mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
@@ -213,6 +213,10 @@ class TC_GAME_API Battlefield : public ZoneScript
|
||||
public:
|
||||
/// Constructor
|
||||
explicit Battlefield(Map* map);
|
||||
Battlefield(Battlefield const& right) = delete;
|
||||
Battlefield(Battlefield&& right) = delete;
|
||||
Battlefield& operator=(Battlefield const& right) = delete;
|
||||
Battlefield& operator=(Battlefield&& right) = delete;
|
||||
/// Destructor
|
||||
virtual ~Battlefield();
|
||||
|
||||
|
||||
@@ -1929,9 +1929,10 @@ WorldSafeLocsEntry const* Battleground::GetClosestGraveyard(Player* player)
|
||||
return sObjectMgr->GetClosestGraveyard(*player, GetPlayerTeam(player->GetGUID()), player);
|
||||
}
|
||||
|
||||
void Battleground::TriggerGameEvent(uint32 gameEventId)
|
||||
void Battleground::TriggerGameEvent(uint32 gameEventId, WorldObject* source /*= nullptr*/, WorldObject* target /*= nullptr*/)
|
||||
{
|
||||
GameEvents::TriggerForMap(gameEventId, GetBgMap());
|
||||
ProcessEvent(target, gameEventId, source);
|
||||
GameEvents::TriggerForMap(gameEventId, GetBgMap(), source, target);
|
||||
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(itr->first))
|
||||
GameEvents::TriggerForPlayer(gameEventId, player);
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "ObjectGuid.h"
|
||||
#include "Position.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "ZoneScript.h"
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
@@ -250,7 +251,7 @@ This class is used to:
|
||||
3. some certain cases, same for all battlegrounds
|
||||
4. It has properties same for all battlegrounds
|
||||
*/
|
||||
class TC_GAME_API Battleground
|
||||
class TC_GAME_API Battleground : public ZoneScript
|
||||
{
|
||||
public:
|
||||
Battleground(BattlegroundTemplate const* battlegroundTemplate);
|
||||
@@ -271,7 +272,7 @@ class TC_GAME_API Battleground
|
||||
|
||||
virtual void DestroyGate(Player* /*player*/, GameObject* /*go*/) { }
|
||||
|
||||
void TriggerGameEvent(uint32 gameEventId);
|
||||
void TriggerGameEvent(uint32 gameEventId, WorldObject* source = nullptr, WorldObject* target = nullptr) override;
|
||||
|
||||
/* Battleground */
|
||||
// Get methods:
|
||||
@@ -429,7 +430,7 @@ class TC_GAME_API Battleground
|
||||
virtual void EventPlayerClickedOnFlag(Player* /*player*/, GameObject* /*target_obj*/) { }
|
||||
void EventPlayerLoggedIn(Player* player);
|
||||
void EventPlayerLoggedOut(Player* player);
|
||||
virtual void ProcessEvent(WorldObject* /*obj*/, uint32 /*eventId*/, WorldObject* /*invoker*/ = nullptr) { }
|
||||
void ProcessEvent(WorldObject* /*obj*/, uint32 /*eventId*/, WorldObject* /*invoker*/) override { }
|
||||
|
||||
// this function can be used by spell to interact with the BG map
|
||||
virtual void DoAction(uint32 /*action*/, ObjectGuid /*var*/) { }
|
||||
|
||||
@@ -1956,12 +1956,14 @@ ZoneScript* WorldObject::FindZoneScript() const
|
||||
{
|
||||
if (InstanceMap* instanceMap = map->ToInstanceMap())
|
||||
return reinterpret_cast<ZoneScript*>(instanceMap->GetInstanceScript());
|
||||
else if (!map->IsBattlegroundOrArena())
|
||||
if (BattlegroundMap* bgMap = map->ToBattlegroundMap())
|
||||
return reinterpret_cast<ZoneScript*>(bgMap->GetBG());
|
||||
if (!map->IsBattlegroundOrArena())
|
||||
{
|
||||
if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(map, GetZoneId()))
|
||||
return bf;
|
||||
else
|
||||
return sOutdoorPvPMgr->GetOutdoorPvPToZoneId(map, GetZoneId());
|
||||
|
||||
return sOutdoorPvPMgr->GetOutdoorPvPToZoneId(map, GetZoneId());
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
|
||||
@@ -16,14 +16,13 @@
|
||||
*/
|
||||
|
||||
#include "GameEventSender.h"
|
||||
#include "Battleground.h"
|
||||
#include "GameObject.h"
|
||||
#include "GameObjectAI.h"
|
||||
#include "InstanceScript.h"
|
||||
#include "Map.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Player.h"
|
||||
#include "Util.h"
|
||||
#include "ZoneScript.h"
|
||||
|
||||
void GameEvents::Trigger(uint32 gameEventId, WorldObject* source, WorldObject* target)
|
||||
{
|
||||
@@ -66,8 +65,5 @@ void GameEvents::TriggerForPlayer(uint32 gameEventId, Player* source)
|
||||
|
||||
void GameEvents::TriggerForMap(uint32 gameEventId, Map* map, WorldObject* source, WorldObject* target)
|
||||
{
|
||||
if (BattlegroundMap* bgMap = map->ToBattlegroundMap())
|
||||
bgMap->GetBG()->ProcessEvent(target, gameEventId, source);
|
||||
|
||||
map->ScriptsStart(sEventScripts, gameEventId, source, target);
|
||||
}
|
||||
|
||||
@@ -182,7 +182,10 @@ class TC_GAME_API InstanceScript : public ZoneScript
|
||||
{
|
||||
public:
|
||||
explicit InstanceScript(InstanceMap* map);
|
||||
|
||||
InstanceScript(InstanceScript const& right) = delete;
|
||||
InstanceScript(InstanceScript&& right) = delete;
|
||||
InstanceScript& operator=(InstanceScript const& right) = delete;
|
||||
InstanceScript& operator=(InstanceScript&& right) = delete;
|
||||
virtual ~InstanceScript();
|
||||
|
||||
InstanceMap* instance;
|
||||
|
||||
@@ -19,13 +19,12 @@
|
||||
#include "Creature.h"
|
||||
#include "GameEventSender.h"
|
||||
|
||||
ZoneScript::ZoneScript()
|
||||
{
|
||||
}
|
||||
|
||||
ZoneScript::~ZoneScript()
|
||||
{
|
||||
}
|
||||
ZoneScript::ZoneScript() = default;
|
||||
ZoneScript::ZoneScript(ZoneScript const& right) = default;
|
||||
ZoneScript::ZoneScript(ZoneScript&& right) noexcept = default;
|
||||
ZoneScript& ZoneScript::operator=(ZoneScript const& right) = default;
|
||||
ZoneScript& ZoneScript::operator=(ZoneScript&& right) noexcept = default;
|
||||
ZoneScript::~ZoneScript() = default;
|
||||
|
||||
uint32 ZoneScript::GetCreatureEntry(ObjectGuid::LowType /*guidLow*/, CreatureData const* data)
|
||||
{
|
||||
|
||||
@@ -31,13 +31,12 @@ class TC_GAME_API ZoneScript
|
||||
{
|
||||
public:
|
||||
ZoneScript();
|
||||
ZoneScript(ZoneScript const& right);
|
||||
ZoneScript(ZoneScript&& right) noexcept;
|
||||
ZoneScript& operator=(ZoneScript const& right);
|
||||
ZoneScript& operator=(ZoneScript&& right) noexcept;
|
||||
virtual ~ZoneScript();
|
||||
|
||||
ZoneScript(ZoneScript const& right) = delete;
|
||||
ZoneScript(ZoneScript&& right) = delete;
|
||||
ZoneScript& operator=(ZoneScript const& right) = delete;
|
||||
ZoneScript& operator=(ZoneScript&& right) = delete;
|
||||
|
||||
virtual uint32 GetCreatureEntry(ObjectGuid::LowType /*spawnId*/, CreatureData const* data);
|
||||
virtual uint32 GetGameObjectEntry(ObjectGuid::LowType /*spawnId*/, uint32 entry) { return entry; }
|
||||
|
||||
|
||||
@@ -157,7 +157,11 @@ class TC_GAME_API OutdoorPvP : public ZoneScript
|
||||
public:
|
||||
|
||||
// ctor
|
||||
OutdoorPvP(Map* map);
|
||||
explicit OutdoorPvP(Map* map);
|
||||
OutdoorPvP(OutdoorPvP const& right) = delete;
|
||||
OutdoorPvP(OutdoorPvP&& right) = delete;
|
||||
OutdoorPvP& operator=(OutdoorPvP const& right) = delete;
|
||||
OutdoorPvP& operator=(OutdoorPvP&& right) = delete;
|
||||
|
||||
// dtor
|
||||
virtual ~OutdoorPvP();
|
||||
|
||||
Reference in New Issue
Block a user