Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4

Conflicts:
	src/server/game/Battlegrounds/Battleground.cpp
	src/server/game/Handlers/QuestHandler.cpp
	src/server/shared/DataStores/DBCFileLoader.h
This commit is contained in:
Vincent-Michael committed 2013-08-07 11:59:51 +02:00
commit c0fc0f237f
47 files changed
+1093 -631

No files matched your search

@@ -922,7 +922,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
(*itr)->ToPlayer()->KilledMonsterCredit(e.action.killedMonster.creature);
TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: SMART_ACTION_CALL_KILLEDMONSTER: Player %u, Killcredit: %u",
(*itr)->GetGUIDLow(), e.action.killedMonster.creature);
}
}
else if (IsUnit(*itr)) // Special handling for vehicles
if (Vehicle* vehicle = (*itr)->ToUnit()->GetVehicleKit())
for (SeatMap::iterator itr = vehicle->Seats.begin(); itr != vehicle->Seats.end(); ++itr)
+3 -4
View File
@@ -549,10 +549,9 @@ bool AccountMgr::HasPermission(uint32 accountId, uint32 permissionId, uint32 rea
return false;
}
RBACData* rbac = new RBACData(accountId, "", realmId);
rbac->LoadFromDB();
bool hasPermission = rbac->HasPermission(permissionId);
delete rbac;
RBACData rbac(accountId, "", realmId);
rbac.LoadFromDB();
bool hasPermission = rbac.HasPermission(permissionId);
TC_LOG_DEBUG(LOG_FILTER_RBAC, "AccountMgr::HasPermission [AccountId: %u, PermissionId: %u, realmId: %d]: %u",
accountId, permissionId, realmId, hasPermission);
+1
View File
@@ -18,6 +18,7 @@
#include "RBAC.h"
#include "AccountMgr.h"
#include "DatabaseEnv.h"
#include "Log.h"
void RBACRole::GrantPermission(uint32 permissionId)
{
+1 -1
View File
@@ -213,7 +213,7 @@ class RBACData: public RBACObject
* }
* @endcode
*/
bool HasPermission(uint32 permission) { return _globalPerms.test(permission); }
bool HasPermission(uint32 permission) const { return _globalPerms.test(permission); }
// Functions enabled to be used by command system
/// Returns all the granted permissions (after computation)
@@ -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"
+24 -19
View File
@@ -551,6 +551,7 @@ inline void Battleground::_ProcessJoin(uint32 diff)
WorldPacket status;
BattlegroundQueueTypeId bgQueueTypeId = sBattlegroundMgr->BGQueueTypeId(m_TypeID, GetArenaType());
uint32 queueSlot = player->GetBattlegroundQueueIndex(bgQueueTypeId);
sBattlegroundMgr->BuildBattlegroundStatusPacket(&status, this, player, queueSlot, STATUS_IN_PROGRESS, player->GetBattlegroundQueueJoinTime(m_TypeID), GetElapsedTime(), GetArenaType());
player->GetSession()->SendPacket(&status);
@@ -673,20 +674,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)
@@ -703,7 +703,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);
}
}
@@ -728,7 +728,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);
}
}
@@ -754,11 +754,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)
@@ -970,11 +970,11 @@ void Battleground::EndBattleground(uint32 winner)
BlockMovement(player);
player->GetSession()->SendPacket(&pvpLogData);
player->SendDirectMessage(&pvpLogData);
WorldPacket data;
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, this, player, player->GetBattlegroundQueueIndex(bgQueueTypeId), STATUS_IN_PROGRESS, player->GetBattlegroundQueueJoinTime(GetTypeID()), GetElapsedTime(), GetArenaType());
player->GetSession()->SendPacket(&data);
player->SendDirectMessage(&data);
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND, 1);
}
@@ -1079,7 +1079,7 @@ void Battleground::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
{
WorldPacket data;
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, this, player, player->GetBattlegroundQueueIndex(bgQueueTypeId), STATUS_NONE, player->GetBattlegroundQueueJoinTime(bgTypeId), 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
@@ -1803,8 +1803,7 @@ void Battleground::SendWarningToAll(int32 entry, ...)
data << (uint8)0; // added in 4.2.0, unk
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)
@@ -1936,10 +1935,10 @@ void Battleground::PlayerAddedToBGCheckIfBGIsRunning(Player* player)
BlockMovement(player);
sBattlegroundMgr->BuildPvpLogDataPacket(&data, this);
player->GetSession()->SendPacket(&data);
player->SendDirectMessage(&data);
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, this, player, player->GetBattlegroundQueueIndex(bgQueueTypeId), STATUS_IN_PROGRESS, player->GetBattlegroundQueueJoinTime(GetTypeID()), GetElapsedTime(), GetArenaType());
player->GetSession()->SendPacket(&data);
player->SendDirectMessage(&data);
}
uint32 Battleground::GetAlivePlayersCountByTeam(uint32 Team) const
@@ -2043,3 +2042,9 @@ void Battleground::HandleAreaTrigger(Player* player, uint32 trigger)
TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "Unhandled AreaTrigger %u in Battleground %u. Player coords (x: %f, y: %f, z: %f)",
trigger, player->GetMapId(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ());
}
bool Battleground::CheckAchievementCriteriaMeet(uint32 criteriaId, Player const* /*source*/, Unit const* /*target*/, uint32 /*miscvalue1*/)
{
TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Battleground::CheckAchievementCriteriaMeet: No implementation for criteria %u", criteriaId);
return false;
}
+18 -48
View File
@@ -29,21 +29,20 @@ 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;
enum BattlegroundCriteriaId
{
BG_CRITERIA_CHECK_RESILIENT_VICTORY,
BG_CRITERIA_CHECK_SAVE_THE_DAY,
BG_CRITERIA_CHECK_EVERYTHING_COUNTS,
BG_CRITERIA_CHECK_AV_PERFECTION,
BG_CRITERIA_CHECK_DEFENSE_OF_THE_ANCIENTS,
BG_CRITERIA_CHECK_NOT_EVEN_A_SCRATCH,
};
enum BattlegroundSounds
{
SOUND_HORDE_WINS = 8454,
@@ -303,8 +302,9 @@ 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);
virtual bool CheckAchievementCriteriaMeet(uint32 /*criteriaId*/, Player const* /*player*/, Unit const* /*target*/ = NULL, uint32 /*miscvalue1*/ = 0);
/* Battleground */
// Get methods:
@@ -438,7 +438,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);
@@ -453,7 +453,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)]; }
@@ -482,7 +482,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*/);
@@ -546,43 +546,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)
@@ -706,3 +711,14 @@ bool BattlegroundAB::IsAllNodesConrolledByTeam(uint32 team) const
return count == BG_AB_DYNAMIC_NODES_COUNT;
}
bool BattlegroundAB::CheckAchievementCriteriaMeet(uint32 criteriaId, Player const* player, Unit const* target, uint32 miscvalue)
{
switch (criteriaId)
{
case BG_CRITERIA_CHECK_RESILIENT_VICTORY:
return m_TeamScores500Disadvantage[GetTeamIndexByTeamId(player->GetTeam())];
}
return Battleground::CheckAchievementCriteriaMeet(criteriaId, player, target, miscvalue);
}
@@ -270,8 +270,8 @@ class BattlegroundAB : public Battleground
void EventPlayerClickedOnFlag(Player* source, GameObject* target_obj);
/* achievement req. */
bool IsAllNodesConrolledByTeam(uint32 team) const; // overwrited
bool IsTeamScores500Disadvantage(uint32 team) const { return m_TeamScores500Disadvantage[GetTeamIndexByTeamId(team)]; }
bool IsAllNodesControlledByTeam(uint32 team) const;
bool CheckAchievementCriteriaMeet(uint32 /*criteriaId*/, Player const* /*player*/, Unit const* /*target*/ = NULL, uint32 /*miscvalue1*/ = 0);
uint32 GetPrematureWinner();
private:
@@ -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);
@@ -1621,63 +1621,67 @@ void BattlegroundAV::ResetBGSubclass()
DelCreature(i);
}
bool BattlegroundAV::IsBothMinesControlledByTeam(uint32 team) const
bool BattlegroundAV::CheckAchievementCriteriaMeet(uint32 criteriaId, Player const* source, Unit const* target, uint32 miscValue)
{
for (uint8 mine = 0; mine < 2; mine++)
if (m_Mine_Owner[mine] != team)
return false;
return true;
}
bool BattlegroundAV::IsAllTowersControlledAndCaptainAlive(uint32 team) const
{
if (team == ALLIANCE)
uint8 team = source->GetTeam();
switch (criteriaId)
{
for (BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_STONEHEART_BUNKER; ++i) // alliance towers controlled
{
if (m_Nodes[i].State == POINT_CONTROLED)
{
if (m_Nodes[i].Owner != ALLIANCE)
case BG_CRITERIA_CHECK_EVERYTHING_COUNTS:
for (uint8 mine = 0; mine < 2; mine++)
if (m_Mine_Owner[mine] != team)
return false;
}
else
return false;
}
for (BG_AV_Nodes i = BG_AV_NODES_ICEBLOOD_TOWER; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i) // horde towers destroyed
if (m_Nodes[i].State != POINT_DESTROYED)
return false;
if (!m_CaptainAlive[0])
return false;
return true;
}
else if (team == HORDE)
{
for (BG_AV_Nodes i = BG_AV_NODES_ICEBLOOD_TOWER; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i) // horde towers controlled
return true;
case BG_CRITERIA_CHECK_AV_PERFECTION:
{
if (m_Nodes[i].State == POINT_CONTROLED)
if (team == ALLIANCE)
{
if (m_Nodes[i].Owner != HORDE)
for (BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_STONEHEART_BUNKER; ++i) // alliance towers controlled
{
if (m_Nodes[i].State == POINT_CONTROLED)
{
if (m_Nodes[i].Owner != ALLIANCE)
return false;
}
else
return false;
}
for (BG_AV_Nodes i = BG_AV_NODES_ICEBLOOD_TOWER; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i) // horde towers destroyed
if (m_Nodes[i].State != POINT_DESTROYED)
return false;
if (!m_CaptainAlive[0])
return false;
return true;
}
else if (team == HORDE)
{
for (BG_AV_Nodes i = BG_AV_NODES_ICEBLOOD_TOWER; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i) // horde towers controlled
{
if (m_Nodes[i].State == POINT_CONTROLED)
{
if (m_Nodes[i].Owner != HORDE)
return false;
}
else
return false;
}
for (BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_STONEHEART_BUNKER; ++i) // alliance towers destroyed
if (m_Nodes[i].State != POINT_DESTROYED)
return false;
if (!m_CaptainAlive[1])
return false;
return true;
}
else
return false;
}
for (BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_STONEHEART_BUNKER; ++i) // alliance towers destroyed
if (m_Nodes[i].State != POINT_DESTROYED)
return false;
if (!m_CaptainAlive[1])
return false;
return true;
}
return false;
return Battleground::CheckAchievementCriteriaMeet(criteriaId, source, target, miscValue);
}
uint32 BattlegroundAV::GetPrematureWinner()
@@ -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,28 +1551,27 @@ 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);
WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
/* achievement req. */
bool IsBothMinesControlledByTeam(uint32 team) const;
bool IsAllTowersControlledAndCaptainAlive(uint32 team) const;
// Achievement: Av perfection and Everything counts
bool CheckAchievementCriteriaMeet(uint32 criteriaId, Player const* source, Unit const* target = NULL, uint32 miscvalue1 = 0);
uint32 GetPrematureWinner();
@@ -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);
@@ -335,23 +322,23 @@ void BattlegroundIC::HandleAreaTrigger(Player* player, uint32 trigger)
/// @hack: this spell should be cast by npc 22515 (World Trigger) and not by the player
if (trigger == 5555 && player->GetTeamId() == TEAM_HORDE)
{
if (GateStatus[BG_IC_A_FRONT] != BG_IC_GATE_DESTROYED
&& GateStatus[BG_IC_A_WEST] != BG_IC_GATE_DESTROYED
if (GateStatus[BG_IC_A_FRONT] != BG_IC_GATE_DESTROYED
&& GateStatus[BG_IC_A_WEST] != BG_IC_GATE_DESTROYED
&& GateStatus[BG_IC_A_EAST] != BG_IC_GATE_DESTROYED)
player->CastSpell(player, SPELL_BACK_DOOR_JOB_ACHIEVEMENT, true);
}
else if (trigger == 5535 && player->GetTeamId() == TEAM_ALLIANCE)
{
if (GateStatus[BG_IC_H_FRONT] != BG_IC_GATE_DESTROYED
&& GateStatus[BG_IC_H_WEST] != BG_IC_GATE_DESTROYED
if (GateStatus[BG_IC_H_FRONT] != BG_IC_GATE_DESTROYED
&& GateStatus[BG_IC_H_WEST] != BG_IC_GATE_DESTROYED
&& GateStatus[BG_IC_H_EAST] != BG_IC_GATE_DESTROYED)
player->CastSpell(player, SPELL_BACK_DOOR_JOB_ACHIEVEMENT, true);
}
}
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;
@@ -56,8 +56,8 @@ void BattlegroundSA::Reset()
GateStatus[i] = BG_SA_GATE_OK;
ShipsStarted = false;
gateDestroyed = false;
_notEvenAScratch[TEAM_ALLIANCE] = true;
_notEvenAScratch[TEAM_HORDE] = true;
_allVehiclesAlive[TEAM_ALLIANCE] = true;
_allVehiclesAlive[TEAM_HORDE] = true;
Status = BG_SA_WARMUP;
}
@@ -274,7 +274,7 @@ void BattlegroundSA::StartShips()
WorldPacket pkt;
GetBGObject(i)->BuildValuesUpdateBlockForPlayer(&data, p);
data.BuildPacket(&pkt);
p->GetSession()->SendPacket(&pkt);
p->SendDirectMessage(&pkt);
}
}
}
@@ -566,7 +566,7 @@ void BattlegroundSA::HandleKillUnit(Creature* creature, Player* killer)
if (creature->GetEntry() == NPC_DEMOLISHER_SA)
{
UpdatePlayerScore(killer, SCORE_DESTROYED_DEMOLISHER, 1);
_notEvenAScratch[Attackers] = false;
_allVehiclesAlive[Attackers] = false;
}
}
@@ -948,7 +948,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);
}
}
@@ -963,6 +963,20 @@ void BattlegroundSA::SendTransportsRemove(Player* player)
GetBGObject(BG_SA_BOAT_TWO)->BuildOutOfRangeUpdateBlock(&transData);
WorldPacket packet;
transData.BuildPacket(&packet);
player->GetSession()->SendPacket(&packet);
player->SendDirectMessage(&packet);
}
}
bool BattlegroundSA::CheckAchievementCriteriaMeet(uint32 criteriaId, Player const* source, Unit const* target, uint32 miscValue)
{
switch (criteriaId)
{
case BG_CRITERIA_CHECK_NOT_EVEN_A_SCRATCH:
return _allVehiclesAlive[GetTeamIndexByTeamId(source->GetTeam())];
case BG_CRITERIA_CHECK_DEFENSE_OF_THE_ANCIENTS:
if (source->GetTeamId() != Attackers && !gateDestroyed)
return true;
}
return Battleground::CheckAchievementCriteriaMeet(criteriaId, source, target, miscValue);
}
@@ -543,7 +543,7 @@ class BattlegroundSA : public Battleground
bool gateDestroyed;
// Achievement: Not Even a Scratch
bool notEvenAScratch(uint32 team) const { return _notEvenAScratch[GetTeamIndexByTeamId(team)]; }
bool CheckAchievementCriteriaMeet(uint32 criteriaId, Player const* source, Unit const* target = NULL, uint32 miscvalue1 = 0);
/// Id of attacker team
TeamId Attackers;
@@ -627,6 +627,6 @@ class BattlegroundSA : public Battleground
std::map<uint32/*id*/, uint32/*timer*/> DemoliserRespawnList;
// Achievement: Not Even a Scratch
bool _notEvenAScratch[BG_TEAMS_COUNT];
bool _allVehiclesAlive[BG_TEAMS_COUNT];
};
#endif
@@ -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;
}
}
@@ -867,3 +871,16 @@ uint32 BattlegroundWS::GetPrematureWinner()
return Battleground::GetPrematureWinner();
}
bool BattlegroundWS::CheckAchievementCriteriaMeet(uint32 criteriaId, Player const* player, Unit const* target, uint32 miscValue)
{
switch (criteriaId)
{
case BG_CRITERIA_CHECK_SAVE_THE_DAY:
if (GetFlagState(player->GetTeam()) == BG_WS_FLAG_STATE_ON_BASE)
return true;
break;
}
return Battleground::CheckAchievementCriteriaMeet(criteriaId, player, target, miscValue);
}
@@ -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)
@@ -213,6 +213,10 @@ class BattlegroundWS : public Battleground
void RemovePoint(uint32 TeamID, uint32 Points = 1) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] -= Points; }
uint32 GetPrematureWinner();
/* Achievements*/
bool CheckAchievementCriteriaMeet(uint32 criteriaId, Player const* source, Unit const* target = NULL, uint32 miscvalue1 = 0);
private:
uint64 m_FlagKeepers[2]; // 0 - alliance, 1 - horde
uint64 m_DroppedFlagGUID[2];
+1 -1
View File
@@ -161,7 +161,7 @@ enum InstanceInfo
INSTANCE_INFO_BOSS_STATE
};
enum
enum MaxConditionTargets
{
MAX_CONDITION_TARGETS = 3
};
+1 -1
View File
@@ -446,7 +446,7 @@ void LFGMgr::InitializeLockedDungeons(Player* player, uint8 level /* = 0 */)
void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const std::string& comment)
{
if (!player || !player->GetSession() || dungeons.empty())
return;
return;
Group* grp = player->GetGroup();
uint64 guid = player->GetGUID();
@@ -17,7 +17,7 @@
*/
#include "GameObjectAI.h"
#include "BattlegroundAV.h"
#include "Battleground.h"
#include "CellImpl.h"
#include "CreatureAISelector.h"
#include "DynamicTree.h"
@@ -325,7 +325,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());
}
@@ -374,7 +374,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;
@@ -873,7 +873,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;
}
@@ -949,12 +951,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;
@@ -1243,7 +1241,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)
{
@@ -1385,7 +1383,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;
}
}
@@ -1648,7 +1646,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;
@@ -1844,7 +1842,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();
+4 -15
View File
@@ -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"
@@ -9003,22 +9002,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)
{
+85 -90
View File
@@ -29,7 +29,6 @@
#include "ObjectAccessor.h"
#include "Group.h"
#include "Battleground.h"
#include "BattlegroundAV.h"
#include "ScriptMgr.h"
#include "GameObjectAI.h"
@@ -523,7 +522,11 @@ void WorldSession::HandleQuestgiverCompleteQuest(WorldPacket& recvData)
TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_COMPLETE_QUEST npc = %u, questId = %u", uint32(GUID_LOPART(playerGuid)), questId);
Object* object = ObjectAccessor::GetObjectByTypeMask(*_player, playerGuid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT);
Quest const* quest = sObjectMgr->GetQuestTemplate(questId);
if (!quest)
return;
Object* object = ObjectAccessor::GetObjectByTypeMask(*_player, playerGuid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT);
if (!object || !object->hasInvolvedQuest(questId))
return;
@@ -534,45 +537,33 @@ void WorldSession::HandleQuestgiverCompleteQuest(WorldPacket& recvData)
return;
}
if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId))
if (!_player->CanSeeStartQuest(quest) && _player->GetQuestStatus(questId) == QUEST_STATUS_NONE)
{
if (autoCompleteMode && !quest->HasFlag(QUEST_FLAGS_AUTO_SUBMIT))
{
TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Possible hacking attempt: Player %s [playerGuid: %u] tried to complete questId [entry: %u] by auto-submit flag for quest witch not suport it.",
_player->GetName().c_str(), _player->GetGUIDLow(), questId);
return;
}
if (!_player->CanSeeStartQuest(quest) && _player->GetQuestStatus(questId) == QUEST_STATUS_NONE)
{
TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Possible hacking attempt: Player %s [playerGuid: %u] tried to complete questId [entry: %u] without being in possession of the questId!",
_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, playerGuid, _player->CanCompleteRepeatableQuest(quest), false);
else
_player->PlayerTalkClass->SendQuestGiverRequestItems(quest, playerGuid, _player->CanRewardQuest(quest, false), false);
}
else
{
if (quest->GetReqItemsCount()) // some items required
_player->PlayerTalkClass->SendQuestGiverRequestItems(quest, playerGuid, _player->CanRewardQuest(quest, false), false);
else // no items required
_player->PlayerTalkClass->SendQuestGiverOfferReward(quest, playerGuid, !autoCompleteMode);
}
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, playerGuid, _player->CanCompleteRepeatableQuest(quest), false);
else
_player->PlayerTalkClass->SendQuestGiverRequestItems(quest, playerGuid, _player->CanRewardQuest(quest, false), false);
}
else
{
if (quest->GetReqItemsCount()) // some items required
_player->PlayerTalkClass->SendQuestGiverRequestItems(quest, playerGuid, _player->CanRewardQuest(quest, false), false);
else // no items required
_player->PlayerTalkClass->SendQuestGiverOfferReward(quest, playerGuid, true);
}
if (Creature* creature = object->ToCreature())
sScriptMgr->OnQuestComplete(_player, creature, quest);
}
void WorldSession::HandleQuestgiverQuestAutoLaunch(WorldPacket& /*recvPacket*/)
@@ -588,66 +579,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);
}
}
}
@@ -669,7 +664,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);
}
}
-2
View File
@@ -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"
+12 -22
View File
@@ -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 91604: // No fly Zone - Wintergrasp
@@ -1115,21 +1120,6 @@ 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
{
@@ -1669,7 +1659,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;
}
@@ -400,12 +400,12 @@ public:
## go_shallow_grave
######*/
enum
enum ShallowGrave
{
ZOMBIE = 7286,
DEAD_HERO = 7276,
ZOMBIE_CHANCE = 65,
DEAD_HERO_CHANCE = 10
NPC_ZOMBIE = 7286,
NPC_DEAD_HERO = 7276,
CHANCE_ZOMBIE = 65,
CHANCE_DEAD_HERO = 10
};
class go_shallow_grave : public GameObjectScript
@@ -419,11 +419,11 @@ public:
if (go->GetUseCount() == 0)
{
uint32 randomchance = urand(0, 100);
if (randomchance < ZOMBIE_CHANCE)
go->SummonCreature(ZOMBIE, go->GetPositionX(), go->GetPositionY(), go->GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000);
if (randomchance < CHANCE_ZOMBIE)
go->SummonCreature(NPC_ZOMBIE, go->GetPositionX(), go->GetPositionY(), go->GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000);
else
if ((randomchance - ZOMBIE_CHANCE) < DEAD_HERO_CHANCE)
go->SummonCreature(DEAD_HERO, go->GetPositionX(), go->GetPositionY(), go->GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000);
if ((randomchance - CHANCE_ZOMBIE) < CHANCE_DEAD_HERO)
go->SummonCreature(NPC_DEAD_HERO, go->GetPositionX(), go->GetPositionY(), go->GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000);
}
go->AddUse();
return false;
@@ -52,7 +52,7 @@ enum Yells
SAY_INTRO = 5
};
enum
enum Misc
{
ACHIEV_TIMED_START_EVENT = 20381,
};
@@ -99,7 +99,7 @@ static _Messages _GossipMessage[]=
{MSG_ANUBARAK, GOSSIP_ACTION_INFO_DEF + 6, true, BOSS_ANUBARAK}
};
enum
enum Messages
{
NUM_MESSAGES = 6
};
@@ -5,7 +5,7 @@
#ifndef DEF_CRUSADER_H
#define DEF_CRUSADER_H
enum
enum DataTypes
{
BOSS_BEASTS = 0,
BOSS_JARAXXUS = 1,
@@ -28,12 +28,18 @@ enum
INCREASE = 501,
DECREASE = 502,
};
enum SpellIds
{
SPELL_WILFRED_PORTAL = 68424,
SPELL_JARAXXUS_CHAINS = 67924,
SPELL_CORPSE_TELEPORT = 69016,
SPELL_DESTROY_FLOOR_KNOCKUP = 68193,
};
enum MiscData
{
DESPAWN_TIME = 300000,
DISPLAYID_DESTROYED_FLOOR = 9060
@@ -198,7 +198,7 @@ enum Events
EVENT_CLOSE_FROSTWORN_DOOR,
};
enum Enum
enum Misc
{
ACTION_START_INTRO,
ACTION_SKIP_INTRO,
@@ -744,7 +744,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript
void JustDied(Unit* /*Killer*/) OVERRIDE
{
if (_instance)
if (_instance)
_instance->SetData(DATA_ESCAPE_EVENT, FAIL);
}
@@ -893,7 +893,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript
case EVENT_ESCAPE_13:
if (Creature* lichking = me->GetCreature(*me, _lichkingGUID))
{
lichking->AI()->DoCast(lichking, SPELL_REMORSELESS_WINTER, true);
lichking->AI()->DoCast(lichking, SPELL_REMORSELESS_WINTER, true);
lichking->AI()->DoCast(lichking, SPELL_SUMMON_RISE_WITCH_DOCTOR);
lichking->GetMotionMaster()->MoveIdle();
lichking->GetMotionMaster()->MoveChase(me);
@@ -901,9 +901,9 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript
if (Creature* walltarget = me->SummonCreature(NPC_ICE_WALL,IceWalls[0].GetPositionX(), IceWalls[0].GetPositionY(), IceWalls[0].GetPositionZ(), IceWalls[0].GetOrientation(), TEMPSUMMON_MANUAL_DESPAWN, 720000))
{
_walltargetGUID = walltarget->GetGUID();
walltarget->AI()->DoCast(walltarget, SPELL_SUMMON_ICE_WALL);
walltarget->AI()->DoCast(walltarget, SPELL_SUMMON_ICE_WALL);
walltarget->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
me->Attack(walltarget,false);
me->Attack(walltarget,false);
}
me->GetMotionMaster()->MovePoint(0, NpcJainaOrSylvanasEscapeRoute[3]);
_events.ScheduleEvent(EVENT_ESCAPE_14, 8000);
@@ -921,7 +921,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript
else
me->AI()->Talk(SAY_SYLVANAS_ESCAPE_2);
}
}
}
_events.ScheduleEvent(EVENT_ESCAPE_15, 1000);
break;
case EVENT_ESCAPE_15:
@@ -966,7 +966,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript
else
me->RemoveAurasDueToSpell(SPELL_SYLVANAS_DESTROY_ICE_WALL);
}
if (_icewall && _icewall < 4)
if (_icewall && _icewall < 4)
me->GetMotionMaster()->MovePoint(0, NpcJainaOrSylvanasEscapeRoute[_icewall + 3]);
_events.ScheduleEvent(EVENT_ESCAPE_18, 2000);
break;
@@ -991,7 +991,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript
if (Creature* walltarget = me->SummonCreature(NPC_ICE_WALL, IceWalls[_icewall].GetPositionX(), IceWalls[_icewall].GetPositionY(), IceWalls[_icewall].GetPositionZ(), IceWalls[_icewall].GetOrientation(), TEMPSUMMON_MANUAL_DESPAWN, 720000))
{
_walltargetGUID = walltarget->GetGUID();
walltarget->AI()->DoCast(walltarget, SPELL_SUMMON_ICE_WALL);
walltarget->AI()->DoCast(walltarget, SPELL_SUMMON_ICE_WALL);
walltarget->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
me->Attack(walltarget,false);
}
@@ -1028,9 +1028,9 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript
if (Creature* lichking = me->GetCreature(*me, _lichkingGUID))
{
if (_icewall && _icewall < 3)
lichking->AI()->DoCast(lichking, SPELL_SUMMON_RISE_WITCH_DOCTOR);
lichking->AI()->DoCast(lichking, SPELL_SUMMON_RISE_WITCH_DOCTOR);
else
lichking->AI()->DoCast(lichking, SPELL_SUMMON_LUMBERING_ABOMINATION);
lichking->AI()->DoCast(lichking, SPELL_SUMMON_LUMBERING_ABOMINATION);
}
if (_icewall == 3)
_events.ScheduleEvent(EVENT_ESCAPE_21, 16000); // last wall, really far
@@ -1826,20 +1826,20 @@ class npc_raging_ghoul : public CreatureScript
{
public:
npc_raging_ghoul() : CreatureScript("npc_raging_ghoul") { }
struct npc_raging_ghoulAI : public ScriptedAI
{
npc_raging_ghoulAI(Creature* creature) : ScriptedAI(creature)
{
_instance = me->GetInstanceScript();
_instance = me->GetInstanceScript();
}
InstanceScript* _instance;
uint32 _emergeTimer;
bool _doEmerge;
bool _doJump;
uint64 _leaderGUID;
void Reset() OVERRIDE
{
_emergeTimer = 4000;
@@ -1847,47 +1847,47 @@ public:
_doJump = false;
if (_instance && _instance->GetData(DATA_ESCAPE_EVENT) == IN_PROGRESS)
_instance->SetData(DATA_SUMMONS, 1);
}
void IsSummonedBy(Unit*) OVERRIDE
{
DoCast(me, SPELL_EMERGE_VISUAL);
DoZoneInCombat(me, 100.00f);
}
void JustDied(Unit* /*killer*/) OVERRIDE
{
if (_instance)
_instance->SetData(DATA_SUMMONS, 0);
}
void AttackStart(Unit* who) OVERRIDE
{
if (!who)
return;
if (!_doEmerge)
return;
ScriptedAI::AttackStart(who);
}
void UpdateAI(uint32 diff) OVERRIDE
{
if (!_instance)
return;
if (_instance->GetData(DATA_ESCAPE_EVENT) == IN_PROGRESS)
{
_leaderGUID = _instance->GetData64(DATA_ESCAPE_LEADER);
Creature* leader = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_ESCAPE_LEADER));
if (_doEmerge != true)
{
if (_emergeTimer < diff)
{
_doEmerge = true;
_doEmerge = true;
if (leader)
{
DoResetThreat();
@@ -1898,7 +1898,7 @@ public:
else
_emergeTimer -= diff;
}
if (me->Attack(leader,true))/*(Unit *target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150.0f))*/
{
if (!_doJump && me->IsWithinDistInMap(leader, 30.0f) && !me->IsWithinDistInMap(leader, 5.0f))
@@ -1913,7 +1913,7 @@ public:
DoMeleeAttackIfReady();
}
};
CreatureAI* GetAI(Creature* creature) const OVERRIDE
{
return new npc_raging_ghoulAI(creature);
@@ -1924,14 +1924,14 @@ class npc_risen_witch_doctor : public CreatureScript
{
public:
npc_risen_witch_doctor() : CreatureScript("npc_risen_witch_doctor") { }
struct npc_risen_witch_doctorAI : public ScriptedAI
{
npc_risen_witch_doctorAI(Creature* creature) : ScriptedAI(creature)
{
_instance = me->GetInstanceScript();
_instance = me->GetInstanceScript();
}
InstanceScript* _instance;
uint32 _emergeTimer;
bool _doEmerge;
@@ -1939,7 +1939,7 @@ public:
uint32 _boltTimer;
uint32 _boltVolleyTimer;
uint32 _curseTimer;
void Reset() OVERRIDE
{
_emergeTimer = 5000;
@@ -1951,36 +1951,36 @@ public:
if (_instance->GetData(DATA_ESCAPE_EVENT) == IN_PROGRESS)
_instance->SetData(DATA_SUMMONS, 1);
}
void IsSummonedBy(Unit*) OVERRIDE
{
DoCast(me, SPELL_EMERGE_VISUAL);
DoZoneInCombat(me, 100.00f);
}
void JustDied(Unit* /*killer*/) OVERRIDE
{
if (_instance)
if (_instance)
_instance->SetData(DATA_SUMMONS, 0);
}
void AttackStart(Unit* who) OVERRIDE
{
if (!who)
return;
if (_doEmerge == false)
return;
ScriptedAI::AttackStart(who);
}
void UpdateAI(uint32 diff) OVERRIDE
{
if (!_instance)
return;
if (_instance->GetData(DATA_ESCAPE_EVENT) == IN_PROGRESS)
{
if (_doEmerge != true)
@@ -1989,7 +1989,7 @@ public:
{
_doEmerge = true;
_leaderGUID = _instance->GetData64(DATA_ESCAPE_LEADER);
if (Creature* leader = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_ESCAPE_LEADER)))
{
DoResetThreat();
@@ -2000,25 +2000,25 @@ public:
else
_emergeTimer -= diff;
}
if (_curseTimer < diff)
{
if (Unit *target = SelectTarget(SELECT_TARGET_RANDOM))
DoCast(target, SPELL_COURSE_OF_DOOM);
_curseTimer = urand(10000, 15000);
}
else
}
else
_curseTimer -= diff;
if (_boltTimer < diff)
{
if (Unit *target = SelectTarget(SELECT_TARGET_TOPAGGRO))
DoCast(target, SPELL_SHADOW_BOLT);
_boltTimer = urand(2000, 3000);
}
else
}
else
_boltTimer -= diff;
if (_boltVolleyTimer < diff)
{
if (Unit *target = SelectTarget(SELECT_TARGET_TOPAGGRO))
@@ -2033,7 +2033,7 @@ public:
DoMeleeAttackIfReady();
}
};
CreatureAI* GetAI(Creature* creature) const OVERRIDE
{
return new npc_risen_witch_doctorAI(creature);
@@ -2045,20 +2045,20 @@ class npc_lumbering_abomination : public CreatureScript
{
public:
npc_lumbering_abomination() : CreatureScript("npc_lumbering_abomination") { }
struct npc_lumbering_abominationAI : public ScriptedAI
{
npc_lumbering_abominationAI(Creature* creature) : ScriptedAI(creature)
{
_instance = me->GetInstanceScript();
_instance = me->GetInstanceScript();
}
InstanceScript* _instance;
uint64 _leaderGUID;
bool _doWalk;
uint32 _strikeTimer;
uint32 _vomitTimer;
void Reset() OVERRIDE
{
_doWalk = false;
@@ -2066,20 +2066,20 @@ public:
_strikeTimer = 6000;
if (_instance)
if (_instance->GetData(DATA_ESCAPE_EVENT) == IN_PROGRESS)
_instance->SetData(DATA_SUMMONS, 1);
_instance->SetData(DATA_SUMMONS, 1);
}
void IsSummonedBy(Unit*) OVERRIDE
{
DoCast(me, SPELL_EMERGE_VISUAL);
DoZoneInCombat(me, 100.00f);
}
void UpdateAI(uint32 diff) OVERRIDE
{
if (!_instance)
return;
if (_instance->GetData(DATA_ESCAPE_EVENT) == IN_PROGRESS)
{
if (_doWalk != true)
@@ -2101,7 +2101,7 @@ public:
}
else
_strikeTimer -= diff;
if (_vomitTimer < diff)
{
if (Unit *target = SelectTarget(SELECT_TARGET_TOPAGGRO))
@@ -2115,15 +2115,15 @@ public:
me->DespawnOrUnsummon();
DoMeleeAttackIfReady();
}
void JustDied(Unit* /*killer*/) OVERRIDE
{
if (_instance)
if (_instance)
_instance->SetData(DATA_SUMMONS, 0);
}
};
CreatureAI* GetAI(Creature* creature) const OVERRIDE
{
return new npc_lumbering_abominationAI(creature);
@@ -2145,7 +2145,7 @@ void AddSC_halls_of_reflection()
new npc_tortured_rifleman();
new npc_raging_ghoul();
new npc_risen_witch_doctor();
new npc_lumbering_abomination();
new npc_lumbering_abomination();
new npc_frostworn_general();
new npc_spiritual_reflection();
}
@@ -181,7 +181,7 @@ public:
HandleGameObject(0, true, go);
else
HandleGameObject(0, false, go);
break;
break;
case GO_CAVE:
_caveGUID = go->GetGUID();
go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_INTERACT_COND);
@@ -255,17 +255,17 @@ public:
if (_teamInInstance == ALLIANCE)
instance->SummonCreature(NPC_JAINA_PART2, JainaSpawnPos2);
else
instance->SummonCreature(NPC_SYLVANAS_PART2, SylvanasSpawnPos2);
instance->SummonCreature(NPC_SYLVANAS_PART2, SylvanasSpawnPos2);
}
_frostwornGeneral = data;
break;
_frostwornGeneral = data;
break;
case DATA_ESCAPE_EVENT:
if (data == IN_PROGRESS)
{
if (!_escapeevent)
if (Creature* jaina_or_sylvanas = instance->GetCreature(_jainaOrSylvanasPart2GUID))
jaina_or_sylvanas->AI()->DoAction(ACTION_START_ESCAPING);
}
}
else if (data == NOT_STARTED)
{
if (Creature* jaina_or_sylvanas = instance->GetCreature(_jainaOrSylvanasPart2GUID))
@@ -287,7 +287,7 @@ public:
if (Creature* jaina_or_sylvanas = instance->GetCreature(_jainaOrSylvanasPart2GUID))
jaina_or_sylvanas->AI()->DoAction(ACTION_WALL_BROKEN);
}
}
}
else if (data == 1)
_mobsaticewall++;
break;
@@ -489,9 +489,9 @@ public:
case DATA_FROSTMOURNE:
return _frostmourneGUID;
case DATA_ESCAPE_LEADER:
return _jainaOrSylvanasPart2GUID;
return _jainaOrSylvanasPart2GUID;
case DATA_CAVE_IN:
return _caveGUID;
return _caveGUID;
default:
break;
}
@@ -19,24 +19,21 @@
#include "ScriptedCreature.h"
#include "naxxramas.h"
enum Anubrekhan
enum Says
{
SAY_AGGRO = 0,
SAY_GREET = 1,
SAY_SLAY = 2,
NPC_CRYPT_GUARD = 16573
SAY_SLAY = 2
};
const Position GuardSummonPos = {3333.72f, -3476.30f, 287.1f, 6.2801f};
Position const GuardSummonPos = {3333.72f, -3476.30f, 287.1f, 6.2801f};
enum Events
{
EVENT_NONE,
EVENT_IMPALE,
EVENT_IMPALE = 1,
EVENT_LOCUST,
EVENT_SPAWN_GUARDIAN_NORMAL,
EVENT_BERSERK,
EVENT_BERSERK
};
enum Spells
@@ -47,12 +44,12 @@ enum Spells
SPELL_LOCUST_SWARM_25 = 54021,
SPELL_SUMMON_CORPSE_SCARABS_PLR = 29105, // This spawns 5 corpse scarabs on top of player
SPELL_SUMMON_CORPSE_SCARABS_MOB = 28864, // This spawns 10 corpse scarabs on top of dead guards
SPELL_BERSERK = 27680,
SPELL_BERSERK = 27680
};
enum
enum Misc
{
ACHIEV_TIMED_START_EVENT = 9891,
ACHIEV_TIMED_START_EVENT = 9891
};
class boss_anubrekhan : public CreatureScript
@@ -25,7 +25,7 @@ enum Spells
H_SPELL_HATEFUL_STRIKE = 59192,
SPELL_FRENZY = 28131,
SPELL_BERSERK = 26662,
SPELL_SLIME_BOLT = 32309,
SPELL_SLIME_BOLT = 32309
};
enum Yells
@@ -45,9 +45,9 @@ enum Events
EVENT_SLIME
};
enum
enum Misc
{
ACHIEV_MAKE_QUICK_WERK_OF_HIM_STARTING_EVENT = 10286,
ACHIEV_MAKE_QUICK_WERK_OF_HIM_STARTING_EVENT = 10286
};
class boss_patchwerk : public CreatureScript
@@ -84,6 +84,7 @@ enum CreaturesIds
NPC_STALAGG = 15929,
NPC_SAPPHIRON = 15989,
NPC_KEL_THUZAD = 15990,
NPC_CRYPT_GUARD = 16573,
NPC_NAXXRAMAS_FOLLOWER = 16505,
NPC_FOLLOWER_WORSHIPPER = 16506,
NPC_DK_UNDERSTUDY = 16803
@@ -936,10 +936,10 @@ public:
## npc_maxx_a_million
######*/
enum
enum MaxxAMillion
{
QUEST_MARK_V_IS_ALIVE = 10191,
GO_DRAENEI_MACHINE = 183771
QUEST_MARK_V_IS_ALIVE = 10191,
GO_DRAENEI_MACHINE = 183771
};
class npc_maxx_a_million_escort : public CreatureScript
+35
View File
@@ -1785,6 +1785,40 @@ class spell_q12847_summon_soul_moveto_bunny : public SpellScriptLoader
}
};
class spell_q13086_cannons_target : public SpellScriptLoader
{
public:
spell_q13086_cannons_target() : SpellScriptLoader("spell_q13086_cannons_target") { }
class spell_q13086_cannons_target_SpellScript : public SpellScript
{
PrepareSpellScript(spell_q13086_cannons_target_SpellScript);
bool Validate(SpellInfo const* spellInfo) OVERRIDE
{
if (!sSpellMgr->GetSpellInfo(spellInfo->Effects[EFFECT_0].CalcValue()))
return false;
return true;
}
void HandleEffectDummy(SpellEffIndex /*effIndex*/)
{
if (WorldLocation const* pos = GetExplTargetDest())
GetCaster()->CastSpell(pos->GetPositionX(), pos->GetPositionY(), pos->GetPositionZ(), GetEffectValue(), true);
}
void Register() OVERRIDE
{
OnEffectHit += SpellEffectFn(spell_q13086_cannons_target_SpellScript::HandleEffectDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const OVERRIDE
{
return new spell_q13086_cannons_target_SpellScript();
}
};
void AddSC_quest_spell_scripts()
{
new spell_q55_sacred_cleansing();
@@ -1829,4 +1863,5 @@ void AddSC_quest_spell_scripts()
new spell_q13291_q13292_q13239_q13261_frostbrood_skytalon_grab_decoy();
new spell_q13291_q13292_q13239_q13261_armored_decoy_summon_skytalon();
new spell_q12847_summon_soul_moveto_bunny();
new spell_q13086_cannons_target();
}
@@ -16,12 +16,8 @@
*/
#include "ScriptMgr.h"
#include "BattlegroundAB.h"
#include "BattlegroundWS.h"
#include "BattlegroundIC.h"
#include "BattlegroundSA.h"
#include "BattlegroundAV.h"
#include "BattlegroundIC.h"
#include "Vehicle.h"
#include "Player.h"
#include "Creature.h"
@@ -31,19 +27,12 @@ class achievement_resilient_victory : public AchievementCriteriaScript
public:
achievement_resilient_victory() : AchievementCriteriaScript("achievement_resilient_victory") { }
bool OnCheck(Player* source, Unit* /*target*/) OVERRIDE
bool OnCheck(Player* source, Unit* target) OVERRIDE
{
Battleground* bg = source->GetBattleground();
if (!bg)
return false;
if (Battleground* bg = source->GetBattleground())
return bg->CheckAchievementCriteriaMeet(BG_CRITERIA_CHECK_RESILIENT_VICTORY, source, target);
if (bg->GetTypeID(true) != BATTLEGROUND_AB)
return false;
if (!bg->ToBattlegroundAB()->IsTeamScores500Disadvantage(source->GetTeam()))
return false;
return true;
return false;
}
};
@@ -54,14 +43,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;
}
};
@@ -72,21 +57,9 @@ class achievement_save_the_day : public AchievementCriteriaScript
bool OnCheck(Player* source, Unit* target) OVERRIDE
{
if (!target)
return false;
if (Battleground* bg = source->GetBattleground())
return bg->CheckAchievementCriteriaMeet(BG_CRITERIA_CHECK_SAVE_THE_DAY, source, target);
if (Player const* player = target->ToPlayer())
{
Battleground* bg = source->GetBattleground();
if (!bg)
return false;
if (bg->GetTypeID(true) != BATTLEGROUND_WS)
return false;
if (bg->ToBattlegroundWS()->GetFlagState(player->GetTeam()) == BG_WS_FLAG_STATE_ON_BASE)
return true;
}
return false;
}
};
@@ -200,17 +173,10 @@ class achievement_everything_counts : public AchievementCriteriaScript
public:
achievement_everything_counts() : AchievementCriteriaScript("achievement_everything_counts") { }
bool OnCheck(Player* source, Unit* /*target*/) OVERRIDE
bool OnCheck(Player* source, Unit* target) OVERRIDE
{
Battleground* bg = source->GetBattleground();
if (!bg)
return false;
if (bg->GetTypeID(true) != BATTLEGROUND_AV)
return false;
if (bg->ToBattlegroundAV()->IsBothMinesControlledByTeam(source->GetTeam()))
return true;
if (Battleground* bg = source->GetBattleground())
return bg->CheckAchievementCriteriaMeet(BG_CRITERIA_CHECK_EVERYTHING_COUNTS, source, target);
return false;
}
@@ -221,17 +187,10 @@ class achievement_bg_av_perfection : public AchievementCriteriaScript
public:
achievement_bg_av_perfection() : AchievementCriteriaScript("achievement_bg_av_perfection") { }
bool OnCheck(Player* source, Unit* /*target*/) OVERRIDE
bool OnCheck(Player* source, Unit* target) OVERRIDE
{
Battleground* bg = source->GetBattleground();
if (!bg)
return false;
if (bg->GetTypeID(true) != BATTLEGROUND_AV)
return false;
if (bg->ToBattlegroundAV()->IsAllTowersControlledAndCaptainAlive(source->GetTeam()))
return true;
if (Battleground* bg = source->GetBattleground())
return bg->CheckAchievementCriteriaMeet(BG_CRITERIA_CHECK_AV_PERFECTION, source, target);
return false;
}
@@ -240,24 +199,12 @@ class achievement_bg_av_perfection : public AchievementCriteriaScript
class achievement_bg_sa_defense_of_ancients : public AchievementCriteriaScript
{
public:
achievement_bg_sa_defense_of_ancients() : AchievementCriteriaScript("achievement_bg_sa_defense_of_ancients")
achievement_bg_sa_defense_of_ancients() : AchievementCriteriaScript("achievement_bg_sa_defense_of_ancients") { }
bool OnCheck(Player* source, Unit* target) OVERRIDE
{
}
bool OnCheck(Player* player, Unit* /*target*/) OVERRIDE
{
if (!player)
return false;
Battleground* battleground = player->GetBattleground();
if (!battleground)
return false;
if (player->GetTeamId() == battleground->ToBattlegroundSA()->Attackers)
return false;
if (!battleground->ToBattlegroundSA()->gateDestroyed)
return true;
if (Battleground* bg = source->GetBattleground())
return bg->CheckAchievementCriteriaMeet(BG_CRITERIA_CHECK_DEFENSE_OF_THE_ANCIENTS, source, target);
return false;
}
@@ -299,17 +246,10 @@ class achievement_not_even_a_scratch : public AchievementCriteriaScript
public:
achievement_not_even_a_scratch() : AchievementCriteriaScript("achievement_not_even_a_scratch") { }
bool OnCheck(Player* source, Unit* /*target*/) OVERRIDE
bool OnCheck(Player* source, Unit* target) OVERRIDE
{
if (!source)
return false;
Battleground* battleground = source->GetBattleground();
if (!battleground)
return false;
if (battleground->ToBattlegroundSA()->notEvenAScratch(source->GetTeam()))
return true;
if (Battleground* bg = source->GetBattleground())
return bg->CheckAchievementCriteriaMeet(BG_CRITERIA_CHECK_NOT_EVEN_A_SCRATCH, source, target);
return false;
}
+1 -1
View File
@@ -273,7 +273,7 @@ public:
## npc_lunaclaw_spirit
######*/
enum
enum LunaclawSpirit
{
QUEST_BODY_HEART_A = 6001,
QUEST_BODY_HEART_H = 6002,