diff --git a/client/src/main/resources/lang/locale.properties b/client/src/main/resources/lang/locale.properties index b10006e..191e75b 100644 --- a/client/src/main/resources/lang/locale.properties +++ b/client/src/main/resources/lang/locale.properties @@ -68,9 +68,11 @@ power.HUDSON=Zachary Hudson power.TORVAL=Zemina Torval power.NONE=None -power.states.CONTROL=Controlling +power.states.HEADQUARTERS=Headquarters +power.states.CONTROL=Controlled power.states.EXPLOITED=Exploited power.states.EXPANSION=Expansion +power.states.CONTESTED=Contested power.states.NONE=None item.group.chemicals=Chemicals diff --git a/client/src/main/resources/lang/locale_ru_RU_FULL.properties b/client/src/main/resources/lang/locale_ru_RU_FULL.properties index c705c99..a55cf70 100644 --- a/client/src/main/resources/lang/locale_ru_RU_FULL.properties +++ b/client/src/main/resources/lang/locale_ru_RU_FULL.properties @@ -70,9 +70,11 @@ power.HUDSON=Zachary Hudson power.TORVAL=Zemina Torval power.NONE=\u041D\u0435\u0442 +power.states.HEADQUARTERS=\u0428\u0442\u0430\u0431-\u043A\u0432\u0430\u0440\u0442\u0438\u0440\u0430 power.states.CONTROL=\u041A\u043E\u043D\u0442\u0440\u043E\u043B\u0438\u0440\u0443\u0435\u0442\u0441\u044F power.states.EXPLOITED=\u042D\u043A\u0441\u043F\u043B\u0443\u0430\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044F power.states.EXPANSION=\u042D\u043A\u0441\u043F\u0430\u043D\u0441\u0438\u044F +power.states.CONTESTED=\u041E\u0441\u043F\u0430\u0440\u0438\u0432\u0430\u0435\u0442\u0441\u044F power.states.NONE=\u041D\u0435\u0442 item.group.chemicals=\u0425\u0438\u043C\u0438\u043A\u0430\u0442\u044B diff --git a/core/src/main/java/ru/trader/core/POWER.java b/core/src/main/java/ru/trader/core/POWER.java index 714472b..7cc3374 100644 --- a/core/src/main/java/ru/trader/core/POWER.java +++ b/core/src/main/java/ru/trader/core/POWER.java @@ -6,7 +6,7 @@ public enum POWER { // Control Systems: Imperial Slaves banned @Override public boolean isIllegal(FACTION faction, Item item, POWER_STATE state) { - if (state == POWER_STATE.CONTROL || state == POWER_STATE.EXPLOITED){ + if (state != null && (state.isControl() || state.isExploited())){ String itemId = item.getName(); return itemId != null && IMPERIAL_SLAVES.equals(itemId); } @@ -17,7 +17,7 @@ public enum POWER { // Control Systems: All weapons/slaves/narcotics/medicals legalised @Override public boolean isLegal(FACTION faction, Item item, POWER_STATE state) { - if (state == POWER_STATE.CONTROL){ + if (state != null && state.isControl()){ String groupId = item.getGroup() != null ? item.getGroup().getName() : null; return groupId != null && (WEAPONS_GRP.equals(groupId) || SLAVES_GRP.equals(groupId) || NARCOTICS_GRP.equals(groupId) || MEDICINE_GRP.equals(groupId)); } @@ -29,7 +29,7 @@ public enum POWER { // Control Systems: Imperial Slaves legalised @Override public boolean isLegal(FACTION faction, Item item, POWER_STATE state) { - if (state == POWER_STATE.CONTROL){ + if (state != null && state.isControl()){ String itemId = item.getName(); return itemId != null && IMPERIAL_SLAVES.equals(itemId); } @@ -43,11 +43,11 @@ public enum POWER { // Control Systems: Imperial Slaves banned @Override public boolean isIllegal(FACTION faction, Item item, POWER_STATE state) { - if (state == POWER_STATE.CONTROL){ + if (state != null && state.isControl()){ String itemId = item.getName(); return itemId != null && IMPERIAL_SLAVES.equals(itemId); } else - if (state == POWER_STATE.EXPLOITED){ + if (state != null && state.isExploited()){ String itemId = item.getName(); return itemId != null && IMPERIAL_SLAVES.equals(itemId) && (faction != null && faction != FACTION.EMPIRE); } @@ -60,7 +60,7 @@ public enum POWER { // Control Systems: All Slaves, Narcotics and non-basic/agri medicines banned @Override public boolean isIllegal(FACTION faction, Item item, POWER_STATE state) { - if (state == POWER_STATE.CONTROL || state == POWER_STATE.EXPLOITED){ + if (state != null && (state.isControl() || state.isExploited())){ String groupId = item.getGroup() != null ? item.getGroup().getName() : null; String itemId = item.getName(); return groupId != null && (SLAVES_GRP.equals(groupId) || NARCOTICS_GRP.equals(groupId) @@ -74,7 +74,7 @@ public enum POWER { // Control Systems: Imperial Slaves banned @Override public boolean isIllegal(FACTION faction, Item item, POWER_STATE state) { - if (state == POWER_STATE.CONTROL){ + if (state != null && state.isControl()){ String itemId = item.getName(); return itemId != null && IMPERIAL_SLAVES.equals(itemId); } @@ -85,7 +85,7 @@ public enum POWER { // Control Systems: Imperial Slaves legalised @Override public boolean isLegal(FACTION faction, Item item, POWER_STATE state) { - if (state == POWER_STATE.CONTROL){ + if (state != null && state.isControl()){ String itemId = item.getName(); return itemId != null && IMPERIAL_SLAVES.equals(itemId); } diff --git a/core/src/main/java/ru/trader/core/POWER_STATE.java b/core/src/main/java/ru/trader/core/POWER_STATE.java index dc7bcda..cb9b2ef 100644 --- a/core/src/main/java/ru/trader/core/POWER_STATE.java +++ b/core/src/main/java/ru/trader/core/POWER_STATE.java @@ -1,5 +1,13 @@ package ru.trader.core; public enum POWER_STATE { - CONTROL, EXPLOITED, EXPANSION, NONE + CONTROL, EXPLOITED, EXPANSION, NONE, CONTESTED, HEADQUARTERS; + + boolean isControl(){ + return this == CONTROL || this == HEADQUARTERS; + } + + boolean isExploited(){ + return this == EXPLOITED; + } }