mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-24 19:06:49 +01:00
scripts/Commands: Sync with 4.3.4 branch (meh nayd)
This commit is contained in:
@@ -249,41 +249,29 @@ public:
|
||||
{
|
||||
Guild* guild = nullptr;
|
||||
|
||||
if (!*args)
|
||||
if (args && strlen(args) > 0)
|
||||
{
|
||||
// Look for the guild of the selected player or ourselves
|
||||
if (Player* 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 (uint32 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;
|
||||
|
||||
std::string 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;
|
||||
|
||||
std::string guildMasterName;
|
||||
|
||||
// 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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user