Merge pull request #151 from Geit/gu-16.9/no-trade-removable

GU 16.9 - No Trade Removable
This commit is contained in:
Cekis
2020-10-24 21:08:43 -07:00
committed by GitHub
3 changed files with 137 additions and 4 deletions

View File

@@ -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

View File

@@ -0,0 +1,58 @@
package script.item.special;
import script.obj_id;
import script.string_id;
import script.menu_info;
import script.menu_info_types;
import script.library.utils;
/**
* 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 SID_REMOVE_NO_TRADE = new string_id("ui_radial", "no_trade_removable");
public static final string_id SID_ITEM_NOT_INVENTORY = new string_id("sarlacc_minigame", "item_not_inventory");
public static final string_id SID_ITEM_NOT_OWNER = new string_id("base_player", "item_not_owner");
public static final string_id SID_ITEM_MADE_TRADABLE = new string_id("system_msg", "item_made_tradable");
public static final String SCRIPT_NAME = "item.special.no_trade_removable";
public int OnObjectMenuRequest(obj_id self, obj_id player, menu_info mi) throws InterruptedException {
if ((getOwner(self) == player || isGod(player)) && hasObjVar(self, "noTrade")
&& utils.getContainingPlayer(self) == player) {
mi.addRootMenu(RADIAL_MENU_ENTRY, SID_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 (getOwner(self) != player && !isGod(player)) {
sendSystemMessage(player, SID_ITEM_NOT_OWNER);
return SCRIPT_CONTINUE;
}
if (utils.getContainingPlayer(self) != player) {
sendSystemMessage(player, SID_ITEM_NOT_INVENTORY);
return SCRIPT_CONTINUE;
}
if (hasObjVar(self, "noTrade")) {
removeObjVar(self, "noTrade");
sendSystemMessage(player, SID_ITEM_MADE_TRADABLE);
CustomerServiceLog("noTrade", getPlayerName(player) + " (" + player + ") removed the noTrade ObjVar from object " + getTemplateName(self) + " (" + self + ")");
detachScript(self, SCRIPT_NAME);
}
}
return SCRIPT_CONTINUE;
}
}

View File

@@ -214,10 +214,10 @@ public class menu_info_types
public static final int SERVER_MENU44 = index++;
public static final int SERVER_MENU45 = index++;
public static final int SERVER_MENU46 = index++;
public static final int SERVER_MENU47 = index++;
public static final int SERVER_MENU48 = index++;
public static final int SERVER_MENU49 = index++;
public static final int SERVER_MENU50 = index++;
public static final int SERVER_MENU47 = index++; // Used for No Trade Removal
public static final int SERVER_MENU48 = index++; // Used for Galactic Reserve Withdrawl
public static final int SERVER_MENU49 = index++; // Used for Autostack and Galactic Reserve Deposit
public static final int SERVER_MENU50 = index++; // Used for Autostack root and Galatic Reserve Root
public static final int SERVER_HARVESTER_MANAGE = index++;
public static final int SERVER_HOUSE_MANAGE = index++;