mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-08-01 01:15:59 -04:00
102 lines
2.3 KiB
Plaintext
102 lines
2.3 KiB
Plaintext
/***** INCLUDES ********************************************************/
|
|
include library.ai_lib;
|
|
include library.utils;
|
|
include library.tcg;
|
|
|
|
trigger OnTransferred(obj_id sourceContainer, obj_id destContainer, obj_id transferer)
|
|
{
|
|
// Log where the card went.
|
|
if(isIdValid(utils.getContainingPlayer(sourceContainer)))
|
|
{
|
|
sourceContainer = utils.getContainingPlayer(sourceContainer);
|
|
}
|
|
|
|
if(isIdValid(utils.getContainingPlayer(destContainer)))
|
|
{
|
|
destContainer = utils.getContainingPlayer(destContainer);
|
|
}
|
|
|
|
string sourceName = "None";
|
|
string destName = "None";
|
|
string transfererName = "None";
|
|
|
|
if(isIdValid(sourceContainer))
|
|
{
|
|
sourceName = getName(sourceContainer);
|
|
}
|
|
|
|
if(isIdValid(destContainer))
|
|
{
|
|
destName = getName(destContainer);
|
|
}
|
|
|
|
if(isIdValid(transferer))
|
|
{
|
|
transfererName = getName(transferer);
|
|
}
|
|
|
|
CustomerServiceLog("tcg_transfer", ",Card ID: " + self + ",Card Name: " + getName(self) + ",Source Container: " + sourceContainer + ",Source Name: " + sourceName +
|
|
",Destination Container: " + destContainer + ",Destination Name: " + destName + ",Transferer: " + transferer + ",Transferer Name: " + transfererName);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnObjectMenuRequest(obj_id player, menu_info mi)
|
|
{
|
|
if(!isIdValid(player) || ai_lib.aiIsDead(player))
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
obj_id containingPlayer = utils.getContainingPlayer(self);
|
|
|
|
if(isIdValid(containingPlayer) && containingPlayer == player)
|
|
{
|
|
menu_info_data mid = mi.getMenuItemByType(menu_info_types.ITEM_USE);
|
|
|
|
if(mid != null)
|
|
{
|
|
mid.setServerNotify(true);
|
|
}
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnObjectMenuSelect(obj_id player, int item)
|
|
{
|
|
if(!isIdValid(self) || !isIdValid(player) || ai_lib.aiIsDead(player))
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
obj_id whoContains = utils.getContainingPlayer(self);
|
|
|
|
// Traded off? Not in inventory?
|
|
if(whoContains != player)
|
|
{
|
|
// That is not in your inventory.
|
|
sendSystemMessage(player, new string_id("spam","not_in_inventory_generic"));
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
int featureId = getIntObjVar(self, "featureID");
|
|
|
|
if(featureId <= 0)
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// Claim the item
|
|
if(item == menu_info_types.ITEM_USE)
|
|
{
|
|
adjustSwgTcgAccountFeatureId(player, self, featureId, 1);
|
|
|
|
if(hasObjVar(player, "qa_tcg"))
|
|
{
|
|
debugSpeakMsg(player, "Item used.");
|
|
}
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
} |