mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-15 10:00:28 +00:00
converted all tabs to 4 spaces
This commit is contained in:
@@ -173,199 +173,199 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket & recv_data)
|
||||
|
||||
void WorldSession::HandleWhoOpcode(WorldPacket& recvData)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_WHO Message");
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_WHO Message");
|
||||
|
||||
time_t now = time(NULL);
|
||||
if (now < timeWhoCommandAllowed)
|
||||
return;
|
||||
timeWhoCommandAllowed = now + 3;
|
||||
time_t now = time(NULL);
|
||||
if (now < timeWhoCommandAllowed)
|
||||
return;
|
||||
timeWhoCommandAllowed = now + 3;
|
||||
|
||||
uint32 matchcount = 0;
|
||||
uint32 matchcount = 0;
|
||||
|
||||
uint32 level_min, level_max, racemask, classmask, zones_count, str_count;
|
||||
uint32 zoneids[10]; // 10 is client limit
|
||||
std::string player_name, guild_name;
|
||||
uint32 level_min, level_max, racemask, classmask, zones_count, str_count;
|
||||
uint32 zoneids[10]; // 10 is client limit
|
||||
std::string player_name, guild_name;
|
||||
|
||||
recvData >> level_min; // maximal player level, default 0
|
||||
recvData >> level_max; // minimal player level, default 100 (MAX_LEVEL)
|
||||
recvData >> player_name; // player name, case sensitive...
|
||||
recvData >> level_min; // maximal player level, default 0
|
||||
recvData >> level_max; // minimal player level, default 100 (MAX_LEVEL)
|
||||
recvData >> player_name; // player name, case sensitive...
|
||||
|
||||
recvData >> guild_name; // guild name, case sensitive...
|
||||
recvData >> guild_name; // guild name, case sensitive...
|
||||
|
||||
recvData >> racemask; // race mask
|
||||
recvData >> classmask; // class mask
|
||||
recvData >> zones_count; // zones count, client limit = 10 (2.0.10)
|
||||
recvData >> racemask; // race mask
|
||||
recvData >> classmask; // class mask
|
||||
recvData >> zones_count; // zones count, client limit = 10 (2.0.10)
|
||||
|
||||
if (zones_count > 10)
|
||||
return; // can't be received from real client or broken packet
|
||||
if (zones_count > 10)
|
||||
return; // can't be received from real client or broken packet
|
||||
|
||||
for (uint32 i = 0; i < zones_count; ++i)
|
||||
{
|
||||
uint32 temp;
|
||||
recvData >> temp; // zone id, 0 if zone is unknown...
|
||||
zoneids[i] = temp;
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "Zone %u: %u", i, zoneids[i]);
|
||||
}
|
||||
for (uint32 i = 0; i < zones_count; ++i)
|
||||
{
|
||||
uint32 temp;
|
||||
recvData >> temp; // zone id, 0 if zone is unknown...
|
||||
zoneids[i] = temp;
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "Zone %u: %u", i, zoneids[i]);
|
||||
}
|
||||
|
||||
recvData >> str_count; // user entered strings count, client limit=4 (checked on 2.0.10)
|
||||
recvData >> str_count; // user entered strings count, client limit=4 (checked on 2.0.10)
|
||||
|
||||
if (str_count > 4)
|
||||
return; // can't be received from real client or broken packet
|
||||
if (str_count > 4)
|
||||
return; // can't be received from real client or broken packet
|
||||
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "Minlvl %u, maxlvl %u, name %s, guild %s, racemask %u, classmask %u, zones %u, strings %u", level_min, level_max, player_name.c_str(), guild_name.c_str(), racemask, classmask, zones_count, str_count);
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "Minlvl %u, maxlvl %u, name %s, guild %s, racemask %u, classmask %u, zones %u, strings %u", level_min, level_max, player_name.c_str(), guild_name.c_str(), racemask, classmask, zones_count, str_count);
|
||||
|
||||
std::wstring str[4]; // 4 is client limit
|
||||
for (uint32 i = 0; i < str_count; ++i)
|
||||
{
|
||||
std::string temp;
|
||||
recvData >> temp; // user entered string, it used as universal search pattern(guild+player name)?
|
||||
std::wstring str[4]; // 4 is client limit
|
||||
for (uint32 i = 0; i < str_count; ++i)
|
||||
{
|
||||
std::string temp;
|
||||
recvData >> temp; // user entered string, it used as universal search pattern(guild+player name)?
|
||||
|
||||
if (!Utf8toWStr(temp, str[i]))
|
||||
continue;
|
||||
if (!Utf8toWStr(temp, str[i]))
|
||||
continue;
|
||||
|
||||
wstrToLower(str[i]);
|
||||
wstrToLower(str[i]);
|
||||
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "String %u: %s", i, temp.c_str());
|
||||
}
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "String %u: %s", i, temp.c_str());
|
||||
}
|
||||
|
||||
std::wstring wplayer_name;
|
||||
std::wstring wguild_name;
|
||||
if (!(Utf8toWStr(player_name, wplayer_name) && Utf8toWStr(guild_name, wguild_name)))
|
||||
return;
|
||||
wstrToLower(wplayer_name);
|
||||
wstrToLower(wguild_name);
|
||||
std::wstring wplayer_name;
|
||||
std::wstring wguild_name;
|
||||
if (!(Utf8toWStr(player_name, wplayer_name) && Utf8toWStr(guild_name, wguild_name)))
|
||||
return;
|
||||
wstrToLower(wplayer_name);
|
||||
wstrToLower(wguild_name);
|
||||
|
||||
// client send in case not set max level value 100 but Trinity supports 255 max level,
|
||||
// update it to show GMs with characters after 100 level
|
||||
if (level_max >= MAX_LEVEL)
|
||||
level_max = STRONG_MAX_LEVEL;
|
||||
// client send in case not set max level value 100 but Trinity supports 255 max level,
|
||||
// update it to show GMs with characters after 100 level
|
||||
if (level_max >= MAX_LEVEL)
|
||||
level_max = STRONG_MAX_LEVEL;
|
||||
|
||||
uint32 team = _player->GetTeamId();
|
||||
uint32 security = GetSecurity();
|
||||
bool allowTwoSideWhoList = sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_WHO_LIST);
|
||||
uint32 gmLevelInWhoList = sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_WHO_LIST);
|
||||
uint32 displaycount = 0;
|
||||
uint32 team = _player->GetTeamId();
|
||||
uint32 security = GetSecurity();
|
||||
bool allowTwoSideWhoList = sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_WHO_LIST);
|
||||
uint32 gmLevelInWhoList = sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_WHO_LIST);
|
||||
uint32 displaycount = 0;
|
||||
|
||||
WorldPacket data(SMSG_WHO, 50); // guess size
|
||||
data << uint32(matchcount); // placeholder, count of players matching criteria
|
||||
data << uint32(displaycount); // placeholder, count of players displayed
|
||||
WorldPacket data(SMSG_WHO, 50); // guess size
|
||||
data << uint32(matchcount); // placeholder, count of players matching criteria
|
||||
data << uint32(displaycount); // placeholder, count of players displayed
|
||||
|
||||
TRINITY_READ_GUARD(HashMapHolder<Player>::LockType, *HashMapHolder<Player>::GetLock());
|
||||
HashMapHolder<Player>::MapType const& m = sObjectAccessor->GetPlayers();
|
||||
for (HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
{
|
||||
if (AccountMgr::IsPlayerAccount(security))
|
||||
{
|
||||
// player can see member of other team only if CONFIG_ALLOW_TWO_SIDE_WHO_LIST
|
||||
if (itr->second->GetTeamId() != team && !allowTwoSideWhoList)
|
||||
continue;
|
||||
TRINITY_READ_GUARD(HashMapHolder<Player>::LockType, *HashMapHolder<Player>::GetLock());
|
||||
HashMapHolder<Player>::MapType const& m = sObjectAccessor->GetPlayers();
|
||||
for (HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
{
|
||||
if (AccountMgr::IsPlayerAccount(security))
|
||||
{
|
||||
// player can see member of other team only if CONFIG_ALLOW_TWO_SIDE_WHO_LIST
|
||||
if (itr->second->GetTeamId() != team && !allowTwoSideWhoList)
|
||||
continue;
|
||||
|
||||
// player can see MODERATOR, GAME MASTER, ADMINISTRATOR only if CONFIG_GM_IN_WHO_LIST
|
||||
if ((itr->second->GetSession()->GetSecurity() > AccountTypes(gmLevelInWhoList)))
|
||||
continue;
|
||||
}
|
||||
// player can see MODERATOR, GAME MASTER, ADMINISTRATOR only if CONFIG_GM_IN_WHO_LIST
|
||||
if ((itr->second->GetSession()->GetSecurity() > AccountTypes(gmLevelInWhoList)))
|
||||
continue;
|
||||
}
|
||||
|
||||
//do not process players which are not in world
|
||||
if (!(itr->second->IsInWorld()))
|
||||
continue;
|
||||
//do not process players which are not in world
|
||||
if (!(itr->second->IsInWorld()))
|
||||
continue;
|
||||
|
||||
// check if target is globally visible for player
|
||||
if (!(itr->second->IsVisibleGloballyFor(_player)))
|
||||
continue;
|
||||
// check if target is globally visible for player
|
||||
if (!(itr->second->IsVisibleGloballyFor(_player)))
|
||||
continue;
|
||||
|
||||
// check if target's level is in level range
|
||||
uint8 lvl = itr->second->getLevel();
|
||||
if (lvl < level_min || lvl > level_max)
|
||||
continue;
|
||||
// check if target's level is in level range
|
||||
uint8 lvl = itr->second->getLevel();
|
||||
if (lvl < level_min || lvl > level_max)
|
||||
continue;
|
||||
|
||||
// check if class matches classmask
|
||||
uint32 class_ = itr->second->getClass();
|
||||
if (!(classmask & (1 << class_)))
|
||||
continue;
|
||||
// check if class matches classmask
|
||||
uint32 class_ = itr->second->getClass();
|
||||
if (!(classmask & (1 << class_)))
|
||||
continue;
|
||||
|
||||
// check if race matches racemask
|
||||
uint32 race = itr->second->getRace();
|
||||
if (!(racemask & (1 << race)))
|
||||
continue;
|
||||
// check if race matches racemask
|
||||
uint32 race = itr->second->getRace();
|
||||
if (!(racemask & (1 << race)))
|
||||
continue;
|
||||
|
||||
uint32 pzoneid = itr->second->GetZoneId();
|
||||
uint8 gender = itr->second->getGender();
|
||||
uint32 pzoneid = itr->second->GetZoneId();
|
||||
uint8 gender = itr->second->getGender();
|
||||
|
||||
bool z_show = true;
|
||||
for (uint32 i = 0; i < zones_count; ++i)
|
||||
{
|
||||
if (zoneids[i] == pzoneid)
|
||||
{
|
||||
z_show = true;
|
||||
break;
|
||||
}
|
||||
bool z_show = true;
|
||||
for (uint32 i = 0; i < zones_count; ++i)
|
||||
{
|
||||
if (zoneids[i] == pzoneid)
|
||||
{
|
||||
z_show = true;
|
||||
break;
|
||||
}
|
||||
|
||||
z_show = false;
|
||||
}
|
||||
if (!z_show)
|
||||
continue;
|
||||
z_show = false;
|
||||
}
|
||||
if (!z_show)
|
||||
continue;
|
||||
|
||||
std::string pname = itr->second->GetName();
|
||||
std::wstring wpname;
|
||||
if (!Utf8toWStr(pname, wpname))
|
||||
continue;
|
||||
wstrToLower(wpname);
|
||||
std::string pname = itr->second->GetName();
|
||||
std::wstring wpname;
|
||||
if (!Utf8toWStr(pname, wpname))
|
||||
continue;
|
||||
wstrToLower(wpname);
|
||||
|
||||
if (!(wplayer_name.empty() || wpname.find(wplayer_name) != std::wstring::npos))
|
||||
continue;
|
||||
if (!(wplayer_name.empty() || wpname.find(wplayer_name) != std::wstring::npos))
|
||||
continue;
|
||||
|
||||
std::string gname = sGuildMgr->GetGuildNameById(itr->second->GetGuildId());
|
||||
std::wstring wgname;
|
||||
if (!Utf8toWStr(gname, wgname))
|
||||
continue;
|
||||
wstrToLower(wgname);
|
||||
std::string gname = sGuildMgr->GetGuildNameById(itr->second->GetGuildId());
|
||||
std::wstring wgname;
|
||||
if (!Utf8toWStr(gname, wgname))
|
||||
continue;
|
||||
wstrToLower(wgname);
|
||||
|
||||
if (!(wguild_name.empty() || wgname.find(wguild_name) != std::wstring::npos))
|
||||
continue;
|
||||
if (!(wguild_name.empty() || wgname.find(wguild_name) != std::wstring::npos))
|
||||
continue;
|
||||
|
||||
std::string aname;
|
||||
if (AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(itr->second->GetZoneId()))
|
||||
aname = areaEntry->area_name[GetSessionDbcLocale()];
|
||||
std::string aname;
|
||||
if (AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(itr->second->GetZoneId()))
|
||||
aname = areaEntry->area_name[GetSessionDbcLocale()];
|
||||
|
||||
bool s_show = true;
|
||||
for (uint32 i = 0; i < str_count; ++i)
|
||||
{
|
||||
if (!str[i].empty())
|
||||
{
|
||||
if (wgname.find(str[i]) != std::wstring::npos ||
|
||||
wpname.find(str[i]) != std::wstring::npos ||
|
||||
Utf8FitTo(aname, str[i]))
|
||||
{
|
||||
s_show = true;
|
||||
break;
|
||||
}
|
||||
s_show = false;
|
||||
}
|
||||
}
|
||||
if (!s_show)
|
||||
continue;
|
||||
bool s_show = true;
|
||||
for (uint32 i = 0; i < str_count; ++i)
|
||||
{
|
||||
if (!str[i].empty())
|
||||
{
|
||||
if (wgname.find(str[i]) != std::wstring::npos ||
|
||||
wpname.find(str[i]) != std::wstring::npos ||
|
||||
Utf8FitTo(aname, str[i]))
|
||||
{
|
||||
s_show = true;
|
||||
break;
|
||||
}
|
||||
s_show = false;
|
||||
}
|
||||
}
|
||||
if (!s_show)
|
||||
continue;
|
||||
|
||||
// 49 is maximum player count sent to client - can be overridden
|
||||
// through config, but is unstable
|
||||
if ((matchcount++) >= 50 /*sWorld->getIntConfig(CONFIG_MAX_WHO)*/)
|
||||
continue;
|
||||
// 49 is maximum player count sent to client - can be overridden
|
||||
// through config, but is unstable
|
||||
if ((matchcount++) >= 50 /*sWorld->getIntConfig(CONFIG_MAX_WHO)*/)
|
||||
continue;
|
||||
|
||||
data << pname; // player name
|
||||
data << gname; // guild name
|
||||
data << uint32(lvl); // player level
|
||||
data << uint32(class_); // player class
|
||||
data << uint32(race); // player race
|
||||
data << uint8(gender); // player gender
|
||||
data << uint32(pzoneid); // player zone id
|
||||
data << pname; // player name
|
||||
data << gname; // guild name
|
||||
data << uint32(lvl); // player level
|
||||
data << uint32(class_); // player class
|
||||
data << uint32(race); // player race
|
||||
data << uint8(gender); // player gender
|
||||
data << uint32(pzoneid); // player zone id
|
||||
|
||||
++displaycount;
|
||||
}
|
||||
++displaycount;
|
||||
}
|
||||
|
||||
data.put(0, displaycount); // insert right count, count displayed
|
||||
data.put(4, matchcount); // insert right count, count of matches
|
||||
data.put(0, displaycount); // insert right count, count displayed
|
||||
data.put(4, matchcount); // insert right count, count of matches
|
||||
|
||||
SendPacket(&data);
|
||||
;// sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Send SMSG_WHO Message");
|
||||
SendPacket(&data);
|
||||
;// sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Send SMSG_WHO Message");
|
||||
}
|
||||
|
||||
|
||||
@@ -524,17 +524,17 @@ void WorldSession::HandleAddFriendOpcode(WorldPacket & recv_data)
|
||||
|
||||
;//sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: %s asked to add friend : '%s'", GetPlayer()->GetName().c_str(), friendName.c_str());
|
||||
|
||||
// xinef: Get Data From global storage
|
||||
uint32 guidLow = sWorld->GetGlobalPlayerGUID(friendName);
|
||||
if (!guidLow)
|
||||
return;
|
||||
// xinef: Get Data From global storage
|
||||
uint32 guidLow = sWorld->GetGlobalPlayerGUID(friendName);
|
||||
if (!guidLow)
|
||||
return;
|
||||
|
||||
GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(guidLow);
|
||||
if (!playerData)
|
||||
return;
|
||||
GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(guidLow);
|
||||
if (!playerData)
|
||||
return;
|
||||
|
||||
uint64 friendGuid = MAKE_NEW_GUID(guidLow, 0, HIGHGUID_PLAYER);
|
||||
uint32 friendAccountId = playerData->accountId;
|
||||
uint32 friendAccountId = playerData->accountId;
|
||||
TeamId teamId = Player::TeamIdForRace(playerData->race);
|
||||
FriendsResult friendResult = FRIEND_NOT_FOUND;
|
||||
|
||||
@@ -544,7 +544,7 @@ void WorldSession::HandleAddFriendOpcode(WorldPacket & recv_data)
|
||||
{
|
||||
if (friendGuid == GetPlayer()->GetGUID())
|
||||
friendResult = FRIEND_SELF;
|
||||
else if (GetPlayer()->GetTeamId() != teamId && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND) && AccountMgr::IsPlayerAccount(GetSecurity()))
|
||||
else if (GetPlayer()->GetTeamId() != teamId && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND) && AccountMgr::IsPlayerAccount(GetSecurity()))
|
||||
friendResult = FRIEND_ENEMY;
|
||||
else if (GetPlayer()->GetSocial()->HasFriend(guidLow))
|
||||
friendResult = FRIEND_ALREADY;
|
||||
@@ -599,9 +599,9 @@ void WorldSession::HandleAddIgnoreOpcode(WorldPacket & recv_data)
|
||||
;//sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: %s asked to Ignore: '%s'",
|
||||
// GetPlayer()->GetName().c_str(), ignoreName.c_str());
|
||||
|
||||
uint32 lowGuid = sWorld->GetGlobalPlayerGUID(ignoreName);
|
||||
uint32 lowGuid = sWorld->GetGlobalPlayerGUID(ignoreName);
|
||||
if (!lowGuid)
|
||||
return;
|
||||
return;
|
||||
|
||||
uint64 IgnoreGuid = MAKE_NEW_GUID(lowGuid, 0, HIGHGUID_PLAYER);
|
||||
FriendsResult ignoreResult = FRIEND_IGNORE_NOT_FOUND;
|
||||
@@ -640,26 +640,26 @@ void WorldSession::HandleCharacterAuraFrozen(PreparedQueryResult result)
|
||||
if (!GetPlayer())
|
||||
return;
|
||||
|
||||
ChatHandler handler = ChatHandler(this);
|
||||
ChatHandler handler = ChatHandler(this);
|
||||
|
||||
// Select
|
||||
if (!result)
|
||||
{
|
||||
handler.SendSysMessage(LANG_COMMAND_NO_FROZEN_PLAYERS);
|
||||
return;
|
||||
}
|
||||
// Select
|
||||
if (!result)
|
||||
{
|
||||
handler.SendSysMessage(LANG_COMMAND_NO_FROZEN_PLAYERS);
|
||||
return;
|
||||
}
|
||||
|
||||
// Header of the names
|
||||
handler.PSendSysMessage(LANG_COMMAND_LIST_FREEZE);
|
||||
// Header of the names
|
||||
handler.PSendSysMessage(LANG_COMMAND_LIST_FREEZE);
|
||||
|
||||
// Output of the results
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
std::string player = fields[0].GetString();
|
||||
handler.PSendSysMessage(LANG_COMMAND_FROZEN_PLAYERS, player.c_str());
|
||||
}
|
||||
while (result->NextRow());
|
||||
// Output of the results
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
std::string player = fields[0].GetString();
|
||||
handler.PSendSysMessage(LANG_COMMAND_FROZEN_PLAYERS, player.c_str());
|
||||
}
|
||||
while (result->NextRow());
|
||||
}
|
||||
|
||||
void WorldSession::HandleDelIgnoreOpcode(WorldPacket & recv_data)
|
||||
@@ -757,8 +757,8 @@ void WorldSession::HandleResurrectResponseOpcode(WorldPacket & recv_data)
|
||||
recv_data >> guid;
|
||||
recv_data >> status;
|
||||
|
||||
// Xinef: Prevent resurrect with prevent resurrection aura
|
||||
if (GetPlayer()->IsAlive() || GetPlayer()->HasAuraType(SPELL_AURA_PREVENT_RESURRECTION))
|
||||
// Xinef: Prevent resurrect with prevent resurrection aura
|
||||
if (GetPlayer()->IsAlive() || GetPlayer()->HasAuraType(SPELL_AURA_PREVENT_RESURRECTION))
|
||||
return;
|
||||
|
||||
if (status == 0)
|
||||
@@ -1379,7 +1379,7 @@ void WorldSession::HandleResetInstancesOpcode(WorldPacket & /*recv_data*/)
|
||||
group->ResetInstances(INSTANCE_RESET_ALL, false, _player);
|
||||
}
|
||||
else
|
||||
Player::ResetInstances(_player->GetGUIDLow(), INSTANCE_RESET_ALL, false);
|
||||
Player::ResetInstances(_player->GetGUIDLow(), INSTANCE_RESET_ALL, false);
|
||||
}
|
||||
|
||||
void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket & recv_data)
|
||||
@@ -1406,17 +1406,17 @@ void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket & recv_data)
|
||||
if (!groupGuy)
|
||||
continue;
|
||||
|
||||
if (!groupGuy->IsInWorld())
|
||||
{
|
||||
_player->SendDungeonDifficulty(group != NULL);
|
||||
if (!groupGuy->IsInWorld())
|
||||
{
|
||||
_player->SendDungeonDifficulty(group != NULL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (groupGuy->GetGUID() == _player->GetGUID() ? groupGuy->GetMap()->IsDungeon() : groupGuy->GetMap()->IsNonRaidDungeon())
|
||||
{
|
||||
_player->SendDungeonDifficulty(group != NULL);
|
||||
if (groupGuy->GetGUID() == _player->GetGUID() ? groupGuy->GetMap()->IsDungeon() : groupGuy->GetMap()->IsNonRaidDungeon())
|
||||
{
|
||||
_player->SendDungeonDifficulty(group != NULL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
group->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, false, _player);
|
||||
@@ -1425,11 +1425,11 @@ void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket & recv_data)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_player->FindMap() && _player->FindMap()->IsDungeon())
|
||||
{
|
||||
_player->SendDungeonDifficulty(group != NULL);
|
||||
return;
|
||||
}
|
||||
if (_player->FindMap() && _player->FindMap()->IsDungeon())
|
||||
{
|
||||
_player->SendDungeonDifficulty(group != NULL);
|
||||
return;
|
||||
}
|
||||
Player::ResetInstances(_player->GetGUIDLow(), INSTANCE_RESET_CHANGE_DIFFICULTY, false);
|
||||
_player->SetDungeonDifficulty(Difficulty(mode));
|
||||
}
|
||||
@@ -1453,26 +1453,26 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket & recv_data)
|
||||
{
|
||||
if (group->IsLeader(_player->GetGUID()))
|
||||
{
|
||||
std::set<uint32> foundMaps;
|
||||
std::set<Map*> foundMapsPtr;
|
||||
Map* currMap = NULL;
|
||||
std::set<uint32> foundMaps;
|
||||
std::set<Map*> foundMapsPtr;
|
||||
Map* currMap = NULL;
|
||||
|
||||
if (uint32 preventionTime = group->GetDifficultyChangePreventionTime())
|
||||
{
|
||||
switch (group->GetDifficultyChangePreventionReason())
|
||||
{
|
||||
case DIFFICULTY_PREVENTION_CHANGE_BOSS_KILLED:
|
||||
ChatHandler(this).PSendSysMessage("Raid was in combat recently and may not change difficulty again for %u sec.", preventionTime);
|
||||
break;
|
||||
case DIFFICULTY_PREVENTION_CHANGE_RECENTLY_CHANGED:
|
||||
default:
|
||||
ChatHandler(this).PSendSysMessage("Raid difficulty has changed recently, and may not change again for %u sec.", preventionTime);
|
||||
break;
|
||||
}
|
||||
if (uint32 preventionTime = group->GetDifficultyChangePreventionTime())
|
||||
{
|
||||
switch (group->GetDifficultyChangePreventionReason())
|
||||
{
|
||||
case DIFFICULTY_PREVENTION_CHANGE_BOSS_KILLED:
|
||||
ChatHandler(this).PSendSysMessage("Raid was in combat recently and may not change difficulty again for %u sec.", preventionTime);
|
||||
break;
|
||||
case DIFFICULTY_PREVENTION_CHANGE_RECENTLY_CHANGED:
|
||||
default:
|
||||
ChatHandler(this).PSendSysMessage("Raid difficulty has changed recently, and may not change again for %u sec.", preventionTime);
|
||||
break;
|
||||
}
|
||||
|
||||
_player->SendRaidDifficulty(group != NULL);
|
||||
return;
|
||||
}
|
||||
_player->SendRaidDifficulty(group != NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
{
|
||||
@@ -1480,113 +1480,113 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket & recv_data)
|
||||
if (!groupGuy)
|
||||
continue;
|
||||
|
||||
if (!groupGuy->IsInWorld())
|
||||
{
|
||||
_player->SendRaidDifficulty(group != NULL);
|
||||
if (!groupGuy->IsInWorld())
|
||||
{
|
||||
_player->SendRaidDifficulty(group != NULL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ((groupGuy->GetMap()->GetId() == 631 || groupGuy->GetMap()->GetId() == 724) && mode%2 == _player->GetRaidDifficulty()%2 && group->isRaidGroup())
|
||||
{
|
||||
if (!currMap)
|
||||
currMap = groupGuy->GetMap();
|
||||
foundMaps.insert(groupGuy->GetMap()->GetId());
|
||||
foundMapsPtr.insert(groupGuy->GetMap());
|
||||
if (foundMaps.size() > 1 || foundMapsPtr.size() > 1)
|
||||
{
|
||||
_player->SendRaidDifficulty(group != NULL);
|
||||
return;
|
||||
}
|
||||
if ((groupGuy->GetMap()->GetId() == 631 || groupGuy->GetMap()->GetId() == 724) && mode%2 == _player->GetRaidDifficulty()%2 && group->isRaidGroup())
|
||||
{
|
||||
if (!currMap)
|
||||
currMap = groupGuy->GetMap();
|
||||
foundMaps.insert(groupGuy->GetMap()->GetId());
|
||||
foundMapsPtr.insert(groupGuy->GetMap());
|
||||
if (foundMaps.size() > 1 || foundMapsPtr.size() > 1)
|
||||
{
|
||||
_player->SendRaidDifficulty(group != NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!groupGuy->IsAlive() || groupGuy->IsInCombat() || groupGuy->GetVictim() || groupGuy->m_mover != groupGuy || groupGuy->IsNonMeleeSpellCast(true) || !groupGuy->GetMotionMaster()->empty() && groupGuy->GetMotionMaster()->GetCurrentMovementGeneratorType() != IDLE_MOTION_TYPE || !groupGuy->movespline->Finalized() || !groupGuy->GetMap()->ToInstanceMap() || !groupGuy->GetMap()->ToInstanceMap()->GetInstanceScript() || groupGuy->GetMap()->ToInstanceMap()->GetInstanceScript()->IsEncounterInProgress() || !groupGuy->Satisfy(sObjectMgr->GetAccessRequirement(groupGuy->GetMap()->GetId(), Difficulty(mode)), groupGuy->GetMap()->GetId(), false))
|
||||
{
|
||||
_player->SendRaidDifficulty(group != NULL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (groupGuy->GetGUID() == _player->GetGUID() ? groupGuy->GetMap()->IsDungeon() : groupGuy->GetMap()->IsRaid())
|
||||
{
|
||||
_player->SendRaidDifficulty(group != NULL);
|
||||
if (!groupGuy->IsAlive() || groupGuy->IsInCombat() || groupGuy->GetVictim() || groupGuy->m_mover != groupGuy || groupGuy->IsNonMeleeSpellCast(true) || !groupGuy->GetMotionMaster()->empty() && groupGuy->GetMotionMaster()->GetCurrentMovementGeneratorType() != IDLE_MOTION_TYPE || !groupGuy->movespline->Finalized() || !groupGuy->GetMap()->ToInstanceMap() || !groupGuy->GetMap()->ToInstanceMap()->GetInstanceScript() || groupGuy->GetMap()->ToInstanceMap()->GetInstanceScript()->IsEncounterInProgress() || !groupGuy->Satisfy(sObjectMgr->GetAccessRequirement(groupGuy->GetMap()->GetId(), Difficulty(mode)), groupGuy->GetMap()->GetId(), false))
|
||||
{
|
||||
_player->SendRaidDifficulty(group != NULL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (groupGuy->GetGUID() == _player->GetGUID() ? groupGuy->GetMap()->IsDungeon() : groupGuy->GetMap()->IsRaid())
|
||||
{
|
||||
_player->SendRaidDifficulty(group != NULL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Map* homeMap571 = sMapMgr->CreateMap(571, NULL);
|
||||
Map* homeMap0 = sMapMgr->CreateMap(0, NULL);
|
||||
ASSERT(homeMap0 && homeMap571);
|
||||
Map* homeMap571 = sMapMgr->CreateMap(571, NULL);
|
||||
Map* homeMap0 = sMapMgr->CreateMap(0, NULL);
|
||||
ASSERT(homeMap0 && homeMap571);
|
||||
|
||||
std::map<Player*, Position> playerTeleport;
|
||||
// handle here all players in the instance that are not in the group
|
||||
if (currMap)
|
||||
for (Map::PlayerList::const_iterator itr = currMap->GetPlayers().begin(); itr != currMap->GetPlayers().end(); ++itr)
|
||||
if (Player* p = itr->GetSource())
|
||||
if (p->GetGroup() != group)
|
||||
{
|
||||
if (!p->IsInWorld() || !p->IsAlive() || p->IsInCombat() || p->GetVictim() || p->m_mover != p || p->IsNonMeleeSpellCast(true) || !p->GetMotionMaster()->empty() && p->GetMotionMaster()->GetCurrentMovementGeneratorType() != IDLE_MOTION_TYPE || !p->movespline->Finalized() || !p->GetMap()->ToInstanceMap() || !p->GetMap()->ToInstanceMap()->GetInstanceScript() || p->GetMap()->ToInstanceMap()->GetInstanceScript()->IsEncounterInProgress())
|
||||
{
|
||||
_player->SendRaidDifficulty(group != NULL);
|
||||
return;
|
||||
}
|
||||
playerTeleport[p];
|
||||
}
|
||||
for (std::map<Player*, Position>::iterator itr = playerTeleport.begin(); itr != playerTeleport.end(); ++itr)
|
||||
{
|
||||
Player* p = itr->first;
|
||||
Map* oldMap = p->GetMap();
|
||||
oldMap->RemovePlayerFromMap(p, false);
|
||||
p->ResetMap();
|
||||
oldMap->AfterPlayerUnlinkFromMap();
|
||||
p->SetMap(homeMap0);
|
||||
p->Relocate(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
if (!p->TeleportTo(571, 5790.20f, 2071.36f, 636.07f, 3.60f))
|
||||
p->GetSession()->KickPlayer();
|
||||
}
|
||||
std::map<Player*, Position> playerTeleport;
|
||||
// handle here all players in the instance that are not in the group
|
||||
if (currMap)
|
||||
for (Map::PlayerList::const_iterator itr = currMap->GetPlayers().begin(); itr != currMap->GetPlayers().end(); ++itr)
|
||||
if (Player* p = itr->GetSource())
|
||||
if (p->GetGroup() != group)
|
||||
{
|
||||
if (!p->IsInWorld() || !p->IsAlive() || p->IsInCombat() || p->GetVictim() || p->m_mover != p || p->IsNonMeleeSpellCast(true) || !p->GetMotionMaster()->empty() && p->GetMotionMaster()->GetCurrentMovementGeneratorType() != IDLE_MOTION_TYPE || !p->movespline->Finalized() || !p->GetMap()->ToInstanceMap() || !p->GetMap()->ToInstanceMap()->GetInstanceScript() || p->GetMap()->ToInstanceMap()->GetInstanceScript()->IsEncounterInProgress())
|
||||
{
|
||||
_player->SendRaidDifficulty(group != NULL);
|
||||
return;
|
||||
}
|
||||
playerTeleport[p];
|
||||
}
|
||||
for (std::map<Player*, Position>::iterator itr = playerTeleport.begin(); itr != playerTeleport.end(); ++itr)
|
||||
{
|
||||
Player* p = itr->first;
|
||||
Map* oldMap = p->GetMap();
|
||||
oldMap->RemovePlayerFromMap(p, false);
|
||||
p->ResetMap();
|
||||
oldMap->AfterPlayerUnlinkFromMap();
|
||||
p->SetMap(homeMap0);
|
||||
p->Relocate(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
if (!p->TeleportTo(571, 5790.20f, 2071.36f, 636.07f, 3.60f))
|
||||
p->GetSession()->KickPlayer();
|
||||
}
|
||||
|
||||
bool anyoneInside = false;
|
||||
playerTeleport.clear();
|
||||
for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
{
|
||||
Player* groupGuy = itr->GetSource();
|
||||
if (!groupGuy)
|
||||
continue;
|
||||
bool anyoneInside = false;
|
||||
playerTeleport.clear();
|
||||
for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
{
|
||||
Player* groupGuy = itr->GetSource();
|
||||
if (!groupGuy)
|
||||
continue;
|
||||
|
||||
if (groupGuy->GetMap()->GetId() == 631 || groupGuy->GetMap()->GetId() == 724)
|
||||
{
|
||||
anyoneInside = true;
|
||||
if (groupGuy->GetMap()->GetId() == 631 || groupGuy->GetMap()->GetId() == 724)
|
||||
{
|
||||
anyoneInside = true;
|
||||
|
||||
float x,y,z,o;
|
||||
groupGuy->GetPosition(x,y,z,o);
|
||||
Map* oldMap = groupGuy->GetMap();
|
||||
oldMap->RemovePlayerFromMap(groupGuy, false);
|
||||
groupGuy->ResetMap();
|
||||
oldMap->AfterPlayerUnlinkFromMap();
|
||||
groupGuy->SetMap(homeMap571);
|
||||
groupGuy->Relocate(5790.20f, 2071.36f, 636.07f, 3.60f);
|
||||
Position dest = {x, y, z+0.1f, o};
|
||||
playerTeleport[groupGuy] = dest;
|
||||
}
|
||||
}
|
||||
float x,y,z,o;
|
||||
groupGuy->GetPosition(x,y,z,o);
|
||||
Map* oldMap = groupGuy->GetMap();
|
||||
oldMap->RemovePlayerFromMap(groupGuy, false);
|
||||
groupGuy->ResetMap();
|
||||
oldMap->AfterPlayerUnlinkFromMap();
|
||||
groupGuy->SetMap(homeMap571);
|
||||
groupGuy->Relocate(5790.20f, 2071.36f, 636.07f, 3.60f);
|
||||
Position dest = {x, y, z+0.1f, o};
|
||||
playerTeleport[groupGuy] = dest;
|
||||
}
|
||||
}
|
||||
|
||||
if (!anyoneInside) // pussywizard: don't reset if changing ICC/RS difficulty while inside
|
||||
group->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, true, _player);
|
||||
if (!anyoneInside) // pussywizard: don't reset if changing ICC/RS difficulty while inside
|
||||
group->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, true, _player);
|
||||
group->SetRaidDifficulty(Difficulty(mode));
|
||||
group->SetDifficultyChangePrevention(DIFFICULTY_PREVENTION_CHANGE_RECENTLY_CHANGED);
|
||||
group->SetDifficultyChangePrevention(DIFFICULTY_PREVENTION_CHANGE_RECENTLY_CHANGED);
|
||||
|
||||
for (std::map<Player*, Position>::iterator itr = playerTeleport.begin(); itr != playerTeleport.end(); ++itr)
|
||||
{
|
||||
itr->first->SetRaidDifficulty(Difficulty(mode)); // needed for teleport not to fail
|
||||
if (!itr->first->TeleportTo(*(foundMaps.begin()), itr->second.GetPositionX(), itr->second.GetPositionY(), itr->second.GetPositionZ(), itr->second.GetOrientation()))
|
||||
itr->first->GetSession()->KickPlayer();
|
||||
}
|
||||
for (std::map<Player*, Position>::iterator itr = playerTeleport.begin(); itr != playerTeleport.end(); ++itr)
|
||||
{
|
||||
itr->first->SetRaidDifficulty(Difficulty(mode)); // needed for teleport not to fail
|
||||
if (!itr->first->TeleportTo(*(foundMaps.begin()), itr->second.GetPositionX(), itr->second.GetPositionY(), itr->second.GetPositionZ(), itr->second.GetOrientation()))
|
||||
itr->first->GetSession()->KickPlayer();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_player->FindMap() && _player->FindMap()->IsDungeon())
|
||||
{
|
||||
_player->SendRaidDifficulty(group != NULL);
|
||||
return;
|
||||
}
|
||||
if (_player->FindMap() && _player->FindMap()->IsDungeon())
|
||||
{
|
||||
_player->SendRaidDifficulty(group != NULL);
|
||||
return;
|
||||
}
|
||||
Player::ResetInstances(_player->GetGUIDLow(), INSTANCE_RESET_CHANGE_DIFFICULTY, true);
|
||||
_player->SetRaidDifficulty(Difficulty(mode));
|
||||
}
|
||||
@@ -1621,12 +1621,12 @@ void WorldSession::HandleMoveSetCanFlyAckOpcode(WorldPacket & recv_data)
|
||||
uint64 guid; // guid - unused
|
||||
recv_data.readPackGUID(guid);
|
||||
|
||||
// pussywizard: typical check for incomming movement packets
|
||||
if (!_player->m_mover || !_player->m_mover->IsInWorld() || _player->m_mover->IsDuringRemoveFromWorld() || guid != _player->m_mover->GetGUID())
|
||||
{
|
||||
recv_data.rfinish(); // prevent warnings spam
|
||||
return;
|
||||
}
|
||||
// pussywizard: typical check for incomming movement packets
|
||||
if (!_player->m_mover || !_player->m_mover->IsInWorld() || _player->m_mover->IsDuringRemoveFromWorld() || guid != _player->m_mover->GetGUID())
|
||||
{
|
||||
recv_data.rfinish(); // prevent warnings spam
|
||||
return;
|
||||
}
|
||||
|
||||
recv_data.read_skip<uint32>(); // unk
|
||||
|
||||
|
||||
Reference in New Issue
Block a user