mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-17 19:05:42 +00:00
converted all tabs to 4 spaces
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -284,7 +284,7 @@ public:
|
||||
|
||||
if (!target)
|
||||
{
|
||||
targetGuid = sWorld->GetGlobalPlayerGUID(name);
|
||||
targetGuid = sWorld->GetGlobalPlayerGUID(name);
|
||||
if (!targetGuid)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_BANINFO_NOCHARACTER);
|
||||
|
||||
@@ -88,7 +88,7 @@ public:
|
||||
|
||||
SpellScriptsBounds bounds = sObjectMgr->GetSpellScriptsBounds(spellId);
|
||||
uint32 spellDifficultyId = sSpellMgr->GetSpellDifficultyId(spellId);
|
||||
if (handler->GetSession()->GetSecurity() < SEC_CONSOLE && (bounds.first != bounds.second || spellDifficultyId || spellInfo->HasEffect(SPELL_EFFECT_SKILL_STEP) || spellInfo->HasEffect(SPELL_EFFECT_TRADE_SKILL)))
|
||||
if (handler->GetSession()->GetSecurity() < SEC_CONSOLE && (bounds.first != bounds.second || spellDifficultyId || spellInfo->HasEffect(SPELL_EFFECT_SKILL_STEP) || spellInfo->HasEffect(SPELL_EFFECT_TRADE_SKILL)))
|
||||
{
|
||||
handler->PSendSysMessage("Spell %u cannot be casted using a command!", spellId);
|
||||
handler->SetSentErrorMessage(true);
|
||||
|
||||
@@ -102,8 +102,8 @@ public:
|
||||
stmt->setUInt32(1, GUID_LOPART(playerGuid));
|
||||
CharacterDatabase.Execute(stmt);
|
||||
|
||||
// xinef: update global storage
|
||||
sWorld->UpdateGlobalPlayerData(GUID_LOPART(playerGuid), PLAYER_UPDATE_DATA_LEVEL, "", newLevel);
|
||||
// xinef: update global storage
|
||||
sWorld->UpdateGlobalPlayerData(GUID_LOPART(playerGuid), PLAYER_UPDATE_DATA_LEVEL, "", newLevel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ public:
|
||||
return false;
|
||||
|
||||
LocaleConstant loc = handler->GetSessionDbcLocale();
|
||||
char const* targetName = target->GetName().c_str();
|
||||
char const* targetName = target->GetName().c_str();
|
||||
char const* knownStr = handler->GetTrinityString(LANG_KNOWN);
|
||||
|
||||
// Search in CharTitles.dbc
|
||||
@@ -512,35 +512,35 @@ public:
|
||||
char* fileStr = strtok((char*)args, " ");
|
||||
char* playerStr = strtok(NULL, " ");
|
||||
|
||||
if (!fileStr && !playerStr)
|
||||
{
|
||||
QueryResult result = CharacterDatabase.PQuery("SELECT guid FROM characters");
|
||||
if (!result)
|
||||
return true;
|
||||
do{
|
||||
uint64 _guid = result->Fetch()[0].GetUInt64();
|
||||
char buff[20];
|
||||
sprintf(buff,"%u.dump", _guid);
|
||||
switch(PlayerDumpWriter().WriteDump(buff, uint32(_guid)))
|
||||
{
|
||||
case DUMP_SUCCESS:
|
||||
handler->PSendSysMessage(LANG_COMMAND_EXPORT_SUCCESS);
|
||||
break;
|
||||
case DUMP_FILE_OPEN_ERROR:
|
||||
handler->PSendSysMessage(LANG_FILE_OPEN_FAIL, buff);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
case DUMP_CHARACTER_DELETED:
|
||||
handler->PSendSysMessage(LANG_COMMAND_EXPORT_DELETED_CHAR);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
default:
|
||||
handler->PSendSysMessage(LANG_COMMAND_EXPORT_FAILED);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
}while(result->NextRow());
|
||||
}
|
||||
if (!fileStr && !playerStr)
|
||||
{
|
||||
QueryResult result = CharacterDatabase.PQuery("SELECT guid FROM characters");
|
||||
if (!result)
|
||||
return true;
|
||||
do{
|
||||
uint64 _guid = result->Fetch()[0].GetUInt64();
|
||||
char buff[20];
|
||||
sprintf(buff,"%u.dump", _guid);
|
||||
switch(PlayerDumpWriter().WriteDump(buff, uint32(_guid)))
|
||||
{
|
||||
case DUMP_SUCCESS:
|
||||
handler->PSendSysMessage(LANG_COMMAND_EXPORT_SUCCESS);
|
||||
break;
|
||||
case DUMP_FILE_OPEN_ERROR:
|
||||
handler->PSendSysMessage(LANG_FILE_OPEN_FAIL, buff);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
case DUMP_CHARACTER_DELETED:
|
||||
handler->PSendSysMessage(LANG_COMMAND_EXPORT_DELETED_CHAR);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
default:
|
||||
handler->PSendSysMessage(LANG_COMMAND_EXPORT_FAILED);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
}while(result->NextRow());
|
||||
}
|
||||
|
||||
if (!fileStr || !playerStr)
|
||||
return false;
|
||||
|
||||
@@ -91,13 +91,13 @@ public:
|
||||
{ "areatriggers", SEC_ADMINISTRATOR, false, &HandleDebugAreaTriggersCommand, "", NULL },
|
||||
{ "los", SEC_GAMEMASTER, false, &HandleDebugLoSCommand, "", NULL },
|
||||
{ "moveflags", SEC_ADMINISTRATOR, false, &HandleDebugMoveflagsCommand, "", NULL },
|
||||
{ "unitstate", SEC_ADMINISTRATOR, false, &HandleDebugUnitStateCommand, "", NULL },
|
||||
{ "unitstate", SEC_ADMINISTRATOR, false, &HandleDebugUnitStateCommand, "", NULL },
|
||||
{ NULL, SEC_PLAYER, false, NULL, "", NULL }
|
||||
};
|
||||
static ChatCommand commandTable[] =
|
||||
{
|
||||
{ "debug", SEC_GAMEMASTER, true, NULL, "", debugCommandTable },
|
||||
{ "wpgps", SEC_ADMINISTRATOR, false, &HandleWPGPSCommand, "", NULL },
|
||||
{ "wpgps", SEC_ADMINISTRATOR, false, &HandleWPGPSCommand, "", NULL },
|
||||
{ NULL, SEC_PLAYER, false, NULL, "", NULL }
|
||||
};
|
||||
return commandTable;
|
||||
@@ -839,7 +839,7 @@ public:
|
||||
while (ref)
|
||||
{
|
||||
if (Unit* unit = ref->GetSource()->GetOwner())
|
||||
handler->PSendSysMessage(" %u. %s %s (guid %u) - threat %f", ++count, (ref->isOnline() ? "" : "[offline]"), unit->GetName().c_str(), unit->GetGUIDLow(), ref->getThreat());
|
||||
handler->PSendSysMessage(" %u. %s %s (guid %u) - threat %f", ++count, (ref->isOnline() ? "" : "[offline]"), unit->GetName().c_str(), unit->GetGUIDLow(), ref->getThreat());
|
||||
else
|
||||
handler->PSendSysMessage(" %u. No Owner - threat %f", ++count, ref->getThreat());
|
||||
ref = ref->next();
|
||||
@@ -1344,19 +1344,19 @@ public:
|
||||
|
||||
if (!*args)
|
||||
{
|
||||
handler->PSendSysMessage("Unit States: %u, React State: %u", target->GetUnitState(), target->ToCreature() ? target->ToCreature()->GetReactState() : 10);
|
||||
handler->PSendSysMessage("Unit States: %u, React State: %u", target->GetUnitState(), target->ToCreature() ? target->ToCreature()->GetReactState() : 10);
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32 unitState = atoi((char*)args);
|
||||
target->ClearUnitState(target->GetUnitState());
|
||||
target->AddUnitState(unitState);
|
||||
target->ClearUnitState(target->GetUnitState());
|
||||
target->AddUnitState(unitState);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleWPGPSCommand(ChatHandler* handler, char const* /*args*/)
|
||||
static bool HandleWPGPSCommand(ChatHandler* handler, char const* /*args*/)
|
||||
{
|
||||
Player* player = handler->GetSession()->GetPlayer();
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ public:
|
||||
data << uint32(0); // unknown
|
||||
target->SendMessageToSet(&data, true);
|
||||
handler->PSendSysMessage(LANG_COMMAND_FLYMODE_STATUS, handler->GetNameLink(target).c_str(), args);
|
||||
handler->SetSentErrorMessage(true);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -200,7 +200,7 @@ public:
|
||||
if (!*args)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_YOU_ARE, _player->isGMVisible() ? handler->GetTrinityString(LANG_VISIBLE) : handler->GetTrinityString(LANG_INVISIBLE));
|
||||
handler->SetSentErrorMessage(true);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ public:
|
||||
_player->SetGMVisible(true);
|
||||
//_player->UpdateObjectVisibility();
|
||||
handler->GetSession()->SendNotification(LANG_INVISIBLE_VISIBLE);
|
||||
handler->SetSentErrorMessage(true);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -225,7 +225,7 @@ public:
|
||||
_player->SetGMVisible(false);
|
||||
//_player->UpdateObjectVisibility();
|
||||
handler->GetSession()->SendNotification(LANG_INVISIBLE_INVISIBLE);
|
||||
handler->SetSentErrorMessage(true);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -242,7 +242,7 @@ public:
|
||||
if (!*args)
|
||||
{
|
||||
handler->GetSession()->SendNotification(_player->IsGameMaster() ? LANG_GM_ON : LANG_GM_OFF);
|
||||
handler->SetSentErrorMessage(true);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -253,7 +253,7 @@ public:
|
||||
_player->SetGameMaster(true);
|
||||
handler->GetSession()->SendNotification(LANG_GM_ON);
|
||||
_player->UpdateTriggerVisibility();
|
||||
handler->SetSentErrorMessage(true);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ public:
|
||||
_player->SetGameMaster(false);
|
||||
handler->GetSession()->SendNotification(LANG_GM_OFF);
|
||||
_player->UpdateTriggerVisibility();
|
||||
handler->SetSentErrorMessage(true);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -600,17 +600,17 @@ public:
|
||||
uint32 displayId = 0;
|
||||
std::string name;
|
||||
uint32 lootId = 0;
|
||||
GameObject* gameObject = NULL;
|
||||
GameObject* gameObject = NULL;
|
||||
|
||||
if (!*args)
|
||||
{
|
||||
if (WorldObject* object = handler->getSelectedObject())
|
||||
{
|
||||
{
|
||||
entry = object->GetEntry();
|
||||
if (object->GetTypeId() == TYPEID_GAMEOBJECT)
|
||||
gameObject = object->ToGameObject();
|
||||
}
|
||||
}
|
||||
if (object->GetTypeId() == TYPEID_GAMEOBJECT)
|
||||
gameObject = object->ToGameObject();
|
||||
}
|
||||
}
|
||||
else
|
||||
entry = atoi((char*)args);
|
||||
|
||||
@@ -631,15 +631,15 @@ public:
|
||||
handler->PSendSysMessage(LANG_GOINFO_TYPE, type);
|
||||
handler->PSendSysMessage(LANG_GOINFO_LOOTID, lootId);
|
||||
handler->PSendSysMessage(LANG_GOINFO_DISPLAYID, displayId);
|
||||
if (gameObject)
|
||||
{
|
||||
handler->PSendSysMessage("LootMode: %u", gameObject->GetLootMode());
|
||||
handler->PSendSysMessage("LootState: %u", gameObject->getLootState());
|
||||
handler->PSendSysMessage("GOState: %u", gameObject->GetGoState());
|
||||
handler->PSendSysMessage("PhaseMask: %u", gameObject->GetPhaseMask());
|
||||
handler->PSendSysMessage("IsLootEmpty: %u", gameObject->loot.empty());
|
||||
handler->PSendSysMessage("IsLootLooted: %u", gameObject->loot.isLooted());
|
||||
}
|
||||
if (gameObject)
|
||||
{
|
||||
handler->PSendSysMessage("LootMode: %u", gameObject->GetLootMode());
|
||||
handler->PSendSysMessage("LootState: %u", gameObject->getLootState());
|
||||
handler->PSendSysMessage("GOState: %u", gameObject->GetGoState());
|
||||
handler->PSendSysMessage("PhaseMask: %u", gameObject->GetPhaseMask());
|
||||
handler->PSendSysMessage("IsLootEmpty: %u", gameObject->loot.empty());
|
||||
handler->PSendSysMessage("IsLootLooted: %u", gameObject->loot.isLooted());
|
||||
}
|
||||
|
||||
handler->PSendSysMessage(LANG_GOINFO_NAME, name.c_str());
|
||||
|
||||
@@ -659,20 +659,20 @@ public:
|
||||
|
||||
GameObject* object = NULL;
|
||||
|
||||
if (guidLow > 0)
|
||||
{
|
||||
if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(guidLow))
|
||||
object = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(guidLow, gameObjectData->id);
|
||||
}
|
||||
else
|
||||
object = handler->GetSession()->GetPlayer()->FindNearestGameObject(-guidLow, 30.0f);
|
||||
if (guidLow > 0)
|
||||
{
|
||||
if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(guidLow))
|
||||
object = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(guidLow, gameObjectData->id);
|
||||
}
|
||||
else
|
||||
object = handler->GetSession()->GetPlayer()->FindNearestGameObject(-guidLow, 30.0f);
|
||||
|
||||
if (!object)
|
||||
{
|
||||
|
||||
handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, abs(guidLow));
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
|
||||
handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, abs(guidLow));
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
char* type = strtok(NULL, " ");
|
||||
@@ -704,10 +704,10 @@ public:
|
||||
data << (uint32)(objectState);
|
||||
object->SendMessageToSet(&data, true);
|
||||
}
|
||||
else if (objectType == 5)
|
||||
object->SetUInt32Value(GAMEOBJECT_FLAGS, (uint32)(objectState));
|
||||
else if (objectType == 6)
|
||||
object->SetGoArtKit((uint32)(objectState));
|
||||
else if (objectType == 5)
|
||||
object->SetUInt32Value(GAMEOBJECT_FLAGS, (uint32)(objectState));
|
||||
else if (objectType == 6)
|
||||
object->SetGoArtKit((uint32)(objectState));
|
||||
|
||||
handler->PSendSysMessage("Set gobject type %d state %d", objectType, objectState);
|
||||
return true;
|
||||
|
||||
@@ -90,7 +90,7 @@ public:
|
||||
}
|
||||
|
||||
// check online security
|
||||
if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer(), 0))
|
||||
if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer(), 0))
|
||||
return false;
|
||||
|
||||
handler->GetSession()->GetPlayer()->RewardHonor(target, 1);
|
||||
|
||||
@@ -76,14 +76,14 @@ public:
|
||||
uint32 counter = 0;
|
||||
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
|
||||
{
|
||||
BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(player->GetGUIDLow(), Difficulty(i));
|
||||
BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(player->GetGUIDLow(), Difficulty(i));
|
||||
for (BoundInstancesMap::const_iterator itr = m_boundInstances.begin(); itr != m_boundInstances.end(); ++itr)
|
||||
{
|
||||
InstanceSave* save = itr->second.save;
|
||||
uint32 resetTime = itr->second.extended ? save->GetExtendedResetTime() : save->GetResetTime();
|
||||
uint32 ttr = (resetTime >= time(NULL) ? resetTime - time(NULL) : 0);
|
||||
uint32 resetTime = itr->second.extended ? save->GetExtendedResetTime() : save->GetResetTime();
|
||||
uint32 ttr = (resetTime >= time(NULL) ? resetTime - time(NULL) : 0);
|
||||
std::string timeleft = GetTimeString(ttr);
|
||||
handler->PSendSysMessage("map: %d, inst: %d, perm: %s, diff: %d, canReset: %s, TTR: %s%s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str(), (itr->second.extended ? " (extended)" : ""));
|
||||
handler->PSendSysMessage("map: %d, inst: %d, perm: %s, diff: %d, canReset: %s, TTR: %s%s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str(), (itr->second.extended ? " (extended)" : ""));
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
@@ -124,12 +124,12 @@ public:
|
||||
InstanceSave* save = itr->second.save;
|
||||
if (itr->first != player->GetMapId() && (!MapId || MapId == itr->first) && (diff == -1 || diff == save->GetDifficulty()))
|
||||
{
|
||||
uint32 resetTime = itr->second.extended ? save->GetExtendedResetTime() : save->GetResetTime();
|
||||
uint32 ttr = (resetTime >= time(NULL) ? resetTime - time(NULL) : 0);
|
||||
uint32 resetTime = itr->second.extended ? save->GetExtendedResetTime() : save->GetResetTime();
|
||||
uint32 ttr = (resetTime >= time(NULL) ? resetTime - time(NULL) : 0);
|
||||
std::string timeleft = GetTimeString(ttr);
|
||||
handler->PSendSysMessage("unbinding map: %d, inst: %d, perm: %s, diff: %d, canReset: %s, TTR: %s%s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str(), (itr->second.extended ? " (extended)" : ""));
|
||||
sInstanceSaveMgr->PlayerUnbindInstance(player->GetGUIDLow(), itr->first, Difficulty(i), true, player);
|
||||
itr = m_boundInstances.begin();
|
||||
sInstanceSaveMgr->PlayerUnbindInstance(player->GetGUIDLow(), itr->first, Difficulty(i), true, player);
|
||||
itr = m_boundInstances.begin();
|
||||
counter++;
|
||||
}
|
||||
else
|
||||
@@ -143,14 +143,14 @@ public:
|
||||
|
||||
static bool HandleInstanceStatsCommand(ChatHandler* handler, char const* /*args*/)
|
||||
{
|
||||
uint32 dungeon = 0, battleground = 0, arena = 0, spectators = 0;
|
||||
sMapMgr->GetNumInstances(dungeon, battleground, arena);
|
||||
uint32 dungeon = 0, battleground = 0, arena = 0, spectators = 0;
|
||||
sMapMgr->GetNumInstances(dungeon, battleground, arena);
|
||||
handler->PSendSysMessage("instances loaded: dungeons (%d), battlegrounds (%d), arenas (%d)", dungeon, battleground, arena);
|
||||
dungeon = 0; battleground = 0; arena = 0; spectators = 0;
|
||||
sMapMgr->GetNumPlayersInInstances(dungeon, battleground, arena, spectators);
|
||||
dungeon = 0; battleground = 0; arena = 0; spectators = 0;
|
||||
sMapMgr->GetNumPlayersInInstances(dungeon, battleground, arena, spectators);
|
||||
handler->PSendSysMessage("players in instances: dungeons (%d), battlegrounds (%d), arenas (%d + %d spect)", dungeon, battleground, arena, spectators);
|
||||
|
||||
handler->SetSentErrorMessage(true);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -229,18 +229,18 @@ public:
|
||||
|
||||
// xinef: search highest talent rank
|
||||
uint32 spellId = 0;
|
||||
uint8 rankId = MAX_TALENT_RANK;
|
||||
uint8 rankId = MAX_TALENT_RANK;
|
||||
for (int8 rank = MAX_TALENT_RANK - 1; rank >= 0; --rank)
|
||||
{
|
||||
if (talentInfo->RankID[rank] != 0)
|
||||
{
|
||||
rankId = rank;
|
||||
rankId = rank;
|
||||
spellId = talentInfo->RankID[rank];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// xinef: some errors?
|
||||
// xinef: some errors?
|
||||
if (!spellId || rankId == MAX_TALENT_RANK)
|
||||
continue;
|
||||
|
||||
@@ -248,7 +248,7 @@ public:
|
||||
if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo))
|
||||
continue;
|
||||
|
||||
player->LearnTalent(talentInfo->TalentID, rankId);
|
||||
player->LearnTalent(talentInfo->TalentID, rankId);
|
||||
}
|
||||
|
||||
handler->SendSysMessage(LANG_COMMAND_LEARN_CLASS_TALENTS);
|
||||
|
||||
@@ -85,7 +85,7 @@ public:
|
||||
handler->PSendSysMessage(LANG_LFG_NOT_IN_GROUP, playerName.c_str());
|
||||
return true;
|
||||
}
|
||||
/*
|
||||
/*
|
||||
uint64 guid = grp->GetGUID();
|
||||
std::string const& state = lfg::GetStateString(sLFGMgr->GetState(guid));
|
||||
handler->PSendSysMessage(LANG_LFG_GROUP_INFO, grp->isLFGGroup(),
|
||||
@@ -93,7 +93,7 @@ public:
|
||||
|
||||
for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
GetPlayerInfo(handler, itr->GetSource());
|
||||
*/
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -449,8 +449,8 @@ public:
|
||||
GUID_LOPART(aura->GetCasterGUID()));
|
||||
}
|
||||
|
||||
if (!args || std::string(args) != "all")
|
||||
return true;
|
||||
if (!args || std::string(args) != "all")
|
||||
return true;
|
||||
|
||||
for (uint16 i = 0; i < TOTAL_AURAS; ++i)
|
||||
{
|
||||
|
||||
@@ -1263,8 +1263,8 @@ public:
|
||||
uint32 count = 0;
|
||||
uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
|
||||
|
||||
const char* name_races[RACE_DRAENEI] = {"Human", "Orc", "Dwarf", "Night Elf", "Undead", "Tauren", "Gnome", "Troll", "", "Blood Elf", "Draenei"};
|
||||
const char* name_classes[CLASS_DRUID] = {"Warrior", "Paladin", "Hunter", "Rogue", "Priest", "Death Knight", "Shaman", "Mage", "Warlock", "", "Druid"};
|
||||
const char* name_races[RACE_DRAENEI] = {"Human", "Orc", "Dwarf", "Night Elf", "Undead", "Tauren", "Gnome", "Troll", "", "Blood Elf", "Draenei"};
|
||||
const char* name_classes[CLASS_DRUID] = {"Warrior", "Paladin", "Hunter", "Rogue", "Priest", "Death Knight", "Shaman", "Mage", "Warlock", "", "Druid"};
|
||||
|
||||
do
|
||||
{
|
||||
@@ -1291,20 +1291,20 @@ public:
|
||||
Field* characterFields = result2->Fetch();
|
||||
uint32 guid = characterFields[0].GetUInt32();
|
||||
std::string name = characterFields[1].GetString();
|
||||
uint8 plevel = 0, prace = 0, pclass = 0;
|
||||
bool online = (ObjectAccessor::FindPlayerInOrOutOfWorld(MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER)) != NULL);
|
||||
uint8 plevel = 0, prace = 0, pclass = 0;
|
||||
bool online = (ObjectAccessor::FindPlayerInOrOutOfWorld(MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER)) != NULL);
|
||||
|
||||
if (const GlobalPlayerData* gpd = sWorld->GetGlobalPlayerData(guid))
|
||||
{
|
||||
plevel = gpd->level;
|
||||
prace = gpd->race;
|
||||
pclass = gpd->playerClass;
|
||||
}
|
||||
if (const GlobalPlayerData* gpd = sWorld->GetGlobalPlayerData(guid))
|
||||
{
|
||||
plevel = gpd->level;
|
||||
prace = gpd->race;
|
||||
pclass = gpd->playerClass;
|
||||
}
|
||||
|
||||
if (plevel > 0 && prace > 0 && prace <= RACE_DRAENEI && pclass > 0 && pclass <= CLASS_DRUID)
|
||||
handler->PSendSysMessage(" %s (GUID %u) - %s - %s - %u%s", name.c_str(), guid, name_races[prace-1], name_classes[pclass-1], plevel, (online ? " - online" : ""));
|
||||
else
|
||||
handler->PSendSysMessage(LANG_LOOKUP_PLAYER_CHARACTER, name.c_str(), guid);
|
||||
if (plevel > 0 && prace > 0 && prace <= RACE_DRAENEI && pclass > 0 && pclass <= CLASS_DRUID)
|
||||
handler->PSendSysMessage(" %s (GUID %u) - %s - %s - %u%s", name.c_str(), guid, name_races[prace-1], name_classes[pclass-1], plevel, (online ? " - online" : ""));
|
||||
else
|
||||
handler->PSendSysMessage(LANG_LOOKUP_PLAYER_CHARACTER, name.c_str(), guid);
|
||||
++counter;
|
||||
}
|
||||
while (result2->NextRow() && (limit == -1 || counter < limit));
|
||||
|
||||
@@ -133,220 +133,220 @@ public:
|
||||
return commandTable;
|
||||
}
|
||||
|
||||
static bool HandleSkirmishCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
Tokenizer tokens(args, ' ');
|
||||
static bool HandleSkirmishCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
Tokenizer tokens(args, ' ');
|
||||
|
||||
if (!*args || !tokens.size())
|
||||
{
|
||||
handler->PSendSysMessage("Usage: .skirmish [arena] [XvX] [Nick1] [Nick2] ... [NickN]");
|
||||
handler->PSendSysMessage("[arena] can be \"all\" or comma-separated list of possible arenas (NA,BE,RL,DS,RV).");
|
||||
handler->PSendSysMessage("[XvX] can be 1v1, 2v2, 3v3, 5v5. After [XvX] specify enough nicknames for that mode.");
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
Tokenizer::const_iterator i = tokens.begin();
|
||||
|
||||
std::set<BattlegroundTypeId> allowedArenas;
|
||||
std::string arenasStr = *(i++);
|
||||
std::string tmpStr;
|
||||
Tokenizer arenaTokens(arenasStr, ',');
|
||||
for (Tokenizer::const_iterator itr = arenaTokens.begin(); itr != arenaTokens.end(); ++itr)
|
||||
{
|
||||
tmpStr = std::string(*itr);
|
||||
if (tmpStr == "all")
|
||||
{
|
||||
if (arenaTokens.size() > 1)
|
||||
{
|
||||
handler->PSendSysMessage("Invalid [arena] specified.");
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
allowedArenas.insert(BATTLEGROUND_NA);
|
||||
allowedArenas.insert(BATTLEGROUND_BE);
|
||||
allowedArenas.insert(BATTLEGROUND_RL);
|
||||
allowedArenas.insert(BATTLEGROUND_DS);
|
||||
allowedArenas.insert(BATTLEGROUND_RV);
|
||||
}
|
||||
else if (tmpStr == "NA")
|
||||
allowedArenas.insert(BATTLEGROUND_NA);
|
||||
else if (tmpStr == "BE")
|
||||
allowedArenas.insert(BATTLEGROUND_BE);
|
||||
else if (tmpStr == "RL")
|
||||
allowedArenas.insert(BATTLEGROUND_RL);
|
||||
else if (tmpStr == "DS")
|
||||
allowedArenas.insert(BATTLEGROUND_DS);
|
||||
else if (tmpStr == "RV")
|
||||
allowedArenas.insert(BATTLEGROUND_RV);
|
||||
else
|
||||
{
|
||||
handler->PSendSysMessage("Invalid [arena] specified.");
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
ASSERT(!allowedArenas.empty());
|
||||
BattlegroundTypeId randomizedArenaBgTypeId = Trinity::Containers::SelectRandomContainerElement(allowedArenas);
|
||||
|
||||
uint8 count = 0;
|
||||
if (i != tokens.end())
|
||||
{
|
||||
std::string mode = *(i++);
|
||||
if (mode == "1v1") count = 2;
|
||||
else if (mode == "2v2") count = 4;
|
||||
else if (mode == "3v3") count = 6;
|
||||
else if (mode == "5v5") count = 10;
|
||||
}
|
||||
|
||||
if (!count)
|
||||
{
|
||||
handler->PSendSysMessage("Invalid bracket. Can be 1v1, 2v2, 3v3, 5v5");
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (tokens.size() != count+2)
|
||||
{
|
||||
handler->PSendSysMessage("Invalid number of nicknames for this bracket.");
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8 hcnt = count / 2;
|
||||
uint8 error = 0;
|
||||
std::string last_name;
|
||||
Player* plr = NULL;
|
||||
Player* players[10] = {NULL};
|
||||
uint8 cnt = 0;
|
||||
for (; i != tokens.end(); ++i)
|
||||
if (!*args || !tokens.size())
|
||||
{
|
||||
last_name = std::string(*i);
|
||||
plr = ObjectAccessor::FindPlayerByName(last_name, false);
|
||||
if (!plr) { error = 1; break; }
|
||||
if (!plr->IsInWorld() || !plr->FindMap() || plr->IsBeingTeleported()) { error = 2; break; }
|
||||
if (plr->GetMap()->GetEntry()->Instanceable()) { error = 3; break; }
|
||||
if (plr->isUsingLfg()) { error = 4; break; }
|
||||
if (plr->InBattlegroundQueue()) { error = 5; break; }
|
||||
if (plr->IsInFlight()) { error = 10; break; }
|
||||
if (!plr->IsAlive()) { error = 11; break; }
|
||||
const Group* g = plr->GetGroup();
|
||||
if (hcnt > 1)
|
||||
{
|
||||
if (!g) { error = 6; break; }
|
||||
if (g->isRaidGroup() || g->isBGGroup() || g->isBFGroup() || g->isLFGGroup()) { error = 7; break; }
|
||||
if (g->GetMembersCount() != hcnt) { error = 8; break; }
|
||||
|
||||
uint8 sti = (cnt < hcnt ? 0 : hcnt);
|
||||
if (sti != cnt)
|
||||
if (players[sti]->GetGroup() != plr->GetGroup()) { error = 9; last_name += " and " + players[sti]->GetName(); break; }
|
||||
}
|
||||
else // 1v1
|
||||
{
|
||||
if (g) { error = 12; break; }
|
||||
}
|
||||
players[cnt++] = plr;
|
||||
handler->PSendSysMessage("Usage: .skirmish [arena] [XvX] [Nick1] [Nick2] ... [NickN]");
|
||||
handler->PSendSysMessage("[arena] can be \"all\" or comma-separated list of possible arenas (NA,BE,RL,DS,RV).");
|
||||
handler->PSendSysMessage("[XvX] can be 1v1, 2v2, 3v3, 5v5. After [XvX] specify enough nicknames for that mode.");
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
for (uint8 i=0; i<cnt && !error; ++i)
|
||||
for (uint8 j=i+1; j<cnt; ++j)
|
||||
if (players[i]->GetGUID() == players[j]->GetGUID())
|
||||
{
|
||||
last_name = players[i]->GetName();
|
||||
error = 13;
|
||||
break;
|
||||
}
|
||||
Tokenizer::const_iterator i = tokens.begin();
|
||||
|
||||
switch (error)
|
||||
{
|
||||
case 1:
|
||||
handler->PSendSysMessage("Player %s not found.", last_name.c_str());
|
||||
break;
|
||||
case 2:
|
||||
handler->PSendSysMessage("Player %s is being teleported.", last_name.c_str());
|
||||
break;
|
||||
case 3:
|
||||
handler->PSendSysMessage("Player %s is in instance/battleground/arena.", last_name.c_str());
|
||||
break;
|
||||
case 4:
|
||||
handler->PSendSysMessage("Player %s is in LFG system.", last_name.c_str());
|
||||
break;
|
||||
case 5:
|
||||
handler->PSendSysMessage("Player %s is queued for battleground/arena.", last_name.c_str());
|
||||
break;
|
||||
case 6:
|
||||
handler->PSendSysMessage("Player %s is not in group.", last_name.c_str());
|
||||
break;
|
||||
case 7:
|
||||
handler->PSendSysMessage("Player %s is not in normal group.", last_name.c_str());
|
||||
break;
|
||||
case 8:
|
||||
handler->PSendSysMessage("Group of player %s has invalid member count.", last_name.c_str());
|
||||
break;
|
||||
case 9:
|
||||
handler->PSendSysMessage("Players %s are not in the same group.", last_name.c_str());
|
||||
break;
|
||||
case 10:
|
||||
handler->PSendSysMessage("Player %s is in flight.", last_name.c_str());
|
||||
break;
|
||||
case 11:
|
||||
handler->PSendSysMessage("Player %s is dead.", last_name.c_str());
|
||||
break;
|
||||
case 12:
|
||||
handler->PSendSysMessage("Player %s is in a group.", last_name.c_str());
|
||||
break;
|
||||
case 13:
|
||||
handler->PSendSysMessage("Player %s occurs more than once.", last_name.c_str());
|
||||
break;
|
||||
}
|
||||
std::set<BattlegroundTypeId> allowedArenas;
|
||||
std::string arenasStr = *(i++);
|
||||
std::string tmpStr;
|
||||
Tokenizer arenaTokens(arenasStr, ',');
|
||||
for (Tokenizer::const_iterator itr = arenaTokens.begin(); itr != arenaTokens.end(); ++itr)
|
||||
{
|
||||
tmpStr = std::string(*itr);
|
||||
if (tmpStr == "all")
|
||||
{
|
||||
if (arenaTokens.size() > 1)
|
||||
{
|
||||
handler->PSendSysMessage("Invalid [arena] specified.");
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
allowedArenas.insert(BATTLEGROUND_NA);
|
||||
allowedArenas.insert(BATTLEGROUND_BE);
|
||||
allowedArenas.insert(BATTLEGROUND_RL);
|
||||
allowedArenas.insert(BATTLEGROUND_DS);
|
||||
allowedArenas.insert(BATTLEGROUND_RV);
|
||||
}
|
||||
else if (tmpStr == "NA")
|
||||
allowedArenas.insert(BATTLEGROUND_NA);
|
||||
else if (tmpStr == "BE")
|
||||
allowedArenas.insert(BATTLEGROUND_BE);
|
||||
else if (tmpStr == "RL")
|
||||
allowedArenas.insert(BATTLEGROUND_RL);
|
||||
else if (tmpStr == "DS")
|
||||
allowedArenas.insert(BATTLEGROUND_DS);
|
||||
else if (tmpStr == "RV")
|
||||
allowedArenas.insert(BATTLEGROUND_RV);
|
||||
else
|
||||
{
|
||||
handler->PSendSysMessage("Invalid [arena] specified.");
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
ASSERT(!allowedArenas.empty());
|
||||
BattlegroundTypeId randomizedArenaBgTypeId = Trinity::Containers::SelectRandomContainerElement(allowedArenas);
|
||||
|
||||
if (error)
|
||||
{
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
uint8 count = 0;
|
||||
if (i != tokens.end())
|
||||
{
|
||||
std::string mode = *(i++);
|
||||
if (mode == "1v1") count = 2;
|
||||
else if (mode == "2v2") count = 4;
|
||||
else if (mode == "3v3") count = 6;
|
||||
else if (mode == "5v5") count = 10;
|
||||
}
|
||||
|
||||
Battleground* bgt = sBattlegroundMgr->GetBattlegroundTemplate(BATTLEGROUND_AA);
|
||||
if (!bgt)
|
||||
{
|
||||
handler->PSendSysMessage("Couldn't create arena map!");
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
if (!count)
|
||||
{
|
||||
handler->PSendSysMessage("Invalid bracket. Can be 1v1, 2v2, 3v3, 5v5");
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
Battleground* bg = sBattlegroundMgr->CreateNewBattleground(randomizedArenaBgTypeId, 80, 80, ArenaType(hcnt >= 2 ? hcnt : 2), false);
|
||||
if (!bg)
|
||||
{
|
||||
handler->PSendSysMessage("Couldn't create arena map!");
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
if (tokens.size() != count+2)
|
||||
{
|
||||
handler->PSendSysMessage("Invalid number of nicknames for this bracket.");
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
bg->StartBattleground();
|
||||
uint8 hcnt = count / 2;
|
||||
uint8 error = 0;
|
||||
std::string last_name;
|
||||
Player* plr = NULL;
|
||||
Player* players[10] = {NULL};
|
||||
uint8 cnt = 0;
|
||||
for (; i != tokens.end(); ++i)
|
||||
{
|
||||
last_name = std::string(*i);
|
||||
plr = ObjectAccessor::FindPlayerByName(last_name, false);
|
||||
if (!plr) { error = 1; break; }
|
||||
if (!plr->IsInWorld() || !plr->FindMap() || plr->IsBeingTeleported()) { error = 2; break; }
|
||||
if (plr->GetMap()->GetEntry()->Instanceable()) { error = 3; break; }
|
||||
if (plr->isUsingLfg()) { error = 4; break; }
|
||||
if (plr->InBattlegroundQueue()) { error = 5; break; }
|
||||
if (plr->IsInFlight()) { error = 10; break; }
|
||||
if (!plr->IsAlive()) { error = 11; break; }
|
||||
const Group* g = plr->GetGroup();
|
||||
if (hcnt > 1)
|
||||
{
|
||||
if (!g) { error = 6; break; }
|
||||
if (g->isRaidGroup() || g->isBGGroup() || g->isBFGroup() || g->isLFGGroup()) { error = 7; break; }
|
||||
if (g->GetMembersCount() != hcnt) { error = 8; break; }
|
||||
|
||||
BattlegroundTypeId bgTypeId = bg->GetBgTypeID();
|
||||
uint8 sti = (cnt < hcnt ? 0 : hcnt);
|
||||
if (sti != cnt)
|
||||
if (players[sti]->GetGroup() != plr->GetGroup()) { error = 9; last_name += " and " + players[sti]->GetName(); break; }
|
||||
}
|
||||
else // 1v1
|
||||
{
|
||||
if (g) { error = 12; break; }
|
||||
}
|
||||
players[cnt++] = plr;
|
||||
}
|
||||
|
||||
TeamId teamId1 = Player::TeamIdForRace(players[0]->getRace());
|
||||
TeamId teamId2 = (teamId1 == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE);
|
||||
for (uint8 i=0; i<cnt; ++i)
|
||||
{
|
||||
Player* player = players[i];
|
||||
for (uint8 i=0; i<cnt && !error; ++i)
|
||||
for (uint8 j=i+1; j<cnt; ++j)
|
||||
if (players[i]->GetGUID() == players[j]->GetGUID())
|
||||
{
|
||||
last_name = players[i]->GetName();
|
||||
error = 13;
|
||||
break;
|
||||
}
|
||||
|
||||
TeamId teamId = (i < hcnt ? teamId1 : teamId2);
|
||||
player->SetEntryPoint();
|
||||
switch (error)
|
||||
{
|
||||
case 1:
|
||||
handler->PSendSysMessage("Player %s not found.", last_name.c_str());
|
||||
break;
|
||||
case 2:
|
||||
handler->PSendSysMessage("Player %s is being teleported.", last_name.c_str());
|
||||
break;
|
||||
case 3:
|
||||
handler->PSendSysMessage("Player %s is in instance/battleground/arena.", last_name.c_str());
|
||||
break;
|
||||
case 4:
|
||||
handler->PSendSysMessage("Player %s is in LFG system.", last_name.c_str());
|
||||
break;
|
||||
case 5:
|
||||
handler->PSendSysMessage("Player %s is queued for battleground/arena.", last_name.c_str());
|
||||
break;
|
||||
case 6:
|
||||
handler->PSendSysMessage("Player %s is not in group.", last_name.c_str());
|
||||
break;
|
||||
case 7:
|
||||
handler->PSendSysMessage("Player %s is not in normal group.", last_name.c_str());
|
||||
break;
|
||||
case 8:
|
||||
handler->PSendSysMessage("Group of player %s has invalid member count.", last_name.c_str());
|
||||
break;
|
||||
case 9:
|
||||
handler->PSendSysMessage("Players %s are not in the same group.", last_name.c_str());
|
||||
break;
|
||||
case 10:
|
||||
handler->PSendSysMessage("Player %s is in flight.", last_name.c_str());
|
||||
break;
|
||||
case 11:
|
||||
handler->PSendSysMessage("Player %s is dead.", last_name.c_str());
|
||||
break;
|
||||
case 12:
|
||||
handler->PSendSysMessage("Player %s is in a group.", last_name.c_str());
|
||||
break;
|
||||
case 13:
|
||||
handler->PSendSysMessage("Player %s occurs more than once.", last_name.c_str());
|
||||
break;
|
||||
}
|
||||
|
||||
uint32 queueSlot = 0;
|
||||
WorldPacket data;
|
||||
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_IN_PROGRESS, 0, bg->GetStartTime(), bg->GetArenaType(), teamId);
|
||||
player->GetSession()->SendPacket(&data);
|
||||
if (error)
|
||||
{
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
player->SetBattlegroundId(bg->GetInstanceID(), bgTypeId, queueSlot, true, false, teamId);
|
||||
sBattlegroundMgr->SendToBattleground(player, bg->GetInstanceID(), bgTypeId);
|
||||
}
|
||||
Battleground* bgt = sBattlegroundMgr->GetBattlegroundTemplate(BATTLEGROUND_AA);
|
||||
if (!bgt)
|
||||
{
|
||||
handler->PSendSysMessage("Couldn't create arena map!");
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
handler->PSendSysMessage("Success! Players are now being teleported to the arena.");
|
||||
return true;
|
||||
}
|
||||
Battleground* bg = sBattlegroundMgr->CreateNewBattleground(randomizedArenaBgTypeId, 80, 80, ArenaType(hcnt >= 2 ? hcnt : 2), false);
|
||||
if (!bg)
|
||||
{
|
||||
handler->PSendSysMessage("Couldn't create arena map!");
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
bg->StartBattleground();
|
||||
|
||||
BattlegroundTypeId bgTypeId = bg->GetBgTypeID();
|
||||
|
||||
TeamId teamId1 = Player::TeamIdForRace(players[0]->getRace());
|
||||
TeamId teamId2 = (teamId1 == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE);
|
||||
for (uint8 i=0; i<cnt; ++i)
|
||||
{
|
||||
Player* player = players[i];
|
||||
|
||||
TeamId teamId = (i < hcnt ? teamId1 : teamId2);
|
||||
player->SetEntryPoint();
|
||||
|
||||
uint32 queueSlot = 0;
|
||||
WorldPacket data;
|
||||
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_IN_PROGRESS, 0, bg->GetStartTime(), bg->GetArenaType(), teamId);
|
||||
player->GetSession()->SendPacket(&data);
|
||||
|
||||
player->SetBattlegroundId(bg->GetInstanceID(), bgTypeId, queueSlot, true, false, teamId);
|
||||
sBattlegroundMgr->SendToBattleground(player, bg->GetInstanceID(), bgTypeId);
|
||||
}
|
||||
|
||||
handler->PSendSysMessage("Success! Players are now being teleported to the arena.");
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleDevCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
@@ -363,9 +363,9 @@ public:
|
||||
|
||||
if (argstr == "on")
|
||||
{
|
||||
handler->GetSession()->GetPlayer()->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER);
|
||||
handler->GetSession()->SendNotification(LANG_DEV_ON);
|
||||
return true;
|
||||
handler->GetSession()->GetPlayer()->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER);
|
||||
handler->GetSession()->SendNotification(LANG_DEV_ON);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (argstr == "off")
|
||||
@@ -380,7 +380,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool HandleGPSCommand(ChatHandler* handler, char const* args)
|
||||
static bool HandleGPSCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
WorldObject* object = NULL;
|
||||
if (*args)
|
||||
@@ -460,8 +460,8 @@ public:
|
||||
|
||||
if (status)
|
||||
handler->PSendSysMessage(LANG_LIQUID_STATUS, liquidStatus.level, liquidStatus.depth_level, liquidStatus.entry, liquidStatus.type_flags, status);
|
||||
if (Transport* t = object->GetTransport())
|
||||
handler->PSendSysMessage("Transport offset: %.2f, %.2f, %.2f, %.2f", object->m_movementInfo.transport.pos.GetPositionX(), object->m_movementInfo.transport.pos.GetPositionY(), object->m_movementInfo.transport.pos.GetPositionZ(), object->m_movementInfo.transport.pos.GetOrientation());
|
||||
if (Transport* t = object->GetTransport())
|
||||
handler->PSendSysMessage("Transport offset: %.2f, %.2f, %.2f, %.2f", object->m_movementInfo.transport.pos.GetPositionX(), object->m_movementInfo.transport.pos.GetPositionY(), object->m_movementInfo.transport.pos.GetPositionZ(), object->m_movementInfo.transport.pos.GetOrientation());
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -607,7 +607,7 @@ public:
|
||||
InstancePlayerBind* bind = sInstanceSaveMgr->PlayerGetBoundInstance(_player->GetGUIDLow(), target->GetMapId(), target->GetDifficulty(map->IsRaid()));
|
||||
if (!bind)
|
||||
if (InstanceSave* save = sInstanceSaveMgr->GetInstanceSave(target->GetInstanceId()))
|
||||
sInstanceSaveMgr->PlayerBindToInstance(_player->GetGUIDLow(), save, !save->CanReset(), _player);
|
||||
sInstanceSaveMgr->PlayerBindToInstance(_player->GetGUIDLow(), save, !save->CanReset(), _player);
|
||||
|
||||
if (map->IsRaid())
|
||||
_player->SetRaidDifficulty(target->GetRaidDifficulty());
|
||||
@@ -703,9 +703,9 @@ public:
|
||||
}
|
||||
else if (map->IsDungeon())
|
||||
{
|
||||
// pussywizard: prevent unbinding normal player's perm bind by just summoning him >_>
|
||||
if (!target->GetSession()->GetSecurity())
|
||||
{
|
||||
// pussywizard: prevent unbinding normal player's perm bind by just summoning him >_>
|
||||
if (!target->GetSession()->GetSecurity())
|
||||
{
|
||||
handler->PSendSysMessage("Only GMs can be summoned to an instance!");
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
@@ -888,11 +888,11 @@ public:
|
||||
if (target->IsAlive())
|
||||
{
|
||||
if (sWorld->getBoolConfig(CONFIG_DIE_COMMAND_MODE))
|
||||
{
|
||||
if (target->GetTypeId() == TYPEID_UNIT && handler->GetSession()->GetSecurity() == SEC_CONSOLE) // pussywizard
|
||||
target->ToCreature()->LowerPlayerDamageReq(target->GetMaxHealth());
|
||||
{
|
||||
if (target->GetTypeId() == TYPEID_UNIT && handler->GetSession()->GetSecurity() == SEC_CONSOLE) // pussywizard
|
||||
target->ToCreature()->LowerPlayerDamageReq(target->GetMaxHealth());
|
||||
Unit::Kill(handler->GetSession()->GetPlayer(), target);
|
||||
}
|
||||
}
|
||||
else
|
||||
Unit::DealDamage(handler->GetSession()->GetPlayer(), target, target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false, true);
|
||||
}
|
||||
@@ -1341,11 +1341,11 @@ public:
|
||||
|
||||
std::string team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_NOTEAM);
|
||||
|
||||
if (data->teamId == TEAM_NEUTRAL)
|
||||
if (data->teamId == TEAM_NEUTRAL)
|
||||
team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ANY);
|
||||
else if (data->teamId == TEAM_HORDE)
|
||||
else if (data->teamId == TEAM_HORDE)
|
||||
team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_HORDE);
|
||||
else if (data->teamId == TEAM_ALLIANCE)
|
||||
else if (data->teamId == TEAM_ALLIANCE)
|
||||
team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ALLIANCE);
|
||||
|
||||
handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDNEAREST, graveyardId, team_name.c_str(), zone_id);
|
||||
@@ -1543,11 +1543,11 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
if (handler->GetSession()->GetSecurity() < SEC_ADMINISTRATOR)
|
||||
{
|
||||
handler->PSendSysMessage("You may only remove items. Adding items is available for higher GMLevel.");
|
||||
return false;
|
||||
}
|
||||
if (handler->GetSession()->GetSecurity() < SEC_ADMINISTRATOR)
|
||||
{
|
||||
handler->PSendSysMessage("You may only remove items. Adding items is available for higher GMLevel.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Adding items
|
||||
uint32 noSpaceForCount = 0;
|
||||
@@ -1801,21 +1801,21 @@ public:
|
||||
uint32 areaId;
|
||||
uint32 phase = 0;
|
||||
|
||||
// pussywizard: guild info
|
||||
std::string guildName = "";
|
||||
bool guildIsLeader = false;
|
||||
uint64 guildMoney = 0;
|
||||
uint32 guildMemberCount = 0;
|
||||
if (const GlobalPlayerData* gpd = sWorld->GetGlobalPlayerData(targetGuid))
|
||||
if (gpd->guildId)
|
||||
if (Guild* targetGuild = sGuildMgr->GetGuildById(gpd->guildId))
|
||||
{
|
||||
guildName = targetGuild->GetName();
|
||||
guildMoney = targetGuild->GetTotalBankMoney();
|
||||
guildMemberCount = targetGuild->GetMemberCount();
|
||||
if (targetGuild->GetLeaderGUID() == targetGuid)
|
||||
guildIsLeader = true;
|
||||
}
|
||||
// pussywizard: guild info
|
||||
std::string guildName = "";
|
||||
bool guildIsLeader = false;
|
||||
uint64 guildMoney = 0;
|
||||
uint32 guildMemberCount = 0;
|
||||
if (const GlobalPlayerData* gpd = sWorld->GetGlobalPlayerData(targetGuid))
|
||||
if (gpd->guildId)
|
||||
if (Guild* targetGuild = sGuildMgr->GetGuildById(gpd->guildId))
|
||||
{
|
||||
guildName = targetGuild->GetName();
|
||||
guildMoney = targetGuild->GetTotalBankMoney();
|
||||
guildMemberCount = targetGuild->GetMemberCount();
|
||||
if (targetGuild->GetLeaderGUID() == targetGuid)
|
||||
guildIsLeader = true;
|
||||
}
|
||||
|
||||
// get additional information from Player object
|
||||
if (target)
|
||||
@@ -2038,13 +2038,13 @@ public:
|
||||
else
|
||||
handler->PSendSysMessage(LANG_PINFO_MAP_OFFLINE, map->name[locale], areaName.c_str());
|
||||
|
||||
if (!guildName.empty())
|
||||
{
|
||||
uint32 gold = guildMoney /GOLD;
|
||||
uint32 silv = (guildMoney % GOLD) / SILVER;
|
||||
uint32 copp = (guildMoney % GOLD) % SILVER;
|
||||
handler->PSendSysMessage("Guild: %s, members: %u, gb money: %ug %us %uc, is guild leader: %s", guildName.c_str(), guildMemberCount, gold, silv, copp, guildIsLeader ? "yes" : "no");
|
||||
}
|
||||
if (!guildName.empty())
|
||||
{
|
||||
uint32 gold = guildMoney /GOLD;
|
||||
uint32 silv = (guildMoney % GOLD) / SILVER;
|
||||
uint32 copp = (guildMoney % GOLD) % SILVER;
|
||||
handler->PSendSysMessage("Guild: %s, members: %u, gb money: %ug %us %uc, is guild leader: %s", guildName.c_str(), guildMemberCount, gold, silv, copp, guildIsLeader ? "yes" : "no");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -2362,8 +2362,8 @@ public:
|
||||
|
||||
uint32 damage = damage_int;
|
||||
|
||||
if (target->GetTypeId() == TYPEID_UNIT && handler->GetSession()->GetSecurity() == SEC_CONSOLE) // pussywizard
|
||||
target->ToCreature()->LowerPlayerDamageReq(target->GetMaxHealth());
|
||||
if (target->GetTypeId() == TYPEID_UNIT && handler->GetSession()->GetSecurity() == SEC_CONSOLE) // pussywizard
|
||||
target->ToCreature()->LowerPlayerDamageReq(target->GetMaxHealth());
|
||||
Unit::DealDamage(handler->GetSession()->GetPlayer(), target, damage, NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false, true);
|
||||
if (target != handler->GetSession()->GetPlayer())
|
||||
handler->GetSession()->GetPlayer()->SendAttackStateUpdate (HITINFO_AFFECTS_VICTIM, target, 1, SPELL_SCHOOL_MASK_NORMAL, damage, 0, 0, VICTIMSTATE_HIT, 0);
|
||||
@@ -2670,8 +2670,8 @@ public:
|
||||
if (!handler->extractPlayerTarget((char*)args, &player))
|
||||
return false;
|
||||
|
||||
if (!player)
|
||||
return false;
|
||||
if (!player)
|
||||
return false;
|
||||
|
||||
char* msgStr = strtok(NULL, "");
|
||||
if (!msgStr)
|
||||
@@ -2908,18 +2908,18 @@ public:
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str());
|
||||
player->RemoveAurasDueToSpell(9454);
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
else if (targetName)
|
||||
{
|
||||
if (uint64 playerGUID = sWorld->GetGlobalPlayerGUID(name))
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_AURA_FROZEN);
|
||||
stmt->setUInt32(0, GUID_LOPART(playerGUID));
|
||||
CharacterDatabase.Execute(stmt);
|
||||
handler->PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str());
|
||||
return true;
|
||||
}
|
||||
if (uint64 playerGUID = sWorld->GetGlobalPlayerGUID(name))
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_AURA_FROZEN);
|
||||
stmt->setUInt32(0, GUID_LOPART(playerGUID));
|
||||
CharacterDatabase.Execute(stmt);
|
||||
handler->PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
handler->SendSysMessage(LANG_COMMAND_FREEZE_WRONG);
|
||||
@@ -3046,9 +3046,9 @@ public:
|
||||
if (playerTarget)
|
||||
groupTarget = playerTarget->GetGroup();
|
||||
|
||||
if (!groupTarget && guidTarget)
|
||||
if (uint32 groupId = Player::GetGroupIdFromStorage(GUID_LOPART(guidTarget)))
|
||||
groupTarget = sGroupMgr->GetGroupByGUID(groupId);
|
||||
if (!groupTarget && guidTarget)
|
||||
if (uint32 groupId = Player::GetGroupIdFromStorage(GUID_LOPART(guidTarget)))
|
||||
groupTarget = sGroupMgr->GetGroupByGUID(groupId);
|
||||
|
||||
if (groupTarget)
|
||||
{
|
||||
|
||||
@@ -37,7 +37,7 @@ public:
|
||||
|
||||
ChatCommand* GetCommands() const
|
||||
{
|
||||
static ChatCommand modifyspeedCommandTable[] =
|
||||
static ChatCommand modifyspeedCommandTable[] =
|
||||
{
|
||||
{ "fly", SEC_GAMEMASTER, false, &HandleModifyFlyCommand, "", NULL },
|
||||
{ "all", SEC_GAMEMASTER, false, &HandleModifyASpeedCommand, "", NULL },
|
||||
@@ -69,12 +69,12 @@ public:
|
||||
{ "standstate", SEC_GAMEMASTER, false, &HandleModifyStandStateCommand, "", NULL },
|
||||
{ "phase", SEC_ADMINISTRATOR, false, &HandleModifyPhaseCommand, "", NULL },
|
||||
{ "gender", SEC_GAMEMASTER, false, &HandleModifyGenderCommand, "", NULL },
|
||||
{ "speed", SEC_GAMEMASTER, false, NULL, "", modifyspeedCommandTable },
|
||||
{ "speed", SEC_GAMEMASTER, false, NULL, "", modifyspeedCommandTable },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
static ChatCommand commandTable[] =
|
||||
{
|
||||
{ "morph", SEC_GAMEMASTER, false, &HandleModifyMorphCommand, "", NULL },
|
||||
{ "morph", SEC_GAMEMASTER, false, &HandleModifyMorphCommand, "", NULL },
|
||||
{ "demorph", SEC_GAMEMASTER, false, &HandleDeMorphCommand, "", NULL },
|
||||
{ "modify", SEC_GAMEMASTER, false, NULL, "", modifyCommandTable },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
@@ -487,8 +487,8 @@ public:
|
||||
}
|
||||
|
||||
Player* target = handler->getSelectedPlayerOrSelf();
|
||||
if (handler->GetSession()->GetSecurity() < SEC_GAMEMASTER)
|
||||
target = handler->GetSession()->GetPlayer();
|
||||
if (handler->GetSession()->GetSecurity() < SEC_GAMEMASTER)
|
||||
target = handler->GetSession()->GetPlayer();
|
||||
if (!target)
|
||||
{
|
||||
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||
@@ -537,8 +537,8 @@ public:
|
||||
}
|
||||
|
||||
Player* target = handler->getSelectedPlayerOrSelf();
|
||||
if (handler->GetSession()->GetSecurity() < SEC_GAMEMASTER)
|
||||
target = handler->GetSession()->GetPlayer();
|
||||
if (handler->GetSession()->GetSecurity() < SEC_GAMEMASTER)
|
||||
target = handler->GetSession()->GetPlayer();
|
||||
if (!target)
|
||||
{
|
||||
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||
@@ -584,8 +584,8 @@ public:
|
||||
}
|
||||
|
||||
Player* target = handler->getSelectedPlayerOrSelf();
|
||||
if (handler->GetSession()->GetSecurity() < SEC_GAMEMASTER)
|
||||
target = handler->GetSession()->GetPlayer();
|
||||
if (handler->GetSession()->GetSecurity() < SEC_GAMEMASTER)
|
||||
target = handler->GetSession()->GetPlayer();
|
||||
if (!target)
|
||||
{
|
||||
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||
@@ -631,8 +631,8 @@ public:
|
||||
}
|
||||
|
||||
Player* target = handler->getSelectedPlayerOrSelf();
|
||||
if (handler->GetSession()->GetSecurity() < SEC_GAMEMASTER)
|
||||
target = handler->GetSession()->GetPlayer();
|
||||
if (handler->GetSession()->GetSecurity() < SEC_GAMEMASTER)
|
||||
target = handler->GetSession()->GetPlayer();
|
||||
if (!target)
|
||||
{
|
||||
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||
@@ -678,8 +678,8 @@ public:
|
||||
}
|
||||
|
||||
Player* target = handler->getSelectedPlayerOrSelf();
|
||||
if (handler->GetSession()->GetSecurity() < SEC_GAMEMASTER)
|
||||
target = handler->GetSession()->GetPlayer();
|
||||
if (handler->GetSession()->GetSecurity() < SEC_GAMEMASTER)
|
||||
target = handler->GetSession()->GetPlayer();
|
||||
if (!target)
|
||||
{
|
||||
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||
|
||||
@@ -175,24 +175,24 @@ public:
|
||||
Map* map = chr->GetMap();
|
||||
|
||||
if (Transport* tt = chr->GetTransport())
|
||||
if (MotionTransport* trans = tt->ToMotionTransport())
|
||||
{
|
||||
uint32 guid = sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT);
|
||||
CreatureData& data = sObjectMgr->NewOrExistCreatureData(guid);
|
||||
data.id = id;
|
||||
data.phaseMask = chr->GetPhaseMaskForSpawn();
|
||||
data.posX = chr->GetTransOffsetX();
|
||||
data.posY = chr->GetTransOffsetY();
|
||||
data.posZ = chr->GetTransOffsetZ();
|
||||
data.orientation = chr->GetTransOffsetO();
|
||||
if (MotionTransport* trans = tt->ToMotionTransport())
|
||||
{
|
||||
uint32 guid = sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT);
|
||||
CreatureData& data = sObjectMgr->NewOrExistCreatureData(guid);
|
||||
data.id = id;
|
||||
data.phaseMask = chr->GetPhaseMaskForSpawn();
|
||||
data.posX = chr->GetTransOffsetX();
|
||||
data.posY = chr->GetTransOffsetY();
|
||||
data.posZ = chr->GetTransOffsetZ();
|
||||
data.orientation = chr->GetTransOffsetO();
|
||||
|
||||
Creature* creature = trans->CreateNPCPassenger(guid, &data);
|
||||
Creature* creature = trans->CreateNPCPassenger(guid, &data);
|
||||
|
||||
creature->SaveToDB(trans->GetGOInfo()->moTransport.mapID, 1 << map->GetSpawnMode(), chr->GetPhaseMaskForSpawn());
|
||||
creature->SaveToDB(trans->GetGOInfo()->moTransport.mapID, 1 << map->GetSpawnMode(), chr->GetPhaseMaskForSpawn());
|
||||
|
||||
sObjectMgr->AddCreatureToGrid(guid, &data);
|
||||
return true;
|
||||
}
|
||||
sObjectMgr->AddCreatureToGrid(guid, &data);
|
||||
return true;
|
||||
}
|
||||
|
||||
Creature* creature = new Creature();
|
||||
if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, 0, x, y, z, o))
|
||||
@@ -260,7 +260,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
char* addMulti = strtok(NULL, " ");
|
||||
char* addMulti = strtok(NULL, " ");
|
||||
uint32 vendor_entry = addMulti ? handler->GetSession()->GetCurrentVendor() : vendor ? vendor->GetEntry() : 0;
|
||||
|
||||
if (!sObjectMgr->IsVendorItemValid(vendor_entry, itemId, maxcount, incrtime, extendedcost, handler->GetSession()->GetPlayer()))
|
||||
@@ -484,7 +484,7 @@ public:
|
||||
}
|
||||
uint32 itemId = atol(pitem);
|
||||
|
||||
char* addMulti = strtok(NULL, " ");
|
||||
char* addMulti = strtok(NULL, " ");
|
||||
if (!sObjectMgr->RemoveVendorItem(addMulti ? handler->GetSession()->GetCurrentVendor() : vendor->GetEntry(), itemId))
|
||||
{
|
||||
handler->PSendSysMessage(LANG_ITEM_NOT_IN_LIST, itemId);
|
||||
@@ -574,7 +574,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
//set data of creature for testing scripting
|
||||
//set data of creature for testing scripting
|
||||
static bool HandleNpcSetDataCommand(ChatHandler* handler, const char* args)
|
||||
{
|
||||
if (!*args)
|
||||
@@ -603,7 +603,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(), creature->GetEntry(), creature->GetName().c_str(), data_1, data_2, AIorScript.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -117,20 +117,20 @@ public:
|
||||
uint32 updateTime = sWorld->GetUpdateTime();
|
||||
uint32 avgUpdateTime = avgDiffTracker.getAverage();
|
||||
|
||||
handler->PSendSysMessage("%s Realm, revision: %s.", realmName.c_str(), _REVISION);
|
||||
handler->PSendSysMessage("This server runs on SunwellCore.");
|
||||
if (!queuedSessionCount)
|
||||
handler->PSendSysMessage("Connected players: %u. Characters in world: %u.", activeSessionCount, playerCount);
|
||||
else
|
||||
handler->PSendSysMessage("Connected players: %u. Characters in world: %u. Queue: %u.", activeSessionCount, playerCount, queuedSessionCount);
|
||||
//handler->PSendSysMessage("Connection peak: %u.", connPeak);
|
||||
handler->PSendSysMessage("%s Realm, revision: %s.", realmName.c_str(), _REVISION);
|
||||
handler->PSendSysMessage("This server runs on SunwellCore.");
|
||||
if (!queuedSessionCount)
|
||||
handler->PSendSysMessage("Connected players: %u. Characters in world: %u.", activeSessionCount, playerCount);
|
||||
else
|
||||
handler->PSendSysMessage("Connected players: %u. Characters in world: %u. Queue: %u.", activeSessionCount, playerCount, queuedSessionCount);
|
||||
//handler->PSendSysMessage("Connection peak: %u.", connPeak);
|
||||
handler->PSendSysMessage(LANG_UPTIME, uptime.c_str());
|
||||
handler->PSendSysMessage("Update time diff: %ums, average: %ums.", updateTime, avgUpdateTime);
|
||||
handler->PSendSysMessage("Update time diff: %ums, average: %ums.", updateTime, avgUpdateTime);
|
||||
|
||||
if (handler->GetSession())
|
||||
if (Player* p = handler->GetSession()->GetPlayer())
|
||||
if (p->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER))
|
||||
handler->PSendSysMessage("DEV wavg: %ums, nsmax: %ums, nsavg: %ums. LFG avg: %ums, max: %ums.", avgDiffTracker.getTimeWeightedAverage(), devDiffTracker.getMax(), devDiffTracker.getAverage(), lfgDiffTracker.getAverage(), lfgDiffTracker.getMax());
|
||||
if (handler->GetSession())
|
||||
if (Player* p = handler->GetSession()->GetPlayer())
|
||||
if (p->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER))
|
||||
handler->PSendSysMessage("DEV wavg: %ums, nsmax: %ums, nsavg: %ums. LFG avg: %ums, max: %ums.", avgDiffTracker.getTimeWeightedAverage(), devDiffTracker.getMax(), devDiffTracker.getAverage(), lfgDiffTracker.getAverage(), lfgDiffTracker.getMax());
|
||||
|
||||
//! Can't use sWorld->ShutdownMsg here in case of console command
|
||||
if (sWorld->IsShuttingDown())
|
||||
|
||||
@@ -36,219 +36,219 @@ public:
|
||||
return commandTable;
|
||||
}
|
||||
|
||||
static bool HandleSpectatorCommand(ChatHandler* handler, char const* args)
|
||||
static bool HandleSpectatorCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
handler->PSendSysMessage("Incorrect syntax.");
|
||||
handler->PSendSysMessage("Command has subcommands:");
|
||||
handler->PSendSysMessage(" spectate");
|
||||
handler->PSendSysMessage(" leave");
|
||||
return true;
|
||||
handler->PSendSysMessage("Incorrect syntax.");
|
||||
handler->PSendSysMessage("Command has subcommands:");
|
||||
handler->PSendSysMessage(" spectate");
|
||||
handler->PSendSysMessage(" leave");
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleSpectatorVersionCommand(ChatHandler* handler, char const* args)
|
||||
static bool HandleSpectatorVersionCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
if (atoi(args) < SPECTATOR_ADDON_VERSION)
|
||||
ArenaSpectator::SendCommand(handler->GetSession()->GetPlayer(), "%sOUTDATED", SPECTATOR_ADDON_PREFIX);
|
||||
return true;
|
||||
ArenaSpectator::SendCommand(handler->GetSession()->GetPlayer(), "%sOUTDATED", SPECTATOR_ADDON_PREFIX);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleSpectatorResetCommand(ChatHandler* handler, char const* args)
|
||||
static bool HandleSpectatorResetCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
Player* p = handler->GetSession()->GetPlayer();
|
||||
if (!p->IsSpectator())
|
||||
return true;
|
||||
ArenaSpectator::HandleResetCommand(p);
|
||||
return true;
|
||||
if (!p->IsSpectator())
|
||||
return true;
|
||||
ArenaSpectator::HandleResetCommand(p);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleSpectatorLeaveCommand(ChatHandler* handler, char const* args)
|
||||
static bool HandleSpectatorLeaveCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
Player* player = handler->GetSession()->GetPlayer();
|
||||
if (!player->IsSpectator() || !player->FindMap() || !player->FindMap()->IsBattleArena())
|
||||
{
|
||||
handler->SendSysMessage("You are not a spectator.");
|
||||
return true;
|
||||
}
|
||||
Player* player = handler->GetSession()->GetPlayer();
|
||||
if (!player->IsSpectator() || !player->FindMap() || !player->FindMap()->IsBattleArena())
|
||||
{
|
||||
handler->SendSysMessage("You are not a spectator.");
|
||||
return true;
|
||||
}
|
||||
|
||||
//player->SetIsSpectator(false);
|
||||
player->TeleportToEntryPoint();
|
||||
return true;
|
||||
//player->SetIsSpectator(false);
|
||||
player->TeleportToEntryPoint();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
bool ArenaSpectator::HandleSpectatorSpectateCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
Player* player = handler->GetSession()->GetPlayer();
|
||||
std::list<std::string> errors;
|
||||
if (!*args)
|
||||
{
|
||||
handler->SendSysMessage("Missing player name.");
|
||||
return true;
|
||||
}
|
||||
if (player->IsSpectator())
|
||||
{
|
||||
if (player->FindMap() && player->FindMap()->IsBattleArena())
|
||||
{
|
||||
HandleSpectatorWatchCommand(handler, args);
|
||||
return true;
|
||||
}
|
||||
handler->PSendSysMessage("You are already spectacting arena.");
|
||||
return true;
|
||||
}
|
||||
if (player->getClass() == CLASS_DEATH_KNIGHT && player->GetMapId() == 609)
|
||||
{
|
||||
handler->PSendSysMessage("Death Knights can't spectate before finishing questline.");
|
||||
return true;
|
||||
}
|
||||
Player* player = handler->GetSession()->GetPlayer();
|
||||
std::list<std::string> errors;
|
||||
if (!*args)
|
||||
{
|
||||
handler->SendSysMessage("Missing player name.");
|
||||
return true;
|
||||
}
|
||||
if (player->IsSpectator())
|
||||
{
|
||||
if (player->FindMap() && player->FindMap()->IsBattleArena())
|
||||
{
|
||||
HandleSpectatorWatchCommand(handler, args);
|
||||
return true;
|
||||
}
|
||||
handler->PSendSysMessage("You are already spectacting arena.");
|
||||
return true;
|
||||
}
|
||||
if (player->getClass() == CLASS_DEATH_KNIGHT && player->GetMapId() == 609)
|
||||
{
|
||||
handler->PSendSysMessage("Death Knights can't spectate before finishing questline.");
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string name = std::string(args);
|
||||
Player* spectate = ObjectAccessor::FindPlayerByName(name);
|
||||
if (!spectate)
|
||||
{
|
||||
handler->SendSysMessage("Requested player not found.");
|
||||
return true;
|
||||
}
|
||||
if (spectate->IsSpectator())
|
||||
{
|
||||
handler->SendSysMessage("Requested player is a spectator.");
|
||||
return true;
|
||||
}
|
||||
if (!spectate->FindMap() || !spectate->FindMap()->IsBattleArena())
|
||||
{
|
||||
handler->SendSysMessage("Requested player is not in arena.");
|
||||
return true;
|
||||
}
|
||||
BattlegroundMap* bgmap = ((BattlegroundMap*)spectate->FindMap());
|
||||
if (!bgmap->GetBG() || bgmap->GetBG()->GetStatus() == STATUS_WAIT_LEAVE)
|
||||
{
|
||||
handler->SendSysMessage("This arena battle has finished.");
|
||||
return true;
|
||||
}
|
||||
std::string name = std::string(args);
|
||||
Player* spectate = ObjectAccessor::FindPlayerByName(name);
|
||||
if (!spectate)
|
||||
{
|
||||
handler->SendSysMessage("Requested player not found.");
|
||||
return true;
|
||||
}
|
||||
if (spectate->IsSpectator())
|
||||
{
|
||||
handler->SendSysMessage("Requested player is a spectator.");
|
||||
return true;
|
||||
}
|
||||
if (!spectate->FindMap() || !spectate->FindMap()->IsBattleArena())
|
||||
{
|
||||
handler->SendSysMessage("Requested player is not in arena.");
|
||||
return true;
|
||||
}
|
||||
BattlegroundMap* bgmap = ((BattlegroundMap*)spectate->FindMap());
|
||||
if (!bgmap->GetBG() || bgmap->GetBG()->GetStatus() == STATUS_WAIT_LEAVE)
|
||||
{
|
||||
handler->SendSysMessage("This arena battle has finished.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (player->IsBeingTeleported() || !player->IsInWorld())
|
||||
errors.push_back("Can't use while being teleported.");
|
||||
if (!player->FindMap() || player->FindMap()->Instanceable())
|
||||
errors.push_back("Can't use while in instance, bg or arena.");
|
||||
if (player->GetVehicle())
|
||||
errors.push_back("Can't be on a vehicle.");
|
||||
if (player->IsInCombat())
|
||||
errors.push_back("Can't be in combat.");
|
||||
if (player->isUsingLfg())
|
||||
errors.push_back("Can't spectate while using LFG system.");
|
||||
if (player->InBattlegroundQueue())
|
||||
errors.push_back("Can't be queued for arena or bg.");
|
||||
if (player->GetGroup())
|
||||
errors.push_back("Can't be in a group.");
|
||||
if (player->HasUnitState(UNIT_STATE_ISOLATED))
|
||||
errors.push_back("Can't be isolated.");
|
||||
if (player->m_mover != player)
|
||||
errors.push_back("You must control yourself.");
|
||||
if (player->IsInFlight())
|
||||
errors.push_back("Can't be in flight.");
|
||||
if (player->IsMounted())
|
||||
errors.push_back("Dismount before spectating.");
|
||||
if (!player->IsAlive())
|
||||
errors.push_back("Must be alive.");
|
||||
if (!player->m_Controlled.empty())
|
||||
errors.push_back("Can't be controlling creatures.");
|
||||
if (player->IsBeingTeleported() || !player->IsInWorld())
|
||||
errors.push_back("Can't use while being teleported.");
|
||||
if (!player->FindMap() || player->FindMap()->Instanceable())
|
||||
errors.push_back("Can't use while in instance, bg or arena.");
|
||||
if (player->GetVehicle())
|
||||
errors.push_back("Can't be on a vehicle.");
|
||||
if (player->IsInCombat())
|
||||
errors.push_back("Can't be in combat.");
|
||||
if (player->isUsingLfg())
|
||||
errors.push_back("Can't spectate while using LFG system.");
|
||||
if (player->InBattlegroundQueue())
|
||||
errors.push_back("Can't be queued for arena or bg.");
|
||||
if (player->GetGroup())
|
||||
errors.push_back("Can't be in a group.");
|
||||
if (player->HasUnitState(UNIT_STATE_ISOLATED))
|
||||
errors.push_back("Can't be isolated.");
|
||||
if (player->m_mover != player)
|
||||
errors.push_back("You must control yourself.");
|
||||
if (player->IsInFlight())
|
||||
errors.push_back("Can't be in flight.");
|
||||
if (player->IsMounted())
|
||||
errors.push_back("Dismount before spectating.");
|
||||
if (!player->IsAlive())
|
||||
errors.push_back("Must be alive.");
|
||||
if (!player->m_Controlled.empty())
|
||||
errors.push_back("Can't be controlling creatures.");
|
||||
|
||||
const Unit::VisibleAuraMap* va = player->GetVisibleAuras();
|
||||
for (Unit::VisibleAuraMap::const_iterator itr = va->begin(); itr != va->end(); ++itr)
|
||||
if (Aura* aura = itr->second->GetBase())
|
||||
if (!itr->second->IsPositive() && !aura->IsPermanent() && aura->GetDuration() < HOUR*IN_MILLISECONDS)
|
||||
{
|
||||
switch (aura->GetSpellInfo()->Id)
|
||||
{
|
||||
case lfg::LFG_SPELL_DUNGEON_DESERTER:
|
||||
case lfg::LFG_SPELL_DUNGEON_COOLDOWN:
|
||||
case 26013: // bg deserter
|
||||
case 57724: // sated
|
||||
case 57723: // exhaustion
|
||||
case 25771: // forbearance
|
||||
case 15007: // resurrection sickness
|
||||
case 24755: // Tricked or Treated (z eventu)
|
||||
continue;
|
||||
}
|
||||
const Unit::VisibleAuraMap* va = player->GetVisibleAuras();
|
||||
for (Unit::VisibleAuraMap::const_iterator itr = va->begin(); itr != va->end(); ++itr)
|
||||
if (Aura* aura = itr->second->GetBase())
|
||||
if (!itr->second->IsPositive() && !aura->IsPermanent() && aura->GetDuration() < HOUR*IN_MILLISECONDS)
|
||||
{
|
||||
switch (aura->GetSpellInfo()->Id)
|
||||
{
|
||||
case lfg::LFG_SPELL_DUNGEON_DESERTER:
|
||||
case lfg::LFG_SPELL_DUNGEON_COOLDOWN:
|
||||
case 26013: // bg deserter
|
||||
case 57724: // sated
|
||||
case 57723: // exhaustion
|
||||
case 25771: // forbearance
|
||||
case 15007: // resurrection sickness
|
||||
case 24755: // Tricked or Treated (z eventu)
|
||||
continue;
|
||||
}
|
||||
|
||||
errors.push_back("Can't have negative auras.");
|
||||
break;
|
||||
}
|
||||
errors.push_back("Can't have negative auras.");
|
||||
break;
|
||||
}
|
||||
|
||||
if (uint32 inviteInstanceId = player->GetPendingSpectatorInviteInstanceId())
|
||||
{
|
||||
if (Battleground* tbg = sBattlegroundMgr->GetBattleground(inviteInstanceId))
|
||||
tbg->RemoveToBeTeleported(player->GetGUID());
|
||||
player->SetPendingSpectatorInviteInstanceId(0);
|
||||
}
|
||||
if (uint32 inviteInstanceId = player->GetPendingSpectatorInviteInstanceId())
|
||||
{
|
||||
if (Battleground* tbg = sBattlegroundMgr->GetBattleground(inviteInstanceId))
|
||||
tbg->RemoveToBeTeleported(player->GetGUID());
|
||||
player->SetPendingSpectatorInviteInstanceId(0);
|
||||
}
|
||||
|
||||
bool bgPreparation = false;
|
||||
if (!handler->GetSession()->GetSecurity() && bgmap->GetBG()->GetStatus() != STATUS_IN_PROGRESS ||
|
||||
handler->GetSession()->GetSecurity() && bgmap->GetBG()->GetStatus() != STATUS_WAIT_JOIN && bgmap->GetBG()->GetStatus() != STATUS_IN_PROGRESS)
|
||||
{
|
||||
bgPreparation = true;
|
||||
handler->SendSysMessage("Arena is not in progress yet. You will be invited as soon as it starts.");
|
||||
bgmap->GetBG()->AddToBeTeleported(player->GetGUID(), spectate->GetGUID());
|
||||
player->SetPendingSpectatorInviteInstanceId(spectate->GetBattlegroundId());
|
||||
}
|
||||
bool bgPreparation = false;
|
||||
if (!handler->GetSession()->GetSecurity() && bgmap->GetBG()->GetStatus() != STATUS_IN_PROGRESS ||
|
||||
handler->GetSession()->GetSecurity() && bgmap->GetBG()->GetStatus() != STATUS_WAIT_JOIN && bgmap->GetBG()->GetStatus() != STATUS_IN_PROGRESS)
|
||||
{
|
||||
bgPreparation = true;
|
||||
handler->SendSysMessage("Arena is not in progress yet. You will be invited as soon as it starts.");
|
||||
bgmap->GetBG()->AddToBeTeleported(player->GetGUID(), spectate->GetGUID());
|
||||
player->SetPendingSpectatorInviteInstanceId(spectate->GetBattlegroundId());
|
||||
}
|
||||
|
||||
if (!errors.empty())
|
||||
{
|
||||
handler->PSendSysMessage("To spectate, please fix the following:");
|
||||
for (std::list<std::string>::const_iterator itr = errors.begin(); itr != errors.end(); ++itr)
|
||||
handler->PSendSysMessage(("- "+(*itr)).c_str());
|
||||
if (!errors.empty())
|
||||
{
|
||||
handler->PSendSysMessage("To spectate, please fix the following:");
|
||||
for (std::list<std::string>::const_iterator itr = errors.begin(); itr != errors.end(); ++itr)
|
||||
handler->PSendSysMessage(("- "+(*itr)).c_str());
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (bgPreparation)
|
||||
return true;
|
||||
if (bgPreparation)
|
||||
return true;
|
||||
|
||||
player->SetPendingSpectatorForBG(spectate->GetBattlegroundId());
|
||||
player->SetBattlegroundId(spectate->GetBattlegroundId(), spectate->GetBattlegroundTypeId(), PLAYER_MAX_BATTLEGROUND_QUEUES, false, false, TEAM_NEUTRAL);
|
||||
player->SetEntryPoint();
|
||||
float z = spectate->GetMapId() == 618 ? std::max(28.27f, spectate->GetPositionZ()+0.25f) : spectate->GetPositionZ()+0.25f;
|
||||
player->TeleportTo(spectate->GetMapId(), spectate->GetPositionX(), spectate->GetPositionY(), z, spectate->GetOrientation(), TELE_TO_GM_MODE);
|
||||
return true;
|
||||
player->SetPendingSpectatorForBG(spectate->GetBattlegroundId());
|
||||
player->SetBattlegroundId(spectate->GetBattlegroundId(), spectate->GetBattlegroundTypeId(), PLAYER_MAX_BATTLEGROUND_QUEUES, false, false, TEAM_NEUTRAL);
|
||||
player->SetEntryPoint();
|
||||
float z = spectate->GetMapId() == 618 ? std::max(28.27f, spectate->GetPositionZ()+0.25f) : spectate->GetPositionZ()+0.25f;
|
||||
player->TeleportTo(spectate->GetMapId(), spectate->GetPositionX(), spectate->GetPositionY(), z, spectate->GetOrientation(), TELE_TO_GM_MODE);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ArenaSpectator::HandleSpectatorWatchCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
if (!*args)
|
||||
if (!*args)
|
||||
return true;
|
||||
|
||||
Player* player = handler->GetSession()->GetPlayer();
|
||||
if (!player->IsSpectator())
|
||||
return true;
|
||||
Player* player = handler->GetSession()->GetPlayer();
|
||||
if (!player->IsSpectator())
|
||||
return true;
|
||||
|
||||
if (!player->FindMap() || !player->FindMap()->IsBattleArena())
|
||||
return true;
|
||||
if (!player->FindMap() || !player->FindMap()->IsBattleArena())
|
||||
return true;
|
||||
|
||||
Battleground* bg = ((BattlegroundMap*)player->FindMap())->GetBG();
|
||||
if (!bg || bg->GetStatus() != STATUS_IN_PROGRESS)
|
||||
return true;
|
||||
Battleground* bg = ((BattlegroundMap*)player->FindMap())->GetBG();
|
||||
if (!bg || bg->GetStatus() != STATUS_IN_PROGRESS)
|
||||
return true;
|
||||
|
||||
std::string name = std::string(args);
|
||||
Player* spectate = ObjectAccessor::FindPlayerByName(name);
|
||||
if (!spectate || !spectate->IsAlive() || spectate->IsSpectator() || spectate->GetGUID() == player->GetGUID() || !spectate->IsInWorld() || !spectate->FindMap() || spectate->IsBeingTeleported() || spectate->FindMap() != player->FindMap() || !bg->IsPlayerInBattleground(spectate->GetGUID()))
|
||||
return true;
|
||||
std::string name = std::string(args);
|
||||
Player* spectate = ObjectAccessor::FindPlayerByName(name);
|
||||
if (!spectate || !spectate->IsAlive() || spectate->IsSpectator() || spectate->GetGUID() == player->GetGUID() || !spectate->IsInWorld() || !spectate->FindMap() || spectate->IsBeingTeleported() || spectate->FindMap() != player->FindMap() || !bg->IsPlayerInBattleground(spectate->GetGUID()))
|
||||
return true;
|
||||
|
||||
if (WorldObject* o = player->GetViewpoint())
|
||||
if (Unit* u = o->ToUnit())
|
||||
{
|
||||
u->RemoveAurasByType(SPELL_AURA_BIND_SIGHT, player->GetGUID());
|
||||
player->RemoveAurasDueToSpell(SPECTATOR_SPELL_BINDSIGHT, player->GetGUID(), (1 << EFFECT_1));
|
||||
if (WorldObject* o = player->GetViewpoint())
|
||||
if (Unit* u = o->ToUnit())
|
||||
{
|
||||
u->RemoveAurasByType(SPELL_AURA_BIND_SIGHT, player->GetGUID());
|
||||
player->RemoveAurasDueToSpell(SPECTATOR_SPELL_BINDSIGHT, player->GetGUID(), (1 << EFFECT_1));
|
||||
|
||||
if (u->GetGUID() == spectate->GetGUID())
|
||||
return true;
|
||||
}
|
||||
if (u->GetGUID() == spectate->GetGUID())
|
||||
return true;
|
||||
}
|
||||
|
||||
if (player->GetUInt64Value(PLAYER_FARSIGHT) || player->m_seer != player) // pussywizard: below this point we must not have a viewpoint!
|
||||
return true;
|
||||
if (player->GetUInt64Value(PLAYER_FARSIGHT) || player->m_seer != player) // pussywizard: below this point we must not have a viewpoint!
|
||||
return true;
|
||||
|
||||
if (player->HaveAtClient(spectate))
|
||||
player->CastSpell(spectate, SPECTATOR_SPELL_BINDSIGHT, true);
|
||||
if (player->HaveAtClient(spectate))
|
||||
player->CastSpell(spectate, SPECTATOR_SPELL_BINDSIGHT, true);
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void AddSC_spectator_commandscript()
|
||||
|
||||
@@ -133,7 +133,7 @@ public:
|
||||
if (target)
|
||||
target->TeleportTo(target->m_homebindMapId, target->m_homebindX, target->m_homebindY, target->m_homebindZ, target->GetOrientation());
|
||||
/* xinef: optimization, not needed function
|
||||
else
|
||||
else
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_HOMEBIND);
|
||||
stmt->setUInt32(0, target_guid);
|
||||
|
||||
Reference in New Issue
Block a user