Revision: 8327
http://planeshift.svn.sourceforge.net/planeshift/?rev=8327&view=rev
Author: lpancallo
Date: 2012-05-29 22:43:36 +0000 (Tue, 29 May 2012)
Log Message:
-----------
automatic code formatting.
Modified Paths:
--------------
trunk/src/server/adminmanager.cpp
Modified: trunk/src/server/adminmanager.cpp
===================================================================
--- trunk/src/server/adminmanager.cpp 2012-05-29 18:47:55 UTC (rev 8326)
+++ trunk/src/server/adminmanager.cpp 2012-05-29 22:43:36 UTC (rev 8327)
@@ -95,47 +95,50 @@
/** This class asks user to confirm that he really wants to do the area target he/she requested */
class AreaTargetConfirm : public PendingQuestion
{
- public:
- AreaTargetConfirm(AdminManager* msgmanager, const csString in_msg, csString in_player, const csString & question, Client *in_client)
- : PendingQuestion(in_client->GetClientNum(),question, psQuestionMessage::generalConfirm)
- { //save variables for later use
- this->command = in_msg;
- this->client = in_client;
- this->player = in_player;
- this->msgmanager = msgmanager;
+public:
+ AreaTargetConfirm(AdminManager* msgmanager, const csString in_msg, csString in_player, const csString & question, Client *in_client)
+ : PendingQuestion(in_client->GetClientNum(),question, psQuestionMessage::generalConfirm)
+ {
+ //save variables for later use
+ this->command = in_msg;
+ this->client = in_client;
+ this->player = in_player;
+ this->msgmanager = msgmanager;
+ }
+
+ /// Handles the user choice
+ virtual void HandleAnswer(const csString & answer)
+ {
+ if (answer != "yes") //if we haven't got a confirm just get out of here
+ {
+ return;
}
- /// Handles the user choice
- virtual void HandleAnswer(const csString & answer)
+ //decode the area command and get the list of objects to work on
+ csArray<csString> filters = msgmanager->DecodeCommandArea(client, player);
+ csArray<csString>::Iterator it(filters.GetIterator());
+ while (it.HasNext())
{
- if (answer != "yes") //if we haven't got a confirm just get out of here
- return;
+ csString cur_player = it.Next(); //get the data about the specific entity on this iteration
- //decode the area command and get the list of objects to work on
- csArray<csString> filters = msgmanager->DecodeCommandArea(client, player);
- csArray<csString>::Iterator it(filters.GetIterator());
- while (it.HasNext())
+ gemObject * targetobject = psserver->GetAdminManager()->FindObjectByString(cur_player, client->GetActor());
+ if (targetobject == client->GetActor())
{
- csString cur_player = it.Next(); //get the data about the specific entity on this iteration
+ continue;
+ }
- gemObject * targetobject = psserver->GetAdminManager()->FindObjectByString(cur_player, client->GetActor());
- if(targetobject == client->GetActor())
- {
- continue;
- }
-
- csString cur_command = command; //get the original command inside a variable where we will change it according to cur_player
- cur_command.ReplaceAll(player.GetData(), cur_player.GetData()); //replace the area command with the eid got from the iteration
- psAdminCmdMessage cmd(cur_command.GetData(),client->GetClientNum()); //prepare the new message
- cmd.FireEvent(); //send it to adminmanager
- }
+ csString cur_command = command; //get the original command inside a variable where we will change it according to cur_player
+ cur_command.ReplaceAll(player.GetData(), cur_player.GetData()); //replace the area command with the eid got from the iteration
+ psAdminCmdMessage cmd(cur_command.GetData(),client->GetClientNum()); //prepare the new message
+ cmd.FireEvent(); //send it to adminmanager
}
+ }
- protected:
- csString command; ///< The complete command sent from the client originally (without any modification)
- Client *client; ///< Originating client of the command
- csString player; ///< Normally this should be the area:x:x command extrapolated from the original command
- AdminManager* msgmanager;
+protected:
+ csString command; ///< The complete command sent from the client originally (without any modification)
+ Client *client; ///< Originating client of the command
+ csString player; ///< Normally this should be the area:x:x command extrapolated from the original command
+ AdminManager* msgmanager;
};
psRewardData::psRewardData(Reward_Type prewardType)
@@ -148,19 +151,19 @@
return true;
}
-psRewardDataExperience::psRewardDataExperience(int pexpDelta)
-: psRewardData(REWARD_EXPERIENCE)
+psRewardDataExperience::psRewardDataExperience(int pexpDelta)
+ : psRewardData(REWARD_EXPERIENCE)
{
expDelta = pexpDelta;
}
bool psRewardDataExperience::IsZero()
{
- return ( expDelta == 0 );
+ return (expDelta == 0);
}
-psRewardDataFaction::psRewardDataFaction(csString pfactionName, int pfactionDelta)
-: psRewardData(REWARD_FACTION)
+psRewardDataFaction::psRewardDataFaction(csString pfactionName, int pfactionDelta)
+ : psRewardData(REWARD_FACTION)
{
factionName = pfactionName;
factionDelta = pfactionDelta;
@@ -172,7 +175,7 @@
}
psRewardDataSkill::psRewardDataSkill(csString pskillName, int pskillDelta, int pskillCap, bool prelativeSkill)
-: psRewardData(REWARD_SKILL)
+ : psRewardData(REWARD_SKILL)
{
skillName = pskillName;
skillDelta = pskillDelta;
@@ -186,7 +189,7 @@
}
psRewardDataMoney::psRewardDataMoney(csString pmoneyType, int pmoneyCount, bool prandom)
-: psRewardData(REWARD_MONEY), moneyType(pmoneyType), moneyCount(pmoneyCount), random(prandom)
+ : psRewardData(REWARD_MONEY), moneyType(pmoneyType), moneyCount(pmoneyCount), random(prandom)
{
}
@@ -196,7 +199,7 @@
}
psRewardDataItem::psRewardDataItem(csString pitemName, int pstackCount)
-: psRewardData(REWARD_ITEM)
+ : psRewardData(REWARD_ITEM)
{
itemName = pitemName;
stackCount = pstackCount;
@@ -223,14 +226,14 @@
AdminCmdData::AdminCmdData(csString commandName, WordArray &words)
-: command(commandName), help(false), valid(true)
+ : command(commandName), help(false), valid(true)
{
// when help is requested, return immediate
if (IsHelp(words[1]))
return;
// parse nothing, so words array must only contain the command
- if (words.GetCount() != 1)
+ if (words.GetCount() != 1)
{
valid = false;
}
@@ -267,7 +270,7 @@
return true;
csString escape;
- db->Escape( escape, cmd );
+ db->Escape(escape, cmd);
int result = db->Command("INSERT INTO gm_command_log "
"(account_id,gm,command,player,ex_time) "
"VALUES (%u,%u,\"%s\",%u,Now())", gmClient->GetAccountID().Unbox(), gmClient->GetPID().Unbox(), escape.GetData(), playerID.Unbox());
@@ -356,7 +359,7 @@
//first of all check if db hits are allowed. most commands don't
//work with the database so there is no use to hit the db for that.
- if(!IsAllowedTargetType(ADMINCMD_TARGET_DATABASE))
+ if (!IsAllowedTargetType(ADMINCMD_TARGET_DATABASE))
return false;
PID pid = PID(strtoul(word.Slice(4).GetData(), NULL, 10));
@@ -384,7 +387,7 @@
targetTypes |= ADMINCMD_TARGET_PID;
psserver->SendSystemInfo(gmClientNum, "Account ID of player (pid:%s) %s is %s.",
- target.GetData(), ShowID(targetID), ShowID(targetAccountID));
+ target.GetData(), ShowID(targetID), ShowID(targetAccountID));
return true;
}
@@ -408,7 +411,7 @@
// otherwise query the database
GetPlayerAccountIDByName(gmClientNum, target, true);
}
- }
+ }
return targetAccountID;
}
@@ -416,7 +419,7 @@
{
//first of all check if db hits are allowed. most commands don't
//work with the database so there is no use to hit the db for that.
- if(!IsAllowedTargetType(ADMINCMD_TARGET_DATABASE))
+ if (!IsAllowedTargetType(ADMINCMD_TARGET_DATABASE))
return false;
// try to find an offline player by name and resolve to a pid
@@ -424,9 +427,9 @@
// normalize and escape name (to avoid security issues)
db->Escape(name, NormalizeCharacterName(word).GetData());
Result result(db->Select("SELECT account_id, id FROM characters where name='%s'",name.GetData()));
-
+
//nothing here, try with another name
- if (!result.IsValid() || result.Count() == 0)
+ if (!result.IsValid() || result.Count() == 0)
{
if (reporterror)
{
@@ -434,8 +437,8 @@
}
return false;
}
- else if (result.Count() != 1)
- //more than one result it means we have duplicates, refrain from continuing
+ else if (result.Count() != 1)
+ //more than one result it means we have duplicates, refrain from continuing
{
psserver->SendSystemError(gmClientNum,"Multiple characters with same name '%s'. Use pid.",name.GetData());
return false;
@@ -474,10 +477,10 @@
bool AdminCmdTargetParser::GetPlayerClient(AdminManager* msgManager, size_t gmClientNum, const csString& playerName, bool allowduplicate)
{
targetClient = msgManager->FindPlayerClient(playerName); // Other player?
- if(targetClient)
+ if (targetClient)
{
//check that the actor name isn't duplicate
- if(!CharCreationManager::IsUnique(playerName, true))
+ if (!CharCreationManager::IsUnique(playerName, true))
{
duplicateActor = true;
if (!allowduplicate)
@@ -524,29 +527,29 @@
// NOTE: this might not set targetObject, targetActor, targetClient
// because the target* may not be online
targetObject = msgManager->FindObjectByString(word, NULL);
-
- if(!targetObject)
+
+ if (!targetObject)
{
//if(GetPlayerAccountIDByPID(me->clientnum, word))
//{
- // try to find an online player for the name resolved
- // from the pid
- // (GetPlayerClient sets targetClient accordingly)
- /*if (!GetPlayerClient(msgManager, me->clientnum, target, false))
+ // try to find an online player for the name resolved
+ // from the pid
+ // (GetPlayerClient sets targetClient accordingly)
+ /*if (!GetPlayerClient(msgManager, me->clientnum, target, false))
+ {
+ // error duplicate or not found at all
+ if (duplicateActor)
{
- // error duplicate or not found at all
- if (duplicateActor)
- {
- psserver->SendSystemError(me->clientnum,"PID resolves to multiple online clients!");
- return false;
- }
- else
- {*/
- // player is offline
- psserver->SendSystemInfo(me->clientnum,"PID:%s no online client", ShowID(targetID));
- //}
- //}
+ psserver->SendSystemError(me->clientnum,"PID resolves to multiple online clients!");
+ return false;
+ }
+ else
+ {*/
+ // player is offline
+ psserver->SendSystemInfo(me->clientnum,"PID:%s no online client", ShowID(targetID));
//}
+ //}
+ //}
}
else
{
@@ -564,16 +567,16 @@
csString question; //used to hold the generated question for the client
//first part of the question add also the command which will be used on the area if confirmed (the name not the arguments)
question.Format("Are you sure you want to execute %s on:\n", msg.cmd.GetData());
- //command.GetDataSafe());
+ //command.GetDataSafe());
csArray<csString> filters = msgManager->DecodeCommandArea(client, word); //decode the area command
csArray<csString>::Iterator it(filters.GetIterator());
- if(filters.GetSize())
+ if (filters.GetSize())
{
while (it.HasNext()) //iterate the resulting entities
{
csString player = it.Next();
targetObject = msgManager->FindObjectByString(player,client->GetActor()); //search for the entity in order to work on it
- if(targetObject && targetObject != client->GetActor()) //just to be sure
+ if (targetObject && targetObject != client->GetActor()) //just to be sure
{
question += targetObject->GetName(); //get the name of the target in order to show it nicely
question += '\n';
@@ -597,7 +600,7 @@
{
// targetclient, online, duplicateActor are set accordingly
// by GetPlayerClient
- if(GetPlayerClient(msgManager, me->clientnum, word, true))
+ if (GetPlayerClient(msgManager, me->clientnum, word, true))
{
targetTypes |= ADMINCMD_TARGET_PLAYER;
}
@@ -607,7 +610,7 @@
return false;
}
// if the command supports pid handling
- else if(IsAllowedTargetType(ADMINCMD_TARGET_PID))
+ else if (IsAllowedTargetType(ADMINCMD_TARGET_PID))
{
GetPlayerAccountIDByPIDFromName(me->clientnum, word, false);
}
@@ -623,7 +626,7 @@
else if (IsAllowedTargetType(ADMINCMD_TARGET_OBJECT) ||
IsAllowedTargetType(ADMINCMD_TARGET_NPC) ||
IsAllowedTargetType(ADMINCMD_TARGET_ITEM))
- // Not found yet
+ // Not found yet
{
targetObject = msgManager->FindObjectByString(word,client->GetActor()); // Find by ID or name
if (targetObject)
@@ -631,7 +634,7 @@
targetTypes |= ADMINCMD_TARGET_OBJECT;
}
else
- // no object selected try the clients target
+ // no object selected try the clients target
{
tryClientTarget = true;
}
@@ -649,7 +652,7 @@
{
tryClientTarget = true;
}
-
+
// take the target of the client (when client selected something)
if (tryClientTarget && IsAllowedTargetType(ADMINCMD_TARGET_CLIENTTARGET))
{
@@ -660,7 +663,7 @@
psserver->SendSystemError(me->clientnum,"You must have a target selected.");
return false;
}
- else if (targetObject)
+ else if (targetObject)
{
targetTypes |= ADMINCMD_TARGET_CLIENTTARGET;
}
@@ -685,7 +688,7 @@
// it is a npc, but npc is not an allowed target, so reset
Reset();
}
- else
+ else
{
// it is definitely not a player (because it is a npc)
targetTypes &= ~(ADMINCMD_TARGET_PLAYER);
@@ -700,7 +703,7 @@
target = (targetClient)?targetClient->GetName():targetObject->GetName();
targetID = targetObject->GetPID();
}
-
+
// Set additional targetTypes accordingly for me & player
if (targetClient)
{
@@ -726,11 +729,11 @@
username.Downcase();
db->Escape(usernameEscaped, username.GetData());
result = db->Select("SELECT id FROM accounts WHERE username = '%s' LIMIT 1",usernameEscaped.GetData());
- if ( result.IsValid() && result.Count() == 1 )
+ if (result.IsValid() && result.Count() == 1)
{
AccountID accountID = AccountID(result[0].GetUInt32("id"));
if (accountID.IsValid())
- {
+ {
targetAccountID = accountID;
target = word;
return true;
@@ -785,12 +788,12 @@
// concatenate all subcommands
csHash<csString, csString>::GlobalIterator it = subCommands.GetIterator();
- while(it.HasNext())
+ while (it.HasNext())
{
csTuple2<csString,csString> tuple = it.NextTuple();
help += "|" + tuple.second;
}
-
+
// remove the starting '|' character
help.SetAt(0, ' ');
help.LTrim();
@@ -912,7 +915,7 @@
csString AdminCmdRewardParser::GetHelpMessage()
{
- return "REWARD: \n " + // rewardTypes.GetHelpMessage() + "\n" + " "
+ return "REWARD: \n " + // rewardTypes.GetHelpMessage() + "\n" + " "
rewardTypes.GetHelpMessage("exp") + "\n" +
" " + rewardTypes.GetHelpMessage("item") + "\n" +
" " + rewardTypes.GetHelpMessage("skill") + "\n" +
@@ -921,7 +924,7 @@
}
AdminCmdOnOffToggleParser::AdminCmdOnOffToggleParser(ADMINCMD_SETTING_ONOFF defaultValue)
-: value(defaultValue)
+ : value(defaultValue)
{
}
@@ -971,7 +974,7 @@
}
AdminCmdDataTarget::AdminCmdDataTarget(csString commandName, int targetTypes, AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdData(commandName), AdminCmdTargetParser(targetTypes)
+ : AdminCmdData(commandName), AdminCmdTargetParser(targetTypes)
{
size_t index = 1;
@@ -986,7 +989,7 @@
}
// if first word is not a target and the client has not selected a target
else if (!IsTargetType(ADMINCMD_TARGET_CLIENTTARGET) &&
- !IsTargetType(ADMINCMD_TARGET_STRING))
+ !IsTargetType(ADMINCMD_TARGET_STRING))
{
ParseError(me, "No target specified");
}
@@ -1008,7 +1011,7 @@
}
AdminCmdDataTargetReason::AdminCmdDataTargetReason(csString commandName, AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdDataTarget(commandName, ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_EID |ADMINCMD_TARGET_CLIENTTARGET)
+ : AdminCmdDataTarget(commandName, ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_EID |ADMINCMD_TARGET_CLIENTTARGET)
{
size_t index = 1;
bool found;
@@ -1043,8 +1046,8 @@
ADMINCMDFACTORY_IMPLEMENT_MSG_FACTORY_CREATE_WITH_CMD(AdminCmdDataTargetReason)
/*
-AdminCmdData* AdminCmdDataTargetReason::CreateCmdData(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-{
+AdminCmdData* AdminCmdDataTargetReason::CreateCmdData(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
+{
return new AdminCmdDataTargetReason(command, msgManager, me, msg, client, words);
}
*/
@@ -1055,7 +1058,7 @@
}
AdminCmdDataDeath::AdminCmdDataDeath(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdDataTarget("/death", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_CLIENTTARGET | ADMINCMD_TARGET_NPC | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_EID)
+ : AdminCmdDataTarget("/death", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_CLIENTTARGET | ADMINCMD_TARGET_NPC | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_EID)
{
size_t index = 1;
bool found = false;
@@ -1101,7 +1104,7 @@
}
AdminCmdDataDeleteChar::AdminCmdDataDeleteChar(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdDataTarget("/deletechar", ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_PID), requestor(ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_CLIENTTARGET | ADMINCMD_TARGET_DATABASE)
+ : AdminCmdDataTarget("/deletechar", ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_PID), requestor(ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_CLIENTTARGET | ADMINCMD_TARGET_DATABASE)
{
size_t index = 1;
@@ -1129,7 +1132,7 @@
}
}
else
- {
+ {
ParseError(me, "No target specified");
}
}
@@ -1146,11 +1149,11 @@
AdminCmdDataUpdateRespawn::AdminCmdDataUpdateRespawn(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdDataTarget("/updaterespawn", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_NPC | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_CLIENTTARGET)
+ : AdminCmdDataTarget("/updaterespawn", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_NPC | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_CLIENTTARGET)
{
size_t index = 1;
bool found = false; // true when first word is a target string
-
+
// when help is requested, return immediate
if (IsHelp(words[index]))
return;
@@ -1192,7 +1195,7 @@
}
AdminCmdDataBan::AdminCmdDataBan(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdDataTarget("/ban", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_ACCOUNT | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_CLIENTTARGET | ADMINCMD_TARGET_DATABASE)
+ : AdminCmdDataTarget("/ban", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_ACCOUNT | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_CLIENTTARGET | ADMINCMD_TARGET_DATABASE)
{
size_t index = 1;
bool found;
@@ -1207,15 +1210,15 @@
{
index++;
}
-
+
// if not enough remaining words
- if ( words.GetCount() <= index + 1)
+ if (words.GetCount() <= index + 1)
{
ParseError(me, "Not enough parameters");
}
// either a target was in the first word or
// the client has got a valid target
- else if (found || IsTargetType(ADMINCMD_TARGET_CLIENTTARGET))
+ else if (found || IsTargetType(ADMINCMD_TARGET_CLIENTTARGET))
{
// try to parse numbers
minutes = words.GetInt(index);
@@ -1263,7 +1266,7 @@
}
AdminCmdDataKillNPC::AdminCmdDataKillNPC(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdDataTarget("/killnpc", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_NPC | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_CLIENTTARGET | ADMINCMD_TARGET_DATABASE), reload(false)
+ : AdminCmdDataTarget("/killnpc", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_NPC | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_CLIENTTARGET | ADMINCMD_TARGET_DATABASE), reload(false)
{
size_t index = 1;
bool found;
@@ -1272,7 +1275,7 @@
if (IsHelp(words[index]))
return;
- // try first word as a target
+ // try first word as a target
if ((found = ParseTarget(msgManager, me, msg, client, words[index])))
{
index++;
@@ -1287,7 +1290,7 @@
index++;
reload = true;
}
- else if (words.GetCount() > index)
+ else if (words.GetCount() > index)
{
ParseError(me, "Too many parameters");
}
@@ -1306,7 +1309,7 @@
}
AdminCmdDataPercept::AdminCmdDataPercept(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdDataTarget("/percept", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_NPC | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_CLIENTTARGET )
+ : AdminCmdDataTarget("/percept", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_NPC | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_CLIENTTARGET)
{
size_t index = 1;
bool found;
@@ -1315,7 +1318,7 @@
if (IsHelp(words[index]))
return;
- // try first word as a target
+ // try first word as a target
if ((found = ParseTarget(msgManager, me, msg, client, words[index])))
{
index++;
@@ -1329,10 +1332,10 @@
{
ParseError(me, "Missing perception");
}
-
+
type = words[index++];
- if (words.GetCount() > index)
+ if (words.GetCount() > index)
{
ParseError(me, "Too many parameters");
}
@@ -1351,7 +1354,7 @@
}
AdminCmdDataChangeNPCType::AdminCmdDataChangeNPCType(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdDataTarget("/changenpctype", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_NPC | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_CLIENTTARGET), npcType("")
+ : AdminCmdDataTarget("/changenpctype", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_NPC | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_CLIENTTARGET), npcType("")
{
size_t index = 1;
bool found;
@@ -1360,7 +1363,7 @@
if (IsHelp(words[index]))
return;
- // try first word as a target
+ // try first word as a target
if ((found = ParseTarget(msgManager, me, msg, client, words[index])))
{
index++;
@@ -1375,7 +1378,7 @@
npcType = words[index];
index++;
}
- else if (words.GetCount() > index)
+ else if (words.GetCount() > index)
{
ParseError(me, "Too many parameters");
}
@@ -1399,7 +1402,7 @@
AdminCmdDataSetStackable::AdminCmdDataSetStackable(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdDataTarget("/setstackable", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_ITEM | ADMINCMD_TARGET_EID |ADMINCMD_TARGET_CLIENTTARGET), subCommandList("info on off reset help")
+ : AdminCmdDataTarget("/setstackable", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_ITEM | ADMINCMD_TARGET_EID |ADMINCMD_TARGET_CLIENTTARGET), subCommandList("info on off reset help")
{
size_t index = 1;
bool found;
@@ -1413,7 +1416,7 @@
{
index++;
}
-
+
// missing further words
if (words.GetCount() == index)
{
@@ -1454,7 +1457,7 @@
// loadquest is only responsible for loading and reloading quests
AdminCmdDataLoadQuest::AdminCmdDataLoadQuest(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdData("/loadquest")
+ : AdminCmdData("/loadquest")
{
size_t index = 1;
@@ -1485,7 +1488,7 @@
}
AdminCmdDataItem::AdminCmdDataItem(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdDataTarget("/item", ADMINCMD_TARGET_ITEM | ADMINCMD_TARGET_STRING), random(false), quality(50)
+ : AdminCmdDataTarget("/item", ADMINCMD_TARGET_ITEM | ADMINCMD_TARGET_STRING), random(false), quality(50)
{
size_t index = 1;
@@ -1495,7 +1498,8 @@
// /item is allowed
if (words.GetCount() == index)
- {// no action required
+ {
+ // no action required
}
// /item <item> [random] <quality>
else if (words.GetCount() >=2)
@@ -1504,7 +1508,7 @@
if (ParseTarget(msgManager, me, msg, client, words[index]))
{
index++;
-
+
// random is optional
csString cc = words[index];
if (words[index]=="random")
@@ -1521,7 +1525,7 @@
ParseError(me, "Too many parameters");
}
}
- else
+ else
{
ParseError(me, "No target given");
}
@@ -1540,9 +1544,9 @@
}
AdminCmdDataKey::AdminCmdDataKey(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdDataTarget("/key", ADMINCMD_TARGET_ITEM | ADMINCMD_TARGET_OBJECT | ADMINCMD_TARGET_CLIENTTARGET),
- subCommandList("make makemaster copy clearlocks skel"),
- subTargetCommandList("changelock makeunlockable securitylockable addlock removelock")
+ : AdminCmdDataTarget("/key", ADMINCMD_TARGET_ITEM | ADMINCMD_TARGET_OBJECT | ADMINCMD_TARGET_CLIENTTARGET),
+ subCommandList("make makemaster copy clearlocks skel"),
+ subTargetCommandList("changelock makeunlockable securitylockable addlock removelock")
{
size_t index = 1;
bool found;
@@ -1558,11 +1562,11 @@
}
//check the subcommand and if it needs a target if the target was found
- if(subCommandList.IsSubCommand(words[index]))
+ if (subCommandList.IsSubCommand(words[index]))
{
subCommand = words[index++];
}
- else if(subTargetCommandList.IsSubCommand(words[index]))
+ else if (subTargetCommandList.IsSubCommand(words[index]))
{
// if first word a target or client selected a valid target
if (found || IsTargetType(ADMINCMD_TARGET_CLIENTTARGET))
@@ -1590,7 +1594,7 @@
}
AdminCmdDataRunScript::AdminCmdDataRunScript(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdDataTarget("/runscript", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_OBJECT | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_NPC | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_ITEM | ADMINCMD_TARGET_CLIENTTARGET), origObj(ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_OBJECT | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_NPC | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_ITEM | ADMINCMD_TARGET_CLIENTTARGET)
+ : AdminCmdDataTarget("/runscript", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_OBJECT | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_NPC | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_ITEM | ADMINCMD_TARGET_CLIENTTARGET), origObj(ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_OBJECT | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_NPC | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_ITEM | ADMINCMD_TARGET_CLIENTTARGET)
{
size_t index = 1;
// when help is requested, return immediate
@@ -1602,16 +1606,16 @@
//first take the name of the script
scriptName = words[index++];
//if there are more entries probably we have a target
- if(words.GetCount() >= index + 1)
+ if (words.GetCount() >= index + 1)
{
//check first the target
- if(ParseTarget(msgManager, me, msg, client, words[index++]))
+ if (ParseTarget(msgManager, me, msg, client, words[index++]))
{
//if there is another field we have also an origin
- if(words.GetCount() == index + 1)
+ if (words.GetCount() == index + 1)
{
//check the origin if it's valid
- if(!origObj.ParseTarget(msgManager, me, msg, client, words[index++]))
+ if (!origObj.ParseTarget(msgManager, me, msg, client, words[index++]))
{
ParseError(me,"Invalid origin target given");
}
@@ -1638,7 +1642,7 @@
}
AdminCmdDataCrystal::AdminCmdDataCrystal(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdDataTarget("/crystal", ADMINCMD_TARGET_ITEM | ADMINCMD_TARGET_STRING)
+ : AdminCmdDataTarget("/crystal", ADMINCMD_TARGET_ITEM | ADMINCMD_TARGET_STRING)
{
// when help is requested, return immediate
if (IsHelp(words[1]))
@@ -1666,7 +1670,7 @@
}
AdminCmdDataTeleport::AdminCmdDataTeleport(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdDataTarget("/teleport", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_OBJECT | ADMINCMD_TARGET_NPC | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_ITEM | ADMINCMD_TARGET_DATABASE), destList("here there last spawn restore"), destObj(ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_OBJECT | ADMINCMD_TARGET_NPC | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_ITEM)
+ : AdminCmdDataTarget("/teleport", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_OBJECT | ADMINCMD_TARGET_NPC | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_ITEM | ADMINCMD_TARGET_DATABASE), destList("here there last spawn restore"), destObj(ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_OBJECT | ADMINCMD_TARGET_NPC | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_ITEM)
{
destList.Push("map", "(<map name>|here) | (<sector name> <x> <y> <z>) [<instance>]");
size_t index = 1;
@@ -1690,7 +1694,7 @@
dest = words[index++];
// current word is not a default target
// but it might be 'map'
- if(dest == "map")
+ if (dest == "map")
{
// map target specified by map name
if (words.GetCount() == index + 1)
@@ -1753,16 +1757,16 @@
csString AdminCmdDataTeleport::GetHelpMessage()
{
- return "Syntax: \"" + command + " <subject> <destination>\"\n"
- "Subject : " + GetHelpMessagePartForTarget() + "\n"
- "Destination: me [<instance>]/target/<object name>/<NPC name>/<player name>/eid:<EID>/pid:<PID>/\n"
- " here [<instance>]/last/spawn/restore/map [<map name>|here] <x> <y> <z> [<instance>]\n"
- " there <instance>\n"
- " restore";
+ return "Syntax: \"" + command + " <subject> <destination>\"\n"
+ "Subject : " + GetHelpMessagePartForTarget() + "\n"
+ "Destination: me [<instance>]/target/<object name>/<NPC name>/<player name>/eid:<EID>/pid:<PID>/\n"
+ " here [<instance>]/last/spawn/restore/map [<map name>|here] <x> <y> <z> [<instance>]\n"
+ " there <instance>\n"
+ " restore";
}
AdminCmdDataSlide::AdminCmdDataSlide(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdDataTarget("/slide", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_NPC | ADMINCMD_TARGET_OBJECT | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_ITEM | ADMINCMD_TARGET_CLIENTTARGET)
+ : AdminCmdDataTarget("/slide", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_NPC | ADMINCMD_TARGET_OBJECT | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_ITEM | ADMINCMD_TARGET_CLIENTTARGET)
{
size_t index = 1;
bool found;
@@ -1792,12 +1796,12 @@
csString AdminCmdDataSlide::GetHelpMessage()
{
- return "Syntax: \"" + command + " " + GetHelpMessagePartForTarget() +
+ return "Syntax: \"" + command + " " + GetHelpMessagePartForTarget() +
" [direction] [distance]\nAllowed directions: U D L R F B T I";
}
AdminCmdDataChangeName::AdminCmdDataChangeName(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdDataTarget("/changename", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_CLIENTTARGET | ADMINCMD_TARGET_DATABASE), uniqueName(true), uniqueFirstName(true)
+ : AdminCmdDataTarget("/changename", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_CLIENTTARGET | ADMINCMD_TARGET_DATABASE), uniqueName(true), uniqueFirstName(true)
{
size_t index = 1;
bool found;
@@ -1859,12 +1863,12 @@
csString AdminCmdDataChangeName::GetHelpMessage()
{
- return "Syntax: \"" + command + " " + GetHelpMessagePartForTarget() +
+ return "Syntax: \"" + command + " " + GetHelpMessagePartForTarget() +
" [force|forceall] <NewName> [NewLastName]\"";
}
AdminCmdDataChangeGuildName::AdminCmdDataChangeGuildName(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdData("/changeguildname")
+ : AdminCmdData("/changeguildname")
{
// when help is requested, return immediate
if (IsHelp(words[1]))
@@ -1889,7 +1893,7 @@
}
AdminCmdDataChangeGuildLeader::AdminCmdDataChangeGuildLeader(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdDataTarget("/changeguildleader", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_CLIENTTARGET | ADMINCMD_TARGET_DATABASE)
+ : AdminCmdDataTarget("/changeguildleader", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_CLIENTTARGET | ADMINCMD_TARGET_DATABASE)
{
size_t index = 1;
bool found = false;
@@ -1923,7 +1927,7 @@
}
AdminCmdDataPetition::AdminCmdDataPetition(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdData("/petition")
+ : AdminCmdData("/petition")
{
// when help is requested, return immediate
if (IsHelp(words[1]))
@@ -1948,7 +1952,7 @@
}
AdminCmdDataImpersonate::AdminCmdDataImpersonate(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdDataTarget("/impersonate", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_CLIENTTARGET | ADMINCMD_TARGET_NPC | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_ITEM | ADMINCMD_TARGET_OBJECT)
+ : AdminCmdDataTarget("/impersonate", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_CLIENTTARGET | ADMINCMD_TARGET_NPC | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_ITEM | ADMINCMD_TARGET_OBJECT)
{
size_t index = 1;
bool found = false;
@@ -1959,7 +1963,7 @@
return;
// when first parameter a valid player name or 'target' or 'text'
- if(words[index] == "text")
+ if (words[index] == "text")
{
found = true;
target = words[index];
@@ -1975,21 +1979,23 @@
{
commandMod = words[index];
commandMod.Downcase();
- if ( commandMod == "say" || commandMod == "shout" || commandMod == "worldshout" )
- { // command mode (if supplied)
+ if (commandMod == "say" || commandMod == "shout" || commandMod == "worldshout")
+ {
+ // command mode (if supplied)
index++;
}
- else if(commandMod == "anim")
+ else if (commandMod == "anim")
{
index++;
//check if a duration is specified
- if(words.GetCount() > index + 1)
+ if (words.GetCount() > index + 1)
{
duration = words.GetInt(index++);
}
}
else
- { // default is to use say
+ {
+ // default is to use say
commandMod = "say";
}
text = words.GetTail(index);
@@ -2005,11 +2011,11 @@
csString AdminCmdDataImpersonate::GetHelpMessage()
{
return "Syntax: \"" + command + " [" + GetHelpMessagePartForTarget() + "] [say|shout|worldshout|anim] <text/[anim duration] anim name>\"\n"
- "If name is \"text\" the given text is used as it is.";
+ "If name is \"text\" the given text is used as it is.";
}
AdminCmdDataDeputize::AdminCmdDataDeputize(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdDataTarget("/deputize", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_CLIENTTARGET)
+ : AdminCmdDataTarget("/deputize", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_CLIENTTARGET)
{
size_t index = 1;
bool found = false;
@@ -2018,7 +2024,7 @@
if (IsHelp(words[1]))
return;
- // when first parameter a valid player name or 'target'
+ // when first parameter a valid player name or 'target'
if (ParseTarget(msgManager, me, msg, client, words[index]))
{
found = true;
@@ -2041,11 +2047,11 @@
csString AdminCmdDataDeputize::GetHelpMessage()
{
return "Syntax: \"" + command + " [" + GetHelpMessagePartForTarget() + "] reset|player|test|gm|developer\"\n"
- "Different gm levels can be attained by using gm1..gm5 instead of gm.";
+ "Different gm levels can be attained by using gm1..gm5 instead of gm.";
}
AdminCmdDataAward::AdminCmdDataAward(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdDataTarget("/award", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_EID |ADMINCMD_TARGET_CLIENTTARGET)
+ : AdminCmdDataTarget("/award", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_EID |ADMINCMD_TARGET_CLIENTTARGET)
{
size_t index = 1;
@@ -2072,11 +2078,11 @@
csString AdminCmdDataAward::GetHelpMessage()
{
return "Syntax: \"" + command + " [" + GetHelpMessagePartForTarget() + "] {REWARD}\"\n" +
- rewardList.GetHelpMessage();
+ rewardList.GetHelpMessage();
}
AdminCmdDataItemTarget::AdminCmdDataItemTarget(csString commandName, AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdDataTarget(commandName, ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA |ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_EID |ADMINCMD_TARGET_CLIENTTARGET), stackCount(0)
+ : AdminCmdDataTarget(commandName, ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA |ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_EID |ADMINCMD_TARGET_CLIENTTARGET), stackCount(0)
{
size_t index = 1;
bool found = false;
@@ -2085,7 +2091,7 @@
if (IsHelp(words[1]))
return;
- // when first parameter a valid player name or 'target'
+ // when first parameter a valid player name or 'target'
if (ParseTarget(msgManager, me, msg, client, words[index]))
{
found = true;
@@ -2128,13 +2134,13 @@
}
AdminCmdDataCheckItem::AdminCmdDataCheckItem(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdDataItemTarget("/checkitem", msgManager, me, msg, client, words)
+ : AdminCmdDataItemTarget("/checkitem", msgManager, me, msg, client, words)
{
/*
size_t index = 1;
bool found = false;
- // when first parameter a valid player name or 'target'
+ // when first parameter a valid player name or 'target'
if (ParseTarget(msgManager, me, msg, client, words[index]))
{
found = true;
@@ -2165,7 +2171,7 @@
}
AdminCmdDataSectorTarget::AdminCmdDataSectorTarget(csString commandName, AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdData(commandName), isClientSector(false), sectorInfo(NULL)
+ : AdminCmdData(commandName), isClientSector(false), sectorInfo(NULL)
{
// when help is requested, return immediate
if (IsHelp(words[1]))
@@ -2189,10 +2195,10 @@
// reset sector name
sectorName = "";
// when string to parse is not empty
- if(!target.IsEmpty())
+ if (!target.IsEmpty())
{
//if here was provided just get the sector of the client directly
- if(target == "here")
+ if (target == "here")
{
return GetSectorOfClient(client);
}
@@ -2201,7 +2207,7 @@
sectorName = target;
targetIsSector = true;
}
-
+
// when sectorinfo is not set, neither a sectorname was given
// nor the current client position revealed a sector
if (!sectorInfo)
@@ -2210,7 +2216,7 @@
sectorName = "";
return false;
}
-
+
return targetIsSector;
}
@@ -2232,7 +2238,7 @@
//csVector3 pos;
//client->GetActor()->GetPosition(pos,here);
- if(!here)
+ if (!here)
{
sectorName.Clear();
sectorInfo = NULL;
@@ -2248,7 +2254,7 @@
AdminCmdDataWeather::AdminCmdDataWeather(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdDataSectorTarget("/weather"), enabled(false)
+ : AdminCmdDataSectorTarget("/weather"), enabled(false)
{
size_t index = 1;
@@ -2258,7 +2264,7 @@
// try to parse the first word as a sector or find the current sector
// of client
- if(ParseTarget(msgManager, me, msg, client, words[index]))
+ if (ParseTarget(msgManager, me, msg, client, words[index]))
{
index++;
}
@@ -2272,10 +2278,10 @@
// if a sector was found
if (sectorInfo)
{
- if(words.GetCount() == index + 2)
+ if (words.GetCount() == index + 2)
{
-
- if(words[index] == "on")
+
+ if (words[index] == "on")
{
enabled = true;
}
@@ -2288,15 +2294,15 @@
ParseError(me, "State must be either on or off");
}
index++;
- if(words[index] == "rain")
+ if (words[index] == "rain")
{
type = psWeatherMessage::RAIN;
}
- else if(words[index] == "fog")
+ else if (words[index] == "fog")
{
type = psWeatherMessage::FOG;
}
- else if(words[index] == "snow")
+ else if (words[index] == "snow")
{
type = psWeatherMessage::SNOW;
}
@@ -2326,7 +2332,7 @@
}
AdminCmdDataWeatherEffect::AdminCmdDataWeatherEffect(csString commandName, AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdDataSectorTarget(commandName), enabled(false), particleCount(4000), interval(600000), fadeTime(10000)
+ : AdminCmdDataSectorTarget(commandName), enabled(false), particleCount(4000), interval(600000), fadeTime(10000)
{
size_t index = 1;
@@ -2336,7 +2342,7 @@
// try to parse the first word as a sector or find the current sector
// of client
- if(ParseTarget(msgManager, me, msg, client, words[1]))
+ if (ParseTarget(msgManager, me, msg, client, words[1]))
{
index++;
}
@@ -2362,7 +2368,7 @@
interval = words.GetInt(3);
fadeTime = words.GetInt(4);
}
- else if(words[index] == "start")
+ else if (words[index] == "start")
{
enabled = true;
}
@@ -2387,7 +2393,7 @@
}
AdminCmdDataFog::AdminCmdDataFog(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdDataSectorTarget("/fog"), enabled(false), density(200), fadeTime(10000), interval(600000), r(200), g(200), b(200)
+ : AdminCmdDataSectorTarget("/fog"), enabled(false), density(200), fadeTime(10000), interval(600000), r(200), g(200), b(200)
{
size_t index = 1;
@@ -2397,7 +2403,7 @@
// try to parse the first word as a sector or find the current sector
// of client
- if(ParseTarget(msgManager, me, msg, client, words[index]))
+ if (ParseTarget(msgManager, me, msg, client, words[index]))
{
index++;
}
@@ -2412,7 +2418,7 @@
if (sectorInfo)
{
//This turns off the fog.
- if (words.GetCount() == index+1 && (words[index] == "stop" || words[index] == "-1" ))
+ if (words.GetCount() == index+1 && (words[index] == "stop" || words[index] == "-1"))
{
enabled = false;
}
@@ -2426,7 +2432,7 @@
interval = words.GetInt(index++);
fadeTime = words.GetInt(index++);
}
- else if(words[index] == "start")
+ else if (words[index] == "start")
{
enabled = true;
}
@@ -2451,7 +2457,7 @@
}
AdminCmdDataModify::AdminCmdDataModify(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdDataTarget("/modify", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_ITEM | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_CLIENTTARGET), attributeList("pickupable unpickable transient npcowned collide settingitem pickupableweak")
+ : AdminCmdDataTarget("/modify", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_ITEM | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_CLIENTTARGET), attributeList("pickupable unpickable transient npcowned collide settingitem pickupableweak")
{
size_t index = 1;
bool found = false;
@@ -2460,7 +2466,7 @@
if (IsHelp(words[1]))
return;
- // when first word is a valid target
+ // when first word is a valid target
if (ParseTarget(msgManager, me, msg, client, words[index]))
{
found = true;
@@ -2495,11 +2501,11 @@
z = words.GetFloat(index++);
rot = words.GetFloat(index);
}
- else if(subCommand == "pickskill")
+ else if (subCommand == "pickskill")
{
skillName = words[index];
}
- else if(attributeList.IsSubCommand(subCommand))
+ else if (attributeList.IsSubCommand(subCommand))
{
if (words.GetCount() == index+1)
{
@@ -2523,7 +2529,7 @@
}
}
// everything else is a syntax error
- else if(subCommand != "remove")
+ else if (subCommand != "remove")
{
ParseError(me,"Invalid subcommand");
}
@@ -2540,18 +2546,18 @@
csString AdminCmdDataModify::GetHelpMessage()
{
return "Syntax: \"" + command + " " + GetHelpMessagePartForTarget() + " <SUBCOMMAND>\"\n"
- "SUBCOMMAND: intervals <interval> <intervalcap>\n"
- " amount <amount>\n"
- " level <level>\n"
- " range <range>\n"
- " move <x> <y> <z> [<y>]\n"
- " pickskill <skillname>\n"
- " ATTRIBUTE true|false\n"
- "ATTRIBUTE: " + attributeList.GetHelpMessage();
+ "SUBCOMMAND: intervals <interval> <intervalcap>\n"
+ " amount <amount>\n"
+ " level <level>\n"
+ " range <range>\n"
+ " move <x> <y> <z> [<y>]\n"
+ " pickskill <skillname>\n"
+ " ATTRIBUTE true|false\n"
+ "ATTRIBUTE: " + attributeList.GetHelpMessage();
}
AdminCmdDataMorph::AdminCmdDataMorph(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdDataTarget("/morph", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_CLIENTTARGET | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_EID)
+ : AdminCmdDataTarget("/morph", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_CLIENTTARGET | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_EID)
{
size_t index = 1;
bool found = false;
@@ -2560,21 +2566,21 @@
if (IsHelp(words[1]))
return;
- // when first word is a valid target
+ // when first word is a valid target
if (ParseTarget(msgManager, me, msg, client, words[index]))
{
found = true;
index++;
}
//always allow list whathever there is a target or not
- if(words.GetCount() == index + 1 && words[index] == "list")
+ if (words.GetCount() == index + 1 && words[index] == "list")
{
subCommand = words[index++];
if (words.GetCount() > index + 1)
ParseError(me, "Subcommand " + subCommand + " does not have any parameters");
}
// when first word is a target or the client has selected a target
- else if(words.GetCount() >= index + 1 && (found || (IsTargetType(ADMINCMD_TARGET_CLIENTTARGET))))
+ else if (words.GetCount() >= index + 1 && (found || (IsTargetType(ADMINCMD_TARGET_CLIENTTARGET))))
{
// test for a subcommand then
if (words[index] == "list" || words[index] == "reset")
@@ -2588,7 +2594,7 @@
raceName = words[index++];
//if there is another entry (specifying the gender)
//use it else use a default.
- if(words.GetCount() == index + 1)
+ if (words.GetCount() == index + 1)
{
genderName = words[index++];
}
@@ -2613,7 +2619,7 @@
}
AdminCmdDataSetSkill::AdminCmdDataSetSkill(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdDataTarget("/setskill", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_CLIENTTARGET), sourcePlayer(ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_NPC | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_CLIENTTARGET), subCommand(), skillData("",0,0,false)
+ : AdminCmdDataTarget("/setskill", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_CLIENTTARGET), sourcePlayer(ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_NPC | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_CLIENTTARGET), subCommand(), skillData("",0,0,false)
{
size_t index = 1;
bool found = false;
@@ -2622,7 +2628,7 @@
if (IsHelp(words[1]))
return;
- // when first word is a valid target
+ // when first word is a valid target
if (ParseTarget(msgManager, me, msg, client, words[index]))
{
found = true;
@@ -2631,7 +2637,7 @@
// when first word is a target or the client has selected a target
if (words.GetCount() == index + 2 && (found || IsTargetType(ADMINCMD_TARGET_CLIENTTARGET)))
{
- if (words[index] == "copy")
+ if (words[index] == "copy")
{
subCommand = words[index++];
// if parsing the word fails
@@ -2644,7 +2650,7 @@
ParseError(me,"No source given");
}
}
- }
+ }
else
{
skillData.skillName = words[index++];
@@ -2675,12 +2681,12 @@
csString AdminCmdDataSetSkill::GetHelpMessage()
{
return "Syntax: \"" + command + " [TARGET] <skillname>|'all' [+-]<value>\"\n"
- " or \"" + command + " [TARGET] copy <source>\"\n"
- "TARGET: " + GetHelpMessagePartForTarget();
+ " or \"" + command + " [TARGET] copy <source>\"\n"
+ "TARGET: " + GetHelpMessagePartForTarget();
}
AdminCmdDataSet::AdminCmdDataSet(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdDataTarget("/set", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_NPC | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_CLIENTTARGET | ADMINCMD_TARGET_ME), subCommandList("list gm player"), attributeList("invincible invincibility invisibility invisible viewall nevertired nofalldamage infiniteinventory questtester infinitemana instantcast givekillexp attackable buddyhide"), setting(AdminCmdOnOffToggleParser::ADMINCMD_SETTING_TOGGLE)
+ : AdminCmdDataTarget("/set", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_NPC | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_CLIENTTARGET | ADMINCMD_TARGET_ME), subCommandList("list gm player"), attributeList("invincible invincibility invisibility invisible viewall nevertired nofalldamage infiniteinventory questtester infinitemana instantcast givekillexp attackable buddyhide"), setting(AdminCmdOnOffToggleParser::ADMINCMD_SETTING_TOGGLE)
{
size_t index = 1;
bool found = false;
@@ -2689,14 +2695,14 @@
if (IsHelp(words[1]))
return;
- // when first word is a valid target
+ // when first word is a valid target
if (ParseTarget(msgManager, me, msg, client, words[index]))
{
found = true;
index++;
}
// when first word is a target or the client has selected a target
- if (words.GetCount() >= index + 1 && (found || (IsTargetType(ADMINCMD_TARGET_CLIENTTARGET))))
+ if (words.GetCount() >= index + 1 && (found || (IsTargetType(ADMINCMD_TARGET_CLIENTTARGET))))
{
// sub commands for doing meta stuff of the command
if (subCommandList.IsSubCommand(words[index]))
@@ -2727,7 +2733,7 @@
// not a subcommand or attribute
else
{
- ParseError(me, words[index] + " is not a supported attribute" );
+ ParseError(me, words[index] + " is not a supported attribute");
}
}
// no target -> syntax error
@@ -2742,12 +2748,12 @@
csString AdminCmdDataSet::GetHelpMessage()
{
return "Syntax: \"" + command + " " + subCommandList.GetHelpMessage() +
- "|" + attributeList.GetHelpMessage() + " [" +
- setting.GetHelpMessage() + "]\"";
+ "|" + attributeList.GetHelpMessage() + " [" +
+ setting.GetHelpMessage() + "]\"";
}
AdminCmdDataSetLabelColor::AdminCmdDataSetLabelColor(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdDataTarget("/setlabelcolor", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_CLIENTTARGET | ADMINCMD_TARGET_EID), labelTypeList("normal alive dead npc tester gm gm1 player")
+ : AdminCmdDataTarget("/setlabelcolor", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_CLIENTTARGET | ADMINCMD_TARGET_EID), labelTypeList("normal alive dead npc tester gm gm1 player")
{
size_t index = 1;
bool found = false;
@@ -2756,14 +2762,14 @@
if (IsHelp(words[1]))
return;
- // when first word is a valid target
+ // when first word is a valid target
if (ParseTarget(msgManager, me, msg, client, words[index]))
{
found = true;
index++;
}
// when first word is a target or the client has selected a target
- if (words.GetCount() >= index + 1 && (found || (IsTargetType(ADMINCMD_TARGET_CLIENTTARGET))))
+ if (words.GetCount() >= index + 1 && (found || (IsTargetType(ADMINCMD_TARGET_CLIENTTARGET))))
{
if (labelTypeList.IsSubCommand(words[index]))
{
@@ -2791,11 +2797,11 @@
csString AdminCmdDataSetLabelColor::GetHelpMessage()
{
return "Syntax: \"" + command + " " + GetHelpMessagePartForTarget() +
- " " + labelTypeList.GetHelpMessage() + "\"";
+ " " + labelTypeList.GetHelpMessage() + "\"";
}
AdminCmdDataAction::AdminCmdDataAction(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdDataSectorTarget("/action"), subCommandList("create_entrance")
+ : AdminCmdDataSectorTarget("/action"), subCommandList("create_entrance")
{
size_t index = 1;
@@ -2845,7 +2851,7 @@
AdminCmdDataPath::AdminCmdDataPath(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
: AdminCmdData("/path"), aliasSubCommandList("add remove rotation"), wpList("waypoints points"), subCmd(), defaultRadius(2.0),radius(0.0)
{
- // register sub commands with their extended help message
+ // register sub commands with their extended help message
subCommandList.Push("adjust","[<radius>]");
subCommandList.Push("alias", "[add|remove|rotation]<alias> [<rotation angle>] [<search radius>]");
subCommandList.Push("display","[points|waypoints]");
@@ -2887,7 +2893,7 @@
else if (subCmd == "alias")
{
aliasSubCmd = words[index++];
-
+
if (aliasSubCommandList.IsSubCommand(aliasSubCmd))
{
if (aliasSubCmd == "add")
@@ -2917,7 +2923,7 @@
ParseError(me,"Missing argument <alias>");
return;
}
-
+
if (!words.GetFloat(index++,rotationAngle))
{
ParseError(me,"Missing argument <rotation angle> or isn't a float value.");
@@ -2941,7 +2947,8 @@
if (words[index] == "waypoints")
{
cmdTarget = "W";
- } else
+ }
+ else
{
cmdTarget = "P";
}
@@ -2958,11 +2965,11 @@
csString wpOrPath = words[index++];
if (wpOrPath == "wp")
{
- wpOrPathIsWP = true;
+ wpOrPathIsWP = true;
}
else if (wpOrPath == "path")
{
- wpOrPathIsWP = false;
+ wpOrPathIsWP = false;
}
else
{
@@ -2983,7 +2990,8 @@
if (words[index] == "waypoints")
{
cmdTarget = "W";
- } else
+ }
+ else
{
cmdTarget = "P";
}
@@ -3014,18 +3022,20 @@
if (words.GetCount() <= index)
{
ParseError(me,"Expected either id or name.");
- } else if (words.GetInt(index,id)) // Is it an id?
+ }
+ else if (words.GetInt(index,id)) // Is it an id?
{
// We got an id
waypointPathIndex = id;
wpOrPathIsIndex = true;
- } else
+ }
+ else
{
// We got a name
waypointPathName = words[index];
wpOrPathIsIndex = false;
-
- if ( !wpOrPathIsWP )
+
+ if (!wpOrPathIsWP)
{
ParseError(me,"Name not supported for points.");
}
@@ -3042,7 +3052,7 @@
else if (subSubCmd == "add")
{
subCmd = "point add";
- }
+ }
else if (subSubCmd == "remove")
{
subCmd = "point remove";
@@ -3125,7 +3135,7 @@
}
AdminCmdDataLocation::AdminCmdDataLocation(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdData("/location")
+ : AdminCmdData("/location")
{
subCommandList.Push("add","<type> <name> <radius> [<rotation angle>]");
@@ -3180,13 +3190,13 @@
{
ParseError(me, "Required radius not given or not an float value.");
}
-
+
// Get optional rotation angle for this location.
if (!words.GetFloat(index++,rotAngle))
{
rotAngle = 0.0;
}
-
+
}
else if (subCommand == "display" || subCommand == "show")
{
@@ -3226,7 +3236,7 @@
else if (subSubCmd == "add")
{
subCommand = "type add";
- }
+ }
else if (subSubCmd == "delete" || subSubCmd == "remove")
{
subCommand = "type delete";
@@ -3236,7 +3246,7 @@
ParseError(me,"No type given.");
}
}
-
+
}
// first wird is not a valid subcommand
else
@@ -3257,7 +3267,7 @@
}
AdminCmdDataGameMasterEvent::AdminCmdDataGameMasterEvent(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdData("/event"), subCommandList("help list"), subCmd(), player(ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_CLIENTTARGET)
+ : AdminCmdData("/event"), subCommandList("help list"), subCmd(), player(ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_CLIENTTARGET)
{
// register subcommands along with their help message
subCommandList.Push("create","<name> <description>");
@@ -3291,7 +3301,7 @@
gmeventDesc = words.GetTail(index);
}
else
- // missing desc
+ // missing desc
{
ParseError(me, "Missing event description");
}
@@ -3324,7 +3334,7 @@
else if (subCmd == "reward")
{
// "/event reward [range # | all | [player_name]] <#> item"
-
+
if (words[index] == "all")
{
commandMod = words[index++];
@@ -3369,7 +3379,7 @@
if (player.ParseTarget(msgManager,me,msg,client,words[index]))
{
index++;
- }
+ }
else if (words.GetCount() >= index && !player.IsTargetType(ADMINCMD_TARGET_CLIENTTARGET))
{
ParseError(me, "Too many parameters for " + subCmd);
@@ -3410,7 +3420,7 @@
}
AdminCmdDataBadText::AdminCmdDataBadText(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdDataTarget("/badtext", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_NPC | ADMINCMD_TARGET_EID |ADMINCMD_TARGET_CLIENTTARGET)
+ : AdminCmdDataTarget("/badtext", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_NPC | ADMINCMD_TARGET_EID |ADMINCMD_TARGET_CLIENTTARGET)
{
size_t index = 1;
bool found;
@@ -3468,8 +3478,8 @@
}
AdminCmdDataQuest::AdminCmdDataQuest(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdDataTarget("/quest", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_CLIENTTARGET | ADMINCMD_TARGET_DATABASE),
- subCommandList("complete list discard assign")
+ : AdminCmdDataTarget("/quest", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_CLIENTTARGET | ADMINCMD_TARGET_DATABASE),
+ subCommandList("complete list discard assign")
{
size_t index = 1;
bool found;
@@ -3522,12 +3532,12 @@
csString AdminCmdDataQuest::GetHelpMessage()
{
- return "Syntax: \"" + command + " [" + subCommandList.GetHelpMessage() +
- "] [questname]\"\n";
+ return "Syntax: \"" + command + " [" + subCommandList.GetHelpMessage() +
+ "] [questname]\"\n";
}
AdminCmdDataSetQuality::AdminCmdDataSetQuality(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdDataTarget("/setquality", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_AREA |ADMINCMD_TARGET_ITEM | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_CLIENTTARGET)
+ : AdminCmdDataTarget("/setquality", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_AREA |ADMINCMD_TARGET_ITEM | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_CLIENTTARGET)
{
size_t index = 1;
bool found;
@@ -3579,7 +3589,7 @@
}
AdminCmdDataSetTrait::AdminCmdDataSetTrait(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdDataTarget("/settrait", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_CLIENTTARGET)
+ : AdminCmdDataTarget("/settrait", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_CLIENTTARGET)
{
size_t index = 1;
bool found;
@@ -3603,17 +3613,17 @@
{
race = words[index++];
csString gen = words[index++];
-
+
// parse the different gender types
- if(gen == "m" || gen == "male")
+ if (gen == "m" || gen == "male")
{
gender = PSCHARACTER_GENDER_MALE;
}
- else if(gen == "f" || gen == "female")
+ else if (gen == "f" || gen == "female")
{
gender = PSCHARACTER_GENDER_FEMALE;
}
- else if(gen == "n" || gen == "none")
+ else if (gen == "n" || gen == "none")
{
gender = PSCHARACTER_GENDER_NONE;
}
@@ -3640,7 +3650,7 @@
ParseError(me, "Not enough arguments for setting trait");
}
}
- else
+ else
{
ParseError(me, "Neither 'list' command invoked, nor target selected");
}
@@ -3650,13 +3660,13 @@
csString AdminCmdDataSetTrait::GetHelpMessage()
{
- return "Syntax: \"" + command + " [" + GetHelpMessagePartForTarget() +
- "] <trait>\"\n"
- + command + " list <race> <gender>";
+ return "Syntax: \"" + command + " [" + GetHelpMessagePartForTarget() +
+ "] <trait>\"\n"
+ + command + " list <race> <gender>";
}
AdminCmdDataSetItem::AdminCmdDataSetItem(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdDataTarget("/setitemname", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_ITEM | ADMINCMD_TARGET_EID |ADMINCMD_TARGET_CLIENTTARGET)
+ : AdminCmdDataTarget("/setitemname", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_ITEM | ADMINCMD_TARGET_EID |ADMINCMD_TARGET_CLIENTTARGET)
{
size_t index = 1;
@@ -3708,7 +3718,7 @@
}
AdminCmdDataReload::AdminCmdDataReload(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdData("/reload"), itemID(0)
+ : AdminCmdData("/reload"), itemID(0)
{
subCommandList.Push("item","<itemID> - reloads the specified item");
subCommandList.Push("serveroptions","#Reload all the server options");
@@ -3718,15 +3728,15 @@
size_t index = 1;
// when help is requested, return immediate
- if(IsHelp(words[1]))
+ if (IsHelp(words[1]))
return;
- if(words.GetCount() > index && subCommandList.IsSubCommand(words[index]))
+ if (words.GetCount() > index && subCommandList.IsSubCommand(words[index]))
{
subCmd = words[index++];
}
- if(subCmd == "item")
+ if (subCmd == "item")
{
itemID = words.GetInt(index++);
if (itemID == 0)
@@ -3735,7 +3745,7 @@
}
}
- if(words.GetCount() > index)
+ if (words.GetCount() > index)
{
ParseError(me, "Too many arguments");
}
@@ -3749,7 +3759,7 @@
}
AdminCmdDataListWarnings::AdminCmdDataListWarnings(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdDataTarget("/listwarnings", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_CLIENTTARGET | ADMINCMD_TARGET_DATABASE)
+ : AdminCmdDataTarget("/listwarnings", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_CLIENTTARGET | ADMINCMD_TARGET_DATABASE)
{
size_t index = 1;
bool found;
@@ -3777,7 +3787,7 @@
}
AdminCmdDataDisableQuest::AdminCmdDataDisableQuest(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdData("/disablequest")
+ : AdminCmdData("/disablequest")
{
size_t index = 1;
@@ -3807,7 +3817,7 @@
}
AdminCmdDataSetKillExp::AdminCmdDataSetKillExp(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
- : AdminCmdDataTarget("/setkillexp", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_CLIENTTARGET)
+ : AdminCmdDataTarget("/setkillexp", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_CLIENTTARGET)
{
size_t index = 1;
bool found;
@@ -3850,32 +3860,32 @@
}
AdminCmdDataAssignFaction::AdminCmdDataAssignFaction(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdDataTarget("/assignfaction", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_CLIENTTARGET)
+ : AdminCmdDataTarget("/assignfaction", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_CLIENTTARGET)
{
size_t index = 1;
bool found;
// when help is requested, return immediate
- if(IsHelp(words[1]))
+ if (IsHelp(words[1]))
return;
// try to parse first word as a target
- if((found = ParseTarget(msgManager, me, msg, client, words[index])))
+ if ((found = ParseTarget(msgManager, me, msg, client, words[index])))
{
index++;
}
// when first word is a target or the client target has a valid target
- if(found || IsTargetType(ADMINCMD_TARGET_CLIENTTARGET))
+ if (found || IsTargetType(ADMINCMD_TARGET_CLIENTTARGET))
{
// two required arguments
- if(words.GetCount() == index + 2)
+ if (words.GetCount() == index + 2)
{
factionName = words[index++];
factionPoints = words.GetInt(index++);
}
// otherwise too long/short
- else if(words.GetCount() < index + 2)
+ else if (words.GetCount() < index + 2)
{
ParseError(me, "Not enough arguments");
}
@@ -3899,7 +3909,7 @@
}
AdminCmdDataServerQuit::AdminCmdDataServerQuit(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdData("/serverquit")
+ : AdminCmdData("/serverquit")
{
// when help is requested, return immediate
if (IsHelp(words[1]))
@@ -3910,7 +3920,7 @@
{
time = words.GetInt(index++);
//optional parameter
- if(words.GetCount() == index + 1)
+ if (words.GetCount() == index + 1)
reason = words.GetTail(index);
}
else
@@ -3927,7 +3937,7 @@
}
AdminCmdDataNPCClientQuit::AdminCmdDataNPCClientQuit(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words)
-: AdminCmdData("/npcclientquit")
+ : AdminCmdData("/npcclientquit")
{
// when help is requested, return immediate
if (IsHelp(words[1]))
@@ -3957,7 +3967,7 @@
}
AdminCmdDataRndMsgTest::AdminCmdDataRndMsgTest(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage& msg, Client *client, WordArray &words)
-: AdminCmdData("/rndmsgtest")
+ : AdminCmdData("/rndmsgtest")
{
size_t index = 1;
@@ -3987,7 +3997,7 @@
}
AdminCmdDataList::AdminCmdDataList(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage& msg, Client *client, WordArray &words)
-: AdminCmdData("/list"), subCommandList("map")
+ : AdminCmdData("/list"), subCommandList("map")
{
size_t index = 1;
@@ -4010,9 +4020,9 @@
AdminCmdDataTime::AdminCmdDataTime(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage& msg, Client *client, WordArray &words)
-: AdminCmdData("/time")
+ : AdminCmdData("/time")
{
- // register sub commands with their extended help message
+ // register sub commands with their extended help message
subCommandList.Push("show","#Show the current game time");
subCommandList.Push("set","<hour> <minutes>");
@@ -4096,7 +4106,7 @@
RegisterMsgFactoryFunction(new AdminCmdDataDeputize());
RegisterMsgFactoryFunction(new AdminCmdDataAward());
- RegisterMsgFactoryFunction(new AdminCmdDataItemTarget("/giveitem"));
+ RegisterMsgFactoryFunction(new AdminCmdDataItemTarget("/giveitem"));
RegisterMsgFactoryFunction(new AdminCmdDataItemTarget("/takeitem"));
RegisterMsgFactoryFunction(new AdminCmdDataCheckItem());
RegisterMsgFactoryFunction(new AdminCmdDataSectorTarget("/thunder"));
@@ -4148,7 +4158,7 @@
RegisterMsgFactoryFunction(new AdminCmdDataTarget("/info", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_OBJECT | ADMINCMD_TARGET_NPC | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_ITEM | ADMINCMD_TARGET_CLIENTTARGET | ADMINCMD_TARGET_DATABASE));
RegisterMsgFactoryFunction(new AdminCmdDataTarget("/charlist", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_NPC | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_CLIENTTARGET | ADMINCMD_TARGET_DATABASE));
RegisterMsgFactoryFunction(new AdminCmdDataTarget("/inspect", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_NPC | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_CLIENTTARGET));
- RegisterMsgFactoryFunction(new AdminCmdDataTarget("/npc", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_NPC ));
+ RegisterMsgFactoryFunction(new AdminCmdDataTarget("/npc", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_NPC));
//has got its own class (but this is not really needed yet)
// RegisterMsgFactoryFunction(new AdminCmdDataTarget("/setstackable", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_ITEM | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_CLIENTTARGET)); //natoka: actually here is a need for ADMIN_TARGET_ITEM
RegisterMsgFactoryFunction(new AdminCmdDataTarget("/divorce", ADMINCMD_TARGET_TARGET | ADMINCMD_TARGET_PID | ADMINCMD_TARGET_AREA | ADMINCMD_TARGET_ME | ADMINCMD_TARGET_PLAYER | ADMINCMD_TARGET_EID | ADMINCMD_TARGET_CLIENTTARGET));
@@ -4197,7 +4207,7 @@
// this makes sure that the player dictionary exists on start up.
npcdlg = new psNPCDialog(NULL);
- npcdlg->Initialize( db );
+ npcdlg->Initialize(db);
locations = new LocationManager();
locations->Load(EntityManager::GetSingleton().GetEngine(),db);
@@ -4231,7 +4241,7 @@
return command.Slice(command.FindFirst(' ')+1,8) == "me reset";
}
-//TODO: To be expanded to make the implementation better than how it is now
+//TODO: To be expanded to make the implementation better than how it is now
// when an NPC issues an admin command
void AdminManager::HandleNpcCommand(MsgEntry *pMsg, Client *client)
{
@@ -4242,7 +4252,7 @@
{
AdminCmdData* data;
psAdminCmdMessage msg(me);
- WordArray words (msg.cmd, false);
+ WordArray words(msg.cmd, false);
// retrieve command data factory for this command
data = dataFactory->FindFactory(words[0]);
@@ -4250,11 +4260,11 @@
// unknown admin command encountered (should not happen)
if (!data)
{
- csString info ("\"" + words[0] + "\" not registered admin command");
+ csString info("\"" + words[0] + "\" not registered admin command");
psserver->SendSystemInfo(me->clientnum,info.GetDataSafe());
return;
}
-
+
// Decode the string from the message into a struct with data elements
data = data->CreateCmdData(this,me,msg,client,words);
if (!data->valid)
@@ -4265,7 +4275,7 @@
}
// Security check
- if ( me->clientnum != 0 && !IsReseting(msg.cmd) && !psserver->CheckAccess(client, data->command))
+ if (me->clientnum != 0 && !IsReseting(msg.cmd) && !psserver->CheckAccess(client, data->command))
return;
if (data->help || !data->valid)
@@ -4276,7 +4286,7 @@
if (me->clientnum)
{
- data->LogGMCommand( client, msg.cmd );
+ data->LogGMCommand(client, msg.cmd);
}
//This will not show anything on client side because for example in area commands
@@ -4285,7 +4295,7 @@
//If this has to behave differently (for example area commands should be dispatched)
//override the function.
- if(data->IsQuietInvalid())
+ if (data->IsQuietInvalid())
{
return;
}
@@ -4382,11 +4392,11 @@
{
KickPlayer(me, msg, data, client);
}
- else if (data->command == "/death" )
+ else if (data->command == "/death")
{
Death(me, msg, data, client);
}
- else if (data->command == "/impersonate" )
+ else if (data->command == "/impersonate")
{
Impersonate(me, msg, data, client);
}
@@ -4394,59 +4404,59 @@
{
TempSecurityLevel(me, msg, data, client);
}
- else if (data->command == "/deletechar" )
+ else if (data->command == "/deletechar")
{
- DeleteCharacter( me, msg, data, client );
+ DeleteCharacter(me, msg, data, client);
}
- else if (data->command == "/changename" )
+ else if (data->command == "/changename")
{
- ChangeName( me, msg, data, client);
+ ChangeName(me, msg, data, client);
}
else if (data->command == "/changeguildname")
{
- RenameGuild( me, msg, data, client );
+ RenameGuild(me, msg, data, client);
}
else if (data->command == "/changeguildleader")
{
- ChangeGuildLeader( me, msg, data, client );
+ ChangeGuildLeader(me, msg, data, client);
}
- else if (data->command == "/banname" )
+ else if (data->command == "/banname")
{
- BanName( me, msg, data, client );
+ BanName(me, msg, data, client);
}
- else if (data->command == "/unbanname" )
+ else if (data->command == "/unbanname")
{
- UnBanName( me, msg, data, client );
+ UnBanName(me, msg, data, client);
}
- else if (data->command == "/ban" )
+ else if (data->command == "/ban")
{
- BanClient( me, msg, data, client );
+ BanClient(me, msg, data, client);
}
- else if (data->command == "/unban" )
+ else if (data->command == "/unban")
{
- UnbanClient( me, msg, data, client );
+ UnbanClient(me, msg, data, client);
}
- else if (data->command == "/banadvisor" )
+ else if (data->command == "/banadvisor")
{
- BanAdvisor( me, msg, data, client );
+ BanAdvisor(me, msg, data, client);
}
- else if (data->command == "/unbanadvisor" )
+ else if (data->command == "/unbanadvisor")
{
- UnbanAdvisor( me, msg, data, client );
+ UnbanAdvisor(me, msg, data, client);
}
- else if (data->command == "/award" )
+ else if (data->command == "/award")
{
Award(data, client);
}
- else if (data->command == "/giveitem" )
+ else if (data->command == "/giveitem")
{
TransferItem(me, msg, data, client);
}
- else if (data->command == "/takeitem" )
+ else if (data->command == "/takeitem")
{
TransferItem(me, msg, data, client);
}
- else if (data->command == "/checkitem" )
+ else if (data->command == "/checkitem")
{
CheckItem(me, msg, data);
}
@@ -4462,7 +4472,7 @@
{
Inspect(me, msg, data, client);
}
- else if ( data->command == "/updaterespawn")
+ else if (data->command == "/updaterespawn")
{
UpdateRespawn(data, client);
}
@@ -4514,7 +4524,7 @@
{
HandleBadText(msg, data, client);
}
- else if ( data->command == "/loadquest" )
+ else if (data->command == "/loadquest")
{
HandleLoadQuest(msg, data, client);
}
@@ -4584,7 +4594,7 @@
}
if (data)
delete data;
-}
+}
void AdminManager::HandleList(MsgEntry* me, psAdminCmdMessage& msg, AdminCmdData* cmddata,Client *client)
{
@@ -4610,7 +4620,8 @@
pos = next +1;
// find next delimiter (= end of map)
next = mapnames.FindFirst('|',pos);
- } while (next < mapnames.Length());
+ }
+ while (next < mapnames.Length());
}
void AdminManager::HandleTime(MsgEntry* me, psAdminCmdMessage& msg, AdminCmdData* cmddata,Client *client)
@@ -4655,12 +4666,12 @@
questID = result[0].GetInt("id");
}
- if(!psserver->GetCacheManager()->UnloadQuest(questID))
+ if (!psserver->GetCacheManager()->UnloadQuest(questID))
psserver->SendSystemError(client->GetClientNum(), "Quest <%s> Could not be unloaded", data->questName.GetData());
else
psserver->SendSystemError(client->GetClientNum(), "Quest <%s> unloaded", data->questName.GetData());
- if(!psserver->GetCacheManager()->LoadQuest(questID))
+ if (!psserver->GetCacheManager()->LoadQuest(questID))
{
psserver->SendSystemError(client->GetClientNum(), "Quest <%s> Could not be loaded", data->questName.GetData());
psserver->SendSystemError(client->GetClientNum(), psserver->questmanager->LastError());
@@ -4681,14 +4692,14 @@
return;
}
- if(data->targetObject && !data->targetObject->GetCharacterData()) //no need to go on this isn't an npc or pc characther (most probably an item)
+ if (data->targetObject && !data->targetObject->GetCharacterData()) //no need to go on this isn't an npc or pc characther (most probably an item)
{
psserver->SendSystemError(me->clientnum,"Charlist can be used only on Player or NPC characters");
return;
}
AccountID accountId = data->GetAccountID(me->clientnum);
- if(data->duplicateActor) //we found more than one result so let's alert the user
+ if (data->duplicateActor) //we found more than one result so let's alert the user
{
psserver->SendSystemInfo(client->GetClientNum(), "Player name isn't unique. It's suggested to use pid.");
}
@@ -4700,15 +4711,15 @@
if (result2.IsValid() && result2.Count())
{
- psserver->SendSystemInfo( client->GetClientNum(), "Characters on this account:" );
+ psserver->SendSystemInfo(client->GetClientNum(), "Characters on this account:");
for (int i = 0; i < (int)result2.Count(); i++)
{
iResultRow& row = result2[i];
psserver->SendSystemInfo(client->GetClientNum(), "Player ID: %d, %s %s, last login: %s",
- row.GetUInt32("id"), row["name"], row["lastname"], row["last_login"] );
+ row.GetUInt32("id"), row["name"], row["lastname"], row["last_login"]);
}
}
- else if ( !result2.Count() )
+ else if (!result2.Count())
{
psserver->SendSystemInfo(me->clientnum, "There are no characters on this account.");
}
@@ -4734,7 +4745,7 @@
float loc_x = 0.0f, loc_y = 0.0f, loc_z = 0.0f, loc_yrot = 0.0f;
int degrees = 0;
- if ( data->targetObject ) //If the target is online or is an item or action location get some data about it like position and eid
+ if (data->targetObject) //If the target is online or is an item or action location get some data about it like position and eid
{
entityId = data->targetObject->GetEID();
csVector3 pos;
@@ -4744,12 +4755,12 @@
loc_x = pos.x;
loc_y = pos.y;
loc_z = pos.z;
- degrees = (int)(loc_yrot * 180 / PI );
+ degrees = (int)(loc_yrot * 180 / PI);
instance = data->targetObject->GetInstance();
sectorName = (sector) ? sector->QueryObject()->GetName() : "(null)";
-
+
regionName = (sector) ? sector->QueryObject()->GetObjectParent()->GetName() : "(null)";
}
@@ -4782,78 +4793,78 @@
return;
}
- if ( data->targetObject && data->targetObject->GetItem() && data->targetObject->GetItem()->GetBaseStats() ) // Item
+ if (data->targetObject && data->targetObject->GetItem() && data->targetObject->GetItem()->GetBaseStats()) // Item
{
- psItem* item = data->targetObject->GetItem();
+ psItem* item = data->targetObject->GetItem();
- csString info;
- info.Format("Item: %s ", item->GetName() );
+ csString info;
+ info.Format("Item: %s ", item->GetName());
- if ( item->GetStackCount() > 1 )
- info.AppendFmt("(x%d) ", item->GetStackCount() );
+ if (item->GetStackCount() > 1)
+ info.AppendFmt("(x%d) ", item->GetStackCount());
- info.AppendFmt("with item stats ID %u, item ID %u, and %s, is at region %s, position (%1.2f, %1.2f, %1.2f) "
- "angle: %d in sector: %s, instance: %d",
- item->GetBaseStats()->GetUID(),
- item->GetUID(),
- ShowID(entityId),
- regionName.GetData(),
- loc_x, loc_y, loc_z, degrees,
- sectorName.GetData(),
- instance);
+ info.AppendFmt("with item stats ID %u, item ID %u, and %s, is at region %s, position (%1.2f, %1.2f, %1.2f) "
+ "angle: %d in sector: %s, instance: %d",
+ item->GetBaseStats()->GetUID(),
+ item->GetUID(),
+ ShowID(entityId),
+ regionName.GetData(),
+ loc_x, loc_y, loc_z, degrees,
+ sectorName.GetData(),
+ instance);
- if ( item->GetScheduledItem() )
- info.AppendFmt(", spawns with interval %d + %d max modifier",
- item->GetScheduledItem()->GetInterval(),
- item->GetScheduledItem()->GetMaxModifier() );
+ if (item->GetScheduledItem())
+ info.AppendFmt(", spawns with interval %d + %d max modifier",
+ item->GetScheduledItem()->GetInterval(),
+ item->GetScheduledItem()->GetMaxModifier());
- // Get all flags on this item
- int flags = item->GetFlags();
- if (flags)
- {
- info += ", has flags:";
+ // Get all flags on this item
+ int flags = item->GetFlags();
+ if (flags)
+ {
+ info += ", has flags:";
- if ( flags & PSITEM_FLAG_CRAFTER_ID_IS_VALID )
- info += " 'valid crafter id'";
- if ( flags & PSITEM_FLAG_GUILD_ID_IS_VALID )
- info += " 'valid guild id'";
- if ( flags & PSITEM_FLAG_UNIQUE_ITEM )
- info += " 'unique'";
- if ( flags & PSITEM_FLAG_USES_BASIC_ITEM )
- info += " 'uses basic item'";
- if ( flags & PSITEM_FLAG_PURIFIED )
- info += " 'purified'";
- if ( flags & PSITEM_FLAG_PURIFYING )
- info += " 'purifying'";
- if ( flags & PSITEM_FLAG_LOCKED )
- info += " 'locked'";
- if ( flags & PSITEM_FLAG_LOCKABLE )
- info += " 'lockable'";
- if ( flags & PSITEM_FLAG_SECURITYLOCK )
- info += " 'lockable'";
- if ( flags & PSITEM_FLAG_UNPICKABLE )
- info += " 'unpickable'";
- if ( flags & PSITEM_FLAG_NOPICKUP )
- info += " 'no pickup'";
- if(flags & PSITEM_FLAG_NOPICKUPWEAK)
- info += " 'no pickup weak'";
- if ( flags & PSITEM_FLAG_KEY )
- info += " 'key'";
- if ( flags & PSITEM_FLAG_MASTERKEY )
- info += " 'masterkey'";
- if ( flags & PSITEM_FLAG_TRANSIENT )
- info += " 'transient'";
- if ( flags & PSITEM_FLAG_USE_CD)
- info += " 'collide'";
- if ( flags & PSITEM_FLAG_SETTINGITEM)
- info += " 'settingitem'";
- if ( flags & PSITEM_FLAG_NPCOWNED)
- info += " 'npcowned'";
- }
+ if (flags & PSITEM_FLAG_CRAFTER_ID_IS_VALID)
+ info += " 'valid crafter id'";
+ if (flags & PSITEM_FLAG_GUILD_ID_IS_VALID)
+ info += " 'valid guild id'";
+ if (flags & PSITEM_FLAG_UNIQUE_ITEM)
+ info += " 'unique'";
+ if (flags & PSITEM_FLAG_USES_BASIC_ITEM)
+ info += " 'uses basic item'";
+ if (flags & PSITEM_FLAG_PURIFIED)
+ info += " 'purified'";
+ if (flags & PSITEM_FLAG_PURIFYING)
+ info += " 'purifying'";
+ if (flags & PSITEM_FLAG_LOCKED)
+ info += " 'locked'";
+ if (flags & PSITEM_FLAG_LOCKABLE)
+ info += " 'lockable'";
+ if (flags & PSITEM_FLAG_SECURITYLOCK)
+ info += " 'lockable'";
+ if (flags & PSITEM_FLAG_UNPICKABLE)
+ info += " 'unpickable'";
+ if (flags & PSITEM_FLAG_NOPICKUP)
+ info += " 'no pickup'";
+ if (flags & PSITEM_FLAG_NOPICKUPWEAK)
+ info += " 'no pickup weak'";
+ if (flags & PSITEM_FLAG_KEY)
+ info += " 'key'";
+ if (flags & PSITEM_FLAG_MASTERKEY)
+ info += " 'masterkey'";
+ if (flags & PSITEM_FLAG_TRANSIENT)
+ info += " 'transient'";
+ if (flags & PSITEM_FLAG_USE_CD)
+ info += " 'collide'";
+ if (flags & PSITEM_FLAG_SETTINGITEM)
+ info += " 'settingitem'";
+ if (flags & PSITEM_FLAG_NPCOWNED)
+ info += " 'npcowned'";
+ }
- psserver->SendSystemInfo(client->GetClientNum(),info);
- return; // Done
+ psserver->SendSystemInfo(client->GetClientNum(),info);
+ return; // Done
}
char ipaddr[20] = {0};
@@ -4923,25 +4934,25 @@
dist = EntityManager::GetSingleton().GetWorld()->Distance(pos, sector, myPos, mySector);
}
-
+
psserver->SendSystemInfo(client->GetClientNum(),
- "NPC: <%s, %s, %s> is at region %s, position (%1.2f, %1.2f, %1.2f) at range %.2f "
- "angle: %d in sector: %s, instance: %d%s%s.",
- name.GetData(),
- ShowID(playerId),
- ShowID(entityId),
- regionName.GetData(),
- loc_x,
- loc_y,
- loc_z,
- dist,
- degrees,
- sectorName.GetData(),
- instance,
- npcChar->GetImperviousToAttack()&ALWAYS_IMPERVIOUS?", is always impervious":"",
- npcChar->GetImperviousToAttack()&TEMPORARILY_IMPERVIOUS?", is temp impervious":""
- );
+ "NPC: <%s, %s, %s> is at region %s, position (%1.2f, %1.2f, %1.2f) at range %.2f "
+ "angle: %d in sector: %s, instance: %d%s%s.",
+ name.GetData(),
+ ShowID(playerId),
+ ShowID(entityId),
+ regionName.GetData(),
+ loc_x,
+ loc_y,
+ loc_z,
+ dist,
+ degrees,
+ sectorName.GetData(),
+ instance,
+ npcChar->GetImperviousToAttack()&ALWAYS_IMPERVIOUS?", is always impervious":"",
+ npcChar->GetImperviousToAttack()&TEMPORARILY_IMPERVIOUS?", is temp impervious":""
+ );
if (client->GetSecurityLevel() >= GM_LEVEL_0)
{
@@ -4961,54 +4972,54 @@
if (!pid.IsValid())
{
- psserver->SendSystemError(client->GetClientNum(), "%s is invalid!",data->target.GetData() );
- return;
+ psserver->SendSystemError(client->GetClientNum(), "%s is invalid!",data->target.GetData());
+ return;
}
result = db->Select("SELECT c.id as 'id', c.name as 'name', lastname, account_id, time_connected_sec, loc_instance, "
- "s.name as 'sector', loc_x, loc_y, loc_z, loc_yrot, advisor_ban from characters c join sectors s on s.id = loc_sector_id "
- "join accounts a on a.id = account_id where c.id=%u", pid.Unbox());
+ "s.name as 'sector', loc_x, loc_y, loc_z, loc_yrot, advisor_ban from characters c join sectors s on s.id = loc_sector_id "
+ "join accounts a on a.id = account_id where c.id=%u", pid.Unbox());
}
else
{
result = db->Select("SELECT c.id as 'id', c.name as 'name', lastname, account_id, time_connected_sec, loc_instance, "
- "s.name as 'sector', loc_x, loc_y, loc_z, loc_yrot, advisor_ban from characters c join sectors s on s.id = loc_sector_id "
- "join accounts a on a.id = account_id where c.name='%s'", data->target.GetData());
+ "s.name as 'sector', loc_x, loc_y, loc_z, loc_yrot, advisor_ban from characters c join sectors s on s.id = loc_sector_id "
+ "join accounts a on a.id = account_id where c.name='%s'", data->target.GetData());
}
if (!result.IsValid() || result.Count() == 0)
{
- psserver->SendSystemError(client->GetClientNum(), "Cannot find player %s",data->target.GetData() );
- return;
+ psserver->SendSystemError(client->GetClientNum(), "Cannot find player %s",data->target.GetData());
+ return;
}
else
{
- iResultRow& row = result[0];
- name = row["name"];
- if (row["lastname"] && strcmp(row["lastname"],""))
- {
- name.Append(" ");
- name.Append(row["lastname"]);
- }
- playerId = PID(row.GetUInt32("id"));
- accountId = AccountID(row.GetUInt32("account_id"));
- ipAddress = "(offline)";
- timeConnected = row.GetFloat("time_connected_sec") / 3600;
- securityLevel.Format("%d",GetTrueSecurityLevel(accountId));
- sectorName = row["sector"];
- instance = row.GetUInt32("loc_instance");
- loc_x = row.GetFloat("loc_x");
- loc_y = row.GetFloat("loc_y");
- loc_z = row.GetFloat("loc_z");
- loc_yrot = row.GetFloat("loc_yrot");
- advisorBanned = row.GetUInt32("advisor_ban") != 0;
+ iResultRow& row = result[0];
+ name = row["name"];
+ if (row["lastname"] && strcmp(row["lastname"],""))
+ {
+ name.Append(" ");
+ name.Append(row["lastname"]);
+ }
+ playerId = PID(row.GetUInt32("id"));
+ accountId = AccountID(row.GetUInt32("account_id"));
+ ipAddress = "(offline)";
+ timeConnected = row.GetFloat("time_connected_sec") / 3600;
+ securityLevel.Format("%d",GetTrueSecurityLevel(accountId));
+ sectorName = row["sector"];
+ instance = row.GetUInt32("loc_instance");
+ loc_x = row.GetFloat("loc_x");
+ loc_y = row.GetFloat("loc_y");
+ loc_z = row.GetFloat("loc_z");
+ loc_yrot = row.GetFloat("loc_yrot");
+ advisorBanned = row.GetUInt32("advisor_ban") != 0;
}
}
BanEntry* ban = psserver->GetAuthServer()->GetBanManager()->GetBanByAccount(accountId);
- if(ban)
+ if (ban)
{
time_t now = time(0);
- if(ban->end > now)
+ if (ban->end > now)
{
BanReason = ban->reason;
banTimeLeft = ban->end - now;
@@ -5027,10 +5038,10 @@
if (playerId.IsValid())
{
csString info;
- info.Format("Player: %s has ", name.GetData() );
+ info.Format("Player: %s has ", name.GetData());
@@ Diff output truncated at 100000 characters. @@
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|