[12081] 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 cd1bb3f9f4
commit 56228cda26
3 changed files with 28 additions and 4 deletions

View file

@ -1740,6 +1740,28 @@ void World::SendDefenseMessage(uint32 zoneId, int32 textId)
} }
} }
/// 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 /// Kick (and save) all players
void World::KickAll() void World::KickAll()
{ {

View file

@ -507,10 +507,12 @@ class World
void LoadConfigSettings(bool reload = false); void LoadConfigSettings(bool reload = false);
void SendWorldText(int32 string_id, ...); void SendWorldText(int32 string_id, ...);
void SendGlobalMessage(WorldPacket* packet); void SendGlobalText(const char* text, WorldSession* self);
void SendGlobalMessage(WorldPacket* packet, WorldSession* self = NULL, Team team = TEAM_NONE);
void SendZoneMessage(uint32 zone, WorldPacket* packet, WorldSession* self = NULL, Team team = TEAM_NONE);
void SendZoneText(uint32 zone, const char* text, WorldSession* self = NULL, Team team = TEAM_NONE);
void SendDefenseMessage(uint32 zoneId, int32 textId, Team team = TEAM_NONE);
void SendServerMessage(ServerMessageType type, const char* text = "", Player* player = NULL); void SendServerMessage(ServerMessageType type, const char* text = "", Player* player = NULL);
void SendZoneUnderAttackMessage(uint32 zoneId, Team team);
void SendDefenseMessage(uint32 zoneId, int32 textId);
/// Are we in the middle of a shutdown? /// Are we in the middle of a shutdown?
bool IsShutdowning() const { return m_ShutdownTimer > 0; } bool IsShutdowning() const { return m_ShutdownTimer > 0; }

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "0071" #define REVISION_NR "12081"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__