Required changes for latest TC

This commit is contained in:
Foereaper
2020-09-12 15:44:02 +02:00
parent 31f4cfd98c
commit b6a450569e
13 changed files with 84 additions and 24 deletions

View File

@@ -1161,7 +1161,9 @@ auto const& threatlist = creature->getThreatManager().getThreatList();
{ {
uint32 msTimeToDespawn = Eluna::CHECKVAL<uint32>(L, 2, 0); uint32 msTimeToDespawn = Eluna::CHECKVAL<uint32>(L, 2, 0);
#if defined TRINITY || AZEROTHCORE #if defined TRINITY
creature->DespawnOrUnsummon(Milliseconds(msTimeToDespawn));
#elif defined AZEROTHCORE
creature->DespawnOrUnsummon(msTimeToDespawn); creature->DespawnOrUnsummon(msTimeToDespawn);
#else #else
creature->ForcedDespawn(msTimeToDespawn); creature->ForcedDespawn(msTimeToDespawn);

View File

@@ -42,8 +42,6 @@
#if defined TRINITY #if defined TRINITY
#include "GitRevision.h" #include "GitRevision.h"
#include "SpellHistory.h" #include "SpellHistory.h"
#include <boost/thread/locks.hpp>
#include <boost/thread/shared_mutex.hpp>
#endif #endif
#if defined TRINITY || defined AZEROTHCORE #if defined TRINITY || defined AZEROTHCORE

View File

@@ -9,6 +9,7 @@
#include "lmarshal.h" #include "lmarshal.h"
#ifndef TRINITY
void ElunaInstanceAI::Initialize() void ElunaInstanceAI::Initialize()
{ {
LOCK_ELUNA; LOCK_ELUNA;
@@ -22,6 +23,7 @@ void ElunaInstanceAI::Initialize()
sEluna->OnInitialize(this); sEluna->OnInitialize(this);
} }
#endif
void ElunaInstanceAI::Load(const char* data) void ElunaInstanceAI::Load(const char* data)
{ {
@@ -82,7 +84,9 @@ void ElunaInstanceAI::Load(const char* data)
lua_pop(L, 1); lua_pop(L, 1);
// Stack: (empty) // Stack: (empty)
#ifndef TRINITY
Initialize(); Initialize();
#endif
} }
} }
else else
@@ -92,7 +96,9 @@ void ElunaInstanceAI::Load(const char* data)
lua_pop(L, 1); lua_pop(L, 1);
// Stack: (empty) // Stack: (empty)
#ifndef TRINITY
Initialize(); Initialize();
#endif
} }
delete[] decodedData; delete[] decodedData;
@@ -100,7 +106,10 @@ void ElunaInstanceAI::Load(const char* data)
else else
{ {
ELUNA_LOG_ERROR("Error while decoding instance data: Data is not valid base-64"); ELUNA_LOG_ERROR("Error while decoding instance data: Data is not valid base-64");
#ifndef TRINITY
Initialize(); Initialize();
#endif
} }
} }

View File

