Core: header cleanup, split realmlist, boost compatibility, cotire, remove stormlib/zlib and stormlib/bzip2 and instead use dep sources
This commit is contained in:
1 parent
7fff6c424f
commit
5ff847159c
1243 files changed
+29780
-36517
No files matched your search
@@ -17,27 +17,32 @@
|
||||
*/
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptReloadMgr.h"
|
||||
#include "Chat.h"
|
||||
#include "Config.h"
|
||||
#include "Creature.h"
|
||||
#include "CreatureAIImpl.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DBCStores.h"
|
||||
#include "GossipDef.h"
|
||||
#include "InstanceScript.h"
|
||||
#include "Item.h"
|
||||
#include "LFGScripts.h"
|
||||
#include "Log.h"
|
||||
#include "MapManager.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "OutdoorPvPMgr.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptReloadMgr.h"
|
||||
#include "ScriptSystem.h"
|
||||
#include "Transport.h"
|
||||
#include "Vehicle.h"
|
||||
#include "SmartAI.h"
|
||||
#include "SpellInfo.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "SpellScript.h"
|
||||
#include "GossipDef.h"
|
||||
#include "CreatureAIImpl.h"
|
||||
#include "Player.h"
|
||||
#include "Transport.h"
|
||||
#include "Vehicle.h"
|
||||
#include "Weather.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
#include "Chat.h"
|
||||
#include "MapManager.h"
|
||||
#include "LFGScripts.h"
|
||||
#include "InstanceScript.h"
|
||||
|
||||
// Trait which indicates whether this script type
|
||||
// must be assigned in the database.
|
||||
@@ -983,7 +988,7 @@ struct TSpellSummary
|
||||
uint8 Effects; // set of enum SelectEffect
|
||||
} *SpellSummary;
|
||||
|
||||
ScriptObject::ScriptObject(const char* name) : _name(name)
|
||||
ScriptObject::ScriptObject(char const* name) : _name(name)
|
||||
{
|
||||
sScriptMgr->IncreaseScriptCount();
|
||||
}
|
||||
@@ -1508,7 +1513,7 @@ InstanceScript* ScriptMgr::CreateInstanceData(InstanceMap* map)
|
||||
{
|
||||
ASSERT(map);
|
||||
|
||||
GET_SCRIPT_RET(InstanceMapScript, map->GetScriptId(), tmpscript, NULL);
|
||||
GET_SCRIPT_RET(InstanceMapScript, map->GetScriptId(), tmpscript, nullptr);
|
||||
return tmpscript->GetInstanceScript(map);
|
||||
}
|
||||
|
||||
@@ -1579,7 +1584,7 @@ CreatureAI* ScriptMgr::GetCreatureAI(Creature* creature)
|
||||
{
|
||||
ASSERT(creature);
|
||||
|
||||
GET_SCRIPT_RET(CreatureScript, creature->GetScriptId(), tmpscript, NULL);
|
||||
GET_SCRIPT_RET(CreatureScript, creature->GetScriptId(), tmpscript, nullptr);
|
||||
return tmpscript->GetAI(creature);
|
||||
}
|
||||
|
||||
@@ -1587,7 +1592,7 @@ GameObjectAI* ScriptMgr::GetGameObjectAI(GameObject* gameobject)
|
||||
{
|
||||
ASSERT(gameobject);
|
||||
|
||||
GET_SCRIPT_RET(GameObjectScript, gameobject->GetScriptId(), tmpscript, NULL);
|
||||
GET_SCRIPT_RET(GameObjectScript, gameobject->GetScriptId(), tmpscript, nullptr);
|
||||
return tmpscript->GetAI(gameobject);
|
||||
}
|
||||
|
||||
@@ -1604,12 +1609,12 @@ Battleground* ScriptMgr::CreateBattleground(BattlegroundTypeId /*typeId*/)
|
||||
{
|
||||
/// @todo Implement script-side battlegrounds.
|
||||
ABORT();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
OutdoorPvP* ScriptMgr::CreateOutdoorPvP(uint32 scriptId)
|
||||
{
|
||||
GET_SCRIPT_RET(OutdoorPvPScript, scriptId, tmpscript, NULL);
|
||||
GET_SCRIPT_RET(OutdoorPvPScript, scriptId, tmpscript, nullptr);
|
||||
return tmpscript->GetOutdoorPvP();
|
||||
}
|
||||
|
||||
@@ -1624,7 +1629,7 @@ std::vector<ChatCommand> ScriptMgr::GetChatCommands()
|
||||
}
|
||||
|
||||
// Sort commands in alphabetical order
|
||||
std::sort(table.begin(), table.end(), [](const ChatCommand& a, const ChatCommand&b)
|
||||
std::sort(table.begin(), table.end(), [](ChatCommand const& a, ChatCommand const& b)
|
||||
{
|
||||
return strcmp(a.Name, b.Name) < 0;
|
||||
});
|
||||
@@ -1807,7 +1812,7 @@ void ScriptMgr::OnShutdown()
|
||||
bool ScriptMgr::OnCriteriaCheck(uint32 scriptId, Player* source, Unit* target)
|
||||
{
|
||||
ASSERT(source);
|
||||
// target can be NULL.
|
||||
// target can be nullptr.
|
||||
|
||||
GET_SCRIPT_RET(AchievementCriteriaScript, scriptId, tmpscript, false);
|
||||
return tmpscript->OnCheck(source, target);
|
||||
@@ -2070,7 +2075,7 @@ void ScriptMgr::OnGroupInviteMember(Group* group, ObjectGuid guid)
|
||||
FOREACH_SCRIPT(GroupScript)->OnInviteMember(group, guid);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnGroupRemoveMember(Group* group, ObjectGuid guid, RemoveMethod method, ObjectGuid kicker, const char* reason)
|
||||
void ScriptMgr::OnGroupRemoveMember(Group* group, ObjectGuid guid, RemoveMethod method, ObjectGuid kicker, char const* reason)
|
||||
{
|
||||
ASSERT(group);
|
||||
FOREACH_SCRIPT(GroupScript)->OnRemoveMember(group, guid, method, kicker, reason);
|
||||
@@ -2119,83 +2124,92 @@ void ScriptMgr::ModifySpellDamageTaken(Unit* target, Unit* attacker, int32& dama
|
||||
FOREACH_SCRIPT(PlayerScript)->ModifySpellDamageTaken(target, attacker, damage);
|
||||
}
|
||||
|
||||
SpellScriptLoader::SpellScriptLoader(const char* name)
|
||||
SpellScriptLoader::SpellScriptLoader(char const* name)
|
||||
: ScriptObject(name)
|
||||
{
|
||||
ScriptRegistry<SpellScriptLoader>::Instance()->AddScript(this);
|
||||
}
|
||||
|
||||
ServerScript::ServerScript(const char* name)
|
||||
ServerScript::ServerScript(char const* name)
|
||||
: ScriptObject(name)
|
||||
{
|
||||
ScriptRegistry<ServerScript>::Instance()->AddScript(this);
|
||||
}
|
||||
|
||||
WorldScript::WorldScript(const char* name)
|
||||
WorldScript::WorldScript(char const* name)
|
||||
: ScriptObject(name)
|
||||
{
|
||||
ScriptRegistry<WorldScript>::Instance()->AddScript(this);
|
||||
}
|
||||
|
||||
FormulaScript::FormulaScript(const char* name)
|
||||
FormulaScript::FormulaScript(char const* name)
|
||||
: ScriptObject(name)
|
||||
{
|
||||
ScriptRegistry<FormulaScript>::Instance()->AddScript(this);
|
||||
}
|
||||
|
||||
UnitScript::UnitScript(const char* name, bool addToScripts)
|
||||
UnitScript::UnitScript(char const* name, bool addToScripts)
|
||||
: ScriptObject(name)
|
||||
{
|
||||
if (addToScripts)
|
||||
ScriptRegistry<UnitScript>::Instance()->AddScript(this);
|
||||
}
|
||||
|
||||
WorldMapScript::WorldMapScript(const char* name, uint32 mapId)
|
||||
: ScriptObject(name), MapScript<Map>(mapId)
|
||||
WorldMapScript::WorldMapScript(char const* name, uint32 mapId)
|
||||
: ScriptObject(name), MapScript<Map>(sMapStore.LookupEntry(mapId))
|
||||
{
|
||||
if (!GetEntry())
|
||||
TC_LOG_ERROR("scripts", "Invalid WorldMapScript for %u; no such map ID.", mapId);
|
||||
|
||||
if (GetEntry() && !GetEntry()->IsWorldMap())
|
||||
TC_LOG_ERROR("scripts", "WorldMapScript for map %u is invalid.", mapId);
|
||||
|
||||
ScriptRegistry<WorldMapScript>::Instance()->AddScript(this);
|
||||
}
|
||||
|
||||
InstanceMapScript::InstanceMapScript(const char* name, uint32 mapId)
|
||||
: ScriptObject(name), MapScript<InstanceMap>(mapId)
|
||||
InstanceMapScript::InstanceMapScript(char const* name, uint32 mapId)
|
||||
: ScriptObject(name), MapScript<InstanceMap>(sMapStore.LookupEntry(mapId))
|
||||
{
|
||||
if (!GetEntry())
|
||||
TC_LOG_ERROR("scripts", "Invalid InstanceMapScript for %u; no such map ID.", mapId);
|
||||
|
||||
if (GetEntry() && !GetEntry()->IsDungeon())
|
||||
TC_LOG_ERROR("scripts", "InstanceMapScript for map %u is invalid.", mapId);
|
||||
|
||||
ScriptRegistry<InstanceMapScript>::Instance()->AddScript(this);
|
||||
}
|
||||
|
||||
BattlegroundMapScript::BattlegroundMapScript(const char* name, uint32 mapId)
|
||||
: ScriptObject(name), MapScript<BattlegroundMap>(mapId)
|
||||
BattlegroundMapScript::BattlegroundMapScript(char const* name, uint32 mapId)
|
||||
: ScriptObject(name), MapScript<BattlegroundMap>(sMapStore.LookupEntry(mapId))
|
||||
{
|
||||
if (!GetEntry())
|
||||
TC_LOG_ERROR("scripts", "Invalid BattlegroundMapScript for %u; no such map ID.", mapId);
|
||||
|
||||
if (GetEntry() && !GetEntry()->IsBattleground())
|
||||
TC_LOG_ERROR("scripts", "BattlegroundMapScript for map %u is invalid.", mapId);
|
||||
|
||||
ScriptRegistry<BattlegroundMapScript>::Instance()->AddScript(this);
|
||||
}
|
||||
|
||||
ItemScript::ItemScript(const char* name)
|
||||
ItemScript::ItemScript(char const* name)
|
||||
: ScriptObject(name)
|
||||
{
|
||||
ScriptRegistry<ItemScript>::Instance()->AddScript(this);
|
||||
}
|
||||
|
||||
CreatureScript::CreatureScript(const char* name)
|
||||
CreatureScript::CreatureScript(char const* name)
|
||||
: UnitScript(name, false)
|
||||
{
|
||||
ScriptRegistry<CreatureScript>::Instance()->AddScript(this);
|
||||
}
|
||||
|
||||
GameObjectScript::GameObjectScript(const char* name)
|
||||
GameObjectScript::GameObjectScript(char const* name)
|
||||
: ScriptObject(name)
|
||||
{
|
||||
ScriptRegistry<GameObjectScript>::Instance()->AddScript(this);
|
||||
}
|
||||
|
||||
AreaTriggerScript::AreaTriggerScript(const char* name)
|
||||
AreaTriggerScript::AreaTriggerScript(char const* name)
|
||||
: ScriptObject(name)
|
||||
{
|
||||
ScriptRegistry<AreaTriggerScript>::Instance()->AddScript(this);
|
||||
@@ -2217,85 +2231,85 @@ void OnlyOnceAreaTriggerScript::ResetAreaTriggerDone(InstanceScript* script, uin
|
||||
void OnlyOnceAreaTriggerScript::ResetAreaTriggerDone(Player const* player, AreaTriggerEntry const* trigger) { if (InstanceScript* instance = player->GetInstanceScript()) ResetAreaTriggerDone(instance, trigger->id); }
|
||||
|
||||
|
||||
BattlegroundScript::BattlegroundScript(const char* name)
|
||||
BattlegroundScript::BattlegroundScript(char const* name)
|
||||
: ScriptObject(name)
|
||||
{
|
||||
ScriptRegistry<BattlegroundScript>::Instance()->AddScript(this);
|
||||
}
|
||||
|
||||
OutdoorPvPScript::OutdoorPvPScript(const char* name)
|
||||
OutdoorPvPScript::OutdoorPvPScript(char const* name)
|
||||
: ScriptObject(name)
|
||||
{
|
||||
ScriptRegistry<OutdoorPvPScript>::Instance()->AddScript(this);
|
||||
}
|
||||
|
||||
CommandScript::CommandScript(const char* name)
|
||||
CommandScript::CommandScript(char const* name)
|
||||
: ScriptObject(name)
|
||||
{
|
||||
ScriptRegistry<CommandScript>::Instance()->AddScript(this);
|
||||
}
|
||||
|
||||
WeatherScript::WeatherScript(const char* name)
|
||||
WeatherScript::WeatherScript(char const* name)
|
||||
: ScriptObject(name)
|
||||
{
|
||||
ScriptRegistry<WeatherScript>::Instance()->AddScript(this);
|
||||
}
|
||||
|
||||
AuctionHouseScript::AuctionHouseScript(const char* name)
|
||||
AuctionHouseScript::AuctionHouseScript(char const* name)
|
||||
: ScriptObject(name)
|
||||
{
|
||||
ScriptRegistry<AuctionHouseScript>::Instance()->AddScript(this);
|
||||
}
|
||||
|
||||
ConditionScript::ConditionScript(const char* name)
|
||||
ConditionScript::ConditionScript(char const* name)
|
||||
: ScriptObject(name)
|
||||
{
|
||||
ScriptRegistry<ConditionScript>::Instance()->AddScript(this);
|
||||
}
|
||||
|
||||
VehicleScript::VehicleScript(const char* name)
|
||||
VehicleScript::VehicleScript(char const* name)
|
||||
: ScriptObject(name)
|
||||
{
|
||||
ScriptRegistry<VehicleScript>::Instance()->AddScript(this);
|
||||
}
|
||||
|
||||
DynamicObjectScript::DynamicObjectScript(const char* name)
|
||||
DynamicObjectScript::DynamicObjectScript(char const* name)
|
||||
: ScriptObject(name)
|
||||
{
|
||||
ScriptRegistry<DynamicObjectScript>::Instance()->AddScript(this);
|
||||
}
|
||||
|
||||
TransportScript::TransportScript(const char* name)
|
||||
TransportScript::TransportScript(char const* name)
|
||||
: ScriptObject(name)
|
||||
{
|
||||
ScriptRegistry<TransportScript>::Instance()->AddScript(this);
|
||||
}
|
||||
|
||||
AchievementCriteriaScript::AchievementCriteriaScript(const char* name)
|
||||
AchievementCriteriaScript::AchievementCriteriaScript(char const* name)
|
||||
: ScriptObject(name)
|
||||
{
|
||||
ScriptRegistry<AchievementCriteriaScript>::Instance()->AddScript(this);
|
||||
}
|
||||
|
||||
PlayerScript::PlayerScript(const char* name)
|
||||
PlayerScript::PlayerScript(char const* name)
|
||||
: UnitScript(name, false)
|
||||
{
|
||||
ScriptRegistry<PlayerScript>::Instance()->AddScript(this);
|
||||
}
|
||||
|
||||
AccountScript::AccountScript(const char* name)
|
||||
AccountScript::AccountScript(char const* name)
|
||||
: ScriptObject(name)
|
||||
{
|
||||
ScriptRegistry<AccountScript>::Instance()->AddScript(this);
|
||||
}
|
||||
|
||||
GuildScript::GuildScript(const char* name)
|
||||
GuildScript::GuildScript(char const* name)
|
||||
: ScriptObject(name)
|
||||
{
|
||||
ScriptRegistry<GuildScript>::Instance()->AddScript(this);
|
||||
}
|
||||
|
||||
GroupScript::GroupScript(const char* name)
|
||||
GroupScript::GroupScript(char const* name)
|
||||
: ScriptObject(name)
|
||||
{
|
||||
ScriptRegistry<GroupScript>::Instance()->AddScript(this);
|
||||
|
||||
@@ -20,12 +20,8 @@
|
||||
#define SC_SCRIPTMGR_H
|
||||
|
||||
#include "Common.h"
|
||||
#include <atomic>
|
||||
#include "DBCStores.h"
|
||||
#include "QuestDef.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "World.h"
|
||||
#include "Weather.h"
|
||||
#include "ObjectGuid.h"
|
||||
#include <vector>
|
||||
|
||||
class AccountMgr;
|
||||
class AuctionHouseObject;
|
||||
@@ -59,17 +55,32 @@ class SpellCastTargets;
|
||||
class Transport;
|
||||
class Unit;
|
||||
class Vehicle;
|
||||
class Weather;
|
||||
class WorldPacket;
|
||||
class WorldSocket;
|
||||
class WorldObject;
|
||||
class WorldSession;
|
||||
|
||||
struct AuctionEntry;
|
||||
struct AreaTriggerEntry;
|
||||
struct ConditionSourceInfo;
|
||||
struct Condition;
|
||||
struct CreatureTemplate;
|
||||
struct CreatureData;
|
||||
struct ItemTemplate;
|
||||
struct MapEntry;
|
||||
|
||||
enum BattlegroundTypeId : uint32;
|
||||
enum ContentLevels : uint8;
|
||||
enum Difficulty : uint8;
|
||||
enum DuelCompleteType : uint8;
|
||||
enum QuestStatus : uint8;
|
||||
enum RemoveMethod : uint8;
|
||||
enum ShutdownExitCode : uint32;
|
||||
enum ShutdownMask : uint32;
|
||||
enum SpellEffIndex : uint8;
|
||||
enum WeatherState : uint32;
|
||||
enum XPColorChar : uint8;
|
||||
|
||||
#define VISIBLE_RANGE 166.0f //MAX visible range (size of grid)
|
||||
|
||||
@@ -99,7 +110,7 @@ struct ItemTemplate;
|
||||
|
||||
protected:
|
||||
|
||||
MyScriptType(const char* name, uint32 someId)
|
||||
MyScriptType(char const* name, uint32 someId)
|
||||
: ScriptObject(name), _someId(someId)
|
||||
{
|
||||
ScriptRegistry<MyScriptType>::AddScript(this);
|
||||
@@ -160,7 +171,7 @@ class TC_GAME_API ScriptObject
|
||||
|
||||
protected:
|
||||
|
||||
ScriptObject(const char* name);
|
||||
ScriptObject(char const* name);
|
||||
virtual ~ScriptObject();
|
||||
|
||||
private:
|
||||
@@ -187,7 +198,7 @@ class TC_GAME_API SpellScriptLoader : public ScriptObject
|
||||
{
|
||||
protected:
|
||||
|
||||
SpellScriptLoader(const char* name);
|
||||
SpellScriptLoader(char const* name);
|
||||
|
||||
public:
|
||||
|
||||
@@ -202,7 +213,7 @@ class TC_GAME_API ServerScript : public ScriptObject
|
||||
{
|
||||
protected:
|
||||
|
||||
ServerScript(const char* name);
|
||||
ServerScript(char const* name);
|
||||
|
||||
public:
|
||||
|
||||
@@ -232,7 +243,7 @@ class TC_GAME_API WorldScript : public ScriptObject
|
||||
{
|
||||
protected:
|
||||
|
||||
WorldScript(const char* name);
|
||||
WorldScript(char const* name);
|
||||
|
||||
public:
|
||||
|
||||
@@ -265,7 +276,7 @@ class TC_GAME_API FormulaScript : public ScriptObject
|
||||
{
|
||||
protected:
|
||||
|
||||
FormulaScript(const char* name);
|
||||
FormulaScript(char const* name);
|
||||
|
||||
public:
|
||||
|
||||
@@ -297,16 +308,11 @@ template<class TMap> class MapScript : public UpdatableScript<TMap>
|
||||
|
||||
protected:
|
||||
|
||||
MapScript(uint32 mapId)
|
||||
: _mapEntry(sMapStore.LookupEntry(mapId))
|
||||
{
|
||||
if (!_mapEntry)
|
||||
TC_LOG_ERROR("scripts", "Invalid MapScript for %u; no such map ID.", mapId);
|
||||
}
|
||||
MapScript(MapEntry const* mapEntry) : _mapEntry(mapEntry) { }
|
||||
|
||||
public:
|
||||
|
||||
// Gets the MapEntry structure associated with this script. Can return NULL.
|
||||
// Gets the MapEntry structure associated with this script. Can return nullptr.
|
||||
MapEntry const* GetEntry() { return _mapEntry; }
|
||||
|
||||
// Called when the map is created.
|
||||
@@ -332,7 +338,7 @@ class TC_GAME_API WorldMapScript : public ScriptObject, public MapScript<Map>
|
||||
{
|
||||
protected:
|
||||
|
||||
WorldMapScript(const char* name, uint32 mapId);
|
||||
WorldMapScript(char const* name, uint32 mapId);
|
||||
};
|
||||
|
||||
class TC_GAME_API InstanceMapScript
|
||||
@@ -340,26 +346,26 @@ class TC_GAME_API InstanceMapScript
|
||||
{
|
||||
protected:
|
||||
|
||||
InstanceMapScript(const char* name, uint32 mapId);
|
||||
InstanceMapScript(char const* name, uint32 mapId);
|
||||
|
||||
public:
|
||||
|
||||
// Gets an InstanceScript object for this instance.
|
||||
virtual InstanceScript* GetInstanceScript(InstanceMap* /*map*/) const { return NULL; }
|
||||
virtual InstanceScript* GetInstanceScript(InstanceMap* /*map*/) const { return nullptr; }
|
||||
};
|
||||
|
||||
class TC_GAME_API BattlegroundMapScript : public ScriptObject, public MapScript<BattlegroundMap>
|
||||
{
|
||||
protected:
|
||||
|
||||
BattlegroundMapScript(const char* name, uint32 mapId);
|
||||
BattlegroundMapScript(char const* name, uint32 mapId);
|
||||
};
|
||||
|
||||
class TC_GAME_API ItemScript : public ScriptObject
|
||||
{
|
||||
protected:
|
||||
|
||||
ItemScript(const char* name);
|
||||
ItemScript(char const* name);
|
||||
|
||||
public:
|
||||
|
||||
@@ -384,7 +390,7 @@ class TC_GAME_API UnitScript : public ScriptObject
|
||||
{
|
||||
protected:
|
||||
|
||||
UnitScript(const char* name, bool addToScripts = true);
|
||||
UnitScript(char const* name, bool addToScripts = true);
|
||||
|
||||
public:
|
||||
// Called when a unit deals healing to another unit
|
||||
@@ -407,7 +413,7 @@ class TC_GAME_API CreatureScript : public UnitScript
|
||||
{
|
||||
protected:
|
||||
|
||||
CreatureScript(const char* name);
|
||||
CreatureScript(char const* name);
|
||||
|
||||
public:
|
||||
|
||||
@@ -422,7 +428,7 @@ class TC_GAME_API GameObjectScript : public ScriptObject, public UpdatableScript
|
||||
{
|
||||
protected:
|
||||
|
||||
GameObjectScript(const char* name);
|
||||
GameObjectScript(char const* name);
|
||||
|
||||
public:
|
||||
|
||||
@@ -434,7 +440,7 @@ class TC_GAME_API AreaTriggerScript : public ScriptObject
|
||||
{
|
||||
protected:
|
||||
|
||||
AreaTriggerScript(const char* name);
|
||||
AreaTriggerScript(char const* name);
|
||||
|
||||
public:
|
||||
|
||||
@@ -459,7 +465,7 @@ class TC_GAME_API BattlegroundScript : public ScriptObject
|
||||
{
|
||||
protected:
|
||||
|
||||
BattlegroundScript(const char* name);
|
||||
BattlegroundScript(char const* name);
|
||||
|
||||
public:
|
||||
|
||||
@@ -471,7 +477,7 @@ class TC_GAME_API OutdoorPvPScript : public ScriptObject
|
||||
{
|
||||
protected:
|
||||
|
||||
OutdoorPvPScript(const char* name);
|
||||
OutdoorPvPScript(char const* name);
|
||||
|
||||
public:
|
||||
|
||||
@@ -483,7 +489,7 @@ class TC_GAME_API CommandScript : public ScriptObject
|
||||
{
|
||||
protected:
|
||||
|
||||
CommandScript(const char* name);
|
||||
CommandScript(char const* name);
|
||||
|
||||
public:
|
||||
|
||||
@@ -495,7 +501,7 @@ class TC_GAME_API WeatherScript : public ScriptObject, public UpdatableScript<We
|
||||
{
|
||||
protected:
|
||||
|
||||
WeatherScript(const char* name);
|
||||
WeatherScript(char const* name);
|
||||
|
||||
public:
|
||||
|
||||
@@ -507,7 +513,7 @@ class TC_GAME_API AuctionHouseScript : public ScriptObject
|
||||
{
|
||||
protected:
|
||||
|
||||
AuctionHouseScript(const char* name);
|
||||
AuctionHouseScript(char const* name);
|
||||
|
||||
public:
|
||||
|
||||
@@ -528,7 +534,7 @@ class TC_GAME_API ConditionScript : public ScriptObject
|
||||
{
|
||||
protected:
|
||||
|
||||
ConditionScript(const char* name);
|
||||
ConditionScript(char const* name);
|
||||
|
||||
public:
|
||||
|
||||
@@ -540,7 +546,7 @@ class TC_GAME_API VehicleScript : public ScriptObject
|
||||
{
|
||||
protected:
|
||||
|
||||
VehicleScript(const char* name);
|
||||
VehicleScript(char const* name);
|
||||
|
||||
public:
|
||||
|
||||
@@ -567,14 +573,14 @@ class TC_GAME_API DynamicObjectScript : public ScriptObject, public UpdatableScr
|
||||
{
|
||||
protected:
|
||||
|
||||
DynamicObjectScript(const char* name);
|
||||
DynamicObjectScript(char const* name);
|
||||
};
|
||||
|
||||
class TC_GAME_API TransportScript : public ScriptObject, public UpdatableScript<Transport>
|
||||
{
|
||||
protected:
|
||||
|
||||
TransportScript(const char* name);
|
||||
TransportScript(char const* name);
|
||||
|
||||
public:
|
||||
|
||||
@@ -595,7 +601,7 @@ class TC_GAME_API AchievementCriteriaScript : public ScriptObject
|
||||
{
|
||||
protected:
|
||||
|
||||
AchievementCriteriaScript(const char* name);
|
||||
AchievementCriteriaScript(char const* name);
|
||||
|
||||
public:
|
||||
|
||||
@@ -607,7 +613,7 @@ class TC_GAME_API PlayerScript : public UnitScript
|
||||
{
|
||||
protected:
|
||||
|
||||
PlayerScript(const char* name);
|
||||
PlayerScript(char const* name);
|
||||
|
||||
public:
|
||||
|
||||
@@ -707,7 +713,7 @@ class TC_GAME_API AccountScript : public ScriptObject
|
||||
{
|
||||
protected:
|
||||
|
||||
AccountScript(const char* name);
|
||||
AccountScript(char const* name);
|
||||
|
||||
public:
|
||||
|
||||
@@ -734,7 +740,7 @@ class TC_GAME_API GuildScript : public ScriptObject
|
||||
{
|
||||
protected:
|
||||
|
||||
GuildScript(const char* name);
|
||||
GuildScript(char const* name);
|
||||
|
||||
public:
|
||||
|
||||
@@ -775,7 +781,7 @@ class TC_GAME_API GroupScript : public ScriptObject
|
||||
{
|
||||
protected:
|
||||
|
||||
GroupScript(const char* name);
|
||||
GroupScript(char const* name);
|
||||
|
||||
public:
|
||||
|
||||
@@ -786,7 +792,7 @@ class TC_GAME_API GroupScript : public ScriptObject
|
||||
virtual void OnInviteMember(Group* /*group*/, ObjectGuid /*guid*/) { }
|
||||
|
||||
// Called when a member is removed from a group.
|
||||
virtual void OnRemoveMember(Group* /*group*/, ObjectGuid /*guid*/, RemoveMethod /*method*/, ObjectGuid /*kicker*/, const char* /*reason*/) { }
|
||||
virtual void OnRemoveMember(Group* /*group*/, ObjectGuid /*guid*/, RemoveMethod /*method*/, ObjectGuid /*kicker*/, char const* /*reason*/) { }
|
||||
|
||||
// Called when the leader of a group is changed.
|
||||
virtual void OnChangeLeader(Group* /*group*/, ObjectGuid /*newLeaderGuid*/, ObjectGuid /*oldLeaderGuid*/) { }
|
||||
@@ -1040,7 +1046,7 @@ class TC_GAME_API ScriptMgr
|
||||
|
||||
void OnGroupAddMember(Group* group, ObjectGuid guid);
|
||||
void OnGroupInviteMember(Group* group, ObjectGuid guid);
|
||||
void OnGroupRemoveMember(Group* group, ObjectGuid guid, RemoveMethod method, ObjectGuid kicker, const char* reason);
|
||||
void OnGroupRemoveMember(Group* group, ObjectGuid guid, RemoveMethod method, ObjectGuid kicker, char const* reason);
|
||||
void OnGroupChangeLeader(Group* group, ObjectGuid newLeaderGuid, ObjectGuid oldLeaderGuid);
|
||||
void OnGroupDisband(Group* group);
|
||||
|
||||
|
||||
@@ -17,10 +17,15 @@
|
||||
*/
|
||||
|
||||
#include "ScriptSystem.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "Creature.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Log.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "SplineChain.h"
|
||||
|
||||
SystemMgr::SystemMgr() = default;
|
||||
SystemMgr::~SystemMgr() = default;
|
||||
|
||||
SystemMgr* SystemMgr::instance()
|
||||
{
|
||||
@@ -108,7 +113,7 @@ void SystemMgr::LoadScriptSplineChains()
|
||||
uint32 entry = fieldsMeta[0].GetUInt32();
|
||||
uint16 chainId = fieldsMeta[1].GetUInt16();
|
||||
uint8 splineId = fieldsMeta[2].GetUInt8();
|
||||
SplineChain& chain = m_mSplineChainsMap[{entry,chainId}];
|
||||
std::vector<SplineChainLink>& chain = m_mSplineChainsMap[{entry,chainId}];
|
||||
|
||||
if (splineId != chain.size())
|
||||
{
|
||||
@@ -116,8 +121,9 @@ void SystemMgr::LoadScriptSplineChains()
|
||||
continue;
|
||||
}
|
||||
|
||||
uint32 expectedDuration = fieldsMeta[3].GetUInt32(), msUntilNext = fieldsMeta[4].GetUInt32();
|
||||
chain.push_back(SplineChainLink(expectedDuration, msUntilNext));
|
||||
uint32 expectedDuration = fieldsMeta[3].GetUInt32();
|
||||
uint32 msUntilNext = fieldsMeta[4].GetUInt32();
|
||||
chain.emplace_back(expectedDuration, msUntilNext);
|
||||
|
||||
if (splineId == 0)
|
||||
++chainCount;
|
||||
@@ -137,7 +143,7 @@ void SystemMgr::LoadScriptSplineChains()
|
||||
TC_LOG_WARN("server.loading", "Creature #%u has waypoint data for spline chain %u. No such chain exists - entry skipped.", entry, chainId);
|
||||
continue;
|
||||
}
|
||||
SplineChain& chain = it->second;
|
||||
std::vector<SplineChainLink>& chain = it->second;
|
||||
if (splineId >= chain.size())
|
||||
{
|
||||
TC_LOG_WARN("server.loading", "Creature #%u has waypoint data for spline (%u,%u). The specified chain does not have a spline with this index - entry skipped.", entry, chainId, splineId);
|
||||
@@ -157,7 +163,15 @@ void SystemMgr::LoadScriptSplineChains()
|
||||
}
|
||||
}
|
||||
|
||||
SplineChain const* SystemMgr::GetSplineChain(Creature const* who, uint16 id) const
|
||||
std::vector<SplineChainLink> const* SystemMgr::GetSplineChain(uint32 entry, uint16 chainId) const
|
||||
{
|
||||
auto it = m_mSplineChainsMap.find({ entry, chainId });
|
||||
if (it == m_mSplineChainsMap.end())
|
||||
return nullptr;
|
||||
return &it->second;
|
||||
}
|
||||
|
||||
std::vector<SplineChainLink> const* SystemMgr::GetSplineChain(Creature const* who, uint16 id) const
|
||||
{
|
||||
return GetSplineChain(who->GetEntry(), id);
|
||||
}
|
||||
@@ -19,10 +19,13 @@
|
||||
#ifndef SC_SYSTEM_H
|
||||
#define SC_SYSTEM_H
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "SplineChain.h"
|
||||
#include "Define.h"
|
||||
#include "Hash.h"
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
class Creature;
|
||||
struct SplineChainLink;
|
||||
|
||||
struct ScriptPointMove
|
||||
{
|
||||
@@ -39,8 +42,8 @@ typedef std::vector<ScriptPointMove> ScriptPointVector;
|
||||
class TC_GAME_API SystemMgr
|
||||
{
|
||||
private:
|
||||
SystemMgr() { }
|
||||
~SystemMgr() { }
|
||||
SystemMgr();
|
||||
~SystemMgr();
|
||||
|
||||
public:
|
||||
static SystemMgr* instance();
|
||||
@@ -61,20 +64,13 @@ class TC_GAME_API SystemMgr
|
||||
return &itr->second;
|
||||
}
|
||||
|
||||
SplineChain const* GetSplineChain(uint32 entry, uint16 chainId) const
|
||||
{
|
||||
auto it = m_mSplineChainsMap.find({ entry, chainId });
|
||||
if (it == m_mSplineChainsMap.end())
|
||||
return nullptr;
|
||||
return &it->second;
|
||||
}
|
||||
|
||||
SplineChain const* GetSplineChain(Creature const* who, uint16 id) const;
|
||||
std::vector<SplineChainLink> const* GetSplineChain(uint32 entry, uint16 chainId) const;
|
||||
std::vector<SplineChainLink> const* GetSplineChain(Creature const* who, uint16 id) const;
|
||||
|
||||
protected:
|
||||
PointMoveMap m_mPointMoveMap; //coordinates for waypoints
|
||||
typedef std::pair<uint32, uint16> ChainKeyType; // creature entry + chain ID
|
||||
std::unordered_map<ChainKeyType, SplineChain> m_mSplineChainsMap; // spline chains
|
||||
std::unordered_map<ChainKeyType, std::vector<SplineChainLink>> m_mSplineChainsMap; // spline chains
|
||||
};
|
||||
|
||||
#define sScriptSystemMgr SystemMgr::instance()
|
||||
|
||||
Reference in new issue
Block a user