mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 10:37:02 +00:00
Various Cleanups (game C-E)
This commit is contained in:
parent
f80629e307
commit
c5c09cee3c
40 changed files with 1826 additions and 1818 deletions
|
|
@ -41,14 +41,14 @@ bool WorldSession::processChatmessageFurtherAfterSecurityChecks(std::string& msg
|
|||
if (lang != LANG_ADDON)
|
||||
{
|
||||
// strip invisible characters for non-addon messages
|
||||
if(sWorld.getConfig(CONFIG_BOOL_CHAT_FAKE_MESSAGE_PREVENTING))
|
||||
if (sWorld.getConfig(CONFIG_BOOL_CHAT_FAKE_MESSAGE_PREVENTING))
|
||||
stripLineInvisibleChars(msg);
|
||||
|
||||
if (sWorld.getConfig(CONFIG_UINT32_CHAT_STRICT_LINK_CHECKING_SEVERITY) && GetSecurity() < SEC_MODERATOR
|
||||
&& !ChatHandler(this).isValidChatMessage(msg.c_str()))
|
||||
{
|
||||
sLog.outError("Player %s (GUID: %u) sent a chatmessage with an invalid link: %s", GetPlayer()->GetName(),
|
||||
GetPlayer()->GetGUIDLow(), msg.c_str());
|
||||
GetPlayer()->GetGUIDLow(), msg.c_str());
|
||||
if (sWorld.getConfig(CONFIG_UINT32_CHAT_STRICT_LINK_CHECKING_KICK))
|
||||
KickPlayer();
|
||||
return false;
|
||||
|
|
@ -58,7 +58,7 @@ bool WorldSession::processChatmessageFurtherAfterSecurityChecks(std::string& msg
|
|||
return true;
|
||||
}
|
||||
|
||||
void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
||||
void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
uint32 type;
|
||||
uint32 lang;
|
||||
|
|
@ -66,45 +66,45 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
|||
recv_data >> type;
|
||||
recv_data >> lang;
|
||||
|
||||
if(type >= MAX_CHAT_MSG_TYPE)
|
||||
if (type >= MAX_CHAT_MSG_TYPE)
|
||||
{
|
||||
sLog.outError("CHAT: Wrong message type received: %u", type);
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG_LOG("CHAT: packet received. type %u, lang %u", type, lang );
|
||||
DEBUG_LOG("CHAT: packet received. type %u, lang %u", type, lang);
|
||||
|
||||
// prevent talking at unknown language (cheating)
|
||||
LanguageDesc const* langDesc = GetLanguageDescByID(lang);
|
||||
if(!langDesc)
|
||||
if (!langDesc)
|
||||
{
|
||||
SendNotification(LANG_UNKNOWN_LANGUAGE);
|
||||
return;
|
||||
}
|
||||
if(langDesc->skill_id != 0 && !_player->HasSkill(langDesc->skill_id))
|
||||
if (langDesc->skill_id != 0 && !_player->HasSkill(langDesc->skill_id))
|
||||
{
|
||||
// also check SPELL_AURA_COMPREHEND_LANGUAGE (client offers option to speak in that language)
|
||||
Unit::AuraList const& langAuras = _player->GetAurasByType(SPELL_AURA_COMPREHEND_LANGUAGE);
|
||||
bool foundAura = false;
|
||||
for(Unit::AuraList::const_iterator i = langAuras.begin(); i != langAuras.end(); ++i)
|
||||
for (Unit::AuraList::const_iterator i = langAuras.begin(); i != langAuras.end(); ++i)
|
||||
{
|
||||
if((*i)->GetModifier()->m_miscvalue == int32(lang))
|
||||
if ((*i)->GetModifier()->m_miscvalue == int32(lang))
|
||||
{
|
||||
foundAura = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!foundAura)
|
||||
if (!foundAura)
|
||||
{
|
||||
SendNotification(LANG_NOT_LEARNED_LANGUAGE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(lang == LANG_ADDON)
|
||||
if (lang == LANG_ADDON)
|
||||
{
|
||||
// Disabled addon channel?
|
||||
if(!sWorld.getConfig(CONFIG_BOOL_ADDON_CHANNEL))
|
||||
if (!sWorld.getConfig(CONFIG_BOOL_ADDON_CHANNEL))
|
||||
return;
|
||||
}
|
||||
// LANG_ADDON should not be changed nor be affected by flood control
|
||||
|
|
@ -120,20 +120,20 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
|||
lang = LANG_UNIVERSAL;
|
||||
else
|
||||
{
|
||||
switch(type)
|
||||
switch (type)
|
||||
{
|
||||
case CHAT_MSG_PARTY:
|
||||
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.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GROUP))
|
||||
if (sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GROUP))
|
||||
lang = LANG_UNIVERSAL;
|
||||
break;
|
||||
case CHAT_MSG_GUILD:
|
||||
case CHAT_MSG_OFFICER:
|
||||
// allow two side chat at guild channel if two side guild allowed
|
||||
if(sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GUILD))
|
||||
if (sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GUILD))
|
||||
lang = LANG_UNIVERSAL;
|
||||
break;
|
||||
}
|
||||
|
|
@ -141,7 +141,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
|||
|
||||
// but overwrite it by SPELL_AURA_MOD_LANGUAGE auras (only single case used)
|
||||
Unit::AuraList const& ModLangAuras = _player->GetAurasByType(SPELL_AURA_MOD_LANGUAGE);
|
||||
if(!ModLangAuras.empty())
|
||||
if (!ModLangAuras.empty())
|
||||
lang = ModLangAuras.front()->GetModifier()->m_miscvalue;
|
||||
}
|
||||
|
||||
|
|
@ -158,7 +158,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
|||
}
|
||||
}
|
||||
|
||||
switch(type)
|
||||
switch (type)
|
||||
{
|
||||
case CHAT_MSG_SAY:
|
||||
case CHAT_MSG_EMOTE:
|
||||
|
|
@ -167,7 +167,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
|||
std::string msg;
|
||||
recv_data >> msg;
|
||||
|
||||
if(msg.empty())
|
||||
if (msg.empty())
|
||||
break;
|
||||
|
||||
if (ChatHandler(this).ParseCommands(msg.c_str()))
|
||||
|
|
@ -176,14 +176,14 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
|||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||
return;
|
||||
|
||||
if(msg.empty())
|
||||
if (msg.empty())
|
||||
break;
|
||||
|
||||
if(type == CHAT_MSG_SAY)
|
||||
if (type == CHAT_MSG_SAY)
|
||||
GetPlayer()->Say(msg, lang);
|
||||
else if(type == CHAT_MSG_EMOTE)
|
||||
else if (type == CHAT_MSG_EMOTE)
|
||||
GetPlayer()->TextEmote(msg);
|
||||
else if(type == CHAT_MSG_YELL)
|
||||
else if (type == CHAT_MSG_YELL)
|
||||
GetPlayer()->Yell(msg, lang);
|
||||
} break;
|
||||
|
||||
|
|
@ -196,16 +196,16 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
|||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||
return;
|
||||
|
||||
if(msg.empty())
|
||||
if (msg.empty())
|
||||
break;
|
||||
|
||||
if(!normalizePlayerName(to))
|
||||
if (!normalizePlayerName(to))
|
||||
{
|
||||
SendPlayerNotFoundNotice(to);
|
||||
break;
|
||||
}
|
||||
|
||||
Player *player = sObjectMgr.GetPlayer(to.c_str());
|
||||
Player* player = sObjectMgr.GetPlayer(to.c_str());
|
||||
uint32 tSecurity = GetSecurity();
|
||||
uint32 pSecurity = player ? player->GetSession()->GetSecurity() : SEC_PLAYER;
|
||||
if (!player || (tSecurity == SEC_PLAYER && pSecurity > SEC_PLAYER && !player->isAcceptWhispers()))
|
||||
|
|
@ -214,7 +214,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
|||
return;
|
||||
}
|
||||
|
||||
if (!sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_CHAT) && tSecurity == SEC_PLAYER && pSecurity == SEC_PLAYER )
|
||||
if (!sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_CHAT) && tSecurity == SEC_PLAYER && pSecurity == SEC_PLAYER)
|
||||
{
|
||||
if (GetPlayer()->GetTeam() != player->GetTeam())
|
||||
{
|
||||
|
|
@ -232,7 +232,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
|||
std::string msg;
|
||||
recv_data >> msg;
|
||||
|
||||
if(msg.empty())
|
||||
if (msg.empty())
|
||||
break;
|
||||
|
||||
if (ChatHandler(this).ParseCommands(msg.c_str()))
|
||||
|
|
@ -241,15 +241,15 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
|||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||
return;
|
||||
|
||||
if(msg.empty())
|
||||
if (msg.empty())
|
||||
break;
|
||||
|
||||
// if player is in battleground, he cannot say to battleground members by /p
|
||||
Group *group = GetPlayer()->GetOriginalGroup();
|
||||
if(!group)
|
||||
Group* group = GetPlayer()->GetOriginalGroup();
|
||||
if (!group)
|
||||
{
|
||||
group = _player->GetGroup();
|
||||
if(!group || group->isBGGroup())
|
||||
if (!group || group->isBGGroup())
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -267,7 +267,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
|||
std::string msg;
|
||||
recv_data >> msg;
|
||||
|
||||
if(msg.empty())
|
||||
if (msg.empty())
|
||||
break;
|
||||
|
||||
if (ChatHandler(this).ParseCommands(msg.c_str()))
|
||||
|
|
@ -276,7 +276,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
|||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||
return;
|
||||
|
||||
if(msg.empty())
|
||||
if (msg.empty())
|
||||
break;
|
||||
|
||||
if (GetPlayer()->GetGuildId())
|
||||
|
|
@ -290,7 +290,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
|||
std::string msg;
|
||||
recv_data >> msg;
|
||||
|
||||
if(msg.empty())
|
||||
if (msg.empty())
|
||||
break;
|
||||
|
||||
if (ChatHandler(this).ParseCommands(msg.c_str()))
|
||||
|
|
@ -299,7 +299,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
|||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||
return;
|
||||
|
||||
if(msg.empty())
|
||||
if (msg.empty())
|
||||
break;
|
||||
|
||||
if (GetPlayer()->GetGuildId())
|
||||
|
|
@ -313,7 +313,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
|||
std::string msg;
|
||||
recv_data >> msg;
|
||||
|
||||
if(msg.empty())
|
||||
if (msg.empty())
|
||||
break;
|
||||
|
||||
if (ChatHandler(this).ParseCommands(msg.c_str()))
|
||||
|
|
@ -322,15 +322,15 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
|||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||
return;
|
||||
|
||||
if(msg.empty())
|
||||
if (msg.empty())
|
||||
break;
|
||||
|
||||
// if player is in battleground, he cannot say to battleground members by /ra
|
||||
Group *group = GetPlayer()->GetOriginalGroup();
|
||||
if(!group)
|
||||
Group* group = GetPlayer()->GetOriginalGroup();
|
||||
if (!group)
|
||||
{
|
||||
group = GetPlayer()->GetGroup();
|
||||
if(!group || group->isBGGroup() || !group->isRaidGroup())
|
||||
if (!group || group->isBGGroup() || !group->isRaidGroup())
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -343,7 +343,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
|||
std::string msg;
|
||||
recv_data >> msg;
|
||||
|
||||
if(msg.empty())
|
||||
if (msg.empty())
|
||||
break;
|
||||
|
||||
if (ChatHandler(this).ParseCommands(msg.c_str()))
|
||||
|
|
@ -352,11 +352,11 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
|||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||
return;
|
||||
|
||||
if(msg.empty())
|
||||
if (msg.empty())
|
||||
break;
|
||||
|
||||
// if player is in battleground, he cannot say to battleground members by /ra
|
||||
Group *group = GetPlayer()->GetOriginalGroup();
|
||||
Group* group = GetPlayer()->GetOriginalGroup();
|
||||
if (!group)
|
||||
{
|
||||
group = GetPlayer()->GetGroup();
|
||||
|
|
@ -377,12 +377,12 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
|||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||
return;
|
||||
|
||||
if(msg.empty())
|
||||
if (msg.empty())
|
||||
break;
|
||||
|
||||
Group *group = GetPlayer()->GetGroup();
|
||||
Group* group = GetPlayer()->GetGroup();
|
||||
if (!group || !group->isRaidGroup() ||
|
||||
!(group->IsLeader(GetPlayer()->GetObjectGuid()) || group->IsAssistant(GetPlayer()->GetObjectGuid())))
|
||||
!(group->IsLeader(GetPlayer()->GetObjectGuid()) || group->IsAssistant(GetPlayer()->GetObjectGuid())))
|
||||
return;
|
||||
|
||||
WorldPacket data;
|
||||
|
|
@ -399,12 +399,12 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
|||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||
return;
|
||||
|
||||
if(msg.empty())
|
||||
if (msg.empty())
|
||||
break;
|
||||
|
||||
// battleground raid is always in Player->GetGroup(), never in GetOriginalGroup()
|
||||
Group *group = GetPlayer()->GetGroup();
|
||||
if(!group || !group->isBGGroup())
|
||||
Group* group = GetPlayer()->GetGroup();
|
||||
if (!group || !group->isBGGroup())
|
||||
return;
|
||||
|
||||
WorldPacket data;
|
||||
|
|
@ -420,11 +420,11 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
|||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||
return;
|
||||
|
||||
if(msg.empty())
|
||||
if (msg.empty())
|
||||
break;
|
||||
|
||||
// battleground raid is always in Player->GetGroup(), never in GetOriginalGroup()
|
||||
Group *group = GetPlayer()->GetGroup();
|
||||
Group* group = GetPlayer()->GetGroup();
|
||||
if (!group || !group->isBGGroup() || !group->IsLeader(GetPlayer()->GetObjectGuid()))
|
||||
return;
|
||||
|
||||
|
|
@ -442,11 +442,11 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
|||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||
return;
|
||||
|
||||
if(msg.empty())
|
||||
if (msg.empty())
|
||||
break;
|
||||
|
||||
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||
if(Channel *chn = cMgr->GetChannel(channel, _player))
|
||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||
if (Channel* chn = cMgr->GetChannel(channel, _player))
|
||||
chn->Say(_player->GetObjectGuid(), msg.c_str(), lang);
|
||||
} break;
|
||||
|
||||
|
|
@ -506,9 +506,9 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
|||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleEmoteOpcode( WorldPacket & recv_data )
|
||||
void WorldSession::HandleEmoteOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
if(!GetPlayer()->isAlive() || GetPlayer()->hasUnitState(UNIT_STAT_DIED))
|
||||
if (!GetPlayer()->isAlive() || GetPlayer()->hasUnitState(UNIT_STAT_DIED))
|
||||
return;
|
||||
|
||||
uint32 emote;
|
||||
|
|
@ -548,9 +548,9 @@ namespace MaNGOS
|
|||
};
|
||||
} // namespace MaNGOS
|
||||
|
||||
void WorldSession::HandleTextEmoteOpcode( WorldPacket & recv_data )
|
||||
void WorldSession::HandleTextEmoteOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
if(!GetPlayer()->isAlive())
|
||||
if (!GetPlayer()->isAlive())
|
||||
return;
|
||||
|
||||
if (!GetPlayer()->CanSpeak())
|
||||
|
|
@ -567,13 +567,13 @@ void WorldSession::HandleTextEmoteOpcode( WorldPacket & recv_data )
|
|||
recv_data >> emoteNum;
|
||||
recv_data >> guid;
|
||||
|
||||
EmotesTextEntry const *em = sEmotesTextStore.LookupEntry(text_emote);
|
||||
EmotesTextEntry const* em = sEmotesTextStore.LookupEntry(text_emote);
|
||||
if (!em)
|
||||
return;
|
||||
|
||||
uint32 emote_id = em->textid;
|
||||
|
||||
switch(emote_id)
|
||||
switch (emote_id)
|
||||
{
|
||||
case EMOTE_STATE_SLEEP:
|
||||
case EMOTE_STATE_SIT:
|
||||
|
|
@ -605,7 +605,7 @@ void WorldSession::HandleTextEmoteOpcode( WorldPacket & recv_data )
|
|||
((Creature*)unit)->AI()->ReceiveEmote(GetPlayer(), text_emote);
|
||||
}
|
||||
|
||||
void WorldSession::HandleChatIgnoredOpcode(WorldPacket& recv_data )
|
||||
void WorldSession::HandleChatIgnoredOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
ObjectGuid iguid;
|
||||
uint8 unk;
|
||||
|
|
@ -614,8 +614,8 @@ void WorldSession::HandleChatIgnoredOpcode(WorldPacket& recv_data )
|
|||
recv_data >> iguid;
|
||||
recv_data >> unk; // probably related to spam reporting
|
||||
|
||||
Player *player = sObjectMgr.GetPlayer(iguid);
|
||||
if(!player || !player->GetSession())
|
||||
Player* player = sObjectMgr.GetPlayer(iguid);
|
||||
if (!player || !player->GetSession())
|
||||
return;
|
||||
|
||||
WorldPacket data;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue