diff --git a/sku.0/sys.server/compiled/game/script/creature/dna_harvest.java b/sku.0/sys.server/compiled/game/script/creature/dna_harvest.java old mode 100644 new mode 100755 index 5d835ab1f..d1092afc2 --- a/sku.0/sys.server/compiled/game/script/creature/dna_harvest.java +++ b/sku.0/sys.server/compiled/game/script/creature/dna_harvest.java @@ -1,14 +1,9 @@ package script.creature; -import script.*; -import script.base_class.*; -import script.combat_engine.*; -import java.util.Arrays; -import java.util.Hashtable; -import java.util.Vector; -import script.base_script; - import script.library.bio_engineer; +import script.menu_info; +import script.menu_info_types; +import script.obj_id; public class dna_harvest extends script.base_script { @@ -19,7 +14,7 @@ public class dna_harvest extends script.base_script { if (getSkillStatMod(player, "dna_harvesting") > 0) { - int subHarvestDNA = mi.addRootMenu(menu_info_types.SERVER_HARVEST_CORPSE, bio_engineer.SID_HARVEST_DNA); + mi.addRootMenu(menu_info_types.SERVER_HARVEST_CORPSE, bio_engineer.SID_HARVEST_DNA); } return SCRIPT_CONTINUE; } diff --git a/sku.0/sys.server/compiled/game/script/creature/droid_setup.java b/sku.0/sys.server/compiled/game/script/creature/droid_setup.java old mode 100644 new mode 100755 index bf3312110..7a9be1a38 --- a/sku.0/sys.server/compiled/game/script/creature/droid_setup.java +++ b/sku.0/sys.server/compiled/game/script/creature/droid_setup.java @@ -1,14 +1,8 @@ package script.creature; -import script.*; -import script.base_class.*; -import script.combat_engine.*; -import java.util.Arrays; -import java.util.Hashtable; -import java.util.Vector; -import script.base_script; - import script.library.hue; +import script.obj_id; +import script.ranged_int_custom_var; public class droid_setup extends script.base_script { @@ -23,162 +17,56 @@ public class droid_setup extends script.base_script } public void getDroidName(obj_id self) throws InterruptedException { - String type = getName(self); - if (type.equals("mob/creature_names:protocol_droid_3po")) - { - String firstLetter = getLetter(); - int firstNum = rand(0, 9); - setName(self, firstLetter + firstNum + "-P0"); + switch (getName(self)) { + case "mob/creature_names:protocol_droid_3po": + setName(self, getLetter() + rand(0, 9) + "-P0"); + break; + case "mob/creature_names:r2": { + setName(self, "R2-" + getLetter() + rand(0, 9)); + break; + } + case "mob/creature_names:r3": { + setName(self, "R3-" + getLetter() + rand(0, 9)); + break; + } + case "mob/creature_names:r4": { + setName(self, "R4-" + getLetter() + rand(0, 9)); + break; + } + case "mob/creature_names:r5": { + setName(self, "R5-" + getLetter() + rand(0, 9)); + break; + } + case "mob/creature_names:eg6_power_droid": { + setName(self, "E" + getLetter() + "-" + rand(0, 9)); + break; + } + case "mob/creature_names:wed_treadwell": { + setName(self, "WED-" + getLetter() + rand(0, 9)); + break; + } + case "mob/creature_names:le_repair_droid": { + setName(self, "LE-" + getLetter() + getLetter() + rand(0, 9)); + break; + } + case "mob/creature_names:ra7_bug_droid": { + setName(self, "RA7-" + getLetter() + rand(0, 9)); + break; + } } - if (type.equals("mob/creature_names:r2")) - { - String secondLetter = getLetter(); - int secondNum = rand(0, 9); - setName(self, "R2-" + secondLetter + secondNum); - } - if (type.equals("mob/creature_names:r3")) - { - String secondLetter = getLetter(); - int secondNum = rand(0, 9); - setName(self, "R3-" + secondLetter + secondNum); - } - if (type.equals("mob/creature_names:r4")) - { - String secondLetter = getLetter(); - int secondNum = rand(0, 9); - setName(self, "R4-" + secondLetter + secondNum); - } - if (type.equals("mob/creature_names:r5")) - { - String secondLetter = getLetter(); - int secondNum = rand(0, 9); - setName(self, "R5-" + secondLetter + secondNum); - } - if (type.equals("mob/creature_names:eg6_power_droid")) - { - String secondLetter = getLetter(); - int secondNum = rand(0, 9); - setName(self, "E" + secondLetter + "-" + secondNum); - } - if (type.equals("mob/creature_names:wed_treadwell")) - { - String fourthLetter = getLetter(); - int num = rand(0, 9); - setName(self, "WED-" + fourthLetter + num); - } - if (type.equals("mob/creature_names:le_repair_droid")) - { - String thirdLetter = getLetter(); - String fourthLetter = getLetter(); - int num = rand(0, 9); - setName(self, "LE-" + thirdLetter + fourthLetter + num); - } - if (type.equals("mob/creature_names:ra7_bug_droid")) - { - String thirdLetter = getLetter(); - int num = rand(0, 9); - setName(self, "RA7-" + thirdLetter + num); - } - return; } public String getLetter() throws InterruptedException { - int which = rand(1, 26); - String letter = "A"; - switch (which) - { - case 1: - letter = "A"; - break; - case 2: - letter = "B"; - break; - case 3: - letter = "C"; - break; - case 4: - letter = "D"; - break; - case 5: - letter = "E"; - break; - case 6: - letter = "F"; - break; - case 7: - letter = "G"; - break; - case 8: - letter = "H"; - break; - case 9: - letter = "I"; - break; - case 10: - letter = "J"; - break; - case 11: - letter = "K"; - break; - case 12: - letter = "L"; - break; - case 13: - letter = "M"; - break; - case 14: - letter = "N"; - break; - case 15: - letter = "O"; - break; - case 16: - letter = "P"; - break; - case 17: - letter = "Q"; - break; - case 18: - letter = "R"; - break; - case 19: - letter = "S"; - break; - case 20: - letter = "T"; - break; - case 21: - letter = "U"; - break; - case 22: - letter = "V"; - break; - case 23: - letter = "W"; - break; - case 24: - letter = "X"; - break; - case 25: - letter = "Y"; - break; - case 26: - letter = "Z"; - break; - } - return letter; + return "" + ((int)'A' + Math.random() * ((int)'Z' - (int)'A' + 1)); } public void setDroidHue(obj_id self) throws InterruptedException { ranged_int_custom_var[] c = hue.getPalcolorVars(self); if (c != null) { - for (int i = 0; i < c.length; i++) - { - int huevar = rand(0, 63); - c[i].setValue(huevar); + for (ranged_int_custom_var aC : c) { + aC.setValue(rand(0, 63)); } } - return; } } diff --git a/sku.0/sys.server/compiled/game/script/creature/dynamic_enemy.java b/sku.0/sys.server/compiled/game/script/creature/dynamic_enemy.java old mode 100644 new mode 100755 index 2998af729..afb12a91b --- a/sku.0/sys.server/compiled/game/script/creature/dynamic_enemy.java +++ b/sku.0/sys.server/compiled/game/script/creature/dynamic_enemy.java @@ -1,18 +1,11 @@ package script.creature; -import script.*; -import script.base_class.*; -import script.combat_engine.*; -import java.util.Arrays; -import java.util.Hashtable; -import java.util.Vector; -import script.base_script; - +import script.dictionary; import script.library.chat; -import script.library.create; import script.library.groundquests; -import script.library.prose; -import script.ai.ai_combat; +import script.location; +import script.obj_id; +import script.string_id; public class dynamic_enemy extends script.base_script { @@ -72,15 +65,13 @@ public class dynamic_enemy extends script.base_script } faceTo(self, player); messageTo(self, "barkDefeat", null, 1, false); - location body = getLocation(player); - pathTo(self, body); + pathTo(self, getLocation(player)); messageTo(self, "runAwayThenCleanUp", null, 4, false); return SCRIPT_CONTINUE; } public int runAwayThenCleanUp(obj_id self, dictionary params) throws InterruptedException { - location l = groundquests.getRandom2DLocationAroundPlayer(self, 20, 50); - pathTo(self, l); + pathTo(self, groundquests.getRandom2DLocationAroundPlayer(self, 20, 50)); messageTo(self, "clientEffect", null, 6, true); return SCRIPT_CONTINUE; } @@ -96,44 +87,38 @@ public class dynamic_enemy extends script.base_script } public int barkAttack(obj_id self, dictionary params) throws InterruptedException { - obj_id mob = self; if (params == null) { return SCRIPT_CONTINUE; } - else if (!hasObjVar(mob, "phrase_string_file")) + else if (!hasObjVar(self, "phrase_string_file")) { return SCRIPT_OVERRIDE; } - String stringFile = getStringObjVar(mob, "phrase_string_file"); - String attackString = getStringObjVar(mob, "attack_phrase"); + String attackString = getStringObjVar(self, "attack_phrase"); if ((attackString == null) || (attackString.equals(""))) { return SCRIPT_OVERRIDE; } - string_id attack_phrase = new string_id(stringFile, attackString); - chat.chat(mob, chat.CHAT_SHOUT, chat.MOOD_ANGRY, attack_phrase); + chat.chat(self, chat.CHAT_SHOUT, chat.MOOD_ANGRY, new string_id(getStringObjVar(self, "phrase_string_file"), attackString)); return SCRIPT_CONTINUE; } public int barkDefeat(obj_id self, dictionary params) throws InterruptedException { - obj_id mob = self; if (params == null) { return SCRIPT_CONTINUE; } - else if (!hasObjVar(mob, "phrase_string_file")) + else if (!hasObjVar(self, "phrase_string_file")) { return SCRIPT_OVERRIDE; } - String stringFile = getStringObjVar(mob, "phrase_string_file"); - String defeatString = getStringObjVar(mob, "defeat_phrase"); + String defeatString = getStringObjVar(self, "defeat_phrase"); if ((defeatString == null) || (defeatString.equals(""))) { return SCRIPT_OVERRIDE; } - string_id defeat_phrase = new string_id(stringFile, defeatString); - chat.chat(mob, chat.CHAT_SHOUT, chat.MOOD_ANGRY, defeat_phrase); + chat.chat(self, chat.CHAT_SHOUT, chat.MOOD_ANGRY, new string_id(getStringObjVar(self, "phrase_string_file"), defeatString)); return SCRIPT_CONTINUE; } } diff --git a/sku.0/sys.server/compiled/game/script/creature/foraging_enemy.java b/sku.0/sys.server/compiled/game/script/creature/foraging_enemy.java old mode 100644 new mode 100755 index 45ced29bb..c950fdfc1 --- a/sku.0/sys.server/compiled/game/script/creature/foraging_enemy.java +++ b/sku.0/sys.server/compiled/game/script/creature/foraging_enemy.java @@ -1,22 +1,10 @@ package script.creature; import script.*; -import script.base_class.*; -import script.combat_engine.*; -import java.util.Arrays; -import java.util.Hashtable; -import java.util.Vector; -import script.base_script; - -import script.library.ai_lib; import script.library.anims; import script.library.chat; -import script.library.create; -import script.library.group; import script.library.groundquests; import script.library.prose; -import script.library.utils; -import script.ai.ai_combat; public class foraging_enemy extends script.base_script { @@ -67,15 +55,13 @@ public class foraging_enemy extends script.base_script } faceTo(self, player); messageTo(self, "barkDefeat", null, 1, false); - location body = getLocation(player); - pathTo(self, body); + pathTo(self, getLocation(player)); messageTo(self, "runAwayThenCleanUpGuard", null, 4, false); return SCRIPT_CONTINUE; } public int runAwayThenCleanUpGuard(obj_id self, dictionary params) throws InterruptedException { - location l = groundquests.getRandom2DLocationAroundPlayer(self, 20, 50); - pathTo(self, l); + pathTo(self, groundquests.getRandom2DLocationAroundPlayer(self, 20, 50)); messageTo(self, "cleanUpGuard", null, 12, true); return SCRIPT_CONTINUE; } @@ -89,23 +75,12 @@ public class foraging_enemy extends script.base_script startCombat(self, player); return SCRIPT_CONTINUE; } - public boolean isThief(obj_id mob) throws InterruptedException - { - if (!isValidId(mob)) - { + public boolean isThief(obj_id mob) throws InterruptedException { + if (!isValidId(mob)) { return false; } String mobName = getStringObjVar(mob, "creature_type"); - if ((mobName == null) || (mobName.equals(""))) - { - return false; - } - int index = mobName.indexOf("forage_"); - if (index == 0) - { - return true; - } - return false; + return !((mobName == null) || (mobName.equals(""))) && mobName.indexOf("forage_") == 0; } public boolean removeFirstSlotFound(obj_id player) throws InterruptedException { @@ -118,15 +93,13 @@ public class foraging_enemy extends script.base_script return false; } String[] slotsInCollection = getAllCollectionSlotsInCollection(FORAGING_COLLECTION); - for (int i = 0; i < slotsInCollection.length; i++) - { - long collectionSlotValue = getCollectionSlotValue(player, slotsInCollection[i]); - if (collectionSlotValue > 0) - { - modifyCollectionSlotValue(player, slotsInCollection[i], (collectionSlotValue * -1)); + for (String aSlotsInCollection : slotsInCollection) { + long collectionSlotValue = getCollectionSlotValue(player, aSlotsInCollection); + if (collectionSlotValue > 0) { + modifyCollectionSlotValue(player, aSlotsInCollection, (collectionSlotValue * -1)); prose_package pp = new prose_package(); prose.setStringId(pp, SID_STEAL_SLOT); - prose.setTT(pp, new string_id("collection_n", slotsInCollection[i])); + prose.setTT(pp, new string_id("collection_n", aSlotsInCollection)); sendSystemMessageProse(player, pp); break; } @@ -135,23 +108,21 @@ public class foraging_enemy extends script.base_script } public int barkAttack(obj_id self, dictionary params) throws InterruptedException { - obj_id guard = self; if (params == null) { return SCRIPT_CONTINUE; } - boolean isThief = isThief(guard); + boolean isThief = isThief(self); if (!isThief) { return SCRIPT_CONTINUE; } - String mob = getStringObjVar(guard, "creature_type"); + String mob = getStringObjVar(self, "creature_type"); if ((mob == null) || (mob.equals(""))) { return SCRIPT_OVERRIDE; } - int row = dataTableSearchColumnForString(mob, "enemy", FORAGING_ENEMY_TABLE); - String type = dataTableGetString(FORAGING_ENEMY_TABLE, row, "bark_attack"); + String type = dataTableGetString(FORAGING_ENEMY_TABLE, dataTableSearchColumnForString(mob, "enemy", FORAGING_ENEMY_TABLE), "bark_attack"); if ((type == null) || (type.equals(""))) { return SCRIPT_OVERRIDE; @@ -161,23 +132,20 @@ public class foraging_enemy extends script.base_script } public int barkDefeat(obj_id self, dictionary params) throws InterruptedException { - obj_id guard = self; if (params == null) { return SCRIPT_CONTINUE; } - boolean isThief = isThief(guard); - if (!isThief) + if (!isThief(self)) { return SCRIPT_CONTINUE; } - String mob = getStringObjVar(guard, "creature_type"); + String mob = getStringObjVar(self, "creature_type"); if ((mob == null) || (mob.equals(""))) { return SCRIPT_OVERRIDE; } - int row = dataTableSearchColumnForString(mob, "enemy", FORAGING_ENEMY_TABLE); - String type = dataTableGetString(FORAGING_ENEMY_TABLE, row, "bark_defeat"); + String type = dataTableGetString(FORAGING_ENEMY_TABLE, dataTableSearchColumnForString(mob, "enemy", FORAGING_ENEMY_TABLE), "bark_defeat"); if ((type == null) || (type.equals(""))) { return SCRIPT_OVERRIDE; @@ -188,7 +156,6 @@ public class foraging_enemy extends script.base_script } public int removeASlot(obj_id self, dictionary params) throws InterruptedException { - obj_id guard = self; if (params == null) { return SCRIPT_CONTINUE; diff --git a/sku.0/sys.server/compiled/game/script/creature/mini_vehicle.java b/sku.0/sys.server/compiled/game/script/creature/mini_vehicle.java old mode 100644 new mode 100755 index 852603f9a..4e2c5e441 --- a/sku.0/sys.server/compiled/game/script/creature/mini_vehicle.java +++ b/sku.0/sys.server/compiled/game/script/creature/mini_vehicle.java @@ -1,17 +1,10 @@ package script.creature; import script.*; -import script.base_class.*; -import script.combat_engine.*; -import java.util.Arrays; -import java.util.Hashtable; -import java.util.Vector; -import script.base_script; - import script.library.ai_lib; +import script.library.player_structure; import script.library.sui; import script.library.utils; -import script.library.player_structure; public class mini_vehicle extends script.base_script { @@ -45,8 +38,7 @@ public class mini_vehicle extends script.base_script public static final string_id MINI_VEHICLE_WAYPOINTS_NOT_CLEAR = new string_id(MENU_FILE, "mini_vehicle_waypoints_not_cleared"); public int OnDestroy(obj_id self) throws InterruptedException { - obj_id vehicle = self; - if (!isValidId(vehicle)) + if (!isValidId(self)) { return SCRIPT_CONTINUE; } @@ -55,61 +47,54 @@ public class mini_vehicle extends script.base_script { return SCRIPT_CONTINUE; } - obj_id house = getObjIdObjVar(vehicle, "house"); + obj_id house = getObjIdObjVar(self, "house"); if (isValidId(house) && exists(house)) { removeObjVar(house, "mini_vehicle.vehicle"); - if (hasScript(house, "structure.mini_vehicle_control")) - { - detachScript(house, "structure.mini_vehicle_control"); - } + detachScript(house, "structure.mini_vehicle_control"); } removeObjVar(terminal, TERMINAL_VEHICLE_ID); return SCRIPT_CONTINUE; } public int OnMovePathComplete(obj_id self) throws InterruptedException { - obj_id vehicle = self; - if (!isValidId(vehicle)) + if (!isValidId(self)) { return SCRIPT_CONTINUE; } - utils.removeScriptVar(vehicle, VEHICLE_MOVING); + utils.removeScriptVar(self, VEHICLE_MOVING); return SCRIPT_CONTINUE; } public int OnMoveMoving(obj_id self) throws InterruptedException { - obj_id vehicle = self; - if (!isValidId(vehicle)) + if (!isValidId(self)) { return SCRIPT_CONTINUE; } - utils.setScriptVar(vehicle, VEHICLE_MOVING, true); + utils.setScriptVar(self, VEHICLE_MOVING, true); return SCRIPT_CONTINUE; } public int OnInitialize(obj_id self) throws InterruptedException { - obj_id vehicle = self; - if (!isValidId(vehicle)) + if (!isValidId(self)) { return SCRIPT_CONTINUE; } - messageTo(vehicle, "initializeVehicleVariables", null, 1, false); + messageTo(self, "initializeVehicleVariables", null, 1, false); return SCRIPT_CONTINUE; } public int OnObjectMenuRequest(obj_id self, obj_id player, menu_info mi) throws InterruptedException { - obj_id vehicle = self; - if (!isIdValid(vehicle)) + if (!isIdValid(self)) { return SCRIPT_CONTINUE; } - obj_id terminal = getObjIdObjVar(vehicle, "terminal"); + obj_id terminal = getObjIdObjVar(self, "terminal"); if (!isValidId(terminal) || !exists(terminal)) { - destroyObject(vehicle); + destroyObject(self); } - if (utils.isNestedWithinAPlayer(vehicle)) + if (utils.isNestedWithinAPlayer(self)) { messageTo(terminal, "destroyVehicle", null, 1, false); return SCRIPT_CONTINUE; @@ -126,17 +111,16 @@ public class mini_vehicle extends script.base_script } public int OnObjectMenuSelect(obj_id self, obj_id player, int item) throws InterruptedException { - obj_id vehicle = self; - if (!isValidId(vehicle)) + if (!isValidId(self)) { return SCRIPT_CONTINUE; } - obj_id terminal = getObjIdObjVar(vehicle, "terminal"); + obj_id terminal = getObjIdObjVar(self, "terminal"); if (!isValidId(terminal)) { return SCRIPT_CONTINUE; } - if (utils.isNestedWithinAPlayer(vehicle)) + if (utils.isNestedWithinAPlayer(self)) { messageTo(terminal, "destroyVehicle", null, 1, false); return SCRIPT_CONTINUE; @@ -146,71 +130,66 @@ public class mini_vehicle extends script.base_script sendSystemMessage(player, MINI_VEHICLE_NOT_OWNER); return SCRIPT_CONTINUE; } - sendDirtyObjectMenuNotification(vehicle); + sendDirtyObjectMenuNotification(self); if (item == menu_info_types.SERVER_MENU1) { - createHelpDialog(vehicle, player); + createHelpDialog(self, player); } - if (item == menu_info_types.SERVER_MENU2) + else if (item == menu_info_types.SERVER_MENU3) { + doSetPatrolPoint(self, player); } - if (item == menu_info_types.SERVER_MENU3) + else if (item == menu_info_types.SERVER_MENU4) { - doSetPatrolPoint(vehicle, player); + doClearPatrolPoints(self, player); } - if (item == menu_info_types.SERVER_MENU4) + else if (item == menu_info_types.SERVER_MENU5) { - doClearPatrolPoints(vehicle, player); + removeLastPatrolPoint(self, player); } - if (item == menu_info_types.SERVER_MENU5) + else if (item == menu_info_types.SERVER_MENU6) { - removeLastPatrolPoint(vehicle, player); + setPatrolOnce(self, player, terminal); } - if (item == menu_info_types.SERVER_MENU6) + else if (item == menu_info_types.SERVER_MENU7) { - setPatrolOnce(vehicle, player, terminal); + setPatrolLoop(self, player, terminal); } - if (item == menu_info_types.SERVER_MENU7) + else if (item == menu_info_types.ITEM_ACTIVATE) { - setPatrolLoop(vehicle, player, terminal); - } - if (item == menu_info_types.ITEM_ACTIVATE) - { - if (utils.hasScriptVar(vehicle, VEHICLE_MOVING) && !utils.hasScriptVar(vehicle, VEHICLE_SETTING_PATROL)) + if (utils.hasScriptVar(self, VEHICLE_MOVING) && !utils.hasScriptVar(self, VEHICLE_SETTING_PATROL)) { - stop(vehicle); - utils.removeScriptVar(vehicle, VEHICLE_MOVING); + stop(self); + utils.removeScriptVar(self, VEHICLE_MOVING); } else { - doPatrol(vehicle, player); + doPatrol(self, player); } } return SCRIPT_CONTINUE; } public int getUserOidSetFirstPoint(obj_id self, dictionary params) throws InterruptedException { - obj_id vehicle = self; - if (!isValidId(vehicle)) + if (!isValidId(self)) { return SCRIPT_CONTINUE; } - obj_id player = getObjIdObjVar(vehicle, "user"); + obj_id player = getObjIdObjVar(self, "user"); if (!isValidId(player)) { return SCRIPT_CONTINUE; } - doSetPatrolPoint(vehicle, player); + doSetPatrolPoint(self, player); return SCRIPT_CONTINUE; } public int pathDirectlyToStart(obj_id self, dictionary params) throws InterruptedException { - obj_id vehicle = self; - if (!isValidId(vehicle)) + if (!isValidId(self)) { return SCRIPT_CONTINUE; } - obj_id terminal = getObjIdObjVar(vehicle, "terminal"); + obj_id terminal = getObjIdObjVar(self, "terminal"); if (!isValidId(terminal)) { return SCRIPT_CONTINUE; @@ -218,19 +197,18 @@ public class mini_vehicle extends script.base_script location[] patrolLoc = getLocationArrayObjVar(terminal, OBJVAR_VEHICLE_PATROL_POINTS); if (patrolLoc != null) { - stop(vehicle); - pathTo(vehicle, patrolLoc[0]); + stop(self); + pathTo(self, patrolLoc[0]); } return SCRIPT_CONTINUE; } public int fromLastPointGoBackToStart(obj_id self, dictionary params) throws InterruptedException { - obj_id vehicle = self; - if (!isValidId(vehicle)) + if (!isValidId(self)) { return SCRIPT_CONTINUE; } - obj_id terminal = getObjIdObjVar(vehicle, "terminal"); + obj_id terminal = getObjIdObjVar(self, "terminal"); if (!isValidId(terminal)) { return SCRIPT_CONTINUE; @@ -244,58 +222,53 @@ public class mini_vehicle extends script.base_script { temp[i] = patrolLoc[(patrolLength - 1) - i]; } - patrolOnce(vehicle, temp); + patrolOnce(self, temp); } return SCRIPT_CONTINUE; } public int handleActivateVehicle(obj_id self, dictionary params) throws InterruptedException { - obj_id vehicle = self; - if (!isValidId(vehicle)) + if (!isValidId(self)) { return SCRIPT_CONTINUE; } - obj_id player = getObjIdObjVar(vehicle, "user"); - doPatrol(vehicle); + doPatrol(self); return SCRIPT_CONTINUE; } public int handleDeactivateVehicle(obj_id self, dictionary params) throws InterruptedException { - obj_id vehicle = self; - if (!isValidId(vehicle)) + if (!isValidId(self)) { return SCRIPT_CONTINUE; } - obj_id player = getObjIdObjVar(vehicle, "user"); - stop(vehicle); - if (utils.hasScriptVar(vehicle, VEHICLE_MOVING)) + stop(self); + if (utils.hasScriptVar(self, VEHICLE_MOVING)) { - utils.removeScriptVar(vehicle, VEHICLE_MOVING); + utils.removeScriptVar(self, VEHICLE_MOVING); } return SCRIPT_CONTINUE; } public int initializeVehicleVariables(obj_id self, dictionary params) throws InterruptedException { - obj_id vehicle = self; obj_id house = getTopMostContainer(self); - if (!isIdValid(vehicle)) + if (!isIdValid(self)) { return SCRIPT_CONTINUE; } - obj_id terminal = getObjIdObjVar(vehicle, "terminal"); + obj_id terminal = getObjIdObjVar(self, "terminal"); if (!isValidId(terminal)) { return SCRIPT_CONTINUE; } - if (!isIdValid(house) || !player_structure.isBuilding(house) || utils.isNestedWithinAPlayer(vehicle)) + if (!isIdValid(house) || !player_structure.isBuilding(house) || utils.isNestedWithinAPlayer(self)) { messageTo(terminal, "destroyVehicle", null, 1, false); return SCRIPT_CONTINUE; } - setObjVar(vehicle, "house", house); + setObjVar(self, "house", house); if (!hasObjVar(terminal, OBJVAR_VEHICLE_PATROL_POINTS)) { - messageTo(vehicle, "getUserOidSetFirstPoint", null, 1, false); + messageTo(self, "getUserOidSetFirstPoint", null, 1, false); } if (!hasScript(house, "structure.mini_vehicle_control")) { @@ -303,7 +276,7 @@ public class mini_vehicle extends script.base_script } if (!hasObjVar(house, "mini_vehicle.vehicle")) { - setObjVar(house, "mini_vehicle.vehicle", vehicle); + setObjVar(house, "mini_vehicle.vehicle", self); } listenToMessage(house, "handleActivateVehicle"); listenToMessage(house, "handleDeactivateVehicle"); @@ -311,36 +284,25 @@ public class mini_vehicle extends script.base_script } public int handleDialogInput(obj_id self, dictionary params) throws InterruptedException { - obj_id vehicle = self; - if (!isValidId(vehicle)) + if (!isValidId(self)) { - if (utils.hasScriptVar(vehicle, SCRIPTVAR_VEHICLE_HELP_MENU)) - { - utils.removeScriptVar(vehicle, SCRIPTVAR_VEHICLE_HELP_MENU); - } + utils.removeScriptVar(self, SCRIPTVAR_VEHICLE_HELP_MENU); return SCRIPT_CONTINUE; } obj_id player = sui.getPlayerId(params); if (!isValidId(player)) { - if (utils.hasScriptVar(vehicle, SCRIPTVAR_VEHICLE_HELP_MENU)) - { - utils.removeScriptVar(vehicle, SCRIPTVAR_VEHICLE_HELP_MENU); - } + utils.removeScriptVar(self, SCRIPTVAR_VEHICLE_HELP_MENU); return SCRIPT_CONTINUE; } - int bp = sui.getIntButtonPressed(params); - switch (bp) + switch (sui.getIntButtonPressed(params)) { case sui.BP_OK: - doPatrol(vehicle, player); - return SCRIPT_CONTINUE; + doPatrol(self, player); + break; case sui.BP_CANCEL: - if (utils.hasScriptVar(vehicle, SCRIPTVAR_VEHICLE_HELP_MENU)) - { - utils.removeScriptVar(vehicle, SCRIPTVAR_VEHICLE_HELP_MENU); - } - return SCRIPT_CONTINUE; + utils.removeScriptVar(self, SCRIPTVAR_VEHICLE_HELP_MENU); + break; } return SCRIPT_CONTINUE; } @@ -378,14 +340,8 @@ public class mini_vehicle extends script.base_script { return false; } - if (utils.hasScriptVar(vehicle, SCRIPTVAR_VEHICLE_HELP_MENU)) - { - utils.removeScriptVar(vehicle, SCRIPTVAR_VEHICLE_HELP_MENU); - } - if (utils.hasScriptVar(vehicle, VEHICLE_SETTING_PATROL)) - { - utils.removeScriptVar(vehicle, VEHICLE_SETTING_PATROL); - } + utils.removeScriptVar(vehicle, SCRIPTVAR_VEHICLE_HELP_MENU); + utils.removeScriptVar(vehicle, VEHICLE_SETTING_PATROL); obj_id terminal = getObjIdObjVar(vehicle, "terminal"); if (!isValidId(terminal)) { @@ -419,19 +375,13 @@ public class mini_vehicle extends script.base_script { return; } - if (utils.hasScriptVar(vehicle, SCRIPTVAR_VEHICLE_HELP_MENU)) - { - utils.removeScriptVar(vehicle, SCRIPTVAR_VEHICLE_HELP_MENU); - } + utils.removeScriptVar(vehicle, SCRIPTVAR_VEHICLE_HELP_MENU); obj_id terminal = getObjIdObjVar(vehicle, "terminal"); if (!isValidId(terminal)) { return; } - if (!utils.hasScriptVar(vehicle, VEHICLE_SETTING_PATROL)) - { - utils.setScriptVar(vehicle, VEHICLE_SETTING_PATROL, true); - } + utils.setScriptVar(vehicle, VEHICLE_SETTING_PATROL, true); location[] patrolLoc = getLocationArrayObjVar(terminal, OBJVAR_VEHICLE_PATROL_POINTS); if (patrolLoc == null) { @@ -440,10 +390,7 @@ public class mini_vehicle extends script.base_script else if (patrolLoc.length < MAX_WAYPOINTS) { location[] temp = new location[patrolLoc.length + 1]; - for (int i = 0; i < patrolLoc.length; ++i) - { - temp[i] = patrolLoc[i]; - } + System.arraycopy(patrolLoc, 0, temp, 0, patrolLoc.length); patrolLoc = temp; } else @@ -508,10 +455,7 @@ public class mini_vehicle extends script.base_script else if (patrolLoc.length > 0) { location[] temp = new location[patrolLoc.length - 1]; - for (int i = 0; i < patrolLoc.length - 1; ++i) - { - temp[i] = patrolLoc[i]; - } + System.arraycopy(patrolLoc, 0, temp, 0, patrolLoc.length - 1); patrolLoc = temp; setObjVar(terminal, OBJVAR_VEHICLE_PATROL_POINTS, patrolLoc); sendSystemMessage(player, SYS_PATROL_ADDED); @@ -521,7 +465,6 @@ public class mini_vehicle extends script.base_script if (isValidId(playerLoc.cell)) { pathTo(vehicle, playerLoc); - return; } } } @@ -594,12 +537,11 @@ public class mini_vehicle extends script.base_script } public int OnPack(obj_id self, dictionary params) throws InterruptedException { - obj_id vehicle = self; - if (!isValidId(vehicle)) + if (!isValidId(self)) { return SCRIPT_CONTINUE; } - obj_id terminal = getObjIdObjVar(vehicle, "terminal"); + obj_id terminal = getObjIdObjVar(self, "terminal"); if (!isValidId(terminal)) { return SCRIPT_CONTINUE; diff --git a/sku.0/sys.server/compiled/game/script/creature/sarlacc.java b/sku.0/sys.server/compiled/game/script/creature/sarlacc.java old mode 100644 new mode 100755 index 1107062c0..a3be4c4e7 --- a/sku.0/sys.server/compiled/game/script/creature/sarlacc.java +++ b/sku.0/sys.server/compiled/game/script/creature/sarlacc.java @@ -1,16 +1,7 @@ package script.creature; import script.*; -import script.base_class.*; -import script.combat_engine.*; -import java.util.Arrays; -import java.util.Hashtable; -import java.util.Vector; -import script.base_script; - import script.library.utils; -import script.library.dot; -import script.library.buff; public class sarlacc extends script.base_script { @@ -52,28 +43,18 @@ public class sarlacc extends script.base_script obj_id[] contents = getTriggerVolumeContents(self, "sarlaccBreach"); if (contents != null) { - for (int i = 0; i < contents.length; i++) - { - if (isPlayer(contents[i])) - { - sendSystemMessage(contents[i], SID_SARLACC_ERUPT); + for (obj_id content : contents) { + if (isPlayer(content)) { + sendSystemMessage(content, SID_SARLACC_ERUPT); } } } } utils.setScriptVar(self, "bile.eject", 1); messageTo(self, "resetBileEject", null, 10.f, false); - int diseaseResist = getEnhancedSkillStatisticModifierUncapped(whoTriggeredMe, "resistance_disease"); - if (diseaseResist < 24) + if (getEnhancedSkillStatisticModifierUncapped(whoTriggeredMe, "resistance_disease") < 24) { - if (buff.applyBuff(whoTriggeredMe, "sarlaccSnare", 300)) - { - - } - - { - sendSystemMessage(whoTriggeredMe, SID_SARLACC_DOT); - } + sendSystemMessage(whoTriggeredMe, SID_SARLACC_DOT); } } else if (volumeName.equals("sarlaccPreBreach")) @@ -100,29 +81,17 @@ public class sarlacc extends script.base_script obj_id[] contents = getTriggerVolumeContents(self, "sarlaccBreach"); if (contents != null) { - for (int i = 0; i < contents.length; i++) - { - if (isPlayer(contents[i])) - { + for (obj_id content : contents) { + if (isPlayer(content)) { playerHint = 1; - if (bile == 0) - { + if (bile == 0) { bile = 1; - playClientEffectLoc(contents[i], "clienteffect/cr_sarlacc_erupt.cef", getLocation(self), 3f); + playClientEffectLoc(content, "clienteffect/cr_sarlacc_erupt.cef", getLocation(self), 3f); } - int diseaseResist = getEnhancedSkillStatisticModifierUncapped(contents[i], "resistance_disease"); - if (diseaseResist < 24) - { - if (buff.applyBuff(contents[i], "sarlaccSnare", 300)) - { - - } - - { - sendSystemMessage(contents[i], SID_SARLACC_DOT); - } + if (getEnhancedSkillStatisticModifierUncapped(content, "resistance_disease") < 24) { + sendSystemMessage(content, SID_SARLACC_DOT); } - sendSystemMessage(contents[i], SID_SARLACC_ERUPT); + sendSystemMessage(content, SID_SARLACC_ERUPT); } } } @@ -149,10 +118,8 @@ public class sarlacc extends script.base_script obj_id[] items = getInventoryAndEquipment(player); if (items != null) { - for (int i = 0; i < items.length; i++) - { - if ((getTemplateName(items[i])).compareTo(BILE_OBJECT) == 0) - { + for (obj_id item1 : items) { + if ((getTemplateName(item1)).compareTo(BILE_OBJECT) == 0) { sendSystemMessage(player, SID_BILE_ALREADY); return SCRIPT_CONTINUE; } diff --git a/sku.0/sys.server/compiled/game/script/creature/serving_droid.java b/sku.0/sys.server/compiled/game/script/creature/serving_droid.java old mode 100644 new mode 100755 index 51a7a1c2d..07854fa0f --- a/sku.0/sys.server/compiled/game/script/creature/serving_droid.java +++ b/sku.0/sys.server/compiled/game/script/creature/serving_droid.java @@ -1,18 +1,7 @@ package script.creature; import script.*; -import script.base_class.*; -import script.combat_engine.*; -import java.util.Arrays; -import java.util.Hashtable; -import java.util.Vector; -import script.base_script; - -import script.library.ai_lib; -import script.library.hue; -import script.library.sui; -import script.library.utils; -import script.library.player_structure; +import script.library.*; public class serving_droid extends script.base_script { @@ -52,8 +41,7 @@ public class serving_droid extends script.base_script public static final String CLOSE = localize(new string_id("sui", "close")); public int OnDestroy(obj_id self) throws InterruptedException { - obj_id droid = self; - if (!isValidId(droid)) + if (!isValidId(self)) { return SCRIPT_CONTINUE; } @@ -62,61 +50,54 @@ public class serving_droid extends script.base_script { return SCRIPT_CONTINUE; } - obj_id house = getObjIdObjVar(droid, "house"); + obj_id house = getObjIdObjVar(self, "house"); if (isValidId(house) && exists(house)) { removeObjVar(house, "serving_droid.droid"); - if (hasScript(house, "structure.serving_droid_control")) - { - detachScript(house, "structure.serving_droid_control"); - } + detachScript(house, "structure.serving_droid_control"); } removeObjVar(terminal, TERMINAL_DROID_ID); return SCRIPT_CONTINUE; } public int OnMovePathComplete(obj_id self) throws InterruptedException { - obj_id droid = self; - if (!isValidId(droid)) + if (!isValidId(self)) { return SCRIPT_CONTINUE; } - utils.removeScriptVar(droid, DROID_MOVING); + utils.removeScriptVar(self, DROID_MOVING); return SCRIPT_CONTINUE; } public int OnMoveMoving(obj_id self) throws InterruptedException { - obj_id droid = self; - if (!isValidId(droid)) + if (!isValidId(self)) { return SCRIPT_CONTINUE; } - utils.setScriptVar(droid, DROID_MOVING, true); + utils.setScriptVar(self, DROID_MOVING, true); return SCRIPT_CONTINUE; } public int OnInitialize(obj_id self) throws InterruptedException { - obj_id droid = self; - if (!isValidId(droid)) + if (!isValidId(self)) { return SCRIPT_CONTINUE; } - messageTo(droid, "initializeDroidVariables", null, 1, false); + messageTo(self, "initializeDroidVariables", null, 1, false); return SCRIPT_CONTINUE; } public int OnObjectMenuRequest(obj_id self, obj_id player, menu_info mi) throws InterruptedException { - obj_id droid = self; - if (!isIdValid(droid)) + if (!isIdValid(self)) { return SCRIPT_CONTINUE; } - obj_id terminal = getObjIdObjVar(droid, "terminal"); + obj_id terminal = getObjIdObjVar(self, "terminal"); if (!isValidId(terminal) || !exists(terminal)) { - destroyObject(droid); + destroyObject(self); } - if (utils.isNestedWithinAPlayer(droid)) + if (utils.isNestedWithinAPlayer(self)) { messageTo(terminal, "destroyDroid", null, 1, false); return SCRIPT_CONTINUE; @@ -136,17 +117,16 @@ public class serving_droid extends script.base_script } public int OnObjectMenuSelect(obj_id self, obj_id player, int item) throws InterruptedException { - obj_id droid = self; - if (!isValidId(droid)) + if (!isValidId(self)) { return SCRIPT_CONTINUE; } - obj_id terminal = getObjIdObjVar(droid, "terminal"); + obj_id terminal = getObjIdObjVar(self, "terminal"); if (!isValidId(terminal)) { return SCRIPT_CONTINUE; } - if (utils.isNestedWithinAPlayer(droid)) + if (utils.isNestedWithinAPlayer(self)) { messageTo(terminal, "destroyDroid", null, 1, false); return SCRIPT_CONTINUE; @@ -156,129 +136,120 @@ public class serving_droid extends script.base_script sendSystemMessage(player, ASTROMECH_NOT_OWNER); return SCRIPT_CONTINUE; } - sendDirtyObjectMenuNotification(droid); + sendDirtyObjectMenuNotification(self); if (item == menu_info_types.SERVER_MENU1) { - createHelpDialog(droid, player); + createHelpDialog(self, player); } - if (item == menu_info_types.SERVER_MENU3) + else if (item == menu_info_types.SERVER_MENU3) { - sui.colorize(droid, player, droid, hue.INDEX_1, "handlePrimaryColorize"); + sui.colorize(self, player, self, hue.INDEX_1, "handlePrimaryColorize"); } - if (item == menu_info_types.SERVER_MENU4) + else if (item == menu_info_types.SERVER_MENU4) { - sui.colorize(droid, player, droid, hue.INDEX_2, "handleSecondaryColorize"); + sui.colorize(self, player, self, hue.INDEX_2, "handleSecondaryColorize"); } - if (item == menu_info_types.SERVER_MENU5) + else if (item == menu_info_types.SERVER_MENU6) { + doSetPatrolPoint(self, player); } - if (item == menu_info_types.SERVER_MENU6) + else if (item == menu_info_types.SERVER_MENU7) { - doSetPatrolPoint(droid, player); + doClearPatrolPoints(self, player); } - if (item == menu_info_types.SERVER_MENU7) + else if (item == menu_info_types.SERVER_MENU8) { - doClearPatrolPoints(droid, player); + setPatrolOnce(self, player, terminal); } - if (item == menu_info_types.SERVER_MENU8) + else if (item == menu_info_types.SERVER_MENU9) { - setPatrolOnce(droid, player, terminal); + setPatrolLoop(self, player, terminal); } - if (item == menu_info_types.SERVER_MENU9) + else if (item == menu_info_types.SERVER_MENU10) { - setPatrolLoop(droid, player, terminal); + removeLastPatrolPoint(self, player); } - if (item == menu_info_types.SERVER_MENU10) + else if (item == menu_info_types.ITEM_ACTIVATE) { - removeLastPatrolPoint(droid, player); - } - if (item == menu_info_types.ITEM_ACTIVATE) - { - if (utils.hasScriptVar(droid, DROID_MOVING) && !utils.hasScriptVar(droid, DROID_SETTING_PATROL)) + if (utils.hasScriptVar(self, DROID_MOVING) && !utils.hasScriptVar(self, DROID_SETTING_PATROL)) { - stop(droid); - utils.removeScriptVar(droid, DROID_MOVING); + stop(self); + utils.removeScriptVar(self, DROID_MOVING); } else { - doPatrol(droid, player); + doPatrol(self, player); } } return SCRIPT_CONTINUE; } public int handlePrimaryColorize(obj_id self, dictionary params) throws InterruptedException { - obj_id droid = self; - if (!isValidId(droid)) + if (!isValidId(self)) { return SCRIPT_CONTINUE; } - obj_id terminal = getObjIdObjVar(droid, "terminal"); + obj_id terminal = getObjIdObjVar(self, "terminal"); if (!isValidId(terminal)) { return SCRIPT_CONTINUE; } int idx = sui.getColorPickerIndex(params); int bp = sui.getIntButtonPressed(params); - obj_id player = sui.getPlayerId(params); if (bp == sui.BP_CANCEL) { return SCRIPT_CONTINUE; } if (idx > -1) { - colorPrimary(droid, terminal, idx); + colorPrimary(self, terminal, idx); } return SCRIPT_CONTINUE; } public int handleSecondaryColorize(obj_id self, dictionary params) throws InterruptedException { - obj_id droid = self; - if (!isValidId(droid)) + if (!isValidId(self)) { return SCRIPT_CONTINUE; } - obj_id terminal = getObjIdObjVar(droid, "terminal"); + obj_id terminal = getObjIdObjVar(self, "terminal"); if (!isValidId(terminal)) { return SCRIPT_CONTINUE; } int idx = sui.getColorPickerIndex(params); int bp = sui.getIntButtonPressed(params); - obj_id player = sui.getPlayerId(params); if (bp == sui.BP_CANCEL) { return SCRIPT_CONTINUE; } if (idx > -1) { - colorSecondary(droid, terminal, idx); + colorSecondary(self, terminal, idx); } return SCRIPT_CONTINUE; } public int getUserOidSetFirstPoint(obj_id self, dictionary params) throws InterruptedException { - obj_id droid = self; - if (!isValidId(droid)) + if (!isValidId(self)) { return SCRIPT_CONTINUE; } - obj_id player = getObjIdObjVar(droid, "user"); + obj_id player = getObjIdObjVar(self, "user"); if (!isValidId(player)) { return SCRIPT_CONTINUE; } - doSetPatrolPoint(droid, player); + doSetPatrolPoint(self, player); return SCRIPT_CONTINUE; } public int pathDirectlyToStart(obj_id self, dictionary params) throws InterruptedException { - obj_id droid = self; - if (!isValidId(droid)) + if (!isValidId(self)) { return SCRIPT_CONTINUE; } - obj_id terminal = getObjIdObjVar(droid, "terminal"); + obj_id terminal = getObjIdObjVar(self, "terminal"); if (!isValidId(terminal)) { return SCRIPT_CONTINUE; @@ -286,19 +257,18 @@ public class serving_droid extends script.base_script location[] patrolLoc = getLocationArrayObjVar(terminal, OBJVAR_DROID_PATROL_POINTS); if (patrolLoc != null) { - stop(droid); - pathTo(droid, patrolLoc[0]); + stop(self); + pathTo(self, patrolLoc[0]); } return SCRIPT_CONTINUE; } public int fromLastPointGoBackToStart(obj_id self, dictionary params) throws InterruptedException { - obj_id droid = self; - if (!isValidId(droid)) + if (!isValidId(self)) { return SCRIPT_CONTINUE; } - obj_id terminal = getObjIdObjVar(droid, "terminal"); + obj_id terminal = getObjIdObjVar(self, "terminal"); if (!isValidId(terminal)) { return SCRIPT_CONTINUE; @@ -312,44 +282,39 @@ public class serving_droid extends script.base_script { temp[i] = patrolLoc[(patrolLength - 1) - i]; } - patrolOnce(droid, temp); + patrolOnce(self, temp); } return SCRIPT_CONTINUE; } public int handleActivateDroid(obj_id self, dictionary params) throws InterruptedException { - obj_id droid = self; - if (!isValidId(droid)) + if (!isValidId(self)) { return SCRIPT_CONTINUE; } - obj_id player = getObjIdObjVar(droid, "user"); - doPatrol(droid); + doPatrol(self); return SCRIPT_CONTINUE; } public int handleDeactivateDroid(obj_id self, dictionary params) throws InterruptedException { - obj_id droid = self; - if (!isValidId(droid)) + if (!isValidId(self)) { return SCRIPT_CONTINUE; } - obj_id player = getObjIdObjVar(droid, "user"); - stop(droid); - if (utils.hasScriptVar(droid, DROID_MOVING)) + stop(self); + if (utils.hasScriptVar(self, DROID_MOVING)) { - utils.removeScriptVar(droid, DROID_MOVING); + utils.removeScriptVar(self, DROID_MOVING); } return SCRIPT_CONTINUE; } public int reColorDroid(obj_id self, dictionary params) throws InterruptedException { - obj_id droid = self; - if (!isValidId(droid)) + if (!isValidId(self)) { return SCRIPT_CONTINUE; } - obj_id terminal = getObjIdObjVar(droid, "terminal"); + obj_id terminal = getObjIdObjVar(self, "terminal"); if (!isValidId(terminal)) { return SCRIPT_CONTINUE; @@ -365,32 +330,31 @@ public class serving_droid extends script.base_script { return SCRIPT_CONTINUE; } - hue.setColor(droid, "/private/index_color_1", primary); - hue.setColor(droid, "/private/index_color_2", secondary); + hue.setColor(self, "/private/index_color_1", primary); + hue.setColor(self, "/private/index_color_2", secondary); return SCRIPT_CONTINUE; } public int initializeDroidVariables(obj_id self, dictionary params) throws InterruptedException { - obj_id droid = self; obj_id house = getTopMostContainer(self); - if (!isIdValid(droid)) + if (!isIdValid(self)) { return SCRIPT_CONTINUE; } - obj_id terminal = getObjIdObjVar(droid, "terminal"); + obj_id terminal = getObjIdObjVar(self, "terminal"); if (!isValidId(terminal)) { return SCRIPT_CONTINUE; } - if (!isIdValid(house) || !player_structure.isBuilding(house) || utils.isNestedWithinAPlayer(droid)) + if (!isIdValid(house) || !player_structure.isBuilding(house) || utils.isNestedWithinAPlayer(self)) { messageTo(terminal, "destroyDroid", null, 1, false); return SCRIPT_CONTINUE; } - setObjVar(droid, "house", house); + setObjVar(self, "house", house); if (!hasObjVar(terminal, OBJVAR_DROID_PATROL_POINTS)) { - messageTo(droid, "getUserOidSetFirstPoint", null, 1, false); + messageTo(self, "getUserOidSetFirstPoint", null, 1, false); } if (!hasScript(house, "structure.serving_droid_control")) { @@ -398,11 +362,11 @@ public class serving_droid extends script.base_script } if (!hasObjVar(house, "serving_droid.droid")) { - setObjVar(house, "serving_droid.droid", droid); + setObjVar(house, "serving_droid.droid", self); } if (hasObjVar(terminal, "color.primary")) { - messageTo(droid, "reColorDroid", null, 0, false); + messageTo(self, "reColorDroid", null, 0, false); } listenToMessage(house, "handleActivateDroid"); listenToMessage(house, "handleDeactivateDroid"); @@ -410,36 +374,31 @@ public class serving_droid extends script.base_script } public int handleDialogInput(obj_id self, dictionary params) throws InterruptedException { - obj_id droid = self; - if (!isValidId(droid)) + if (!isValidId(self)) { - if (utils.hasScriptVar(droid, SCRIPTVAR_DROID_HELP_MENU)) + if (utils.hasScriptVar(self, SCRIPTVAR_DROID_HELP_MENU)) { - utils.removeScriptVar(droid, SCRIPTVAR_DROID_HELP_MENU); + utils.removeScriptVar(self, SCRIPTVAR_DROID_HELP_MENU); } return SCRIPT_CONTINUE; } obj_id player = sui.getPlayerId(params); if (!isValidId(player)) { - if (utils.hasScriptVar(droid, SCRIPTVAR_DROID_HELP_MENU)) + if (utils.hasScriptVar(self, SCRIPTVAR_DROID_HELP_MENU)) { - utils.removeScriptVar(droid, SCRIPTVAR_DROID_HELP_MENU); + utils.removeScriptVar(self, SCRIPTVAR_DROID_HELP_MENU); } return SCRIPT_CONTINUE; } - int bp = sui.getIntButtonPressed(params); - switch (bp) + switch (sui.getIntButtonPressed(params)) { case sui.BP_OK: - doPatrol(droid, player); - return SCRIPT_CONTINUE; + doPatrol(self, player); + break; case sui.BP_CANCEL: - if (utils.hasScriptVar(droid, SCRIPTVAR_DROID_HELP_MENU)) - { - utils.removeScriptVar(droid, SCRIPTVAR_DROID_HELP_MENU); - } - return SCRIPT_CONTINUE; + utils.removeScriptVar(self, SCRIPTVAR_DROID_HELP_MENU); + break; } return SCRIPT_CONTINUE; } @@ -548,15 +507,6 @@ public class serving_droid extends script.base_script { patrolLoc = new location[1]; } - else if (patrolLoc.length < MAX_WAYPOINTS) - { - location[] temp = new location[patrolLoc.length + 1]; - for (int i = 0; i < patrolLoc.length; ++i) - { - temp[i] = patrolLoc[i]; - } - patrolLoc = temp; - } else { sendSystemMessage(player, ASTROMECH_MAX_WAYPOINTS); @@ -618,12 +568,6 @@ public class serving_droid extends script.base_script } else if (patrolLoc.length > 0) { - location[] temp = new location[patrolLoc.length - 1]; - for (int i = 0; i < patrolLoc.length - 1; ++i) - { - temp[i] = patrolLoc[i]; - } - patrolLoc = temp; setObjVar(terminal, OBJVAR_DROID_PATROL_POINTS, patrolLoc); sendSystemMessage(player, SYS_PATROL_ADDED); sendConsoleMessage(player, "Patrol points left: " + (MAX_WAYPOINTS - patrolLoc.length)); @@ -632,7 +576,6 @@ public class serving_droid extends script.base_script if (isValidId(playerLoc.cell)) { pathTo(droid, playerLoc); - return; } } } @@ -708,12 +651,11 @@ public class serving_droid extends script.base_script } public int OnPack(obj_id self, dictionary params) throws InterruptedException { - obj_id droid = self; - if (!isValidId(droid)) + if (!isValidId(self)) { return SCRIPT_CONTINUE; } - obj_id terminal = getObjIdObjVar(droid, "terminal"); + obj_id terminal = getObjIdObjVar(self, "terminal"); if (!isValidId(terminal)) { return SCRIPT_CONTINUE; diff --git a/sku.0/sys.server/compiled/game/script/creature/yavin4_atst.java b/sku.0/sys.server/compiled/game/script/creature/yavin4_atst.java old mode 100644 new mode 100755 index 40a71a617..eec1a393a --- a/sku.0/sys.server/compiled/game/script/creature/yavin4_atst.java +++ b/sku.0/sys.server/compiled/game/script/creature/yavin4_atst.java @@ -1,14 +1,9 @@ package script.creature; -import script.*; -import script.base_class.*; -import script.combat_engine.*; -import java.util.Arrays; -import java.util.Hashtable; -import java.util.Vector; -import script.base_script; - +import script.dictionary; import script.library.ai_lib; +import script.location; +import script.obj_id; public class yavin4_atst extends script.base_script { @@ -17,14 +12,12 @@ public class yavin4_atst extends script.base_script } public int OnAttach(obj_id self) throws InterruptedException { - int timeOut = rand(5, 15); - messageTo(self, "startPatrol", null, timeOut, false); + messageTo(self, "startPatrol", null, rand(5, 15), false); return SCRIPT_CONTINUE; } public int OnInitialize(obj_id self) throws InterruptedException { - int timeOut = rand(5, 10); - messageTo(self, "startPatrol", null, timeOut, false); + messageTo(self, "startPatrol", null, rand(5, 10), false); return SCRIPT_CONTINUE; } public int startPatrol(obj_id self, dictionary params) throws InterruptedException @@ -39,12 +32,10 @@ public class yavin4_atst extends script.base_script if (name.equals("marker")) { messageTo(self, "nextSpot", null, 10, false); - return SCRIPT_CONTINUE; } - if (name.equals("marker2")) + else if (name.equals("marker2")) { messageTo(self, "startPatrol", null, 10, false); - return SCRIPT_CONTINUE; } return SCRIPT_CONTINUE; }