mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-28 22:15:54 -04:00
178 lines
5.6 KiB
Plaintext
178 lines
5.6 KiB
Plaintext
// ======================================================================
|
|
//
|
|
// qa_damage.script
|
|
// Copyright 2006, Sony Online Entertainment
|
|
// All Rights Reserved.
|
|
//
|
|
// VERSION 1.50
|
|
//
|
|
// Jeff W Haskell
|
|
//
|
|
//
|
|
// QA Tool - Damage/Health Tool Version 1.50
|
|
//
|
|
// not for public use
|
|
//
|
|
// Attach the test.qatools script to the test character and use the spatial command 'damage'. If the tester has a valid mob or player targeted (to include themself) a SUI will instantiate
|
|
// and give the tester a transfer UI with the target's current health max. The tester can use the slider to subtract health from the target for any testing purpose
|
|
//
|
|
// ======================================================================
|
|
//
|
|
|
|
/***** INCLUDES ********************************************************/
|
|
|
|
include library.qa;
|
|
include library.sui;
|
|
include library.utils;
|
|
|
|
/***** CONSTANTS *******************************************************/
|
|
|
|
const string DAMAGE_PID_SCRIPTVAR = "doDamage.pid";
|
|
const string DAMAGE_SCRIPTVAR = "doDamageVar";
|
|
const string HEAL_PID_SCRIPTVAR = "healDamage.pid";
|
|
const string HEAL_SCRIPTVAR = "healDamageVar";
|
|
const string HEAL_TOOL_PROMPT = "Give the amount you want to heal the target for. This tool will heal in the amount you specify as long as it doesn't exceed the target's maximum health.";
|
|
const string HEAL_TOOL_TITLE = "HEAL AMOUNT";
|
|
const string DAMAGE_TOOL_PROMPT = "Give the amount you want to damage the target for. This tool will cause damage in the amount you specify. ARMOR AND OTHER MITIGATION WILL NOT BE CONSIDERED. Use the Mitigation Tool to test Mitigation.";
|
|
const string DAMAGE_TOOL_TITLE = "DAMAGE AMOUNT";
|
|
|
|
/***** TRIGGERS *******************************************************/
|
|
|
|
trigger OnAttach()
|
|
{
|
|
if (isGod(self))
|
|
{
|
|
if(getGodLevel(self) < 10)
|
|
{
|
|
detachScript(self, "test.qatool");
|
|
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
|
|
}
|
|
}
|
|
else if (!isGod(self))
|
|
{
|
|
detachScript(self, "test.qatool");
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnSpeaking(string text)
|
|
{
|
|
if(isGod(self))
|
|
{
|
|
if ( toLower(text).equals("qadamage") || toLower(text).equals("mobdamage") || toLower(text).equals("playerdamage"))
|
|
{
|
|
qa.damageMobTool(self);
|
|
}
|
|
|
|
else if ( toLower(text).equals("heal") || toLower(text).equals("mobheal") || toLower(text).equals("playerheal"))
|
|
{
|
|
qa.healMobTool(self);
|
|
}
|
|
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
/******** Message Handlers *************************************/
|
|
messageHandler doTheDamage()
|
|
{
|
|
if (isGod(self))
|
|
{
|
|
if (utils.hasScriptVar( self, DAMAGE_PID_SCRIPTVAR))
|
|
{
|
|
//sendSystemMessageTestingOnly(self, "handler doTheDamage");
|
|
|
|
qa.checkParams(params, "doDamage");
|
|
int idx = sui.getListboxSelectedRow(params);
|
|
int btn = sui.getIntButtonPressed(params);
|
|
int damageAmount = sui.getTransferInputTo(params);
|
|
|
|
int healthWhenAttacked = utils.getIntScriptVar(self, DAMAGE_SCRIPTVAR + ".targetCurrentHealth");
|
|
|
|
obj_id lookAtTarget = utils.stringToObjId(utils.getStringScriptVar(self, DAMAGE_SCRIPTVAR + ".lookAtTarget"));
|
|
int healthRightNow = getAttrib(lookAtTarget, HEALTH);
|
|
|
|
if (btn == sui.BP_CANCEL)
|
|
{
|
|
removePlayer(self, "Tool Exiting");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
else
|
|
{
|
|
if (damageAmount > 0 && isIdValid(lookAtTarget))
|
|
{
|
|
damage(lookAtTarget, DAMAGE_KINETIC, HIT_LOCATION_BODY, damageAmount);
|
|
CustomerServiceLog("qaTool","User: (" + self + ") " + getName(self) + " has healed (" + lookAtTarget + ") using the QA Damage Tool.");
|
|
sendSystemMessageTestingOnly(self, "Damage to target completed.");
|
|
}
|
|
else
|
|
{
|
|
sendSystemMessageTestingOnly(self, "Variables not valid");
|
|
}
|
|
|
|
removePlayer(self, "");
|
|
}
|
|
}
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
messageHandler healDamage()
|
|
{
|
|
if (isGod(self))
|
|
{
|
|
if (utils.hasScriptVar(self, HEAL_PID_SCRIPTVAR))
|
|
{
|
|
//sendSystemMessageTestingOnly(self, "handler healDamage");
|
|
|
|
qa.checkParams(params, "healDamage");
|
|
int idx = sui.getListboxSelectedRow(params);
|
|
int btn = sui.getIntButtonPressed(params);
|
|
int healAmount = sui.getTransferInputTo(params);
|
|
|
|
int healthWhenAttacked = utils.getIntScriptVar(self, HEAL_SCRIPTVAR + ".targetCurrentHealth");
|
|
|
|
obj_id lookAtTarget = utils.stringToObjId(utils.getStringScriptVar(self, HEAL_SCRIPTVAR + ".lookAtTarget"));
|
|
int healthRightNow = getAttrib(lookAtTarget, HEALTH);
|
|
|
|
if (btn == sui.BP_CANCEL)
|
|
{
|
|
removePlayer(self, "Tool Exiting");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
else
|
|
{
|
|
if (healAmount > 0 && isIdValid(lookAtTarget))
|
|
{
|
|
int totalHeal = healAmount + healthRightNow;
|
|
setAttrib(lookAtTarget, HEALTH, totalHeal);
|
|
CustomerServiceLog("qaTool","User: (" + self + ") " + getName(self) + " has healed (" + lookAtTarget + ") using the QA Heal Tool.");
|
|
|
|
// sendSystemMessageTestingOnly(self, ""+totalHeal);
|
|
sendSystemMessageTestingOnly(self, "Heal target completed.");
|
|
}
|
|
else
|
|
{
|
|
sendSystemMessageTestingOnly(self, "Variables not valid");
|
|
}
|
|
|
|
removePlayer(self, "");
|
|
}
|
|
}
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//THIS FUNCTION IS A GENERIC SCRIPT REMOVAL FUNCTION
|
|
void removePlayer(obj_id self, string err)
|
|
{
|
|
sendSystemMessageTestingOnly(self, err);
|
|
qa.removeScriptVars(self, DAMAGE_SCRIPTVAR);
|
|
qa.removeScriptVars(self, DAMAGE_PID_SCRIPTVAR);
|
|
utils.removeScriptVarTree(self, DAMAGE_SCRIPTVAR);
|
|
utils.removeScriptVarTree(self, DAMAGE_PID_SCRIPTVAR);
|
|
qa.removeScriptVars(self, HEAL_SCRIPTVAR);
|
|
qa.removeScriptVars(self, HEAL_PID_SCRIPTVAR);
|
|
utils.removeScriptVarTree(self, HEAL_SCRIPTVAR);
|
|
utils.removeScriptVarTree(self, HEAL_PID_SCRIPTVAR);
|
|
} |