[0049] Implement SMSG_DEFENSE_MESSAGE for the upcoming opvp system

Also fix callig go type 29 progress event if there is no neutral area (like in Halaa)
This commit is contained in:
stfx 2012-08-10 11:21:51 +02:00 committed by Antz
parent cfae212258
commit 428bb2c5e9
4 changed files with 28 additions and 5 deletions

View file

@ -1733,6 +1733,28 @@ void World::SendZoneText(uint32 zone, const char* text, WorldSession* self /*= N
SendZoneMessage(zone, &data, self, team);
}
/// Sends a server wide defense message to all players (or players of the specified team)
void World::SendDefenseMessage(uint32 zoneId, int32 textId, Team team /*= TEAM_NONE*/)
{
for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
{
if (itr->second &&
itr->second->GetPlayer() &&
itr->second->GetPlayer()->IsInWorld() &&
(team == TEAM_NONE || itr->second->GetPlayer()->GetTeam() == team))
{
char const* message = itr->second->GetMangosString(textId);
uint32 messageLength = strlen(message) + 1;
WorldPacket data(SMSG_DEFENSE_MESSAGE, 4 + 4 + messageLength);
data << uint32(zoneId);
data << uint32(messageLength);
data << message;
itr->second->SendPacket(&data);
}
}
}
/// Kick (and save) all players
void World::KickAll()
{