diff --git a/sku.0/sys.server/compiled/game/datatables/item/master_item/item_stats.tab b/sku.0/sys.server/compiled/game/datatables/item/master_item/item_stats.tab index 372834bca..8d7b34815 100755 --- a/sku.0/sys.server/compiled/game/datatables/item/master_item/item_stats.tab +++ b/sku.0/sys.server/compiled/game/datatables/item/master_item/item_stats.tab @@ -4643,3 +4643,8 @@ item_player_house_deed_jabbas_sail_barge item_tcg_loot_reward_series8_single_pod_airspeeder "string:vehicle_attribs.object_ref=single_pod_airspeeder,float:hit_points=15000" item_tcg_loot_reward_series8_snow_speeder_familiar string:creatureName=item_tcg_loot_reward_series8_snow_speeder_familiar item_tcg_loot_reward_series8_wampa_arm tcg_series8_severed_wampa_arm long_reuse_4 3600 clienteffect/tcg_shadow_scroll.cef +item_tcg_loot_reward_series8_bespin_lamp_off "string:type=lamp,string:status=off,string:tcg.combineItemTemplatePattern=object/tangible/tcg/series8/combine_decorative_,string:tcg.setName=set8_cloud_house" +item_tcg_loot_reward_series8_bespin_lamp_on "string:type=lamp,string:status=off,string:tcg.combineItemTemplatePattern=object/tangible/tcg/series8/combine_decorative_,string:tcg.setName=set8_cloud_house" +item_tcg_loot_reward_series8_bespin_shelves "string:tcg.combineItemTemplatePattern=object/tangible/tcg/series8/combine_decorative_,string:tcg.setName=set8_cloud_house" +item_tcg_loot_reward_series8_glowly_sculpture "string:tcg.combineItemTemplatePattern=object/tangible/tcg/series8/combine_decorative_,string:tcg.setName=set8_cloud_house" +item_tcg_loot_reward_series8_torture_table "string:tcg.combineItemTemplatePattern=object/tangible/tcg/series8/combine_decorative_,string:tcg.setName=set8_cloud_house" diff --git a/sku.0/sys.server/compiled/game/datatables/item/master_item/master_item.tab b/sku.0/sys.server/compiled/game/datatables/item/master_item/master_item.tab index 08a393462..01d0af8a5 100755 --- a/sku.0/sys.server/compiled/game/datatables/item/master_item/master_item.tab +++ b/sku.0/sys.server/compiled/game/datatables/item/master_item/master_item.tab @@ -8270,15 +8270,17 @@ rare_loot_chest_quality_2 object/tangible/item/rare_loot_chest_2.iff sys rare_loot_chest_quality_3 object/tangible/item/rare_loot_chest_3.iff systems.loot.rare_loot_chest Legendary Loot Chest Legen-wait for it-dary Loot Chest... Open it up! item_player_house_deed_jabbas_sail_barge object/tangible/deed/player_house_deed/jabbas_sail_barge_deed.iff 4 "item.special.nomove,item.structure_deed.player_structure_deed" cloud city house a cloud city house item_tcg_loot_reward_series8_glass_sculpture object/tangible/tcg/series8/decorative_bespin_glass_sculpture.iff 4 item.special.nomove Glass Helix Sculpture "From the skilled artisans of the Cloud City, this showy piece beautifies your home, creating an opulent diffusion of light in even the most humble of dwellings." -item_tcg_loot_reward_series8_bespin_lamp object/tangible/tcg/series8/decorative_bespin_lamp_off.iff "string:type=lamp,string:status=off" 4 "item.special.nomove,systems.tcg.tcg_bespin_lights" Cloud City Lamp Build-An-Item Object #2: This elegant lamp is patterned after the decorative illumination units found in the Cloud city on Bespin. -item_tcg_loot_reward_series8_bespin_sconce object/tangible/tcg/series8/decorative_bespin_sconce_off.iff "string:type=sconce,string:status=off" 4 "item.special.nomove,systems.tcg.tcg_bespin_lights" Cloud City Sconces Sconces in the fashionable style of Bespin's Cloud City. -item_tcg_loot_reward_series8_bespin_shelves object/tangible/tcg/series8/decorative_bespin_shelves.iff 4 item.special.nomove Cloud City Shelves Build-An-Item Object #4: These elegant shelves are patterned after the decorative and sturdy shelves used in the Cloud City on Bespin. +item_tcg_loot_reward_series8_bespin_lamp_off object/tangible/tcg/series8/combine_decorative_bespin_lamp_off.iff 4 "item.special.nomove,systems.tcg.tcg_bespin_lights,systems.tcg.tcg_combine_tcg_items_generic" Cloud City Lamp Build-An-Item Object #2: This elegant lamp is patterned after the decorative illumination units found in the Cloud city on Bespin. +item_tcg_loot_reward_series8_bespin_lamp_on object/tangible/tcg/series8/combine_decorative_bespin_lamp_on.iff 4 "item.special.nomove,systems.tcg.tcg_bespin_lights,systems.tcg.tcg_combine_tcg_items_generic" Cloud City Lamp Build-An-Item Object #2: This elegant lamp is patterned after the decorative illumination units found in the Cloud city on Bespin. +item_tcg_loot_reward_series8_bespin_sconce_off object/tangible/tcg/series8/decorative_bespin_sconce_off.iff "string:type=sconce,string:status=off" 4 "item.special.nomove,systems.tcg.tcg_bespin_lights" Cloud City Sconces Sconces in the fashionable style of Bespin's Cloud City. +item_tcg_loot_reward_series8_bespin_sconce_on object/tangible/tcg/series8/decorative_bespin_sconce_on.iff "string:type=sconce,string:status=on" 4 "item.special.nomove,systems.tcg.tcg_bespin_lights" Cloud City Sconces Sconces in the fashionable style of Bespin's Cloud City. +item_tcg_loot_reward_series8_bespin_shelves object/tangible/tcg/series8/combine_decorative_bespin_shelves.iff 4 "item.special.nomove,systems.tcg.tcg_combine_tcg_items_generic" Cloud City Shelves Build-An-Item Object #4: These elegant shelves are patterned after the decorative and sturdy shelves used in the Cloud City on Bespin. item_tcg_loot_reward_series8_dagobah_garden object/tangible/tcg/series8/decorative_dagobah_garden.iff 4 item.special.nomove Dagobah Indoor Garden An indoor garden similar to the one grown by the Jedi Master Yoda in his Dagobah home. -item_tcg_loot_reward_series8_glowly_sculpture object/tangible/tcg/series8/decorative_glowly_sculpture.iff 4 item.special.nomove Ionized Tibanna Gas Display "Build-An-Item Object #1: A stylish conversation piece for your home. This object d'art emits a faint light of ionized Tibanna gas, producing the famed dusky hues of the gas giant planet Bespin." +item_tcg_loot_reward_series8_glowly_sculpture object/tangible/tcg/series8/combine_decorative_glowly_sculpture.iff 4 "item.special.nomove,systems.tcg.tcg_combine_tcg_items_generic" Ionized Tibanna Gas Display "Build-An-Item Object #1: A stylish conversation piece for your home. This object d'art emits a faint light of ionized Tibanna gas, producing the famed dusky hues of the gas giant planet Bespin." item_tcg_loot_reward_series8_palpatine_hologram object/tangible/tcg/series8/decorative_palpatine_hologram.iff 4 item.special.nomove Emperor Palpatine Hologram "This is a hologram of the Emperor of the Galaxy, honorably elected by the Galactic Senate, taken from the speech in which he announces the disbanding of the Senate." item_tcg_loot_reward_series8_r2d2_dagobah object/tangible/tcg/series8/decorative_r2d2_dagobah.iff 4 item.special.nomove r2d2 dagobah a r2d2 dagobah. item_tcg_loot_reward_series8_shield_generator_blueprint object/tangible/tcg/series8/decorative_shield_generator_blueprint.iff 4 item.special.nomove Shield Generator blueprint a Shield Generator blueprint. -item_tcg_loot_reward_series8_torture_table object/tangible/tcg/series8/decorative_torture_table.iff 4 item.special.nomove Torture Table a Torture Table. +item_tcg_loot_reward_series8_torture_table object/tangible/tcg/series8/combine_decorative_torture_table.iff 4 "item.special.nomove,systems.tcg.tcg_combine_tcg_items_generic" Torture Table a Torture Table. item_tcg_loot_reward_series8_deco_vader_pod object/tangible/tcg/series8/decorative_vader_pod.iff 4 item.special.nomove Decorative Vader Pod a Decorative Vader Pod. item_tcg_decorational_bespin_house object/tangible/tcg/series8/deco_bespin_house.iff 4 item.special.nomove Decorative Bespin House a model of a Cloud City house item_tcg_loot_reward_series8_single_pod_airspeeder object/tangible/tcg/series8/deco_single_pod_airspeeder.iff 4 "item.special.nomove,systems.vehicle_system.vehicle_deed" Cloud City Pod Car A single pod from the twin-pod cloud car. diff --git a/sku.0/sys.server/compiled/game/datatables/tcg/combine_item.tab b/sku.0/sys.server/compiled/game/datatables/tcg/combine_item.tab index 8eb62f77d..f09dd5efb 100755 --- a/sku.0/sys.server/compiled/game/datatables/tcg/combine_item.tab +++ b/sku.0/sys.server/compiled/game/datatables/tcg/combine_item.tab @@ -4,3 +4,4 @@ set5_atat object/tangible/tcg/series5/combine_object_at_at_blueprint.iff object/ set5_scurrier object/tangible/tcg/series5/combine_object_house_pet_scurrier_leftover_01.iff object/tangible/tcg/series5/combine_object_house_pet_scurrier_leftover_02.iff object/tangible/tcg/series5/combine_object_house_pet_scurrier_leftover_03.iff object/tangible/tcg/series5/combine_object_house_pet_scurrier_leftover_04.iff item_tcg_scurrier_final_palm_schematic set6_hk47 object/tangible/tcg/series6/combine_object_hk47_statuette.iff object/tangible/tcg/series6/combine_object_hk47_mustafar_diorama.iff object/tangible/tcg/series6/combine_object_battle_droid_statuette.iff object/tangible/tcg/series6/combine_object_hk_droids_poster.iff item_tcg_loot_reward_series6_buildreward_hk47_jet_pack set7_gunship object/tangible/tcg/series7/combine_object_tie_canopy.iff object/tangible/tcg/series7/combine_object_xwing_wing.iff object/tangible/tcg/series7/combine_object_gunship_blueprint.iff object/tangible/tcg/series7/combine_object_broken_ball_turret.iff item_tcg_loot_reward_series7_buildreward_republic_gunship +set8_cloud_house object/tangible/tcg/series8/combine_decorative_bespin_lamp_off.iff object/tangible/tcg/series8/combine_decorative_bespin_shelves.iff object/tangible/tcg/series8/combine_decorative_glowly_sculpture.iff object/tangible/tcg/series8/combine_decorative_torture_table.iff item_tcg_loot_reward_series8_bespin_house_deed diff --git a/sku.0/sys.server/compiled/game/object/tangible/tcg/series8/combine_decorative_bespin_lamp_off.tpf b/sku.0/sys.server/compiled/game/object/tangible/tcg/series8/combine_decorative_bespin_lamp_off.tpf index ea6946ad4..9da2f9791 100755 --- a/sku.0/sys.server/compiled/game/object/tangible/tcg/series8/combine_decorative_bespin_lamp_off.tpf +++ b/sku.0/sys.server/compiled/game/object/tangible/tcg/series8/combine_decorative_bespin_lamp_off.tpf @@ -1,4 +1,5 @@ @base object/tangible/furniture/base/furniture_base.iff @class tangible_object_template 1 @class object_template 2 -sharedTemplate = "object/tangible/tcg/series8/shared_combine_decorative_bespin_lamp_off.iff" \ No newline at end of file +sharedTemplate = "object/tangible/tcg/series8/shared_combine_decorative_bespin_lamp_off.iff" +objvars =+["combine"="true"] \ No newline at end of file diff --git a/sku.0/sys.server/compiled/game/object/tangible/tcg/series8/combine_decorative_bespin_lamp_on.tpf b/sku.0/sys.server/compiled/game/object/tangible/tcg/series8/combine_decorative_bespin_lamp_on.tpf index 7b6e54e4e..135c27b3d 100755 --- a/sku.0/sys.server/compiled/game/object/tangible/tcg/series8/combine_decorative_bespin_lamp_on.tpf +++ b/sku.0/sys.server/compiled/game/object/tangible/tcg/series8/combine_decorative_bespin_lamp_on.tpf @@ -1,4 +1,5 @@ @base object/tangible/furniture/base/furniture_base.iff @class tangible_object_template 1 @class object_template 2 -sharedTemplate = "object/tangible/tcg/series8/shared_combine_decorative_bespin_lamp_on.iff" \ No newline at end of file +sharedTemplate = "object/tangible/tcg/series8/shared_combine_decorative_bespin_lamp_on.iff" +objvars =+["combine"="true"] \ No newline at end of file diff --git a/sku.0/sys.server/compiled/game/object/tangible/tcg/series8/combine_decorative_bespin_shelves.tpf b/sku.0/sys.server/compiled/game/object/tangible/tcg/series8/combine_decorative_bespin_shelves.tpf index 86117f72e..268e571c1 100755 --- a/sku.0/sys.server/compiled/game/object/tangible/tcg/series8/combine_decorative_bespin_shelves.tpf +++ b/sku.0/sys.server/compiled/game/object/tangible/tcg/series8/combine_decorative_bespin_shelves.tpf @@ -1,4 +1,5 @@ @base object/tangible/furniture/base/furniture_base.iff @class tangible_object_template 1 @class object_template 2 -sharedTemplate = "object/tangible/tcg/series8/shared_combine_decorative_bespin_shelves.iff" \ No newline at end of file +sharedTemplate = "object/tangible/tcg/series8/shared_combine_decorative_bespin_shelves.iff" +objvars =+["combine"="true"] \ No newline at end of file diff --git a/sku.0/sys.server/compiled/game/object/tangible/tcg/series8/combine_decorative_glowly_sculpture.tpf b/sku.0/sys.server/compiled/game/object/tangible/tcg/series8/combine_decorative_glowly_sculpture.tpf index 7522d40be..c4fe126fa 100755 --- a/sku.0/sys.server/compiled/game/object/tangible/tcg/series8/combine_decorative_glowly_sculpture.tpf +++ b/sku.0/sys.server/compiled/game/object/tangible/tcg/series8/combine_decorative_glowly_sculpture.tpf @@ -1,4 +1,5 @@ @base object/tangible/furniture/base/furniture_base.iff @class tangible_object_template 1 @class object_template 2 -sharedTemplate = "object/tangible/tcg/series8/shared_combine_decorative_glowly_sculpture.iff" \ No newline at end of file +sharedTemplate = "object/tangible/tcg/series8/shared_combine_decorative_glowly_sculpture.iff" +objvars =+["combine"="true"] \ No newline at end of file diff --git a/sku.0/sys.server/compiled/game/object/tangible/tcg/series8/combine_decorative_torture_table.tpf b/sku.0/sys.server/compiled/game/object/tangible/tcg/series8/combine_decorative_torture_table.tpf index e382333fa..97564af0d 100755 --- a/sku.0/sys.server/compiled/game/object/tangible/tcg/series8/combine_decorative_torture_table.tpf +++ b/sku.0/sys.server/compiled/game/object/tangible/tcg/series8/combine_decorative_torture_table.tpf @@ -1,4 +1,5 @@ @base object/tangible/furniture/base/furniture_base.iff @class tangible_object_template 1 @class object_template 2 -sharedTemplate = "object/tangible/tcg/series8/shared_combine_decorative_torture_table.iff" \ No newline at end of file +sharedTemplate = "object/tangible/tcg/series8/shared_combine_decorative_torture_table.iff" +objvars =+["combine"="true"] \ No newline at end of file diff --git a/sku.0/sys.server/compiled/game/object/tangible/tcg/series8/decorative_bespin_lamp_off.tpf b/sku.0/sys.server/compiled/game/object/tangible/tcg/series8/decorative_bespin_lamp_off.tpf index 1e84253a9..ef8defb1a 100755 --- a/sku.0/sys.server/compiled/game/object/tangible/tcg/series8/decorative_bespin_lamp_off.tpf +++ b/sku.0/sys.server/compiled/game/object/tangible/tcg/series8/decorative_bespin_lamp_off.tpf @@ -1,4 +1,5 @@ @base object/tangible/furniture/base/furniture_base.iff @class tangible_object_template 1 @class object_template 2 -sharedTemplate = "object/tangible/tcg/series8/shared_decorative_bespin_lamp_off.iff" \ No newline at end of file +sharedTemplate = "object/tangible/tcg/series8/shared_decorative_bespin_lamp_off.iff" +objvars =+["combine"="true"] \ No newline at end of file diff --git a/sku.0/sys.server/compiled/game/script/systems/tcg/tcg_bespin_lights.java b/sku.0/sys.server/compiled/game/script/systems/tcg/tcg_bespin_lights.java index ebc51c1e3..bdf1913dd 100755 --- a/sku.0/sys.server/compiled/game/script/systems/tcg/tcg_bespin_lights.java +++ b/sku.0/sys.server/compiled/game/script/systems/tcg/tcg_bespin_lights.java @@ -12,26 +12,14 @@ public class tcg_bespin_lights extends script.base_script public int OnAttach(obj_id self) throws InterruptedException { if(!hasObjVar(self, "status")){ - setObjVar(self, "status", "off"); - } - else{ - String type = getStringObjVar(self, "type"); - if(!isOn(self)){ - toggleLight(self, type, "on"); - } + setObjVar(self, "status", (getTemplateName(self).contains("_off") ? "off" : "on")); } return SCRIPT_CONTINUE; } public int OnInitialize(obj_id self) throws InterruptedException { if(!hasObjVar(self, "status")){ - setObjVar(self, "status", "off"); - } - else{ - String type = getStringObjVar(self, "type"); - if(!isOn(self)){ - toggleLight(self, type, "on"); - } + setObjVar(self, "status", (getTemplateName(self).contains("_off") ? "off" : "on")); } return SCRIPT_CONTINUE; } @@ -75,7 +63,7 @@ public class tcg_bespin_lights extends script.base_script sendSystemMessageTestingOnly(getOwner(self), "Turning light " + position); location currentLocation = getLocation(self); - dictionary itemData = dataTableGetRow("datatables/item/master_item/master_item.iff", "item_tcg_loot_reward_series8_bespin_" + type + "_" + position); + dictionary itemData = dataTableGetRow("datatables/item/master_item/master_item.iff", "item_tcg_loot_reward_series8_bespin_" + type); obj_id newLight = createObject(itemData.getString("template_name"), currentLocation); if(newLight == null){ @@ -84,6 +72,9 @@ public class tcg_bespin_lights extends script.base_script attachScript(newLight, "systems.tcg.tcg_bespin_lights"); setObjVar(newLight, "status", position); setObjVar(newLight, "type", type); + setObjVar(newLight, "combine", "true"); + setObjVar(newLight, "tcg.combineItemTemplatePattern", "object/tangible/tcg/series8/combine_decorative_"); + setObjVar(newLight, "tcg.setName", "set8_cloud_house"); float[] orientation = getQuaternion(self); setQuaternion(newLight, orientation[0], orientation[1], orientation[2], orientation[3]); persistObject(newLight); diff --git a/sku.0/sys.server/compiled/game/script/systems/tcg/tcg_combine_tcg_items.java b/sku.0/sys.server/compiled/game/script/systems/tcg/tcg_combine_tcg_items.java index 031ae9071..a563fa4d3 100755 --- a/sku.0/sys.server/compiled/game/script/systems/tcg/tcg_combine_tcg_items.java +++ b/sku.0/sys.server/compiled/game/script/systems/tcg/tcg_combine_tcg_items.java @@ -1,15 +1,13 @@ package script.systems.tcg; -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.menu_info; +import script.menu_info_types; +import script.obj_id; +import script.string_id; + +import java.util.Vector; public class tcg_combine_tcg_items extends script.base_script { diff --git a/sku.0/sys.server/compiled/game/script/systems/tcg/tcg_combine_tcg_items_generic.java b/sku.0/sys.server/compiled/game/script/systems/tcg/tcg_combine_tcg_items_generic.java index ca852dbc2..42569be2c 100755 --- a/sku.0/sys.server/compiled/game/script/systems/tcg/tcg_combine_tcg_items_generic.java +++ b/sku.0/sys.server/compiled/game/script/systems/tcg/tcg_combine_tcg_items_generic.java @@ -1,22 +1,17 @@ package script.systems.tcg; 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.Vector; public class tcg_combine_tcg_items_generic extends script.base_script { public tcg_combine_tcg_items_generic() { } - public static final boolean LOGGING_ON = false; + public static final boolean LOGGING_ON = true; public static final String LOGGING_CATEGORY = "combine"; public static final String OBJVAR_SET_NAME = "tcg.setName"; public static final String DATATABLE_COMBINE_ITEM = "datatables/tcg/combine_item.iff"; @@ -71,13 +66,16 @@ public class tcg_combine_tcg_items_generic extends script.base_script String templatePattern = getStringObjVar(self, OBJVAR_COMBINE_ITEM); blog("combine: OnObjectMenuSelect - templatePattern: " + templatePattern); obj_id[] allPossibleMatches = utils.getAllItemsPlayerHasByTemplateStartsWith(owner, templatePattern); + if(allPossibleMatches == null || allPossibleMatches.length == 0){ + sendSystemMessage(player, new string_id("tcg", "combination_not_enough_items")); + return SCRIPT_CONTINUE; + } blog("combine: OnObjectMenuSelect - allPossibleMatches length: " + allPossibleMatches.length); if (allPossibleMatches.length < NUM_COMBINE_ITEMS) { sendSystemMessage(player, new string_id("tcg", "combination_not_enough_items")); return SCRIPT_CONTINUE; } - blog("combine: OnObjectMenuSelect - allPossibleMatches.length: " + allPossibleMatches.length); String setName = getStringObjVar(self, OBJVAR_SET_NAME); if (setName == null || setName.length() <= 0) { @@ -109,18 +107,18 @@ public class tcg_combine_tcg_items_generic extends script.base_script } Vector combinableObjects = new Vector(); combinableObjects.setSize(0); - for (int i = 0; i < allPossibleMatches.length; i++) - { - if (hasObjVar(allPossibleMatches[i], COMBINE) && (getStringObjVar(allPossibleMatches[i], COMBINE)).startsWith("true")) - { - utils.addElement(combinableObjects, allPossibleMatches[i]); + for (obj_id possibleMatch : allPossibleMatches) { + if (hasObjVar(possibleMatch, COMBINE) && (getStringObjVar(possibleMatch, COMBINE)).startsWith("true")) { + utils.addElement(combinableObjects, possibleMatch); } } + blog("combine: getListOfCombinableObjects - List size is " + combinableObjects.size()); if (combinableObjects.size() < NUM_COMBINE_ITEMS) { + blog("combine: getListOfCombinableObjects - List shorter than 4 so quitting."); return null; } - blog("combine: getListOfCombinableObjects - List longer or equal to 4"); + blog("combine: getListOfCombinableObjects - List longer or equal to 4 so continuing"); return utils.toStaticObjIdArray(combinableObjects); } public boolean getCorrectCombination(obj_id[] combinableObjects, obj_id owner, String setName) throws InterruptedException @@ -144,58 +142,40 @@ public class tcg_combine_tcg_items_generic extends script.base_script return false; } dictionary tableData = dataTableGetRow(DATATABLE_COMBINE_ITEM, row); - boolean itemOneFound = false; - boolean itemTwoFound = false; - boolean itemThreeFound = false; - boolean itemFourFound = false; - String templateOne = tableData.getString("template_1"); - String templateTwo = tableData.getString("template_2"); - String templateThree = tableData.getString("template_3"); - String templateFour = tableData.getString("template_4"); - String reward = tableData.getString("reward_item"); Vector toBeCombinedList = new Vector(); toBeCombinedList.setSize(0); - for (int j = 0; j < combinableObjects.length; j++) - { - if (!itemOneFound && (getTemplateName(combinableObjects[j])).equals(templateOne)) - { - utils.addElement(toBeCombinedList, combinableObjects[j]); - if (owner != utils.getContainingPlayer(combinableObjects[j])) - { - break; - } - itemOneFound = true; - CustomerServiceLog("tcg", setName + " Combination - Player: " + owner + " " + getPlayerName(owner) + " first object (" + combinableObjects[j] + ")in inventory"); + boolean[] items = {false, false, false, false}; + obj_id potentialItem; + String[] templates = new String[4]; + // get our template names for this collection. + for(int i = 0; i < 4; i++){ + templates[i] = tableData.getString("template_" + (i + 1)); + } + // iterate through the entire list of the items found that may be legit + for(int i = 0; i < combinableObjects.length; i++){ + if(combinableObjects[i] == null) continue; + // make sure we are still looking for our items - if not, break and continue with combining + if (items[0] && items[1] && items[2] && items[3]) break; + potentialItem = combinableObjects[i]; + CustomerServiceLog("tcg", setName + " Checking item: " + getTemplateName(potentialItem)); + if (owner != utils.getContainingPlayer(potentialItem)) { + combinableObjects[i] = null; + CustomerServiceLog("tcg", setName + " Item " + getTemplateName(potentialItem) + " is not contained in the player's inventory so skipping."); + continue; } - else if (!itemTwoFound && (getTemplateName(combinableObjects[j])).equals(templateTwo)) - { - utils.addElement(toBeCombinedList, combinableObjects[j]); - if (owner != utils.getContainingPlayer(combinableObjects[j])) - { - break; + // iterate through the items needed to see if we have a match or not + for(int k = 0; k < 4; k++) { + // don't evaluate against items already found. + if (!items[k]){ + CustomerServiceLog("tcg", setName + " Checking if item (" + getTemplateName(potentialItem) + ") is equivalent to set item #" + (k+1) + " (" + templates[k] + ")"); + if (getTemplateName(potentialItem).equals(templates[k])) { + // user has the item + items[k] = true; + utils.addElement(toBeCombinedList, potentialItem); + CustomerServiceLog("tcg", setName + " Combination - Player: " + owner + " " + getPlayerName(owner) + " has object #" + (i + 1) + " (" + potentialItem + ")in inventory"); + break; + } } - itemTwoFound = true; - CustomerServiceLog("tcg", setName + " Combination - Player: " + owner + " " + getPlayerName(owner) + " has second object (" + combinableObjects[j] + ")in inventory"); - } - else if (!itemThreeFound && (getTemplateName(combinableObjects[j])).equals(templateThree)) - { - utils.addElement(toBeCombinedList, combinableObjects[j]); - if (owner != utils.getContainingPlayer(combinableObjects[j])) - { - break; - } - itemThreeFound = true; - CustomerServiceLog("tcg", setName + " Combination - Player: " + owner + " " + getPlayerName(owner) + " has third object (" + combinableObjects[j] + ")in inventory"); - } - else if (!itemFourFound && (getTemplateName(combinableObjects[j])).equals(templateFour)) - { - utils.addElement(toBeCombinedList, combinableObjects[j]); - if (owner != utils.getContainingPlayer(combinableObjects[j])) - { - break; - } - itemFourFound = true; - CustomerServiceLog("tcg", setName + " Combination - Player: " + owner + " " + getPlayerName(owner) + " has fourth object (" + combinableObjects[j] + ")in inventory"); } } if (toBeCombinedList.size() < NUM_COMBINE_ITEMS) @@ -203,8 +183,9 @@ public class tcg_combine_tcg_items_generic extends script.base_script CustomerServiceLog("tcg", setName + " Combination Failed - Player: " + owner + " " + getPlayerName(owner) + " has only: " + toBeCombinedList.size() + " items that can be combined."); return false; } - if (itemOneFound && itemTwoFound && itemThreeFound && itemFourFound) + if (items[0] && items[1] && items[2] && items[3]) { + String reward = tableData.getString("reward_item"); CustomerServiceLog("tcg", setName + " Combination - Player: " + owner + " " + getPlayerName(owner) + " has all 4 items needed to get " + reward + ". Green light for combination process."); obj_id[] combinableList = utils.toStaticObjIdArray(toBeCombinedList); return combineTheCombinableObjects(combinableList, owner, setName, reward); @@ -240,21 +221,17 @@ public class tcg_combine_tcg_items_generic extends script.base_script return false; } int checkSum = 0; - for (int i = 0; i < combinableList.length; i++) - { - if (!isValidId(combinableList[i]) || !exists(combinableList[i])) - { - CustomerServiceLog("tcg", setName + " Combination ERROR - Object (" + combinableList[i] + ") No longer exists for combine process. Possible attempt to exploit involving Player: " + owner + " " + getPlayerName(owner) + "."); + for (obj_id combinableItem : combinableList) { + if (!isValidId(combinableItem) || !exists(combinableItem)) { + CustomerServiceLog("tcg", setName + " Combination ERROR - Object (" + combinableItem + ") No longer exists for combine process. Possible attempt to exploit involving Player: " + owner + " " + getPlayerName(owner) + "."); continue; } - if (owner != utils.getContainingPlayer(combinableList[i])) - { - CustomerServiceLog("tcg", setName + " Combination ERROR - Object (" + combinableList[i] + ") No longer exists in player inventory for the combine process. Possible attempt to exploit involving Player: " + owner + " " + getPlayerName(owner) + "."); + if (owner != utils.getContainingPlayer(combinableItem)) { + CustomerServiceLog("tcg", setName + " Combination ERROR - Object (" + combinableItem + ") No longer exists in player inventory for the combine process. Possible attempt to exploit involving Player: " + owner + " " + getPlayerName(owner) + "."); continue; } - if (!hasObjVar(combinableList[i], COMBINE) && (getStringObjVar(combinableList[i], COMBINE)).startsWith("true")) - { - CustomerServiceLog("tcg", setName + " Combination ERROR - Object (" + combinableList[i] + ") No longer has objvar allowing combination process. Possible attempt to exploit involving Player: " + owner + " " + getPlayerName(owner) + "."); + if (!hasObjVar(combinableItem, COMBINE) && (getStringObjVar(combinableItem, COMBINE)).startsWith("true")) { + CustomerServiceLog("tcg", setName + " Combination ERROR - Object (" + combinableItem + ") No longer has objvar allowing combination process. Possible attempt to exploit involving Player: " + owner + " " + getPlayerName(owner) + "."); continue; } checkSum++; @@ -277,15 +254,13 @@ public class tcg_combine_tcg_items_generic extends script.base_script return false; } CustomerServiceLog("tcg", setName + " Combination Success - Reward creation success. reward Object: (" + reward + ") in player inventory: " + playerInv + " for Player: " + owner + " " + getPlayerName(owner) + "."); - for (int j = 0; j < combinableList.length; j++) - { - if (!isValidId(combinableList[j]) || !exists(combinableList[j])) - { - CustomerServiceLog("tcg", setName + " Combination ERROR - Combine object: " + combinableList[j] + " could not be found for update. This object was last owned by Player: " + owner + " " + getPlayerName(owner) + " and needed to be updated to avoid reuse in the combination process."); + for (obj_id item : combinableList) { + if (!isValidId(item) || !exists(item)) { + CustomerServiceLog("tcg", setName + " Combination ERROR - Combine object: " + item + " could not be found for update. This object was last owned by Player: " + owner + " " + getPlayerName(owner) + " and needed to be updated to avoid reuse in the combination process."); continue; } - setObjVar(combinableList[j], COMBINE, "false"); - CustomerServiceLog("tcg", setName + " Combination - Combine object: " + combinableList[j] + " was successfully updated to remove objvar. This object should no longer allow for combination functionality. Object owned by Player: " + owner + " " + getPlayerName(owner) + "."); + setObjVar(item, COMBINE, "false"); + CustomerServiceLog("tcg", setName + " Combination - Combine object: " + item + " was successfully updated to remove objvar. This object should no longer allow for combination functionality. Object owned by Player: " + owner + " " + getPlayerName(owner) + "."); } CustomerServiceLog("tcg", setName + " Combination SUCCESS - All objects combined for Player: " + owner + " " + getPlayerName(owner) + ". reward object: " + reward + " created in player inventory, objects used in process should be updated."); return true;