*Allow to get promotion in wintergrasp by killing vehicles and guards.
--HG-- branch : trunk
This commit is contained in:
+52
-18
@@ -324,10 +324,34 @@ uint32 OPvPWintergrasp::GetCreatureEntry(uint32 guidlow, const CreatureData *dat
|
||||
return data->id;
|
||||
}
|
||||
|
||||
WintergraspCreType OPvPWintergrasp::GetCreatureType(uint32 entry) const
|
||||
{
|
||||
switch(entry)
|
||||
{
|
||||
case 27881:
|
||||
case 28094:
|
||||
case 28312:
|
||||
case 32627:
|
||||
return CREATURE_SIEGE_VEHICLE;
|
||||
case 28366:
|
||||
return CREATURE_TURRET;
|
||||
case CRE_ENG_A:
|
||||
case CRE_ENG_H:
|
||||
return CREATURE_ENGINEER;
|
||||
case 30739:
|
||||
case 30740:
|
||||
return CREATURE_GUARD;
|
||||
default:
|
||||
return CREATURE_OTHER;
|
||||
}
|
||||
}
|
||||
|
||||
void OPvPWintergrasp::OnCreatureCreate(Creature *creature, bool add)
|
||||
{
|
||||
uint32 entry = creature->GetEntry();
|
||||
if(creature->isVehicle()) // vehicles
|
||||
switch(GetCreatureType(entry))
|
||||
{
|
||||
case CREATURE_SIEGE_VEHICLE:
|
||||
{
|
||||
TeamId team;
|
||||
if(creature->getFaction() == WintergraspFaction[TEAM_ALLIANCE])
|
||||
@@ -337,12 +361,6 @@ void OPvPWintergrasp::OnCreatureCreate(Creature *creature, bool add)
|
||||
else
|
||||
return;
|
||||
|
||||
switch(entry)
|
||||
{
|
||||
case 27881:
|
||||
case 28094:
|
||||
case 28312:
|
||||
case 32627:
|
||||
if(uint32 engLowguid = GUID_LOPART(creature->GetOwnerGUID()))
|
||||
{
|
||||
if(SiegeWorkshop *workshop = GetWorkshopByEngGuid(engLowguid))
|
||||
@@ -370,7 +388,6 @@ void OPvPWintergrasp::OnCreatureCreate(Creature *creature, bool add)
|
||||
}
|
||||
}
|
||||
}
|
||||
//case 28366: tower
|
||||
if(add)
|
||||
{
|
||||
if(m_tenacityStack > 0)
|
||||
@@ -387,15 +404,9 @@ void OPvPWintergrasp::OnCreatureCreate(Creature *creature, bool add)
|
||||
SendUpdateWorldState(VehNumWorldState[team], m_vehicles[team].size());
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(m_creEntryPair.find(entry) != m_creEntryPair.end()) // guards and npc
|
||||
{
|
||||
if(add) m_creatures.insert(creature);
|
||||
else m_creatures.erase(creature);
|
||||
}
|
||||
else if(entry == CRE_ENG_A || entry == CRE_ENG_H) // demolisher engineers
|
||||
{
|
||||
case CREATURE_ENGINEER:
|
||||
for(OutdoorPvP::OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
|
||||
{
|
||||
if(SiegeWorkshop *workshop = dynamic_cast<SiegeWorkshop*>(itr->second))
|
||||
if(workshop->m_engGuid == creature->GetDBTableGUIDLow())
|
||||
{
|
||||
@@ -403,6 +414,15 @@ void OPvPWintergrasp::OnCreatureCreate(Creature *creature, bool add)
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if(m_creEntryPair.find(entry) != m_creEntryPair.end()) // guards and npc
|
||||
{
|
||||
if(add) m_creatures.insert(creature);
|
||||
else m_creatures.erase(creature);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void OPvPWintergrasp::OnGameObjectCreate(GameObject *go, bool add)
|
||||
@@ -578,10 +598,25 @@ void OPvPWintergrasp::HandlePlayerLeaveZone(Player * plr, uint32 zone)
|
||||
|
||||
void OPvPWintergrasp::HandleKill(Player *killer, Unit *victim)
|
||||
{
|
||||
bool ok = false;
|
||||
if(victim->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
// We handle promotion here because player should not get promotion if he has buff but do the kill outside the zone
|
||||
if(victim->getLevel() >= 70)
|
||||
ok = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(GetCreatureType(victim->GetEntry()))
|
||||
{
|
||||
case CREATURE_SIEGE_VEHICLE:
|
||||
case CREATURE_GUARD:
|
||||
case CREATURE_TURRET:
|
||||
ok = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(ok)
|
||||
{
|
||||
Aura *aur;
|
||||
if(aur = killer->GetAura(SPELL_RECRUIT))
|
||||
@@ -607,7 +642,6 @@ void OPvPWintergrasp::HandleKill(Player *killer, Unit *victim)
|
||||
else if(killer->HasAura(SPELL_LIEUTENANT))
|
||||
killer->CastSpell(killer, SPELL_LIEUTENANT, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OPvPWintergrasp::UpdateTenacityStack()
|
||||
|
||||
@@ -86,6 +86,15 @@ const uint32 VehNumWorldState[2] = {3680,3490};
|
||||
const uint32 MaxVehNumWorldState[2] = {3681,3491};
|
||||
const uint32 ClockWorldState[5] = {3785,3784,3782,3976,3975};
|
||||
|
||||
enum WintergraspCreType
|
||||
{
|
||||
CREATURE_OTHER,
|
||||
CREATURE_SIEGE_VEHICLE,
|
||||
CREATURE_TURRET,
|
||||
CREATURE_ENGINEER,
|
||||
CREATURE_GUARD,
|
||||
};
|
||||
|
||||
enum BuildingType
|
||||
{
|
||||
BUILDING_WALL,
|
||||
@@ -197,6 +206,7 @@ class OPvPWintergrasp : public OutdoorPvP
|
||||
bool UpdateGameObjectInfo(GameObject *go) const;
|
||||
|
||||
bool CanBuildVehicle(SiegeWorkshop *workshop) const;
|
||||
WintergraspCreType GetCreatureType(uint32 entry) const;
|
||||
|
||||
void RebuildAllBuildings();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user