mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-23 05:36:23 +00:00
importing changes from callmephil repo
a special thanks to him
This commit is contained in:
@@ -123,11 +123,11 @@ void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket & recvData)
|
||||
if (player->GetSocial()->HasIgnore(GetPlayer()->GetGUIDLow()))
|
||||
return;
|
||||
|
||||
if (player->GetTeamId() != GetPlayer()->GetTeamId())
|
||||
{
|
||||
SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", "", ERR_ARENA_TEAM_NOT_ALLIED);
|
||||
return;
|
||||
}
|
||||
if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && player->GetTeamId() != GetPlayer()->GetTeamId())
|
||||
{
|
||||
SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", "", ERR_ARENA_TEAM_NOT_ALLIED);
|
||||
return;
|
||||
}
|
||||
|
||||
if (player->GetArenaTeamId(arenaTeam->GetSlot()))
|
||||
{
|
||||
@@ -174,12 +174,12 @@ void WorldSession::HandleArenaTeamAcceptOpcode(WorldPacket & /*recvData*/)
|
||||
return;
|
||||
}
|
||||
|
||||
// Only allow members of the other faction to join the team if cross faction interaction is enabled
|
||||
if (_player->GetTeamId() != sObjectMgr->GetPlayerTeamIdByGUID(arenaTeam->GetCaptain()))
|
||||
{
|
||||
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_NOT_ALLIED);
|
||||
return;
|
||||
}
|
||||
// Only allow members of the other faction to join the team if cross faction interaction is enabled
|
||||
if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && _player->GetTeamId() != sObjectMgr->GetPlayerTeamIdByGUID(arenaTeam->GetCaptain()))
|
||||
{
|
||||
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_NOT_ALLIED);
|
||||
return;
|
||||
}
|
||||
|
||||
// Add player to team
|
||||
if (!arenaTeam->AddMember(_player->GetGUID()))
|
||||
|
||||
@@ -265,7 +265,11 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recvData)
|
||||
|
||||
AuctionEntry* AH = new AuctionEntry;
|
||||
AH->Id = sObjectMgr->GenerateAuctionID();
|
||||
AH->auctioneer = GUID_LOPART(auctioneer);
|
||||
|
||||
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION))
|
||||
AH->auctioneer = 23442;
|
||||
else
|
||||
AH->auctioneer = GUID_LOPART(auctioneer);
|
||||
|
||||
// Required stack size of auction matches to current item stack size, just move item to auctionhouse
|
||||
if (itemsCount == 1 && item->GetCount() == count[i])
|
||||
|
||||
@@ -462,7 +462,7 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recvData)
|
||||
return;
|
||||
}
|
||||
|
||||
if (_player->GetTeamId() != inviteeTeamId /*&& !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CALENDAR)*/)
|
||||
if (_player->GetTeamId() != inviteeTeamId && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CALENDAR))
|
||||
{
|
||||
sCalendarMgr->SendCalendarCommandResult(playerGuid, CALENDAR_ERROR_NOT_ALLIED);
|
||||
return;
|
||||
|
||||
@@ -468,7 +468,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte
|
||||
}
|
||||
}
|
||||
|
||||
bool allowTwoSideAccounts = !sWorld->IsPvPRealm() || true/*sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ACCOUNTS)*/ || !AccountMgr::IsPlayerAccount(GetSecurity());
|
||||
bool allowTwoSideAccounts = !sWorld->IsPvPRealm() || sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ACCOUNTS) || !AccountMgr::IsPlayerAccount(GetSecurity());
|
||||
uint32 skipCinematics = sWorld->getIntConfig(CONFIG_SKIP_CINEMATICS);
|
||||
|
||||
_charCreateCallback.FreeResult();
|
||||
@@ -492,7 +492,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte
|
||||
bool haveSameRace = false;
|
||||
uint32 heroicReqLevel = sWorld->getIntConfig(CONFIG_CHARACTER_CREATING_MIN_LEVEL_FOR_HEROIC_CHARACTER);
|
||||
bool hasHeroicReqLevel = (heroicReqLevel == 0);
|
||||
bool allowTwoSideAccounts = !sWorld->IsPvPRealm() || true/*sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ACCOUNTS)*/ || !AccountMgr::IsPlayerAccount(GetSecurity());
|
||||
bool allowTwoSideAccounts = !sWorld->IsPvPRealm() || sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ACCOUNTS) || !AccountMgr::IsPlayerAccount(GetSecurity());
|
||||
uint32 skipCinematics = sWorld->getIntConfig(CONFIG_SKIP_CINEMATICS);
|
||||
|
||||
if (result)
|
||||
@@ -2327,18 +2327,24 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
|
||||
}
|
||||
|
||||
// Reset guild
|
||||
if (uint32 guildId = playerData->guildId)
|
||||
if (Guild* guild = sGuildMgr->GetGuildById(guildId))
|
||||
guild->DeleteMember(MAKE_NEW_GUID(lowGuid, 0, HIGHGUID_PLAYER), false, false, true);
|
||||
if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD))
|
||||
{
|
||||
if (uint32 guildId = playerData->guildId)
|
||||
if (Guild* guild = sGuildMgr->GetGuildById(guildId))
|
||||
guild->DeleteMember(MAKE_NEW_GUID(lowGuid, 0, HIGHGUID_PLAYER), false, false, true);
|
||||
}
|
||||
|
||||
// Delete Friend List
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SOCIAL_BY_GUID);
|
||||
stmt->setUInt32(0, lowGuid);
|
||||
trans->Append(stmt);
|
||||
if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND))
|
||||
{
|
||||
// Delete Friend List
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SOCIAL_BY_GUID);
|
||||
stmt->setUInt32(0, lowGuid);
|
||||
trans->Append(stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SOCIAL_BY_FRIEND);
|
||||
stmt->setUInt32(0, lowGuid);
|
||||
trans->Append(stmt);
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SOCIAL_BY_FRIEND);
|
||||
stmt->setUInt32(0, lowGuid);
|
||||
trans->Append(stmt);
|
||||
}
|
||||
|
||||
// Leave Arena Teams
|
||||
Player::LeaveAllArenaTeams(guid);
|
||||
|
||||
@@ -165,25 +165,38 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recvData)
|
||||
lang = LANG_UNIVERSAL;
|
||||
else
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case CHAT_MSG_PARTY:
|
||||
case CHAT_MSG_PARTY_LEADER:
|
||||
case CHAT_MSG_RAID:
|
||||
case CHAT_MSG_RAID_LEADER:
|
||||
case CHAT_MSG_RAID_WARNING:
|
||||
specialMessageLimit = 35;
|
||||
break;
|
||||
case CHAT_MSG_GUILD:
|
||||
case CHAT_MSG_OFFICER:
|
||||
specialMessageLimit = 15;
|
||||
break;
|
||||
case CHAT_MSG_WHISPER:
|
||||
if (sender->getLevel() >= 80)
|
||||
specialMessageLimit = 15;
|
||||
break;
|
||||
}
|
||||
// send in universal language in two side iteration allowed mode
|
||||
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT))
|
||||
lang = LANG_UNIVERSAL;
|
||||
else
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case CHAT_MSG_PARTY:
|
||||
case CHAT_MSG_PARTY_LEADER:
|
||||
case CHAT_MSG_RAID:
|
||||
case CHAT_MSG_RAID_LEADER:
|
||||
case CHAT_MSG_RAID_WARNING:
|
||||
// allow two side chat at group channel if two side group allowed
|
||||
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP))
|
||||
lang = LANG_UNIVERSAL;
|
||||
|
||||
specialMessageLimit = 35;
|
||||
break;
|
||||
case CHAT_MSG_GUILD:
|
||||
case CHAT_MSG_OFFICER:
|
||||
// allow two side chat at guild channel if two side guild allowed
|
||||
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD))
|
||||
lang = LANG_UNIVERSAL;
|
||||
|
||||
specialMessageLimit = 15;
|
||||
break;
|
||||
case CHAT_MSG_WHISPER:
|
||||
if (sender->getLevel() >= 80)
|
||||
specialMessageLimit = 15;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// but overwrite it by SPELL_AURA_MOD_LANGUAGE auras (only single case used)
|
||||
Unit::AuraEffectList const& ModLangAuras = sender->GetAuraEffectsByType(SPELL_AURA_MOD_LANGUAGE);
|
||||
if (!ModLangAuras.empty())
|
||||
@@ -335,7 +348,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recvData)
|
||||
return;
|
||||
}
|
||||
|
||||
if (senderIsPlayer && receiverIsPlayer)
|
||||
if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT) && senderIsPlayer && receiverIsPlayer)
|
||||
if (GetPlayer()->GetTeamId() != receiver->GetTeamId())
|
||||
{
|
||||
SendWrongFactionNotice();
|
||||
|
||||
@@ -97,7 +97,7 @@ void WorldSession::HandleGroupInviteOpcode(WorldPacket& recvData)
|
||||
}
|
||||
|
||||
// can't group with
|
||||
if (!GetPlayer()->IsGameMaster() && GetPlayer()->GetTeamId() != player->GetTeamId())
|
||||
if (!GetPlayer()->IsGameMaster() && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP) && GetPlayer()->GetTeamId() != player->GetTeamId())
|
||||
{
|
||||
SendPartyResult(PARTY_OP_INVITE, membername, ERR_PLAYER_WRONG_FACTION);
|
||||
return;
|
||||
|
||||
@@ -724,7 +724,7 @@ void WorldSession::HandleListInventoryOpcode(WorldPacket & recvData)
|
||||
SendListInventory(guid);
|
||||
}
|
||||
|
||||
void WorldSession::SendListInventory(uint64 vendorGuid)
|
||||
void WorldSession::SendListInventory(uint64 vendorGuid, uint32 vendorEntry)
|
||||
{
|
||||
;//sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_LIST_INVENTORY");
|
||||
|
||||
@@ -744,7 +744,9 @@ void WorldSession::SendListInventory(uint64 vendorGuid)
|
||||
if (vendor->HasUnitState(UNIT_STATE_MOVING))
|
||||
vendor->StopMoving();
|
||||
|
||||
VendorItemData const* items = vendor->GetVendorItems();
|
||||
SetCurrentVendor(vendorEntry);
|
||||
|
||||
VendorItemData const* items = vendorEntry ? sObjectMgr->GetNpcVendorItemList(vendorEntry) : vendor->GetVendorItems();
|
||||
if (!items)
|
||||
{
|
||||
WorldPacket data(SMSG_LIST_INVENTORY, 8 + 1 + 1);
|
||||
|
||||
@@ -189,7 +189,7 @@ void WorldSession::HandleSendMail(WorldPacket & recvData)
|
||||
? receive->GetSession()->GetAccountId()
|
||||
: sObjectMgr->GetPlayerAccountIdByGUID(rc);
|
||||
|
||||
if (/*!accountBound*/ GetAccountId() != rc_account && player->GetTeamId() != rc_teamId && AccountMgr::IsPlayerAccount(GetSecurity()))
|
||||
if (/*!accountBound*/ GetAccountId() != rc_account && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_MAIL) && player->GetTeamId() != rc_teamId && AccountMgr::IsPlayerAccount(GetSecurity()))
|
||||
{
|
||||
player->SendMailResult(0, MAIL_SEND, MAIL_ERR_NOT_YOUR_TEAM);
|
||||
return;
|
||||
|
||||
@@ -170,193 +170,205 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket & recv_data)
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleWhoOpcode(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;
|
||||
|
||||
recv_data >> level_min; // maximal player level, default 0
|
||||
recv_data >> level_max; // minimal player level, default 100 (MAX_LEVEL)
|
||||
recv_data >> 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...
|
||||
|
||||
recv_data >> guild_name; // guild name, case sensitive...
|
||||
recvData >> guild_name; // guild name, case sensitive...
|
||||
|
||||
recv_data >> racemask; // race mask
|
||||
recv_data >> classmask; // class mask
|
||||
recv_data >> 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;
|
||||
recv_data >> 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]);
|
||||
}
|
||||
|
||||
recv_data >> 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;
|
||||
recv_data >> 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;
|
||||
|
||||
wstrToLower(str[i]);
|
||||
|
||||
;//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);
|
||||
|
||||
// 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;
|
||||
|
||||
TeamId teamId = _player->GetTeamId();
|
||||
uint32 security = GetSecurity();
|
||||
uint32 gmLevelInWhoList = sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_WHO_LIST);
|
||||
uint32 displaycount = 0;
|
||||
|
||||
WorldPacket data(SMSG_WHO, 500); // guess size
|
||||
data << uint32(matchcount); // placeholder, count of players matching criteria
|
||||
data << uint32(displaycount); // placeholder, count of players displayed
|
||||
|
||||
std::vector<WhoListPlayerInfo> * m = WhoListCacheMgr::GetWhoList();
|
||||
for (std::vector<WhoListPlayerInfo>::const_iterator itr = m->begin(); itr != m->end(); ++itr)
|
||||
{
|
||||
if (AccountMgr::IsPlayerAccount(security))
|
||||
{
|
||||
if ((*itr).teamId != teamId)
|
||||
continue;
|
||||
|
||||
// player can see MODERATOR, GAME MASTER, ADMINISTRATOR only if CONFIG_GM_IN_WHO_LIST
|
||||
//if ((*itr).security > AccountTypes(gmLevelInWhoList))
|
||||
// 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's level is in level range
|
||||
uint8 lvl = (*itr).level;
|
||||
if (lvl < level_min || lvl > level_max)
|
||||
continue;
|
||||
|
||||
// check if class matches classmask
|
||||
uint32 class_ = (*itr).clas;
|
||||
if (!(classmask & (1 << class_)))
|
||||
continue;
|
||||
|
||||
// check if race matches racemask
|
||||
uint32 race = (*itr).race;
|
||||
if (!(racemask & (1 << race)))
|
||||
continue;
|
||||
|
||||
uint32 pzoneid = (*itr).zoneid;
|
||||
uint8 gender = (*itr).gender;
|
||||
|
||||
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;
|
||||
|
||||
std::wstring wpname = (*itr).wpname;
|
||||
|
||||
if (!(wplayer_name.empty() || wpname.find(wplayer_name) != std::wstring::npos))
|
||||
continue;
|
||||
|
||||
std::wstring wgname = (*itr).wgname;
|
||||
|
||||
if (!(wguild_name.empty() || wgname.find(wguild_name) != std::wstring::npos))
|
||||
continue;
|
||||
|
||||
std::string aname = (*itr).aname;
|
||||
|
||||
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;
|
||||
|
||||
// 50 is maximum player count sent to client
|
||||
if (matchcount >= 50)
|
||||
{
|
||||
++matchcount;
|
||||
if (!Utf8toWStr(temp, str[i]))
|
||||
continue;
|
||||
|
||||
wstrToLower(str[i]);
|
||||
|
||||
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);
|
||||
|
||||
// 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;
|
||||
|
||||
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;
|
||||
|
||||
// player can see MODERATOR, GAME MASTER, ADMINISTRATOR only if CONFIG_GM_IN_WHO_LIST
|
||||
if ((itr->second->GetSession()->GetSecurity() > AccountTypes(gmLevelInWhoList)))
|
||||
continue;
|
||||
}
|
||||
|
||||
data << (*itr).pname; // player name
|
||||
data << (*itr).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
|
||||
//do not process players which are not in world
|
||||
if (!(itr->second->IsInWorld()))
|
||||
continue;
|
||||
|
||||
++matchcount;
|
||||
++displaycount;
|
||||
}
|
||||
// check if target is globally visible for player
|
||||
if (!(itr->second->IsVisibleGloballyFor(_player)))
|
||||
continue;
|
||||
|
||||
data.put(0, displaycount); // insert right count, count displayed
|
||||
data.put(4, matchcount); // insert right count, count of matches
|
||||
// check if target's level is in level range
|
||||
uint8 lvl = itr->second->getLevel();
|
||||
if (lvl < level_min || lvl > level_max)
|
||||
continue;
|
||||
|
||||
SendPacket(&data);
|
||||
;//sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Send SMSG_WHO Message");
|
||||
// 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;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
z_show = false;
|
||||
}
|
||||
if (!z_show)
|
||||
continue;
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
// 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
|
||||
|
||||
++displaycount;
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
|
||||
void WorldSession::HandleLogoutRequestOpcode(WorldPacket & /*recv_data*/)
|
||||
{
|
||||
;//sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_LOGOUT_REQUEST Message, security - %u", GetSecurity());
|
||||
@@ -532,7 +544,7 @@ void WorldSession::HandleAddFriendOpcode(WorldPacket & recv_data)
|
||||
{
|
||||
if (friendGuid == GetPlayer()->GetGUID())
|
||||
friendResult = FRIEND_SELF;
|
||||
else if (GetPlayer()->GetTeamId() != teamId && 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;
|
||||
|
||||
@@ -435,7 +435,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recvData)
|
||||
return;
|
||||
|
||||
// not let enemies sign guild charter
|
||||
if (GetPlayer()->GetTeamId() != sObjectMgr->GetPlayerTeamIdByGUID(ownerGuid))
|
||||
if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && GetPlayer()->GetTeamId() != sObjectMgr->GetPlayerTeamIdByGUID(ownerGuid))
|
||||
{
|
||||
if (type != GUILD_CHARTER_TYPE)
|
||||
SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", "", ERR_ARENA_TEAM_NOT_ALLIED);
|
||||
|
||||
@@ -618,11 +618,11 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket)
|
||||
return;
|
||||
}
|
||||
|
||||
if (pOther->GetTeamId() !=_player->GetTeamId())
|
||||
{
|
||||
SendTradeStatus(TRADE_STATUS_WRONG_FACTION);
|
||||
return;
|
||||
}
|
||||
if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_TRADE) && pOther->GetTeamId() != _player->GetTeamId())
|
||||
{
|
||||
SendTradeStatus(TRADE_STATUS_WRONG_FACTION);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!pOther->IsWithinDistInMap(_player, 10.0f, false))
|
||||
{
|
||||
|
||||
@@ -222,7 +222,7 @@ void WorldSession::HandleEjectPassenger(WorldPacket &data)
|
||||
sLog->outError("Player %u attempted to eject creature GUID %u from non-ejectable seat.", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
|
||||
}
|
||||
else
|
||||
sLog->outError("HandleEjectPassenger: Player %u tried to eject invalid GUID " UI64FMTD, GetPlayer()->GetGUIDLow(), guid);
|
||||
sLog->outError("HandleEjectPassenger: Player %u tried to eject invalid GUID "UI64FMTD, GetPlayer()->GetGUIDLow(), guid);
|
||||
}
|
||||
|
||||
void WorldSession::HandleRequestVehicleExit(WorldPacket& /*recvData*/)
|
||||
|
||||
Reference in New Issue
Block a user