mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-01-15 23:04:31 -05:00
NoTrade Removable Fix
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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, "");
|
||||
|
||||
Reference in New Issue
Block a user