Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4

Conflicts:
	sql/base/auth_database.sql
	src/server/game/Entities/Player/Player.cpp
This commit is contained in:
Vincent-Michael committed 2014-08-29 06:24:08 +02:00
commit 9cb92f93aa
24 files changed
+1783 -71

No files matched your search

+58
View File
@@ -45,6 +45,7 @@ public:
{ "uninvite", rbac::RBAC_PERM_COMMAND_GUILD_UNINVITE, true, &HandleGuildUninviteCommand, "", NULL },
{ "rank", rbac::RBAC_PERM_COMMAND_GUILD_RANK, true, &HandleGuildRankCommand, "", NULL },
{ "rename", rbac::RBAC_PERM_COMMAND_GUILD_RENAME, true, &HandleGuildRenameCommand, "", NULL },
{ "info", rbac::RBAC_PERM_COMMAND_GUILD_INFO, true, &HandleGuildInfoCommand, "", NULL },
{ NULL, 0, false, NULL, "", NULL }
};
static ChatCommand commandTable[] =
@@ -244,6 +245,63 @@ public:
handler->PSendSysMessage(LANG_GUILD_RENAME_DONE, oldGuildStr, newGuildStr);
return true;
}
static bool HandleGuildInfoCommand(ChatHandler* handler, char const* args)
{
Player* target;
uint32 guildId;
std::string guildName;
std::string guildMasterName;
Guild* guild;
if (!*args)
{
// Look for the guild of the selected player or ourselves
if (target = handler->getSelectedPlayerOrSelf())
guild = target->GetGuild();
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);
}
if (!guild)
return false;
// Display Guild Information
handler->PSendSysMessage(LANG_GUILD_INFO_NAME, guild->GetName().c_str(), guild->GetId()); // Guild Id + Name
if (sObjectMgr->GetPlayerNameByGUID(guild->GetLeaderGUID(), guildMasterName))
handler->PSendSysMessage(LANG_GUILD_INFO_GUILD_MASTER, guildMasterName.c_str(), guild->GetLeaderGUID()); // Guild Master
// Format creation date
char createdDateStr[20];
time_t createdDate = guild->GetCreatedDate();
strftime(createdDateStr, 20, "%Y-%m-%d %H:%M:%S", localtime(&createdDate));
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_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()