Remove corpse methods (report if needing them) and made changes to objectaccessor required by TC

See 402a3c45ff for more
This commit is contained in:
Rochet2
2015-09-30 22:00:53 +03:00
parent 64a442a887
commit 28161fa2fc
6 changed files with 14 additions and 69 deletions

View File

@@ -91,7 +91,7 @@ typedef Opcodes OpcodesList;
#define eObjectMgr (sObjectMgr) #define eObjectMgr (sObjectMgr)
#define eAccountMgr (sAccountMgr) #define eAccountMgr (sAccountMgr)
#define eAuctionMgr (sAuctionMgr) #define eAuctionMgr (sAuctionMgr)
#define eObjectAccessor (sObjectAccessor) #define eObjectAccessor() ObjectAccessor::
#define REGEN_TIME_FULL #define REGEN_TIME_FULL
typedef ThreatContainer::StorageType ThreatList; typedef ThreatContainer::StorageType ThreatList;
@@ -108,7 +108,7 @@ typedef ThreatContainer::StorageType ThreatList;
#define eObjectMgr (&sObjectMgr) #define eObjectMgr (&sObjectMgr)
#define eAccountMgr (&sAccountMgr) #define eAccountMgr (&sAccountMgr)
#define eAuctionMgr (&sAuctionMgr) #define eAuctionMgr (&sAuctionMgr)
#define eObjectAccessor (&sObjectAccessor) #define eObjectAccessor() sObjectAccessor.
#define SERVER_MSG_STRING SERVER_MSG_CUSTOM #define SERVER_MSG_STRING SERVER_MSG_CUSTOM
#define TOTAL_LOCALES MAX_LOCALE #define TOTAL_LOCALES MAX_LOCALE
#define DIALOG_STATUS_SCRIPTED_NO_STATUS DIALOG_STATUS_UNDEFINED #define DIALOG_STATUS_SCRIPTED_NO_STATUS DIALOG_STATUS_UNDEFINED

View File

