mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-14 23:07:51 -04:00
* Code compiles - execution NOT tested * updating gitignore * Removed intellij settings files * Removed more intellij files * Added exclusion for JDK classes. * Fixed purchasing script for vendors that have listed coin types. * Updated script to not kick off until the entire preload is complete. * adds static name entry for Solo movie poster and tcg9 vendor entry * clean up empty and orphaned object templates * adds placeholder black market (static) spawns * corrects entries for the video game table to correctly set it in tcg series 2 and remove series 1 console errors * Updated gitignore and removed intellij project files * Fixed appearance reference for thranta payroll and kashyyyk door, added skipLosCheck objvar due to cannit see issue. Requires updated src * Fixed appearance and template for terminal (#2) * Fixed appearance and template for terminal (#3) * Fixed appearance and template for terminal (#4) * Deleted another faulty/orphaned object template * Fixed gcw ranks option on frog. Only issue is that it doesn't award the officer commands or badges. * Fixed some unneeded java 11 changes
75 lines
2.4 KiB
Java
Executable File
75 lines
2.4 KiB
Java
Executable File
package script.item.special;
|
|
|
|
import script.library.player_structure;
|
|
import script.library.structure;
|
|
import script.library.utils;
|
|
import script.obj_id;
|
|
|
|
public class nomove_container extends script.item.special.nomove_base
|
|
{
|
|
public nomove_container()
|
|
{
|
|
}
|
|
public int OnAttach(obj_id self) throws InterruptedException
|
|
{
|
|
setObjVar(self, "noTrade", true);
|
|
propogateNoTrade(self, true);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public int OnLostItem(obj_id self, obj_id destContainer, obj_id transferer, obj_id item) throws InterruptedException
|
|
{
|
|
if (containsNoTradeItem(self))
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
removeObjVar(self, "noTrade");
|
|
propogateNoTrade(self, false);
|
|
detachScript(self, "item.special.nomove_container");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public boolean containsNoTradeItem(obj_id container) throws InterruptedException
|
|
{
|
|
obj_id[] contents = getContents(container);
|
|
for (obj_id content : contents) {
|
|
if (hasObjVar(content, "noTrade")) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
public void propogateNoTrade(obj_id container, boolean isNoTrade) throws InterruptedException
|
|
{
|
|
obj_id player = utils.getContainingPlayer(container);
|
|
obj_id inventory = getObjectInSlot(player, utils.SLOT_INVENTORY);
|
|
obj_id parent = getContainedBy(container);
|
|
while (isIdValid(parent) && !(getTemplateName(parent)).equals(structure.TEMPLATE_CELL) && parent != inventory && !player_structure.isBuilding(parent))
|
|
{
|
|
if (isNoTrade)
|
|
{
|
|
if (!hasObjVar(parent, "noTrade"))
|
|
{
|
|
attachScript(parent, "item.special.nomove_container");
|
|
return;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (containsNoTradeItem(parent))
|
|
{
|
|
return;
|
|
}
|
|
if (hasScript(parent, "item.special.nomove_container"))
|
|
{
|
|
removeObjVar(parent, "noTrade");
|
|
detachScript(parent, "item.special.nomove_container");
|
|
}
|
|
else
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
parent = getContainedBy(parent);
|
|
}
|
|
}
|
|
}
|