Index: mangos/src/mangosd/CliRunnable.cpp =================================================================== --- mangos/src/mangosd/CliRunnable.cpp (revision 5244) +++ mangos/src/mangosd/CliRunnable.cpp (working copy) @@ -71,33 +71,46 @@ const CliCommand Commands[]= { {"help", & CliHelp,"Display this help message"}, - {"broadcast", & CliBroadcast,"Announce in-game message"}, + +// Serverside broadcasts/messages + {"broadcast", & CliBroadcast,"Send ingame announcement/message"}, + {"send", &CliSend,"Send message to player"}, + +// Server-related commands + {"info", & CliInfo,"Display server information"}, + {"motd", & CliMotd,"Change or display motd"}, + {"uptime", & CliUpTime, "Displays the server uptime"}, + {"version", & CliVersion,"Display server version"}, + {"setloglevel", & CliSetLogLevel,"Set loglevel"}, + {"loadscripts", & CliLoadScripts,"Load script library"}, + {"plimit", &CliPLimit,"Show (or set) player login limitations"} + +// Account management {"create", & CliCreate,"Create account"}, - {"delete", & CliDelete,"Delete account and characters"}, - {"info", & CliInfo,"Display Server infomation"}, - {"uptime", & CliUpTime, "Displays the server uptime"}, - {"motd", & CliMotd,"Change or display motd"}, + {"delete", & CliDelete,"Delete account (and characters)"}, + {"setbc", & CliSetTBC,"Set user expansion allowed"}, + {"setpass", & CliSetPassword,"Set password for account"}, + {"setgm", & CliSetGM,"Edit user privileges"}, + {"listgm", & CliListGM,"Display user privileges"}, + {"tele", &CliTele,"Teleport player to location"}, + +// Access-related commands {"kick", & CliKick,"Kick user"}, {"ban", & CliBan,"Ban account|ip"}, + {"unban", & CliRemoveBan,"Remove ban from account|ip"}, {"listbans", & CliBanList,"List bans"}, - {"unban", & CliRemoveBan,"Remove ban from account|ip"}, - {"setgm", & CliSetGM,"Edit user privileges"}, - {"setpass", & CliSetPassword,"Set password for account"}, - {"setbc", & CliSetTBC,"Set user expansion allowed"}, - {"listgm", & CliListGM,"Display user privileges"}, - {"loadscripts", & CliLoadScripts,"Load script library"}, - {"setloglevel", & CliSetLogLevel,"Set Log Level"}, - {"corpses", & CliCorpses,"Manually call corpses erase global even code"}, - {"version", & CliVersion,"Display server version"}, - {"idleshutdown", & CliIdleShutdown,"Shutdown server with some delay when not active connections at server"}, - {"shutdown", & CliShutdown,"Shutdown server with some delay"}, - {"exit", & CliExit,"Shutdown server NOW"}, + +// Misc {"writepdump", &CliWritePlayerDump,"Write a player dump to a file"}, {"loadpdump", &CliLoadPlayerDump,"Load a player dump from a file"}, {"saveall", &CliSave,"Save all players"}, - {"send", &CliSend,"Send message to a player"}, - {"tele", &CliTele,"Teleport player to location"}, - {"plimit", &CliPLimit,"Show or set player login limitations"} + {"corpses", & CliCorpses,"Manually call corpses erase global even code"}, + +// Shutdown-commands + {"idleshutdown", & CliIdleShutdown,"Shutdown server (with some delay) when no active connections exists"}, + {"shutdown", & CliShutdown,"Shutdown server (with possible delay)"}, + {"exit", & CliExit,"Shutdown server NOW"}, + }; /// \todo Need some pragma pack? Else explain why in a comment. #define CliTotalCmds sizeof(Commands)/sizeof(CliCommand) @@ -128,9 +141,9 @@ char * name = strtok(NULL, " "); char * guid = name ? strtok(NULL, " ") : NULL; if(objmgr.LoadPlayerDump(file, atoi(acc), name ? name : "", guid ? atoi(guid) : 0)) - zprintf("Character loaded successfully!"); + zprintf("Character load completed"); else - zprintf("Failed to load the character!"); + zprintf("Character load failed"); } /// Reload the scripts and notify the players @@ -160,11 +173,11 @@ int result = accmgr.DeleteAccount(accmgr.GetId(account_name)); if(result == -1) - zprintf("User %s NOT deleted (probably sql file format was updated)\r\n",account_name); + zprintf("Account '%s' not deleted (Possible SQL file format update detected)\r\n",account_name); if(result == 1) - zprintf("User %s does not exist\r\n",account_name); + zprintf("Account '%s' does not exist\r\n",account_name); else if(result == 0) - zprintf("We deleted account: %s\r\n",account_name); + zprintf("Account '%s' deleted\r\n",account_name); } /// Broadcast a message to the World @@ -173,7 +186,7 @@ std::string str = objmgr.GetMangosString(LANG_SYSTEMMESSAGE); str += text; sWorld.SendWorldText(str.c_str(), NULL); - zprintf("Broadcasting to the world:%s\r\n",str.c_str()); + zprintf("Broadcast sent to world: %s\r\n",str.c_str()); } /// Print the list of commands and associated description @@ -269,7 +282,7 @@ char* buf = new char[resultDB->GetRowCount()*linesize+1]; char* bufPos = buf; - ///- Circle through accounts + ///- Cycle through accounts do { Field *fieldsDB = resultDB->Fetch(); @@ -383,7 +396,7 @@ delete result; } //there is result already deleted pointer! , do not use it - if(!result) zprintf("We do not have banned users\r\n"); + if(!result) zprintf("No bans found\r\n"); } /// Ban an IP address or a user account @@ -408,12 +421,12 @@ { case BAN_SUCCESS: if(atoi(duration)>0) - zprintf("%s is banned for %s. Reason: %s.\r\n",nameOrIP,secsToTimeString(TimeStringToSecs(duration),true,false).c_str(),reason); + zprintf("Account '%s' banned for %s. Reason: %s.\r\n",nameOrIP,secsToTimeString(TimeStringToSecs(duration),true,false).c_str(),reason); else - zprintf("%s is banned permanently. Reason: %s.\r\n",nameOrIP,reason); + zprintf("Account '%s' banned permanently. Reason: %s.\r\n",nameOrIP,reason); break; case BAN_NOTFOUND: - zprintf("%s %s not found\r\n", type, nameOrIP); + zprintf("Ban %s %s not found\r\n", type, nameOrIP); break; case BAN_SYNTAX_ERROR: zprintf("Syntax: ban account|ip|character $AccountOrIpOrCharacter $reason ($duration[s|m|h|d]) \r\n"); @@ -425,7 +438,7 @@ void CliVersion(char*,pPrintf zprintf) { //<--maybe better append to info cmd - zprintf( "MaNGOS daemon version is %s\r\n", _FULLVERSION ); + zprintf( "MaNGOS/%s\r\n", _FULLVERSION ); } /// Unban an IP adress or a user account @@ -441,9 +454,9 @@ } if (!sWorld.RemoveBanAccount(type, nameorip)) - zprintf("%s %s not found\r\n", type, nameorip); + zprintf("Ban %s %s not found\r\n", type, nameorip); else - zprintf("We removed ban from %s: %s\r\n",type,nameorip); + zprintf("Ban %s %s removed\r\n",type,nameorip); } /// Display the list of GMs @@ -462,7 +475,7 @@ zprintf("| Account | GM |\r\n"); zprintf("========================\r\n"); - ///- Circle through them. Display username and GM level + ///- Cycle through them. Display username and GM level do { fields = result->Fetch(); @@ -475,7 +488,7 @@ } else { - zprintf("NO gamemasters\r\n"); + zprintf("No administrators, gamemasters or moderators found\r\n"); } } @@ -515,11 +528,11 @@ // No SQL injection (account name is escaped) loginDatabase.PExecute("UPDATE `account` SET `gmlevel` = '%d' WHERE `username` = '%s'",lev,safe_account_name.c_str()); - zprintf("We added %s gmlevel %d\r\n",szAcc,lev); + zprintf("Account '%s' set to level %d\r\n",szAcc,lev); } else { - zprintf("No account %s found\r\n",szAcc); + zprintf("Account '%s' does not exist\r\n",szAcc); } } @@ -540,7 +553,7 @@ uint32 acc_id = accmgr.GetId(szAcc); if (!acc_id) { - zprintf("Account '%s' not exist!\r\n", szAcc); + zprintf("Password not changed: Account '%s' does not exist\r\n", szAcc); return; } @@ -549,20 +562,20 @@ if (pass1 != pass2) { - zprintf("Password does not match the confirm password, password not changed!\r\n"); + zprintf("Password not changed: Passwords does not match\r\n"); return; } if (pass1.size() > 16) { - zprintf("Password can't be longer than 16 characters (client limit), password not changed!\r\n"); + zprintf("Password not changed: Password longer than 16 characters (client limit)\r\n"); return; } if(accmgr.ChangePassword(acc_id, pass1) == 0) - zprintf("The password was changed for account '%s' (ID: %u).\r\n",szAcc,acc_id); + zprintf("Password changed for account '%s' (ID: %u)\r\n",szAcc,acc_id); else - zprintf("Password not changed!\r\n"); + zprintf("Password not changed: unknown reason\r\n"); } /// Create an account @@ -582,7 +595,7 @@ if(strlen(szAcc)>16) { - zprintf("Account cannot be longer than 16 characters.\r\n"); + zprintf("Account not created - username longer than 16 characters.\r\n"); return; } @@ -596,13 +609,13 @@ int result = accmgr.CreateAccount(szAcc, szPassword); if(result == -1) - zprintf("User %s with password %s NOT created (probably sql file format was updated)\r\n",szAcc,szPassword); + zprintf("Account '%s' not created (Possible SQL file format update detected)\r\n",szAcc); else if(result == 1) - zprintf("Username %s is too long\r\n", szAcc); + zprintf("Account '%s' not created - username longer than 16 characters\r\n", szAcc); else if(result == 2) - zprintf("User %s already exists\r\n",szAcc); + zprintf("Account '%s' already exists\r\n",szAcc); else if(result == 0) - zprintf("User %s with password %s created successfully\r\n",szAcc,szPassword); + zprintf("Account '%s' created with password '%s'\r\n",szAcc,szPassword); } /// Command parser and dispatcher @@ -639,7 +652,7 @@ } } if (!bSuccess) - zprintf("mangos>"); + zprintf("mangos> "); } /// Kick a character out of the realm @@ -735,13 +748,13 @@ if (strlen(command) == 0) { - zprintf("Current Message of the day: \r\n%s\r\n", sWorld.GetMotd()); + zprintf("Current MOTD:\r\n%s\r\n", sWorld.GetMotd()); return; } else { sWorld.SetMotd(command); - zprintf("Message of the day changed to:\r\n%s\r\n", command); + zprintf("Changed MOTD to:\r\n%s\r\n", command); } } @@ -804,13 +817,13 @@ { // No SQL injection (account name is escaped) loginDatabase.PExecute("UPDATE `account` SET `tbc` = '%d' WHERE `username` = '%s'",lev,safe_account_name.c_str()); - zprintf("We added %s to expansion allowed %d\r\n",szAcc,lev); + zprintf("Account '%s' modified for expansion-level %d\r\n",szAcc,lev); delete result; } else { - zprintf("No account %s found\r\n",szAcc); + zprintf("Account '%s' not found\r\n",szAcc); } } @@ -819,7 +832,7 @@ { ///- Save players ObjectAccessor::Instance().SaveAllPlayers(); - zprintf( "All Players Saved \r\n" ); + zprintf( "All players saved\r\n" ); ///- Send a message sWorld.SendWorldText("Players saved!", NULL); @@ -842,13 +855,13 @@ Player *rPlayer = objmgr.GetPlayer(plr); if(!rPlayer) { - zprintf("Player %s not found!\r\n", plr); + zprintf("Player '%s' not found - message not sent\r\n", plr); return; } if (rPlayer->GetSession()->isLogingOut()) { - zprintf("Cannot send message while player %s is logging out!\r\n",plr); + zprintf("Player '%s' currenly logging out - message not sent)\r\n",plr); return; } @@ -858,7 +871,7 @@ rPlayer->GetSession()->SendAreaTriggerMessage("|cffff0000[Message from administrator]:|r"); //Confirmation message - zprintf("Message '%s' sent to %s\r\n",msg , plr); + zprintf("Message sent to player '%s': %s\r\n",plr, msg); } void CliPLimit(char *args,pPrintf zprintf) @@ -871,7 +884,7 @@ int l = strlen(param); - if( strncmp(param,"player",l) == 0 ) + if(strncmp(param,"player",l) == 0 ) sWorld.SetPlayerLimit(-SEC_PLAYER); else if(strncmp(param,"moderator",l) == 0 ) sWorld.SetPlayerLimit(-SEC_MODERATOR); @@ -906,7 +919,7 @@ default: secName = ""; break; } - zprintf("Player limits: amount %u, min. security level %s.\r\n",pLimit,secName); + zprintf("Player limits: Amount %u - Min. security level %s.\r\n",pLimit,secName); } /// @} @@ -946,7 +959,7 @@ // print this here the first time // later it will be printed after command queue updates - printf("mangos>"); + printf("mangos> "); ///- As long as the World is running (no World::m_stopEvent), get the command line and handle it while (!World::m_stopEvent)