* Rename: BattleGround -> Battleground.

--HG--
branch : trunk
This commit is contained in:
XTZGZoReX
2010-08-08 04:37:24 +02:00
parent 3d1efa6ed7
commit 909e332579
77 changed files with 1556 additions and 1556 deletions
@@ -18,14 +18,14 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "BattleGround.h"
#include "BattleGroundWS.h"
#include "Battleground.h"
#include "BattlegroundWS.h"
#include "Creature.h"
#include "GameObject.h"
#include "Language.h"
#include "Object.h"
#include "ObjectMgr.h"
#include "BattleGroundMgr.h"
#include "BattlegroundMgr.h"
#include "Player.h"
#include "World.h"
#include "WorldPacket.h"
@@ -49,7 +49,7 @@ uint32 BG_WSG_Reputation[BG_HONOR_MODE_NUM][BG_WSG_REWARD_NUM] = {
{0,45,0} // holiday
};
BattleGroundWS::BattleGroundWS()
BattlegroundWS::BattlegroundWS()
{
m_BgObjects.resize(BG_WS_OBJECT_MAX);
m_BgCreatures.resize(BG_CREATURES_MAX_WS);
@@ -60,13 +60,13 @@ BattleGroundWS::BattleGroundWS()
m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN;
}
BattleGroundWS::~BattleGroundWS()
BattlegroundWS::~BattlegroundWS()
{
}
void BattleGroundWS::Update(uint32 diff)
void BattlegroundWS::Update(uint32 diff)
{
BattleGround::Update(diff);
Battleground::Update(diff);
if (GetStatus() == STATUS_IN_PROGRESS)
{
@@ -75,21 +75,21 @@ void BattleGroundWS::Update(uint32 diff)
if (GetTeamScore(ALLIANCE) == 0)
{
if (GetTeamScore(HORDE) == 0) // No one scored - result is tie
EndBattleGround(NULL);
EndBattleground(NULL);
else // Horde has more points and thus wins
EndBattleGround(HORDE);
EndBattleground(HORDE);
}
else if (GetTeamScore(HORDE) == 0)
EndBattleGround(ALLIANCE); // Alliance has > 0, Horde has 0, alliance wins
EndBattleground(ALLIANCE); // Alliance has > 0, Horde has 0, alliance wins
else if (GetTeamScore(HORDE) == GetTeamScore(ALLIANCE)) // Team score equal, winner is team that scored the last flag
EndBattleGround(m_LastFlagCaptureTeam);
EndBattleground(m_LastFlagCaptureTeam);
else if (GetTeamScore(HORDE) > GetTeamScore(ALLIANCE)) // Last but not least, check who has the higher score
EndBattleGround(HORDE);
EndBattleground(HORDE);
else
EndBattleGround(ALLIANCE);
EndBattleground(ALLIANCE);
}
else if (GetStartTime() > m_minutesElapsed*MINUTE*IN_MILLISECONDS)
{
@@ -173,7 +173,7 @@ void BattleGroundWS::Update(uint32 diff)
}
}
void BattleGroundWS::StartingEventCloseDoors()
void BattlegroundWS::StartingEventCloseDoors()
{
for (uint32 i = BG_WS_OBJECT_DOOR_A_1; i <= BG_WS_OBJECT_DOOR_H_4; ++i)
{
@@ -187,7 +187,7 @@ void BattleGroundWS::StartingEventCloseDoors()
UpdateWorldState(BG_WS_STATE_TIMER, 25);
}
void BattleGroundWS::StartingEventOpenDoors()
void BattlegroundWS::StartingEventOpenDoors()
{
for (uint32 i = BG_WS_OBJECT_DOOR_A_1; i <= BG_WS_OBJECT_DOOR_A_4; ++i)
DoorOpen(i);
@@ -203,16 +203,16 @@ void BattleGroundWS::StartingEventOpenDoors()
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
}
void BattleGroundWS::AddPlayer(Player *plr)
void BattlegroundWS::AddPlayer(Player *plr)
{
BattleGround::AddPlayer(plr);
Battleground::AddPlayer(plr);
//create score and add it to map, default values are set in constructor
BattleGroundWGScore* sc = new BattleGroundWGScore;
BattlegroundWGScore* sc = new BattlegroundWGScore;
m_PlayerScores[plr->GetGUID()] = sc;
}
void BattleGroundWS::RespawnFlag(uint32 Team, bool captured)
void BattlegroundWS::RespawnFlag(uint32 Team, bool captured)
{
if (Team == ALLIANCE)
{
@@ -236,7 +236,7 @@ void BattleGroundWS::RespawnFlag(uint32 Team, bool captured)
m_BothFlagsKept = false;
}
void BattleGroundWS::RespawnFlagAfterDrop(uint32 team)
void BattlegroundWS::RespawnFlagAfterDrop(uint32 team)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
@@ -265,7 +265,7 @@ void BattleGroundWS::RespawnFlagAfterDrop(uint32 team)
m_BothFlagsKept = false;
}
void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
void BattlegroundWS::EventPlayerCapturedFlag(Player *Source)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
@@ -343,7 +343,7 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
UpdateWorldState(BG_WS_STATE_TIMER_ACTIVE, 0);
RewardHonorToTeam(BG_WSG_Honor[m_HonorMode][BG_WSG_WIN], winner);
EndBattleGround(winner);
EndBattleground(winner);
}
else
{
@@ -351,7 +351,7 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
}
}
void BattleGroundWS::EventPlayerDroppedFlag(Player *Source)
void BattlegroundWS::EventPlayerDroppedFlag(Player *Source)
{
if (GetStatus() != STATUS_IN_PROGRESS)
{
@@ -437,7 +437,7 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player *Source)
}
}
void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj)
void BattlegroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
@@ -556,14 +556,14 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
}
void BattleGroundWS::RemovePlayer(Player *plr, uint64 guid)
void BattlegroundWS::RemovePlayer(Player *plr, uint64 guid)
{
// sometimes flag aura not removed :(
if (IsAllianceFlagPickedup() && m_FlagKeepers[BG_TEAM_ALLIANCE] == guid)
{
if (!plr)
{
sLog.outError("BattleGroundWS: Removing offline player who has the FLAG!!");
sLog.outError("BattlegroundWS: Removing offline player who has the FLAG!!");
this->SetAllianceFlagPicker(0);
this->RespawnFlag(ALLIANCE, false);
}
@@ -574,7 +574,7 @@ void BattleGroundWS::RemovePlayer(Player *plr, uint64 guid)
{
if (!plr)
{
sLog.outError("BattleGroundWS: Removing offline player who has the FLAG!!");
sLog.outError("BattlegroundWS: Removing offline player who has the FLAG!!");
this->SetHordeFlagPicker(0);
this->RespawnFlag(HORDE, false);
}
@@ -583,7 +583,7 @@ void BattleGroundWS::RemovePlayer(Player *plr, uint64 guid)
}
}
void BattleGroundWS::UpdateFlagState(uint32 team, uint32 value)
void BattlegroundWS::UpdateFlagState(uint32 team, uint32 value)
{
if (team == ALLIANCE)
UpdateWorldState(BG_WS_FLAG_STATE_ALLIANCE, value);
@@ -591,7 +591,7 @@ void BattleGroundWS::UpdateFlagState(uint32 team, uint32 value)
UpdateWorldState(BG_WS_FLAG_STATE_HORDE, value);
}
void BattleGroundWS::UpdateTeamScore(uint32 team)
void BattlegroundWS::UpdateTeamScore(uint32 team)
{
if (team == ALLIANCE)
UpdateWorldState(BG_WS_FLAG_CAPTURES_ALLIANCE, GetTeamScore(team));
@@ -599,7 +599,7 @@ void BattleGroundWS::UpdateTeamScore(uint32 team)
UpdateWorldState(BG_WS_FLAG_CAPTURES_HORDE, GetTeamScore(team));
}
void BattleGroundWS::HandleAreaTrigger(Player *Source, uint32 Trigger)
void BattlegroundWS::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)
@@ -609,10 +609,10 @@ void BattleGroundWS::HandleAreaTrigger(Player *Source, uint32 Trigger)
//uint64 buff_guid = 0;
switch(Trigger)
{
case 3686: // Alliance elixir of speed spawn. Trigger not working, because located inside other areatrigger, can be replaced by IsWithinDist(object, dist) in BattleGround::Update().
case 3686: // Alliance elixir of speed spawn. Trigger not working, because located inside other areatrigger, can be replaced by IsWithinDist(object, dist) in Battleground::Update().
//buff_guid = m_BgObjects[BG_WS_OBJECT_SPEEDBUFF_1];
break;
case 3687: // Horde elixir of speed spawn. Trigger not working, because located inside other areatrigger, can be replaced by IsWithinDist(object, dist) in BattleGround::Update().
case 3687: // Horde elixir of speed spawn. Trigger not working, because located inside other areatrigger, can be replaced by IsWithinDist(object, dist) in Battleground::Update().
//buff_guid = m_BgObjects[BG_WS_OBJECT_SPEEDBUFF_2];
break;
case 3706: // Alliance elixir of regeneration spawn
@@ -652,7 +652,7 @@ void BattleGroundWS::HandleAreaTrigger(Player *Source, uint32 Trigger)
// HandleTriggerBuff(buff_guid,Source);
}
bool BattleGroundWS::SetupBattleGround()
bool BattlegroundWS::SetupBattleground()
{
// flags
if (!AddObject(BG_WS_OBJECT_A_FLAG, BG_OBJECT_A_FLAG_WS_ENTRY, 1540.423f, 1481.325f, 351.8284f, 3.089233f, 0, 0, 0.9996573f, 0.02617699f, BG_WS_FLAG_RESPAWN_TIME/1000)
@@ -678,21 +678,21 @@ bool BattleGroundWS::SetupBattleGround()
|| !AddObject(BG_WS_OBJECT_DOOR_H_4, BG_OBJECT_DOOR_H_4_WS_ENTRY, 950.7952f, 1459.583f, 342.1523f, 0.05235988f, 0, 0, 0.02617695f, 0.9996573f, RESPAWN_IMMEDIATELY)
)
{
sLog.outErrorDb("BatteGroundWS: Failed to spawn some object BattleGround not created!");
sLog.outErrorDb("BatteGroundWS: Failed to spawn some object Battleground not created!");
return false;
}
WorldSafeLocsEntry const *sg = sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_ALLIANCE);
if (!sg || !AddSpiritGuide(WS_SPIRIT_MAIN_ALLIANCE, sg->x, sg->y, sg->z, 3.124139f, ALLIANCE))
{
sLog.outErrorDb("BatteGroundWS: Failed to spawn Alliance spirit guide! BattleGround not created!");
sLog.outErrorDb("BatteGroundWS: Failed to spawn Alliance spirit guide! Battleground not created!");
return false;
}
sg = sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_HORDE);
if (!sg || !AddSpiritGuide(WS_SPIRIT_MAIN_HORDE, sg->x, sg->y, sg->z, 3.193953f, HORDE))
{
sLog.outErrorDb("BatteGroundWS: Failed to spawn Horde spirit guide! BattleGround not created!");
sLog.outErrorDb("BatteGroundWS: Failed to spawn Horde spirit guide! Battleground not created!");
return false;
}
@@ -701,10 +701,10 @@ bool BattleGroundWS::SetupBattleGround()
return true;
}
void BattleGroundWS::Reset()
void BattlegroundWS::Reset()
{
//call parent's class reset
BattleGround::Reset();
Battleground::Reset();
m_FlagKeepers[BG_TEAM_ALLIANCE] = 0;
m_FlagKeepers[BG_TEAM_HORDE] = 0;
@@ -714,7 +714,7 @@ void BattleGroundWS::Reset()
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE;
m_TeamScores[BG_TEAM_ALLIANCE] = 0;
m_TeamScores[BG_TEAM_HORDE] = 0;
bool isBGWeekend = sBattleGroundMgr.IsBGWeekend(GetTypeID());
bool isBGWeekend = sBattlegroundMgr.IsBGWeekend(GetTypeID());
m_ReputationCapture = (isBGWeekend) ? 45 : 35;
m_HonorWinKills = (isBGWeekend) ? 3 : 1;
m_HonorEndKills = (isBGWeekend) ? 4 : 2;
@@ -730,7 +730,7 @@ void BattleGroundWS::Reset()
*/
}
void BattleGroundWS::EndBattleGround(uint32 winner)
void BattlegroundWS::EndBattleground(uint32 winner)
{
//win reward
if (winner == ALLIANCE)
@@ -741,43 +741,43 @@ void BattleGroundWS::EndBattleGround(uint32 winner)
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorEndKills), ALLIANCE);
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorEndKills), HORDE);
BattleGround::EndBattleGround(winner);
Battleground::EndBattleground(winner);
}
void BattleGroundWS::HandleKillPlayer(Player *player, Player *killer)
void BattlegroundWS::HandleKillPlayer(Player *player, Player *killer)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
EventPlayerDroppedFlag(player);
BattleGround::HandleKillPlayer(player, killer);
Battleground::HandleKillPlayer(player, killer);
}
void BattleGroundWS::UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor)
void BattlegroundWS::UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor)
{
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID());
BattlegroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID());
if (itr == m_PlayerScores.end()) // player not found
return;
switch(type)
{
case SCORE_FLAG_CAPTURES: // flags captured
((BattleGroundWGScore*)itr->second)->FlagCaptures += value;
((BattlegroundWGScore*)itr->second)->FlagCaptures += value;
Source->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, WS_OBJECTIVE_CAPTURE_FLAG);
break;
case SCORE_FLAG_RETURNS: // flags returned
((BattleGroundWGScore*)itr->second)->FlagReturns += value;
((BattlegroundWGScore*)itr->second)->FlagReturns += value;
Source->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, WS_OBJECTIVE_RETURN_FLAG);
break;
default:
BattleGround::UpdatePlayerScore(Source, type, value, doAddHonor);
Battleground::UpdatePlayerScore(Source, type, value, doAddHonor);
break;
}
}
WorldSafeLocsEntry const* BattleGroundWS::GetClosestGraveYard(Player* player)
WorldSafeLocsEntry const* BattlegroundWS::GetClosestGraveYard(Player* player)
{
//if status in progress, it returns main graveyards with spiritguides
//else it will return the graveyard in the flagroom - this is especially good
@@ -800,7 +800,7 @@ WorldSafeLocsEntry const* BattleGroundWS::GetClosestGraveYard(Player* player)
}
}
void BattleGroundWS::FillInitialWorldStates(WorldPacket& data)
void BattlegroundWS::FillInitialWorldStates(WorldPacket& data)
{
data << uint32(BG_WS_FLAG_CAPTURES_ALLIANCE) << uint32(GetTeamScore(ALLIANCE));
data << uint32(BG_WS_FLAG_CAPTURES_HORDE) << uint32(GetTeamScore(HORDE));