From 6a67803887cf20fd085536dd92cca6b31d394c66 Mon Sep 17 00:00:00 2001 From: RezecNoble Date: Thu, 29 Aug 2024 19:55:13 -0400 Subject: [PATCH] NoTrade Removable Fix --- .../game/script/item/special/no_trade_removable.java | 4 ++++ .../compiled/game/script/library/static_item.java | 6 ++++++ 2 files changed, 10 insertions(+) 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 index ee00e2321..4ac3163e3 100644 --- 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 @@ -25,6 +25,7 @@ public class no_trade_removable extends script.base_script { 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 static final String NO_TRADE_SCRIPT_NAME = "item.special.nomove"; public int OnObjectMenuRequest(obj_id self, obj_id player, menu_info mi) throws InterruptedException { if ((getOwner(self) == player || isGod(player)) && hasObjVar(self, "noTrade") @@ -48,6 +49,9 @@ public class no_trade_removable extends script.base_script { if (hasObjVar(self, "noTrade")) { removeObjVar(self, "noTrade"); + if (hasScript(self, NO_TRADE_SCRIPT_NAME)) { + detachScript(self, NO_TRADE_SCRIPT_NAME); + } sendSystemMessage(player, SID_ITEM_MADE_TRADABLE); CustomerServiceLog("noTrade", getPlayerName(player) + " (" + player + ") removed the noTrade ObjVar from object " + getTemplateName(self) + " (" + self + ")"); detachScript(self, SCRIPT_NAME); diff --git a/sku.0/sys.server/compiled/game/script/library/static_item.java b/sku.0/sys.server/compiled/game/script/library/static_item.java index 8cdb26fc4..99f0478f0 100755 --- a/sku.0/sys.server/compiled/game/script/library/static_item.java +++ b/sku.0/sys.server/compiled/game/script/library/static_item.java @@ -152,6 +152,12 @@ public class static_item extends script.base_script } } attachScript(object, "item.static_item_base"); + // attaching the no_trade_removable script. + // Doing this here instead of the above because this runs on Init for all existing static_items instead of only at creation time + String[] no_trade_removable_items = dataTableGetStringColumn(ITEM_NO_TRADE_REMOVABLE_TABLE, 0); + if(no_trade_removable_items != null && Arrays.asList(no_trade_removable_items).contains(itemName)) { + attachScript(object, "item.special.no_trade_removable"); + } if (!jedi.isCrystalTuned(object)) { setName(object, "");