@@ -65,7 +65,9 @@ public:
{ {
} }
#ifndef TRINITY
void Initialize() override; void Initialize() override;
#endif
/* /*
* These are responsible for serializing/deserializing the instance's * These are responsible for serializing/deserializing the instance's

View File

@@ -181,7 +181,7 @@ namespace LuaGlobalFunctions
#else #else
{ {
#ifdef TRINITY #ifdef TRINITY
boost::shared_lock<boost::shared_mutex> lock(*HashMapHolder<Player>::GetLock()); std::shared_lock<std::shared_mutex> lock(*HashMapHolder<Player>::GetLock());
#elif defined(AZEROTHCORE) #elif defined(AZEROTHCORE)
ACORE_READ_GUARD(HashMapHolder<Player>::LockType, *HashMapHolder<Player>::GetLock()); ACORE_READ_GUARD(HashMapHolder<Player>::LockType, *HashMapHolder<Player>::GetLock());
#else #else
@@ -477,7 +477,7 @@ namespace LuaGlobalFunctions
if (!areaEntry) if (!areaEntry)
return luaL_argerror(L, 1, "valid Area or Zone ID expected"); return luaL_argerror(L, 1, "valid Area or Zone ID expected");
Eluna::Push(L, areaEntry->area_name[locale]); Eluna::Push(L, areaEntry->AreaName[locale]);
return 1; return 1;
} }
@@ -2300,10 +2300,10 @@ namespace LuaGlobalFunctions
TaxiPathNodeEntry entry; TaxiPathNodeEntry entry;
#ifdef TRINITY #ifdef TRINITY
// mandatory // mandatory
entry.MapID = Eluna::CHECKVAL<uint32>(L, start); entry.ContinentID = Eluna::CHECKVAL<uint32>(L, start);
entry.LocX = Eluna::CHECKVAL<float>(L, start + 1); entry.Loc.X = Eluna::CHECKVAL<float>(L, start + 1);
entry.LocY = Eluna::CHECKVAL<float>(L, start + 2); entry.Loc.Y = Eluna::CHECKVAL<float>(L, start + 2);
entry.LocZ = Eluna::CHECKVAL<float>(L, start + 3); entry.Loc.Z = Eluna::CHECKVAL<float>(L, start + 3);
// optional // optional
entry.Flags = Eluna::CHECKVAL<uint32>(L, start + 4, 0); entry.Flags = Eluna::CHECKVAL<uint32>(L, start + 4, 0);
entry.Delay = Eluna::CHECKVAL<uint32>(L, start + 5, 0); entry.Delay = Eluna::CHECKVAL<uint32>(L, start + 5, 0);
@@ -2351,10 +2351,10 @@ namespace LuaGlobalFunctions
entry.PathID = pathId; entry.PathID = pathId;
entry.NodeIndex = nodeId; entry.NodeIndex = nodeId;
nodeEntry->ID = index; nodeEntry->ID = index;
nodeEntry->map_id = entry.MapID; nodeEntry->ContinentID = entry.ContinentID;
nodeEntry->x = entry.LocX; nodeEntry->Pos.X = entry.Loc.X;
nodeEntry->y = entry.LocY; nodeEntry->Pos.Y = entry.Loc.Y;
nodeEntry->z = entry.LocZ; nodeEntry->Pos.Z = entry.Loc.Z;
nodeEntry->MountCreatureID[0] = mountH; nodeEntry->MountCreatureID[0] = mountH;
nodeEntry->MountCreatureID[1] = mountA; nodeEntry->MountCreatureID[1] = mountA;
sTaxiNodesStore.SetEntry(nodeId++, nodeEntry); sTaxiNodesStore.SetEntry(nodeId++, nodeEntry);
@@ -2381,10 +2381,16 @@ namespace LuaGlobalFunctions
return 1; return 1;
sTaxiPathSetBySource[startNode][nodeId - 1] = TaxiPathBySourceAndDestination(pathId, price); sTaxiPathSetBySource[startNode][nodeId - 1] = TaxiPathBySourceAndDestination(pathId, price);
TaxiPathEntry* pathEntry = new TaxiPathEntry(); TaxiPathEntry* pathEntry = new TaxiPathEntry();
#ifdef TRINITY
pathEntry->FromTaxiNode = startNode;
pathEntry->ToTaxiNode = nodeId - 1;
pathEntry->Cost = price;
#else
pathEntry->from = startNode; pathEntry->from = startNode;
pathEntry->to = nodeId - 1; pathEntry->to = nodeId - 1;
pathEntry->ID = pathId;
pathEntry->price = price; pathEntry->price = price;
#endif
pathEntry->ID = pathId;
sTaxiPathStore.SetEntry(pathId, pathEntry); sTaxiPathStore.SetEntry(pathId, pathEntry);
Eluna::Push(L, pathId); Eluna::Push(L, pathId);
return 1; return 1;

View File

@@ -37,7 +37,7 @@ namespace LuaGuild
#else #else
{ {
#ifdef TRINITY #ifdef TRINITY
boost::shared_lock<boost::shared_mutex> lock(*HashMapHolder<Player>::GetLock()); std::shared_lock<std::shared_mutex> lock(*HashMapHolder<Player>::GetLock());
#elif defined(AZEROTHCORE) #elif defined(AZEROTHCORE)
ACORE_READ_GUARD(HashMapHolder<Player>::LockType, *HashMapHolder<Player>::GetLock()); ACORE_READ_GUARD(HashMapHolder<Player>::LockType, *HashMapHolder<Player>::GetLock());
#else #else

View File

@@ -274,24 +274,40 @@ namespace LuaItem
#if defined(CATA) || defined (MISTS) #if defined(CATA) || defined (MISTS)
char* suffix = NULL; char* suffix = NULL;
#else #else
#ifdef TRINITY
std::array<char const*, 16> const* suffix = NULL;
#elif
char* const* suffix = NULL; char* const* suffix = NULL;
#endif
#endif #endif
if (itemRandPropId < 0) if (itemRandPropId < 0)
{ {
const ItemRandomSuffixEntry* itemRandEntry = sItemRandomSuffixStore.LookupEntry(-item->GetItemRandomPropertyId()); const ItemRandomSuffixEntry* itemRandEntry = sItemRandomSuffixStore.LookupEntry(-item->GetItemRandomPropertyId());
if (itemRandEntry) if (itemRandEntry)
#ifdef TRINITY
suffix = &itemRandEntry->Name;
#else
suffix = itemRandEntry->nameSuffix; suffix = itemRandEntry->nameSuffix;
#endif
} }
else else
{ {
const ItemRandomPropertiesEntry* itemRandEntry = sItemRandomPropertiesStore.LookupEntry(item->GetItemRandomPropertyId()); const ItemRandomPropertiesEntry* itemRandEntry = sItemRandomPropertiesStore.LookupEntry(item->GetItemRandomPropertyId());
if (itemRandEntry) if (itemRandEntry)
#ifdef TRINITY
suffix = &itemRandEntry->Name;
#else
suffix = itemRandEntry->nameSuffix; suffix = itemRandEntry->nameSuffix;
#endif
} }
if (suffix) if (suffix)
{ {
name += ' '; name += ' ';
#if defined TRINITY
name += (*suffix)[(name != temp->Name1) ? locale : uint8(DEFAULT_LOCALE)];
#else
name += suffix[(name != temp->Name1) ? locale : uint8(DEFAULT_LOCALE)]; name += suffix[(name != temp->Name1) ? locale : uint8(DEFAULT_LOCALE)];
#endif
} }
} }
#endif #endif

View File

@@ -399,7 +399,7 @@ ElunaRegister<Unit> UnitMethods[] =
{ "StopSpellCast", &LuaUnit::StopSpellCast }, { "StopSpellCast", &LuaUnit::StopSpellCast },
{ "InterruptSpell", &LuaUnit::InterruptSpell }, { "InterruptSpell", &LuaUnit::InterruptSpell },
{ "SendChatMessageToPlayer", &LuaUnit::SendChatMessageToPlayer }, { "SendChatMessageToPlayer", &LuaUnit::SendChatMessageToPlayer },
{ "Emote", &LuaUnit::Emote }, { "PerformEmote", &LuaUnit::PerformEmote },
{ "EmoteState", &LuaUnit::EmoteState }, { "EmoteState", &LuaUnit::EmoteState },
{ "CountPctFromCurHealth", &LuaUnit::CountPctFromCurHealth }, { "CountPctFromCurHealth", &LuaUnit::CountPctFromCurHealth },
{ "CountPctFromMaxHealth", &LuaUnit::CountPctFromMaxHealth }, { "CountPctFromMaxHealth", &LuaUnit::CountPctFromMaxHealth },

View File

@@ -2262,10 +2262,11 @@ namespace LuaPlayer
WorldPacket data(MSG_AUCTION_HELLO, 12); WorldPacket data(MSG_AUCTION_HELLO, 12);
#ifdef TRINITY #ifdef TRINITY
data << uint64(unit->GetGUID().GetCounter()); data << uint64(unit->GetGUID().GetCounter());
data << uint32(ahEntry->ID);
#else #else
data << uint64(unit->GetGUIDLow()); data << uint64(unit->GetGUIDLow());
#endif
data << uint32(ahEntry->houseId); data << uint32(ahEntry->houseId);
#endif
data << uint8(1); data << uint8(1);
#ifdef CMANGOS #ifdef CMANGOS
player->GetSession()->SendPacket(data); player->GetSession()->SendPacket(data);
@@ -3312,11 +3313,19 @@ namespace LuaPlayer
{ {
if (SkillLineEntry const* entry = sSkillLineStore.LookupEntry(i)) if (SkillLineEntry const* entry = sSkillLineStore.LookupEntry(i))
{ {
#ifdef TRINITY
if (entry->CategoryID == SKILL_CATEGORY_LANGUAGES || entry->CategoryID == SKILL_CATEGORY_GENERIC)
continue;
if (player->HasSkill(entry->ID))
player->UpdateSkill(entry->ID, step);
#else
if (entry->categoryId == SKILL_CATEGORY_LANGUAGES || entry->categoryId == SKILL_CATEGORY_GENERIC) if (entry->categoryId == SKILL_CATEGORY_LANGUAGES || entry->categoryId == SKILL_CATEGORY_GENERIC)
continue; continue;
if (player->HasSkill(entry->id)) if (player->HasSkill(entry->id))
player->UpdateSkill(entry->id, step); player->UpdateSkill(entry->id, step);
#endif
} }
} }

View File

@@ -116,10 +116,13 @@ bool Eluna::OnAreaTrigger(Player* pPlayer, AreaTriggerEntry const* pTrigger)
{ {
START_HOOK_WITH_RETVAL(TRIGGER_EVENT_ON_TRIGGER, false); START_HOOK_WITH_RETVAL(TRIGGER_EVENT_ON_TRIGGER, false);
Push(pPlayer); Push(pPlayer);
#ifndef AZEROTHCORE #ifdef TRINITY
Push(pTrigger->id); Push(pTrigger->ID);
#else #elif AZEROTHCORE
Push(pTrigger->entry); Push(pTrigger->entry);
#else
Push(pTrigger->id);
#endif #endif
return CallAllFunctionsBool(ServerEventBindings, key); return CallAllFunctionsBool(ServerEventBindings, key);
} }

View File

@@ -1163,7 +1163,11 @@ namespace LuaUnit
if (!entry) if (!entry)
return 1; return 1;
#ifdef TRINITY
Eluna::Push(L, entry->Name[locale]);
#else
Eluna::Push(L, entry->name[locale]); Eluna::Push(L, entry->name[locale]);
#endif
return 1; return 1;
} }
@@ -1202,7 +1206,11 @@ namespace LuaUnit
if (!entry) if (!entry)
return 1; return 1;
#ifdef TRINITY
Eluna::Push(L, entry->Name[locale]);
#else
Eluna::Push(L, entry->name[locale]); Eluna::Push(L, entry->name[locale]);
#endif
return 1; return 1;
} }
@@ -2033,9 +2041,14 @@ namespace LuaUnit
* *
* @param uint32 emoteId * @param uint32 emoteId
*/ */
int Emote(lua_State* L, Unit* unit) int PerformEmote(lua_State* L, Unit* unit)
{ {
#ifdef TRINITY
Emote emote = static_cast<Emote>(Eluna::CHECKVAL<uint32>(L, 2));
unit->HandleEmoteCommand(emote);
#else
unit->HandleEmoteCommand(Eluna::CHECKVAL<uint32>(L, 2)); unit->HandleEmoteCommand(Eluna::CHECKVAL<uint32>(L, 2));
#endif
return 0; return 0;
} }

