*Rewrite some OPvP functions.
*Apply tenacity buff for outnumbered players in wintergrasp. --HG-- branch : trunk
This commit is contained in:
+27
-18
@@ -411,10 +411,7 @@ OutdoorPvP::~OutdoorPvP()
|
||||
|
||||
void OutdoorPvP::HandlePlayerEnterZone(Player * plr, uint32 zone)
|
||||
{
|
||||
if(plr->GetTeam()==ALLIANCE)
|
||||
m_PlayerGuids[0].insert(plr->GetGUID());
|
||||
else
|
||||
m_PlayerGuids[1].insert(plr->GetGUID());
|
||||
m_players[TEAM_ID(plr->GetTeam())].insert(plr);
|
||||
}
|
||||
|
||||
void OutdoorPvP::HandlePlayerLeaveZone(Player * plr, uint32 zone)
|
||||
@@ -423,13 +420,10 @@ void OutdoorPvP::HandlePlayerLeaveZone(Player * plr, uint32 zone)
|
||||
for(OutdoorPvPObjectiveSet::iterator itr = m_OutdoorPvPObjectives.begin(); itr != m_OutdoorPvPObjectives.end(); ++itr)
|
||||
(*itr)->HandlePlayerLeave(plr);
|
||||
// remove the world state information from the player (we can't keep everyone up to date, so leave out those who are not in the concerning zones)
|
||||
if(zone != plr->GetZoneId())
|
||||
if(!plr->GetSession()->PlayerLogout())
|
||||
SendRemoveWorldStates(plr);
|
||||
if(plr->GetTeam()==ALLIANCE)
|
||||
m_PlayerGuids[0].erase(plr->GetGUID());
|
||||
else
|
||||
m_PlayerGuids[1].erase(plr->GetGUID());
|
||||
sLog.outDebug("player left an outdoorpvp zone");
|
||||
m_players[TEAM_ID(plr->GetTeam())].erase(plr);
|
||||
sLog.outDebug("Player %s left an outdoorpvp zone");
|
||||
}
|
||||
|
||||
bool OutdoorPvP::Update(uint32 diff)
|
||||
@@ -570,14 +564,8 @@ void OutdoorPvP::SendUpdateWorldState(uint32 field, uint32 value)
|
||||
for(int i = 0; i < 2; ++i)
|
||||
{
|
||||
// send to all players present in the area
|
||||
for(std::set<uint64>::iterator itr = m_PlayerGuids[i].begin(); itr != m_PlayerGuids[i].end(); ++itr)
|
||||
{
|
||||
Player * plr = objmgr.GetPlayer(*itr);
|
||||
if(plr)
|
||||
{
|
||||
plr->SendUpdateWorldState(field,value);
|
||||
}
|
||||
}
|
||||
for(PlayerSet::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr)
|
||||
(*itr)->SendUpdateWorldState(field,value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -781,3 +769,24 @@ void OutdoorPvP::RegisterZone(uint32 zoneId)
|
||||
{
|
||||
sOutdoorPvPMgr.AddZone(zoneId, this);
|
||||
}
|
||||
|
||||
bool OutdoorPvP::HasPlayer(Player *plr) const
|
||||
{
|
||||
return m_players[TEAM_ID(plr->GetTeam())].find(plr) != m_players[TEAM_ID(plr->GetTeam())].end();
|
||||
}
|
||||
|
||||
void OutdoorPvP::TeamCastSpell(TeamId team, int32 spellId)
|
||||
{
|
||||
if(spellId > 0)
|
||||
for(PlayerSet::iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||
(*itr)->CastSpell(*itr, (uint32)spellId, true);
|
||||
else
|
||||
for(PlayerSet::iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||
(*itr)->RemoveAura((uint32)-spellId); // by stack?
|
||||
}
|
||||
|
||||
void OutdoorPvP::TeamApplyBuff(TeamId team, uint32 spellId, uint32 spellId2)
|
||||
{
|
||||
TeamCastSpell(team, spellId);
|
||||
TeamCastSpell(OTHER_TEAM(team), spellId2 ? -(int32)spellId2 : -(int32)spellId);
|
||||
}
|
||||
|
||||
+22
-9
@@ -26,6 +26,13 @@
|
||||
|
||||
#define OPVP_TRIGGER_CREATURE_ENTRY 12999
|
||||
|
||||
enum TeamId
|
||||
{
|
||||
TEAM_ALLIANCE = 0,
|
||||
TEAM_HORDE,
|
||||
TEAM_NEUTRAL,
|
||||
};
|
||||
|
||||
enum OutdoorPvPTypes
|
||||
{
|
||||
OUTDOOR_PVP_HP = 1,
|
||||
@@ -153,6 +160,7 @@ protected:
|
||||
// base class for specific outdoor pvp handlers
|
||||
class OutdoorPvP
|
||||
{
|
||||
friend class OutdoorPvPMgr;
|
||||
public:
|
||||
// ctor
|
||||
OutdoorPvP();
|
||||
@@ -163,9 +171,7 @@ public:
|
||||
|
||||
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);
|
||||
virtual void HandlePlayerLeaveZone(Player * plr, uint32 zone);
|
||||
virtual void FillInitialWorldStates(WorldPacket & data) {}
|
||||
virtual void HandlePlayerActivityChanged(Player * plr);
|
||||
// called when a player triggers an areatrigger
|
||||
virtual bool HandleAreaTrigger(Player * plr, uint32 trigger);
|
||||
@@ -179,10 +185,6 @@ public:
|
||||
// setup stuff
|
||||
virtual bool SetupOutdoorPvP() {return true;}
|
||||
|
||||
// world state stuff
|
||||
virtual void SendRemoveWorldStates(Player * plr) {}
|
||||
virtual void FillInitialWorldStates(WorldPacket & data) {}
|
||||
|
||||
// send world state update to all players present
|
||||
virtual void SendUpdateWorldState(uint32 field, uint32 value);
|
||||
|
||||
@@ -206,14 +208,25 @@ public:
|
||||
virtual bool HandleGossipOption(Player *plr, uint64 guid, uint32 gossipid);
|
||||
|
||||
virtual bool CanTalkTo(Player * plr, Creature * c, GossipOption &gso);
|
||||
|
||||
void TeamApplyBuff(TeamId team, uint32 spellId, uint32 spellId2 = 0);
|
||||
protected:
|
||||
// the map of the objectives belonging to this outdoorpvp
|
||||
OutdoorPvPObjectiveSet m_OutdoorPvPObjectives;
|
||||
// players in the zones of this outdoorpvp, 0 - alliance, 1 - horde
|
||||
std::set<uint64> m_PlayerGuids[2];
|
||||
|
||||
typedef std::set<Player*> PlayerSet;
|
||||
PlayerSet m_players[2];
|
||||
uint32 m_TypeId;
|
||||
|
||||
// world state stuff
|
||||
virtual void SendRemoveWorldStates(Player * plr) {}
|
||||
|
||||
virtual void HandlePlayerEnterZone(Player * plr, uint32 zone);
|
||||
virtual void HandlePlayerLeaveZone(Player * plr, uint32 zone);
|
||||
|
||||
void RegisterZone(uint32 zoneid);
|
||||
bool HasPlayer(Player *plr) const;
|
||||
void TeamCastSpell(TeamId team, int32 spellId);
|
||||
};
|
||||
|
||||
#endif /*OUTDOOR_PVP_H_*/
|
||||
|
||||
@@ -853,24 +853,24 @@ void OutdoorPvPEP::HandlePlayerLeaveZone(Player * plr, uint32 zone)
|
||||
|
||||
void OutdoorPvPEP::BuffTeams()
|
||||
{
|
||||
for(std::set<uint64>::iterator itr = m_PlayerGuids[0].begin(); itr != m_PlayerGuids[0].end(); ++itr)
|
||||
for(PlayerSet::iterator itr = m_players[0].begin(); itr != m_players[0].end(); ++itr)
|
||||
{
|
||||
if(Player * plr = objmgr.GetPlayer(*itr))
|
||||
Player * plr = *itr;
|
||||
{
|
||||
for(int i = 0; i < 4; ++i)
|
||||
if(plr->IsInWorld()) plr->RemoveAurasDueToSpell(EP_AllianceBuffs[i]);
|
||||
plr->RemoveAurasDueToSpell(EP_AllianceBuffs[i]);
|
||||
if(m_AllianceTowersControlled && m_AllianceTowersControlled < 5)
|
||||
if(plr->IsInWorld()) plr->CastSpell(plr,EP_AllianceBuffs[m_AllianceTowersControlled-1],true);
|
||||
plr->CastSpell(plr,EP_AllianceBuffs[m_AllianceTowersControlled-1],true);
|
||||
}
|
||||
}
|
||||
for(std::set<uint64>::iterator itr = m_PlayerGuids[1].begin(); itr != m_PlayerGuids[1].end(); ++itr)
|
||||
for(PlayerSet::iterator itr = m_players[1].begin(); itr != m_players[1].end(); ++itr)
|
||||
{
|
||||
if(Player * plr = objmgr.GetPlayer(*itr))
|
||||
Player * plr = *itr;
|
||||
{
|
||||
for(int i = 0; i < 4; ++i)
|
||||
if(plr->IsInWorld()) plr->RemoveAurasDueToSpell(EP_HordeBuffs[i]);
|
||||
plr->RemoveAurasDueToSpell(EP_HordeBuffs[i]);
|
||||
if(m_HordeTowersControlled && m_HordeTowersControlled < 5)
|
||||
if(plr->IsInWorld()) plr->CastSpell(plr,EP_HordeBuffs[m_HordeTowersControlled-1],true);
|
||||
plr->CastSpell(plr,EP_HordeBuffs[m_HordeTowersControlled-1],true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,11 +117,14 @@ bool OutdoorPvPHP::Update(uint32 diff)
|
||||
if(changed = OutdoorPvP::Update(diff))
|
||||
{
|
||||
if(m_AllianceTowersControlled == 3)
|
||||
BuffTeam(ALLIANCE);
|
||||
TeamApplyBuff(TEAM_ALLIANCE, AllianceBuff, HordeBuff);
|
||||
else if(m_HordeTowersControlled == 3)
|
||||
BuffTeam(HORDE);
|
||||
TeamApplyBuff(TEAM_HORDE, HordeBuff, AllianceBuff);
|
||||
else
|
||||
BuffTeam(0);
|
||||
{
|
||||
TeamCastSpell(TEAM_ALLIANCE, -AllianceBuff);
|
||||
TeamCastSpell(TEAM_HORDE, -HordeBuff);
|
||||
}
|
||||
SendUpdateWorldState(HP_UI_TOWER_COUNT_A, m_AllianceTowersControlled);
|
||||
SendUpdateWorldState(HP_UI_TOWER_COUNT_H, m_HordeTowersControlled);
|
||||
}
|
||||
@@ -328,49 +331,6 @@ void OutdoorPvPObjectiveHP::HandlePlayerLeave(Player *plr)
|
||||
OutdoorPvPObjective::HandlePlayerLeave(plr);
|
||||
}
|
||||
|
||||
void OutdoorPvPHP::BuffTeam(uint32 team)
|
||||
{
|
||||
if(team == ALLIANCE)
|
||||
{
|
||||
for(std::set<uint64>::iterator itr = m_PlayerGuids[0].begin(); itr != m_PlayerGuids[0].end(); ++itr)
|
||||
{
|
||||
if(Player * plr = objmgr.GetPlayer(*itr))
|
||||
if(plr->IsInWorld()) plr->CastSpell(plr,AllianceBuff,true);
|
||||
}
|
||||
for(std::set<uint64>::iterator itr = m_PlayerGuids[1].begin(); itr != m_PlayerGuids[1].end(); ++itr)
|
||||
{
|
||||
if(Player * plr = objmgr.GetPlayer(*itr))
|
||||
if(plr->IsInWorld()) plr->RemoveAurasDueToSpell(HordeBuff);
|
||||
}
|
||||
}
|
||||
else if(team == HORDE)
|
||||
{
|
||||
for(std::set<uint64>::iterator itr = m_PlayerGuids[1].begin(); itr != m_PlayerGuids[1].end(); ++itr)
|
||||
{
|
||||
if(Player * plr = objmgr.GetPlayer(*itr))
|
||||
if(plr->IsInWorld()) plr->CastSpell(plr,HordeBuff,true);
|
||||
}
|
||||
for(std::set<uint64>::iterator itr = m_PlayerGuids[0].begin(); itr != m_PlayerGuids[0].end(); ++itr)
|
||||
{
|
||||
if(Player * plr = objmgr.GetPlayer(*itr))
|
||||
if(plr->IsInWorld()) plr->RemoveAurasDueToSpell(AllianceBuff);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(std::set<uint64>::iterator itr = m_PlayerGuids[0].begin(); itr != m_PlayerGuids[0].end(); ++itr)
|
||||
{
|
||||
if(Player * plr = objmgr.GetPlayer(*itr))
|
||||
if(plr->IsInWorld()) plr->RemoveAurasDueToSpell(AllianceBuff);
|
||||
}
|
||||
for(std::set<uint64>::iterator itr = m_PlayerGuids[1].begin(); itr != m_PlayerGuids[1].end(); ++itr)
|
||||
{
|
||||
if(Player * plr = objmgr.GetPlayer(*itr))
|
||||
if(plr->IsInWorld()) plr->RemoveAurasDueToSpell(HordeBuff);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OutdoorPvPHP::HandleKillImpl(Player *plr, Unit * killed)
|
||||
{
|
||||
if(killed->GetTypeId() != TYPEID_PLAYER)
|
||||
|
||||
@@ -25,9 +25,9 @@
|
||||
// HP, citadel, ramparts, blood furnace, shattered halls, mag's lair
|
||||
const uint32 OutdoorPvPHPBuffZones[OutdoorPvPHPBuffZonesNum] = { 3483, 3563, 3562, 3713, 3714, 3836 };
|
||||
|
||||
const uint32 AllianceBuff = 32071;
|
||||
#define AllianceBuff 32071
|
||||
|
||||
const uint32 HordeBuff = 32049;
|
||||
#define HordeBuff 32049
|
||||
|
||||
const uint32 AlliancePlayerKillReward = 32155;
|
||||
|
||||
@@ -108,7 +108,6 @@ public:
|
||||
void FillInitialWorldStates(WorldPacket &data);
|
||||
void SendRemoveWorldStates(Player * plr);
|
||||
void HandleKillImpl(Player * plr, Unit * killed);
|
||||
void BuffTeam(uint32 team);
|
||||
private:
|
||||
// how many towers are controlled
|
||||
uint32 m_AllianceTowersControlled;
|
||||
|
||||
@@ -22,7 +22,8 @@
|
||||
#include "OutdoorPvP.h"
|
||||
#include "Player.h"
|
||||
|
||||
#define TEAM_ID(a) (a == ALLIANCE ? 0 : 1)
|
||||
#define TEAM_ID(a) (a == ALLIANCE ? TEAM_ALLIANCE : TEAM_HORDE)
|
||||
#define OTHER_TEAM(a) (a == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE)
|
||||
|
||||
enum ObjectiveStates
|
||||
{
|
||||
|
||||
@@ -151,24 +151,25 @@ void OutdoorPvPMgr::HandlePlayerEnterZone(Player *plr, uint32 zoneid)
|
||||
{
|
||||
OutdoorPvPMap::iterator itr = m_OutdoorPvPMap.find(zoneid);
|
||||
if(itr == m_OutdoorPvPMap.end())
|
||||
{
|
||||
// no handle for this zone, return
|
||||
return;
|
||||
}
|
||||
// add possibly beneficial buffs to plr for zone
|
||||
|
||||
if(itr->second->HasPlayer(plr))
|
||||
return;
|
||||
|
||||
itr->second->HandlePlayerEnterZone(plr, zoneid);
|
||||
sLog.outDebug("Player %u entered outdoorpvp id %u",plr->GetGUIDLow(), itr->second->GetTypeId());
|
||||
sLog.outDebug("Player %u entered outdoorpvp id %u", plr->GetGUIDLow(), itr->second->GetTypeId());
|
||||
}
|
||||
|
||||
void OutdoorPvPMgr::HandlePlayerLeaveZone(Player *plr, uint32 zoneid)
|
||||
{
|
||||
OutdoorPvPMap::iterator itr = m_OutdoorPvPMap.find(zoneid);
|
||||
if(itr == m_OutdoorPvPMap.end())
|
||||
{
|
||||
// no handle for this zone, return
|
||||
return;
|
||||
}
|
||||
// inform the OutdoorPvP class of the leaving, it should remove the player from all objectives
|
||||
|
||||
// teleport: remove once in removefromworld, once in updatezone
|
||||
if(!itr->second->HasPlayer(plr))
|
||||
return;
|
||||
|
||||
itr->second->HandlePlayerLeaveZone(plr, zoneid);
|
||||
sLog.outDebug("Player %u left outdoorpvp id %u",plr->GetGUIDLow(), itr->second->GetTypeId());
|
||||
}
|
||||
|
||||
@@ -83,49 +83,6 @@ uint32 OutdoorPvPObjectiveNA::GetAliveGuardsCount()
|
||||
return cnt;
|
||||
}
|
||||
|
||||
void OutdoorPvPNA::BuffTeam(uint32 team)
|
||||
{
|
||||
if(team == ALLIANCE)
|
||||
{
|
||||
for(std::set<uint64>::iterator itr = m_PlayerGuids[0].begin(); itr != m_PlayerGuids[0].end(); ++itr)
|
||||
{
|
||||
if(Player * plr = objmgr.GetPlayer(*itr))
|
||||
if(plr->IsInWorld()) plr->CastSpell(plr,NA_CAPTURE_BUFF,true);
|
||||
}
|
||||
for(std::set<uint64>::iterator itr = m_PlayerGuids[1].begin(); itr != m_PlayerGuids[1].end(); ++itr)
|
||||
{
|
||||
if(Player * plr = objmgr.GetPlayer(*itr))
|
||||
if(plr->IsInWorld()) plr->RemoveAurasDueToSpell(NA_CAPTURE_BUFF);
|
||||
}
|
||||
}
|
||||
else if(team == HORDE)
|
||||
{
|
||||
for(std::set<uint64>::iterator itr = m_PlayerGuids[1].begin(); itr != m_PlayerGuids[1].end(); ++itr)
|
||||
{
|
||||
if(Player * plr = objmgr.GetPlayer(*itr))
|
||||
if(plr->IsInWorld()) plr->CastSpell(plr,NA_CAPTURE_BUFF,true);
|
||||
}
|
||||
for(std::set<uint64>::iterator itr = m_PlayerGuids[0].begin(); itr != m_PlayerGuids[0].end(); ++itr)
|
||||
{
|
||||
if(Player * plr = objmgr.GetPlayer(*itr))
|
||||
if(plr->IsInWorld()) plr->RemoveAurasDueToSpell(NA_CAPTURE_BUFF);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(std::set<uint64>::iterator itr = m_PlayerGuids[0].begin(); itr != m_PlayerGuids[0].end(); ++itr)
|
||||
{
|
||||
if(Player * plr = objmgr.GetPlayer(*itr))
|
||||
if(plr->IsInWorld()) plr->RemoveAurasDueToSpell(NA_CAPTURE_BUFF);
|
||||
}
|
||||
for(std::set<uint64>::iterator itr = m_PlayerGuids[1].begin(); itr != m_PlayerGuids[1].end(); ++itr)
|
||||
{
|
||||
if(Player * plr = objmgr.GetPlayer(*itr))
|
||||
if(plr->IsInWorld()) plr->RemoveAurasDueToSpell(NA_CAPTURE_BUFF);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OutdoorPvPObjectiveNA::SpawnNPCsForTeam(uint32 team)
|
||||
{
|
||||
const creature_type * creatures = NULL;
|
||||
@@ -222,7 +179,7 @@ void OutdoorPvPObjectiveNA::FactionTakeOver(uint32 team)
|
||||
this->UpdateWyvernRoostWorldState(NA_ROOST_N);
|
||||
this->UpdateWyvernRoostWorldState(NA_ROOST_W);
|
||||
this->UpdateWyvernRoostWorldState(NA_ROOST_E);
|
||||
((OutdoorPvPNA*)m_PvP)->BuffTeam(team);
|
||||
m_PvP->TeamApplyBuff(TEAM_ID(team), NA_CAPTURE_BUFF);
|
||||
}
|
||||
|
||||
bool OutdoorPvPObjectiveNA::HandlePlayerEnter(Player *plr)
|
||||
|
||||
@@ -289,7 +289,6 @@ public:
|
||||
void FillInitialWorldStates(WorldPacket &data);
|
||||
void SendRemoveWorldStates(Player * plr);
|
||||
void HandleKillImpl(Player * plr, Unit * killed);
|
||||
void BuffTeam(uint32 team);
|
||||
private:
|
||||
OutdoorPvPObjectiveNA * m_obj;
|
||||
};
|
||||
|
||||
@@ -81,49 +81,6 @@ void OutdoorPvPSI::HandlePlayerLeaveZone(Player * plr, uint32 zone)
|
||||
OutdoorPvP::HandlePlayerLeaveZone(plr, zone);
|
||||
}
|
||||
|
||||
void OutdoorPvPSI::BuffTeam(uint32 team)
|
||||
{
|
||||
if(team == ALLIANCE)
|
||||
{
|
||||
for(std::set<uint64>::iterator itr = m_PlayerGuids[0].begin(); itr != m_PlayerGuids[0].end(); ++itr)
|
||||
{
|
||||
if(Player * plr = objmgr.GetPlayer(*itr))
|
||||
if(plr->IsInWorld()) plr->CastSpell(plr,SI_CENARION_FAVOR,true);
|
||||
}
|
||||
for(std::set<uint64>::iterator itr = m_PlayerGuids[1].begin(); itr != m_PlayerGuids[1].end(); ++itr)
|
||||
{
|
||||
if(Player * plr = objmgr.GetPlayer(*itr))
|
||||
if(plr->IsInWorld()) plr->RemoveAurasDueToSpell(SI_CENARION_FAVOR);
|
||||
}
|
||||
}
|
||||
else if(team == HORDE)
|
||||
{
|
||||
for(std::set<uint64>::iterator itr = m_PlayerGuids[1].begin(); itr != m_PlayerGuids[1].end(); ++itr)
|
||||
{
|
||||
if(Player * plr = objmgr.GetPlayer(*itr))
|
||||
if(plr->IsInWorld()) plr->CastSpell(plr,SI_CENARION_FAVOR,true);
|
||||
}
|
||||
for(std::set<uint64>::iterator itr = m_PlayerGuids[0].begin(); itr != m_PlayerGuids[0].end(); ++itr)
|
||||
{
|
||||
if(Player * plr = objmgr.GetPlayer(*itr))
|
||||
if(plr->IsInWorld()) plr->RemoveAurasDueToSpell(SI_CENARION_FAVOR);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(std::set<uint64>::iterator itr = m_PlayerGuids[0].begin(); itr != m_PlayerGuids[0].end(); ++itr)
|
||||
{
|
||||
if(Player * plr = objmgr.GetPlayer(*itr))
|
||||
if(plr->IsInWorld()) plr->RemoveAurasDueToSpell(SI_CENARION_FAVOR);
|
||||
}
|
||||
for(std::set<uint64>::iterator itr = m_PlayerGuids[1].begin(); itr != m_PlayerGuids[1].end(); ++itr)
|
||||
{
|
||||
if(Player * plr = objmgr.GetPlayer(*itr))
|
||||
if(plr->IsInWorld()) plr->RemoveAurasDueToSpell(SI_CENARION_FAVOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool OutdoorPvPSI::HandleAreaTrigger(Player *plr, uint32 trigger)
|
||||
{
|
||||
switch(trigger)
|
||||
@@ -136,7 +93,7 @@ bool OutdoorPvPSI::HandleAreaTrigger(Player *plr, uint32 trigger)
|
||||
++ m_Gathered_A;
|
||||
if(m_Gathered_A >= SI_MAX_RESOURCES)
|
||||
{
|
||||
BuffTeam(ALLIANCE);
|
||||
TeamApplyBuff(TEAM_ALLIANCE, SI_CENARION_FAVOR);
|
||||
sWorld.SendZoneText(OutdoorPvPSIBuffZones[0],objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_SI_CAPTURE_A));
|
||||
m_LastController = ALLIANCE;
|
||||
m_Gathered_A = 0;
|
||||
@@ -161,7 +118,7 @@ bool OutdoorPvPSI::HandleAreaTrigger(Player *plr, uint32 trigger)
|
||||
++ m_Gathered_H;
|
||||
if(m_Gathered_H >= SI_MAX_RESOURCES)
|
||||
{
|
||||
BuffTeam(HORDE);
|
||||
TeamApplyBuff(TEAM_HORDE, SI_CENARION_FAVOR);
|
||||
sWorld.SendZoneText(OutdoorPvPSIBuffZones[0],objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_SI_CAPTURE_H));
|
||||
m_LastController = HORDE;
|
||||
m_Gathered_A = 0;
|
||||
|
||||
@@ -64,7 +64,6 @@ public:
|
||||
bool HandleAreaTrigger(Player * plr, uint32 trigger);
|
||||
bool HandleDropFlag(Player * plr, uint32 spellId);
|
||||
bool HandleCustomSpell(Player * plr, uint32 spellId, GameObject *go);
|
||||
void BuffTeam(uint32 team);
|
||||
void UpdateWorldState();
|
||||
private:
|
||||
uint32 m_Gathered_A;
|
||||
|
||||
@@ -133,49 +133,6 @@ bool OutdoorPvPObjectiveTF::HandleCapturePointEvent(Player *plr, uint32 eventId)
|
||||
return false;
|
||||
}
|
||||
|
||||
void OutdoorPvPTF::BuffTeam(uint32 team)
|
||||
{
|
||||
if(team == ALLIANCE)
|
||||
{
|
||||
for(std::set<uint64>::iterator itr = m_PlayerGuids[0].begin(); itr != m_PlayerGuids[0].end(); ++itr)
|
||||
{
|
||||
if(Player * plr = objmgr.GetPlayer(*itr))
|
||||
if(plr->IsInWorld()) plr->CastSpell(plr,TF_CAPTURE_BUFF,true);
|
||||
}
|
||||
for(std::set<uint64>::iterator itr = m_PlayerGuids[1].begin(); itr != m_PlayerGuids[1].end(); ++itr)
|
||||
{
|
||||
if(Player * plr = objmgr.GetPlayer(*itr))
|
||||
if(plr->IsInWorld()) plr->RemoveAurasDueToSpell(TF_CAPTURE_BUFF);
|
||||
}
|
||||
}
|
||||
else if(team == HORDE)
|
||||
{
|
||||
for(std::set<uint64>::iterator itr = m_PlayerGuids[1].begin(); itr != m_PlayerGuids[1].end(); ++itr)
|
||||
{
|
||||
if(Player * plr = objmgr.GetPlayer(*itr))
|
||||
if(plr->IsInWorld()) plr->CastSpell(plr,TF_CAPTURE_BUFF,true);
|
||||
}
|
||||
for(std::set<uint64>::iterator itr = m_PlayerGuids[0].begin(); itr != m_PlayerGuids[0].end(); ++itr)
|
||||
{
|
||||
if(Player * plr = objmgr.GetPlayer(*itr))
|
||||
if(plr->IsInWorld()) plr->RemoveAurasDueToSpell(TF_CAPTURE_BUFF);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(std::set<uint64>::iterator itr = m_PlayerGuids[0].begin(); itr != m_PlayerGuids[0].end(); ++itr)
|
||||
{
|
||||
if(Player * plr = objmgr.GetPlayer(*itr))
|
||||
if(plr->IsInWorld()) plr->RemoveAurasDueToSpell(TF_CAPTURE_BUFF);
|
||||
}
|
||||
for(std::set<uint64>::iterator itr = m_PlayerGuids[1].begin(); itr != m_PlayerGuids[1].end(); ++itr)
|
||||
{
|
||||
if(Player * plr = objmgr.GetPlayer(*itr))
|
||||
if(plr->IsInWorld()) plr->RemoveAurasDueToSpell(TF_CAPTURE_BUFF);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool OutdoorPvPTF::Update(uint32 diff)
|
||||
{
|
||||
bool changed = false;
|
||||
@@ -184,7 +141,7 @@ bool OutdoorPvPTF::Update(uint32 diff)
|
||||
{
|
||||
if(m_AllianceTowersControlled == TF_TOWER_NUM)
|
||||
{
|
||||
BuffTeam(ALLIANCE);
|
||||
TeamApplyBuff(TEAM_ALLIANCE, TF_CAPTURE_BUFF);
|
||||
m_IsLocked = true;
|
||||
SendUpdateWorldState(TF_UI_LOCKED_DISPLAY_NEUTRAL,uint32(0));
|
||||
SendUpdateWorldState(TF_UI_LOCKED_DISPLAY_HORDE,uint32(0));
|
||||
@@ -193,7 +150,7 @@ bool OutdoorPvPTF::Update(uint32 diff)
|
||||
}
|
||||
else if(m_HordeTowersControlled == TF_TOWER_NUM)
|
||||
{
|
||||
BuffTeam(HORDE);
|
||||
TeamApplyBuff(TEAM_HORDE, TF_CAPTURE_BUFF);
|
||||
m_IsLocked = true;
|
||||
SendUpdateWorldState(TF_UI_LOCKED_DISPLAY_NEUTRAL,uint32(0));
|
||||
SendUpdateWorldState(TF_UI_LOCKED_DISPLAY_HORDE,uint32(1));
|
||||
@@ -201,7 +158,10 @@ bool OutdoorPvPTF::Update(uint32 diff)
|
||||
SendUpdateWorldState(TF_UI_TOWERS_CONTROLLED_DISPLAY, uint32(0));
|
||||
}
|
||||
else
|
||||
BuffTeam(NULL);
|
||||
{
|
||||
TeamCastSpell(TEAM_ALLIANCE, -TF_CAPTURE_BUFF);
|
||||
TeamCastSpell(TEAM_HORDE, -TF_CAPTURE_BUFF);
|
||||
}
|
||||
SendUpdateWorldState(TF_UI_TOWER_COUNT_A, m_AllianceTowersControlled);
|
||||
SendUpdateWorldState(TF_UI_TOWER_COUNT_H, m_HordeTowersControlled);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ const uint32 TF_LOCK_TIME = 3600 * 6 * 1000;
|
||||
const uint32 TF_LOCK_TIME_UPDATE = 15000;
|
||||
|
||||
// blessing of auchindoun
|
||||
const uint32 TF_CAPTURE_BUFF = 33377;
|
||||
#define TF_CAPTURE_BUFF 33377
|
||||
|
||||
const uint32 TF_ALLY_QUEST = 11505;
|
||||
const uint32 TF_HORDE_QUEST = 11506;
|
||||
@@ -104,7 +104,6 @@ public:
|
||||
bool Update(uint32 diff);
|
||||
void FillInitialWorldStates(WorldPacket &data);
|
||||
void SendRemoveWorldStates(Player * plr);
|
||||
void BuffTeam(uint32 team);
|
||||
private:
|
||||
bool m_IsLocked;
|
||||
uint32 m_LockTimer;
|
||||
|
||||
@@ -224,49 +224,6 @@ void OutdoorPvPZM::HandleKillImpl(Player *plr, Unit * killed)
|
||||
plr->CastSpell(plr,ZM_HordePlayerKillReward,true);
|
||||
}
|
||||
|
||||
void OutdoorPvPZM::BuffTeam(uint32 team)
|
||||
{
|
||||
if(team == ALLIANCE)
|
||||
{
|
||||
for(std::set<uint64>::iterator itr = m_PlayerGuids[0].begin(); itr != m_PlayerGuids[0].end(); ++itr)
|
||||
{
|
||||
if(Player * plr = objmgr.GetPlayer(*itr))
|
||||
if(plr->IsInWorld()) plr->CastSpell(plr,ZM_CAPTURE_BUFF,true);
|
||||
}
|
||||
for(std::set<uint64>::iterator itr = m_PlayerGuids[1].begin(); itr != m_PlayerGuids[1].end(); ++itr)
|
||||
{
|
||||
if(Player * plr = objmgr.GetPlayer(*itr))
|
||||
if(plr->IsInWorld()) plr->RemoveAurasDueToSpell(ZM_CAPTURE_BUFF);
|
||||
}
|
||||
}
|
||||
else if(team == HORDE)
|
||||
{
|
||||
for(std::set<uint64>::iterator itr = m_PlayerGuids[1].begin(); itr != m_PlayerGuids[1].end(); ++itr)
|
||||
{
|
||||
if(Player * plr = objmgr.GetPlayer(*itr))
|
||||
if(plr->IsInWorld()) plr->CastSpell(plr,ZM_CAPTURE_BUFF,true);
|
||||
}
|
||||
for(std::set<uint64>::iterator itr = m_PlayerGuids[0].begin(); itr != m_PlayerGuids[0].end(); ++itr)
|
||||
{
|
||||
if(Player * plr = objmgr.GetPlayer(*itr))
|
||||
if(plr->IsInWorld()) plr->RemoveAurasDueToSpell(ZM_CAPTURE_BUFF);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(std::set<uint64>::iterator itr = m_PlayerGuids[0].begin(); itr != m_PlayerGuids[0].end(); ++itr)
|
||||
{
|
||||
if(Player * plr = objmgr.GetPlayer(*itr))
|
||||
if(plr->IsInWorld()) plr->RemoveAurasDueToSpell(ZM_CAPTURE_BUFF);
|
||||
}
|
||||
for(std::set<uint64>::iterator itr = m_PlayerGuids[1].begin(); itr != m_PlayerGuids[1].end(); ++itr)
|
||||
{
|
||||
if(Player * plr = objmgr.GetPlayer(*itr))
|
||||
if(plr->IsInWorld()) plr->RemoveAurasDueToSpell(ZM_CAPTURE_BUFF);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool OutdoorPvPObjectiveZM_GraveYard::Update(uint32 diff)
|
||||
{
|
||||
bool retval = m_State != m_OldState;
|
||||
@@ -288,7 +245,7 @@ int32 OutdoorPvPObjectiveZM_GraveYard::HandleOpenGo(Player *plr, uint64 guid)
|
||||
AddObject(0,ZM_Banner_A.entry,ZM_Banner_A.map,ZM_Banner_A.x,ZM_Banner_A.y,ZM_Banner_A.z,ZM_Banner_A.o,ZM_Banner_A.rot0,ZM_Banner_A.rot1,ZM_Banner_A.rot2,ZM_Banner_A.rot3);
|
||||
objmgr.RemoveGraveYardLink(ZM_GRAVEYARD_ID, ZM_GRAVEYARD_ZONE, HORDE); // rem gy
|
||||
objmgr.AddGraveYardLink(ZM_GRAVEYARD_ID, ZM_GRAVEYARD_ZONE, ALLIANCE, false); // add gy
|
||||
((OutdoorPvPZM*)m_PvP)->BuffTeam(ALLIANCE);
|
||||
m_PvP->TeamApplyBuff(TEAM_ALLIANCE, ZM_CAPTURE_BUFF);
|
||||
plr->RemoveAurasDueToSpell(ZM_BATTLE_STANDARD_A);
|
||||
sWorld.SendZoneText(ZM_GRAVEYARD_ZONE,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_ZM_CAPTURE_GY_A));
|
||||
}
|
||||
@@ -301,7 +258,7 @@ int32 OutdoorPvPObjectiveZM_GraveYard::HandleOpenGo(Player *plr, uint64 guid)
|
||||
AddObject(0,ZM_Banner_H.entry,ZM_Banner_H.map,ZM_Banner_H.x,ZM_Banner_H.y,ZM_Banner_H.z,ZM_Banner_H.o,ZM_Banner_H.rot0,ZM_Banner_H.rot1,ZM_Banner_H.rot2,ZM_Banner_H.rot3);
|
||||
objmgr.RemoveGraveYardLink(ZM_GRAVEYARD_ID, ZM_GRAVEYARD_ZONE, ALLIANCE); // rem gy
|
||||
objmgr.AddGraveYardLink(ZM_GRAVEYARD_ID, ZM_GRAVEYARD_ZONE, HORDE, false); // add gy
|
||||
((OutdoorPvPZM*)m_PvP)->BuffTeam(HORDE);
|
||||
m_PvP->TeamApplyBuff(TEAM_HORDE, ZM_CAPTURE_BUFF);
|
||||
plr->RemoveAurasDueToSpell(ZM_BATTLE_STANDARD_H);
|
||||
sWorld.SendZoneText(ZM_GRAVEYARD_ZONE,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_ZM_CAPTURE_GY_H));
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ const uint32 OutdoorPvPZMBuffZonesNum = 5;
|
||||
// the buff is cast in these zones
|
||||
const uint32 OutdoorPvPZMBuffZones[OutdoorPvPZMBuffZonesNum] = {3521,3607,3717,3715,3716};
|
||||
// cast on the players of the controlling faction
|
||||
const uint32 ZM_CAPTURE_BUFF = 33779; // twin spire blessing
|
||||
#define ZM_CAPTURE_BUFF 33779 // twin spire blessing
|
||||
// spell that the field scout casts on the player to carry the flag
|
||||
const uint32 ZM_BATTLE_STANDARD_A = 32430;
|
||||
// spell that the field scout casts on the player to carry the flag
|
||||
@@ -204,7 +204,6 @@ public:
|
||||
void FillInitialWorldStates(WorldPacket &data);
|
||||
void SendRemoveWorldStates(Player * plr);
|
||||
void HandleKillImpl(Player * plr, Unit * killed);
|
||||
void BuffTeam(uint32 team);
|
||||
private:
|
||||
OutdoorPvPObjectiveZM_GraveYard * m_GraveYard;
|
||||
uint32 m_AllianceTowersControlled;
|
||||
|
||||
@@ -1820,6 +1820,7 @@ void Player::RemoveFromWorld()
|
||||
///- Release charmed creatures, unsummon totems and remove pets/guardians
|
||||
StopCastingCharm();
|
||||
StopCastingBindSight();
|
||||
sOutdoorPvPMgr.HandlePlayerLeaveZone(this, m_zoneUpdateId);
|
||||
}
|
||||
|
||||
for(int i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; ++i)
|
||||
|
||||
@@ -6593,6 +6593,11 @@ void AuraEffect::PeriodicDummyTick()
|
||||
// case 50493: break;
|
||||
// // Love Rocket Barrage
|
||||
// case 50530: break;
|
||||
// Tenacity
|
||||
case 58549:
|
||||
case 59911:
|
||||
GetParentAura()->RefreshAura();
|
||||
break;
|
||||
// Exist more after, need add later
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -13796,6 +13796,18 @@ void Unit::AddAura(uint32 spellId, Unit* target)
|
||||
target->AddAura(Aur);
|
||||
}
|
||||
|
||||
void Unit::SetAuraStack(uint32 spellId, Unit *target, uint32 stack)
|
||||
{
|
||||
Aura *aur = target->GetAura(spellId, GetGUID());
|
||||
if(!aur)
|
||||
{
|
||||
AddAura(spellId, target);
|
||||
aur = target->GetAura(spellId, GetGUID());
|
||||
}
|
||||
if(aur && stack)
|
||||
aur->SetStackAmount(stack);
|
||||
}
|
||||
|
||||
Aura * Unit::AddAuraEffect(const SpellEntry * spellInfo, uint8 effIndex, Unit* caster, int32 * basePoints, Unit * source)
|
||||
{
|
||||
// can't do that for passive auras - they stack from same caster so there is no way to get exact aura which should get effect
|
||||
|
||||
@@ -1189,6 +1189,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
|
||||
void CastCustomSpell(uint32 spellId, CustomSpellValues const &value, Unit* Victim = NULL, bool triggered = true, Item *castItem = NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0);
|
||||
void CastSpell(GameObject *go, uint32 spellId, bool triggered, Item *castItem = NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0);
|
||||
void AddAura(uint32 spellId, Unit *target);
|
||||
void SetAuraStack(uint32 spellId, Unit *target, uint32 stack);
|
||||
void HandleAuraEffect(AuraEffect * aureff, bool apply);
|
||||
Aura *AddAuraEffect(const SpellEntry * spellInfo, uint8 effIndex, Unit* caster, int32 * basePoints=NULL, Unit * source=NULL);
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@ bool OPvPWintergrasp::SetupOutdoorPvP()
|
||||
}
|
||||
|
||||
m_defender = TeamId(rand()%2);
|
||||
m_attacker = (m_defender == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -45,18 +44,21 @@ void OPvPWintergrasp::HandlePlayerEnterZone(Player * plr, uint32 zone)
|
||||
|
||||
for(AreaPOIList::iterator itr = areaPOIs.begin(); itr != areaPOIs.end(); ++itr)
|
||||
{
|
||||
TeamId team = ((*itr)->x > POS_X_CENTER ? m_defender : m_attacker);
|
||||
TeamId team = ((*itr)->x > POS_X_CENTER ? m_defender : OTHER_TEAM(m_defender));
|
||||
plr->SendUpdateWorldState((*itr)->worldState, AreaPOIIconId[team][DAMAGE_INTACT]);
|
||||
}
|
||||
|
||||
OutdoorPvP::HandlePlayerEnterZone(plr, zone);
|
||||
UpdateTenacityStack();
|
||||
}
|
||||
|
||||
void OPvPWintergrasp::HandlePlayerLeaveZone(Player * plr, uint32 zone)
|
||||
{
|
||||
if(!plr->GetSession()->PlayerLogout() && plr->m_Vehicle) // dismiss in change zone case
|
||||
plr->m_Vehicle->Dismiss();
|
||||
plr->RemoveAura(SPELL_TENACITY);
|
||||
OutdoorPvP::HandlePlayerLeaveZone(plr, zone);
|
||||
UpdateTenacityStack();
|
||||
}
|
||||
|
||||
void OPvPWintergrasp::HandleKill(Player *killer, Unit *victim)
|
||||
@@ -91,3 +93,42 @@ void OPvPWintergrasp::HandleKill(Player *killer, Unit *victim)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OPvPWintergrasp::UpdateTenacityStack()
|
||||
{
|
||||
uint32 allianceNum = m_players[TEAM_ALLIANCE].size();
|
||||
uint32 hordeNum = m_players[TEAM_HORDE].size();
|
||||
|
||||
int32 newStack = 0;
|
||||
if(allianceNum && hordeNum)
|
||||
{
|
||||
if(allianceNum > hordeNum)
|
||||
newStack = allianceNum / hordeNum - 1;
|
||||
else if(allianceNum < hordeNum)
|
||||
newStack = 1 - int32(hordeNum / allianceNum);
|
||||
}
|
||||
|
||||
if(newStack == m_tenacityStack)
|
||||
return;
|
||||
|
||||
// Remove old buff
|
||||
if(m_tenacityStack > 0)
|
||||
{
|
||||
if(newStack <= 0)
|
||||
TeamCastSpell(TEAM_ALLIANCE, -SPELL_TENACITY);
|
||||
}
|
||||
else if(m_tenacityStack < 0)
|
||||
{
|
||||
if(newStack >= 0)
|
||||
TeamCastSpell(TEAM_HORDE, -SPELL_TENACITY);
|
||||
}
|
||||
m_tenacityStack = newStack;
|
||||
|
||||
// Apply new buff
|
||||
if(newStack)
|
||||
{
|
||||
TeamId team = newStack > 0 ? TEAM_ALLIANCE : TEAM_HORDE;
|
||||
for(PlayerSet::iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||
(*itr)->SetAuraStack(SPELL_TENACITY, *itr, newStack);
|
||||
}
|
||||
}
|
||||
|
||||
+7
-10
@@ -29,15 +29,8 @@
|
||||
#define SPELL_CORPORAL 33280
|
||||
#define SPELL_LIEUTENANT 55629
|
||||
|
||||
#define SPELL_TENICITY 58549
|
||||
#define SPELL_TENICITY_VEHICLE 59911
|
||||
|
||||
enum TeamId
|
||||
{
|
||||
TEAM_ALLIANCE = 0,
|
||||
TEAM_HORDE,
|
||||
TEAM_NEUTRAL,
|
||||
};
|
||||
#define SPELL_TENACITY 58549
|
||||
#define SPELL_TENACITY_VEHICLE 59911
|
||||
|
||||
enum DamageState
|
||||
{
|
||||
@@ -65,14 +58,18 @@ class OPvPWintergrasp : public OutdoorPvP
|
||||
typedef std::list<const AreaPOIEntry *> AreaPOIList;
|
||||
typedef std::map<uint32, BuildingState *> BuildingStateMap;
|
||||
public:
|
||||
explicit OPvPWintergrasp() : m_tenacityStack(0) {}
|
||||
bool SetupOutdoorPvP();
|
||||
void HandlePlayerEnterZone(Player *plr, uint32 zone);
|
||||
void HandlePlayerLeaveZone(Player *plr, uint32 zone);
|
||||
void HandleKill(Player *killer, Unit *victim);
|
||||
protected:
|
||||
TeamId m_defender, m_attacker;
|
||||
TeamId m_defender;
|
||||
int32 m_tenacityStack;
|
||||
AreaPOIList areaPOIs;
|
||||
BuildingStateMap buildingStates;
|
||||
|
||||
void UpdateTenacityStack();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user