[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

@ -2074,8 +2074,8 @@ void GameObject::TickCapturePoint()
} }
/* PROGRESS EVENTS */ /* PROGRESS EVENTS */
// alliance takes the tower from neutral or contested to alliance // alliance takes the tower from neutral, contested or horde (if there is no neutral area) to alliance
else if ((m_captureState == CAPTURE_STATE_NEUTRAL && m_captureSlider > CAPTURE_SLIDER_NEUTRAL + neutralPercent * 0.5f) || (m_captureState == CAPTURE_STATE_CONTEST_ALLIANCE && progressFaction == ALLIANCE)) else if (m_captureState != CAPTURE_STATE_PROGRESS_ALLIANCE && m_captureSlider > CAPTURE_SLIDER_NEUTRAL + neutralPercent * 0.5f && progressFaction == ALLIANCE)
{ {
eventId = info->capturePoint.progressEventID1; eventId = info->capturePoint.progressEventID1;
@ -2084,8 +2084,8 @@ void GameObject::TickCapturePoint()
// set capture state to alliance // set capture state to alliance
m_captureState = CAPTURE_STATE_PROGRESS_ALLIANCE; m_captureState = CAPTURE_STATE_PROGRESS_ALLIANCE;
} }
// horde takes the tower from neutral or contested to horde // horde takes the tower from neutral, contested or alliance (if there is no neutral area) to horde
else if ((m_captureState == CAPTURE_STATE_NEUTRAL && m_captureSlider < CAPTURE_SLIDER_NEUTRAL - neutralPercent * 0.5f) || (m_captureState == CAPTURE_STATE_CONTEST_HORDE && progressFaction == HORDE)) else if (m_captureState != CAPTURE_STATE_PROGRESS_HORDE && m_captureSlider < CAPTURE_SLIDER_NEUTRAL - neutralPercent * 0.5f && progressFaction == HORDE)
{ {
eventId = info->capturePoint.progressEventID2; eventId = info->capturePoint.progressEventID2;

View file

@ -1733,6 +1733,28 @@ void World::SendZoneText(uint32 zone, const char* text, WorldSession* self /*= N
SendZoneMessage(zone, &data, self, team); 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 /// Kick (and save) all players
void World::KickAll() void World::KickAll()
{ {

View file

@ -511,6 +511,7 @@ class World
void SendGlobalMessage(WorldPacket* packet, WorldSession* self = NULL, Team team = TEAM_NONE); 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 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 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);
/// Are we in the middle of a shutdown? /// Are we in the middle of a shutdown?

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 "0048" #define REVISION_NR "0049"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__