From c58135b1619f9be57a1900e8df4815ae8597ca15 Mon Sep 17 00:00:00 2001 From: RedSkull-666 <60255796+RedSkull-666@users.noreply.github.com> Date: Tue, 31 Mar 2020 19:29:24 +0200 Subject: [PATCH] Trinity SQLTransaction Ungroups Trinity from AzerothCore when necessary Replaces SQLTransaction by CharacterDatabaseTransaction --- GlobalMethods.h | 4 +++- GuildMethods.h | 9 ++++++--- ItemMethods.h | 5 ++++- PlayerMethods.h | 2 +- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/GlobalMethods.h b/GlobalMethods.h index a4a7cd9..6e4db30 100644 --- a/GlobalMethods.h +++ b/GlobalMethods.h @@ -2094,7 +2094,9 @@ namespace LuaGlobalFunctions draft.SetMoney(money); #endif -#if defined TRINITY || AZEROTHCORE +#if defined TRINITY + CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction(); +#elif defined AZEROTHCORE SQLTransaction trans = CharacterDatabase.BeginTransaction(); #endif uint8 addedItems = 0; diff --git a/GuildMethods.h b/GuildMethods.h index 3bb50fd..16e7433 100644 --- a/GuildMethods.h +++ b/GuildMethods.h @@ -254,7 +254,7 @@ namespace LuaGuild uint8 rankId = Eluna::CHECKVAL(L, 3, GUILD_RANK_NONE); #ifdef TRINITY - SQLTransaction trans(nullptr); + CharacterDatabaseTransaction trans(nullptr); guild->AddMember(trans, player->GET_GUID(), rankId); #else guild->AddMember(player->GET_GUID(), rankId); @@ -273,7 +273,10 @@ namespace LuaGuild Player* player = Eluna::CHECKOBJ(L, 2); bool isDisbanding = Eluna::CHECKVAL(L, 3, false); -#if defined TRINITY || AZEROTHCORE +#if defined TRINITY + CharacterDatabaseTransaction trans(nullptr); + guild->DeleteMember(trans, player->GET_GUID(), isDisbanding); +#elif defined AZEROTHCORE SQLTransaction trans(nullptr); guild->DeleteMember(trans, player->GET_GUID(), isDisbanding); #else @@ -294,7 +297,7 @@ namespace LuaGuild uint8 newRank = Eluna::CHECKVAL(L, 3); #ifdef TRINITY - SQLTransaction trans(nullptr); + CharacterDatabaseTransaction trans(nullptr); guild->ChangeMemberRank(trans, player->GET_GUID(), newRank); #else guild->ChangeMemberRank(player->GET_GUID(), newRank); diff --git a/ItemMethods.h b/ItemMethods.h index 9838078..4aed44e 100644 --- a/ItemMethods.h +++ b/ItemMethods.h @@ -740,7 +740,10 @@ namespace LuaItem */ int SaveToDB(lua_State* /*L*/, Item* item) { -#if defined TRINITY || AZEROTHCORE +#if defined TRINITY + CharacterDatabaseTransaction trans = CharacterDatabaseTransaction(nullptr); + item->SaveToDB(trans); +#elif defined AZEROTHCORE SQLTransaction trans = SQLTransaction(NULL); item->SaveToDB(trans); #else diff --git a/PlayerMethods.h b/PlayerMethods.h index fee9473..d8416d0 100644 --- a/PlayerMethods.h +++ b/PlayerMethods.h @@ -2913,7 +2913,7 @@ namespace LuaPlayer if (sWorld->getBoolConfig(CONFIG_QUEST_ENABLE_QUEST_TRACKER)) // check if Quest Tracker is enabled { // prepare Quest Tracker datas - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_QUEST_TRACK_GM_COMPLETE); + CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_QUEST_TRACK_GM_COMPLETE); stmt->setUInt32(0, quest->GetQuestId()); stmt->setUInt32(1, player->GetGUID().GetCounter());