mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2025-11-29 17:38:24 +08:00
Implemented guild info command (#756)
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
INSERT INTO version_db_world (`sql_rev`) VALUES ('1515920217003409800');
|
||||||
|
|
||||||
|
DELETE FROM `command` WHERE `name` = 'guild info';
|
||||||
|
INSERT INTO `command` (`name`, `security`, `help`) VALUES
|
||||||
|
('guild info', 2, 'Shows information about the target''s guild or a given Guild Id or Name.');
|
||||||
@@ -1161,7 +1161,7 @@ bool Guild::Create(Player* pLeader, std::string const& name)
|
|||||||
m_info = "";
|
m_info = "";
|
||||||
m_motd = "No message set.";
|
m_motd = "No message set.";
|
||||||
m_bankMoney = 0;
|
m_bankMoney = 0;
|
||||||
m_createdDate = ::time(NULL);
|
m_createdDate = sWorld->GetGameTime();
|
||||||
_CreateLogHolders();
|
_CreateLogHolders();
|
||||||
|
|
||||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||||
|
|||||||
@@ -747,6 +747,7 @@ public:
|
|||||||
// pussywizard
|
// pussywizard
|
||||||
uint64 GetTotalBankMoney() const { return m_bankMoney; }
|
uint64 GetTotalBankMoney() const { return m_bankMoney; }
|
||||||
uint32 GetMemberCount() const { return m_members.size(); }
|
uint32 GetMemberCount() const { return m_members.size(); }
|
||||||
|
time_t GetCreatedDate() const { return m_createdDate; }
|
||||||
|
|
||||||
// Bank tabs
|
// Bank tabs
|
||||||
void SetBankTabText(uint8 tabId, std::string const& text);
|
void SetBankTabText(uint8 tabId, std::string const& text);
|
||||||
|
|||||||
@@ -31,7 +31,8 @@ public:
|
|||||||
{ "delete", SEC_GAMEMASTER, true, &HandleGuildDeleteCommand, "" },
|
{ "delete", SEC_GAMEMASTER, true, &HandleGuildDeleteCommand, "" },
|
||||||
{ "invite", SEC_GAMEMASTER, true, &HandleGuildInviteCommand, "" },
|
{ "invite", SEC_GAMEMASTER, true, &HandleGuildInviteCommand, "" },
|
||||||
{ "uninvite", SEC_GAMEMASTER, true, &HandleGuildUninviteCommand, "" },
|
{ "uninvite", SEC_GAMEMASTER, true, &HandleGuildUninviteCommand, "" },
|
||||||
{ "rank", SEC_GAMEMASTER, true, &HandleGuildRankCommand, "" }
|
{ "rank", SEC_GAMEMASTER, true, &HandleGuildRankCommand, "" },
|
||||||
|
{ "info", SEC_GAMEMASTER, true, &HandleGuildInfoCommand, "" }
|
||||||
};
|
};
|
||||||
static std::vector<ChatCommand> commandTable =
|
static std::vector<ChatCommand> commandTable =
|
||||||
{
|
{
|
||||||
@@ -180,6 +181,44 @@ public:
|
|||||||
uint8 newRank = uint8(atoi(rankStr));
|
uint8 newRank = uint8(atoi(rankStr));
|
||||||
return targetGuild->ChangeMemberRank(targetGuid, newRank);
|
return targetGuild->ChangeMemberRank(targetGuid, newRank);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool HandleGuildInfoCommand(ChatHandler* handler, char const* args)
|
||||||
|
{
|
||||||
|
Guild* guild = nullptr;
|
||||||
|
|
||||||
|
if (args && args[0] != '\0')
|
||||||
|
{
|
||||||
|
if (isNumeric(args))
|
||||||
|
guild = sGuildMgr->GetGuildById(strtoull(args, nullptr, 10));
|
||||||
|
else
|
||||||
|
guild = sGuildMgr->GetGuildByName(args);
|
||||||
|
}
|
||||||
|
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(), GUID_LOPART(guild->GetLeaderGUID())); // Guild Master
|
||||||
|
|
||||||
|
// Format creation date
|
||||||
|
char createdDateStr[20];
|
||||||
|
time_t createdDate = guild->GetCreatedDate();
|
||||||
|
tm localTm;
|
||||||
|
ACE_OS::localtime_r(&createdDate, &localTm);
|
||||||
|
strftime(createdDateStr, 20, "%Y-%m-%d %H:%M:%S", &localTm);
|
||||||
|
|
||||||
|
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->GetTotalBankMoney() / 100 / 100); // Bank Gold (in gold coins)
|
||||||
|
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;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void AddSC_guild_commandscript()
|
void AddSC_guild_commandscript()
|
||||||
|
|||||||
Reference in New Issue
Block a user