mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-31 00:15:54 -04:00
59 lines
2.0 KiB
Java
Executable File
59 lines
2.0 KiB
Java
Executable File
package script.working.jfreeman;
|
|
|
|
import script.library.utils;
|
|
import script.obj_id;
|
|
|
|
public class invtest extends script.base_script
|
|
{
|
|
public invtest()
|
|
{
|
|
}
|
|
public int OnAttach(obj_id self) throws InterruptedException
|
|
{
|
|
sendSystemMessageTestingOnly(self, "attached!");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public int OnLogin(obj_id self) throws InterruptedException
|
|
{
|
|
obj_id bank = utils.getPlayerBank(self);
|
|
if (!isIdValid(bank))
|
|
{
|
|
sendSystemMessageTestingOnly(self, "bank is invalid");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
obj_id inv = utils.getInventoryContainer(self);
|
|
if (!isIdValid(inv))
|
|
{
|
|
sendSystemMessageTestingOnly(self, "inventory is invalid");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
obj_id[] bankContents = getContents(bank);
|
|
if (bankContents == null)
|
|
{
|
|
sendSystemMessageTestingOnly(self, "bank contents is null");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
sendSystemMessageTestingOnly(self, "bank has " + bankContents.length + " items");
|
|
obj_id[] invContents = getContents(inv);
|
|
if (invContents == null)
|
|
{
|
|
sendSystemMessageTestingOnly(self, "inv contents is null");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
sendSystemMessageTestingOnly(self, "inv has " + invContents.length + " items");
|
|
if (invContents.length > bankContents.length)
|
|
{
|
|
sendSystemMessageTestingOnly(self, "moving inv contents to bank");
|
|
int numMoved = moveObjects(invContents, bank);
|
|
sendSystemMessageTestingOnly(self, "moved " + numMoved + " objects");
|
|
}
|
|
else
|
|
{
|
|
sendSystemMessageTestingOnly(self, "moving bank contents to inv");
|
|
int numMoved = moveObjects(bankContents, inv);
|
|
sendSystemMessageTestingOnly(self, "moved " + numMoved + " objects");
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|