@@ -98,7 +98,7 @@ namespace LuaGlobalFunctions
int GetPlayerByGUID(Eluna* /*E*/, lua_State* L) int GetPlayerByGUID(Eluna* /*E*/, lua_State* L)
{ {
uint64 guid = Eluna::CHECKVAL<uint64>(L, 1); uint64 guid = Eluna::CHECKVAL<uint64>(L, 1);
Eluna::Push(L, eObjectAccessor->FindPlayer(ObjectGuid(guid))); Eluna::Push(L, eObjectAccessor()FindPlayer(ObjectGuid(guid)));
return 1; return 1;
} }
@@ -111,7 +111,7 @@ namespace LuaGlobalFunctions
int GetPlayerByName(Eluna* /*E*/, lua_State* L) int GetPlayerByName(Eluna* /*E*/, lua_State* L)
{ {
const char* name = Eluna::CHECKVAL<const char*>(L, 1); const char* name = Eluna::CHECKVAL<const char*>(L, 1);
Eluna::Push(L, eObjectAccessor->FindPlayerByName(name)); Eluna::Push(L, eObjectAccessor()FindPlayerByName(name));
return 1; return 1;
} }
@@ -155,7 +155,7 @@ namespace LuaGlobalFunctions
#else #else
HashMapHolder<Player>::ReadGuard g(HashMapHolder<Player>::GetLock()); HashMapHolder<Player>::ReadGuard g(HashMapHolder<Player>::GetLock());
#endif #endif
const HashMapHolder<Player>::MapType& m = eObjectAccessor->GetPlayers(); const HashMapHolder<Player>::MapType& m = eObjectAccessor()GetPlayers();
for (HashMapHolder<Player>::MapType::const_iterator it = m.begin(); it != m.end(); ++it) for (HashMapHolder<Player>::MapType::const_iterator it = m.begin(); it != m.end(); ++it)
{ {
if (Player* player = it->second) if (Player* player = it->second)
@@ -1900,7 +1900,7 @@ namespace LuaGlobalFunctions
*/ */
int SaveAllPlayers(Eluna* /*E*/, lua_State* /*L*/) int SaveAllPlayers(Eluna* /*E*/, lua_State* /*L*/)
{ {
eObjectAccessor->SaveAllPlayers(); eObjectAccessor()SaveAllPlayers();
return 0; return 0;
} }
@@ -2242,57 +2242,6 @@ namespace LuaGlobalFunctions
return 1; 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<Corpse>(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<Corpse>(L, 1);
eObjectAccessor->RemoveCorpse(corpse);
Eluna::CHECKOBJ<ElunaObject>(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<uint64>(L, 1);
bool insignia = Eluna::CHECKVAL<bool>(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`. * Returns `true` if the bag and slot is a valid inventory position, otherwise `false`.
* *

View File

@@ -29,7 +29,7 @@ namespace LuaGuild
#else #else
HashMapHolder<Player>::ReadGuard g(HashMapHolder<Player>::GetLock()); HashMapHolder<Player>::ReadGuard g(HashMapHolder<Player>::GetLock());
#endif #endif
const HashMapHolder<Player>::MapType& m = eObjectAccessor->GetPlayers(); const HashMapHolder<Player>::MapType& m = eObjectAccessor()GetPlayers();
for (HashMapHolder<Player>::MapType::const_iterator it = m.begin(); it != m.end(); ++it) for (HashMapHolder<Player>::MapType::const_iterator it = m.begin(); it != m.end(); ++it)
{ {
if (Player* player = it->second) if (Player* player = it->second)
@@ -68,9 +68,9 @@ namespace LuaGuild
int GetLeader(Eluna* /*E*/, lua_State* L, Guild* guild) int GetLeader(Eluna* /*E*/, lua_State* L, Guild* guild)
{ {
#ifndef TRINITY #ifndef TRINITY
Eluna::Push(L, eObjectAccessor->FindPlayer(guild->GetLeaderGuid())); Eluna::Push(L, eObjectAccessor()FindPlayer(guild->GetLeaderGuid()));
#else #else
Eluna::Push(L, eObjectAccessor->FindPlayer(guild->GetLeaderGUID())); Eluna::Push(L, eObjectAccessor()FindPlayer(guild->GetLeaderGUID()));
#endif #endif
return 1; return 1;
} }

View File

@@ -138,10 +138,6 @@ ElunaGlobal::ElunaRegister GlobalMethods[] =
{ "SaveAllPlayers", &LuaGlobalFunctions::SaveAllPlayers }, { "SaveAllPlayers", &LuaGlobalFunctions::SaveAllPlayers },
{ "SendMail", &LuaGlobalFunctions::SendMail }, { "SendMail", &LuaGlobalFunctions::SendMail },
{ "AddTaxiPath", &LuaGlobalFunctions::AddTaxiPath }, { "AddTaxiPath", &LuaGlobalFunctions::AddTaxiPath },
{ "AddCorpse", &LuaGlobalFunctions::AddCorpse },
{ "RemoveCorpse", &LuaGlobalFunctions::RemoveCorpse },
{ "ConvertCorpseForPlayer", &LuaGlobalFunctions::ConvertCorpseForPlayer },
{ "RemoveOldCorpses", &LuaGlobalFunctions::RemoveOldCorpses },
{ "CreateInt64", &LuaGlobalFunctions::CreateLongLong }, { "CreateInt64", &LuaGlobalFunctions::CreateLongLong },
{ "CreateUint64", &LuaGlobalFunctions::CreateULongLong }, { "CreateUint64", &LuaGlobalFunctions::CreateULongLong },

View File

@@ -213,7 +213,7 @@ namespace LuaMap
switch (GUID_HIPART(guid)) switch (GUID_HIPART(guid))
{ {
case HIGHGUID_PLAYER: case HIGHGUID_PLAYER:
Eluna::Push(L, sObjectAccessor->GetPlayer(map, ObjectGuid(guid))); Eluna::Push(L, eObjectAccessor()GetPlayer(map, ObjectGuid(guid)));
break; break;
case HIGHGUID_TRANSPORT: case HIGHGUID_TRANSPORT:
case HIGHGUID_MO_TRANSPORT: case HIGHGUID_MO_TRANSPORT:

View File

@@ -107,7 +107,7 @@ void Eluna::OnChange(Weather* weather, uint32 zone, WeatherState state, float gr
// Auction House // Auction House
void Eluna::OnAdd(AuctionHouseObject* /*ah*/, AuctionEntry* entry) 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 #ifdef TRINITY
Item* item = eAuctionMgr->GetAItem(entry->itemGUIDLow); Item* item = eAuctionMgr->GetAItem(entry->itemGUIDLow);
uint32 expiretime = entry->expire_time; uint32 expiretime = entry->expire_time;
@@ -134,7 +134,7 @@ void Eluna::OnAdd(AuctionHouseObject* /*ah*/, AuctionEntry* entry)
void Eluna::OnRemove(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 #ifdef TRINITY
Item* item = eAuctionMgr->GetAItem(entry->itemGUIDLow); Item* item = eAuctionMgr->GetAItem(entry->itemGUIDLow);
uint32 expiretime = entry->expire_time; uint32 expiretime = entry->expire_time;
@@ -161,7 +161,7 @@ void Eluna::OnRemove(AuctionHouseObject* /*ah*/, AuctionEntry* entry)
void Eluna::OnSuccessful(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 #ifdef TRINITY
Item* item = eAuctionMgr->GetAItem(entry->itemGUIDLow); Item* item = eAuctionMgr->GetAItem(entry->itemGUIDLow);
uint32 expiretime = entry->expire_time; uint32 expiretime = entry->expire_time;
@@ -188,7 +188,7 @@ void Eluna::OnSuccessful(AuctionHouseObject* /*ah*/, AuctionEntry* entry)
void Eluna::OnExpire(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 #ifdef TRINITY
Item* item = eAuctionMgr->GetAItem(entry->itemGUIDLow); Item* item = eAuctionMgr->GetAItem(entry->itemGUIDLow);
uint32 expiretime = entry->expire_time; uint32 expiretime = entry->expire_time;