Wintergrasp: Normalization of names to fit OutdoorPvP system

--HG--
branch : trunk
This commit is contained in:
spp
2009-12-14 03:53:38 +01:00
parent 3a46634a20
commit 51a1a0aca9
10 changed files with 175 additions and 192 deletions
@@ -15,7 +15,7 @@
*/ */
#include "precompiled.h" #include "precompiled.h"
#include "Wintergrasp.h" #include "OutdoorPvPWG.h"
#define GOSSIP_HELLO_DEMO1 "Build catapult." #define GOSSIP_HELLO_DEMO1 "Build catapult."
#define GOSSIP_HELLO_DEMO2 "Build demolisher." #define GOSSIP_HELLO_DEMO2 "Build demolisher."
+3 -3
View File
@@ -36,7 +36,7 @@
#include "Opcodes.h" #include "Opcodes.h"
// Temporal fix to wintergrasp spirit guides till 3.2 // Temporal fix to wintergrasp spirit guides till 3.2
#include "Wintergrasp.h" #include "OutdoorPvPWG.h"
#include "OutdoorPvPMgr.h" #include "OutdoorPvPMgr.h"
// WG end // WG end
@@ -601,7 +601,7 @@ void WorldSession::HandleAreaSpiritHealerQueryOpcode( WorldPacket & recv_data )
{ // Wintergrasp Hack till 3.2 and it's implemented as BG { // Wintergrasp Hack till 3.2 and it's implemented as BG
if (GetPlayer()->GetZoneId() == 4197) if (GetPlayer()->GetZoneId() == 4197)
{ {
OPvPWintergrasp *pvpWG = (OPvPWintergrasp*)sOutdoorPvPMgr.GetOutdoorPvPToZoneId(4197); OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)sOutdoorPvPMgr.GetOutdoorPvPToZoneId(4197);
if (pvpWG && pvpWG->isWarTime()) if (pvpWG && pvpWG->isWarTime())
pvpWG->SendAreaSpiritHealerQueryOpcode(_player, guid); pvpWG->SendAreaSpiritHealerQueryOpcode(_player, guid);
} }
@@ -632,7 +632,7 @@ void WorldSession::HandleAreaSpiritHealerQueueOpcode( WorldPacket & recv_data )
{ // Wintergrasp Hack till 3.2 and it's implemented as BG { // Wintergrasp Hack till 3.2 and it's implemented as BG
if (GetPlayer()->GetZoneId() == 4197) if (GetPlayer()->GetZoneId() == 4197)
{ {
OPvPWintergrasp *pvpWG = (OPvPWintergrasp*)sOutdoorPvPMgr.GetOutdoorPvPToZoneId(4197); OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)sOutdoorPvPMgr.GetOutdoorPvPToZoneId(4197);
if (pvpWG && pvpWG->isWarTime()) if (pvpWG && pvpWG->isWarTime())
pvpWG->AddPlayerToResurrectQueue(guid, _player->GetGUID()); pvpWG->AddPlayerToResurrectQueue(guid, _player->GetGUID());
} }
+2 -2
View File
@@ -192,6 +192,8 @@ SET(game_STAT_SRCS
OutdoorPvPTF.h OutdoorPvPTF.h
OutdoorPvPZM.cpp OutdoorPvPZM.cpp
OutdoorPvPZM.h OutdoorPvPZM.h
OutdoorPvPWG.cpp
OutdoorPvPWG.h
Path.h Path.h
PetAI.cpp PetAI.cpp
PetAI.h PetAI.h
@@ -290,8 +292,6 @@ SET(game_STAT_SRCS
GroupReference.h GroupReference.h
GroupRefManager.h GroupRefManager.h
OutdoorPvPImpl.h OutdoorPvPImpl.h
Wintergrasp.h
Wintergrasp.cpp
ZoneScript.h ZoneScript.h
) )
add_definitions(-fopenmp) add_definitions(-fopenmp)
+9 -9
View File
@@ -40,7 +40,7 @@
#include <fstream> #include <fstream>
#include <map> #include <map>
#include "GlobalEvents.h" #include "GlobalEvents.h"
#include "Wintergrasp.h" #include "OutdoorPvPWG.h"
#include "OutdoorPvPMgr.h" #include "OutdoorPvPMgr.h"
#include "TargetedMovementGenerator.h" // for HandleNpcUnFollowCommand #include "TargetedMovementGenerator.h" // for HandleNpcUnFollowCommand
@@ -4240,7 +4240,7 @@ bool ChatHandler::HandleNpcSetLinkCommand(const char* args)
bool ChatHandler::HandleWintergraspStatusCommand(const char* args) bool ChatHandler::HandleWintergraspStatusCommand(const char* args)
{ {
OPvPWintergrasp *pvpWG = (OPvPWintergrasp*)sOutdoorPvPMgr.GetOutdoorPvPToZoneId(4197); OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)sOutdoorPvPMgr.GetOutdoorPvPToZoneId(4197);
if (!pvpWG || !sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_ENABLED)) if (!pvpWG || !sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_ENABLED))
{ {
@@ -4250,7 +4250,7 @@ bool ChatHandler::HandleWintergraspStatusCommand(const char* args)
} }
PSendSysMessage(LANG_BG_WG_STATUS, objmgr.GetTrinityStringForDBCLocale( PSendSysMessage(LANG_BG_WG_STATUS, objmgr.GetTrinityStringForDBCLocale(
pvpWG->GetTeam() == TEAM_ALLIANCE ? LANG_BG_AB_ALLY : LANG_BG_AB_HORDE), pvpWG->getDefenderTeam() == TEAM_ALLIANCE ? LANG_BG_AB_ALLY : LANG_BG_AB_HORDE),
secsToTimeString(pvpWG->GetTimer(), true).c_str(), secsToTimeString(pvpWG->GetTimer(), true).c_str(),
pvpWG->isWarTime() ? "Yes" : "No", pvpWG->isWarTime() ? "Yes" : "No",
pvpWG->GetNumPlayersH(), pvpWG->GetNumPlayersH(),
@@ -4260,7 +4260,7 @@ bool ChatHandler::HandleWintergraspStatusCommand(const char* args)
bool ChatHandler::HandleWintergraspStartCommand(const char* args) bool ChatHandler::HandleWintergraspStartCommand(const char* args)
{ {
OPvPWintergrasp *pvpWG = (OPvPWintergrasp*)sOutdoorPvPMgr.GetOutdoorPvPToZoneId(4197); OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)sOutdoorPvPMgr.GetOutdoorPvPToZoneId(4197);
if (!pvpWG || !sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_ENABLED)) if (!pvpWG || !sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_ENABLED))
{ {
@@ -4275,7 +4275,7 @@ bool ChatHandler::HandleWintergraspStartCommand(const char* args)
bool ChatHandler::HandleWintergraspStopCommand(const char* args) bool ChatHandler::HandleWintergraspStopCommand(const char* args)
{ {
OPvPWintergrasp *pvpWG = (OPvPWintergrasp*)sOutdoorPvPMgr.GetOutdoorPvPToZoneId(4197); OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)sOutdoorPvPMgr.GetOutdoorPvPToZoneId(4197);
if (!pvpWG || !sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_ENABLED)) if (!pvpWG || !sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_ENABLED))
{ {
@@ -4293,7 +4293,7 @@ bool ChatHandler::HandleWintergraspEnableCommand(const char* args)
if(!*args) if(!*args)
return false; return false;
OPvPWintergrasp *pvpWG = (OPvPWintergrasp*)sOutdoorPvPMgr.GetOutdoorPvPToZoneId(4197); OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)sOutdoorPvPMgr.GetOutdoorPvPToZoneId(4197);
if (!pvpWG || !sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_ENABLED)) if (!pvpWG || !sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_ENABLED))
{ {
@@ -4335,7 +4335,7 @@ bool ChatHandler::HandleWintergraspTimerCommand(const char* args)
if(!*args) if(!*args)
return false; return false;
OPvPWintergrasp *pvpWG = (OPvPWintergrasp*)sOutdoorPvPMgr.GetOutdoorPvPToZoneId(4197); OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)sOutdoorPvPMgr.GetOutdoorPvPToZoneId(4197);
if (!pvpWG) if (!pvpWG)
{ {
@@ -4367,7 +4367,7 @@ bool ChatHandler::HandleWintergraspTimerCommand(const char* args)
bool ChatHandler::HandleWintergraspSwitchTeamCommand(const char* args) bool ChatHandler::HandleWintergraspSwitchTeamCommand(const char* args)
{ {
OPvPWintergrasp *pvpWG = (OPvPWintergrasp*)sOutdoorPvPMgr.GetOutdoorPvPToZoneId(4197); OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)sOutdoorPvPMgr.GetOutdoorPvPToZoneId(4197);
if (!pvpWG) if (!pvpWG)
{ {
@@ -4378,6 +4378,6 @@ bool ChatHandler::HandleWintergraspSwitchTeamCommand(const char* args)
uint32 timer = pvpWG->GetTimer(); uint32 timer = pvpWG->GetTimer();
pvpWG->forceChangeTeam(); pvpWG->forceChangeTeam();
pvpWG->setTimer(timer); pvpWG->setTimer(timer);
PSendSysMessage(LANG_BG_WG_SWITCH_FACTION, GetTrinityString(pvpWG->GetTeam() == TEAM_ALLIANCE ? LANG_BG_AB_ALLY : LANG_BG_AB_HORDE)); PSendSysMessage(LANG_BG_WG_SWITCH_FACTION, GetTrinityString(pvpWG->getDefenderTeam() == TEAM_ALLIANCE ? LANG_BG_AB_ALLY : LANG_BG_AB_HORDE));
return true; return true;
} }
+1 -1
View File
@@ -33,7 +33,7 @@ enum OutdoorPvPTypes
OUTDOOR_PVP_ZM, OUTDOOR_PVP_ZM,
OUTDOOR_PVP_SI, OUTDOOR_PVP_SI,
OUTDOOR_PVP_EP, OUTDOOR_PVP_EP,
OPVP_WINTERGRASP, OUTDOOR_PVP_WG,
OUTDOOR_PVP_NR, OUTDOOR_PVP_NR,
}; };
+2 -2
View File
@@ -23,7 +23,7 @@
#include "OutdoorPvPZM.h" #include "OutdoorPvPZM.h"
#include "OutdoorPvPSI.h" #include "OutdoorPvPSI.h"
#include "OutdoorPvPEP.h" #include "OutdoorPvPEP.h"
#include "Wintergrasp.h" #include "OutdoorPvPWG.h"
#include "Player.h" #include "Player.h"
#include "Policies/SingletonImp.h" #include "Policies/SingletonImp.h"
@@ -125,7 +125,7 @@ void OutdoorPvPMgr::InitOutdoorPvP()
sLog.outDebug("OutdoorPvP : EP successfully initiated."); sLog.outDebug("OutdoorPvP : EP successfully initiated.");
} }
pOP = new OPvPWintergrasp; pOP = new OutdoorPvPWG;
// respawn, init variables // respawn, init variables
if(!pOP->SetupOutdoorPvP()) if(!pOP->SetupOutdoorPvP())
{ {
@@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include "Wintergrasp.h" #include "OutdoorPvPWG.h"
#include "SpellAuras.h" #include "SpellAuras.h"
#include "Vehicle.h" #include "Vehicle.h"
#include "ObjectMgr.h" #include "ObjectMgr.h"
@@ -24,41 +24,7 @@
#include "Chat.h" #include "Chat.h"
#include "MapManager.h" #include "MapManager.h"
typedef uint32 TeamPair[2]; void _LoadTeamPair(TeamPairMap &pairMap, const TeamPair *pair)
enum WintergraspQuest
{
A_VICTORY_IN_WG = 13181,
H_VICTORY_IN_WG = 13183,
CRE_PVP_KILL = 31086, //Quest Objective
CRE_PVP_KILL_V = 31093, //Quest Objective
};
enum CreatureEntry
{
CRE_ENG_A = 30499,
CRE_ENG_H = 30400,
CRE_SPI_A = 31842,
CRE_SPI_H = 31841,
};
const TeamPair CreatureEntryPair[] =
{
{32307, 32308}, // Guards
{30739, 30740}, // Champions
{32296, 32294}, // Quartermaster
{32615, 32626}, // Warbringer & Brigadier General
{0,0} // Do not delete Used in LoadTeamPair
};
const TeamPair GODisplayPair[] =
{
{5651, 5652},
{8256, 8257},
{0,0} // Do not delete Used in LoadTeamPair
};
void LoadTeamPair(TeamPairMap &pairMap, const TeamPair *pair)
{ {
while((*pair)[0]) while((*pair)[0])
{ {
@@ -68,7 +34,7 @@ void LoadTeamPair(TeamPairMap &pairMap, const TeamPair *pair)
} }
} }
void RespawnCreatureIfNeeded(Creature *cr, uint32 entry) void _RespawnCreatureIfNeeded(Creature *cr, uint32 entry)
{ {
if (cr) if (cr)
{ {
@@ -79,25 +45,14 @@ void RespawnCreatureIfNeeded(Creature *cr, uint32 entry)
} }
} }
#define REMOVE_WARTIME_AURAS(p) (p)->RemoveAura(SPELL_RECRUIT);\ OutdoorPvPWG::OutdoorPvPWG()
(p)->RemoveAura(SPELL_CORPORAL);(p)->RemoveAura(SPELL_LIEUTENANT);\
(p)->RemoveAura(SPELL_TOWER_CONTROL);\
(p)->RemoveAura(SPELL_SPIRITUAL_IMMUNITY)
// Visual defines, easier to understand code
#define getDefenderTeam() m_defender
#define getAttackerTeam() OTHER_TEAM(m_defender)
typedef std::list<const AreaPOIEntry *> AreaPOIList;
OPvPWintergrasp::OPvPWintergrasp()
{ {
m_TypeId = OPVP_WINTERGRASP; m_TypeId = OUTDOOR_PVP_WG;
m_LastResurrectTime = 0; // Temporal copy of BG system till 3.2 m_LastResurrectTime = 0; // Temporal copy of BG system till 3.2
} }
bool OPvPWintergrasp::SetupOutdoorPvP() bool OutdoorPvPWG::SetupOutdoorPvP()
{ {
if (!sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_ENABLED)) if (!sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_ENABLED))
{ {
@@ -340,7 +295,7 @@ bool OPvPWintergrasp::SetupOutdoorPvP()
} }
// Inside fortress won't be capturable // Inside fortress won't be capturable
SiegeWorkshop *workshop = new SiegeWorkshop(this, m_buildingStates[guid]); OPvPCapturePointWG *workshop = new OPvPCapturePointWG(this, m_buildingStates[guid]);
if (goData->posX < POS_X_CENTER && !workshop->SetCapturePointData(capturePointEntry, goData->mapid, goData->posX + 40 * cos(goData->orientation + M_PI / 2), goData->posY + 40 * sin(goData->orientation + M_PI / 2), goData->posZ)) if (goData->posX < POS_X_CENTER && !workshop->SetCapturePointData(capturePointEntry, goData->mapid, goData->posX + 40 * cos(goData->orientation + M_PI / 2), goData->posY + 40 * sin(goData->orientation + M_PI / 2), goData->posZ))
{ {
delete workshop; delete workshop;
@@ -429,16 +384,11 @@ bool OPvPWintergrasp::SetupOutdoorPvP()
++itr; ++itr;
} }
//for (AreaPOIList::iterator itr = areaPOIs.begin(); itr != areaPOIs.end(); ++itr) //Titan Relic
// sLog.outError("not assigned %u %f %f", (*itr)->id, (*itr)->x, (*itr)->y);
//gameeventmgr.StartInternalEvent(GameEventWintergraspDefender[getDefenderTeam()]);
//Titan Relic eventid = 19982
objmgr.AddGOData(192829, 571, 5440, 2840.8, 420.43 + 10, 0); objmgr.AddGOData(192829, 571, 5440, 2840.8, 420.43 + 10, 0);
LoadTeamPair(m_goDisplayPair, GODisplayPair); _LoadTeamPair(m_goDisplayPair, OutdoorPvPWGGODisplayPair);
LoadTeamPair(m_creEntryPair, CreatureEntryPair); _LoadTeamPair(m_creEntryPair, OutdoorPvPWGCreEntryPair);
m_wartime = false; m_wartime = false;
m_timer = sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_START_TIME) * MINUTE * IN_MILISECONDS; m_timer = sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_START_TIME) * MINUTE * IN_MILISECONDS;
@@ -454,9 +404,9 @@ bool OPvPWintergrasp::SetupOutdoorPvP()
return true; return true;
} }
void OPvPWintergrasp::ProcessEvent(GameObject *obj, uint32 eventId) void OutdoorPvPWG::ProcessEvent(GameObject *obj, uint32 eventId)
{ {
if (obj->GetEntry() == 192829) if (obj->GetEntry() == 192829) // Titan Relic
{ {
if (obj->GetGOInfo()->goober.eventId == eventId && isWarTime() && m_gate && m_gate->damageState == DAMAGE_DESTROYED) if (obj->GetGOInfo()->goober.eventId == eventId && isWarTime() && m_gate && m_gate->damageState == DAMAGE_DESTROYED)
{ {
@@ -589,14 +539,14 @@ void OPvPWintergrasp::ProcessEvent(GameObject *obj, uint32 eventId)
} }
} }
void OPvPWintergrasp::RemoveOfflinePlayerWGAuras() void OutdoorPvPWG::RemoveOfflinePlayerWGAuras()
{ {
// if server crashed while in battle there could be players with rank or tenacity // if server crashed while in battle there could be players with rank or tenacity
CharacterDatabase.PExecute("DELETE FROM character_aura WHERE spell IN (%u, %u, %u, %u, %u)", CharacterDatabase.PExecute("DELETE FROM character_aura WHERE spell IN (%u, %u, %u, %u, %u)",
SPELL_RECRUIT, SPELL_CORPORAL, SPELL_LIEUTENANT, SPELL_TENACITY, SPELL_TOWER_CONTROL); SPELL_RECRUIT, SPELL_CORPORAL, SPELL_LIEUTENANT, SPELL_TENACITY, SPELL_TOWER_CONTROL);
} }
void OPvPWintergrasp::ModifyWorkshopCount(TeamId team, bool add) void OutdoorPvPWG::ModifyWorkshopCount(TeamId team, bool add)
{ {
if (team == TEAM_NEUTRAL) if (team == TEAM_NEUTRAL)
return; return;
@@ -606,12 +556,12 @@ void OPvPWintergrasp::ModifyWorkshopCount(TeamId team, bool add)
else if (m_workshopCount[team]) else if (m_workshopCount[team])
--m_workshopCount[team]; --m_workshopCount[team];
else else
sLog.outError("OPvPWintergrasp::ModifyWorkshopCount: negative workshop count!"); sLog.outError("OutdoorPvPWG::ModifyWorkshopCount: negative workshop count!");
SendUpdateWorldState(MaxVehNumWorldState[team], m_workshopCount[team] * MAX_VEHICLE_PER_WORKSHOP); SendUpdateWorldState(MaxVehNumWorldState[team], m_workshopCount[team] * MAX_VEHICLE_PER_WORKSHOP);
} }
uint32 OPvPWintergrasp::GetCreatureEntry(uint32 guidlow, const CreatureData *data) uint32 OutdoorPvPWG::GetCreatureEntry(uint32 guidlow, const CreatureData *data)
{ {
if (getDefenderTeam() == TEAM_ALLIANCE) if (getDefenderTeam() == TEAM_ALLIANCE)
{ {
@@ -625,7 +575,7 @@ uint32 OPvPWintergrasp::GetCreatureEntry(uint32 guidlow, const CreatureData *dat
return data->id; return data->id;
} }
WintergraspCreType OPvPWintergrasp::GetCreatureType(uint32 entry) const OutdoorPvPWGCreType OutdoorPvPWG::GetCreatureType(uint32 entry) const
{ {
// VEHICLES, GUARDS and TURRETS gives kill credit // VEHICLES, GUARDS and TURRETS gives kill credit
// OTHER Not in wartime // OTHER Not in wartime
@@ -671,7 +621,7 @@ WintergraspCreType OPvPWintergrasp::GetCreatureType(uint32 entry) const
} }
} }
void OPvPWintergrasp::OnCreatureCreate(Creature *creature, bool add) void OutdoorPvPWG::OnCreatureCreate(Creature *creature, bool add)
{ {
uint32 entry = creature->GetEntry(); uint32 entry = creature->GetEntry();
switch(GetCreatureType(entry)) switch(GetCreatureType(entry))
@@ -693,7 +643,7 @@ void OPvPWintergrasp::OnCreatureCreate(Creature *creature, bool add)
if (uint32 engLowguid = GUID_LOPART(((TempSummon*)creature)->GetSummonerGUID())) if (uint32 engLowguid = GUID_LOPART(((TempSummon*)creature)->GetSummonerGUID()))
{ {
if (SiegeWorkshop *workshop = GetWorkshopByEngGuid(engLowguid)) if (OPvPCapturePointWG *workshop = GetWorkshopByEngGuid(engLowguid))
{ {
if (CanBuildVehicle(workshop)) if (CanBuildVehicle(workshop))
{ {
@@ -733,7 +683,7 @@ void OPvPWintergrasp::OnCreatureCreate(Creature *creature, bool add)
case CREATURE_ENGINEER: case CREATURE_ENGINEER:
for (OutdoorPvP::OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) for (OutdoorPvP::OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
{ {
if (SiegeWorkshop *workshop = dynamic_cast<SiegeWorkshop*>(itr->second)) if (OPvPCapturePointWG *workshop = dynamic_cast<OPvPCapturePointWG*>(itr->second))
if (workshop->m_engGuid == creature->GetDBTableGUIDLow()) if (workshop->m_engGuid == creature->GetDBTableGUIDLow())
{ {
workshop->m_engineer = add ? creature : NULL; workshop->m_engineer = add ? creature : NULL;
@@ -744,7 +694,7 @@ void OPvPWintergrasp::OnCreatureCreate(Creature *creature, bool add)
case CREATURE_SPIRIT_GUIDE: case CREATURE_SPIRIT_GUIDE:
for (OutdoorPvP::OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) for (OutdoorPvP::OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
{ {
if (SiegeWorkshop *workshop = dynamic_cast<SiegeWorkshop*>(itr->second)) if (OPvPCapturePointWG *workshop = dynamic_cast<OPvPCapturePointWG*>(itr->second))
if (workshop->m_spiGuid == creature->GetDBTableGUIDLow()) if (workshop->m_spiGuid == creature->GetDBTableGUIDLow())
{ {
workshop->m_spiritguide = add ? creature : NULL; workshop->m_spiritguide = add ? creature : NULL;
@@ -766,7 +716,7 @@ void OPvPWintergrasp::OnCreatureCreate(Creature *creature, bool add)
} }
} }
void OPvPWintergrasp::OnGameObjectCreate(GameObject *go, bool add) void OutdoorPvPWG::OnGameObjectCreate(GameObject *go, bool add)
{ {
OutdoorPvP::OnGameObjectCreate(go, add); OutdoorPvP::OnGameObjectCreate(go, add);
@@ -798,7 +748,7 @@ void OPvPWintergrasp::OnGameObjectCreate(GameObject *go, bool add)
} }
} }
void OPvPWintergrasp::UpdateAllWorldObject() void OutdoorPvPWG::UpdateAllWorldObject()
{ {
// update cre and go factions // update cre and go factions
for (GameObjectSet::iterator itr = m_gobjects.begin(); itr != m_gobjects.end(); ++itr) for (GameObjectSet::iterator itr = m_gobjects.begin(); itr != m_gobjects.end(); ++itr)
@@ -813,11 +763,11 @@ void OPvPWintergrasp::UpdateAllWorldObject()
// update capture points // update capture points
for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
if (SiegeWorkshop *workshop = dynamic_cast<SiegeWorkshop*>(itr->second)) if (OPvPCapturePointWG *workshop = dynamic_cast<OPvPCapturePointWG*>(itr->second))
workshop->SetTeamByBuildingState(); workshop->SetTeamByBuildingState();
} }
void OPvPWintergrasp::RebuildAllBuildings() void OutdoorPvPWG::RebuildAllBuildings()
{ {
for (BuildingStateMap::const_iterator itr = m_buildingStates.begin(); itr != m_buildingStates.end(); ++itr) for (BuildingStateMap::const_iterator itr = m_buildingStates.begin(); itr != m_buildingStates.end(); ++itr)
{ {
@@ -845,7 +795,7 @@ void OPvPWintergrasp::RebuildAllBuildings()
m_towerDestroyedCount[TEAM_HORDE] = 0; m_towerDestroyedCount[TEAM_HORDE] = 0;
} }
void OPvPWintergrasp::SendInitWorldStatesTo(Player *player) const void OutdoorPvPWG::SendInitWorldStatesTo(Player *player) const
{ {
WorldPacket data(SMSG_INIT_WORLD_STATES, (4+4+4+2+(m_buildingStates.size()*8))); WorldPacket data(SMSG_INIT_WORLD_STATES, (4+4+4+2+(m_buildingStates.size()*8)));
data << uint32(571); data << uint32(571);
@@ -875,7 +825,7 @@ void OPvPWintergrasp::SendInitWorldStatesTo(Player *player) const
BroadcastPacket(data); BroadcastPacket(data);
} }
void OPvPWintergrasp::BroadcastStateChange(BuildingState *state) const void OutdoorPvPWG::BroadcastStateChange(BuildingState *state) const
{ {
if (m_sendUpdate) if (m_sendUpdate)
for (uint32 team = 0; team < 2; ++team) for (uint32 team = 0; team < 2; ++team)
@@ -884,7 +834,7 @@ void OPvPWintergrasp::BroadcastStateChange(BuildingState *state) const
} }
// Called at Start and Battle End // Called at Start and Battle End
bool OPvPWintergrasp::UpdateCreatureInfo(Creature *creature) bool OutdoorPvPWG::UpdateCreatureInfo(Creature *creature)
{ {
if (!creature) if (!creature)
return false; return false;
@@ -946,7 +896,7 @@ bool OPvPWintergrasp::UpdateCreatureInfo(Creature *creature)
if (itr != m_creEntryPair.end()) if (itr != m_creEntryPair.end())
{ {
entry = getDefenderTeam() == TEAM_ALLIANCE ? itr->second : itr->first; entry = getDefenderTeam() == TEAM_ALLIANCE ? itr->second : itr->first;
RespawnCreatureIfNeeded(creature, entry); _RespawnCreatureIfNeeded(creature, entry);
} }
return false; return false;
} }
@@ -955,7 +905,7 @@ bool OPvPWintergrasp::UpdateCreatureInfo(Creature *creature)
} }
} }
bool OPvPWintergrasp::UpdateQuestGiverPosition(uint32 guid, Creature *creature) bool OutdoorPvPWG::UpdateQuestGiverPosition(uint32 guid, Creature *creature)
{ {
assert(guid); assert(guid);
Position pos = m_qgPosMap[std::pair<uint32, bool>(guid, getDefenderTeam() == TEAM_HORDE)]; Position pos = m_qgPosMap[std::pair<uint32, bool>(guid, getDefenderTeam() == TEAM_HORDE)];
@@ -989,7 +939,7 @@ bool OPvPWintergrasp::UpdateQuestGiverPosition(uint32 guid, Creature *creature)
// Return false = Need to rebuild at battle End/Start // Return false = Need to rebuild at battle End/Start
// true = no need to rebuild (ie: Banners or teleporters) // true = no need to rebuild (ie: Banners or teleporters)
bool OPvPWintergrasp::UpdateGameObjectInfo(GameObject *go) const bool OutdoorPvPWG::UpdateGameObjectInfo(GameObject *go) const
{ {
uint32 attFaction = 35; uint32 attFaction = 35;
uint32 defFaction = 35; uint32 defFaction = 35;
@@ -1020,7 +970,7 @@ bool OPvPWintergrasp::UpdateGameObjectInfo(GameObject *go) const
go->SetUInt32Value(GAMEOBJECT_FACTION, attFaction); go->SetUInt32Value(GAMEOBJECT_FACTION, attFaction);
return false; return false;
case 8208: // Goblin Workshop case 8208: // Goblin Workshop
SiegeWorkshop *workshop = GetWorkshopByGOGuid(go->GetGUID()); OPvPCapturePointWG *workshop = GetWorkshopByGOGuid(go->GetGUID());
if (workshop) if (workshop)
go->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[workshop->m_buildingState->GetTeam()]); go->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[workshop->m_buildingState->GetTeam()]);
return false; return false;
@@ -1037,7 +987,7 @@ bool OPvPWintergrasp::UpdateGameObjectInfo(GameObject *go) const
return false; return false;
} }
void OPvPWintergrasp::HandlePlayerEnterZone(Player * plr, uint32 zone) void OutdoorPvPWG::HandlePlayerEnterZone(Player * plr, uint32 zone)
{ {
if (!sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_ENABLED)) if (!sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_ENABLED))
return; return;
@@ -1068,7 +1018,7 @@ void OPvPWintergrasp::HandlePlayerEnterZone(Player * plr, uint32 zone)
} }
// Reapply Auras if needed // Reapply Auras if needed
void OPvPWintergrasp::HandlePlayerResurrects(Player * plr, uint32 zone) void OutdoorPvPWG::HandlePlayerResurrects(Player * plr, uint32 zone)
{ {
if (!sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_ENABLED)) if (!sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_ENABLED))
return; return;
@@ -1106,7 +1056,7 @@ void OPvPWintergrasp::HandlePlayerResurrects(Player * plr, uint32 zone)
OutdoorPvP::HandlePlayerResurrects(plr, zone); OutdoorPvP::HandlePlayerResurrects(plr, zone);
} }
void OPvPWintergrasp::HandlePlayerLeaveZone(Player * plr, uint32 zone) void OutdoorPvPWG::HandlePlayerLeaveZone(Player * plr, uint32 zone)
{ {
if (!sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_ENABLED)) if (!sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_ENABLED))
return; return;
@@ -1115,14 +1065,18 @@ void OPvPWintergrasp::HandlePlayerLeaveZone(Player * plr, uint32 zone)
{ {
if (plr->GetVehicle()) // dismiss in change zone case if (plr->GetVehicle()) // dismiss in change zone case
plr->GetVehicle()->Dismiss(); plr->GetVehicle()->Dismiss();
REMOVE_WARTIME_AURAS(plr); plr->RemoveAurasDueToSpell(SPELL_RECRUIT);
plr->RemoveAurasDueToSpell(SPELL_CORPORAL);
plr->RemoveAurasDueToSpell(SPELL_LIEUTENANT);
plr->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL);
plr->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY);
} }
plr->RemoveAurasDueToSpell(SPELL_TENACITY); plr->RemoveAurasDueToSpell(SPELL_TENACITY);
OutdoorPvP::HandlePlayerLeaveZone(plr, zone); OutdoorPvP::HandlePlayerLeaveZone(plr, zone);
UpdateTenacityStack(); UpdateTenacityStack();
} }
void OPvPWintergrasp::PromotePlayer(Player *killer) const void OutdoorPvPWG::PromotePlayer(Player *killer) const
{ {
Aura *aur; Aura *aur;
if (aur = killer->GetAura(SPELL_RECRUIT)) if (aur = killer->GetAura(SPELL_RECRUIT))
@@ -1149,7 +1103,7 @@ void OPvPWintergrasp::PromotePlayer(Player *killer) const
} }
} }
void OPvPWintergrasp::HandleKill(Player *killer, Unit *victim) void OutdoorPvPWG::HandleKill(Player *killer, Unit *victim)
{ {
if (!sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_ENABLED) || !isWarTime()) if (!sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_ENABLED) || !isWarTime())
return; return;
@@ -1193,7 +1147,7 @@ void OPvPWintergrasp::HandleKill(Player *killer, Unit *victim)
} }
// Recalculates Tenacity and applies it to Players / Vehicles // Recalculates Tenacity and applies it to Players / Vehicles
void OPvPWintergrasp::UpdateTenacityStack() void OutdoorPvPWG::UpdateTenacityStack()
{ {
if (!isWarTime()) if (!isWarTime())
return; return;
@@ -1258,7 +1212,7 @@ void OPvPWintergrasp::UpdateTenacityStack()
} }
} }
void OPvPWintergrasp::UpdateClockDigit(uint32 &timer, uint32 digit, uint32 mod) void OutdoorPvPWG::UpdateClockDigit(uint32 &timer, uint32 digit, uint32 mod)
{ {
uint32 value = timer%mod; uint32 value = timer%mod;
timer /= mod; timer /= mod;
@@ -1269,7 +1223,7 @@ void OPvPWintergrasp::UpdateClockDigit(uint32 &timer, uint32 digit, uint32 mod)
} }
} }
void OPvPWintergrasp::UpdateClock() void OutdoorPvPWG::UpdateClock()
{ {
uint32 timer = m_timer / 1000; uint32 timer = m_timer / 1000;
UpdateClockDigit(timer, 0, 10); UpdateClockDigit(timer, 0, 10);
@@ -1280,7 +1234,7 @@ void OPvPWintergrasp::UpdateClock()
UpdateClockDigit(timer, 4, 10); UpdateClockDigit(timer, 4, 10);
} }
bool OPvPWintergrasp::Update(uint32 diff) bool OutdoorPvPWG::Update(uint32 diff)
{ {
if (!sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_ENABLED)) if (!sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_ENABLED))
return false; return false;
@@ -1387,7 +1341,7 @@ bool OPvPWintergrasp::Update(uint32 diff)
return false; return false;
} }
void OPvPWintergrasp::forceStartBattle() void OutdoorPvPWG::forceStartBattle()
{ // Uptime will do all the work { // Uptime will do all the work
m_wartime = false; m_wartime = false;
@@ -1398,7 +1352,7 @@ void OPvPWintergrasp::forceStartBattle()
} }
} }
void OPvPWintergrasp::forceStopBattle() void OutdoorPvPWG::forceStopBattle()
{ // Uptime will do all the work. { // Uptime will do all the work.
if (!isWarTime()) if (!isWarTime())
@@ -1411,7 +1365,7 @@ void OPvPWintergrasp::forceStopBattle()
} }
} }
void OPvPWintergrasp::forceChangeTeam() void OutdoorPvPWG::forceChangeTeam()
{ {
m_changeDefender = true; m_changeDefender = true;
m_timer = 1; m_timer = 1;
@@ -1423,7 +1377,7 @@ void OPvPWintergrasp::forceChangeTeam()
} }
// Can be forced by gm's while in battle so have to reset in case it was wartime // Can be forced by gm's while in battle so have to reset in case it was wartime
void OPvPWintergrasp::StartBattle() void OutdoorPvPWG::StartBattle()
{ {
m_wartime = true; m_wartime = true;
m_timer = sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_BATTLE_TIME) * MINUTE * IN_MILISECONDS; m_timer = sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_BATTLE_TIME) * MINUTE * IN_MILISECONDS;
@@ -1446,7 +1400,11 @@ void OPvPWintergrasp::StartBattle()
// Remove All Wintergrasp auras. Add Recruit rank and Tower Control // Remove All Wintergrasp auras. Add Recruit rank and Tower Control
for (PlayerSet::iterator itr = m_players[getAttackerTeam()].begin(); itr != m_players[getAttackerTeam()].end(); ++itr) for (PlayerSet::iterator itr = m_players[getAttackerTeam()].begin(); itr != m_players[getAttackerTeam()].end(); ++itr)
{ {
REMOVE_WARTIME_AURAS(*itr); (*itr)->RemoveAurasDueToSpell(SPELL_RECRUIT);
(*itr)->RemoveAurasDueToSpell(SPELL_CORPORAL);
(*itr)->RemoveAurasDueToSpell(SPELL_LIEUTENANT);
(*itr)->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL);
(*itr)->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY);
if ((*itr)->getLevel() > 69) if ((*itr)->getLevel() > 69)
{ {
(*itr)->SetAuraStack(SPELL_TOWER_CONTROL, (*itr), 3); (*itr)->SetAuraStack(SPELL_TOWER_CONTROL, (*itr), 3);
@@ -1457,14 +1415,18 @@ void OPvPWintergrasp::StartBattle()
// Remove All Wintergrasp auras. Add Recruit rank // Remove All Wintergrasp auras. Add Recruit rank
for (PlayerSet::iterator itr = m_players[getDefenderTeam()].begin(); itr != m_players[getDefenderTeam()].end(); ++itr) for (PlayerSet::iterator itr = m_players[getDefenderTeam()].begin(); itr != m_players[getDefenderTeam()].end(); ++itr)
{ {
REMOVE_WARTIME_AURAS(*itr); (*itr)->RemoveAurasDueToSpell(SPELL_RECRUIT);
(*itr)->RemoveAurasDueToSpell(SPELL_CORPORAL);
(*itr)->RemoveAurasDueToSpell(SPELL_LIEUTENANT);
(*itr)->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL);
(*itr)->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY);
if ((*itr)->getLevel() > 69) if ((*itr)->getLevel() > 69)
(*itr)->CastSpell(*itr, SPELL_RECRUIT, true); (*itr)->CastSpell(*itr, SPELL_RECRUIT, true);
} }
UpdateTenacityStack(); UpdateTenacityStack();
} }
void OPvPWintergrasp::EndBattle() void OutdoorPvPWG::EndBattle()
{ {
// Cast Essence of Wintergrasp to all players (CheckCast will determine who to cast) // Cast Essence of Wintergrasp to all players (CheckCast will determine who to cast)
sWorld.setState(WORLDSTATE_WINTERGRASP_CONTROLING_FACTION, getDefenderTeam()); sWorld.setState(WORLDSTATE_WINTERGRASP_CONTROLING_FACTION, getDefenderTeam());
@@ -1500,7 +1462,11 @@ void OPvPWintergrasp::EndBattle()
{ {
for (PlayerSet::iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) for (PlayerSet::iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
{ {
REMOVE_WARTIME_AURAS(*itr); (*itr)->RemoveAurasDueToSpell(SPELL_RECRUIT);
(*itr)->RemoveAurasDueToSpell(SPELL_CORPORAL);
(*itr)->RemoveAurasDueToSpell(SPELL_LIEUTENANT);
(*itr)->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL);
(*itr)->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY);
} }
continue; continue;
} }
@@ -1509,7 +1475,7 @@ void OPvPWintergrasp::EndBattle()
uint32 intactNum = 0; uint32 intactNum = 0;
uint32 damagedNum = 0; uint32 damagedNum = 0;
for (OutdoorPvP::OPvPCapturePointMap::const_iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) for (OutdoorPvP::OPvPCapturePointMap::const_iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
if (SiegeWorkshop *workshop = dynamic_cast<SiegeWorkshop*>(itr->second)) if (OPvPCapturePointWG *workshop = dynamic_cast<OPvPCapturePointWG*>(itr->second))
if (workshop->m_buildingState->GetTeam() == team) if (workshop->m_buildingState->GetTeam() == team)
if (workshop->m_buildingState->damageState == DAMAGE_DAMAGED) if (workshop->m_buildingState->damageState == DAMAGE_DAMAGED)
++damagedNum; ++damagedNum;
@@ -1613,7 +1579,11 @@ void OPvPWintergrasp::EndBattle()
(*itr)->AreaExploredOrEventHappens(H_VICTORY_IN_WG); (*itr)->AreaExploredOrEventHappens(H_VICTORY_IN_WG);
} }
} }
REMOVE_WARTIME_AURAS(*itr); (*itr)->RemoveAurasDueToSpell(SPELL_RECRUIT);
(*itr)->RemoveAurasDueToSpell(SPELL_CORPORAL);
(*itr)->RemoveAurasDueToSpell(SPELL_LIEUTENANT);
(*itr)->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL);
(*itr)->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY);
} }
} }
@@ -1623,14 +1593,7 @@ void OPvPWintergrasp::EndBattle()
RemoveOfflinePlayerWGAuras(); RemoveOfflinePlayerWGAuras();
} }
void OPvPWintergrasp::SetData(uint32 id, uint32 value) bool OutdoorPvPWG::CanBuildVehicle(OPvPCapturePointWG *workshop) const
{
//if (id == DATA_ENGINEER_DIE)
// if (SiegeWorkshop *workshop = GetWorkshopByEngGuid(value))
// workshop->DespawnAllVehicles();
}
bool OPvPWintergrasp::CanBuildVehicle(SiegeWorkshop *workshop) const
{ {
TeamId team = workshop->m_buildingState->GetTeam(); TeamId team = workshop->m_buildingState->GetTeam();
if (team == TEAM_NEUTRAL) if (team == TEAM_NEUTRAL)
@@ -1641,16 +1604,16 @@ bool OPvPWintergrasp::CanBuildVehicle(SiegeWorkshop *workshop) const
&& m_vehicles[team].size() < m_workshopCount[team] * MAX_VEHICLE_PER_WORKSHOP; && m_vehicles[team].size() < m_workshopCount[team] * MAX_VEHICLE_PER_WORKSHOP;
} }
uint32 OPvPWintergrasp::GetData(uint32 id) uint32 OutdoorPvPWG::GetData(uint32 id)
{ {
// if can build more vehicles // if can build more vehicles
if (SiegeWorkshop *workshop = GetWorkshopByEngGuid(id)) if (OPvPCapturePointWG *workshop = GetWorkshopByEngGuid(id))
return CanBuildVehicle(workshop) ? 1 : 0; return CanBuildVehicle(workshop) ? 1 : 0;
return 0; return 0;
} }
void OPvPWintergrasp::RewardMarkOfHonor(Player *plr, uint32 count) void OutdoorPvPWG::RewardMarkOfHonor(Player *plr, uint32 count)
{ {
// 'Inactive' this aura prevents the player from gaining honor points and battleground tokens // 'Inactive' this aura prevents the player from gaining honor points and battleground tokens
if (plr->HasAura(SPELL_AURA_PLAYER_INACTIVE)) if (plr->HasAura(SPELL_AURA_PLAYER_INACTIVE))
@@ -1676,7 +1639,7 @@ void OPvPWintergrasp::RewardMarkOfHonor(Player *plr, uint32 count)
plr->SendNewItem(item, count, true, false); plr->SendNewItem(item, count, true, false);
} }
void OPvPWintergrasp::LoadQuestGiverMap(uint32 guid, Position posHorde, Position posAlli) void OutdoorPvPWG::LoadQuestGiverMap(uint32 guid, Position posHorde, Position posAlli)
{ {
m_qgPosMap[std::pair<uint32, bool>(guid, true)] = posHorde, m_qgPosMap[std::pair<uint32, bool>(guid, true)] = posHorde,
m_qgPosMap[std::pair<uint32, bool>(guid, false)] = posAlli, m_qgPosMap[std::pair<uint32, bool>(guid, false)] = posAlli,
@@ -1685,26 +1648,26 @@ void OPvPWintergrasp::LoadQuestGiverMap(uint32 guid, Position posHorde, Position
objmgr.MoveCreData(guid, 571, posAlli); objmgr.MoveCreData(guid, 571, posAlli);
} }
SiegeWorkshop *OPvPWintergrasp::GetWorkshop(uint32 lowguid) const OPvPCapturePointWG *OutdoorPvPWG::GetWorkshop(uint32 lowguid) const
{ {
if (OPvPCapturePoint *cp = GetCapturePoint(lowguid)) if (OPvPCapturePoint *cp = GetCapturePoint(lowguid))
return dynamic_cast<SiegeWorkshop*>(cp); return dynamic_cast<OPvPCapturePointWG*>(cp);
return NULL; return NULL;
} }
SiegeWorkshop *OPvPWintergrasp::GetWorkshopByEngGuid(uint32 lowguid) const OPvPCapturePointWG *OutdoorPvPWG::GetWorkshopByEngGuid(uint32 lowguid) const
{ {
for (OutdoorPvP::OPvPCapturePointMap::const_iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) for (OutdoorPvP::OPvPCapturePointMap::const_iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
if (SiegeWorkshop *workshop = dynamic_cast<SiegeWorkshop*>(itr->second)) if (OPvPCapturePointWG *workshop = dynamic_cast<OPvPCapturePointWG*>(itr->second))
if (workshop->m_engGuid == lowguid) if (workshop->m_engGuid == lowguid)
return workshop; return workshop;
return NULL; return NULL;
} }
SiegeWorkshop *OPvPWintergrasp::GetWorkshopByGOGuid(uint32 lowguid) const OPvPCapturePointWG *OutdoorPvPWG::GetWorkshopByGOGuid(uint32 lowguid) const
{ {
for (OutdoorPvP::OPvPCapturePointMap::const_iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) for (OutdoorPvP::OPvPCapturePointMap::const_iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
if (SiegeWorkshop *workshop = dynamic_cast<SiegeWorkshop*>(itr->second)) if (OPvPCapturePointWG *workshop = dynamic_cast<OPvPCapturePointWG*>(itr->second))
if (workshop->m_workshopGuid == lowguid) if (workshop->m_workshopGuid == lowguid)
return workshop; return workshop;
return NULL; return NULL;
@@ -1713,7 +1676,7 @@ SiegeWorkshop *OPvPWintergrasp::GetWorkshopByGOGuid(uint32 lowguid) const
/*######################################################## /*########################################################
* Copy of Battleground system to make Spirit Guides Work * Copy of Battleground system to make Spirit Guides Work
*#######################################################*/ *#######################################################*/
void OPvPWintergrasp::SendAreaSpiritHealerQueryOpcode(Player *pl, const uint64& guid) void OutdoorPvPWG::SendAreaSpiritHealerQueryOpcode(Player *pl, const uint64& guid)
{ {
WorldPacket data(SMSG_AREA_SPIRIT_HEALER_TIME, 12); WorldPacket data(SMSG_AREA_SPIRIT_HEALER_TIME, 12);
uint32 time_ = 30000 - GetLastResurrectTime(); // resurrect every 30 seconds uint32 time_ = 30000 - GetLastResurrectTime(); // resurrect every 30 seconds
@@ -1723,7 +1686,7 @@ void OPvPWintergrasp::SendAreaSpiritHealerQueryOpcode(Player *pl, const uint64&
pl->GetSession()->SendPacket(&data); pl->GetSession()->SendPacket(&data);
} }
void OPvPWintergrasp::AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid) void OutdoorPvPWG::AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid)
{ {
m_ReviveQueue[npc_guid].push_back(player_guid); m_ReviveQueue[npc_guid].push_back(player_guid);
@@ -1734,7 +1697,7 @@ void OPvPWintergrasp::AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_g
plr->CastSpell(plr, SPELL_WAITING_FOR_RESURRECT, true); plr->CastSpell(plr, SPELL_WAITING_FOR_RESURRECT, true);
} }
void OPvPWintergrasp::RemovePlayerFromResurrectQueue(uint64 player_guid) void OutdoorPvPWG::RemovePlayerFromResurrectQueue(uint64 player_guid)
{ {
for (std::map<uint64, std::vector<uint64> >::iterator itr = m_ReviveQueue.begin(); itr != m_ReviveQueue.end(); ++itr) for (std::map<uint64, std::vector<uint64> >::iterator itr = m_ReviveQueue.begin(); itr != m_ReviveQueue.end(); ++itr)
{ {
@@ -1756,7 +1719,7 @@ void OPvPWintergrasp::RemovePlayerFromResurrectQueue(uint64 player_guid)
} }
} }
void OPvPWintergrasp::RelocateDeadPlayers(Creature *cr) void OutdoorPvPWG::RelocateDeadPlayers(Creature *cr)
{ {
if (!cr || GetCreatureType(cr->GetEntry()) != CREATURE_SPIRIT_GUIDE) if (!cr || GetCreatureType(cr->GetEntry()) != CREATURE_SPIRIT_GUIDE)
return; return;
@@ -1782,16 +1745,16 @@ void OPvPWintergrasp::RelocateDeadPlayers(Creature *cr)
} }
/*###### /*######
##SiegeWorkshop ##OPvPCapturePointWG
######*/ ######*/
SiegeWorkshop::SiegeWorkshop(OPvPWintergrasp *opvp, BuildingState *state) OPvPCapturePointWG::OPvPCapturePointWG(OutdoorPvPWG *opvp, BuildingState *state)
: OPvPCapturePoint(opvp), m_buildingState(state), m_wintergrasp(opvp) : OPvPCapturePoint(opvp), m_buildingState(state), m_wintergrasp(opvp)
, m_engineer(NULL), m_engGuid(0), m_spiritguide(NULL), m_spiGuid(0) , m_engineer(NULL), m_engGuid(0), m_spiritguide(NULL), m_spiGuid(0)
{ {
} }
void SiegeWorkshop::SetTeamByBuildingState() void OPvPCapturePointWG::SetTeamByBuildingState()
{ {
if (m_buildingState->GetTeam() == TEAM_ALLIANCE) if (m_buildingState->GetTeam() == TEAM_ALLIANCE)
{ {
@@ -1819,7 +1782,7 @@ void SiegeWorkshop::SetTeamByBuildingState()
SendChangePhase(); SendChangePhase();
} }
void SiegeWorkshop::ChangeTeam(TeamId oldTeam) void OPvPCapturePointWG::ChangeTeam(TeamId oldTeam)
{ {
uint32 entry = 0; uint32 entry = 0;
uint32 guide_entry = 0; uint32 guide_entry = 0;
@@ -1849,12 +1812,12 @@ void SiegeWorkshop::ChangeTeam(TeamId oldTeam)
if (m_engGuid) if (m_engGuid)
{ {
*m_engEntry = entry; *m_engEntry = entry;
RespawnCreatureIfNeeded(m_engineer, entry); _RespawnCreatureIfNeeded(m_engineer, entry);
} }
if (m_spiGuid) if (m_spiGuid)
{ {
*m_spiEntry = guide_entry; *m_spiEntry = guide_entry;
RespawnCreatureIfNeeded(m_spiritguide, guide_entry); _RespawnCreatureIfNeeded(m_spiritguide, guide_entry);
m_wintergrasp->RelocateDeadPlayers(m_spiritguide); m_wintergrasp->RelocateDeadPlayers(m_spiritguide);
} }
} }
@@ -16,8 +16,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#ifndef TRINITY_WINTERGRASP_H #ifndef OUTDOOR_PVP_WG_
#define TRINITY_WINTERGRASP_H #define OUTDOOR_PVP_WG_
#include "OutdoorPvPImpl.h" #include "OutdoorPvPImpl.h"
@@ -31,7 +31,7 @@ const uint32 VehNumWorldState[2] = {3680,3490};
const uint32 MaxVehNumWorldState[2] = {3681,3491}; const uint32 MaxVehNumWorldState[2] = {3681,3491};
const uint32 ClockWorldState[5] = {3785,3784,3782,3976,3975}; const uint32 ClockWorldState[5] = {3785,3784,3782,3976,3975};
enum WintergraspSpell enum OutdoorPvPWGSpell
{ {
// Wartime auras // Wartime auras
SPELL_RECRUIT = 37795, SPELL_RECRUIT = 37795,
@@ -85,7 +85,7 @@ enum OutdoorPvP_WG_KeepStatus
}; };
*/ */
enum WintergraspCreType enum OutdoorPvPWGCreType
{ {
CREATURE_OTHER, CREATURE_OTHER,
CREATURE_SIEGE_VEHICLE, CREATURE_SIEGE_VEHICLE,
@@ -98,21 +98,56 @@ enum WintergraspCreType
CREATURE_QUESTGIVER, CREATURE_QUESTGIVER,
}; };
enum BuildingType enum OutdoorPvPWGBuildingType
{ {
BUILDING_WALL, BUILDING_WALL,
BUILDING_WORKSHOP, BUILDING_WORKSHOP,
BUILDING_TOWER, BUILDING_TOWER,
}; };
enum DamageState enum OutdoorPvPWGDamageState
{ // Do not change order { // Do not change order
DAMAGE_INTACT, DAMAGE_INTACT,
DAMAGE_DAMAGED, DAMAGE_DAMAGED,
DAMAGE_DESTROYED, DAMAGE_DESTROYED,
}; };
typedef uint32 TeamPair[2];
enum OutdoorPvPWGQuest
{
A_VICTORY_IN_WG = 13181,
H_VICTORY_IN_WG = 13183,
CRE_PVP_KILL = 31086, //Quest Objective - Fixme: this should be handled by DB
CRE_PVP_KILL_V = 31093, //Quest Objective - Fixme: this should be handled by DB
};
enum OutdoorPvPWGCreEntry
{
CRE_ENG_A = 30499,
CRE_ENG_H = 30400,
CRE_SPI_A = 31842,
CRE_SPI_H = 31841,
};
const TeamPair OutdoorPvPWGCreEntryPair[] =
{
{32307, 32308}, // Guards
{30739, 30740}, // Champions
{32296, 32294}, // Quartermaster
{32615, 32626}, // Warbringer & Brigadier General
{0,0} // Do not delete Used in LoadTeamPair
};
const TeamPair OutdoorPvPWGGODisplayPair[] =
{
{5651, 5652},
{8256, 8257},
{0,0} // Do not delete Used in LoadTeamPair
};
const uint32 AreaPOIIconId[3][3] = {{7,8,9},{4,5,6},{1,2,3}}; const uint32 AreaPOIIconId[3][3] = {{7,8,9},{4,5,6},{1,2,3}};
typedef std::list<const AreaPOIEntry *> AreaPOIList;
struct BuildingState struct BuildingState
{ {
@@ -124,10 +159,10 @@ struct BuildingState
uint32 worldState; uint32 worldState;
uint32 health; uint32 health;
TeamId defaultTeam; TeamId defaultTeam;
DamageState damageState; OutdoorPvPWGDamageState damageState;
GameObject *building; GameObject *building;
uint32 *graveTeam; uint32 *graveTeam;
BuildingType type; OutdoorPvPWGBuildingType type;
void SendUpdate(Player *player) const void SendUpdate(Player *player) const
{ {
@@ -154,9 +189,9 @@ private:
typedef std::map<uint32, uint32> TeamPairMap; typedef std::map<uint32, uint32> TeamPairMap;
class SiegeWorkshop; class OPvPCapturePointWG;
class OPvPWintergrasp : public OutdoorPvP class OutdoorPvPWG : public OutdoorPvP
{ {
protected: protected:
typedef std::map<uint32, BuildingState *> BuildingStateMap; typedef std::map<uint32, BuildingState *> BuildingStateMap;
@@ -165,11 +200,10 @@ class OPvPWintergrasp : public OutdoorPvP
typedef std::map<std::pair<uint32, bool>, Position> QuestGiverPositionMap; typedef std::map<std::pair<uint32, bool>, Position> QuestGiverPositionMap;
typedef std::map<uint32, Creature*> QuestGiverMap; typedef std::map<uint32, Creature*> QuestGiverMap;
public: public:
OPvPWintergrasp(); OutdoorPvPWG();
bool SetupOutdoorPvP(); bool SetupOutdoorPvP();
uint32 GetCreatureEntry(uint32 guidlow, const CreatureData *data); uint32 GetCreatureEntry(uint32 guidlow, const CreatureData *data);
//uint32 GetGameObjectEntry(uint32 guidlow, uint32 entry);
void OnCreatureCreate(Creature *creature, bool add); void OnCreatureCreate(Creature *creature, bool add);
void OnGameObjectCreate(GameObject *go, bool add); void OnGameObjectCreate(GameObject *go, bool add);
@@ -186,26 +220,16 @@ class OPvPWintergrasp : public OutdoorPvP
void BroadcastStateChange(BuildingState *state) const; void BroadcastStateChange(BuildingState *state) const;
uint32 GetData(uint32 id); uint32 GetData(uint32 id);
void SetData(uint32 id, uint32 value); void SetData(uint32 id, uint32 value) {};
void ModifyWorkshopCount(TeamId team, bool add); void ModifyWorkshopCount(TeamId team, bool add);
uint32 GetTimer() const { return m_timer / 1000; }; uint32 GetTimer() const { return m_timer / 1000; };
TeamId GetTeam() const { return m_defender; };
bool isWarTime() const { return m_wartime; }; bool isWarTime() const { return m_wartime; };
void setTimer(uint32 timer) void setTimer(uint32 timer) { if (timer >= 0) m_timer = timer; };
{ uint32 GetNumPlayersA() const { return m_players[TEAM_ALLIANCE].size(); };
if (timer >= 0) uint32 GetNumPlayersH() const { return m_players[TEAM_HORDE].size(); };
m_timer = timer; TeamId getDefenderTeam() const { return m_defender; };
}; TeamId getAttackerTeam() const { return OTHER_TEAM(m_defender); };
uint32 GetNumPlayersA() const
{
return m_players[TEAM_ALLIANCE].size();
}
uint32 GetNumPlayersH() const
{
return m_players[TEAM_HORDE].size();
}
void forceChangeTeam(); void forceChangeTeam();
void forceStopBattle(); void forceStopBattle();
void forceStartBattle(); void forceStartBattle();
@@ -249,9 +273,9 @@ class OPvPWintergrasp : public OutdoorPvP
uint32 m_towerDestroyedCount[2]; uint32 m_towerDestroyedCount[2];
uint32 m_towerDamagedCount[2]; uint32 m_towerDamagedCount[2];
SiegeWorkshop *GetWorkshop(uint32 lowguid) const; OPvPCapturePointWG *GetWorkshop(uint32 lowguid) const;
SiegeWorkshop *GetWorkshopByEngGuid(uint32 lowguid) const; OPvPCapturePointWG *GetWorkshopByEngGuid(uint32 lowguid) const;
SiegeWorkshop *GetWorkshopByGOGuid(uint32 lowguid) const; OPvPCapturePointWG *GetWorkshopByGOGuid(uint32 lowguid) const;
void StartBattle(); void StartBattle();
void EndBattle(); void EndBattle();
@@ -264,8 +288,8 @@ class OPvPWintergrasp : public OutdoorPvP
bool UpdateCreatureInfo(Creature *creature); bool UpdateCreatureInfo(Creature *creature);
bool UpdateGameObjectInfo(GameObject *go) const; bool UpdateGameObjectInfo(GameObject *go) const;
bool CanBuildVehicle(SiegeWorkshop *workshop) const; bool CanBuildVehicle(OPvPCapturePointWG *workshop) const;
WintergraspCreType GetCreatureType(uint32 entry) const; OutdoorPvPWGCreType GetCreatureType(uint32 entry) const;
void RebuildAllBuildings(); void RebuildAllBuildings();
@@ -277,16 +301,13 @@ class OPvPWintergrasp : public OutdoorPvP
bool UpdateQuestGiverPosition(uint32 guid, Creature *creature); bool UpdateQuestGiverPosition(uint32 guid, Creature *creature);
}; };
class SiegeWorkshop : public OPvPCapturePoint class OPvPCapturePointWG : public OPvPCapturePoint
{ {
public: public:
explicit SiegeWorkshop(OPvPWintergrasp *opvp, BuildingState *state); explicit OPvPCapturePointWG(OutdoorPvPWG *opvp, BuildingState *state);
void SetTeamByBuildingState(); void SetTeamByBuildingState();
void ChangeState() {} void ChangeState() {}
void ChangeTeam(TeamId oldteam); void ChangeTeam(TeamId oldteam);
//void DespawnAllVehicles();
//bool CanBuildVehicle() const { return m_vehicles.size() < MAX_VEHICLE_PER_WORKSHOP && m_buildingState->damageState != DAMAGE_DESTROYED; }
uint32 *m_spiEntry; uint32 *m_spiEntry;
uint32 m_spiGuid; uint32 m_spiGuid;
@@ -296,10 +317,9 @@ class SiegeWorkshop : public OPvPCapturePoint
uint32 m_engGuid; uint32 m_engGuid;
Creature *m_engineer; Creature *m_engineer;
uint32 m_workshopGuid; uint32 m_workshopGuid;
//CreatureSet m_vehicles;
BuildingState *m_buildingState; BuildingState *m_buildingState;
protected: protected:
OPvPWintergrasp *m_wintergrasp; OutdoorPvPWG *m_wintergrasp;
}; };
#endif #endif
+2 -2
View File
@@ -1698,11 +1698,11 @@
> >
</File> </File>
<File <File
RelativePath="..\..\src\game\Wintergrasp.cpp" RelativePath="..\..\src\game\OutdoorPvPWG.cpp"
> >
</File> </File>
<File <File
RelativePath="..\..\src\game\Wintergrasp.h" RelativePath="..\..\src\game\OutdoorPvPWG.h"
> >
</File> </File>
</Filter> </Filter>
+2 -2
View File
@@ -1699,11 +1699,11 @@
> >
</File> </File>
<File <File
RelativePath="..\..\src\game\Wintergrasp.cpp" RelativePath="..\..\src\game\OutdoorPvPWG.cpp"
> >
</File> </File>
<File <File
RelativePath="..\..\src\game\Wintergrasp.h" RelativePath="..\..\src\game\OutdoorPvPWG.h"
> >
</File> </File>
</Filter> </Filter>