aboutsummaryrefslogtreecommitdiff
path: root/src/game/OutdoorPvP.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-08-10 23:38:51 -0500
committermegamage <none@none>2009-08-10 23:38:51 -0500
commitc8ed3cf1e963250cd7a64ceff493b8a370632867 (patch)
tree2653cd15347be0f53d6dc0de7f7009e36668ad84 /src/game/OutdoorPvP.cpp
parent31374835f6d4ef983d75af1209125d9db08442af (diff)
*Some update of opvp (no real change)
--HG-- branch : trunk
Diffstat (limited to 'src/game/OutdoorPvP.cpp')
-rw-r--r--src/game/OutdoorPvP.cpp65
1 files changed, 49 insertions, 16 deletions
diff --git a/src/game/OutdoorPvP.cpp b/src/game/OutdoorPvP.cpp
index d3c96f53fcb..dc17f340038 100644
--- a/src/game/OutdoorPvP.cpp
+++ b/src/game/OutdoorPvP.cpp
@@ -48,28 +48,52 @@ void OPvPCapturePoint::HandlePlayerLeave(Player * plr)
m_activePlayers[plr->GetTeamId()].erase(plr);
}
-bool OPvPCapturePoint::AddObject(uint32 type, uint32 entry, uint32 map, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3)
+void OPvPCapturePoint::AddGO(uint32 type, uint32 guid, uint32 entry)
{
- uint32 guid = objmgr.AddGameObject(entry, map, x, y, z, o, 0, rotation0, rotation1, rotation2, rotation3);
- if(!guid)
- return false;
-
- // 2 way registering
+ if(!entry)
+ {
+ const GameObjectData *data = objmgr.GetGOData(guid);
+ if(!data)
+ return;
+ entry = data->id;
+ }
m_Objects[type] = MAKE_NEW_GUID(guid, entry, HIGHGUID_GAMEOBJECT);
m_ObjectTypes[m_Objects[type]]=type;
+}
- return true;
+void OPvPCapturePoint::AddCre(uint32 type, uint32 guid, uint32 entry)
+{
+ if(!entry)
+ {
+ const CreatureData *data = objmgr.GetCreatureData(guid);
+ if(!data)
+ return;
+ entry = data->id;
+ }
+ m_Creatures[type] = MAKE_NEW_GUID(guid, entry, HIGHGUID_UNIT);
+ m_CreatureTypes[m_Creatures[type]] = type;
+}
+
+bool OPvPCapturePoint::AddObject(uint32 type, uint32 entry, uint32 map, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3)
+{
+ if(uint32 guid = objmgr.AddGOData(entry, map, x, y, z, o, 0, rotation0, rotation1, rotation2, rotation3))
+ {
+ AddGO(type, guid, entry);
+ return true;
+ }
+
+ return false;
}
bool OPvPCapturePoint::AddCreature(uint32 type, uint32 entry, uint32 team, uint32 map, float x, float y, float z, float o, uint32 spawntimedelay)
{
- uint32 guid = objmgr.AddCreature(entry, team, map, x, y, z, o, spawntimedelay);
- if(!guid)
- return false;
+ if(uint32 guid = objmgr.AddCreData(entry, team, map, x, y, z, o, spawntimedelay))
+ {
+ AddCre(type, guid, entry);
+ return true;
+ }
- m_Creatures[type] = MAKE_NEW_GUID(guid, entry, HIGHGUID_UNIT);
- m_CreatureTypes[m_Creatures[type]] = type;
- return true;
+ return false;
}
bool OPvPCapturePoint::AddCapturePoint(uint32 entry, uint32 map, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3)
@@ -84,7 +108,7 @@ bool OPvPCapturePoint::AddCapturePoint(uint32 entry, uint32 map, float x, float
return false;
}
- m_CapturePointGUID = objmgr.AddGameObject(entry, map, x, y, z, o, 0, rotation0, rotation1, rotation2, rotation3);
+ m_CapturePointGUID = objmgr.AddGOData(entry, map, x, y, z, o, 0, rotation0, rotation1, rotation2, rotation3);
if(!m_CapturePointGUID)
return false;
@@ -209,7 +233,13 @@ bool OutdoorPvP::Update(uint32 diff)
{
bool objective_changed = false;
for(OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
- objective_changed |= (*itr)->Update(diff);
+ {
+ if((*itr)->Update(diff))
+ {
+ (*itr)->ChangeState();
+ objective_changed = true;
+ }
+ }
return objective_changed;
}
@@ -316,7 +346,10 @@ bool OPvPCapturePoint::Update(uint32 diff)
m_State = OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE;
}
- return true;
+ if(m_ShiftPhase != m_OldPhase)
+ SendChangePhase();
+
+ return m_OldState != m_State;
}
void OutdoorPvP::SendUpdateWorldState(uint32 field, uint32 value)