diff options
| author | Vincent-Michael <Vincent_Michael@gmx.de> | 2014-08-29 21:08:34 +0200 | 
|---|---|---|
| committer | Vincent-Michael <Vincent_Michael@gmx.de> | 2014-08-29 21:09:06 +0200 | 
| commit | e8d0de67782eb7773d6c10172ba0ab0b458d777f (patch) | |
| tree | 01577505d1c7fc4ef1c80f8f2a33a6f4e84f3ada | |
| parent | 9597b1526c3a9d3c9423a19978840fed5fe09fd7 (diff) | |
Scripts/Commands: Added for guild info guild level output
| -rw-r--r-- | sql/updates/world/2014_08_29_00_world_trinity_string_434.sql | 4 | ||||
| -rw-r--r-- | src/server/game/Miscellaneous/Language.h | 1 | ||||
| -rw-r--r-- | src/server/scripts/Commands/cs_guild.cpp | 46 | 
3 files changed, 22 insertions, 29 deletions
diff --git a/sql/updates/world/2014_08_29_00_world_trinity_string_434.sql b/sql/updates/world/2014_08_29_00_world_trinity_string_434.sql new file mode 100644 index 00000000000..547cca013bd --- /dev/null +++ b/sql/updates/world/2014_08_29_00_world_trinity_string_434.sql @@ -0,0 +1,4 @@ +-- .guild info command strings +DELETE FROM `trinity_string` WHERE `entry`=1184; +INSERT INTO `trinity_string` (`entry`, `content_default`) VALUES +(1184, '| Guild Level: %u'); diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h index 9e4bd55671a..d8005f2e338 100644 --- a/src/server/game/Miscellaneous/Language.h +++ b/src/server/game/Miscellaneous/Language.h @@ -977,6 +977,7 @@ enum TrinityStrings      LANG_GUILD_INFO_BANK_GOLD           = 1181,      LANG_GUILD_INFO_MOTD                = 1182,      LANG_GUILD_INFO_EXTRA_INFO          = 1183, +    LANG_GUILD_INFO_LEVEL               = 1184,      // Room for more level 3              1184-1199 not used      // Debug commands diff --git a/src/server/scripts/Commands/cs_guild.cpp b/src/server/scripts/Commands/cs_guild.cpp index 99d9e0a2a8a..362f16d29a3 100644 --- a/src/server/scripts/Commands/cs_guild.cpp +++ b/src/server/scripts/Commands/cs_guild.cpp @@ -29,6 +29,7 @@ EndScriptData */  #include "GuildMgr.h"  #include "ObjectAccessor.h"  #include "ScriptMgr.h" +#include <iomanip>  class guild_commandscript : public CommandScript  { @@ -248,45 +249,31 @@ public:      static bool HandleGuildInfoCommand(ChatHandler* handler, char const* args)      { -        Player* target; -        uint32 guildId; -        std::string guildName; -        std::string guildMasterName; -        Guild* guild; +        Guild* guild = nullptr; -        if (!*args) +        if (args && strlen(args) > 0)          { -            // Look for the guild of the selected player or ourselves -            if (target = handler->getSelectedPlayerOrSelf()) -                guild = target->GetGuild(); +            if (isNumeric(args)) +            { +                uint32 guildId = uint32(atoi(args)); +                guild = sGuildMgr->GetGuildById(guildId); +            }              else -                // getSelectedPlayerOrSelf will return null if there is no session -                // so target becomes nullptr if the command is ran through console -                // without specifying args. -                return false; -        } -        else if (guildId = atoi(args)) // Try searching by Id -            guild = sGuildMgr->GetGuildById(guildId); -        else -        { -            // Try to extract a guild name -            char* tailStr = *args != '"' ? strtok(NULL, "") : (char*)args; -            if (!tailStr) -                return false; - -            char* guildStr = handler->extractQuotedArg((char*)args); -            if (!guildStr) -                return false; - -            guildName = guildStr; -            guild = sGuildMgr->GetGuildByName(guildName); +            { +                std::string guildName = args; +                guild = sGuildMgr->GetGuildByName(guildName); +            }          } +        else if (Player* target = handler->getSelectedPlayerOrSelf()) +            guild = target->GetGuild();          if (!guild)              return false;          // Display Guild Information          handler->PSendSysMessage(LANG_GUILD_INFO_NAME, guild->GetName().c_str(), guild->GetId()); // Guild Id + Name + +        std::string guildMasterName;          if (sObjectMgr->GetPlayerNameByGUID(guild->GetLeaderGUID(), guildMasterName))              handler->PSendSysMessage(LANG_GUILD_INFO_GUILD_MASTER, guildMasterName.c_str(), guild->GetLeaderGUID()); // Guild Master @@ -298,6 +285,7 @@ public:          handler->PSendSysMessage(LANG_GUILD_INFO_CREATION_DATE, createdDateStr); // Creation Date          handler->PSendSysMessage(LANG_GUILD_INFO_MEMBER_COUNT, guild->GetMemberCount()); // Number of Members          handler->PSendSysMessage(LANG_GUILD_INFO_BANK_GOLD, guild->GetBankMoney() / 100 / 100); // Bank Gold (in gold coins) +        handler->PSendSysMessage(LANG_GUILD_INFO_LEVEL, guild->GetLevel()); // Level          handler->PSendSysMessage(LANG_GUILD_INFO_MOTD, guild->GetMOTD().c_str()); // Message of the Day          handler->PSendSysMessage(LANG_GUILD_INFO_EXTRA_INFO, guild->GetInfo().c_str()); // Extra Information          return true;  | 
