Skip to content

Commit

Permalink
Revert back to LuaFunctions combined file
Browse files Browse the repository at this point in the history
  • Loading branch information
Foereaper committed Nov 10, 2024
1 parent 23396f1 commit 321a184
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 115 deletions.
113 changes: 0 additions & 113 deletions ElunaMethods.cpp

This file was deleted.

4 changes: 2 additions & 2 deletions LuaEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ extern "C"
// Additional lua libraries
};

extern void RegisterMethods(Eluna* E);
extern void RegisterFunctions(Eluna* E);

void Eluna::_ReloadEluna()
{
Expand Down Expand Up @@ -146,7 +146,7 @@ void Eluna::OpenLua()
luaL_openlibs(L);

// Register methods and functions
RegisterMethods(this);
RegisterFunctions(this);

// get require paths
const std::string& requirepath = sElunaLoader->GetRequirePath();
Expand Down
104 changes: 104 additions & 0 deletions ElunaTemplate.cpp → LuaFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,27 @@
#include "ElunaIncludes.h"
#include "ElunaTemplate.h"

// Method includes
#include "GlobalMethods.h"
#include "ObjectMethods.h"
#include "WorldObjectMethods.h"
#include "UnitMethods.h"
#include "PlayerMethods.h"
#include "CreatureMethods.h"
#include "GroupMethods.h"
#include "GuildMethods.h"
#include "GameObjectMethods.h"
#include "ElunaQueryMethods.h"
#include "AuraMethods.h"
#include "ItemMethods.h"
#include "WorldPacketMethods.h"
#include "SpellMethods.h"
#include "QuestMethods.h"
#include "MapMethods.h"
#include "CorpseMethods.h"
#include "VehicleMethods.h"
#include "BattleGroundMethods.h"

#if defined TRACKABLE_PTR_NAMESPACE
ElunaConstrainedObjectRef<Aura> GetWeakPtrFor(Aura const* obj)
{
Expand Down Expand Up @@ -83,3 +104,86 @@ template<> inline int ElunaTemplate<ObjectGuid>::ToString(lua_State* L)
#endif
return 1;
}

void RegisterFunctions(Eluna* E)
{
ElunaTemplate<>::SetMethods(E, LuaGlobalFunctions::GlobalMethods);

ElunaTemplate<Object>::Register(E, "Object");
ElunaTemplate<Object>::SetMethods(E, LuaObject::ObjectMethods);

ElunaTemplate<WorldObject>::Register(E, "WorldObject");
ElunaTemplate<WorldObject>::SetMethods(E, LuaObject::ObjectMethods);
ElunaTemplate<WorldObject>::SetMethods(E, LuaWorldObject::WorldObjectMethods);

ElunaTemplate<Unit>::Register(E, "Unit");
ElunaTemplate<Unit>::SetMethods(E, LuaObject::ObjectMethods);
ElunaTemplate<Unit>::SetMethods(E, LuaWorldObject::WorldObjectMethods);
ElunaTemplate<Unit>::SetMethods(E, LuaUnit::UnitMethods);

ElunaTemplate<Player>::Register(E, "Player");
ElunaTemplate<Player>::SetMethods(E, LuaObject::ObjectMethods);
ElunaTemplate<Player>::SetMethods(E, LuaWorldObject::WorldObjectMethods);
ElunaTemplate<Player>::SetMethods(E, LuaUnit::UnitMethods);
ElunaTemplate<Player>::SetMethods(E, LuaPlayer::PlayerMethods);

ElunaTemplate<Creature>::Register(E, "Creature");
ElunaTemplate<Creature>::SetMethods(E, LuaObject::ObjectMethods);
ElunaTemplate<Creature>::SetMethods(E, LuaWorldObject::WorldObjectMethods);
ElunaTemplate<Creature>::SetMethods(E, LuaUnit::UnitMethods);
ElunaTemplate<Creature>::SetMethods(E, LuaCreature::CreatureMethods);

ElunaTemplate<GameObject>::Register(E, "GameObject");
ElunaTemplate<GameObject>::SetMethods(E, LuaObject::ObjectMethods);
ElunaTemplate<GameObject>::SetMethods(E, LuaWorldObject::WorldObjectMethods);
ElunaTemplate<GameObject>::SetMethods(E, LuaGameObject::GameObjectMethods);

ElunaTemplate<Corpse>::Register(E, "Corpse");
ElunaTemplate<Corpse>::SetMethods(E, LuaObject::ObjectMethods);
ElunaTemplate<Corpse>::SetMethods(E, LuaWorldObject::WorldObjectMethods);
ElunaTemplate<Corpse>::SetMethods(E, LuaCorpse::CorpseMethods);

ElunaTemplate<Item>::Register(E, "Item");
ElunaTemplate<Item>::SetMethods(E, LuaObject::ObjectMethods);
ElunaTemplate<Item>::SetMethods(E, LuaItem::ItemMethods);

#if ELUNA_EXPANSION >= EXP_WOTLK
ElunaTemplate<Vehicle>::Register(E, "Vehicle");
ElunaTemplate<Vehicle>::SetMethods(E, LuaVehicle::VehicleMethods);
#endif

ElunaTemplate<Group>::Register(E, "Group");
ElunaTemplate<Group>::SetMethods(E, LuaGroup::GroupMethods);

ElunaTemplate<Guild>::Register(E, "Guild");
ElunaTemplate<Guild>::SetMethods(E, LuaGuild::GuildMethods);

ElunaTemplate<Aura>::Register(E, "Aura");
ElunaTemplate<Aura>::SetMethods(E, LuaAura::AuraMethods);

ElunaTemplate<Spell>::Register(E, "Spell");
ElunaTemplate<Spell>::SetMethods(E, LuaSpell::SpellMethods);

ElunaTemplate<Quest>::Register(E, "Quest");
ElunaTemplate<Quest>::SetMethods(E, LuaQuest::QuestMethods);

ElunaTemplate<Map>::Register(E, "Map");
ElunaTemplate<Map>::SetMethods(E, LuaMap::MapMethods);

ElunaTemplate<BattleGround>::Register(E, "BattleGround");
ElunaTemplate<BattleGround>::SetMethods(E, LuaBattleGround::BattleGroundMethods);

ElunaTemplate<WorldPacket>::Register(E, "WorldPacket");
ElunaTemplate<WorldPacket>::SetMethods(E, LuaPacket::PacketMethods);

ElunaTemplate<ElunaQuery>::Register(E, "ElunaQuery");
ElunaTemplate<ElunaQuery>::SetMethods(E, LuaQuery::QueryMethods);

ElunaTemplate<long long>::Register(E, "long long");

ElunaTemplate<unsigned long long>::Register(E, "unsigned long long");

ElunaTemplate<ObjectGuid>::Register(E, "ObjectGuid");

LuaVal::Register(E->L);
}

0 comments on commit 321a184

Please sign in to comment.