mirror of
https://bitbucket.org/seefoe/dsrc.git
synced 2026-07-31 01:15:55 -04:00
299 lines
8.6 KiB
Plaintext
299 lines
8.6 KiB
Plaintext
include library.utils;
|
|
|
|
const string[] HELP_TEXT = { "=========================================",
|
|
"KEY WORDS (These are case sensitive): setStartPhrase, setEndPhrase, setAreaRange, setSingleMode, setAreaMode, showStats, detach.",
|
|
"setStartPhrase: Set the phrase that you will speak to cause yourself to become TEF'd. Default is \"Come get me\"",
|
|
"setEndPhrase: Set the phrase that you will speak to attempt to end your TEFs. Default is \"Not in the face!\"",
|
|
"setAreaRange: Set the range for area wide TEF mode.",
|
|
"setSingleMode: Puts you in single target mode, meaning only your look-at target will get a TEF against you.",
|
|
"setAreaMode: Puts you in area wide mode.",
|
|
"showStats: Check what mode you are in and current variables.",
|
|
"detach: Detachs this script and clears objvars.",
|
|
"========================================="
|
|
};
|
|
|
|
trigger OnAttach()
|
|
{
|
|
|
|
if(!isPlayer(self))
|
|
detachScript(self, "event.area_tefme");
|
|
removeObjVar(self, "event.tefme");
|
|
|
|
if(!isGod(self))
|
|
{
|
|
detachScript(self, "event.area_tefme");
|
|
sendSystemMessage(self, "You must be in God Mode for this script to take hold.", null);
|
|
removeObjVar(self, "event.tefme");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(isGod(self))
|
|
{
|
|
int godLevel = getGodLevel(self);
|
|
if(godLevel < 15)
|
|
{
|
|
detachScript(self, "event.area_tefme");
|
|
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
|
|
removeObjVar(self, "event.tefme");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
|
|
sendSystemMessage(self, "Say \"Help\" for usage and options. Remember to refresh God Mode after teleporting or warping.", null);
|
|
|
|
string startPhrase = "Come get me";
|
|
string endPhrase = "Not in the face!";
|
|
|
|
setObjVar(self, "event.tefme.currentState", 0);
|
|
setObjVar(self, "event.tefme.startPhrase", startPhrase);
|
|
setObjVar(self, "event.tefme.endPhrase", endPhrase);
|
|
setObjVar(self, "event.tefme.range", 100);
|
|
setObjVar(self, "event.tefme.mode", 0);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
/*------------------------------------------
|
|
trigger OnLogin()
|
|
{
|
|
|
|
if(!isGod(self))
|
|
{
|
|
detachScript(self, "event.area_tefme");
|
|
removeObjVar(self, "event.tefme");
|
|
sendSystemMessage(self, "You must be in God Mode to use this script.", null);
|
|
}
|
|
|
|
if(isGod(self))
|
|
{
|
|
int godLevel = getGodLevel(self);
|
|
if(godLevel < 15)
|
|
{
|
|
detachScript(self, "event.area_tefme");
|
|
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
|
|
removeObjVar(self, "event.tefme");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
----------------------------------------------*/
|
|
|
|
trigger OnHearSpeech(obj_id objSpeaker, string strText)
|
|
{
|
|
if(objSpeaker!=self)
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(isGod(self))
|
|
{
|
|
int godLevel = getGodLevel(self);
|
|
if(godLevel < 15)
|
|
{
|
|
detachScript(self, "event.area_tefme");
|
|
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
|
|
removeObjVar(self, "event.tefme");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
|
|
if(!isGod(self))
|
|
{
|
|
detachScript(self, "event.area_tefme");
|
|
sendSystemMessage(self, "You must be in God Mode to use this script.", null);
|
|
removeObjVar(self, "event.tefme");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
int currentState = getIntObjVar(self, "event.tefme.currentState");
|
|
string startPhrase = getStringObjVar(self, "event.tefme.startPhrase");
|
|
string endPhrase = getStringObjVar(self, "event.tefme.endPhrase");
|
|
int range = getIntObjVar(self, "event.tefme.range");
|
|
int mode = getIntObjVar(self, "event.tefme.mode");
|
|
|
|
if(mode == 0 && currentState == 0) // AOE version
|
|
{
|
|
|
|
if(strText.equalsIgnoreCase(startPhrase))
|
|
{
|
|
obj_id[] objPlayers = getPlayerCreaturesInRange(self, range);
|
|
|
|
if (objPlayers != null && objPlayers.length>0)
|
|
{
|
|
for(int i = 0; i < objPlayers.length; i++)
|
|
{
|
|
if(objPlayers[i] != self)
|
|
{
|
|
pvpSetPersonalEnemyFlag(self, objPlayers[i]);
|
|
string playerName = getName(objPlayers[i]);
|
|
sendSystemMessage(self, playerName + " can now attack you!", null);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if(strText.equalsIgnoreCase(endPhrase))
|
|
{
|
|
pvpRemoveAllTempEnemyFlags(self);
|
|
sendSystemMessage(self, "Clearing your TEFs. Note that you may still be able to attack some players for a period of time.", null);
|
|
}
|
|
|
|
}
|
|
|
|
if(mode == 1 && currentState == 0) // Single target version
|
|
{
|
|
if(strText.equalsIgnoreCase(startPhrase))
|
|
{
|
|
obj_id target = getLookAtTarget(self);
|
|
|
|
if(isIdValid(target) && target != self)
|
|
{
|
|
pvpSetPersonalEnemyFlag(self, target);
|
|
string playerName = getName(target);
|
|
sendSystemMessage(self, playerName + " can now attack you!", null);
|
|
}
|
|
}
|
|
|
|
if(strText.equalsIgnoreCase(endPhrase))
|
|
{
|
|
pvpRemoveAllTempEnemyFlags(self);
|
|
sendSystemMessage(self, "Clearing your TEFs. Note that you may still be able to attack some players for a period of time.", null);
|
|
}
|
|
|
|
}
|
|
|
|
if(currentState == 1) // We're setting the start phrase.
|
|
{
|
|
if(strText.equalsIgnoreCase(endPhrase))
|
|
{
|
|
sendSystemMessage(self, "Your start phrase must be different from your end phrase dummy.", null);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
setObjVar(self, "event.tefme.startPhrase", strText);
|
|
setObjVar(self, "event.tefme.currentState", 0);
|
|
sendSystemMessage(self, "You will TEF yourself when you say the following phrase: " + strText, null);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(currentState == 2) // We're setting the end phrase.
|
|
{
|
|
if(strText.equalsIgnoreCase(startPhrase))
|
|
{
|
|
sendSystemMessage(self, "Your end phrase must be different from your start phrase dummy.", null);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
setObjVar(self, "event.tefme.endPhrase", strText);
|
|
setObjVar(self, "event.tefme.currentState", 0);
|
|
sendSystemMessage(self, "You will attempt to lose your TEFs when you say the following phrase: " + strText, null);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(currentState == 3) // We're setting the range.
|
|
{
|
|
string rangeStr = strText;
|
|
range = utils.stringToInt(rangeStr);
|
|
|
|
if(range < 1 || range > 256)
|
|
{
|
|
sendSystemMessage(self, "Range must be between 1 and 255. Please note that these are numbers. Try again.", null);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
setObjVar(self, "event.tefme.range", range);
|
|
setObjVar(self, "event.tefme.currentState", 0);
|
|
|
|
sendSystemMessage(self, "Your TEF range is set to " + strText + "m.", null);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(currentState > 3) // WTF mate?
|
|
{
|
|
setObjVar(self, "event.tefme.currentState", 0);
|
|
sendSystemMessage(self, "Somehow currentState was above 3. Resetting it to 0.", null);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(mode > 1) // WTF mate?
|
|
{
|
|
setObjVar(self, "event.tefme.mode", 0);
|
|
sendSystemMessage(self, "Somehow mode was above 1. Resetting it to 0.", null);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(strText.equals("setStartPhrase"))
|
|
{
|
|
setObjVar(self, "event.tefme.currentState", 1);
|
|
sendSystemMessage(self, "The next phrase you say will be set as the trigger to TEF yourself.", null);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(strText.equals("setEndPhrase"))
|
|
{
|
|
setObjVar(self, "event.tefme.currentState", 2);
|
|
sendSystemMessage(self, "The next phrase you say will be set as the trigger to attempt to remove your TEFs.", null);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(strText.equals("setAreaRange"))
|
|
{
|
|
setObjVar(self, "event.tefme.currentState", 3);
|
|
sendSystemMessage(self, "Speak the range you wish to use for the AOE TEF.", null);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(strText.equals("setSingleMode"))
|
|
{
|
|
setObjVar(self, "event.tefme.mode", 1);
|
|
sendSystemMessage(self, "Single TEF Mode active. Your look-at target will recieve a TEF for you when you speak the startPhrase.", null);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if(strText.equals("setAreaMode"))
|
|
{
|
|
setObjVar(self, "event.tefme.mode", 0);
|
|
sendSystemMessage(self, "Area Mode active. Everyone within " + range + "m will get a TEF against you when you speak the startPhrase.", null);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(strText.equals("showStats"))
|
|
{
|
|
string currentModeStr = "Area Mode";
|
|
|
|
if(mode == 0)
|
|
currentModeStr = "Area Mode";
|
|
|
|
if(mode == 1)
|
|
currentModeStr = "Single Target Mode";
|
|
|
|
sendSystemMessage(self, "You are currently in " + currentModeStr, null);
|
|
sendSystemMessage(self, "Your start phrase is: " + startPhrase, null);
|
|
sendSystemMessage(self, "Your end phrase is: " + endPhrase, null);
|
|
sendSystemMessage(self, "Your current AOE range is set to " + range + "m", null);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(toLower(strText).equals("detach"))
|
|
{
|
|
detachScript(self, "event.area_tefme");
|
|
removeObjVar(self, "event.tefme");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
|
|
if(toLower(strText).equals("help"))
|
|
{
|
|
|
|
for(int i = 0; i < HELP_TEXT.length; i++)
|
|
{
|
|
sendSystemMessage(self, HELP_TEXT[i], null);
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
} |