*Massive cleanup (\n\n -> \n, *\n -> \n, cleanup for(...) to for (...), and some other cleanups by hand)
*Fix a possible crash in Spell::DoAllEffectOnTarget --HG-- branch : trunk
This commit is contained in:
1 parent
f21f47005d
commit
26b5e033ff
2257 files changed
+750
-103852
No files matched your search
@@ -17,10 +17,8 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "ObjectMgr.h"
|
||||
#include "WorldPacket.h"
|
||||
|
||||
#include "BattleGround.h"
|
||||
#include "BattleGroundAV.h"
|
||||
#include "Formulas.h"
|
||||
@@ -28,36 +26,29 @@
|
||||
#include "Language.h"
|
||||
#include "Player.h"
|
||||
#include "SpellAuras.h"
|
||||
|
||||
BattleGroundAV::BattleGroundAV()
|
||||
{
|
||||
m_BgObjects.resize(BG_AV_OBJECT_MAX);
|
||||
m_BgCreatures.resize(AV_CPLACE_MAX+AV_STATICCPLACE_MAX);
|
||||
|
||||
m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_AV_START_TWO_MINUTES;
|
||||
m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_AV_START_ONE_MINUTE;
|
||||
m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_AV_START_HALF_MINUTE;
|
||||
m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_AV_HAS_BEGUN;
|
||||
}
|
||||
|
||||
BattleGroundAV::~BattleGroundAV()
|
||||
{
|
||||
}
|
||||
|
||||
const uint16 BattleGroundAV::GetBonusHonor(uint8 kills) //TODO: move this function to Battleground.cpp (needs to find a way to get m_MaxLevel)
|
||||
{
|
||||
return Trinity::Honor::hk_honor_at_level(m_MaxLevel, kills);
|
||||
}
|
||||
|
||||
void BattleGroundAV::HandleKillPlayer(Player *player, Player *killer)
|
||||
{
|
||||
if(GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
BattleGround::HandleKillPlayer(player, killer);
|
||||
UpdateScore(player->GetTeam(),-1);
|
||||
}
|
||||
|
||||
void BattleGroundAV::HandleKillUnit(Creature *unit, Player *killer)
|
||||
{
|
||||
sLog.outDebug("bg_av HandleKillUnit %i",unit->GetEntry());
|
||||
@@ -95,7 +86,6 @@ void BattleGroundAV::HandleKillUnit(Creature *unit, Player *killer)
|
||||
Creature* creature = GetBGCreature(AV_CPLACE_HERALD);
|
||||
if(creature)
|
||||
YellToAll(creature,GetTrinityString(LANG_BG_AV_A_CAPTAIN_DEAD),LANG_UNIVERSAL);
|
||||
|
||||
}
|
||||
else if ( entry == BG_AV_CreatureInfo[AV_NPC_H_CAPTAIN][0] )
|
||||
{
|
||||
@@ -120,7 +110,6 @@ void BattleGroundAV::HandleKillUnit(Creature *unit, Player *killer)
|
||||
else if ( entry == BG_AV_CreatureInfo[AV_NPC_S_MINE_N_4][0] || entry == BG_AV_CreatureInfo[AV_NPC_S_MINE_A_4][0] || entry == BG_AV_CreatureInfo[AV_NPC_S_MINE_H_4][0])
|
||||
ChangeMineOwner(AV_SOUTH_MINE,killer->GetTeam());
|
||||
}
|
||||
|
||||
void BattleGroundAV::HandleQuestComplete(uint32 questid, Player *player)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
@@ -224,13 +213,11 @@ void BattleGroundAV::HandleQuestComplete(uint32 questid, Player *player)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BattleGroundAV::UpdateScore(uint16 team, int16 points )
|
||||
{ //note: to remove reinforcementpoints points must be negative, for adding reinforcements points must be positive
|
||||
assert( team == ALLIANCE || team == HORDE);
|
||||
uint8 teamindex = GetTeamIndexByTeamId(team); //0=ally 1=horde
|
||||
m_Team_Scores[teamindex] += points;
|
||||
|
||||
UpdateWorldState(((teamindex==BG_TEAM_HORDE)?AV_Horde_Score:AV_Alliance_Score), m_Team_Scores[teamindex]);
|
||||
if( points < 0)
|
||||
{
|
||||
@@ -247,7 +234,6 @@ void BattleGroundAV::UpdateScore(uint16 team, int16 points )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Creature* BattleGroundAV::AddAVCreature(uint16 cinfoid, uint16 type )
|
||||
{
|
||||
uint32 level;
|
||||
@@ -271,7 +257,6 @@ Creature* BattleGroundAV::AddAVCreature(uint16 cinfoid, uint16 type )
|
||||
return NULL;
|
||||
if(creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_A_CAPTAIN][0] || creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_H_CAPTAIN][0])
|
||||
creature->SetRespawnDelay(RESPAWN_ONE_DAY); // TODO: look if this can be done by database + also add this for the wingcommanders
|
||||
|
||||
if((isStatic && cinfoid>=10 && cinfoid<=14) || (!isStatic && ((cinfoid >= AV_NPC_A_GRAVEDEFENSE0 && cinfoid<=AV_NPC_A_GRAVEDEFENSE3) ||
|
||||
(cinfoid>=AV_NPC_H_GRAVEDEFENSE0 && cinfoid<=AV_NPC_H_GRAVEDEFENSE3))))
|
||||
{
|
||||
@@ -289,17 +274,14 @@ Creature* BattleGroundAV::AddAVCreature(uint16 cinfoid, uint16 type )
|
||||
//TODO: find a way to add a motionmaster without killing the creature (i
|
||||
//just copied this code from a gm-command
|
||||
}
|
||||
|
||||
if(level != 0)
|
||||
level += m_MaxLevel-60; //maybe we can do this more generic for custom level-range.. actually it's blizzlike
|
||||
creature->SetLevel(level);
|
||||
return creature;
|
||||
}
|
||||
|
||||
void BattleGroundAV::Update(uint32 diff)
|
||||
{
|
||||
BattleGround::Update(diff);
|
||||
|
||||
if(GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
for(uint8 i=0; i<=1;i++)//0=alliance, 1=horde
|
||||
@@ -335,7 +317,6 @@ void BattleGroundAV::Update(uint32 diff)
|
||||
{
|
||||
if( m_Mine_Timer <= 0)
|
||||
UpdateScore(m_Mine_Owner[mine],1);
|
||||
|
||||
if(m_Mine_Reclaim_Timer[mine] > diff)
|
||||
m_Mine_Reclaim_Timer[mine] -= diff;
|
||||
else{ //we don't need to set this timer to 0 cause this codepart wont get called when this thing is 0
|
||||
@@ -345,7 +326,6 @@ void BattleGroundAV::Update(uint32 diff)
|
||||
}
|
||||
if( m_Mine_Timer <= 0)
|
||||
m_Mine_Timer=AV_MINE_TICK_TIMER; //this is at the end, cause we need to update both mines
|
||||
|
||||
//looks for all timers of the nodes and destroy the building (for graveyards the building wont get destroyed, it goes just to the other team
|
||||
for(BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i)
|
||||
if(m_Nodes[i].State == POINT_ASSAULTED) //maybe remove this
|
||||
@@ -357,13 +337,11 @@ void BattleGroundAV::Update(uint32 diff)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BattleGroundAV::StartingEventCloseDoors()
|
||||
{
|
||||
DoorClose(BG_AV_OBJECT_DOOR_A);
|
||||
DoorClose(BG_AV_OBJECT_DOOR_H);
|
||||
}
|
||||
|
||||
void BattleGroundAV::StartingEventOpenDoors()
|
||||
{
|
||||
sLog.outDebug("BG_AV: start spawning mine stuff");
|
||||
@@ -373,14 +351,11 @@ void BattleGroundAV::StartingEventOpenDoors()
|
||||
SpawnBGObject(i,RESPAWN_IMMEDIATELY);
|
||||
for(uint8 mine = AV_NORTH_MINE; mine <= AV_SOUTH_MINE; mine++) //mine population
|
||||
ChangeMineOwner(mine, AV_NEUTRAL_TEAM,true);
|
||||
|
||||
UpdateWorldState(AV_SHOW_H_SCORE, 1);
|
||||
UpdateWorldState(AV_SHOW_A_SCORE, 1);
|
||||
|
||||
DoorOpen(BG_AV_OBJECT_DOOR_H);
|
||||
DoorOpen(BG_AV_OBJECT_DOOR_A);
|
||||
}
|
||||
|
||||
void BattleGroundAV::AddPlayer(Player *plr)
|
||||
{
|
||||
BattleGround::AddPlayer(plr);
|
||||
@@ -389,9 +364,7 @@ void BattleGroundAV::AddPlayer(Player *plr)
|
||||
m_PlayerScores[plr->GetGUID()] = sc;
|
||||
if(m_MaxLevel==0)
|
||||
m_MaxLevel=(plr->getLevel()%10 == 0)? plr->getLevel() : (plr->getLevel()-(plr->getLevel()%10))+10; //TODO: just look at the code \^_^/ --but queue-info should provide this information..
|
||||
|
||||
}
|
||||
|
||||
void BattleGroundAV::EndBattleGround(uint32 winner)
|
||||
{
|
||||
//calculate bonuskills for both teams:
|
||||
@@ -414,7 +387,6 @@ void BattleGroundAV::EndBattleGround(uint32 winner)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(int i=0; i<=1; i++) //0=ally 1=horde
|
||||
{
|
||||
if(m_CaptainAlive[i])
|
||||
@@ -427,11 +399,9 @@ void BattleGroundAV::EndBattleGround(uint32 winner)
|
||||
if(kills[i] != 0)
|
||||
RewardHonorToTeam(GetBonusHonor(kills[i]),(i == 0)?ALLIANCE:HORDE);
|
||||
}
|
||||
|
||||
//TODO add enterevademode for all attacking creatures
|
||||
BattleGround::EndBattleGround(winner);
|
||||
}
|
||||
|
||||
void BattleGroundAV::RemovePlayer(Player* plr,uint64 /*guid*/)
|
||||
{
|
||||
if(!plr)
|
||||
@@ -445,13 +415,11 @@ void BattleGroundAV::RemovePlayer(Player* plr,uint64 /*guid*/)
|
||||
plr->RemoveAurasDueToSpell(AV_BUFF_H_CAPTAIN);
|
||||
}
|
||||
|
||||
|
||||
void BattleGroundAV::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||
{
|
||||
// this is wrong way to implement these things. On official it done by gameobject spell cast.
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
uint32 SpellId = 0;
|
||||
switch(Trigger)
|
||||
{
|
||||
@@ -481,18 +449,14 @@ void BattleGroundAV::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||
// Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger);
|
||||
break;
|
||||
}
|
||||
|
||||
if (SpellId)
|
||||
Source->CastSpell(Source, SpellId, true);
|
||||
}
|
||||
|
||||
void BattleGroundAV::UpdatePlayerScore(Player* Source, uint32 type, uint32 value)
|
||||
{
|
||||
|
||||
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID());
|
||||
if(itr == m_PlayerScores.end()) // player not found...
|
||||
return;
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case SCORE_GRAVEYARDS_ASSAULTED:
|
||||
@@ -522,19 +486,14 @@ void BattleGroundAV::UpdatePlayerScore(Player* Source, uint32 type, uint32 value
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void BattleGroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node)
|
||||
{
|
||||
|
||||
uint32 object = GetObjectThroughNode(node);
|
||||
sLog.outDebug("bg_av: player destroyed point node %i object %i",node,object);
|
||||
|
||||
//despawn banner
|
||||
SpawnBGObject(object, RESPAWN_ONE_DAY);
|
||||
DestroyNode(node);
|
||||
UpdateNodeWorldState(node);
|
||||
|
||||
uint32 owner = m_Nodes[node].Owner;
|
||||
if( IsTower(node) )
|
||||
{
|
||||
@@ -547,11 +506,9 @@ void BattleGroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node)
|
||||
//spawn destroyed aura
|
||||
for(uint8 i=0; i<=9; i++)
|
||||
SpawnBGObject(BG_AV_OBJECT_BURN_DUNBALDAR_SOUTH + i + (tmp * 10),RESPAWN_IMMEDIATELY);
|
||||
|
||||
UpdateScore((owner == ALLIANCE) ? HORDE : ALLIANCE, (-1)*BG_AV_RES_TOWER);
|
||||
RewardReputationToTeam((owner == ALLIANCE)?730:729,BG_AV_REP_TOWER,owner);
|
||||
RewardHonorToTeam(GetBonusHonor(BG_AV_KILL_TOWER),owner);
|
||||
|
||||
SpawnBGObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+GetTeamIndexByTeamId(owner)+(2*tmp),RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+GetTeamIndexByTeamId(owner)+(2*tmp),RESPAWN_ONE_DAY);
|
||||
}
|
||||
@@ -579,12 +536,10 @@ void BattleGroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node)
|
||||
sprintf(buf, GetTrinityString(LANG_BG_AV_TOWER_TAKEN) , GetNodeName(node),( owner == ALLIANCE ) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE) );
|
||||
else
|
||||
sprintf(buf, GetTrinityString(LANG_BG_AV_GRAVE_TAKEN) , GetNodeName(node),( owner == ALLIANCE ) ? GetTrinityString(LANG_BG_AV_ALLY) :GetTrinityString(LANG_BG_AV_HORDE) );
|
||||
|
||||
Creature* creature = GetBGCreature(AV_CPLACE_HERALD);
|
||||
if(creature)
|
||||
YellToAll(creature,buf,LANG_UNIVERSAL);
|
||||
}
|
||||
|
||||
void BattleGroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial)
|
||||
{ //mine=0 northmine mine=1 southmin
|
||||
//changing the owner results in setting respawntim to infinite for current creatures, spawning new mine owners creatures and changing the chest-objects so that the current owning team can use them
|
||||
@@ -593,12 +548,10 @@ void BattleGroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial)
|
||||
team = AV_NEUTRAL_TEAM;
|
||||
else
|
||||
PlaySoundToAll((team==ALLIANCE)?AV_SOUND_ALLIANCE_GOOD:AV_SOUND_HORDE_GOOD);
|
||||
|
||||
if(m_Mine_Owner[mine] == team && !initial)
|
||||
return;
|
||||
m_Mine_PrevOwner[mine] = m_Mine_Owner[mine];
|
||||
m_Mine_Owner[mine] = team;
|
||||
|
||||
if(!initial)
|
||||
{
|
||||
sLog.outDebug("bg_av depopulating mine %i (0=north,1=south)",mine);
|
||||
@@ -611,7 +564,6 @@ void BattleGroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial)
|
||||
DelCreature(i); //TODO here also
|
||||
}
|
||||
SendMineWorldStates(mine);
|
||||
|
||||
sLog.outDebug("bg_av populating mine %i (0=north,1=south)",mine);
|
||||
uint16 miner;
|
||||
//also neutral team exists.. after a big time, the neutral team tries to conquer the mine
|
||||
@@ -674,7 +626,6 @@ void BattleGroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial)
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
bool BattleGroundAV::PlayerCanDoMineQuest(int32 GOId,uint32 team)
|
||||
{
|
||||
if(GOId == BG_AV_OBJECTID_MINE_N)
|
||||
@@ -683,12 +634,10 @@ bool BattleGroundAV::PlayerCanDoMineQuest(int32 GOId,uint32 team)
|
||||
return (m_Mine_Owner[AV_SOUTH_MINE]==team);
|
||||
return true; //cause it's no mine'object it is ok if this is true
|
||||
}
|
||||
|
||||
void BattleGroundAV::PopulateNode(BG_AV_Nodes node)
|
||||
{
|
||||
uint32 owner = m_Nodes[node].Owner;
|
||||
assert(owner);
|
||||
|
||||
uint32 c_place = AV_CPLACE_DEFENSE_STORM_AID + ( 4 * node );
|
||||
uint32 creatureid;
|
||||
if(IsTower(node))
|
||||
@@ -709,7 +658,6 @@ void BattleGroundAV::PopulateNode(BG_AV_Nodes node)
|
||||
DelCreature(node);
|
||||
if( !AddSpiritGuide(node, BG_AV_CreaturePos[node][0], BG_AV_CreaturePos[node][1], BG_AV_CreaturePos[node][2], BG_AV_CreaturePos[node][3], owner))
|
||||
sLog.outError("AV: couldn't spawn spiritguide at node %i",node);
|
||||
|
||||
}
|
||||
for(uint8 i=0; i<4; i++)
|
||||
{
|
||||
@@ -727,7 +675,6 @@ void BattleGroundAV::DePopulateNode(BG_AV_Nodes node)
|
||||
DelCreature(node);
|
||||
}
|
||||
|
||||
|
||||
const BG_AV_Nodes BattleGroundAV::GetNodeThroughObject(uint32 object)
|
||||
{
|
||||
sLog.outDebug("bg_AV getnodethroughobject %i",object);
|
||||
@@ -749,7 +696,6 @@ const BG_AV_Nodes BattleGroundAV::GetNodeThroughObject(uint32 object)
|
||||
assert(false);
|
||||
return BG_AV_Nodes(0);
|
||||
}
|
||||
|
||||
const uint32 BattleGroundAV::GetObjectThroughNode(BG_AV_Nodes node)
|
||||
{ //this function is the counterpart to GetNodeThroughObject()
|
||||
sLog.outDebug("bg_AV GetObjectThroughNode %i",node);
|
||||
@@ -786,9 +732,7 @@ const uint32 BattleGroundAV::GetObjectThroughNode(BG_AV_Nodes node)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//called when using banner
|
||||
|
||||
void BattleGroundAV::EventPlayerClickedOnFlag(Player *source, GameObject* target_obj)
|
||||
{
|
||||
if(GetStatus() != STATUS_IN_PROGRESS)
|
||||
@@ -816,15 +760,12 @@ void BattleGroundAV::EventPlayerClickedOnFlag(Player *source, GameObject* target
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void BattleGroundAV::EventPlayerDefendsPoint(Player* player, uint32 object)
|
||||
{
|
||||
assert(GetStatus() == STATUS_IN_PROGRESS);
|
||||
BG_AV_Nodes node = GetNodeThroughObject(object);
|
||||
|
||||
uint32 owner = m_Nodes[node].Owner; //maybe should name it prevowner
|
||||
uint32 team = player->GetTeam();
|
||||
|
||||
if(owner == player->GetTeam() || m_Nodes[node].State != POINT_ASSAULTED)
|
||||
return;
|
||||
if(m_Nodes[node].TotalOwner == AV_NEUTRAL_TEAM)
|
||||
@@ -840,13 +781,11 @@ void BattleGroundAV::EventPlayerDefendsPoint(Player* player, uint32 object)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//spawn new go :)
|
||||
if(m_Nodes[node].Owner == ALLIANCE)
|
||||
SpawnBGObject(object+22, RESPAWN_IMMEDIATELY); //spawn horde banner
|
||||
else
|
||||
SpawnBGObject(object-22, RESPAWN_IMMEDIATELY); //spawn alliance banner
|
||||
|
||||
if(!IsTower(node))
|
||||
{
|
||||
SpawnBGObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION+3*node,RESPAWN_ONE_DAY);
|
||||
@@ -854,11 +793,9 @@ void BattleGroundAV::EventPlayerDefendsPoint(Player* player, uint32 object)
|
||||
}
|
||||
// despawn old go
|
||||
SpawnBGObject(object, RESPAWN_ONE_DAY);
|
||||
|
||||
DefendNode(node,team);
|
||||
PopulateNode(node);
|
||||
UpdateNodeWorldState(node);
|
||||
|
||||
if(IsTower(node))
|
||||
{
|
||||
//spawn big flag+aura on top of tower
|
||||
@@ -888,11 +825,9 @@ void BattleGroundAV::EventPlayerDefendsPoint(Player* player, uint32 object)
|
||||
else
|
||||
PlaySoundToAll((team==ALLIANCE)?AV_SOUND_ALLIANCE_GOOD:AV_SOUND_HORDE_GOOD);
|
||||
}
|
||||
|
||||
void BattleGroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
|
||||
{
|
||||
assert(GetStatus() == STATUS_IN_PROGRESS);
|
||||
|
||||
BG_AV_Nodes node = GetNodeThroughObject(object);
|
||||
uint32 owner = m_Nodes[node].Owner; //maybe name it prevowner
|
||||
uint32 team = player->GetTeam();
|
||||
@@ -900,7 +835,6 @@ void BattleGroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
|
||||
if(owner == team || team == m_Nodes[node].TotalOwner)
|
||||
return; //surely a gm used this object
|
||||
|
||||
|
||||
if(node == BG_AV_NODES_SNOWFALL_GRAVE) //snowfall is a bit special in capping + it gets eyecandy stuff
|
||||
{
|
||||
if(object == BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE) //initial capping
|
||||
@@ -938,7 +872,6 @@ void BattleGroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
|
||||
SpawnBGObject(spawn+i,RESPAWN_IMMEDIATELY);
|
||||
}
|
||||
}
|
||||
|
||||
//if snowfall gots capped it can be handled like all other graveyards
|
||||
if( m_Nodes[node].TotalOwner != AV_NEUTRAL_TEAM)
|
||||
{
|
||||
@@ -980,11 +913,9 @@ void BattleGroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
|
||||
}
|
||||
DePopulateNode(node);
|
||||
}
|
||||
|
||||
SpawnBGObject(object, RESPAWN_ONE_DAY); //delete old banner
|
||||
AssaultNode(node,team);
|
||||
UpdateNodeWorldState(node);
|
||||
|
||||
//send a nice message to all :)
|
||||
char buf[256];
|
||||
sprintf(buf, ( IsTower(node) ) ? GetTrinityString(LANG_BG_AV_TOWER_ASSAULTED) : GetTrinityString(LANG_BG_AV_GRAVE_ASSAULTED), GetNodeName(node), ( team == ALLIANCE ) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE ));
|
||||
@@ -995,7 +926,6 @@ void BattleGroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
|
||||
UpdatePlayerScore(player, ( IsTower(node) ) ? SCORE_TOWERS_ASSAULTED : SCORE_GRAVEYARDS_ASSAULTED, 1);
|
||||
PlaySoundToAll((team==ALLIANCE)?AV_SOUND_ALLIANCE_ASSAULTS:AV_SOUND_HORDE_ASSAULTS);
|
||||
}
|
||||
|
||||
void BattleGroundAV::FillInitialWorldStates(WorldPacket& data)
|
||||
{
|
||||
bool stateok;
|
||||
@@ -1009,7 +939,6 @@ void BattleGroundAV::FillInitialWorldStates(WorldPacket& data)
|
||||
data << uint32(BG_AV_NodeWorldStates[i][GetWorldStateType(j,HORDE)]) << uint32((m_Nodes[i].Owner == HORDE && stateok)?1:0);
|
||||
}
|
||||
}
|
||||
|
||||
//towers
|
||||
for (uint8 i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_MAX; i++)
|
||||
for (uint8 j =1; j <= 3; j+=2)
|
||||
@@ -1034,7 +963,6 @@ void BattleGroundAV::FillInitialWorldStates(WorldPacket& data)
|
||||
SendMineWorldStates(AV_NORTH_MINE);
|
||||
SendMineWorldStates(AV_SOUTH_MINE);
|
||||
}
|
||||
|
||||
const uint8 BattleGroundAV::GetWorldStateType(uint8 state, uint16 team) //this is used for node worldstates and returns values which fit good into the worldstatesarray
|
||||
{
|
||||
//neutral stuff cant get handled (currently its only snowfall)
|
||||
@@ -1057,7 +985,6 @@ const uint8 BattleGroundAV::GetWorldStateType(uint8 state, uint16 team) //this i
|
||||
sLog.outError("BG_AV: should update a strange worldstate state:%i team:%i",state,team);
|
||||
return 5; //this will crash the game, but i want to know if something is wrong here
|
||||
}
|
||||
|
||||
void BattleGroundAV::UpdateNodeWorldState(BG_AV_Nodes node)
|
||||
{
|
||||
UpdateWorldState(BG_AV_NodeWorldStates[node][GetWorldStateType(m_Nodes[node].State,m_Nodes[node].Owner)],1);
|
||||
@@ -1066,14 +993,12 @@ void BattleGroundAV::UpdateNodeWorldState(BG_AV_Nodes node)
|
||||
else
|
||||
UpdateWorldState(BG_AV_NodeWorldStates[node][GetWorldStateType(m_Nodes[node].PrevState,m_Nodes[node].PrevOwner)],0);
|
||||
}
|
||||
|
||||
void BattleGroundAV::SendMineWorldStates(uint32 mine)
|
||||
{
|
||||
assert(mine == AV_NORTH_MINE || mine==AV_SOUTH_MINE);
|
||||
// currently i'm sure, that this works (:
|
||||
// assert(m_Mine_PrevOwner[mine] == ALLIANCE || m_Mine_PrevOwner[mine] == HORDE || m_Mine_PrevOwner[mine] == AV_NEUTRAL_TEAM);
|
||||
// assert(m_Mine_Owner[mine] == ALLIANCE || m_Mine_Owner[mine] == HORDE || m_Mine_Owner[mine] == AV_NEUTRAL_TEAM);
|
||||
|
||||
uint8 owner,prevowner,mine2; //those variables are needed to access the right worldstate in the BG_AV_MineWorldStates array
|
||||
mine2 = (mine==AV_NORTH_MINE)?0:1;
|
||||
if(m_Mine_PrevOwner[mine] == ALLIANCE)
|
||||
@@ -1088,13 +1013,11 @@ void BattleGroundAV::SendMineWorldStates(uint32 mine)
|
||||
owner = 2;
|
||||
else
|
||||
owner = 1;
|
||||
|
||||
UpdateWorldState(BG_AV_MineWorldStates[mine2][owner],1);
|
||||
if( prevowner != owner)
|
||||
UpdateWorldState(BG_AV_MineWorldStates[mine2][prevowner],0);
|
||||
}
|
||||
|
||||
|
||||
WorldSafeLocsEntry const* BattleGroundAV::GetClosestGraveYard(Player* player)
|
||||
{
|
||||
WorldSafeLocsEntry const* good_entry = NULL;
|
||||
@@ -1120,11 +1043,9 @@ WorldSafeLocsEntry const* BattleGroundAV::GetClosestGraveYard(Player* player)
|
||||
// If not, place ghost on starting location
|
||||
if( !good_entry )
|
||||
good_entry = sWorldSafeLocsStore.LookupEntry( BG_AV_GraveyardIds[GetTeamIndexByTeamId(player->GetTeam())+7] );
|
||||
|
||||
return good_entry;
|
||||
}
|
||||
|
||||
|
||||
bool BattleGroundAV::SetupBattleGround()
|
||||
{
|
||||
// Create starting objects
|
||||
@@ -1137,7 +1058,6 @@ bool BattleGroundAV::SetupBattleGround()
|
||||
sLog.outErrorDb("BatteGroundAV: Failed to spawn some object BattleGround not created!1");
|
||||
return false;
|
||||
}
|
||||
|
||||
//spawn node-objects
|
||||
for (uint8 i = BG_AV_NODES_FIRSTAID_STATION ; i < BG_AV_NODES_MAX; ++i)
|
||||
{
|
||||
@@ -1232,7 +1152,6 @@ bool BattleGroundAV::SetupBattleGround()
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(!AddObject(BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE, BG_AV_OBJECTID_BANNER_SNOWFALL_N ,BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][0],BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][1],BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][2],BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3],0,0,sin(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2), cos(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2), RESPAWN_ONE_DAY))
|
||||
{
|
||||
sLog.outError("BatteGroundAV: Failed to spawn some object BattleGround not created!8");
|
||||
@@ -1249,7 +1168,6 @@ bool BattleGroundAV::SetupBattleGround()
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
uint16 i;
|
||||
sLog.outDebug("Alterac Valley: entering state STATUS_WAIT_JOIN ...");
|
||||
// Initial Nodes
|
||||
@@ -1280,7 +1198,6 @@ bool BattleGroundAV::SetupBattleGround()
|
||||
for(i = BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE; i <= BG_AV_OBJECT_DOOR_A; i++)
|
||||
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(BG_AV_OBJECT_AURA_N_SNOWFALL_GRAVE,RESPAWN_IMMEDIATELY);
|
||||
|
||||
//creatures
|
||||
sLog.outDebug("BG_AV start poputlating nodes");
|
||||
for(BG_AV_Nodes i= BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i )
|
||||
@@ -1303,7 +1220,6 @@ bool BattleGroundAV::SetupBattleGround()
|
||||
AddAVCreature(AV_NPC_HERALD,AV_CPLACE_HERALD);
|
||||
return true;
|
||||
}
|
||||
|
||||
const char* BattleGroundAV::GetNodeName(BG_AV_Nodes node)
|
||||
{
|
||||
switch (node)
|
||||
@@ -1331,7 +1247,6 @@ const char* BattleGroundAV::GetNodeName(BG_AV_Nodes node)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BattleGroundAV::AssaultNode(BG_AV_Nodes node, uint16 team)
|
||||
{
|
||||
if (m_Nodes[node].TotalOwner == team)
|
||||
@@ -1361,18 +1276,15 @@ void BattleGroundAV::AssaultNode(BG_AV_Nodes node, uint16 team)
|
||||
m_Nodes[node].PrevState = m_Nodes[node].State;
|
||||
m_Nodes[node].State = POINT_ASSAULTED;
|
||||
}
|
||||
|
||||
void BattleGroundAV::DestroyNode(BG_AV_Nodes node)
|
||||
{
|
||||
assert(m_Nodes[node].State == POINT_ASSAULTED);
|
||||
|
||||
m_Nodes[node].TotalOwner = m_Nodes[node].Owner;
|
||||
m_Nodes[node].PrevOwner = m_Nodes[node].Owner;
|
||||
m_Nodes[node].PrevState = m_Nodes[node].State;
|
||||
m_Nodes[node].State = (m_Nodes[node].Tower)? POINT_DESTROYED : POINT_CONTROLED;
|
||||
m_Nodes[node].Timer = 0;
|
||||
}
|
||||
|
||||
void BattleGroundAV::InitNode(BG_AV_Nodes node, uint16 team, bool tower)
|
||||
{
|
||||
m_Nodes[node].TotalOwner = team;
|
||||
@@ -1384,7 +1296,6 @@ void BattleGroundAV::InitNode(BG_AV_Nodes node, uint16 team, bool tower)
|
||||
m_Nodes[node].Timer = 0;
|
||||
m_Nodes[node].Tower = tower;
|
||||
}
|
||||
|
||||
void BattleGroundAV::DefendNode(BG_AV_Nodes node, uint16 team)
|
||||
{
|
||||
assert(m_Nodes[node].TotalOwner == team);
|
||||
@@ -1396,7 +1307,6 @@ void BattleGroundAV::DefendNode(BG_AV_Nodes node, uint16 team)
|
||||
m_Nodes[node].State = POINT_CONTROLED;
|
||||
m_Nodes[node].Timer = 0;
|
||||
}
|
||||
|
||||
void BattleGroundAV::ResetBGSubclass()
|
||||
{
|
||||
m_MaxLevel=0;
|
||||
@@ -1420,12 +1330,9 @@ void BattleGroundAV::ResetBGSubclass()
|
||||
for(BG_AV_Nodes i = BG_AV_NODES_ICEBLOOD_TOWER; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i) //horde towers
|
||||
InitNode(i,HORDE,true);
|
||||
InitNode(BG_AV_NODES_SNOWFALL_GRAVE,AV_NEUTRAL_TEAM,false); //give snowfall neutral owner
|
||||
|
||||
m_Mine_Timer=AV_MINE_TICK_TIMER;
|
||||
for(uint16 i = 0; i < AV_CPLACE_MAX+AV_STATICCPLACE_MAX; i++)
|
||||
if(m_BgCreatures[i])
|
||||
DelCreature(i);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user