2010-10-07 15:35:36 +02:00
|
|
|
/*
|
|
|
|
|
* Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
|
|
|
|
|
* 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, see <http://www.gnu.org/licenses/>.
|
2009-12-17 10:43:12 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "Player.h"
|
2010-08-08 04:37:24 +02:00
|
|
|
#include "Battleground.h"
|
|
|
|
|
#include "BattlegroundIC.h"
|
2009-12-17 10:43:12 +01:00
|
|
|
#include "Language.h"
|
|
|
|
|
|
2010-08-08 04:37:24 +02:00
|
|
|
BattlegroundIC::BattlegroundIC()
|
2009-12-17 10:43:12 +01:00
|
|
|
{
|
2010-02-14 19:13:14 -07:00
|
|
|
m_BgCreatures.resize(2);
|
|
|
|
|
m_BgObjects.resize(5);
|
2009-12-17 10:43:12 +01:00
|
|
|
//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;
|
|
|
|
|
}
|
|
|
|
|
|
2010-08-08 04:37:24 +02:00
|
|
|
BattlegroundIC::~BattlegroundIC()
|
2009-12-17 10:43:12 +01:00
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2010-08-08 04:37:24 +02:00
|
|
|
void BattlegroundIC::Update(uint32 diff)
|
2009-12-17 10:43:12 +01:00
|
|
|
{
|
2010-08-08 04:37:24 +02:00
|
|
|
Battleground::Update(diff);
|
2009-12-17 10:43:12 +01:00
|
|
|
}
|
|
|
|
|
|
2010-08-08 04:37:24 +02:00
|
|
|
void BattlegroundIC::StartingEventCloseDoors()
|
2009-12-17 10:43:12 +01:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2010-08-08 04:37:24 +02:00
|
|
|
void BattlegroundIC::StartingEventOpenDoors()
|
2009-12-17 10:43:12 +01:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2010-08-08 04:37:24 +02:00
|
|
|
void BattlegroundIC::AddPlayer(Player *plr)
|
2009-12-17 10:43:12 +01:00
|
|
|
{
|
2010-08-08 04:37:24 +02:00
|
|
|
Battleground::AddPlayer(plr);
|
2009-12-17 10:43:12 +01:00
|
|
|
//create score and add it to map, default values are set in constructor
|
2010-08-08 04:37:24 +02:00
|
|
|
BattlegroundICScore* sc = new BattlegroundICScore;
|
2009-12-17 10:43:12 +01:00
|
|
|
|
|
|
|
|
m_PlayerScores[plr->GetGUID()] = sc;
|
|
|
|
|
}
|
|
|
|
|
|
2010-08-08 04:37:24 +02:00
|
|
|
void BattlegroundIC::RemovePlayer(Player* /*plr*/,uint64 /*guid*/)
|
2009-12-17 10:43:12 +01:00
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2010-08-08 04:37:24 +02:00
|
|
|
void BattlegroundIC::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/)
|
2009-12-17 10:43:12 +01:00
|
|
|
{
|
|
|
|
|
// this is wrong way to implement these things. On official it done by gameobject spell cast.
|
|
|
|
|
if (GetStatus() != STATUS_IN_PROGRESS)
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2010-08-08 04:37:24 +02:00
|
|
|
void BattlegroundIC::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor)
|
2009-12-17 10:43:12 +01:00
|
|
|
{
|
|
|
|
|
|
2010-08-08 04:37:24 +02:00
|
|
|
std::map<uint64, BattlegroundScore*>::iterator itr = m_PlayerScores.find(Source->GetGUID());
|
2009-12-17 10:43:12 +01:00
|
|
|
|
2010-04-07 19:14:10 +02:00
|
|
|
if (itr == m_PlayerScores.end()) // player not found...
|
2009-12-17 10:43:12 +01:00
|
|
|
return;
|
|
|
|
|
|
2010-08-08 04:37:24 +02:00
|
|
|
Battleground::UpdatePlayerScore(Source,type,value, doAddHonor);
|
2010-02-14 19:13:14 -07:00
|
|
|
}
|
|
|
|
|
|
2010-08-08 04:37:24 +02:00
|
|
|
bool BattlegroundIC::SetupBattleground()
|
2010-02-14 19:13:14 -07:00
|
|
|
{
|
|
|
|
|
AddObject(0, 195157, 459.72f, -419.93f, 42.55f, 0, 0, 0, 0.9996573f, 0.02617699f, 10*MINUTE);
|
|
|
|
|
AddObject(1, 195158, 797.72f, -1009.48f, 138.52f, 0, 0, 0, 0.9996573f, 0.02617699f, 10*MINUTE);
|
|
|
|
|
AddObject(2, 195338, 418.98f, -838.33f, 51.09f, 0, 0, 0, 0.9996573f, 0.02617699f, 10*MINUTE);
|
|
|
|
|
AddObject(3, 195343, 1267.45f, -390.88f, 24.23f, 0, 0, 0, 0.9996573f, 0.02617699f, 10*MINUTE);
|
|
|
|
|
AddObject(4, 195333, 769.27f, -833.53f, 9.57f, 0, 0, 0, 0.9996573f, 0.02617699f, 10*MINUTE);
|
|
|
|
|
SpawnLeader(ALLIANCE);
|
|
|
|
|
SpawnLeader(HORDE);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2010-08-08 04:37:24 +02:00
|
|
|
void BattlegroundIC::SpawnLeader(uint32 teamid)
|
2010-02-14 19:13:14 -07:00
|
|
|
{
|
|
|
|
|
if (teamid == ALLIANCE)
|
|
|
|
|
AddCreature(34924, 0, ALLIANCE, 307.03f, -833.04f, 48.91f, 6.23f, 10*MINUTE);
|
|
|
|
|
else
|
|
|
|
|
AddCreature(34922, 1, HORDE, 1264.42f, -766.80f, 48.91f, 3.28f, 10*MINUTE);
|
|
|
|
|
}
|
|
|
|
|
|
2010-08-08 04:37:24 +02:00
|
|
|
void BattlegroundIC::HandleKillUnit(Creature *unit, Player * /*killer*/)
|
2010-02-14 19:13:14 -07:00
|
|
|
{
|
|
|
|
|
if (GetStatus() != STATUS_IN_PROGRESS)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
uint32 entry = unit->GetEntry();
|
|
|
|
|
if (entry == 34924)
|
|
|
|
|
{
|
|
|
|
|
RewardHonorToTeam(500,HORDE);
|
2010-08-08 04:37:24 +02:00
|
|
|
EndBattleground(HORDE);
|
2010-02-14 19:13:14 -07:00
|
|
|
}
|
|
|
|
|
else if (entry == 34922)
|
|
|
|
|
{
|
|
|
|
|
RewardHonorToTeam(500,ALLIANCE);
|
2010-08-08 04:37:24 +02:00
|
|
|
EndBattleground(ALLIANCE);
|
2010-02-14 19:13:14 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-08-08 04:37:24 +02:00
|
|
|
void BattlegroundIC::EndBattleground(uint32 winner)
|
2010-02-14 19:13:14 -07:00
|
|
|
{
|
2010-08-08 04:37:24 +02:00
|
|
|
Battleground::EndBattleground(winner);
|
2010-02-14 19:13:14 -07:00
|
|
|
}
|
2010-04-19 09:26:37 +02:00
|
|
|
|
2010-08-08 04:37:24 +02:00
|
|
|
void BattlegroundIC::EventPlayerClickedOnFlag(Player * /*source*/, GameObject* /*target_obj*/)
|
2010-02-14 19:13:14 -07:00
|
|
|
{
|
|
|
|
|
if (GetStatus() != STATUS_IN_PROGRESS)
|
|
|
|
|
return;
|
|
|
|
|
}
|