Core/Battlefield: attempt to fix vehicle counter when vehicle is killed. finish correcting alliance/horde siege engine
This commit is contained in:
@@ -518,8 +518,8 @@ void BattlefieldWG::OnCreatureCreate(Creature* creature)
|
|||||||
{
|
{
|
||||||
switch (creature->GetEntry())
|
switch (creature->GetEntry())
|
||||||
{
|
{
|
||||||
case NPC_WINTERGRASP_SIEGE_ENGINE_1:
|
case NPC_WINTERGRASP_SIEGE_ENGINE_ALLIANCE:
|
||||||
case NPC_WINTERGRASP_SIEGE_ENGINE_2:
|
case NPC_WINTERGRASP_SIEGE_ENGINE_HORDE:
|
||||||
case NPC_WINTERGRASP_CATAPULT:
|
case NPC_WINTERGRASP_CATAPULT:
|
||||||
case NPC_WINTERGRASP_DEMOLISHER:
|
case NPC_WINTERGRASP_DEMOLISHER:
|
||||||
{
|
{
|
||||||
@@ -573,12 +573,13 @@ void BattlefieldWG::OnCreatureCreate(Creature* creature)
|
|||||||
|
|
||||||
void BattlefieldWG::OnCreatureRemove(Creature* creature)
|
void BattlefieldWG::OnCreatureRemove(Creature* creature)
|
||||||
{
|
{
|
||||||
|
/* possibly can be used later
|
||||||
if (IsWarTime())
|
if (IsWarTime())
|
||||||
{
|
{
|
||||||
switch (creature->GetEntry())
|
switch (creature->GetEntry())
|
||||||
{
|
{
|
||||||
case NPC_WINTERGRASP_SIEGE_ENGINE_1:
|
case NPC_WINTERGRASP_SIEGE_ENGINE_ALLIANCE:
|
||||||
case NPC_WINTERGRASP_SIEGE_ENGINE_2:
|
case NPC_WINTERGRASP_SIEGE_ENGINE_HORDE:
|
||||||
case NPC_WINTERGRASP_CATAPULT:
|
case NPC_WINTERGRASP_CATAPULT:
|
||||||
case NPC_WINTERGRASP_DEMOLISHER:
|
case NPC_WINTERGRASP_DEMOLISHER:
|
||||||
{
|
{
|
||||||
@@ -600,7 +601,7 @@ void BattlefieldWG::OnCreatureRemove(Creature* creature)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattlefieldWG::OnGameObjectCreate(GameObject* go)
|
void BattlefieldWG::OnGameObjectCreate(GameObject* go)
|
||||||
@@ -656,23 +657,19 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
bool again = false;
|
bool again = false;
|
||||||
|
TeamId killerTeam = killer->GetTeamId();
|
||||||
|
|
||||||
if (victim->GetTypeId() == TYPEID_PLAYER)
|
if (victim->GetTypeId() == TYPEID_PLAYER)
|
||||||
{
|
{
|
||||||
for (GuidSet::const_iterator itr = m_PlayersInWar[killer->GetTeamId()].begin(); itr != m_PlayersInWar[killer->GetTeamId()].end(); ++itr)
|
for (GuidSet::const_iterator itr = m_PlayersInWar[killerTeam].begin(); itr != m_PlayersInWar[killerTeam].end(); ++itr)
|
||||||
if (Player* player = sObjectAccessor->FindPlayer(*itr))
|
if (Player* player = sObjectAccessor->FindPlayer(*itr))
|
||||||
if (player->GetDistance2d(killer) < 40)
|
if (player->GetDistance2d(killer) < 40)
|
||||||
PromotePlayer(player);
|
PromotePlayer(player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (GuidSet::const_iterator itr = m_vehicles[GetOtherTeam(killer->GetTeamId())].begin(); itr != m_vehicles[GetOtherTeam(killer->GetTeamId())].end(); ++itr)
|
for (GuidSet::const_iterator itr = KeepCreature[GetOtherTeam(killerTeam)].begin();
|
||||||
if (Unit* unit = sObjectAccessor->FindUnit(*itr))
|
itr != KeepCreature[GetOtherTeam(killerTeam)].end(); ++itr)
|
||||||
if (Creature* creature = unit->ToCreature())
|
|
||||||
if (victim->GetEntry() == creature->GetEntry() && !again)
|
|
||||||
again = true;
|
|
||||||
|
|
||||||
for (GuidSet::const_iterator itr = KeepCreature[GetOtherTeam(killer->GetTeamId())].begin();
|
|
||||||
itr != KeepCreature[GetOtherTeam(killer->GetTeamId())].end(); ++itr)
|
|
||||||
{
|
{
|
||||||
if (Unit* unit = sObjectAccessor->FindUnit(*itr))
|
if (Unit* unit = sObjectAccessor->FindUnit(*itr))
|
||||||
{
|
{
|
||||||
@@ -681,7 +678,7 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim)
|
|||||||
if (victim->GetEntry() == creature->GetEntry() && !again)
|
if (victim->GetEntry() == creature->GetEntry() && !again)
|
||||||
{
|
{
|
||||||
again = true;
|
again = true;
|
||||||
for (GuidSet::const_iterator iter = m_PlayersInWar[killer->GetTeamId()].begin(); iter != m_PlayersInWar[killer->GetTeamId()].end(); ++iter)
|
for (GuidSet::const_iterator iter = m_PlayersInWar[killerTeam].begin(); iter != m_PlayersInWar[killerTeam].end(); ++iter)
|
||||||
if (Player* player = sObjectAccessor->FindPlayer(*iter))
|
if (Player* player = sObjectAccessor->FindPlayer(*iter))
|
||||||
if (player->GetDistance2d(killer) < 40.0f)
|
if (player->GetDistance2d(killer) < 40.0f)
|
||||||
PromotePlayer(player);
|
PromotePlayer(player);
|
||||||
@@ -692,6 +689,31 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim)
|
|||||||
// TODO:Recent PvP activity worldstate
|
// TODO:Recent PvP activity worldstate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool BattlefieldWG::FindAndRemoveVehicleFromList(Unit* vehicle)
|
||||||
|
{
|
||||||
|
for (uint32 itr = 0; itr < 2; ++itr)
|
||||||
|
{
|
||||||
|
if (m_vehicles[itr].find(vehicle->GetGUID()) != m_vehicles[itr].end())
|
||||||
|
{
|
||||||
|
m_vehicles[itr].erase(vehicle->GetGUID());
|
||||||
|
if (itr == WintergraspFaction[TEAM_HORDE])
|
||||||
|
UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_H,-1);
|
||||||
|
else
|
||||||
|
UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_A,-1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BattlefieldWG::OnUnitDeath(Unit* unit)
|
||||||
|
{
|
||||||
|
if (IsWarTime())
|
||||||
|
if (unit->IsVehicle())
|
||||||
|
if (FindAndRemoveVehicleFromList(unit))
|
||||||
|
UpdateVehicleCountWG();
|
||||||
|
}
|
||||||
|
|
||||||
// Update rank for player
|
// Update rank for player
|
||||||
void BattlefieldWG::PromotePlayer(Player* killer)
|
void BattlefieldWG::PromotePlayer(Player* killer)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -212,8 +212,8 @@ enum WintergraspNpcs
|
|||||||
NPC_DWARVEN_SPIRIT_GUIDE = 31842, // Alliance spirit guide for Wintergrasp
|
NPC_DWARVEN_SPIRIT_GUIDE = 31842, // Alliance spirit guide for Wintergrasp
|
||||||
NPC_TOWER_CANNON = 28366,
|
NPC_TOWER_CANNON = 28366,
|
||||||
|
|
||||||
NPC_WINTERGRASP_SIEGE_ENGINE_1 = 28312,
|
NPC_WINTERGRASP_SIEGE_ENGINE_ALLIANCE = 28312,
|
||||||
NPC_WINTERGRASP_SIEGE_ENGINE_2 = 32627,
|
NPC_WINTERGRASP_SIEGE_ENGINE_HORDE = 32627,
|
||||||
NPC_WINTERGRASP_CATAPULT = 27881,
|
NPC_WINTERGRASP_CATAPULT = 27881,
|
||||||
NPC_WINTERGRASP_DEMOLISHER = 28094,
|
NPC_WINTERGRASP_DEMOLISHER = 28094,
|
||||||
NPC_WINTERGRASP_TOWER_CANNON = 28366,
|
NPC_WINTERGRASP_TOWER_CANNON = 28366,
|
||||||
@@ -400,11 +400,14 @@ class BattlefieldWG : public Battlefield
|
|||||||
void SendInitWorldStatesToAll();
|
void SendInitWorldStatesToAll();
|
||||||
|
|
||||||
void HandleKill(Player* killer, Unit* victim);
|
void HandleKill(Player* killer, Unit* victim);
|
||||||
|
void OnUnitDeath(Unit* unit);
|
||||||
void PromotePlayer(Player* killer);
|
void PromotePlayer(Player* killer);
|
||||||
|
|
||||||
void UpdateTenacity();
|
void UpdateTenacity();
|
||||||
void ProcessEvent(WorldObject *obj, uint32 eventId);
|
void ProcessEvent(WorldObject *obj, uint32 eventId);
|
||||||
|
|
||||||
|
bool FindAndRemoveVehicleFromList(Unit* vehicle);
|
||||||
|
|
||||||
// returns the graveyardId in the specified area.
|
// returns the graveyardId in the specified area.
|
||||||
uint8 GetSpiritGraveyardId(uint32 areaId);
|
uint8 GetSpiritGraveyardId(uint32 areaId);
|
||||||
|
|
||||||
|
|||||||
@@ -99,8 +99,8 @@ uint8 const MAX_WINTERGRASP_VEHICLES = 4;
|
|||||||
uint32 const vehiclesList[MAX_WINTERGRASP_VEHICLES] = {
|
uint32 const vehiclesList[MAX_WINTERGRASP_VEHICLES] = {
|
||||||
NPC_WINTERGRASP_CATAPULT,
|
NPC_WINTERGRASP_CATAPULT,
|
||||||
NPC_WINTERGRASP_DEMOLISHER,
|
NPC_WINTERGRASP_DEMOLISHER,
|
||||||
NPC_WINTERGRASP_SIEGE_ENGINE_1,
|
NPC_WINTERGRASP_SIEGE_ENGINE_ALLIANCE,
|
||||||
NPC_WINTERGRASP_SIEGE_ENGINE_2
|
NPC_WINTERGRASP_SIEGE_ENGINE_HORDE
|
||||||
};
|
};
|
||||||
|
|
||||||
class npc_wg_demolisher_engineer : public CreatureScript
|
class npc_wg_demolisher_engineer : public CreatureScript
|
||||||
@@ -468,8 +468,8 @@ class spell_wintergrasp_force_building : public SpellScriptLoader
|
|||||||
{
|
{
|
||||||
if (!sSpellMgr->GetSpellInfo(SPELL_BUILD_CATAPULT_FORCE)
|
if (!sSpellMgr->GetSpellInfo(SPELL_BUILD_CATAPULT_FORCE)
|
||||||
|| !sSpellMgr->GetSpellInfo(SPELL_BUILD_DEMOLISHER_FORCE)
|
|| !sSpellMgr->GetSpellInfo(SPELL_BUILD_DEMOLISHER_FORCE)
|
||||||
|| !sSpellMgr->GetSpellInfo(SPELL_BUILD_SIEGE_VEHICLE_FORCE_1)
|
|| !sSpellMgr->GetSpellInfo(SPELL_BUILD_SIEGE_VEHICLE_FORCE_HORDE)
|
||||||
|| !sSpellMgr->GetSpellInfo(SPELL_BUILD_SIEGE_VEHICLE_FORCE_2))
|
|| !sSpellMgr->GetSpellInfo(SPELL_BUILD_SIEGE_VEHICLE_FORCE_ALLIANCE))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user