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);
#if defined TRINITY || AZEROTHCORE
#if defined TRINITY
creature->DespawnOrUnsummon(Milliseconds(msTimeToDespawn));
#elif defined AZEROTHCORE
creature->DespawnOrUnsummon(msTimeToDespawn);
#else
creature->ForcedDespawn(msTimeToDespawn);

View File

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

View File

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

View File

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

View File

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

View File

@@ -37,7 +37,7 @@ namespace LuaGuild
#else
{
#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)
ACORE_READ_GUARD(HashMapHolder<Player>::LockType, *HashMapHolder<Player>::GetLock());
#else

View File

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

View File

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

View File

@@ -2262,10 +2262,11 @@ namespace LuaPlayer
WorldPacket data(MSG_AUCTION_HELLO, 12);
#ifdef TRINITY
data << uint64(unit->GetGUID().GetCounter());
data << uint32(ahEntry->ID);
#else
data << uint64(unit->GetGUIDLow());
#endif
data << uint32(ahEntry->houseId);
#endif
data << uint8(1);
#ifdef CMANGOS
player->GetSession()->SendPacket(data);
@@ -3312,11 +3313,19 @@ namespace LuaPlayer
{
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)
continue;
if (player->HasSkill(entry->id))
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);
Push(pPlayer);
#ifndef AZEROTHCORE
Push(pTrigger->id);
#else
#ifdef TRINITY
Push(pTrigger->ID);
#elif AZEROTHCORE
Push(pTrigger->entry);
#else
Push(pTrigger->id);
#endif
return CallAllFunctionsBool(ServerEventBindings, key);
}

View File

@@ -1163,7 +1163,11 @@ namespace LuaUnit
if (!entry)
return 1;
#ifdef TRINITY
Eluna::Push(L, entry->Name[locale]);
#else
Eluna::Push(L, entry->name[locale]);
#endif
return 1;
}
@@ -1202,7 +1206,11 @@ namespace LuaUnit
if (!entry)
return 1;
#ifdef TRINITY
Eluna::Push(L, entry->Name[locale]);
#else
Eluna::Push(L, entry->name[locale]);
#endif
return 1;
}
@@ -2033,9 +2041,14 @@ namespace LuaUnit
*
* @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));
#endif
return 0;
}

View File

@@ -53,7 +53,9 @@ namespace LuaVehicle
*/
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);
#else
Eluna::Push(L, vehicle->GetVehicleEntry()->m_ID);

View File

@@ -717,7 +717,7 @@ namespace LuaWorldObject
uint32 respawnDelay = Eluna::CHECKVAL<uint32>(L, 7, 30);
#ifdef TRINITY
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
Eluna::Push(L, obj->SummonGameObject(entry, x, y, z, o, 0, 0, 0, 0, respawnDelay));
#else
@@ -804,7 +804,7 @@ namespace LuaWorldObject
default:
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;
}