Core/Battleground: Get rid of dinamic casts BattlegroundXX outside Battleground scope by implementing generic functions (1/2)
- HandleQuestComplete, CanActivateGO and IsSpellAllowed
This commit is contained in:
@@ -19,7 +19,6 @@
|
||||
#include "AchievementMgr.h"
|
||||
#include "ArenaTeam.h"
|
||||
#include "ArenaTeamMgr.h"
|
||||
#include "BattlegroundAB.h"
|
||||
#include "Battleground.h"
|
||||
#include "CellImpl.h"
|
||||
#include "Common.h"
|
||||
|
||||
@@ -524,7 +524,7 @@ inline void Battleground::_ProcessJoin(uint32 diff)
|
||||
BattlegroundQueueTypeId bgQueueTypeId = sBattlegroundMgr->BGQueueTypeId(m_TypeID, GetArenaType());
|
||||
uint32 queueSlot = player->GetBattlegroundQueueIndex(bgQueueTypeId);
|
||||
sBattlegroundMgr->BuildBattlegroundStatusPacket(&status, this, queueSlot, STATUS_IN_PROGRESS, 0, GetStartTime(), GetArenaType(), player->GetBGTeam());
|
||||
player->GetSession()->SendPacket(&status);
|
||||
player->SendDirectMessage(&status);
|
||||
|
||||
player->RemoveAurasDueToSpell(SPELL_ARENA_PREPARATION);
|
||||
player->ResetAllPowers();
|
||||
@@ -639,20 +639,19 @@ void Battleground::SendPacketToAll(WorldPacket* packet)
|
||||
{
|
||||
for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
if (Player* player = _GetPlayer(itr, "SendPacketToAll"))
|
||||
player->GetSession()->SendPacket(packet);
|
||||
player->SendDirectMessage(packet);
|
||||
}
|
||||
|
||||
void Battleground::SendPacketToTeam(uint32 TeamID, WorldPacket* packet, Player* sender, bool self)
|
||||
{
|
||||
for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
if (Player* player = _GetPlayerForTeam(TeamID, itr, "SendPacketToTeam"))
|
||||
{
|
||||
if (self || sender != player)
|
||||
{
|
||||
WorldSession* session = player->GetSession();
|
||||
TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "%s %s - SendPacketToTeam %u, Player: %s", GetOpcodeNameForLogging(packet->GetOpcode()).c_str(),
|
||||
session->GetPlayerInfo().c_str(), TeamID, sender ? sender->GetName().c_str() : "null");
|
||||
session->SendPacket(packet);
|
||||
}
|
||||
player->SendDirectMessage(packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Battleground::PlaySoundToAll(uint32 SoundID)
|
||||
@@ -669,7 +668,7 @@ void Battleground::PlaySoundToTeam(uint32 SoundID, uint32 TeamID)
|
||||
if (Player* player = _GetPlayerForTeam(TeamID, itr, "PlaySoundToTeam"))
|
||||
{
|
||||
sBattlegroundMgr->BuildPlaySoundPacket(&data, SoundID);
|
||||
player->GetSession()->SendPacket(&data);
|
||||
player->SendDirectMessage(&data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -694,7 +693,7 @@ void Battleground::YellToAll(Creature* creature, char const* text, uint32 langua
|
||||
{
|
||||
WorldPacket data(SMSG_MESSAGECHAT, 200);
|
||||
creature->BuildMonsterChat(&data, CHAT_MSG_MONSTER_YELL, text, language, creature->GetName(), itr->first);
|
||||
player->GetSession()->SendPacket(&data);
|
||||
player->SendDirectMessage(&data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -720,11 +719,11 @@ void Battleground::UpdateWorldState(uint32 Field, uint32 Value)
|
||||
SendPacketToAll(&data);
|
||||
}
|
||||
|
||||
void Battleground::UpdateWorldStateForPlayer(uint32 Field, uint32 Value, Player* Source)
|
||||
void Battleground::UpdateWorldStateForPlayer(uint32 field, uint32 value, Player* player)
|
||||
{
|
||||
WorldPacket data;
|
||||
sBattlegroundMgr->BuildUpdateWorldStatePacket(&data, Field, Value);
|
||||
Source->GetSession()->SendPacket(&data);
|
||||
sBattlegroundMgr->BuildUpdateWorldStatePacket(&data, field, value);
|
||||
player->SendDirectMessage(&data);
|
||||
}
|
||||
|
||||
void Battleground::EndBattleground(uint32 winner)
|
||||
@@ -916,11 +915,11 @@ void Battleground::EndBattleground(uint32 winner)
|
||||
|
||||
BlockMovement(player);
|
||||
|
||||
player->GetSession()->SendPacket(&pvpLogData);
|
||||
player->SendDirectMessage(&pvpLogData);
|
||||
|
||||
WorldPacket data;
|
||||
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, this, player->GetBattlegroundQueueIndex(bgQueueTypeId), STATUS_IN_PROGRESS, TIME_TO_AUTOREMOVE, GetStartTime(), GetArenaType(), player->GetBGTeam());
|
||||
player->GetSession()->SendPacket(&data);
|
||||
player->SendDirectMessage(&data);
|
||||
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND, 1);
|
||||
}
|
||||
|
||||
@@ -1023,7 +1022,7 @@ void Battleground::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
|
||||
{
|
||||
WorldPacket data;
|
||||
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, this, player->GetBattlegroundQueueIndex(bgQueueTypeId), STATUS_NONE, 0, 0, 0, 0);
|
||||
player->GetSession()->SendPacket(&data);
|
||||
player->SendDirectMessage(&data);
|
||||
}
|
||||
|
||||
// this call is important, because player, when joins to battleground, this method is not called, so it must be called when leaving bg
|
||||
@@ -1727,8 +1726,7 @@ void Battleground::SendWarningToAll(int32 entry, ...)
|
||||
data << (uint8)0;
|
||||
for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER)))
|
||||
if (player->GetSession())
|
||||
player->GetSession()->SendPacket(&data);
|
||||
player->SendDirectMessage(&data);
|
||||
}
|
||||
|
||||
void Battleground::SendMessage2ToAll(int32 entry, ChatMsg type, Player const* source, int32 arg1, int32 arg2)
|
||||
@@ -1860,10 +1858,10 @@ void Battleground::PlayerAddedToBGCheckIfBGIsRunning(Player* player)
|
||||
BlockMovement(player);
|
||||
|
||||
sBattlegroundMgr->BuildPvpLogDataPacket(&data, this);
|
||||
player->GetSession()->SendPacket(&data);
|
||||
player->SendDirectMessage(&data);
|
||||
|
||||
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, this, player->GetBattlegroundQueueIndex(bgQueueTypeId), STATUS_IN_PROGRESS, GetEndTime(), GetStartTime(), GetArenaType(), player->GetBGTeam());
|
||||
player->GetSession()->SendPacket(&data);
|
||||
player->SendDirectMessage(&data);
|
||||
}
|
||||
|
||||
uint32 Battleground::GetAlivePlayersCountByTeam(uint32 Team) const
|
||||
|
||||
@@ -29,17 +29,6 @@ class Group;
|
||||
class Player;
|
||||
class WorldPacket;
|
||||
class BattlegroundMap;
|
||||
class BattlegroundAV;
|
||||
class BattlegroundWS;
|
||||
class BattlegroundAB;
|
||||
class BattlegroundNA;
|
||||
class BattlegroundBE;
|
||||
class BattlegroundEY;
|
||||
class BattlegroundRL;
|
||||
class BattlegroundSA;
|
||||
class BattlegroundDS;
|
||||
class BattlegroundRV;
|
||||
class BattlegroundIC;
|
||||
|
||||
struct PvPDifficultyEntry;
|
||||
struct WorldSafeLocsEntry;
|
||||
@@ -300,7 +289,7 @@ class Battleground
|
||||
virtual void DestroyGate(Player* /*player*/, GameObject* /*go*/) {}
|
||||
|
||||
/* achievement req. */
|
||||
virtual bool IsAllNodesConrolledByTeam(uint32 /*team*/) const { return false; }
|
||||
virtual bool IsAllNodesControlledByTeam(uint32 /*team*/) const { return false; }
|
||||
void StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry);
|
||||
|
||||
/* Battleground */
|
||||
@@ -433,7 +422,7 @@ class Battleground
|
||||
void RewardHonorToTeam(uint32 Honor, uint32 TeamID);
|
||||
void RewardReputationToTeam(uint32 faction_id, uint32 Reputation, uint32 TeamID);
|
||||
void UpdateWorldState(uint32 Field, uint32 Value);
|
||||
void UpdateWorldStateForPlayer(uint32 Field, uint32 Value, Player* Source);
|
||||
void UpdateWorldStateForPlayer(uint32 Field, uint32 Value, Player* player);
|
||||
void EndBattleground(uint32 winner);
|
||||
void BlockMovement(Player* player);
|
||||
|
||||
@@ -448,7 +437,7 @@ class Battleground
|
||||
Group* GetBgRaid(uint32 TeamID) const { return TeamID == ALLIANCE ? m_BgRaids[TEAM_ALLIANCE] : m_BgRaids[TEAM_HORDE]; }
|
||||
void SetBgRaid(uint32 TeamID, Group* bg_raid);
|
||||
|
||||
virtual void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true);
|
||||
virtual void UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true);
|
||||
|
||||
static TeamId GetTeamIndexByTeamId(uint32 Team) { return Team == ALLIANCE ? TEAM_ALLIANCE : TEAM_HORDE; }
|
||||
uint32 GetPlayersCountByTeam(uint32 Team) const { return m_PlayersCount[GetTeamIndexByTeamId(Team)]; }
|
||||
@@ -477,7 +466,7 @@ class Battleground
|
||||
|
||||
// Triggers handle
|
||||
// must be implemented in BG subclass
|
||||
virtual void HandleAreaTrigger(Player* /*Source*/, uint32 /*Trigger*/);
|
||||
virtual void HandleAreaTrigger(Player* /*player*/, uint32 /*Trigger*/);
|
||||
// must be implemented in BG subclass if need AND call base class generic code
|
||||
virtual void HandleKillPlayer(Player* player, Player* killer);
|
||||
virtual void HandleKillUnit(Creature* /*unit*/, Player* /*killer*/);
|
||||
@@ -541,43 +530,13 @@ class Battleground
|
||||
|
||||
virtual uint64 GetFlagPickerGUID(int32 /*team*/ = -1) const { return 0; }
|
||||
virtual void SetDroppedFlagGUID(uint64 /*guid*/, int32 /*team*/ = -1) {}
|
||||
virtual void HandleQuestComplete(uint32 /*questid*/, Player* /*player*/) {}
|
||||
virtual bool CanActivateGO(int32 /*entry*/, uint32 /*team*/) const { return true; }
|
||||
virtual bool IsSpellAllowed(uint32 /*spellId*/, Player const* /*player*/) const { return true; }
|
||||
uint32 GetTeamScore(uint32 TeamID) const;
|
||||
|
||||
virtual uint32 GetPrematureWinner();
|
||||
|
||||
BattlegroundAV* ToBattlegroundAV() { if (GetTypeID() == BATTLEGROUND_AV) return reinterpret_cast<BattlegroundAV*>(this); else return NULL; }
|
||||
BattlegroundAV const* ToBattlegroundAV() const { if (GetTypeID() == BATTLEGROUND_AV) return reinterpret_cast<const BattlegroundAV*>(this); else return NULL; }
|
||||
|
||||
BattlegroundWS* ToBattlegroundWS() { if (GetTypeID() == BATTLEGROUND_WS) return reinterpret_cast<BattlegroundWS*>(this); else return NULL; }
|
||||
BattlegroundWS const* ToBattlegroundWS() const { if (GetTypeID() == BATTLEGROUND_WS) return reinterpret_cast<const BattlegroundWS*>(this); else return NULL; }
|
||||
|
||||
BattlegroundAB* ToBattlegroundAB() { if (GetTypeID() == BATTLEGROUND_AB) return reinterpret_cast<BattlegroundAB*>(this); else return NULL; }
|
||||
BattlegroundAB const* ToBattlegroundAB() const { if (GetTypeID() == BATTLEGROUND_AB) return reinterpret_cast<const BattlegroundAB*>(this); else return NULL; }
|
||||
|
||||
BattlegroundNA* ToBattlegroundNA() { if (GetTypeID() == BATTLEGROUND_NA) return reinterpret_cast<BattlegroundNA*>(this); else return NULL; }
|
||||
BattlegroundNA const* ToBattlegroundNA() const { if (GetTypeID() == BATTLEGROUND_NA) return reinterpret_cast<const BattlegroundNA*>(this); else return NULL; }
|
||||
|
||||
BattlegroundBE* ToBattlegroundBE() { if (GetTypeID() == BATTLEGROUND_BE) return reinterpret_cast<BattlegroundBE*>(this); else return NULL; }
|
||||
BattlegroundBE const* ToBattlegroundBE() const { if (GetTypeID() == BATTLEGROUND_BE) return reinterpret_cast<const BattlegroundBE*>(this); else return NULL; }
|
||||
|
||||
BattlegroundEY* ToBattlegroundEY() { if (GetTypeID() == BATTLEGROUND_EY) return reinterpret_cast<BattlegroundEY*>(this); else return NULL; }
|
||||
BattlegroundEY const* ToBattlegroundEY() const { if (GetTypeID() == BATTLEGROUND_EY) return reinterpret_cast<const BattlegroundEY*>(this); else return NULL; }
|
||||
|
||||
BattlegroundRL* ToBattlegroundRL() { if (GetTypeID() == BATTLEGROUND_RL) return reinterpret_cast<BattlegroundRL*>(this); else return NULL; }
|
||||
BattlegroundRL const* ToBattlegroundRL() const { if (GetTypeID() == BATTLEGROUND_RL) return reinterpret_cast<const BattlegroundRL*>(this); else return NULL; }
|
||||
|
||||
BattlegroundSA* ToBattlegroundSA() { if (GetTypeID() == BATTLEGROUND_SA) return reinterpret_cast<BattlegroundSA*>(this); else return NULL; }
|
||||
BattlegroundSA const* ToBattlegroundSA() const { if (GetTypeID() == BATTLEGROUND_SA) return reinterpret_cast<const BattlegroundSA*>(this); else return NULL; }
|
||||
|
||||
BattlegroundDS* ToBattlegroundDS() { if (GetTypeID() == BATTLEGROUND_DS) return reinterpret_cast<BattlegroundDS*>(this); else return NULL; }
|
||||
BattlegroundDS const* ToBattlegroundDS() const { if (GetTypeID() == BATTLEGROUND_DS) return reinterpret_cast<const BattlegroundDS*>(this); else return NULL; }
|
||||
|
||||
BattlegroundRV* ToBattlegroundRV() { if (GetTypeID() == BATTLEGROUND_RV) return reinterpret_cast<BattlegroundRV*>(this); else return NULL; }
|
||||
BattlegroundRV const* ToBattlegroundRV() const { if (GetTypeID() == BATTLEGROUND_RV) return reinterpret_cast<const BattlegroundRV*>(this); else return NULL; }
|
||||
|
||||
BattlegroundIC* ToBattlegroundIC() { if (GetTypeID() == BATTLEGROUND_IC) return reinterpret_cast<BattlegroundIC*>(this); else return NULL; }
|
||||
BattlegroundIC const* ToBattlegroundIC() const { if (GetTypeID() == BATTLEGROUND_IC) return reinterpret_cast<const BattlegroundIC*>(this); else return NULL; }
|
||||
|
||||
protected:
|
||||
// this method is called, when BG cannot spawn its own spirit guide, or something is wrong, It correctly ends Battleground
|
||||
void EndNow();
|
||||
|
||||
@@ -111,23 +111,28 @@ void BattlegroundAB::PostUpdateImpl(uint32 diff)
|
||||
int points = team_points[team];
|
||||
if (!points)
|
||||
continue;
|
||||
|
||||
m_lastTick[team] += diff;
|
||||
|
||||
if (m_lastTick[team] > BG_AB_TickIntervals[points])
|
||||
{
|
||||
m_lastTick[team] -= BG_AB_TickIntervals[points];
|
||||
m_TeamScores[team] += BG_AB_TickPoints[points];
|
||||
m_HonorScoreTics[team] += BG_AB_TickPoints[points];
|
||||
m_ReputationScoreTics[team] += BG_AB_TickPoints[points];
|
||||
|
||||
if (m_ReputationScoreTics[team] >= m_ReputationTics)
|
||||
{
|
||||
(team == TEAM_ALLIANCE) ? RewardReputationToTeam(509, 10, ALLIANCE) : RewardReputationToTeam(510, 10, HORDE);
|
||||
m_ReputationScoreTics[team] -= m_ReputationTics;
|
||||
}
|
||||
|
||||
if (m_HonorScoreTics[team] >= m_HonorTics)
|
||||
{
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), (team == TEAM_ALLIANCE) ? ALLIANCE : HORDE);
|
||||
m_HonorScoreTics[team] -= m_HonorTics;
|
||||
}
|
||||
|
||||
if (!m_IsInformedNearVictory && m_TeamScores[team] > BG_AB_WARNING_NEAR_VICTORY_SCORE)
|
||||
{
|
||||
if (team == TEAM_ALLIANCE)
|
||||
@@ -140,9 +145,10 @@ void BattlegroundAB::PostUpdateImpl(uint32 diff)
|
||||
|
||||
if (m_TeamScores[team] > BG_AB_MAX_TEAM_SCORE)
|
||||
m_TeamScores[team] = BG_AB_MAX_TEAM_SCORE;
|
||||
|
||||
if (team == TEAM_ALLIANCE)
|
||||
UpdateWorldState(BG_AB_OP_RESOURCES_ALLY, m_TeamScores[team]);
|
||||
if (team == TEAM_HORDE)
|
||||
else if (team == TEAM_HORDE)
|
||||
UpdateWorldState(BG_AB_OP_RESOURCES_HORDE, m_TeamScores[team]);
|
||||
// update achievement flags
|
||||
// we increased m_TeamScores[team] so we just need to check if it is 500 more than other teams resources
|
||||
@@ -155,7 +161,7 @@ void BattlegroundAB::PostUpdateImpl(uint32 diff)
|
||||
// Test win condition
|
||||
if (m_TeamScores[TEAM_ALLIANCE] >= BG_AB_MAX_TEAM_SCORE)
|
||||
EndBattleground(ALLIANCE);
|
||||
if (m_TeamScores[TEAM_HORDE] >= BG_AB_MAX_TEAM_SCORE)
|
||||
else if (m_TeamScores[TEAM_HORDE] >= BG_AB_MAX_TEAM_SCORE)
|
||||
EndBattleground(HORDE);
|
||||
}
|
||||
}
|
||||
@@ -397,8 +403,7 @@ void BattlegroundAB::_NodeDeOccupied(uint8 node)
|
||||
|
||||
RelocateDeadPlayers(BgCreatures[node]);
|
||||
|
||||
if (BgCreatures[node])
|
||||
DelCreature(node);
|
||||
DelCreature(node);
|
||||
|
||||
// buff object isn't despawned
|
||||
}
|
||||
@@ -696,7 +701,7 @@ void BattlegroundAB::UpdatePlayerScore(Player* Source, uint32 type, uint32 value
|
||||
}
|
||||
}
|
||||
|
||||
bool BattlegroundAB::IsAllNodesConrolledByTeam(uint32 team) const
|
||||
bool BattlegroundAB::IsAllNodesControlledByTeam(uint32 team) const
|
||||
{
|
||||
uint32 count = 0;
|
||||
for (int i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
|
||||
|
||||
@@ -270,7 +270,7 @@ class BattlegroundAB : public Battleground
|
||||
void EventPlayerClickedOnFlag(Player* source, GameObject* target_obj);
|
||||
|
||||
/* achievement req. */
|
||||
bool IsAllNodesConrolledByTeam(uint32 team) const; // overwrited
|
||||
bool IsAllNodesControlledByTeam(uint32 team) const;
|
||||
bool IsTeamScores500Disadvantage(uint32 team) const { return m_TeamScores500Disadvantage[GetTeamIndexByTeamId(team)]; }
|
||||
|
||||
uint32 GetPrematureWinner();
|
||||
|
||||
@@ -445,7 +445,7 @@ void BattlegroundAV::StartingEventOpenDoors()
|
||||
DoorOpen(BG_AV_OBJECT_DOOR_A);
|
||||
|
||||
// Achievement: The Alterac Blitz
|
||||
StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, AV_EVENT_START_BATTLE);
|
||||
StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, BG_AV_EVENT_START_BATTLE);
|
||||
}
|
||||
|
||||
void BattlegroundAV::AddPlayer(Player* player)
|
||||
@@ -733,7 +733,7 @@ void BattlegroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial)
|
||||
return;
|
||||
}
|
||||
|
||||
bool BattlegroundAV::PlayerCanDoMineQuest(int32 GOId, uint32 team)
|
||||
bool BattlegroundAV::CanActivateGO(int32 GOId, uint32 team) const
|
||||
{
|
||||
if (GOId == BG_AV_OBJECTID_MINE_N)
|
||||
return (m_Mine_Owner[AV_NORTH_MINE] == team);
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
#define BG_AV_KILL_SURVIVING_CAPTAIN 2
|
||||
#define BG_AV_REP_SURVIVING_CAPTAIN 125
|
||||
|
||||
#define AV_EVENT_START_BATTLE 9166 // Achievement: The Alterac Blitz
|
||||
#define BG_AV_EVENT_START_BATTLE 9166 // Achievement: The Alterac Blitz
|
||||
|
||||
enum BG_AV_Sounds
|
||||
{ /// @todo: get out if there comes a sound when neutral team captures mine
|
||||
@@ -1527,7 +1527,8 @@ inline BG_AV_Nodes &operator++(BG_AV_Nodes &i){ return i = BG_AV_Nodes(i + 1); }
|
||||
|
||||
struct BattlegroundAVScore : public BattlegroundScore
|
||||
{
|
||||
BattlegroundAVScore() : GraveyardsAssaulted(0), GraveyardsDefended(0), TowersAssaulted(0), TowersDefended(0), MinesCaptured(0), LeadersKilled(0), SecondaryObjectives(0) { }
|
||||
BattlegroundAVScore() : GraveyardsAssaulted(0), GraveyardsDefended(0), TowersAssaulted(0),
|
||||
TowersDefended(0), MinesCaptured(0), LeadersKilled(0), SecondaryObjectives(0) { }
|
||||
~BattlegroundAVScore() { }
|
||||
uint32 GraveyardsAssaulted;
|
||||
uint32 GraveyardsDefended;
|
||||
@@ -1550,20 +1551,20 @@ class BattlegroundAV : public Battleground
|
||||
void StartingEventOpenDoors();
|
||||
|
||||
void RemovePlayer(Player* player, uint64 guid, uint32 team);
|
||||
void HandleAreaTrigger(Player* Source, uint32 Trigger);
|
||||
void HandleAreaTrigger(Player* player, uint32 trigger);
|
||||
bool SetupBattleground();
|
||||
void ResetBGSubclass();
|
||||
|
||||
/*general stuff*/
|
||||
void UpdateScore(uint16 team, int16 points);
|
||||
void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true);
|
||||
void UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true);
|
||||
|
||||
/*handlestuff*/ //these are functions which get called from extern
|
||||
void EventPlayerClickedOnFlag(Player* source, GameObject* target_obj);
|
||||
void HandleKillPlayer(Player* player, Player* killer);
|
||||
void HandleKillUnit(Creature* unit, Player* killer);
|
||||
void HandleQuestComplete(uint32 questid, Player* player);
|
||||
bool PlayerCanDoMineQuest(int32 GOId, uint32 team);
|
||||
bool CanActivateGO(int32 GOId, uint32 team) const;
|
||||
|
||||
void EndBattleground(uint32 winner);
|
||||
|
||||
|
||||
@@ -142,12 +142,10 @@ bool BattlegroundBE::SetupBattleground()
|
||||
|
||||
void BattlegroundBE::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor)
|
||||
{
|
||||
|
||||
BattlegroundScoreMap::iterator itr = PlayerScores.find(Source->GetGUID());
|
||||
if (itr == PlayerScores.end()) // player not found...
|
||||
return;
|
||||
|
||||
//there is nothing special in this score
|
||||
Battleground::UpdatePlayerScore(Source, type, value, doAddHonor);
|
||||
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ BattlegroundDS::BattlegroundDS()
|
||||
StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S;
|
||||
StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S;
|
||||
StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE;
|
||||
//we must set messageIds
|
||||
StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE;
|
||||
StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS;
|
||||
StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS;
|
||||
|
||||
@@ -122,7 +122,7 @@ void BattlegroundEY::StartingEventOpenDoors()
|
||||
}
|
||||
|
||||
// Achievement: Flurry
|
||||
StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, EY_EVENT_START_BATTLE);
|
||||
StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, BG_EY_EVENT_START_BATTLE);
|
||||
}
|
||||
|
||||
void BattlegroundEY::AddPoints(uint32 Team, uint32 Points)
|
||||
@@ -591,16 +591,16 @@ void BattlegroundEY::HandleKillPlayer(Player* player, Player* killer)
|
||||
EventPlayerDroppedFlag(player);
|
||||
}
|
||||
|
||||
void BattlegroundEY::EventPlayerDroppedFlag(Player* Source)
|
||||
void BattlegroundEY::EventPlayerDroppedFlag(Player* player)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
{
|
||||
// if not running, do not cast things at the dropper player, neither send unnecessary messages
|
||||
// just take off the aura
|
||||
if (IsFlagPickedup() && GetFlagPickerGUID() == Source->GetGUID())
|
||||
if (IsFlagPickedup() && GetFlagPickerGUID() == player->GetGUID())
|
||||
{
|
||||
SetFlagPicker(0);
|
||||
Source->RemoveAurasDueToSpell(BG_EY_NETHERSTORM_FLAG_SPELL);
|
||||
player->RemoveAurasDueToSpell(BG_EY_NETHERSTORM_FLAG_SPELL);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -608,31 +608,31 @@ void BattlegroundEY::EventPlayerDroppedFlag(Player* Source)
|
||||
if (!IsFlagPickedup())
|
||||
return;
|
||||
|
||||
if (GetFlagPickerGUID() != Source->GetGUID())
|
||||
if (GetFlagPickerGUID() != player->GetGUID())
|
||||
return;
|
||||
|
||||
SetFlagPicker(0);
|
||||
Source->RemoveAurasDueToSpell(BG_EY_NETHERSTORM_FLAG_SPELL);
|
||||
player->RemoveAurasDueToSpell(BG_EY_NETHERSTORM_FLAG_SPELL);
|
||||
m_FlagState = BG_EY_FLAG_STATE_ON_GROUND;
|
||||
m_FlagsTimer = BG_EY_FLAG_RESPAWN_TIME;
|
||||
Source->CastSpell(Source, SPELL_RECENTLY_DROPPED_FLAG, true);
|
||||
Source->CastSpell(Source, BG_EY_PLAYER_DROPPED_FLAG_SPELL, true);
|
||||
player->CastSpell(player, SPELL_RECENTLY_DROPPED_FLAG, true);
|
||||
player->CastSpell(player, BG_EY_PLAYER_DROPPED_FLAG_SPELL, true);
|
||||
//this does not work correctly :((it should remove flag carrier name)
|
||||
UpdateWorldState(NETHERSTORM_FLAG_STATE_HORDE, BG_EY_FLAG_STATE_WAIT_RESPAWN);
|
||||
UpdateWorldState(NETHERSTORM_FLAG_STATE_ALLIANCE, BG_EY_FLAG_STATE_WAIT_RESPAWN);
|
||||
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
if (player->GetTeam() == ALLIANCE)
|
||||
SendMessageToAll(LANG_BG_EY_DROPPED_FLAG, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL);
|
||||
else
|
||||
SendMessageToAll(LANG_BG_EY_DROPPED_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, NULL);
|
||||
}
|
||||
|
||||
void BattlegroundEY::EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj)
|
||||
void BattlegroundEY::EventPlayerClickedOnFlag(Player* player, GameObject* target_obj)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS || IsFlagPickedup() || !Source->IsWithinDistInMap(target_obj, 10))
|
||||
if (GetStatus() != STATUS_IN_PROGRESS || IsFlagPickedup() || !player->IsWithinDistInMap(target_obj, 10))
|
||||
return;
|
||||
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
if (player->GetTeam() == ALLIANCE)
|
||||
{
|
||||
UpdateWorldState(NETHERSTORM_FLAG_STATE_ALLIANCE, BG_EY_FLAG_STATE_ON_PLAYER);
|
||||
PlaySoundToAll(BG_EY_SOUND_FLAG_PICKED_UP_ALLIANCE);
|
||||
@@ -648,18 +648,18 @@ void BattlegroundEY::EventPlayerClickedOnFlag(Player* Source, GameObject* target
|
||||
m_FlagState = BG_EY_FLAG_STATE_ON_PLAYER;
|
||||
|
||||
SpawnBGObject(BG_EY_OBJECT_FLAG_NETHERSTORM, RESPAWN_ONE_DAY);
|
||||
SetFlagPicker(Source->GetGUID());
|
||||
SetFlagPicker(player->GetGUID());
|
||||
//get flag aura on player
|
||||
Source->CastSpell(Source, BG_EY_NETHERSTORM_FLAG_SPELL, true);
|
||||
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
||||
player->CastSpell(player, BG_EY_NETHERSTORM_FLAG_SPELL, true);
|
||||
player->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
||||
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL, Source->GetName().c_str());
|
||||
if (player->GetTeam() == ALLIANCE)
|
||||
PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL, player->GetName().c_str());
|
||||
else
|
||||
PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, NULL, Source->GetName().c_str());
|
||||
PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, NULL, player->GetName().c_str());
|
||||
}
|
||||
|
||||
void BattlegroundEY::EventTeamLostPoint(Player* Source, uint32 Point)
|
||||
void BattlegroundEY::EventTeamLostPoint(Player* player, uint32 Point)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
@@ -695,9 +695,9 @@ void BattlegroundEY::EventTeamLostPoint(Player* Source, uint32 Point)
|
||||
m_PointState[Point] = EY_POINT_NO_OWNER;
|
||||
|
||||
if (Team == ALLIANCE)
|
||||
SendMessageToAll(m_LosingPointTypes[Point].MessageIdAlliance, CHAT_MSG_BG_SYSTEM_ALLIANCE, Source);
|
||||
SendMessageToAll(m_LosingPointTypes[Point].MessageIdAlliance, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
|
||||
else
|
||||
SendMessageToAll(m_LosingPointTypes[Point].MessageIdHorde, CHAT_MSG_BG_SYSTEM_HORDE, Source);
|
||||
SendMessageToAll(m_LosingPointTypes[Point].MessageIdHorde, CHAT_MSG_BG_SYSTEM_HORDE, player);
|
||||
|
||||
UpdatePointsIcons(Team, Point);
|
||||
UpdatePointsCount(Team);
|
||||
@@ -707,12 +707,12 @@ void BattlegroundEY::EventTeamLostPoint(Player* Source, uint32 Point)
|
||||
DelCreature(Point + 6);//NULL checks are in DelCreature! 0-5 spirit guides
|
||||
}
|
||||
|
||||
void BattlegroundEY::EventTeamCapturedPoint(Player* Source, uint32 Point)
|
||||
void BattlegroundEY::EventTeamCapturedPoint(Player* player, uint32 Point)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
uint32 Team = Source->GetTeam();
|
||||
uint32 Team = player->GetTeam();
|
||||
|
||||
SpawnBGObject(m_CapturingPointTypes[Point].DespawnNeutralObjectType, RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(m_CapturingPointTypes[Point].DespawnNeutralObjectType + 1, RESPAWN_ONE_DAY);
|
||||
@@ -739,9 +739,9 @@ void BattlegroundEY::EventTeamCapturedPoint(Player* Source, uint32 Point)
|
||||
m_PointState[Point] = EY_POINT_UNDER_CONTROL;
|
||||
|
||||
if (Team == ALLIANCE)
|
||||
SendMessageToAll(m_CapturingPointTypes[Point].MessageIdAlliance, CHAT_MSG_BG_SYSTEM_ALLIANCE, Source);
|
||||
SendMessageToAll(m_CapturingPointTypes[Point].MessageIdAlliance, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
|
||||
else
|
||||
SendMessageToAll(m_CapturingPointTypes[Point].MessageIdHorde, CHAT_MSG_BG_SYSTEM_HORDE, Source);
|
||||
SendMessageToAll(m_CapturingPointTypes[Point].MessageIdHorde, CHAT_MSG_BG_SYSTEM_HORDE, player);
|
||||
|
||||
if (BgCreatures[Point])
|
||||
DelCreature(Point);
|
||||
@@ -774,18 +774,18 @@ void BattlegroundEY::EventTeamCapturedPoint(Player* Source, uint32 Point)
|
||||
}
|
||||
}
|
||||
|
||||
void BattlegroundEY::EventPlayerCapturedFlag(Player* Source, uint32 BgObjectType)
|
||||
void BattlegroundEY::EventPlayerCapturedFlag(Player* player, uint32 BgObjectType)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS || GetFlagPickerGUID() != Source->GetGUID())
|
||||
if (GetStatus() != STATUS_IN_PROGRESS || GetFlagPickerGUID() != player->GetGUID())
|
||||
return;
|
||||
|
||||
SetFlagPicker(0);
|
||||
m_FlagState = BG_EY_FLAG_STATE_WAIT_RESPAWN;
|
||||
Source->RemoveAurasDueToSpell(BG_EY_NETHERSTORM_FLAG_SPELL);
|
||||
player->RemoveAurasDueToSpell(BG_EY_NETHERSTORM_FLAG_SPELL);
|
||||
|
||||
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
||||
player->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
||||
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
if (player->GetTeam() == ALLIANCE)
|
||||
PlaySoundToAll(BG_EY_SOUND_FLAG_CAPTURED_ALLIANCE);
|
||||
else
|
||||
PlaySoundToAll(BG_EY_SOUND_FLAG_CAPTURED_HORDE);
|
||||
@@ -796,26 +796,26 @@ void BattlegroundEY::EventPlayerCapturedFlag(Player* Source, uint32 BgObjectType
|
||||
m_FlagCapturedBgObjectType = BgObjectType;
|
||||
|
||||
uint8 team_id = 0;
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
if (player->GetTeam() == ALLIANCE)
|
||||
{
|
||||
team_id = TEAM_ALLIANCE;
|
||||
SendMessageToAll(LANG_BG_EY_CAPTURED_FLAG_A, CHAT_MSG_BG_SYSTEM_ALLIANCE, Source);
|
||||
SendMessageToAll(LANG_BG_EY_CAPTURED_FLAG_A, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
|
||||
}
|
||||
else
|
||||
{
|
||||
team_id = TEAM_HORDE;
|
||||
SendMessageToAll(LANG_BG_EY_CAPTURED_FLAG_H, CHAT_MSG_BG_SYSTEM_HORDE, Source);
|
||||
SendMessageToAll(LANG_BG_EY_CAPTURED_FLAG_H, CHAT_MSG_BG_SYSTEM_HORDE, player);
|
||||
}
|
||||
|
||||
if (m_TeamPointsCount[team_id] > 0)
|
||||
AddPoints(Source->GetTeam(), BG_EY_FlagPoints[m_TeamPointsCount[team_id] - 1]);
|
||||
AddPoints(player->GetTeam(), BG_EY_FlagPoints[m_TeamPointsCount[team_id] - 1]);
|
||||
|
||||
UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1);
|
||||
UpdatePlayerScore(player, SCORE_FLAG_CAPTURES, 1);
|
||||
}
|
||||
|
||||
void BattlegroundEY::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor)
|
||||
void BattlegroundEY::UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor)
|
||||
{
|
||||
BattlegroundScoreMap::iterator itr = PlayerScores.find(Source->GetGUID());
|
||||
BattlegroundScoreMap::iterator itr = PlayerScores.find(player->GetGUID());
|
||||
if (itr == PlayerScores.end()) // player not found
|
||||
return;
|
||||
|
||||
@@ -823,10 +823,10 @@ void BattlegroundEY::UpdatePlayerScore(Player* Source, uint32 type, uint32 value
|
||||
{
|
||||
case SCORE_FLAG_CAPTURES: // flags captured
|
||||
((BattlegroundEYScore*)itr->second)->FlagCaptures += value;
|
||||
Source->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, EY_OBJECTIVE_CAPTURE_FLAG);
|
||||
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, EY_OBJECTIVE_CAPTURE_FLAG);
|
||||
break;
|
||||
default:
|
||||
Battleground::UpdatePlayerScore(Source, type, value, doAddHonor);
|
||||
Battleground::UpdatePlayerScore(player, type, value, doAddHonor);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -934,7 +934,7 @@ WorldSafeLocsEntry const* BattlegroundEY::GetClosestGraveYard(Player* player)
|
||||
return nearestEntry;
|
||||
}
|
||||
|
||||
bool BattlegroundEY::IsAllNodesConrolledByTeam(uint32 team) const
|
||||
bool BattlegroundEY::IsAllNodesControlledByTeam(uint32 team) const
|
||||
{
|
||||
uint32 count = 0;
|
||||
for (int i = 0; i < EY_POINTS_MAX; ++i)
|
||||
@@ -952,4 +952,4 @@ uint32 BattlegroundEY::GetPrematureWinner()
|
||||
return HORDE;
|
||||
|
||||
return Battleground::GetPrematureWinner();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
enum BG_EY_Misc
|
||||
{
|
||||
BG_EY_EVENT_START_BATTLE = 13180, // Achievement: Flurry
|
||||
BG_EY_FLAG_RESPAWN_TIME = (8*IN_MILLISECONDS),
|
||||
BG_EY_FPOINTS_TICK_TIME = (2*IN_MILLISECONDS)
|
||||
};
|
||||
@@ -219,8 +220,6 @@ enum EYBattlegroundObjectTypes
|
||||
#define BG_EY_NotEYWeekendHonorTicks 260
|
||||
#define BG_EY_EYWeekendHonorTicks 160
|
||||
|
||||
#define EY_EVENT_START_BATTLE 13180 // Achievement: Flurry
|
||||
|
||||
enum BG_EY_Score
|
||||
{
|
||||
BG_EY_WARNING_NEAR_VICTORY_SCORE = 1400,
|
||||
@@ -368,7 +367,7 @@ class BattlegroundEY : public Battleground
|
||||
void EventPlayerDroppedFlag(Player* Source);
|
||||
|
||||
/* achievement req. */
|
||||
bool IsAllNodesConrolledByTeam(uint32 team) const;
|
||||
bool IsAllNodesControlledByTeam(uint32 team) const;
|
||||
|
||||
uint32 GetPrematureWinner();
|
||||
private:
|
||||
|
||||
@@ -84,7 +84,7 @@ void BattlegroundIC::SendTransportInit(Player* player)
|
||||
WorldPacket packet;
|
||||
|
||||
transData.BuildPacket(&packet);
|
||||
player->GetSession()->SendPacket(&packet);
|
||||
player->SendDirectMessage(&packet);
|
||||
}
|
||||
|
||||
void BattlegroundIC::DoAction(uint32 action, uint64 var)
|
||||
@@ -290,19 +290,6 @@ void BattlegroundIC::StartingEventOpenDoors()
|
||||
}
|
||||
}
|
||||
|
||||
bool BattlegroundIC::IsAllNodesConrolledByTeam(uint32 team) const
|
||||
{
|
||||
uint32 count = 0;
|
||||
ICNodeState controlledState = team == ALLIANCE ? NODE_STATE_CONTROLLED_A : NODE_STATE_CONTROLLED_H;
|
||||
for (int i = 0; i < NODE_TYPE_WORKSHOP; ++i)
|
||||
{
|
||||
if (nodePoint[i].nodeState == controlledState)
|
||||
++count;
|
||||
}
|
||||
|
||||
return count == NODE_TYPE_WORKSHOP;
|
||||
}
|
||||
|
||||
void BattlegroundIC::AddPlayer(Player* player)
|
||||
{
|
||||
Battleground::AddPlayer(player);
|
||||
@@ -349,9 +336,9 @@ void BattlegroundIC::HandleAreaTrigger(Player* player, uint32 trigger)
|
||||
}
|
||||
}
|
||||
|
||||
void BattlegroundIC::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor)
|
||||
void BattlegroundIC::UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor)
|
||||
{
|
||||
std::map<uint64, BattlegroundScore*>::iterator itr = PlayerScores.find(Source->GetGUID());
|
||||
std::map<uint64, BattlegroundScore*>::iterator itr = PlayerScores.find(player->GetGUID());
|
||||
|
||||
if (itr == PlayerScores.end()) // player not found...
|
||||
return;
|
||||
@@ -365,7 +352,7 @@ void BattlegroundIC::UpdatePlayerScore(Player* Source, uint32 type, uint32 value
|
||||
((BattlegroundICScore*)itr->second)->BasesDefended += value;
|
||||
break;
|
||||
default:
|
||||
Battleground::UpdatePlayerScore(Source, type, value, doAddHonor);
|
||||
Battleground::UpdatePlayerScore(player, type, value, doAddHonor);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -888,8 +875,8 @@ WorldSafeLocsEntry const* BattlegroundIC::GetClosestGraveYard(Player* player)
|
||||
// If so, select the closest node to place ghost on
|
||||
if (!nodes.empty())
|
||||
{
|
||||
float plr_x = player->GetPositionX();
|
||||
float plr_y = player->GetPositionY();
|
||||
float player_x = player->GetPositionX();
|
||||
float player_y = player->GetPositionY();
|
||||
|
||||
float mindist = 999999.0f;
|
||||
for (uint8 i = 0; i < nodes.size(); ++i)
|
||||
@@ -897,7 +884,7 @@ WorldSafeLocsEntry const* BattlegroundIC::GetClosestGraveYard(Player* player)
|
||||
WorldSafeLocsEntry const*entry = sWorldSafeLocsStore.LookupEntry(BG_IC_GraveyardIds[nodes[i]]);
|
||||
if (!entry)
|
||||
continue;
|
||||
float dist = (entry->x - plr_x)*(entry->x - plr_x)+(entry->y - plr_y)*(entry->y - plr_y);
|
||||
float dist = (entry->x - player_x)*(entry->x - player_x)+(entry->y - player_y)*(entry->y - player_y);
|
||||
if (mindist > dist)
|
||||
{
|
||||
mindist = dist;
|
||||
@@ -958,3 +945,35 @@ Transport* BattlegroundIC::CreateTransport(uint32 goEntry, uint32 period)
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
bool BattlegroundIC::IsAllNodesControlledByTeam(uint32 team) const
|
||||
{
|
||||
uint32 count = 0;
|
||||
ICNodeState controlledState = team == ALLIANCE ? NODE_STATE_CONTROLLED_A : NODE_STATE_CONTROLLED_H;
|
||||
for (int i = 0; i < NODE_TYPE_WORKSHOP; ++i)
|
||||
{
|
||||
if (nodePoint[i].nodeState == controlledState)
|
||||
++count;
|
||||
}
|
||||
|
||||
return count == NODE_TYPE_WORKSHOP;
|
||||
}
|
||||
|
||||
bool BattlegroundIC::IsSpellAllowed(uint32 spellId, Player const* player) const
|
||||
{
|
||||
switch (spellId)
|
||||
{
|
||||
case SPELL_OIL_REFINERY:
|
||||
case SPELL_QUARRY:
|
||||
{
|
||||
uint32 team = player->GetTeamId();
|
||||
uint8 nodeType = spellId = SPELL_OIL_REFINERY ? NODE_TYPE_REFINERY : NODE_TYPE_QUARRY;
|
||||
uint8 nodeState = team == TEAM_ALLIANCE ? NODE_STATE_CONTROLLED_A : NODE_STATE_CONTROLLED_H;
|
||||
return GetNodeState(nodeType) == nodeState;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -868,7 +868,7 @@ class BattlegroundIC : public Battleground
|
||||
void PostUpdateImpl(uint32 diff);
|
||||
|
||||
void RemovePlayer(Player* player, uint64 guid, uint32 team);
|
||||
void HandleAreaTrigger(Player* Source, uint32 Trigger);
|
||||
void HandleAreaTrigger(Player* player, uint32 trigger);
|
||||
bool SetupBattleground();
|
||||
void SpawnLeader(uint32 teamid);
|
||||
void HandleKillUnit(Creature* unit, Player* killer);
|
||||
@@ -882,7 +882,7 @@ class BattlegroundIC : public Battleground
|
||||
WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
|
||||
|
||||
/* Scorekeeping */
|
||||
void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true);
|
||||
void UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true);
|
||||
|
||||
void FillInitialWorldStates(WorldPacket& data);
|
||||
|
||||
@@ -892,7 +892,9 @@ class BattlegroundIC : public Battleground
|
||||
|
||||
uint32 GetNodeState(uint8 nodeType) const { return (uint8)nodePoint[nodeType].nodeState; }
|
||||
|
||||
bool IsAllNodesConrolledByTeam(uint32 team) const; // overwrited
|
||||
bool IsAllNodesControlledByTeam(uint32 team) const;
|
||||
|
||||
bool IsSpellAllowed(uint32 spellId, Player const* player) const;
|
||||
private:
|
||||
uint32 closeFortressDoorsTimer;
|
||||
bool doorsClosed;
|
||||
|
||||
@@ -274,7 +274,7 @@ void BattlegroundSA::StartShips()
|
||||
WorldPacket pkt;
|
||||
GetBGObject(i)->BuildValuesUpdateBlockForPlayer(&data, p);
|
||||
data.BuildPacket(&pkt);
|
||||
p->GetSession()->SendPacket(&pkt);
|
||||
p->SendDirectMessage(&pkt);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -947,7 +947,7 @@ void BattlegroundSA::SendTransportInit(Player* player)
|
||||
GetBGObject(BG_SA_BOAT_TWO)->BuildCreateUpdateBlockForPlayer(&transData, player);
|
||||
WorldPacket packet;
|
||||
transData.BuildPacket(&packet);
|
||||
player->GetSession()->SendPacket(&packet);
|
||||
player->SendDirectMessage(&packet);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -962,6 +962,6 @@ void BattlegroundSA::SendTransportsRemove(Player* player)
|
||||
GetBGObject(BG_SA_BOAT_TWO)->BuildOutOfRangeUpdateBlock(&transData);
|
||||
WorldPacket packet;
|
||||
transData.BuildPacket(&packet);
|
||||
player->GetSession()->SendPacket(&packet);
|
||||
player->SendDirectMessage(&packet);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,15 +274,15 @@ void BattlegroundWS::RespawnFlagAfterDrop(uint32 team)
|
||||
_bothFlagsKept = false;
|
||||
}
|
||||
|
||||
void BattlegroundWS::EventPlayerCapturedFlag(Player* Source)
|
||||
void BattlegroundWS::EventPlayerCapturedFlag(Player* player)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
uint32 winner = 0;
|
||||
|
||||
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
player->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
||||
if (player->GetTeam() == ALLIANCE)
|
||||
{
|
||||
if (!IsHordeFlagPickedup())
|
||||
return;
|
||||
@@ -290,11 +290,12 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player* Source)
|
||||
// horde flag in base (but not respawned yet)
|
||||
_flagState[TEAM_HORDE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
|
||||
// Drop Horde Flag from Player
|
||||
Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
|
||||
player->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
|
||||
if (_flagDebuffState == 1)
|
||||
Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
|
||||
if (_flagDebuffState == 2)
|
||||
Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT);
|
||||
player->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
|
||||
else if (_flagDebuffState == 2)
|
||||
player->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT);
|
||||
|
||||
if (GetTeamScore(TEAM_ALLIANCE) < BG_WS_MAX_TEAM_SCORE)
|
||||
AddPoint(ALLIANCE, 1);
|
||||
PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_ALLIANCE);
|
||||
@@ -308,34 +309,35 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player* Source)
|
||||
// alliance flag in base (but not respawned yet)
|
||||
_flagState[TEAM_ALLIANCE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
|
||||
// Drop Alliance Flag from Player
|
||||
Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
|
||||
player->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
|
||||
if (_flagDebuffState == 1)
|
||||
Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
|
||||
if (_flagDebuffState == 2)
|
||||
Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT);
|
||||
player->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
|
||||
else if (_flagDebuffState == 2)
|
||||
player->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT);
|
||||
|
||||
if (GetTeamScore(TEAM_HORDE) < BG_WS_MAX_TEAM_SCORE)
|
||||
AddPoint(HORDE, 1);
|
||||
PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_HORDE);
|
||||
RewardReputationToTeam(889, m_ReputationCapture, HORDE);
|
||||
}
|
||||
//for flag capture is reward 2 honorable kills
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(2), Source->GetTeam());
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(2), player->GetTeam());
|
||||
|
||||
SpawnBGObject(BG_WS_OBJECT_H_FLAG, BG_WS_FLAG_RESPAWN_TIME);
|
||||
SpawnBGObject(BG_WS_OBJECT_A_FLAG, BG_WS_FLAG_RESPAWN_TIME);
|
||||
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
SendMessageToAll(LANG_BG_WS_CAPTURED_HF, CHAT_MSG_BG_SYSTEM_ALLIANCE, Source);
|
||||
if (player->GetTeam() == ALLIANCE)
|
||||
SendMessageToAll(LANG_BG_WS_CAPTURED_HF, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
|
||||
else
|
||||
SendMessageToAll(LANG_BG_WS_CAPTURED_AF, CHAT_MSG_BG_SYSTEM_HORDE, Source);
|
||||
SendMessageToAll(LANG_BG_WS_CAPTURED_AF, CHAT_MSG_BG_SYSTEM_HORDE, player);
|
||||
|
||||
UpdateFlagState(Source->GetTeam(), 1); // flag state none
|
||||
UpdateTeamScore(Source->GetTeamId());
|
||||
UpdateFlagState(player->GetTeam(), 1); // flag state none
|
||||
UpdateTeamScore(player->GetTeamId());
|
||||
// only flag capture should be updated
|
||||
UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1); // +1 flag captures
|
||||
UpdatePlayerScore(player, SCORE_FLAG_CAPTURES, 1); // +1 flag captures
|
||||
|
||||
// update last flag capture to be used if teamscore is equal
|
||||
SetLastFlagCapture(Source->GetTeam());
|
||||
SetLastFlagCapture(player->GetTeam());
|
||||
|
||||
if (GetTeamScore(TEAM_ALLIANCE) == BG_WS_MAX_TEAM_SCORE)
|
||||
winner = ALLIANCE;
|
||||
@@ -356,34 +358,36 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player* Source)
|
||||
}
|
||||
else
|
||||
{
|
||||
_flagsTimer[GetTeamIndexByTeamId(Source->GetTeam()) ? 0 : 1] = BG_WS_FLAG_RESPAWN_TIME;
|
||||
_flagsTimer[GetTeamIndexByTeamId(player->GetTeam()) ? 0 : 1] = BG_WS_FLAG_RESPAWN_TIME;
|
||||
}
|
||||
}
|
||||
|
||||
void BattlegroundWS::EventPlayerDroppedFlag(Player* Source)
|
||||
void BattlegroundWS::EventPlayerDroppedFlag(Player* player)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
{
|
||||
// if not running, do not cast things at the dropper player (prevent spawning the "dropped" flag), neither send unnecessary messages
|
||||
// just take off the aura
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
if (player->GetTeam() == ALLIANCE)
|
||||
{
|
||||
if (!IsHordeFlagPickedup())
|
||||
return;
|
||||
if (GetFlagPickerGUID(TEAM_HORDE) == Source->GetGUID())
|
||||
|
||||
if (GetFlagPickerGUID(TEAM_HORDE) == player->GetGUID())
|
||||
{
|
||||
SetHordeFlagPicker(0);
|
||||
Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
|
||||
player->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!IsAllianceFlagPickedup())
|
||||
return;
|
||||
if (GetFlagPickerGUID(TEAM_ALLIANCE) == Source->GetGUID())
|
||||
|
||||
if (GetFlagPickerGUID(TEAM_ALLIANCE) == player->GetGUID())
|
||||
{
|
||||
SetAllianceFlagPicker(0);
|
||||
Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
|
||||
player->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -391,20 +395,20 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* Source)
|
||||
|
||||
bool set = false;
|
||||
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
if (player->GetTeam() == ALLIANCE)
|
||||
{
|
||||
if (!IsHordeFlagPickedup())
|
||||
return;
|
||||
if (GetFlagPickerGUID(TEAM_HORDE) == Source->GetGUID())
|
||||
if (GetFlagPickerGUID(TEAM_HORDE) == player->GetGUID())
|
||||
{
|
||||
SetHordeFlagPicker(0);
|
||||
Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
|
||||
player->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
|
||||
if (_flagDebuffState == 1)
|
||||
Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
|
||||
if (_flagDebuffState == 2)
|
||||
Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT);
|
||||
player->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
|
||||
else if (_flagDebuffState == 2)
|
||||
player->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT);
|
||||
_flagState[TEAM_HORDE] = BG_WS_FLAG_STATE_ON_GROUND;
|
||||
Source->CastSpell(Source, BG_WS_SPELL_WARSONG_FLAG_DROPPED, true);
|
||||
player->CastSpell(player, BG_WS_SPELL_WARSONG_FLAG_DROPPED, true);
|
||||
set = true;
|
||||
}
|
||||
}
|
||||
@@ -412,41 +416,41 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* Source)
|
||||
{
|
||||
if (!IsAllianceFlagPickedup())
|
||||
return;
|
||||
if (GetFlagPickerGUID(TEAM_ALLIANCE) == Source->GetGUID())
|
||||
if (GetFlagPickerGUID(TEAM_ALLIANCE) == player->GetGUID())
|
||||
{
|
||||
SetAllianceFlagPicker(0);
|
||||
Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
|
||||
player->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
|
||||
if (_flagDebuffState == 1)
|
||||
Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
|
||||
if (_flagDebuffState == 2)
|
||||
Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT);
|
||||
player->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
|
||||
else if (_flagDebuffState == 2)
|
||||
player->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT);
|
||||
_flagState[TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_GROUND;
|
||||
Source->CastSpell(Source, BG_WS_SPELL_SILVERWING_FLAG_DROPPED, true);
|
||||
player->CastSpell(player, BG_WS_SPELL_SILVERWING_FLAG_DROPPED, true);
|
||||
set = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (set)
|
||||
{
|
||||
Source->CastSpell(Source, SPELL_RECENTLY_DROPPED_FLAG, true);
|
||||
UpdateFlagState(Source->GetTeam(), 1);
|
||||
player->CastSpell(player, SPELL_RECENTLY_DROPPED_FLAG, true);
|
||||
UpdateFlagState(player->GetTeam(), 1);
|
||||
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
if (player->GetTeam() == ALLIANCE)
|
||||
{
|
||||
SendMessageToAll(LANG_BG_WS_DROPPED_HF, CHAT_MSG_BG_SYSTEM_HORDE, Source);
|
||||
SendMessageToAll(LANG_BG_WS_DROPPED_HF, CHAT_MSG_BG_SYSTEM_HORDE, player);
|
||||
UpdateWorldState(BG_WS_FLAG_UNK_HORDE, uint32(-1));
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageToAll(LANG_BG_WS_DROPPED_AF, CHAT_MSG_BG_SYSTEM_ALLIANCE, Source);
|
||||
SendMessageToAll(LANG_BG_WS_DROPPED_AF, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
|
||||
UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, uint32(-1));
|
||||
}
|
||||
|
||||
_flagsDropTimer[GetTeamIndexByTeamId(Source->GetTeam()) ? 0 : 1] = BG_WS_FLAG_DROP_TIME;
|
||||
_flagsDropTimer[GetTeamIndexByTeamId(player->GetTeam()) ? 0 : 1] = BG_WS_FLAG_DROP_TIME;
|
||||
}
|
||||
}
|
||||
|
||||
void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj)
|
||||
void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* target_obj)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
@@ -455,48 +459,48 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
|
||||
ChatMsg type = CHAT_MSG_BG_SYSTEM_NEUTRAL;
|
||||
|
||||
//alliance flag picked up from base
|
||||
if (Source->GetTeam() == HORDE && GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_BASE
|
||||
if (player->GetTeam() == HORDE && GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_BASE
|
||||
&& BgObjects[BG_WS_OBJECT_A_FLAG] == target_obj->GetGUID())
|
||||
{
|
||||
message_id = LANG_BG_WS_PICKEDUP_AF;
|
||||
type = CHAT_MSG_BG_SYSTEM_HORDE;
|
||||
PlaySoundToAll(BG_WS_SOUND_ALLIANCE_FLAG_PICKED_UP);
|
||||
SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_ONE_DAY);
|
||||
SetAllianceFlagPicker(Source->GetGUID());
|
||||
SetAllianceFlagPicker(player->GetGUID());
|
||||
_flagState[TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_PLAYER;
|
||||
//update world state to show correct flag carrier
|
||||
UpdateFlagState(HORDE, BG_WS_FLAG_STATE_ON_PLAYER);
|
||||
UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 1);
|
||||
Source->CastSpell(Source, BG_WS_SPELL_SILVERWING_FLAG, true);
|
||||
Source->StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, BG_WS_SPELL_SILVERWING_FLAG_PICKED);
|
||||
player->CastSpell(player, BG_WS_SPELL_SILVERWING_FLAG, true);
|
||||
player->StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, BG_WS_SPELL_SILVERWING_FLAG_PICKED);
|
||||
if (_flagState[1] == BG_WS_FLAG_STATE_ON_PLAYER)
|
||||
_bothFlagsKept = true;
|
||||
}
|
||||
|
||||
//horde flag picked up from base
|
||||
if (Source->GetTeam() == ALLIANCE && GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_BASE
|
||||
if (player->GetTeam() == ALLIANCE && GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_BASE
|
||||
&& BgObjects[BG_WS_OBJECT_H_FLAG] == target_obj->GetGUID())
|
||||
{
|
||||
message_id = LANG_BG_WS_PICKEDUP_HF;
|
||||
type = CHAT_MSG_BG_SYSTEM_ALLIANCE;
|
||||
PlaySoundToAll(BG_WS_SOUND_HORDE_FLAG_PICKED_UP);
|
||||
SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_ONE_DAY);
|
||||
SetHordeFlagPicker(Source->GetGUID());
|
||||
SetHordeFlagPicker(player->GetGUID());
|
||||
_flagState[TEAM_HORDE] = BG_WS_FLAG_STATE_ON_PLAYER;
|
||||
//update world state to show correct flag carrier
|
||||
UpdateFlagState(ALLIANCE, BG_WS_FLAG_STATE_ON_PLAYER);
|
||||
UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 1);
|
||||
Source->CastSpell(Source, BG_WS_SPELL_WARSONG_FLAG, true);
|
||||
Source->StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, BG_WS_SPELL_WARSONG_FLAG_PICKED);
|
||||
player->CastSpell(player, BG_WS_SPELL_WARSONG_FLAG, true);
|
||||
player->StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, BG_WS_SPELL_WARSONG_FLAG_PICKED);
|
||||
if (_flagState[0] == BG_WS_FLAG_STATE_ON_PLAYER)
|
||||
_bothFlagsKept = true;
|
||||
}
|
||||
|
||||
//Alliance flag on ground(not in base) (returned or picked up again from ground!)
|
||||
if (GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10)
|
||||
if (GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_GROUND && player->IsWithinDistInMap(target_obj, 10)
|
||||
&& target_obj->GetGOInfo()->entry == BG_OBJECT_A_FLAG_GROUND_WS_ENTRY)
|
||||
{
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
if (player->GetTeam() == ALLIANCE)
|
||||
{
|
||||
message_id = LANG_BG_WS_RETURNED_AF;
|
||||
type = CHAT_MSG_BG_SYSTEM_ALLIANCE;
|
||||
@@ -504,7 +508,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
|
||||
RespawnFlag(ALLIANCE, false);
|
||||
SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_IMMEDIATELY);
|
||||
PlaySoundToAll(BG_WS_SOUND_FLAG_RETURNED);
|
||||
UpdatePlayerScore(Source, SCORE_FLAG_RETURNS, 1);
|
||||
UpdatePlayerScore(player, SCORE_FLAG_RETURNS, 1);
|
||||
_bothFlagsKept = false;
|
||||
}
|
||||
else
|
||||
@@ -513,14 +517,14 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
|
||||
type = CHAT_MSG_BG_SYSTEM_HORDE;
|
||||
PlaySoundToAll(BG_WS_SOUND_ALLIANCE_FLAG_PICKED_UP);
|
||||
SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_ONE_DAY);
|
||||
SetAllianceFlagPicker(Source->GetGUID());
|
||||
Source->CastSpell(Source, BG_WS_SPELL_SILVERWING_FLAG, true);
|
||||
SetAllianceFlagPicker(player->GetGUID());
|
||||
player->CastSpell(player, BG_WS_SPELL_SILVERWING_FLAG, true);
|
||||
_flagState[TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_PLAYER;
|
||||
UpdateFlagState(HORDE, BG_WS_FLAG_STATE_ON_PLAYER);
|
||||
if (_flagDebuffState == 1)
|
||||
Source->CastSpell(Source, WS_SPELL_FOCUSED_ASSAULT, true);
|
||||
if (_flagDebuffState == 2)
|
||||
Source->CastSpell(Source, WS_SPELL_BRUTAL_ASSAULT, true);
|
||||
player->CastSpell(player, WS_SPELL_FOCUSED_ASSAULT, true);
|
||||
else if (_flagDebuffState == 2)
|
||||
player->CastSpell(player, WS_SPELL_BRUTAL_ASSAULT, true);
|
||||
UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 1);
|
||||
}
|
||||
//called in HandleGameObjectUseOpcode:
|
||||
@@ -528,10 +532,10 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
|
||||
}
|
||||
|
||||
//Horde flag on ground(not in base) (returned or picked up again)
|
||||
if (GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10)
|
||||
if (GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_GROUND && player->IsWithinDistInMap(target_obj, 10)
|
||||
&& target_obj->GetGOInfo()->entry == BG_OBJECT_H_FLAG_GROUND_WS_ENTRY)
|
||||
{
|
||||
if (Source->GetTeam() == HORDE)
|
||||
if (player->GetTeam() == HORDE)
|
||||
{
|
||||
message_id = LANG_BG_WS_RETURNED_HF;
|
||||
type = CHAT_MSG_BG_SYSTEM_HORDE;
|
||||
@@ -539,7 +543,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
|
||||
RespawnFlag(HORDE, false);
|
||||
SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_IMMEDIATELY);
|
||||
PlaySoundToAll(BG_WS_SOUND_FLAG_RETURNED);
|
||||
UpdatePlayerScore(Source, SCORE_FLAG_RETURNS, 1);
|
||||
UpdatePlayerScore(player, SCORE_FLAG_RETURNS, 1);
|
||||
_bothFlagsKept = false;
|
||||
}
|
||||
else
|
||||
@@ -548,14 +552,14 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
|
||||
type = CHAT_MSG_BG_SYSTEM_ALLIANCE;
|
||||
PlaySoundToAll(BG_WS_SOUND_HORDE_FLAG_PICKED_UP);
|
||||
SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_ONE_DAY);
|
||||
SetHordeFlagPicker(Source->GetGUID());
|
||||
Source->CastSpell(Source, BG_WS_SPELL_WARSONG_FLAG, true);
|
||||
SetHordeFlagPicker(player->GetGUID());
|
||||
player->CastSpell(player, BG_WS_SPELL_WARSONG_FLAG, true);
|
||||
_flagState[TEAM_HORDE] = BG_WS_FLAG_STATE_ON_PLAYER;
|
||||
UpdateFlagState(ALLIANCE, BG_WS_FLAG_STATE_ON_PLAYER);
|
||||
if (_flagDebuffState == 1)
|
||||
Source->CastSpell(Source, WS_SPELL_FOCUSED_ASSAULT, true);
|
||||
if (_flagDebuffState == 2)
|
||||
Source->CastSpell(Source, WS_SPELL_BRUTAL_ASSAULT, true);
|
||||
player->CastSpell(player, WS_SPELL_FOCUSED_ASSAULT, true);
|
||||
else if (_flagDebuffState == 2)
|
||||
player->CastSpell(player, WS_SPELL_BRUTAL_ASSAULT, true);
|
||||
UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 1);
|
||||
}
|
||||
//called in HandleGameObjectUseOpcode:
|
||||
@@ -565,8 +569,8 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
|
||||
if (!message_id)
|
||||
return;
|
||||
|
||||
SendMessageToAll(message_id, type, Source);
|
||||
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
||||
SendMessageToAll(message_id, type, player);
|
||||
player->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
||||
}
|
||||
|
||||
void BattlegroundWS::RemovePlayer(Player* player, uint64 guid, uint32 /*team*/)
|
||||
@@ -660,7 +664,7 @@ void BattlegroundWS::HandleAreaTrigger(Player* player, uint32 trigger)
|
||||
}
|
||||
|
||||
//if (buff_guid)
|
||||
// HandleTriggerBuff(buff_guid, Source);
|
||||
// HandleTriggerBuff(buff_guid, player);
|
||||
}
|
||||
|
||||
bool BattlegroundWS::SetupBattleground()
|
||||
@@ -773,9 +777,9 @@ void BattlegroundWS::HandleKillPlayer(Player* player, Player* killer)
|
||||
Battleground::HandleKillPlayer(player, killer);
|
||||
}
|
||||
|
||||
void BattlegroundWS::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor)
|
||||
void BattlegroundWS::UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor)
|
||||
{
|
||||
BattlegroundScoreMap::iterator itr = PlayerScores.find(Source->GetGUID());
|
||||
BattlegroundScoreMap::iterator itr = PlayerScores.find(player->GetGUID());
|
||||
if (itr == PlayerScores.end()) // player not found
|
||||
return;
|
||||
|
||||
@@ -783,14 +787,14 @@ void BattlegroundWS::UpdatePlayerScore(Player* Source, uint32 type, uint32 value
|
||||
{
|
||||
case SCORE_FLAG_CAPTURES: // flags captured
|
||||
((BattlegroundWGScore*)itr->second)->FlagCaptures += value;
|
||||
Source->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, WS_OBJECTIVE_CAPTURE_FLAG);
|
||||
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, WS_OBJECTIVE_CAPTURE_FLAG);
|
||||
break;
|
||||
case SCORE_FLAG_RETURNS: // flags returned
|
||||
((BattlegroundWGScore*)itr->second)->FlagReturns += value;
|
||||
Source->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, WS_OBJECTIVE_RETURN_FLAG);
|
||||
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, WS_OBJECTIVE_RETURN_FLAG);
|
||||
break;
|
||||
default:
|
||||
Battleground::UpdatePlayerScore(Source, type, value, doAddHonor);
|
||||
Battleground::UpdatePlayerScore(player, type, value, doAddHonor);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,12 +182,12 @@ class BattlegroundWS : public Battleground
|
||||
uint8 GetFlagState(uint32 team) { return _flagState[GetTeamIndexByTeamId(team)]; }
|
||||
|
||||
/* Battleground Events */
|
||||
void EventPlayerDroppedFlag(Player* Source);
|
||||
void EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj);
|
||||
void EventPlayerCapturedFlag(Player* Source);
|
||||
void EventPlayerDroppedFlag(Player* player);
|
||||
void EventPlayerClickedOnFlag(Player* player, GameObject* target_obj);
|
||||
void EventPlayerCapturedFlag(Player* player);
|
||||
|
||||
void RemovePlayer(Player* player, uint64 guid, uint32 team);
|
||||
void HandleAreaTrigger(Player* Source, uint32 Trigger);
|
||||
void HandleAreaTrigger(Player* player, uint32 trigger);
|
||||
void HandleKillPlayer(Player* player, Player* killer);
|
||||
bool SetupBattleground();
|
||||
void Reset();
|
||||
@@ -197,7 +197,7 @@ class BattlegroundWS : public Battleground
|
||||
void UpdateFlagState(uint32 team, uint32 value);
|
||||
void SetLastFlagCapture(uint32 team) { _lastFlagCaptureTeam = team; }
|
||||
void UpdateTeamScore(uint32 team);
|
||||
void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true);
|
||||
void UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true);
|
||||
void SetDroppedFlagGUID(uint64 guid, int32 team = -1)
|
||||
{
|
||||
if (team == TEAM_ALLIANCE || team == TEAM_HORDE)
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "GameObjectAI.h"
|
||||
#include "BattlegroundAV.h"
|
||||
#include "Battleground.h"
|
||||
#include "CellImpl.h"
|
||||
#include "CreatureAISelector.h"
|
||||
#include "DynamicTree.h"
|
||||
@@ -324,7 +324,7 @@ void GameObject::Update(uint32 diff)
|
||||
WorldPacket packet;
|
||||
BuildValuesUpdateBlockForPlayer(&udata, caster->ToPlayer());
|
||||
udata.BuildPacket(&packet);
|
||||
caster->ToPlayer()->GetSession()->SendPacket(&packet);
|
||||
caster->ToPlayer()->SendDirectMessage(&packet);
|
||||
|
||||
SendCustomAnim(GetGoAnimProgress());
|
||||
}
|
||||
@@ -373,7 +373,7 @@ void GameObject::Update(uint32 diff)
|
||||
caster->ToPlayer()->RemoveGameObject(this, false);
|
||||
|
||||
WorldPacket data(SMSG_FISH_ESCAPED, 0);
|
||||
caster->ToPlayer()->GetSession()->SendPacket(&data);
|
||||
caster->ToPlayer()->SendDirectMessage(&data);
|
||||
}
|
||||
// can be delete
|
||||
m_lootState = GO_JUST_DEACTIVATED;
|
||||
@@ -872,7 +872,9 @@ bool GameObject::IsDynTransport() const
|
||||
bool GameObject::IsDestructibleBuilding() const
|
||||
{
|
||||
GameObjectTemplate const* gInfo = GetGOInfo();
|
||||
if (!gInfo) return false;
|
||||
if (!gInfo)
|
||||
return false;
|
||||
|
||||
return gInfo->type == GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING;
|
||||
}
|
||||
|
||||
@@ -948,12 +950,8 @@ bool GameObject::ActivateToQuest(Player* target) const
|
||||
{
|
||||
if (LootTemplates_Gameobject.HaveQuestLootForPlayer(GetGOInfo()->GetLootId(), target))
|
||||
{
|
||||
/// @todo fix this hack
|
||||
//look for battlegroundAV for some objects which are only activated after mine gots captured by own team
|
||||
if (GetEntry() == BG_AV_OBJECTID_MINE_N || GetEntry() == BG_AV_OBJECTID_MINE_S)
|
||||
if (Battleground* bg = target->GetBattleground())
|
||||
if (bg->GetTypeID(true) == BATTLEGROUND_AV && !bg->ToBattlegroundAV()->PlayerCanDoMineQuest(GetEntry(), target->GetTeam()))
|
||||
return false;
|
||||
if (Battleground const* bg = target->GetBattleground())
|
||||
return bg->CanActivateGO(GetEntry(), target->GetTeam());
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
@@ -1242,7 +1240,7 @@ void GameObject::Use(Unit* user)
|
||||
{
|
||||
WorldPacket data(SMSG_GAMEOBJECT_PAGETEXT, 8);
|
||||
data << GetGUID();
|
||||
player->GetSession()->SendPacket(&data);
|
||||
player->SendDirectMessage(&data);
|
||||
}
|
||||
else if (info->goober.gossipID)
|
||||
{
|
||||
@@ -1384,7 +1382,7 @@ void GameObject::Use(Unit* user)
|
||||
SetLootState(GO_JUST_DEACTIVATED);
|
||||
|
||||
WorldPacket data(SMSG_FISH_NOT_HOOKED, 0);
|
||||
player->GetSession()->SendPacket(&data);
|
||||
player->SendDirectMessage(&data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1647,7 +1645,7 @@ void GameObject::Use(Unit* user)
|
||||
player->TeleportTo(GetMapId(), GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation(), TELE_TO_NOT_LEAVE_TRANSPORT | TELE_TO_NOT_LEAVE_COMBAT | TELE_TO_NOT_UNSUMMON_PET);
|
||||
|
||||
WorldPacket data(SMSG_ENABLE_BARBER_SHOP, 0);
|
||||
player->GetSession()->SendPacket(&data);
|
||||
player->SendDirectMessage(&data);
|
||||
|
||||
player->SetStandState(UNIT_STAND_STATE_SIT_LOW_CHAIR+info->barberChair.chairheight);
|
||||
return;
|
||||
@@ -1843,7 +1841,7 @@ void GameObject::ModifyHealth(int32 change, Unit* attackerOrHealer /*= NULL*/, u
|
||||
data << uint32(-change); // change < 0 triggers SPELL_BUILDING_HEAL combat log event
|
||||
// change >= 0 triggers SPELL_BUILDING_DAMAGE event
|
||||
data << uint32(spellId);
|
||||
player->GetSession()->SendPacket(&data);
|
||||
player->SendDirectMessage(&data);
|
||||
}
|
||||
|
||||
GameObjectDestructibleState newState = GetDestructibleState();
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include "BattlefieldMgr.h"
|
||||
#include "BattlefieldWG.h"
|
||||
#include "Battleground.h"
|
||||
#include "BattlegroundAV.h"
|
||||
#include "BattlegroundMgr.h"
|
||||
#include "CellImpl.h"
|
||||
#include "Channel.h"
|
||||
@@ -8770,22 +8769,12 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
|
||||
if (go->getLootState() == GO_READY)
|
||||
{
|
||||
uint32 lootid = go->GetGOInfo()->GetLootId();
|
||||
|
||||
/// @todo fix this big hack
|
||||
if ((go->GetEntry() == BG_AV_OBJECTID_MINE_N || go->GetEntry() == BG_AV_OBJECTID_MINE_S))
|
||||
{
|
||||
if (Battleground* bg = GetBattleground())
|
||||
if (Battleground* bg = GetBattleground())
|
||||
if (!bg->CanActivateGO(go->GetEntry(), GetTeam()))
|
||||
{
|
||||
if (bg->GetTypeID(true) == BATTLEGROUND_AV)
|
||||
{
|
||||
if (!bg->ToBattlegroundAV()->PlayerCanDoMineQuest(go->GetEntry(), GetTeam()))
|
||||
{
|
||||
SendLootRelease(guid);
|
||||
return;
|
||||
}
|
||||
}
|
||||
SendLootRelease(guid);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (lootid)
|
||||
{
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include "ObjectAccessor.h"
|
||||
#include "Group.h"
|
||||
#include "Battleground.h"
|
||||
#include "BattlegroundAV.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "GameObjectAI.h"
|
||||
|
||||
@@ -510,6 +509,10 @@ void WorldSession::HandleQuestgiverCompleteQuest(WorldPacket& recvData)
|
||||
|
||||
TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_COMPLETE_QUEST npc = %u, quest = %u", uint32(GUID_LOPART(guid)), questId);
|
||||
|
||||
Quest const* quest = sObjectMgr->GetQuestTemplate(questId);
|
||||
if (!quest)
|
||||
return;
|
||||
|
||||
Object* object = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT);
|
||||
if (!object || !object->hasInvolvedQuest(questId))
|
||||
return;
|
||||
@@ -518,38 +521,33 @@ void WorldSession::HandleQuestgiverCompleteQuest(WorldPacket& recvData)
|
||||
if (!_player->CanInteractWithQuestGiver(object))
|
||||
return;
|
||||
|
||||
if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId))
|
||||
if (!_player->CanSeeStartQuest(quest) && _player->GetQuestStatus(questId) == QUEST_STATUS_NONE)
|
||||
{
|
||||
if (!_player->CanSeeStartQuest(quest) && _player->GetQuestStatus(questId) == QUEST_STATUS_NONE)
|
||||
{
|
||||
TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Possible hacking attempt: Player %s [guid: %u] tried to complete quest [entry: %u] without being in possession of the quest!",
|
||||
_player->GetName().c_str(), _player->GetGUIDLow(), questId);
|
||||
return;
|
||||
}
|
||||
/// @todo need a virtual function
|
||||
if (_player->InBattleground())
|
||||
if (Battleground* bg = _player->GetBattleground())
|
||||
if (bg->GetTypeID() == BATTLEGROUND_AV)
|
||||
bg->ToBattlegroundAV()->HandleQuestComplete(questId, _player);
|
||||
|
||||
if (_player->GetQuestStatus(questId) != QUEST_STATUS_COMPLETE)
|
||||
{
|
||||
if (quest->IsRepeatable())
|
||||
_player->PlayerTalkClass->SendQuestGiverRequestItems(quest, guid, _player->CanCompleteRepeatableQuest(quest), false);
|
||||
else
|
||||
_player->PlayerTalkClass->SendQuestGiverRequestItems(quest, guid, _player->CanRewardQuest(quest, false), false);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (quest->GetReqItemsCount()) // some items required
|
||||
_player->PlayerTalkClass->SendQuestGiverRequestItems(quest, guid, _player->CanRewardQuest(quest, false), false);
|
||||
else // no items required
|
||||
_player->PlayerTalkClass->SendQuestGiverOfferReward(quest, guid, true);
|
||||
}
|
||||
|
||||
if (Creature* creature = object->ToCreature())
|
||||
sScriptMgr->OnQuestComplete(_player, creature, quest);
|
||||
TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Possible hacking attempt: Player %s [guid: %u] tried to complete quest [entry: %u] without being in possession of the quest!",
|
||||
_player->GetName().c_str(), _player->GetGUIDLow(), questId);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Battleground* bg = _player->GetBattleground())
|
||||
bg->HandleQuestComplete(questId, _player);
|
||||
|
||||
if (_player->GetQuestStatus(questId) != QUEST_STATUS_COMPLETE)
|
||||
{
|
||||
if (quest->IsRepeatable())
|
||||
_player->PlayerTalkClass->SendQuestGiverRequestItems(quest, guid, _player->CanCompleteRepeatableQuest(quest), false);
|
||||
else
|
||||
_player->PlayerTalkClass->SendQuestGiverRequestItems(quest, guid, _player->CanRewardQuest(quest, false), false);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (quest->GetReqItemsCount()) // some items required
|
||||
_player->PlayerTalkClass->SendQuestGiverRequestItems(quest, guid, _player->CanRewardQuest(quest, false), false);
|
||||
else // no items required
|
||||
_player->PlayerTalkClass->SendQuestGiverOfferReward(quest, guid, true);
|
||||
}
|
||||
|
||||
if (Creature* creature = object->ToCreature())
|
||||
sScriptMgr->OnQuestComplete(_player, creature, quest);
|
||||
}
|
||||
|
||||
void WorldSession::HandleQuestgiverQuestAutoLaunch(WorldPacket& /*recvPacket*/)
|
||||
@@ -565,66 +563,70 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket)
|
||||
if (!_player->CanShareQuest(questId))
|
||||
return;
|
||||
|
||||
TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_PUSHQUESTTOPARTY quest = %u", questId);
|
||||
TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_PUSHQUESTTOPARTY questId = %u", questId);
|
||||
|
||||
if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId))
|
||||
Quest const* quest = sObjectMgr->GetQuestTemplate(questId);
|
||||
if (!quest)
|
||||
return;
|
||||
|
||||
Player * const sender = GetPlayer();
|
||||
|
||||
Group* group = sender->GetGroup();
|
||||
if (!group)
|
||||
return;
|
||||
|
||||
for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
{
|
||||
if (Group* group = _player->GetGroup())
|
||||
Player* receiver = itr->GetSource();
|
||||
|
||||
if (!receiver || receiver == sender)
|
||||
continue;
|
||||
|
||||
if (!receiver->SatisfyQuestStatus(quest, false))
|
||||
{
|
||||
for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
{
|
||||
Player* player = itr->GetSource();
|
||||
sender->SendPushToPartyResponse(receiver, QUEST_PARTY_MSG_HAVE_QUEST);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!player || player == _player) // skip self
|
||||
continue;
|
||||
if (receiver->GetQuestStatus(questId) == QUEST_STATUS_COMPLETE)
|
||||
{
|
||||
sender->SendPushToPartyResponse(receiver, QUEST_PARTY_MSG_FINISH_QUEST);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!player->SatisfyQuestStatus(quest, false))
|
||||
{
|
||||
_player->SendPushToPartyResponse(player, QUEST_PARTY_MSG_HAVE_QUEST);
|
||||
continue;
|
||||
}
|
||||
if (!receiver->CanTakeQuest(quest, false))
|
||||
{
|
||||
sender->SendPushToPartyResponse(receiver, QUEST_PARTY_MSG_CANT_TAKE_QUEST);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (player->GetQuestStatus(questId) == QUEST_STATUS_COMPLETE)
|
||||
{
|
||||
_player->SendPushToPartyResponse(player, QUEST_PARTY_MSG_FINISH_QUEST);
|
||||
continue;
|
||||
}
|
||||
if (!receiver->SatisfyQuestLog(false))
|
||||
{
|
||||
sender->SendPushToPartyResponse(receiver, QUEST_PARTY_MSG_LOG_FULL);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!player->CanTakeQuest(quest, false))
|
||||
{
|
||||
_player->SendPushToPartyResponse(player, QUEST_PARTY_MSG_CANT_TAKE_QUEST);
|
||||
continue;
|
||||
}
|
||||
if (receiver->GetDivider() != 0)
|
||||
{
|
||||
sender->SendPushToPartyResponse(receiver, QUEST_PARTY_MSG_BUSY);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!player->SatisfyQuestLog(false))
|
||||
{
|
||||
_player->SendPushToPartyResponse(player, QUEST_PARTY_MSG_LOG_FULL);
|
||||
continue;
|
||||
}
|
||||
sender->SendPushToPartyResponse(receiver, QUEST_PARTY_MSG_SHARING_QUEST);
|
||||
|
||||
if (player->GetDivider() != 0)
|
||||
{
|
||||
_player->SendPushToPartyResponse(player, QUEST_PARTY_MSG_BUSY);
|
||||
continue;
|
||||
}
|
||||
if (quest->IsAutoAccept() && receiver->CanAddQuest(quest, true) && receiver->CanTakeQuest(quest, true))
|
||||
{
|
||||
receiver->AddQuest(quest, sender);
|
||||
if (receiver->CanCompleteQuest(questId))
|
||||
receiver->CompleteQuest(questId);
|
||||
}
|
||||
|
||||
_player->SendPushToPartyResponse(player, QUEST_PARTY_MSG_SHARING_QUEST);
|
||||
|
||||
if (quest->IsAutoAccept() && player->CanAddQuest(quest, true) && player->CanTakeQuest(quest, true))
|
||||
{
|
||||
player->AddQuest(quest, _player);
|
||||
if (player->CanCompleteQuest(questId))
|
||||
player->CompleteQuest(questId);
|
||||
}
|
||||
|
||||
if ((quest->IsAutoComplete() && quest->IsRepeatable() && !quest->IsDailyOrWeekly()) || quest->HasFlag(QUEST_FLAGS_AUTOCOMPLETE))
|
||||
player->PlayerTalkClass->SendQuestGiverRequestItems(quest, _player->GetGUID(), player->CanCompleteRepeatableQuest(quest), true);
|
||||
else
|
||||
{
|
||||
player->SetDivider(_player->GetGUID());
|
||||
player->PlayerTalkClass->SendQuestGiverQuestDetails(quest, _player->GetGUID(), true);
|
||||
}
|
||||
}
|
||||
if ((quest->IsAutoComplete() && quest->IsRepeatable() && !quest->IsDailyOrWeekly()) || quest->HasFlag(QUEST_FLAGS_AUTOCOMPLETE))
|
||||
receiver->PlayerTalkClass->SendQuestGiverRequestItems(quest, sender->GetGUID(), receiver->CanCompleteRepeatableQuest(quest), true);
|
||||
else
|
||||
{
|
||||
receiver->SetDivider(sender->GetGUID());
|
||||
receiver->PlayerTalkClass->SendQuestGiverQuestDetails(quest, sender->GetGUID(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -646,7 +648,7 @@ void WorldSession::HandleQuestPushResult(WorldPacket& recvPacket)
|
||||
WorldPacket data(MSG_QUEST_PUSH_RESULT, 8 + 4 + 1);
|
||||
data << uint64(_player->GetGUID());
|
||||
data << uint8(msg); // valid values: 0-8
|
||||
player->GetSession()->SendPacket(&data);
|
||||
player->SendDirectMessage(&data);
|
||||
_player->SetDivider(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,8 +45,6 @@
|
||||
#include "CreatureAI.h"
|
||||
#include "BattlegroundMgr.h"
|
||||
#include "Battleground.h"
|
||||
#include "BattlegroundEY.h"
|
||||
#include "BattlegroundWS.h"
|
||||
#include "OutdoorPvPMgr.h"
|
||||
#include "Language.h"
|
||||
#include "SocialMgr.h"
|
||||
@@ -1338,7 +1336,7 @@ void Spell::EffectPowerDrain(SpellEffIndex effIndex)
|
||||
|
||||
float gainMultiplier = 0.0f;
|
||||
|
||||
// Don`t restore from self drain
|
||||
// Don't restore from self drain
|
||||
if (m_caster != unitTarget)
|
||||
{
|
||||
gainMultiplier = m_spellInfo->Effects[effIndex].CalcValueMultiplier(m_originalCaster, this);
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include "BattlegroundMgr.h"
|
||||
#include "CreatureAI.h"
|
||||
#include "MapManager.h"
|
||||
#include "BattlegroundIC.h"
|
||||
#include "BattlefieldWG.h"
|
||||
#include "BattlefieldMgr.h"
|
||||
#include "Player.h"
|
||||
@@ -358,7 +357,7 @@ bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* player, bool msg
|
||||
if (!spellInfo)
|
||||
return false;
|
||||
|
||||
bool need_check_reagents = false;
|
||||
bool needCheckReagents = false;
|
||||
|
||||
// check effects
|
||||
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
|
||||
@@ -401,7 +400,7 @@ bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* player, bool msg
|
||||
return false;
|
||||
}
|
||||
|
||||
need_check_reagents = true;
|
||||
needCheckReagents = true;
|
||||
break;
|
||||
}
|
||||
case SPELL_EFFECT_LEARN_SPELL:
|
||||
@@ -423,7 +422,7 @@ bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* player, bool msg
|
||||
}
|
||||
}
|
||||
|
||||
if (need_check_reagents)
|
||||
if (needCheckReagents)
|
||||
{
|
||||
for (uint8 j = 0; j < MAX_SPELL_REAGENTS; ++j)
|
||||
{
|
||||
@@ -447,7 +446,7 @@ bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* player, bool msg
|
||||
uint32 SpellMgr::GetSpellDifficultyId(uint32 spellId) const
|
||||
{
|
||||
SpellDifficultySearcherMap::const_iterator i = mSpellDifficultySearcherMap.find(spellId);
|
||||
return i == mSpellDifficultySearcherMap.end() ? 0 : (*i).second;
|
||||
return i == mSpellDifficultySearcherMap.end() ? 0 : i->second;
|
||||
}
|
||||
|
||||
void SpellMgr::SetSpellDifficultyId(uint32 spellId, uint32 id)
|
||||
@@ -1102,7 +1101,13 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32
|
||||
if (!player || (auraSpell > 0 && !player->HasAura(auraSpell)) || (auraSpell < 0 && player->HasAura(-auraSpell)))
|
||||
return false;
|
||||
|
||||
// Extra conditions -- leaving the possibility add extra conditions...
|
||||
if (player)
|
||||
{
|
||||
if (Battleground* bg = player->GetBattleground())
|
||||
return bg->IsSpellAllowed(spellId, player);
|
||||
}
|
||||
|
||||
// Extra conditions
|
||||
switch (spellId)
|
||||
{
|
||||
case 58600: // No fly Zone - Dalaran
|
||||
@@ -1127,41 +1132,26 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
case 68719: // Oil Refinery - Isle of Conquest.
|
||||
case 68720: // Quarry - Isle of Conquest.
|
||||
{
|
||||
if (!player || player->GetBattlegroundTypeId() != BATTLEGROUND_IC || !player->GetBattleground())
|
||||
return false;
|
||||
|
||||
uint8 nodeType = spellId == 68719 ? NODE_TYPE_REFINERY : NODE_TYPE_QUARRY;
|
||||
uint8 nodeState = player->GetTeamId() == TEAM_ALLIANCE ? NODE_STATE_CONTROLLED_A : NODE_STATE_CONTROLLED_H;
|
||||
|
||||
BattlegroundIC* pIC = player->GetBattleground()->ToBattlegroundIC();
|
||||
if (pIC->GetNodeState(nodeType) == nodeState)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
case 56618: // Horde Controls Factory Phase Shift
|
||||
case 56617: // Alliance Controls Factory Phase Shift
|
||||
{
|
||||
if (!player)
|
||||
return false;
|
||||
{
|
||||
if (!player)
|
||||
return false;
|
||||
|
||||
Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId());
|
||||
Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId());
|
||||
|
||||
if (!bf || bf->GetTypeId() != BATTLEFIELD_WG)
|
||||
return false;
|
||||
if (!bf || bf->GetTypeId() != BATTLEFIELD_WG)
|
||||
return false;
|
||||
|
||||
// team that controls the workshop in the specified area
|
||||
uint32 team = bf->GetData(newArea);
|
||||
// team that controls the workshop in the specified area
|
||||
uint32 team = bf->GetData(newArea);
|
||||
|
||||
if (team == TEAM_HORDE)
|
||||
return spellId == 56618;
|
||||
else if (team == TEAM_ALLIANCE)
|
||||
return spellId == 56617;
|
||||
}
|
||||
if (team == TEAM_HORDE)
|
||||
return spellId == 56618;
|
||||
else if (team == TEAM_ALLIANCE)
|
||||
return spellId == 56617;
|
||||
break;
|
||||
}
|
||||
case 57940: // Essence of Wintergrasp - Northrend
|
||||
case 58045: // Essence of Wintergrasp - Wintergrasp
|
||||
{
|
||||
@@ -1356,6 +1346,7 @@ void SpellMgr::LoadSpellRanks()
|
||||
mSpellInfoMap[addedSpell]->ChainEntry = &mSpellChains[addedSpell];
|
||||
prevRank = addedSpell;
|
||||
++itr;
|
||||
|
||||
if (itr == rankChain.end())
|
||||
{
|
||||
mSpellChains[addedSpell].next = NULL;
|
||||
@@ -1616,7 +1607,7 @@ void SpellMgr::LoadSpellTargetPositions()
|
||||
SpellInfo const* spellInfo = GetSpellInfo(Spell_ID);
|
||||
if (!spellInfo)
|
||||
{
|
||||
TC_LOG_ERROR(LOG_FILTER_SQL, "Spell (ID:%u) listed in `spell_target_position` does not exist.", Spell_ID);
|
||||
TC_LOG_ERROR(LOG_FILTER_SQL, "Spell (Id: %u) listed in `spell_target_position` does not exist.", Spell_ID);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ class achievement_resilient_victory : public AchievementCriteriaScript
|
||||
if (bg->GetTypeID(true) != BATTLEGROUND_AB)
|
||||
return false;
|
||||
|
||||
if (!bg->ToBattlegroundAB()->IsTeamScores500Disadvantage(source->GetTeam()))
|
||||
if (!static_cast<BattlegroundAB*>(bg)->IsTeamScores500Disadvantage(source->GetTeam()))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -54,14 +54,10 @@ class achievement_bg_control_all_nodes : public AchievementCriteriaScript
|
||||
|
||||
bool OnCheck(Player* source, Unit* /*target*/) OVERRIDE
|
||||
{
|
||||
Battleground* bg = source->GetBattleground();
|
||||
if (!bg)
|
||||
return false;
|
||||
if (Battleground* bg = source->GetBattleground())
|
||||
return bg->IsAllNodesControlledByTeam(source->GetTeam());
|
||||
|
||||
if (!bg->IsAllNodesConrolledByTeam(source->GetTeam()))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -84,7 +80,7 @@ class achievement_save_the_day : public AchievementCriteriaScript
|
||||
if (bg->GetTypeID(true) != BATTLEGROUND_WS)
|
||||
return false;
|
||||
|
||||
if (bg->ToBattlegroundWS()->GetFlagState(player->GetTeam()) == BG_WS_FLAG_STATE_ON_BASE)
|
||||
if (static_cast<BattlegroundWS*>(bg)->GetFlagState(player->GetTeam()) == BG_WS_FLAG_STATE_ON_BASE)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -209,7 +205,7 @@ class achievement_everything_counts : public AchievementCriteriaScript
|
||||
if (bg->GetTypeID(true) != BATTLEGROUND_AV)
|
||||
return false;
|
||||
|
||||
if (bg->ToBattlegroundAV()->IsBothMinesControlledByTeam(source->GetTeam()))
|
||||
if (static_cast<BattlegroundAV*>(bg)->IsBothMinesControlledByTeam(source->GetTeam()))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -230,7 +226,7 @@ class achievement_bg_av_perfection : public AchievementCriteriaScript
|
||||
if (bg->GetTypeID(true) != BATTLEGROUND_AV)
|
||||
return false;
|
||||
|
||||
if (bg->ToBattlegroundAV()->IsAllTowersControlledAndCaptainAlive(source->GetTeam()))
|
||||
if (static_cast<BattlegroundAV*>(bg)->IsAllTowersControlledAndCaptainAlive(source->GetTeam()))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -253,10 +249,14 @@ class achievement_bg_sa_defense_of_ancients : public AchievementCriteriaScript
|
||||
if (!battleground)
|
||||
return false;
|
||||
|
||||
if (player->GetTeamId() == battleground->ToBattlegroundSA()->Attackers)
|
||||
BattlegroundSA* bg = static_cast<BattlegroundSA*>(battleground);
|
||||
if (!bg)
|
||||
return false;
|
||||
|
||||
if (!battleground->ToBattlegroundSA()->gateDestroyed)
|
||||
if (player->GetTeamId() == bg->Attackers)
|
||||
return false;
|
||||
|
||||
if (!bg->gateDestroyed)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -308,7 +308,11 @@ class achievement_not_even_a_scratch : public AchievementCriteriaScript
|
||||
if (!battleground)
|
||||
return false;
|
||||
|
||||
if (battleground->ToBattlegroundSA()->notEvenAScratch(source->GetTeam()))
|
||||
BattlegroundSA* bg = static_cast<BattlegroundSA*>(battleground);
|
||||
if (!bg)
|
||||
return false;
|
||||
|
||||
if (bg->notEvenAScratch(source->GetTeam()))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user