Core/Battlefield: Fix issue with previous commit. codestyle cleanup and attempt to fix vehicle issues with worldstates.

This commit is contained in:
Kandera
2012-08-20 13:49:22 -04:00
parent 9c5b1b2bb6
commit d31902d858
2 changed files with 21 additions and 13 deletions
@@ -31,6 +31,14 @@ enum WGBfData
BATTLEFIELD_WG_MAPID = 571, // Northrend BATTLEFIELD_WG_MAPID = 571, // Northrend
}; };
enum WGVehicles
{
NPC_WG_SEIGE_ENGINE_ALLIANCE = 28312,
NPC_WG_SEIGE_ENGINE_HORDE = 32627,
NPC_WG_DEMOLISHER = 28094,
NPC_WG_CATAPULT = 27881,
};
bool BattlefieldWG::SetupBattlefield() bool BattlefieldWG::SetupBattlefield()
{ {
InitStalker(BATTLEFIELD_WG_NPC_STALKER, WintergraspStalkerPos[0], WintergraspStalkerPos[1], WintergraspStalkerPos[2], WintergraspStalkerPos[3]); InitStalker(BATTLEFIELD_WG_NPC_STALKER, WintergraspStalkerPos[0], WintergraspStalkerPos[1], WintergraspStalkerPos[2], WintergraspStalkerPos[3]);
@@ -580,10 +588,10 @@ void BattlefieldWG::OnCreatureCreate(Creature *creature)
{ {
switch (creature->GetEntry()) switch (creature->GetEntry())
{ {
case 28312: case NPC_WG_SEIGE_ENGINE_ALLIANCE:
case 32627: case NPC_WG_SEIGE_ENGINE_HORDE:
case 27881: case NPC_WG_CATAPULT:
case 28094: case NPC_WG_DEMOLISHER:
{ {
uint8 team; uint8 team;
if (creature->getFaction() == WintergraspFaction[TEAM_ALLIANCE]) if (creature->getFaction() == WintergraspFaction[TEAM_ALLIANCE])
@@ -595,10 +603,10 @@ void BattlefieldWG::OnCreatureCreate(Creature *creature)
if (team == TEAM_HORDE) if (team == TEAM_HORDE)
{ {
m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_H]++;
if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_H) <= GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H)) if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_H) <= GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H))
{ {
creature->AddAura(SPELL_HORDE_FLAG, creature); m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_H]++;
creature->CastSpell(creature, SPELL_HORDE_FLAG, true);
m_vehicles[team].insert(creature->GetGUID()); m_vehicles[team].insert(creature->GetGUID());
UpdateVehicleCountWG(); UpdateVehicleCountWG();
} }
@@ -611,10 +619,10 @@ void BattlefieldWG::OnCreatureCreate(Creature *creature)
} }
else else
{ {
m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_A]++;
if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_A) <= GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A)) if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_A) <= GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A))
{ {
creature->AddAura(SPELL_ALLIANCE_FLAG, creature); m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_A]++;
creature->CastSpell(creature, SPELL_ALLIANCE_FLAG, true);
m_vehicles[team].insert(creature->GetGUID()); m_vehicles[team].insert(creature->GetGUID());
UpdateVehicleCountWG(); UpdateVehicleCountWG();
} }
@@ -637,10 +645,10 @@ void BattlefieldWG::OnCreatureRemove(Creature* creature)
{ {
switch (creature->GetEntry()) switch (creature->GetEntry())
{ {
case 28312: case NPC_WG_SEIGE_ENGINE_ALLIANCE:
case 32627: case NPC_WG_SEIGE_ENGINE_HORDE:
case 27881: case NPC_WG_CATAPULT:
case 28094: case NPC_WG_DEMOLISHER:
{ {
uint8 team; uint8 team;
if (creature->getFaction() == WintergraspFaction[TEAM_ALLIANCE]) if (creature->getFaction() == WintergraspFaction[TEAM_ALLIANCE])
+1 -1
View File
@@ -266,7 +266,7 @@ class go_wg_vehicle_teleporter : public GameObjectScript
uint32 plfaction = passenger->getFaction(); uint32 plfaction = passenger->getFaction();
if (gofaction == plfaction) if (gofaction == plfaction)
{ {
if (Creature teleportTrigger = vehicleCreature->FindNearestCreature(NPC_WORLD_TRIGGER_WG,100.0f,true)) if (Creature* teleportTrigger = vehicleCreature->FindNearestCreature(NPC_WORLD_TRIGGER_WG,100.0f,true))
teleportTrigger->CastSpell(vehicleCreature, SPELL_VEHICLE_TELEPORT, true); teleportTrigger->CastSpell(vehicleCreature, SPELL_VEHICLE_TELEPORT, true);
} }
} }