Skip to content

Commit

Permalink
TC Retail Changes pt. 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Niam5 committed Jul 13, 2024
1 parent d78f69c commit ac23f8f
Show file tree
Hide file tree
Showing 20 changed files with 416 additions and 232 deletions.
6 changes: 1 addition & 5 deletions ElunaUtility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,7 @@ bool ElunaUtil::WorldObjectInRangeCheck::operator()(WorldObject* u)
{
if (i_obj_fact)
{
#if (defined CATA || defined RETAIL) && defined TRINITY
#if ((defined TRINITY || AZEROTHCORE || CMANGOS || VMANGOS) && (defined !CATA || !RETAIL))
if ((i_obj_fact->IsHostileTo(*target->GetFactionTemplateEntry())) != (i_hostile == 1))
return false;
#elif ((defined CATA || RETAIL) && defined TRINITY)
#if ((defined CATA || RETAIL) && defined TRINITY)
if ((i_obj_fact->IsHostileTo(target->GetFactionTemplateEntry())) != (i_hostile == 1))
return false;
#elif ((defined TRINITY || AZEROTHCORE || CMANGOS || VMANGOS) && !defined CATA)
Expand Down
10 changes: 5 additions & 5 deletions ElunaUtility.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,22 @@
typedef QueryResult ElunaQuery;
#define GET_GUID GetGUID
#define HIGHGUID_PLAYER HighGuid::Player
#define HIGHGUID_UNIT HighGuid::Unit
#define HIGHGUID_UNIT HighGuid::Creature
#define HIGHGUID_ITEM HighGuid::Item
#define HIGHGUID_GAMEOBJECT HighGuid::GameObject
#define HIGHGUID_PET HighGuid::Pet
#define HIGHGUID_TRANSPORT HighGuid::Transport
#define HIGHGUID_VEHICLE HighGuid::Vehicle
#define HIGHGUID_CONTAINER HighGuid::Container
//#define HIGHGUID_CONTAINER HighGuid::Container
#define HIGHGUID_DYNAMICOBJECT HighGuid::DynamicObject
#define HIGHGUID_CORPSE HighGuid::Corpse
#define HIGHGUID_MO_TRANSPORT HighGuid::Mo_Transport
#define HIGHGUID_MO_TRANSPORT HighGuid::Transport
#define HIGHGUID_INSTANCE HighGuid::Instance
#define HIGHGUID_GROUP HighGuid::Group
//#define HIGHGUID_GROUP HighGuid::Group
#endif

#ifdef TRINITY
#ifdef WOTLK
#if defined WOTLK || defined RETAIL
#include "fmt/printf.h"
#define ELUNA_LOG_TC_FMT(TC_LOG_MACRO, ...) \
try { \
Expand Down
8 changes: 4 additions & 4 deletions GossipHooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ bool Eluna::OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 sender,
auto original_menu = *pPlayer->GetPlayerMenu();
pPlayer->GetPlayerMenu()->ClearMenus();
#else
auto original_menu = *pPlayer->PlayerTalkClass;
auto original_menu = pPlayer->PlayerTalkClass->GetGossipMenu().GetMenuId();
pPlayer->PlayerTalkClass->ClearMenus();
#endif
HookPush(pPlayer);
Expand All @@ -154,7 +154,7 @@ bool Eluna::OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 sender,
#if defined CMANGOS && !defined(CATA)
*pPlayer->GetPlayerMenu() = original_menu;
#else
*pPlayer->PlayerTalkClass = original_menu;
pPlayer->PlayerTalkClass->GetGossipMenu().SetMenuId(original_menu);
#endif
}
return preventDefault;
Expand All @@ -167,7 +167,7 @@ bool Eluna::OnGossipSelectCode(Player* pPlayer, Creature* pCreature, uint32 send
auto original_menu = *pPlayer->GetPlayerMenu();
pPlayer->GetPlayerMenu()->ClearMenus();
#else
auto original_menu = *pPlayer->PlayerTalkClass;
auto original_menu = pPlayer->PlayerTalkClass->GetGossipMenu().GetMenuId();
pPlayer->PlayerTalkClass->ClearMenus();
#endif
HookPush(pPlayer);
Expand All @@ -180,7 +180,7 @@ bool Eluna::OnGossipSelectCode(Player* pPlayer, Creature* pCreature, uint32 send
#if defined CMANGOS &&!defined(CATA)
*pPlayer->GetPlayerMenu() = original_menu;
#else
*pPlayer->PlayerTalkClass = original_menu;
pPlayer->PlayerTalkClass->GetGossipMenu().SetMenuId(original_menu);
#endif
}
return preventDefault;
Expand Down
11 changes: 11 additions & 0 deletions GuildHooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ void Eluna::OnAddMember(Guild* guild, Player* player, uint32 plRank)
CallAllFunctions(GuildEventBindings, key);
}

#ifdef RETAIL
void Eluna::OnRemoveMember(Guild* guild, ObjectGuid guid, bool isDisbanding)
{
START_HOOK(GUILD_EVENT_ON_REMOVE_MEMBER);
HookPush(guild);
HookPush(guid);
HookPush(isDisbanding);
CallAllFunctions(GuildEventBindings, key);
}
#else
void Eluna::OnRemoveMember(Guild* guild, Player* player, bool isDisbanding)
{
START_HOOK(GUILD_EVENT_ON_REMOVE_MEMBER);
Expand All @@ -34,6 +44,7 @@ void Eluna::OnRemoveMember(Guild* guild, Player* player, bool isDisbanding)
HookPush(isDisbanding);
CallAllFunctions(GuildEventBindings, key);
}
#endif

void Eluna::OnMOTDChanged(Guild* guild, const std::string& newMotd)
{
Expand Down
7 changes: 4 additions & 3 deletions LuaEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ int Eluna::Register(uint8 regtype, uint32 entry, ObjectGuid guid, uint32 instanc
return 1; // Stack: callback
}
break;

#ifndef RETAIL
case Hooks::REGTYPE_PACKET:
if (event_id < Hooks::PACKET_EVENT_COUNT)
{
Expand All @@ -822,6 +822,7 @@ int Eluna::Register(uint8 regtype, uint32 entry, ObjectGuid guid, uint32 instanc
return 1; // Stack: callback
}
break;
#endif

case Hooks::REGTYPE_CREATURE:
if (event_id < Hooks::CREATURE_EVENT_COUNT)
Expand Down Expand Up @@ -989,13 +990,13 @@ int Eluna::Register(uint8 regtype, uint32 entry, ObjectGuid guid, uint32 instanc
void Eluna::UpdateEluna(uint32 diff)
{
if (reload)
#ifdef TRINITY
#if defined TRINITY && defined WOTLK
if(!GetQueryProcessor().HasPendingCallbacks())
#endif
_ReloadEluna();

eventMgr->globalProcessor->Update(diff);
#ifdef TRINITY
#if defined TRINITY && defined WOTLK
GetQueryProcessor().ProcessReadyCallbacks();
#endif
}
Expand Down
4 changes: 4 additions & 0 deletions LuaEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,11 @@ class ELUNA_GAME_API Eluna

/* Guild */
void OnAddMember(Guild* guild, Player* player, uint32 plRank);
#ifdef RETAIL
void OnRemoveMember(Guild* guild, ObjectGuid guid, bool isDisbanding);
#else
void OnRemoveMember(Guild* guild, Player* player, bool isDisbanding);
#endif
void OnMOTDChanged(Guild* guild, const std::string& newMotd);
void OnInfoChanged(Guild* guild, const std::string& newInfo);
void OnCreate(Guild* guild, Player* leader, const std::string& name);
Expand Down
9 changes: 6 additions & 3 deletions ServerHooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,10 @@ void Eluna::OnChange(Weather* /*weather*/, uint32 zone, WeatherState state, floa
CallAllFunctions(ServerEventBindings, key);
}

#ifndef RETAIL
// Auction House
#ifdef RETAIL
void Eluna::OnAdd(AuctionHouseObject* /*ah*/, AuctionPosting* entry)
/*
void Eluna::OnAdd(AuctionHouseObject* ah, AuctionPosting* entry)
{
#ifdef AZEROTHCORE
Player* owner = eObjectAccessor()FindPlayer(entry->owner);
Expand Down Expand Up @@ -165,7 +166,8 @@ void Eluna::OnAdd(AuctionHouseObject* /*ah*/, AuctionPosting* entry)
Push(entry->bidder);
CallAllFunctions(ServerEventBindings, key);
}
#else
*/
#ifndef RETAIL
void Eluna::OnAdd(AuctionHouseObject* /*ah*/, AuctionEntry* entry)
{
#ifdef AZEROTHCORE
Expand Down Expand Up @@ -305,6 +307,7 @@ void Eluna::OnExpire(AuctionHouseObject* /*ah*/, AuctionEntry* entry)
HookPush(entry->bidder);
CallAllFunctions(ServerEventBindings, key);
}
#endif

void Eluna::OnOpenStateChange(bool open)
{
Expand Down
2 changes: 1 addition & 1 deletion TrinityCore/BattleGroundMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ namespace LuaBattleGround
*/
int GetEndTime(Eluna* E, BattleGround* bg)
{
#ifdef CATA
#if defined CATA || defined RETAIL
E->Push(bg->GetRemainingTime());
#else
E->Push(bg->GetEndTime());
Expand Down
Loading

0 comments on commit ac23f8f

Please sign in to comment.