Files
dsrc/sku.0/sys.server/compiled/game/script/event/housepackup/cts_refugee.script
T

67 lines
1.8 KiB
Plaintext

/***** INCLUDES ********************************************************/
include library.cts;
include library.utils;
/***** CONSTANTS *******************************************************/
const boolean BLOGGING_ON = true;
const string BLOG_CATEGORY = "CharacterTransfer";
/***** TRIGGERS ********************************************************/
//OnInitialize() is for clean up only. Hopefully the work
//will be done in OnTransferred()
trigger OnInitialize()
{
if(!utils.isNestedWithinAPlayer(self))
return SCRIPT_CONTINUE;
blog("OnInitialize.cts_refugee validation completed");
if(!hasObjVar(self, cts.CURRENT_PLAYER_OID))
cts.initializeCtsObject(self);
return SCRIPT_CONTINUE;
}
//Assuming the gift is claimed via the vet reward system and placed directly into the
//player inventory, upon OnTransferred, the CTS data is retrieved by this script (and lib) and written on
//the gift template directly as 5 objvars.
trigger OnTransferred(obj_id sourceContainer, obj_id destContainer, obj_id transferer)
{
if(!utils.isNestedWithinAPlayer(self))
return SCRIPT_CONTINUE;
blog("OnTransferred.cts_refugee validation completed");
if(!hasObjVar(self, cts.CURRENT_PLAYER_OID))
cts.initializeCtsObject(self);
return SCRIPT_CONTINUE;
}
trigger OnGetAttributes(obj_id player, string[] names, string[] attribs)
{
int idx = utils.getValidAttributeIndex(names);
if(idx == -1)
return SCRIPT_CONTINUE;
if(!isValidId(self) || !exists(self))
return SCRIPT_CONTINUE;
string inscriptionString = cts.getCtsInscription(self);
if(inscriptionString != null && !inscriptionString.equals(""))
{
names[idx] = "inscription";
attribs[idx] = inscriptionString;
idx++;
}
return SCRIPT_CONTINUE;
}
boolean blog(string msg)
{
if(BLOGGING_ON)
LOG(BLOG_CATEGORY, msg);
return true;
}