/** * Copyright (c)2000-2002 Sony Online Entertainment Inc. * All Rights Reserved * * Title: testcenter_player.script * Description: This will be the script to fix BH armor to be either the mando construction type or the wearable type * @author Thomas Blair * @version $Revision:$ */ /***** INCLUDES ********************************************************/ include library.utils; include library.sui; /***** CONSTANTS *******************************************************/ /***** TRIGGERS ********************************************************/ trigger OnInitialize() { return SCRIPT_CONTINUE; } trigger OnObjectMenuRequest(obj_id player, menu_info mi) { if (utils.getContainingPlayer(self) == player) { mi.addRootMenu (menu_info_types.SERVER_MENU1, new string_id("craft_armor_ingredients_d","dismantle_bounty_hunter")); } return SCRIPT_CONTINUE; } trigger OnObjectMenuSelect(obj_id player, int item) { if (utils.getContainingPlayer(self) == player) { if (item == menu_info_types.SERVER_MENU1) { showConfirmationWindow(player); } } return SCRIPT_CONTINUE; } void showConfirmationWindow(obj_id player) { obj_id self = getSelf(); string prompt = "Are you sure you wish to DESTROY this piece of wearable armor and create a piece used for the construction of Mandalorian armor?"; string title = "Dismantle Bounty Hunter Armor Piece"; closeOldWindow(player); int pid = sui.msgbox(self, player, prompt, sui.OK_CANCEL, title, 0,"handleConfirmationSelect"); setWindowPid(player, pid); } void dismantleBountyHunter(obj_id player) { obj_id self = getSelf(); string templatename = getTemplateName(self); string schematicTemplate = ""; obj_id pInv = utils.getInventoryContainer(player); if (getVolumeFree(pInv) <= 1) { sendSystemMessage(player, new string_id("quest_armorsmith", "inventory_full")); return; } else { if (templatename.equals("object/tangible/wearables/armor/bounty_hunter/armor_bounty_hunter_crafted_helmet.iff")) { schematicTemplate = "object/tangible/wearables/armor/bounty_hunter/armor_bounty_hunter_helmet.iff"; } else if (templatename.equals("object/tangible/wearables/armor/bounty_hunter/armor_bounty_hunter_crafted_chest_plate.iff")) { schematicTemplate = "object/tangible/wearables/armor/bounty_hunter/armor_bounty_hunter_chest_plate.iff"; } else if (templatename.equals("object/tangible/wearables/armor/bounty_hunter/armor_bounty_hunter_crafted_leggings.iff")) { schematicTemplate = "object/tangible/wearables/armor/bounty_hunter/armor_bounty_hunter_leggings.iff"; } else if (templatename.equals("object/tangible/wearables/armor/bounty_hunter/armor_bounty_hunter_crafted_bicep_l.iff")) { schematicTemplate = "object/tangible/wearables/armor/bounty_hunter/armor_bounty_hunter_bicep_l.iff"; } else if (templatename.equals("object/tangible/wearables/armor/bounty_hunter/armor_bounty_hunter_crafted_bicep_r.iff")) { schematicTemplate = "object/tangible/wearables/armor/bounty_hunter/armor_bounty_hunter_bicep_r.iff"; } else if (templatename.equals("object/tangible/wearables/armor/bounty_hunter/armor_bounty_hunter_crafted_bracer_l.iff")) { schematicTemplate = "object/tangible/wearables/armor/bounty_hunter/armor_bounty_hunter_bracer_l.iff"; } else if (templatename.equals("object/tangible/wearables/armor/bounty_hunter/armor_bounty_hunter_crafted_bracer_r.iff")) { schematicTemplate = "object/tangible/wearables/armor/bounty_hunter/armor_bounty_hunter_bracer_r.iff"; } else if (templatename.equals("object/tangible/wearables/armor/bounty_hunter/armor_bounty_hunter_crafted_gloves.iff")) { schematicTemplate = "object/tangible/wearables/armor/bounty_hunter/armor_bounty_hunter_gloves.iff"; } else if (templatename.equals("object/tangible/wearables/armor/bounty_hunter/armor_bounty_hunter_crafted_boots.iff")) { schematicTemplate = "object/tangible/wearables/armor/bounty_hunter/armor_bounty_hunter_boots.iff"; } else if (templatename.equals("object/tangible/wearables/armor/bounty_hunter/armor_bounty_hunter_crafted_belt.iff")) { schematicTemplate = "object/tangible/wearables/armor/bounty_hunter/armor_bounty_hunter_belt.iff"; } if (schematicTemplate.length() < 1) { CustomerServiceLog("armor_converion", "%TU attempted to dismantle Bounty Hunter " +templatename+ " however was not found in schematic listing", player); return; } obj_id newSchematic = createObject(schematicTemplate, pInv, ""); if (isIdValid(newSchematic)) { destroyObject(self); setCraftedId(newSchematic, newSchematic); setCrafter(newSchematic, player); sendSystemMessage(player, new string_id("quest_armorsmith", "bounty_hunter_converted")); } else { CustomerServiceLog("armor_converion", "Server attempted to create Bounty Hunter " +newSchematic+ " for %TU but failed", player); return; } } } void closeOldWindow(obj_id player) { if ( utils.hasScriptVar(player, "bounty_hunter_armor.pid")) { int oldpid = utils.getIntScriptVar(player, "bounty_hunter_armor.pid"); forceCloseSUIPage (oldpid); utils.removeScriptVar(player, "bounty_hunter_armor.pid"); } } void setWindowPid(obj_id player, int pid) { if (pid > -1) utils.setScriptVar(player, "bounty_hunter_armor.pid", pid); } messageHandler handleConfirmationSelect() { obj_id player = sui.getPlayerId(params); int btn = sui.getIntButtonPressed(params); if ( btn == sui.BP_CANCEL ) { utils.removeScriptVar(player, "bounty_hunter_armor.pid"); return SCRIPT_CONTINUE; } dismantleBountyHunter(player); return SCRIPT_CONTINUE; }