mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-28 22:15:54 -04:00
191 lines
4.3 KiB
Plaintext
191 lines
4.3 KiB
Plaintext
//************************************************************/
|
|
// Copyright (c) ©2000,2001 Sony Online Entertainment Inc.
|
|
// All Rights Reserved
|
|
//
|
|
// Title: qaham.script
|
|
// Description: Health and Action Script - keeps testers full of Health and Action
|
|
// @author $Author: James Michener $
|
|
// @version $1.0.0$
|
|
//************************************************************/
|
|
|
|
include java.util.StringTokenizer;
|
|
|
|
|
|
/********* Constants *****************************************/
|
|
|
|
const string QA_REGEN_OBJVAR = "test.qaham.OriginalActionRegen";
|
|
const float QA_MASSIVE_REGEN_RATE = 10000;
|
|
|
|
/********* Triggers ******************************************/
|
|
|
|
trigger OnAttach()
|
|
{
|
|
if (isGod(self))
|
|
{
|
|
if(getGodLevel(self) < 10)
|
|
{
|
|
detachScript(self, "test.qaham");
|
|
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
|
|
}
|
|
else
|
|
{
|
|
helpMessage(self);
|
|
}
|
|
}
|
|
else if (!isGod(self))
|
|
{
|
|
detachScript(self, "test.qaham");
|
|
}
|
|
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
|
|
trigger OnDetach()
|
|
{
|
|
restoreActionRegenRate(self);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
/*
|
|
trigger OnLogout()
|
|
{
|
|
detachScript(self, "test.qaham");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
*/
|
|
|
|
trigger OnSpeaking(string text)
|
|
{
|
|
obj_id player = self;
|
|
|
|
if(isGod(player))
|
|
{
|
|
StringTokenizer st = new java.util.StringTokenizer(text);
|
|
int tokens = st.countTokens();
|
|
string command = null;
|
|
if (st.hasMoreTokens())
|
|
command = st.nextToken();
|
|
|
|
//Lists player's buffs in system messages.
|
|
if(command.equals("stop_action_regen"))
|
|
{
|
|
stopActionRegenRate(player);
|
|
}
|
|
if(command.equals("restore_action_regen"))
|
|
{
|
|
restoreActionRegenRate(player);
|
|
|
|
}
|
|
if(command.equals("max_action_regen"))
|
|
{
|
|
setActionRegenRate(player, QA_MASSIVE_REGEN_RATE);
|
|
}
|
|
if(command.equals("qaham") || command.equals("test.qaham"))
|
|
{
|
|
helpMessage(player);
|
|
}
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
void restoreActionRegenRate(obj_id player)
|
|
{
|
|
|
|
if(!isIdValid(player))
|
|
{
|
|
return;
|
|
}
|
|
|
|
if(!hasObjVar(player, QA_REGEN_OBJVAR))
|
|
{
|
|
return;
|
|
}
|
|
|
|
float myStoredRegen = getFloatObjVar(player, QA_REGEN_OBJVAR);
|
|
|
|
getActionRegenRate(player, myStoredRegen);
|
|
|
|
removeObjVar(player, QA_REGEN_OBJVAR);
|
|
|
|
if(!hasObjVar(player, QA_REGEN_OBJVAR))
|
|
{
|
|
sendSystemMessageTestingOnly(player, "Your Action Regen Rate has been restored");
|
|
}
|
|
else
|
|
{
|
|
sendSystemMessageTestingOnly(player, "Problem - Regen Rate was not restored!");
|
|
sendSystemMessageTestingOnly(player, "Contact the QA Tool Team about this character immediately.");
|
|
}
|
|
|
|
}
|
|
|
|
void stopActionRegenRate(obj_id player)
|
|
{
|
|
if(!isIdValid(player))
|
|
{
|
|
return;
|
|
}
|
|
|
|
setActionRegenRate(player, 0f);
|
|
|
|
}
|
|
|
|
|
|
void setActionRegenRate(obj_id player, float rate)
|
|
{
|
|
|
|
if(!isIdValid(player))
|
|
{
|
|
return;
|
|
}
|
|
|
|
//get the tester's original regen rate
|
|
float currentRegenRate = getActionRegenRate(player);
|
|
|
|
//place the original regen rate as an objvar
|
|
//if player has objvar, assume the orignal rate has already been stored
|
|
if (!hasObjVar(player, QA_REGEN_OBJVAR))
|
|
{
|
|
setObjVar(player, QA_REGEN_OBJVAR, currentRegenRate);
|
|
}
|
|
//set the tester's regen rate
|
|
getActionRegenRate(player, rate);
|
|
|
|
if(hasObjVar(player, QA_REGEN_OBJVAR))
|
|
{
|
|
sendSystemMessageTestingOnly(player, "Your Action Regen Rate has been set to " + rate);
|
|
}
|
|
else
|
|
{
|
|
sendSystemMessageTestingOnly(player, "Problem - Regen Rate was not set correctly!");
|
|
sendSystemMessageTestingOnly(player, "Contact the QA Tool Team about this character immediately.");
|
|
}
|
|
|
|
}
|
|
|
|
void helpMessage(obj_id player)
|
|
{
|
|
if(!isIdValid(player))
|
|
{
|
|
return;
|
|
}
|
|
|
|
//help messages are triggered in spatial chat by saying the name of the script that is attached
|
|
//messages should include:
|
|
//script name
|
|
//all commands related to script
|
|
//any other useful information
|
|
|
|
//TODO: Consider switching from system mesages to pop-up window with save to text button like qatool dumptarget
|
|
|
|
sendSystemMessageTestingOnly(player, "Qaham Script Help Message");
|
|
sendSystemMessageTestingOnly(player, "Say any the following commands in chat:");
|
|
sendSystemMessageTestingOnly(player, "stop_action_regen");
|
|
sendSystemMessageTestingOnly(player, "restore_action_regen");
|
|
sendSystemMessageTestingOnly(player, "max_action_regen");
|
|
|
|
} |