mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 08:55:32 +01:00
Performance improvements in outdoorpvp handling.
--HG-- branch : trunk
This commit is contained in:
@@ -28,7 +28,7 @@
|
||||
|
||||
OutdoorPvPObjective::OutdoorPvPObjective(OutdoorPvP * pvp)
|
||||
: m_PvP(pvp), m_AllianceActivePlayerCount(0), m_HordeActivePlayerCount(0),
|
||||
m_ShiftTimer(0), m_ShiftPhase(0), m_ShiftMaxPhase(0), m_OldPhase(0),
|
||||
m_ShiftPhase(0), m_ShiftMaxPhase(0), m_OldPhase(0),
|
||||
m_State(0), m_OldState(0), m_CapturePoint(0), m_NeutralValue(0), m_ShiftMaxCaptureSpeed(0), m_CapturePointCreature(0)
|
||||
{
|
||||
}
|
||||
@@ -456,9 +456,6 @@ bool OutdoorPvP::Update(uint32 diff)
|
||||
bool OutdoorPvPObjective::Update(uint32 diff)
|
||||
{
|
||||
uint32 Challenger = 0;
|
||||
if(m_ShiftTimer<diff)
|
||||
{
|
||||
m_ShiftTimer = OUTDOORPVP_OBJECTIVE_UPDATE_INTERVAL;
|
||||
|
||||
// get the difference of numbers
|
||||
float fact_diff = (m_AllianceActivePlayerCount - m_HordeActivePlayerCount);
|
||||
@@ -526,9 +523,6 @@ bool OutdoorPvPObjective::Update(uint32 diff)
|
||||
}
|
||||
|
||||
return true;
|
||||
} else m_ShiftTimer-=diff;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OutdoorPvPObjective::HandleCaptureCreaturePlayerMoveInLos(Player * p, Creature * c)
|
||||
|
||||
@@ -24,8 +24,6 @@
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
#define OUTDOORPVP_OBJECTIVE_UPDATE_INTERVAL 1000
|
||||
|
||||
#define OPVP_TRIGGER_CREATURE_ENTRY 12999
|
||||
|
||||
enum ObjectiveStates{
|
||||
@@ -133,8 +131,6 @@ protected:
|
||||
std::set<uint64> m_ActivePlayerGuids;
|
||||
int32 m_AllianceActivePlayerCount;
|
||||
int32 m_HordeActivePlayerCount;
|
||||
// time left to capture the objective
|
||||
uint32 m_ShiftTimer;
|
||||
// total shift needed to capture the objective
|
||||
float m_ShiftMaxPhase;
|
||||
// maximum speed of capture
|
||||
@@ -173,7 +169,7 @@ public:
|
||||
// deletes all gos/creatures spawned by the pvp
|
||||
void DeleteSpawns();
|
||||
|
||||
typedef std::set<OutdoorPvPObjective *> OutdoorPvPObjectiveSet;
|
||||
typedef std::vector<OutdoorPvPObjective *> OutdoorPvPObjectiveSet;
|
||||
|
||||
// called from Player::UpdateZone to add / remove buffs given by outdoor pvp events
|
||||
virtual void HandlePlayerEnterZone(Player * plr, uint32 zone);
|
||||
|
||||
@@ -121,7 +121,7 @@ bool OutdoorPvPObjectiveEP_EWT::Update(uint32 diff)
|
||||
// send this too, sometimes it resets :S
|
||||
SendUpdateWorldState(EP_UI_TOWER_SLIDER_N, m_NeutralValue);
|
||||
}
|
||||
return true;
|
||||
return m_OldState != m_State;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -296,7 +296,7 @@ bool OutdoorPvPObjectiveEP_NPT::Update(uint32 diff)
|
||||
// send this too, sometimes it resets :S
|
||||
SendUpdateWorldState(EP_UI_TOWER_SLIDER_N, m_NeutralValue);
|
||||
}
|
||||
return true;
|
||||
return m_OldState != m_State;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -463,7 +463,7 @@ bool OutdoorPvPObjectiveEP_CGT::Update(uint32 diff)
|
||||
// send this too, sometimes it resets :S
|
||||
SendUpdateWorldState(EP_UI_TOWER_SLIDER_N, m_NeutralValue);
|
||||
}
|
||||
return true;
|
||||
return m_OldState != m_State;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -629,7 +629,7 @@ bool OutdoorPvPObjectiveEP_PWT::Update(uint32 diff)
|
||||
// send this too, sometimes it resets :S
|
||||
SendUpdateWorldState(EP_UI_TOWER_SLIDER_N, m_NeutralValue);
|
||||
}
|
||||
return true;
|
||||
return m_OldState != m_State;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -791,10 +791,10 @@ bool OutdoorPvPEP::SetupOutdoorPvP()
|
||||
for(int i = 0; i < EPBuffZonesNum; ++i)
|
||||
sOutdoorPvPMgr.AddZone(EPBuffZones[i],this);
|
||||
|
||||
m_OutdoorPvPObjectives.insert(new OutdoorPvPObjectiveEP_EWT(this));
|
||||
m_OutdoorPvPObjectives.insert(new OutdoorPvPObjectiveEP_PWT(this));
|
||||
m_OutdoorPvPObjectives.insert(new OutdoorPvPObjectiveEP_CGT(this));
|
||||
m_OutdoorPvPObjectives.insert(new OutdoorPvPObjectiveEP_NPT(this));
|
||||
m_OutdoorPvPObjectives.push_back(new OutdoorPvPObjectiveEP_EWT(this));
|
||||
m_OutdoorPvPObjectives.push_back(new OutdoorPvPObjectiveEP_PWT(this));
|
||||
m_OutdoorPvPObjectives.push_back(new OutdoorPvPObjectiveEP_CGT(this));
|
||||
m_OutdoorPvPObjectives.push_back(new OutdoorPvPObjectiveEP_NPT(this));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,11 +72,11 @@ bool OutdoorPvPHP::SetupOutdoorPvP()
|
||||
for(int i = 0; i < OutdoorPvPHPBuffZonesNum; ++i)
|
||||
sOutdoorPvPMgr.AddZone(OutdoorPvPHPBuffZones[i],this);
|
||||
|
||||
m_OutdoorPvPObjectives.insert(new OutdoorPvPObjectiveHP(this,HP_TOWER_BROKEN_HILL));
|
||||
m_OutdoorPvPObjectives.push_back(new OutdoorPvPObjectiveHP(this,HP_TOWER_BROKEN_HILL));
|
||||
|
||||
m_OutdoorPvPObjectives.insert(new OutdoorPvPObjectiveHP(this,HP_TOWER_OVERLOOK));
|
||||
m_OutdoorPvPObjectives.push_back(new OutdoorPvPObjectiveHP(this,HP_TOWER_OVERLOOK));
|
||||
|
||||
m_OutdoorPvPObjectives.insert(new OutdoorPvPObjectiveHP(this,HP_TOWER_STADIUM));
|
||||
m_OutdoorPvPObjectives.push_back(new OutdoorPvPObjectiveHP(this,HP_TOWER_STADIUM));
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -277,7 +277,7 @@ bool OutdoorPvPObjectiveHP::Update(uint32 diff)
|
||||
// send this too, sometimes the slider disappears, dunno why :(
|
||||
SendUpdateWorldState(HP_UI_TOWER_SLIDER_DISPLAY, 1);
|
||||
}
|
||||
return true;
|
||||
return m_OldState != m_State;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ INSTANTIATE_SINGLETON_1( OutdoorPvPMgr );
|
||||
|
||||
OutdoorPvPMgr::OutdoorPvPMgr()
|
||||
{
|
||||
m_UpdateTimer = OUTDOORPVP_OBJECTIVE_UPDATE_INTERVAL;
|
||||
//sLog.outDebug("Instantiating OutdoorPvPMgr");
|
||||
}
|
||||
|
||||
@@ -54,7 +55,7 @@ void OutdoorPvPMgr::InitOutdoorPvP()
|
||||
}
|
||||
else
|
||||
{
|
||||
m_OutdoorPvPSet.insert(pOP);
|
||||
m_OutdoorPvPSet.push_back(pOP);
|
||||
sLog.outDebug("OutdoorPvP : HP successfully initiated.");
|
||||
}
|
||||
|
||||
@@ -68,7 +69,7 @@ void OutdoorPvPMgr::InitOutdoorPvP()
|
||||
}
|
||||
else
|
||||
{
|
||||
m_OutdoorPvPSet.insert(pOP);
|
||||
m_OutdoorPvPSet.push_back(pOP);
|
||||
sLog.outDebug("OutdoorPvP : NA successfully initiated.");
|
||||
}
|
||||
|
||||
@@ -82,7 +83,7 @@ void OutdoorPvPMgr::InitOutdoorPvP()
|
||||
}
|
||||
else
|
||||
{
|
||||
m_OutdoorPvPSet.insert(pOP);
|
||||
m_OutdoorPvPSet.push_back(pOP);
|
||||
sLog.outDebug("OutdoorPvP : TF successfully initiated.");
|
||||
}
|
||||
|
||||
@@ -95,7 +96,7 @@ void OutdoorPvPMgr::InitOutdoorPvP()
|
||||
}
|
||||
else
|
||||
{
|
||||
m_OutdoorPvPSet.insert(pOP);
|
||||
m_OutdoorPvPSet.push_back(pOP);
|
||||
sLog.outDebug("OutdoorPvP : ZM successfully initiated.");
|
||||
}
|
||||
|
||||
@@ -108,7 +109,7 @@ void OutdoorPvPMgr::InitOutdoorPvP()
|
||||
}
|
||||
else
|
||||
{
|
||||
m_OutdoorPvPSet.insert(pOP);
|
||||
m_OutdoorPvPSet.push_back(pOP);
|
||||
sLog.outDebug("OutdoorPvP : SI successfully initiated.");
|
||||
}
|
||||
|
||||
@@ -121,7 +122,7 @@ void OutdoorPvPMgr::InitOutdoorPvP()
|
||||
}
|
||||
else
|
||||
{
|
||||
m_OutdoorPvPSet.insert(pOP);
|
||||
m_OutdoorPvPSet.push_back(pOP);
|
||||
sLog.outDebug("OutdoorPvP : EP successfully initiated.");
|
||||
}
|
||||
}
|
||||
@@ -172,10 +173,14 @@ OutdoorPvP * OutdoorPvPMgr::GetOutdoorPvPToZoneId(uint32 zoneid)
|
||||
|
||||
void OutdoorPvPMgr::Update(uint32 diff)
|
||||
{
|
||||
for(OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr)
|
||||
if(m_UpdateTimer < diff)
|
||||
{
|
||||
(*itr)->Update(diff);
|
||||
}
|
||||
for(OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr)
|
||||
{
|
||||
(*itr)->Update(diff);
|
||||
}
|
||||
m_UpdateTimer = OUTDOORPVP_OBJECTIVE_UPDATE_INTERVAL;
|
||||
} else m_UpdateTimer -= diff;
|
||||
}
|
||||
|
||||
bool OutdoorPvPMgr::HandleCustomSpell(Player *plr, uint32 spellId, GameObject * go)
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
#ifndef OUTDOOR_PVP_MGR_H_
|
||||
#define OUTDOOR_PVP_MGR_H_
|
||||
|
||||
#define OUTDOORPVP_OBJECTIVE_UPDATE_INTERVAL 1000
|
||||
|
||||
#include "OutdoorPvP.h"
|
||||
#include "Policies/Singleton.h"
|
||||
|
||||
@@ -61,7 +63,7 @@ public:
|
||||
|
||||
void HandleDropFlag(Player * plr, uint32 spellId);
|
||||
|
||||
typedef std::set<OutdoorPvP*> OutdoorPvPSet;
|
||||
typedef std::vector<OutdoorPvP*> OutdoorPvPSet;
|
||||
typedef std::map<uint32 /* zoneid */, OutdoorPvP*> OutdoorPvPMap;
|
||||
private:
|
||||
// contains all initiated outdoor pvp events
|
||||
@@ -70,6 +72,8 @@ private:
|
||||
// maps the zone ids to an outdoor pvp event
|
||||
// used in player event handling
|
||||
OutdoorPvPMap m_OutdoorPvPMap;
|
||||
// update interval
|
||||
float m_UpdateTimer;
|
||||
};
|
||||
|
||||
#define sOutdoorPvPMgr Trinity::Singleton<OutdoorPvPMgr>::Instance()
|
||||
|
||||
@@ -262,7 +262,7 @@ bool OutdoorPvPNA::SetupOutdoorPvP()
|
||||
m_obj = new OutdoorPvPObjectiveNA(this);
|
||||
if(!m_obj)
|
||||
return false;
|
||||
m_OutdoorPvPObjectives.insert(m_obj);
|
||||
m_OutdoorPvPObjectives.push_back(m_obj);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -660,7 +660,7 @@ bool OutdoorPvPObjectiveNA::Update(uint32 diff)
|
||||
SendUpdateWorldState(NA_UI_TOWER_SLIDER_POS, phase);
|
||||
SendUpdateWorldState(NA_UI_TOWER_SLIDER_N, m_NeutralValue);
|
||||
}
|
||||
return true;
|
||||
return m_OldState != m_State;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -278,11 +278,11 @@ bool OutdoorPvPTF::SetupOutdoorPvP()
|
||||
for(int i = 0; i < OutdoorPvPTFBuffZonesNum; ++i)
|
||||
sOutdoorPvPMgr.AddZone(OutdoorPvPTFBuffZones[i],this);
|
||||
|
||||
m_OutdoorPvPObjectives.insert(new OutdoorPvPObjectiveTF(this,TF_TOWER_NW));
|
||||
m_OutdoorPvPObjectives.insert(new OutdoorPvPObjectiveTF(this,TF_TOWER_N));
|
||||
m_OutdoorPvPObjectives.insert(new OutdoorPvPObjectiveTF(this,TF_TOWER_NE));
|
||||
m_OutdoorPvPObjectives.insert(new OutdoorPvPObjectiveTF(this,TF_TOWER_SE));
|
||||
m_OutdoorPvPObjectives.insert(new OutdoorPvPObjectiveTF(this,TF_TOWER_S));
|
||||
m_OutdoorPvPObjectives.push_back(new OutdoorPvPObjectiveTF(this,TF_TOWER_NW));
|
||||
m_OutdoorPvPObjectives.push_back(new OutdoorPvPObjectiveTF(this,TF_TOWER_N));
|
||||
m_OutdoorPvPObjectives.push_back(new OutdoorPvPObjectiveTF(this,TF_TOWER_NE));
|
||||
m_OutdoorPvPObjectives.push_back(new OutdoorPvPObjectiveTF(this,TF_TOWER_SE));
|
||||
m_OutdoorPvPObjectives.push_back(new OutdoorPvPObjectiveTF(this,TF_TOWER_S));
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -360,7 +360,7 @@ bool OutdoorPvPObjectiveTF::Update(uint32 diff)
|
||||
// send this too, sometimes it resets :S
|
||||
SendUpdateWorldState(TF_UI_TOWER_SLIDER_N, m_NeutralValue);
|
||||
}
|
||||
return true;
|
||||
return m_OldState != m_State;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ bool OutdoorPvPObjectiveZM_Beacon::Update(uint32 diff)
|
||||
SendUpdateWorldState(ZMBeaconInfo[m_TowerType].slider_pos, phase);
|
||||
SendUpdateWorldState(ZMBeaconInfo[m_TowerType].slider_n, m_NeutralValue);
|
||||
}
|
||||
return true;
|
||||
return m_OldState != m_State;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -205,10 +205,10 @@ bool OutdoorPvPZM::SetupOutdoorPvP()
|
||||
for(int i = 0; i < OutdoorPvPZMBuffZonesNum; ++i)
|
||||
sOutdoorPvPMgr.AddZone(OutdoorPvPZMBuffZones[i],this);
|
||||
|
||||
m_OutdoorPvPObjectives.insert(new OutdoorPvPObjectiveZM_Beacon(this,ZM_BEACON_WEST));
|
||||
m_OutdoorPvPObjectives.insert(new OutdoorPvPObjectiveZM_Beacon(this,ZM_BEACON_EAST));
|
||||
m_OutdoorPvPObjectives.push_back(new OutdoorPvPObjectiveZM_Beacon(this,ZM_BEACON_WEST));
|
||||
m_OutdoorPvPObjectives.push_back(new OutdoorPvPObjectiveZM_Beacon(this,ZM_BEACON_EAST));
|
||||
m_GraveYard = new OutdoorPvPObjectiveZM_GraveYard(this);
|
||||
m_OutdoorPvPObjectives.insert(m_GraveYard); // though the update function isn't used, the handleusego is!
|
||||
m_OutdoorPvPObjectives.push_back(m_GraveYard); // though the update function isn't used, the handleusego is!
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user