chore(Misc): make AzerothCore new api support

This commit is contained in:
Winfidonarleyan
2021-05-06 01:51:07 +07:00
parent 2962d4fea3
commit dc300fe5cd
5 changed files with 39 additions and 60 deletions

View File

@@ -40,13 +40,13 @@
#include "WorldSession.h"
#if defined TRINITY
#include "GitRevision.h"
#include "SpellHistory.h"
#endif
#if defined TRINITY || defined AZEROTHCORE
#include "Config.h"
#include "GameEventMgr.h"
#include "GitRevision.h"
#include "GroupMgr.h"
#include "ScriptedCreature.h"
#include "SpellInfo.h"
@@ -95,26 +95,15 @@ typedef Opcodes OpcodesList;
#ifdef TRINITY
#define CORE_NAME "TrinityCore"
#define CORE_VERSION (GitRevision::GetDate())
#define eWorld (sWorld)
#define eMapMgr (sMapMgr)
#define eConfigMgr (sConfigMgr)
#define eGuildMgr (sGuildMgr)
#define eObjectMgr (sObjectMgr)
#define eAccountMgr (sAccountMgr)
#define eAuctionMgr (sAuctionMgr)
#define eGameEventMgr (sGameEventMgr)
#define eObjectAccessor() ObjectAccessor::
#define REGEN_TIME_FULL
#ifdef CATA
#define NUM_MSG_TYPES NUM_OPCODE_HANDLERS
#endif
#endif
#ifdef AZEROTHCORE
#define CORE_NAME "AzerothCore"
#define CORE_VERSION ""
#endif
#if defined TRINITY || defined AZEROTHCORE
#define CORE_VERSION (GitRevision::GetFullVersion())
#define eWorld (sWorld)
#define eMapMgr (sMapMgr)
#define eConfigMgr (sConfigMgr)
@@ -126,6 +115,10 @@ typedef Opcodes OpcodesList;
#define eObjectAccessor() ObjectAccessor::
#endif
#ifdef CATA
#define NUM_MSG_TYPES NUM_OPCODE_HANDLERS
#endif
#if !defined TRINITY && !AZEROTHCORE
#define eWorld (&sWorld)
#define eMapMgr (&sMapMgr)

View File

@@ -25,46 +25,32 @@
#include "Log.h"
#endif
#ifdef TRINITY
#if defined(TRINITY) || defined(AZEROTHCORE)
typedef QueryResult ElunaQuery;
#define GET_GUID GetGUID
#define HIGHGUID_PLAYER HighGuid::Player
#define HIGHGUID_UNIT HighGuid::Unit
#define HIGHGUID_ITEM HighGuid::Item
#define HIGHGUID_GAMEOBJECT HighGuid::GameObject
#define HIGHGUID_PET HighGuid::Pet
#define HIGHGUID_TRANSPORT HighGuid::Transport
#define HIGHGUID_VEHICLE HighGuid::Vehicle
#define HIGHGUID_CONTAINER HighGuid::Container
#define HIGHGUID_DYNAMICOBJECT HighGuid::DynamicObject
#define HIGHGUID_CORPSE HighGuid::Corpse
#define HIGHGUID_MO_TRANSPORT HighGuid::Mo_Transport
#define HIGHGUID_INSTANCE HighGuid::Instance
#define HIGHGUID_GROUP HighGuid::Group
#endif
#ifdef TRINITY
#define ELUNA_LOG_INFO(...) TC_LOG_INFO("eluna", __VA_ARGS__);
#define ELUNA_LOG_ERROR(...) TC_LOG_ERROR("eluna", __VA_ARGS__);
#define ELUNA_LOG_DEBUG(...) TC_LOG_DEBUG("eluna", __VA_ARGS__);
#define GET_GUID GetGUID
#define HIGHGUID_PLAYER HighGuid::Player
#define HIGHGUID_UNIT HighGuid::Unit
#define HIGHGUID_ITEM HighGuid::Item
#define HIGHGUID_GAMEOBJECT HighGuid::GameObject
#define HIGHGUID_PET HighGuid::Pet
#define HIGHGUID_TRANSPORT HighGuid::Transport
#define HIGHGUID_VEHICLE HighGuid::Vehicle
#define HIGHGUID_CONTAINER HighGuid::Container
#define HIGHGUID_DYNAMICOBJECT HighGuid::DynamicObject
#define HIGHGUID_CORPSE HighGuid::Corpse
#define HIGHGUID_MO_TRANSPORT HighGuid::Mo_Transport
#define HIGHGUID_INSTANCE HighGuid::Instance
#define HIGHGUID_GROUP HighGuid::Group
#elif AZEROTHCORE
typedef QueryResult ElunaQuery;
#elif defined(AZEROTHCORE)
#define ELUNA_LOG_INFO(...) LOG_INFO("eluna", __VA_ARGS__);
#define ELUNA_LOG_ERROR(...) LOG_ERROR("eluna", __VA_ARGS__);
#define ELUNA_LOG_DEBUG(...) LOG_DEBUG("eluna", __VA_ARGS__);
#define GET_GUID GetGUID
#define HIGHGUID_PLAYER HighGuid::Player
#define HIGHGUID_UNIT HighGuid::Unit
#define HIGHGUID_ITEM HighGuid::Item
#define HIGHGUID_GAMEOBJECT HighGuid::GameObject
#define HIGHGUID_PET HighGuid::Pet
#define HIGHGUID_TRANSPORT HighGuid::Transport
#define HIGHGUID_VEHICLE HighGuid::Vehicle
#define HIGHGUID_CONTAINER HighGuid::Container
#define HIGHGUID_DYNAMICOBJECT HighGuid::DynamicObject
#define HIGHGUID_CORPSE HighGuid::Corpse
#define HIGHGUID_MO_TRANSPORT HighGuid::Mo_Transport
#define HIGHGUID_INSTANCE HighGuid::Instance
#define HIGHGUID_GROUP HighGuid::Group
#else
typedef QueryNamedResult ElunaQuery;
#define ASSERT MANGOS_ASSERT

View File

@@ -2116,10 +2116,8 @@ namespace LuaGlobalFunctions
draft.SetMoney(money);
#endif
#if defined TRINITY
#if defined TRINITY || defined AZEROTHCORE
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
#elif defined AZEROTHCORE
SQLTransaction trans = CharacterDatabase.BeginTransaction();
#endif
uint8 addedItems = 0;
while (addedItems <= MAX_MAIL_ITEMS && i + 2 <= argAmount)

View File

@@ -756,12 +756,9 @@ namespace LuaItem
*/
int SaveToDB(lua_State* /*L*/, Item* item)
{
#if defined TRINITY
#if defined TRINITY || defined AZEROTHCORE
CharacterDatabaseTransaction trans = CharacterDatabaseTransaction(nullptr);
item->SaveToDB(trans);
#elif defined AZEROTHCORE
SQLTransaction trans = SQLTransaction(NULL);
item->SaveToDB(trans);
#else
item->SaveToDB();
#endif

View File

@@ -117,10 +117,15 @@ struct LuaScript
#define ELUNA_STATE_PTR "Eluna State Ptr"
#define LOCK_ELUNA Eluna::Guard __guard(Eluna::GetLock())
#ifndef TRINITY
#define TC_GAME_API
#if defined(TRINITY)
#define ELUNA_GAME_API TC_GAME_API
#elif defined(AZEROTHCORE)
#define ELUNA_GAME_API AC_GAME_API
#else
#define ELUNA_GAME_API
#endif
class TC_GAME_API Eluna
class ELUNA_GAME_API Eluna
{
public:
typedef std::list<LuaScript> ScriptList;