diff --git a/sku.0/sys.server/compiled/game/script/event/halloween/song_book.java b/sku.0/sys.server/compiled/game/script/event/halloween/song_book.java old mode 100644 new mode 100755 index 13e7c87da..5e323c612 --- a/sku.0/sys.server/compiled/game/script/event/halloween/song_book.java +++ b/sku.0/sys.server/compiled/game/script/event/halloween/song_book.java @@ -1,29 +1,20 @@ package script.event.halloween; -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.sui; import script.library.utils; +import script.*; public class song_book extends script.base_script { public song_book() { } - public static final String HALLOWEEN = new String("event/halloween"); + private static final String HALLOWEEN = "event/halloween"; public static final string_id SID_USE = new string_id(HALLOWEEN, "learn_song"); - public static final string_id CANT_USE = new string_id(HALLOWEEN, "not_entertainer"); - public static final string_id LEARNED_SONG = new string_id(HALLOWEEN, "learned_song"); - public static final string_id CANT_USE_LOW_LEVEL = new string_id(HALLOWEEN, "not_entertainer_enough"); + private static final string_id CANT_USE = new string_id(HALLOWEEN, "not_entertainer"); + private static final string_id LEARNED_SONG = new string_id(HALLOWEEN, "learned_song"); + private static final string_id CANT_USE_LOW_LEVEL = new string_id(HALLOWEEN, "not_entertainer_enough"); public int OnObjectMenuRequest(obj_id self, obj_id player, menu_info mi) throws InterruptedException { - menu_info_data data = mi.getMenuItemByType(menu_info_types.SERVER_MENU1); if (utils.isNestedWithin(self, player)) { if (utils.isProfession(player, utils.ENTERTAINER)) diff --git a/sku.0/sys.server/compiled/game/script/event/halloween/trick_device.java b/sku.0/sys.server/compiled/game/script/event/halloween/trick_device.java old mode 100644 new mode 100755 index a16f15134..6a30927ed --- a/sku.0/sys.server/compiled/game/script/event/halloween/trick_device.java +++ b/sku.0/sys.server/compiled/game/script/event/halloween/trick_device.java @@ -1,49 +1,32 @@ package script.event.halloween; 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.create; -import script.library.utils; -import script.library.player_structure; -import script.library.sui; -import script.library.static_item; -import script.library.buff; -import script.library.chat; -import script.library.ai_lib; -import script.library.space_utils; -import script.library.space_transition; -import script.library.event_perk; +import script.library.*; public class trick_device extends script.base_script { public trick_device() { } - public static final String HALLOWEEN = new String("event/halloween"); - public static final string_id TRICK_OPTION_1_ID = new string_id(HALLOWEEN, "halloween_trick_1"); - public static final string_id TRICK_OPTION_2_ID = new string_id(HALLOWEEN, "halloween_trick_2"); - public static final string_id TRICK_OPTION_3_ID = new string_id(HALLOWEEN, "halloween_trick_3"); - public static final string_id TRICK_OPTION_4_ID = new string_id(HALLOWEEN, "halloween_trick_4"); - public static final string_id TRICK_OPTION_5_ID = new string_id(HALLOWEEN, "halloween_trick_5"); - public static final String TRICK_1 = new String("appearance/pt_spider_flock_trick_device.prt"); - public static final String TRICK_2 = new String("appearance/pt_moon_skulls.prt"); - public static final String TRICK_3 = new String("appearance/pt_moon_ghost_s05.prt"); - public static final String TRICK_4 = new String("appearance/pt_fire_face.prt"); - public static final String TRICK_5 = new String("appearance/pt_moon_vortex.prt"); - public static final string_id FAULTY_DEVICE = new string_id(HALLOWEEN, "halloween_faulty_device"); - public static final string_id IN_COMBAT = new string_id(HALLOWEEN, "halloween_in_combat"); - public static final string_id SID_TURN_ON = new string_id(HALLOWEEN, "fog_machine_on"); - public static final string_id SID_TURN_OFF = new string_id(HALLOWEEN, "fog_machine_off"); - public static final string_id CANT_USE = new string_id(HALLOWEEN, "cant_use_device"); + private static final String HALLOWEEN = "event/halloween"; + private static final string_id TRICK_OPTION_1_ID = new string_id(HALLOWEEN, "halloween_trick_1"); + private static final string_id TRICK_OPTION_2_ID = new string_id(HALLOWEEN, "halloween_trick_2"); + private static final string_id TRICK_OPTION_3_ID = new string_id(HALLOWEEN, "halloween_trick_3"); + private static final string_id TRICK_OPTION_4_ID = new string_id(HALLOWEEN, "halloween_trick_4"); + private static final string_id TRICK_OPTION_5_ID = new string_id(HALLOWEEN, "halloween_trick_5"); + private static final String TRICK_1 = "appearance/pt_spider_flock_trick_device.prt"; + private static final String TRICK_2 = "appearance/pt_moon_skulls.prt"; + private static final String TRICK_3 = "appearance/pt_moon_ghost_s05.prt"; + private static final String TRICK_4 = "appearance/pt_fire_face.prt"; + private static final String TRICK_5 = "appearance/pt_moon_vortex.prt"; + private static final string_id FAULTY_DEVICE = new string_id(HALLOWEEN, "halloween_faulty_device"); + private static final string_id IN_COMBAT = new string_id(HALLOWEEN, "halloween_in_combat"); + private static final string_id SID_TURN_ON = new string_id(HALLOWEEN, "fog_machine_on"); + private static final string_id SID_TURN_OFF = new string_id(HALLOWEEN, "fog_machine_off"); + private static final string_id CANT_USE = new string_id(HALLOWEEN, "cant_use_device"); public static final string_id TEN_COINS = new string_id(HALLOWEEN, "ten_coins"); public static final string_id FIVE_COINS = new string_id(HALLOWEEN, "five_coins"); - public static final string_id OUT_OF_RANGE = new string_id(HALLOWEEN, "trick_device_oor"); + private static final string_id OUT_OF_RANGE = new string_id(HALLOWEEN, "trick_device_oor"); public int OnInitialize(obj_id self) throws InterruptedException { int projectorTier = getIntObjVar(self, "item.projector"); @@ -77,7 +60,6 @@ public class trick_device extends script.base_script } public int OnTransferred(obj_id self, obj_id sourceContainer, obj_id destContainer, obj_id transferer) throws InterruptedException { - obj_id house = getTopMostContainer(self); int projectorTier = getIntObjVar(self, "item.projector"); obj_id ship = space_transition.getContainingShip(destContainer); String templateName = ""; @@ -104,31 +86,25 @@ public class trick_device extends script.base_script { if (!buff.hasBuff(breacher, "event_halloween_no_trick")) { - int idx = rand(0, 4); - switch (idx) + switch (rand(0, 4)) { case 0: - playClientEffectObj(self, TRICK_1, breacher, ""); - buff.applyBuff(breacher, "event_halloween_no_trick"); - break; + playClientEffectObj(self, TRICK_1, breacher, ""); + break; case 1: - playClientEffectObj(self, TRICK_2, breacher, ""); - buff.applyBuff(breacher, "event_halloween_no_trick"); - break; + playClientEffectObj(self, TRICK_2, breacher, ""); + break; case 2: - playClientEffectObj(self, TRICK_3, breacher, ""); - buff.applyBuff(breacher, "event_halloween_no_trick"); - break; + playClientEffectObj(self, TRICK_3, breacher, ""); + break; case 3: - playClientEffectObj(self, TRICK_4, breacher, ""); - buff.applyBuff(breacher, "event_halloween_no_trick"); - break; + playClientEffectObj(self, TRICK_4, breacher, ""); + break; case 4: - playClientEffectObj(self, TRICK_5, breacher, ""); - buff.applyBuff(breacher, "event_halloween_no_trick"); - break; - default: + playClientEffectObj(self, TRICK_5, breacher, ""); + break; } + buff.applyBuff(breacher, "event_halloween_no_trick"); } } if (volumeName.equals("fogTrigger")) @@ -139,17 +115,16 @@ public class trick_device extends script.base_script } public int OnObjectMenuRequest(obj_id self, obj_id player, menu_info mi) throws InterruptedException { - menu_info_data data = mi.getMenuItemByType(menu_info_types.ITEM_USE); mi.addRootMenu(menu_info_types.ITEM_USE, new string_id("", "")); if (inHouse(self)) { if (hasObjVar(self, "fogOn")) { - int fogOnOff = mi.addRootMenu(menu_info_types.ITEM_USE, SID_TURN_OFF); + mi.addRootMenu(menu_info_types.ITEM_USE, SID_TURN_OFF); } else { - int fogOnOff = mi.addRootMenu(menu_info_types.ITEM_USE, SID_TURN_ON); + mi.addRootMenu(menu_info_types.ITEM_USE, SID_TURN_ON); } } return SCRIPT_CONTINUE; @@ -161,15 +136,14 @@ public class trick_device extends script.base_script if (item == menu_info_types.ITEM_USE && !hasObjVar(self, "fogOn")) { startFog(self); - return SCRIPT_CONTINUE; } - if (item == menu_info_types.ITEM_USE && hasObjVar(self, "fogOn")) + else if (item == menu_info_types.ITEM_USE && hasObjVar(self, "fogOn")) { stopFog(self); - return SCRIPT_CONTINUE; } + return SCRIPT_CONTINUE; } - else if (canUse(player, self) == true) + else if (canUse(player, self)) { if (item == menu_info_types.ITEM_USE) { @@ -183,24 +157,23 @@ public class trick_device extends script.base_script } return SCRIPT_CONTINUE; } - public boolean canUse(obj_id player, obj_id device) throws InterruptedException + private boolean canUse(obj_id player, obj_id device) throws InterruptedException { if (!inHouse(device)) { - if (event_perk.timeStampCheck(player) == false) + if (!event_perk.timeStampCheck(player)) { return false; } - obj_id target = getIntendedTarget(player); - obj_id correctPlayer = utils.getObjIdScriptVar(target, "readyForTrickFromPlayer." + player); - if (correctPlayer == player) - { - return true; + if(!isValidId(getIntendedTarget(player))) { + return false; } + obj_id correctPlayer = utils.getObjIdScriptVar(getIntendedTarget(player), "readyForTrickFromPlayer." + player); + return (correctPlayer == player); } return false; } - public void startDevice(obj_id player) throws InterruptedException + private void startDevice(obj_id player) throws InterruptedException { String TRICK_OPTION_1 = utils.packStringId(TRICK_OPTION_1_ID); String TRICK_OPTION_2 = utils.packStringId(TRICK_OPTION_2_ID); @@ -282,179 +255,94 @@ public class trick_device extends script.base_script if (utils.hasScriptVar(target, "readyForTrickFromPlayer." + player)) { obj_id correctPlayer = utils.getObjIdScriptVar(target, "readyForTrickFromPlayer." + player); - switch (idx) - { - case 0: - if (correctPlayer == player) - { - utils.removeScriptVar(target, "readyForTrickFromPlayer." + player); - playTrick(self, player, target, 1); + if(correctPlayer == player) { + switch (idx) { + case 0: + utils.removeScriptVar(target, "readyForTrickFromPlayer." + player); + playTrick(self, player, target, 1); + break; + case 1: + utils.removeScriptVar(target, "readyForTrickFromPlayer." + player); + playTrick(self, player, target, 2); + break; + case 2: + utils.removeScriptVar(target, "readyForTrickFromPlayer." + player); + playTrick(self, player, target, 3); + break; + case 3: + utils.removeScriptVar(target, "readyForTrickFromPlayer." + player); + playTrick(self, player, target, 4); + break; + case 4: + utils.removeScriptVar(target, "readyForTrickFromPlayer." + player); + playTrick(self, player, target, 5); + break; + default: + cleanScriptVars(player); } - break; - case 1: - if (correctPlayer == player) - { - utils.removeScriptVar(target, "readyForTrickFromPlayer." + player); - playTrick(self, player, target, 2); - } - break; - case 2: - if (correctPlayer == player) - { - utils.removeScriptVar(target, "readyForTrickFromPlayer." + player); - playTrick(self, player, target, 3); - } - break; - case 3: - if (correctPlayer == player) - { - utils.removeScriptVar(target, "readyForTrickFromPlayer." + player); - playTrick(self, player, target, 4); - } - break; - case 4: - if (correctPlayer == player) - { - utils.removeScriptVar(target, "readyForTrickFromPlayer." + player); - playTrick(self, player, target, 5); - } - break; - default: - cleanScriptVars(player); - return SCRIPT_CONTINUE; } } return SCRIPT_CONTINUE; } - public void playTrick(obj_id self, obj_id player, obj_id target, int trick) throws InterruptedException + private void playTrick(obj_id self, obj_id player, obj_id target, int trick) throws InterruptedException { if (!ai_lib.isInCombat(player) || !ai_lib.isInCombat(target)) { int deviceQuality = getIntObjVar(self, "item.projector"); - int scariestChance = rand(1, 5); - int scareChance = 0; + int scareChance; if (deviceQuality == 3) { scareChance = rand(1, 70); } - if (deviceQuality == 2) + else if (deviceQuality == 2) { scareChance = rand(1, 80); } - if (deviceQuality == 1) + else if (deviceQuality == 1) { scareChance = rand(1, 100); } - if (deviceQuality < 1) + else { sendSystemMessage(player, FAULTY_DEVICE); return; } int scareDialogue = rand(1, 5); + int scariestChance = rand(1, 5); switch (trick) { case 1: - playClientEffectObj(player, TRICK_1, target, ""); - if (scariestChance == 1) - { - chat.chat(target, player, chat.CHAT_SCREAM, new string_id(HALLOWEEN, "super_scared_" + scareDialogue), chat.ChatFlag_targetOnly); - event_perk.giveTreat(player, 2); - doAnimationAction(target, "cover_eyes"); - } - else if (scareChance < 51) - { - doAnimationAction(target, "scared"); - chat.chat(target, player, chat.CHAT_STUTTER, new string_id(HALLOWEEN, "scared_" + scareDialogue), chat.ChatFlag_targetOnly); - event_perk.giveTreat(player, 1); - } - else - { - doAnimationAction(target, "dismiss"); - chat.chat(target, player, chat.CHAT_SAY, new string_id(HALLOWEEN, "not_scared_" + scareDialogue), chat.ChatFlag_targetOnly); - } - break; + playClientEffectObj(player, TRICK_1, target, ""); + break; case 2: - playClientEffectObj(player, TRICK_2, target, ""); - if (scariestChance == 2) - { - chat.chat(target, player, chat.CHAT_SCREAM, new string_id(HALLOWEEN, "super_scared_" + scareDialogue), chat.ChatFlag_targetOnly); - event_perk.giveTreat(player, 2); - doAnimationAction(target, "cover_eyes"); - } - else if (scareChance < 51) - { - doAnimationAction(target, "scared"); - chat.chat(target, player, chat.CHAT_STUTTER, new string_id(HALLOWEEN, "scared_" + scareDialogue), chat.ChatFlag_targetOnly); - event_perk.giveTreat(player, 1); - } - else - { - doAnimationAction(target, "dismiss"); - chat.chat(target, player, chat.CHAT_SAY, new string_id(HALLOWEEN, "not_scared_" + scareDialogue), chat.ChatFlag_targetOnly); - } - break; + playClientEffectObj(player, TRICK_2, target, ""); + break; case 3: - playClientEffectObj(player, TRICK_3, target, ""); - if (scariestChance == 3) - { - chat.chat(target, player, chat.CHAT_SCREAM, new string_id(HALLOWEEN, "super_scared_" + scareDialogue), chat.ChatFlag_targetOnly); - event_perk.giveTreat(player, 2); - doAnimationAction(target, "cover_eyes"); - } - else if (scareChance < 51) - { - doAnimationAction(target, "scared"); - chat.chat(target, player, chat.CHAT_STUTTER, new string_id(HALLOWEEN, "scared_" + scareDialogue), chat.ChatFlag_targetOnly); - event_perk.giveTreat(player, 1); - } - else - { - doAnimationAction(target, "dismiss"); - chat.chat(target, player, chat.CHAT_SAY, new string_id(HALLOWEEN, "not_scared_" + scareDialogue), chat.ChatFlag_targetOnly); - } - break; + playClientEffectObj(player, TRICK_3, target, ""); + break; case 4: - playClientEffectObj(player, TRICK_4, target, ""); - if (scariestChance == 4) - { - chat.chat(target, player, chat.CHAT_SCREAM, new string_id(HALLOWEEN, "super_scared_" + scareDialogue), chat.ChatFlag_targetOnly); - event_perk.giveTreat(player, 2); - doAnimationAction(target, "cover_eyes"); - } - else if (scareChance < 51) - { - doAnimationAction(target, "scared"); - chat.chat(target, player, chat.CHAT_STUTTER, new string_id(HALLOWEEN, "scared_" + scareDialogue), chat.ChatFlag_targetOnly); - event_perk.giveTreat(player, 1); - } - else - { - doAnimationAction(target, "dismiss"); - chat.chat(target, player, chat.CHAT_SAY, new string_id(HALLOWEEN, "not_scared_" + scareDialogue), chat.ChatFlag_targetOnly); - } - break; + playClientEffectObj(player, TRICK_4, target, ""); + break; case 5: - playClientEffectObj(player, TRICK_5, target, ""); - if (scariestChance == 5) - { - chat.chat(target, player, chat.CHAT_SCREAM, new string_id(HALLOWEEN, "super_scared_" + scareDialogue), chat.ChatFlag_targetOnly); - event_perk.giveTreat(player, 2); - doAnimationAction(target, "cover_eyes"); - } - else if (scareChance < 51) - { - doAnimationAction(target, "scared"); - chat.chat(target, player, chat.CHAT_STUTTER, new string_id(HALLOWEEN, "scared_" + scareDialogue), chat.ChatFlag_targetOnly); - event_perk.giveTreat(player, 1); - } - else - { - doAnimationAction(target, "dismiss"); - chat.chat(target, player, chat.CHAT_SAY, new string_id(HALLOWEEN, "not_scared_" + scareDialogue), chat.ChatFlag_targetOnly); - } - break; - default: - break; + playClientEffectObj(player, TRICK_5, target, ""); + break; + } + if (scariestChance == trick) + { + chat.chat(target, player, chat.CHAT_SCREAM, new string_id(HALLOWEEN, "super_scared_" + scareDialogue), chat.ChatFlag_targetOnly); + event_perk.giveTreat(player, 2); + doAnimationAction(target, "cover_eyes"); + } + else if (scareChance < 51) + { + doAnimationAction(target, "scared"); + chat.chat(target, player, chat.CHAT_STUTTER, new string_id(HALLOWEEN, "scared_" + scareDialogue), chat.ChatFlag_targetOnly); + event_perk.giveTreat(player, 1); + } + else + { + doAnimationAction(target, "dismiss"); + chat.chat(target, player, chat.CHAT_SAY, new string_id(HALLOWEEN, "not_scared_" + scareDialogue), chat.ChatFlag_targetOnly); } } else @@ -464,18 +352,15 @@ public class trick_device extends script.base_script } public void cleanScriptVars(obj_id player) throws InterruptedException { - obj_id self = getSelf(); utils.removeScriptVarTree(player, "trick_or_treat_device"); - utils.removeScriptVarTree(self, "trick_or_treat_device"); + utils.removeScriptVarTree(getSelf(), "trick_or_treat_device"); setObjVar(player, "trick_or_treat_device", true); } public void closeOldWindow(obj_id player) throws InterruptedException { - String playerPath = "trick_or_treat_device."; if (utils.hasScriptVar(player, "trick_or_treat_device.pid")) { - int oldpid = utils.getIntScriptVar(player, "trick_or_treat_device.pid"); - forceCloseSUIPage(oldpid); + forceCloseSUIPage(utils.getIntScriptVar(player, "trick_or_treat_device.pid")); utils.removeScriptVar(player, "trick_or_treat_device.pid"); } } @@ -486,7 +371,7 @@ public class trick_device extends script.base_script utils.setScriptVar(player, "trick_or_treat_device.pid", pid); } } - public boolean inHouse(obj_id device) throws InterruptedException + private boolean inHouse(obj_id device) throws InterruptedException { obj_id selfContainer = getContainedBy(device); obj_id ship = space_transition.getContainingShip(selfContainer); @@ -501,7 +386,7 @@ public class trick_device extends script.base_script } return false; } - public void startFog(obj_id device) throws InterruptedException + private void startFog(obj_id device) throws InterruptedException { stopClientEffectObjByLabel(device, "halloweenFog"); if (!hasObjVar(device, "fogOn")) @@ -512,7 +397,7 @@ public class trick_device extends script.base_script playClientEffectObj(device, "clienteffect/halloween_fog_machine.cef", device, "", null, "halloweenFog"); messageTo(device, "continueFog", null, 18.0f, false); } - public void stopFog(obj_id device) throws InterruptedException + private void stopFog(obj_id device) throws InterruptedException { stopClientEffectObjByLabel(device, "halloweenFog"); if (hasObjVar(device, "fogOn")) diff --git a/sku.0/sys.server/compiled/game/script/event/halloween/trick_or_treater.java b/sku.0/sys.server/compiled/game/script/event/halloween/trick_or_treater.java old mode 100644 new mode 100755 index 9b3c2ede1..97ff00518 --- a/sku.0/sys.server/compiled/game/script/event/halloween/trick_or_treater.java +++ b/sku.0/sys.server/compiled/game/script/event/halloween/trick_or_treater.java @@ -1,25 +1,11 @@ package script.event.halloween; -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.deltadictionary; +import script.library.*; +import script.location; +import script.obj_id; +import script.region; -import script.library.create; -import script.library.utils; -import script.library.player_structure; -import script.library.sui; -import script.library.static_item; -import script.library.buff; -import script.library.chat; -import script.library.ai_lib; -import script.library.beast_lib; -import script.library.factions; -import script.library.vehicle; -import script.library.event_perk; import java.util.Enumeration; public class trick_or_treater extends script.base_script @@ -29,31 +15,22 @@ public class trick_or_treater extends script.base_script } public int OnLogin(obj_id self) throws InterruptedException { - if (costumeBuffExists(self) == false) + if (!costumeBuffExists(self)) { detachScript(self, "event.halloween.trick_or_treater"); } if (buff.hasBuff(self, "event_halloween_coin_limit")) { - if (event_perk.newDayOrNot(self) == true) + if (event_perk.newDayOrNot(self)) { buff.removeBuff(self, "event_halloween_coin_limit"); } } - if (event_perk.newDayOrNot(self) == true) + if (event_perk.newDayOrNot(self)) { - if (hasObjVar(self, event_perk.COUNTER)) - { - removeObjVar(self, event_perk.COUNTER); - } - if (hasObjVar(self, event_perk.COUNTER_RESTARTTIME)) - { - removeObjVar(self, event_perk.COUNTER_RESTARTTIME); - } - if (hasObjVar(self, event_perk.COUNTER_TIMESTAMP)) - { - removeObjVar(self, event_perk.COUNTER_TIMESTAMP); - } + removeObjVar(self, event_perk.COUNTER); + removeObjVar(self, event_perk.COUNTER_RESTARTTIME); + removeObjVar(self, event_perk.COUNTER_TIMESTAMP); } return SCRIPT_CONTINUE; } @@ -61,31 +38,22 @@ public class trick_or_treater extends script.base_script { if (buff.hasBuff(self, "event_halloween_coin_limit")) { - if (event_perk.newDayOrNot(self) == true) + if (event_perk.newDayOrNot(self)) { buff.removeBuff(self, "event_halloween_coin_limit"); } } - if (event_perk.newDayOrNot(self) == true) + if (event_perk.newDayOrNot(self)) { - if (hasObjVar(self, event_perk.COUNTER)) - { - removeObjVar(self, event_perk.COUNTER); - } - if (hasObjVar(self, event_perk.COUNTER_RESTARTTIME)) - { - removeObjVar(self, event_perk.COUNTER_RESTARTTIME); - } - if (hasObjVar(self, event_perk.COUNTER_TIMESTAMP)) - { - removeObjVar(self, event_perk.COUNTER_TIMESTAMP); - } + removeObjVar(self, event_perk.COUNTER); + removeObjVar(self, event_perk.COUNTER_RESTARTTIME); + removeObjVar(self, event_perk.COUNTER_TIMESTAMP); } return SCRIPT_CONTINUE; } public int OnInitialize(obj_id self) throws InterruptedException { - if (costumeBuffExists(self) == false) + if (!costumeBuffExists(self)) { detachScript(self, "event.halloween.trick_or_treater"); } @@ -110,12 +78,12 @@ public class trick_or_treater extends script.base_script } } } - if (costumeBuffExists(self) == false) + if (!costumeBuffExists(self)) { detachScript(self, "event.halloween.trick_or_treater"); return SCRIPT_CONTINUE; } - if ((toLower(text)).indexOf("trick or treat") > -1) + if ((toLower(text)).contains("trick or treat")) { location speakerLocation = getLocation(speaker); if (isInCity(speakerLocation)) @@ -158,12 +126,12 @@ public class trick_or_treater extends script.base_script sendSystemMessage(self, event_perk.ZOZ); return SCRIPT_CONTINUE; } - if (hasObjVar(target, "celebrity")) + else if (hasObjVar(target, "celebrity")) { sendSystemMessage(self, event_perk.STATIC_NPC); return SCRIPT_CONTINUE; } - if (event_perk.timeStampCheck(self) == false) + else if (!event_perk.timeStampCheck(self)) { return SCRIPT_CONTINUE; } @@ -237,47 +205,25 @@ public class trick_or_treater extends script.base_script region[] regionsHere = getRegionsAtPoint(here); if (regionsHere != null && regionsHere.length > 0) { - for (int i = 0; i < regionsHere.length; i++) - { - region testRegion = regionsHere[i]; - String regionName = testRegion.getName(); - if (regionName.endsWith("mos_eisley")) - { + String regionName; + for (region testRegion : regionsHere) { + regionName = testRegion.getName(); + if (regionName.endsWith("mos_eisley")) { return true; } - if (regionName.endsWith("moenia")) - { + if (regionName.endsWith("moenia")) { return true; } } } return false; } - public boolean costumeBuffExists(obj_id player) throws InterruptedException + private boolean costumeBuffExists(obj_id player) throws InterruptedException { - if (buff.hasBuff(player, "event_halloween_costume_jawa")) - { - return true; - } - if (buff.hasBuff(player, "event_halloween_costume_droid")) - { - return true; - } - if (buff.hasBuff(player, "event_halloween_costume_kowakian")) - { - return true; - } - if (buff.hasBuff(player, "event_halloween_costume_hutt_female")) - { - return true; - } - if (buff.hasBuff(player, "event_halloween_costume_toydarian")) - { - return true; - } - else - { - return false; - } + return buff.hasBuff(player, "event_halloween_costume_jawa") || + buff.hasBuff(player, "event_halloween_costume_droid") || + buff.hasBuff(player, "event_halloween_costume_kowakian") || + buff.hasBuff(player, "event_halloween_costume_hutt_female") || + buff.hasBuff(player, "event_halloween_costume_toydarian"); } } diff --git a/sku.0/sys.server/compiled/game/script/library/utils.java b/sku.0/sys.server/compiled/game/script/library/utils.java index 9a6454e1a..185e41d2d 100755 --- a/sku.0/sys.server/compiled/game/script/library/utils.java +++ b/sku.0/sys.server/compiled/game/script/library/utils.java @@ -1692,7 +1692,13 @@ public class utils extends script.base_script } public static int countOfStackedItemsInArray(obj_id[] items) throws InterruptedException { - return items.length; + int totalCount = 0; + + for (obj_id item : items) { + testAbortScript(); + totalCount += getCount(item); + } + return totalCount; } public static obj_id getItemPlayerHasByTemplate(obj_id objPlayer, String strTemplate) throws InterruptedException {