diff --git a/.gitignore b/.gitignore index 4253c641f..eebf51cab 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ object_template_crc_string_table.tab -**/.idea/*.* - +**/.idea +*.iml diff --git a/sku.0/sys.server/compiled/game/datatables/spawning/restuss_event/invasion_data.tab b/sku.0/sys.server/compiled/game/datatables/spawning/restuss_event/invasion_data.tab index 637df8f7c..1879c3bea 100755 --- a/sku.0/sys.server/compiled/game/datatables/spawning/restuss_event/invasion_data.tab +++ b/sku.0/sys.server/compiled/game/datatables/spawning/restuss_event/invasion_data.tab @@ -107,7 +107,7 @@ clientfx:pt_restuss_explosion.prt:forced_visability-1000:10 3604 160.1 0 168.5 clientfx:restuss_event_city_destruction.cef:forced_visability-1000:10 3604 0 0 0 string:kill_effect=restriction_npc-range_300 clientfx:restuss_event_city_destruction.cef:forced_visability-1000:10 3601 0 0 0 clientfx:restuss_event_city_explosion_personnel.cef:player_visability-500 3602 0 0 0 -clientfx:rebel_transport_touch_and_go.prt:focred_visability-300 45 -429 -3 118 0 +clientfx:rebel_transport_touch_and_go.prt:forced_visability-300 45 -429 -3 118 0 restuss_rebel_mandalorian 55 -417 -3 120 90 patrol_once int:path=1 restuss_rebel_commando 55 -420 -3 121 90 patrol_once int:path=1 restuss_rebel_commando 55 -423 -3 122 90 patrol_once int:path=1 @@ -122,7 +122,7 @@ restuss_rebel_commando 55 -426 -3 111 90 patrol_once int:path=0 restuss_rebel_commando 55 -429 -3 112 90 patrol_once int:path=0 restuss_rebel_commando 55 -432 -3 113 90 patrol_once int:path=0 restuss_rebel_commando 55 -435 -3 114 90 patrol_once int:path=0 -clientfx:rebel_transport_touch_and_go.prt:focred_visability-300 80 -429 -3 198 0 +clientfx:rebel_transport_touch_and_go.prt:forced_visability-300 80 -429 -3 198 0 restuss_rebel_mandalorian 90 -417 -3 200 90 patrol_once int:path=1 restuss_rebel_commando 90 -420 -3 201 90 patrol_once int:path=1 restuss_rebel_commando 90 -423 -3 202 90 patrol_once int:path=1 @@ -181,7 +181,7 @@ restuss_stormtrooper 40 571 -0.3 -57.1 -90 patrol_once int:path=4 restuss_stormtrooper 40 575 -0.9 -57.1 -90 patrol_once int:path=4 restuss_stormtrooper 40 579 -0.3 -57.1 -90 patrol_once int:path=4 restuss_stormtrooper 40 583 -0.3 -57.1 -90 patrol_once int:path=4 -clientfx:rebel_transport_touch_and_go.prt:focred_visability-300 rebel_lander -429 -3.5 158 0 +clientfx:rebel_transport_touch_and_go.prt:forced_visability-300 rebel_lander -429 -3.5 158 0 restuss_rebel_mandalorian rebel_reinforcement -417 -3.5 160 90 patrol_once int:path=1 restuss_rebel_commando rebel_reinforcement -420 -3.5 161 90 patrol_once int:path=1 restuss_rebel_commando rebel_reinforcement -423 -3.5 162 90 patrol_once int:path=1 @@ -196,7 +196,7 @@ restuss_rebel_commando rebel_reinforcement -426 -3.5 151 90 patrol_once int:pa restuss_rebel_commando rebel_reinforcement -429 -3.5 152 90 patrol_once int:path=0 restuss_rebel_commando rebel_reinforcement -432 -3.5 153 90 patrol_once int:path=0 restuss_rebel_commando rebel_reinforcement -435 -3.5 154 90 patrol_once int:path=0 -clientfx:rebel_transport_touch_and_go.prt:focred_visability-300 rebel_lander -429 -3 118 0 +clientfx:rebel_transport_touch_and_go.prt:forced_visability-300 rebel_lander -429 -3 118 0 restuss_rebel_mandalorian rebel_reinforcement -417 -3 120 90 patrol_once int:path=1 restuss_rebel_commando rebel_reinforcement -420 -3 121 90 patrol_once int:path=1 restuss_rebel_commando rebel_reinforcement -423 -3 122 90 patrol_once int:path=1 @@ -211,7 +211,7 @@ restuss_rebel_commando rebel_reinforcement -426 -3 111 90 patrol_once int:path restuss_rebel_commando rebel_reinforcement -429 -3 112 90 patrol_once int:path=0 restuss_rebel_commando rebel_reinforcement -432 -3 113 90 patrol_once int:path=0 restuss_rebel_commando rebel_reinforcement -435 -3 114 90 patrol_once int:path=0 -clientfx:rebel_transport_touch_and_go.prt:focred_visability-300 rebel_lander -429 -3 198 0 +clientfx:rebel_transport_touch_and_go.prt:forced_visability-300 rebel_lander -429 -3 198 0 restuss_rebel_mandalorian rebel_reinforcement -417 -3 200 90 patrol_once int:path=1 restuss_rebel_commando rebel_reinforcement -420 -3 201 90 patrol_once int:path=1 restuss_rebel_commando rebel_reinforcement -423 -3 202 90 patrol_once int:path=1 diff --git a/sku.0/sys.server/compiled/game/game.iml b/sku.0/sys.server/compiled/game/game.iml deleted file mode 100755 index 1de981c38..000000000 --- a/sku.0/sys.server/compiled/game/game.iml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/sku.0/sys.server/compiled/game/script/gm/cmd.java b/sku.0/sys.server/compiled/game/script/gm/cmd.java index aad7e0966..f89221d5e 100755 --- a/sku.0/sys.server/compiled/game/script/gm/cmd.java +++ b/sku.0/sys.server/compiled/game/script/gm/cmd.java @@ -3819,56 +3819,47 @@ public class cmd extends script.base_script } public int cmdCompleteRestussStageOne(obj_id self, obj_id target, String params, float defaultTime) throws InterruptedException { - obj_id[] objects = getAllObjectsWithObjVar(getLocation(self), 200.0f, "element"); - if (objects == null || objects.length == 0) + obj_id[] spawnedItems = getAllObjectsWithObjVar(getLocation(self), 200.0f, "element"); + if (spawnedItems == null || spawnedItems.length == 0) { return SCRIPT_CONTINUE; } - for (int i = 0; i < objects.length; i++) - { - if (!hasObjVar(objects[i], "element")) - { + for (obj_id spawnedItem : spawnedItems) { + if (!hasObjVar(spawnedItem, "element")) { continue; } - String element = getStringObjVar(objects[i], "element"); - if (!element.startsWith("ph1")) - { + String element = getStringObjVar(spawnedItem, "element"); + if (!element.startsWith("ph1")) { continue; } - if (element.equals("ph1_restuss_master")) - { + if (element.equals("ph1_restuss_master")) { continue; } - if (element.indexOf("wall") > -1 || element.indexOf("medic") > -1) - { + if (element.contains("wall") || element.contains("medic")) { continue; } - if (element.indexOf("baracks") > -1) - { - messageTo(objects[i], "incrimentPhase", null, 0, false); - messageTo(objects[i], "incrimentPhase", null, 20, false); - messageTo(objects[i], "incrimentPhase", null, 40, false); + if (element.contains("baracks")) { + messageTo(spawnedItem, "incrimentPhase", null, 0, false); + messageTo(spawnedItem, "incrimentPhase", null, 20, false); + messageTo(spawnedItem, "incrimentPhase", null, 40, false); continue; } - if (element.indexOf("headq") > -1) - { - messageTo(objects[i], "incrimentPhase", null, 5, false); - messageTo(objects[i], "incrimentPhase", null, 25, false); - messageTo(objects[i], "incrimentPhase", null, 45, false); + if (element.contains("headq")) { + messageTo(spawnedItem, "incrimentPhase", null, 5, false); + messageTo(spawnedItem, "incrimentPhase", null, 25, false); + messageTo(spawnedItem, "incrimentPhase", null, 45, false); continue; } - if (element.indexOf("commu") > -1) - { - messageTo(objects[i], "incrimentPhase", null, 10, false); - messageTo(objects[i], "incrimentPhase", null, 30, false); - messageTo(objects[i], "incrimentPhase", null, 50, false); + if (element.contains("commu")) { + messageTo(spawnedItem, "incrimentPhase", null, 10, false); + messageTo(spawnedItem, "incrimentPhase", null, 30, false); + messageTo(spawnedItem, "incrimentPhase", null, 50, false); continue; } - if (element.indexOf("logis") > -1) - { - messageTo(objects[i], "incrimentPhase", null, 15, false); - messageTo(objects[i], "incrimentPhase", null, 35, false); - messageTo(objects[i], "incrimentPhase", null, 55, false); + if (element.contains("logis")) { + messageTo(spawnedItem, "incrimentPhase", null, 15, false); + messageTo(spawnedItem, "incrimentPhase", null, 35, false); + messageTo(spawnedItem, "incrimentPhase", null, 55, false); continue; } } diff --git a/sku.0/sys.server/compiled/game/script/theme_park/controller_initialize.java b/sku.0/sys.server/compiled/game/script/theme_park/controller_initialize.java index f44e5e9b2..ca4391d28 100755 --- a/sku.0/sys.server/compiled/game/script/theme_park/controller_initialize.java +++ b/sku.0/sys.server/compiled/game/script/theme_park/controller_initialize.java @@ -40,7 +40,8 @@ public class controller_initialize extends script.base_script public void createController(obj_id self) throws InterruptedException { obj_id object = createObject(CONTROLLER, getLocation(self)); - persistObject(object); + // why are we persisting?? + // persistObject(object); String objVarString = null; if (hasObjVar(self, "objVarString")) { @@ -77,6 +78,7 @@ public class controller_initialize extends script.base_script { return; } + setObjVar(newObject, "spawnedBy", getSelf()); for (int i = 0; i < parse.length; i++) { String[] typeDataSplit = split(parse[i], ':'); diff --git a/sku.0/sys.server/compiled/game/script/theme_park/npc_base_builder.java b/sku.0/sys.server/compiled/game/script/theme_park/npc_base_builder.java index 6987b2a21..6d90bd79a 100755 --- a/sku.0/sys.server/compiled/game/script/theme_park/npc_base_builder.java +++ b/sku.0/sys.server/compiled/game/script/theme_park/npc_base_builder.java @@ -147,8 +147,13 @@ public class npc_base_builder extends script.base_script for (int i = 0; i < length; i++) { dictionary data = dataTableGetRow(dataTable, i); - String toSpawn = data.getString("object"); String spawnPhase = data.getString("phase"); + if (!validatePhase(phase, spawnPhase) && i != lineNumber) + { + continue; + } + + String toSpawn = data.getString("object"); int locationType = data.getInt("location_type"); float locX = data.getFloat("x_offset"); float locY = data.getFloat("y_offset"); @@ -158,10 +163,6 @@ public class npc_base_builder extends script.base_script String scriptString = data.getString("script"); String objvarString = data.getString("objvar"); String respawn = data.getString("respawn"); - if (!validatePhase(phase, spawnPhase) && i != lineNumber) - { - continue; - } obj_id newObject = null; if (!cell.equals("world")) { @@ -350,12 +351,10 @@ public class npc_base_builder extends script.base_script { setObjVar(self, CURRENT_PHASE, 1); } - String dataTable = getStringObjVar(self, SPAWN_DATATABLE); if (hasObjVar(self, SPAWN_LIST)) { cleanupChildren(self); } - int spawnPhase = getCurrentPhase(self); messageTo(self, "initializePhase", trial.getSessionDict(self), 1.0f, false); } public boolean canIncrimentPhase(obj_id self) throws InterruptedException @@ -403,7 +402,15 @@ public class npc_base_builder extends script.base_script { if (!hasObjVar(self, CURRENT_PHASE)) { - setObjVar(self, CURRENT_PHASE, 0); + String restussEvent = getConfigSetting("EventTeam", "restussEvent"); + + if(restussEvent == null || (!restussEvent.equals("1") && !restussEvent.equals("true"))) { + // event is not on so start at beginning phase + setObjVar(self, CURRENT_PHASE, 0); + } else { + // event is on so move to final phase + setObjVar(self, CURRENT_PHASE, 2); + } } return getIntObjVar(self, CURRENT_PHASE); } diff --git a/sku.0/sys.server/compiled/game/script/theme_park/restuss_event/pvp_region.java b/sku.0/sys.server/compiled/game/script/theme_park/restuss_event/pvp_region.java index 693fa0675..2a3a613eb 100755 --- a/sku.0/sys.server/compiled/game/script/theme_park/restuss_event/pvp_region.java +++ b/sku.0/sys.server/compiled/game/script/theme_park/restuss_event/pvp_region.java @@ -28,20 +28,34 @@ public class pvp_region extends script.base_script { removeObjVar(self, trial.PARENT); } - persistObject(self); - createCircleRegion(getLocation(self), 400, restuss_event.PVP_REGION_NAME, regions.PVP_REGION_TYPE_NORMAL, regions.BUILD_FALSE, regions.MUNI_TRUE, regions.GEO_CITY, 0, 0, regions.SPAWN_FALSE, regions.MISSION_NONE, false, true); + if(getRegion("rori", restuss_event.PVP_REGION_NAME) == null) { + persistObject(self); + createCircleRegion( + getLocation(self), + 400, + restuss_event.PVP_REGION_NAME, + regions.PVP_REGION_TYPE_NORMAL, + regions.BUILD_FALSE, + regions.MUNI_TRUE, + regions.GEO_CITY, + 0, + 0, + regions.SPAWN_FALSE, + regions.MISSION_NONE, + false, + true + ); + } obj_id[] players = getPlayerCreaturesInRange(getLocation(self), 420.0f); if (players == null || players.length == 0) { return; } - for (int i = 0; i < players.length; i++) - { - if (factions.isImperial(players[i]) || factions.isRebel(players[i])) - { + for (obj_id player : players) { + if (factions.isImperial(player) || factions.isRebel(player)) { continue; } - warpPlayer(players[i], "rori", 5305, 80, 6188, null, 0, 0, 0); + warpPlayer(player, "rori", 5305, 80, 6188, null, 0, 0, 0); } } public int OnDestroy(obj_id self) throws InterruptedException diff --git a/sku.0/sys.server/compiled/game/script/theme_park/restuss_event/restuss_event_manager.java b/sku.0/sys.server/compiled/game/script/theme_park/restuss_event/restuss_event_manager.java index 78b7b2406..ea452de5c 100755 --- a/sku.0/sys.server/compiled/game/script/theme_park/restuss_event/restuss_event_manager.java +++ b/sku.0/sys.server/compiled/game/script/theme_park/restuss_event/restuss_event_manager.java @@ -6,6 +6,7 @@ import script.obj_id; public class restuss_event_manager extends script.base_script { + public restuss_event_manager() { } @@ -45,61 +46,48 @@ public class restuss_event_manager extends script.base_script "reb_wall" }; obj_id[] elementList = new obj_id[12]; - for (int i = 0; i < dungeon_data.length; i++) - { - String name = getStringObjVar(dungeon_data[i], "element"); - if (name.indexOf(elementName[IMP_BAR]) > -1) - { - elementList[IMP_BAR] = dungeon_data[i]; + for (obj_id dungeon_datum : dungeon_data) { + String name = getStringObjVar(dungeon_datum, "element"); + if (name.contains(elementName[IMP_BAR])) { + elementList[IMP_BAR] = dungeon_datum; } - if (name.indexOf(elementName[IMP_HQ]) > -1) - { - elementList[IMP_HQ] = dungeon_data[i]; + if (name.contains(elementName[IMP_HQ])) { + elementList[IMP_HQ] = dungeon_datum; } - if (name.indexOf(elementName[IMP_COMM]) > -1) - { - elementList[IMP_COMM] = dungeon_data[i]; + if (name.contains(elementName[IMP_COMM])) { + elementList[IMP_COMM] = dungeon_datum; } - if (name.indexOf(elementName[IMP_LOG]) > -1) - { - elementList[IMP_LOG] = dungeon_data[i]; + if (name.contains(elementName[IMP_LOG])) { + elementList[IMP_LOG] = dungeon_datum; } - if (name.indexOf(elementName[IMP_MED]) > -1) - { - elementList[IMP_MED] = dungeon_data[i]; + if (name.contains(elementName[IMP_MED])) { + elementList[IMP_MED] = dungeon_datum; } - if (name.indexOf(elementName[IMP_WALL]) > -1) - { - elementList[IMP_WALL] = dungeon_data[i]; + if (name.contains(elementName[IMP_WALL])) { + elementList[IMP_WALL] = dungeon_datum; } - if (name.indexOf(elementName[REB_BAR]) > -1) - { - elementList[REB_BAR] = dungeon_data[i]; + if (name.contains(elementName[REB_BAR])) { + elementList[REB_BAR] = dungeon_datum; } - if (name.indexOf(elementName[REB_HQ]) > -1) - { - elementList[REB_HQ] = dungeon_data[i]; + if (name.contains(elementName[REB_HQ])) { + elementList[REB_HQ] = dungeon_datum; } - if (name.indexOf(elementName[REB_COMM]) > -1) - { - elementList[REB_COMM] = dungeon_data[i]; + if (name.contains(elementName[REB_COMM])) { + elementList[REB_COMM] = dungeon_datum; } - if (name.indexOf(elementName[REB_LOG]) > -1) - { - elementList[REB_LOG] = dungeon_data[i]; + if (name.contains(elementName[REB_LOG])) { + elementList[REB_LOG] = dungeon_datum; } - if (name.indexOf(elementName[REB_MED]) > -1) - { - elementList[REB_MED] = dungeon_data[i]; + if (name.contains(elementName[REB_MED])) { + elementList[REB_MED] = dungeon_datum; } - if (name.indexOf(elementName[REB_WALL]) > -1) - { - elementList[REB_WALL] = dungeon_data[i]; + if (name.contains(elementName[REB_WALL])) { + elementList[REB_WALL] = dungeon_datum; } } int sum_imp_phase = 0; int sum_reb_phase = 0; - if ((getStringObjVar(self, "element")).indexOf("imp") > -1) + if ((getStringObjVar(self, "element")).contains("imp")) { int imp_bar_phase = restuss_event.getPhase(elementList[IMP_BAR]); int imp_hq_phase = restuss_event.getPhase(elementList[IMP_HQ]); diff --git a/sku.0/sys.server/compiled/game/script/theme_park/restuss_event/restuss_event_watcher.java b/sku.0/sys.server/compiled/game/script/theme_park/restuss_event/restuss_event_watcher.java index ca09c260b..025d91174 100755 --- a/sku.0/sys.server/compiled/game/script/theme_park/restuss_event/restuss_event_watcher.java +++ b/sku.0/sys.server/compiled/game/script/theme_park/restuss_event/restuss_event_watcher.java @@ -2,12 +2,21 @@ package script.theme_park.restuss_event; import script.dictionary; import script.obj_id; +import script.library.utils; public class restuss_event_watcher extends script.base_script { public restuss_event_watcher() { } + public int OnAttach(obj_id self) throws InterruptedException { + if(automationEnabled()) completeStageOne(self, null); + return SCRIPT_CONTINUE; + } + public int OnInitialize(obj_id self) throws InterruptedException { + if(automationEnabled()) completeStageOne(self, null); + return SCRIPT_CONTINUE; + } public int incrimentPhase(obj_id self, dictionary params) throws InterruptedException { obj_id controller = null; @@ -20,11 +29,46 @@ public class restuss_event_watcher extends script.base_script controller = getFirstObjectWithScript(getLocation(self), 200.0f, "theme_park.restuss_event.restuss_event_manager"); } String element = getStringObjVar(self, "element"); - if (element.indexOf("wall") > -1 || element.indexOf("medi") > -1) + if (element.contains("wall") || element.contains("medi")) { return SCRIPT_CONTINUE; } messageTo(controller, "stepIncrease", null, 1, false); return SCRIPT_CONTINUE; } + private boolean automationEnabled() { + String restussEvent = getConfigSetting("EventTeam", "restussEvent"); + if (restussEvent == null || (!restussEvent.equals("1") && !restussEvent.equals("true"))) { + return false; + } + return true; + } + public int completeStageOne(obj_id self, dictionary params) throws InterruptedException{ + if(utils.hasScriptVar(self, "processed")) return SCRIPT_CONTINUE; + utils.setScriptVar(self, "processed", 1); + + String element = getStringObjVar(self, "element"); + LOG("events", "Restuss Event - Completing Stage One (factional base) for element \"" + element + "\"."); + if (element.contains("baracks")) { + messageTo(self, "incrimentPhase", null, 0, false); + messageTo(self, "incrimentPhase", null, 20, false); + messageTo(self, "incrimentPhase", null, 40, false); + } + else if (element.contains("headq")) { + messageTo(self, "incrimentPhase", null, 5, false); + messageTo(self, "incrimentPhase", null, 25, false); + messageTo(self, "incrimentPhase", null, 45, false); + } + else if (element.contains("commu")) { + messageTo(self, "incrimentPhase", null, 10, false); + messageTo(self, "incrimentPhase", null, 30, false); + messageTo(self, "incrimentPhase", null, 50, false); + } + else if (element.contains("logis")) { + messageTo(self, "incrimentPhase", null, 15, false); + messageTo(self, "incrimentPhase", null, 35, false); + messageTo(self, "incrimentPhase", null, 55, false); + } + return SCRIPT_CONTINUE; + } } diff --git a/sku.0/sys.server/compiled/game/script/theme_park/restuss_event/stage_one_watcher.java b/sku.0/sys.server/compiled/game/script/theme_park/restuss_event/stage_one_watcher.java index c897c9477..b4cab1e0e 100755 --- a/sku.0/sys.server/compiled/game/script/theme_park/restuss_event/stage_one_watcher.java +++ b/sku.0/sys.server/compiled/game/script/theme_park/restuss_event/stage_one_watcher.java @@ -6,6 +6,8 @@ import script.obj_id; public class stage_one_watcher extends script.base_script { + private boolean evaluating = false; + public stage_one_watcher() { } @@ -85,23 +87,18 @@ public class stage_one_watcher extends script.base_script } public int OnClusterWideDataResponse(obj_id self, String manage_name, String name, int request_id, String[] element_name_list, dictionary[] dungeon_data, int lock_key) throws InterruptedException { - if (dungeon_data == null || dungeon_data.length == 0) - { - LOG("doLogging", "Dungeon data was null or empty"); + if (dungeon_data == null || dungeon_data.length == 0) { + LOG("events", "Dungeon data was null or empty"); return SCRIPT_CONTINUE; } - if (hasObjVar(self, "sent_signal_one") && hasObjVar(self, "sent_signal_two")) - { - for (int i = 0; i < dungeon_data.length; i++) - { + if (hasObjVar(self, "sent_signal_one") && hasObjVar(self, "sent_signal_two")) { + for (int i = 0; i < dungeon_data.length; i++) { obj_id crier_id = dungeon_data[i].getObjId("dungeon_id"); messageTo(crier_id, "beginMessage", null, 0, false); } } - if (hasObjVar(self, "sent_signal_one") && !hasObjVar(self, "sent_signal_two")) - { - for (int i = 0; i < dungeon_data.length; i++) - { + if (hasObjVar(self, "sent_signal_one") && !hasObjVar(self, "sent_signal_two")) { + for (int i = 0; i < dungeon_data.length; i++) { obj_id crier_id = dungeon_data[i].getObjId("dungeon_id"); messageTo(crier_id, "beginSpawn", null, 0, false); } diff --git a/sku.0/sys.server/compiled/game/script/theme_park/restuss_event/stage_two_controller.java b/sku.0/sys.server/compiled/game/script/theme_park/restuss_event/stage_two_controller.java index 52a4ebf4e..853920e7f 100755 --- a/sku.0/sys.server/compiled/game/script/theme_park/restuss_event/stage_two_controller.java +++ b/sku.0/sys.server/compiled/game/script/theme_park/restuss_event/stage_two_controller.java @@ -31,11 +31,47 @@ public class stage_two_controller extends script.base_script public static final boolean LOGGING = true; public int beginSpawning(obj_id self, dictionary params) throws InterruptedException { - clearEventArea(self); - dictionary dict = trial.getSessionDict(self); - - dict.put("stage", 1); - messageTo(self, "spawnNextStage", dict, 0, false); + setObjVar(self, "eventStarted", 1); + String restussEvent = getConfigSetting("EventTeam", "restussEvent"); + if(restussEvent != null && restussEvent.equals("1") || restussEvent.equals("true")){ + LOG("events", "Restuss Event - Event is on."); + String phaseVal = getConfigSetting("EventTeam", "restussPhase"); + if(phaseVal != null && !phaseVal.equals("")){ + int phase = Integer.parseInt(phaseVal); + if(phase > 2) phase = 2; + if(phase < 0) phase = 0; + LOG("events", "Restuss Event - Config set to put Restuss into phase " + phaseVal); + String progressionOn = getConfigSetting("EventTeam", "restussProgressionOn"); + if(phase == 1){ + // Check if the user wants to progress through stage one or not. If so, start the cycle. + if(progressionOn != null && !progressionOn.equals("false") || !progressionOn.equals("0")) { + dictionary dict = trial.getSessionDict(self); + dict.put("stage", 3608); + messageTo(self, "spawnNextStage", dict, 0, false); + } + } + } else { + doMessageTo("messageTo:broadcastMessage:10:incrimentPhase:0"); + doMessageTo("messageTo:broadcastMessage:10:incrimentPhase:10"); + doMessageTo("messageTo:broadcastMessage:10:makePvPArea:10"); + } + } else { + clearEventArea(self); + dictionary dict = trial.getSessionDict(self); + dict.put("stage", 1); + messageTo(self, "spawnNextStage", dict, 0, false); + } + return SCRIPT_CONTINUE; + } + public int OnHearSpeech(obj_id self, obj_id speaker, String text) throws InterruptedException { + if (!isGod(speaker)) { + return SCRIPT_CONTINUE; + } + if (text.toLowerCase().equals("start restuss event") && getIntObjVar(self, "eventStarted") != 1) { + LOG("events", "Restuss Event - Manually starting the Restuss Event."); + startRestussBaseSpawners(self); + startRestussCitySpawner(self); + } return SCRIPT_CONTINUE; } public int cleanupEvent(obj_id self, dictionary params) throws InterruptedException @@ -67,6 +103,7 @@ public class stage_two_controller extends script.base_script public int spawnNextStage(obj_id self, dictionary params) throws InterruptedException { int stage = params.getInt("stage"); + LOG("events", "Restuss Event - Spawning for Stage " + stage + "."); if (!trial.verifySession(self, params)) { return SCRIPT_CONTINUE; @@ -81,11 +118,9 @@ public class stage_two_controller extends script.base_script boolean moreStages = false; int nextStage = (int)Float.POSITIVE_INFINITY; float timeToNext = 0; - for (int i = 0; i < allStages.length; i++) - { - if (allStages[i] > stage && allStages[i] < nextStage) - { - nextStage = allStages[i]; + for (int eventStage : allStages) { + if (eventStage > stage && eventStage < nextStage) { + nextStage = eventStage; timeToNext = nextStage - stage; moreStages = true; } @@ -112,7 +147,7 @@ public class stage_two_controller extends script.base_script int rows = dataTableGetNumRows(restuss_event.STAGE_TWO_DATA); if (rows == 0) { - doLogging("spawnActors", "Your table has no rows: " + restuss_event.STAGE_TWO_DATA); + doLogging("events", "Your table has no rows: " + restuss_event.STAGE_TWO_DATA); return; } if (stage == 2) @@ -203,7 +238,7 @@ public class stage_two_controller extends script.base_script trial.setInterest(newObject); setSpawnObjVar(newObject, spawnObjVar); attachSpawnScripts(newObject, spawnScript, objType); - if (object.indexOf("patrol_waypoint.iff") > -1) + if (object.contains("patrol_waypoint.iff")) { addToWaypointData(controller, newObject); } @@ -368,12 +403,16 @@ public class stage_two_controller extends script.base_script if (completeParse[1].startsWith("broadcastMessage")) { float range = utils.stringToFloat(completeParse[2]); + float delay = 0; + if(completeParse.length == 5) { + delay = utils.stringToFloat(completeParse[4]); + } obj_id[] objects = getObjectsInRange(getLocation(getSelf()), range); if (objects == null || objects.length == 0) { return; } - utils.messageTo(objects, completeParse[3], null, 0, false); + utils.messageTo(objects, completeParse[3], null, delay, false); } } public void doPlayMusicInArea(String message) throws InterruptedException @@ -417,14 +456,40 @@ public class stage_two_controller extends script.base_script dungeon_info.put("position_y", loc.y); dungeon_info.put("position_z", loc.z); replaceClusterWideData(manage_name, name, dungeon_info, true, lock_key); + + String restussEvent = getConfigSetting("EventTeam", "restussEvent"); + + if(restussEvent == null || (!restussEvent.equals("1") && !restussEvent.equals("true"))) { + LOG("events", "Restuss Event - Event is turned off."); + } else { + startRestussCitySpawner(self); + } + releaseClusterWideDataLock(manage_name, lock_key); return SCRIPT_CONTINUE; } + private void startRestussBaseSpawners(obj_id self) { + obj_id[] baseControllers = getAllObjectsWithScript(getLocation(self), 1000.0f, "theme_park.restuss_event.restuss_event_watcher"); + for(obj_id baseController : baseControllers){ + LOG("events", "Restuss Event - Telling Base Object (" + getName(baseController) + ":" + baseController.toString() + ") to progress through base building phase."); + messageTo(baseController, "completeStageOne", null, 0.0f, false); + } + } + private void startRestussCitySpawner(obj_id self) { + LOG("events", "Restuss Event - Event is turned on - Starting Stage Two."); + messageTo(self, "beginSpawning", null, 1.0f, false); + } + public int makePvPArea(obj_id self, dictionary params) throws InterruptedException { + LOG("events","Restuss Event - Restuss Stage Two kicked off - creating PvP Zone."); + attachScript(self, "theme_park.restuss_event.pvp_region"); + LOG("events", "Restuss Event - Restuss PVP area engaged - Event Progression Complete."); + return SCRIPT_CONTINUE; + } public void doLogging(String section, String message) throws InterruptedException { if (LOGGING) { - LOG("doLogging/stage_two_controller/" + section, message); + LOG("events", section + ": " + message); } } }