mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-22 18:15:31 +01:00
Core/Misc: Code style fixes and fix bug with fixed-level dependent removal of Tenacity buff
This commit is contained in:
@@ -289,7 +289,7 @@ void Battlefield::InvitePlayerToWar(Player *plr)
|
||||
|
||||
void Battlefield::InitStalker(uint32 entry, float x, float y, float z, float o)
|
||||
{
|
||||
if (Creature * creature = SpawnCreature(entry, x, y, z, o, TEAM_NEUTRAL))
|
||||
if (Creature* creature = SpawnCreature(entry, x, y, z, o, TEAM_NEUTRAL))
|
||||
StalkerGuid = creature->GetGUID();
|
||||
else
|
||||
sLog->outError("Battlefield::InitStalker: could not spawn Stalker (Creature entry %u), zone messeges will be un-available", entry);
|
||||
@@ -507,7 +507,7 @@ void Battlefield::RegisterZone(uint32 zoneId)
|
||||
sBattlefieldMgr.AddZone(zoneId, this);
|
||||
}
|
||||
|
||||
void Battlefield::HideNpc(Creature * p_Creature)
|
||||
void Battlefield::HideNpc(Creature *p_Creature)
|
||||
{
|
||||
p_Creature->CombatStop();
|
||||
p_Creature->SetReactState(REACT_PASSIVE);
|
||||
@@ -517,7 +517,7 @@ void Battlefield::HideNpc(Creature * p_Creature)
|
||||
p_Creature->SetVisible(false);
|
||||
}
|
||||
|
||||
void Battlefield::ShowNpc(Creature * p_Creature, bool p_Aggressive)
|
||||
void Battlefield::ShowNpc(Creature *p_Creature, bool p_Aggressive)
|
||||
{
|
||||
p_Creature->SetPhaseMask(1, true);
|
||||
p_Creature->SetVisible(true);
|
||||
@@ -730,7 +730,7 @@ BfGraveYard::BfGraveYard(Battlefield *Bf)
|
||||
void BfGraveYard::Init(uint32 horde_entry, uint32 alliance_entry, float x, float y, float z, float o, TeamId startcontrol, uint32 gy)
|
||||
{
|
||||
m_ControlTeam = startcontrol;
|
||||
if (Creature * cre = m_Bf->SpawnCreature(horde_entry, x, y, z, o, TEAM_HORDE))
|
||||
if (Creature* cre = m_Bf->SpawnCreature(horde_entry, x, y, z, o, TEAM_HORDE))
|
||||
{
|
||||
m_SpiritGuide[TEAM_HORDE] = cre;
|
||||
m_SpiritGuide[TEAM_HORDE]->SetReactState(REACT_PASSIVE);
|
||||
@@ -740,7 +740,7 @@ void BfGraveYard::Init(uint32 horde_entry, uint32 alliance_entry, float x, float
|
||||
else
|
||||
sLog->outError("BfGraveYard::Init can't spawn horde spiritguide %u", horde_entry);
|
||||
|
||||
if (Creature * cre = m_Bf->SpawnCreature(alliance_entry, x, y, z, o, TEAM_ALLIANCE))
|
||||
if (Creature* cre = m_Bf->SpawnCreature(alliance_entry, x, y, z, o, TEAM_ALLIANCE))
|
||||
{
|
||||
m_SpiritGuide[TEAM_ALLIANCE] = cre;
|
||||
m_SpiritGuide[TEAM_ALLIANCE]->SetReactState(REACT_PASSIVE);
|
||||
@@ -896,12 +896,12 @@ Creature *Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl
|
||||
GameObject *Battlefield::SpawnGameObject(uint32 entry, float x, float y, float z, float o)
|
||||
{
|
||||
//Get map object
|
||||
Map *map = const_cast < Map * >(sMapMgr->CreateBaseMap(571));
|
||||
Map* map = const_cast < Map * >(sMapMgr->CreateBaseMap(571));
|
||||
if (!map)
|
||||
return 0;
|
||||
|
||||
//Create gameobject
|
||||
GameObject *go = new GameObject;
|
||||
GameObject* go = new GameObject;
|
||||
if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, map, PHASEMASK_NORMAL, x, y, z, o, 0, 0, 0, 0, 100, GO_STATE_READY))
|
||||
{
|
||||
sLog->outErrorDb("Gameobject template %u not found in database! Battleground not created!", entry);
|
||||
|
||||
@@ -128,34 +128,34 @@ bool BattlefieldWG::SetupBattlefield()
|
||||
for (uint8 i = 0; i < WG_MAX_KEEP_NPC; i++)
|
||||
{
|
||||
// Horde npc
|
||||
if (Creature * creature = SpawnCreature(WGKeepNPC[i].entryh, WGKeepNPC[i].x, WGKeepNPC[i].y, WGKeepNPC[i].z, WGKeepNPC[i].o, TEAM_HORDE))
|
||||
if (Creature* creature = SpawnCreature(WGKeepNPC[i].entryh, WGKeepNPC[i].x, WGKeepNPC[i].y, WGKeepNPC[i].z, WGKeepNPC[i].o, TEAM_HORDE))
|
||||
KeepCreature[TEAM_HORDE].insert(creature->GetGUID());
|
||||
// Alliance npc
|
||||
if (Creature * creature = SpawnCreature(WGKeepNPC[i].entrya, WGKeepNPC[i].x, WGKeepNPC[i].y, WGKeepNPC[i].z, WGKeepNPC[i].o, TEAM_ALLIANCE))
|
||||
if (Creature* creature = SpawnCreature(WGKeepNPC[i].entrya, WGKeepNPC[i].x, WGKeepNPC[i].y, WGKeepNPC[i].z, WGKeepNPC[i].o, TEAM_ALLIANCE))
|
||||
KeepCreature[TEAM_ALLIANCE].insert(creature->GetGUID());
|
||||
}
|
||||
// Hide keep npc
|
||||
for (GuidSet::const_iterator itr = KeepCreature[GetAttackerTeam()].begin(); itr != KeepCreature[GetAttackerTeam()].end(); ++itr)
|
||||
if (Unit * unit = sObjectAccessor->FindUnit((*itr)))
|
||||
if (Creature * creature = unit->ToCreature())
|
||||
if (Unit* unit = sObjectAccessor->FindUnit((*itr)))
|
||||
if (Creature* creature = unit->ToCreature())
|
||||
HideNpc(creature);
|
||||
// Spawn out of keep npc
|
||||
// Horde npc
|
||||
for (uint8 i = 0; i < WG_OUTSIDE_ALLIANCE_NPC; i++)
|
||||
if (Creature * creature = SpawnCreature(WGOutsideNPC[i].entryh, WGOutsideNPC[i].x, WGOutsideNPC[i].y, WGOutsideNPC[i].z, WGOutsideNPC[i].o, TEAM_HORDE))
|
||||
if (Creature* creature = SpawnCreature(WGOutsideNPC[i].entryh, WGOutsideNPC[i].x, WGOutsideNPC[i].y, WGOutsideNPC[i].z, WGOutsideNPC[i].o, TEAM_HORDE))
|
||||
OutsideCreature[TEAM_HORDE].insert(creature->GetGUID());
|
||||
// Alliance npc
|
||||
for (uint8 i = WG_OUTSIDE_ALLIANCE_NPC; i < WG_MAX_OUTSIDE_NPC; i++)
|
||||
if (Creature * creature = SpawnCreature(WGOutsideNPC[i].entrya, WGOutsideNPC[i].x, WGOutsideNPC[i].y, WGOutsideNPC[i].z, WGOutsideNPC[i].o, TEAM_ALLIANCE))
|
||||
if (Creature* creature = SpawnCreature(WGOutsideNPC[i].entrya, WGOutsideNPC[i].x, WGOutsideNPC[i].y, WGOutsideNPC[i].z, WGOutsideNPC[i].o, TEAM_ALLIANCE))
|
||||
OutsideCreature[TEAM_ALLIANCE].insert(creature->GetGUID());
|
||||
// Hide outside npc
|
||||
for (GuidSet::const_iterator itr = OutsideCreature[GetDefenderTeam()].begin(); itr != OutsideCreature[GetDefenderTeam()].end(); ++itr)
|
||||
if (Unit * unit = sObjectAccessor->FindUnit((*itr)))
|
||||
if (Creature * creature = unit->ToCreature())
|
||||
if (Unit* unit = sObjectAccessor->FindUnit((*itr)))
|
||||
if (Creature* creature = unit->ToCreature())
|
||||
HideNpc(creature);
|
||||
for (uint8 i = 0; i < WG_MAX_TURRET; i++)
|
||||
{
|
||||
if (Creature * creature = SpawnCreature(28366, WGTurret[i].x, WGTurret[i].y, WGTurret[i].z, WGTurret[i].o, TeamId(0)))
|
||||
if (Creature* creature = SpawnCreature(28366, WGTurret[i].x, WGTurret[i].y, WGTurret[i].z, WGTurret[i].o, TeamId(0)))
|
||||
{
|
||||
CanonList.insert(creature->GetGUID());
|
||||
HideNpc(creature);
|
||||
@@ -164,7 +164,7 @@ bool BattlefieldWG::SetupBattlefield()
|
||||
// Spawning Buiding
|
||||
for (uint8 i = 0; i < WG_MAX_OBJ; i++)
|
||||
{
|
||||
GameObject *go =
|
||||
GameObject* go =
|
||||
SpawnGameObject(WGGameObjectBuillding[i].entry, WGGameObjectBuillding[i].x, WGGameObjectBuillding[i].y, WGGameObjectBuillding[i].z, WGGameObjectBuillding[i].o);
|
||||
BfWGGameObjectBuilding *b = new BfWGGameObjectBuilding(this);
|
||||
b->Init(go, WGGameObjectBuillding[i].type, WGGameObjectBuillding[i].WorldState, WGGameObjectBuillding[i].nameid);
|
||||
@@ -173,7 +173,7 @@ bool BattlefieldWG::SetupBattlefield()
|
||||
// Spawning portal defender
|
||||
for (uint8 i = 0; i < WG_MAX_TELEPORTER; i++)
|
||||
{
|
||||
GameObject *go = SpawnGameObject(WGPortalDefenderData[i].entry, WGPortalDefenderData[i].x, WGPortalDefenderData[i].y, WGPortalDefenderData[i].z, WGPortalDefenderData[i].o);
|
||||
GameObject* go = SpawnGameObject(WGPortalDefenderData[i].entry, WGPortalDefenderData[i].x, WGPortalDefenderData[i].y, WGPortalDefenderData[i].z, WGPortalDefenderData[i].o);
|
||||
DefenderPortalList.insert(go);
|
||||
go->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[GetDefenderTeam()]);
|
||||
}
|
||||
@@ -181,12 +181,12 @@ bool BattlefieldWG::SetupBattlefield()
|
||||
// Spawn banner in keep
|
||||
for (uint8 i = 0; i < WG_KEEPGAMEOBJECT_MAX; i++)
|
||||
{
|
||||
if (GameObject * go = SpawnGameObject(WGKeepGameObject[i].entryh, WGKeepGameObject[i].x, WGKeepGameObject[i].y, WGKeepGameObject[i].z, WGKeepGameObject[i].o))
|
||||
if (GameObject* go = SpawnGameObject(WGKeepGameObject[i].entryh, WGKeepGameObject[i].x, WGKeepGameObject[i].y, WGKeepGameObject[i].z, WGKeepGameObject[i].o))
|
||||
{
|
||||
go->SetRespawnTime(GetDefenderTeam()? RESPAWN_ONE_DAY : RESPAWN_IMMEDIATELY);
|
||||
m_KeepGameObject[1].insert(go);
|
||||
}
|
||||
if (GameObject * go = SpawnGameObject(WGKeepGameObject[i].entrya, WGKeepGameObject[i].x, WGKeepGameObject[i].y, WGKeepGameObject[i].z, WGKeepGameObject[i].o))
|
||||
if (GameObject* go = SpawnGameObject(WGKeepGameObject[i].entrya, WGKeepGameObject[i].x, WGKeepGameObject[i].y, WGKeepGameObject[i].z, WGKeepGameObject[i].o))
|
||||
{
|
||||
go->SetRespawnTime(GetDefenderTeam()? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
|
||||
m_KeepGameObject[0].insert(go);
|
||||
@@ -299,9 +299,9 @@ void BattlefieldWG::OnBattleStart()
|
||||
// Update tower visibility and update faction
|
||||
for (GuidSet::const_iterator itr = CanonList.begin(); itr != CanonList.end(); ++itr)
|
||||
{
|
||||
if (Unit * unit = sObjectAccessor->FindUnit((*itr)))
|
||||
if (Unit* unit = sObjectAccessor->FindUnit((*itr)))
|
||||
{
|
||||
if (Creature * creature = unit->ToCreature())
|
||||
if (Creature* creature = unit->ToCreature())
|
||||
{
|
||||
ShowNpc(creature, true);
|
||||
creature->setFaction(WintergraspFaction[GetDefenderTeam()]);
|
||||
@@ -402,20 +402,20 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer)
|
||||
for (GuidSet::const_iterator itr = KeepCreature[GetAttackerTeam()].begin(); itr != KeepCreature[GetAttackerTeam()].end(); ++itr)
|
||||
{
|
||||
if (Unit* unit = sObjectAccessor->FindUnit((*itr)))
|
||||
if (Creature * creature = unit->ToCreature())
|
||||
if (Creature* creature = unit->ToCreature())
|
||||
HideNpc(creature);
|
||||
}
|
||||
for (GuidSet::const_iterator itr = KeepCreature[GetDefenderTeam()].begin(); itr != KeepCreature[GetDefenderTeam()].end(); ++itr)
|
||||
{
|
||||
if (Unit* unit = sObjectAccessor->FindUnit((*itr)))
|
||||
if (Creature * creature = unit->ToCreature())
|
||||
if (Creature* creature = unit->ToCreature())
|
||||
ShowNpc(creature, true);
|
||||
}
|
||||
// Change all npc out of keep
|
||||
for (GuidSet::const_iterator itr = OutsideCreature[GetDefenderTeam()].begin(); itr != OutsideCreature[GetDefenderTeam()].end(); ++itr)
|
||||
{
|
||||
if (Unit* unit = sObjectAccessor->FindUnit((*itr)))
|
||||
if (Creature * creature = unit->ToCreature())
|
||||
if (Creature* creature = unit->ToCreature())
|
||||
HideNpc(creature);
|
||||
}
|
||||
for (GuidSet::const_iterator itr = OutsideCreature[GetAttackerTeam()].begin(); itr != OutsideCreature[GetAttackerTeam()].end(); ++itr)
|
||||
@@ -611,7 +611,7 @@ void BattlefieldWG::OnStartGrouping()
|
||||
SendWarningToAllInZone(BATTLEFIELD_WG_TEXT_WILL_START);
|
||||
}
|
||||
|
||||
void BattlefieldWG::OnCreatureCreate(Creature * creature, bool add)
|
||||
void BattlefieldWG::OnCreatureCreate(Creature *creature, bool add)
|
||||
{
|
||||
if (IsWarTime())
|
||||
{
|
||||
@@ -702,9 +702,9 @@ void BattlefieldWG::HandleKill(Player *killer, Unit *victim)
|
||||
for (GuidSet::const_iterator itr = m_vehicles[killer->GetTeamId()? TEAM_ALLIANCE : TEAM_HORDE].begin();
|
||||
itr != m_vehicles[killer->GetTeamId()? TEAM_ALLIANCE : TEAM_HORDE].end(); ++itr)
|
||||
{
|
||||
if (Unit * unit = sObjectAccessor->FindUnit((*itr)))
|
||||
if (Unit* unit = sObjectAccessor->FindUnit((*itr)))
|
||||
{
|
||||
if (Creature * creature = unit->ToCreature())
|
||||
if (Creature* creature = unit->ToCreature())
|
||||
{
|
||||
if (victim->GetEntry() == creature->GetEntry() && !again)
|
||||
{
|
||||
@@ -722,9 +722,9 @@ void BattlefieldWG::HandleKill(Player *killer, Unit *victim)
|
||||
for (GuidSet::const_iterator itr = KeepCreature[killer->GetTeamId()? TEAM_ALLIANCE : TEAM_HORDE].begin();
|
||||
itr != KeepCreature[killer->GetTeamId()? TEAM_ALLIANCE : TEAM_HORDE].end(); ++itr)
|
||||
{
|
||||
if (Unit * unit = sObjectAccessor->FindUnit((*itr)))
|
||||
if (Unit* unit = sObjectAccessor->FindUnit((*itr)))
|
||||
{
|
||||
if (Creature * creature = unit->ToCreature())
|
||||
if (Creature* creature = unit->ToCreature())
|
||||
{
|
||||
if (victim->GetEntry() == creature->GetEntry() && !again)
|
||||
{
|
||||
@@ -750,7 +750,7 @@ void BattlefieldWG::PromotePlayer(Player *killer)
|
||||
if (!m_WarTime)
|
||||
return;
|
||||
// Updating rank of player
|
||||
if (Aura * aur = killer->GetAura(SPELL_RECRUIT))
|
||||
if (Aura* aur = killer->GetAura(SPELL_RECRUIT))
|
||||
{
|
||||
if (aur->GetStackAmount() >= 5) // 7 or more TODO:
|
||||
{
|
||||
@@ -761,7 +761,7 @@ void BattlefieldWG::PromotePlayer(Player *killer)
|
||||
else
|
||||
killer->CastSpell(killer, SPELL_RECRUIT, true);
|
||||
}
|
||||
else if (Aura * aur = killer->GetAura(SPELL_CORPORAL))
|
||||
else if (Aura* aur = killer->GetAura(SPELL_CORPORAL))
|
||||
{
|
||||
if (aur->GetStackAmount() >= 5) // 7 or more TODO:
|
||||
{
|
||||
@@ -997,7 +997,7 @@ void BattlefieldWG::AddBrokenTower(TeamId team)
|
||||
}
|
||||
}
|
||||
|
||||
void BattlefieldWG::ProcessEvent(GameObject * obj, uint32 eventId)
|
||||
void BattlefieldWG::ProcessEvent(GameObject *obj, uint32 eventId)
|
||||
{
|
||||
if (!obj || !IsWarTime())
|
||||
return;
|
||||
@@ -1079,7 +1079,7 @@ void BattlefieldWG::UpdateTenacity()
|
||||
{
|
||||
for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||
if (Player* plr = sObjectMgr->GetPlayer((*itr)))
|
||||
if (plr->getLevel() > 76)
|
||||
if (plr->getLevel() >= m_MinLevel))
|
||||
plr->RemoveAurasDueToSpell(SPELL_TENACITY);
|
||||
|
||||
for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
|
||||
@@ -1108,7 +1108,7 @@ void BattlefieldWG::UpdateTenacity()
|
||||
plr->SetAuraStack(SPELL_TENACITY, plr, newStack);
|
||||
for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
|
||||
if (Unit* unit = sObjectAccessor->FindUnit((*itr)))
|
||||
if (Creature * creature = unit->ToCreature())
|
||||
if (Creature* creature = unit->ToCreature())
|
||||
creature->SetAuraStack(SPELL_TENACITY_VEHICLE, creature, newStack);
|
||||
|
||||
if (buff_honnor != 0)
|
||||
@@ -1129,13 +1129,13 @@ void BfCapturePointWG::ChangeTeam(TeamId /*oldTeam */ )
|
||||
m_WorkShop->ChangeControl(m_team, false);
|
||||
}
|
||||
|
||||
BfCapturePointWG::BfCapturePointWG(BattlefieldWG * bf, TeamId control):BfCapturePoint(bf)
|
||||
BfCapturePointWG::BfCapturePointWG(BattlefieldWG *bf, TeamId control):BfCapturePoint(bf)
|
||||
{
|
||||
m_Bf = bf;
|
||||
m_team = control;
|
||||
}
|
||||
|
||||
BfGraveYardWG::BfGraveYardWG(BattlefieldWG * bf):BfGraveYard(bf)
|
||||
BfGraveYardWG::BfGraveYardWG(BattlefieldWG *bf):BfGraveYard(bf)
|
||||
{
|
||||
m_Bf = bf;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user