mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-17 19:05:42 +00:00
refactor(Core/Game): restyle game lib with astyle (#3466)
This commit is contained in:
@@ -16,51 +16,51 @@
|
||||
|
||||
class CreatureTextBuilder
|
||||
{
|
||||
public:
|
||||
CreatureTextBuilder(WorldObject* obj, uint8 gender, ChatMsg msgtype, uint8 textGroup, uint32 id, uint32 language, WorldObject const* target)
|
||||
: _source(obj), _gender(gender), _msgType(msgtype), _textGroup(textGroup), _textId(id), _language(language), _target(target)
|
||||
{
|
||||
}
|
||||
public:
|
||||
CreatureTextBuilder(WorldObject* obj, uint8 gender, ChatMsg msgtype, uint8 textGroup, uint32 id, uint32 language, WorldObject const* target)
|
||||
: _source(obj), _gender(gender), _msgType(msgtype), _textGroup(textGroup), _textId(id), _language(language), _target(target)
|
||||
{
|
||||
}
|
||||
|
||||
size_t operator()(WorldPacket* data, LocaleConstant locale) const
|
||||
{
|
||||
std::string const& text = sCreatureTextMgr->GetLocalizedChatString(_source->GetEntry(), _gender, _textGroup, _textId, locale);
|
||||
size_t operator()(WorldPacket* data, LocaleConstant locale) const
|
||||
{
|
||||
std::string const& text = sCreatureTextMgr->GetLocalizedChatString(_source->GetEntry(), _gender, _textGroup, _textId, locale);
|
||||
|
||||
return ChatHandler::BuildChatPacket(*data, _msgType, Language(_language), _source, _target, text, 0, "", locale);
|
||||
}
|
||||
return ChatHandler::BuildChatPacket(*data, _msgType, Language(_language), _source, _target, text, 0, "", locale);
|
||||
}
|
||||
|
||||
WorldObject* _source;
|
||||
uint8 _gender;
|
||||
ChatMsg _msgType;
|
||||
uint8 _textGroup;
|
||||
uint32 _textId;
|
||||
uint32 _language;
|
||||
WorldObject const* _target;
|
||||
WorldObject* _source;
|
||||
uint8 _gender;
|
||||
ChatMsg _msgType;
|
||||
uint8 _textGroup;
|
||||
uint32 _textId;
|
||||
uint32 _language;
|
||||
WorldObject const* _target;
|
||||
};
|
||||
|
||||
class PlayerTextBuilder
|
||||
{
|
||||
public:
|
||||
PlayerTextBuilder(WorldObject* obj, WorldObject* speaker, uint8 gender, ChatMsg msgtype, uint8 textGroup, uint32 id, uint32 language, WorldObject const* target)
|
||||
: _source(obj), _talker(speaker), _gender(gender), _msgType(msgtype), _textGroup(textGroup), _textId(id), _language(language), _target(target)
|
||||
{
|
||||
}
|
||||
public:
|
||||
PlayerTextBuilder(WorldObject* obj, WorldObject* speaker, uint8 gender, ChatMsg msgtype, uint8 textGroup, uint32 id, uint32 language, WorldObject const* target)
|
||||
: _source(obj), _talker(speaker), _gender(gender), _msgType(msgtype), _textGroup(textGroup), _textId(id), _language(language), _target(target)
|
||||
{
|
||||
}
|
||||
|
||||
size_t operator()(WorldPacket* data, LocaleConstant locale) const
|
||||
{
|
||||
std::string const& text = sCreatureTextMgr->GetLocalizedChatString(_source->GetEntry(), _gender, _textGroup, _textId, locale);
|
||||
size_t operator()(WorldPacket* data, LocaleConstant locale) const
|
||||
{
|
||||
std::string const& text = sCreatureTextMgr->GetLocalizedChatString(_source->GetEntry(), _gender, _textGroup, _textId, locale);
|
||||
|
||||
return ChatHandler::BuildChatPacket(*data, _msgType, Language(_language), _talker, _target, text, 0, "", locale);
|
||||
}
|
||||
return ChatHandler::BuildChatPacket(*data, _msgType, Language(_language), _talker, _target, text, 0, "", locale);
|
||||
}
|
||||
|
||||
WorldObject* _source;
|
||||
WorldObject* _talker;
|
||||
uint8 _gender;
|
||||
ChatMsg _msgType;
|
||||
uint8 _textGroup;
|
||||
uint32 _textId;
|
||||
uint32 _language;
|
||||
WorldObject const* _target;
|
||||
WorldObject* _source;
|
||||
WorldObject* _talker;
|
||||
uint8 _gender;
|
||||
ChatMsg _msgType;
|
||||
uint8 _textGroup;
|
||||
uint32 _textId;
|
||||
uint32 _language;
|
||||
WorldObject const* _target;
|
||||
};
|
||||
|
||||
CreatureTextMgr* CreatureTextMgr::instance()
|
||||
@@ -108,7 +108,8 @@ void CreatureTextMgr::LoadCreatureTexts()
|
||||
|
||||
if (temp.sound)
|
||||
{
|
||||
if (!sSoundEntriesStore.LookupEntry(temp.sound)){
|
||||
if (!sSoundEntriesStore.LookupEntry(temp.sound))
|
||||
{
|
||||
sLog->outErrorDb("CreatureTextMgr: Entry %u, Group %u in table `creature_texts` has Sound %u but sound does not exist.", temp.entry, temp.group, temp.sound);
|
||||
temp.sound = 0;
|
||||
}
|
||||
@@ -336,17 +337,17 @@ void CreatureTextMgr::SendNonChatPacket(WorldObject* source, WorldPacket* data,
|
||||
{
|
||||
case CHAT_MSG_MONSTER_WHISPER:
|
||||
case CHAT_MSG_RAID_BOSS_WHISPER:
|
||||
{
|
||||
if (range == TEXT_RANGE_NORMAL)//ignores team and gmOnly
|
||||
{
|
||||
if (!whisperTarget || whisperTarget->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
if (range == TEXT_RANGE_NORMAL)//ignores team and gmOnly
|
||||
{
|
||||
if (!whisperTarget || whisperTarget->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
whisperTarget->ToPlayer()->GetSession()->SendPacket(data);
|
||||
return;
|
||||
whisperTarget->ToPlayer()->GetSession()->SendPacket(data);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -354,40 +355,40 @@ void CreatureTextMgr::SendNonChatPacket(WorldObject* source, WorldPacket* data,
|
||||
switch (range)
|
||||
{
|
||||
case TEXT_RANGE_AREA:
|
||||
{
|
||||
uint32 areaId = source->GetAreaId();
|
||||
Map::PlayerList const& players = source->GetMap()->GetPlayers();
|
||||
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
|
||||
if (itr->GetSource()->GetAreaId() == areaId && (teamId == TEAM_NEUTRAL || itr->GetSource()->GetTeamId() == teamId) && (!gmOnly || itr->GetSource()->IsGameMaster()))
|
||||
itr->GetSource()->GetSession()->SendPacket(data);
|
||||
return;
|
||||
}
|
||||
{
|
||||
uint32 areaId = source->GetAreaId();
|
||||
Map::PlayerList const& players = source->GetMap()->GetPlayers();
|
||||
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
|
||||
if (itr->GetSource()->GetAreaId() == areaId && (teamId == TEAM_NEUTRAL || itr->GetSource()->GetTeamId() == teamId) && (!gmOnly || itr->GetSource()->IsGameMaster()))
|
||||
itr->GetSource()->GetSession()->SendPacket(data);
|
||||
return;
|
||||
}
|
||||
case TEXT_RANGE_ZONE:
|
||||
{
|
||||
uint32 zoneId = source->GetZoneId();
|
||||
Map::PlayerList const& players = source->GetMap()->GetPlayers();
|
||||
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
|
||||
if (itr->GetSource()->GetZoneId() == zoneId && (teamId == TEAM_NEUTRAL || itr->GetSource()->GetTeamId() == teamId) && (!gmOnly || itr->GetSource()->IsGameMaster()))
|
||||
itr->GetSource()->GetSession()->SendPacket(data);
|
||||
return;
|
||||
}
|
||||
{
|
||||
uint32 zoneId = source->GetZoneId();
|
||||
Map::PlayerList const& players = source->GetMap()->GetPlayers();
|
||||
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
|
||||
if (itr->GetSource()->GetZoneId() == zoneId && (teamId == TEAM_NEUTRAL || itr->GetSource()->GetTeamId() == teamId) && (!gmOnly || itr->GetSource()->IsGameMaster()))
|
||||
itr->GetSource()->GetSession()->SendPacket(data);
|
||||
return;
|
||||
}
|
||||
case TEXT_RANGE_MAP:
|
||||
{
|
||||
Map::PlayerList const& players = source->GetMap()->GetPlayers();
|
||||
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
|
||||
if ((teamId == TEAM_NEUTRAL || itr->GetSource()->GetTeamId() == teamId) && (!gmOnly || itr->GetSource()->IsGameMaster()))
|
||||
itr->GetSource()->GetSession()->SendPacket(data);
|
||||
return;
|
||||
}
|
||||
{
|
||||
Map::PlayerList const& players = source->GetMap()->GetPlayers();
|
||||
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
|
||||
if ((teamId == TEAM_NEUTRAL || itr->GetSource()->GetTeamId() == teamId) && (!gmOnly || itr->GetSource()->IsGameMaster()))
|
||||
itr->GetSource()->GetSession()->SendPacket(data);
|
||||
return;
|
||||
}
|
||||
case TEXT_RANGE_WORLD:
|
||||
{
|
||||
SessionMap const& smap = sWorld->GetAllSessions();
|
||||
for (SessionMap::const_iterator itr = smap.begin(); itr != smap.end(); ++itr)
|
||||
if (Player* player = itr->second->GetPlayer())
|
||||
if ((teamId == TEAM_NEUTRAL || player->GetTeamId() == teamId) && (!gmOnly || player->IsGameMaster()))
|
||||
player->GetSession()->SendPacket(data);
|
||||
return;
|
||||
}
|
||||
{
|
||||
SessionMap const& smap = sWorld->GetAllSessions();
|
||||
for (SessionMap::const_iterator itr = smap.begin(); itr != smap.end(); ++itr)
|
||||
if (Player* player = itr->second->GetPlayer())
|
||||
if ((teamId == TEAM_NEUTRAL || player->GetTeamId() == teamId) && (!gmOnly || player->IsGameMaster()))
|
||||
player->GetSession()->SendPacket(data);
|
||||
return;
|
||||
}
|
||||
case TEXT_RANGE_NORMAL:
|
||||
default:
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user