From 28161fa2fc4f09b0113fc1711ca5682379ae0de7 Mon Sep 17 00:00:00 2001 From: Rochet2 Date: Wed, 30 Sep 2015 22:00:53 +0300 Subject: [PATCH] Remove corpse methods (report if needing them) and made changes to objectaccessor required by TC See https://github.com/TrinityCore/TrinityCore/commit/402a3c45ffe65597d9863dce5fb76362795d706a for more --- ElunaIncludes.h | 4 ++-- GlobalMethods.h | 59 ++++-------------------------------------------- GuildMethods.h | 6 ++--- LuaFunctions.cpp | 4 ---- MapMethods.h | 2 +- ServerHooks.cpp | 8 +++---- 6 files changed, 14 insertions(+), 69 deletions(-) diff --git a/ElunaIncludes.h b/ElunaIncludes.h index 016f066..53c72e5 100644 --- a/ElunaIncludes.h +++ b/ElunaIncludes.h @@ -91,7 +91,7 @@ typedef Opcodes OpcodesList; #define eObjectMgr (sObjectMgr) #define eAccountMgr (sAccountMgr) #define eAuctionMgr (sAuctionMgr) -#define eObjectAccessor (sObjectAccessor) +#define eObjectAccessor() ObjectAccessor:: #define REGEN_TIME_FULL typedef ThreatContainer::StorageType ThreatList; @@ -108,7 +108,7 @@ typedef ThreatContainer::StorageType ThreatList; #define eObjectMgr (&sObjectMgr) #define eAccountMgr (&sAccountMgr) #define eAuctionMgr (&sAuctionMgr) -#define eObjectAccessor (&sObjectAccessor) +#define eObjectAccessor() sObjectAccessor. #define SERVER_MSG_STRING SERVER_MSG_CUSTOM #define TOTAL_LOCALES MAX_LOCALE #define DIALOG_STATUS_SCRIPTED_NO_STATUS DIALOG_STATUS_UNDEFINED diff --git a/GlobalMethods.h b/GlobalMethods.h index 9a4fdf1..34d6025 100644 --- a/GlobalMethods.h +++ b/GlobalMethods.h @@ -98,7 +98,7 @@ namespace LuaGlobalFunctions int GetPlayerByGUID(Eluna* /*E*/, lua_State* L) { uint64 guid = Eluna::CHECKVAL(L, 1); - Eluna::Push(L, eObjectAccessor->FindPlayer(ObjectGuid(guid))); + Eluna::Push(L, eObjectAccessor()FindPlayer(ObjectGuid(guid))); return 1; } @@ -111,7 +111,7 @@ namespace LuaGlobalFunctions int GetPlayerByName(Eluna* /*E*/, lua_State* L) { const char* name = Eluna::CHECKVAL(L, 1); - Eluna::Push(L, eObjectAccessor->FindPlayerByName(name)); + Eluna::Push(L, eObjectAccessor()FindPlayerByName(name)); return 1; } @@ -155,7 +155,7 @@ namespace LuaGlobalFunctions #else HashMapHolder::ReadGuard g(HashMapHolder::GetLock()); #endif - const HashMapHolder::MapType& m = eObjectAccessor->GetPlayers(); + const HashMapHolder::MapType& m = eObjectAccessor()GetPlayers(); for (HashMapHolder::MapType::const_iterator it = m.begin(); it != m.end(); ++it) { if (Player* player = it->second) @@ -1900,7 +1900,7 @@ namespace LuaGlobalFunctions */ int SaveAllPlayers(Eluna* /*E*/, lua_State* /*L*/) { - eObjectAccessor->SaveAllPlayers(); + eObjectAccessor()SaveAllPlayers(); return 0; } @@ -2242,57 +2242,6 @@ namespace LuaGlobalFunctions return 1; } - /** - * Adds a [Corpse] to the world. - * - * @param [Corpse] corpse : [Corpse] to add - */ - int AddCorpse(Eluna* /*E*/, lua_State* L) - { - Corpse* corpse = Eluna::CHECKOBJ(L, 1); - - eObjectAccessor->AddCorpse(corpse); - return 0; - } - - /** - * Removes a [Corpse] from the world. - * - * @param [Corpse] corpse : [Corpse] to remove - */ - int RemoveCorpse(Eluna* /*E*/, lua_State* L) - { - Corpse* corpse = Eluna::CHECKOBJ(L, 1); - eObjectAccessor->RemoveCorpse(corpse); - Eluna::CHECKOBJ(L, 1)->Invalidate(); - return 0; - } - - /** - * Converts a [Corpse] by GUID, and optionally allows for insignia to be looted. - * - * @param uint64 playerGUID : GUID of the [Player] - * @param bool insignia = false : if `true`, allow an insignia to be looted - * @return [Corpse] corpse : returns converted [Corpse] - */ - int ConvertCorpseForPlayer(Eluna* /*E*/, lua_State* L) - { - uint64 guid = Eluna::CHECKVAL(L, 1); - bool insignia = Eluna::CHECKVAL(L, 2, false); - - Eluna::Push(L, eObjectAccessor->ConvertCorpseForPlayer(ObjectGuid(guid), insignia)); - return 1; - } - - /** - * Removes old [Corpse]s from the world. - */ - int RemoveOldCorpses(Eluna* /*E*/, lua_State* /*L*/) - { - eObjectAccessor->RemoveOldCorpses(); - return 0; - } - /** * Returns `true` if the bag and slot is a valid inventory position, otherwise `false`. * diff --git a/GuildMethods.h b/GuildMethods.h index b4d5079..7314823 100644 --- a/GuildMethods.h +++ b/GuildMethods.h @@ -29,7 +29,7 @@ namespace LuaGuild #else HashMapHolder::ReadGuard g(HashMapHolder::GetLock()); #endif - const HashMapHolder::MapType& m = eObjectAccessor->GetPlayers(); + const HashMapHolder::MapType& m = eObjectAccessor()GetPlayers(); for (HashMapHolder::MapType::const_iterator it = m.begin(); it != m.end(); ++it) { if (Player* player = it->second) @@ -68,9 +68,9 @@ namespace LuaGuild int GetLeader(Eluna* /*E*/, lua_State* L, Guild* guild) { #ifndef TRINITY - Eluna::Push(L, eObjectAccessor->FindPlayer(guild->GetLeaderGuid())); + Eluna::Push(L, eObjectAccessor()FindPlayer(guild->GetLeaderGuid())); #else - Eluna::Push(L, eObjectAccessor->FindPlayer(guild->GetLeaderGUID())); + Eluna::Push(L, eObjectAccessor()FindPlayer(guild->GetLeaderGUID())); #endif return 1; } diff --git a/LuaFunctions.cpp b/LuaFunctions.cpp index e6e2548..e0f1374 100644 --- a/LuaFunctions.cpp +++ b/LuaFunctions.cpp @@ -138,10 +138,6 @@ ElunaGlobal::ElunaRegister GlobalMethods[] = { "SaveAllPlayers", &LuaGlobalFunctions::SaveAllPlayers }, { "SendMail", &LuaGlobalFunctions::SendMail }, { "AddTaxiPath", &LuaGlobalFunctions::AddTaxiPath }, - { "AddCorpse", &LuaGlobalFunctions::AddCorpse }, - { "RemoveCorpse", &LuaGlobalFunctions::RemoveCorpse }, - { "ConvertCorpseForPlayer", &LuaGlobalFunctions::ConvertCorpseForPlayer }, - { "RemoveOldCorpses", &LuaGlobalFunctions::RemoveOldCorpses }, { "CreateInt64", &LuaGlobalFunctions::CreateLongLong }, { "CreateUint64", &LuaGlobalFunctions::CreateULongLong }, diff --git a/MapMethods.h b/MapMethods.h index e3d5486..9d1c82f 100644 --- a/MapMethods.h +++ b/MapMethods.h @@ -213,7 +213,7 @@ namespace LuaMap switch (GUID_HIPART(guid)) { case HIGHGUID_PLAYER: - Eluna::Push(L, sObjectAccessor->GetPlayer(map, ObjectGuid(guid))); + Eluna::Push(L, eObjectAccessor()GetPlayer(map, ObjectGuid(guid))); break; case HIGHGUID_TRANSPORT: case HIGHGUID_MO_TRANSPORT: diff --git a/ServerHooks.cpp b/ServerHooks.cpp index 2ab3da7..10a7e22 100644 --- a/ServerHooks.cpp +++ b/ServerHooks.cpp @@ -107,7 +107,7 @@ void Eluna::OnChange(Weather* weather, uint32 zone, WeatherState state, float gr // Auction House void Eluna::OnAdd(AuctionHouseObject* /*ah*/, AuctionEntry* entry) { - Player* owner = eObjectAccessor->FindPlayer(MAKE_NEW_GUID(entry->owner, 0, HIGHGUID_PLAYER)); + Player* owner = eObjectAccessor()FindPlayer(MAKE_NEW_GUID(entry->owner, 0, HIGHGUID_PLAYER)); #ifdef TRINITY Item* item = eAuctionMgr->GetAItem(entry->itemGUIDLow); uint32 expiretime = entry->expire_time; @@ -134,7 +134,7 @@ void Eluna::OnAdd(AuctionHouseObject* /*ah*/, AuctionEntry* entry) void Eluna::OnRemove(AuctionHouseObject* /*ah*/, AuctionEntry* entry) { - Player* owner = eObjectAccessor->FindPlayer(MAKE_NEW_GUID(entry->owner, 0, HIGHGUID_PLAYER)); + Player* owner = eObjectAccessor()FindPlayer(MAKE_NEW_GUID(entry->owner, 0, HIGHGUID_PLAYER)); #ifdef TRINITY Item* item = eAuctionMgr->GetAItem(entry->itemGUIDLow); uint32 expiretime = entry->expire_time; @@ -161,7 +161,7 @@ void Eluna::OnRemove(AuctionHouseObject* /*ah*/, AuctionEntry* entry) void Eluna::OnSuccessful(AuctionHouseObject* /*ah*/, AuctionEntry* entry) { - Player* owner = eObjectAccessor->FindPlayer(MAKE_NEW_GUID(entry->owner, 0, HIGHGUID_PLAYER)); + Player* owner = eObjectAccessor()FindPlayer(MAKE_NEW_GUID(entry->owner, 0, HIGHGUID_PLAYER)); #ifdef TRINITY Item* item = eAuctionMgr->GetAItem(entry->itemGUIDLow); uint32 expiretime = entry->expire_time; @@ -188,7 +188,7 @@ void Eluna::OnSuccessful(AuctionHouseObject* /*ah*/, AuctionEntry* entry) void Eluna::OnExpire(AuctionHouseObject* /*ah*/, AuctionEntry* entry) { - Player* owner = eObjectAccessor->FindPlayer(MAKE_NEW_GUID(entry->owner, 0, HIGHGUID_PLAYER)); + Player* owner = eObjectAccessor()FindPlayer(MAKE_NEW_GUID(entry->owner, 0, HIGHGUID_PLAYER)); #ifdef TRINITY Item* item = eAuctionMgr->GetAItem(entry->itemGUIDLow); uint32 expiretime = entry->expire_time;