mirror of
https://bitbucket.org/seefoe/dsrc.git
synced 2026-07-31 01:15:55 -04:00
58 lines
1.4 KiB
Plaintext
58 lines
1.4 KiB
Plaintext
include library.utils;
|
|
|
|
trigger OnAttach()
|
|
{
|
|
sendSystemMessageTestingOnly( self, "attached!" );
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnLogin()
|
|
{
|
|
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;
|
|
}
|
|
|