aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/BattleGround.cpp54
-rw-r--r--src/game/BattleGround.h33
-rw-r--r--src/game/BattleGroundAB.cpp4
-rw-r--r--src/game/BattleGroundAB.h4
-rw-r--r--src/game/BattleGroundABG.cpp81
-rw-r--r--src/game/BattleGroundABG.h54
-rw-r--r--src/game/BattleGroundDS.cpp105
-rw-r--r--src/game/BattleGroundDS.h39
-rw-r--r--src/game/BattleGroundHandler.cpp13
-rw-r--r--src/game/BattleGroundIC.cpp81
-rw-r--r--src/game/BattleGroundIC.h54
-rw-r--r--src/game/BattleGroundMgr.cpp52
-rw-r--r--src/game/BattleGroundMgr.h1
-rw-r--r--src/game/BattleGroundWS.cpp30
-rw-r--r--src/game/BattleGroundWS.h4
-rw-r--r--src/game/CMakeLists.txt4
16 files changed, 553 insertions, 60 deletions
diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp
index d6558e3bb4f..767d3581ef8 100644
--- a/src/game/BattleGround.cpp
+++ b/src/game/BattleGround.cpp
@@ -156,6 +156,7 @@ BattleGround::BattleGround()
m_MinPlayers = 0;
m_MapId = 0;
+ m_Map = NULL;
m_TeamStartLocX[BG_TEAM_ALLIANCE] = 0;
m_TeamStartLocX[BG_TEAM_HORDE] = 0;
@@ -224,9 +225,8 @@ BattleGround::~BattleGround()
sBattleGroundMgr.RemoveBattleGround(GetInstanceID(), GetTypeID());
// unload map
- if (Map * map = MapManager::Instance().FindMap(GetMapId(), GetInstanceID()))
- if (map->IsBattleGroundOrArena())
- ((BattleGroundMap*)map)->SetUnload();
+ if (m_Map)
+ m_Map->SetUnload();
// remove from bg free slot queue
this->RemoveFromBGFreeSlotQueue();
@@ -784,6 +784,7 @@ void BattleGround::EndBattleGround(uint32 winner)
else if(winner)
RewardMark(plr,ITEM_LOSER_COUNT);
+
plr->SetHealth(plr->GetMaxHealth());
plr->SetPower(POWER_MANA, plr->GetMaxPower(POWER_MANA));
plr->CombatStopWithPets(true);
@@ -921,6 +922,10 @@ void BattleGround::SendRewardMarkByMail(Player *plr,uint32 mark, uint32 count)
// save new item before send
markItem->SaveToDB(); // save for prevent lost at next mail load, if send fail then item will deleted
+ // item
+ MailItemsInfo mi;
+ mi.AddItem(markItem->GetGUIDLow(), markItem->GetEntry(), markItem);
+
// subject: item name
std::string subject = markProto->Name1;
int loc_idx = plr->GetSession()->GetSessionDbLocaleIndex();
@@ -935,9 +940,7 @@ void BattleGround::SendRewardMarkByMail(Player *plr,uint32 mark, uint32 count)
snprintf(textBuf,300,textFormat.c_str(),GetName(),GetName());
uint32 itemTextId = objmgr.CreateItemText( textBuf );
- MailDraft(subject, itemTextId)
- .AddItem(markItem)
- .SendMailTo(plr, MailSender(MAIL_CREATURE, bmEntry));
+ WorldSession::SendMailTo(plr, MAIL_CREATURE, MAIL_STATIONERY_NORMAL, bmEntry, plr->GetGUIDLow(), subject, itemTextId , &mi, 0, 0, MAIL_CHECK_MASK_NONE);
}
}
@@ -1277,7 +1280,9 @@ void BattleGround::EventPlayerLoggedOut(Player* player)
if (GetAlivePlayersCountByTeam(player->GetTeam()) <= 1 && GetPlayersCountByTeam(GetOtherTeam(player->GetTeam())))
EndBattleGround(GetOtherTeam(player->GetTeam()));
}
+ return;
}
+ player->LeaveBattleground();
}
/* This method should be called only once ... it adds pointer to queue */
@@ -1445,15 +1450,14 @@ void BattleGround::RemovePlayerFromResurrectQueue(uint64 player_guid)
bool BattleGround::AddObject(uint32 type, uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime)
{
- Map * map = MapManager::Instance().FindMap(GetMapId(),GetInstanceID());
+ Map *map = GetBgMap();
if (!map)
return false;
-
// must be created this way, adding to godatamap would add it to the base map of the instance
// and when loading it (in go::LoadFromDB()), a new guid would be assigned to the object, and a new object would be created
// so we must create it specific for this instance
GameObject * go = new GameObject;
- if(!go->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT),entry, map,
+ if(!go->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT),entry, GetBgMap(),
PHASEMASK_NORMAL, x,y,z,o,rotation0,rotation1,rotation2,rotation3,100,GO_STATE_READY))
{
sLog.outErrorDb("Gameobject template %u not found in database! BattleGround not created!", entry);
@@ -1493,7 +1497,7 @@ bool BattleGround::AddObject(uint32 type, uint32 entry, float x, float y, float
//it would be nice to correctly implement GO_ACTIVATED state and open/close doors in gameobject code
void BattleGround::DoorClose(uint32 type)
{
- GameObject *obj = HashMapHolder<GameObject>::Find(m_BgObjects[type]);
+ GameObject *obj = GetBgMap()->GetGameObject(m_BgObjects[type]);
if (obj)
{
//if doors are open, close it
@@ -1512,7 +1516,7 @@ void BattleGround::DoorClose(uint32 type)
void BattleGround::DoorOpen(uint32 type)
{
- GameObject *obj = HashMapHolder<GameObject>::Find(m_BgObjects[type]);
+ GameObject *obj = GetBgMap()->GetGameObject(m_BgObjects[type]);
if (obj)
{
//change state to be sure they will be opened
@@ -1527,7 +1531,7 @@ void BattleGround::DoorOpen(uint32 type)
GameObject* BattleGround::GetBGObject(uint32 type)
{
- GameObject *obj = HashMapHolder<GameObject>::Find(m_BgObjects[type]);
+ GameObject *obj = GetBgMap()->GetGameObject(m_BgObjects[type]);
if(!obj)
sLog.outError("couldn't get gameobject %i",type);
return obj;
@@ -1535,7 +1539,7 @@ GameObject* BattleGround::GetBGObject(uint32 type)
Creature* BattleGround::GetBGCreature(uint32 type)
{
- Creature *creature = HashMapHolder<Creature>::Find(m_BgCreatures[type]);
+ Creature *creature = GetBgMap()->GetCreature(m_BgCreatures[type]);
if(!creature)
sLog.outError("couldn't get creature %i",type);
return creature;
@@ -1543,12 +1547,12 @@ Creature* BattleGround::GetBGCreature(uint32 type)
void BattleGround::SpawnBGObject(uint32 type, uint32 respawntime)
{
- Map * map = MapManager::Instance().FindMap(GetMapId(),GetInstanceID());
+ Map * map = GetBgMap();
if (!map)
return;
if (respawntime == 0)
{
- GameObject *obj = HashMapHolder<GameObject>::Find(m_BgObjects[type]);
+ GameObject *obj = map->GetGameObject(m_BgObjects[type]);
if (obj)
{
//we need to change state from GO_JUST_DEACTIVATED to GO_READY in case battleground is starting again
@@ -1560,7 +1564,7 @@ void BattleGround::SpawnBGObject(uint32 type, uint32 respawntime)
}
else
{
- GameObject *obj = HashMapHolder<GameObject>::Find(m_BgObjects[type]);
+ GameObject *obj = map->GetGameObject(m_BgObjects[type]);
if (obj)
{
map->Add(obj);
@@ -1572,7 +1576,7 @@ void BattleGround::SpawnBGObject(uint32 type, uint32 respawntime)
Creature* BattleGround::AddCreature(uint32 entry, uint32 type, uint32 teamval, float x, float y, float z, float o, uint32 respawntime)
{
- Map * map = MapManager::Instance().FindMap(GetMapId(),GetInstanceID());
+ Map * map = GetBgMap();
if (!map)
return NULL;
@@ -1628,7 +1632,7 @@ bool BattleGround::DelCreature(uint32 type)
if (!m_BgCreatures[type])
return true;
- Creature *cr = HashMapHolder<Creature>::Find(m_BgCreatures[type]);
+ Creature *cr = GetBgMap()->GetCreature(m_BgCreatures[type]);
if (!cr)
{
sLog.outError("Can't find creature guid: %u",GUID_LOPART(m_BgCreatures[type]));
@@ -1644,7 +1648,7 @@ bool BattleGround::DelObject(uint32 type)
if (!m_BgObjects[type])
return true;
- GameObject *obj = HashMapHolder<GameObject>::Find(m_BgObjects[type]);
+ GameObject *obj = GetBgMap()->GetGameObject(m_BgObjects[type]);
if (!obj)
{
sLog.outError("Can't find gobject guid: %u",GUID_LOPART(m_BgObjects[type]));
@@ -1679,10 +1683,6 @@ bool BattleGround::AddSpiritGuide(uint32 type, float x, float y, float z, float
// aura
//TODO: Fix display here
//pCreature->SetVisibleAura(0, SPELL_SPIRIT_HEAL_CHANNEL);
-
- //pCreature->SetUInt32Value(UNIT_FIELD_AURAFLAGS, 0x00000009);
- //pCreature->SetUInt32Value(UNIT_FIELD_AURALEVELS, 0x0000003C);
- //pCreature->SetUInt32Value(UNIT_FIELD_AURAAPPLICATIONS, 0x000000FF);
// casting visual effect
pCreature->SetUInt32Value(UNIT_CHANNEL_SPELL, SPELL_SPIRIT_HEAL_CHANNEL);
// correct cast speed
@@ -1740,7 +1740,7 @@ buffs are in their positions when battleground starts
*/
void BattleGround::HandleTriggerBuff(uint64 const& go_guid)
{
- GameObject *obj = HashMapHolder<GameObject>::Find(go_guid);
+ GameObject *obj = GetBgMap()->GetGameObject(go_guid);
if (!obj || obj->GetGoType() != GAMEOBJECT_TYPE_TRAP || !obj->isSpawned())
return;
@@ -1887,10 +1887,10 @@ void BattleGround::CheckArenaWinConditions()
EndBattleGround(ALLIANCE);
}
-void BattleGround::UpdateArenaUnitWorldState()
+void BattleGround::UpdateArenaWorldState()
{
- UpdateWorldState(HORDE_WORLD_STATE, GetAlivePlayersCountByTeam(HORDE));
- UpdateWorldState(ALLIANCE_WORLD_STATE, GetAlivePlayersCountByTeam(ALLIANCE));
+ UpdateWorldState(0xe10, GetAlivePlayersCountByTeam(HORDE));
+ UpdateWorldState(0xe11, GetAlivePlayersCountByTeam(ALLIANCE));
}
void BattleGround::SetBgRaid( uint32 TeamID, Group *bg_raid )
diff --git a/src/game/BattleGround.h b/src/game/BattleGround.h
index 275085f4ca7..7a1bcbc58ea 100644
--- a/src/game/BattleGround.h
+++ b/src/game/BattleGround.h
@@ -29,6 +29,7 @@ class GameObject;
class Group;
class Player;
class WorldPacket;
+class BattleGroundMap;
struct WorldSafeLocsEntry;
@@ -97,9 +98,9 @@ enum BattleGroundSpells
enum BattleGroundTimeIntervals
{
RESURRECTION_INTERVAL = 30000, // ms
- REMIND_INTERVAL = 30000, // ms
- INVITATION_REMIND_TIME = 60000, // ms
- INVITE_ACCEPT_WAIT_TIME = 80000, // ms
+ //REMIND_INTERVAL = 10000, // ms
+ INVITATION_REMIND_TIME = 20000, // ms
+ INVITE_ACCEPT_WAIT_TIME = 40000, // ms
TIME_TO_AUTOREMOVE = 120000, // ms
MAX_OFFLINE_TIME = 300, // secs
RESPAWN_ONE_DAY = 86400, // secs
@@ -158,11 +159,12 @@ enum BattleGroundQueueTypeId
BATTLEGROUND_QUEUE_AB = 3,
BATTLEGROUND_QUEUE_EY = 4,
BATTLEGROUND_QUEUE_SA = 5,
- BATTLEGROUND_QUEUE_2v2 = 6,
- BATTLEGROUND_QUEUE_3v3 = 7,
- BATTLEGROUND_QUEUE_5v5 = 8
+ BATTLEGROUND_QUEUE_IC = 6,
+ BATTLEGROUND_QUEUE_2v2 = 7,
+ BATTLEGROUND_QUEUE_3v3 = 8,
+ BATTLEGROUND_QUEUE_5v5 = 9,
+ MAX_BATTLEGROUND_QUEUE_TYPES
};
-#define MAX_BATTLEGROUND_QUEUE_TYPES 9
enum BGQueueIdBasedOnLevel // queue_id for level ranges
{
@@ -210,12 +212,6 @@ enum ArenaType
ARENA_TYPE_5v5 = 5
};
-enum ArenaWorldUnitState
-{
- HORDE_WORLD_STATE = 0xE10,
- ALLIANCE_WORLD_STATE = 0xE11
-};
-
enum BattleGroundType
{
TYPE_BATTLEGROUND = 3,
@@ -420,6 +416,14 @@ class BattleGround
void SetMapId(uint32 MapID) { m_MapId = MapID; }
uint32 GetMapId() const { return m_MapId; }
+ /* Map pointers */
+ void SetBgMap(BattleGroundMap* map) { m_Map = map; }
+ BattleGroundMap* GetBgMap()
+ {
+ ASSERT(m_Map);
+ return m_Map;
+ }
+
void SetTeamStartLoc(uint32 TeamID, float X, float Y, float Z, float O);
void GetTeamStartLoc(uint32 TeamID, float &X, float &Y, float &Z, float &O) const
{
@@ -484,7 +488,7 @@ class BattleGround
void SetArenaTeamRatingChangeForTeam(uint32 Team, int32 RatingChange) { m_ArenaTeamRatingChanges[GetTeamIndexByTeamId(Team)] = RatingChange; }
int32 GetArenaTeamRatingChangeForTeam(uint32 Team) const { return m_ArenaTeamRatingChanges[GetTeamIndexByTeamId(Team)]; }
void CheckArenaWinConditions();
- void UpdateArenaUnitWorldState();
+ void UpdateArenaWorldState();
/* Triggers handle */
// must be implemented in BG subclass
@@ -623,6 +627,7 @@ class BattleGround
/* Start location */
uint32 m_MapId;
+ BattleGroundMap* m_Map;
float m_TeamStartLocX[BG_TEAMS_COUNT];
float m_TeamStartLocY[BG_TEAMS_COUNT];
float m_TeamStartLocZ[BG_TEAMS_COUNT];
diff --git a/src/game/BattleGroundAB.cpp b/src/game/BattleGroundAB.cpp
index b684f4523e1..0fea16bfcbd 100644
--- a/src/game/BattleGroundAB.cpp
+++ b/src/game/BattleGroundAB.cpp
@@ -420,11 +420,11 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*targ
return;
uint8 node = BG_AB_NODE_STABLES;
- GameObject* obj=HashMapHolder<GameObject>::Find(m_BgObjects[node*8+7]);
+ GameObject* obj=GetBgMap()->GetGameObject(m_BgObjects[node*8+7]);
while ( (node < BG_AB_DYNAMIC_NODES_COUNT) && ((!obj) || (!source->IsWithinDistInMap(obj,10))))
{
++node;
- obj=HashMapHolder<GameObject>::Find(m_BgObjects[node*8+BG_AB_OBJECT_AURA_CONTESTED]);
+ obj=GetBgMap()->GetGameObject(m_BgObjects[node*8+BG_AB_OBJECT_AURA_CONTESTED]);
}
if (node == BG_AB_DYNAMIC_NODES_COUNT)
diff --git a/src/game/BattleGroundAB.h b/src/game/BattleGroundAB.h
index ef151ad187b..bdc073f6ec8 100644
--- a/src/game/BattleGroundAB.h
+++ b/src/game/BattleGroundAB.h
@@ -130,8 +130,8 @@ enum BG_AB_Timers
enum BG_AB_Score
{
- BG_AB_WARNING_NEAR_VICTORY_SCORE = 1800,
- BG_AB_MAX_TEAM_SCORE = 2000
+ BG_AB_WARNING_NEAR_VICTORY_SCORE = 1400,
+ BG_AB_MAX_TEAM_SCORE = 1600
};
/* do NOT change the order, else wrong behaviour */
diff --git a/src/game/BattleGroundABG.cpp b/src/game/BattleGroundABG.cpp
new file mode 100644
index 00000000000..f0ae47482f1
--- /dev/null
+++ b/src/game/BattleGroundABG.cpp
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "Player.h"
+#include "BattleGround.h"
+#include "BattleGroundABG.h"
+#include "Language.h"
+
+BattleGroundABG::BattleGroundABG()
+{
+ //TODO FIX ME!
+ m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_WS_START_TWO_MINUTES;
+ m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_WS_START_ONE_MINUTE;
+ m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE;
+ m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN;
+}
+
+BattleGroundABG::~BattleGroundABG()
+{
+
+}
+
+void BattleGroundABG::Update(uint32 diff)
+{
+ BattleGround::Update(diff);
+}
+
+void BattleGroundABG::StartingEventCloseDoors()
+{
+}
+
+void BattleGroundABG::StartingEventOpenDoors()
+{
+}
+
+void BattleGroundABG::AddPlayer(Player *plr)
+{
+ BattleGround::AddPlayer(plr);
+ //create score and add it to map, default values are set in constructor
+ BattleGroundABGScore* sc = new BattleGroundABGScore;
+
+ m_PlayerScores[plr->GetGUID()] = sc;
+}
+
+void BattleGroundABG::RemovePlayer(Player* /*plr*/,uint64 /*guid*/)
+{
+
+}
+
+void BattleGroundABG::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;
+}
+
+void BattleGroundABG::UpdatePlayerScore(Player* Source, uint32 type, uint32 value)
+{
+
+ std::map<uint64, BattleGroundScore*>::iterator itr = m_PlayerScores.find(Source->GetGUID());
+
+ if(itr == m_PlayerScores.end()) // player not found...
+ return;
+
+ BattleGround::UpdatePlayerScore(Source,type,value);
+} \ No newline at end of file
diff --git a/src/game/BattleGroundABG.h b/src/game/BattleGroundABG.h
new file mode 100644
index 00000000000..478e8ffaf46
--- /dev/null
+++ b/src/game/BattleGroundABG.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef __BATTLEGROUNDABG_H
+#define __BATTLEGROUNDABG_H
+
+class BattleGround;
+
+class BattleGroundABGScore : public BattleGroundScore
+{
+ public:
+ BattleGroundABGScore() {};
+ virtual ~BattleGroundABGScore() {};
+};
+
+class BattleGroundABG : public BattleGround
+{
+ friend class BattleGroundMgr;
+
+ public:
+ BattleGroundABG();
+ ~BattleGroundABG();
+ void Update(uint32 diff);
+
+ /* inherited from BattlegroundClass */
+ virtual void AddPlayer(Player *plr);
+ virtual void StartingEventCloseDoors();
+ virtual void StartingEventOpenDoors();
+
+ void RemovePlayer(Player *plr,uint64 guid);
+ void HandleAreaTrigger(Player *Source, uint32 Trigger);
+ //bool SetupBattleGround();
+
+ /* Scorekeeping */
+ void UpdatePlayerScore(Player *Source, uint32 type, uint32 value);
+
+ private:
+};
+#endif \ No newline at end of file
diff --git a/src/game/BattleGroundDS.cpp b/src/game/BattleGroundDS.cpp
index 0be870be175..9036ef83f93 100644
--- a/src/game/BattleGroundDS.cpp
+++ b/src/game/BattleGroundDS.cpp
@@ -20,9 +20,13 @@
#include "BattleGroundDS.h"
#include "Language.h"
#include "Player.h"
+#include "Object.h"
+#include "ObjectMgr.h"
+#include "WorldPacket.h"
BattleGroundDS::BattleGroundDS()
{
+ m_BgObjects.resize(BG_DS_OBJECT_MAX);
m_StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M;
m_StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S;
@@ -43,14 +47,46 @@ BattleGroundDS::~BattleGroundDS()
void BattleGroundDS::Update(uint32 diff)
{
BattleGround::Update(diff);
+ if (getWaterFallTimer() < diff)
+ {
+ if (isWaterFallActive())
+ {
+ setWaterFallTimer(urand(BG_DS_WATERFALL_TIMER_MIN, BG_DS_WATERFALL_TIMER_MAX));
+ for (uint32 i = BG_DS_OBJECT_WATER_1; i <= BG_DS_OBJECT_WATER_2; ++i)
+ SpawnBGObject(i, getWaterFallTimer());
+ setWaterFallActive(false);
+ }
+ else
+ {
+ setWaterFallTimer(BG_DS_WATERFALL_DURATION);
+ for (uint32 i = BG_DS_OBJECT_WATER_1; i <= BG_DS_OBJECT_WATER_2; ++i)
+ SpawnBGObject(i, RESPAWN_IMMEDIATELY);
+ setWaterFallActive(true);
+ }
+ }
+ else
+ setWaterFallTimer(getWaterFallTimer() - diff);
}
void BattleGroundDS::StartingEventCloseDoors()
{
+ for (uint32 i = BG_DS_OBJECT_DOOR_1; i <= BG_DS_OBJECT_DOOR_2; ++i)
+ SpawnBGObject(i, RESPAWN_IMMEDIATELY);
}
void BattleGroundDS::StartingEventOpenDoors()
{
+ for (uint32 i = BG_DS_OBJECT_DOOR_1; i <= BG_DS_OBJECT_DOOR_2; ++i)
+ DoorOpen(i);
+
+ for (uint32 i = BG_DS_OBJECT_BUFF_1; i <= BG_DS_OBJECT_BUFF_2; ++i)
+ SpawnBGObject(i, 60);
+
+ setWaterFallTimer(urand(BG_DS_WATERFALL_TIMER_MIN, BG_DS_WATERFALL_TIMER_MAX));
+ setWaterFallActive(false);
+
+ for (uint32 i = BG_DS_OBJECT_WATER_1; i <= BG_DS_OBJECT_WATER_2; ++i)
+ SpawnBGObject(i, getWaterFallTimer());
}
void BattleGroundDS::AddPlayer(Player *plr)
@@ -60,22 +96,87 @@ void BattleGroundDS::AddPlayer(Player *plr)
BattleGroundDSScore* sc = new BattleGroundDSScore;
m_PlayerScores[plr->GetGUID()] = sc;
+
+ UpdateArenaWorldState();
}
void BattleGroundDS::RemovePlayer(Player * /*plr*/, uint64 /*guid*/)
{
+ if (GetStatus() == STATUS_WAIT_LEAVE)
+ return;
+
+ UpdateArenaWorldState();
+ CheckArenaWinConditions();
}
void BattleGroundDS::HandleKillPlayer(Player* player, Player* killer)
{
- BattleGround::HandleKillPlayer(player, killer);
+ if (GetStatus() != STATUS_IN_PROGRESS)
+ return;
+
+ if (!killer)
+ {
+ sLog.outError("BattleGroundDS: Killer player not found");
+ return;
+ }
+
+ BattleGround::HandleKillPlayer(player,killer);
+
+ UpdateArenaWorldState();
+ CheckArenaWinConditions();
}
-void BattleGroundDS::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/)
+void BattleGroundDS::HandleAreaTrigger(Player *Source, uint32 Trigger)
{
+ if (GetStatus() != STATUS_IN_PROGRESS)
+ return;
+
+ switch(Trigger)
+ {
+ case 5347:
+ case 5348:
+ break;
+ default:
+ sLog.outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
+ Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger);
+ break;
+ }
}
+bool BattleGroundDS::HandlePlayerUnderMap(Player *player)
+{
+ player->TeleportTo(GetMapId(), 1299.046, 784.825, 9.338, 2.422, false);
+ return true;
+}
+
+void BattleGroundDS::FillInitialWorldStates(WorldPacket &data)
+{
+ data << uint32(3610) << uint32(1); // 9 show
+ UpdateArenaWorldState();
+}
+
+void BattleGroundDS::Reset()
+{
+ //call parent's class reset
+ BattleGround::Reset();
+}
+
+
bool BattleGroundDS::SetupBattleGround()
{
+ // gates
+ if (!AddObject(BG_DS_OBJECT_DOOR_1, BG_DS_OBJECT_TYPE_DOOR_1, 1350.95, 817.2, 20.8096, 3.15, 0, 0, 0.99627, 0.0862864, RESPAWN_IMMEDIATELY)
+ || !AddObject(BG_DS_OBJECT_DOOR_2, BG_DS_OBJECT_TYPE_DOOR_2, 1232.65, 764.913, 20.0729, 6.3, 0, 0, 0.0310211, -0.999519, RESPAWN_IMMEDIATELY)
+ // water
+ || !AddObject(BG_DS_OBJECT_WATER_1, BG_DS_OBJECT_TYPE_WATER_1, 1291.56, 790.837, 7.1, 3.14238, 0, 0, 0.694215, -0.719768, 120)
+ || !AddObject(BG_DS_OBJECT_WATER_2, BG_DS_OBJECT_TYPE_WATER_2, 1291.56, 790.837, 7.1, 3.14238, 0, 0, 0.694215, -0.719768, 120)
+ // buffs
+ || !AddObject(BG_DS_OBJECT_BUFF_1, BG_DS_OBJECT_TYPE_BUFF_1, 1291.7, 813.424, 7.11472, 4.64562, 0, 0, 0.730314, -0.683111, 120)
+ || !AddObject(BG_DS_OBJECT_BUFF_2, BG_DS_OBJECT_TYPE_BUFF_2, 1291.7, 768.911, 7.11472, 1.55194, 0, 0, 0.700409, 0.713742, 120))
+ {
+ sLog.outErrorDb("BatteGroundDS: Failed to spawn some object!");
+ return false;
+ }
+
return true;
}
diff --git a/src/game/BattleGroundDS.h b/src/game/BattleGroundDS.h
index 44a6cfbd33a..2ced5c88fd1 100644
--- a/src/game/BattleGroundDS.h
+++ b/src/game/BattleGroundDS.h
@@ -20,6 +20,34 @@
class BattleGround;
+enum BattleGroundDSObjectTypes
+{
+ BG_DS_OBJECT_DOOR_1 = 0,
+ BG_DS_OBJECT_DOOR_2 = 1,
+ BG_DS_OBJECT_WATER_1 = 2,
+ BG_DS_OBJECT_WATER_2 = 3,
+ BG_DS_OBJECT_BUFF_1 = 4,
+ BG_DS_OBJECT_BUFF_2 = 5,
+ BG_DS_OBJECT_MAX = 6
+};
+
+enum BattleGroundDSObjects
+{
+ BG_DS_OBJECT_TYPE_DOOR_1 = 192642,
+ BG_DS_OBJECT_TYPE_DOOR_2 = 192643,
+ BG_DS_OBJECT_TYPE_WATER_1 = 194395,
+ BG_DS_OBJECT_TYPE_WATER_2 = 191877,
+ BG_DS_OBJECT_TYPE_BUFF_1 = 184663,
+ BG_DS_OBJECT_TYPE_BUFF_2 = 184664
+};
+
+enum BattleGroundDSData
+{ // These values are NOT blizzlike... need the correct data!
+ BG_DS_WATERFALL_TIMER_MIN = 30000,
+ BG_DS_WATERFALL_TIMER_MAX = 60000,
+ BG_DS_WATERFALL_DURATION = 10000,
+};
+
class BattleGroundDSScore : public BattleGroundScore
{
public:
@@ -45,6 +73,17 @@ class BattleGroundDS : public BattleGround
void RemovePlayer(Player *plr, uint64 guid);
void HandleAreaTrigger(Player *Source, uint32 Trigger);
bool SetupBattleGround();
+ virtual void Reset();
+ virtual void FillInitialWorldStates(WorldPacket &d);
void HandleKillPlayer(Player* player, Player *killer);
+ bool HandlePlayerUnderMap(Player * plr);
+ private:
+ uint32 m_waterTimer;
+ bool m_waterfallActive;
+ protected:
+ bool isWaterFallActive() { return m_waterfallActive; };
+ void setWaterFallActive(bool active) { m_waterfallActive = active; };
+ void setWaterFallTimer(uint32 timer) { m_waterTimer = timer; };
+ uint32 getWaterFallTimer() { return m_waterTimer; };
};
#endif
diff --git a/src/game/BattleGroundHandler.cpp b/src/game/BattleGroundHandler.cpp
index 8413198272e..8d24be21dee 100644
--- a/src/game/BattleGroundHandler.cpp
+++ b/src/game/BattleGroundHandler.cpp
@@ -36,7 +36,7 @@
#include "Opcodes.h"
// Temporal fix to wintergrasp spirit guides till 3.2
-#include "OutdoorPvPWG.h"
+#include "Wintergrasp.h"
#include "OutdoorPvPMgr.h"
// WG end
@@ -285,7 +285,10 @@ void WorldSession::HandleBattlefieldListOpcode( WorldPacket &recv_data )
recv_data >> bgTypeId; // id from DBC
uint8 fromWhere;
- recv_data >> fromWhere; // 0 - battlemaster, 1 - UI
+ recv_data >> fromWhere; // 0 - battlemaster (lua: ShowBattlefieldList), 1 - UI (lua: RequestBattlegroundInstanceInfo)
+
+ uint8 unk1;
+ recv_data >> unk1; // Unknown 3.2.2
BattlemasterListEntry const* bl = sBattlemasterListStore.LookupEntry(bgTypeId);
if (!bl)
@@ -601,7 +604,7 @@ void WorldSession::HandleAreaSpiritHealerQueryOpcode( WorldPacket & recv_data )
{ // Wintergrasp Hack till 3.2 and it's implemented as BG
if (GetPlayer()->GetZoneId() == 4197)
{
- OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)sOutdoorPvPMgr.GetOutdoorPvPToZoneId(4197);
+ OPvPWintergrasp *pvpWG = (OPvPWintergrasp*)sOutdoorPvPMgr.GetOutdoorPvPToZoneId(4197);
if (pvpWG && pvpWG->isWarTime())
pvpWG->SendAreaSpiritHealerQueryOpcode(_player, guid);
}
@@ -632,7 +635,7 @@ void WorldSession::HandleAreaSpiritHealerQueueOpcode( WorldPacket & recv_data )
{ // Wintergrasp Hack till 3.2 and it's implemented as BG
if (GetPlayer()->GetZoneId() == 4197)
{
- OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)sOutdoorPvPMgr.GetOutdoorPvPToZoneId(4197);
+ OPvPWintergrasp *pvpWG = (OPvPWintergrasp*)sOutdoorPvPMgr.GetOutdoorPvPToZoneId(4197);
if (pvpWG && pvpWG->isWarTime())
pvpWG->AddPlayerToResurrectQueue(guid, _player->GetGUID());
}
@@ -742,7 +745,7 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data )
Player *member = itr->getSource();
// calc avg personal rating
- avg_pers_rating += member->GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arenaslot*6) + 5);
+ avg_pers_rating += member->GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arenaslot * ARENA_TEAM_END) + ARENA_TEAM_PERSONAL_RATING);
}
if (arenatype)
diff --git a/src/game/BattleGroundIC.cpp b/src/game/BattleGroundIC.cpp
new file mode 100644
index 00000000000..216b7cbe727
--- /dev/null
+++ b/src/game/BattleGroundIC.cpp
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "Player.h"
+#include "BattleGround.h"
+#include "BattleGroundIC.h"
+#include "Language.h"
+
+BattleGroundIC::BattleGroundIC()
+{
+ //TODO FIX ME!
+ m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_WS_START_TWO_MINUTES;
+ m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_WS_START_ONE_MINUTE;
+ m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE;
+ m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN;
+}
+
+BattleGroundIC::~BattleGroundIC()
+{
+
+}
+
+void BattleGroundIC::Update(uint32 diff)
+{
+ BattleGround::Update(diff);
+}
+
+void BattleGroundIC::StartingEventCloseDoors()
+{
+}
+
+void BattleGroundIC::StartingEventOpenDoors()
+{
+}
+
+void BattleGroundIC::AddPlayer(Player *plr)
+{
+ BattleGround::AddPlayer(plr);
+ //create score and add it to map, default values are set in constructor
+ BattleGroundICScore* sc = new BattleGroundICScore;
+
+ m_PlayerScores[plr->GetGUID()] = sc;
+}
+
+void BattleGroundIC::RemovePlayer(Player* /*plr*/,uint64 /*guid*/)
+{
+
+}
+
+void BattleGroundIC::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;
+}
+
+void BattleGroundIC::UpdatePlayerScore(Player* Source, uint32 type, uint32 value)
+{
+
+ std::map<uint64, BattleGroundScore*>::iterator itr = m_PlayerScores.find(Source->GetGUID());
+
+ if(itr == m_PlayerScores.end()) // player not found...
+ return;
+
+ BattleGround::UpdatePlayerScore(Source,type,value);
+} \ No newline at end of file
diff --git a/src/game/BattleGroundIC.h b/src/game/BattleGroundIC.h
new file mode 100644
index 00000000000..5c4b17cc926
--- /dev/null
+++ b/src/game/BattleGroundIC.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef __BATTLEGROUNDIC_H
+#define __BATTLEGROUNDIC_H
+
+class BattleGround;
+
+class BattleGroundICScore : public BattleGroundScore
+{
+ public:
+ BattleGroundICScore() {};
+ virtual ~BattleGroundICScore() {};
+};
+
+class BattleGroundIC : public BattleGround
+{
+ friend class BattleGroundMgr;
+
+ public:
+ BattleGroundIC();
+ ~BattleGroundIC();
+ void Update(uint32 diff);
+
+ /* inherited from BattlegroundClass */
+ virtual void AddPlayer(Player *plr);
+ virtual void StartingEventCloseDoors();
+ virtual void StartingEventOpenDoors();
+
+ void RemovePlayer(Player *plr,uint64 guid);
+ void HandleAreaTrigger(Player *Source, uint32 Trigger);
+ //bool SetupBattleGround();
+
+ /* Scorekeeping */
+ void UpdatePlayerScore(Player *Source, uint32 type, uint32 value);
+
+ private:
+};
+#endif \ No newline at end of file
diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp
index 926759c0373..56fbf772aea 100644
--- a/src/game/BattleGroundMgr.cpp
+++ b/src/game/BattleGroundMgr.cpp
@@ -37,6 +37,8 @@
#include "BattleGroundSA.h"
#include "BattleGroundDS.h"
#include "BattleGroundRV.h"
+#include "BattleGroundIC.h"
+#include "BattleGroundABG.h"
#include "Chat.h"
#include "Map.h"
#include "MapInstanced.h"
@@ -155,7 +157,7 @@ GroupQueueInfo * BattleGroundQueue::AddGroup(Player *leader, BattleGroundTypeId
// create new ginfo
// cannot use the method like in addplayer, because that could modify an in-queue group's stats
// (e.g. leader leaving queue then joining as individual again)
- GroupQueueInfo* ginfo = new GroupQueueInfo;
+ GroupQueueInfo* ginfo = new GroupQueueInfo;
ginfo->BgTypeId = BgTypeId;
ginfo->ArenaType = ArenaType;
ginfo->ArenaTeamId = arenateamid;
@@ -1423,6 +1425,8 @@ void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg)
case BATTLEGROUND_SA: // wotlk
case BATTLEGROUND_DS: // wotlk
case BATTLEGROUND_RV: // wotlk
+ case BATTLEGROUND_IC: // wotlk
+ case BATTLEGROUND_ABG: // wotlk
*data << (int32)0; // 0
break;
default:
@@ -1602,6 +1606,12 @@ BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeI
case BATTLEGROUND_RV:
bg = new BattleGroundRV(*(BattleGroundRV*)bg_template);
break;
+ case BATTLEGROUND_IC:
+ bg = new BattleGroundIC(*(BattleGroundIC*)bg_template);
+ break;
+ case BATTLEGROUND_ABG:
+ bg = new BattleGroundABG(*(BattleGroundABG*)bg_template);
+ break;
default:
//error, but it is handled few lines above
return 0;
@@ -1641,7 +1651,11 @@ uint32 BattleGroundMgr::CreateBattleGround(BattleGroundTypeId bgTypeId, bool IsA
case BATTLEGROUND_SA: bg = new BattleGroundSA; break;
case BATTLEGROUND_DS: bg = new BattleGroundDS; break;
case BATTLEGROUND_RV: bg = new BattleGroundRV; break;
- default:bg = new BattleGround; break; // placeholder for non implemented BG
+ case BATTLEGROUND_IC: bg = new BattleGroundIC; break;
+ case BATTLEGROUND_ABG: bg = new BattleGroundABG; break;
+ default:
+ bg = new BattleGround;
+ break;
}
bg->SetMapId(MapID);
@@ -1735,7 +1749,7 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
AStartLoc[2] = start->z;
AStartLoc[3] = fields[6].GetFloat();
}
- else if (bgTypeID == BATTLEGROUND_AA)
+ else if (bgTypeID == BATTLEGROUND_AA || bgTypeID == BATTLEGROUND_ABG)
{
AStartLoc[0] = 0;
AStartLoc[1] = 0;
@@ -1758,7 +1772,7 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
HStartLoc[2] = start->z;
HStartLoc[3] = fields[8].GetFloat();
}
- else if (bgTypeID == BATTLEGROUND_AA)
+ else if (bgTypeID == BATTLEGROUND_AA || bgTypeID == BATTLEGROUND_ABG)
{
HStartLoc[0] = 0;
HStartLoc[1] = 0;
@@ -1931,7 +1945,8 @@ bool BattleGroundMgr::IsArenaType(BattleGroundTypeId bgTypeId)
bgTypeId == BATTLEGROUND_NA ||
bgTypeId == BATTLEGROUND_DS ||
bgTypeId == BATTLEGROUND_RV ||
- bgTypeId == BATTLEGROUND_RL );
+ bgTypeId == BATTLEGROUND_RL ||
+ bgTypeId == BATTLEGROUND_DS );
}
BattleGroundQueueTypeId BattleGroundMgr::BGQueueTypeId(BattleGroundTypeId bgTypeId, uint8 arenaType)
@@ -1948,6 +1963,10 @@ BattleGroundQueueTypeId BattleGroundMgr::BGQueueTypeId(BattleGroundTypeId bgType
return BATTLEGROUND_QUEUE_EY;
case BATTLEGROUND_SA:
return BATTLEGROUND_QUEUE_SA;
+ case BATTLEGROUND_IC:
+ return BATTLEGROUND_QUEUE_IC;
+ case BATTLEGROUND_ABG:
+ return BATTLEGROUND_QUEUE_NONE;
case BATTLEGROUND_AA:
case BATTLEGROUND_NA:
case BATTLEGROUND_RL:
@@ -1984,6 +2003,8 @@ BattleGroundTypeId BattleGroundMgr::BGTemplateId(BattleGroundQueueTypeId bgQueue
return BATTLEGROUND_EY;
case BATTLEGROUND_QUEUE_SA:
return BATTLEGROUND_SA;
+ case BATTLEGROUND_QUEUE_IC:
+ return BATTLEGROUND_IC;
case BATTLEGROUND_QUEUE_2v2:
case BATTLEGROUND_QUEUE_3v3:
case BATTLEGROUND_QUEUE_5v5:
@@ -2134,3 +2155,24 @@ bool BattleGroundMgr::IsBGWeekend(BattleGroundTypeId bgTypeId)
return false;
}
}
+
+void BattleGroundMgr::DoCompleteAchievement(uint32 achievement, Player * player)
+{
+ AchievementEntry const* AE = GetAchievementStore()->LookupEntry(achievement);
+
+ if(!player)
+ {
+ //Map::PlayerList const &PlayerList = this->GetPlayers();
+ //GroupsQueueType::iterator group = SelectedGroups.begin();
+
+ //if (!PlayerList.isEmpty())
+ //for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
+ // for (GroupsQueueType::iterator itr = group; itr != SelectedGroups.end(); ++itr)
+ // if (Player *pPlayer = itr->getSource())
+ // pPlayer->CompletedAchievement(AE);
+ }
+ else
+ {
+ player->CompletedAchievement(AE);
+ }
+}
diff --git a/src/game/BattleGroundMgr.h b/src/game/BattleGroundMgr.h
index 9100142ebd0..95b45640b69 100644
--- a/src/game/BattleGroundMgr.h
+++ b/src/game/BattleGroundMgr.h
@@ -250,6 +250,7 @@ class BattleGroundMgr
static uint8 BGArenaType(BattleGroundQueueTypeId bgQueueTypeId);
static bool IsBGWeekend(BattleGroundTypeId bgTypeId);
+ void DoCompleteAchievement(uint32 achievement, Player * player = NULL);
private:
BattleMastersMap mBattleMastersMap;
diff --git a/src/game/BattleGroundWS.cpp b/src/game/BattleGroundWS.cpp
index 63dd2f48a0b..0071e2c615c 100644
--- a/src/game/BattleGroundWS.cpp
+++ b/src/game/BattleGroundWS.cpp
@@ -67,9 +67,32 @@ BattleGroundWS::~BattleGroundWS()
void BattleGroundWS::Update(uint32 diff)
{
BattleGround::Update(diff);
-
+
if (GetStatus() == STATUS_IN_PROGRESS)
{
+ if( GetStartTime() >= 25*MINUTE*1000 ) // Таймер тикать начинает после 25 минут
+ {
+ if( GetTeamScore(ALLIANCE) == 0 )
+ {
+ if ( GetTeamScore(HORDE) == 0 ) // No one scored - result is tie
+ EndBattleGround(NULL);
+
+ else // Horde has more points and thus wins
+ EndBattleGround(HORDE);
+ }
+
+ else if( GetTeamScore(HORDE) == 0 )
+ 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 first flag
+ EndBattleGround(m_FirstFlagCaptureTeam);
+
+ else if( GetTeamScore(HORDE) > GetTeamScore(ALLIANCE) ) // Last but not least, check who has the higher score
+ EndBattleGround(HORDE);
+ else
+ EndBattleGround(ALLIANCE);
+ }
+
if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_WAIT_RESPAWN)
{
m_FlagsTimer[BG_TEAM_ALLIANCE] -= diff;
@@ -225,7 +248,7 @@ void BattleGroundWS::RespawnFlagAfterDrop(uint32 team)
PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED);
- GameObject *obj = HashMapHolder<GameObject>::Find(GetDroppedFlagGUID(team));
+ GameObject *obj = GetBgMap()->GetGameObject(GetDroppedFlagGUID(team));
if (obj)
obj->Delete();
else
@@ -294,6 +317,9 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
UpdateTeamScore(Source->GetTeam());
// only flag capture should be updated
UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1); // +1 flag captures
+
+ if(!m_FirstFlagCaptureTeam)
+ SetFirstFlagCapture(Source->GetTeam());
if (GetTeamScore(ALLIANCE) == BG_WS_MAX_TEAM_SCORE)
winner = ALLIANCE;
diff --git a/src/game/BattleGroundWS.h b/src/game/BattleGroundWS.h
index 16631afecdc..1a98f0623c5 100644
--- a/src/game/BattleGroundWS.h
+++ b/src/game/BattleGroundWS.h
@@ -189,6 +189,7 @@ class BattleGroundWS : public BattleGround
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
void UpdateFlagState(uint32 team, uint32 value);
+ void SetFirstFlagCapture(uint32 team) { m_FirstFlagCaptureTeam = team; }
void UpdateTeamScore(uint32 team);
void UpdatePlayerScore(Player *Source, uint32 type, uint32 value);
void SetDroppedFlagGUID(uint64 guid, uint32 TeamID) { m_DroppedFlagGUID[GetTeamIndexByTeamId(TeamID)] = guid;}
@@ -206,7 +207,8 @@ class BattleGroundWS : public BattleGround
uint8 m_FlagState[2]; // for checking flag state
int32 m_FlagsTimer[2];
int32 m_FlagsDropTimer[2];
-
+ uint32 m_FirstFlagCaptureTeam; // Winner is based on this if score is equal
+
uint32 m_ReputationCapture;
uint32 m_HonorWinKills;
uint32 m_HonorEndKills;
diff --git a/src/game/CMakeLists.txt b/src/game/CMakeLists.txt
index 0131437b732..a4d656cf7f6 100644
--- a/src/game/CMakeLists.txt
+++ b/src/game/CMakeLists.txt
@@ -23,10 +23,12 @@ SET(game_STAT_SRCS
BattleGround.cpp
BattleGroundAA.cpp
BattleGroundAB.cpp
+ BattleGroundABG.cpp
BattleGroundAV.cpp
BattleGroundBE.cpp
BattleGroundDS.cpp
BattleGroundEY.cpp
+ BattleGroundIC.cpp
BattleGroundNA.cpp
BattleGroundRL.cpp
BattleGroundRV.cpp
@@ -35,10 +37,12 @@ SET(game_STAT_SRCS
BattleGround.h
BattleGroundAA.h
BattleGroundAB.h
+ BattleGroundABG.h
BattleGroundAV.h
BattleGroundBE.h
BattleGroundDS.h
BattleGroundEY.h
+ BattleGroundIC.h
BattleGroundNA.h
BattleGroundRL.h
BattleGroundRV.h