mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-28 22:15:54 -04:00
115 lines
3.0 KiB
Plaintext
115 lines
3.0 KiB
Plaintext
//**********************************************************
|
|
// Copyright (c) ©2000,2001 Sony Online Entertainment Inc.
|
|
// All Rights Reserved
|
|
//
|
|
// Title: qabackpack.script
|
|
// Description: QA Backpack functions
|
|
// @author $Author: Tim Jones $
|
|
// @version $Revision: #1 $
|
|
//***********************************************************
|
|
|
|
/********* Includes ******************************************/
|
|
include library.qa;
|
|
include library.sui;
|
|
include library.utils;
|
|
|
|
/********* CONSTANTS *****************************************/
|
|
|
|
//hi
|
|
|
|
/********* Triggers ******************************************/
|
|
trigger OnAttach()
|
|
{
|
|
if (isGod(self))
|
|
{
|
|
if(getGodLevel(self) < 10)
|
|
{
|
|
detachScript(self, "test.qabackpack");
|
|
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
|
|
}
|
|
}
|
|
else if (!isGod(self))
|
|
{
|
|
detachScript(self, "test.qabackpack");
|
|
}
|
|
|
|
sendSystemMessage(self, "QA Backpack script attached.\nAny item received will be moved into a QA backpack.\nAny items moved from the backpack should not be automatically moved into the backpack.\nDetach script test.qabackpack to remove qabackpack automatic inventory functions.", null);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
|
|
}
|
|
|
|
trigger OnSpeaking(string text)
|
|
{
|
|
obj_id player = self;
|
|
if(isGod(player))
|
|
{
|
|
if (toLower(text).equals("qabackpack stop") )
|
|
{
|
|
sendSystemMessage(self, "Not yet implemented. QA Backpack automatic inventory functions DISABLED.", null);
|
|
return SCRIPT_OVERRIDE;
|
|
}
|
|
if (toLower(text).equals("qabackpack start") )
|
|
{
|
|
sendSystemMessage(self, "Not yet implemented. QA Backpack automatic inventory functions ENABLED.", null);
|
|
return SCRIPT_OVERRIDE;
|
|
}
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
|
|
trigger OnContainerChildGainItem(obj_id item, obj_id source, obj_id transferer)
|
|
{
|
|
|
|
//sendSystemMessage(self, "OnContainerChildGainItem", null);
|
|
|
|
putInQaBackpack(item, self, source);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
|
|
void putInQaBackpack(obj_id item, obj_id player, obj_id source)
|
|
{
|
|
obj_id testerInventoryId = utils.getInventoryContainer(player);
|
|
|
|
qa.findOrCreateAndEquipQABag(player, testerInventoryId, false);
|
|
|
|
obj_id myBag = getObjectInSlot(player, "back");
|
|
|
|
//check to make sure everything is valid; break if not
|
|
if (!isValidId(myBag) && isValidId(testerInventoryId))
|
|
{
|
|
sendSystemMessage(player, "Error: Something bad happened in test.qabackpack", null);
|
|
return;
|
|
}
|
|
|
|
//do not put containers in containers
|
|
//actually this is ok but i'll leave the code here for future reference or if we need to allow this check
|
|
/*
|
|
if (utils.isContainer(item))
|
|
{
|
|
return;
|
|
}
|
|
*/
|
|
|
|
//if item is received in a container already, do not move it (e.g. a fish contains fish food and chum)
|
|
obj_id itemContainer = getContainedBy(item);
|
|
|
|
if (itemContainer != testerInventoryId)
|
|
{
|
|
return;
|
|
}
|
|
|
|
|
|
//if player is moving object from qabackpack into inventory, do not move that item back into qabackpack
|
|
if (myBag == source)
|
|
{
|
|
return;
|
|
}
|
|
|
|
putInOverloaded(item, myBag);
|
|
|
|
return;
|
|
} |