*Allow to get promotion in wintergrasp by killing vehicles and guards.
--HG-- branch : trunk
This commit is contained in:
+121
-87
@@ -324,84 +324,104 @@ uint32 OPvPWintergrasp::GetCreatureEntry(uint32 guidlow, const CreatureData *dat
|
|||||||
return data->id;
|
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)
|
void OPvPWintergrasp::OnCreatureCreate(Creature *creature, bool add)
|
||||||
{
|
{
|
||||||
uint32 entry = creature->GetEntry();
|
uint32 entry = creature->GetEntry();
|
||||||
if(creature->isVehicle()) // vehicles
|
switch(GetCreatureType(entry))
|
||||||
{
|
{
|
||||||
TeamId team;
|
case CREATURE_SIEGE_VEHICLE:
|
||||||
if(creature->getFaction() == WintergraspFaction[TEAM_ALLIANCE])
|
|
||||||
team = TEAM_ALLIANCE;
|
|
||||||
else if(creature->getFaction() == WintergraspFaction[TEAM_HORDE])
|
|
||||||
team = TEAM_HORDE;
|
|
||||||
else
|
|
||||||
return;
|
|
||||||
|
|
||||||
switch(entry)
|
|
||||||
{
|
{
|
||||||
case 27881:
|
TeamId team;
|
||||||
case 28094:
|
if(creature->getFaction() == WintergraspFaction[TEAM_ALLIANCE])
|
||||||
case 28312:
|
team = TEAM_ALLIANCE;
|
||||||
case 32627:
|
else if(creature->getFaction() == WintergraspFaction[TEAM_HORDE])
|
||||||
if(uint32 engLowguid = GUID_LOPART(creature->GetOwnerGUID()))
|
team = TEAM_HORDE;
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(uint32 engLowguid = GUID_LOPART(creature->GetOwnerGUID()))
|
||||||
|
{
|
||||||
|
if(SiegeWorkshop *workshop = GetWorkshopByEngGuid(engLowguid))
|
||||||
{
|
{
|
||||||
if(SiegeWorkshop *workshop = GetWorkshopByEngGuid(engLowguid))
|
if(add)
|
||||||
{
|
{
|
||||||
if(add)
|
if(CanBuildVehicle(workshop))
|
||||||
{
|
{
|
||||||
if(CanBuildVehicle(workshop))
|
m_vehicles[team].insert((Vehicle*)creature);
|
||||||
{
|
//workshop->m_vehicles.insert((Vehicle*)creature);
|
||||||
m_vehicles[team].insert((Vehicle*)creature);
|
|
||||||
//workshop->m_vehicles.insert((Vehicle*)creature);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
creature->setDeathState(DEAD);
|
|
||||||
creature->SetRespawnTime(DAY);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// TODO: now you have to wait until the corpse of vehicle disappear to build a new one
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_vehicles[team].erase((Vehicle*)creature);
|
creature->setDeathState(DEAD);
|
||||||
//if(!workshop->m_vehicles.erase((Vehicle*)creature))
|
creature->SetRespawnTime(DAY);
|
||||||
// sLog.outError("OPvPWintergrasp::OnCreatureCreate: a vehicle is removed but it does not have record in workshop!");
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
// TODO: now you have to wait until the corpse of vehicle disappear to build a new one
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_vehicles[team].erase((Vehicle*)creature);
|
||||||
|
//if(!workshop->m_vehicles.erase((Vehicle*)creature))
|
||||||
|
// sLog.outError("OPvPWintergrasp::OnCreatureCreate: a vehicle is removed but it does not have record in workshop!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//case 28366: tower
|
}
|
||||||
if(add)
|
if(add)
|
||||||
|
{
|
||||||
|
if(m_tenacityStack > 0)
|
||||||
{
|
{
|
||||||
if(m_tenacityStack > 0)
|
if(team == TEAM_ALLIANCE)
|
||||||
{
|
creature->SetAuraStack(SPELL_TENACITY_VEHICLE, creature, m_tenacityStack);
|
||||||
if(team == TEAM_ALLIANCE)
|
}
|
||||||
creature->SetAuraStack(SPELL_TENACITY_VEHICLE, creature, m_tenacityStack);
|
else if(m_tenacityStack < 0)
|
||||||
}
|
{
|
||||||
else if(m_tenacityStack < 0)
|
if(team == TEAM_HORDE)
|
||||||
{
|
creature->SetAuraStack(SPELL_TENACITY_VEHICLE, creature, -m_tenacityStack);
|
||||||
if(team == TEAM_HORDE)
|
}
|
||||||
creature->SetAuraStack(SPELL_TENACITY_VEHICLE, creature, -m_tenacityStack);
|
}
|
||||||
}
|
SendUpdateWorldState(VehNumWorldState[team], m_vehicles[team].size());
|
||||||
}
|
break;
|
||||||
SendUpdateWorldState(VehNumWorldState[team], m_vehicles[team].size());
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
case CREATURE_ENGINEER:
|
||||||
else if(m_creEntryPair.find(entry) != m_creEntryPair.end()) // guards and npc
|
for(OutdoorPvP::OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
|
||||||
{
|
{
|
||||||
if(add) m_creatures.insert(creature);
|
if(SiegeWorkshop *workshop = dynamic_cast<SiegeWorkshop*>(itr->second))
|
||||||
else m_creatures.erase(creature);
|
if(workshop->m_engGuid == creature->GetDBTableGUIDLow())
|
||||||
}
|
{
|
||||||
else if(entry == CRE_ENG_A || entry == CRE_ENG_H) // demolisher engineers
|
workshop->m_engineer = add ? creature : NULL;
|
||||||
{
|
break;
|
||||||
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())
|
break;
|
||||||
{
|
default:
|
||||||
workshop->m_engineer = add ? creature : NULL;
|
if(m_creEntryPair.find(entry) != m_creEntryPair.end()) // guards and npc
|
||||||
break;
|
{
|
||||||
}
|
if(add) m_creatures.insert(creature);
|
||||||
|
else m_creatures.erase(creature);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -578,36 +598,50 @@ void OPvPWintergrasp::HandlePlayerLeaveZone(Player * plr, uint32 zone)
|
|||||||
|
|
||||||
void OPvPWintergrasp::HandleKill(Player *killer, Unit *victim)
|
void OPvPWintergrasp::HandleKill(Player *killer, Unit *victim)
|
||||||
{
|
{
|
||||||
|
bool ok = false;
|
||||||
if(victim->GetTypeId() == TYPEID_PLAYER)
|
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)
|
if(victim->getLevel() >= 70)
|
||||||
|
ok = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch(GetCreatureType(victim->GetEntry()))
|
||||||
{
|
{
|
||||||
Aura *aur;
|
case CREATURE_SIEGE_VEHICLE:
|
||||||
if(aur = killer->GetAura(SPELL_RECRUIT))
|
case CREATURE_GUARD:
|
||||||
{
|
case CREATURE_TURRET:
|
||||||
if(aur->GetStackAmount() >= 5)
|
ok = true;
|
||||||
{
|
break;
|
||||||
killer->RemoveAura(SPELL_RECRUIT);
|
|
||||||
killer->CastSpell(killer, SPELL_CORPORAL, true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
killer->CastSpell(killer, SPELL_RECRUIT, true);
|
|
||||||
}
|
|
||||||
else if(aur = killer->GetAura(SPELL_CORPORAL))
|
|
||||||
{
|
|
||||||
if(aur->GetStackAmount() >= 5)
|
|
||||||
{
|
|
||||||
killer->RemoveAura(SPELL_CORPORAL);
|
|
||||||
killer->CastSpell(killer, SPELL_LIEUTENANT, true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
killer->CastSpell(killer, SPELL_CORPORAL, true);
|
|
||||||
}
|
|
||||||
else if(killer->HasAura(SPELL_LIEUTENANT))
|
|
||||||
killer->CastSpell(killer, SPELL_LIEUTENANT, true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(ok)
|
||||||
|
{
|
||||||
|
Aura *aur;
|
||||||
|
if(aur = killer->GetAura(SPELL_RECRUIT))
|
||||||
|
{
|
||||||
|
if(aur->GetStackAmount() >= 5)
|
||||||
|
{
|
||||||
|
killer->RemoveAura(SPELL_RECRUIT);
|
||||||
|
killer->CastSpell(killer, SPELL_CORPORAL, true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
killer->CastSpell(killer, SPELL_RECRUIT, true);
|
||||||
|
}
|
||||||
|
else if(aur = killer->GetAura(SPELL_CORPORAL))
|
||||||
|
{
|
||||||
|
if(aur->GetStackAmount() >= 5)
|
||||||
|
{
|
||||||
|
killer->RemoveAura(SPELL_CORPORAL);
|
||||||
|
killer->CastSpell(killer, SPELL_LIEUTENANT, true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
killer->CastSpell(killer, SPELL_CORPORAL, true);
|
||||||
|
}
|
||||||
|
else if(killer->HasAura(SPELL_LIEUTENANT))
|
||||||
|
killer->CastSpell(killer, SPELL_LIEUTENANT, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OPvPWintergrasp::UpdateTenacityStack()
|
void OPvPWintergrasp::UpdateTenacityStack()
|
||||||
|
|||||||
@@ -86,6 +86,15 @@ 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 WintergraspCreType
|
||||||
|
{
|
||||||
|
CREATURE_OTHER,
|
||||||
|
CREATURE_SIEGE_VEHICLE,
|
||||||
|
CREATURE_TURRET,
|
||||||
|
CREATURE_ENGINEER,
|
||||||
|
CREATURE_GUARD,
|
||||||
|
};
|
||||||
|
|
||||||
enum BuildingType
|
enum BuildingType
|
||||||
{
|
{
|
||||||
BUILDING_WALL,
|
BUILDING_WALL,
|
||||||
@@ -197,6 +206,7 @@ class OPvPWintergrasp : public OutdoorPvP
|
|||||||
bool UpdateGameObjectInfo(GameObject *go) const;
|
bool UpdateGameObjectInfo(GameObject *go) const;
|
||||||
|
|
||||||
bool CanBuildVehicle(SiegeWorkshop *workshop) const;
|
bool CanBuildVehicle(SiegeWorkshop *workshop) const;
|
||||||
|
WintergraspCreType GetCreatureType(uint32 entry) const;
|
||||||
|
|
||||||
void RebuildAllBuildings();
|
void RebuildAllBuildings();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user