From 476b705432c8b43d3a39a48fc6e6ca200cc6aba9 Mon Sep 17 00:00:00 2001 From: Geit Date: Mon, 21 Sep 2020 14:32:16 -0400 Subject: [PATCH] GU 16.9 - No Trade Removable --- .../no_trade/no_trade_removable.tab | 75 +++++++++++++++++++ .../item/special/no_trade_removable.java | 46 ++++++++++++ 2 files changed, 121 insertions(+) create mode 100755 sku.0/sys.server/compiled/game/datatables/no_trade/no_trade_removable.tab create mode 100644 sku.0/sys.server/compiled/game/script/item/special/no_trade_removable.java diff --git a/sku.0/sys.server/compiled/game/datatables/no_trade/no_trade_removable.tab b/sku.0/sys.server/compiled/game/datatables/no_trade/no_trade_removable.tab new file mode 100755 index 000000000..7c5c95f54 --- /dev/null +++ b/sku.0/sys.server/compiled/game/datatables/no_trade/no_trade_removable.tab @@ -0,0 +1,75 @@ +Object Template Comment +s c +item_pgc_planet_hologram_dantooine +item_pgc_planet_hologram_dathomir +item_pgc_planet_hologram_endor +item_pgc_planet_hologram_lok +item_pgc_planet_hologram_naboo +item_pgc_planet_hologram_rori +item_pgc_planet_hologram_talus +item_pgc_planet_hologram_tatooine +item_pgc_planet_hologram_yavin4 +item_pgc_planet_hologram_corellia_02 +item_pgc_planet_hologram_dantooine_02 +item_pgc_planet_hologram_dathomir_02 +item_pgc_planet_hologram_endor_02 +item_pgc_planet_hologram_lok_02 +item_pgc_planet_hologram_naboo_02 +item_pgc_planet_hologram_rori_02 +item_pgc_planet_hologram_talus_02 +item_pgc_planet_hologram_tatooine_02 +item_pgc_planet_hologram_yavin4_02 +item_deed_landspeeder_usv5_s02 +item_deed_podracer_anakin +item_pgc_chronicle_master_robe +item_pgc_chronicle_master_sign +item_pgc_chronicle_master_sign_02 +item_pgc_chronicle_master_statuette +item_pgc_monitorscreen +item_pgc_monitorscreen_sm +item_pgc_glass_pane_01 +item_pgc_glass_pane_02 +item_pgc_jabba_chandelier +item_pgc_jabba_drapes +item_pgc_jabba_fancyrug +item_pgc_jabba_gargoyle +item_pgc_jabba_generator +item_pgc_jabba_table +item_pgc_jabba_tassels +item_pgc_jabba_windchime +item_pgc_decal_pgc_s01 +item_pgc_decal_pgc_s02 +item_pgc_decal_pgc_s03 +item_pgc_decal_pgc_s04 +item_pgc_decal_pgc_s05 +item_pgc_decal_pgc_s06 +item_pgc_booster_pack +item_pgc_booster_pack_goto +item_pgc_booster_pack_comm +item_pgc_starter_kit +item_pgc_fireplace +item_pgc_starship_storage_device_01 +item_pgc_sandcrawler_house_deed +item_pgc_chronicler_tent_deed +item_costume_chiss_01 +item_costume_exar_kun_cultist +item_npe_sparky_droid_02_01 +col_reward_buddy_painting_01 +col_reward_buddy_painting_02 +col_reward_buddy_painting_03 +item_tow_schematic_saber_03_01 +item_tow_schematic_saber_03_02 +weapon_smuggler_reward_pistol_04_01 +weapon_smuggler_reward_pistol_dl44_04_01 +weapon_content_pistol_commando_pistol_03_01 +weapon_content_heavy_commando_03_01 +item_tow_schematic_vehicle_02_02 +item_deed_light_bend_barc_06_01 +item_publish_gift_27_04_01 +item_tow_cystal_buff_drained_05_01 +item_tow_schematic_psg_05_01 +item_content_binocs_detection_03_02 +item_content_click_health_02_01 +item_tow_schematic_jedi_statue_02_01 +heroic_minder_creature_knowledge_gloves_02_01 +item_outbreak_cornburr_brain diff --git a/sku.0/sys.server/compiled/game/script/item/special/no_trade_removable.java b/sku.0/sys.server/compiled/game/script/item/special/no_trade_removable.java new file mode 100644 index 000000000..e1ea81edb --- /dev/null +++ b/sku.0/sys.server/compiled/game/script/item/special/no_trade_removable.java @@ -0,0 +1,46 @@ +package script.item.special; + +import script.obj_id; +import script.string_id; +import script.menu_info; +import script.menu_info_types; + +/** + * Allows items that previously had the "noTrade" flag to be made tradeable by + * their original owner. + * + * Automatically attached to objects in no_trade_removable.tab + */ +public class no_trade_removable extends script.base_script { + public no_trade_removable() { + } + + // Using one of the unused reserved entries. + public static final int RADIAL_MENU_ENTRY = menu_info_types.SERVER_MENU47; + public static final string_id REMOVE_NO_TRADE = new string_id("ui_radial", "no_trade_removable"); + + public int OnObjectMenuRequest(obj_id self, obj_id player, menu_info mi) throws InterruptedException { + if (hasObjVar(self, "noTrade") && (getOwner(self) == player || isGod(player))) { + mi.addRootMenu(RADIAL_MENU_ENTRY, REMOVE_NO_TRADE); + } + return SCRIPT_CONTINUE; + } + + public int OnObjectMenuSelect(obj_id self, obj_id player, int selectedMenuItem) throws InterruptedException { + if (selectedMenuItem == RADIAL_MENU_ENTRY) { + if (!hasObjVar(self, "noTrade")) { + sendSystemMessage(player, "This item is already tradeable.", null); + return SCRIPT_CONTINUE; + } + + if (getOwner(self) != player && !isGod(player)) { + sendSystemMessage(player, "This item does not belong to you.", null); + return SCRIPT_CONTINUE; + } + + removeObjVar(self, "noTrade"); + sendSystemMessage(player, "This item is now tradable.", null); + } + return SCRIPT_CONTINUE; + } +}