diff --git a/sku.0/sys.server/compiled/game/script/event/lifeday/city_spawner.java b/sku.0/sys.server/compiled/game/script/event/lifeday/city_spawner.java old mode 100644 new mode 100755 index 12a839b22..f34f10638 --- a/sku.0/sys.server/compiled/game/script/event/lifeday/city_spawner.java +++ b/sku.0/sys.server/compiled/game/script/event/lifeday/city_spawner.java @@ -1,51 +1,40 @@ package script.event.lifeday; -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.location; +import script.obj_id; public class city_spawner extends script.base_script { public city_spawner() { } - public static final int[] LOCS = + private static final int[][] startLocations = { - 131, - 52, - -5384, - -5545, - 23, - -6177, - -5557, - -150, - 0 + {131,52,-5384}, + {-5545,23,-6177}, + {-5557,-150,0} }; public int OnInitialize(obj_id self) throws InterruptedException { if (!hasObjVar(self, "event.lifeday.spawned")) { String myPlanet = getCurrentSceneName(); - if (!myPlanet.equals("tatooine") && !myPlanet.equals("corellia") && !myPlanet.equals("naboo")) - { - return SCRIPT_CONTINUE; + int locStart; + switch(myPlanet){ + case "tatooine": + locStart = 0; + break; + case "corellia": + locStart = 1; + break; + case "naboo": + locStart = 2; + break; + default: + return SCRIPT_CONTINUE; } - int locStart = 0; - if (myPlanet.equals("corellia")) - { - locStart = 3; - } - if (myPlanet.equals("naboo")) - { - locStart = 6; - } - location male1Spawn = new location(LOCS[locStart], LOCS[locStart + 1], LOCS[locStart + 2], myPlanet); + location male1Spawn = new location(startLocations[locStart][0], startLocations[locStart][1], startLocations[locStart][2], myPlanet); obj_id male1 = create.object("object/tangible/spawning/static_npc/wookiee_lifeday_male1.iff", male1Spawn); setObjVar(self, "event.lifeday.spawned", 1); setObjVar(self, "event.lifeday.male1", male1); diff --git a/sku.0/sys.server/compiled/game/script/event/lifeday/lifeday_gift.java b/sku.0/sys.server/compiled/game/script/event/lifeday/lifeday_gift.java old mode 100644 new mode 100755 index 983a83bf6..217e7430f --- a/sku.0/sys.server/compiled/game/script/event/lifeday/lifeday_gift.java +++ b/sku.0/sys.server/compiled/game/script/event/lifeday/lifeday_gift.java @@ -1,15 +1,9 @@ package script.event.lifeday; 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.static_item; +import script.library.utils; + import java.util.HashSet; public class lifeday_gift extends script.base_script @@ -17,12 +11,12 @@ public class lifeday_gift extends script.base_script public lifeday_gift() { } - public static final string_id CRATE_USED = new string_id("spam", "opened_crate"); - public static final string_id GIVE_AWAY = new string_id("spam", "give_away"); - public static final string_id OUTSIDE = new string_id("spam", "must_be_outside"); - public static final string_id MOUNTED = new string_id("spam", "mounted"); - public static final string_id UNABLE = new string_id("spam", "no_data"); - public static final String LIFEDAY_TABLE = "datatables/event/lifeday/lifeday_gift.iff"; + private static final string_id CRATE_USED = new string_id("spam", "opened_crate"); + private static final string_id GIVE_AWAY = new string_id("spam", "give_away"); + private static final string_id OUTSIDE = new string_id("spam", "must_be_outside"); + private static final string_id MOUNTED = new string_id("spam", "mounted"); + private static final string_id UNABLE = new string_id("spam", "no_data"); + private static final String LIFEDAY_TABLE = "datatables/event/lifeday/lifeday_gift.iff"; public int OnObjectMenuRequest(obj_id self, obj_id player, menu_info mi) throws InterruptedException { if (canManipulate(player, self, true, true, 5, true)) @@ -50,29 +44,26 @@ public class lifeday_gift extends script.base_script } if (item == menu_info_types.ITEM_USE) { - String[] itemNames = new String[1]; - dictionary giftData = new dictionary(); String year = getStringObjVar(self, "year"); if (year == null || year.equals("")) { return SCRIPT_CONTINUE; } - giftData = dataTableGetRow(LIFEDAY_TABLE, year); + dictionary giftData = dataTableGetRow(LIFEDAY_TABLE, year); if (giftData == null) { sendSystemMessage(player, UNABLE); return SCRIPT_CONTINUE; } + String[] itemNames = new String[1]; if (hasObjVar(self, utils.LIFEDAY_OWNER)) { obj_id owner = getObjIdObjVar(self, utils.LIFEDAY_OWNER); if (owner != player) { - String giftsOtherUnparsed = giftData.getString("gift_other"); - String[] giftsOther = split(giftsOtherUnparsed, ','); + String[] giftsOther = split(giftData.getString("gift_other"), ','); itemNames[0] = giftsOther[rand(0, giftsOther.length - 1)]; - int grantAllGiftsOther = giftData.getInt("grant_all_other"); - if (grantAllGiftsOther != 0) + if (giftData.getInt("grant_all_other") != 0) { itemNames = giftsOther; } @@ -111,8 +102,7 @@ public class lifeday_gift extends script.base_script } public boolean grantReward(obj_id player, String[] itemNames, dictionary giftData) throws InterruptedException { - obj_id mount = getMountId(player); - if (isIdValid(mount)) + if (isIdValid(getMountId(player))) { sendSystemMessage(player, MOUNTED); return false; @@ -132,9 +122,8 @@ public class lifeday_gift extends script.base_script if (isIdValid(pInv) && (itemNames != null && itemNames.length > 0)) { HashSet theSet = new HashSet(); - for (int i = 0; i < itemNames.length; i++) - { - theSet.add(static_item.createNewItemFunction(itemNames[i], pInv)); + for (String itemName : itemNames) { + theSet.add(static_item.createNewItemFunction(itemName, pInv)); } obj_id[] gift = new obj_id[theSet.size()]; theSet.toArray(gift); diff --git a/sku.0/sys.server/compiled/game/script/event/lifeday/lifeday_gift_06.java b/sku.0/sys.server/compiled/game/script/event/lifeday/lifeday_gift_06.java old mode 100644 new mode 100755 index 0139133b5..09f7e49f8 --- a/sku.0/sys.server/compiled/game/script/event/lifeday/lifeday_gift_06.java +++ b/sku.0/sys.server/compiled/game/script/event/lifeday/lifeday_gift_06.java @@ -1,15 +1,9 @@ package script.event.lifeday; -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.static_item; +import script.library.utils; +import script.*; + import java.util.HashSet; public class lifeday_gift_06 extends script.base_script @@ -17,15 +11,15 @@ public class lifeday_gift_06 extends script.base_script public lifeday_gift_06() { } - public static final string_id CRATE_USED = new string_id("spam", "opened_crate"); - public static final string_id GIVE_AWAY = new string_id("spam", "give_away"); - public static final string_id OUTSIDE = new string_id("spam", "must_be_outside"); - public static final String[] GIFTS_SELF = + private static final string_id CRATE_USED = new string_id("spam", "opened_crate"); + private static final string_id GIVE_AWAY = new string_id("spam", "give_away"); + private static final string_id OUTSIDE = new string_id("spam", "must_be_outside"); + private static final String[] GIFTS_SELF = { "item_lifeday_wreath_01_01", "item_lifeday_mini_tree_01_01" }; - public static final String[] GIFTS_RANDOM = + private static final String[] GIFTS_RANDOM = { "item_lifeday_bunting_01_01", "item_lifeday_incense_burner_01_01", @@ -94,10 +88,7 @@ public class lifeday_gift_06 extends script.base_script else { String[] items = new String[(GIFTS_SELF.length + 1)]; - for (int i = 0; i < GIFTS_SELF.length; i++) - { - items[i] = GIFTS_SELF[i]; - } + System.arraycopy(GIFTS_SELF, 0, items, 0, GIFTS_SELF.length); items[GIFTS_SELF.length] = GIFTS_RANDOM[rand(0, GIFTS_RANDOM.length - 1)]; if (grantReward(player, items)) { @@ -122,9 +113,8 @@ public class lifeday_gift_06 extends script.base_script if (isIdValid(pInv) && (items != null && items.length > 0)) { HashSet theSet = new HashSet(); - for (int i = 0; i < items.length; i++) - { - theSet.add(static_item.createNewItemFunction(items[i], pInv)); + for (String item : items) { + theSet.add(static_item.createNewItemFunction(item, pInv)); } obj_id[] gift = new obj_id[theSet.size()]; theSet.toArray(gift); diff --git a/sku.0/sys.server/compiled/game/script/event/lifeday/lifeday_objective.java b/sku.0/sys.server/compiled/game/script/event/lifeday/lifeday_objective.java old mode 100644 new mode 100755 index 6b1418d0b..895b3d401 --- a/sku.0/sys.server/compiled/game/script/event/lifeday/lifeday_objective.java +++ b/sku.0/sys.server/compiled/game/script/event/lifeday/lifeday_objective.java @@ -1,79 +1,65 @@ package script.event.lifeday; 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.sui; -import script.library.groundquests; -import script.library.create; -import script.library.trial; -import script.library.buff; -import script.library.factions; -import script.library.stealth; -import script.library.static_item; +import script.library.*; public class lifeday_objective extends script.base_script { public lifeday_objective() { } - public static final String LIFEDAY = "event/life_day"; - public static final string_id SID_ALREADY_DRESSED = new string_id(LIFEDAY, "already_dressed"); - public static final string_id SID_ALREADY_STOMPED = new string_id(LIFEDAY, "already_stomped"); - public static final string_id SID_WRONG_FACTION = new string_id(LIFEDAY, "wrong_faction"); - public static final string_id SID_LOCKED_OUT = new string_id(LIFEDAY, "locked_out"); - public static final string_id SID_IMPERIAL_START = new string_id(LIFEDAY, "imperial_start"); - public static final string_id SID_REBEL_START = new string_id(LIFEDAY, "rebel_start"); - public static final string_id SID_IMPERIAL_COMPETITIVE_START = new string_id(LIFEDAY, "imperial_competitive_start"); - public static final string_id SID_REBEL_COMPETITIVE_START = new string_id(LIFEDAY, "rebel_competitive_start"); - public static final string_id SID_NEUTRAL_IMP_COMP_START = new string_id(LIFEDAY, "neutral_imperial_comp_start"); - public static final string_id SID_NEUTRAL_REB_COMP_START = new string_id(LIFEDAY, "neutral_rebel_comp_start"); - public static final string_id SID_NEUTRAL_IMP_CAS_START = new string_id(LIFEDAY, "neutral_imperial_cas_start"); - public static final string_id SID_NEUTRAL_REB_CAS_START = new string_id(LIFEDAY, "neutral_rebel_cas_start"); - public static final string_id SID_MNU_DRESS = new string_id(LIFEDAY, "dress_menu_header"); - public static final string_id SID_MNU_STOMP = new string_id(LIFEDAY, "stomp_menu_header"); - public static final string_id SID_ZIP_DRESSING = new string_id(LIFEDAY, "dress_zip_bar_text"); - public static final string_id SID_ZIP_STOMPING = new string_id(LIFEDAY, "stomp_zip_bar_text"); - public static final string_id SID_TOKENS_REBEL = new string_id(LIFEDAY, "tokens_rebel"); - public static final string_id SID_TOKENS_REBEL_HIGH = new string_id(LIFEDAY, "tokens_rebel_high"); - public static final string_id SID_TOKENS_IMPERIAL = new string_id(LIFEDAY, "tokens_imperial"); - public static final string_id SID_TOKENS_IMPERIAL_HIGH = new string_id(LIFEDAY, "tokens_imperial_high"); - public static final string_id SID_PICK_PATH = new string_id(LIFEDAY, "pick_path"); - public static final string_id SID_REACHED_LIMIT = new string_id(LIFEDAY, "reached_limit"); - public static final string_id SID_MOUNTED = new string_id(LIFEDAY, "mounted"); - public static final String LOCKED_OUT = "lifeday.locked_out"; - public static final String LIFEDAY_TIMESTAMP = "lifeday.time_stamp"; - public static final String NEUTRAL_IMPERIAL = "lifeday.neutral_imperial"; - public static final String NEUTRAL_REBEL = "lifeday.neutral_rebel"; - public static final String TOKEN_COUNTER = "lifeday.token_counter"; - public static final String IMPERIAL_COMPETITIVE_BUFF = "event_lifeday_imperial_competitive"; - public static final String REBEL_COMPETITIVE_BUFF = "event_lifeday_rebel_competitive"; - public static final String IMPERIAL_COUNTER_BUFF = "event_lifeday_imperial_present_counter"; - public static final String REBEL_COUNTER_BUFF = "event_lifeday_rebel_tree_counter"; - public static final String PICKED_CASUAL_BUFF_REBEL = "event_lifeday_casual_rebel_lock_in"; - public static final String PICKED_CASUAL_BUFF_IMPERIAL = "event_lifeday_casual_imperial_lock_in"; - public static final String PICKED_COMPETITIVE_BUFF_REBEL = "event_lifeday_competitive_rebel_lock_in"; - public static final String PICKED_COMPETITIVE_BUFF_IMPERIAL = "event_lifeday_competitive_imperial_lock_in"; - public static final String TREE = "object/tangible/holiday/life_day/life_day_tree.iff"; - public static final String TREE_DRESSED = "object/tangible/holiday/life_day/life_day_tree_dressed.iff"; - public static final String PRESENTS = "object/tangible/holiday/life_day/life_day_present.iff"; - public static final String PRESENTS_STOMPED = "object/tangible/holiday/life_day/life_day_present_stomped.iff"; - public static final String REBEL_TOKEN = "item_event_lifeday_rebel_token"; - public static final String IMPERIAL_TOKEN = "item_event_lifeday_imperial_token"; - public static final float MIN_DESTROY_TIME = 60; - public static final float MAX_DESTROY_TIME = 180; - public static final int COUNTDOWN_TIMER = 3; - public static final int NON_DECLARED_TOKENS = 5; - public static final int DECLARED_TOKENS = 15; - public static final int REBEL = 1; - public static final int IMPERIAL = 2; - public static final int DAILY_COUNTER_LIMIT = 9; + private static final String LIFEDAY = "event/life_day"; + private static final string_id SID_ALREADY_DRESSED = new string_id(LIFEDAY, "already_dressed"); + private static final string_id SID_ALREADY_STOMPED = new string_id(LIFEDAY, "already_stomped"); + private static final string_id SID_WRONG_FACTION = new string_id(LIFEDAY, "wrong_faction"); + private static final string_id SID_LOCKED_OUT = new string_id(LIFEDAY, "locked_out"); + private static final string_id SID_IMPERIAL_START = new string_id(LIFEDAY, "imperial_start"); + private static final string_id SID_REBEL_START = new string_id(LIFEDAY, "rebel_start"); + private static final string_id SID_IMPERIAL_COMPETITIVE_START = new string_id(LIFEDAY, "imperial_competitive_start"); + private static final string_id SID_REBEL_COMPETITIVE_START = new string_id(LIFEDAY, "rebel_competitive_start"); + private static final string_id SID_NEUTRAL_IMP_COMP_START = new string_id(LIFEDAY, "neutral_imperial_comp_start"); + private static final string_id SID_NEUTRAL_REB_COMP_START = new string_id(LIFEDAY, "neutral_rebel_comp_start"); + private static final string_id SID_NEUTRAL_IMP_CAS_START = new string_id(LIFEDAY, "neutral_imperial_cas_start"); + private static final string_id SID_NEUTRAL_REB_CAS_START = new string_id(LIFEDAY, "neutral_rebel_cas_start"); + private static final string_id SID_MNU_DRESS = new string_id(LIFEDAY, "dress_menu_header"); + private static final string_id SID_MNU_STOMP = new string_id(LIFEDAY, "stomp_menu_header"); + private static final string_id SID_ZIP_DRESSING = new string_id(LIFEDAY, "dress_zip_bar_text"); + private static final string_id SID_ZIP_STOMPING = new string_id(LIFEDAY, "stomp_zip_bar_text"); + private static final string_id SID_TOKENS_REBEL = new string_id(LIFEDAY, "tokens_rebel"); + private static final string_id SID_TOKENS_REBEL_HIGH = new string_id(LIFEDAY, "tokens_rebel_high"); + private static final string_id SID_TOKENS_IMPERIAL = new string_id(LIFEDAY, "tokens_imperial"); + private static final string_id SID_TOKENS_IMPERIAL_HIGH = new string_id(LIFEDAY, "tokens_imperial_high"); + private static final string_id SID_PICK_PATH = new string_id(LIFEDAY, "pick_path"); + private static final string_id SID_REACHED_LIMIT = new string_id(LIFEDAY, "reached_limit"); + private static final string_id SID_MOUNTED = new string_id(LIFEDAY, "mounted"); + private static final String LOCKED_OUT = "lifeday.locked_out"; + private static final String LIFEDAY_TIMESTAMP = "lifeday.time_stamp"; + private static final String NEUTRAL_IMPERIAL = "lifeday.neutral_imperial"; + private static final String NEUTRAL_REBEL = "lifeday.neutral_rebel"; + private static final String TOKEN_COUNTER = "lifeday.token_counter"; + private static final String IMPERIAL_COMPETITIVE_BUFF = "event_lifeday_imperial_competitive"; + private static final String REBEL_COMPETITIVE_BUFF = "event_lifeday_rebel_competitive"; + private static final String IMPERIAL_COUNTER_BUFF = "event_lifeday_imperial_present_counter"; + private static final String REBEL_COUNTER_BUFF = "event_lifeday_rebel_tree_counter"; + private static final String PICKED_CASUAL_BUFF_REBEL = "event_lifeday_casual_rebel_lock_in"; + private static final String PICKED_CASUAL_BUFF_IMPERIAL = "event_lifeday_casual_imperial_lock_in"; + private static final String PICKED_COMPETITIVE_BUFF_REBEL = "event_lifeday_competitive_rebel_lock_in"; + private static final String PICKED_COMPETITIVE_BUFF_IMPERIAL = "event_lifeday_competitive_imperial_lock_in"; + private static final String TREE = "object/tangible/holiday/life_day/life_day_tree.iff"; + private static final String TREE_DRESSED = "object/tangible/holiday/life_day/life_day_tree_dressed.iff"; + private static final String PRESENTS = "object/tangible/holiday/life_day/life_day_present.iff"; + private static final String PRESENTS_STOMPED = "object/tangible/holiday/life_day/life_day_present_stomped.iff"; + private static final String REBEL_TOKEN = "item_event_lifeday_rebel_token"; + private static final String IMPERIAL_TOKEN = "item_event_lifeday_imperial_token"; + private static final float MIN_DESTROY_TIME = 60; + private static final float MAX_DESTROY_TIME = 180; + private static final int COUNTDOWN_TIMER = 3; + private static final int NON_DECLARED_TOKENS = 5; + private static final int DECLARED_TOKENS = 15; + private static final int REBEL = 1; + private static final int IMPERIAL = 2; + private static final int DAILY_COUNTER_LIMIT = 9; + public int OnAttach(obj_id self) throws InterruptedException { String objectTemplate = getTemplateName(self); @@ -137,56 +123,22 @@ public class lifeday_objective extends script.base_script if (text.equals("resetMe")) { sendSystemMessageTestingOnly(speaker, "Resetting all life day obj vars and buffs"); - if (hasObjVar(speaker, "lifeday.locked_out")) - { - removeObjVar(speaker, "lifeday.locked_out"); - } - if (hasObjVar(speaker, "lifeday.time_stamp")) - { - removeObjVar(speaker, "lifeday.time_stamp"); - } - if (hasObjVar(speaker, "lifeday.neutral_imperial")) - { - removeObjVar(speaker, "lifeday.neutral_imperial"); - } - if (hasObjVar(speaker, "lifeday.neutral_rebel")) - { - removeObjVar(speaker, "lifeday.neutral_rebel"); - } - if (hasObjVar(speaker, "lifeday.token_counter")) - { - removeObjVar(speaker, "lifeday.token_counter"); - } - if (buff.hasBuff(speaker, "event_lifeday_imperial_competitive")) - { - buff.removeBuff(speaker, "event_lifeday_imperial_competitive"); - } - if (buff.hasBuff(speaker, "event_lifeday_rebel_competitive")) - { - buff.removeBuff(speaker, "event_lifeday_rebel_competitive"); - } - if (buff.hasBuff(speaker, "event_lifeday_imperial_present_counter")) - { - buff.removeBuff(speaker, "event_lifeday_imperial_present_counter"); - } - if (buff.hasBuff(speaker, "event_lifeday_rebel_tree_counter")) - { - buff.removeBuff(speaker, "event_lifeday_rebel_tree_counter"); - } - if (buff.hasBuff(speaker, "event_lifeday_casual_buff")) - { - buff.removeBuff(speaker, "event_lifeday_casual_buff"); - } - if (buff.hasBuff(speaker, "event_lifeday_competetive_buff")) - { - buff.removeBuff(speaker, "event_lifeday_competetive_buff"); - } + removeObjVar(speaker, "lifeday.locked_out"); + removeObjVar(speaker, "lifeday.time_stamp"); + removeObjVar(speaker, "lifeday.neutral_imperial"); + removeObjVar(speaker, "lifeday.neutral_rebel"); + removeObjVar(speaker, "lifeday.token_counter"); + buff.removeBuff(speaker, "event_lifeday_imperial_competitive"); + buff.removeBuff(speaker, "event_lifeday_rebel_competitive"); + buff.removeBuff(speaker, "event_lifeday_imperial_present_counter"); + buff.removeBuff(speaker, "event_lifeday_rebel_tree_counter"); + buff.removeBuff(speaker, "event_lifeday_casual_buff"); + buff.removeBuff(speaker, "event_lifeday_competetive_buff"); } return SCRIPT_CONTINUE; } 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); String objectTemplate = getTemplateName(self); if (!isDead(player) && !isIncapacitated(player)) { @@ -205,7 +157,6 @@ public class lifeday_objective extends script.base_script } public int OnObjectMenuSelect(obj_id self, obj_id player, int item) throws InterruptedException { - String objectTemplate = getTemplateName(self); if (item == menu_info_types.ITEM_USE) { if (!canInteract(player, self)) @@ -214,6 +165,7 @@ public class lifeday_objective extends script.base_script } else if (!isDead(player) && !isIncapacitated(player)) { + String objectTemplate = getTemplateName(self); if (objectTemplate.equals(TREE)) { String handler = "handleDressingCountdownTimer"; @@ -223,7 +175,7 @@ public class lifeday_objective extends script.base_script flags |= sui.CD_EVENT_INCAPACITATE; flags |= sui.CD_EVENT_DAMAGED; stealth.testInvisNonCombatAction(player, self); - int countdownSui = sui.smartCountdownTimerSUI(self, player, "quest_countdown_timer", SID_ZIP_DRESSING, startTime, COUNTDOWN_TIMER, handler, range, flags); + sui.smartCountdownTimerSUI(self, player, "quest_countdown_timer", SID_ZIP_DRESSING, startTime, COUNTDOWN_TIMER, handler, range, flags); doAnimationAction(player, "manipulate_high"); } if (objectTemplate.equals(PRESENTS)) @@ -235,14 +187,14 @@ public class lifeday_objective extends script.base_script flags |= sui.CD_EVENT_INCAPACITATE; flags |= sui.CD_EVENT_DAMAGED; stealth.testInvisNonCombatAction(player, self); - int countdownSui = sui.smartCountdownTimerSUI(self, player, "quest_countdown_timer", SID_ZIP_STOMPING, startTime, COUNTDOWN_TIMER, handler, range, flags); + sui.smartCountdownTimerSUI(self, player, "quest_countdown_timer", SID_ZIP_STOMPING, startTime, COUNTDOWN_TIMER, handler, range, flags); doAnimationAction(player, "stamp_feet"); } } } return SCRIPT_CONTINUE; } - public void treeDressed(obj_id self, obj_id player) throws InterruptedException + private void treeDressed(obj_id self, obj_id player) throws InterruptedException { if (!factions.isDeclared(player)) { @@ -257,20 +209,17 @@ public class lifeday_objective extends script.base_script } if (hasObjVar(self, "objParent")) { - obj_id objParent = getObjIdObjVar(self, "objParent"); if (utils.hasScriptVar(self, "deathTracker")) { if (hasObjVar(self, "fltRespawnTime")) { location loc = utils.getLocationScriptVar(self, "deathTracker"); obj_id dressedTree = createObject(TREE_DRESSED, loc); - float respawnTime = getFloatObjVar(self, "fltRespawnTime"); - float yaw = getYaw(self); setObjVar(self, "dontCountDeath", 1); - setObjVar(dressedTree, "objParent", objParent); - setObjVar(dressedTree, "fltRespawnTime", respawnTime); + setObjVar(dressedTree, "objParent", getObjIdObjVar(self, "objParent")); + setObjVar(dressedTree, "fltRespawnTime", getFloatObjVar(self, "fltRespawnTime")); utils.setScriptVar(dressedTree, "deathTracker", loc); - setYaw(dressedTree, yaw); + setYaw(dressedTree, getYaw(self)); attachScript(dressedTree, "event.lifeday.lifeday_objective"); attachScript(dressedTree, "systems.spawning.spawned_tracker"); trial.cleanupObject(self); @@ -289,9 +238,8 @@ public class lifeday_objective extends script.base_script { LOG("Lifeday: ", "Something went wrong, object " + self + "doesn't have the right objvars and script vars on it as it should if it had been spawned correctly. Recommend destroying object."); } - return; } - public void presentsStomped(obj_id self, obj_id player) throws InterruptedException + private void presentsStomped(obj_id self, obj_id player) throws InterruptedException { if (!factions.isDeclared(player)) { @@ -306,18 +254,15 @@ public class lifeday_objective extends script.base_script } if (hasObjVar(self, "objParent")) { - obj_id objParent = getObjIdObjVar(self, "objParent"); if (utils.hasScriptVar(self, "deathTracker")) { location loc = utils.getLocationScriptVar(self, "deathTracker"); obj_id stompedPresents = createObject(PRESENTS_STOMPED, loc); - float respawnTime = getFloatObjVar(self, "fltRespawnTime"); - float yaw = getYaw(self); setObjVar(self, "dontCountDeath", 1); - setObjVar(stompedPresents, "objParent", objParent); - setObjVar(stompedPresents, "fltRespawnTime", respawnTime); + setObjVar(stompedPresents, "objParent", getObjIdObjVar(self, "objParent")); + setObjVar(stompedPresents, "fltRespawnTime", getFloatObjVar(self, "fltRespawnTime")); utils.setScriptVar(stompedPresents, "deathTracker", loc); - setYaw(stompedPresents, yaw); + setYaw(stompedPresents, getYaw(self)); attachScript(stompedPresents, "event.lifeday.lifeday_objective"); attachScript(stompedPresents, "systems.spawning.spawned_tracker"); trial.cleanupObject(self); @@ -331,15 +276,13 @@ public class lifeday_objective extends script.base_script { LOG("Lifeday: ", "Something went wrong, object " + self + "doesn't have the right objvars and script vars on it as it should if it had been spawned correctly. Recommend destroying object."); } - return; } - public void giveTreat(obj_id player, int quantity, int faction) throws InterruptedException + private void giveTreat(obj_id player, int quantity, int faction) throws InterruptedException { obj_id pInv = utils.getInventoryContainer(player); - obj_id rebelTokens = utils.getStaticItemInInventory(player, REBEL_TOKEN); - obj_id imperialTokens = utils.getStaticItemInInventory(player, IMPERIAL_TOKEN); if (faction == REBEL) { + obj_id rebelTokens = utils.getStaticItemInInventory(player, REBEL_TOKEN); if (isIdValid(rebelTokens)) { int currentTokens = getCount(rebelTokens); @@ -347,7 +290,7 @@ public class lifeday_objective extends script.base_script } else { - obj_id tokens = static_item.createNewItemFunction(REBEL_TOKEN, pInv, quantity); + static_item.createNewItemFunction(REBEL_TOKEN, pInv, quantity); } doAnimationAction(player, "cheer"); if (quantity > NON_DECLARED_TOKENS) @@ -359,8 +302,9 @@ public class lifeday_objective extends script.base_script sendSystemMessage(player, SID_TOKENS_REBEL); } } - if (faction == IMPERIAL) + else if (faction == IMPERIAL) { + obj_id imperialTokens = utils.getStaticItemInInventory(player, IMPERIAL_TOKEN); if (isIdValid(imperialTokens)) { int currentTokens = getCount(imperialTokens); @@ -368,7 +312,7 @@ public class lifeday_objective extends script.base_script } else { - obj_id tokens = static_item.createNewItemFunction(IMPERIAL_TOKEN, pInv, quantity); + static_item.createNewItemFunction(IMPERIAL_TOKEN, pInv, quantity); } doAnimationAction(player, "cheer"); if (quantity > NON_DECLARED_TOKENS) @@ -397,14 +341,13 @@ public class lifeday_objective extends script.base_script { setObjVar(player, TOKEN_COUNTER, quantity); } - return; } - public void applyCorrectBuff(obj_id self, obj_id player) throws InterruptedException + private void applyCorrectBuff(obj_id self, obj_id player) throws InterruptedException { - String objectTemplate = getTemplateName(self); int lifeDayBuff = buff.getBuffOnTargetFromGroup(player, "lifeday_tracker"); if (lifeDayBuff == 0) { + String objectTemplate = getTemplateName(self); if (factions.isImperial(player)) { if (objectTemplate.equals(PRESENTS)) @@ -423,7 +366,7 @@ public class lifeday_objective extends script.base_script } } } - if (factions.isRebel(player)) + else if (factions.isRebel(player)) { if (objectTemplate.equals(TREE)) { @@ -476,30 +419,21 @@ public class lifeday_objective extends script.base_script } } } - public boolean newDay(obj_id player) throws InterruptedException + private boolean newDay(obj_id player) throws InterruptedException { if (hasObjVar(player, LIFEDAY_TIMESTAMP)) { int now = getCalendarTime(); int then = getIntObjVar(player, LIFEDAY_TIMESTAMP); - if (now > then) - { - return true; - } - else - { - return false; - } + return now > then; } return true; } - public boolean canInteract(obj_id player, obj_id self) throws InterruptedException + private boolean canInteract(obj_id player, obj_id self) throws InterruptedException { int now = getCalendarTime(); int secondsUntil = secondsUntilNextDailyTime(10, 0, 0); int then = now + secondsUntil; - int lifeDayBuffImperial = buff.getBuffOnTargetFromGroup(player, "lifeday_imperial"); - int lifeDayBuffRebel = buff.getBuffOnTargetFromGroup(player, "lifeday_rebel"); obj_id mount = getMountId(player); if (isIdValid(mount)) { @@ -537,11 +471,13 @@ public class lifeday_objective extends script.base_script sendSystemMessage(player, SID_WRONG_FACTION); return false; } + int lifeDayBuffImperial = buff.getBuffOnTargetFromGroup(player, "lifeday_imperial"); if (objectTemplate.equals(TREE) && (lifeDayBuffImperial != 0)) { sendSystemMessage(player, SID_WRONG_FACTION); return false; } + int lifeDayBuffRebel = buff.getBuffOnTargetFromGroup(player, "lifeday_rebel"); if (objectTemplate.equals(PRESENTS) && (lifeDayBuffRebel != 0)) { sendSystemMessage(player, SID_WRONG_FACTION); @@ -554,38 +490,14 @@ public class lifeday_objective extends script.base_script if (newDay(player)) { setObjVar(player, LIFEDAY_TIMESTAMP, then); - if (hasObjVar(player, LOCKED_OUT)) - { - removeObjVar(player, LOCKED_OUT); - } - if (hasObjVar(player, TOKEN_COUNTER)) - { - removeObjVar(player, TOKEN_COUNTER); - } - if (hasObjVar(player, NEUTRAL_IMPERIAL)) - { - removeObjVar(player, NEUTRAL_IMPERIAL); - } - if (hasObjVar(player, NEUTRAL_REBEL)) - { - removeObjVar(player, NEUTRAL_REBEL); - } - if (buff.hasBuff(player, IMPERIAL_COMPETITIVE_BUFF)) - { - buff.removeBuff(player, IMPERIAL_COMPETITIVE_BUFF); - } - if (buff.hasBuff(player, REBEL_COMPETITIVE_BUFF)) - { - buff.removeBuff(player, REBEL_COMPETITIVE_BUFF); - } - if (buff.hasBuff(player, IMPERIAL_COUNTER_BUFF)) - { - buff.removeBuff(player, IMPERIAL_COUNTER_BUFF); - } - if (buff.hasBuff(player, REBEL_COUNTER_BUFF)) - { - buff.removeBuff(player, REBEL_COUNTER_BUFF); - } + removeObjVar(player, LOCKED_OUT); + removeObjVar(player, TOKEN_COUNTER); + removeObjVar(player, NEUTRAL_IMPERIAL); + removeObjVar(player, NEUTRAL_REBEL); + buff.removeBuff(player, IMPERIAL_COMPETITIVE_BUFF); + buff.removeBuff(player, REBEL_COMPETITIVE_BUFF); + buff.removeBuff(player, IMPERIAL_COUNTER_BUFF); + buff.removeBuff(player, REBEL_COUNTER_BUFF); return false; } if (hasObjVar(player, LOCKED_OUT)) @@ -603,7 +515,6 @@ public class lifeday_objective extends script.base_script } public int handleDressingCountdownTimer(obj_id self, dictionary params) throws InterruptedException { - int pid = params.getInt("id"); obj_id player = params.getObjId("player"); if (!isIdValid(player)) { @@ -637,6 +548,7 @@ public class lifeday_objective extends script.base_script return SCRIPT_CONTINUE; } int test_pid = getIntObjVar(player, sui.COUNTDOWNTIMER_SUI_VAR); + int pid = params.getInt("id"); if (pid != test_pid) { return SCRIPT_CONTINUE; @@ -650,8 +562,7 @@ public class lifeday_objective extends script.base_script } else if (buff.hasBuff(player, REBEL_COUNTER_BUFF)) { - long counter = buff.getBuffStackCount(player, REBEL_COUNTER_BUFF); - if (counter >= DAILY_COUNTER_LIMIT) + if (buff.getBuffStackCount(player, REBEL_COUNTER_BUFF) >= DAILY_COUNTER_LIMIT) { buff.removeBuff(player, REBEL_COUNTER_BUFF); setObjVar(player, LOCKED_OUT, 1); @@ -667,7 +578,6 @@ public class lifeday_objective extends script.base_script } public int handleStompingCountdownTimer(obj_id self, dictionary params) throws InterruptedException { - int pid = params.getInt("id"); obj_id player = params.getObjId("player"); if (!isIdValid(player)) { @@ -700,6 +610,7 @@ public class lifeday_objective extends script.base_script { return SCRIPT_CONTINUE; } + int pid = params.getInt("id"); int test_pid = getIntObjVar(player, sui.COUNTDOWNTIMER_SUI_VAR); if (pid != test_pid) { @@ -714,8 +625,7 @@ public class lifeday_objective extends script.base_script } else if (buff.hasBuff(player, IMPERIAL_COUNTER_BUFF)) { - long counter = buff.getBuffStackCount(player, IMPERIAL_COUNTER_BUFF); - if (counter >= DAILY_COUNTER_LIMIT) + if (buff.getBuffStackCount(player, IMPERIAL_COUNTER_BUFF) >= DAILY_COUNTER_LIMIT) { buff.removeBuff(player, IMPERIAL_COUNTER_BUFF); setObjVar(player, LOCKED_OUT, 1); diff --git a/sku.0/sys.server/compiled/game/script/event/lifeday/lifeday_spawner.java b/sku.0/sys.server/compiled/game/script/event/lifeday/lifeday_spawner.java old mode 100644 new mode 100755 index c92977325..4b7ffc1e0 --- a/sku.0/sys.server/compiled/game/script/event/lifeday/lifeday_spawner.java +++ b/sku.0/sys.server/compiled/game/script/event/lifeday/lifeday_spawner.java @@ -1,90 +1,61 @@ package script.event.lifeday; -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.location; +import script.obj_id; public class lifeday_spawner extends script.base_script { public lifeday_spawner() { } - public static final int[] LOCS = + private static final int[][] LOCS = { - -2580, - 77, - -5519, - -2576, - 77, - -5519, - -2576, - 77, - -5508, - -2580, - 77, - -5508, - -1088, - 6, - -998, - -1088, - 6, - -994, - -1100, - 6, - -994, - -1100, - 6, - -998, - -12, - 163, - -3918, - -12, - 163, - -3922, - -3, - 163, - -3922, - -3, - 163, - -3918 + {-2580,77,-5519}, + {-2576,77,-5519}, + {-2576,77,-5508}, + {-2580,77,-5508}, + {-1088,6,-998}, + {-1088,6,-994}, + {-1100,6,-994}, + {-1100,6,-998}, + {-12,163,-3918}, + {-12,163,-3922}, + {-3,163,-3922}, + {-3,163,-3918} }; public int OnInitialize(obj_id self) throws InterruptedException { if (!hasObjVar(self, "event.lifeday.spawned")) { String myPlanet = getCurrentSceneName(); - if (!myPlanet.equals("dathomir") && !myPlanet.equals("endor") && !myPlanet.equals("yavin4")) - { - return SCRIPT_CONTINUE; + int locStart; + switch(myPlanet){ + case "dathomir": + locStart = 0; + break; + case "endor": + locStart = 4; + break; + case "yavin4": + locStart = 8; + break; + default: + return SCRIPT_CONTINUE; } - int locStart = 0; - if (myPlanet.equals("endor")) - { - locStart = 12; - } - if (myPlanet.equals("yavin4")) - { - locStart = 24; - } - location elderSpawn = new location(LOCS[locStart], LOCS[locStart + 1], LOCS[locStart + 2], myPlanet); - location female1Spawn = new location(LOCS[locStart + 3], LOCS[locStart + 4], LOCS[locStart + 5], myPlanet); - location female2Spawn = new location(LOCS[locStart + 6], LOCS[locStart + 7], LOCS[locStart + 8], myPlanet); - location male2Spawn = new location(LOCS[locStart + 9], LOCS[locStart + 10], LOCS[locStart + 11], myPlanet); + location elderSpawn = new location(LOCS[locStart][0], LOCS[locStart][1], LOCS[locStart][2], myPlanet); + location female1Spawn = new location(LOCS[locStart][0], LOCS[locStart][1], LOCS[locStart][2], myPlanet); + location female2Spawn = new location(LOCS[locStart][0], LOCS[locStart][1], LOCS[locStart][2], myPlanet); + location male2Spawn = new location(LOCS[locStart][0], LOCS[locStart][1], LOCS[locStart][2], myPlanet); obj_id elder = create.object("object/tangible/spawning/static_npc/wookiee_lifeday_elder.iff", elderSpawn); obj_id female1 = create.object("object/tangible/spawning/static_npc/wookiee_lifeday_female1.iff", female1Spawn); obj_id female2 = create.object("object/tangible/spawning/static_npc/wookiee_lifeday_female2.iff", female2Spawn); obj_id male2 = create.object("object/tangible/spawning/static_npc/wookiee_lifeday_male2.iff", male2Spawn); - setObjVar(self, "event.lifeday.spawned", 1); setObjVar(self, "event.lifeday.elder", elder); setObjVar(self, "event.lifeday.female1", female1); setObjVar(self, "event.lifeday.female2", female2); setObjVar(self, "event.lifeday.male2", male2); + setObjVar(self, "event.lifeday.spawned", 1); } return SCRIPT_CONTINUE; } diff --git a/sku.0/sys.server/compiled/game/script/event/lifeday/lifeday_tree.java b/sku.0/sys.server/compiled/game/script/event/lifeday/lifeday_tree.java old mode 100644 new mode 100755 index dabeacdb9..a60c5663f --- a/sku.0/sys.server/compiled/game/script/event/lifeday/lifeday_tree.java +++ b/sku.0/sys.server/compiled/game/script/event/lifeday/lifeday_tree.java @@ -1,30 +1,27 @@ package script.event.lifeday; -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.static_item; import script.library.badge; +import script.library.static_item; +import script.library.utils; +import script.menu_info; +import script.menu_info_types; +import script.obj_id; +import script.string_id; public class lifeday_tree extends script.base_script { public lifeday_tree() { } - public static final string_id TREE_USE = new string_id("spam", "tree_use"); - public static final string_id NOT_OLD_ENOUGH = new string_id("spam", "not_old_enough"); - public static final string_id GIFT_GRANTED = new string_id("spam", "gift_granted"); - public static final String GIFT_SELF = "item_lifeday_gift_self_01_04"; - public static final String GIFT_OTHER = "item_lifeday_gift_other_01_04"; - public static final String LIFEDAY_BADGE = "lifeday_badge_09"; - public static final string_id TREE_BADGE = new string_id("spam", "tree_badge"); - public String currentYearObjVar() throws InterruptedException + private static final string_id TREE_USE = new string_id("spam", "tree_use"); + private static final string_id NOT_OLD_ENOUGH = new string_id("spam", "not_old_enough"); + private static final string_id GIFT_GRANTED = new string_id("spam", "gift_granted"); + private static final String GIFT_SELF = "item_lifeday_gift_self_01_04"; + private static final String GIFT_OTHER = "item_lifeday_gift_other_01_04"; + private static final String LIFEDAY_BADGE = "lifeday_badge_09"; + private static final string_id TREE_BADGE = new string_id("spam", "tree_badge"); + + private String currentYearObjVar() throws InterruptedException { return utils.XMAS_RECEIVED_IX_01; } @@ -71,14 +68,14 @@ public class lifeday_tree extends script.base_script } return SCRIPT_CONTINUE; } - public boolean grantGift(obj_id player) throws InterruptedException + private boolean grantGift(obj_id player) throws InterruptedException { if (!isIdValid(player)) { return false; } obj_id inv = utils.getInventoryContainer(player); - obj_id giftSelf = static_item.createNewItemFunction(GIFT_SELF, inv); + static_item.createNewItemFunction(GIFT_SELF, inv); obj_id giftOther = static_item.createNewItemFunction(GIFT_OTHER, inv); setObjVar(giftOther, utils.LIFEDAY_OWNER, player); utils.sendMail(utils.GIFT_GRANTED_SUB, utils.GIFT_GRANTED, player, "System"); diff --git a/sku.0/sys.server/compiled/game/script/event/lifeday/monkey_pet.java b/sku.0/sys.server/compiled/game/script/event/lifeday/monkey_pet.java old mode 100644 new mode 100755 index bf18383fd..601e0cd92 --- a/sku.0/sys.server/compiled/game/script/event/lifeday/monkey_pet.java +++ b/sku.0/sys.server/compiled/game/script/event/lifeday/monkey_pet.java @@ -1,103 +1,82 @@ package script.event.lifeday; 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.locations; -import script.library.space_transition; -import script.library.space_utils; -import script.library.buff; -import script.library.ai_lib; +import script.library.*; public class monkey_pet extends script.base_script { public monkey_pet() { } - public static final String LIFEDAY = new String("event/life_day"); - public static final String MONKEY_RED = new String("lifeday_monkey_lizard"); - public static final String MONKEY_GREEN = new String("lifeday_monkey_lizard_green"); - public static final String LAUGH = new String("sound/voc_kowakian_laugh.snd"); - public static final String ANIMATION_1 = new String("wave2"); - public static final String ANIMATION_2 = new String("laugh_cackle"); - public static final String ANIMATION_3 = new String("pound_fist_palm"); - public static final String ANIMATION_4 = new String("bow2"); - public static final String ANIMATION_5 = new String("wave1"); - public static final string_id SID_TURN_ON = new string_id(LIFEDAY, "free_monkey"); - public static final string_id SID_TURN_OFF = new string_id(LIFEDAY, "cage_monkey"); + private static final String LIFEDAY = "event/life_day"; + private static final String MONKEY_RED = "lifeday_monkey_lizard"; + private static final String MONKEY_GREEN = "lifeday_monkey_lizard_green"; + private static final String LAUGH = "sound/voc_kowakian_laugh.snd"; + private static final String ANIMATION_1 = "wave2"; + private static final String ANIMATION_2 = "laugh_cackle"; + private static final String ANIMATION_3 = "pound_fist_palm"; + private static final String ANIMATION_4 = "bow2"; + private static final String ANIMATION_5 = "wave1"; + private static final string_id SID_TURN_ON = new string_id(LIFEDAY, "free_monkey"); + private static final string_id SID_TURN_OFF = new string_id(LIFEDAY, "cage_monkey"); + public int OnInitialize(obj_id self) throws InterruptedException { - if (inHouse(self)) + if (inHouse(self) && hasObjVar(self, "petCalled")) { location spawnLoc = getLocation(self); spawnLoc.x += 1; - if (hasObjVar(self, "petCalled")) + if (hasObjVar(self, "petId")) { - if (hasObjVar(self, "petId")) - { - obj_id oldPet = getObjIdObjVar(self, "petId"); - if (!exists(oldPet)) - { - obj_id monkey = create.object(whichMonkey(), spawnLoc); - ai_lib.setDefaultCalmBehavior(monkey, ai_lib.BEHAVIOR_WANDER); - setObjVar(self, "petId", monkey); - setObjVar(monkey, "momId", self); - } - } - else + if (!exists(getObjIdObjVar(self, "petId"))) { obj_id monkey = create.object(whichMonkey(), spawnLoc); + ai_lib.setDefaultCalmBehavior(monkey, ai_lib.BEHAVIOR_WANDER); setObjVar(self, "petId", monkey); setObjVar(monkey, "momId", self); } - createTriggerVolume("laughAura", 5, true); } - else + else { - removeTriggerVolume("laughAura"); + obj_id monkey = create.object(whichMonkey(), spawnLoc); + setObjVar(self, "petId", monkey); + setObjVar(monkey, "momId", self); } + createTriggerVolume("laughAura", 5, true); + } + else + { + removeTriggerVolume("laughAura"); } return SCRIPT_CONTINUE; } public int OnAttach(obj_id self) throws InterruptedException { - if (inHouse(self)) + if (inHouse(self) && hasObjVar(self, "petCalled")) { location spawnLoc = getLocation(self); spawnLoc.x += 1; - if (hasObjVar(self, "petCalled")) + if (hasObjVar(self, "petId")) { - if (hasObjVar(self, "petId")) - { - obj_id oldPet = getObjIdObjVar(self, "petId"); - if (!exists(oldPet)) - { - obj_id monkey = create.object(whichMonkey(), spawnLoc); - ai_lib.setDefaultCalmBehavior(monkey, ai_lib.BEHAVIOR_LOITER); - setObjVar(self, "petId", monkey); - setObjVar(monkey, "momId", self); - } - } - else + if (!exists(getObjIdObjVar(self, "petId"))) { obj_id monkey = create.object(whichMonkey(), spawnLoc); + ai_lib.setDefaultCalmBehavior(monkey, ai_lib.BEHAVIOR_LOITER); setObjVar(self, "petId", monkey); setObjVar(monkey, "momId", self); } - createTriggerVolume("laughAura", 5, true); } - else + else { - removeTriggerVolume("laughAura"); + obj_id monkey = create.object(whichMonkey(), spawnLoc); + setObjVar(self, "petId", monkey); + setObjVar(monkey, "momId", self); } + createTriggerVolume("laughAura", 5, true); + } + else + { + removeTriggerVolume("laughAura"); } return SCRIPT_CONTINUE; } @@ -120,28 +99,19 @@ public class monkey_pet extends script.base_script } public int OnTriggerVolumeEntered(obj_id self, String volumeName, obj_id breacher) throws InterruptedException { - if (!buff.hasBuff(breacher, "event_lifeday_no_laugh")) - { - if (volumeName.equals("laughAura")) - { - if (hasObjVar(self, "petId")) - { - obj_id monkey = getObjIdObjVar(self, "petId"); - if (exists(monkey)) - { - int idx = rand(0, 4); - dictionary params = new dictionary(); - params.put("breacher", breacher); - params.put("monkey", monkey); - params.put("idx", idx); - messageTo(self, "animationOne", params, 3, false); - messageTo(self, "animationTwo", params, 6, false); - messageTo(self, "getMoving", params, 9, false); - faceTo(monkey, breacher); - suspendMovement(monkey); - buff.applyBuff(breacher, "event_lifeday_no_laugh"); - } - } + if (!buff.hasBuff(breacher, "event_lifeday_no_laugh") && volumeName.equals("laughAura") && hasObjVar(self, "petId")) { + obj_id monkey = getObjIdObjVar(self, "petId"); + if (exists(monkey)) { + dictionary params = new dictionary(); + params.put("breacher", breacher); + params.put("monkey", monkey); + params.put("idx", rand(0, 4)); + messageTo(self, "animationOne", params, 3, false); + messageTo(self, "animationTwo", params, 6, false); + messageTo(self, "getMoving", params, 9, false); + faceTo(monkey, breacher); + suspendMovement(monkey); + buff.applyBuff(breacher, "event_lifeday_no_laugh"); } } return SCRIPT_CONTINUE; @@ -150,15 +120,14 @@ public class monkey_pet extends script.base_script { if (inHouse(self)) { - menu_info_data data = mi.getMenuItemByType(menu_info_types.ITEM_USE); mi.addRootMenu(menu_info_types.ITEM_USE, new string_id("", "")); if (hasObjVar(self, "petCalled")) { - int monkeyCalled = mi.addRootMenu(menu_info_types.ITEM_USE, SID_TURN_OFF); + mi.addRootMenu(menu_info_types.ITEM_USE, SID_TURN_OFF); } else { - int monkeyCalled = mi.addRootMenu(menu_info_types.ITEM_USE, SID_TURN_ON); + mi.addRootMenu(menu_info_types.ITEM_USE, SID_TURN_ON); } } return SCRIPT_CONTINUE; @@ -196,19 +165,15 @@ public class monkey_pet extends script.base_script } return SCRIPT_CONTINUE; } - public String whichMonkey() throws InterruptedException + private String whichMonkey() throws InterruptedException { - int monkeyColor = rand(1, 2); - if (monkeyColor > 1) + if (rand(1, 2) == 2) { return MONKEY_GREEN; } - else - { - return MONKEY_RED; - } + return MONKEY_RED; } - 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); @@ -217,11 +182,7 @@ public class monkey_pet extends script.base_script { templateName = getTemplateName(ship); } - if ((utils.isInHouseCellSpace(device) || space_utils.isPobType(templateName)) && !utils.isNestedWithinAPlayer(device)) - { - return true; - } - return false; + return (utils.isInHouseCellSpace(device) || space_utils.isPobType(templateName)) && !utils.isNestedWithinAPlayer(device); } public int animationOne(obj_id self, dictionary params) throws InterruptedException { @@ -232,20 +193,20 @@ public class monkey_pet extends script.base_script switch (idx) { case 0: - doAnimationAction(monkey, ANIMATION_1); - break; + doAnimationAction(monkey, ANIMATION_1); + break; case 1: - doAnimationAction(monkey, ANIMATION_2); - break; + doAnimationAction(monkey, ANIMATION_2); + break; case 2: - doAnimationAction(monkey, ANIMATION_3); - break; + doAnimationAction(monkey, ANIMATION_3); + break; case 3: - doAnimationAction(monkey, ANIMATION_4); - break; + doAnimationAction(monkey, ANIMATION_4); + break; case 4: - doAnimationAction(monkey, ANIMATION_5); - break; + doAnimationAction(monkey, ANIMATION_5); + break; default: } return SCRIPT_CONTINUE; @@ -253,33 +214,31 @@ public class monkey_pet extends script.base_script public int animationTwo(obj_id self, dictionary params) throws InterruptedException { int idx = params.getInt("idx"); - obj_id breacher = params.getObjId("breacher"); obj_id monkey = params.getObjId("monkey"); switch (idx) { case 0: - doAnimationAction(monkey, ANIMATION_1); - break; + doAnimationAction(monkey, ANIMATION_1); + break; case 1: - doAnimationAction(monkey, ANIMATION_2); - break; + doAnimationAction(monkey, ANIMATION_2); + break; case 2: - doAnimationAction(monkey, ANIMATION_3); - break; + doAnimationAction(monkey, ANIMATION_3); + break; case 3: - doAnimationAction(monkey, ANIMATION_4); - break; + doAnimationAction(monkey, ANIMATION_4); + break; case 4: - doAnimationAction(monkey, ANIMATION_5); - break; + doAnimationAction(monkey, ANIMATION_5); + break; default: } return SCRIPT_CONTINUE; } public int getMoving(obj_id self, dictionary params) throws InterruptedException { - obj_id monkey = params.getObjId("monkey"); - resumeMovement(monkey); + resumeMovement(params.getObjId("monkey")); return SCRIPT_CONTINUE; } public int OnDestroy(obj_id self) throws InterruptedException diff --git a/sku.0/sys.server/compiled/game/script/event/lifeday/proton_chair.java b/sku.0/sys.server/compiled/game/script/event/lifeday/proton_chair.java old mode 100644 new mode 100755 index 3debd97b9..a13fd9a64 --- a/sku.0/sys.server/compiled/game/script/event/lifeday/proton_chair.java +++ b/sku.0/sys.server/compiled/game/script/event/lifeday/proton_chair.java @@ -1,69 +1,48 @@ package script.event.lifeday; 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.locations; import script.library.space_transition; import script.library.space_utils; -import script.library.buff; -import script.library.ai_lib; +import script.library.utils; public class proton_chair extends script.base_script { public proton_chair() { } - public static final String LIFEDAY = new String("event/life_day"); - public static final String SOUND_1 = new String("sound/proton_chair_adorable.snd"); - public static final String SOUND_2 = new String("sound/proton_chair_create_me.snd"); - public static final String SOUND_3 = new String("sound/proton_chair_exist_for_you.snd"); - public static final String SOUND_4 = new String("sound/proton_chair_relax.snd"); - public static final String SOUND_5 = new String("sound/proton_chair_searching_for.snd"); - public static final String SOUND_6 = new String("sound/proton_chair_time.snd"); - public static final String SOUND_7 = new String("sound/proton_chair_voice_for_you_alone.snd"); - public static final string_id SID_TURN_ON = new string_id(LIFEDAY, "chair_on"); - public static final string_id SID_TURN_OFF = new string_id(LIFEDAY, "chair_off"); + private static final String LIFEDAY = "event/life_day"; + private static final String SOUND_1 = "sound/proton_chair_adorable.snd"; + private static final String SOUND_2 = "sound/proton_chair_create_me.snd"; + private static final String SOUND_3 = "sound/proton_chair_exist_for_you.snd"; + private static final String SOUND_4 = "sound/proton_chair_relax.snd"; + private static final String SOUND_5 = "sound/proton_chair_searching_for.snd"; + private static final String SOUND_6 = "sound/proton_chair_time.snd"; + private static final String SOUND_7 = "sound/proton_chair_voice_for_you_alone.snd"; + private static final string_id SID_TURN_ON = new string_id(LIFEDAY, "chair_on"); + private static final string_id SID_TURN_OFF = new string_id(LIFEDAY, "chair_off"); + public int OnInitialize(obj_id self) throws InterruptedException { - if (hasObjVar(self, "chairOn")) - { - removeObjVar(self, "chairOn"); - } + removeObjVar(self, "chairOn"); return SCRIPT_CONTINUE; } public int OnAttach(obj_id self) throws InterruptedException { - if (hasObjVar(self, "chairOn")) - { - removeObjVar(self, "chairOn"); - } + removeObjVar(self, "chairOn"); return SCRIPT_CONTINUE; } public int OnObjectMenuRequest(obj_id self, obj_id player, menu_info mi) throws InterruptedException { - if (inHouse(self)) + if (inHouse(self) && getPosture(player) == POSTURE_SITTING) { - menu_info_data data = mi.getMenuItemByType(menu_info_types.SERVER_MENU6); - if (getPosture(player) == POSTURE_SITTING) + mi.addRootMenu(menu_info_types.SERVER_MENU6, new string_id("", "")); + if (hasObjVar(self, "chairOn")) { - mi.addRootMenu(menu_info_types.SERVER_MENU6, new string_id("", "")); - if (hasObjVar(self, "chairOn")) - { - int chairOn = mi.addRootMenu(menu_info_types.SERVER_MENU6, SID_TURN_OFF); - } - else - { - int chairOn = mi.addRootMenu(menu_info_types.SERVER_MENU6, SID_TURN_ON); - } + mi.addRootMenu(menu_info_types.SERVER_MENU6, SID_TURN_OFF); + } + else + { + mi.addRootMenu(menu_info_types.SERVER_MENU6, SID_TURN_ON); } } return SCRIPT_CONTINUE; @@ -81,31 +60,24 @@ public class proton_chair extends script.base_script params.put("player", player); messageTo(self, "soundLoop", params, 3, false); setObjVar(self, "chairOn", 1); - return SCRIPT_CONTINUE; } } - if (item == menu_info_types.SERVER_MENU6 && hasObjVar(self, "chairOn")) + else if (item == menu_info_types.SERVER_MENU6 && hasObjVar(self, "chairOn")) { removeObjVar(self, "chairOn"); - return SCRIPT_CONTINUE; } } return SCRIPT_CONTINUE; } - 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); + obj_id ship = space_transition.getContainingShip(getContainedBy(device)); String templateName = ""; if (isIdValid(ship)) { templateName = getTemplateName(ship); } - if ((utils.isInHouseCellSpace(device) || space_utils.isPobType(templateName)) && !utils.isNestedWithinAPlayer(device)) - { - return true; - } - return false; + return (utils.isInHouseCellSpace(device) || space_utils.isPobType(templateName)) && !utils.isNestedWithinAPlayer(device); } public int soundLoop(obj_id self, dictionary params) throws InterruptedException { @@ -127,27 +99,26 @@ public class proton_chair extends script.base_script switch (idx) { case 1: - play2dNonLoopingMusic(player, SOUND_1); - break; + play2dNonLoopingMusic(player, SOUND_1); + break; case 2: - play2dNonLoopingMusic(player, SOUND_2); - break; + play2dNonLoopingMusic(player, SOUND_2); + break; case 3: - play2dNonLoopingMusic(player, SOUND_3); - break; + play2dNonLoopingMusic(player, SOUND_3); + break; case 4: - play2dNonLoopingMusic(player, SOUND_4); - break; + play2dNonLoopingMusic(player, SOUND_4); + break; case 5: - play2dNonLoopingMusic(player, SOUND_5); - break; + play2dNonLoopingMusic(player, SOUND_5); + break; case 6: - play2dNonLoopingMusic(player, SOUND_6); - break; + play2dNonLoopingMusic(player, SOUND_6); + break; case 7: - play2dNonLoopingMusic(player, SOUND_7); - break; - default: + play2dNonLoopingMusic(player, SOUND_7); + break; } params.put("lastSound", idx); params.put("player", player);