mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-16 10:30:27 +00:00
feat(Core/Chat): new argument parsing and unify chat hyperlink parsing (#6243)
This commit is contained in:
@@ -38,14 +38,20 @@ EndScriptData */
|
||||
#include <openssl/rand.h>
|
||||
#include <unordered_map>
|
||||
|
||||
#if AC_COMPILER == AC_COMPILER_GNU
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
using namespace Acore::ChatCommands;
|
||||
|
||||
class account_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
account_commandscript() : CommandScript("account_commandscript") { }
|
||||
|
||||
std::vector<ChatCommand> GetCommands() const override
|
||||
ChatCommandTable GetCommands() const override
|
||||
{
|
||||
static std::vector<ChatCommand> accountSetCommandTable =
|
||||
static ChatCommandTable accountSetCommandTable =
|
||||
{
|
||||
{ "addon", SEC_GAMEMASTER, true, &HandleAccountSetAddonCommand, "" },
|
||||
{ "gmlevel", SEC_CONSOLE, true, &HandleAccountSetGmLevelCommand, "" },
|
||||
@@ -53,24 +59,24 @@ public:
|
||||
{ "2fa", SEC_PLAYER, true, &HandleAccountSet2FACommand, "" }
|
||||
};
|
||||
|
||||
static std::vector<ChatCommand> accountLockCommandTable
|
||||
static ChatCommandTable accountLockCommandTable
|
||||
{
|
||||
{ "country", SEC_PLAYER, true, &HandleAccountLockCountryCommand, "" },
|
||||
{ "ip", SEC_PLAYER, true, &HandleAccountLockIpCommand, "" }
|
||||
};
|
||||
|
||||
static std::vector<ChatCommand> account2faCommandTable
|
||||
static ChatCommandTable account2faCommandTable
|
||||
{
|
||||
{ "setup", SEC_PLAYER, false, &HandleAccount2FASetupCommand, "" },
|
||||
{ "remove", SEC_PLAYER, false, &HandleAccount2FARemoveCommand, "" },
|
||||
};
|
||||
|
||||
static std::vector<ChatCommand> accountRemoveCommandTable
|
||||
static ChatCommandTable accountRemoveCommandTable
|
||||
{
|
||||
{ "country", SEC_ADMINISTRATOR, true, &HandleAccountRemoveLockCountryCommand, "" }
|
||||
};
|
||||
|
||||
static std::vector<ChatCommand> accountCommandTable =
|
||||
static ChatCommandTable accountCommandTable =
|
||||
{
|
||||
{ "2fa", SEC_PLAYER, true, nullptr, "", account2faCommandTable },
|
||||
{ "addon", SEC_MODERATOR, false, &HandleAccountAddonCommand, "" },
|
||||
@@ -84,7 +90,7 @@ public:
|
||||
{ "", SEC_PLAYER, false, &HandleAccountCommand, "" }
|
||||
};
|
||||
|
||||
static std::vector<ChatCommand> commandTable =
|
||||
static ChatCommandTable commandTable =
|
||||
{
|
||||
{ "account", SEC_PLAYER, true, nullptr, "", accountCommandTable }
|
||||
};
|
||||
|
||||
@@ -27,19 +27,25 @@ EndScriptData */
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
|
||||
#if AC_COMPILER == AC_COMPILER_GNU
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
using namespace Acore::ChatCommands;
|
||||
|
||||
class achievement_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
achievement_commandscript() : CommandScript("achievement_commandscript") { }
|
||||
|
||||
std::vector<ChatCommand> GetCommands() const override
|
||||
ChatCommandTable GetCommands() const override
|
||||
{
|
||||
static std::vector<ChatCommand> achievementCommandTable =
|
||||
static ChatCommandTable achievementCommandTable =
|
||||
{
|
||||
{ "add", SEC_GAMEMASTER, false, &HandleAchievementAddCommand, "" },
|
||||
{ "checkall", SEC_ADMINISTRATOR, false, &HandleAchievementCheckAllCommand, "" }
|
||||
};
|
||||
static std::vector<ChatCommand> commandTable =
|
||||
static ChatCommandTable commandTable =
|
||||
{
|
||||
{ "achievement", SEC_GAMEMASTER, false, nullptr, "", achievementCommandTable }
|
||||
};
|
||||
|
||||
@@ -29,99 +29,73 @@ EndScriptData */
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
|
||||
using namespace Acore::ChatCommands;
|
||||
|
||||
class arena_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
arena_commandscript() : CommandScript("arena_commandscript") { }
|
||||
|
||||
std::vector<ChatCommand> GetCommands() const override
|
||||
ChatCommandTable GetCommands() const override
|
||||
{
|
||||
static std::vector<ChatCommand> arenaCommandTable =
|
||||
static ChatCommandTable arenaCommandTable =
|
||||
{
|
||||
{ "create", SEC_ADMINISTRATOR, true, &HandleArenaCreateCommand, "" },
|
||||
{ "disband", SEC_ADMINISTRATOR, true, &HandleArenaDisbandCommand, "" },
|
||||
{ "rename", SEC_ADMINISTRATOR, true, &HandleArenaRenameCommand, "" },
|
||||
{ "captain", SEC_ADMINISTRATOR, false, &HandleArenaCaptainCommand, "" },
|
||||
{ "info", SEC_GAMEMASTER, true, &HandleArenaInfoCommand, "" },
|
||||
{ "lookup", SEC_GAMEMASTER, false, &HandleArenaLookupCommand, "" },
|
||||
{ "create", HandleArenaCreateCommand, SEC_ADMINISTRATOR, Console::Yes },
|
||||
{ "disband", HandleArenaDisbandCommand, SEC_ADMINISTRATOR, Console::Yes },
|
||||
{ "rename", HandleArenaRenameCommand, SEC_ADMINISTRATOR, Console::Yes },
|
||||
{ "captain", HandleArenaCaptainCommand, SEC_ADMINISTRATOR, Console::No },
|
||||
{ "info", HandleArenaInfoCommand, SEC_GAMEMASTER, Console::Yes },
|
||||
{ "lookup", HandleArenaLookupCommand, SEC_GAMEMASTER, Console::No },
|
||||
};
|
||||
static std::vector<ChatCommand> commandTable =
|
||||
|
||||
static ChatCommandTable commandTable =
|
||||
{
|
||||
{ "arena", SEC_GAMEMASTER, false, nullptr, "", arenaCommandTable },
|
||||
{ "arena", arenaCommandTable }
|
||||
};
|
||||
|
||||
return commandTable;
|
||||
}
|
||||
|
||||
static bool HandleArenaCreateCommand(ChatHandler* handler, char const* args)
|
||||
static bool HandleArenaCreateCommand(ChatHandler* handler, Optional<PlayerIdentifier> captain, QuotedString name, ArenaTeamTypes type)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
Player* target;
|
||||
if (!handler->extractPlayerTarget(*args != '"' ? (char*)args : nullptr, &target))
|
||||
return false;
|
||||
|
||||
char* tailStr = *args != '"' ? strtok(nullptr, "") : (char*)args;
|
||||
if (!tailStr)
|
||||
return false;
|
||||
|
||||
char* name = handler->extractQuotedArg(tailStr);
|
||||
if (!name)
|
||||
return false;
|
||||
|
||||
char* typeStr = strtok(nullptr, "");
|
||||
if (!typeStr)
|
||||
return false;
|
||||
|
||||
int8 type = atoi(typeStr);
|
||||
if (sArenaTeamMgr->GetArenaTeamByName(name))
|
||||
{
|
||||
handler->PSendSysMessage(LANG_ARENA_ERROR_NAME_EXISTS, name);
|
||||
handler->PSendSysMessage(LANG_ARENA_ERROR_NAME_EXISTS, name.c_str());
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (type == 2 || type == 3 || type == 5 )
|
||||
if (!captain)
|
||||
captain = PlayerIdentifier::FromTargetOrSelf(handler);
|
||||
|
||||
if (!captain)
|
||||
return false;
|
||||
|
||||
if (Player::GetArenaTeamIdFromDB(captain->GetGUID(), type) != 0)
|
||||
{
|
||||
if (Player::GetArenaTeamIdFromDB(target->GetGUID(), type) != 0)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_ARENA_ERROR_SIZE, target->GetName().c_str());
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
ArenaTeam* arena = new ArenaTeam();
|
||||
|
||||
if (!arena->Create(target->GetGUID(), type, name, 4293102085, 101, 4293253939, 4, 4284049911))
|
||||
{
|
||||
delete arena;
|
||||
handler->SendSysMessage(LANG_BAD_VALUE);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
sArenaTeamMgr->AddArenaTeam(arena);
|
||||
handler->PSendSysMessage(LANG_ARENA_CREATE, arena->GetName().c_str(), arena->GetId(), arena->GetType(), arena->GetCaptain());
|
||||
handler->PSendSysMessage(LANG_ARENA_ERROR_SIZE, captain->GetName().c_str());
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
|
||||
ArenaTeam* arena = new ArenaTeam();
|
||||
|
||||
if (!arena->Create(captain->GetGUID(), type, name, 4293102085, 101, 4293253939, 4, 4284049911))
|
||||
{
|
||||
delete arena;
|
||||
handler->SendSysMessage(LANG_BAD_VALUE);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
sArenaTeamMgr->AddArenaTeam(arena);
|
||||
handler->PSendSysMessage(LANG_ARENA_CREATE, arena->GetName().c_str(), arena->GetId(), arena->GetType(), arena->GetCaptain().GetCounter());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleArenaDisbandCommand(ChatHandler* handler, char const* args)
|
||||
static bool HandleArenaDisbandCommand(ChatHandler* handler, uint32 teamId)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
uint32 teamId = atoi((char*)args);
|
||||
if (!teamId)
|
||||
return false;
|
||||
|
||||
ArenaTeam* arena = sArenaTeamMgr->GetArenaTeamById(teamId);
|
||||
|
||||
if (!arena)
|
||||
@@ -147,40 +121,19 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleArenaRenameCommand(ChatHandler* handler, char const* _args)
|
||||
static bool HandleArenaRenameCommand(ChatHandler* handler, QuotedString oldName, QuotedString newName)
|
||||
{
|
||||
if (!*_args)
|
||||
return false;
|
||||
|
||||
char* args = (char*)_args;
|
||||
|
||||
char const* oldArenaStr = handler->extractQuotedArg(args);
|
||||
if (!oldArenaStr)
|
||||
{
|
||||
handler->SendSysMessage(LANG_BAD_VALUE);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
char const* newArenaStr = handler->extractQuotedArg(strtok(nullptr, ""));
|
||||
if (!newArenaStr)
|
||||
{
|
||||
handler->SendSysMessage(LANG_BAD_VALUE);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
ArenaTeam* arena = sArenaTeamMgr->GetArenaTeamByName(oldArenaStr);
|
||||
ArenaTeam* arena = sArenaTeamMgr->GetArenaTeamByName(oldName);
|
||||
if (!arena)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_AREAN_ERROR_NAME_NOT_FOUND, oldArenaStr);
|
||||
handler->PSendSysMessage(LANG_AREAN_ERROR_NAME_NOT_FOUND, oldName.c_str());
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sArenaTeamMgr->GetArenaTeamByName(newArenaStr))
|
||||
if (sArenaTeamMgr->GetArenaTeamByName(newName))
|
||||
{
|
||||
handler->PSendSysMessage(LANG_ARENA_ERROR_NAME_EXISTS, oldArenaStr);
|
||||
handler->PSendSysMessage(LANG_ARENA_ERROR_NAME_EXISTS, oldName.c_str());
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
@@ -192,40 +145,21 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!arena->SetName(newArenaStr))
|
||||
if (!arena->SetName(newName))
|
||||
{
|
||||
handler->SendSysMessage(LANG_BAD_VALUE);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
handler->PSendSysMessage(LANG_ARENA_RENAME, arena->GetId(), oldArenaStr, newArenaStr);
|
||||
handler->PSendSysMessage(LANG_ARENA_RENAME, arena->GetId(), oldName.c_str(), newName.c_str());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleArenaCaptainCommand(ChatHandler* handler, char const* args)
|
||||
static bool HandleArenaCaptainCommand(ChatHandler* handler, uint32 teamId, Optional<PlayerIdentifier> target)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
char* idStr;
|
||||
char* nameStr;
|
||||
handler->extractOptFirstArg((char*)args, &idStr, &nameStr);
|
||||
if (!idStr)
|
||||
return false;
|
||||
|
||||
uint32 teamId = atoi(idStr);
|
||||
if (!teamId)
|
||||
return false;
|
||||
|
||||
Player* target;
|
||||
ObjectGuid targetGuid;
|
||||
if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid))
|
||||
return false;
|
||||
|
||||
ArenaTeam* arena = sArenaTeamMgr->GetArenaTeamById(teamId);
|
||||
|
||||
if (!arena)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_ARENA_ERROR_NOT_FOUND, teamId);
|
||||
@@ -233,13 +167,6 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!target)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_PLAYER_NOT_EXIST_OR_OFFLINE, nameStr);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (arena->IsFighting())
|
||||
{
|
||||
handler->SendSysMessage(LANG_ARENA_ERROR_COMBAT);
|
||||
@@ -247,40 +174,38 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!arena->IsMember(targetGuid))
|
||||
if (!target)
|
||||
target = PlayerIdentifier::FromTargetOrSelf(handler);
|
||||
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
if (!arena->IsMember(target->GetGUID()))
|
||||
{
|
||||
handler->PSendSysMessage(LANG_ARENA_ERROR_NOT_MEMBER, nameStr, arena->GetName().c_str());
|
||||
handler->PSendSysMessage(LANG_ARENA_ERROR_NOT_MEMBER, target->GetName().c_str(), arena->GetName().c_str());
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (arena->GetCaptain() == targetGuid)
|
||||
if (arena->GetCaptain() == target->GetGUID())
|
||||
{
|
||||
handler->PSendSysMessage(LANG_ARENA_ERROR_CAPTAIN, nameStr, arena->GetName().c_str());
|
||||
handler->PSendSysMessage(LANG_ARENA_ERROR_CAPTAIN, target->GetName().c_str(), arena->GetName().c_str());
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string oldCaptainName;
|
||||
sObjectMgr->GetPlayerNameByGUID(arena->GetCaptain().GetCounter(), oldCaptainName);
|
||||
arena->SetCaptain(targetGuid);
|
||||
arena->SetCaptain(target->GetGUID());
|
||||
|
||||
handler->PSendSysMessage(LANG_ARENA_CAPTAIN, arena->GetName().c_str(), arena->GetId(), oldCaptainName.c_str(), target->GetName().c_str());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleArenaInfoCommand(ChatHandler* handler, char const* args)
|
||||
static bool HandleArenaInfoCommand(ChatHandler* handler, uint32 teamId)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
uint32 teamId = atoi((char*)args);
|
||||
if (!teamId)
|
||||
return false;
|
||||
|
||||
ArenaTeam* arena = sArenaTeamMgr->GetArenaTeamById(teamId);
|
||||
|
||||
if (!arena)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_ARENA_ERROR_NOT_FOUND, teamId);
|
||||
@@ -289,36 +214,26 @@ public:
|
||||
}
|
||||
|
||||
handler->PSendSysMessage(LANG_ARENA_INFO_HEADER, arena->GetName().c_str(), arena->GetId(), arena->GetRating(), arena->GetType(), arena->GetType());
|
||||
for (ArenaTeam::MemberList::iterator itr = arena->m_membersBegin(); itr != arena->m_membersEnd(); ++itr)
|
||||
handler->PSendSysMessage(LANG_ARENA_INFO_MEMBERS, itr->Name.c_str(), itr->Guid.GetCounter(), itr->PersonalRating, (arena->GetCaptain() == itr->Guid ? "- Captain" : ""));
|
||||
|
||||
for (auto const& itr : arena->GetMembers())
|
||||
handler->PSendSysMessage(LANG_ARENA_INFO_MEMBERS, itr.Name.c_str(), itr.Guid.GetCounter(), itr.PersonalRating, (arena->GetCaptain() == itr.Guid ? "- Captain" : ""));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleArenaLookupCommand(ChatHandler* handler, char const* args)
|
||||
static bool HandleArenaLookupCommand(ChatHandler* handler, Tail needle)
|
||||
{
|
||||
if (!*args)
|
||||
if (needle.empty())
|
||||
return false;
|
||||
|
||||
std::string namepart = args;
|
||||
std::wstring wnamepart;
|
||||
|
||||
if (!Utf8toWStr(namepart, wnamepart))
|
||||
return false;
|
||||
|
||||
wstrToLower(wnamepart);
|
||||
|
||||
bool found = false;
|
||||
ArenaTeamMgr::ArenaTeamContainer::const_iterator i = sArenaTeamMgr->GetArenaTeamMapBegin();
|
||||
for (; i != sArenaTeamMgr->GetArenaTeamMapEnd(); ++i)
|
||||
for (auto [teamId, team] : sArenaTeamMgr->GetArenaTeams())
|
||||
{
|
||||
ArenaTeam* arena = i->second;
|
||||
|
||||
if (Utf8FitTo(arena->GetName(), wnamepart))
|
||||
if (StringContainsStringI(team->GetName(), needle))
|
||||
{
|
||||
if (handler->GetSession())
|
||||
{
|
||||
handler->PSendSysMessage(LANG_ARENA_LOOKUP, arena->GetName().c_str(), arena->GetId(), arena->GetType(), arena->GetType());
|
||||
handler->PSendSysMessage(LANG_ARENA_LOOKUP, team->GetName().c_str(), team->GetId(), team->GetType(), team->GetType());
|
||||
found = true;
|
||||
continue;
|
||||
}
|
||||
@@ -326,7 +241,7 @@ public:
|
||||
}
|
||||
|
||||
if (!found)
|
||||
handler->PSendSysMessage(LANG_AREAN_ERROR_NAME_NOT_FOUND, namepart.c_str());
|
||||
handler->PSendSysMessage(LANG_AREAN_ERROR_NAME_NOT_FOUND, std::string(needle).c_str());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -39,36 +39,42 @@ enum BanMode
|
||||
BAN_IP
|
||||
};
|
||||
|
||||
#if AC_COMPILER == AC_COMPILER_GNU
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
using namespace Acore::ChatCommands;
|
||||
|
||||
class ban_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
ban_commandscript() : CommandScript("ban_commandscript") { }
|
||||
|
||||
std::vector<ChatCommand> GetCommands() const override
|
||||
ChatCommandTable GetCommands() const override
|
||||
{
|
||||
static std::vector<ChatCommand> unbanCommandTable =
|
||||
static ChatCommandTable unbanCommandTable =
|
||||
{
|
||||
{ "account", SEC_GAMEMASTER, true, &HandleUnBanAccountCommand, "" },
|
||||
{ "character", SEC_GAMEMASTER, true, &HandleUnBanCharacterCommand, "" },
|
||||
{ "playeraccount", SEC_GAMEMASTER, true, &HandleUnBanAccountByCharCommand, "" },
|
||||
{ "ip", SEC_GAMEMASTER, true, &HandleUnBanIPCommand, "" }
|
||||
{ "account", SEC_ADMINISTRATOR, true, &HandleUnBanAccountCommand, "" },
|
||||
{ "character", SEC_ADMINISTRATOR, true, &HandleUnBanCharacterCommand, "" },
|
||||
{ "playeraccount", SEC_ADMINISTRATOR, true, &HandleUnBanAccountByCharCommand, "" },
|
||||
{ "ip", SEC_ADMINISTRATOR, true, &HandleUnBanIPCommand, "" }
|
||||
};
|
||||
|
||||
static std::vector<ChatCommand> banlistCommandTable =
|
||||
static ChatCommandTable banlistCommandTable =
|
||||
{
|
||||
{ "account", SEC_GAMEMASTER, true, &HandleBanListAccountCommand, "" },
|
||||
{ "character", SEC_GAMEMASTER, true, &HandleBanListCharacterCommand, "" },
|
||||
{ "ip", SEC_GAMEMASTER, true, &HandleBanListIPCommand, "" }
|
||||
};
|
||||
|
||||
static std::vector<ChatCommand> baninfoCommandTable =
|
||||
static ChatCommandTable baninfoCommandTable =
|
||||
{
|
||||
{ "account", SEC_GAMEMASTER, true, &HandleBanInfoAccountCommand, "" },
|
||||
{ "character", SEC_GAMEMASTER, true, &HandleBanInfoCharacterCommand, "" },
|
||||
{ "ip", SEC_GAMEMASTER, true, &HandleBanInfoIPCommand, "" }
|
||||
};
|
||||
|
||||
static std::vector<ChatCommand> banCommandTable =
|
||||
static ChatCommandTable banCommandTable =
|
||||
{
|
||||
{ "account", SEC_GAMEMASTER, true, &HandleBanAccountCommand, "" },
|
||||
{ "character", SEC_GAMEMASTER, true, &HandleBanCharacterCommand, "" },
|
||||
@@ -76,12 +82,12 @@ public:
|
||||
{ "ip", SEC_GAMEMASTER, true, &HandleBanIPCommand, "" }
|
||||
};
|
||||
|
||||
static std::vector<ChatCommand> commandTable =
|
||||
static ChatCommandTable commandTable =
|
||||
{
|
||||
{ "ban", SEC_GAMEMASTER, true, nullptr, "", banCommandTable },
|
||||
{ "baninfo", SEC_GAMEMASTER, true, nullptr, "", baninfoCommandTable },
|
||||
{ "banlist", SEC_GAMEMASTER, true, nullptr, "", banlistCommandTable },
|
||||
{ "unban", SEC_GAMEMASTER, true, nullptr, "", unbanCommandTable }
|
||||
{ "ban", SEC_GAMEMASTER, true, nullptr, "", banCommandTable },
|
||||
{ "baninfo", SEC_GAMEMASTER, true, nullptr, "", baninfoCommandTable },
|
||||
{ "banlist", SEC_GAMEMASTER, true, nullptr, "", banlistCommandTable },
|
||||
{ "unban", SEC_ADMINISTRATOR, true, nullptr, "", unbanCommandTable }
|
||||
};
|
||||
|
||||
return commandTable;
|
||||
|
||||
@@ -26,14 +26,20 @@ EndScriptData */
|
||||
#include "Chat.h"
|
||||
#include "ScriptMgr.h"
|
||||
|
||||
#if AC_COMPILER == AC_COMPILER_GNU
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
using namespace Acore::ChatCommands;
|
||||
|
||||
class bf_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
bf_commandscript() : CommandScript("bf_commandscript") { }
|
||||
|
||||
std::vector<ChatCommand> GetCommands() const override
|
||||
ChatCommandTable GetCommands() const override
|
||||
{
|
||||
static std::vector<ChatCommand> battlefieldcommandTable =
|
||||
static ChatCommandTable battlefieldcommandTable =
|
||||
{
|
||||
{ "start", SEC_ADMINISTRATOR, false, &HandleBattlefieldStart, "" },
|
||||
{ "stop", SEC_ADMINISTRATOR, false, &HandleBattlefieldEnd, "" },
|
||||
@@ -41,7 +47,7 @@ public:
|
||||
{ "timer", SEC_ADMINISTRATOR, false, &HandleBattlefieldTimer, "" },
|
||||
{ "enable", SEC_ADMINISTRATOR, false, &HandleBattlefieldEnable, "" }
|
||||
};
|
||||
static std::vector<ChatCommand> commandTable =
|
||||
static ChatCommandTable commandTable =
|
||||
{
|
||||
{ "bf", SEC_ADMINISTRATOR, false, nullptr, "", battlefieldcommandTable }
|
||||
};
|
||||
|
||||
@@ -29,14 +29,20 @@ EndScriptData */
|
||||
#include "ScriptMgr.h"
|
||||
#include "SpellInfo.h"
|
||||
|
||||
#if AC_COMPILER == AC_COMPILER_GNU
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
using namespace Acore::ChatCommands;
|
||||
|
||||
class cast_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
cast_commandscript() : CommandScript("cast_commandscript") { }
|
||||
|
||||
std::vector<ChatCommand> GetCommands() const override
|
||||
ChatCommandTable GetCommands() const override
|
||||
{
|
||||
static std::vector<ChatCommand> castCommandTable =
|
||||
static ChatCommandTable castCommandTable =
|
||||
{
|
||||
{ "back", SEC_GAMEMASTER, false, &HandleCastBackCommand, "" },
|
||||
{ "dist", SEC_GAMEMASTER, false, &HandleCastDistCommand, "" },
|
||||
@@ -45,7 +51,7 @@ public:
|
||||
{ "dest", SEC_GAMEMASTER, false, &HandleCastDestCommand, "" },
|
||||
{ "", SEC_GAMEMASTER, false, &HandleCastCommand, "" }
|
||||
};
|
||||
static std::vector<ChatCommand> commandTable =
|
||||
static ChatCommandTable commandTable =
|
||||
{
|
||||
{ "cast", SEC_GAMEMASTER, false, nullptr, "", castCommandTable }
|
||||
};
|
||||
|
||||
@@ -31,54 +31,61 @@ EndScriptData */
|
||||
#include "ReputationMgr.h"
|
||||
#include "ScriptMgr.h"
|
||||
|
||||
#if AC_COMPILER == AC_COMPILER_GNU
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
using namespace Acore::ChatCommands;
|
||||
|
||||
class character_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
character_commandscript() : CommandScript("character_commandscript") { }
|
||||
|
||||
std::vector<ChatCommand> GetCommands() const override
|
||||
ChatCommandTable GetCommands() const override
|
||||
{
|
||||
static std::vector<ChatCommand> pdumpCommandTable =
|
||||
static ChatCommandTable pdumpCommandTable =
|
||||
{
|
||||
{ "load", SEC_ADMINISTRATOR, true, &HandlePDumpLoadCommand, "" },
|
||||
{ "write", SEC_ADMINISTRATOR, true, &HandlePDumpWriteCommand, "" }
|
||||
{ "load", HandlePDumpLoadCommand, SEC_ADMINISTRATOR, Console::Yes },
|
||||
{ "write", HandlePDumpWriteCommand, SEC_ADMINISTRATOR, Console::Yes }
|
||||
};
|
||||
|
||||
static std::vector<ChatCommand> characterDeletedCommandTable =
|
||||
static ChatCommandTable characterDeletedCommandTable =
|
||||
{
|
||||
{ "delete", SEC_CONSOLE, true, &HandleCharacterDeletedDeleteCommand, "" },
|
||||
{ "list", SEC_ADMINISTRATOR, true, &HandleCharacterDeletedListCommand, "" },
|
||||
{ "restore", SEC_ADMINISTRATOR, true, &HandleCharacterDeletedRestoreCommand, "" },
|
||||
{ "purge", SEC_CONSOLE, true, &HandleCharacterDeletedPurgeCommand, "" },
|
||||
{ "delete", HandleCharacterDeletedDeleteCommand, SEC_CONSOLE, Console::Yes },
|
||||
{ "list", HandleCharacterDeletedListCommand, SEC_ADMINISTRATOR, Console::Yes },
|
||||
{ "restore", HandleCharacterDeletedRestoreCommand, SEC_ADMINISTRATOR, Console::Yes },
|
||||
{ "purge", HandleCharacterDeletedPurgeCommand, SEC_CONSOLE, Console::Yes }
|
||||
};
|
||||
|
||||
static std::vector<ChatCommand> characterCheckCommandTable =
|
||||
static ChatCommandTable characterCheckCommandTable =
|
||||
{
|
||||
{ "bank", SEC_GAMEMASTER, false, &HandleCharacterCheckBankCommand, "" },
|
||||
{ "bag", SEC_GAMEMASTER, false, &HandleCharacterCheckBagCommand, "" },
|
||||
{ "profession", SEC_GAMEMASTER, false, &HandleCharacterCheckProfessionCommand, "" },
|
||||
{ "bank", HandleCharacterCheckBankCommand, SEC_GAMEMASTER, Console::Yes },
|
||||
{ "bag", HandleCharacterCheckBagCommand, SEC_GAMEMASTER, Console::Yes },
|
||||
{ "profession", HandleCharacterCheckProfessionCommand, SEC_GAMEMASTER, Console::Yes }
|
||||
};
|
||||
|
||||
static std::vector<ChatCommand> characterCommandTable =
|
||||
static ChatCommandTable characterCommandTable =
|
||||
{
|
||||
{ "customize", SEC_GAMEMASTER, true, &HandleCharacterCustomizeCommand, "" },
|
||||
{ "changefaction", SEC_GAMEMASTER, true, &HandleCharacterChangeFactionCommand, "" },
|
||||
{ "changerace", SEC_GAMEMASTER, true, &HandleCharacterChangeRaceCommand, "" },
|
||||
{ "check", SEC_GAMEMASTER, false, nullptr, "", characterCheckCommandTable },
|
||||
{ "erase", SEC_CONSOLE, true, &HandleCharacterEraseCommand, "" },
|
||||
{ "deleted", SEC_ADMINISTRATOR, true, nullptr, "", characterDeletedCommandTable },
|
||||
{ "level", SEC_GAMEMASTER, true, &HandleCharacterLevelCommand, "" },
|
||||
{ "rename", SEC_GAMEMASTER, true, &HandleCharacterRenameCommand, "" },
|
||||
{ "reputation", SEC_GAMEMASTER, true, &HandleCharacterReputationCommand, "" },
|
||||
{ "titles", SEC_GAMEMASTER, true, &HandleCharacterTitlesCommand, "" }
|
||||
{ "customize", HandleCharacterCustomizeCommand, SEC_GAMEMASTER, Console::Yes },
|
||||
{ "changefaction", HandleCharacterChangeFactionCommand, SEC_GAMEMASTER, Console::Yes },
|
||||
{ "changerace", HandleCharacterChangeRaceCommand, SEC_GAMEMASTER, Console::Yes },
|
||||
{ "check", characterCheckCommandTable },
|
||||
{ "erase", HandleCharacterEraseCommand, SEC_CONSOLE, Console::Yes },
|
||||
{ "deleted", characterDeletedCommandTable },
|
||||
{ "level", HandleCharacterLevelCommand, SEC_GAMEMASTER, Console::Yes },
|
||||
{ "rename", HandleCharacterRenameCommand, SEC_GAMEMASTER, Console::Yes },
|
||||
{ "reputation", HandleCharacterReputationCommand, SEC_GAMEMASTER, Console::Yes },
|
||||
{ "titles", HandleCharacterTitlesCommand, SEC_GAMEMASTER, Console::Yes }
|
||||
};
|
||||
|
||||
static std::vector<ChatCommand> commandTable =
|
||||
static ChatCommandTable commandTable =
|
||||
{
|
||||
{ "character", SEC_GAMEMASTER, true, nullptr, "", characterCommandTable },
|
||||
{ "levelup", SEC_GAMEMASTER, false, &HandleLevelUpCommand, "" },
|
||||
{ "pdump", SEC_ADMINISTRATOR, true, nullptr, "", pdumpCommandTable }
|
||||
{ "character", characterCommandTable },
|
||||
{ "levelup", HandleLevelUpCommand, SEC_GAMEMASTER, Console::No },
|
||||
{ "pdump", pdumpCommandTable }
|
||||
};
|
||||
|
||||
return commandTable;
|
||||
}
|
||||
|
||||
@@ -222,7 +229,7 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_RESTORE_DELETE_INFO);
|
||||
auto* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_RESTORE_DELETE_INFO);
|
||||
stmt->setString(0, delInfo.name);
|
||||
stmt->setUInt32(1, delInfo.accountId);
|
||||
stmt->setUInt32(2, delInfo.lowGuid);
|
||||
@@ -255,7 +262,7 @@ public:
|
||||
else
|
||||
{
|
||||
// Update level and reset XP, everything else will be updated at login
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_LEVEL);
|
||||
auto* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_LEVEL);
|
||||
stmt->setUInt8(0, uint8(newLevel));
|
||||
stmt->setUInt32(1, playerGuid.GetCounter());
|
||||
CharacterDatabase.Execute(stmt);
|
||||
@@ -347,7 +354,7 @@ public:
|
||||
std::string oldNameLink = handler->playerLink(targetName);
|
||||
handler->PSendSysMessage(LANG_RENAME_PLAYER_GUID, oldNameLink.c_str(), targetGuid.GetCounter());
|
||||
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
|
||||
auto* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
|
||||
stmt->setUInt16(0, uint16(AT_LOGIN_RENAME));
|
||||
stmt->setUInt32(1, targetGuid.GetCounter());
|
||||
CharacterDatabase.Execute(stmt);
|
||||
@@ -361,29 +368,15 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleCharacterLevelCommand(ChatHandler* handler, char const* args)
|
||||
static bool HandleCharacterLevelCommand(ChatHandler* handler, Optional<PlayerIdentifier> player, int16 newlevel)
|
||||
{
|
||||
char* nameStr;
|
||||
char* levelStr;
|
||||
handler->extractOptFirstArg((char*)args, &nameStr, &levelStr);
|
||||
if (!levelStr)
|
||||
if (!player)
|
||||
player = PlayerIdentifier::FromTargetOrSelf(handler);
|
||||
|
||||
if (!player)
|
||||
return false;
|
||||
|
||||
// exception opt second arg: .character level $name
|
||||
if (isalpha(levelStr[0]))
|
||||
{
|
||||
nameStr = levelStr;
|
||||
levelStr = nullptr; // current level will used
|
||||
}
|
||||
|
||||
Player* target;
|
||||
ObjectGuid targetGuid;
|
||||
std::string targetName;
|
||||
if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid, &targetName))
|
||||
return false;
|
||||
|
||||
int32 oldlevel = target ? target->getLevel() : Player::GetLevelFromStorage(targetGuid.GetCounter());
|
||||
int32 newlevel = levelStr ? atoi(levelStr) : oldlevel;
|
||||
uint8 oldlevel = player->IsConnected() ? player->GetConnectedPlayer()->getLevel() : static_cast<uint8>(Player::GetLevelFromStorage(player->GetGUID().GetCounter()));
|
||||
|
||||
if (newlevel < 1)
|
||||
return false; // invalid level
|
||||
@@ -391,12 +384,10 @@ public:
|
||||
if (newlevel > DEFAULT_MAX_LEVEL) // hardcoded maximum level
|
||||
newlevel = DEFAULT_MAX_LEVEL;
|
||||
|
||||
HandleCharacterLevel(target, targetGuid, oldlevel, newlevel, handler);
|
||||
if (!handler->GetSession() || handler->GetSession()->GetPlayer() != target) // including player == nullptr
|
||||
{
|
||||
std::string nameLink = handler->playerLink(targetName);
|
||||
handler->PSendSysMessage(LANG_YOU_CHANGE_LVL, nameLink.c_str(), newlevel);
|
||||
}
|
||||
HandleCharacterLevel(player->GetConnectedPlayer(), player->GetGUID(), oldlevel, newlevel, handler);
|
||||
|
||||
if (!handler->GetSession() || (handler->GetSession()->GetPlayer() != player->GetConnectedPlayer())) // including chr == NULL
|
||||
handler->PSendSysMessage(LANG_YOU_CHANGE_LVL, handler->playerLink(*player).c_str(), newlevel);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -410,7 +401,7 @@ public:
|
||||
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
|
||||
return false;
|
||||
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
|
||||
auto* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
|
||||
stmt->setUInt16(0, uint16(AT_LOGIN_CUSTOMIZE));
|
||||
if (target)
|
||||
{
|
||||
@@ -438,7 +429,7 @@ public:
|
||||
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
|
||||
return false;
|
||||
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
|
||||
auto* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
|
||||
stmt->setUInt16(0, uint16(AT_LOGIN_CHANGE_FACTION));
|
||||
if (target)
|
||||
{
|
||||
@@ -465,7 +456,7 @@ public:
|
||||
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
|
||||
return false;
|
||||
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
|
||||
auto* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
|
||||
stmt->setUInt16(0, uint16(AT_LOGIN_CHANGE_RACE));
|
||||
if (target)
|
||||
{
|
||||
@@ -745,28 +736,16 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleLevelUpCommand(ChatHandler* handler, char const* args)
|
||||
static bool HandleLevelUpCommand(ChatHandler* handler, Optional<PlayerIdentifier> player, int16 level)
|
||||
{
|
||||
char* nameStr;
|
||||
char* levelStr;
|
||||
handler->extractOptFirstArg((char*)args, &nameStr, &levelStr);
|
||||
if (!player)
|
||||
player = PlayerIdentifier::FromTargetOrSelf(handler);
|
||||
|
||||
// exception opt second arg: .character level $name
|
||||
if (levelStr && isalpha(levelStr[0]))
|
||||
{
|
||||
nameStr = levelStr;
|
||||
levelStr = nullptr; // current level will used
|
||||
}
|
||||
|
||||
Player* target;
|
||||
ObjectGuid targetGuid;
|
||||
std::string targetName;
|
||||
if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid, &targetName))
|
||||
if (!player)
|
||||
return false;
|
||||
|
||||
int32 oldlevel = target ? target->getLevel() : Player::GetLevelFromStorage(targetGuid.GetCounter());
|
||||
int32 addlevel = levelStr ? atoi(levelStr) : 1;
|
||||
int32 newlevel = oldlevel + addlevel;
|
||||
uint8 oldlevel = static_cast<uint8>(player->IsConnected() ? player->GetConnectedPlayer()->getLevel() : Player::GetLevelFromStorage(player->GetGUID().GetCounter()));
|
||||
int16 newlevel = static_cast<int16>(oldlevel) + level;
|
||||
|
||||
if (newlevel < 1)
|
||||
newlevel = 1;
|
||||
@@ -774,13 +753,10 @@ public:
|
||||
if (newlevel > STRONG_MAX_LEVEL) // hardcoded maximum level
|
||||
newlevel = STRONG_MAX_LEVEL;
|
||||
|
||||
HandleCharacterLevel(target, targetGuid, oldlevel, newlevel, handler);
|
||||
HandleCharacterLevel(player->GetConnectedPlayer(), player->GetGUID(), oldlevel, newlevel, handler);
|
||||
|
||||
if (!handler->GetSession() || handler->GetSession()->GetPlayer() != target) // including chr == nullptr
|
||||
{
|
||||
std::string nameLink = handler->playerLink(targetName);
|
||||
handler->PSendSysMessage(LANG_YOU_CHANGE_LVL, nameLink.c_str(), newlevel);
|
||||
}
|
||||
if (!handler->GetSession() || (handler->GetSession()->GetPlayer() != player->GetConnectedPlayer())) // including chr == NULL
|
||||
handler->PSendSysMessage(LANG_YOU_CHANGE_LVL, handler->playerLink(*player).c_str(), newlevel);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -20,14 +20,20 @@
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
|
||||
#if AC_COMPILER == AC_COMPILER_GNU
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
using namespace Acore::ChatCommands;
|
||||
|
||||
class cheat_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
cheat_commandscript() : CommandScript("cheat_commandscript") { }
|
||||
|
||||
std::vector<ChatCommand> GetCommands() const override
|
||||
ChatCommandTable GetCommands() const override
|
||||
{
|
||||
static std::vector<ChatCommand> cheatCommandTable =
|
||||
static ChatCommandTable cheatCommandTable =
|
||||
{
|
||||
{ "god", SEC_GAMEMASTER, false, &HandleGodModeCheatCommand, "" },
|
||||
{ "casttime", SEC_GAMEMASTER, false, &HandleCasttimeCheatCommand, "" },
|
||||
@@ -39,7 +45,7 @@ public:
|
||||
{ "explore", SEC_GAMEMASTER, false, &HandleExploreCheatCommand, "" },
|
||||
};
|
||||
|
||||
static std::vector<ChatCommand> commandTable =
|
||||
static ChatCommandTable commandTable =
|
||||
{
|
||||
{ "cheat", SEC_GAMEMASTER, false, nullptr, "", cheatCommandTable },
|
||||
};
|
||||
|
||||
@@ -34,20 +34,26 @@ EndScriptData */
|
||||
#include "ScriptMgr.h"
|
||||
#include <fstream>
|
||||
|
||||
#if AC_COMPILER == AC_COMPILER_GNU
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
using namespace Acore::ChatCommands;
|
||||
|
||||
class debug_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
debug_commandscript() : CommandScript("debug_commandscript") { }
|
||||
|
||||
std::vector<ChatCommand> GetCommands() const override
|
||||
ChatCommandTable GetCommands() const override
|
||||
{
|
||||
static std::vector<ChatCommand> debugPlayCommandTable =
|
||||
static ChatCommandTable debugPlayCommandTable =
|
||||
{
|
||||
{ "cinematic", SEC_MODERATOR, false, &HandleDebugPlayCinematicCommand, "" },
|
||||
{ "movie", SEC_MODERATOR, false, &HandleDebugPlayMovieCommand, "" },
|
||||
{ "sound", SEC_MODERATOR, false, &HandleDebugPlaySoundCommand, "" }
|
||||
};
|
||||
static std::vector<ChatCommand> debugSendCommandTable =
|
||||
static ChatCommandTable debugSendCommandTable =
|
||||
{
|
||||
{ "buyerror", SEC_ADMINISTRATOR, false, &HandleDebugSendBuyErrorCommand, "" },
|
||||
{ "channelnotify", SEC_ADMINISTRATOR, false, &HandleDebugSendChannelNotifyCommand, "" },
|
||||
@@ -61,7 +67,7 @@ public:
|
||||
{ "setphaseshift", SEC_ADMINISTRATOR, false, &HandleDebugSendSetPhaseShiftCommand, "" },
|
||||
{ "spellfail", SEC_ADMINISTRATOR, false, &HandleDebugSendSpellFailCommand, "" }
|
||||
};
|
||||
static std::vector<ChatCommand> debugCommandTable =
|
||||
static ChatCommandTable debugCommandTable =
|
||||
{
|
||||
{ "setbit", SEC_ADMINISTRATOR, false, &HandleDebugSet32BitCommand, "" },
|
||||
{ "threat", SEC_ADMINISTRATOR, false, &HandleDebugThreatListCommand, "" },
|
||||
@@ -91,7 +97,7 @@ public:
|
||||
{ "moveflags", SEC_ADMINISTRATOR, false, &HandleDebugMoveflagsCommand, "" },
|
||||
{ "unitstate", SEC_ADMINISTRATOR, false, &HandleDebugUnitStateCommand, "" }
|
||||
};
|
||||
static std::vector<ChatCommand> commandTable =
|
||||
static ChatCommandTable commandTable =
|
||||
{
|
||||
{ "debug", SEC_GAMEMASTER, true, nullptr, "", debugCommandTable },
|
||||
{ "wpgps", SEC_ADMINISTRATOR, false, &HandleWPGPSCommand, "", }
|
||||
|
||||
@@ -28,32 +28,38 @@ enum Spells
|
||||
BG_SPELL_DESERTER = 26013
|
||||
};
|
||||
|
||||
#if AC_COMPILER == AC_COMPILER_GNU
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
using namespace Acore::ChatCommands;
|
||||
|
||||
class deserter_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
deserter_commandscript() : CommandScript("deserter_commandscript") { }
|
||||
|
||||
std::vector<ChatCommand> GetCommands() const override
|
||||
ChatCommandTable GetCommands() const override
|
||||
{
|
||||
static std::vector<ChatCommand> deserterinstanceCommandTable =
|
||||
static ChatCommandTable deserterinstanceCommandTable =
|
||||
{
|
||||
{ "add", SEC_ADMINISTRATOR, false, &HandleDeserterInstanceAdd, "" },
|
||||
{ "remove", SEC_ADMINISTRATOR, false, &HandleDeserterInstanceRemove, "" }
|
||||
};
|
||||
|
||||
static std::vector<ChatCommand> deserterBGCommandTable =
|
||||
static ChatCommandTable deserterBGCommandTable =
|
||||
{
|
||||
{ "add", SEC_ADMINISTRATOR, false, &HandleDeserterBGAdd, "" },
|
||||
{ "remove", SEC_ADMINISTRATOR, false, &HandleDeserterBGRemove, "" }
|
||||
};
|
||||
|
||||
static std::vector<ChatCommand> deserterCommandTable =
|
||||
static ChatCommandTable deserterCommandTable =
|
||||
{
|
||||
{ "instance", SEC_ADMINISTRATOR, false, nullptr, "", deserterinstanceCommandTable },
|
||||
{ "bg", SEC_ADMINISTRATOR, false, nullptr, "", deserterBGCommandTable }
|
||||
};
|
||||
|
||||
static std::vector<ChatCommand> commandTable =
|
||||
static ChatCommandTable commandTable =
|
||||
{
|
||||
{ "deserter", SEC_ADMINISTRATOR, false, nullptr, "", deserterCommandTable }
|
||||
};
|
||||
|
||||
@@ -32,14 +32,20 @@ EndScriptData */
|
||||
#include "ScriptMgr.h"
|
||||
#include "SpellMgr.h"
|
||||
|
||||
#if AC_COMPILER == AC_COMPILER_GNU
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
using namespace Acore::ChatCommands;
|
||||
|
||||
class disable_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
disable_commandscript() : CommandScript("disable_commandscript") { }
|
||||
|
||||
std::vector<ChatCommand> GetCommands() const override
|
||||
ChatCommandTable GetCommands() const override
|
||||
{
|
||||
static std::vector<ChatCommand> removeDisableCommandTable =
|
||||
static ChatCommandTable removeDisableCommandTable =
|
||||
{
|
||||
{ "spell", SEC_ADMINISTRATOR, true, &HandleRemoveDisableSpellCommand, "" },
|
||||
{ "quest", SEC_ADMINISTRATOR, true, &HandleRemoveDisableQuestCommand, "" },
|
||||
@@ -48,7 +54,7 @@ public:
|
||||
{ "outdoorpvp", SEC_ADMINISTRATOR, true, &HandleRemoveDisableOutdoorPvPCommand, "" },
|
||||
{ "vmap", SEC_ADMINISTRATOR, true, &HandleRemoveDisableVmapCommand, "" },
|
||||
};
|
||||
static std::vector<ChatCommand> addDisableCommandTable =
|
||||
static ChatCommandTable addDisableCommandTable =
|
||||
{
|
||||
{ "spell", SEC_ADMINISTRATOR, true, &HandleAddDisableSpellCommand, "" },
|
||||
{ "quest", SEC_ADMINISTRATOR, true, &HandleAddDisableQuestCommand, "" },
|
||||
@@ -57,12 +63,12 @@ public:
|
||||
{ "outdoorpvp", SEC_ADMINISTRATOR, true, &HandleAddDisableOutdoorPvPCommand, "" },
|
||||
{ "vmap", SEC_ADMINISTRATOR, true, &HandleAddDisableVmapCommand, "" },
|
||||
};
|
||||
static std::vector<ChatCommand> disableCommandTable =
|
||||
static ChatCommandTable disableCommandTable =
|
||||
{
|
||||
{ "add", SEC_ADMINISTRATOR, true, nullptr, "", addDisableCommandTable },
|
||||
{ "remove", SEC_ADMINISTRATOR, true, nullptr, "", removeDisableCommandTable },
|
||||
};
|
||||
static std::vector<ChatCommand> commandTable =
|
||||
static ChatCommandTable commandTable =
|
||||
{
|
||||
{ "disable", SEC_ADMINISTRATOR, false, nullptr, "", disableCommandTable },
|
||||
};
|
||||
|
||||
@@ -28,21 +28,27 @@ EndScriptData */
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
|
||||
#if AC_COMPILER == AC_COMPILER_GNU
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
using namespace Acore::ChatCommands;
|
||||
|
||||
class event_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
event_commandscript() : CommandScript("event_commandscript") { }
|
||||
|
||||
std::vector<ChatCommand> GetCommands() const override
|
||||
ChatCommandTable GetCommands() const override
|
||||
{
|
||||
static std::vector<ChatCommand> eventCommandTable =
|
||||
static ChatCommandTable eventCommandTable =
|
||||
{
|
||||
{ "activelist", SEC_GAMEMASTER, true, &HandleEventActiveListCommand, "" },
|
||||
{ "start", SEC_GAMEMASTER, true, &HandleEventStartCommand, "" },
|
||||
{ "stop", SEC_GAMEMASTER, true, &HandleEventStopCommand, "" },
|
||||
{ "", SEC_GAMEMASTER, true, &HandleEventInfoCommand, "" }
|
||||
};
|
||||
static std::vector<ChatCommand> commandTable =
|
||||
static ChatCommandTable commandTable =
|
||||
{
|
||||
{ "event", SEC_GAMEMASTER, false, nullptr, "", eventCommandTable }
|
||||
};
|
||||
|
||||
@@ -32,23 +32,29 @@ EndScriptData */
|
||||
#include "ScriptMgr.h"
|
||||
#include "World.h"
|
||||
|
||||
#if AC_COMPILER == AC_COMPILER_GNU
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
using namespace Acore::ChatCommands;
|
||||
|
||||
class gm_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
gm_commandscript() : CommandScript("gm_commandscript") { }
|
||||
|
||||
std::vector<ChatCommand> GetCommands() const override
|
||||
ChatCommandTable GetCommands() const override
|
||||
{
|
||||
static std::vector<ChatCommand> gmCommandTable =
|
||||
static ChatCommandTable gmCommandTable =
|
||||
{
|
||||
{ "chat", SEC_GAMEMASTER, false, &HandleGMChatCommand, "" },
|
||||
{ "fly", SEC_GAMEMASTER, false, &HandleGMFlyCommand, "" },
|
||||
{ "ingame", SEC_PLAYER, true, &HandleGMListIngameCommand, "" },
|
||||
{ "list", SEC_GAMEMASTER, true, &HandleGMListFullCommand, "" },
|
||||
{ "visible", SEC_GAMEMASTER, false, &HandleGMVisibleCommand, "" },
|
||||
{ "", SEC_GAMEMASTER, false, &HandleGMCommand, "" }
|
||||
{ "", SEC_MODERATOR, false, &HandleGMCommand, "" }
|
||||
};
|
||||
static std::vector<ChatCommand> commandTable =
|
||||
static ChatCommandTable commandTable =
|
||||
{
|
||||
{ "gm", SEC_MODERATOR, false, nullptr, "", gmCommandTable }
|
||||
};
|
||||
|
||||
@@ -31,14 +31,20 @@ EndScriptData */
|
||||
#include "ScriptMgr.h"
|
||||
#include "TicketMgr.h"
|
||||
|
||||
#if AC_COMPILER == AC_COMPILER_GNU
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
using namespace Acore::ChatCommands;
|
||||
|
||||
class go_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
go_commandscript() : CommandScript("go_commandscript") { }
|
||||
|
||||
std::vector<ChatCommand> GetCommands() const override
|
||||
ChatCommandTable GetCommands() const override
|
||||
{
|
||||
static std::vector<ChatCommand> goCommandTable =
|
||||
static ChatCommandTable goCommandTable =
|
||||
{
|
||||
{ "creature", SEC_MODERATOR, false, &HandleGoCreatureCommand, "" },
|
||||
{ "graveyard", SEC_MODERATOR, false, &HandleGoGraveyardCommand, "" },
|
||||
@@ -53,7 +59,7 @@ public:
|
||||
{ "", SEC_MODERATOR, false, &HandleGoXYZCommand, "" }
|
||||
};
|
||||
|
||||
static std::vector<ChatCommand> commandTable =
|
||||
static ChatCommandTable commandTable =
|
||||
{
|
||||
{ "go", SEC_MODERATOR, false, nullptr, "", goCommandTable }
|
||||
};
|
||||
|
||||
@@ -34,26 +34,32 @@ EndScriptData */
|
||||
#include "ScriptMgr.h"
|
||||
#include "Transport.h"
|
||||
|
||||
#if AC_COMPILER == AC_COMPILER_GNU
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
using namespace Acore::ChatCommands;
|
||||
|
||||
class gobject_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
gobject_commandscript() : CommandScript("gobject_commandscript") { }
|
||||
|
||||
std::vector<ChatCommand> GetCommands() const override
|
||||
ChatCommandTable GetCommands() const override
|
||||
{
|
||||
static std::vector<ChatCommand> gobjectAddCommandTable =
|
||||
static ChatCommandTable gobjectAddCommandTable =
|
||||
{
|
||||
{ "temp", SEC_GAMEMASTER, false, &HandleGameObjectAddTempCommand, "" },
|
||||
{ "", SEC_ADMINISTRATOR, false, &HandleGameObjectAddCommand, "" }
|
||||
};
|
||||
static std::vector<ChatCommand> gobjectSetCommandTable =
|
||||
static ChatCommandTable gobjectSetCommandTable =
|
||||
{
|
||||
{ "phase", SEC_ADMINISTRATOR, false, &HandleGameObjectSetPhaseCommand, "" },
|
||||
{ "state", SEC_ADMINISTRATOR, false, &HandleGameObjectSetStateCommand, "" }
|
||||
};
|
||||
static std::vector<ChatCommand> gobjectCommandTable =
|
||||
static ChatCommandTable gobjectCommandTable =
|
||||
{
|
||||
{ "activate", SEC_ADMINISTRATOR, false, &HandleGameObjectActivateCommand, "" },
|
||||
{ "activate", SEC_GAMEMASTER, false, &HandleGameObjectActivateCommand, "" },
|
||||
{ "delete", SEC_ADMINISTRATOR, false, &HandleGameObjectDeleteCommand, "" },
|
||||
{ "info", SEC_MODERATOR, false, &HandleGameObjectInfoCommand, "" },
|
||||
{ "move", SEC_ADMINISTRATOR, false, &HandleGameObjectMoveCommand, "" },
|
||||
@@ -63,7 +69,7 @@ public:
|
||||
{ "add", SEC_ADMINISTRATOR, false, nullptr, "", gobjectAddCommandTable },
|
||||
{ "set", SEC_ADMINISTRATOR, false, nullptr, "", gobjectSetCommandTable }
|
||||
};
|
||||
static std::vector<ChatCommand> commandTable =
|
||||
static ChatCommandTable commandTable =
|
||||
{
|
||||
{ "gobject", SEC_MODERATOR, false, nullptr, "", gobjectCommandTable }
|
||||
};
|
||||
|
||||
@@ -29,14 +29,20 @@ EndScriptData */
|
||||
#include "ObjectAccessor.h"
|
||||
#include "ScriptMgr.h"
|
||||
|
||||
#if AC_COMPILER == AC_COMPILER_GNU
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
using namespace Acore::ChatCommands;
|
||||
|
||||
class guild_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
guild_commandscript() : CommandScript("guild_commandscript") { }
|
||||
|
||||
std::vector<ChatCommand> GetCommands() const override
|
||||
ChatCommandTable GetCommands() const override
|
||||
{
|
||||
static std::vector<ChatCommand> guildCommandTable =
|
||||
static ChatCommandTable guildCommandTable =
|
||||
{
|
||||
{ "create", SEC_GAMEMASTER, true, &HandleGuildCreateCommand, "" },
|
||||
{ "delete", SEC_GAMEMASTER, true, &HandleGuildDeleteCommand, "" },
|
||||
@@ -45,7 +51,7 @@ public:
|
||||
{ "rank", SEC_GAMEMASTER, true, &HandleGuildRankCommand, "" },
|
||||
{ "info", SEC_GAMEMASTER, true, &HandleGuildInfoCommand, "" }
|
||||
};
|
||||
static std::vector<ChatCommand> commandTable =
|
||||
static ChatCommandTable commandTable =
|
||||
{
|
||||
{ "guild", SEC_GAMEMASTER, true, nullptr, "", guildCommandTable }
|
||||
};
|
||||
@@ -182,21 +188,15 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleGuildRankCommand(ChatHandler* handler, char const* args)
|
||||
static bool HandleGuildRankCommand(ChatHandler* handler, Optional<PlayerIdentifier> player, uint8 rank)
|
||||
{
|
||||
char* nameStr;
|
||||
char* rankStr;
|
||||
handler->extractOptFirstArg((char*)args, &nameStr, &rankStr);
|
||||
if (!rankStr)
|
||||
if (!player)
|
||||
player = PlayerIdentifier::FromTargetOrSelf(handler);
|
||||
|
||||
if (!player)
|
||||
return false;
|
||||
|
||||
Player* target;
|
||||
ObjectGuid targetGuid;
|
||||
std::string target_name;
|
||||
if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid, &target_name))
|
||||
return false;
|
||||
|
||||
uint32 guildId = target ? target->GetGuildId() : Player::GetGuildIdFromStorage(targetGuid.GetCounter());
|
||||
uint32 guildId = player->IsConnected() ? player->GetConnectedPlayer()->GetGuildId() : Player::GetGuildIdFromStorage(player->GetGUID().GetCounter());
|
||||
if (!guildId)
|
||||
return false;
|
||||
|
||||
@@ -204,8 +204,7 @@ public:
|
||||
if (!targetGuild)
|
||||
return false;
|
||||
|
||||
uint8 newRank = uint8(atoi(rankStr));
|
||||
return targetGuild->ChangeMemberRank(targetGuid, newRank);
|
||||
return targetGuild->ChangeMemberRank(player->GetGUID(), rank);
|
||||
}
|
||||
|
||||
static bool HandleGuildInfoCommand(ChatHandler* handler, char const* args)
|
||||
|
||||
@@ -28,26 +28,32 @@ EndScriptData */
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
|
||||
#if AC_COMPILER == AC_COMPILER_GNU
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
using namespace Acore::ChatCommands;
|
||||
|
||||
class honor_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
honor_commandscript() : CommandScript("honor_commandscript") { }
|
||||
|
||||
std::vector<ChatCommand> GetCommands() const override
|
||||
ChatCommandTable GetCommands() const override
|
||||
{
|
||||
static std::vector<ChatCommand> honorAddCommandTable =
|
||||
static ChatCommandTable honorAddCommandTable =
|
||||
{
|
||||
{ "kill", SEC_GAMEMASTER, false, &HandleHonorAddKillCommand, "" },
|
||||
{ "", SEC_GAMEMASTER, false, &HandleHonorAddCommand, "" }
|
||||
};
|
||||
|
||||
static std::vector<ChatCommand> honorCommandTable =
|
||||
static ChatCommandTable honorCommandTable =
|
||||
{
|
||||
{ "add", SEC_GAMEMASTER, false, nullptr, "", honorAddCommandTable },
|
||||
{ "update", SEC_GAMEMASTER, false, &HandleHonorUpdateCommand, "" }
|
||||
};
|
||||
|
||||
static std::vector<ChatCommand> commandTable =
|
||||
static ChatCommandTable commandTable =
|
||||
{
|
||||
{ "honor", SEC_GAMEMASTER, false, nullptr, "", honorCommandTable }
|
||||
};
|
||||
|
||||
@@ -31,14 +31,20 @@ EndScriptData */
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
|
||||
#if AC_COMPILER == AC_COMPILER_GNU
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
using namespace Acore::ChatCommands;
|
||||
|
||||
class instance_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
instance_commandscript() : CommandScript("instance_commandscript") { }
|
||||
|
||||
std::vector<ChatCommand> GetCommands() const override
|
||||
ChatCommandTable GetCommands() const override
|
||||
{
|
||||
static std::vector<ChatCommand> instanceCommandTable =
|
||||
static ChatCommandTable instanceCommandTable =
|
||||
{
|
||||
{ "listbinds", SEC_MODERATOR, false, &HandleInstanceListBindsCommand, "" },
|
||||
{ "unbind", SEC_GAMEMASTER, false, &HandleInstanceUnbindCommand, "" },
|
||||
@@ -48,7 +54,7 @@ public:
|
||||
{ "getbossstate", SEC_MODERATOR, true, &HandleInstanceGetBossStateCommand, "" }
|
||||
};
|
||||
|
||||
static std::vector<ChatCommand> commandTable =
|
||||
static ChatCommandTable commandTable =
|
||||
{
|
||||
{ "instance", SEC_MODERATOR, true, nullptr, "", instanceCommandTable }
|
||||
};
|
||||
|
||||
@@ -32,14 +32,20 @@ EndScriptData */
|
||||
#include "SpellInfo.h"
|
||||
#include "SpellMgr.h"
|
||||
|
||||
#if AC_COMPILER == AC_COMPILER_GNU
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
using namespace Acore::ChatCommands;
|
||||
|
||||
class learn_commandscript : public CommandScript, public PlayerCommand
|
||||
{
|
||||
public:
|
||||
learn_commandscript() : CommandScript("learn_commandscript") { }
|
||||
|
||||
std::vector<ChatCommand> GetCommands() const override
|
||||
ChatCommandTable GetCommands() const override
|
||||
{
|
||||
static std::vector<ChatCommand> learnAllMyCommandTable =
|
||||
static ChatCommandTable learnAllMyCommandTable =
|
||||
{
|
||||
{ "class", SEC_GAMEMASTER, false, &HandleLearnAllMyClassCommand, "" },
|
||||
{ "pettalents", SEC_GAMEMASTER, false, &HandleLearnAllMyPetTalentsCommand, "" },
|
||||
@@ -47,7 +53,7 @@ public:
|
||||
{ "talents", SEC_GAMEMASTER, false, &HandleLearnAllMyTalentsCommand, "" }
|
||||
};
|
||||
|
||||
static std::vector<ChatCommand> learnAllCommandTable =
|
||||
static ChatCommandTable learnAllCommandTable =
|
||||
{
|
||||
{ "my", SEC_GAMEMASTER, false, nullptr, "", learnAllMyCommandTable },
|
||||
{ "gm", SEC_GAMEMASTER, false, &HandleLearnAllGMCommand, "" },
|
||||
@@ -57,13 +63,13 @@ public:
|
||||
{ "recipes", SEC_GAMEMASTER, false, &HandleLearnAllRecipesCommand, "" }
|
||||
};
|
||||
|
||||
static std::vector<ChatCommand> learnCommandTable =
|
||||
static ChatCommandTable learnCommandTable =
|
||||
{
|
||||
{ "all", SEC_GAMEMASTER, false, nullptr, "", learnAllCommandTable },
|
||||
{ "", SEC_GAMEMASTER, false, &HandleLearnCommand, "" }
|
||||
};
|
||||
|
||||
static std::vector<ChatCommand> commandTable =
|
||||
static ChatCommandTable commandTable =
|
||||
{
|
||||
{ "learn", SEC_GAMEMASTER, false, nullptr, "", learnCommandTable },
|
||||
{ "unlearn", SEC_GAMEMASTER, false, &HandleUnLearnCommand, "" }
|
||||
|
||||
@@ -36,14 +36,20 @@ void GetPlayerInfo(ChatHandler* handler, Player* player)
|
||||
lfg::GetRolesString(sLFGMgr->GetRoles(guid)).c_str(), sLFGMgr->GetComment(guid).c_str());
|
||||
}
|
||||
|
||||
#if AC_COMPILER == AC_COMPILER_GNU
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
using namespace Acore::ChatCommands;
|
||||
|
||||
class lfg_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
lfg_commandscript() : CommandScript("lfg_commandscript") { }
|
||||
|
||||
std::vector<ChatCommand> GetCommands() const override
|
||||
ChatCommandTable GetCommands() const override
|
||||
{
|
||||
static std::vector<ChatCommand> lfgCommandTable =
|
||||
static ChatCommandTable lfgCommandTable =
|
||||
{
|
||||
{ "player", SEC_MODERATOR, false, &HandleLfgPlayerInfoCommand, "" },
|
||||
{ "group", SEC_MODERATOR, false, &HandleLfgGroupInfoCommand, "" },
|
||||
@@ -52,7 +58,7 @@ public:
|
||||
{ "options", SEC_GAMEMASTER, false, &HandleLfgOptionsCommand, "" },
|
||||
};
|
||||
|
||||
static std::vector<ChatCommand> commandTable =
|
||||
static ChatCommandTable commandTable =
|
||||
{
|
||||
{ "lfg", SEC_GAMEMASTER, false, nullptr, "", lfgCommandTable },
|
||||
};
|
||||
|
||||
@@ -29,14 +29,20 @@ EndScriptData */
|
||||
#include "ScriptMgr.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
|
||||
#if AC_COMPILER == AC_COMPILER_GNU
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
using namespace Acore::ChatCommands;
|
||||
|
||||
class list_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
list_commandscript() : CommandScript("list_commandscript") { }
|
||||
|
||||
std::vector<ChatCommand> GetCommands() const override
|
||||
ChatCommandTable GetCommands() const override
|
||||
{
|
||||
static std::vector<ChatCommand> listCommandTable =
|
||||
static ChatCommandTable listCommandTable =
|
||||
{
|
||||
{ "creature", SEC_MODERATOR, true, &HandleListCreatureCommand, "" },
|
||||
{ "item", SEC_MODERATOR, true, &HandleListItemCommand, "" },
|
||||
@@ -44,7 +50,7 @@ public:
|
||||
{ "gobject", SEC_MODERATOR, true, &HandleListObjectCommand, "" },
|
||||
{ "auras", SEC_MODERATOR, false, &HandleListAurasCommand, "" }
|
||||
};
|
||||
static std::vector<ChatCommand> commandTable =
|
||||
static ChatCommandTable commandTable =
|
||||
{
|
||||
{ "list", SEC_MODERATOR, true, nullptr, "", listCommandTable }
|
||||
};
|
||||
|
||||
@@ -32,27 +32,33 @@ EndScriptData */
|
||||
#include "ScriptMgr.h"
|
||||
#include "SpellInfo.h"
|
||||
|
||||
#if AC_COMPILER == AC_COMPILER_GNU
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
using namespace Acore::ChatCommands;
|
||||
|
||||
class lookup_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
lookup_commandscript() : CommandScript("lookup_commandscript") { }
|
||||
|
||||
std::vector<ChatCommand> GetCommands() const override
|
||||
ChatCommandTable GetCommands() const override
|
||||
{
|
||||
static std::vector<ChatCommand> lookupPlayerCommandTable =
|
||||
static ChatCommandTable lookupPlayerCommandTable =
|
||||
{
|
||||
{ "ip", SEC_GAMEMASTER, true, &HandleLookupPlayerIpCommand, "" },
|
||||
{ "account", SEC_GAMEMASTER, true, &HandleLookupPlayerAccountCommand, "" },
|
||||
{ "email", SEC_GAMEMASTER, true, &HandleLookupPlayerEmailCommand, "" }
|
||||
};
|
||||
|
||||
static std::vector<ChatCommand> lookupSpellCommandTable =
|
||||
static ChatCommandTable lookupSpellCommandTable =
|
||||
{
|
||||
{ "id", SEC_MODERATOR, true, &HandleLookupSpellIdCommand, "" },
|
||||
{ "", SEC_MODERATOR, true, &HandleLookupSpellCommand, "" }
|
||||
};
|
||||
|
||||
static std::vector<ChatCommand> lookupCommandTable =
|
||||
static ChatCommandTable lookupCommandTable =
|
||||
{
|
||||
{ "area", SEC_MODERATOR, true, &HandleLookupAreaCommand, "" },
|
||||
{ "creature", SEC_MODERATOR, true, &HandleLookupCreatureCommand, "" },
|
||||
@@ -72,7 +78,7 @@ public:
|
||||
{ "spell", SEC_MODERATOR, true, nullptr, "", lookupSpellCommandTable }
|
||||
};
|
||||
|
||||
static std::vector<ChatCommand> commandTable =
|
||||
static ChatCommandTable commandTable =
|
||||
{
|
||||
{ "lookup", SEC_MODERATOR, true, nullptr, "", lookupCommandTable }
|
||||
};
|
||||
|
||||
@@ -28,14 +28,20 @@ EndScriptData */
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
|
||||
#if AC_COMPILER == AC_COMPILER_GNU
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
using namespace Acore::ChatCommands;
|
||||
|
||||
class message_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
message_commandscript() : CommandScript("message_commandscript") { }
|
||||
|
||||
std::vector<ChatCommand> GetCommands() const override
|
||||
ChatCommandTable GetCommands() const override
|
||||
{
|
||||
static std::vector<ChatCommand> commandTable =
|
||||
static ChatCommandTable commandTable =
|
||||
{
|
||||
{ "nameannounce", SEC_GAMEMASTER, true, &HandleNameAnnounceCommand, "" },
|
||||
{ "gmnameannounce", SEC_GAMEMASTER, true, &HandleGMNameAnnounceCommand, "" },
|
||||
|
||||
@@ -41,14 +41,20 @@
|
||||
#include "TargetedMovementGenerator.h"
|
||||
#include "WeatherMgr.h"
|
||||
|
||||
#if AC_COMPILER == AC_COMPILER_GNU
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
using namespace Acore::ChatCommands;
|
||||
|
||||
class misc_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
misc_commandscript() : CommandScript("misc_commandscript") { }
|
||||
|
||||
std::vector<ChatCommand> GetCommands() const override
|
||||
ChatCommandTable GetCommands() const override
|
||||
{
|
||||
static std::vector<ChatCommand> groupCommandTable =
|
||||
static ChatCommandTable groupCommandTable =
|
||||
{
|
||||
{ "leader", SEC_GAMEMASTER, false, &HandleGroupLeaderCommand, "" },
|
||||
{ "disband", SEC_GAMEMASTER, false, &HandleGroupDisbandCommand, "" },
|
||||
@@ -56,25 +62,25 @@ public:
|
||||
{ "join", SEC_GAMEMASTER, false, &HandleGroupJoinCommand, "" },
|
||||
{ "list", SEC_GAMEMASTER, false, &HandleGroupListCommand, "" }
|
||||
};
|
||||
static std::vector<ChatCommand> petCommandTable =
|
||||
static ChatCommandTable petCommandTable =
|
||||
{
|
||||
{ "create", SEC_GAMEMASTER, false, &HandleCreatePetCommand, "" },
|
||||
{ "learn", SEC_GAMEMASTER, false, &HandlePetLearnCommand, "" },
|
||||
{ "unlearn", SEC_GAMEMASTER, false, &HandlePetUnlearnCommand, "" }
|
||||
};
|
||||
static std::vector<ChatCommand> sendCommandTable =
|
||||
static ChatCommandTable sendCommandTable =
|
||||
{
|
||||
{ "items", SEC_GAMEMASTER, true, &HandleSendItemsCommand, "" },
|
||||
{ "mail", SEC_GAMEMASTER, true, &HandleSendMailCommand, "" },
|
||||
{ "message", SEC_ADMINISTRATOR, true, &HandleSendMessageCommand, "" },
|
||||
{ "money", SEC_GAMEMASTER, true, &HandleSendMoneyCommand, "" }
|
||||
};
|
||||
static std::vector<ChatCommand> gearCommandTable =
|
||||
static ChatCommandTable gearCommandTable =
|
||||
{
|
||||
{ "repair", SEC_GAMEMASTER, false, &HandleGearRepairCommand, "" },
|
||||
{ "stats", SEC_PLAYER, false, &HandleGearStatsCommand, "" }
|
||||
};
|
||||
static std::vector<ChatCommand> commandTable =
|
||||
static ChatCommandTable commandTable =
|
||||
{
|
||||
{ "dev", SEC_ADMINISTRATOR, false, &HandleDevCommand, "" },
|
||||
{ "gps", SEC_MODERATOR, false, &HandleGPSCommand, "" },
|
||||
@@ -894,7 +900,7 @@ public:
|
||||
|
||||
static bool HandleCommandsCommand(ChatHandler* handler, char const* /*args*/)
|
||||
{
|
||||
handler->ShowHelpForCommand(handler->getCommandTable(), "");
|
||||
SendCommandHelpFor(*handler, "");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -993,19 +999,12 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleHelpCommand(ChatHandler* handler, char const* args)
|
||||
static bool HandleHelpCommand(ChatHandler* handler, Tail cmd)
|
||||
{
|
||||
char const* cmd = strtok((char*)args, " ");
|
||||
if (!cmd)
|
||||
{
|
||||
handler->ShowHelpForCommand(handler->getCommandTable(), "help");
|
||||
handler->ShowHelpForCommand(handler->getCommandTable(), "");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!handler->ShowHelpForCommand(handler->getCommandTable(), cmd))
|
||||
handler->SendSysMessage(LANG_NO_HELP_CMD);
|
||||
}
|
||||
Acore::ChatCommands::SendCommandHelpFor(*handler, cmd);
|
||||
|
||||
if (cmd.empty())
|
||||
Acore::ChatCommands::SendCommandHelpFor(*handler, "help");
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -2242,36 +2241,33 @@ public:
|
||||
return true;
|
||||
}
|
||||
// mute player for some times
|
||||
static bool HandleMuteCommand(ChatHandler* handler, char const* args)
|
||||
static bool HandleMuteCommand(ChatHandler* handler, Optional<PlayerIdentifier> player, uint32 notSpeakTime, Tail muteReason)
|
||||
{
|
||||
char* nameStr;
|
||||
char* delayStr;
|
||||
handler->extractOptFirstArg((char*)args, &nameStr, &delayStr);
|
||||
if (!delayStr)
|
||||
std::string muteReasonStr{ muteReason };
|
||||
|
||||
if (muteReason.empty())
|
||||
muteReasonStr = handler->GetAcoreString(LANG_NO_REASON);
|
||||
|
||||
if (!player)
|
||||
player = PlayerIdentifier::FromTarget(handler);
|
||||
|
||||
if (!player)
|
||||
{
|
||||
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
char const* muteReason = strtok(nullptr, "\r");
|
||||
std::string muteReasonStr = handler->GetAcoreString(LANG_NO_REASON);
|
||||
if (muteReason != nullptr)
|
||||
muteReasonStr = muteReason;
|
||||
|
||||
Player* target;
|
||||
ObjectGuid targetGuid;
|
||||
std::string targetName;
|
||||
if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid, &targetName))
|
||||
return false;
|
||||
|
||||
uint32 accountId = target ? target->GetSession()->GetAccountId() : sObjectMgr->GetPlayerAccountIdByGUID(targetGuid.GetCounter());
|
||||
Player* target = player->GetConnectedPlayer();
|
||||
uint32 accountId = target ? target->GetSession()->GetAccountId() : sObjectMgr->GetPlayerAccountIdByGUID(player->GetGUID().GetCounter());
|
||||
|
||||
// find only player from same account if any
|
||||
if (!target)
|
||||
if (WorldSession* session = sWorld->FindSession(accountId))
|
||||
target = session->GetPlayer();
|
||||
|
||||
uint32 notSpeakTime = uint32(atoi(delayStr));
|
||||
|
||||
// must have strong lesser security level
|
||||
if (handler->HasLowerSecurity (target, targetGuid, true))
|
||||
if (handler->HasLowerSecurity(target, player->GetGUID(), true))
|
||||
return false;
|
||||
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME);
|
||||
@@ -2287,7 +2283,7 @@ public:
|
||||
int64 muteTime = time(nullptr) + notSpeakTime * MINUTE;
|
||||
target->GetSession()->m_muteTime = muteTime;
|
||||
stmt->setInt64(0, muteTime);
|
||||
std::string nameLink = handler->playerLink(targetName);
|
||||
std::string nameLink = handler->playerLink(player->GetName());
|
||||
|
||||
if (sWorld->getBoolConfig(CONFIG_SHOW_MUTE_IN_WORLD))
|
||||
sWorld->SendWorldText(LANG_COMMAND_MUTEMESSAGE_WORLD, muteBy.c_str(), nameLink.c_str(), notSpeakTime, muteReasonStr.c_str());
|
||||
@@ -2297,21 +2293,22 @@ public:
|
||||
else
|
||||
{
|
||||
// Target is offline, mute will be in effect starting from the next login.
|
||||
int32 muteTime = -int32(notSpeakTime * MINUTE);
|
||||
stmt->setInt64(0, muteTime);
|
||||
stmt->setInt32(0, -int32(notSpeakTime * MINUTE));
|
||||
}
|
||||
|
||||
stmt->setString(1, muteReasonStr);
|
||||
stmt->setString(2, muteBy);
|
||||
stmt->setUInt32(3, accountId);
|
||||
LoginDatabase.Execute(stmt);
|
||||
|
||||
stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_ACCOUNT_MUTE);
|
||||
stmt->setUInt32(0, accountId);
|
||||
stmt->setUInt32(1, notSpeakTime);
|
||||
stmt->setString(2, muteBy);
|
||||
stmt->setString(3, muteReasonStr);
|
||||
LoginDatabase.Execute(stmt);
|
||||
std::string nameLink = handler->playerLink(targetName);
|
||||
|
||||
std::string nameLink = handler->playerLink(player->GetName());
|
||||
|
||||
if (sWorld->getBoolConfig(CONFIG_SHOW_MUTE_IN_WORLD) && !target)
|
||||
sWorld->SendWorldText(LANG_COMMAND_MUTEMESSAGE_WORLD, muteBy.c_str(), nameLink.c_str(), notSpeakTime, muteReasonStr.c_str());
|
||||
@@ -2322,7 +2319,8 @@ public:
|
||||
HashMapHolder<Player>::MapType const& m = ObjectAccessor::GetPlayers();
|
||||
for (HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
if (itr->second->GetSession()->GetSecurity())
|
||||
ChatHandler(itr->second->GetSession()).PSendSysMessage(target ? LANG_YOU_DISABLE_CHAT : LANG_COMMAND_DISABLE_CHAT_DELAYED, (handler->GetSession() ? handler->GetSession()->GetPlayerName().c_str() : handler->GetAcoreString(LANG_CONSOLE)), nameLink.c_str(), notSpeakTime, muteReasonStr.c_str());
|
||||
ChatHandler(itr->second->GetSession()).PSendSysMessage(target ? LANG_YOU_DISABLE_CHAT : LANG_COMMAND_DISABLE_CHAT_DELAYED,
|
||||
(handler->GetSession() ? handler->GetSession()->GetPlayerName().c_str() : handler->GetAcoreString(LANG_CONSOLE)), nameLink.c_str(), notSpeakTime, muteReasonStr.c_str());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -36,14 +36,20 @@
|
||||
#include "ScriptMgr.h"
|
||||
#include "TargetedMovementGenerator.h"
|
||||
|
||||
#if AC_COMPILER == AC_COMPILER_GNU
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
using namespace Acore::ChatCommands;
|
||||
|
||||
class mmaps_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
mmaps_commandscript() : CommandScript("mmaps_commandscript") { }
|
||||
|
||||
std::vector<ChatCommand> GetCommands() const override
|
||||
ChatCommandTable GetCommands() const override
|
||||
{
|
||||
static std::vector<ChatCommand> mmapCommandTable =
|
||||
static ChatCommandTable mmapCommandTable =
|
||||
{
|
||||
{ "loadedtiles", SEC_ADMINISTRATOR, false, &HandleMmapLoadedTilesCommand, "" },
|
||||
{ "loc", SEC_ADMINISTRATOR, false, &HandleMmapLocCommand, "" },
|
||||
@@ -52,7 +58,7 @@ public:
|
||||
{ "testarea", SEC_ADMINISTRATOR, false, &HandleMmapTestArea, "" },
|
||||
};
|
||||
|
||||
static std::vector<ChatCommand> commandTable =
|
||||
static ChatCommandTable commandTable =
|
||||
{
|
||||
{ "mmap", SEC_ADMINISTRATOR, true, nullptr, "", mmapCommandTable },
|
||||
};
|
||||
|
||||
@@ -32,14 +32,20 @@ EndScriptData */
|
||||
#include "ScriptMgr.h"
|
||||
#include "StringConvert.h"
|
||||
|
||||
#if AC_COMPILER == AC_COMPILER_GNU
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
using namespace Acore::ChatCommands;
|
||||
|
||||
class modify_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
modify_commandscript() : CommandScript("modify_commandscript") { }
|
||||
|
||||
std::vector<ChatCommand> GetCommands() const override
|
||||
ChatCommandTable GetCommands() const override
|
||||
{
|
||||
static std::vector<ChatCommand> modifyspeedCommandTable =
|
||||
static ChatCommandTable modifyspeedCommandTable =
|
||||
{
|
||||
{ "fly", SEC_GAMEMASTER, false, &HandleModifyFlyCommand, "" },
|
||||
{ "all", SEC_GAMEMASTER, false, &HandleModifyASpeedCommand, "" },
|
||||
@@ -49,7 +55,7 @@ public:
|
||||
{ "", SEC_GAMEMASTER, false, &HandleModifyASpeedCommand, "" }
|
||||
};
|
||||
|
||||
static std::vector<ChatCommand> modifyCommandTable =
|
||||
static ChatCommandTable modifyCommandTable =
|
||||
{
|
||||
{ "hp", SEC_GAMEMASTER, false, &HandleModifyHPCommand, "" },
|
||||
{ "mana", SEC_GAMEMASTER, false, &HandleModifyManaCommand, "" },
|
||||
@@ -60,7 +66,7 @@ public:
|
||||
{ "scale", SEC_GAMEMASTER, false, &HandleModifyScaleCommand, "" },
|
||||
{ "bit", SEC_GAMEMASTER, false, &HandleModifyBitCommand, "" },
|
||||
{ "faction", SEC_ADMINISTRATOR, false, &HandleModifyFactionCommand, "" },
|
||||
{ "spell", SEC_GAMEMASTER, false, &HandleModifySpellCommand, "" },
|
||||
{ "spell", SEC_CONSOLE, false, &HandleModifySpellCommand, "" },
|
||||
{ "talentpoints", SEC_GAMEMASTER, false, &HandleModifyTalentCommand, "" },
|
||||
{ "mount", SEC_GAMEMASTER, false, &HandleModifyMountCommand, "" },
|
||||
{ "honor", SEC_GAMEMASTER, false, &HandleModifyHonorCommand, "" },
|
||||
@@ -73,13 +79,13 @@ public:
|
||||
{ "speed", SEC_GAMEMASTER, false, nullptr, "", modifyspeedCommandTable }
|
||||
};
|
||||
|
||||
static std::vector<ChatCommand> morphCommandTable =
|
||||
static ChatCommandTable morphCommandTable =
|
||||
{
|
||||
{ "reset", SEC_MODERATOR, false, &HandleMorphResetCommand, "" },
|
||||
{ "target", SEC_MODERATOR, false, &HandleMorphTargetCommand, "" }
|
||||
};
|
||||
|
||||
static std::vector<ChatCommand> commandTable =
|
||||
static ChatCommandTable commandTable =
|
||||
{
|
||||
{ "morph", SEC_MODERATOR, false, nullptr, "", morphCommandTable },
|
||||
{ "modify", SEC_GAMEMASTER, false, nullptr, "", modifyCommandTable }
|
||||
|
||||
@@ -34,6 +34,12 @@ EndScriptData */
|
||||
#include "Transport.h"
|
||||
#include <string>
|
||||
|
||||
#if AC_COMPILER == AC_COMPILER_GNU
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
using namespace Acore::ChatCommands;
|
||||
|
||||
struct NpcFlagText
|
||||
{
|
||||
uint32 flag;
|
||||
@@ -136,9 +142,9 @@ class npc_commandscript : public CommandScript
|
||||
public:
|
||||
npc_commandscript() : CommandScript("npc_commandscript") { }
|
||||
|
||||
std::vector<ChatCommand> GetCommands() const override
|
||||
ChatCommandTable GetCommands() const override
|
||||
{
|
||||
static std::vector<ChatCommand> npcAddCommandTable =
|
||||
static ChatCommandTable npcAddCommandTable =
|
||||
{
|
||||
{ "formation", SEC_ADMINISTRATOR, false, &HandleNpcAddFormationCommand, "" },
|
||||
{ "item", SEC_ADMINISTRATOR, false, &HandleNpcAddVendorItemCommand, "" },
|
||||
@@ -149,25 +155,25 @@ public:
|
||||
//}
|
||||
{ "", SEC_ADMINISTRATOR, false, &HandleNpcAddCommand, "" }
|
||||
};
|
||||
static std::vector<ChatCommand> npcDeleteCommandTable =
|
||||
static ChatCommandTable npcDeleteCommandTable =
|
||||
{
|
||||
{ "item", SEC_ADMINISTRATOR, false, &HandleNpcDeleteVendorItemCommand, "" },
|
||||
{ "", SEC_ADMINISTRATOR, false, &HandleNpcDeleteCommand, "" }
|
||||
};
|
||||
static std::vector<ChatCommand> npcFollowCommandTable =
|
||||
static ChatCommandTable npcFollowCommandTable =
|
||||
{
|
||||
{ "stop", SEC_GAMEMASTER, false, &HandleNpcUnFollowCommand, "" },
|
||||
{ "", SEC_GAMEMASTER, false, &HandleNpcFollowCommand, "" }
|
||||
};
|
||||
|
||||
static std::vector<ChatCommand> npcFactionCommandTable =
|
||||
static ChatCommandTable npcFactionCommandTable =
|
||||
{
|
||||
{ "permanent", SEC_ADMINISTRATOR, false, &HandleNpcSetFactionIdCommand, "" },
|
||||
{ "temp", SEC_ADMINISTRATOR, false, &HandleNpcSetFactionTempIdCommand, "" },
|
||||
{ "original", SEC_ADMINISTRATOR, false, &HandleNpcSetOriginalFaction, "" }
|
||||
};
|
||||
|
||||
static std::vector<ChatCommand> npcSetCommandTable =
|
||||
static ChatCommandTable npcSetCommandTable =
|
||||
{
|
||||
{ "allowmove", SEC_ADMINISTRATOR, false, &HandleNpcSetAllowMovementCommand, "" },
|
||||
{ "entry", SEC_ADMINISTRATOR, false, &HandleNpcSetEntryCommand, "" },
|
||||
@@ -186,7 +192,7 @@ public:
|
||||
{ "subname", SEC_ADMINISTRATOR, false, &HandleNpcSetSubNameCommand, "" }
|
||||
//}
|
||||
};
|
||||
static std::vector<ChatCommand> npcCommandTable =
|
||||
static ChatCommandTable npcCommandTable =
|
||||
{
|
||||
{ "info", SEC_MODERATOR, false, &HandleNpcInfoCommand, "" },
|
||||
{ "near", SEC_GAMEMASTER, false, &HandleNpcNearCommand, "" },
|
||||
@@ -202,7 +208,7 @@ public:
|
||||
{ "follow", SEC_GAMEMASTER, false, nullptr, "", npcFollowCommandTable },
|
||||
{ "set", SEC_ADMINISTRATOR, false, nullptr, "", npcSetCommandTable }
|
||||
};
|
||||
static std::vector<ChatCommand> commandTable =
|
||||
static ChatCommandTable commandTable =
|
||||
{
|
||||
{ "npc", SEC_MODERATOR, false, nullptr, "", npcCommandTable }
|
||||
};
|
||||
@@ -705,7 +711,7 @@ public:
|
||||
|
||||
creature->AI()->SetData(data_1, data_2);
|
||||
std::string AIorScript = creature->GetAIName() != "" ? "AI type: " + creature->GetAIName() : (creature->GetScriptName() != "" ? "Script Name: " + creature->GetScriptName() : "No AI or Script Name Set");
|
||||
handler->PSendSysMessage(LANG_NPC_SETDATA, creature->GetGUID(), creature->GetEntry(), creature->GetName().c_str(), data_1, data_2, AIorScript.c_str());
|
||||
handler->PSendSysMessage(LANG_NPC_SETDATA, creature->GetGUID().GetCounter(), creature->GetEntry(), creature->GetName().c_str(), data_1, data_2, AIorScript.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,20 +21,26 @@
|
||||
#include "PlayerCommand.h"
|
||||
#include "ScriptMgr.h"
|
||||
|
||||
#if AC_COMPILER == AC_COMPILER_GNU
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
using namespace Acore::ChatCommands;
|
||||
|
||||
class player_commandscript : public CommandScript, public PlayerCommand
|
||||
{
|
||||
public:
|
||||
player_commandscript() : CommandScript("player_commandscript") { }
|
||||
|
||||
std::vector<ChatCommand> GetCommands() const override
|
||||
ChatCommandTable GetCommands() const override
|
||||
{
|
||||
static std::vector<ChatCommand> playerCommandTable =
|
||||
static ChatCommandTable playerCommandTable =
|
||||
{
|
||||
{ "learn", SEC_GAMEMASTER, true, &HandlePlayerLearnCommand, "" },
|
||||
{ "unlearn", SEC_GAMEMASTER, true, &HandlePlayerUnLearnCommand, "" }
|
||||
};
|
||||
|
||||
static std::vector<ChatCommand> commandTable =
|
||||
static ChatCommandTable commandTable =
|
||||
{
|
||||
{ "player", SEC_GAMEMASTER, true, nullptr, "", playerCommandTable }
|
||||
};
|
||||
|
||||
@@ -28,21 +28,27 @@ EndScriptData */
|
||||
#include "ReputationMgr.h"
|
||||
#include "ScriptMgr.h"
|
||||
|
||||
#if AC_COMPILER == AC_COMPILER_GNU
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
using namespace Acore::ChatCommands;
|
||||
|
||||
class quest_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
quest_commandscript() : CommandScript("quest_commandscript") { }
|
||||
|
||||
std::vector<ChatCommand> GetCommands() const override
|
||||
ChatCommandTable GetCommands() const override
|
||||
{
|
||||
static std::vector<ChatCommand> questCommandTable =
|
||||
static ChatCommandTable questCommandTable =
|
||||
{
|
||||
{ "add", SEC_GAMEMASTER, false, &HandleQuestAdd, "" },
|
||||
{ "complete", SEC_GAMEMASTER, false, &HandleQuestComplete, "" },
|
||||
{ "remove", SEC_GAMEMASTER, false, &HandleQuestRemove, "" },
|
||||
{ "reward", SEC_GAMEMASTER, false, &HandleQuestReward, "" },
|
||||
};
|
||||
static std::vector<ChatCommand> commandTable =
|
||||
static ChatCommandTable commandTable =
|
||||
{
|
||||
{ "quest", SEC_GAMEMASTER, false, nullptr, "", questCommandTable },
|
||||
};
|
||||
|
||||
@@ -44,14 +44,20 @@ EndScriptData */
|
||||
#include "StringConvert.h"
|
||||
#include "Tokenize.h"
|
||||
|
||||
#if AC_COMPILER == AC_COMPILER_GNU
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
using namespace Acore::ChatCommands;
|
||||
|
||||
class reload_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
reload_commandscript() : CommandScript("reload_commandscript") { }
|
||||
|
||||
std::vector<ChatCommand> GetCommands() const override
|
||||
ChatCommandTable GetCommands() const override
|
||||
{
|
||||
static std::vector<ChatCommand> reloadAllCommandTable =
|
||||
static ChatCommandTable reloadAllCommandTable =
|
||||
{
|
||||
{ "achievement", SEC_ADMINISTRATOR, true, &HandleReloadAllAchievementCommand, "" },
|
||||
{ "area", SEC_ADMINISTRATOR, true, &HandleReloadAllAreaCommand, "" },
|
||||
@@ -65,7 +71,7 @@ public:
|
||||
{ "spell", SEC_ADMINISTRATOR, true, &HandleReloadAllSpellCommand, "" },
|
||||
{ "", SEC_ADMINISTRATOR, true, &HandleReloadAllCommand, "" }
|
||||
};
|
||||
static std::vector<ChatCommand> reloadCommandTable =
|
||||
static ChatCommandTable reloadCommandTable =
|
||||
{
|
||||
{ "auctions", SEC_ADMINISTRATOR, true, &HandleReloadAuctionsCommand, "" },
|
||||
{ "dungeon_access_template", SEC_ADMINISTRATOR, true, &HandleReloadDungeonAccessCommand, "" },
|
||||
@@ -85,7 +91,7 @@ public:
|
||||
{ "config", SEC_ADMINISTRATOR, true, &HandleReloadConfigCommand, "" },
|
||||
{ "creature_text", SEC_ADMINISTRATOR, true, &HandleReloadCreatureText, "" },
|
||||
{ "creature_questender", SEC_ADMINISTRATOR, true, &HandleReloadCreatureQuestEnderCommand, "" },
|
||||
{ "creature_linked_respawn", SEC_GAMEMASTER, true, &HandleReloadLinkedRespawnCommand, "" },
|
||||
{ "creature_linked_respawn", SEC_ADMINISTRATOR, true, &HandleReloadLinkedRespawnCommand, "" },
|
||||
{ "creature_loot_template", SEC_ADMINISTRATOR, true, &HandleReloadLootTemplatesCreatureCommand, "" },
|
||||
{ "creature_onkill_reputation", SEC_ADMINISTRATOR, true, &HandleReloadOnKillReputationCommand, "" },
|
||||
{ "creature_queststarter", SEC_ADMINISTRATOR, true, &HandleReloadCreatureQuestStarterCommand, "" },
|
||||
@@ -161,7 +167,7 @@ public:
|
||||
{ "vehicle_accessory", SEC_ADMINISTRATOR, true, &HandleReloadVehicleAccessoryCommand, "" },
|
||||
{ "vehicle_template_accessory", SEC_ADMINISTRATOR, true, &HandleReloadVehicleTemplateAccessoryCommand, "" }
|
||||
};
|
||||
static std::vector<ChatCommand> commandTable =
|
||||
static ChatCommandTable commandTable =
|
||||
{
|
||||
{ "reload", SEC_ADMINISTRATOR, true, nullptr, "", reloadCommandTable }
|
||||
};
|
||||
@@ -405,9 +411,13 @@ public:
|
||||
|
||||
static bool HandleReloadCommandCommand(ChatHandler* handler, const char* /*args*/)
|
||||
{
|
||||
handler->SetLoadCommandTable(true);
|
||||
handler->SendGlobalGMSysMessage("DB table `command` will be reloaded at next chat command use.");
|
||||
return true;
|
||||
LOG_INFO("server.loading", "Reloading .command information...");
|
||||
Acore::ChatCommands::LoadCommandMap();
|
||||
handler->SendGlobalGMSysMessage("DB table `command` reloaded.");
|
||||
|
||||
// do not log this invocation, otherwise we might crash (the command table we used to get here is no longer valid!)
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool HandleReloadOnKillReputationCommand(ChatHandler* handler, const char* /*args*/)
|
||||
|
||||
@@ -30,14 +30,20 @@ EndScriptData */
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
|
||||
#if AC_COMPILER == AC_COMPILER_GNU
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
using namespace Acore::ChatCommands;
|
||||
|
||||
class reset_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
reset_commandscript() : CommandScript("reset_commandscript") { }
|
||||
|
||||
std::vector<ChatCommand> GetCommands() const override
|
||||
ChatCommandTable GetCommands() const override
|
||||
{
|
||||
static std::vector<ChatCommand> resetCommandTable =
|
||||
static ChatCommandTable resetCommandTable =
|
||||
{
|
||||
{ "achievements", SEC_CONSOLE, true, &HandleResetAchievementsCommand, "" },
|
||||
{ "honor", SEC_ADMINISTRATOR, true, &HandleResetHonorCommand, "" },
|
||||
@@ -47,7 +53,7 @@ public:
|
||||
{ "talents", SEC_ADMINISTRATOR, true, &HandleResetTalentsCommand, "" },
|
||||
{ "all", SEC_CONSOLE, true, &HandleResetAllCommand, "" }
|
||||
};
|
||||
static std::vector<ChatCommand> commandTable =
|
||||
static ChatCommandTable commandTable =
|
||||
{
|
||||
{ "reset", SEC_ADMINISTRATOR, true, nullptr, "", resetCommandTable }
|
||||
};
|
||||
|
||||
@@ -41,38 +41,44 @@ EndScriptData */
|
||||
#include <openssl/opensslv.h>
|
||||
#include <numeric>
|
||||
|
||||
#if AC_COMPILER == AC_COMPILER_GNU
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
using namespace Acore::ChatCommands;
|
||||
|
||||
class server_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
server_commandscript() : CommandScript("server_commandscript") { }
|
||||
|
||||
std::vector<ChatCommand> GetCommands() const override
|
||||
ChatCommandTable GetCommands() const override
|
||||
{
|
||||
static std::vector<ChatCommand> serverIdleRestartCommandTable =
|
||||
static ChatCommandTable serverIdleRestartCommandTable =
|
||||
{
|
||||
{ "cancel", SEC_ADMINISTRATOR, true, &HandleServerShutDownCancelCommand, "" },
|
||||
{ "", SEC_ADMINISTRATOR, true, &HandleServerIdleRestartCommand, "" }
|
||||
{ "cancel", SEC_ADMINISTRATOR, true, &HandleServerShutDownCancelCommand, "" },
|
||||
{ "", SEC_CONSOLE, true, &HandleServerIdleRestartCommand, "" }
|
||||
};
|
||||
|
||||
static std::vector<ChatCommand> serverIdleShutdownCommandTable =
|
||||
static ChatCommandTable serverIdleShutdownCommandTable =
|
||||
{
|
||||
{ "cancel", SEC_ADMINISTRATOR, true, &HandleServerShutDownCancelCommand, "" },
|
||||
{ "", SEC_ADMINISTRATOR, true, &HandleServerIdleShutDownCommand, "" }
|
||||
{ "cancel", SEC_ADMINISTRATOR, true, &HandleServerShutDownCancelCommand, "" },
|
||||
{ "", SEC_CONSOLE, true, &HandleServerIdleShutDownCommand, "" }
|
||||
};
|
||||
|
||||
static std::vector<ChatCommand> serverRestartCommandTable =
|
||||
static ChatCommandTable serverRestartCommandTable =
|
||||
{
|
||||
{ "cancel", SEC_ADMINISTRATOR, true, &HandleServerShutDownCancelCommand, "" },
|
||||
{ "", SEC_ADMINISTRATOR, true, &HandleServerRestartCommand, "" }
|
||||
{ "cancel", SEC_ADMINISTRATOR, true, &HandleServerShutDownCancelCommand, "" },
|
||||
{ "", SEC_ADMINISTRATOR, true, &HandleServerRestartCommand, "" }
|
||||
};
|
||||
|
||||
static std::vector<ChatCommand> serverShutdownCommandTable =
|
||||
static ChatCommandTable serverShutdownCommandTable =
|
||||
{
|
||||
{ "cancel", SEC_ADMINISTRATOR, true, &HandleServerShutDownCancelCommand, "" },
|
||||
{ "", SEC_ADMINISTRATOR, true, &HandleServerShutDownCommand, "" }
|
||||
{ "cancel", SEC_ADMINISTRATOR, true, &HandleServerShutDownCancelCommand, "" },
|
||||
{ "", SEC_ADMINISTRATOR, true, &HandleServerShutDownCommand, "" }
|
||||
};
|
||||
|
||||
static std::vector<ChatCommand> serverSetCommandTable =
|
||||
static ChatCommandTable serverSetCommandTable =
|
||||
{
|
||||
{ "difftime", SEC_CONSOLE, true, &HandleServerSetDiffTimeCommand, "" },
|
||||
{ "loglevel", SEC_CONSOLE, true, &HandleServerSetLogLevelCommand, "" },
|
||||
@@ -80,7 +86,7 @@ public:
|
||||
{ "closed", SEC_CONSOLE, true, &HandleServerSetClosedCommand, "" }
|
||||
};
|
||||
|
||||
static std::vector<ChatCommand> serverCommandTable =
|
||||
static ChatCommandTable serverCommandTable =
|
||||
{
|
||||
{ "corpses", SEC_GAMEMASTER, true, &HandleServerCorpsesCommand, "" },
|
||||
{ "debug", SEC_ADMINISTRATOR, true, &HandleServerDebugCommand, "" },
|
||||
@@ -94,7 +100,7 @@ public:
|
||||
{ "set", SEC_ADMINISTRATOR, true, nullptr, "", serverSetCommandTable }
|
||||
};
|
||||
|
||||
static std::vector<ChatCommand> commandTable =
|
||||
static ChatCommandTable commandTable =
|
||||
{
|
||||
{ "server", SEC_PLAYER, true, nullptr, "", serverCommandTable }
|
||||
};
|
||||
|
||||
@@ -23,25 +23,31 @@
|
||||
#include "ScriptMgr.h"
|
||||
#include "World.h"
|
||||
|
||||
#if AC_COMPILER == AC_COMPILER_GNU
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
using namespace Acore::ChatCommands;
|
||||
|
||||
class spectator_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
spectator_commandscript() : CommandScript("spectator_commandscript") { }
|
||||
|
||||
std::vector<ChatCommand> GetCommands() const override
|
||||
ChatCommandTable GetCommands() const override
|
||||
{
|
||||
static std::vector<ChatCommand> spectatorCommandTable =
|
||||
static ChatCommandTable spectatorCommandTable =
|
||||
{
|
||||
{ "version", SEC_CONSOLE, false, &HandleSpectatorVersionCommand, "" },
|
||||
{ "reset", SEC_CONSOLE, false, &HandleSpectatorResetCommand, "" },
|
||||
{ "spectate", SEC_CONSOLE, false, &HandleSpectatorSpectateCommand, "" },
|
||||
{ "watch", SEC_CONSOLE, false, &HandleSpectatorWatchCommand, "" },
|
||||
{ "leave", SEC_CONSOLE, false, &HandleSpectatorLeaveCommand, "" },
|
||||
{ "", SEC_CONSOLE, false, &HandleSpectatorCommand, "" }
|
||||
{ "version", SEC_PLAYER, false, &HandleSpectatorVersionCommand, "" },
|
||||
{ "reset", SEC_PLAYER, false, &HandleSpectatorResetCommand, "" },
|
||||
{ "spectate", SEC_PLAYER, false, &HandleSpectatorSpectateCommand, "" },
|
||||
{ "watch", SEC_PLAYER, false, &HandleSpectatorWatchCommand, "" },
|
||||
{ "leave", SEC_PLAYER, false, &HandleSpectatorLeaveCommand, "" },
|
||||
{ "", SEC_PLAYER, false, &HandleSpectatorCommand, "" }
|
||||
};
|
||||
static std::vector<ChatCommand> commandTable =
|
||||
static ChatCommandTable commandTable =
|
||||
{
|
||||
{ "spect", SEC_CONSOLE, false, nullptr, "", spectatorCommandTable }
|
||||
{ "spect", SEC_PLAYER, false, nullptr, "", spectatorCommandTable }
|
||||
};
|
||||
return commandTable;
|
||||
}
|
||||
|
||||
@@ -30,14 +30,20 @@ EndScriptData */
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
|
||||
#if AC_COMPILER == AC_COMPILER_GNU
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
using namespace Acore::ChatCommands;
|
||||
|
||||
class tele_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
tele_commandscript() : CommandScript("tele_commandscript") { }
|
||||
|
||||
std::vector<ChatCommand> GetCommands() const override
|
||||
ChatCommandTable GetCommands() const override
|
||||
{
|
||||
static std::vector<ChatCommand> teleCommandTable =
|
||||
static ChatCommandTable teleCommandTable =
|
||||
{
|
||||
{ "add", SEC_ADMINISTRATOR, false, &HandleTeleAddCommand, "" },
|
||||
{ "del", SEC_ADMINISTRATOR, true, &HandleTeleDelCommand, "" },
|
||||
@@ -45,7 +51,7 @@ public:
|
||||
{ "group", SEC_GAMEMASTER, false, &HandleTeleGroupCommand, "" },
|
||||
{ "", SEC_MODERATOR, false, &HandleTeleCommand, "" }
|
||||
};
|
||||
static std::vector<ChatCommand> commandTable =
|
||||
static ChatCommandTable commandTable =
|
||||
{
|
||||
{ "teleport", SEC_MODERATOR, false, nullptr, "", teleCommandTable }
|
||||
};
|
||||
@@ -92,82 +98,37 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleTeleDelCommand(ChatHandler* handler, const char* args)
|
||||
static bool HandleTeleDelCommand(ChatHandler* handler, GameTele const* tele)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
// id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r
|
||||
GameTele const* tele = handler->extractGameTeleFromLink((char*)args);
|
||||
if (!tele)
|
||||
{
|
||||
handler->SendSysMessage(LANG_COMMAND_TELE_NOTFOUND);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string name = tele->name;
|
||||
sObjectMgr->DeleteGameTele(name);
|
||||
handler->SendSysMessage(LANG_COMMAND_TP_DELETED);
|
||||
return true;
|
||||
}
|
||||
|
||||
// teleport player to given game_tele.entry
|
||||
static bool HandleTeleNameCommand(ChatHandler* handler, const char* args)
|
||||
static bool DoNameTeleport(ChatHandler* handler, PlayerIdentifier player, uint32 mapId, Position const& pos, std::string const& locationName)
|
||||
{
|
||||
char* nameStr;
|
||||
char* teleStr;
|
||||
handler->extractOptFirstArg((char*)args, &nameStr, &teleStr);
|
||||
if (!teleStr)
|
||||
return false;
|
||||
|
||||
Player* target;
|
||||
ObjectGuid target_guid;
|
||||
std::string target_name;
|
||||
if (!handler->extractPlayerTarget(nameStr, &target, &target_guid, &target_name))
|
||||
return false;
|
||||
|
||||
if (strcmp(teleStr, "$home") == 0) // References target's homebind
|
||||
if (!MapMgr::IsValidMapCoord(mapId, pos) || sObjectMgr->IsTransportMap(mapId))
|
||||
{
|
||||
if (target)
|
||||
target->TeleportTo(target->m_homebindMapId, target->m_homebindX, target->m_homebindY, target->m_homebindZ, target->GetOrientation());
|
||||
else
|
||||
{
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_HOMEBIND);
|
||||
stmt->setUInt32(0, target_guid.GetCounter());
|
||||
PreparedQueryResult resultDB = CharacterDatabase.Query(stmt);
|
||||
|
||||
if (resultDB)
|
||||
{
|
||||
Field* fieldsDB = resultDB->Fetch();
|
||||
uint32 mapId = fieldsDB[0].GetUInt16();
|
||||
uint32 zoneId = fieldsDB[1].GetUInt16();
|
||||
float posX = fieldsDB[2].GetFloat();
|
||||
float posY = fieldsDB[3].GetFloat();
|
||||
float posZ = fieldsDB[4].GetFloat();
|
||||
|
||||
Player::SavePositionInDB(mapId, posX, posY, posZ, 0, zoneId, target_guid);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r
|
||||
GameTele const* tele = handler->extractGameTeleFromLink(teleStr);
|
||||
if (!tele)
|
||||
{
|
||||
handler->SendSysMessage(LANG_COMMAND_TELE_NOTFOUND);
|
||||
handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, pos.GetPositionX(), pos.GetPositionY(), mapId);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (target)
|
||||
if (Player* target = player.GetConnectedPlayer())
|
||||
{
|
||||
// check online security
|
||||
if (handler->HasLowerSecurity(target))
|
||||
if (handler->HasLowerSecurity(target, ObjectGuid::Empty))
|
||||
return false;
|
||||
|
||||
std::string chrNameLink = handler->playerLink(target_name);
|
||||
std::string chrNameLink = handler->playerLink(target->GetName());
|
||||
|
||||
if (target->IsBeingTeleported())
|
||||
{
|
||||
@@ -176,9 +137,9 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
handler->PSendSysMessage(LANG_TELEPORTING_TO, chrNameLink.c_str(), "", tele->name.c_str());
|
||||
handler->PSendSysMessage(LANG_TELEPORTING_TO, chrNameLink.c_str(), "", locationName.c_str());
|
||||
if (handler->needReportToTarget(target))
|
||||
(ChatHandler(target->GetSession())).PSendSysMessage(LANG_TELEPORTED_TO_BY, handler->GetNameLink().c_str());
|
||||
ChatHandler(target->GetSession()).PSendSysMessage(LANG_TELEPORTED_TO_BY, handler->GetNameLink().c_str());
|
||||
|
||||
// stop flight if need
|
||||
if (target->IsInFlight())
|
||||
@@ -186,34 +147,74 @@ public:
|
||||
target->GetMotionMaster()->MovementExpired();
|
||||
target->CleanupAfterTaxiFlight();
|
||||
}
|
||||
// save only in non-flight case
|
||||
else
|
||||
else // save only in non-flight case
|
||||
target->SaveRecallPosition();
|
||||
|
||||
target->TeleportTo(tele->mapId, tele->position_x, tele->position_y, tele->position_z, tele->orientation);
|
||||
target->TeleportTo({ mapId, pos });
|
||||
}
|
||||
else
|
||||
{
|
||||
// check offline security
|
||||
if (handler->HasLowerSecurity(nullptr, target_guid))
|
||||
if (handler->HasLowerSecurity(nullptr, player.GetGUID()))
|
||||
return false;
|
||||
|
||||
std::string nameLink = handler->playerLink(target_name);
|
||||
std::string nameLink = handler->playerLink(player.GetName());
|
||||
|
||||
handler->PSendSysMessage(LANG_TELEPORTING_TO, nameLink.c_str(), handler->GetAcoreString(LANG_OFFLINE), tele->name.c_str());
|
||||
Player::SavePositionInDB(tele->mapId, tele->position_x, tele->position_y, tele->position_z, tele->orientation,
|
||||
sMapMgr->GetZoneId(PHASEMASK_NORMAL, tele->mapId, tele->position_x, tele->position_y, tele->position_z), target_guid);
|
||||
handler->PSendSysMessage(LANG_TELEPORTING_TO, nameLink.c_str(), handler->GetAcoreString(LANG_OFFLINE), locationName.c_str());
|
||||
|
||||
Player::SavePositionInDB({mapId, pos}, sMapMgr->GetZoneId(PHASEMASK_NORMAL, {mapId, pos}), player.GetGUID(), nullptr);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//Teleport group to given game_tele.entry
|
||||
static bool HandleTeleGroupCommand(ChatHandler* handler, const char* args)
|
||||
// teleport player to given game_tele.entry
|
||||
static bool HandleTeleNameCommand(ChatHandler* handler, Optional<PlayerIdentifier> player, Variant<GameTele const*, EXACT_SEQUENCE("$home")> where)
|
||||
{
|
||||
if (!*args)
|
||||
if (!player)
|
||||
player = PlayerIdentifier::FromTargetOrSelf(handler);
|
||||
|
||||
if (!player)
|
||||
return false;
|
||||
|
||||
if (where.index() == 1) // References target's homebind
|
||||
{
|
||||
if (Player* target = player->GetConnectedPlayer())
|
||||
target->TeleportTo(target->m_homebindMapId, target->m_homebindX, target->m_homebindY, target->m_homebindZ, target->GetOrientation());
|
||||
else
|
||||
{
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_HOMEBIND);
|
||||
stmt->setUInt32(0, player->GetGUID().GetCounter());
|
||||
PreparedQueryResult resultDB = CharacterDatabase.Query(stmt);
|
||||
|
||||
if (resultDB)
|
||||
{
|
||||
Field* fieldsDB = resultDB->Fetch();
|
||||
WorldLocation loc(fieldsDB[0].GetUInt16(), fieldsDB[2].GetFloat(), fieldsDB[3].GetFloat(), fieldsDB[4].GetFloat(), 0.0f);
|
||||
uint32 zoneId = fieldsDB[1].GetUInt16();
|
||||
|
||||
Player::SavePositionInDB(loc, zoneId, player->GetGUID(), nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r
|
||||
GameTele const* tele = where.get<GameTele const*>();
|
||||
return DoNameTeleport(handler, *player, tele->mapId, { tele->position_x, tele->position_y, tele->position_z, tele->orientation }, tele->name);
|
||||
}
|
||||
|
||||
//Teleport group to given game_tele.entry
|
||||
static bool HandleTeleGroupCommand(ChatHandler* handler, GameTele const* tele)
|
||||
{
|
||||
if (!tele)
|
||||
{
|
||||
handler->SendSysMessage(LANG_COMMAND_TELE_NOTFOUND);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
Player* target = handler->getSelectedPlayer();
|
||||
if (!target)
|
||||
{
|
||||
@@ -226,15 +227,6 @@ public:
|
||||
if (handler->HasLowerSecurity(target))
|
||||
return false;
|
||||
|
||||
// id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r
|
||||
GameTele const* tele = handler->extractGameTeleFromLink((char*)args);
|
||||
if (!tele)
|
||||
{
|
||||
handler->SendSysMessage(LANG_COMMAND_TELE_NOTFOUND);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
MapEntry const* map = sMapStore.LookupEntry(tele->mapId);
|
||||
if (!map || map->IsBattlegroundOrArena())
|
||||
{
|
||||
@@ -292,16 +284,17 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleTeleCommand(ChatHandler* handler, const char* args)
|
||||
static bool HandleTeleCommand(ChatHandler* handler, GameTele const* tele)
|
||||
{
|
||||
if (!*args)
|
||||
if (!tele)
|
||||
{
|
||||
handler->SendSysMessage(LANG_COMMAND_TELE_NOTFOUND);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
Player* me = handler->GetSession()->GetPlayer();
|
||||
|
||||
// id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r
|
||||
GameTele const* tele = handler->extractGameTeleFromLink((char*)args);
|
||||
|
||||
if (!tele)
|
||||
{
|
||||
handler->SendSysMessage(LANG_COMMAND_TELE_NOTFOUND);
|
||||
|
||||
@@ -32,19 +32,25 @@ EndScriptData */
|
||||
#include "ScriptMgr.h"
|
||||
#include "TicketMgr.h"
|
||||
|
||||
#if AC_COMPILER == AC_COMPILER_GNU
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
using namespace Acore::ChatCommands;
|
||||
|
||||
class ticket_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
ticket_commandscript() : CommandScript("ticket_commandscript") { }
|
||||
|
||||
std::vector<ChatCommand> GetCommands() const override
|
||||
ChatCommandTable GetCommands() const override
|
||||
{
|
||||
static std::vector<ChatCommand> ticketResponseCommandTable =
|
||||
static ChatCommandTable ticketResponseCommandTable =
|
||||
{
|
||||
{ "append", SEC_GAMEMASTER, true, &HandleGMTicketResponseAppendCommand, "" },
|
||||
{ "appendln", SEC_GAMEMASTER, true, &HandleGMTicketResponseAppendLnCommand, "" }
|
||||
};
|
||||
static std::vector<ChatCommand> ticketCommandTable =
|
||||
static ChatCommandTable ticketCommandTable =
|
||||
{
|
||||
{ "assign", SEC_GAMEMASTER, true, &HandleGMTicketAssignToCommand, "" },
|
||||
{ "close", SEC_GAMEMASTER, true, &HandleGMTicketCloseByIdCommand, "" },
|
||||
@@ -63,7 +69,7 @@ public:
|
||||
{ "viewid", SEC_GAMEMASTER, true, &HandleGMTicketGetByIdCommand, "" },
|
||||
{ "viewname", SEC_GAMEMASTER, true, &HandleGMTicketGetByNameCommand, "" }
|
||||
};
|
||||
static std::vector<ChatCommand> commandTable =
|
||||
static ChatCommandTable commandTable =
|
||||
{
|
||||
{ "ticket", SEC_GAMEMASTER, false, nullptr, "", ticketCommandTable }
|
||||
};
|
||||
|
||||
@@ -28,25 +28,31 @@ EndScriptData */
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
|
||||
#if AC_COMPILER == AC_COMPILER_GNU
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
using namespace Acore::ChatCommands;
|
||||
|
||||
class titles_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
titles_commandscript() : CommandScript("titles_commandscript") { }
|
||||
|
||||
std::vector<ChatCommand> GetCommands() const override
|
||||
ChatCommandTable GetCommands() const override
|
||||
{
|
||||
static std::vector<ChatCommand> titlesSetCommandTable =
|
||||
static ChatCommandTable titlesSetCommandTable =
|
||||
{
|
||||
{ "mask", SEC_GAMEMASTER, false, &HandleTitlesSetMaskCommand, "" }
|
||||
};
|
||||
static std::vector<ChatCommand> titlesCommandTable =
|
||||
static ChatCommandTable titlesCommandTable =
|
||||
{
|
||||
{ "add", SEC_GAMEMASTER, false, &HandleTitlesAddCommand, "" },
|
||||
{ "current", SEC_GAMEMASTER, false, &HandleTitlesCurrentCommand, "" },
|
||||
{ "remove", SEC_GAMEMASTER, false, &HandleTitlesRemoveCommand, "" },
|
||||
{ "set", SEC_GAMEMASTER, false, nullptr, "", titlesSetCommandTable }
|
||||
};
|
||||
static std::vector<ChatCommand> commandTable =
|
||||
static ChatCommandTable commandTable =
|
||||
{
|
||||
{ "titles", SEC_GAMEMASTER, false, nullptr, "", titlesCommandTable }
|
||||
};
|
||||
|
||||
@@ -29,14 +29,20 @@ EndScriptData */
|
||||
#include "ScriptMgr.h"
|
||||
#include "WaypointMgr.h"
|
||||
|
||||
#if AC_COMPILER == AC_COMPILER_GNU
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
using namespace Acore::ChatCommands;
|
||||
|
||||
class wp_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
wp_commandscript() : CommandScript("wp_commandscript") { }
|
||||
|
||||
std::vector<ChatCommand> GetCommands() const override
|
||||
ChatCommandTable GetCommands() const override
|
||||
{
|
||||
static std::vector<ChatCommand> wpCommandTable =
|
||||
static ChatCommandTable wpCommandTable =
|
||||
{
|
||||
{ "add", SEC_ADMINISTRATOR, false, &HandleWpAddCommand, "" },
|
||||
{ "event", SEC_ADMINISTRATOR, false, &HandleWpEventCommand, "" },
|
||||
@@ -46,7 +52,7 @@ public:
|
||||
{ "reload", SEC_ADMINISTRATOR, false, &HandleWpReloadCommand, "" },
|
||||
{ "show", SEC_ADMINISTRATOR, false, &HandleWpShowCommand, "" }
|
||||
};
|
||||
static std::vector<ChatCommand> commandTable =
|
||||
static ChatCommandTable commandTable =
|
||||
{
|
||||
{ "wp", SEC_ADMINISTRATOR, false, nullptr, "", wpCommandTable }
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user