Files
dsrc/sku.0/sys.server/compiled/game/script/systems/image_designer/holoemote.script
T

235 lines
7.2 KiB
Plaintext

/**********************************************************************
* Copyright (c)2000-2002 Sony Online Entertainment Inc.
* All Rights Reserved
*
* Title: holoemote
* Description: parses the holoemote command and plays holoemote
* @author hgray
* @version 1.0
**********************************************************************/
/***** INCLUDES ********************************************************/
include library.utils;
include library.sui;
/***** CONSTANTS *******************************************************/
const string HOLO_EMOTE_SCRIPT = "systems.image_designer.holoemote";
const string VAR_HOLO_HELP = "image_design.holohelp";
const string HOLO_DATATABLE = "datatables/image_design/holoemote.iff";
const string HOLO_HARDPOINT = "head";
const string HOLO_EMOTE_ALL = "holoemote_all";
const string HOLO_EMOTE_BEEHIVE = "holoemote_beehive";
const string HOLO_EMOTE_BRAINSTORM = "holoemote_brainstorm";
const string HOLO_EMOTE_IMPERIAL = "holoemote_imperial";
const string HOLO_EMOTE_REBEL = "holoemote_rebel";
const string HOLO_EMOTE_BUBBLEHEAD = "holoemote_bubblehead";
const string HOLO_EMOTE_HOLOGLITTER = "holoemote_hologlitter";
const string HOLO_EMOTE_HOLONOTES = "holoemote_holonotes";
const string HOLO_EMOTE_SPARKY = "holoemote_sparky";
const string HOLO_EMOTE_CHAMPAGNE = "holoemote_champagne";
const string HOLO_EMOTE_BULLHORNS = "holoemote_bullhorns";
const string HOLO_EMOTE_KITTY = "holoemote_kitty";
const string HOLO_EMOTE_PHONYTAIL = "holoemote_phonytail";
const string HOLO_EMOTE_BLOSSOM = "holoemote_blossom";
const string HOLO_EMOTE_BUTTERFLIES = "holoemote_butterflies";
const string HOLO_EMOTE_HAUNTED = "holoemote_haunted";
const string HOLO_EMOTE_HEARTS = "holoemote_hearts";
const string HOLO_EMOTE_DELETE = "delete";
const string HOLO_EMOTE_HELP = "help";
const string STF_FILE = "image_designer";
const int MINUTE = 60;
/***** TRIGGERS ********************************************************/
/***** MESSAGEHANDLERS *************************************************/
messageHandler holoHelpOff ()
{
obj_id holoSelf = sui.getPlayerId(params);
//debugSpeakMsg(self, "HIT -- OUTSIDE holoHelpOff");
if (utils.hasScriptVar(holoSelf, VAR_HOLO_HELP))
{
//debugSpeakMsg(self, "HIT -- INSIDE holoHelpOff");
utils.removeScriptVar(holoSelf, VAR_HOLO_HELP);
}
return SCRIPT_CONTINUE;
}
/***** COMMANDHANDLERS *************************************************/
commandHandler cmdHoloEmote()
{
if(!utils.hasObjVar(self, "holoEmote"))
{
sendSystemMessage(self, new string_id(STF_FILE, "no_holoemote"));
return SCRIPT_CONTINUE;
}
if(toLower(params).equals(HOLO_EMOTE_HELP))
{
if(!utils.hasScriptVar(self, VAR_HOLO_HELP))
{
int holoHelpCharges = utils.getIntObjVar(self, "holoEmoteCharges");
if(toLower(utils.getStringObjVar(self, "holoEmote")).equals(HOLO_EMOTE_ALL))
{
sui.msgbox(self, self, "Your Holo-Emote generator can play all Holo-Emotes available. \n You have "+holoHelpCharges+" charges remaining. \n To play a Holo-Emote, type /holoemote <name>. \n To delete your Holo-Emote type /holoemote delete. \n Purchasing a new Holo-Emote will automatically delete your current Holo-Emote. \n \n The available Holo-Emote names are: \n \n Beehive Blossom Brainstorm \n Bubblehead Bullhorns Butterflies \n Champagne Haunted Hearts \n Hologlitter Holonotes Imperial \n Kitty Phonytail Rebel \n Sparky", sui.OK_ONLY, "Holo-Emote Help", sui.MSG_NORMAL, "holoHelpOff");
}
else
{
String holoType = utils.getStringObjVar(self, "holoEmote").substring(10);
sui.msgbox(self, self, "Your current Holo-Emote is "+holoType+". \n You have "+holoHelpCharges+" charges remaining. \n To play your Holo-Emote type /holoemote. \n To delete your Holo-Emote type /holoemote delete. \n Purchasing a new Holo-Emote will automatically delete your current Holo-Emote.", sui.OK_ONLY, "Holo-Emote Help", sui.MSG_NORMAL, "holoHelpOff");
}
utils.setScriptVar(self, VAR_HOLO_HELP, self);
return SCRIPT_CONTINUE;
}
else
{
return SCRIPT_CONTINUE;
}
}
if(toLower(params).equals(HOLO_EMOTE_DELETE))
{
detachScript(self, HOLO_EMOTE_SCRIPT);
utils.removeObjVar(self, "holoEmoteCharges");
utils.removeObjVar(self, "holoEmote");
sendSystemMessage(self, new string_id(STF_FILE, "remove_holoemote"));
return SCRIPT_CONTINUE;
}
if(getGameTime() - utils.getIntScriptVar(self, "holoEmoteTimer") < MINUTE)
{
sendSystemMessage(self, "Your Holo-Emote generator will recharge in "+(utils.getIntScriptVar(self, "holoEmoteTimer") - getGameTime() + MINUTE)+" seconds.", null);
return SCRIPT_CONTINUE;
}
if(utils.getIntObjVar(self, "holoEmoteCharges") <= 0)
{
sendSystemMessage(self, new string_id(STF_FILE, "no_charges_holoemote"));
detachScript(self, HOLO_EMOTE_SCRIPT);
utils.removeObjVar(self, "holoEmoteCharges");
utils.removeObjVar(self, "holoEmote");
if(utils.hasScriptVar(self, "holoEmoteTimer"))
{
utils.removeScriptVar(self, "holoEmoteTimer");
}
return SCRIPT_CONTINUE;
}
else
{
int charges = 0;
if(hasObjVar(self, "holoEmote") && toLower(utils.getStringObjVar(self, "holoEmote")).equals(HOLO_EMOTE_ALL))
{
String holoEmoteIn = toLower(params);
if (holoEmoteIn == "technokitty")
{
holoEmoteIn = "kitty";
}
String holoPath = getHoloEmotePath(holoEmoteIn);
boolean playTrue = playClientEffectObj(self, holoPath, self, HOLO_HARDPOINT);
if(playTrue)
{
if(utils.hasScriptVar(self, "holoEmoteTimer"))
{
utils.removeScriptVar(self, "holoEmoteTimer");
}
charges = utils.getIntObjVar(self, "holoEmoteCharges");
charges--;
utils.removeObjVar(self, "holoEmoteCharges");
utils.setObjVar(self, "holoEmoteCharges", charges);
utils.setScriptVar(self, "holoEmoteTimer", getGameTime());
}
else
{
sendSystemMessage(self, new string_id(STF_FILE, "holoemote_help"));
}
return SCRIPT_CONTINUE;
}
else
{
String holoString = utils.getStringObjVar(self, "holoEmote");
if(holoString.length() < 11)
{
LOG("HOLOEMOTE_ERROR", "A Holo-Emote received an invalid ObjVar from the UI: " + holoString );
return SCRIPT_CONTINUE;
}
string holoPath = getHoloEmotePath(utils.getStringObjVar(self, "holoEmote").substring(10));
boolean playTrue = playClientEffectObj(self, holoPath, self, HOLO_HARDPOINT);
if(playTrue)
{
if(utils.hasScriptVar(self, "holoEmoteTimer"))
{
utils.removeScriptVar(self, "holoEmoteTimer");
}
charges = utils.getIntObjVar(self, "holoEmoteCharges");
charges--;
utils.removeObjVar(self, "holoEmoteCharges");
utils.setObjVar(self, "holoEmoteCharges", charges);
utils.setScriptVar(self, "holoEmoteTimer", getGameTime());
}
else
{
LOG("HOLOEMOTE_ERROR", "A Holo-Emote did not fire! HoloString: " + holoString + " HoloPath: " +holoPath+ " Charges: "+charges );
}
return SCRIPT_CONTINUE;
}
}
}
/***** FUNCTIONS *******************************************************/
string getHoloEmotePath(string holoEmote)
{
int holo_row = dataTableSearchColumnForString(holoEmote, 0, HOLO_DATATABLE);
string holo_path = dataTableGetString(HOLO_DATATABLE, holo_row, 1);
return holo_path;
}