This reverts commit f580cddc09.

This commit is contained in:
kaelima
2011-06-28 13:05:15 +02:00
parent a5493c14a9
commit 142943d4c1
49 changed files with 83 additions and 6744 deletions
-6
View File
@@ -39,12 +39,6 @@ class GameObjectAI
virtual void Reset() {};
// Pass parameters between AI
virtual void DoAction(const int32 /*param = 0 */) {}
virtual uint32 GetData(uint32 /*id = 0*/) { return 0; }
virtual void SetGUID(const uint64 &/*guid*/, int32 /*id = 0 */) {}
virtual uint64 GetGUID(int32 /*id = 0 */) { return 0; }
static int Permissible(const GameObject* go);
virtual bool GossipHello(Player* /*player*/) {return false;}
@@ -134,11 +134,6 @@ namespace FactorySelector
GameObjectAIRegistry& ai_registry(*GameObjectAIRepository::instance());
ai_factory = ai_registry.GetRegistryItem(go->GetAIName());
//scriptname in db
if (!ai_factory)
if (GameObjectAI* scriptedAI = sScriptMgr->GetGameObjectAI(go))
return scriptedAI;
//future goAI types go here
File diff suppressed because it is too large Load Diff
-402
View File
@@ -1,402 +0,0 @@
/*
* Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef BATTLEFIELD_H_
#define BATTLEFIELD_H_
#include "Utilities/Util.h"
#include "SharedDefines.h"
#include "ZoneScript.h"
#include "WorldPacket.h"
#include "GameObject.h"
#include "Battleground.h"
enum BattlefieldTypes
{
BATTLEFIELD_WG, // Wintergrasp
BATTLEFIELD_TB, // Tol Barad (cataclysm)
};
enum BattlefieldIDs
{
BATTLEFIELD_BATTLEID_WG = 1, // Wintergrasp battle
};
enum BattlefieldObjectiveStates
{
BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL = 0,
BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE,
BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE,
BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE,
BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE,
BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE,
BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE,
};
enum BattlefieldSounds
{
BF_HORDE_WINS = 8454,
BF_ALLIANCE_WINS = 8455,
BF_START = 3439
};
enum BattlefieldTimers
{
BATTLEFIELD_OBJECTIVE_UPDATE_INTERVAL = 1000
};
// some class predefs
class Player;
class GameObject;
class WorldPacket;
class Creature;
class Unit;
class Battlefield;
class BfGraveYard;
typedef std::set < uint64 > GuidSet;
typedef std::vector < BfGraveYard * >GraveYardVect;
typedef std::map < uint64, uint32 > PlayerTimerMap;
class BfCapturePoint
{
public:
BfCapturePoint(Battlefield * bf);
virtual void FillInitialWorldStates(WorldPacket & /*data */ ) {}
// send world state update to all players present
void SendUpdateWorldState(uint32 field, uint32 value);
// send kill notify to players in the controlling faction
void SendObjectiveComplete(uint32 id, uint64 guid);
// used when player is activated/inactivated in the area
virtual bool HandlePlayerEnter(Player * plr);
virtual void HandlePlayerLeave(Player * plr);
//virtual void HandlePlayerActivityChanged(Player * plr);
// checks if player is in range of a capture credit marker
bool IsInsideObjective(Player * plr) const;
// returns true if the state of the objective has changed, in this case, the OutdoorPvP must send a world state ui update.
virtual bool Update(uint32 diff);
virtual void ChangeTeam(TeamId /*oldTeam */ ) {}
virtual void SendChangePhase();
bool SetCapturePointData(uint32 entry, uint32 map, float x, float y, float z, float o);
GameObject *GetCapturePointGo() { return m_capturePoint; }
TeamId GetTeamId() {return m_team;}
protected:
bool DelCapturePoint();
// active players in the area of the objective, 0 - alliance, 1 - horde
GuidSet m_activePlayers[2];
// total shift needed to capture the objective
float m_maxValue;
float m_minValue;
// maximum speed of capture
float m_maxSpeed;
// the status of the objective
float m_value;
TeamId m_team;
// objective states
BattlefieldObjectiveStates m_OldState;
BattlefieldObjectiveStates m_State;
// neutral value on capture bar
uint32 m_neutralValuePct;
// pointer to the Battlefield this objective belongs to
Battlefield *m_Bf;
uint32 m_capturePointEntry;
GameObject *m_capturePoint;
};
class BfGraveYard
{
public:
BfGraveYard(Battlefield *Bf);
// method for change who control the graveyard
void ChangeControl(TeamId team);
TeamId GetControlTeamId() { return m_ControlTeam; }
// use for found the nearest graveyard
float GetDistance(Player * plr);
void Init(uint32 horde_entry, uint32 alliance_entry, float x, float y, float z, float o, TeamId startcontrol, uint32 gy);
void AddPlayer(uint64 player_guid);
void RemovePlayer(uint64 player_guid);
void Resurrect();
void RelocateDeadPlayers();
bool HasNpc(uint64 guid) { return (m_SpiritGuide[0]->GetGUID() == guid || m_SpiritGuide[1]->GetGUID() == guid); }
bool HasPlayer(uint64 guid) { return m_ResurrectQueue.find(guid) != m_ResurrectQueue.end(); }
uint32 GetGraveYardId() { return m_GraveyardId; }
protected:
TeamId m_ControlTeam;
uint32 m_GraveyardId;
Creature *m_SpiritGuide[2];
GuidSet m_ResurrectQueue;
Battlefield *m_Bf;
};
class Battlefield:public ZoneScript
{
friend class BattlefieldMgr;
public:
/// Constructor
Battlefield();
/// Destructor
virtual ~Battlefield();
/// typedef of map witch store capturepoint and the associate gameobject entry
typedef std::map < uint32 /*lowguid */ , BfCapturePoint * >BfCapturePointMap;
/// Call this to init the Battlefield
virtual bool SetupBattlefield() { return true; }
/// Generate packet which contain all worldstatedata of area
virtual void FillInitialWorldStates(WorldPacket & /*data */ ) {}
/// Call when a GameObject/Creature is created OR destroyed (view bool add)
void OnGameObjectCreate(GameObject * /*go */ , bool /*add */ ) {}
void OnCreatureCreate(Creature * /*cre */ , bool /*add */ ) {}
/// Update data of a worldstate to all players present in zone
void SendUpdateWorldState(uint32 field, uint32 value);
/**
* \brief Called every time for update bf data and time
* -Update timer for start/end battle
* -Invite player in zone to queue x minutes before start (x = m_StartGroupingTimer)
* -Kick Afk players
* \param diff : time ellapsed since last call (in ms)
*/
virtual bool Update(uint32 diff);
/// Invite all player in zone, to join the queue, called x minutes before battle start in Update()
void InvitePlayerInZoneToQueue();
/// Invite all player in queue to join battle on battle start
void InvitePlayerInQueueToWar();
/// Invite all player in zone to join battle on battle start
void InvitePlayerInZoneToWar();
/// Called when a Unit is kill in battlefield zone
virtual void HandleKill(Player * /*killer */ , Unit * /*killed */ ) {};
uint32 GetTypeId() { return m_TypeId; }
uint32 GetZoneId() { return m_ZoneId; }
void TeamApplyBuff(TeamId team, uint32 spellId, uint32 spellId2 = 0);
/// Return true if battle is start, false if battle is not started
bool IsWarTime() { return m_BattlefieldActive; }
/// Enable or Disable battlefield
void SetEnable(bool enable) { m_enable = enable; }
/// Return if battlefield is enable
bool GetEnable() { return m_enable; }
/**
* \brief Kick player from battlefield and teleport him to kick-point location
* \param guid : guid of player who must be kick
*/
void KickPlayerFromBf(uint64 guid);
/// Called when player (plr) enter in zone
void HandlePlayerEnterZone(Player * plr, uint32 zone);
/// Called when player (plr) leave the zone
void HandlePlayerLeaveZone(Player * plr, uint32 zone);
// All-purpose data storage 64 bit
virtual uint64 GetData64(uint32 DataId) { return m_Data64[DataId]; }
virtual void SetData64(uint32 DataId, uint64 Value) { m_Data64[DataId] = Value; }
// All-purpose data storage 32 bit
virtual uint32 GetData(uint32 DataId) { return m_Data32[DataId]; }
virtual void SetData(uint32 DataId, uint32 Value) { m_Data32[DataId] = Value; }
// Battlefield - generic methods
TeamId GetDefenderTeam() { return m_DefenderTeam; }
TeamId GetAttackerTeam() { return TeamId(1 - m_DefenderTeam); }
void SetDefenderTeam(TeamId team) { m_DefenderTeam = team; }
// Group methods
/**
* \brief Find a not full battlefield group, if there is no, create one
* \param TeamId : Id of player team for who we search a group (plr->GetTeamId())
*/
Group *GetFreeBfRaid(TeamId TeamId);
/// Return battlefield group where player is.
Group *GetGroupPlayer(uint64 guid, TeamId TeamId);
/// Force player to join a battlefield group
bool AddOrSetPlayerToCorrectBfGroup(Player * plr);
// Graveyard methods
// Find which graveyard the player must be teleported to to be resurrected by spiritguide
WorldSafeLocsEntry const *GetClosestGraveYard(Player * plr);
virtual void AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid);
void RemovePlayerFromResurrectQueue(uint64 player_guid);
void SetGraveyardNumber(uint32 number) { m_GraveYardList.resize(number); }
BfGraveYard *GetGraveYardById(uint32 id);
// Misc methods
Creature *SpawnCreature(uint32 entry, float x, float y, float z, float o, TeamId team);
Creature *SpawnCreature(uint32 entry, Position pos, TeamId team);
GameObject *SpawnGameObject(uint32 entry, float x, float y, float z, float o);
// Script-methods
/// Called on start
virtual void OnBattleStart() {};
/// Called at the end of battle
virtual void OnBattleEnd(bool /*endbytimer */ ) {};
/// Called x minutes before battle start when player in zone are invite to join queue
virtual void OnStartGrouping() {};
/// Called when a player accept to join the battle
virtual void OnPlayerJoinWar(Player * /*plr */ ) {};
/// Called when a player leave the battle
virtual void OnPlayerLeaveWar(Player * /*plr */ ) {};
/// Called when a player leave battlefield zone
virtual void OnPlayerLeaveZone(Player * /*plr */ ) {};
/// Called when a player enter in battlefield zone
virtual void OnPlayerEnterZone(Player * /*plr */ ) {};
WorldPacket BuildWarningAnnPacket(std::string msg);
void SendWarningToAllInZone(uint32 entry);
//void SendWarningToAllInWar(int32 entry, ...); -- UNUSED
void SendWarningToPlayer(Player * plr, uint32 entry);
void PlayerAcceptInviteToQueue(Player * plr);
void PlayerAcceptInviteToWar(Player * plr);
uint32 GetBattleId() { return m_BattleId; }
void AskToLeaveQueue(Player * plr);
virtual void DoCompleteOrIncrementAchievement(uint32 /*achievement */ , Player * /*player */ , uint8 /*incrementNumber = 1 */ ) {};
/// Send all worldstate data to all player in zone.
virtual void SendInitWorldStatesToAll() {};
/// Return if we can use mount in battlefield
bool CanFlyIn() { return !m_BattlefieldActive; } // Used for check if we can use flying mount or not
bool IncrementQuest(Player * player, uint32 quest, bool complete = false);
void SendAreaSpiritHealerQueryOpcode(Player * pl, const uint64 & guid);
void StartBattle();
void EndBattle(bool endbytimer);
void HideNpc(Creature * p_Creature);
void ShowNpc(Creature * p_Creature, bool p_Aggressive);
GraveYardVect GetGraveYardVect() { return m_GraveYardList; }
uint32 GetTimer() { return m_Timer; }
void SetTimer(uint32 timer) { m_Timer = timer; }
void PlaySoundToAll(uint32 SoundID);
void InvitePlayerToQueue(Player * plr);
void InvitePlayerToWar(Player * plr);
void InitStalker(uint32 entry, float x, float y, float z, float o);
protected:
uint64 StalkerGuid;
uint32 m_Timer; // Global timer for event
bool m_enable;
bool m_BattlefieldActive;
TeamId m_DefenderTeam;
// the map of the objectives belonging to this outdoorpvp
BfCapturePointMap m_capturePoints;
// the set of player
GuidSet m_players[BG_TEAMS_COUNT]; // Players in zone
GuidSet m_PlayersInQueue[BG_TEAMS_COUNT]; // Players in the queue
GuidSet m_PlayersInWar[BG_TEAMS_COUNT]; // Players in WG combat
PlayerTimerMap m_InvitedPlayers[BG_TEAMS_COUNT];
PlayerTimerMap m_PlayersWillBeKick[BG_TEAMS_COUNT];
//Variables that must exist for each battlefield
uint32 m_TypeId; // See enum BattlefieldTypes
uint32 m_BattleId; // BattleID (for packet)
uint32 m_ZoneId; // ZoneID of Wintergrasp = 4197
uint32 m_MapId; // MapId where is Battlefield
uint32 m_MaxPlayer; // Maximum number of player that participated to Battlefield
uint32 m_MinPlayer; // Minimum number of player for Battlefield start
uint32 m_MinLevel; // Required level to participate at Battlefield
uint32 m_BattleTime; // Length of a battle
uint32 m_NoWarBattleTime; // Time between two battles
uint32 m_RestartAfterCrash; // Delay to restart Wintergrasp if the server crashed during a running battle.
uint32 m_TimeForAcceptInvite;
uint32 m_uiKickDontAcceptTimer;
WorldLocation KickPosition; // Position where player is teleport if they switch to afk during battle or if they dont accept invitation
uint32 m_uiKickAfkTimer; // Timer for check Afk in war
//Graveyard variables
GraveYardVect m_GraveYardList; // Vector witch contain the different GY of the battle
uint32 m_LastResurectTimer; // Timer for resurect player every 30 sec
uint32 m_StartGroupingTimer; // Timer for invite players in area 15 minute before start battle
bool m_StartGrouping; // bool for know if all players in area has been invited
GuidSet m_Groups[BG_TEAMS_COUNT]; // Contain different raid group
std::vector < uint64 > m_Data64;
std::vector < uint32 > m_Data32;
void KickAfk();
// use for switch off all worldstate for client
virtual void SendRemoveWorldStates(Player * /*plr */ ) {}
// use for send a packet for all player list
void BroadcastPacketZone(WorldPacket & data) const;
void BroadcastPacketQueue(WorldPacket & data) const;
void BroadcastPacketWar(WorldPacket & data) const;
//CapturePoint system
void AddCapturePoint(BfCapturePoint * cp) { m_capturePoints[cp->GetCapturePointGo()->GetEntry()] = cp; }
BfCapturePoint *GetCapturePoint(uint32 lowguid) const
{
Battlefield::BfCapturePointMap::const_iterator itr = m_capturePoints.find(lowguid);
if (itr != m_capturePoints.end())
return itr->second;
return NULL;
}
void RegisterZone(uint32 zoneid);
bool HasPlayer(Player * plr) const;
void TeamCastSpell(TeamId team, int32 spellId);
};
#endif
@@ -1,152 +0,0 @@
/*
* Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "Common.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "WorldPacket.h"
#include "WorldSession.h"
#include "Battlefield.h"
#include "BattlefieldMgr.h"
#include "Opcodes.h"
//This send to player windows for invite player to join the war
//Param1:(BattleId) the BattleId of Bf
//Param2:(ZoneId) the zone where the battle is (4197 for wg)
//Param3:(time) Time in second that the player have for accept
void WorldSession::SendBfInvitePlayerToWar(uint32 BattleId, uint32 ZoneId, uint32 p_time)
{
//Send packet
WorldPacket data(SMSG_BATTLEFIELD_MGR_ENTRY_INVITE, 12);
data << uint32(BattleId);
data << uint32(ZoneId);
data << uint32((time(NULL) + p_time));
//Sending the packet to player
SendPacket(&data);
}
//This send invitation to player to join the queue
//Param1:(BattleId) the BattleId of Bf
void WorldSession::SendBfInvitePlayerToQueue(uint32 BattleId)
{
WorldPacket data(SMSG_BATTLEFIELD_MGR_QUEUE_INVITE, 5);
data << uint32(BattleId);
data << uint8(1); //warmup ? used ?
//Sending packet to player
SendPacket(&data);
}
//This send packet for inform player that he join queue
//Param1:(BattleId) the BattleId of Bf
//Param2:(ZoneId) the zone where the battle is (4197 for wg)
void WorldSession::SendBfQueueInviteResponce(uint32 BattleId, uint32 ZoneId)
{
WorldPacket data(SMSG_BATTLEFIELD_MGR_QUEUE_REQUEST_RESPONSE, 11);
data << uint32(BattleId);
data << uint32(ZoneId);
data << uint8(1); //Accepted
data << uint8(0); //Logging In
data << uint8(1); //Warmup
SendPacket(&data);
}
//This is call when player accept to join war
//Param1:(BattleId) the BattleId of Bf
void WorldSession::SendBfEntered(uint32 BattleId)
{
// m_PlayerInWar[plr->GetTeamId()].insert(plr->GetGUID());
WorldPacket data(SMSG_BATTLEFIELD_MGR_ENTERED, 7);
data << uint32(BattleId);
data << uint8(1); //unk
data << uint8(1); //unk
data << uint8(_player->isAFK() ? 1 : 0); //Clear AFK
SendPacket(&data);
}
//Send when player is kick from Battlefield
void WorldSession::SendBfLeaveMessage(uint32 BattleId)
{
WorldPacket data(SMSG_BATTLEFIELD_MGR_EJECTED, 7);
data << uint32(BattleId);
data << uint8(8); //byte Reason
data << uint8(2); //byte BattleStatus
data << uint8(0); //bool Relocated
SendPacket(&data);
}
//Send by client when he click on accept for queue
void WorldSession::HandleBfQueueInviteResponse(WorldPacket & recv_data)
{
uint32 BattleId;
uint8 Accepted;
recv_data >> BattleId >> Accepted;
sLog->outError("HandleQueueInviteResponse: BattleID:%u Accepted:%u", BattleId, Accepted);
Battlefield* Bf = sBattlefieldMgr.GetBattlefieldByBattleId(BattleId);
if (!Bf)
return;
if (Accepted)
{
Bf->PlayerAcceptInviteToQueue(_player);
}
}
//Send by client on clicking in accept or refuse of invitation windows for join game
void WorldSession::HandleBfEntryInviteResponse(WorldPacket & recv_data)
{
uint32 BattleId;
uint8 Accepted;
recv_data >> BattleId >> Accepted;
sLog->outError("HandleBattlefieldInviteResponse: BattleID:%u Accepted:%u", BattleId, Accepted);
Battlefield* Bf = sBattlefieldMgr.GetBattlefieldByBattleId(BattleId);
if (!Bf)
return;
//If player accept invitation
if (Accepted)
{
Bf->PlayerAcceptInviteToWar(_player);
}
else
{
if (_player->GetZoneId() == Bf->GetZoneId())
Bf->KickPlayerFromBf(_player->GetGUID());
}
}
void WorldSession::HandleBfExitRequest(WorldPacket & recv_data)
{
uint32 BattleId;
recv_data >> BattleId;
sLog->outError("HandleBfExitRequest: BattleID:%u ", BattleId);
Battlefield* Bf = sBattlefieldMgr.GetBattlefieldByBattleId(BattleId);
if (!Bf)
return;
Bf->AskToLeaveQueue(_player);
}
@@ -1,143 +0,0 @@
/*
* Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "BattlefieldMgr.h"
#include "Zones/BattlefieldWG.h"
#include "ObjectMgr.h"
#include "Player.h"
BattlefieldMgr::BattlefieldMgr()
{
m_UpdateTimer = 0;
//sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Instantiating BattlefieldMgr");
}
BattlefieldMgr::~BattlefieldMgr()
{
//sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Deleting BattlefieldMgr");
for (BattlefieldSet::iterator itr = m_BattlefieldSet.begin(); itr != m_BattlefieldSet.end(); ++itr)
delete *itr;
}
void BattlefieldMgr::InitBattlefield()
{
Battlefield* pBf = new BattlefieldWG;
// respawn, init variables
if (!pBf->SetupBattlefield())
{
sLog->outString();
sLog->outString("Battlefield : Wintergrasp init failed.");
delete pBf;
}
else
{
m_BattlefieldSet.push_back(pBf);
sLog->outString();
sLog->outString("Battlefield : Wintergrasp successfully initiated.");
}
/* For Cataclysm: Tol Barad
pBf = new BattlefieldTB;
// respawn, init variables
if(!pBf->SetupBattlefield())
{
sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Battlefield : Tol Barad init failed.");
delete pBf;
}
else
{
m_BattlefieldSet.push_back(pBf);
sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Battlefield : Tol Barad successfully initiated.");
} */
}
void BattlefieldMgr::AddZone(uint32 zoneid, Battlefield *handle)
{
m_BattlefieldMap[zoneid] = handle;
}
void BattlefieldMgr::HandlePlayerEnterZone(Player * plr, uint32 zoneid)
{
BattlefieldMap::iterator itr = m_BattlefieldMap.find(zoneid);
if (itr == m_BattlefieldMap.end())
return;
if (itr->second->HasPlayer(plr))
return;
if (itr->second->GetEnable() == false)
return;
itr->second->HandlePlayerEnterZone(plr, zoneid);
sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Player %u entered outdoorpvp id %u", plr->GetGUIDLow(), itr->second->GetTypeId());
}
void BattlefieldMgr::HandlePlayerLeaveZone(Player * plr, uint32 zoneid)
{
BattlefieldMap::iterator itr = m_BattlefieldMap.find(zoneid);
if (itr == m_BattlefieldMap.end())
return;
// teleport: remove once in removefromworld, once in updatezone
if (!itr->second->HasPlayer(plr))
return;
itr->second->HandlePlayerLeaveZone(plr, zoneid);
sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Player %u left outdoorpvp id %u", plr->GetGUIDLow(), itr->second->GetTypeId());
}
Battlefield *BattlefieldMgr::GetBattlefieldToZoneId(uint32 zoneid)
{
BattlefieldMap::iterator itr = m_BattlefieldMap.find(zoneid);
if (itr == m_BattlefieldMap.end())
{
// no handle for this zone, return
return NULL;
}
if (itr->second->GetEnable() == false)
return NULL;
return itr->second;
}
Battlefield *BattlefieldMgr::GetBattlefieldByBattleId(uint32 battleid)
{
for (BattlefieldSet::iterator itr = m_BattlefieldSet.begin(); itr != m_BattlefieldSet.end(); ++itr)
{
if ((*itr)->GetBattleId() == battleid)
return (*itr);
}
return NULL;
}
void BattlefieldMgr::Update(uint32 diff)
{
m_UpdateTimer += diff;
if (m_UpdateTimer > BATTLEFIELD_OBJECTIVE_UPDATE_INTERVAL)
{
for (BattlefieldSet::iterator itr = m_BattlefieldSet.begin(); itr != m_BattlefieldSet.end(); ++itr)
if ((*itr)->GetEnable())
(*itr)->Update(m_UpdateTimer);
m_UpdateTimer = 0;
}
}
ZoneScript *BattlefieldMgr::GetZoneScript(uint32 zoneId)
{
BattlefieldMap::iterator itr = m_BattlefieldMap.find(zoneId);
if (itr != m_BattlefieldMap.end())
return itr->second;
else
return NULL;
}
@@ -1,79 +0,0 @@
/*
* Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef BATTLEFIELD_MGR_H_
#define BATTLEFIELD_MGR_H_
#include "Battlefield.h"
#include "ace/Singleton.h"
class Player;
class GameObject;
class Creature;
class ZoneScript;
struct GossipMenuItems;
// class to handle player enter / leave / areatrigger / GO use events
class BattlefieldMgr
{
public:
// ctor
BattlefieldMgr();
// dtor
~BattlefieldMgr();
// create battlefield events
void InitBattlefield();
// called when a player enters an battlefield area
void HandlePlayerEnterZone(Player * plr, uint32 areaflag);
// called when player leaves an battlefield area
void HandlePlayerLeaveZone(Player * plr, uint32 areaflag);
// called when player resurrects
void HandlePlayerResurrects(Player * plr, uint32 areaflag);
// return assigned battlefield
Battlefield *GetBattlefieldToZoneId(uint32 zoneid);
Battlefield *GetBattlefieldByBattleId(uint32 battleid);
ZoneScript *GetZoneScript(uint32 zoneId);
void AddZone(uint32 zoneid, Battlefield * handle);
void Update(uint32 diff);
void HandleGossipOption(Player * player, uint64 guid, uint32 gossipid);
bool CanTalkTo(Player * player, Creature * creature, GossipMenuItems gso);
void HandleDropFlag(Player * plr, uint32 spellId);
typedef std::vector < Battlefield * >BattlefieldSet;
typedef std::map < uint32 /* zoneid */ , Battlefield * >BattlefieldMap;
private:
// contains all initiated battlefield events
// used when initing / cleaning up
BattlefieldSet m_BattlefieldSet;
// maps the zone ids to an battlefield event
// used in player event handling
BattlefieldMap m_BattlefieldMap;
// update interval
uint32 m_UpdateTimer;
};
#define sBattlefieldMgr (*ACE_Singleton<BattlefieldMgr, ACE_Null_Mutex>::instance())
#endif
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -1148,7 +1148,7 @@ void Battleground::AddOrSetPlayerToCorrectBgGroup(Player* player, uint32 team)
if (group->IsMember(playerGuid))
{
uint8 subgroup = group->GetMemberGroup(playerGuid);
player->SetBattlegroundOrBattlefieldRaid(group, subgroup);
player->SetBattlegroundRaid(group, subgroup);
}
else
{
-5
View File
@@ -17,7 +17,6 @@ file(GLOB_RECURSE sources_Achievements Achievements/*.cpp Achievements/*.h)
file(GLOB_RECURSE sources_Addons Addons/*.cpp Addons/*.h)
file(GLOB_RECURSE sources_AI AI/*.cpp AI/*.h)
file(GLOB_RECURSE sources_AuctionHouse AuctionHouse/*.cpp AuctionHouse/*.h)
file(GLOB_RECURSE sources_Battlefield Battlefield/*.cpp Battlefield/*.h)
file(GLOB_RECURSE sources_Battlegrounds Battlegrounds/*.cpp Battlegrounds/*.h)
file(GLOB_RECURSE sources_Calendar Calendar/*.cpp Calendar/*.h)
file(GLOB_RECURSE sources_Chat Chat/*.cpp Chat/*.h)
@@ -67,7 +66,6 @@ set(game_STAT_SRCS
${sources_Addons}
${sources_AI}
${sources_AuctionHouse}
${sources_Battlefield}
${sources_Battlegrounds}
${sources_Calendar}
${sources_Chat}
@@ -134,9 +132,6 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/AI/ScriptedAI
${CMAKE_CURRENT_SOURCE_DIR}/AI/SmartScripts
${CMAKE_CURRENT_SOURCE_DIR}/AuctionHouse
${CMAKE_CURRENT_SOURCE_DIR}/Battlefield
${CMAKE_CURRENT_SOURCE_DIR}/Battlefield/Zones
${CMAKE_CURRENT_SOURCE_DIR}/Battlegrounds
${CMAKE_CURRENT_SOURCE_DIR}/Battlegrounds/Zones
${CMAKE_CURRENT_SOURCE_DIR}/Calendar
@@ -831,13 +831,6 @@ bool GameObject::IsDynTransport() const
return gInfo->type == GAMEOBJECT_TYPE_MO_TRANSPORT || (gInfo->type == GAMEOBJECT_TYPE_TRANSPORT && !gInfo->transport.pause);
}
bool GameObject::IsDestructibleBuilding() const
{
GameObjectTemplate const* gInfo = GetGOInfo();
if (!gInfo) return false;
return gInfo->type == GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING;
}
Unit* GameObject::GetOwner() const
{
return ObjectAccessor::GetUnit(*this, GetOwnerGUID());
@@ -854,7 +847,7 @@ bool GameObject::isAlwaysVisibleFor(WorldObject const* seer) const
if (WorldObject::isAlwaysVisibleFor(seer))
return true;
if (IsTransport() || IsDestructibleBuilding())
if (IsTransport())
return true;
return false;
@@ -631,7 +631,6 @@ class GameObject : public WorldObject, public GridObject<GameObject>
bool IsTransport() const;
bool IsDynTransport() const;
bool IsDestructibleBuilding() const;
uint32 GetDBTableGUIDLow() const { return m_DBTableGuid; }
+2 -7
View File
@@ -41,7 +41,7 @@
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "SpellAuraEffects.h"
#include "BattlefieldMgr.h"
#include "TemporarySummon.h"
#include "Totem.h"
#include "OutdoorPvPMgr.h"
@@ -2210,12 +2210,7 @@ void WorldObject::SetZoneScript()
if (map->IsDungeon())
m_zoneScript = (ZoneScript*)((InstanceMap*)map)->GetInstanceScript();
else if (!map->IsBattlegroundOrArena())
{
if (Battlefield* bf = sBattlefieldMgr.GetBattlefieldToZoneId(GetZoneId()))
m_zoneScript = bf;
else
m_zoneScript = sOutdoorPvPMgr->GetZoneScript(GetZoneId());
}
m_zoneScript = sOutdoorPvPMgr->GetZoneScript(GetZoneId());
}
}
+4 -13
View File
@@ -70,7 +70,6 @@
#include "DisableMgr.h"
#include "WeatherMgr.h"
#include "LFGMgr.h"
#include "BattlefieldMgr.h"
#include "CharacterDatabaseCleaner.h"
#include "InstanceScript.h"
#include <cmath>
@@ -2406,7 +2405,6 @@ void Player::RemoveFromWorld()
StopCastingBindSight();
UnsummonPetTemporaryIfAny();
sOutdoorPvPMgr->HandlePlayerLeaveZone(this, m_zoneUpdateId);
sBattlefieldMgr.HandlePlayerLeaveZone(this, m_zoneUpdateId);
}
///- Do not add/remove the player from the object storage
@@ -5485,12 +5483,7 @@ void Player::RepopAtGraveyard()
if (Battleground *bg = GetBattleground())
ClosestGrave = bg->GetClosestGraveYard(this);
else
{
if (sBattlefieldMgr.GetBattlefieldToZoneId(GetZoneId()))
ClosestGrave = sBattlefieldMgr.GetBattlefieldToZoneId(GetZoneId())->GetClosestGraveYard(this);
else
ClosestGrave = sObjectMgr->GetClosestGraveYard(GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam());
}
ClosestGrave = sObjectMgr->GetClosestGraveYard(GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam());
// stop countdown until repop
m_deathTimer = 0;
@@ -7386,8 +7379,6 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea)
{
sOutdoorPvPMgr->HandlePlayerLeaveZone(this, m_zoneUpdateId);
sOutdoorPvPMgr->HandlePlayerEnterZone(this, newZone);
sBattlefieldMgr.HandlePlayerLeaveZone(this, m_zoneUpdateId);
sBattlefieldMgr.HandlePlayerEnterZone(this, newZone);
SendInitWorldStates(newZone, newArea); // only if really enters to new zone, not just area change, works strange...
}
@@ -7522,7 +7513,7 @@ void Player::CheckDuelDistance(time_t currTime)
bool Player::IsOutdoorPvPActive()
{
return isAlive() && !HasInvisibilityAura() && !HasStealthAura() && IsPvP() && !HasUnitMovementFlag(MOVEMENTFLAG_FLYING) && !isInFlight();
return isAlive() && !HasInvisibilityAura() && !HasStealthAura() && (IsPvP() || sWorld->IsPvPRealm()) && !HasUnitMovementFlag(MOVEMENTFLAG_FLYING) && !isInFlight();
}
void Player::DuelComplete(DuelCompleteType type)
@@ -22556,7 +22547,7 @@ bool Player::isUsingLfg()
return sLFGMgr->GetState(guid) != LFG_STATE_NONE;
}
void Player::SetBattlegroundOrBattlefieldRaid(Group *group, int8 subgroup)
void Player::SetBattlegroundRaid(Group* group, int8 subgroup)
{
//we must move references from m_group to m_originalGroup
SetOriginalGroup(GetGroup(), GetSubGroup());
@@ -22566,7 +22557,7 @@ void Player::SetBattlegroundOrBattlefieldRaid(Group *group, int8 subgroup)
m_group.setSubGroup((uint8)subgroup);
}
void Player::RemoveFromBattlegroundOrBattlefieldRaid()
void Player::RemoveFromBattlegroundRaid()
{
//remove existing reference
m_group.unlink();
+2 -2
View File
@@ -2378,8 +2378,8 @@ class Player : public Unit, public GridObject<Player>
Player* GetNextRandomRaidMember(float radius);
PartyResult CanUninviteFromGroup() const;
// Battleground Group System
void SetBattlegroundOrBattlefieldRaid(Group *group, int8 subgroup = -1);
void RemoveFromBattlegroundOrBattlefieldRaid();
void SetBattlegroundRaid(Group* group, int8 subgroup = -1);
void RemoveFromBattlegroundRaid();
Group * GetOriginalGroup() { return m_originalGroup.getTarget(); }
GroupReference& GetOriginalGroupRef() { return m_originalGroup; }
uint8 GetOriginalSubGroup() const { return m_originalGroup.getSubGroup(); }
+1 -6
View File
@@ -54,7 +54,7 @@
#include "Vehicle.h"
#include "Transport.h"
#include "InstanceScript.h"
#include "BattlefieldMgr.h"
#include <math.h>
float baseMoveSpeed[MAX_MOVE_TYPE] =
@@ -15487,14 +15487,9 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
// outdoor pvp things, do these after setting the death state, else the player activity notify won't work... doh...
// handle player kill only if not suicide (spirit of redemption for example)
if (player && this != victim)
{
if (OutdoorPvP* pvp = player->GetOutdoorPvP())
pvp->HandleKill(player, victim);
if (Battlefield* bf = sBattlefieldMgr.GetBattlefieldToZoneId(player->GetZoneId()))
bf->HandleKill(player, victim);
}
//if (pVictim->GetTypeId() == TYPEID_PLAYER)
// if (OutdoorPvP* pvp = pVictim->ToPlayer()->GetOutdoorPvP())
// pvp->HandlePlayerActivityChangedpVictim->ToPlayer();
+1 -20
View File
@@ -178,13 +178,8 @@ void Vehicle::ApplyAllImmunities()
// Different immunities for vehicles goes below
switch (GetVehicleInfo()->m_ID)
{
case 160: //Isle of conquest turret
case 244: //Wintergrasp turret
case 160:
_me->SetControlled(true, UNIT_STAT_ROOT);
//me->AddUnitMovementFlag(MOVEMENTFLAG_ROOT);
//me->SetSpeed(MOVE_TURN_RATE, 0.7f);
//me->SetSpeed(MOVE_PITCH_RATE, 0.7f);
//me->m_movementInfo.flags2=59;
_me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_DECREASE_SPEED, true);
break;
default:
@@ -469,20 +464,6 @@ void Vehicle::Dismiss()
_me->AddObjectToRemoveList();
}
void Vehicle::TeleportVehicle(float x, float y, float z, float ang)
{
vehiclePlayers.clear();
for(int8 i = 0; i < 8; i++)
if (Unit* player = GetPassenger(i))
vehiclePlayers.insert(player->GetGUID());
RemoveAllPassengers(); // this can unlink Guns from Siege Engines
_me->NearTeleportTo(x, y, z, ang);
for (GuidSet::const_iterator itr = vehiclePlayers.begin(); itr != vehiclePlayers.end(); ++itr)
if(Unit* plr = sObjectAccessor->FindUnit(*itr))
plr->NearTeleportTo(x, y, z, ang);
}
void Vehicle::InitMovementInfoForBase()
{
uint32 vehicleFlags = GetVehicleInfo()->m_flags;
@@ -98,7 +98,6 @@ struct VehicleAccessory
typedef std::vector<VehicleAccessory> VehicleAccessoryList;
typedef std::map<uint32, VehicleAccessoryList> VehicleAccessoryMap;
typedef std::map<int8, VehicleSeat> SeatMap;
typedef std::set<uint64> GuidSet;
class Vehicle
{
@@ -130,7 +129,6 @@ class Vehicle
void RelocatePassengers(float x, float y, float z, float ang);
void RemoveAllPassengers();
void Dismiss();
void TeleportVehicle(float x, float y, float z, float ang);
bool IsVehicleInUse() { return Seats.begin() != Seats.end(); }
SeatMap Seats;
@@ -146,7 +144,6 @@ class Vehicle
Unit* _me;
VehicleEntry const* _vehicleInfo;
GuidSet vehiclePlayers;
uint32 _usableSeatNum; // Number of seats that match VehicleSeatEntry::UsableByPlayer, used for proper display flags
uint32 _creatureEntry; // Can be different than me->GetBase()->GetEntry() in case of players
};
-1
View File
@@ -194,7 +194,6 @@ class ObjectAccessor
// ACCESS LIKE THAT IS NOT THREAD SAFE
static Pet * FindPet(uint64);
static Player* FindPlayer(uint64);
static Creature* FindCreature(uint64);
static Unit* FindUnit(uint64);
Player* FindPlayerByName(const char* name);
-5
View File
@@ -836,11 +836,6 @@ class ObjectMgr
return &mCreatureQuestRelations;
}
QuestRelations* GetCreatureQuestInvolvedRelation()
{
return &mCreatureQuestInvolvedRelations;
}
QuestRelationBounds GetCreatureQuestRelationBounds(uint32 creature_entry)
{
return mCreatureQuestRelations.equal_range(creature_entry);
+24 -34
View File
@@ -57,7 +57,7 @@ Loot* Roll::getLoot()
Group::Group() : m_leaderGuid(0), m_leaderName(""), m_groupType(GROUPTYPE_NORMAL),
m_dungeonDifficulty(DUNGEON_DIFFICULTY_NORMAL), m_raidDifficulty(RAID_DIFFICULTY_10MAN_NORMAL),
m_bgGroup(NULL), m_bfGroup(NULL), m_lootMethod(FREE_FOR_ALL), m_lootThreshold(ITEM_QUALITY_UNCOMMON), m_looterGuid(0),
m_bgGroup(NULL), m_lootMethod(FREE_FOR_ALL), m_lootThreshold(ITEM_QUALITY_UNCOMMON), m_looterGuid(0),
m_subGroupsCounts(NULL), m_guid(0), m_counter(0), m_maxEnchantingLevel(0), m_dbStoreId(0)
{
for (uint8 i = 0; i < TARGETICONCOUNT; ++i)
@@ -102,7 +102,7 @@ bool Group::Create(Player *leader)
m_leaderGuid = leaderGuid;
m_leaderName = leader->GetName();
m_groupType = (isBGGroup() || isBFGroup()) ? GROUPTYPE_BGRAID : GROUPTYPE_NORMAL;
m_groupType = isBGGroup() ? GROUPTYPE_BGRAID : GROUPTYPE_NORMAL;
if (m_groupType & GROUPTYPE_RAID)
_initRaidSubGroupsCounter();
@@ -114,7 +114,7 @@ bool Group::Create(Player *leader)
m_dungeonDifficulty = DUNGEON_DIFFICULTY_NORMAL;
m_raidDifficulty = RAID_DIFFICULTY_10MAN_NORMAL;
if (!isBGGroup() || !isBFGroup())
if (!isBGGroup())
{
m_dungeonDifficulty = leader->GetDungeonDifficulty();
m_raidDifficulty = leader->GetRaidDifficulty();
@@ -200,7 +200,7 @@ void Group::ConvertToLFG()
{
m_groupType = GroupType(m_groupType | GROUPTYPE_LFG | GROUPTYPE_UNK1);
m_lootMethod = NEED_BEFORE_GREED;
if (!isBGGroup() && !isBFGroup())
if (!isBGGroup())
CharacterDatabase.PExecute("UPDATE groups SET groupType='%u' WHERE guid='%u'", uint8(m_groupType), m_dbStoreId);
SendUpdate();
}
@@ -211,7 +211,7 @@ void Group::ConvertToRaid()
_initRaidSubGroupsCounter();
if (!isBGGroup() && !isBFGroup())
if (!isBGGroup())
CharacterDatabase.PExecute("UPDATE groups SET groupType='%u' WHERE guid='%u'", uint8(m_groupType), m_dbStoreId);
SendUpdate();
@@ -226,7 +226,7 @@ bool Group::AddInvite(Player* player)
if (!player || player->GetGroupInvite())
return false;
Group* group = player->GetGroup();
if (group && (group->isBGGroup() || group->isBFGroup()))
if (group && group->isBGGroup())
group = player->GetOriginalGroup();
if (group)
return false;
@@ -323,8 +323,8 @@ bool Group::AddMember(Player* player)
if (player)
{
player->SetGroupInvite(NULL);
if (player->GetGroup() && (isBGGroup() || isBFGroup())) //if player is in group and he is being added to BG raid group, then call SetBattlegroundRaid()
player->SetBattlegroundOrBattlefieldRaid(this, subGroup);
if (player->GetGroup() && isBGGroup()) //if player is in group and he is being added to BG raid group, then call SetBattlegroundRaid()
player->SetBattlegroundRaid(this, subGroup);
else if (player->GetGroup()) //if player is in bg raid and we are adding him to normal group, then call SetOriginalGroup()
player->SetOriginalGroup(this, subGroup);
else //if player is not in group, then call set group
@@ -343,7 +343,7 @@ bool Group::AddMember(Player* player)
}
// insert into the table if we're not a battleground group
if (!isBGGroup() || !isBFGroup())
if (!isBGGroup())
CharacterDatabase.PExecute("INSERT INTO group_member (guid, memberGuid, memberFlags, subgroup, roles) VALUES(%u, %u, %u, %u, %u)",
m_dbStoreId, GUID_LOPART(member.guid), member.flags, member.group, member.roles);
@@ -352,7 +352,7 @@ bool Group::AddMember(Player* player)
if (player)
{
if (!IsLeader(player->GetGUID()) && !isBGGroup() && !isBFGroup())
if (!IsLeader(player->GetGUID()) && !isBGGroup())
{
// reset the new member's instances, unless he is currently in one of them
// including raid/heroic instances that they are not permanently bound to!
@@ -397,15 +397,15 @@ bool Group::RemoveMember(const uint64 &guid, const RemoveMethod &method /*= GROU
if (isLFGGroup() && method == GROUP_REMOVEMETHOD_KICK)
return m_memberSlots.size();
// remove member and change leader (if need) only if strong more 2 members _before_ member remove (BG/BF allow 1 member group)
if (GetMembersCount() > ((isBGGroup() || isBFGroup()) ? 1u : 2u))
// remove member and change leader (if need) only if strong more 2 members _before_ member remove (BG allow 1 member group)
if (GetMembersCount() > (isBGGroup() ? 1u : 2u))
{
Player* player = sObjectMgr->GetPlayer(guid);
if (player)
{
// Battleground group handling
if (isBGGroup() || isBFGroup())
player->RemoveFromBattlegroundOrBattlefieldRaid();
if (isBGGroup())
player->RemoveFromBattlegroundRaid();
else
// Regular group
{
@@ -513,7 +513,7 @@ void Group::ChangeLeader(const uint64 &guid)
sScriptMgr->OnGroupChangeLeader(this, m_leaderGuid, guid);
if (!isBGGroup() || !isBFGroup())
if (!isBGGroup())
{
// Remove the groups permanent instance bindings
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
@@ -563,8 +563,8 @@ void Group::Disband(bool hideDestroy /* = false */)
//we cannot call _removeMember because it would invalidate member iterator
//if we are removing player from battleground raid
if (isBGGroup() || isBFGroup())
player->RemoveFromBattlegroundOrBattlefieldRaid();
if (isBGGroup())
player->RemoveFromBattlegroundRaid();
else
{
//we can remove player who is in battleground from his original group
@@ -608,7 +608,7 @@ void Group::Disband(bool hideDestroy /* = false */)
RemoveAllInvites();
if (!isBGGroup() || !isBFGroup())
if (!isBGGroup())
{
SQLTransaction trans = CharacterDatabase.BeginTransaction();
trans->PAppend("DELETE FROM groups WHERE guid = %u", m_dbStoreId);
@@ -1213,7 +1213,7 @@ void Group::SendUpdate()
Player* member = sObjectMgr->GetPlayer(citr2->guid);
uint8 onlineState = (member) ? MEMBER_STATUS_ONLINE : MEMBER_STATUS_OFFLINE;
onlineState = onlineState | ((isBGGroup() || isBFGroup()) ? MEMBER_STATUS_PVP : 0);
onlineState = onlineState | ((isBGGroup()) ? MEMBER_STATUS_PVP : 0);
data << citr2->name;
data << uint64(citr2->guid); // guid
@@ -1305,7 +1305,7 @@ bool Group::_setMembersGroup(const uint64 &guid, const uint8 &group)
SubGroupCounterIncrease(group);
if (!isBGGroup() || !isBFGroup())
if (!isBGGroup())
CharacterDatabase.PExecute("UPDATE group_member SET subgroup='%u' WHERE memberGuid='%u'", group, GUID_LOPART(guid));
return true;
@@ -1538,7 +1538,7 @@ void Roll::targetObjectBuildLink()
void Group::SetDungeonDifficulty(Difficulty difficulty)
{
m_dungeonDifficulty = difficulty;
if (!isBGGroup() || !isBFGroup())
if (!isBGGroup())
CharacterDatabase.PExecute("UPDATE groups SET difficulty = %u WHERE guid ='%u'", m_dungeonDifficulty, m_dbStoreId);
for (GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next())
@@ -1555,7 +1555,7 @@ void Group::SetDungeonDifficulty(Difficulty difficulty)
void Group::SetRaidDifficulty(Difficulty difficulty)
{
m_raidDifficulty = difficulty;
if (!isBGGroup() || !isBFGroup())
if (!isBGGroup())
CharacterDatabase.PExecute("UPDATE groups SET raiddifficulty = %u WHERE guid ='%u'", m_raidDifficulty, m_dbStoreId);
for (GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next())
@@ -1584,7 +1584,7 @@ bool Group::InCombatToInstance(uint32 instanceId)
void Group::ResetInstances(uint8 method, bool isRaid, Player* SendMsgTo)
{
if (isBGGroup() || isBFGroup())
if (isBGGroup())
return;
// method can be INSTANCE_RESET_ALL, INSTANCE_RESET_CHANGE_DIFFICULTY, INSTANCE_RESET_GROUP_DISBAND
@@ -1692,7 +1692,7 @@ InstanceGroupBind* Group::GetBoundInstance(MapEntry const* mapEntry)
InstanceGroupBind* Group::BindToInstance(InstanceSave *save, bool permanent, bool load)
{
if (!save || isBGGroup() || isBFGroup())
if (!save || isBGGroup())
return NULL;
InstanceGroupBind& bind = m_boundInstances[save->GetDifficulty()][save->GetMapId()];
@@ -1807,11 +1807,6 @@ bool Group::isBGGroup() const
return m_bgGroup != NULL;
}
bool Group::isBFGroup() const
{
return m_bfGroup != NULL;
}
bool Group::IsCreated() const
{
return GetMembersCount() > 0;
@@ -1927,11 +1922,6 @@ void Group::SetBattlegroundGroup(Battleground *bg)
m_bgGroup = bg;
}
void Group::SetBattlefieldGroup(Battlefield *bg)
{
m_bfGroup = bg;
}
void Group::SetGroupMemberFlag(uint64 guid, const bool &apply, GroupMemberFlags flag)
{
// Assistants, main assistants and main tanks are only available in raid groups
-4
View File
@@ -26,7 +26,6 @@
#include "QueryResult.h"
#include "SharedDefines.h"
#include "Player.h"
#include "../../Battlefield/BattlefieldMgr.h" //FIXME
class Creature;
class GroupReference;
@@ -205,7 +204,6 @@ class Group
bool IsFull() const;
bool isLFGGroup() const;
bool isRaidGroup() const;
bool isBFGroup() const;
bool isBGGroup() const;
bool IsCreated() const;
const uint64& GetLeaderGUID() const;
@@ -241,7 +239,6 @@ class Group
void ConvertToRaid();
void SetBattlegroundGroup(Battleground *bg);
void SetBattlefieldGroup(Battlefield *bf);
GroupJoinBattlegroundResult CanJoinBattlegroundQueue(Battleground const* bgOrTemplate, BattlegroundQueueTypeId bgQueueTypeId, uint32 MinPlayerCount, uint32 MaxPlayerCount, bool isRated, uint32 arenaSlot);
void ChangeMembersGroup(const uint64 &guid, const uint8 &group);
@@ -322,7 +319,6 @@ class Group
GroupType m_groupType;
Difficulty m_dungeonDifficulty;
Difficulty m_raidDifficulty;
Battlefield* m_bfGroup;
Battleground* m_bgGroup;
uint64 m_targetIcons[TARGETICONCOUNT];
LootMethod m_lootMethod;
+1 -1
View File
@@ -250,7 +250,7 @@ class Quest
bool IsWeekly() const { return QuestFlags & QUEST_FLAGS_WEEKLY; }
bool IsDailyOrWeekly() const { return QuestFlags & (QUEST_FLAGS_DAILY | QUEST_FLAGS_WEEKLY); }
bool IsAutoAccept() const { return QuestFlags & QUEST_FLAGS_AUTO_ACCEPT; }
bool IsRaidQuest() const { return Type == QUEST_TYPE_RAID || Type == QUEST_TYPE_RAID_10 || Type == QUEST_TYPE_RAID_25 || Type == QUEST_TYPE_PVP; }
bool IsRaidQuest() const { return Type == QUEST_TYPE_RAID || Type == QUEST_TYPE_RAID_10 || Type == QUEST_TYPE_RAID_25; }
bool IsAllowedInRaid() const;
bool IsDFQuest() const { return QuestFlags & QUEST_TRINITY_FLAGS_DF_QUEST; }
uint32 CalculateHonorGain(uint8 level) const;
@@ -45,7 +45,6 @@ void AddSC_SmartSCripts();
//Commands
void AddSC_account_commandscript();
void AddSC_achievement_commandscript();
void AddSC_bf_commandscript();
void AddSC_debug_commandscript();
void AddSC_event_commandscript();
void AddSC_gm_commandscript();
@@ -645,7 +644,6 @@ void AddCommandScripts()
{
AddSC_account_commandscript();
AddSC_achievement_commandscript();
AddSC_bf_commandscript();
AddSC_debug_commandscript();
AddSC_event_commandscript();
AddSC_gm_commandscript();
-8
View File
@@ -753,14 +753,6 @@ CreatureAI* ScriptMgr::GetCreatureAI(Creature* creature)
return tmpscript->GetAI(creature);
}
GameObjectAI* ScriptMgr::GetGameObjectAI(GameObject* gameobject)
{
ASSERT(gameobject);
GET_SCRIPT_RET(GameObjectScript, gameobject->GetScriptId(), tmpscript, NULL);
return tmpscript->GetAI(gameobject);
}
void ScriptMgr::OnCreatureUpdate(Creature* creature, uint32 diff)
{
ASSERT(creature);
-5
View File
@@ -37,7 +37,6 @@ class Channel;
class ChatCommand;
class Creature;
class CreatureAI;
class GameObjectAI;
class DynamicObject;
class GameObject;
class Guild;
@@ -469,9 +468,6 @@ class GameObjectScript : public ScriptObject, public UpdatableScript<GameObject>
virtual void OnDestroyed(GameObject* /*go*/, Player* /*player*/, uint32 /*eventId*/) { }
// Called when the gameobject is damaged (destructible buildings only).
virtual void OnDamaged(GameObject* /*go*/, Player* /*player*/, uint32 /*eventId*/) { }
// Called when a CreatureAI object is needed for the creature.
virtual GameObjectAI* GetAI(GameObject* /*gameobject*/) const { return NULL; }
};
class AreaTriggerScript : public ScriptObject
@@ -871,7 +867,6 @@ class ScriptMgr
uint32 GetDialogStatus(Player* player, GameObject* go);
void OnGameObjectDestroyed(GameObject* go, Player* player, uint32 eventId);
void OnGameObjectDamaged(GameObject* go, Player* player, uint32 eventId);
GameObjectAI* GetGameObjectAI(GameObject* gameobject);
void OnGameObjectUpdate(GameObject* go, uint32 diff);
public: /* AreaTriggerScript */
@@ -586,6 +586,46 @@ void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket & /*recv_data*/)
}
}
void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket & recv_data)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUERY");
Battleground *bg = _player->GetBattleground();
uint64 guid;
recv_data >> guid;
Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
if (!unit)
return;
if (!unit->isSpiritService()) // it's not spirit service
return;
if (bg)
sBattlegroundMgr->SendAreaSpiritHealerQueryOpcode(_player, bg, guid);
}
void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket & recv_data)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUEUE");
Battleground *bg = _player->GetBattleground();
uint64 guid;
recv_data >> guid;
Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
if (!unit)
return;
if (!unit->isSpiritService()) // it's not spirit service
return;
if (bg)
bg->AddPlayerToResurrectQueue(guid, _player->GetGUID());
}
void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recv_data)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_BATTLEMASTER_JOIN_ARENA");
@@ -36,8 +36,7 @@
#include "zlib.h"
#include "ObjectAccessor.h"
#include "Object.h"
#include "BattlegroundMgr.h"
#include "BattlefieldMgr.h"
#include "Battleground.h"
#include "OutdoorPvP.h"
#include "Pet.h"
#include "SocialMgr.h"
@@ -1724,64 +1723,11 @@ void WorldSession::SendSetPhaseShift(uint32 PhaseShift)
SendPacket(&data);
}
//Battlefield and Battleground
void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket & recv_data)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUERY");
Battleground* bg = _player->GetBattleground();
uint64 guid;
recv_data >> guid;
Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
if (!unit)
return;
if (!unit->isSpiritService()) // it's not spirit service
return;
if (bg)
sBattlegroundMgr->SendAreaSpiritHealerQueryOpcode(_player, bg, guid);
if (Battlefield* bf = sBattlefieldMgr.GetBattlefieldToZoneId(_player->GetZoneId()))
bf->SendAreaSpiritHealerQueryOpcode(_player,guid);
}
void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket & recv_data)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUEUE");
Battleground* bg = _player->GetBattleground();
uint64 guid;
recv_data >> guid;
Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
if (!unit)
return;
if (!unit->isSpiritService()) // it's not spirit service
return;
if (bg)
bg->AddPlayerToResurrectQueue(guid, _player->GetGUID());
if (Battlefield* bf = sBattlefieldMgr.GetBattlefieldToZoneId(_player->GetZoneId()))
bf->AddPlayerToResurrectQueue(guid, _player->GetGUID());
}
void WorldSession::HandleHearthAndResurrect(WorldPacket& /*recv_data*/)
{
if (_player->isInFlight())
return;
if(Battlefield* bf = sBattlefieldMgr.GetBattlefieldToZoneId(_player->GetZoneId()))
{
// bf->PlayerAskToLeave(_player); FIXME
return;
}
AreaTableEntry const *atEntry = GetAreaEntryByAreaID(_player->GetAreaId());
if (!atEntry || !(atEntry->flags & AREA_FLAG_WINTERGRASP_2))
return;
+3 -3
View File
@@ -1273,15 +1273,15 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] =
/*0x4DC*/ { "UMSG_UNKNOWN_1244", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
/*0x4DD*/ { "UMSG_UNKNOWN_1245", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
/*0x4DE*/ { "SMSG_BATTLEFIELD_MGR_ENTRY_INVITE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x4DF*/ { "CMSG_BATTLEFIELD_MGR_ENTRY_INVITE_RESPONSE", STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleBfEntryInviteResponse },
/*0x4DF*/ { "CMSG_BATTLEFIELD_MGR_ENTRY_INVITE_RESPONSE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
/*0x4E0*/ { "SMSG_BATTLEFIELD_MGR_ENTERED", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x4E1*/ { "SMSG_BATTLEFIELD_MGR_QUEUE_INVITE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x4E2*/ { "CMSG_BATTLEFIELD_MGR_QUEUE_INVITE_RESPONSE", STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleBfQueueInviteResponse },
/*0x4E2*/ { "CMSG_BATTLEFIELD_MGR_QUEUE_INVITE_RESPONSE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
/*0x4E3*/ { "CMSG_BATTLEFIELD_MGR_QUEUE_REQUEST", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
/*0x4E4*/ { "SMSG_BATTLEFIELD_MGR_QUEUE_REQUEST_RESPONSE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x4E5*/ { "SMSG_BATTLEFIELD_MGR_EJECT_PENDING", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x4E6*/ { "SMSG_BATTLEFIELD_MGR_EJECTED", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x4E7*/ { "CMSG_BATTLEFIELD_MGR_EXIT_REQUEST", STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleBfExitRequest },
/*0x4E7*/ { "CMSG_BATTLEFIELD_MGR_EXIT_REQUEST", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
/*0x4E8*/ { "SMSG_BATTLEFIELD_MGR_STATE_CHANGE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x4E9*/ { "UMSG_UNKNOWN_1257", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
/*0x4EA*/ { "UMSG_UNKNOWN_1258", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
-10
View File
@@ -785,16 +785,6 @@ class WorldSession
void HandleHearthAndResurrect(WorldPacket& recv_data);
void HandleInstanceLockResponse(WorldPacket& recvPacket);
// Battlefield
void SendBfInvitePlayerToWar(uint32 BattleId,uint32 ZoneId,uint32 time);
void SendBfInvitePlayerToQueue(uint32 BattleId);
void SendBfQueueInviteResponce(uint32 BattleId,uint32 ZoneId);
void SendBfEntered(uint32 BattleId);
void SendBfLeaveMessage(uint32 BattleId);
void HandleBfQueueInviteResponse(WorldPacket &recv_data);
void HandleBfEntryInviteResponse(WorldPacket &recv_data);
void HandleBfExitRequest(WorldPacket &recv_data);
// Looking for Dungeon/Raid
void HandleLfgSetCommentOpcode(WorldPacket & recv_data);
void HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& recv_data);
@@ -35,7 +35,6 @@
#include "GridNotifiersImpl.h"
#include "CellImpl.h"
#include "ScriptMgr.h"
#include "BattlefieldMgr.h"
class Aura;
//
@@ -4816,12 +4815,8 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
case 2584: // Waiting to Resurrect
// Waiting to resurrect spell cancel, we must remove player from resurrect queue
if (target->GetTypeId() == TYPEID_PLAYER)
{
if (Battleground* bg = target->ToPlayer()->GetBattleground())
if (Battleground *bg = target->ToPlayer()->GetBattleground())
bg->RemovePlayerFromResurrectQueue(target->GetGUID());
if(Battlefield* bf = sBattlefieldMgr.GetBattlefieldToZoneId(target->GetZoneId()))
bf->RemovePlayerFromResurrectQueue(target->GetGUID());
}
break;
case 36730: // Flame Strike
{
@@ -4858,7 +4853,6 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
target->CastSpell((Unit*)NULL, GetAmount(), true, NULL, this);
break;
case 58600: // Restricted Flight Area
case 58730: // Restricted Flight Area
if (aurApp->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
target->CastSpell(target, 58601, true);
break;
+1 -3
View File
@@ -52,7 +52,6 @@
#include "DisableMgr.h"
#include "SpellScript.h"
#include "InstanceScript.h"
#include "BattlefieldMgr.h"
extern pEffect SpellEffects[TOTAL_SPELL_EFFECTS];
@@ -5473,9 +5472,8 @@ SpellCastResult Spell::CheckCast(bool strict)
// allow always ghost flight spells
if (m_originalCaster && m_originalCaster->GetTypeId() == TYPEID_PLAYER && m_originalCaster->isAlive())
{
Battlefield* Bf = sBattlefieldMgr.GetBattlefieldToZoneId(m_originalCaster->GetZoneId());
if (AreaTableEntry const* pArea = GetAreaEntryByAreaID(m_originalCaster->GetAreaId()))
if ((pArea->flags & AREA_FLAG_NO_FLY_ZONE) || (Bf && !Bf->CanFlyIn()))
if (pArea->flags & AREA_FLAG_NO_FLY_ZONE)
return m_IsTriggeredSpell ? SPELL_FAILED_DONT_REPORT : SPELL_FAILED_NOT_HERE;
}
break;
-1
View File
@@ -6976,7 +6976,6 @@ void Spell::EffectPlayerNotification(SpellEffIndex effIndex)
case 58730: // Restricted Flight Area
case 58600: // Restricted Flight Area
unitTarget->ToPlayer()->GetSession()->SendNotification(LANG_ZONE_NOFLYZONE);
unitTarget->PlayDirectSound(9417); // Fel Reaver sound
break;
}
-21
View File
@@ -25,7 +25,6 @@
#include "Chat.h"
#include "Spell.h"
#include "BattlegroundMgr.h"
#include "BattlefieldMgr.h"
#include "CreatureAI.h"
#include "MapManager.h"
#include "BattlegroundIC.h"
@@ -3290,26 +3289,6 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32
return false;
break;
}
case 58730: // No fly Zone - Wintergrasp
{
if (!player)
return false;
Battlefield* Bf = sBattlefieldMgr.GetBattlefieldToZoneId(player->GetZoneId());
if (!Bf || Bf->CanFlyIn() || (!player->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) && !player->HasAuraType(SPELL_AURA_FLY)))
return false;
break;
}
case 57940: // Essence of Wintergrasp - Northrend
{
if (!player)
return false;
Battlefield* Bf = sBattlefieldMgr.GetBattlefieldToZoneId(4197);
if (!Bf || player->GetTeamId() != Bf->GetDefenderTeam())
return false;
break;
}
case SPELL_OIL_REFINERY: // Oil Refinery - Isle of Conquest.
case SPELL_QUARRY: // Quarry - Isle of Conquest.
{
-17
View File
@@ -50,7 +50,6 @@
#include "MapManager.h"
#include "CreatureAIRegistry.h"
#include "BattlegroundMgr.h"
#include "BattlefieldMgr.h"
#include "OutdoorPvPMgr.h"
#include "TemporarySummon.h"
#include "WaypointMovementGenerator.h"
@@ -1185,15 +1184,6 @@ void World::LoadConfigSettings(bool reload)
// MySQL ping time interval
m_int_configs[CONFIG_DB_PING_INTERVAL] = sConfig->GetIntDefault("MaxPingTime", 30);
// Wintergrasp
m_bool_configs[CONFIG_WINTERGRASP_ENABLE] = sConfig->GetBoolDefault("Wintergrasp.Enable", false);
m_int_configs[CONFIG_WINTERGRASP_PLR_MAX] = sConfig->GetIntDefault("Wintergrasp.PlayerMax", 100);
m_int_configs[CONFIG_WINTERGRASP_PLR_MIN] = sConfig->GetIntDefault("Wintergrasp.PlayerMin", 0);
m_int_configs[CONFIG_WINTERGRASP_PLR_MIN_LVL] = sConfig->GetIntDefault("Wintergrasp.PlayerMinLvl", 77);
m_int_configs[CONFIG_WINTERGRASP_BATTLETIME] = sConfig->GetIntDefault("Wintergrasp.BattleTimer", 30);
m_int_configs[CONFIG_WINTERGRASP_NOBATTLETIME] = sConfig->GetIntDefault("Wintergrasp.NoBattleTimer", 150);
m_int_configs[CONFIG_WINTERGRASP_RESTART_AFTER_CRASH] = sConfig->GetIntDefault("Wintergrasp.CrashRestartTimer", 10);
sScriptMgr->OnConfigLoad(reload);
}
@@ -1708,10 +1698,6 @@ void World::SetInitialWorldSettings()
sLog->outString("Starting Outdoor PvP System");
sOutdoorPvPMgr->InitOutdoorPvP();
///- Initialize Battlefield
sLog->outString("Starting Battlefield System");
sBattlefieldMgr.InitBattlefield();
sLog->outString("Loading Transports...");
sMapMgr->LoadTransports();
@@ -1962,9 +1948,6 @@ void World::Update(uint32 diff)
sOutdoorPvPMgr->Update(diff);
RecordTimeDiff("UpdateOutdoorPvPMgr");
sBattlefieldMgr.Update(diff);
RecordTimeDiff("BattlefieldMgr");
///- Delete all characters which have been deleted X days before
if (m_timers[WUPDATE_DELETECHARS].Passed())
{
-7
View File
@@ -158,7 +158,6 @@ enum WorldBoolConfigs
CONFIG_ALLOW_TICKETS,
CONFIG_DBC_ENFORCE_ITEM_ATTRIBUTES,
CONFIG_PRESERVE_CUSTOM_CHANNELS,
CONFIG_WINTERGRASP_ENABLE,
BOOL_CONFIG_VALUE_COUNT
};
@@ -307,12 +306,6 @@ enum WorldIntConfigs
CONFIG_PRESERVE_CUSTOM_CHANNEL_DURATION,
CONFIG_PERSISTENT_CHARACTER_CLEAN_FLAGS,
CONFIG_MAX_INSTANCES_PER_HOUR,
CONFIG_WINTERGRASP_PLR_MAX,
CONFIG_WINTERGRASP_PLR_MIN,
CONFIG_WINTERGRASP_PLR_MIN_LVL,
CONFIG_WINTERGRASP_BATTLETIME,
CONFIG_WINTERGRASP_NOBATTLETIME,
CONFIG_WINTERGRASP_RESTART_AFTER_CRASH,
INT_CONFIG_VALUE_COUNT
};