View File

@@ -53,7 +53,9 @@ namespace LuaVehicle
*/ */
int GetEntry(lua_State* L, Vehicle* vehicle) int GetEntry(lua_State* L, Vehicle* vehicle)
{ {
#if defined TRINITY || AZEROTHCORE #ifdef TRINITY
Eluna::Push(L, vehicle->GetVehicleInfo()->ID);
#elif AZEROTHCORE
Eluna::Push(L, vehicle->GetVehicleInfo()->m_ID); Eluna::Push(L, vehicle->GetVehicleInfo()->m_ID);
#else #else
Eluna::Push(L, vehicle->GetVehicleEntry()->m_ID); Eluna::Push(L, vehicle->GetVehicleEntry()->m_ID);

View File

@@ -717,7 +717,7 @@ namespace LuaWorldObject
uint32 respawnDelay = Eluna::CHECKVAL<uint32>(L, 7, 30); uint32 respawnDelay = Eluna::CHECKVAL<uint32>(L, 7, 30);
#ifdef TRINITY #ifdef TRINITY
QuaternionData rot = QuaternionData::fromEulerAnglesZYX(o, 0.f, 0.f); QuaternionData rot = QuaternionData::fromEulerAnglesZYX(o, 0.f, 0.f);
Eluna::Push(L, obj->SummonGameObject(entry, Position(x, y, z, o), rot, respawnDelay)); Eluna::Push(L, obj->SummonGameObject(entry, Position(x, y, z, o), rot, Seconds(respawnDelay)));
#elif AZEROTHCORE #elif AZEROTHCORE
Eluna::Push(L, obj->SummonGameObject(entry, x, y, z, o, 0, 0, 0, 0, respawnDelay)); Eluna::Push(L, obj->SummonGameObject(entry, x, y, z, o, 0, 0, 0, 0, respawnDelay));
#else #else
@@ -804,7 +804,7 @@ namespace LuaWorldObject
default: default:
return luaL_argerror(L, 7, "valid SpawnType expected"); return luaL_argerror(L, 7, "valid SpawnType expected");
} }
Eluna::Push(L, obj->SummonCreature(entry, x, y, z, o, type, despawnTimer)); Eluna::Push(L, obj->SummonCreature(entry, x, y, z, o, type, Seconds(despawnTimer)));
return 1; return 1;
} }