Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function RPGchat(%client, %team, %message, %senderName)
- {
- if(%client.IsInvalid) {
- return;
- }
- if(isobject(%client) == false) {
- return;
- }
- //-------------------------//
- %TrueClientId = %client;
- if(%senderName !$= "")
- {
- %client = 2048;
- %clientToServerAdminLevel = $BlockOwnerAdminLevel[%senderName];
- }
- else
- {
- %senderName = %client.nameBase;
- %clientToServerAdminLevel = mfloor(%client.adminLevel);
- }
- if(%client.isAIControlled()) {
- %clientToServerAdminLevel = 3;
- }
- if(%TrueClientId $= 2048) {
- %echoOff = true;
- }
- else {
- %echoOff = %TrueClientId.echoOff;
- }
- %TCsenderName = %TrueClientId.rpgName;
- //If %senderName is empty, the rest of this function will continue normally, as both %TrueClientId and %client
- //are identical. However, if %senderName is NOT empty, messages that the server should hear will be under %client,
- //and messages that the client RUNNING the script needs to hear will be under %TrueClientId.
- //During %senderName being NOT empty, basic player command messages are sent to the server. These commands shouldn't
- //normally be invoked anyway, unless the scripter forces it somehow. Block management commands should use
- //%TrueClientId because they can only be run WHILE the client is in-game, so the messages should be sent to him.
- //The rest of the commands should use %client because those are the ones that the server will be calling.
- //An easy to way to distinguish the tasks between client and server is that the client runs the commands that
- //manage, while the server runs the commands that do actions.
- //- %TrueClientId should be assigned to things that require client access, and need to send a message
- // (like a confirmation or error message) to someone.
- //- %client should be assigned to things that do actions.
- //%TrueClientId will only become 2048 if the client leaves the game.
- //Remember that if a client disconnects, the %TrueClientId will become 2048, the same as %client. This means
- //that the server will then be receiving all these messages.
- //I had to write this little commentary because I was getting confused myself...
- //NEW:
- //- %TrueClientId should be assigned to things that involve the player at hand
- //- %client should be assigned to things that involve control
- //-------------------------//
- %time = getTime();
- if(%time - %client.lastSayTime <= $sayDelay && !(%clientToServerAdminLevel >= 1)) {
- return;
- }
- %client.lastSayTime = %time;
- //check for a bulknum-type of message
- if(%message $= mfloor(%message))
- {
- if(%client.currentShop !$= "" || %client.currentBank !$= "")
- {
- if(%message < 1) {
- %message = 1;
- }
- if(%message > 100) {
- %message = 100;
- }
- }
- %TrueClientId.bulkNum = %message;
- }
- //parse message
- %botTalk = false;
- %isCommand = false;
- if(getsubstr(%message, 0, 1) !$= "#")
- {
- if(%team $= 1) {
- %message = "#zone " @ %message;
- }
- else {
- %message = fetchData(%TrueClientId, "defaultTalk") @ " " @ %message;
- }
- }
- if(getsubstr(%message, 0, 1) $= "#") {
- %isCommand = true;
- }
- if($exportChat)
- {
- %ip = %TrueClientId.getAddress();
- if(%TrueClientId.doExport)
- {
- $log::msg["[\"" @ %TCsenderName @ "\"]"] = %message;
- export("log::msg[\"" @ %TCsenderName @ "\"*", "temp\\log-" @ %TCsenderName @ ".cs", true);
- $log::msg["[\"" @ %TCsenderName @ "\"]"] = "";//memory
- }
- }
- %w1 = GetWord(%message, 0);
- //========== Redirect block commands into memory =============================================
- if(fetchData(%TrueClientId, "BlockInputFlag") !$= "" && stricmp(%w1, "#endblock") !$= 0 && %w1 !$= -1 && %message !$= "")
- {
- //Entering block information into memory
- %tmpBlockCnt = fetchData(%TrueClientId, "tmpBlockCnt") + 1;
- storeData(%TrueClientId, "tmpBlockCnt", %tmpBlockCnt);
- $BlockData[%TCsenderName, fetchData(%TrueClientId, "BlockInputFlag"), %tmpBlockCnt] = %message;
- return 0;
- }
- //============================================================================================
- %cropped = getsubstr(%message, (strlen(%w1)+1), 99999);
- if(%isCommand)
- {
- switch$(%w1)
- {
- case "#say":
- if(SkillCanUse(%TrueClientId, "#say"))
- {
- if(%TrueClientID.player)// does player exist
- {
- %count = ClientGroup.getCount();
- for(%icl = 0; %icl < %count; %icl++)
- {
- %cl = ClientGroup.getObject(%icl);
- if(isobject(%cl.player))
- {
- %talkingPos = %TrueClientId.player.getPosition();
- %receivingPos = %cl.player.getPosition();
- %distVec = VectorDist(%talkingPos, %receivingPos);
- if(%distVec <= $maxSAYdistVec)
- {
- //%newmsg = FadeMsg(%cropped, %distVec, $maxSAYdistVec);
- %newmsg = %cropped;
- if(!%cl.muted[%TrueClientId] && %cl !$= %TrueClientId) {
- messageClient(%cl, 'RPGchatCallback', %TCsenderName @ " says, \"" @ %newmsg @ "\"");
- }
- }
- }
- }
- messageClient(%TrueClientId, 'RPGchatCallback', "You say, \"" @ %cropped @ "\"");
- UseSkill(%TrueClientId, $SkillSpeech, true, true);
- %botTalk = true;
- }
- }
- else
- {
- messageClient(%TrueClientId, 'RPGchatCallback', "You lack the necessary skills to use this command.");
- UseSkill(%TrueClientId, $SkillSpeech, false, true);
- }
- case "#shout":
- if(SkillCanUse(%TrueClientId, "#shout"))
- {
- %count = ClientGroup.getCount();
- for(%icl = 0; %icl < %count; %icl++)
- {
- %cl = ClientGroup.getObject(%icl);
- %talkingPos = %TrueClientId.player.getPosition();
- %receivingPos = %cl.player.getPosition();
- %distVec = VectorDist(%talkingPos, %receivingPos);
- if(%distVec <= $maxSHOUTdistVec)
- {
- //%newmsg = FadeMsg(%cropped, %distVec, $maxSHOUTdistVec);
- %newmsg = %cropped;
- if(!%cl.muted[%TrueClientId] && %cl !$= %TrueClientId) {
- messageClient(%cl, 'RPGchatCallback', %TCsenderName @ " shouts, \"" @ %newmsg @ "\"");
- }
- }
- }
- messageClient(%TrueClientId, 'RPGchatCallback', "You shouted, \"" @ %cropped @ "\"");
- UseSkill(%TrueClientId, $SkillSpeech, true, true);
- %botTalk = true;
- }
- else
- {
- messageClient(%TrueClientId, 'RPGchatCallback', "You lack the necessary skills to use this command.");
- UseSkill(%TrueClientId, $SkillSpeech, false, true);
- }
- case "#whisper":
- if(SkillCanUse(%TrueClientId, "#whisper"))
- {
- %count = ClientGroup.getCount();
- for(%icl = 0; %icl < %count; %icl++)
- {
- %cl = ClientGroup.getObject(%icl);
- %talkingPos = %TrueClientId.player.getPosition();
- %receivingPos = %cl.player.getPosition();
- %distVec = VectorDist(%talkingPos, %receivingPos);
- if(%distVec <= $maxWHISPERdistVec)
- {
- //%newmsg = FadeMsg(%cropped, %distVec, $maxWHISPERdistVec);
- %newmsg = %cropped;
- if(!%cl.muted[%TrueClientId] && %cl !$= %TrueClientId) {
- messageClient(%cl, 'RPGchatCallback', %TCsenderName @ " whispers, \"" @ %newmsg @ "\"");
- }
- }
- }
- messageClient(%TrueClientId, 'RPGchatCallback', "You whisper, \"" @ %cropped @ "\"");
- UseSkill(%TrueClientId, $SkillSpeech, true, true);
- %botTalk = true;
- }
- else
- {
- messageClient(%TrueClientId, 'RPGchatCallback', "You lack the necessary skills to use this command.");
- UseSkill(%TrueClientId, $SkillSpeech, false, true);
- }
- }
- if(Game.IsJailed(%TrueClientId) && %clienttoServeradminlevel < 5) {
- return;
- }
- switch$(%w1)
- {
- case "#tell":
- if(SkillCanUse(%TrueClientId, "#tell"))
- {
- if(%cropped $= "")
- {
- messageClient(%TrueClientId, 'RPGchatCallback', "syntax: #tell whoever, message");
- }
- else
- {
- %pos1 = 0;
- %pos2 = strstr(%cropped, ",");
- %name = getsubstr(%cropped, %pos1, %pos2-%pos1);
- %final = getsubstr(%cropped, %pos2 + 2, strlen(%cropped)-%pos2-2);
- %cl = getClientByName(%name);
- if(%cl !$= -1)
- {
- %n = %cl.nameBase; //capitalize the name properly
- if(!%cl.muted[%TrueClientId])
- {
- messageClient(%cl, 'RPGchatCallback', %TCsenderName @ " tells you, \"" @ %final @ "\"");
- if(%cl !$= %TrueClientId) {
- messageClient(%TrueClientId, 'RPGchatCallback', "You tell " @ %n @ ", \"" @ %final @ "\"");
- }
- %cl.replyTo = %TCsenderName;
- UseSkill(%TrueClientId, $SkillSpeech, true, true);
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', %n @ " has muted you.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name.");
- }
- }
- %botTalk = true;
- }
- else
- {
- messageClient(%TrueClientId, 'RPGchatCallback', "You lack the necessary skills to use this command.");
- UseSkill(%TrueClientId, $SkillSpeech, false, true);
- }
- case "#r":
- if(SkillCanUse(%TrueClientId, "#tell"))
- {
- if(%cropped $= "") {
- messageClient(%TrueClientId, 'RPGchatCallback', "syntax: #r message");
- }
- else
- {
- %name = %TrueClientId.replyTo;
- if(%name !$= "")
- {
- %cl = getClientByName(%name);
- if(%cl !$= -1)
- {
- if(!%cl.muted[%TrueClientId])
- {
- messageClient(%cl, 'RPGchatCallback', %TCsenderName @ " replies, \"" @ %cropped @ "\"");
- if(%cl !$= %TrueClientId) {
- messageClient(%TrueClientId, 'RPGchatCallback', "You reply to " @ %name @ ", \"" @ %cropped @ "\"");
- }
- %cl.replyTo = %TCsenderName;
- //UseSkill(%TrueClientId, $SkillSpeech, true, true);
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name.");
- }
- %botTalk = true;
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "You haven't received a #tell to reply to yet.");
- }
- }
- }
- else
- {
- messageClient(%TrueClientId, 'RPGchatCallback', "You lack the necessary skills to use this command.");
- UseSkill(%TrueClientId, $SkillSpeech, false, true);
- }
- return;
- case "#global" or "#g":
- if(SkillCanUse(%TrueClientId, "#global"))
- {
- if(!fetchData(%TrueClientId, "ignoreGlobal"))
- {
- %count = ClientGroup.getCount();
- for(%icl = 0; %icl < %count; %icl++)
- {
- %cl = ClientGroup.getObject(%icl);
- if(!%cl.muted[%TrueClientId] && %cl !$= %TrueClientId && !fetchData(%cl, "ignoreGlobal")) {
- messageClient(%cl, 'RPGchatCallback', "[GLBL] " @ %TCsenderName @ " \"" @ %cropped @ "\"");
- }
- }
- messageClient(%TrueClientId, 'RPGchatCallback', "[GLBL] \"" @ %cropped @ "\"");
- //UseSkill(%TrueClientId, $SkillSpeech, true, true);
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "You can't send a Global message when ignoring other Global messages.");
- }
- }
- else
- {
- messageClient(%TrueClientId, 'RPGchatCallback', "You lack the necessary skills to use this command.");
- UseSkill(%TrueClientId, $SkillSpeech, false, true);
- }
- return;
- case "#guild" or "#gu":
- if(SkillCanUse(%TrueClientId, "#guild"))
- {
- %guildid = IsInWhatGuild(%client);
- %guild = GuildGroup.GetObject(%guildid);
- if(%guildid != -1 || %guild.GetGUIDRank(%TrueClientId.guid) == 0)
- {
- //ok user is in a guild so we get the guild and obtain the list.
- %count = ClientGroup.getCount();
- for(%icl = 0; %icl < %count; %icl++)
- {
- %cl = ClientGroup.getObject(%icl);
- if(%cl.isAiControlled()) {
- continue; //skip bots
- }
- if(%guild.GUIDinGuild(%cl.guid) && %guild.GetGUIDRank(%cl.guid) > 0 && (!%cl.muted[%TrueClientId] && %cl !$= %TrueClientId)) {
- messageClient(%cl, 'RPGchatCallback' ,"[GUILD] " @ %TCsenderName @ " \"" @ %cropped @ "\"");
- }
- }
- messageClient(%TrueClientID, 'RPGchatCallback', "[GUILD] \"" @ %cropped @ "\"");
- UseSkill(%TrueClientId, $SkillSpeech, true, true);
- }
- else {
- messageClient(%TrueClientID, 'RPGchatcallback', "You are not in a guild.");
- }
- }
- else {
- messageClient(%TrueClientID, 'RPGchatCallback', "You lack the necessary skills to use this command.");
- }
- return;
- case "#zone" or "#z":
- if(SkillCanUse(%TrueClientId, "#zone"))
- {
- %count = ClientGroup.getCount();
- for(%icl = 0; %icl < %count; %icl++)
- {
- %cl = ClientGroup.getObject(%icl);
- if(!%cl.muted[%TrueClientId] && %cl !$= %TrueClientId && fetchData(%cl, "zone") $= fetchData(%TrueClientId, "zone")) {
- messageClient(%cl, 'RPGchatCallback', "[ZONE] " @ %TCsenderName @ " \"" @ %cropped @ "\"");
- }
- }
- messageClient(%TrueClientId, 'RPGchatCallback', "[ZONE] \"" @ %cropped @ "\"");
- UseSkill(%TrueClientId, $SkillSpeech, true, true);
- }
- else
- {
- messageClient(%TrueClientId, 'RPGchatCallback', "You lack the necessary skills to use this command.");
- UseSkill(%TrueClientId, $SkillSpeech, false, true);
- }
- return;
- case "#group":
- if(SkillCanUse(%TrueClientId, "#group"))
- {
- %count = ClientGroup.getCount();
- for(%icl = 0; %icl < %count; %icl++)
- {
- %cl = ClientGroup.getObject(%icl);
- if(!%cl.muted[%TrueClientId] && %cl !$= %TrueClientId && IsInGroupList(%TrueClientId, %cl))
- {
- if(IsInGroupList(%cl, %TrueClientId)) {
- messageClient(%cl, 'RPGchatCallback', "[GRP] " @ %TCsenderName @ " \"" @ %cropped @ "\"");
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', %cl.nameBase @ " does not have you on his/her group-list.");
- }
- }
- }
- messageClient(%TrueClientId, 'RPGchatCallback', "[GRP] \"" @ %cropped @ "\"");
- UseSkill(%TrueClientId, $SkillSpeech, true, true);
- }
- else
- {
- messageClient(%TrueClientId, 'RPGchatCallback', "You lack the necessary skills to use this command.");
- UseSkill(%TrueClientId, $SkillSpeech, false, true);
- }
- return;
- case "#party" or "#p":
- if(SkillCanUse(%TrueClientId, "#party"))
- {
- %list = GetPartyListIAmIn(%TrueClientId);
- for(%p = strstr(%list, ","); (%p = strstr(%list, ",")) !$= -1; %list = getsubstr(%list, %p+1, 99999))
- {
- %cl = getsubstr(%list, 0, %p);
- if(!%cl.muted[%TrueClientId] && %cl !$= %TrueClientId) {
- messageClient(%cl, 'RPGchatCallback', "[PRTY] " @ %TCsenderName @ " \"" @ %cropped @ "\"");
- }
- }
- messageClient(%TrueClientId, 'RPGchatCallback', "[PRTY] \"" @ %cropped @ "\"");
- UseSkill(%TrueClientId, $SkillSpeech, true, true);
- }
- else
- {
- messageClient(%TrueClientId, 'RPGchatCallback', "You lack the necessary skills to use this command.");
- UseSkill(%TrueClientId, $SkillSpeech, false, true);
- }
- return;
- case "#leavearena":
- if(inArenaroster(%TrueClientId))
- {
- leaveArena(%TrueClientId);
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "You must be in the arena wait room in order to leave it");
- }
- }
- if(IsDead(%TrueClientId) && %TrueClientId !$= 2048) {
- return;
- }
- //check for onHear events
- if(%botTalk)
- {
- %count = ClientGroup.getCount();
- for(%icl = 0; %icl < %count; %icl++)
- {
- %oid = ClientGroup.getObject(%icl);
- %time = getTime();
- if(%time - fetchData(%oid, "nextOnHear") > 0.05)
- {
- storeData(%oid, "nextOnHear", %time);
- %oname = %oid.nameBase;
- %index = GetEventCommandIndex(%oid, "onHear");
- if(%index !$= -1)
- {
- for(%i2 = 0; (%index2 = GetWord(%index, %i2)) !$= ""; %i2++)
- {
- %ec = $EventCommand[%oid, %index2];
- %hearName = GetWord(%ec, 2);
- %radius = GetWord(%ec, 3);
- if(VectorDist(%oid.player.getPosition(), %TrueClientId.player.getPosition()) <= %radius)
- {
- %targetname = GetWord(%ec, 5);
- if(stricmp(%targetname, "all") !$= 0) {
- %targetId = getClientByName(%targetname);
- }
- if(stricmp(%targetname, "all") $= 0 || %targetId $= %TrueClientId)
- {
- %sname = GetWord(%ec, 0);
- %type = GetWord(%ec, 1);
- %keep = GetWord(%ec, 4);
- %var = GetWord(%ec, 6);
- if(stricmp(%var, "var") $= 0) {
- %var = true;
- }
- else
- {
- %div1 = strstr(%ec, "|");
- %div2 = String::ofindSubStr(%ec, "|", %div1+1);
- %text = getsubstr(%ec, %div1+1, %div2);
- %oec = getsubstr(%ec, %div1+%div2+2, 99999);
- }
- if(stricmp(%cropped, %text) $= 0 || %var)
- {
- if((%cl = getClientByName(%sname)) $= -1) {
- %cl = 2048;
- }
- %cmd = getsubstr($EventCommand[%oid, %index2], strstr($EventCommand[%oid, %index2], ">")+1, 99999);
- if(%var) {
- %cmd = strreplace(%cmd, "^var", %cropped);
- }
- %pcmd = ParseBlockData(%cmd, %TrueClientId, "");
- if(!%keep) {
- $EventCommand[%oid, %index2] = "";
- }
- RPGchat(%cl, 0, %pcmd); //, %sname);
- }
- }
- }
- }
- }
- }
- }
- }
- //=================================================
- // Beginning of commands
- // (player can't use any of these while dead)
- //=================================================
- switch$(%w1)
- {
- case "#steal":
- %time = getTime();
- if(%time - %TrueClientId.lastStealTime > $stealDelay)
- {
- %TrueClientId.lastStealTime = %time;
- if((%reason = AllowedToSteal(%TrueClientId)) $= "true")
- {
- if(SkillCanUse(%TrueClientId, "#steal"))
- {
- if(getLOSinfo(%TrueClientId, 1))
- {
- %id = $los::object.client;
- if($los::object.getClassName() $= "Player")
- {
- %victimName = %id.nameBase;
- %stealerName = %TCsenderName;
- %victimCoins = fetchData(%id, "COINS");
- %fail = false;
- if(%victimCoins > 0)
- {
- %r1 = GetRpgRoll("1r" @(%TrueClientId.PlayerSkill[$SkillStealing] * (4/5)));
- %r2 = GetRpgRoll("1r" @ %id.PlayerSkill[$SkillStealing]);
- %a = %r1 - %r2;
- if(%a > 0)
- {
- %amount = mfloor(%a * getRandom() * 1.2);
- if(%amount > %victimCoins) {
- %amount = %victimCoins;
- }
- if(%amount > 0)
- {
- storeData(%TrueClientId, "COINS", %amount, "inc");
- storeData(%id, "COINS", %amount, "dec");
- PerhapsPlayStealSound(%TrueClientId, 0);
- messageClient(%TrueClientId, 'RPGchatCallback', "You successfully stole " @ %amount @ " coins from " @ %victimName @ "!");
- RefreshAll(%TrueClientId);
- RefreshAll(%id);
- UseSkill(%TrueClientId, $SkillStealing, true, true);
- PostSteal(%TrueClientId, true, 0);
- }
- else {
- %fail = true;
- }
- }
- else {
- %fail = true;
- }
- if(%fail)
- {
- messageClient(%TrueClientId, 'RPGchatCallback', "You failed to steal from " @ %victimName @ "!");
- messageClient(%id, 'RPGchatCallback', %stealerName @ " just failed to steal from you!");
- UseSkill(%TrueClientId, $SkillStealing, false, true);
- PostSteal(%TrueClientId, false, 0);
- }
- }
- else
- {
- messageClient(%TrueClientId, 'RPGchatCallback', %victimName @ " doesn't appear to be carrying any coins...");
- }
- }
- }
- }
- else
- {
- messageClient(%TrueClientId, 'RPGchatCallback', "You can't steal because you lack the necessary skills.");
- UseSkill(%TrueClientId, $SkillStealing, false, true);
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', %reason);
- }
- }
- return;
- case "#savecharacter":
- if(%clientToServerAdminLevel >= 4)
- {
- if(%cropped $= "")
- {
- %r = SaveCharacter(%TrueClientId);
- messageClient(%TrueClientId, 'RPGchatCallback', "Saving self (" @ %TrueClientId @ "): success = " @ %r);
- }
- else
- {
- %id = getClientByName(%cropped);
- if(%id)
- {
- %r = SaveCharacter(%id);
- messageClient(%TrueClientId, 'RPGchatCallback', "Saving " @ %id.nameBase @ " (" @ %id @ "): success = " @ %r);
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name.");
- }
- }
- }
- else
- {
- %time = getTime();
- if(%time - %TrueClientId.lastSaveCharTime > 10)
- {
- %TrueClientId.lastSaveCharTime = %time;
- %r = SaveCharacter(%TrueClientId);
- messageClient(%TrueClientId, 'RPGchatCallback', "Saving self (" @ %TrueClientId @ "): success = " @ %r);
- }
- }
- return;
- case "#whatismyclientid":
- messageClient(%TrueClientId, 'RPGchatCallback', "Your clientId is " @ %TrueClientId);
- return;
- case "#whatismyuniqueid":
- messageClient(%TrueClientId, 'RPGchatCallback', "Your Global Unique ID is" SPC %TrueClientId.guid);
- case "#whatismyplayerid":
- messageClient(%TrueClientId, 'RPGchatCallback', "Your playerId is " @ %TrueClientId.player);
- return;
- case "#dropcoins":
- %cropped = GetWord(%cropped, 0);
- if(%cropped $= "all") {
- %cropped = fetchData(%TrueClientId, "COINS");
- }
- else {
- %cropped = mfloor(%cropped);
- }
- if(fetchData(%TrueClientId, "COINS") >= %cropped || %clientToServerAdminLevel >= 4)
- {
- if(%cropped > 0)
- {
- if(!(%clientToServerAdminLevel >= 4)) {
- storeData(%TrueClientId, "COINS", %cropped, "dec");
- }
- %toss = GetTypicalTossStrength(%TrueClientId);
- TossLootbag(%TrueClientId, "", %cropped, 0);
- RefreshAll(%TrueClientId);
- messageClient(%TrueClientId, 'RPGchatCallback', "You dropped " @ %cropped @ " coins.");
- %TrueClientId.player.playAudio(0, SoundMoney1);
- }
- }
- else
- {
- messageClient(%TrueClientId, 'RPGchatCallback', "You don't even have that many coins!");
- }
- return;
- case "#compass":
- if(%cropped $= "") {
- messageClient(%TrueClientId, 'RPGchatCallback', "Use #compass town or #compass dungeon. (Do not specify which, simply write town or dungeon)");
- }
- else
- {
- if(SkillCanUse(%TrueClientId, "#compass"))
- {
- %mpos = GetNearestZone(%TrueClientId, %cropped, 4);
- if(%mpos !$= false && (%cropped $= "town" || %cropped $= "dungeon")) // only allow town and dungeon queries.
- {
- %d = GetNESW(%TrueClientId.player.getPosition(), %mpos);
- UseSkill(%TrueClientId, $SkillSenseHeading, true, true);
- messageClient(%TrueClientId, 'RPGchatCallback', "The nearest " @ %cropped @ " is " @ %d @ " of here.");
- }
- else {
- messageClient(%TrueClientId, 1, "Error finding a zone!");
- }
- }
- else
- {
- messageClient(%TrueClientId, 'RPGchatCallback', "You can't use your compass because you lack the necessary skills.");
- UseSkill(%TrueClientId, $SkillSenseHeading, false, true);
- }
- }
- return;
- case "#getinfo":
- %cropped = %cropped;
- if(%cropped $= "") {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify a name.");
- }
- else
- {
- %id = getClientByName(%cropped);
- if(%id !$= -1) {
- DisplayGetInfo(%TrueClientId, %id);
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name.");
- }
- }
- return;
- case "#setinfo":
- if(%cropped $= "") {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify text.");
- }
- else
- {
- storeData(%TrueClientId, "PlayerInfo", %cropped);
- messageClient(%TrueClientId, 'RPGchatCallback', "Info set. Use #getinfo [name] to retrieve this type of information.");
- }
- return;
- case "#addinfo":
- if(%cropped $= "") {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify text.");
- }
- else
- {
- storeData(%TrueClientId, "PlayerInfo", %cropped, "strinc");
- messageClient(%TrueClientId, 'RPGchatCallback', "Info added to the end of previous info.");
- }
- return;
- case "#w" or "#whatis":
- %item = %cropped;
- if(%item $= "") {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify an item (ex: Small Rock = SmallRock).");
- }
- else
- {
- %msg = WhatIs(%item);
- if(%msg !$= "") {
- sendRPGbottomprint(%TrueClientId, mfloor(strlen(%msg) / 10)+1, Getword(%msg, 0), getwords(%msg, 1));
- }
- }
- return;
- case "#spell" or "#cast":
- if(fetchData(%TrueClientId, "SpellCastStep") $= 1) {
- messageClient(%TrueClientId, 'RPGchatCallback', "You are already casting a spell!");
- }
- else if(fetchData(%TrueClientId, "SpellCastStep") $= 2) {
- messageClient(%TrueClientId, 'RPGchatCallback', "You are still recovering from your last spell cast.");
- }
- else if(%TrueClientId.sleepMode !$= "" && %TrueClientId.sleepMode !$= false) {
- messageClient(%TrueClientId, 'RPGchatCallback', "You can not cast a spell while sleeping or meditating.");
- }
- else if(IsDead(%TrueClientId)) {
- messageClient(%TrueClientId, 'RPGchatCallback', "You can not cast a spell when dead.");
- }
- else if(inArenaRoster(%TrueClientID))
- {
- messageClient(%TrueClientId, 'RPGchatCallback', "Some force is preventing you to cast a spell in this area. Wait till you enter the arena!");
- }
- else
- {
- if(%cropped $= "") {
- messageClient(%TrueClientId, 'RPGchatCallback', "Specify a spell.");
- }
- else
- {
- if(fetchdata(%client, "Mana") >= $spelldata[%cropped, Cost])
- {
- if(SkillCanUse(%TrueclientId, getword(%cropped, 0))) {
- BeginCastSpell(%TrueClientId, %cropped);
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "You do not have the required skill for this spell. " @ $skillDesc[$spelldata[GetWord(%cropped, 0), Skill]] @ ":" @ GetWord($skillRestriction[GetWord(%cropped, 0)],1));
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "You do not have the required amount of mana for this spell");
- }
- }
- }
- return;
- case "#recall":
- if(inarena(%Trueclientid)) {
- return;
- }
- %zvel = mfloor(getWord(%TrueClientId.player.getVelocity, 2));
- messageClient(%TrueClientId, 'RPGchatCallback', "ATTEMPTING RECALL");
- if(%zvel <= -350 || %zvel >= 350)
- {
- FellOffMap(%TrueClientId);
- CheckAndBootFromArena(%TrueClientId);
- %zv = "PASS";
- }
- else {
- %zv = "FAIL";
- }
- messageClient(%TrueClientId, 'RPGchatCallback', "Z-Velocity check: " @ %zv);
- if(%zv !$= "PASS" && !fetchData(%TrueClientId, "tmprecall"))
- {
- %seconds = $recallDelay;
- storeData(%TrueClientId, "tmprecall", true);
- %client.recall = schedule(%seconds * 1000, 0, "checkrecall", %TrueClientId, %TrueClientID.player.GetPosition());
- messageClient(%TrueClientId, 'RPGchatCallback', "Stay at your current position for the next " @ %seconds @ " seconds to recall.");
- }
- return;
- case "#track":
- //%cropped = GetWord(%cropped, 0);
- if(%cropped $= "") {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify a name.");
- }
- else
- {
- if(SkillCanUse(%TrueClientId, "#track"))
- {
- %id = getClientByName(%cropped);
- if(%id !$= -1)
- {
- %clientpos = %TrueClientId.player.getPosition();
- %idpos = %id.player.getPosition();
- %dist = round(VectorDist(%clientpos, %idpos));
- if(Cap(%TrueClientId.PlayerSkill[$Skill::SenseHeading] * 7.5, 100, "inf") >= %dist)
- {
- %d = GetNESW(%clientpos, %idpos);
- messageClient(%TrueClientId, 'RPGchatCallback', %cropped @ " is " @ %d @ " of here, " @ %dist @ " meters away.");
- UseSkill(%TrueClientId, $Skill::SenseHeading, true, true);
- if(%dist <= 10) {
- Client::unhide(%id); //counter counter!
- }
- }
- else
- {
- messageClient(%TrueClientId, 'RPGchatCallback', %cropped @ " is too far from you to track with your current sense heading skills.");
- UseSkill(%TrueClientId, $Skill::SenseHeading, false, true);
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name.");
- }
- }
- else
- {
- messageClient(%TrueClientId, 'RPGchatCallback', "You can't track because you lack the necessary skills.");
- UseSkill(%TrueClientId, $Skill::SenseHeading, false, true);
- }
- }
- return;
- case "#trackpack":
- return;
- %cropped = GetWord(%cropped, 0);
- if(%cropped $= "") {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify a name.");
- }
- else
- {
- if(SkillCanUse(%TrueClientId, "#trackpack"))
- {
- %id = getClientByName(%cropped);
- if(%id !$= -1)
- {
- %cropped = %id.nameBase; //properly capitalize name
- %closest = 5000000;
- %closestId = -1;
- %clientpos = %TrueClientId.player.getPosition();
- %list = fetchData(%id, "lootbaglist");
- for(%i = strstr(%list, ","); strstr(%list, ",") !$= -1; %list = getsubstr(%list, %i+1, 99999))
- {
- %id = getsubstr(%list, 0, %i);
- %idpos = %id.player.getPosition();
- %dist = round(VectorDist(%clientpos, %idpos));
- if(%dist < %closest)
- {
- %closest = %dist;
- %closestId = %id;
- }
- }
- if(%closestId !$= -1)
- {
- %idpos = %closestId.player.getPosition();
- if(Cap(%TrueClientId.PlayerSkill[$SkillSenseHeading] * 15, 100, "inf") >= %closest)
- {
- %d = GetNESW(%clientpos, %idpos);
- messageClient(%TrueClientId, 'RPGchatCallback', %cropped @ "'s nearest backpack is " @ %d @ " of here, " @ %closest @ " meters away.");
- UseSkill(%TrueClientId, $SkillSenseHeading, true, true);
- }
- else
- {
- messageClient(%TrueClientId, 'RPGchatCallback', %cropped @ "'s nearest backpack is too far from you to track with your current sense heading skills.");
- UseSkill(%TrueClientId, $SkillSenseHeading, false, true);
- }
- }
- else
- {
- messageClient(%TrueClientId, 'RPGchatCallback', %cropped @ " doesn't have any dropped backpacks.");
- UseSkill(%TrueClientId, $SkillSenseHeading, false, true);
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name.");
- }
- }
- else
- {
- messageClient(%TrueClientId, 'RPGchatCallback', "You can't track a backpack because you lack the necessary skills.");
- UseSkill(%TrueClientId, $SkillSenseHeading, false, true);
- }
- }
- return;
- case "#sharepack":
- return;
- %time = getTime();
- if(%time - %TrueClientId.lastSharePackTime > 5)
- {
- %TrueClientId.lastSharePackTime = %time;
- %c1 = GetWord(%cropped, 0);
- %c2 = GetWord(%cropped, 1);
- if(%c1 !$= -1 && %c2 !$= -1)
- {
- %id = getClientByName(%c1);
- if(%id !$= -1 && %id.nameBase !$= %senderName)
- {
- %c1 = %id.nameBase; //properly capitalize name
- if(mfloor(%c2) !$= 0 || %c2 $= "*")
- {
- %flag = "";
- %cnt = 0;
- %list = fetchData(%TrueClientId, "lootbaglist");
- for(%i = strstr(%list, ","); strstr(%list, ",") !$= -1; %list = getsubstr(%list, %i+1, 99999))
- {
- %cnt++;
- %bid = getsubstr(%list, 0, %i);
- if(%cnt $= %c2 || %c2 $= "*")
- {
- %flag++;
- %nl = GetWord($loot[%bid], 1);
- if(%nl !$= "*")
- {
- $loot[%bid] = strreplace($loot[%bid], %nl, AddToCommaList(%nl, %c1));
- messageClient(%TrueClientId, 'RPGchatCallback', "Adding " @ %c1 @ " to backpack #" @ %cnt @ " (" @ %bid @ ")'s share list.");
- messageClient(%id, 'RPGchatCallback', %TCsenderName @ " is sharing his/her backpack #" @ %cnt @ " with you.");
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Backpack #" @ %cnt @ " is already publicly available.");
- }
- }
- }
- if(%flag $= "") {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid backpack number.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify a backpack number (1, 2, 3, etc, or * for all)");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name or same player name.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify player name & data.");
- }
- }
- return;
- case "#unsharepack":
- return;
- %c1 = GetWord(%cropped, 0);
- %c2 = GetWord(%cropped, 1);
- if(%c1 !$= -1 && %c2 !$= -1)
- {
- %id = getClientByName(%c1);
- if(%id !$= -1 && %id.nameBase !$= %senderName)
- {
- %c1 = %id.nameBase; //properly capitalize name
- if(mfloor(%c2) !$= 0 || %c2 $= "*")
- {
- %flag = "";
- %cnt = 0;
- %list = fetchData(%TrueClientId, "lootbaglist");
- for(%i = strstr(%list, ","); strstr(%list, ",") !$= -1; %list = getsubstr(%list, %i+1, 99999))
- {
- %cnt++;
- %bid = getsubstr(%list, 0, %i);
- if(%cnt $= %c2 || %c2 $= "*")
- {
- %flag++;
- %nl = GetWord($loot[%bid], 1);
- if(%nl !$= "*")
- {
- $loot[%bid] = strreplace($loot[%bid], %nl, RemoveFromCommaList(%nl, %c1));
- messageClient(%TrueClientId, 'RPGchatCallback', "Removing " @ %c1 @ " from backpack #" @ %cnt @ " (" @ %bid @ ")'s share list.");
- messageClient(%id, 'RPGchatCallback', %TCsenderName @ " has removed you from his/her backpack #" @ %cnt @ " share list.");
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Backpack #" @ %cnt @ " is already publicly available. Its share list can not be changed.");
- }
- }
- }
- if(%flag $= "") {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid backpack number.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify a backpack number (1, 2, 3, etc, or * for all)");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name or same player name.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify player name & data.");
- }
- return;
- case "#packsummary":
- return;
- if(%clientToServerAdminLevel >= 1)
- {
- if(%cropped !$= "")
- {
- %id = getClientByName(%cropped);
- %cropped = %id.nameBase; //properly capitalize name
- %cnt = mfloor(CountObjInCommaList(fetchData(%id, "lootbaglist")));
- messageClient(%TrueClientId, 'RPGchatCallback', %cropped @ " has " @ %cnt @ " dropped backpacks.");
- }
- else
- {
- %list = GetPlayerIdList();
- for(%i = 0; (%id = GetWord(%list, %i)) !$= ""; %i++)
- {
- %cnt = CountObjInCommaList(fetchData(%id, "lootbaglist"));
- if(%cnt > 0) {
- messageClient(%TrueClientId, 'RPGchatCallback', %id.nameBase @ " has " @ %cnt @ " dropped backpacks.");
- }
- }
- }
- }
- else if(%cropped $= "")
- {
- %cnt = mfloor(CountObjInCommaList(fetchData(%TrueClientId, "lootbaglist")));
- messageClient(%TrueClientId, 'RPGchatCallback', "You have a total of " @ %cnt @ " currently dropped backpacks.");
- }
- return;
- case "#mypassword":
- return; //no password for characters!
- %c1 = GetWord(%cropped, 0);
- if(%c1 !$= -1)
- {
- storeData(%TrueClientId, "password", %c1);
- messageClient(%TrueClientId, 'RPGchatCallback', "Changed personal password to " @ fetchData(%TrueClientId, "password") @ ".");
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify a one-word password.");
- }
- return;
- case "#sleep":
- //return; //BROKEN will be fixed later
- if(fetchData(%TrueClientId, "InSleepZone") == true && %TrueClientId.sleepMode $= "" && !IsDead(%TrueClientId)) {
- %flag = true;
- }
- echo(fetchData(%trueclientid, "InSleepZone"));
- if(%flag)
- {
- %TrueClientId.sleepMode = 1;
- %TrueClientId.camera.setTransform(%transform);
- %TrueClientId.camera.client = %clientid;
- %TrueClientId.camera.setOrbitMode(%TrueClientId.player, %TrueClientId.player.getTransform(), 0.5, 4.5, 4.5);
- %TrueClientId.setControlObject(%TrueClientId.camera);
- refreshHPREGEN(%TrueClientId);
- refreshMANAREGEN(%TrueClientId);
- messageClient(%TrueClientId, 'RPGchatCallback', "You fall asleep... Use #wake to wake up.");
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "You can't seem to fall asleep here.");
- }
- return;
- case "#meditate":
- if(%TrueClientId.sleepMode $= "" && !IsDead(%TrueClientId) && $possessedBy[%TrueClientId].possessId !$= %TrueClientId)
- {
- %TrueClientId.sleepMode = 2;
- %transform = %TrueClientId.player.getTransform();
- //note, AI's don't have a camera...
- if(isObject(%TrueClientId.camera))
- {
- %TrueClientId.camera.setTransform(%transform);
- %TrueClientId.camera.client = %clientid;
- %TrueClientId.camera.setOrbitMode(%TrueClientId.player, %TrueClientId.player.getTransform(), 0.5, 4.5, 4.5);
- %TrueClientId.setControlObject(%TrueClientId.camera);
- }
- //Client::setControlObject(%TrueClientId, Client::getObserverCamera(%TrueClientId));
- //Observer::setOrbitObject(%TrueClientId, Client::getOwnedObject(%TrueClientId), 30, 30, 30);
- refreshHPREGEN(%TrueClientId);
- refreshMANAREGEN(%TrueClientId);
- messageClient(%TrueClientId, 'RPGchatCallback', "You begin to meditate. Use #wake to stop meditating.");
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "You can't seem to meditate.");
- }
- return;
- case "#wake":
- if(%TrueClientId.sleepMode !$= "")
- {
- %TrueClientId.sleepMode = "";
- %TrueClientId.setControlObject(%TrueClientId.player);
- refreshHPREGEN(%TrueClientId);
- refreshMANAREGEN(%TrueClientId);
- messageClient(%TrueClientId, 'RPGchatCallback', "You awaken.");
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "You are not sleeping or meditating.");
- }
- return;
- case "#roll":
- %c1 = GetWord(%cropped, 0);
- if(%c1 !$= -1) {
- messageClient(%TrueClientId, 'RPGchatCallback', %c1 @ ": " @ GetRpgRoll(%c1));
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify a roll (example: 1d6)");
- }
- return;
- case "#hide":
- if(SkillCanUse(%TrueClientId, "#hide"))
- {
- if(!fetchData(%TrueClientId, "invisible") && !fetchData(%TrueClientId, "blockHide") && %Trueclientid.lasthide + 5000 < getSimTime())
- {
- %closeEnoughToWall = Cap(%TrueClientId.PlayerSkill[$SkillHiding] / 125, 3.5, 8);
- %pos = %TrueClientId.player.getPosition();
- %closest = 10000;
- for(%i = 0; %i <= 6.283; %i+= 0.52)
- {
- getLOSinfo(%TrueClientId, 25, "", "0 0 " @ %i);
- %dist = VectorDist(%pos, $los::position);
- if(%dist < %closest && $los::position !$= "0 0 0" && $los::position !$= "") {
- %closest = %dist;
- }
- }
- if(%closest <= %closeEnoughToWall)
- {
- messageClient(%TrueClientId, 'RPGchatCallback', "You are successful at Hide In Shadows.");
- Client::hide(%TrueClientID);
- //GameBase::startFadeOut(%TrueClientId);
- //storeData(%TrueClientId, "invisible", true);
- %grace = Cap(%TrueClientId.PlayerSkill[$SkillHiding] / 20, 5, 100);
- WalkSlowInvisLoop(%TrueClientId, 5, %grace);
- %Trueclientid.lasthide = getSimTime();
- UseSkill(%TrueClientId, $Skill::Hiding, true, true);
- }
- else
- {
- messageClient(%TrueClientId, 'RPGchatCallback', "You were unsuccessful at Hide In Shadows.");
- UseSkill(%TrueClientId, $Skill::Hiding, false, true);
- }
- }
- }
- else
- {
- messageClient(%TrueClientId, 'RPGchatCallback', "You can't hide because you lack the necessary skills.");
- //UseSkill(%TrueClientId, $Skill::Hiding, false, true);
- }
- return;
- case "#bash":
- if(SkillCanUse(%TrueClientId, "#bash"))
- {
- if(!(fetchdata(%trueClientId, "NextHitBash") || fetchdata(%trueClientId, "blockBash")))
- {
- messageClient(%TrueClientId, 'RPGchatCallback', "You are ready to bash!");
- storeData(%TrueClientId, "NextHitBash", true);
- storeData(%TrueClientId, "blockBash", true);
- }
- else if(fetchdata(%TrueClientId, "NextHitBash")) {
- messageClient(%TrueClientId, 'RPGchatCallback', "You are already ready to bash");
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "You are too tired to bash again, wait a bit");
- }
- }
- else
- {
- messageClient(%TrueClientId, 'RPGchatCallback', "You can't bash because you lack the necessary skills.");
- //UseSkill(%TrueClientId, $SkillBashing, false, true);
- }
- return;
- case "#disrupt":
- if(SkillCanUse(%TrueClientId, "#disrupt"))
- {
- if(!(fetchdata(%TrueClientId, "NextHitDisrupt") || fetchdata(%TrueClientId, "BlockDisrupt")))
- {
- storedata(%TrueClientId, "NextHitDisrupt", true);
- storedata(%TrueClientId, "blockdisrupt", true);
- messageClient(%TrueClientID, 'RPGchatCallback', "You are ready to disrupt!");
- }
- else if(fetchdata(%TrueClientId, "NextHitDisrupt")) {
- messageClient(%TrueClientId, 'RPGchatCallback', "You are already ready to disrupt.");
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "You are too tired to Disrupt again, wait a bit");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "You can't Disrupt because you lack the necessary skills.");
- }
- case "#focus":
- if(SkillCanUse(%TrueClientId, "#focus"))
- {
- if(!(fetchdata(%trueClientId, "NextHitFocus") || fetchdata(%trueClientId, "blockFocus")))
- {
- messageClient(%TrueClientId, 'RPGchatCallback', "You focus your energy!");
- storeData(%TrueClientId, "NextHitFocus", true);
- storeData(%TrueClientId, "blockFocus", true);
- }
- else if(fetchdata(%TrueClientId, "NextHitFocus")) {
- messageClient(%TrueClientId, 'RPGchatCallback', "You are already focused.");
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "You are too strained to focus, wait a bit.");
- }
- }
- else
- {
- messageClient(%TrueClientId, 'RPGchatCallback', "You can't focus because you lack the necessary skills.");
- //UseSkill(%TrueClientId, $SkillBashing, false, true);
- }
- return;
- case "#cleave":
- if(SkillCanUse(%TrueClientId, "#cleave"))
- {
- if(!(fetchdata(%trueClientId, "NextHitCleave") || fetchdata(%trueClientId, "blockCleave")))
- {
- messageClient(%TrueClientId, 'RPGchatCallback', "You are ready to Cleave!");
- storeData(%TrueClientId, "NextHitCleave", true);
- storeData(%TrueClientId, "blockCleave", true);
- }
- else if(fetchdata(%TrueClientId, "NextHitCleave")) {
- messageClient(%TrueClientId, 'RPGchatCallback', "You are already ready to cleave.");
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "You are too tired to cleave again, wait a bit");
- }
- }
- else
- {
- messageClient(%TrueClientId, 'RPGchatCallback', "You can't cleave because you lack the necessary skills.");
- //UseSkill(%TrueClientId, $SkillBashing, false, true);
- }
- return;
- case "#shock":
- if(SkillCanUse(%TrueClientId, "#shock"))
- {
- }
- else
- {
- messageClient(%TrueClientID, 'RPGchatCallback', "You can't shock because you lack the necessary skills.");
- }
- case "#stun":
- if(SkillCanUse(%TrueClientId, "#stun"))
- {
- if(!(fetchdata(%trueClientId, "NextHitStun") || fetchdata(%trueClientId, "blockStun")))
- {
- messageClient(%TrueClientId, 'RPGchatCallback', "You are ready to Stun!");
- storeData(%TrueClientId, "NextHitStun", true);
- storeData(%TrueClientId, "blockStun", true);
- }
- else if(fetchdata(%TrueClientId, "NextHitStun")) {
- messageClient(%TrueClientId, 'RPGchatCallback', "You are already ready to Stun.");
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "You are too tired to Stun again, wait a bit");
- }
- }
- else
- {
- messageClient(%TrueClientID, 'RPGchatCallback', "You can't stun because you lack the necessary skills.");
- }
- case "#targetleg":
- if(SkillCanUse(%TrueClientId, "#targetleg"))
- {
- if(!(fetchdata(%trueClientId, "NextHitLeg") || fetchdata(%trueClientId, "blockLeg")))
- {
- messageClient(%TrueClientId, 'RPGchatCallback', "You are ready to Target Leg!");
- storeData(%TrueClientId, "NextHitLeg", true);
- storeData(%TrueClientId, "blockLeg", true);
- }
- else if(fetchdata(%TrueClientId, "NextHitLeg")) {
- messageClient(%TrueClientId, 'RPGchatCallback', "You are already ready to Target Leg.");
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "You are too tired to Target Leg again, wait a bit");
- }
- }
- else
- {
- MessageClient(%trueClientId, 'RPGchatCallBack', "You can't target leg because you lack the necessary skills.");
- }
- case "#encumber":
- if(SkillCanUse(%TrueClientId, "#encumber"))
- {
- if(!(fetchdata(%trueClientId, "NextHitencumber") || fetchdata(%trueClientId, "blockEncumber")))
- {
- messageClient(%TrueClientId, 'RPGchatCallback', "You are ready to Encumber!");
- storeData(%TrueClientId, "NextHitencumber", true);
- storeData(%TrueClientId, "blockencumber", true);
- }
- else if(fetchdata(%TrueClientId, "NextHitEncumber")) {
- messageClient(%TrueClientId, 'RPGchatCallback', "You are already ready to Encumber.");
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "You are too tired to Encumber again, wait a bit");
- }
- }
- else
- {
- MessageClient(%trueClientId, 'RPGchatCallBack', "You can't encumber because you lack the necessary skills.");
- }
- case "#backstab":
- if(SkillCanUse(%TrueClientId, "#backstab"))
- {
- if(!(fetchdata(%trueClientId, "NextHitBackStab") || fetchdata(%trueClientId, "BlockBackStab")))
- {
- messageClient(%TrueClientId, 'RPGchatCallback', "You are ready to backstab!");
- storeData(%TrueClientId, "NextHitBackStab", true);
- storeData(%TrueClientId, "blockBackStab", true);
- }
- else if(fetchdata(%TrueClientId, "NextHitBackStab")) {
- messageClient(%TrueClientId, 'RPGchatCallback', "You are already ready to backstab.");
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "You are too tired to backstab again, wait a bit");
- }
- }
- else
- {
- messageClient(%TrueClientId, 'RPGchatCallback', "You can't backstab because you lack the necessary skills.");
- //UseSkill(%TrueClientId, $SkillBashing, false, true);
- }
- return;
- case "#surge":
- if(SkillCanUse(%TrueClientId, "#surge"))
- {
- if(!(fetchdata(%TrueClientId, "blockSurge")))
- {
- //storedata(%TrueClientId, "Surge", true);
- AddBonusState(%TrueClientId, "12 10", 5, "Surge");
- storedata(%TrueClientId, "BlockSurge", true);
- weightcall(%TrueClientId, false);
- debugBonusState(%TrueClientId);
- schedule(5000, %client, "endsurge", %client);
- messageClient(%TrueClientid, 'RPGchatCallback', "You begin to surge!");
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "You are too tired to boost your speed.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "You can't surge because you lack the necessary skills.");
- }
- case "#berserk":
- if(SkillCanuse(%trueclientid, "#berserk"))
- {
- if(!(fetchdata(%TrueClientId, "blockberserk") || fetchdata(%TrueClientId, "Surge")))
- {
- storedata(%TrueClientId, "Surge", true);
- weightcall(%TrueClientId, false);
- storedata(%TrueClientId, "BlockBerserk", true);
- schedule(5000, %client, "endberserk", %client);
- messageClient(%TrueClientId, 'RPGchatCallBack', "You go Berserk!");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "You can't berserk because you lack the necessary skills.");
- }
- case "#ignite":
- if(SkillCanUse(%TrueClientId, "#ignite"))
- {
- if(!(fetchdata(%trueClientId, "NextHitignite") || fetchdata(%trueClientId, "Blockignite")))
- {
- messageClient(%TrueClientId, 'RPGchatCallback', "You light your projectile!");
- storeData(%TrueClientId, "NextHitignite", true);
- storeData(%TrueClientId, "blockignite", true);
- }
- else if(fetchdata(%TrueClientId, "NextHitignite")) {
- messageClient(%TrueClientId, 'RPGchatCallback', "You are already ready to ignite.");
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "You are too tired to ignite again, wait a bit");
- }
- }
- else
- {
- messageClient(%TrueClientId, 'RPGchatCallback', "You can't ignite arrows because you lack the necessary skills.");
- //UseSkill(%TrueClientId, $SkillBashing, false, true);
- }
- return;
- case "#shove":
- %time = getTime();
- if(%time - %TrueClientId.lastShoveTime > 1.5)
- {
- %TrueClientId.lastShoveTime = %time;
- if(SkillCanUse(%TrueClientId, "#shove"))
- {
- %player = %trueClientId.player;
- if(getLOSinfo(%TrueClientId, 5))
- {
- %pl = $los::object;
- %id = %pl.client;
- if(%TrueClientId.adminLevel > %id.adminLevel || %id.adminLevel < 1 && %id != 0)
- {
- %b = %TrueClientId.player.rotation;
- %c1 = Cap(20 + fetchData(%TrueClientId, "LVL"), 0, 250);
- %c2 = %c1 / 4;
- %muzzlevec = %client.player.getMuzzleVector(1);
- %vel = %id.player.getVelocity();
- %mom = GetWord(%muzzlevec, 0)*20+GetWord(%vel, 0) SPC GetWord(%muzzlevec, 1)*20+GetWord(%vel, 1) SPC GetWord(%muzzlevec, 2)*20+GetWord(%vel, 2);
- %id.player.setVelocity(%mom);
- }
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "You can't shove because you lack the necessary skills.");
- }
- }
- return;
- case "#defaulttalk":
- if(%cropped !$= "")
- {
- storeData(%TrueClientId, "defaultTalk", %cropped);
- messageClient(%TrueClientId, 'RPGchatCallback', "Changed Default Talk to " @ fetchData(%TrueClientId, "defaultTalk") @ ".");
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify what will be added to the beginning of each of your messages.");
- }
- return;
- case "#zonelist":
- if(SkillCanUse(%TrueClientId, "#zonelist"))
- {
- %c1 = GetWord(%cropped, 0);
- if(%c1 !$= -1)
- {
- if(stricmp(%c1, "all") $= 0) {
- %t = 1;
- }
- else if(stricmp(%c1, "players") $= 0) {
- %t = 2;
- }
- else if(stricmp(%c1, "enemies") $= 0) {
- %t = 3;
- }
- %list = Zone::getPlayerList(fetchData(%TrueClientId, "zone"), %t);
- if(%list !$= "")
- {
- for(%i = 0; (%id = GetWord(%list, %i)) !$= ""; %i++) {
- messageClient(%TrueClientId, 'RPGchatCallback', %id.nameBase);
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "[none]");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify 'players', 'enemies', or 'all'");
- }
- }
- else
- {
- messageClient(%TrueClientId, 'RPGchatCallback', "You can't zonelist because you lack the necessary skills.");
- UseSkill(%TrueClientId, $SkillSenseHeading, false, true);
- }
- return;
- case "#pickpocket":
- %time = getTime();//ok pickpocket will only steal small items, user really wont have a choice to what they steal either unlike tribes rpg.
- if(%time - %TrueClientId.lastStealTime > $stealDelay)
- {
- %TrueClientId.lastStealTime = %time;
- if((%reason = AllowedToSteal(%TrueClientId)) $= "true")
- {
- if(SkillCanUse(%TrueClientId, "#pickpocket"))
- {
- if(getLOSinfo(%TrueClientId, 1))
- {
- %id = $los::object.client;
- %pos = $los::position;
- if($los::object.getClassName() $= "Player")
- {
- %damloc = %id.player.getDamageLocation(%pos);
- %tciskill = %TrueClientID.PlayerSkill[$SkillStealing] * 4/5;
- %idskill = %id.playerSkill[$skillStealing];
- //echo(%damloc);
- //%TrueClientId.stealType = 1;
- //SetupInvSteal(%TrueClientId, %id);
- //attempt to steal
- %inv = fetchdata(%id, "inventory");
- %num = getwordcount(%inv);
- //randomly select an item
- %itemid = GetWord(%inv, getrandom(0,%num-1));
- if(%itemid)
- {
- %item = getItem(%itemid);
- if($itemtype[%item] $= "armor" || $itemType[%item] $= "weapon")
- {
- //error cannot steal
- %fail = true;
- }
- else
- {
- %backfront = getword(%damloc, 1);
- if(%backfront $= "back_right" || %backfront $= "back" || %backfront $= "back_left" || %backfront $= "middle_back") {
- %multi = 1;
- }
- else {
- %multi = 0.5; //odds of stealing 1/2
- }
- if(!id.isAIControlled()) {
- %oddcalc = %num - 10;
- }
- else {
- %oddcalc = %num;
- }
- if(%oddcalc < 0) {
- %oddcalc = 0;
- }
- %ooddcalc = %oddcalc * %tciskill * %multi;
- %doddcalc = 35 * %idskill + 10;
- %success = getRandom(-%doddcalc, %ooddcalc);
- if(%success > 0) {
- %fail = false;
- }
- else {
- %fail = true;
- }
- }
- echo("PICKPOCKET:" SPC -%doddcalc SPC %ooddcalc SPC %success SPC %tciskill SPC %idskill);
- if(!%fail)
- {
- RemoveFromInventory(%id, %itemid);
- AddToInventory(%TrueClientId, %itemid);
- messageClient(%TrueClientId, 'RPGchatCallback', "You sucessfully stole a" SPC GetFullItemName(%itemid));
- MessageClient(%TrueClientID, 'RPGchatcallback', "DEBUG, ODDS TO STEAL:" SPC -%doddcalc SPC " to " SPC %ooddcalc SPC "NUMBER:" SPC %success);
- }
- else
- {
- messageClient(%TrueClientId, 'RPGchatCallback', "You failed to steal from" SPC %id.rpgname @ "!");
- MessageClient(%TrueClientID, 'RPGchatcallback', "DEBUG, ODDS TO STEAL:" SPC -%doddcalc SPC " to " SPC %ooddcalc SPC "NUMBER:" SPC %success);
- messageClient(%id, 'RPGchatCallback', %TrueClientid.rpgname SPC "failed to steal from you!");
- //failed to steal, notify victim? lashback?
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Your target has no items on him");
- }
- }
- }
- }
- else
- {
- messageClient(%TrueClientId, 'RPGchatCallback', "You can't pickpocket because you lack the necessary skills.");
- UseSkill(%TrueClientId, $SkillStealing, false, true);
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', %reason);
- }
- }
- return;
- case "#mug":
- //can steal ANYTHING unequiped at a higher success rate, however player must be in your target list to attempt!
- %time = getTime();
- if(%time - %TrueClientId.lastStealTime > $stealDelay)
- {
- %TrueClientId.lastStealTime = %time;
- if(skillcanuse(%TrueClientId, "#mug"))
- {
- if(fetchdata(%TrueClientId, "NextHitMug"))
- {
- messageClient(%TrueClientId, 'RPGchatCallback', "You are already ready to mug");
- }
- else if(fetchdata(%TrueClientId, "blockHitMug"))
- {
- messageClient(%TrueClientId, 'RPGchatCallback', "You are not ready to mug");
- }
- else
- {
- storedata(%TrueClientId, "blockhitmug", true);
- storedata(%TrueClientId, "NextHitMug", true);
- messageClient(%TrueClientId, 'RPGchatCallback', "You are ready to mug.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "You do not have enough skill to mug");
- }
- }
- return;
- case "#createpack":
- return;
- if(fetchData(%TrueClientId, "TempPack") !$= "")
- {
- if(HasThisStuff(%TrueClientId, fetchData(%TrueClientId, "TempPack")))
- {
- TakeThisStuff(%TrueClientId, fetchData(%TrueClientId, "TempPack"));
- %namelist = %TCsenderName @ ",";
- TossLootbag(%TrueClientId, fetchData(%TrueClientId, "TempPack"), 5, %namelist, 0);
- RefreshAll(%TrueClientId);
- remotePlayMode(%TrueClientId);
- }
- }
- return;
- case "#camp":
- return;
- if(Player::getItemCount(%TrueClientId, Tent))
- {
- %camp = nameToId("MissionCleanup/Camp" @ %TrueClientId);
- if(%camp $= -1)
- {
- if(fetchData(%TrueClientId, "zone") $= "")
- {
- messageClient(%TrueClientId, 'RPGchatCallback', "Setting up camp...");
- %pos = %TrueClientId.player.getPosition();
- Player::decItemCount(%TrueClientId, Tent);
- RefreshAll(%TrueClientId);
- %group = newObject("Camp" @ %TrueClientId, SimGroup);
- addToSet("MissionCleanup", %group);
- schedule(2000, "DoCampSetup(" @ %TrueClientId @ ", 1, \"" @ %pos @ "\");");
- schedule(10000, "DoCampSetup(" @ %TrueClientId @ ", 2, \"" @ %pos @ "\");");
- schedule(17000, "DoCampSetup(" @ %TrueClientId @ ", 3, \"" @ %pos @ "\");");
- schedule(20000, "DoCampSetup(" @ %TrueClientId @ ", 4, \"" @ %pos @ "\");");
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "You can't set up a camp here.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "You already have a camp setup somewhere.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "You aren't carrying a tent.");
- }
- return;
- case "#uncamp":
- return;
- %camp = nameToId("MissionCleanup/Camp" @ %TrueClientId);
- if(%camp !$= -1)
- {
- %obj = nameToId("MissionCleanup/Camp" @ %TrueClientId @ "/woodfire");
- if(VectorDist(%TrueClientId.player.getPosition(), %obj.getPosition()) <= 10)
- {
- DoCampSetup(%TrueClientId, 5);
- messageClient(%TrueClientId, 'RPGchatCallback', "Camp has been packed up.");
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "You are too far from your camp.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "You don't have a camp.");
- }
- return;
- case "#advcompass":
- if(%cropped $= "") {
- messageClient(%TrueClientId, 'RPGchatCallback', "Use #advcompass zone keyword");
- }
- else
- {
- if(SkillCanUse(%TrueClientId, "#advcompass"))
- {
- %obj = GetZoneByKeywords(%TrueClientId, %cropped, 3);
- if(%obj !$= false)
- {
- %mpos = Zone::getMarker(%obj);
- %d = GetNESW(%TrueClientId.player.getPosition(), %mpos);
- UseSkill(%TrueClientId, $SkillSenseHeading, true, true);
- messageClient(%TrueClientId, 'RPGchatCallback', Zone::getDesc(%obj) @ " is " @ %d @ " of here.");
- }
- else {
- messageClient(%TrueClientId, 1, "Couldn't fine a zone to match those keywords.");
- }
- }
- else
- {
- messageClient(%TrueClientId, 'RPGchatCallback', "You can't use #advcompass because you lack the necessary skills.");
- UseSkill(%TrueClientId, $SkillSenseHeading, false, true);
- }
- }
- return;
- case "#smith":
- %ret = getLOSInfo(%TrueClientId, 10);
- %obj = GetWord(%ret, 0);
- if(%obj.special !$= "Smith")
- {
- MessageClient(%TrueClientId, 'RPGchatCallback', "You need to be looking at an anvil to smith");
- return false;
- }
- if(!%TrueClientId.IsSmithing)
- {
- %TrueClientId.IsSmithing = true;
- %command = GetWord(%cropped, 0);
- %nitem = GetWord(%cropped, 1);
- %from = GetWord(%cropped, 2);
- Game.smith(%TrueClientID, %command, %nitem, %from);
- %TrueClientId.IsSmithing = false;
- }
- case "#myexp":
- messageClient(%TrueClientId, 'RPGchatCallback', "Your EXP:" SPC fetchdata(%TrueClientId, "EXP"));
- case "#mylevel":
- messageClient(%TrueClientId, 'RPGchatCallback', "Your Level:" SPC fetchdata(%TrueClientId, "LVL"));
- case "#quickbind":
- if(%cropped !$= "")
- {
- %number = GetWord(%cropped, 0);
- %rest = GetWords(%cropped, 1, 99);
- %number = mfloor(%number);
- if(%number > 0 && %number <= 6)
- {
- %number--;
- storedata(%client, "QuickBind" @ %number, %rest);
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallBack', "Incorrect usage, syntax: #QuickBind [number 1-6] [#command...] example #quickbind 1 #cast thorn");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallBack', "Incorrect usage, syntax: #QuickBind [number 1-6] [#command...] example #quickbind 1 #cast thorn");
- }
- case "#resetplayer":
- %race = fetchdata(%TrueClientID, "RACE");
- %race = "MaleHuman";//until femalehuman is put in
- %apm = "Armor";
- %dbname = %race @ %apm @ %TrueClientID.cweight;
- %e = %TrueClientID.player.getEnergyLevel();
- %d = %TrueClientID.player.getDamageLevel();
- %TrueClientID.player.setDataBlock(MaleHuman);
- %TrueClientID.player.setdatablock(%dbname);
- %TrueClientID.player.setEnergyLevel(%e);
- %TrueClientID.player.setDamageLevel(%d);
- MessageClient(%TrueClientId, 'RPGchatCallBack', "Player Reset");
- case "#mount":
- //getlosinfo
- %obj = getword(getlosinfo(%TrueClientId, 10), 0);
- %dataBlock = %obj.getDataBlock();
- %className = %dataBlock.className;
- %player = %TrueClientID.player;
- if(%forceVehicleNode !$= "" || (%className $= WheeledVehicleData || %className $= FlyingVehicleData || %className $= HoverVehicleData) &&
- %player.mountVehicle && %player.getState() $= "Move" && %obj.getDamageState() !$= "Destroyed")
- {
- if(%TrueClientID.isAIControlled())
- {
- %transform = %col.getTransform();
- //either the AI is *required* to pilot, or they'll pick the first available passenger seat
- if(%client.pilotVehicle)
- {
- //make sure the bot is in light armor
- if(%player.getArmorSize() $= "Light")
- {
- //make sure the pilot seat is empty
- if(!%obj.getMountNodeObject(0)) {
- %node = 0;
- }
- }
- }
- else {
- %node = findAIEmptySeat(%obj, %player);
- }
- }
- else {
- %node = findEmptySeat(%obj, %player);
- }
- //now mount the player in the vehicle
- if(%node >= 0)
- {
- %obj.mountObject(%player,%node);
- %obj.playAudio(0, MountVehicleSound);
- %player.mVehicle = %obj;
- //%player.mountnode = %node;
- // if player is repairing something, stop it
- if(%player.repairing) {
- stopRepairing(%player);
- }
- //this will setup the huds as well...
- // %dataBlock.playerMounted(%obj,%player, %node);
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "You cannot mount this object");
- }
- }
- //another break...
- //============================
- //Guild commands==============
- //============================
- switch$(%w1)
- {
- case "#claim":
- %guildid = IsInWhatGuild(%TrueClientId);
- %guild = GuildGroup.getObject(%guildid);
- if(%guildid == -1 || %guild.getGUIDRank(%TrueClientId.guid) < 1)
- {
- MessageClient(%TrueClientId, 'MessageClaimFail', "You have to be in a guild to claim land.");
- return;
- }
- %zone = fetchdata(%TrueClientId, "zone");
- if(%zone.type $= "GuildZone")
- {
- if(%zone.owned)
- {
- if(%zone.owner == %guild)
- {
- MessageClient(%TrueClientId, 'MessageClaimFail', "Your guild already owns this zone.");
- }
- else
- {
- MessageClient(%TrueClientId, 'MessageClaimFail', "You cannot claim this zone because it is owned by a guild, in order to obtain it you must #challenge the current owner.");
- }
- }
- else
- {
- %list = Zone::getPlayerList(fetchData(%TrueClientId, "zone"), 2);
- %flag = true;
- for(%i = 0; GetWord(%list, %i); %i++)
- {
- %id = GetWord(%list, %i);
- if(%id != %TrueClientId)
- {
- %gid = IsInWhatGuild(%id);
- if(%gid != -1 && %gid != %guildid)
- {
- %flag = false;
- break;
- }
- }
- }
- if(%flag)
- {
- if(GetWordCount(%guild.getzonelist()) < $guildownerzonelimit)
- {
- //check to see if there are any other guild members in this zone.
- MessageClient(%TrueClientId, 'MessageClaim', "You claim this zone in the name of" SPC %guild.getName() @ "!");
- %guild.addZone(%zone);
- %zone.owned = true;
- %zone.owner = %guild;
- SaveServerGuilds();
- }
- else {
- MessageClient(%TrueClientId, 'MessageClaim', "Your guild already owns too many zones");
- }
- }
- else {
- MessageClient(%TrueClientId, 'MessageClaimFail', "You cannot claim this zone until you are the only guild in this zone.");
- }
- }
- }
- else {
- MessageClient(%TrueClientId, 'MessageClaimFail', "You must be in a guild zone to claim it.");
- }
- case "#challenge":
- %guildid = IsInWhatGuild(%Trueclientid);
- %guild = GuildGroup.getObject(%guildid);
- %zone = fetchdata(%TrueClientId, "Zone");
- if(%guildid == -1 || %guild.getGUIDRank(%TrueClientId.guid) <= 1)
- {
- if(%guildid == -1) {
- MessageClient(%TrueClientId, 'RPGchatcallback', "Error, you must be in a guild to use this command");
- }
- else {
- MessageClient(%TrueClientId, 'RPGchatCallback', "You are not of sufficent rank to start a challenge with another guild");
- }
- return;
- }
- if(%zone.type $= "GuildZone")
- {
- if(%zone.owned)
- {
- if(%zone.owner == %guild)
- {
- MessageClient(%TrueClientId, 'RPGchatcallback', "Error, your guild already owns this zone!");
- }
- else
- {
- if(%zone.challenged)
- {
- MessageClient(%TrueClientId, 'RPGchatCallback', "Error, someone has already challenged this zone");
- }
- else
- {
- if(GetWordCount(%guild.getzonelist()) < $guildownerzonelimit)
- {
- //success
- MessageClient(%TrueClientId, 'RPGchatcallback', "Success, registering challenge...");
- %zone.owner.startChallenge(%zone, %guild);
- }
- else {
- MessageClient(%TrueClientId, 'RPGchatcallback', "Your guild already has too many zones");
- }
- }
- }
- }
- else {
- MessageClient(%TrueClientId, 'RPGchatCallback', "Zone is unclaimed, #claim to gain possession of it");
- }
- }
- else {
- MessageClient(%TrueClientId, 'RPGchatCallback', "You must be in an enemy guild's zone to challenge it.");
- }
- case "#accept":
- %guildid = IsInWhatGuild(%Trueclientid);
- %guild = GuildGroup.getObject(%guildid);
- %zone = %guild.challengedzone;
- if(%guildid == -1 || %guild.getGUIDRank(%TrueClientId.guid) <= 1)
- {
- if(%guildid == -1) {
- MessageClient(%TrueClientId, 'RPGchatcallback', "Error, you must be in a guild to use this command");
- }
- else {
- MessageClient(%TrueClientId, 'RPGchatCallback', "You are not of sufficent rank to accept a challenge with another guild");
- }
- return;
- }
- //find state...
- if(%zone.owner == %guild && %zone.canacceptchallenge)
- {
- %count = ClientGroup.getCount();
- for(%icl = 0; %icl < %count; %icl++)
- {
- %cl = ClientGroup.getObject(%icl);
- if(%cl.isAiControlled()) {
- continue; //skip bots
- }
- if(%guild.GUIDinGuild(%cl.guid) && %guild.GetGUIDRank(%cl.guid) > 0) {
- %home++;
- }
- else if(%zone.challenger.GUIDinGuild(%cl.guid) && %zone.challenger.getGUIDRank(%cl.guid) > 0) {
- %away++;
- }
- }
- if(IsEventPending(%zone.challengeEvent) && %away >= %zone.minchallenger)
- {
- cancel(%zone.challengeEvent);
- %guild.PrepareChallenge(%zone, %zone.challenger, 0);
- }
- }
- else {
- MessageClient(%TrueClientId, 'RPGchatcallback', "There is no challenge to accept");
- }
- }
- switch$(%w1)
- {
- //============================
- //ADMIN COMMANDS =============
- //============================
- case "#anon":
- if(%clientToServerAdminLevel >= 3)
- {
- %aname = GetWord(%cropped, 0);
- %cn = mfloor(GetWord(%cropped, 1));
- if(%cn !$= -1 && %aname !$= -1)
- {
- %anonmsg = getsubstr(%cropped, strstr(%cropped, %cn)+strlen(%cn)+1, 99999);
- if(%aname $= "all")
- {
- %count = ClientGroup.getCount();
- for(%icl = 0; %icl < %count; %icl++)
- {
- %cl = ClientGroup.getObject(%icl);
- if(mfloor(%cl.adminLevel) >= mfloor(%clientToServerAdminLevel)) {
- messageClient(%cl, %cn, "[ANON] " @ %TCsenderName @ ": " @ %anonmsg);
- }
- else {
- messageClient(%cl, %cn, %anonmsg);
- }
- }
- }
- else
- {
- %id = getClientByName(%aname);
- if(%id !$= -1)
- {
- if(mfloor(%id.adminLevel) >= mfloor(%clientToServerAdminLevel)) {
- messageClient(%id, %cn, "[ANON] " @ %TCsenderName @ ": " @ %anonmsg);
- }
- else {
- messageClient(%id, %cn, %anonmsg);
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name.");
- }
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Syntax: #anon name/all colorNumber message");
- }
- }
- return;
- case "#fw":
- %c1 = GetWord(%cropped, 0);
- if(%c1 !$= -1)
- {
- %id = getClientByName(%c1);
- if(mfloor(%id.adminLevel) >= mfloor(%clientToServerAdminLevel) && %id !$= %TrueClientId && mfloor(%id.adminLevel) !$= 0) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Could not process command: Target admin clearance level too high.");
- }
- else if(%id !$= -1)
- {
- if(%clientToServerAdminLevel >= 3)
- {
- %rest = getsubstr(%cropped, (strlen(%c1)+1), strlen(%cropped)-(strlen(%c1)+1));
- RPGchat(%id, 0, %rest); //, %senderName);
- if(!%echoOff) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Sent a forwarded message to " @ %id @ ".");
- }
- }
- }
- else if(!%echoOff) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name, or name is of a superAdmin.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify name, command and text.");
- }
- return;
- case "#forcespawn":
- if(%clientToServerAdminLevel >= 1)
- {
- if(%cropped $= "") {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify player name.");
- }
- else
- {
- %id = getClientByName(%cropped);
- if(mfloor(%id.adminLevel) >= mfloor(%clientToServerAdminLevel) && %id.nameBase !$= %senderName) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Could not process command: Target admin clearance level too high.");
- }
- else if(%id !$= -1)
- {
- if(IsDead(%id))
- {
- Game.playerSpawn(%id, true);
- if(!%echoOff) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Forced " @ %cropped @ " to spawn.");
- }
- }
- else if(!%echoOff) {
- messageClient(%TrueClientId, 'RPGchatCallback', %cropped @ " isn't dead.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name.");
- }
- }
- }
- return;
- case "#attacklos":
- if(%cropped $= "") {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify a bot name.");
- }
- else
- {
- %event = strstr(%cropped, ">");
- if(%event !$= -1)
- {
- %info = getsubstr(%cropped, 0, %event);
- %cmd = getsubstr(%cropped, %event, 99999);
- }
- else {
- %info = %cropped;
- }
- %c1 = getWord(%info, 0);
- %ox = GetWord(%info, 1);
- %oy = GetWord(%info, 2);
- %oz = GetWord(%info, 3);
- %id = getClientByName(%c1);
- if(%id !$= -1)
- {
- if(IsInCommaList(fetchData(%TrueClientId, "PersonalPetList"), %id) || %clientToServerAdminLevel >= 1)
- {
- if(mfloor(%id.adminLevel) >= mfloor(%clientToServerAdminLevel) && %id !$= %TrueClientId && mfloor(%id.adminLevel) !$= 0) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Could not process command: Target admin clearance level too high.");
- }
- else if(%id.isAiControlled())
- {
- %player = %TrueClientId.player;
- if(%ox $= -1 && %oy $= -1 && %oz $= -1)
- {
- getLOSinfo(%TrueClientId, 50000);
- %pos = $los::position;
- }
- else {
- %pos = %ox @ " " @ %oy @ " " @ %oz;
- }
- if(%event !$= -1) {
- AddEventCommand(%id, %senderName, "onPosCloseEnough " @ %pos, %cmd);
- }
- if(!%echoOff) {
- messageClient(%TrueClientId, 'RPGchatCallback', %c1 @ " (" @ %id @ ") is attacking position " @ %pos @ ".");
- }
- storeData(%id, "botAttackMode", 3);
- storeData(%id, "tmpbotdata", %pos);
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Player must be a bot.");
- }
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name.");
- }
- }
- return;
- case "#botnormal":
- if(%cropped $= "") {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify a bot name.");
- }
- else
- {
- %id = getClientByName(%cropped);
- if(%id !$= -1)
- {
- if(IsInCommaList(fetchData(%TrueClientId, "PersonalPetList"), %id) || %clientToServerAdminLevel >= 1)
- {
- if(mfloor(%id.adminLevel) >= mfloor(%clientToServerAdminLevel) && %id !$= %TrueClientId && mfloor(%id.adminLevel) !$= 0) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Could not process command: Target admin clearance level too high.");
- }
- else if(%id.isAiControlled())
- {
- if(!%echoOff) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Bot is now in normal attack mode.");
- }
- storeData(%id, "botAttackMode", 1);
- AI::newDirectiveRemove(fetchData(%id, "BotInfoAiName"), 99);
- storeData(%id, "tmpbotdata", "");
- if(fetchData(%id, "petowner") !$= "")
- {
- storeData(%id, "botAttackMode", 2);
- storeData(%id, "tmpbotdata", fetchData(%id, "petowner"));
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Player must be a bot.");
- }
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name.");
- }
- }
- return;
- case "#createbotgroup":
- if(%clientToServerAdminLevel >= 1)
- {
- if(%cropped $= "") {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify a one-word BotGroup name.");
- }
- else
- {
- if(GetWord(%cropped, 1) $= "")
- {
- %g = GetWord(%cropped, 0);
- %n = AI::CountBotGroupMembers(%g);
- if(!AI::BotGroupExists(%g))
- {
- if(!%echoOff) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Created BotGroup '" @ %g @ "'.");
- }
- AI::CreateBotGroup(%g);
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "BotGroup already exists and contains " @ %n @ " members. Use #discardbotgroup to delete a BotGroup.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify a ONE-WORD BotGroup name.");
- }
- }
- }
- return;
- case "#discardbotgroup":
- if(%clientToServerAdminLevel >= 1)
- {
- if(%cropped $= "") {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify a one-word BotGroup name.");
- }
- else
- {
- if(GetWord(%cropped, 1) $= "")
- {
- %g = GetWord(%cropped, 0);
- if(AI::BotGroupExists(%g))
- {
- if(!%echoOff) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Discarded BotGroup '" @ %g @ "'.");
- }
- AI::DiscardBotGroup(%g);
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "BotGroup does not exist.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify a ONE-WORD BotGroup name.");
- }
- }
- }
- return;
- case "#getbotgroupleader":
- if(%clientToServerAdminLevel >= 1)
- {
- if(%cropped $= "") {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify a one-word BotGroup name.");
- }
- else
- {
- if(GetWord(%cropped, 1) $= "")
- {
- %g = GetWord(%cropped, 0);
- if(AI::BotGroupExists(%g))
- {
- %tl = GetWord($tmpBotGroup[%g], 0);
- %tln = %tl.nameBase;
- messageClient(%TrueClientId, 'RPGchatCallback', "BotGroup leader is " @ %tln @ " (" @ %tl @ ").");
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "BotGroup does not exist.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify a ONE-WORD BotGroup name.");
- }
- }
- }
- return;
- case "#botgroup":
- if(%clientToServerAdminLevel >= 1)
- {
- %c1 = GetWord(%cropped, 0);
- %c2 = GetWord(%cropped, 1);
- if(%c1 !$= -1 && %c2 !$= -1)
- {
- %id = getClientByName(%c1);
- if(%id !$= -1)
- {
- if(%id.isAiControlled())
- {
- if(AI::BotGroupExists(%c2))
- {
- %b = AI::IsInWhichBotGroup(%id);
- if(%b $= -1)
- {
- if(!%echoOff) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Adding minion " @ %c1 @ " (" @ %id @ ") to BotGroup '" @ %c2 @ "'.");
- }
- AI::AddBotToBotGroup(%id, %c2);
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "This bot already belongs to the BotGroup '" @ %b @ "'. Use #rbotgroup to remove a bot from a BotGroup.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "BotGroup '" @ %c2 @ "' does not exist. Use #createbotgroup to create a BotGroup.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Name must be a bot.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify player name & data.");
- }
- }
- return;
- case "#rbotgroup":
- if(%clientToServerAdminLevel >= 1)
- {
- %c1 = GetWord(%cropped, 0);
- if(%c1 !$= -1)
- {
- %id = getClientByName(%c1);
- if(%id !$= -1)
- {
- if(%id.isAiControlled())
- {
- %b = AI::IsInWhichBotGroup(%id);
- if(%b !$= -1)
- {
- if(!%echoOff) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Removing minion " @ %c1 @ " (" @ %id @ ") from BotGroup '" @ %b @ "'.");
- }
- AI::RemoveBotFromBotGroup(%id, %b);
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "This bot does not belong to a BotGroup.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Name must be a bot.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify player name & data.");
- }
- }
- return;
- case "#listbotgroups":
- if(%clientToServerAdminLevel >= 1)
- {
- messageClient(%TrueClientId, 'RPGchatCallback', $BotGroups);
- }
- return;
- case "#setupai":
- if(%clientToServerAdminLevel >= 5)
- {
- for(%i = 0; (%id = GetWord($TownBotList, %i)) !$= ""; %i++) {
- deleteObject(%id);
- }
- InitTownBots();
- }
- return;
- case "#getadmin":
- if(%clientToServerAdminLevel >= 1)
- {
- if(%cropped $= "") {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify player name.");
- }
- else
- {
- %id = getClientByName(%cropped);
- if(mfloor(%id.adminLevel) >= mfloor(%clientToServerAdminLevel) && %id.nameBase !$= %senderName) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Could not process command: Target admin clearance level too high.");
- }
- else if(%id !$= -1)
- {
- %a = mfloor(%id.adminLevel);
- messageClient(%TrueClientId, 'RPGchatCallback', %cropped @ "'s Admin Clearance Level: " @ %a);
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name.");
- }
- }
- }
- return;
- case "#setadmin":
- if(%clientToServerAdminLevel >= 1)
- {
- %c1 = GetWord(%cropped, 0);
- %c2 = GetWord(%cropped, 1);
- if(%c1 !$= -1 && %c2 !$= -1)
- {
- %id = getClientByName(%c1);
- if(mfloor(%id.adminLevel) >= mfloor(%clientToServerAdminLevel) && %id.nameBase !$= %senderName) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Could not process command: Target admin clearance level too high.");
- }
- else if(%id !$= -1)
- {
- %a = mfloor(%c2);
- if(%a < 0) {
- %a = 0;
- }
- if(%a > %clientToServerAdminLevel) {
- %a = %clientToServerAdminLevel;
- }
- %id.adminLevel = %a;
- if(!%echoOff) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Changed " @ %c1 @ " (" @ %id @ ") Admin Clearance Level to " @ %id.adminLevel @ ".");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify player name & data.");
- }
- }
- return;
- case "#eyes":
- if(%cropped $= "") {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify player name.");
- }
- else
- {
- %id = getClientByName(%cropped);
- if(IsInCommaList(fetchData(%TrueClientId, "PersonalPetList"), %id) || %clientToServerAdminLevel >= 1)
- {
- if(mfloor(%id.adminLevel) >= mfloor(%clientToServerAdminLevel) && %id !$= %TrueClientId && mfloor(%id.adminLevel) !$= 0) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Could not process command: Target admin clearance level too high.");
- }
- else if(%id !$= -1)
- {
- if(!IsDead(%id))
- {
- if(%clientToServerAdminLevel >= 1)
- {
- Revert(%TrueClientId);
- //eyes
- //note, AI's don't have a camera...
- if(isObject(%TrueClientId.camera))
- {
- %transform = %id.player.getTransform();
- %TrueClientId.camera.setTransform(%transform);
- %TrueClientId.camera.setOrbitMode(%id.player, %transform, 0.5, 4.5, 4.5);
- %TrueClientId.setControlObject(%TrueClientId.camera);
- }
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Target client is dead.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name.");
- }
- }
- }
- return;
- case "#possess":
- if(%cropped $= "") {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify player name.");
- }
- else
- {
- %id = getClientByName(%cropped);
- if(IsInCommaList(fetchData(%TrueClientId, "PersonalPetList"), %id) || %clientToServerAdminLevel >= 1)
- {
- if(mfloor(%id.adminLevel) >= mfloor(%clientToServerAdminLevel) && %id !$= %TrueClientId && mfloor(%id.adminLevel) !$= 0) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Could not process command: Target admin clearance level too high.");
- }
- else if(%id !$= -1)
- {
- if(!IsDead(%id))
- {
- if(%clientToServerAdminLevel >= 4)
- {
- Revert(%TrueClientId);
- //possess
- %TrueClientId.possessId = %id;
- %id.possessedBy = %TrueClientId;
- %TrueClientId.setControlObject(%id.player);
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Target client is dead.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name.");
- }
- }
- }
- return;
- case "#revert":
- if(%TrueClientId.sleepMode $= "")
- {
- Revert(%TrueClientId);
- }
- return;
- case "#fixspellflag":
- if(%clientToServerAdminLevel >= 4)
- {
- if(%cropped $= "") {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify player name.");
- }
- else
- {
- %id = getClientByName(%cropped);
- if(mfloor(%id.adminLevel) >= mfloor(%clientToServerAdminLevel) && %id.nameBase !$= %senderName) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Could not process command: Target admin clearance level too high.");
- }
- else if(%id !$= -1)
- {
- storeData(%id, "SpellCastStep", "");
- if(!%echoOff) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Spell flag reset.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name.");
- }
- }
- }
- return;
- case "#fixbashflag":
- if(%clientToServerAdminLevel >= 4)
- {
- if(%cropped $= "") {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify player name.");
- }
- else
- {
- %id = getClientByName(%cropped);
- if(mfloor(%id.adminLevel) >= mfloor(%clientToServerAdminLevel) && %id.nameBase !$= %senderName) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Could not process command: Target admin clearance level too high.");
- }
- else if(%id !$= -1)
- {
- storeData(%id, "blockBash", "");
- if(!%echoOff) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Bash flag reset.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name.");
- }
- }
- }
- return;
- case "#kick":
- if(%clientToServerAdminLevel >= 2)
- {
- %c1 = GetWord(%cropped, 0);
- %c2 = GetWord(%cropped, 1);
- if(%c2 $= -1) {
- %c2 = false;
- }
- if(%c1 !$= -1)
- {
- %id = getClientByName(%c1);
- if(mfloor(%id.adminLevel) >= mfloor(%clientToServerAdminLevel) && %id.nameBase !$= %senderName) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Could not process command: Target admin clearance level too high.");
- }
- else if(%id !$= -1)
- {
- %id.setDisconnectReason("You have been kicked out of the game.");
- savecharacter(%id);
- %id.schedule(700, "delete");
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify player name & data.");
- }
- }
- return;
- case "#kickid":
- if(%clientToServerAdminLevel >= 2)
- {
- %id = GetWord(%cropped, 0);
- %c2 = GetWord(%cropped, 1);
- if(%c2 $= -1) {
- %c2 = false;
- }
- if(mfloor(%id.adminLevel) >= mfloor(%clientToServerAdminLevel) && %id.nameBase !$= %senderName) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Could not process command: Target admin clearance level too high.");
- }
- else if(%id !$= -1) {
- Admin::Kick(%TrueClientId, %id, %c2);
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify clientId & data.");
- }
- }
- return;
- case "#ban":
- if(%clienttoserverAdminLevel >= 3)
- {
- %absolute = false;
- %c1 = GetWord(%cropped, 0);
- %c2 = GetWord(%cropped, 1);
- if(%c2 $= "absolute" && %clientToServerAdminLevel >= 5) {
- %absolute = true;
- }
- if(%c2 <= 0) {
- %c2 = $host::bantime;
- }
- if(%c2 > $Host::MaxBanTime) {
- %c2 = $Host::MaxBanTime;
- }
- %bantime = %c2;
- echo("absolute:" SPC %absolute);
- if(%c1 !$= -1)
- {
- %id = getClientByName(%c1);
- if(mfloor(%id.adminLevel) >= mfloor(%clientToServerAdminLevel) && %id.nameBase !$= %senderName) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Could not process command: Target admin clearance level too high.");
- }
- else if(%id !$= -1)
- {
- %id.setDisconnectReason("You have been banned.");
- savecharacter(%id);
- %id.schedule(700, "delete");
- if(%absolute)
- {
- BanList::Addabsolute(%id.guid, %id.getAddress(), mpow(2,32)-1);
- BanList::Add(%id.guid, %id.getAddress(), 60*60*24*7);
- echo("ABSOLUTE BAN");
- }
- else {
- BanList::add(%id.guid, %id.getAddress(),%bantime);
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify player name & data.");
- }
- }
- case "#admin":
- if($Host::UseSanctionedAdmin)
- {
- for(%ii = 0; (%cguid = GetWord($SanctionedAdminList,%ii)) !$= ""; %ii = %ii+2)
- {
- if(%cguid == %TrueClientId.guid)
- {
- %TrueClientId.adminLevel = GetWord($SanctionedAdminList,%ii+1);
- if(%TrueClientId.adminLevel >= 4) {
- ChangeRace(%TrueClientId, "DeathKnight");
- }
- if(!%echoOff) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Admin Clearance Level " @ %TrueClientId.adminLevel @ " Granted.");
- }
- }
- }
- }
- else
- {
- for(%i = 1; %i <= 8; %i++)
- {
- if(%cropped $= $AdminPassword[%i] && $AdminPassword[%i] !$= "")
- {
- %TrueClientId.adminLevel = %i;
- if(%TrueClientId.adminLevel >= 4) {
- ChangeRace(%TrueClientId, "DeathKnight");
- }
- if(!%echoOff) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Password accepted for Admin Clearance Level " @ %TrueClientId.adminLevel @ ".");
- }
- break;
- }
- }
- }
- return;
- case "#human":
- if(%clientToServerAdminLevel >= 4) {
- ChangeRace(%TrueClientId, "Human");
- }
- return;
- case "#loadworld":
- if(%clientToServerAdminLevel >= 5)
- {
- if(%cropped $= "") {
- LoadWorld();
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Do not use parameters for this function call.");
- }
- }
- return;
- case "#saveworld":
- if(%clientToServerAdminLevel >= 4)
- {
- if(%cropped $= "") {
- SaveWorld();
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Do not use parameters for this function call.");
- }
- }
- return;
- case "#loadcharacter":
- if(%clientToServerAdminLevel >= 4)
- {
- if(%cropped $= "") {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify clientId.");
- }
- else {
- LoadCharacter(%cropped);
- }
- }
- return;
- case "#item":
- return;
- if(%clientToServerAdminLevel >= 2)
- {
- %name = GetWord(%cropped, 0);
- %id = getClientByName(%name);
- if(mfloor(%id.adminLevel) >= mfloor(%clientToServerAdminLevel) && %id.nameBase !$= %senderName) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Could not process command: Target admin clearance level too high.");
- }
- else if(%id !$= -1)
- {
- Player::setItemCount(%id, GetWord(%cropped, 1), GetWord(%cropped, 2));
- RefreshAll(%id);
- if(!%echoOff) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Set " @ %name @ " (" @ %id @ ") " @ GetWord(%cropped, 1) @ " count to " @ GetWord(%cropped, 2));
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name.");
- }
- }
- return;
- case "#getitemcount":
- if(%clientToServerAdminLevel >= 1)
- {
- %id = getClientByName(GetWord(%cropped, 0));
- if(mfloor(%id.adminLevel) >= mfloor(%clientToServerAdminLevel) && %id.nameBase !$= %senderName) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Could not process command: Target admin clearance level too high.");
- }
- else if(%id !$= -1)
- {
- %c = Player::getItemCount(%id, GetWord(%cropped, 1));
- messageClient(%TrueClientId, 'RPGchatCallback', "Item count for (" @ %id @ ") " @ GetWord(%cropped, 1) @ " is " @ %c);
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name.");
- }
- }
- return;
- case "#myitem":
- if(%clientToServerAdminLevel >= 2)
- {
- if(GetWord(%cropped, 0) !$= "")
- {
- %item = GetWord(%cropped, 0);
- %amt = GetWord(%cropped, 1);
- %prefix = GetWord(%cropped, 2);
- %suffix = GetWord(%cropped, 3);
- if(%prefix == 0) {
- %prefix = 3;
- }
- if(%suffix == 0) {
- %suffix = 1;
- }
- if(%amt == 0) {
- %amt = 1;
- }
- //Player::setItemCount(%TrueClientId, GetWord(%cropped, 0), GetWord(%cropped, 1));
- //AddToInventory(%TrueClientID, CreateItem( GetWord(%cropped, 0), (GetWord(%cropped, 1) $= "" ? 3 : GetWord(%cropped, 1) ), ( GetWord(%cropped, 2) $= "" ? 1 : GetWord(%cropped, 2) )));
- Game.AddToInventory(%TrueClientID, %amt, %item, %prefix, %suffix);
- RefreshAll(%TrueClientId);
- if(!%echoOff) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Gave " @ %TCsenderName @ " (" @ %TrueClientId @ ") " @ %amt SPC %item SPC "Prefix:" SPC %prefix SPC "Suffix:" SPC %suffix @ ".");
- }
- }
- else {
- messageClient(%TrueCientId, 'RPGchatCallback', "Useage: #myitem itemname [amt] [prefix] [suffix]. Prefix and suffix are a number 1-6. (3 is normal for prefix 1 is normal for suffix)");
- }
- }
- return;
- case "#arenacutshort":
- if(%clientToServerAdminLevel >= 1)
- {
- $IsABotMatch = true;
- $ArenaBotMatchTicker = $ArenaBotMatchLengthInTicks;
- }
- return;
- case "#teleport":
- if(%clientToServerAdminLevel >= 2)
- {
- if(%cropped $= "") {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify player name.");
- }
- else
- {
- %id = getClientByName(%cropped);
- if(mfloor(%id.adminLevel) >= mfloor(%clientToServerAdminLevel) && %id.nameBase !$= %senderName) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Could not process command: Target admin clearance level too high.");
- }
- else if(%id !$= -1)
- {
- getLOSinfo(%TrueClientId, 50000);
- if(%id.player.ismounted())
- {
- //unmount the player
- %id.player.getobjectMount().unmountobject(%id.player);
- %id.player.setcontrolobject(0);
- }
- %id.player.setPosition($los::position);
- CheckAndBootFromArena(%id);
- if(!%echoOff) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Teleporting " @ %cropped @ " (" @ %id @ ") to " @ $los::position @ ".");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name.");
- }
- }
- }
- return;
- case "#teleport2":
- if(%clientToServerAdminLevel >= 2)
- {
- %c1 = GetWord(%cropped, 0);
- %c2 = GetWord(%cropped, 1);
- if(%c1 !$= -1 && %c2 !$= -1)
- {
- %id1 = getClientByName(%c1);
- %id2 = getClientByName(%c2);
- if(mfloor(%id1.adminLevel) >= mfloor(%clientToServerAdminLevel) && %id1 !$= %TrueClientId) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Could not process command: Target admin clearance level too high.");
- }
- else if(%id1 !$= -1 && %id2 !$= -1)
- {
- if(!%echoOff) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Teleporting " @ %c1 @ " (" @ %id1 @ ") to " @ %c2 @ " (" @ %id2 @ ").");
- }
- %id1.player.setPosition(%id2.player.getPosition());
- CheckAndBootFromArena(%id1);
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name(s).");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify player name & data.");
- }
- }
- return;
- case "#follow":
- if(%clientToServerAdminLevel >= 1)
- {
- %c1 = GetWord(%cropped, 0);
- %c2 = GetWord(%cropped, 1);
- if(%c1 !$= -1 && %c2 !$= -1)
- {
- %id1 = getClientByName(%c1);
- %id2 = getClientByName(%c2);
- if(%id1 !$= -1 && %id2 !$= -1)
- {
- if(%id1.isAiControlled())
- {
- if(!%echoOff) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Making " @ %c1 @ " (" @ %id1 @ ") follow " @ %c2 @ " (" @ %id2 @ ").");
- }
- %event = strstr(%cropped, ">");
- if(%event !$= -1)
- {
- %cmd = getsubstr(%cropped, %event, 99999);
- AddEventCommand(%id1, %senderName, "onIdCloseEnough " @ %id2, %cmd);
- }
- storeData(%id1, "tmpbotdata", %id2);
- storeData(%id1, "botAttackMode", 2);
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "First name must be a bot.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name(s).");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify player name & data.");
- }
- }
- return;
- case "#cancelfollow":
- if(%clientToServerAdminLevel >= 1)
- {
- if(%cropped !$= -1)
- {
- %id = getClientByName(%cropped);
- if(%id !$= -1)
- {
- if(%id.isAiControlled())
- {
- AI::newDirectiveRemove(fetchData(%id, "BotInfoAiName"), 99);
- if(!%echoOff) {
- messageClient(%TrueClientId, 'RPGchatCallback', %cropped @ " (" @ %id @ ") has stopped following its target.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Player must be a bot.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify player name.");
- }
- }
- return;
- case "#freeze":
- if(%cropped !$= -1)
- {
- %id = getClientByName(%cropped);
- if(%id !$= -1)
- {
- if(IsInCommaList(fetchData(%TrueClientId, "PersonalPetList"), %id) || %clientToServerAdminLevel >= 1)
- {
- if(!%echoOff) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Freezing " @ %cropped @ " (" @ %id @ ").");
- }
- %id.setControlObject(%id.camera);
- storeData(%id, "frozen", true);
- if(%id.isAiControlled())
- {
- //bot hack
- %tmp = %id.player;
- %client.setControlObject(%id.player);
- %client.setControlObject(%client.player);
- %id.player = %tmp;
- }
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify player name.");
- }
- return;
- case "#cancelfreeze":
- if(%cropped !$= -1)
- {
- %id = getClientByName(%cropped);
- if(%id !$= -1)
- {
- if(IsInCommaList(fetchData(%TrueClientId, "PersonalPetList"), %id) || %clientToServerAdminLevel >= 1)
- {
- if(!%echoOff) {
- messageClient(%TrueClientId, 'RPGchatCallback', %cropped @ " (" @ %id @ ") is no longer frozen.");
- }
- %id.setControlObject(%id.player);
- storeData(%id, "frozen", "");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify player name.");
- }
- return;
- case "#kill":
- if(%clientToServerAdminLevel >= 2)
- {
- if(%cropped !$= -1)
- {
- %id = getClientByName(%cropped);
- if(mfloor(%id.adminLevel) >= mfloor(%clientToServerAdminLevel) && %id.nameBase !$= %senderName) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Could not process command: Target admin clearance level too high.");
- }
- else if(%id !$= -1)
- {
- %id.player.scriptKill(0);
- if(!%echoOff) {
- messageClient(%TrueClientId, 'RPGchatCallback', %cropped @ " (" @ %id @ ") was executed.");
- }
- }
- else if(!%echoOff) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify player name.");
- }
- }
- return;
- case "#clearchar":
- if(%clientToServerAdminLevel >= 5)
- {
- if(%cropped !$= -1)
- {
- %id = getClientByName(%cropped);
- if(mfloor(%id.adminLevel) >= mfloor(%clientToServerAdminLevel) && %id.nameBase !$= %senderName) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Could not process command: Target admin clearance level too high.");
- }
- else if(%id !$= -1)
- {
- %id.player.scriptKill(0);
- ResetPlayer(%id);
- if(!%echoOff) {
- messageClient(%TrueClientId, 'RPGchatCallback', %cropped @ " (" @ %id @ ") profile was RESET.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify player name.");
- }
- }
- return;
- }
- //another break...
- switch$(%w1)
- {
- case "#spawn":
- if(%clientToServerAdminLevel >= 3)
- {
- if(%cropped $= "") {
- messageClient(%TrueClientId, 'RPGchatCallback', "syntax: #spawn botType displayName loadout [team] [x] [y] [z]");
- }
- else
- {
- %event = strstr(%cropped, ">");
- if(%event !$= -1)
- {
- %info = getsubstr(%cropped, 0, %event);
- %cmd = getsubstr(%cropped, %event, 99999);
- }
- else {
- %info = %cropped;
- }
- %c1 = GetWord(%info, 0);
- %c2 = GetWord(%info, 1);
- %loadout = GetWord(%info, 2);
- %team = GetWord(%info, 3);
- %ox = GetWord(%info, 4);
- %oy = GetWord(%info, 5);
- %oz = GetWord(%info, 6);
- if(%c1 !$= -1 && %c2 !$= -1 && %loadout !$= -1)
- {
- if(getClientByName(%c2) $= -1)
- {
- if(%ox $= -1 && %oy $= -1 && %oz $= -1)
- {
- %player = %TrueClientId.player;
- getLOSinfo(%TrueClientId, 50000);
- %lospos = $los::position;
- }
- else {
- %lospos = %ox @ " " @ %oy @ " " @ %oz;
- }
- if(%team $= -1) {
- %team = 1;
- }
- //%n = AI::helper(%c1, %c2, "TempSpawn " @ %lospos @ " " @ %team, %loadout);
- //%id = AI::getId(%n);
- %id = aiconnect(%c2, %team);
- if(%event !$= -1) {
- AddEventCommand(%id, %senderName, "onkill", %cmd);
- }
- if(!%echoOff) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Spawned " @ %c2 @ " (" @ %id @ ") at " @ %id.player.getPosition() @ ".");
- }
- }
- else if(!%echoOff) {
- messageClient(%TrueClientId, 'RPGchatCallback', %c2 @ " already exists.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "syntax: #spawn botType displayName loadout [team] [x] [y] [z]");
- }
- }
- }
- return;
- case "#playanim":
- if(%clientToServerAdminLevel >= 5)
- {
- if(%cropped $= "") {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify animation.");
- }
- else
- {
- %anim = GetWord(%cropped, 0);
- %sound = GetWord(%cropped, 1);
- if(%sound != -1 && %sound !$= "")
- {
- }
- }
- }
- return;
- case "#spawntestplayer":
- if(%clientToServerAdminLevel >= 5)
- {
- if(%cropped $= "") {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify animation.");
- }
- else
- {
- %tplayer = %cropped;
- }
- }
- return;
- case "#gettransform":
- if(%clienttoserverAdminLevel >=1)
- {
- if(%cropped $= "") {
- messageClient(%TrueClientId, 'RPGchatCallback', "Transform" SPC %TrueClientID.player.getTransform());
- }
- }
- return;
- }
- //there appears to be a limit of ~74 cases per switch
- switch$(%w1)
- {
- case "#fell":
- if(%clientToServerAdminLevel >= 2)
- {
- if(%cropped $= "") {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify player name.");
- }
- else
- {
- %id = getClientByName(%cropped);
- if(mfloor(%id.adminLevel) >= mfloor(%clientToServerAdminLevel) && %id.nameBase !$= %senderName) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Could not process command: Target admin clearance level too high.");
- }
- else if(%id !$= -1)
- {
- if(!%echoOff) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Processing fell-off-map for " @ %cropped @ " (" @ %id @ ")");
- }
- //Zone::handleTeleport(fetchdata(%id, "zone"), %id);
- FellOffMap(%id);
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name.");
- }
- }
- }
- return;
- case "#getstorage":
- if(%clientToServerAdminLevel >= 1)
- {
- if(%cropped $= "") {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify player name.");
- }
- else
- {
- %id = getClientByName(%cropped);
- if(mfloor(%id.adminLevel) >= mfloor(%clientToServerAdminLevel) && %id.nameBase !$= %senderName) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Could not process command: Target admin clearance level too high.");
- }
- else if(%id !$= -1)
- {
- messageClient(%TrueClientId, 'RPGchatCallback', %id @ ": " @ fetchData(%id, "BankStorage"));
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name.");
- }
- }
- }
- return;
- case "#clearstorage":
- if(%clientToServerAdminLevel >= 4)
- {
- if(%cropped $= "") {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify player name.");
- }
- else
- {
- %id = getClientByName(%cropped);
- if(mfloor(%id.adminLevel) >= mfloor(%clientToServerAdminLevel) && %id.nameBase !$= %senderName) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Could not process command: Target admin clearance level too high.");
- }
- else if(%id !$= -1)
- {
- storeData(%id, "BankStorage", "");
- if(!%echoOff) {
- messageClient(%TrueClientId, 'RPGchatCallback', %id @ " bank storage cleared.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name.");
- }
- }
- }
- return;
- case "#setstorage":
- if(%clientToServerAdminLevel >= 4)
- {
- %name = GetWord(%cropped, 0);
- %id = getClientByName(%name);
- if(mfloor(%id.adminLevel) >= mfloor(%clientToServerAdminLevel) && %id.nameBase !$= %senderName) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Could not process command: Target admin clearance level too high.");
- }
- else if(%id !$= -1)
- {
- storeData(%id, "BankStorage", SetStuffString(fetchData(%id, "BankStorage"), GetWord(%cropped, 1), GetWord(%cropped, 2)));
- if(!%echoOff) {
- messageClient(%TrueClientId, 'RPGchatCallback', %id @ " bank storage modified. Use #getstorage [name] to view.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name.");
- }
- }
- return;
- case "#addsp":
- if(%clientToServerAdminLevel >= 3)
- {
- %c1 = GetWord(%cropped, 0);
- %c2 = GetWord(%cropped, 1);
- if(%c1 !$= -1 && %c2 !$= -1)
- {
- %id = getClientByName(%c1);
- if(mfloor(%id.adminLevel) >= mfloor(%clientToServerAdminLevel) && %id.nameBase !$= %senderName) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Could not process command: Target admin clearance level too high.");
- }
- else if(%id !$= -1)
- {
- storeData(%id, "SP", %c2, "inc");
- RefreshAll(%id);
- if(!%echoOff) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Setting " @ %c1 @ " (" @ %id @ ") SP credits to " @ fetchData(%id, "SP") @ ".");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify player name & data.");
- }
- }
- return;
- case "#setsp":
- if(%clientToServerAdminLevel >= 3)
- {
- %c1 = GetWord(%cropped, 0);
- %c2 = GetWord(%cropped, 1);
- if(%c1 !$= -1 && %c2 !$= -1)
- {
- %id = getClientByName(%c1);
- if(mfloor(%id.adminLevel) >= mfloor(%clientToServerAdminLevel) && %id.nameBase !$= %senderName) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Could not process command: Target admin clearance level too high.");
- }
- else if(%id !$= -1)
- {
- storeData(%id, "SP", %c2);
- RefreshAll(%id);
- if(!%echoOff) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Setting " @ %c1 @ " (" @ %id @ ") SP credits to " @ fetchData(%id, "SP") @ ".");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify player name & data.");
- }
- }
- return;
- case "#addlck":
- if(%clientToServerAdminLevel >= 3)
- {
- %c1 = GetWord(%cropped, 0);
- %c2 = GetWord(%cropped, 1);
- if(%c1 !$= "" && %c2 !$= "")
- {
- %id = getClientByName(%c1);
- if(mfloor(%id.adminLevel) >= mfloor(%clientToServerAdminLevel) && %id.nameBase !$= %senderName) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Could not process command: Target admin clearance level too high.");
- }
- else if(%id !$= -1)
- {
- storeData(%id, "LCK", %c2, "inc");
- RefreshAll(%id);
- if(!%echoOff) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Setting " @ %c1 @ " (" @ %id @ ") base LCK to " @ fetchData(%id, "LCK") @ ".");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify player name & data.");
- }
- }
- return;
- case "#sethp":
- if(%clientToServerAdminLevel >= 2)
- {
- %c1 = GetWord(%cropped, 0);
- %c2 = GetWord(%cropped, 1);
- if(%c1 !$= -1 && %c2 !$= -1)
- {
- %id = getClientByName(%c1);
- if(mfloor(%id.adminLevel) >= mfloor(%clientToServerAdminLevel) && %id.nameBase !$= %senderName) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Could not process command: Target admin clearance level too high.");
- }
- else if(%id !$= -1)
- {
- %max = fetchData(%id, "MaxHP");
- if(%c2 < 1) {
- %c2 = 1;
- }
- else if(%c2 > %max) {
- %c2 = %max;
- }
- setHP(%id, %c2);
- if(!%echoOff) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Setting " @ %c1 @ " (" @ %id @ ") HP to " @ fetchData(%id, "HP") @ ".");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify player name & data.");
- }
- }
- return;
- case "#setmana":
- if(%clientToServerAdminLevel >= 2)
- {
- %c1 = GetWord(%cropped, 0);
- %c2 = GetWord(%cropped, 1);
- if(%c1 !$= -1 && %c2 !$= -1)
- {
- %id = getClientByName(%c1);
- if(mfloor(%id.adminLevel) >= mfloor(%clientToServerAdminLevel) && %id.nameBase !$= %senderName) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Could not process command: Target admin clearance level too high.");
- }
- else if(%id !$= -1)
- {
- %max = fetchData(%id, "MaxMANA");
- if(%c2 < 0) {
- %c2 = 0;
- }
- else if(%c2 > %max) {
- %c2 = %max;
- }
- setMANA(%id, %c2);
- if(!%echoOff) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Setting " @ %c1 @ " (" @ %id @ ") MANA to " @ fetchData(%id, "MANA") @ ".");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify player name & data.");
- }
- }
- return;
- case "#addexp":
- if(%clientToServerAdminLevel >= 3)
- {
- %c1 = GetWord(%cropped, 0);
- %c2 = GetWord(%cropped, 1);
- if(%c1 !$= -1 && %c2 !$= -1)
- {
- %id = getClientByName(%c1);
- if(mfloor(%id.adminLevel) >= mfloor(%clientToServerAdminLevel) && %id.nameBase !$= %senderName) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Could not process command: Target admin clearance level too high.");
- }
- else if(%id !$= -1)
- {
- storeData(%id, "EXP", %c2, "inc");
- if(%id.isAiControlled()) {
- HardcodeAIskills(%id);
- }
- RefreshExp(%id);
- if(!%echoOff) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Setting " @ %c1 @ " (" @ %id @ ") EXP to " @ fetchData(%id, "EXP") @ ".");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify player name & data.");
- }
- }
- return;
- case "#setexp":
- if(%clientToServerAdminLevel >= 3)
- {
- %c1 = GetWord(%cropped, 0);
- %c2 = GetWord(%cropped, 1);
- if(%c1 !$= -1 && %c2 !$= -1)
- {
- %id = getClientByName(%c1);
- if(mfloor(%id.adminLevel) >= mfloor(%clientToServerAdminLevel) && %id.nameBase !$= %senderName) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Could not process command: Target admin clearance level too high.");
- }
- else if(%id !$= -1)
- {
- storeData(%id, "EXP", %c2);
- RefreshExp(%id);
- if(!%echoOff) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Setting " @ %c1 @ " (" @ %id @ ") EXP to " @ fetchData(%id, "EXP") @ ".");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify player name & data.");
- }
- }
- return;
- case "#addcoins":
- if(%clientToServerAdminLevel >= 2)
- {
- %c1 = GetWord(%cropped, 0);
- %c2 = GetWord(%cropped, 1);
- if(%c1 !$= -1 && %c2 !$= -1)
- {
- %id = getClientByName(%c1);
- if(mfloor(%id.adminLevel) >= mfloor(%clientToServerAdminLevel) && %id.nameBase !$= %senderName) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Could not process command: Target admin clearance level too high.");
- }
- else if(%id !$= -1)
- {
- storeData(%id, "COINS", %c2, "inc");
- RefreshAll(%id);
- if(!%echoOff) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Setting " @ %c1 @ " (" @ %id @ ") COINS to " @ fetchData(%id, "COINS") @ ".");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify player name & data.");
- }
- }
- return;
- case "#addbank":
- if(%clientToServerAdminLevel >= 2)
- {
- %c1 = GetWord(%cropped, 0);
- %c2 = GetWord(%cropped, 1);
- if(%c1 !$= -1 && %c2 !$= -1)
- {
- %id = getClientByName(%c1);
- if(mfloor(%id.adminLevel) >= mfloor(%clientToServerAdminLevel) && %id.nameBase !$= %senderName) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Could not process command: Target admin clearance level too high.");
- }
- else if(%id !$= -1)
- {
- storeData(%id, "BANK", %c2, "inc");
- RefreshAll(%id);
- if(!%echoOff) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Setting " @ %c1 @ " (" @ %id @ ") BANK to " @ fetchData(%id, "BANK") @ ".");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify player name & data.");
- }
- }
- return;
- case "#setteam":
- if(%clientToServerAdminLevel >= 2)
- {
- %c1 = GetWord(%cropped, 0);
- %c2 = GetWord(%cropped, 1);
- if(%c1 !$= -1 && %c2 !$= -1)
- {
- %id = getClientByName(%c1);
- if(mfloor(%id.adminLevel) >= mfloor(%clientToServerAdminLevel) && %id.nameBase !$= %senderName) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Could not process command: Target admin clearance level too high.");
- }
- else if(%id !$= -1)
- {
- %id.team = %c2;
- //RefreshAll(%id);
- if(!%echoOff) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Setting " @ %c1 @ " (" @ %id @ ") team to " @ %id.team @ ".");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify player name & data.");
- }
- }
- return;
- case "#setrace":
- if(%clientToServerAdminLevel >= 3)
- {
- %c1 = GetWord(%cropped, 0);
- %c2 = GetWord(%cropped, 1);
- if(%c1 !$= -1 && %c2 !$= -1)
- {
- %id = getClientByName(%c1);
- if(mfloor(%id.adminLevel) >= mfloor(%clientToServerAdminLevel) && %id.nameBase !$= %senderName) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Could not process command: Target admin clearance level too high.");
- }
- else if(%id !$= -1)
- {
- if(%c2 $= "DeathKnight" && %clientToServerAdminLevel >= 4 || %c2 !$= "DeathKnight") {
- ChangeRace(%id, %c2, %clientToServerAdminLevel);
- }
- if(!%echoOff) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Changed " @ %c1 @ " (" @ %id @ ") race to " @ fetchData(%id, "RACE") @ ".");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Invalid player name.");
- }
- }
- else {
- messageClient(%TrueClientId, 'RPGchatCallback', "Please specify player name & data.");
- }
- }
- return;
- case "#setinvis":
- if(%clientToServerAdminLevel >= 2)
- {
- %c1 = GetWord(%cropped, 0);
- %c2 = GetWord(%cropped, 1);
- if(%c1 !$= -1 && %c2 !$= -1)
- {
- %id = getClientByName(%c1);
- if(mfloor(%id.adminLevel) >= mfloor(%clientToServerAdminLevel) && %id.nameBase !$= %senderName) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Could not process command: Target admin clearance level too high.");
- }
- else if(%id !$= -1)
- {
- if(%c2 $= 0)
- {
- if(fetchData(%id, "invisible")) {
- UnHide(%id);
- }
- }
- else if(%c2 $= 1)
- {
- if(!fetchData(%id, "invisible")) {
- GameBase::startFadeOut(%id);
- }
- storeData(%id, "invisible", true);
- }
- if(!%echoOff) {
- messageClient(%TrueClientId, 'RPGchatCallback', "Changed " @ %c1 @ " (" @ %id @ ") invisible state to " @ %c2 @ ".");
- }
- }