diff --git a/README.md b/README.md
index 35ea371..599b3a1 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
-# [](https://github.com/azerothcore/mod-eluna)
+# ALE - AzerothCore Lua Engine
*Unleash the power of Lua scripting in your AzerothCore server*
@@ -12,11 +12,11 @@
> [!IMPORTANT]
-> **mod-eluna** is an independent Lua scripting engine specifically designed for AzerothCore. This project has **diverged from the original Eluna project** and is no longer compatible with standard Eluna scripts. Scripts written for mod-eluna will not work with the original Eluna engine and vice versa.
+> **ALE** is an independent Lua scripting engine specifically designed for AzerothCore. This project has **diverged from the original Eluna project** and is no longer compatible with standard Eluna scripts. Scripts written for ALE will not work with the original Eluna engine and vice versa.
## 🚀 Overview
-mod-eluna is a powerful, AzerothCore-specific implementation of a Lua scripting engine that enables server administrators and developers to create custom gameplay features, events, and mechanics without modifying the core server code.
+ALE is a powerful, AzerothCore-specific implementation of a Lua scripting engine that enables server administrators and developers to create custom gameplay features, events, and mechanics without modifying the core server code.
### Key Features
- **Native AzerothCore Integration**: Built specifically for AzerothCore's architecture
@@ -25,9 +25,9 @@ mod-eluna is a powerful, AzerothCore-specific implementation of a Lua scripting
## ⚠️ Compatibility Notice
-### mod-eluna vs Original Eluna
+### ALE vs Original Eluna
-**mod-eluna is NOT compatible with the original Eluna project.** This fork has evolved independently with AzerothCore-specific enhancements and API changes that make scripts non-interchangeable.
+**ALE is NOT compatible with the original Eluna project.** This fork has evolved independently with AzerothCore-specific enhancements and API changes that make scripts non-interchangeable.
### For Original Eluna Compatibility
@@ -59,8 +59,8 @@ This repository maintains compatibility with the original Eluna API and supports
# Navigate to your AzerothCore modules directory
cd /modules
-# Clone the mod-eluna repository
-git clone https://github.com/azerothcore/mod-eluna.git
+# Clone the mod-ale repository
+git clone https://github.com/azerothcore/mod-ale.git
# Configure build with your preferred Lua version
cd
@@ -81,21 +81,21 @@ make -j$(nproc)
## 📚 Documentation
### Getting Started
-- [Installation Guide](https://github.com/azerothcore/mod-eluna/tree/master/docs/USAGE.md)
-- [Implementation Details](https://github.com/azerothcore/mod-eluna/tree/master/docs/IMPL_DETAILS.md)
+- [Installation Guide](https://github.com/azerothcore/mod-ale/tree/master/docs/USAGE.md)
+- [Implementation Details](https://github.com/azerothcore/mod-ale/tree/master/docs/IMPL_DETAILS.md)
### API Reference
-- **[mod-eluna API Documentation](https://www.azerothcore.org/eluna/)** - Complete API reference for mod-eluna
-- **[Hooks Documentation](https://github.com/azerothcore/mod-eluna/blob/master/src/LuaEngine/Hooks.h)** - Available event hooks
+- **[mod-ale API Documentation](https://www.azerothcore.org/eluna/)** - Complete API reference for mod-ale
+- **[Hooks Documentation](https://github.com/azerothcore/mod-ale/blob/master/src/LuaEngine/Hooks.h)** - Available event hooks
- **[Lua 5.2 Reference](http://www.lua.org/manual/5.2/)** - Official Lua language documentation
> [!WARNING]
-> **API Differences**: mod-eluna functions may not be available in the original Eluna project and vice versa. Always refer to the mod-eluna specific documentation when developing scripts.
+> **API Differences**: ALE functions may not be available in the original Eluna project and vice versa. Always refer to the ALE specific documentation when developing scripts.
## 💬 Support
### Getting Help
-- **GitHub Issues**: [Report bugs or request features](https://github.com/azerothcore/mod-eluna/issues)
+- **GitHub Issues**: [Report bugs or request features](https://github.com/azerothcore/mod-ale/issues)
- **Discord Community**: [Join our Discord server](https://discord.com/invite/bx3y5Qmy)
- **AzerothCore Discord**: [Official AzerothCore support](http://www.azerothcore.org/)
@@ -120,7 +120,7 @@ We welcome contributions from the community! Here's how you can help:
## 🌟 Acknowledgements
### Original Project
-mod-eluna is built upon the foundation of the original [Eluna](https://github.com/ElunaLuaEngine/Eluna) project. We acknowledge and thank the original Eluna team for their pioneering work in Lua scripting for World of Warcraft server emulators.
+mod-ale is built upon the foundation of the original [Eluna](https://github.com/ElunaLuaEngine/Eluna) project. We acknowledge and thank the original Eluna team for their pioneering work in Lua scripting for World of Warcraft server emulators.
### Related Projects
- **[Original Eluna Repository](https://github.com/ElunaLuaEngine/Eluna)** - The original Eluna project
@@ -135,12 +135,12 @@ mod-eluna is built upon the foundation of the original [Eluna](https://github.co
## 📄 License
-This project is licensed under the GNU General Public License v3.0. See [LICENSE](https://github.com/azerothcore/mod-eluna/blob/master/LICENSE) for details.
+This project is licensed under the GNU General Public License v3.0. See [LICENSE](https://github.com/azerothcore/mod-ale/blob/master/LICENSE) for details.
---
-Developed with ❤️ by the AzerothCore and mod-eluna community
+Developed with ❤️ by the AzerothCore and ALE community
[⬆ Back to Top](#-overview)
diff --git a/conf/mod_eluna.conf.dist b/conf/mod_ale.conf.dist
similarity index 90%
rename from conf/mod_eluna.conf.dist
rename to conf/mod_ale.conf.dist
index 2047d02..3eca4cc 100644
--- a/conf/mod_eluna.conf.dist
+++ b/conf/mod_ale.conf.dist
@@ -1,44 +1,44 @@
[worldserver]
###################################################################################################
-# ELUNA SETTINGS
+# ALE SETTINGS
#
-# Eluna.Enabled
-# Description: Enable or disable Eluna LuaEngine
+# ALE.Enabled
+# Description: Enable or disable ALE LuaEngine
# Default: true - (enabled)
# false - (disabled)
#
-# Eluna.TraceBack
+# ALE.TraceBack
# Description: Sets whether to use debug.traceback function on a lua error or not.
# Notice that you can redefine the function.
# Default: false - (use default error output)
# true - (use debug.traceback function)
#
-# Eluna.ScriptPath
+# ALE.ScriptPath
# Description: Sets the location of the script folder to load scripts from
# The path can be relative or absolute.
# Default: "lua_scripts"
#
-# Eluna.PlayerAnnounceReload
+# ALE.PlayerAnnounceReload
# Description: Enable or disable whether the reload announcement is sent to players (Lowest security level).
# Default: false - (disabled)
# true - (enabled)
#
-# Eluna.RequirePaths
+# ALE.RequirePaths
# Description: Sets the location of additional require paths.
# These paths are absolute and follows the standard Lua require path patterns.
# Below are a set of "standard" paths used by most package managers.
# "/usr/share/%s/?.lua;/usr/local/share/lua/%s/?.lua;/usr/local/share/lua/%s/?/init.lua;/usr/share/lua/%s/?.lua;/usr/share/lua/%s/?/init.lua;"
# Default: ""
#
-# Eluna.RequireCPaths
+# ALE.RequireCPaths
# Description: Sets the location of additional require C paths.
# These paths are absolute and follows the standard Lua require path patterns.
# Below are a set of "standard" paths used by most package managers.
# "/usr/local/lib/lua/%s/?.so;/usr/lib/x86_64-linux-gnu/lua/%s/?.so;/usr/local/lib/lua/%s/loadall.so;"
# Default: ""
#
-# Eluna.AutoReload
+# ALE.AutoReload
# Description: Enable or disable automatic reloading of Lua scripts when files are modified.
# This feature watches the script directory for changes and automatically
# triggers a reload when .lua files are added, modified, or deleted.
@@ -46,29 +46,29 @@
# Default: false - (disabled)
# true - (enabled)
#
-# Eluna.AutoReloadInterval
+# ALE.AutoReloadInterval
# Description: Sets the interval in seconds between file system checks for auto-reload.
# Lower values provide faster detection but use more CPU resources.
# Higher values reduce CPU usage but increase detection delay.
# Default: 1 - (check every 1 second)
#
-# Eluna.BytecodeCache
+# ALE.BytecodeCache
# Description: Enable or disable bytecode caching for improved performance.
# When enabled, Lua/MoonScript files are compiled to bytecode and cached in memory.
-# This significantly speeds up script reloading (.reload eluna).
+# This significantly speeds up script reloading (.reload ALE).
# Cache is cleared only when files are modified or server restarts.
# Default: true - (enabled)
# false - (disabled)
-Eluna.Enabled = true
-Eluna.TraceBack = false
-Eluna.ScriptPath = "lua_scripts"
-Eluna.PlayerAnnounceReload = false
-Eluna.RequirePaths = ""
-Eluna.RequireCPaths = ""
-Eluna.AutoReload = false
-Eluna.AutoReloadInterval = 1
-Eluna.BytecodeCache = true
+ALE.Enabled = true
+ALE.TraceBack = false
+ALE.ScriptPath = "lua_scripts"
+ALE.PlayerAnnounceReload = false
+ALE.RequirePaths = ""
+ALE.RequireCPaths = ""
+ALE.AutoReload = false
+ALE.AutoReloadInterval = 1
+ALE.BytecodeCache = true
###################################################################################################
# LOGGING SYSTEM SETTINGS
@@ -136,8 +136,8 @@ Eluna.BytecodeCache = true
# NOTE: Does not work with dynamic filenames.
# Example: 536870912 (512 MB)
#
-Appender.ElunaLog=2,5,0,eluna.log,w
-Appender.ElunaConsole=1,4,0,"0 9 0 3 5 0"
+Appender.ALELog=2,5,0,ALE.log,w
+Appender.ALEConsole=1,4,0,"0 9 0 3 5 0"
# Logger config values: Given a logger "name"
# Logger.name
@@ -156,4 +156,4 @@ Appender.ElunaConsole=1,4,0,"0 9 0 3 5 0"
# AppenderList: List of appenders linked to logger
# (Using spaces as separator).
#
-Logger.eluna=4,ElunaLog ElunaConsole
+Logger.ALE=4,ALELog ALEConsole
diff --git a/src/ElunaLuaEngine_SC.cpp b/src/ALE_SC.cpp
similarity index 64%
rename from src/ElunaLuaEngine_SC.cpp
rename to src/ALE_SC.cpp
index ae07a0d..18e1cab 100644
--- a/src/ElunaLuaEngine_SC.cpp
+++ b/src/ALE_SC.cpp
@@ -16,7 +16,7 @@
*/
#include "Chat.h"
-#include "ElunaEventMgr.h"
+#include "ALEEventMgr.h"
#include "Log.h"
#include "LuaEngine.h"
#include "Pet.h"
@@ -24,15 +24,15 @@
#include "ScriptMgr.h"
#include "ScriptedGossip.h"
-class Eluna_AllCreatureScript : public AllCreatureScript
+class ALE_AllCreatureScript : public AllCreatureScript
{
public:
- Eluna_AllCreatureScript() : AllCreatureScript("Eluna_AllCreatureScript") { }
+ ALE_AllCreatureScript() : AllCreatureScript("ALE_AllCreatureScript") { }
// Creature
bool CanCreatureGossipHello(Player* player, Creature* creature) override
{
- if (sEluna->OnGossipHello(player, creature))
+ if (sALE->OnGossipHello(player, creature))
return true;
return false;
@@ -40,7 +40,7 @@ public:
bool CanCreatureGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action) override
{
- if (sEluna->OnGossipSelect(player, creature, sender, action))
+ if (sALE->OnGossipSelect(player, creature, sender, action))
return true;
return false;
@@ -48,7 +48,7 @@ public:
bool CanCreatureGossipSelectCode(Player* player, Creature* creature, uint32 sender, uint32 action, const char* code) override
{
- if (sEluna->OnGossipSelectCode(player, creature, sender, action, code))
+ if (sALE->OnGossipSelectCode(player, creature, sender, action, code))
return true;
return false;
@@ -56,29 +56,29 @@ public:
void OnCreatureAddWorld(Creature* creature) override
{
- sEluna->OnAddToWorld(creature);
- sEluna->OnAllCreatureAddToWorld(creature);
+ sALE->OnAddToWorld(creature);
+ sALE->OnAllCreatureAddToWorld(creature);
if (creature->IsGuardian() && creature->ToTempSummon() && creature->ToTempSummon()->GetSummonerGUID().IsPlayer())
- sEluna->OnPetAddedToWorld(creature->ToTempSummon()->GetSummonerUnit()->ToPlayer(), creature);
+ sALE->OnPetAddedToWorld(creature->ToTempSummon()->GetSummonerUnit()->ToPlayer(), creature);
}
void OnCreatureRemoveWorld(Creature* creature) override
{
- sEluna->OnRemoveFromWorld(creature);
- sEluna->OnAllCreatureRemoveFromWorld(creature);
+ sALE->OnRemoveFromWorld(creature);
+ sALE->OnAllCreatureRemoveFromWorld(creature);
}
bool CanCreatureQuestAccept(Player* player, Creature* creature, Quest const* quest) override
{
- sEluna->OnPlayerQuestAccept(player, quest);
- sEluna->OnQuestAccept(player, creature, quest);
+ sALE->OnPlayerQuestAccept(player, quest);
+ sALE->OnQuestAccept(player, creature, quest);
return false;
}
bool CanCreatureQuestReward(Player* player, Creature* creature, Quest const* quest, uint32 opt) override
{
- if (sEluna->OnQuestReward(player, creature, quest, opt))
+ if (sALE->OnQuestReward(player, creature, quest, opt))
{
ClearGossipMenuFor(player);
return true;
@@ -89,7 +89,7 @@ public:
CreatureAI* GetCreatureAI(Creature* creature) const override
{
- if (CreatureAI* luaAI = sEluna->GetAI(creature))
+ if (CreatureAI* luaAI = sALE->GetAI(creature))
return luaAI;
return nullptr;
@@ -97,41 +97,41 @@ public:
void OnCreatureSelectLevel(const CreatureTemplate* cinfo, Creature* creature) override
{
- sEluna->OnAllCreatureSelectLevel(cinfo, creature);
+ sALE->OnAllCreatureSelectLevel(cinfo, creature);
}
void OnBeforeCreatureSelectLevel(const CreatureTemplate* cinfo, Creature* creature, uint8& level) override
{
- sEluna->OnAllCreatureBeforeSelectLevel(cinfo, creature, level);
+ sALE->OnAllCreatureBeforeSelectLevel(cinfo, creature, level);
}
};
-class Eluna_AllGameObjectScript : public AllGameObjectScript
+class ALE_AllGameObjectScript : public AllGameObjectScript
{
public:
- Eluna_AllGameObjectScript() : AllGameObjectScript("Eluna_AllGameObjectScript") { }
+ ALE_AllGameObjectScript() : AllGameObjectScript("ALE_AllGameObjectScript") { }
void OnGameObjectAddWorld(GameObject* go) override
{
- sEluna->OnAddToWorld(go);
+ sALE->OnAddToWorld(go);
}
void OnGameObjectRemoveWorld(GameObject* go) override
{
- sEluna->OnRemoveFromWorld(go);
+ sALE->OnRemoveFromWorld(go);
}
void OnGameObjectUpdate(GameObject* go, uint32 diff) override
{
- sEluna->UpdateAI(go, diff);
+ sALE->UpdateAI(go, diff);
}
bool CanGameObjectGossipHello(Player* player, GameObject* go) override
{
- if (sEluna->OnGossipHello(player, go))
+ if (sALE->OnGossipHello(player, go))
return true;
- if (sEluna->OnGameObjectUse(player, go))
+ if (sALE->OnGameObjectUse(player, go))
return true;
return false;
@@ -139,34 +139,34 @@ public:
void OnGameObjectDamaged(GameObject* go, Player* player) override
{
- sEluna->OnDamaged(go, player);
+ sALE->OnDamaged(go, player);
}
void OnGameObjectDestroyed(GameObject* go, Player* player) override
{
- sEluna->OnDestroyed(go, player);
+ sALE->OnDestroyed(go, player);
}
void OnGameObjectLootStateChanged(GameObject* go, uint32 state, Unit* /*unit*/) override
{
- sEluna->OnLootStateChanged(go, state);
+ sALE->OnLootStateChanged(go, state);
}
void OnGameObjectStateChanged(GameObject* go, uint32 state) override
{
- sEluna->OnGameObjectStateChanged(go, state);
+ sALE->OnGameObjectStateChanged(go, state);
}
bool CanGameObjectQuestAccept(Player* player, GameObject* go, Quest const* quest) override
{
- sEluna->OnPlayerQuestAccept(player, quest);
- sEluna->OnQuestAccept(player, go, quest);
+ sALE->OnPlayerQuestAccept(player, quest);
+ sALE->OnQuestAccept(player, go, quest);
return false;
}
bool CanGameObjectGossipSelect(Player* player, GameObject* go, uint32 sender, uint32 action) override
{
- if (sEluna->OnGossipSelect(player, go, sender, action))
+ if (sALE->OnGossipSelect(player, go, sender, action))
return true;
return false;
@@ -174,7 +174,7 @@ public:
bool CanGameObjectGossipSelectCode(Player* player, GameObject* go, uint32 sender, uint32 action, const char* code) override
{
- if (sEluna->OnGossipSelectCode(player, go, sender, action, code))
+ if (sALE->OnGossipSelectCode(player, go, sender, action, code))
return true;
return false;
@@ -182,35 +182,35 @@ public:
bool CanGameObjectQuestReward(Player* player, GameObject* go, Quest const* quest, uint32 opt) override
{
- if (sEluna->OnQuestAccept(player, go, quest))
+ if (sALE->OnQuestAccept(player, go, quest))
{
- sEluna->OnPlayerQuestAccept(player, quest);
+ sALE->OnPlayerQuestAccept(player, quest);
return false;
}
- if (sEluna->OnQuestReward(player, go, quest, opt))
- return true;
+ if (sALE->OnQuestReward(player, go, quest, opt))
+ return false;
return false;
}
GameObjectAI* GetGameObjectAI(GameObject* go) const override
{
- sEluna->OnSpawn(go);
+ sALE->OnSpawn(go);
return nullptr;
}
};
-class Eluna_AllItemScript : public AllItemScript
+class ALE_AllItemScript : public AllItemScript
{
public:
- Eluna_AllItemScript() : AllItemScript("Eluna_AllItemScript") { }
+ ALE_AllItemScript() : AllItemScript("ALE_AllItemScript") { }
bool CanItemQuestAccept(Player* player, Item* item, Quest const* quest) override
{
- if (sEluna->OnQuestAccept(player, item, quest))
+ if (sALE->OnQuestAccept(player, item, quest))
{
- sEluna->OnPlayerQuestAccept(player, quest);
+ sALE->OnPlayerQuestAccept(player, quest);
return false;
}
@@ -219,7 +219,7 @@ public:
bool CanItemUse(Player* player, Item* item, SpellCastTargets const& targets) override
{
- if (!sEluna->OnUse(player, item, targets))
+ if (!sALE->OnUse(player, item, targets))
return true;
return false;
@@ -227,7 +227,7 @@ public:
bool CanItemExpire(Player* player, ItemTemplate const* proto) override
{
- if (sEluna->OnExpire(player, proto))
+ if (sALE->OnExpire(player, proto))
return false;
return true;
@@ -235,7 +235,7 @@ public:
bool CanItemRemove(Player* player, Item* item) override
{
- if (sEluna->OnRemove(player, item))
+ if (sALE->OnRemove(player, item))
return false;
return true;
@@ -243,19 +243,19 @@ public:
void OnItemGossipSelect(Player* player, Item* item, uint32 sender, uint32 action) override
{
- sEluna->HandleGossipSelectOption(player, item, sender, action, "");
+ sALE->HandleGossipSelectOption(player, item, sender, action, "");
}
void OnItemGossipSelectCode(Player* player, Item* item, uint32 sender, uint32 action, const char* code) override
{
- sEluna->HandleGossipSelectOption(player, item, sender, action, code);
+ sALE->HandleGossipSelectOption(player, item, sender, action, code);
}
};
-class Eluna_AllMapScript : public AllMapScript
+class ALE_AllMapScript : public AllMapScript
{
public:
- Eluna_AllMapScript() : AllMapScript("Eluna_AllMapScript", {
+ ALE_AllMapScript() : AllMapScript("ALE_AllMapScript", {
ALLMAPHOOK_ON_BEFORE_CREATE_INSTANCE_SCRIPT,
ALLMAPHOOK_ON_DESTROY_INSTANCE,
ALLMAPHOOK_ON_CREATE_MAP,
@@ -268,44 +268,44 @@ public:
void OnBeforeCreateInstanceScript(InstanceMap* instanceMap, InstanceScript** instanceData, bool /*load*/, std::string /*data*/, uint32 /*completedEncounterMask*/) override
{
if (instanceData)
- *instanceData = sEluna->GetInstanceData(instanceMap);
+ *instanceData = sALE->GetInstanceData(instanceMap);
}
void OnDestroyInstance(MapInstanced* /*mapInstanced*/, Map* map) override
{
- sEluna->FreeInstanceId(map->GetInstanceId());
+ sALE->FreeInstanceId(map->GetInstanceId());
}
void OnCreateMap(Map* map) override
{
- sEluna->OnCreate(map);
+ sALE->OnCreate(map);
}
void OnDestroyMap(Map* map) override
{
- sEluna->OnDestroy(map);
+ sALE->OnDestroy(map);
}
void OnPlayerEnterAll(Map* map, Player* player) override
{
- sEluna->OnPlayerEnter(map, player);
+ sALE->OnPlayerEnter(map, player);
}
void OnPlayerLeaveAll(Map* map, Player* player) override
{
- sEluna->OnPlayerLeave(map, player);
+ sALE->OnPlayerLeave(map, player);
}
void OnMapUpdate(Map* map, uint32 diff) override
{
- sEluna->OnUpdate(map, diff);
+ sALE->OnUpdate(map, diff);
}
};
-class Eluna_AuctionHouseScript : public AuctionHouseScript
+class ALE_AuctionHouseScript : public AuctionHouseScript
{
public:
- Eluna_AuctionHouseScript() : AuctionHouseScript("Eluna_AuctionHouseScript", {
+ ALE_AuctionHouseScript() : AuctionHouseScript("ALE_AuctionHouseScript", {
AUCTIONHOUSEHOOK_ON_AUCTION_ADD,
AUCTIONHOUSEHOOK_ON_AUCTION_REMOVE,
AUCTIONHOUSEHOOK_ON_AUCTION_SUCCESSFUL,
@@ -314,29 +314,29 @@ public:
void OnAuctionAdd(AuctionHouseObject* ah, AuctionEntry* entry) override
{
- sEluna->OnAdd(ah, entry);
+ sALE->OnAdd(ah, entry);
}
void OnAuctionRemove(AuctionHouseObject* ah, AuctionEntry* entry) override
{
- sEluna->OnRemove(ah, entry);
+ sALE->OnRemove(ah, entry);
}
void OnAuctionSuccessful(AuctionHouseObject* ah, AuctionEntry* entry) override
{
- sEluna->OnSuccessful(ah, entry);
+ sALE->OnSuccessful(ah, entry);
}
void OnAuctionExpire(AuctionHouseObject* ah, AuctionEntry* entry) override
{
- sEluna->OnExpire(ah, entry);
+ sALE->OnExpire(ah, entry);
}
};
-class Eluna_BGScript : public BGScript
+class ALE_BGScript : public BGScript
{
public:
- Eluna_BGScript() : BGScript("Eluna_BGScript", {
+ ALE_BGScript() : BGScript("ALE_BGScript", {
ALLBATTLEGROUNDHOOK_ON_BATTLEGROUND_START,
ALLBATTLEGROUNDHOOK_ON_BATTLEGROUND_END,
ALLBATTLEGROUNDHOOK_ON_BATTLEGROUND_DESTROY,
@@ -345,35 +345,35 @@ public:
void OnBattlegroundStart(Battleground* bg) override
{
- sEluna->OnBGStart(bg, bg->GetBgTypeID(), bg->GetInstanceID());
+ sALE->OnBGStart(bg, bg->GetBgTypeID(), bg->GetInstanceID());
}
void OnBattlegroundEnd(Battleground* bg, TeamId winnerTeam) override
{
- sEluna->OnBGEnd(bg, bg->GetBgTypeID(), bg->GetInstanceID(), winnerTeam);
+ sALE->OnBGEnd(bg, bg->GetBgTypeID(), bg->GetInstanceID(), winnerTeam);
}
void OnBattlegroundDestroy(Battleground* bg) override
{
- sEluna->OnBGDestroy(bg, bg->GetBgTypeID(), bg->GetInstanceID());
+ sALE->OnBGDestroy(bg, bg->GetBgTypeID(), bg->GetInstanceID());
}
void OnBattlegroundCreate(Battleground* bg) override
{
- sEluna->OnBGCreate(bg, bg->GetBgTypeID(), bg->GetInstanceID());
+ sALE->OnBGCreate(bg, bg->GetBgTypeID(), bg->GetInstanceID());
}
};
-class Eluna_CommandSC : public CommandSC
+class ALE_CommandSC : public CommandSC
{
public:
- Eluna_CommandSC() : CommandSC("Eluna_CommandSC", {
+ ALE_CommandSC() : CommandSC("ALE_CommandSC", {
ALLCOMMANDHOOK_ON_TRY_EXECUTE_COMMAND
}) { }
bool OnTryExecuteCommand(ChatHandler& handler, std::string_view cmdStr) override
{
- if (!sEluna->OnCommand(handler, std::string(cmdStr).c_str()))
+ if (!sALE->OnCommand(handler, std::string(cmdStr).c_str()))
{
return false;
}
@@ -382,50 +382,50 @@ public:
}
};
-class Eluna_ElunaScript : public ElunaScript
+class ALE_ALEScript : public ALEScript
{
public:
- Eluna_ElunaScript() : ElunaScript("Eluna_ElunaScript") { }
+ ALE_ALEScript() : ALEScript("ALE_ALEScript") { }
// Weather
void OnWeatherChange(Weather* weather, WeatherState state, float grade) override
{
- sEluna->OnChange(weather, weather->GetZone(), state, grade);
+ sALE->OnChange(weather, weather->GetZone(), state, grade);
}
// AreaTriger
bool CanAreaTrigger(Player* player, AreaTrigger const* trigger) override
{
- if (sEluna->OnAreaTrigger(player, trigger))
+ if (sALE->OnAreaTrigger(player, trigger))
return true;
return false;
}
};
-class Eluna_GameEventScript : public GameEventScript
+class ALE_GameEventScript : public GameEventScript
{
public:
- Eluna_GameEventScript() : GameEventScript("Eluna_GameEventScript", {
+ ALE_GameEventScript() : GameEventScript("ALE_GameEventScript", {
GAMEEVENTHOOK_ON_START,
GAMEEVENTHOOK_ON_STOP
}) { }
void OnStart(uint16 eventID) override
{
- sEluna->OnGameEventStart(eventID);
+ sALE->OnGameEventStart(eventID);
}
void OnStop(uint16 eventID) override
{
- sEluna->OnGameEventStop(eventID);
+ sALE->OnGameEventStop(eventID);
}
};
-class Eluna_GroupScript : public GroupScript
+class ALE_GroupScript : public GroupScript
{
public:
- Eluna_GroupScript() : GroupScript("Eluna_GroupScript", {
+ ALE_GroupScript() : GroupScript("ALE_GroupScript", {
GROUPHOOK_ON_ADD_MEMBER,
GROUPHOOK_ON_INVITE_MEMBER,
GROUPHOOK_ON_REMOVE_MEMBER,
@@ -436,39 +436,39 @@ public:
void OnAddMember(Group* group, ObjectGuid guid) override
{
- sEluna->OnAddMember(group, guid);
+ sALE->OnAddMember(group, guid);
}
void OnInviteMember(Group* group, ObjectGuid guid) override
{
- sEluna->OnInviteMember(group, guid);
+ sALE->OnInviteMember(group, guid);
}
void OnRemoveMember(Group* group, ObjectGuid guid, RemoveMethod method, ObjectGuid /* kicker */, const char* /* reason */) override
{
- sEluna->OnRemoveMember(group, guid, method);
+ sALE->OnRemoveMember(group, guid, method);
}
void OnChangeLeader(Group* group, ObjectGuid newLeaderGuid, ObjectGuid oldLeaderGuid) override
{
- sEluna->OnChangeLeader(group, newLeaderGuid, oldLeaderGuid);
+ sALE->OnChangeLeader(group, newLeaderGuid, oldLeaderGuid);
}
void OnDisband(Group* group) override
{
- sEluna->OnDisband(group);
+ sALE->OnDisband(group);
}
void OnCreate(Group* group, Player* leader) override
{
- sEluna->OnCreate(group, leader->GetGUID(), group->GetGroupType());
+ sALE->OnCreate(group, leader->GetGUID(), group->GetGroupType());
}
};
-class Eluna_GuildScript : public GuildScript
+class ALE_GuildScript : public GuildScript
{
public:
- Eluna_GuildScript() : GuildScript("Eluna_GuildScript", {
+ ALE_GuildScript() : GuildScript("ALE_GuildScript", {
GUILDHOOK_ON_ADD_MEMBER,
GUILDHOOK_ON_REMOVE_MEMBER,
GUILDHOOK_ON_MOTD_CHANGED,
@@ -484,107 +484,107 @@ public:
void OnAddMember(Guild* guild, Player* player, uint8& plRank) override
{
- sEluna->OnAddMember(guild, player, plRank);
+ sALE->OnAddMember(guild, player, plRank);
}
void OnRemoveMember(Guild* guild, Player* player, bool isDisbanding, bool /*isKicked*/) override
{
- sEluna->OnRemoveMember(guild, player, isDisbanding);
+ sALE->OnRemoveMember(guild, player, isDisbanding);
}
void OnMOTDChanged(Guild* guild, const std::string& newMotd) override
{
- sEluna->OnMOTDChanged(guild, newMotd);
+ sALE->OnMOTDChanged(guild, newMotd);
}
void OnInfoChanged(Guild* guild, const std::string& newInfo) override
{
- sEluna->OnInfoChanged(guild, newInfo);
+ sALE->OnInfoChanged(guild, newInfo);
}
void OnCreate(Guild* guild, Player* leader, const std::string& name) override
{
- sEluna->OnCreate(guild, leader, name);
+ sALE->OnCreate(guild, leader, name);
}
void OnDisband(Guild* guild) override
{
- sEluna->OnDisband(guild);
+ sALE->OnDisband(guild);
}
void OnMemberWitdrawMoney(Guild* guild, Player* player, uint32& amount, bool isRepair) override
{
- sEluna->OnMemberWitdrawMoney(guild, player, amount, isRepair);
+ sALE->OnMemberWitdrawMoney(guild, player, amount, isRepair);
}
void OnMemberDepositMoney(Guild* guild, Player* player, uint32& amount) override
{
- sEluna->OnMemberDepositMoney(guild, player, amount);
+ sALE->OnMemberDepositMoney(guild, player, amount);
}
void OnItemMove(Guild* guild, Player* player, Item* pItem, bool isSrcBank, uint8 srcContainer, uint8 srcSlotId,
bool isDestBank, uint8 destContainer, uint8 destSlotId) override
{
- sEluna->OnItemMove(guild, player, pItem, isSrcBank, srcContainer, srcSlotId, isDestBank, destContainer, destSlotId);
+ sALE->OnItemMove(guild, player, pItem, isSrcBank, srcContainer, srcSlotId, isDestBank, destContainer, destSlotId);
}
void OnEvent(Guild* guild, uint8 eventType, ObjectGuid::LowType playerGuid1, ObjectGuid::LowType playerGuid2, uint8 newRank) override
{
- sEluna->OnEvent(guild, eventType, playerGuid1, playerGuid2, newRank);
+ sALE->OnEvent(guild, eventType, playerGuid1, playerGuid2, newRank);
}
void OnBankEvent(Guild* guild, uint8 eventType, uint8 tabId, ObjectGuid::LowType playerGuid, uint32 itemOrMoney, uint16 itemStackCount, uint8 destTabId) override
{
- sEluna->OnBankEvent(guild, eventType, tabId, playerGuid, itemOrMoney, itemStackCount, destTabId);
+ sALE->OnBankEvent(guild, eventType, tabId, playerGuid, itemOrMoney, itemStackCount, destTabId);
}
};
-class Eluna_LootScript : public LootScript
+class ALE_LootScript : public LootScript
{
public:
- Eluna_LootScript() : LootScript("Eluna_LootScript", {
+ ALE_LootScript() : LootScript("ALE_LootScript", {
LOOTHOOK_ON_LOOT_MONEY
}) { }
void OnLootMoney(Player* player, uint32 gold) override
{
- sEluna->OnLootMoney(player, gold);
+ sALE->OnLootMoney(player, gold);
}
};
-class Eluna_MiscScript : public MiscScript
+class ALE_MiscScript : public MiscScript
{
public:
- Eluna_MiscScript() : MiscScript("Eluna_MiscScript", {
+ ALE_MiscScript() : MiscScript("ALE_MiscScript", {
MISCHOOK_GET_DIALOG_STATUS
}) { }
void GetDialogStatus(Player* player, Object* questgiver) override
{
if (questgiver->GetTypeId() == TYPEID_GAMEOBJECT)
- sEluna->GetDialogStatus(player, questgiver->ToGameObject());
+ sALE->GetDialogStatus(player, questgiver->ToGameObject());
else if (questgiver->GetTypeId() == TYPEID_UNIT)
- sEluna->GetDialogStatus(player, questgiver->ToCreature());
+ sALE->GetDialogStatus(player, questgiver->ToCreature());
}
};
-class Eluna_PetScript : public PetScript
+class ALE_PetScript : public PetScript
{
public:
- Eluna_PetScript() : PetScript("Eluna_PetScript", {
+ ALE_PetScript() : PetScript("ALE_PetScript", {
PETHOOK_ON_PET_ADD_TO_WORLD
}) { }
void OnPetAddToWorld(Pet* pet) override
{
- sEluna->OnPetAddedToWorld(pet->GetOwner(), pet);
+ sALE->OnPetAddedToWorld(pet->GetOwner(), pet);
}
};
-class Eluna_PlayerScript : public PlayerScript
+class ALE_PlayerScript : public PlayerScript
{
public:
- Eluna_PlayerScript() : PlayerScript("Eluna_PlayerScript", {
+ ALE_PlayerScript() : PlayerScript("ALE_PlayerScript", {
PLAYERHOOK_ON_PLAYER_RESURRECT,
PLAYERHOOK_CAN_PLAYER_USE_CHAT,
PLAYERHOOK_CAN_PLAYER_USE_PRIVATE_CHAT,
@@ -648,7 +648,7 @@ public:
void OnPlayerResurrect(Player* player, float /*restore_percent*/, bool /*applySickness*/) override
{
- sEluna->OnResurrect(player);
+ sALE->OnResurrect(player);
}
bool OnPlayerCanUseChat(Player* player, uint32 type, uint32 lang, std::string& msg) override
@@ -656,7 +656,7 @@ public:
if (type != CHAT_MSG_SAY && type != CHAT_MSG_YELL && type != CHAT_MSG_EMOTE)
return true;
- if (!sEluna->OnChat(player, type, lang, msg))
+ if (!sALE->OnChat(player, type, lang, msg))
return false;
return true;
@@ -664,7 +664,7 @@ public:
bool OnPlayerCanUseChat(Player* player, uint32 type, uint32 lang, std::string& msg, Player* target) override
{
- if (!sEluna->OnChat(player, type, lang, msg, target))
+ if (!sALE->OnChat(player, type, lang, msg, target))
return false;
return true;
@@ -672,7 +672,7 @@ public:
bool OnPlayerCanUseChat(Player* player, uint32 type, uint32 lang, std::string& msg, Group* group) override
{
- if (!sEluna->OnChat(player, type, lang, msg, group))
+ if (!sALE->OnChat(player, type, lang, msg, group))
return false;
return true;
@@ -680,7 +680,7 @@ public:
bool OnPlayerCanUseChat(Player* player, uint32 type, uint32 lang, std::string& msg, Guild* guild) override
{
- if (!sEluna->OnChat(player, type, lang, msg, guild))
+ if (!sALE->OnChat(player, type, lang, msg, guild))
return false;
return true;
@@ -688,7 +688,7 @@ public:
bool OnPlayerCanUseChat(Player* player, uint32 type, uint32 lang, std::string& msg, Channel* channel) override
{
- if (!sEluna->OnChat(player, type, lang, msg, channel))
+ if (!sALE->OnChat(player, type, lang, msg, channel))
return false;
return true;
@@ -696,283 +696,283 @@ public:
void OnPlayerLootItem(Player* player, Item* item, uint32 count, ObjectGuid lootguid) override
{
- sEluna->OnLootItem(player, item, count, lootguid);
+ sALE->OnLootItem(player, item, count, lootguid);
}
void OnPlayerLearnTalents(Player* player, uint32 talentId, uint32 talentRank, uint32 spellid) override
{
- sEluna->OnLearnTalents(player, talentId, talentRank, spellid);
+ sALE->OnLearnTalents(player, talentId, talentRank, spellid);
}
bool OnPlayerCanUseItem(Player* player, ItemTemplate const* proto, InventoryResult& result) override
{
- result = sEluna->OnCanUseItem(player, proto->ItemId);
+ result = sALE->OnCanUseItem(player, proto->ItemId);
return result != EQUIP_ERR_OK ? false : true;
}
void OnPlayerEquip(Player* player, Item* it, uint8 bag, uint8 slot, bool /*update*/) override
{
- sEluna->OnEquip(player, it, bag, slot);
+ sALE->OnEquip(player, it, bag, slot);
}
void OnPlayerEnterCombat(Player* player, Unit* enemy) override
{
- sEluna->OnPlayerEnterCombat(player, enemy);
+ sALE->OnPlayerEnterCombat(player, enemy);
}
void OnPlayerLeaveCombat(Player* player) override
{
- sEluna->OnPlayerLeaveCombat(player);
+ sALE->OnPlayerLeaveCombat(player);
}
bool OnPlayerCanRepopAtGraveyard(Player* player) override
{
- sEluna->OnRepop(player);
+ sALE->OnRepop(player);
return true;
}
void OnPlayerQuestAbandon(Player* player, uint32 questId) override
{
- sEluna->OnQuestAbandon(player, questId);
+ sALE->OnQuestAbandon(player, questId);
}
void OnPlayerMapChanged(Player* player) override
{
- sEluna->OnMapChanged(player);
+ sALE->OnMapChanged(player);
}
void OnPlayerGossipSelect(Player* player, uint32 menu_id, uint32 sender, uint32 action) override
{
- sEluna->HandleGossipSelectOption(player, menu_id, sender, action, "");
+ sALE->HandleGossipSelectOption(player, menu_id, sender, action, "");
}
void OnPlayerGossipSelectCode(Player* player, uint32 menu_id, uint32 sender, uint32 action, const char* code) override
{
- sEluna->HandleGossipSelectOption(player, menu_id, sender, action, code);
+ sALE->HandleGossipSelectOption(player, menu_id, sender, action, code);
}
void OnPlayerPVPKill(Player* killer, Player* killed) override
{
- sEluna->OnPVPKill(killer, killed);
+ sALE->OnPVPKill(killer, killed);
}
void OnPlayerCreatureKill(Player* killer, Creature* killed) override
{
- sEluna->OnCreatureKill(killer, killed);
+ sALE->OnCreatureKill(killer, killed);
}
void OnPlayerKilledByCreature(Creature* killer, Player* killed) override
{
- sEluna->OnPlayerKilledByCreature(killer, killed);
+ sALE->OnPlayerKilledByCreature(killer, killed);
}
void OnPlayerLevelChanged(Player* player, uint8 oldLevel) override
{
- sEluna->OnLevelChanged(player, oldLevel);
+ sALE->OnLevelChanged(player, oldLevel);
}
void OnPlayerFreeTalentPointsChanged(Player* player, uint32 points) override
{
- sEluna->OnFreeTalentPointsChanged(player, points);
+ sALE->OnFreeTalentPointsChanged(player, points);
}
void OnPlayerTalentsReset(Player* player, bool noCost) override
{
- sEluna->OnTalentsReset(player, noCost);
+ sALE->OnTalentsReset(player, noCost);
}
void OnPlayerMoneyChanged(Player* player, int32& amount) override
{
- sEluna->OnMoneyChanged(player, amount);
+ sALE->OnMoneyChanged(player, amount);
}
void OnPlayerGiveXP(Player* player, uint32& amount, Unit* victim, uint8 xpSource) override
{
- sEluna->OnGiveXP(player, amount, victim, xpSource);
+ sALE->OnGiveXP(player, amount, victim, xpSource);
}
bool OnPlayerReputationChange(Player* player, uint32 factionID, int32& standing, bool incremental) override
{
- return sEluna->OnReputationChange(player, factionID, standing, incremental);
+ return sALE->OnReputationChange(player, factionID, standing, incremental);
}
void OnPlayerDuelRequest(Player* target, Player* challenger) override
{
- sEluna->OnDuelRequest(target, challenger);
+ sALE->OnDuelRequest(target, challenger);
}
void OnPlayerDuelStart(Player* player1, Player* player2) override
{
- sEluna->OnDuelStart(player1, player2);
+ sALE->OnDuelStart(player1, player2);
}
void OnPlayerDuelEnd(Player* winner, Player* loser, DuelCompleteType type) override
{
- sEluna->OnDuelEnd(winner, loser, type);
+ sALE->OnDuelEnd(winner, loser, type);
}
void OnPlayerEmote(Player* player, uint32 emote) override
{
- sEluna->OnEmote(player, emote);
+ sALE->OnEmote(player, emote);
}
void OnPlayerTextEmote(Player* player, uint32 textEmote, uint32 emoteNum, ObjectGuid guid) override
{
- sEluna->OnTextEmote(player, textEmote, emoteNum, guid);
+ sALE->OnTextEmote(player, textEmote, emoteNum, guid);
}
void OnPlayerSpellCast(Player* player, Spell* spell, bool skipCheck) override
{
- sEluna->OnPlayerSpellCast(player, spell, skipCheck);
+ sALE->OnPlayerSpellCast(player, spell, skipCheck);
}
void OnPlayerLogin(Player* player) override
{
- sEluna->OnLogin(player);
+ sALE->OnLogin(player);
}
void OnPlayerLogout(Player* player) override
{
- sEluna->OnLogout(player);
+ sALE->OnLogout(player);
}
void OnPlayerCreate(Player* player) override
{
- sEluna->OnCreate(player);
+ sALE->OnCreate(player);
}
void OnPlayerSave(Player* player) override
{
- sEluna->OnSave(player);
+ sALE->OnSave(player);
}
void OnPlayerDelete(ObjectGuid guid, uint32 /*accountId*/) override
{
- sEluna->OnDelete(guid.GetCounter());
+ sALE->OnDelete(guid.GetCounter());
}
void OnPlayerBindToInstance(Player* player, Difficulty difficulty, uint32 mapid, bool permanent) override
{
- sEluna->OnBindToInstance(player, difficulty, mapid, permanent);
+ sALE->OnBindToInstance(player, difficulty, mapid, permanent);
}
void OnPlayerUpdateArea(Player* player, uint32 oldArea, uint32 newArea) override
{
- sEluna->OnUpdateArea(player, oldArea, newArea);
+ sALE->OnUpdateArea(player, oldArea, newArea);
}
void OnPlayerUpdateZone(Player* player, uint32 newZone, uint32 newArea) override
{
- sEluna->OnUpdateZone(player, newZone, newArea);
+ sALE->OnUpdateZone(player, newZone, newArea);
}
void OnPlayerFirstLogin(Player* player) override
{
- sEluna->OnFirstLogin(player);
+ sALE->OnFirstLogin(player);
}
void OnPlayerLearnSpell(Player* player, uint32 spellId) override
{
- sEluna->OnLearnSpell(player, spellId);
+ sALE->OnLearnSpell(player, spellId);
}
void OnPlayerAchievementComplete(Player* player, AchievementEntry const* achievement) override
{
- sEluna->OnAchiComplete(player, achievement);
+ sALE->OnAchiComplete(player, achievement);
}
void OnPlayerFfaPvpStateUpdate(Player* player, bool IsFlaggedForFfaPvp) override
{
- sEluna->OnFfaPvpStateUpdate(player, IsFlaggedForFfaPvp);
+ sALE->OnFfaPvpStateUpdate(player, IsFlaggedForFfaPvp);
}
bool OnPlayerCanInitTrade(Player* player, Player* target) override
{
- return sEluna->OnCanInitTrade(player, target);
+ return sALE->OnCanInitTrade(player, target);
}
bool OnPlayerCanSendMail(Player* player, ObjectGuid receiverGuid, ObjectGuid mailbox, std::string& subject, std::string& body, uint32 money, uint32 cod, Item* item) override
{
- return sEluna->OnCanSendMail(player, receiverGuid, mailbox, subject, body, money, cod, item);
+ return sALE->OnCanSendMail(player, receiverGuid, mailbox, subject, body, money, cod, item);
}
bool OnPlayerCanJoinLfg(Player* player, uint8 roles, lfg::LfgDungeonSet& dungeons, const std::string& comment) override
{
- return sEluna->OnCanJoinLfg(player, roles, dungeons, comment);
+ return sALE->OnCanJoinLfg(player, roles, dungeons, comment);
}
void OnPlayerQuestRewardItem(Player* player, Item* item, uint32 count) override
{
- sEluna->OnQuestRewardItem(player, item, count);
+ sALE->OnQuestRewardItem(player, item, count);
}
void OnPlayerGroupRollRewardItem(Player* player, Item* item, uint32 count, RollVote voteType, Roll* roll) override
{
- sEluna->OnGroupRollRewardItem(player, item, count, voteType, roll);
+ sALE->OnGroupRollRewardItem(player, item, count, voteType, roll);
}
void OnPlayerCreateItem(Player* player, Item* item, uint32 count) override
{
- sEluna->OnCreateItem(player, item, count);
+ sALE->OnCreateItem(player, item, count);
}
void OnPlayerStoreNewItem(Player* player, Item* item, uint32 count) override
{
- sEluna->OnStoreNewItem(player, item, count);
+ sALE->OnStoreNewItem(player, item, count);
}
void OnPlayerCompleteQuest(Player* player, Quest const* quest) override
{
- sEluna->OnPlayerCompleteQuest(player, quest);
+ sALE->OnPlayerCompleteQuest(player, quest);
}
bool OnPlayerCanGroupInvite(Player* player, std::string& memberName) override
{
- return sEluna->OnCanGroupInvite(player, memberName);
+ return sALE->OnCanGroupInvite(player, memberName);
}
void OnPlayerBattlegroundDesertion(Player* player, const BattlegroundDesertionType type) override
{
- sEluna->OnBattlegroundDesertion(player, type);
+ sALE->OnBattlegroundDesertion(player, type);
}
void OnPlayerCreatureKilledByPet(Player* player, Creature* killed) override
{
- sEluna->OnCreatureKilledByPet(player, killed);
+ sALE->OnCreatureKilledByPet(player, killed);
}
bool OnPlayerCanUpdateSkill(Player* player, uint32 skill_id) override
{
- return sEluna->OnPlayerCanUpdateSkill(player, skill_id);
+ return sALE->OnPlayerCanUpdateSkill(player, skill_id);
}
void OnPlayerBeforeUpdateSkill(Player* player, uint32 skill_id, uint32& value, uint32 max, uint32 step) override
{
- sEluna->OnPlayerBeforeUpdateSkill(player, skill_id, value, max, step);
+ sALE->OnPlayerBeforeUpdateSkill(player, skill_id, value, max, step);
}
void OnPlayerUpdateSkill(Player* player, uint32 skill_id, uint32 value, uint32 max, uint32 step, uint32 new_value) override
{
- sEluna->OnPlayerUpdateSkill(player, skill_id, value, max, step, new_value);
+ sALE->OnPlayerUpdateSkill(player, skill_id, value, max, step, new_value);
}
bool OnPlayerCanResurrect(Player* player) override
{
- return sEluna->CanPlayerResurrect(player);
+ return sALE->CanPlayerResurrect(player);
}
};
-class Eluna_ServerScript : public ServerScript
+class ALE_ServerScript : public ServerScript
{
public:
- Eluna_ServerScript() : ServerScript("Eluna_ServerScript", {
+ ALE_ServerScript() : ServerScript("ALE_ServerScript", {
SERVERHOOK_CAN_PACKET_SEND,
SERVERHOOK_CAN_PACKET_RECEIVE
}) { }
bool CanPacketSend(WorldSession* session, WorldPacket& packet) override
{
- if (!sEluna->OnPacketSend(session, packet))
+ if (!sALE->OnPacketSend(session, packet))
return false;
return true;
@@ -980,17 +980,17 @@ public:
bool CanPacketReceive(WorldSession* session, WorldPacket& packet) override
{
- if (!sEluna->OnPacketReceive(session, packet))
+ if (!sALE->OnPacketReceive(session, packet))
return false;
return true;
}
};
-class Eluna_SpellSC : public SpellSC
+class ALE_SpellSC : public SpellSC
{
public:
- Eluna_SpellSC() : SpellSC("Eluna_SpellSC", {
+ ALE_SpellSC() : SpellSC("ALE_SpellSC", {
ALLSPELLHOOK_ON_DUMMY_EFFECT_GAMEOBJECT,
ALLSPELLHOOK_ON_DUMMY_EFFECT_CREATURE,
ALLSPELLHOOK_ON_DUMMY_EFFECT_ITEM,
@@ -1001,70 +1001,70 @@ public:
void OnDummyEffect(WorldObject* caster, uint32 spellID, SpellEffIndex effIndex, GameObject* gameObjTarget) override
{
- sEluna->OnDummyEffect(caster, spellID, effIndex, gameObjTarget);
+ sALE->OnDummyEffect(caster, spellID, effIndex, gameObjTarget);
}
void OnDummyEffect(WorldObject* caster, uint32 spellID, SpellEffIndex effIndex, Creature* creatureTarget) override
{
- sEluna->OnDummyEffect(caster, spellID, effIndex, creatureTarget);
+ sALE->OnDummyEffect(caster, spellID, effIndex, creatureTarget);
}
void OnDummyEffect(WorldObject* caster, uint32 spellID, SpellEffIndex effIndex, Item* itemTarget) override
{
- sEluna->OnDummyEffect(caster, spellID, effIndex, itemTarget);
+ sALE->OnDummyEffect(caster, spellID, effIndex, itemTarget);
}
void OnSpellCastCancel(Spell* spell, Unit* caster, SpellInfo const* spellInfo, bool bySelf) override
{
- sEluna->OnSpellCastCancel(caster, spell, spellInfo, bySelf);
+ sALE->OnSpellCastCancel(caster, spell, spellInfo, bySelf);
}
void OnSpellCast(Spell* spell, Unit* caster, SpellInfo const* spellInfo, bool skipCheck) override
{
- sEluna->OnSpellCast(caster, spell, spellInfo, skipCheck);
+ sALE->OnSpellCast(caster, spell, spellInfo, skipCheck);
}
void OnSpellPrepare(Spell* spell, Unit* caster, SpellInfo const* spellInfo) override
{
- sEluna->OnSpellPrepare(caster, spell, spellInfo);
+ sALE->OnSpellPrepare(caster, spell, spellInfo);
}
};
-class Eluna_VehicleScript : public VehicleScript
+class ALE_VehicleScript : public VehicleScript
{
public:
- Eluna_VehicleScript() : VehicleScript("Eluna_VehicleScript") { }
+ ALE_VehicleScript() : VehicleScript("ALE_VehicleScript") { }
void OnInstall(Vehicle* veh) override
{
- sEluna->OnInstall(veh);
+ sALE->OnInstall(veh);
}
void OnUninstall(Vehicle* veh) override
{
- sEluna->OnUninstall(veh);
+ sALE->OnUninstall(veh);
}
void OnInstallAccessory(Vehicle* veh, Creature* accessory) override
{
- sEluna->OnInstallAccessory(veh, accessory);
+ sALE->OnInstallAccessory(veh, accessory);
}
void OnAddPassenger(Vehicle* veh, Unit* passenger, int8 seatId) override
{
- sEluna->OnAddPassenger(veh, passenger, seatId);
+ sALE->OnAddPassenger(veh, passenger, seatId);
}
void OnRemovePassenger(Vehicle* veh, Unit* passenger) override
{
- sEluna->OnRemovePassenger(veh, passenger);
+ sALE->OnRemovePassenger(veh, passenger);
}
};
-class Eluna_WorldObjectScript : public WorldObjectScript
+class ALE_WorldObjectScript : public WorldObjectScript
{
public:
- Eluna_WorldObjectScript() : WorldObjectScript("Eluna_WorldObjectScript", {
+ ALE_WorldObjectScript() : WorldObjectScript("ALE_WorldObjectScript", {
WORLDOBJECTHOOK_ON_WORLD_OBJECT_DESTROY,
WORLDOBJECTHOOK_ON_WORLD_OBJECT_CREATE,
WORLDOBJECTHOOK_ON_WORLD_OBJECT_SET_MAP,
@@ -1073,31 +1073,31 @@ public:
void OnWorldObjectDestroy(WorldObject* object) override
{
- delete object->elunaEvents;
- object->elunaEvents = nullptr;
+ delete object->ALEEvents;
+ object->ALEEvents = nullptr;
}
void OnWorldObjectCreate(WorldObject* object) override
{
- object->elunaEvents = nullptr;
+ object->ALEEvents = nullptr;
}
void OnWorldObjectSetMap(WorldObject* object, Map* /*map*/) override
{
- if (!object->elunaEvents)
- object->elunaEvents = new ElunaEventProcessor(&Eluna::GEluna, object);
+ if (!object->ALEEvents)
+ object->ALEEvents = new ALEEventProcessor(&ALE::GALE, object);
}
void OnWorldObjectUpdate(WorldObject* object, uint32 diff) override
{
- object->elunaEvents->Update(diff);
+ object->ALEEvents->Update(diff);
}
};
-class Eluna_WorldScript : public WorldScript
+class ALE_WorldScript : public WorldScript
{
public:
- Eluna_WorldScript() : WorldScript("Eluna_WorldScript", {
+ ALE_WorldScript() : WorldScript("ALE_WorldScript", {
WORLDHOOK_ON_OPEN_STATE_CHANGE,
WORLDHOOK_ON_BEFORE_CONFIG_LOAD,
WORLDHOOK_ON_AFTER_CONFIG_LOAD,
@@ -1112,70 +1112,70 @@ public:
void OnOpenStateChange(bool open) override
{
- sEluna->OnOpenStateChange(open);
+ sALE->OnOpenStateChange(open);
}
void OnBeforeConfigLoad(bool reload) override
{
- ElunaConfig::GetInstance().Initialize(reload);
+ ALEConfig::GetInstance().Initialize(reload);
if (!reload)
{
///- Initialize Lua Engine
- LOG_INFO("eluna", "Initialize Eluna Lua Engine...");
- Eluna::Initialize();
+ LOG_INFO("ALE", "Initialize ALE Lua Engine...");
+ ALE::Initialize();
}
- sEluna->OnConfigLoad(reload, true);
+ sALE->OnConfigLoad(reload, true);
}
void OnAfterConfigLoad(bool reload) override
{
- sEluna->OnConfigLoad(reload, false);
+ sALE->OnConfigLoad(reload, false);
}
void OnShutdownInitiate(ShutdownExitCode code, ShutdownMask mask) override
{
- sEluna->OnShutdownInitiate(code, mask);
+ sALE->OnShutdownInitiate(code, mask);
}
void OnShutdownCancel() override
{
- sEluna->OnShutdownCancel();
+ sALE->OnShutdownCancel();
}
void OnUpdate(uint32 diff) override
{
- sEluna->OnWorldUpdate(diff);
+ sALE->OnWorldUpdate(diff);
}
void OnStartup() override
{
- sEluna->OnStartup();
+ sALE->OnStartup();
}
void OnShutdown() override
{
- sEluna->OnShutdown();
+ sALE->OnShutdown();
}
void OnAfterUnloadAllMaps() override
{
- Eluna::Uninitialize();
+ ALE::Uninitialize();
}
void OnBeforeWorldInitialized() override
{
- ///- Run eluna scripts.
+ ///- Run ALE scripts.
// in multithread foreach: run scripts
- sEluna->RunScripts();
- sEluna->OnConfigLoad(false, false); // Must be done after Eluna is initialized and scripts have run.
+ sALE->RunScripts();
+ sALE->OnConfigLoad(false, false); // Must be done after ALE is initialized and scripts have run.
}
};
-class Eluna_TicketScript : public TicketScript
+class ALE_TicketScript : public TicketScript
{
public:
- Eluna_TicketScript() : TicketScript("Eluna_TicketScript", {
+ ALE_TicketScript() : TicketScript("ALE_TicketScript", {
TICKETHOOK_ON_TICKET_CREATE,
TICKETHOOK_ON_TICKET_UPDATE_LAST_CHANGE,
TICKETHOOK_ON_TICKET_CLOSE,
@@ -1184,39 +1184,39 @@ public:
void OnTicketCreate(GmTicket* ticket) override
{
- sEluna->OnTicketCreate(ticket);
+ sALE->OnTicketCreate(ticket);
}
void OnTicketUpdateLastChange(GmTicket* ticket) override
{
- sEluna->OnTicketUpdateLastChange(ticket);
+ sALE->OnTicketUpdateLastChange(ticket);
}
void OnTicketClose(GmTicket* ticket) override
{
- sEluna->OnTicketClose(ticket);
+ sALE->OnTicketClose(ticket);
}
void OnTicketResolve(GmTicket* ticket) override
{
- sEluna->OnTicketResolve(ticket);
+ sALE->OnTicketResolve(ticket);
}
};
-class Eluna_UnitScript : public UnitScript
+class ALE_UnitScript : public UnitScript
{
public:
- Eluna_UnitScript() : UnitScript("Eluna_UnitScript") { }
+ ALE_UnitScript() : UnitScript("ALE_UnitScript") { }
void OnAuraApply(Unit* unit, Aura* aura) override
{
if (!unit || !aura) return;
if (unit->IsPlayer())
- sEluna->OnPlayerAuraApply(unit->ToPlayer(), aura);
+ sALE->OnPlayerAuraApply(unit->ToPlayer(), aura);
if (unit->IsCreature())
- sEluna->OnCreatureAuraApply(unit->ToCreature(), aura);
+ sALE->OnCreatureAuraApply(unit->ToCreature(), aura);
}
void OnHeal(Unit* healer, Unit* receiver, uint32& gain) override
@@ -1224,10 +1224,10 @@ public:
if (!receiver || !healer) return;
if (healer->IsPlayer())
- sEluna->OnPlayerHeal(healer->ToPlayer(), receiver, gain);
+ sALE->OnPlayerHeal(healer->ToPlayer(), receiver, gain);
if (healer->IsCreature())
- sEluna->OnCreatureHeal(healer->ToCreature(), receiver, gain);
+ sALE->OnCreatureHeal(healer->ToCreature(), receiver, gain);
}
void OnDamage(Unit* attacker, Unit* receiver, uint32& damage) override
@@ -1235,36 +1235,36 @@ public:
if (!attacker || !receiver) return;
if (attacker->IsPlayer())
- sEluna->OnPlayerDamage(attacker->ToPlayer(), receiver, damage);
+ sALE->OnPlayerDamage(attacker->ToPlayer(), receiver, damage);
if (attacker->IsCreature())
- sEluna->OnCreatureDamage(attacker->ToCreature(), receiver, damage);
+ sALE->OnCreatureDamage(attacker->ToCreature(), receiver, damage);
}
};
// Group all custom scripts
-void AddSC_ElunaLuaEngine()
+void AddSC_ALE()
{
- new Eluna_AllCreatureScript();
- new Eluna_AllGameObjectScript();
- new Eluna_AllItemScript();
- new Eluna_AllMapScript();
- new Eluna_AuctionHouseScript();
- new Eluna_BGScript();
- new Eluna_CommandSC();
- new Eluna_ElunaScript();
- new Eluna_GameEventScript();
- new Eluna_GroupScript();
- new Eluna_GuildScript();
- new Eluna_LootScript();
- new Eluna_MiscScript();
- new Eluna_PetScript();
- new Eluna_PlayerScript();
- new Eluna_ServerScript();
- new Eluna_SpellSC();
- new Eluna_TicketScript();
- new Eluna_VehicleScript();
- new Eluna_WorldObjectScript();
- new Eluna_WorldScript();
- new Eluna_UnitScript();
+ new ALE_AllCreatureScript();
+ new ALE_AllGameObjectScript();
+ new ALE_AllItemScript();
+ new ALE_AllMapScript();
+ new ALE_AuctionHouseScript();
+ new ALE_BGScript();
+ new ALE_CommandSC();
+ new ALE_ALEScript();
+ new ALE_GameEventScript();
+ new ALE_GroupScript();
+ new ALE_GuildScript();
+ new ALE_LootScript();
+ new ALE_MiscScript();
+ new ALE_PetScript();
+ new ALE_PlayerScript();
+ new ALE_ServerScript();
+ new ALE_SpellSC();
+ new ALE_TicketScript();
+ new ALE_VehicleScript();
+ new ALE_WorldObjectScript();
+ new ALE_WorldScript();
+ new ALE_UnitScript();
}
diff --git a/src/eluna_loader.cpp b/src/ALE_loader.cpp
similarity index 90%
rename from src/eluna_loader.cpp
rename to src/ALE_loader.cpp
index 4ac23bc..1dd1c0f 100644
--- a/src/eluna_loader.cpp
+++ b/src/ALE_loader.cpp
@@ -16,10 +16,10 @@
*/
// From SC
-void AddSC_ElunaLuaEngine();
+void AddSC_ALE();
// Add all
-void Addmod_elunaScripts()
+void Addmod_ALEScripts()
{
- AddSC_ElunaLuaEngine();
+ AddSC_ALE();
}
diff --git a/src/LuaEngine/ElunaCompat.cpp b/src/LuaEngine/ALECompat.cpp
similarity index 96%
rename from src/LuaEngine/ElunaCompat.cpp
rename to src/LuaEngine/ALECompat.cpp
index c7c5a62..18535df 100644
--- a/src/LuaEngine/ElunaCompat.cpp
+++ b/src/LuaEngine/ALECompat.cpp
@@ -1,10 +1,10 @@
/*
- * Copyright (C) 2010 - 2024 Eluna Lua Engine
+ * Copyright (C) 2010 - 2025 Eluna Lua Engine
* This program is free software licensed under GPL version 3
* Please see the included DOCS/LICENSE.md for more information
*/
-#include "ElunaCompat.h"
+#include "ALECompat.h"
#if LUA_VERSION_NUM == 501
const char* luaL_tolstring(lua_State* L, int idx, size_t* len) {
diff --git a/src/LuaEngine/ElunaCompat.h b/src/LuaEngine/ALECompat.h
similarity index 92%
rename from src/LuaEngine/ElunaCompat.h
rename to src/LuaEngine/ALECompat.h
index 68ecbfb..42d783d 100644
--- a/src/LuaEngine/ElunaCompat.h
+++ b/src/LuaEngine/ALECompat.h
@@ -1,11 +1,11 @@
/*
- * Copyright (C) 2010 - 2024 Eluna Lua Engine
+ * Copyright (C) 2010 - 2025 Eluna Lua Engine
* This program is free software licensed under GPL version 3
* Please see the included DOCS/LICENSE.md for more information
*/
-#ifndef ELUNACOMPAT_H
-#define ELUNACOMPAT_H
+#ifndef ALECOMPAT_H
+#define ALECOMPAT_H
extern "C"
{
diff --git a/src/LuaEngine/ALEConfig.cpp b/src/LuaEngine/ALEConfig.cpp
new file mode 100644
index 0000000..e3eca21
--- /dev/null
+++ b/src/LuaEngine/ALEConfig.cpp
@@ -0,0 +1,30 @@
+#include "ALEConfig.h"
+
+ALEConfig& ALEConfig::GetInstance()
+{
+ static ALEConfig instance;
+ return instance;
+}
+
+ALEConfig::ALEConfig() : ConfigValueCache(ALEConfigValues::CONFIG_VALUE_COUNT)
+{
+}
+
+void ALEConfig::Initialize(bool reload)
+{
+ ConfigValueCache::Initialize(reload);
+}
+
+void ALEConfig::BuildConfigCache()
+{
+ SetConfigValue(ALEConfigValues::ENABLED, "ALE.Enabled", "false");
+ SetConfigValue(ALEConfigValues::TRACEBACK_ENABLED, "ALE.TraceBack", "false");
+ SetConfigValue(ALEConfigValues::AUTORELOAD_ENABLED, "ALE.AutoReload", "false");
+ SetConfigValue(ALEConfigValues::BYTECODE_CACHE_ENABLED, "ALE.BytecodeCache", "false");
+
+ SetConfigValue(ALEConfigValues::SCRIPT_PATH, "ALE.ScriptPath", "lua_scripts");
+ SetConfigValue(ALEConfigValues::REQUIRE_PATH, "ALE.RequirePaths", "");
+ SetConfigValue(ALEConfigValues::REQUIRE_CPATH, "ALE.RequireCPaths", "");
+
+ SetConfigValue(ALEConfigValues::AUTORELOAD_INTERVAL, "ALE.AutoReloadInterval", 1);
+}
diff --git a/src/LuaEngine/ElunaConfig.h b/src/LuaEngine/ALEConfig.h
similarity index 51%
rename from src/LuaEngine/ElunaConfig.h
rename to src/LuaEngine/ALEConfig.h
index 2714aa4..b413b4a 100644
--- a/src/LuaEngine/ElunaConfig.h
+++ b/src/LuaEngine/ALEConfig.h
@@ -1,9 +1,9 @@
-#ifndef ELUNA_CONFIG_HPP
-#define ELUNA_CONFIG_HPP
+#ifndef ALE_CONFIG_HPP
+#define ALE_CONFIG_HPP
#include "ConfigValueCache.h"
-enum class ElunaConfigValues : uint32
+enum class ALEConfigValues : uint32
{
// Boolean
ENABLED = 0,
@@ -22,32 +22,32 @@ enum class ElunaConfigValues : uint32
CONFIG_VALUE_COUNT
};
-class ElunaConfig final : public ConfigValueCache
+class ALEConfig final : public ConfigValueCache
{
public:
- static ElunaConfig& GetInstance();
+ static ALEConfig& GetInstance();
void Initialize(bool reload = false);
- bool IsElunaEnabled() const { return GetConfigValue(ElunaConfigValues::ENABLED); }
- bool IsTraceBackEnabled() const { return GetConfigValue(ElunaConfigValues::TRACEBACK_ENABLED); }
- bool IsAutoReloadEnabled() const { return GetConfigValue(ElunaConfigValues::AUTORELOAD_ENABLED); }
- bool IsByteCodeCacheEnabled() const { return GetConfigValue(ElunaConfigValues::BYTECODE_CACHE_ENABLED); }
+ bool IsALEEnabled() const { return GetConfigValue(ALEConfigValues::ENABLED); }
+ bool IsTraceBackEnabled() const { return GetConfigValue(ALEConfigValues::TRACEBACK_ENABLED); }
+ bool IsAutoReloadEnabled() const { return GetConfigValue(ALEConfigValues::AUTORELOAD_ENABLED); }
+ bool IsByteCodeCacheEnabled() const { return GetConfigValue(ALEConfigValues::BYTECODE_CACHE_ENABLED); }
- std::string_view GetScriptPath() const { return GetConfigValue(ElunaConfigValues::SCRIPT_PATH); }
- std::string_view GetRequirePath() const { return GetConfigValue(ElunaConfigValues::REQUIRE_PATH); }
- std::string_view GetRequireCPath() const { return GetConfigValue(ElunaConfigValues::REQUIRE_CPATH); }
+ std::string_view GetScriptPath() const { return GetConfigValue(ALEConfigValues::SCRIPT_PATH); }
+ std::string_view GetRequirePath() const { return GetConfigValue(ALEConfigValues::REQUIRE_PATH); }
+ std::string_view GetRequireCPath() const { return GetConfigValue(ALEConfigValues::REQUIRE_CPATH); }
- uint32 GetAutoReloadInterval() const { return GetConfigValue(ElunaConfigValues::AUTORELOAD_INTERVAL); }
+ uint32 GetAutoReloadInterval() const { return GetConfigValue(ALEConfigValues::AUTORELOAD_INTERVAL); }
protected:
void BuildConfigCache() override;
private:
- ElunaConfig();
- ~ElunaConfig() = default;
- ElunaConfig(const ElunaConfig&) = delete;
- ElunaConfig& operator=(const ElunaConfig&) = delete;
+ ALEConfig();
+ ~ALEConfig() = default;
+ ALEConfig(const ALEConfig&) = delete;
+ ALEConfig& operator=(const ALEConfig&) = delete;
};
-#endif // ELUNA_CONFIG_H
\ No newline at end of file
+#endif // ALE_CONFIG_H
\ No newline at end of file
diff --git a/src/LuaEngine/ElunaCreatureAI.h b/src/LuaEngine/ALECreatureAI.h
similarity index 77%
rename from src/LuaEngine/ElunaCreatureAI.h
rename to src/LuaEngine/ALECreatureAI.h
index e6a13dd..cb9ccda 100644
--- a/src/LuaEngine/ElunaCreatureAI.h
+++ b/src/LuaEngine/ALECreatureAI.h
@@ -1,27 +1,27 @@
/*
- * Copyright (C) 2010 - 2016 Eluna Lua Engine
+ * Copyright (C) 2010 - 2025 Eluna Lua Engine
* This program is free software licensed under GPL version 3
* Please see the included DOCS/LICENSE.md for more information
*/
-#ifndef _ELUNA_CREATURE_AI_H
-#define _ELUNA_CREATURE_AI_H
+#ifndef _ALE_CREATURE_AI_H
+#define _ALE_CREATURE_AI_H
#include "LuaEngine.h"
struct ScriptedAI;
-struct ElunaCreatureAI : ScriptedAI
+struct ALECreatureAI : ScriptedAI
{
// used to delay the spawn hook triggering on AI creation
bool justSpawned;
// used to delay movementinform hook (WP hook)
std::vector< std::pair > movepoints;
- ElunaCreatureAI(Creature* creature) : ScriptedAI(creature), justSpawned(true)
+ ALECreatureAI(Creature* creature) : ScriptedAI(creature), justSpawned(true)
{
}
- ~ElunaCreatureAI() { }
+ ~ALECreatureAI() { }
//Called at World update tick
void UpdateAI(uint32 diff) override
@@ -37,13 +37,13 @@ struct ElunaCreatureAI : ScriptedAI
{
for (auto& point : movepoints)
{
- if (!sEluna->MovementInform(me, point.first, point.second))
+ if (!sALE->MovementInform(me, point.first, point.second))
ScriptedAI::MovementInform(point.first, point.second);
}
movepoints.clear();
}
- if (!sEluna->UpdateAI(me, diff))
+ if (!sALE->UpdateAI(me, diff))
{
if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC))
ScriptedAI::UpdateAI(diff);
@@ -54,14 +54,14 @@ struct ElunaCreatureAI : ScriptedAI
// Called at creature aggro either by MoveInLOS or Attack Start
void JustEngagedWith(Unit* target) override
{
- if (!sEluna->EnterCombat(me, target))
+ if (!sALE->EnterCombat(me, target))
ScriptedAI::JustEngagedWith(target);
}
// Called at any Damage from any attacker (before damage apply)
void DamageTaken(Unit* attacker, uint32& damage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask) override
{
- if (!sEluna->DamageTaken(me, attacker, damage))
+ if (!sALE->DamageTaken(me, attacker, damage))
{
ScriptedAI::DamageTaken(attacker, damage, damagetype, damageSchoolMask);
}
@@ -70,28 +70,28 @@ struct ElunaCreatureAI : ScriptedAI
//Called at creature death
void JustDied(Unit* killer) override
{
- if (!sEluna->JustDied(me, killer))
+ if (!sALE->JustDied(me, killer))
ScriptedAI::JustDied(killer);
}
//Called at creature killing another unit
void KilledUnit(Unit* victim) override
{
- if (!sEluna->KilledUnit(me, victim))
+ if (!sALE->KilledUnit(me, victim))
ScriptedAI::KilledUnit(victim);
}
// Called when the creature summon successfully other creature
void JustSummoned(Creature* summon) override
{
- if (!sEluna->JustSummoned(me, summon))
+ if (!sALE->JustSummoned(me, summon))
ScriptedAI::JustSummoned(summon);
}
// Called when a summoned creature is despawned
void SummonedCreatureDespawn(Creature* summon) override
{
- if (!sEluna->SummonedCreatureDespawn(me, summon))
+ if (!sALE->SummonedCreatureDespawn(me, summon))
ScriptedAI::SummonedCreatureDespawn(summon);
}
@@ -106,89 +106,89 @@ struct ElunaCreatureAI : ScriptedAI
// Called before EnterCombat even before the creature is in combat.
void AttackStart(Unit* target) override
{
- if (!sEluna->AttackStart(me, target))
+ if (!sALE->AttackStart(me, target))
ScriptedAI::AttackStart(target);
}
// Called for reaction at stopping attack at no attackers or targets
void EnterEvadeMode(EvadeReason /*why*/) override
{
- if (!sEluna->EnterEvadeMode(me))
+ if (!sALE->EnterEvadeMode(me))
ScriptedAI::EnterEvadeMode();
}
// Called when creature is spawned or respawned (for reseting variables)
void JustRespawned() override
{
- if (!sEluna->JustRespawned(me))
+ if (!sALE->JustRespawned(me))
ScriptedAI::JustRespawned();
}
// Called at reaching home after evade
void JustReachedHome() override
{
- if (!sEluna->JustReachedHome(me))
+ if (!sALE->JustReachedHome(me))
ScriptedAI::JustReachedHome();
}
// Called at text emote receive from player
void ReceiveEmote(Player* player, uint32 emoteId) override
{
- if (!sEluna->ReceiveEmote(me, player, emoteId))
+ if (!sALE->ReceiveEmote(me, player, emoteId))
ScriptedAI::ReceiveEmote(player, emoteId);
}
// called when the corpse of this creature gets removed
void CorpseRemoved(uint32& respawnDelay) override
{
- if (!sEluna->CorpseRemoved(me, respawnDelay))
+ if (!sALE->CorpseRemoved(me, respawnDelay))
ScriptedAI::CorpseRemoved(respawnDelay);
}
void MoveInLineOfSight(Unit* who) override
{
- if (!sEluna->MoveInLineOfSight(me, who))
+ if (!sALE->MoveInLineOfSight(me, who))
ScriptedAI::MoveInLineOfSight(who);
}
// Called when hit by a spell
void SpellHit(Unit* caster, SpellInfo const* spell) override
{
- if (!sEluna->SpellHit(me, caster, spell))
+ if (!sALE->SpellHit(me, caster, spell))
ScriptedAI::SpellHit(caster, spell);
}
// Called when spell hits a target
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
{
- if (!sEluna->SpellHitTarget(me, target, spell))
+ if (!sALE->SpellHitTarget(me, target, spell))
ScriptedAI::SpellHitTarget(target, spell);
}
// Called when the creature is summoned successfully by other creature
void IsSummonedBy(WorldObject* summoner) override
{
- if (!summoner->ToUnit() || !sEluna->OnSummoned(me, summoner->ToUnit()))
+ if (!summoner->ToUnit() || !sALE->OnSummoned(me, summoner->ToUnit()))
ScriptedAI::IsSummonedBy(summoner);
}
void SummonedCreatureDies(Creature* summon, Unit* killer) override
{
- if (!sEluna->SummonedCreatureDies(me, summon, killer))
+ if (!sALE->SummonedCreatureDies(me, summon, killer))
ScriptedAI::SummonedCreatureDies(summon, killer);
}
// Called when owner takes damage
void OwnerAttackedBy(Unit* attacker) override
{
- if (!sEluna->OwnerAttackedBy(me, attacker))
+ if (!sALE->OwnerAttackedBy(me, attacker))
ScriptedAI::OwnerAttackedBy(attacker);
}
// Called when owner attacks something
void OwnerAttacked(Unit* target) override
{
- if (!sEluna->OwnerAttacked(me, target))
+ if (!sALE->OwnerAttacked(me, target))
ScriptedAI::OwnerAttacked(target);
}
};
diff --git a/src/LuaEngine/ElunaDBCRegistry.cpp b/src/LuaEngine/ALEDBCRegistry.cpp
similarity index 86%
rename from src/LuaEngine/ElunaDBCRegistry.cpp
rename to src/LuaEngine/ALEDBCRegistry.cpp
index 85e5639..4acc311 100644
--- a/src/LuaEngine/ElunaDBCRegistry.cpp
+++ b/src/LuaEngine/ALEDBCRegistry.cpp
@@ -1,4 +1,4 @@
-#include "ElunaDBCRegistry.h"
+#include "ALEDBCRegistry.h"
std::vector dbcRegistry = {
REGISTER_DBC(GemProperties, GemPropertiesEntry, sGemPropertiesStore),
diff --git a/src/LuaEngine/ElunaDBCRegistry.h b/src/LuaEngine/ALEDBCRegistry.h
similarity index 87%
rename from src/LuaEngine/ElunaDBCRegistry.h
rename to src/LuaEngine/ALEDBCRegistry.h
index 2671720..b525ce8 100644
--- a/src/LuaEngine/ElunaDBCRegistry.h
+++ b/src/LuaEngine/ALEDBCRegistry.h
@@ -1,5 +1,5 @@
-#ifndef ELUNADBCREGISTRY_H
-#define ELUNADBCREGISTRY_H
+#ifndef ALEDBCREGISTRY_H
+#define ALEDBCREGISTRY_H
#include
#include
@@ -30,9 +30,9 @@ extern std::vector dbcRegistry;
}, \
[](lua_State* L, const void* entry) { \
auto cast_entry = static_cast(entry); \
- Eluna::Push(L, *cast_entry); \
+ ALE::Push(L, *cast_entry); \
} \
}
-#endif // ELUNADBCREGISTRY_H
+#endif // ALEDBCREGISTRY_H
diff --git a/src/LuaEngine/ElunaEventMgr.cpp b/src/LuaEngine/ALEEventMgr.cpp
similarity index 78%
rename from src/LuaEngine/ElunaEventMgr.cpp
rename to src/LuaEngine/ALEEventMgr.cpp
index c5309a8..f90cee3 100644
--- a/src/LuaEngine/ElunaEventMgr.cpp
+++ b/src/LuaEngine/ALEEventMgr.cpp
@@ -1,10 +1,10 @@
/*
-* Copyright (C) 2010 - 2016 Eluna Lua Engine
+* Copyright (C) 2010 - 2025 Eluna Lua Engine
* This program is free software licensed under GPL version 3
* Please see the included DOCS/LICENSE.md for more information
*/
-#include "ElunaEventMgr.h"
+#include "ALEEventMgr.h"
#include "LuaEngine.h"
#include "Object.h"
@@ -14,7 +14,7 @@ extern "C"
#include "lauxlib.h"
};
-ElunaEventProcessor::ElunaEventProcessor(Eluna** _E, WorldObject* _obj) : m_time(0), obj(_obj), E(_E)
+ALEEventProcessor::ALEEventProcessor(ALE** _E, WorldObject* _obj) : m_time(0), obj(_obj), E(_E)
{
// can be called from multiple threads
if (obj)
@@ -24,22 +24,22 @@ ElunaEventProcessor::ElunaEventProcessor(Eluna** _E, WorldObject* _obj) : m_time
}
}
-ElunaEventProcessor::~ElunaEventProcessor()
+ALEEventProcessor::~ALEEventProcessor()
{
// can be called from multiple threads
{
- LOCK_ELUNA;
+ LOCK_ALE;
RemoveEvents_internal();
}
- if (obj && Eluna::IsInitialized())
+ if (obj && ALE::IsInitialized())
{
EventMgr::Guard guard((*E)->eventMgr->GetLock());
(*E)->eventMgr->processors.erase(this);
}
}
-void ElunaEventProcessor::Update(uint32 diff)
+void ALEEventProcessor::Update(uint32 diff)
{
m_time += diff;
for (EventList::iterator it = eventList.begin(); it != eventList.end() && it->first <= m_time; it = eventList.begin())
@@ -69,7 +69,7 @@ void ElunaEventProcessor::Update(uint32 diff)
}
}
-void ElunaEventProcessor::SetStates(LuaEventState state)
+void ALEEventProcessor::SetStates(LuaEventState state)
{
for (EventList::iterator it = eventList.begin(); it != eventList.end(); ++it)
it->second->SetState(state);
@@ -77,7 +77,7 @@ void ElunaEventProcessor::SetStates(LuaEventState state)
eventMap.clear();
}
-void ElunaEventProcessor::RemoveEvents_internal()
+void ALEEventProcessor::RemoveEvents_internal()
{
//if (!final)
//{
@@ -93,7 +93,7 @@ void ElunaEventProcessor::RemoveEvents_internal()
eventMap.clear();
}
-void ElunaEventProcessor::SetState(int eventId, LuaEventState state)
+void ALEEventProcessor::SetState(int eventId, LuaEventState state)
{
if (eventMap.find(eventId) != eventMap.end())
eventMap[eventId]->SetState(state);
@@ -101,22 +101,22 @@ void ElunaEventProcessor::SetState(int eventId, LuaEventState state)
eventMap.erase(eventId);
}
-void ElunaEventProcessor::AddEvent(LuaEvent* luaEvent)
+void ALEEventProcessor::AddEvent(LuaEvent* luaEvent)
{
luaEvent->GenerateDelay();
eventList.insert(std::pair(m_time + luaEvent->delay, luaEvent));
eventMap[luaEvent->funcRef] = luaEvent;
}
-void ElunaEventProcessor::AddEvent(int funcRef, uint32 min, uint32 max, uint32 repeats)
+void ALEEventProcessor::AddEvent(int funcRef, uint32 min, uint32 max, uint32 repeats)
{
AddEvent(new LuaEvent(funcRef, min, max, repeats));
}
-void ElunaEventProcessor::RemoveEvent(LuaEvent* luaEvent)
+void ALEEventProcessor::RemoveEvent(LuaEvent* luaEvent)
{
- // Unreference if should and if Eluna was not yet uninitialized and if the lua state still exists
- if (luaEvent->state != LUAEVENT_STATE_ERASE && Eluna::IsInitialized() && (*E)->HasLuaState())
+ // Unreference if should and if ALE was not yet uninitialized and if the lua state still exists
+ if (luaEvent->state != LUAEVENT_STATE_ERASE && ALE::IsInitialized() && (*E)->HasLuaState())
{
// Free lua function ref
luaL_unref((*E)->L, LUA_REGISTRYINDEX, luaEvent->funcRef);
@@ -124,7 +124,7 @@ void ElunaEventProcessor::RemoveEvent(LuaEvent* luaEvent)
delete luaEvent;
}
-EventMgr::EventMgr(Eluna** _E) : globalProcessor(new ElunaEventProcessor(_E, NULL)), E(_E)
+EventMgr::EventMgr(ALE** _E) : globalProcessor(new ALEEventProcessor(_E, NULL)), E(_E)
{
}
diff --git a/src/LuaEngine/ElunaEventMgr.h b/src/LuaEngine/ALEEventMgr.h
similarity index 81%
rename from src/LuaEngine/ElunaEventMgr.h
rename to src/LuaEngine/ALEEventMgr.h
index 1ab2cbe..5302ece 100644
--- a/src/LuaEngine/ElunaEventMgr.h
+++ b/src/LuaEngine/ALEEventMgr.h
@@ -1,22 +1,22 @@
/*
-* Copyright (C) 2010 - 2016 Eluna Lua Engine
+* Copyright (C) 2010 - 2025 Eluna Lua Engine
* This program is free software licensed under GPL version 3
* Please see the included DOCS/LICENSE.md for more information
*/
-#ifndef _ELUNA_EVENT_MGR_H
-#define _ELUNA_EVENT_MGR_H
+#ifndef _ALE_EVENT_MGR_H
+#define _ALE_EVENT_MGR_H
-#include "ElunaUtility.h"
+#include "ALEUtility.h"
#include "Common.h"
#include "Util.h"
#include
#include "Define.h"
-class Eluna;
+class ALE;
class EventMgr;
-class ElunaEventProcessor;
+class ALEEventProcessor;
class WorldObject;
enum LuaEventState
@@ -52,7 +52,7 @@ struct LuaEvent
LuaEventState state; // State for next call
};
-class ElunaEventProcessor
+class ALEEventProcessor
{
friend class EventMgr;
@@ -60,8 +60,8 @@ public:
typedef std::multimap EventList;
typedef std::unordered_map EventMap;
- ElunaEventProcessor(Eluna** _E, WorldObject* _obj);
- ~ElunaEventProcessor();
+ ALEEventProcessor(ALE** _E, WorldObject* _obj);
+ ~ALEEventProcessor();
void Update(uint32 diff);
// removes all timed events on next tick or at tick end
@@ -78,18 +78,18 @@ private:
EventList eventList;
uint64 m_time;
WorldObject* obj;
- Eluna** E;
+ ALE** E;
};
-class EventMgr : public ElunaUtil::Lockable
+class EventMgr : public ALEUtil::Lockable
{
public:
- typedef std::unordered_set ProcessorSet;
+ typedef std::unordered_set ProcessorSet;
ProcessorSet processors;
- ElunaEventProcessor* globalProcessor;
- Eluna** E;
+ ALEEventProcessor* globalProcessor;
+ ALE** E;
- EventMgr(Eluna** _E);
+ EventMgr(ALE** _E);
~EventMgr();
// Set the state of all timed events
diff --git a/src/LuaEngine/ElunaFileWatcher.cpp b/src/LuaEngine/ALEFileWatcher.cpp
similarity index 71%
rename from src/LuaEngine/ElunaFileWatcher.cpp
rename to src/LuaEngine/ALEFileWatcher.cpp
index 729f8ae..aa3cd37 100644
--- a/src/LuaEngine/ElunaFileWatcher.cpp
+++ b/src/LuaEngine/ALEFileWatcher.cpp
@@ -1,34 +1,34 @@
/*
-* Copyright (C) 2010 - 2016 Eluna Lua Engine
+* Copyright (C) 2010 - 2025 Eluna Lua Engine
* This program is free software licensed under GPL version 3
* Please see the included DOCS/LICENSE.md for more information
*/
-#include "ElunaFileWatcher.h"
+#include "ALEFileWatcher.h"
#include "LuaEngine.h"
-#include "ElunaUtility.h"
+#include "ALEUtility.h"
#include
-ElunaFileWatcher::ElunaFileWatcher() : running(false), checkInterval(1)
+ALEFileWatcher::ALEFileWatcher() : running(false), checkInterval(1)
{
}
-ElunaFileWatcher::~ElunaFileWatcher()
+ALEFileWatcher::~ALEFileWatcher()
{
StopWatching();
}
-void ElunaFileWatcher::StartWatching(const std::string& scriptPath, uint32 intervalSeconds)
+void ALEFileWatcher::StartWatching(const std::string& scriptPath, uint32 intervalSeconds)
{
if (running.load())
{
- ELUNA_LOG_DEBUG("[ElunaFileWatcher]: Already watching files");
+ ALE_LOG_DEBUG("[ALEFileWatcher]: Already watching files");
return;
}
if (scriptPath.empty())
{
- ELUNA_LOG_ERROR("[ElunaFileWatcher]: Cannot start watching - script path is empty");
+ ALE_LOG_ERROR("[ALEFileWatcher]: Cannot start watching - script path is empty");
return;
}
@@ -38,12 +38,12 @@ void ElunaFileWatcher::StartWatching(const std::string& scriptPath, uint32 inter
ScanDirectory(watchPath);
- watcherThread = std::thread(&ElunaFileWatcher::WatchLoop, this);
+ watcherThread = std::thread(&ALEFileWatcher::WatchLoop, this);
- ELUNA_LOG_INFO("[ElunaFileWatcher]: Started watching '{}' (interval: {}s)", watchPath, checkInterval);
+ ALE_LOG_INFO("[ALEFileWatcher]: Started watching '{}' (interval: {}s)", watchPath, checkInterval);
}
-void ElunaFileWatcher::StopWatching()
+void ALEFileWatcher::StopWatching()
{
if (!running.load())
return;
@@ -55,10 +55,10 @@ void ElunaFileWatcher::StopWatching()
fileTimestamps.clear();
- ELUNA_LOG_INFO("[ElunaFileWatcher]: Stopped watching files");
+ ALE_LOG_INFO("[ALEFileWatcher]: Stopped watching files");
}
-void ElunaFileWatcher::WatchLoop()
+void ALEFileWatcher::WatchLoop()
{
while (running.load())
{
@@ -68,20 +68,20 @@ void ElunaFileWatcher::WatchLoop()
}
catch (const std::exception& e)
{
- ELUNA_LOG_ERROR("[ElunaFileWatcher]: Error during file watching: {}", e.what());
+ ALE_LOG_ERROR("[ALEFileWatcher]: Error during file watching: {}", e.what());
}
std::this_thread::sleep_for(std::chrono::seconds(checkInterval));
}
}
-bool ElunaFileWatcher::IsWatchedFileType(const std::string& filename) {
+bool ALEFileWatcher::IsWatchedFileType(const std::string& filename) {
return (filename.length() >= 4 && filename.substr(filename.length() - 4) == ".lua") ||
(filename.length() >= 4 && filename.substr(filename.length() - 4) == ".ext") ||
(filename.length() >= 5 && filename.substr(filename.length() - 5) == ".moon");
}
-void ElunaFileWatcher::ScanDirectory(const std::string& path)
+void ALEFileWatcher::ScanDirectory(const std::string& path)
{
try
{
@@ -113,11 +113,11 @@ void ElunaFileWatcher::ScanDirectory(const std::string& path)
}
catch (const std::exception& e)
{
- ELUNA_LOG_ERROR("[ElunaFileWatcher]: Error scanning directory '{}': {}", path, e.what());
+ ALE_LOG_ERROR("[ALEFileWatcher]: Error scanning directory '{}': {}", path, e.what());
}
}
-void ElunaFileWatcher::CheckForChanges()
+void ALEFileWatcher::CheckForChanges()
{
bool hasChanges = false;
@@ -140,7 +140,7 @@ void ElunaFileWatcher::CheckForChanges()
{
if (!boost::filesystem::exists(it->first))
{
- ELUNA_LOG_DEBUG("[ElunaFileWatcher]: File deleted: {}", it->first);
+ ALE_LOG_DEBUG("[ALEFileWatcher]: File deleted: {}", it->first);
it = fileTimestamps.erase(it);
hasChanges = true;
}
@@ -152,20 +152,20 @@ void ElunaFileWatcher::CheckForChanges()
}
catch (const std::exception& e)
{
- ELUNA_LOG_ERROR("[ElunaFileWatcher]: Error checking for changes: {}", e.what());
+ ALE_LOG_ERROR("[ALEFileWatcher]: Error checking for changes: {}", e.what());
return;
}
if (hasChanges)
{
- ELUNA_LOG_INFO("[ElunaFileWatcher]: Lua script changes detected - triggering reload");
- Eluna::ReloadEluna();
+ ALE_LOG_INFO("[ALEFileWatcher]: Lua script changes detected - triggering reload");
+ ALE::ReloadALE();
ScanDirectory(watchPath);
}
}
-bool ElunaFileWatcher::ShouldReloadFile(const std::string& filepath)
+bool ALEFileWatcher::ShouldReloadFile(const std::string& filepath)
{
try
{
@@ -195,21 +195,21 @@ bool ElunaFileWatcher::ShouldReloadFile(const std::string& filepath)
if (it == fileTimestamps.end())
{
- ELUNA_LOG_DEBUG("[ElunaFileWatcher]: New file detected: {}", filepath);
+ ALE_LOG_DEBUG("[ALEFileWatcher]: New file detected: {}", filepath);
fileTimestamps[filepath] = currentTime;
return true;
}
if (it->second != currentTime)
{
- ELUNA_LOG_DEBUG("[ElunaFileWatcher]: File modified: {}", filepath);
+ ALE_LOG_DEBUG("[ALEFileWatcher]: File modified: {}", filepath);
it->second = currentTime;
return true;
}
}
catch (const std::exception& e)
{
- ELUNA_LOG_ERROR("[ElunaFileWatcher]: Error checking file '{}': {}", filepath, e.what());
+ ALE_LOG_ERROR("[ALEFileWatcher]: Error checking file '{}': {}", filepath, e.what());
}
return false;
diff --git a/src/LuaEngine/ElunaFileWatcher.h b/src/LuaEngine/ALEFileWatcher.h
similarity index 80%
rename from src/LuaEngine/ElunaFileWatcher.h
rename to src/LuaEngine/ALEFileWatcher.h
index fec29ba..75364a6 100644
--- a/src/LuaEngine/ElunaFileWatcher.h
+++ b/src/LuaEngine/ALEFileWatcher.h
@@ -1,11 +1,11 @@
/*
-* Copyright (C) 2010 - 2016 Eluna Lua Engine
+* Copyright (C) 2010 - 2025 Eluna Lua Engine
* This program is free software licensed under GPL version 3
* Please see the included DOCS/LICENSE.md for more information
*/
-#ifndef ELUNA_FILE_WATCHER_H
-#define ELUNA_FILE_WATCHER_H
+#ifndef ALE_FILE_WATCHER_H
+#define ALE_FILE_WATCHER_H
#include
#include
@@ -15,11 +15,11 @@
#include
#include "Common.h"
-class ElunaFileWatcher
+class ALEFileWatcher
{
public:
- ElunaFileWatcher();
- ~ElunaFileWatcher();
+ ALEFileWatcher();
+ ~ALEFileWatcher();
void StartWatching(const std::string& scriptPath, uint32 intervalSeconds = 1);
void StopWatching();
diff --git a/src/LuaEngine/ElunaIncludes.h b/src/LuaEngine/ALEIncludes.h
similarity index 92%
rename from src/LuaEngine/ElunaIncludes.h
rename to src/LuaEngine/ALEIncludes.h
index 0fc8456..7b305cd 100644
--- a/src/LuaEngine/ElunaIncludes.h
+++ b/src/LuaEngine/ALEIncludes.h
@@ -1,11 +1,11 @@
/*
-* Copyright (C) 2010 - 2016 Eluna Lua Engine
+* Copyright (C) 2010 - 2025 Eluna Lua Engine
* This program is free software licensed under GPL version 3
* Please see the included DOCS/LICENSE.md for more information
*/
-#ifndef _ELUNA_INCLUDES_H
-#define _ELUNA_INCLUDES_H
+#ifndef _ALE_INCLUDES_H
+#define _ALE_INCLUDES_H
// Required
#include "AccountMgr.h"
@@ -73,4 +73,4 @@ typedef Opcodes OpcodesList;
#define eGameEventMgr (sGameEventMgr)
#define eObjectAccessor() ObjectAccessor::
-#endif // _ELUNA_INCLUDES_H
+#endif // _ALE_INCLUDES_H
diff --git a/src/LuaEngine/ElunaInstanceAI.cpp b/src/LuaEngine/ALEInstanceAI.cpp
similarity index 57%
rename from src/LuaEngine/ElunaInstanceAI.cpp
rename to src/LuaEngine/ALEInstanceAI.cpp
index 731261a..ea32f2f 100644
--- a/src/LuaEngine/ElunaInstanceAI.cpp
+++ b/src/LuaEngine/ALEInstanceAI.cpp
@@ -1,31 +1,31 @@
/*
- * Copyright (C) 2010 - 2016 Eluna Lua Engine
+ * Copyright (C) 2010 - 2025 Eluna Lua Engine
* This program is free software licensed under GPL version 3
* Please see the included DOCS/LICENSE.md for more information
*/
-#include "ElunaInstanceAI.h"
-#include "ElunaUtility.h"
+#include "ALEInstanceAI.h"
+#include "ALEUtility.h"
#include "lmarshal.h"
-void ElunaInstanceAI::Initialize()
+void ALEInstanceAI::Initialize()
{
- LOCK_ELUNA;
+ LOCK_ALE;
- ASSERT(!sEluna->HasInstanceData(instance));
+ ASSERT(!sALE->HasInstanceData(instance));
// Create a new table for instance data.
- lua_State* L = sEluna->L;
+ lua_State* L = sALE->L;
lua_newtable(L);
- sEluna->CreateInstanceData(instance);
+ sALE->CreateInstanceData(instance);
- sEluna->OnInitialize(this);
+ sALE->OnInitialize(this);
}
-void ElunaInstanceAI::Load(const char* data)
+void ALEInstanceAI::Load(const char* data)
{
- LOCK_ELUNA;
+ LOCK_ALE;
// If we get passed NULL (i.e. `Reload` was called) then use
// the last known save data (or maybe just an empty string).
@@ -40,21 +40,21 @@ void ElunaInstanceAI::Load(const char* data)
if (data[0] == '\0')
{
- ASSERT(!sEluna->HasInstanceData(instance));
+ ASSERT(!sALE->HasInstanceData(instance));
// Create a new table for instance data.
- lua_State* L = sEluna->L;
+ lua_State* L = sALE->L;
lua_newtable(L);
- sEluna->CreateInstanceData(instance);
+ sALE->CreateInstanceData(instance);
- sEluna->OnLoad(this);
+ sALE->OnLoad(this);
// Stack: (empty)
return;
}
size_t decodedLength;
- const unsigned char* decodedData = ElunaUtil::DecodeData(data, &decodedLength);
- lua_State* L = sEluna->L;
+ const unsigned char* decodedData = ALEUtil::DecodeData(data, &decodedLength);
+ lua_State* L = sALE->L;
if (decodedData)
{
@@ -71,14 +71,14 @@ void ElunaInstanceAI::Load(const char* data)
// Only use the data if it's a table.
if (lua_istable(L, -1))
{
- sEluna->CreateInstanceData(instance);
+ sALE->CreateInstanceData(instance);
// Stack: (empty)
- sEluna->OnLoad(this);
+ sALE->OnLoad(this);
// WARNING! lastSaveData might be different after `OnLoad` if the Lua code saved data.
}
else
{
- ELUNA_LOG_ERROR("Error while loading instance data: Expected data to be a table (type 5), got type {} instead", lua_type(L, -1));
+ ALE_LOG_ERROR("Error while loading instance data: Expected data to be a table (type 5), got type {} instead", lua_type(L, -1));
lua_pop(L, 1);
// Stack: (empty)
@@ -88,7 +88,7 @@ void ElunaInstanceAI::Load(const char* data)
else
{
// Stack: error_message
- ELUNA_LOG_ERROR("Error while parsing instance data with lua-marshal: {}", lua_tostring(L, -1));
+ ALE_LOG_ERROR("Error while parsing instance data with lua-marshal: {}", lua_tostring(L, -1));
lua_pop(L, 1);
// Stack: (empty)
@@ -99,16 +99,16 @@ void ElunaInstanceAI::Load(const char* data)
}
else
{
- ELUNA_LOG_ERROR("Error while decoding instance data: Data is not valid base-64");
+ ALE_LOG_ERROR("Error while decoding instance data: Data is not valid base-64");
Initialize();
}
}
-const char* ElunaInstanceAI::Save() const
+const char* ALEInstanceAI::Save() const
{
- LOCK_ELUNA;
- lua_State* L = sEluna->L;
+ LOCK_ALE;
+ lua_State* L = sALE->L;
// Stack: (empty)
/*
@@ -118,16 +118,16 @@ const char* ElunaInstanceAI::Save() const
* Declaring virtual methods as `const` is BAD!
* Don't dictate to children that their methods must be pure.
*/
- ElunaInstanceAI* self = const_cast(this);
+ ALEInstanceAI* self = const_cast(this);
lua_pushcfunction(L, mar_encode);
- sEluna->PushInstanceData(L, self, false);
+ sALE->PushInstanceData(L, self, false);
// Stack: mar_encode, instance_data
if (lua_pcall(L, 1, 1, 0) != 0)
{
// Stack: error_message
- ELUNA_LOG_ERROR("Error while saving: {}", lua_tostring(L, -1));
+ ALE_LOG_ERROR("Error while saving: {}", lua_tostring(L, -1));
lua_pop(L, 1);
return NULL;
}
@@ -135,7 +135,7 @@ const char* ElunaInstanceAI::Save() const
// Stack: data
size_t dataLength;
const unsigned char* data = (const unsigned char*)lua_tolstring(L, -1, &dataLength);
- ElunaUtil::EncodeData(data, dataLength, self->lastSaveData);
+ ALEUtil::EncodeData(data, dataLength, self->lastSaveData);
lua_pop(L, 1);
// Stack: (empty)
@@ -143,39 +143,39 @@ const char* ElunaInstanceAI::Save() const
return lastSaveData.c_str();
}
-uint32 ElunaInstanceAI::GetData(uint32 key) const
+uint32 ALEInstanceAI::GetData(uint32 key) const
{
- LOCK_ELUNA;
- lua_State* L = sEluna->L;
+ LOCK_ALE;
+ lua_State* L = sALE->L;
// Stack: (empty)
- sEluna->PushInstanceData(L, const_cast(this), false);
+ sALE->PushInstanceData(L, const_cast(this), false);
// Stack: instance_data
- Eluna::Push(L, key);
+ ALE::Push(L, key);
// Stack: instance_data, key
lua_gettable(L, -2);
// Stack: instance_data, value
- uint32 value = Eluna::CHECKVAL(L, -1, 0);
+ uint32 value = ALE::CHECKVAL(L, -1, 0);
lua_pop(L, 2);
// Stack: (empty)
return value;
}
-void ElunaInstanceAI::SetData(uint32 key, uint32 value)
+void ALEInstanceAI::SetData(uint32 key, uint32 value)
{
- LOCK_ELUNA;
- lua_State* L = sEluna->L;
+ LOCK_ALE;
+ lua_State* L = sALE->L;
// Stack: (empty)
- sEluna->PushInstanceData(L, this, false);
+ sALE->PushInstanceData(L, this, false);
// Stack: instance_data
- Eluna::Push(L, key);
- Eluna::Push(L, value);
+ ALE::Push(L, key);
+ ALE::Push(L, value);
// Stack: instance_data, key, value
lua_settable(L, -3);
@@ -185,39 +185,39 @@ void ElunaInstanceAI::SetData(uint32 key, uint32 value)
// Stack: (empty)
}
-uint64 ElunaInstanceAI::GetData64(uint32 key) const
+uint64 ALEInstanceAI::GetData64(uint32 key) const
{
- LOCK_ELUNA;
- lua_State* L = sEluna->L;
+ LOCK_ALE;
+ lua_State* L = sALE->L;
// Stack: (empty)
- sEluna->PushInstanceData(L, const_cast(this), false);
+ sALE->PushInstanceData(L, const_cast(this), false);
// Stack: instance_data
- Eluna::Push(L, key);
+ ALE::Push(L, key);
// Stack: instance_data, key
lua_gettable(L, -2);
// Stack: instance_data, value
- uint64 value = Eluna::CHECKVAL(L, -1, 0);
+ uint64 value = ALE::CHECKVAL(L, -1, 0);
lua_pop(L, 2);
// Stack: (empty)
return value;
}
-void ElunaInstanceAI::SetData64(uint32 key, uint64 value)
+void ALEInstanceAI::SetData64(uint32 key, uint64 value)
{
- LOCK_ELUNA;
- lua_State* L = sEluna->L;
+ LOCK_ALE;
+ lua_State* L = sALE->L;
// Stack: (empty)
- sEluna->PushInstanceData(L, this, false);
+ sALE->PushInstanceData(L, this, false);
// Stack: instance_data
- Eluna::Push(L, key);
- Eluna::Push(L, value);
+ ALE::Push(L, key);
+ ALE::Push(L, value);
// Stack: instance_data, key, value
lua_settable(L, -3);
diff --git a/src/LuaEngine/ElunaInstanceAI.h b/src/LuaEngine/ALEInstanceAI.h
similarity index 65%
rename from src/LuaEngine/ElunaInstanceAI.h
rename to src/LuaEngine/ALEInstanceAI.h
index b141a8e..ebc5037 100644
--- a/src/LuaEngine/ElunaInstanceAI.h
+++ b/src/LuaEngine/ALEInstanceAI.h
@@ -1,42 +1,42 @@
/*
-* Copyright (C) 2010 - 2016 Eluna Lua Engine
+* Copyright (C) 2010 - 2025 Eluna Lua Engine
* This program is free software licensed under GPL version 3
* Please see the included DOCS/LICENSE.md for more information
*/
-#ifndef _ELUNA_INSTANCE_DATA_H
-#define _ELUNA_INSTANCE_DATA_H
+#ifndef _ALE_INSTANCE_DATA_H
+#define _ALE_INSTANCE_DATA_H
#include "LuaEngine.h"
#include "InstanceScript.h"
/*
* This class is a small wrapper around `InstanceData`,
- * allowing instances to be scripted with Eluna.
+ * allowing instances to be scripted with ALE.
*
*
* Note 1
* ======
*
- * Instances of `ElunaInstanceAI` are owned by the core, so they
- * are not deleted when Eluna is reloaded. Thus `Load` is only called
- * by the core once, no matter how many times Eluna is reloaded.
+ * Instances of `ALEInstanceAI` are owned by the core, so they
+ * are not deleted when ALE is reloaded. Thus `Load` is only called
+ * by the core once, no matter how many times ALE is reloaded.
*
- * However, when Eluna reloads, all instance data in Eluna is lost.
+ * However, when ALE reloads, all instance data in ALE is lost.
* So the solution is as follows:
*
* 1. Store the last save data in the member var `lastSaveData`.
*
* At first this is just the data given to us by the core when it calls `Load`,
- * but later on once we start saving new data this is from Eluna.
+ * but later on once we start saving new data this is from ALE.
*
- * 2. When retrieving instance data from Eluna, check if it's missing.
+ * 2. When retrieving instance data from ALE, check if it's missing.
*
- * The data will be missing if Eluna is reloaded, since a new Lua state is created.
+ * The data will be missing if ALE is reloaded, since a new Lua state is created.
*
* 3. If it *is* missing, call `Reload`.
*
- * This reloads the last known instance save data into Eluna, and calls the appropriate hooks.
+ * This reloads the last known instance save data into ALE, and calls the appropriate hooks.
*
*
* Note 2
@@ -48,7 +48,7 @@
* Therefore, none of the hooks are `const`-safe, and `const_cast` is used
* to escape from these restrictions.
*/
-class ElunaInstanceAI : public InstanceData
+class ALEInstanceAI : public InstanceData
{
private:
// The last save data to pass through this class,
@@ -56,7 +56,7 @@ private:
std::string lastSaveData;
public:
- ElunaInstanceAI(Map* map) : InstanceData(map)
+ ALEInstanceAI(Map* map) : InstanceData(map)
{
}
@@ -77,7 +77,7 @@ public:
/*
* Calls `Load` with the last save data that was passed to
- * or from Eluna.
+ * or from ALE.
*
* See: big documentation blurb at the top of this class.
*/
@@ -96,38 +96,38 @@ public:
void SetData64(uint32 key, uint64 value) override;
/*
- * These methods are just thin wrappers around Eluna.
+ * These methods are just thin wrappers around ALE.
*/
void Update(uint32 diff) override
{
- // If Eluna is reloaded, it will be missing our instance data.
+ // If ALE is reloaded, it will be missing our instance data.
// Reload here instead of waiting for the next hook call (possibly never).
// This avoids having to have an empty Update hook handler just to trigger the reload.
- if (!sEluna->HasInstanceData(instance))
+ if (!sALE->HasInstanceData(instance))
Reload();
- sEluna->OnUpdateInstance(this, diff);
+ sALE->OnUpdateInstance(this, diff);
}
bool IsEncounterInProgress() const override
{
- return sEluna->OnCheckEncounterInProgress(const_cast(this));
+ return sALE->OnCheckEncounterInProgress(const_cast(this));
}
void OnPlayerEnter(Player* player) override
{
- sEluna->OnPlayerEnterInstance(this, player);
+ sALE->OnPlayerEnterInstance(this, player);
}
void OnGameObjectCreate(GameObject* gameobject) override
{
- sEluna->OnGameObjectCreate(this, gameobject);
+ sALE->OnGameObjectCreate(this, gameobject);
}
void OnCreatureCreate(Creature* creature) override
{
- sEluna->OnCreatureCreate(this, creature);
+ sALE->OnCreatureCreate(this, creature);
}
};
-#endif // _ELUNA_INSTANCE_DATA_H
+#endif // _ALE_INSTANCE_DATA_H
diff --git a/src/LuaEngine/ElunaTemplate.h b/src/LuaEngine/ALETemplate.h
similarity index 80%
rename from src/LuaEngine/ElunaTemplate.h
rename to src/LuaEngine/ALETemplate.h
index 30c9f7d..a8d6fc4 100644
--- a/src/LuaEngine/ElunaTemplate.h
+++ b/src/LuaEngine/ALETemplate.h
@@ -1,11 +1,11 @@
/*
-* Copyright (C) 2010 - 2016 Eluna Lua Engine
+* Copyright (C) 2010 - 2025 Eluna Lua Engine
* This program is free software licensed under GPL version 3
* Please see the included DOCS/LICENSE.md for more information
*/
-#ifndef _ELUNA_TEMPLATE_H
-#define _ELUNA_TEMPLATE_H
+#ifndef _ALE_TEMPLATE_H
+#define _ALE_TEMPLATE_H
extern "C"
{
@@ -14,11 +14,11 @@ extern "C"
#include "lauxlib.h"
};
#include "LuaEngine.h"
-#include "ElunaCompat.h"
-#include "ElunaUtility.h"
+#include "ALECompat.h"
+#include "ALEUtility.h"
#include "SharedDefines.h"
-class ElunaGlobal
+class ALEGlobal
{
public:
static int thunk(lua_State* L)
@@ -29,14 +29,14 @@ public:
int args = lua_gettop(L) - top;
if (args < 0 || args > expected)
{
- ELUNA_LOG_ERROR("[Eluna]: {} returned unexpected amount of arguments {} out of {}. Report to devs", l->name, args, expected);
+ ALE_LOG_ERROR("[ALE]: {} returned unexpected amount of arguments {} out of {}. Report to devs", l->name, args, expected);
ASSERT(false);
}
lua_settop(L, top + expected);
return expected;
}
- static void SetMethods(Eluna* E, luaL_Reg* methodTable)
+ static void SetMethods(ALE* E, luaL_Reg* methodTable)
{
ASSERT(E);
ASSERT(methodTable);
@@ -55,20 +55,20 @@ public:
}
};
-class ElunaObject
+class ALEObject
{
public:
template
- ElunaObject(T * obj, bool manageMemory);
+ ALEObject(T * obj, bool manageMemory);
- ~ElunaObject()
+ ~ALEObject()
{
}
// Get wrapped object pointer
void* GetObj() const { return object; }
// Returns whether the object is valid or not
- bool IsValid() const { return !callstackid || callstackid == sEluna->GetCallstackId(); }
+ bool IsValid() const { return !callstackid || callstackid == sALE->GetCallstackId(); }
// Returns whether the object can be invalidated or not
bool CanInvalidate() const { return _invalidate; }
// Returns pointer to the wrapped object's type name
@@ -87,7 +87,7 @@ public:
ASSERT(!valid || (valid && object));
if (valid)
if (CanInvalidate())
- callstackid = sEluna->GetCallstackId();
+ callstackid = sALE->GetCallstackId();
else
callstackid = 0;
else
@@ -113,14 +113,14 @@ private:
};
template
-struct ElunaRegister
+struct ALERegister
{
const char* name;
int(*mfunc)(lua_State*, T*);
};
template
-class ElunaTemplate
+class ALETemplate
{
public:
static const char* tname;
@@ -130,7 +130,7 @@ public:
// If gc is true, lua will handle the memory management for object pushed
// gc should be used if pushing for example WorldPacket,
// that will only be needed on lua side and will not be managed by TC/mangos/
- static void Register(Eluna* E, const char* name, bool gc = false)
+ static void Register(ALE* E, const char* name, bool gc = false)
{
ASSERT(E);
ASSERT(name);
@@ -230,7 +230,7 @@ public:
}
template
- static void SetMethods(Eluna* E, ElunaRegister* methodTable)
+ static void SetMethods(ALE* E, ALERegister* methodTable)
{
ASSERT(E);
ASSERT(tname);
@@ -261,21 +261,21 @@ public:
}
// Create new userdata
- ElunaObject** ptrHold = static_cast(lua_newuserdata(L, sizeof(ElunaObject*)));
+ ALEObject** ptrHold = static_cast(lua_newuserdata(L, sizeof(ALEObject*)));
if (!ptrHold)
{
- ELUNA_LOG_ERROR("{} could not create new userdata", tname);
+ ALE_LOG_ERROR("{} could not create new userdata", tname);
lua_pushnil(L);
return 1;
}
- *ptrHold = new ElunaObject(const_cast(obj), manageMemory);
+ *ptrHold = new ALEObject(const_cast(obj), manageMemory);
// Set metatable for it
lua_pushstring(L, tname);
lua_rawget(L, LUA_REGISTRYINDEX);
if (!lua_istable(L, -1))
{
- ELUNA_LOG_ERROR("{} missing metatable", tname);
+ ALE_LOG_ERROR("{} missing metatable", tname);
lua_pop(L, 2);
lua_pushnil(L);
return 1;
@@ -286,11 +286,11 @@ public:
static T* Check(lua_State* L, int narg, bool error = true)
{
- ElunaObject* elunaObj = Eluna::CHECKTYPE(L, narg, tname, error);
- if (!elunaObj)
+ ALEObject* ALEObj = ALE::CHECKTYPE(L, narg, tname, error);
+ if (!ALEObj)
return NULL;
- if (!elunaObj->IsValid())
+ if (!ALEObj->IsValid())
{
char buff[256];
snprintf(buff, 256, "%s expected, got pointer to nonexisting (invalidated) object (%s). Check your code.", tname, luaL_typename(L, narg));
@@ -300,11 +300,11 @@ public:
}
else
{
- ELUNA_LOG_ERROR("{}", buff);
+ ALE_LOG_ERROR("{}", buff);
}
return NULL;
}
- return static_cast(elunaObj->GetObj());
+ return static_cast(ALEObj->GetObj());
}
static int GetType(lua_State* L)
@@ -315,25 +315,25 @@ public:
static int SetInvalidation(lua_State* L)
{
- ElunaObject* elunaObj = Eluna::CHECKOBJ(L, 1);
- bool invalidate = Eluna::CHECKVAL(L, 2);
+ ALEObject* ALEObj = ALE::CHECKOBJ(L, 1);
+ bool invalidate = ALE::CHECKVAL(L, 2);
- elunaObj->SetValidation(invalidate);
+ ALEObj->SetValidation(invalidate);
return 0;
}
static int CallMethod(lua_State* L)
{
- T* obj = Eluna::CHECKOBJ(L, 1); // get self
+ T* obj = ALE::CHECKOBJ(L, 1); // get self
if (!obj)
return 0;
- ElunaRegister* l = static_cast*>(lua_touserdata(L, lua_upvalueindex(1)));
+ ALERegister* l = static_cast*>(lua_touserdata(L, lua_upvalueindex(1)));
int top = lua_gettop(L);
int expected = l->mfunc(L, obj);
int args = lua_gettop(L) - top;
if (args < 0 || args > expected)
{
- ELUNA_LOG_ERROR("[Eluna]: {} returned unexpected amount of arguments {} out of {}. Report to devs", l->name, args, expected);
+ ALE_LOG_ERROR("[ALE]: {} returned unexpected amount of arguments {} out of {}. Report to devs", l->name, args, expected);
ASSERT(false);
}
lua_settop(L, top + expected);
@@ -342,11 +342,11 @@ public:
// Metamethods ("virtual")
- // Remember special cases like ElunaTemplate::CollectGarbage
+ // Remember special cases like ALETemplate::CollectGarbage
static int CollectGarbage(lua_State* L)
{
// Get object pointer (and check type, no error)
- ElunaObject* obj = Eluna::CHECKOBJ(L, 1, false);
+ ALEObject* obj = ALE::CHECKOBJ(L, 1, false);
if (obj && manageMemory)
delete static_cast(obj->GetObj());
delete obj;
@@ -355,7 +355,7 @@ public:
static int ToString(lua_State* L)
{
- T* obj = Eluna::CHECKOBJ(L, 1, true); // get self
+ T* obj = ALE::CHECKOBJ(L, 1, true); // get self
lua_pushfstring(L, "%s: %p", tname, obj);
return 1;
}
@@ -371,19 +371,19 @@ public:
static int UnaryMinus(lua_State* L) { return ArithmeticError(L); }
static int Concat(lua_State* L) { return luaL_error(L, "attempt to concatenate a %s value", tname); }
static int Length(lua_State* L) { return luaL_error(L, "attempt to get length of a %s value", tname); }
- static int Equal(lua_State* L) { Eluna::Push(L, Eluna::CHECKOBJ(L, 1) == Eluna::CHECKOBJ(L, 2)); return 1; }
+ static int Equal(lua_State* L) { ALE::Push(L, ALE::CHECKOBJ(L, 1) == ALE::CHECKOBJ(L, 2)); return 1; }
static int Less(lua_State* L) { return CompareError(L); }
static int LessOrEqual(lua_State* L) { return CompareError(L); }
static int Call(lua_State* L) { return luaL_error(L, "attempt to call a %s value", tname); }
};
template
-ElunaObject::ElunaObject(T * obj, bool manageMemory) : callstackid(1), _invalidate(!manageMemory), object(obj), type_name(ElunaTemplate::tname)
+ALEObject::ALEObject(T * obj, bool manageMemory) : callstackid(1), _invalidate(!manageMemory), object(obj), type_name(ALETemplate::tname)
{
SetValid(true);
}
-template const char* ElunaTemplate::tname = NULL;
-template bool ElunaTemplate::manageMemory = false;
+template const char* ALETemplate::tname = NULL;
+template bool ALETemplate::manageMemory = false;
#endif
diff --git a/src/LuaEngine/ElunaUtility.cpp b/src/LuaEngine/ALEUtility.cpp
similarity index 84%
rename from src/LuaEngine/ElunaUtility.cpp
rename to src/LuaEngine/ALEUtility.cpp
index 4bc7cb8..9817465 100644
--- a/src/LuaEngine/ElunaUtility.cpp
+++ b/src/LuaEngine/ALEUtility.cpp
@@ -1,44 +1,44 @@
/*
-* Copyright (C) 2010 - 2016 Eluna Lua Engine
+* Copyright (C) 2010 - 2025 Eluna Lua Engine
* This program is free software licensed under GPL version 3
* Please see the included DOCS/LICENSE.md for more information
*/
-#include "ElunaUtility.h"
+#include "ALEUtility.h"
#include "World.h"
#include "Object.h"
#include "Unit.h"
#include "GameObject.h"
#include "DBCStores.h"
-uint32 ElunaUtil::GetCurrTime()
+uint32 ALEUtil::GetCurrTime()
{
return getMSTime();
}
-uint32 ElunaUtil::GetTimeDiff(uint32 oldMSTime)
+uint32 ALEUtil::GetTimeDiff(uint32 oldMSTime)
{
return GetMSTimeDiffToNow(oldMSTime);
}
-ElunaUtil::ObjectGUIDCheck::ObjectGUIDCheck(ObjectGuid guid) : _guid(guid)
+ALEUtil::ObjectGUIDCheck::ObjectGUIDCheck(ObjectGuid guid) : _guid(guid)
{
}
-bool ElunaUtil::ObjectGUIDCheck::operator()(WorldObject* object)
+bool ALEUtil::ObjectGUIDCheck::operator()(WorldObject* object)
{
return object->GET_GUID() == _guid;
}
-ElunaUtil::ObjectDistanceOrderPred::ObjectDistanceOrderPred(WorldObject const* pRefObj, bool ascending) : m_refObj(pRefObj), m_ascending(ascending)
+ALEUtil::ObjectDistanceOrderPred::ObjectDistanceOrderPred(WorldObject const* pRefObj, bool ascending) : m_refObj(pRefObj), m_ascending(ascending)
{
}
-bool ElunaUtil::ObjectDistanceOrderPred::operator()(WorldObject const* pLeft, WorldObject const* pRight) const
+bool ALEUtil::ObjectDistanceOrderPred::operator()(WorldObject const* pLeft, WorldObject const* pRight) const
{
return m_ascending ? m_refObj->GetDistanceOrder(pLeft, pRight) : !m_refObj->GetDistanceOrder(pLeft, pRight);
}
-ElunaUtil::WorldObjectInRangeCheck::WorldObjectInRangeCheck(bool nearest, WorldObject const* obj, float range,
+ALEUtil::WorldObjectInRangeCheck::WorldObjectInRangeCheck(bool nearest, WorldObject const* obj, float range,
uint16 typeMask, uint32 entry, uint32 hostile, uint32 dead) :
i_obj(obj), i_obj_unit(nullptr), i_obj_fact(nullptr), i_hostile(hostile), i_entry(entry), i_range(range), i_typeMask(typeMask), i_dead(dead), i_nearest(nearest)
{
@@ -49,11 +49,11 @@ ElunaUtil::WorldObjectInRangeCheck::WorldObjectInRangeCheck(bool nearest, WorldO
if (!i_obj_unit)
i_obj_fact = sFactionTemplateStore.LookupEntry(14);
}
-WorldObject const& ElunaUtil::WorldObjectInRangeCheck::GetFocusObject() const
+WorldObject const& ALEUtil::WorldObjectInRangeCheck::GetFocusObject() const
{
return *i_obj;
}
-bool ElunaUtil::WorldObjectInRangeCheck::operator()(WorldObject* u)
+bool ALEUtil::WorldObjectInRangeCheck::operator()(WorldObject* u)
{
if (i_typeMask && !u->isType(TypeMask(i_typeMask)))
return false;
@@ -110,7 +110,7 @@ static void build_decoding_table()
decoding_table[(unsigned char)encoding_table[i]] = i;
}
-void ElunaUtil::EncodeData(const unsigned char* data, size_t input_length, std::string& output)
+void ALEUtil::EncodeData(const unsigned char* data, size_t input_length, std::string& output)
{
size_t output_length = 4 * ((input_length + 2) / 3);
char* buffer = new char[output_length];
@@ -136,7 +136,7 @@ void ElunaUtil::EncodeData(const unsigned char* data, size_t input_length, std::
delete[] buffer;
}
-unsigned char* ElunaUtil::DecodeData(const char *data, size_t *output_length)
+unsigned char* ALEUtil::DecodeData(const char *data, size_t *output_length)
{
if (decoding_table[(unsigned char)'B'] == 0)
build_decoding_table();
diff --git a/src/LuaEngine/ElunaUtility.h b/src/LuaEngine/ALEUtility.h
similarity index 91%
rename from src/LuaEngine/ElunaUtility.h
rename to src/LuaEngine/ALEUtility.h
index 024aba6..5af4ad8 100644
--- a/src/LuaEngine/ElunaUtility.h
+++ b/src/LuaEngine/ALEUtility.h
@@ -1,11 +1,11 @@
/*
-* Copyright (C) 2010 - 2016 Eluna Lua Engine
+* Copyright (C) 2010 - 2025 Eluna Lua Engine
* This program is free software licensed under GPL version 3
* Please see the included DOCS/LICENSE.md for more information
*/
-#ifndef _ELUNA_UTIL_H
-#define _ELUNA_UTIL_H
+#ifndef _ALE_UTIL_H
+#define _ALE_UTIL_H
#include
#include
@@ -17,7 +17,7 @@
#include "Database/QueryResult.h"
#include "Log.h"
-typedef QueryResult ElunaQuery;
+typedef QueryResult ALEQuery;
#define GET_GUID GetGUID
#define HIGHGUID_PLAYER HighGuid::Player
#define HIGHGUID_UNIT HighGuid::Unit
@@ -33,9 +33,9 @@ typedef QueryResult ElunaQuery;
#define HIGHGUID_INSTANCE HighGuid::Instance
#define HIGHGUID_GROUP HighGuid::Group
-#define ELUNA_LOG_INFO(...) LOG_INFO("eluna", __VA_ARGS__);
-#define ELUNA_LOG_ERROR(...) LOG_ERROR("eluna", __VA_ARGS__);
-#define ELUNA_LOG_DEBUG(...) LOG_DEBUG("eluna", __VA_ARGS__);
+#define ALE_LOG_INFO(...) LOG_INFO("ALE", __VA_ARGS__);
+#define ALE_LOG_ERROR(...) LOG_ERROR("ALE", __VA_ARGS__);
+#define ALE_LOG_DEBUG(...) LOG_DEBUG("ALE", __VA_ARGS__);
#ifndef MAKE_NEW_GUID
#define MAKE_NEW_GUID(l, e, h) ObjectGuid(h, e, l)
@@ -54,7 +54,7 @@ class Unit;
class WorldObject;
struct FactionTemplateEntry;
-namespace ElunaUtil
+namespace ALEUtil
{
uint32 GetCurrTime();
diff --git a/src/LuaEngine/BindingMap.h b/src/LuaEngine/BindingMap.h
index 287d489..c14ce6d 100644
--- a/src/LuaEngine/BindingMap.h
+++ b/src/LuaEngine/BindingMap.h
@@ -1,5 +1,5 @@
/*
-* Copyright (C) 2010 - 2016 Eluna Lua Engine
+* Copyright (C) 2010 - 2025 Eluna Lua Engine
* This program is free software licensed under GPL version 3
* Please see the included DOCS/LICENSE.md for more information
*/
@@ -9,7 +9,7 @@
#include
#include "Common.h"
-#include "ElunaUtility.h"
+#include "ALEUtility.h"
#include
extern "C"
@@ -23,7 +23,7 @@ extern "C"
* A set of bindings from keys of type `K` to Lua references.
*/
template
-class BindingMap : public ElunaUtil::Lockable
+class BindingMap : public ALEUtil::Lockable
{
private:
lua_State* L;
diff --git a/src/LuaEngine/ElunaConfig.cpp b/src/LuaEngine/ElunaConfig.cpp
deleted file mode 100644
index d2f8b3d..0000000
--- a/src/LuaEngine/ElunaConfig.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-#include "ElunaConfig.h"
-
-ElunaConfig& ElunaConfig::GetInstance()
-{
- static ElunaConfig instance;
- return instance;
-}
-
-ElunaConfig::ElunaConfig() : ConfigValueCache(ElunaConfigValues::CONFIG_VALUE_COUNT)
-{
-}
-
-void ElunaConfig::Initialize(bool reload)
-{
- ConfigValueCache::Initialize(reload);
-}
-
-void ElunaConfig::BuildConfigCache()
-{
- SetConfigValue(ElunaConfigValues::ENABLED, "Eluna.Enabled", "false");
- SetConfigValue(ElunaConfigValues::TRACEBACK_ENABLED, "Eluna.TraceBack", "false");
- SetConfigValue(ElunaConfigValues::AUTORELOAD_ENABLED, "Eluna.AutoReload", "false");
- SetConfigValue(ElunaConfigValues::BYTECODE_CACHE_ENABLED, "Eluna.BytecodeCache", "false");
-
- SetConfigValue(ElunaConfigValues::SCRIPT_PATH, "Eluna.ScriptPath", "lua_scripts");
- SetConfigValue(ElunaConfigValues::REQUIRE_PATH, "Eluna.RequirePaths", "");
- SetConfigValue(ElunaConfigValues::REQUIRE_CPATH, "Eluna.RequireCPaths", "");
-
- SetConfigValue(ElunaConfigValues::AUTORELOAD_INTERVAL, "Eluna.AutoReloadInterval", 1);
-}
diff --git a/src/LuaEngine/HookHelpers.h b/src/LuaEngine/HookHelpers.h
index 9dd0f26..557f753 100644
--- a/src/LuaEngine/HookHelpers.h
+++ b/src/LuaEngine/HookHelpers.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 - 2016 Eluna Lua Engine
+ * Copyright (C) 2010 - 2025 Eluna Lua Engine
* This program is free software licensed under GPL version 3
* Please see the included DOCS/LICENSE.md for more information
*/
@@ -8,7 +8,7 @@
#define _HOOK_HELPERS_H
#include "LuaEngine.h"
-#include "ElunaUtility.h"
+#include "ALEUtility.h"
/*
* Sets up the stack so that event handlers can be called.
@@ -16,7 +16,7 @@
* Returns the number of functions that were pushed onto the stack.
*/
template
-int Eluna::SetupStack(BindingMap* bindings1, BindingMap* bindings2, const K1& key1, const K2& key2, int number_of_arguments)
+int ALE::SetupStack(BindingMap* bindings1, BindingMap* bindings2, const K1& key1, const K2& key2, int number_of_arguments)
{
ASSERT(number_of_arguments == this->push_counter);
ASSERT(key1.event_id == key2.event_id);
@@ -47,12 +47,12 @@ int Eluna::SetupStack(BindingMap* bindings1, BindingMap* bindings2, cons
* Replace one of the arguments pushed before `SetupStack` with a new value.
*/
template
-void Eluna::ReplaceArgument(T value, uint8 index)
+void ALE::ReplaceArgument(T value, uint8 index)
{
ASSERT(index < lua_gettop(L) && index > 0);
// Stack: event_id, [arguments], [functions], [results]
- Eluna::Push(L, value);
+ ALE::Push(L, value);
// Stack: event_id, [arguments], [functions], [results], value
lua_replace(L, index + 1);
@@ -63,7 +63,7 @@ void Eluna::ReplaceArgument(T value, uint8 index)
* Call all event handlers registered to the event ID/entry combination and ignore any results.
*/
template
-void Eluna::CallAllFunctions(BindingMap* bindings1, BindingMap* bindings2, const K1& key1, const K2& key2)
+void ALE::CallAllFunctions(BindingMap* bindings1, BindingMap* bindings2, const K1& key1, const K2& key2)
{
int number_of_arguments = this->push_counter;
// Stack: [arguments]
@@ -89,7 +89,7 @@ void Eluna::CallAllFunctions(BindingMap* bindings1, BindingMap* bindings
* otherwise returns the opposite of `default_value`.
*/
template
-bool Eluna::CallAllFunctionsBool(BindingMap* bindings1, BindingMap* bindings2, const K1& key1, const K2& key2, bool default_value/* = false*/)
+bool ALE::CallAllFunctionsBool(BindingMap* bindings1, BindingMap* bindings2, const K1& key1, const K2& key2, bool default_value/* = false*/)
{
bool result = default_value;
// Note: number_of_arguments here does not count in eventID, which is pushed in SetupStack
diff --git a/src/LuaEngine/Hooks.h b/src/LuaEngine/Hooks.h
index 1c3a8ef..44272d1 100644
--- a/src/LuaEngine/Hooks.h
+++ b/src/LuaEngine/Hooks.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 - 2016 Eluna Lua Engine
+ * Copyright (C) 2010 - 2025 Eluna Lua Engine
* This program is free software licensed under GPL version 3
* Please see the included DOCS/LICENSE.md for more information
*/
@@ -17,7 +17,7 @@
* return;
*
* // Lock out any other threads.
- * LOCK_ELUNA;
+ * LOCK_ALE;
*
* // Push extra arguments, if any.
* Push(a);
@@ -35,7 +35,7 @@
* return;
*
* // Lock out any other threads.
- * LOCK_ELUNA;
+ * LOCK_ALE;
*
* // Push extra arguments, if any.
* Push(a);
@@ -122,8 +122,8 @@ namespace Hooks
WORLD_EVENT_ON_STARTUP = 14, // (event)
WORLD_EVENT_ON_SHUTDOWN = 15, // (event)
- // Eluna
- ELUNA_EVENT_ON_LUA_STATE_CLOSE = 16, // (event) - triggers just before shutting down eluna (on shutdown and restart)
+ // ALE
+ ALE_EVENT_ON_LUA_STATE_CLOSE = 16, // (event) - triggers just before shutting down ALE (on shutdown and restart)
// Map
MAP_EVENT_ON_CREATE = 17, // (event, map)
@@ -152,8 +152,8 @@ namespace Hooks
WORLD_EVENT_ON_DELETE_CREATURE = 31, // (event, creature)
WORLD_EVENT_ON_DELETE_GAMEOBJECT = 32, // (event, gameobject)
- // Eluna
- ELUNA_EVENT_ON_LUA_STATE_OPEN = 33, // (event) - triggers after all scripts are loaded
+ // ALE
+ ALE_EVENT_ON_LUA_STATE_OPEN = 33, // (event) - triggers after all scripts are loaded
GAME_EVENT_START = 34, // (event, gameeventid)
GAME_EVENT_STOP = 35, // (event, gameeventid)
diff --git a/src/LuaEngine/HttpManager.cpp b/src/LuaEngine/HttpManager.cpp
index 1efdc9d..f7079cf 100644
--- a/src/LuaEngine/HttpManager.cpp
+++ b/src/LuaEngine/HttpManager.cpp
@@ -131,7 +131,7 @@ void HttpManager::HttpWorkerThread()
std::string path;
if (!ParseUrl(req->url, host, path)) {
- ELUNA_LOG_ERROR("[Eluna]: Could not parse URL {}", req->url);
+ ALE_LOG_ERROR("[ALE]: Could not parse URL {}", req->url);
continue;
}
@@ -144,7 +144,7 @@ void HttpManager::HttpWorkerThread()
httplib::Error err = res.error();
if (err != httplib::Error::Success)
{
- ELUNA_LOG_ERROR("[Eluna]: HTTP request error: {}", httplib::to_string(err));
+ ALE_LOG_ERROR("[ALE]: HTTP request error: {}", httplib::to_string(err));
continue;
}
@@ -156,7 +156,7 @@ void HttpManager::HttpWorkerThread()
if (!ParseUrl(location, host, path))
{
- ELUNA_LOG_ERROR("[Eluna]: Could not parse URL after redirect: {}", location);
+ ALE_LOG_ERROR("[ALE]: Could not parse URL after redirect: {}", location);
continue;
}
httplib::Client cli2(host);
@@ -170,7 +170,7 @@ void HttpManager::HttpWorkerThread()
}
catch (const std::exception& ex)
{
- ELUNA_LOG_ERROR("[Eluna]: HTTP request error: {}", ex.what());
+ ALE_LOG_ERROR("[ALE]: HTTP request error: {}", ex.what());
}
delete req;
@@ -209,7 +209,7 @@ httplib::Result HttpManager::DoRequest(httplib::Client& client, HttpWorkItem* re
return client.Options(path, req->headers);
}
- ELUNA_LOG_ERROR("[Eluna]: HTTP request error: invalid HTTP verb {}", req->httpVerb);
+ ALE_LOG_ERROR("[ALE]: HTTP request error: invalid HTTP verb {}", req->httpVerb);
return client.Get(path, req->headers);
}
@@ -248,25 +248,25 @@ void HttpManager::HandleHttpResponses()
continue;
}
- LOCK_ELUNA;
+ LOCK_ALE;
- lua_State* L = Eluna::GEluna->L;
+ lua_State* L = ALE::GALE->L;
// Get function
lua_rawgeti(L, LUA_REGISTRYINDEX, res->funcRef);
// Push parameters
- Eluna::Push(L, res->statusCode);
- Eluna::Push(L, res->body);
+ ALE::Push(L, res->statusCode);
+ ALE::Push(L, res->body);
lua_newtable(L);
for (const auto& item : res->headers) {
- Eluna::Push(L, item.first);
- Eluna::Push(L, item.second);
+ ALE::Push(L, item.first);
+ ALE::Push(L, item.second);
lua_settable(L, -3);
}
// Call function
- Eluna::GEluna->ExecuteCall(3, 0);
+ ALE::GALE->ExecuteCall(3, 0);
luaL_unref(L, LUA_REGISTRYINDEX, res->funcRef);
diff --git a/src/LuaEngine/HttpManager.h b/src/LuaEngine/HttpManager.h
index 2a77c1e..cab17a4 100644
--- a/src/LuaEngine/HttpManager.h
+++ b/src/LuaEngine/HttpManager.h
@@ -1,5 +1,5 @@
-#ifndef ELUNA_HTTP_MANAGER_H
-#define ELUNA_HTTP_MANAGER_H
+#ifndef ALE_HTTP_MANAGER_H
+#define ALE_HTTP_MANAGER_H
#include
@@ -58,4 +58,4 @@ private:
std::regex parseUrlRegex;
};
-#endif // #ifndef ELUNA_HTTP_MANAGER_H
+#endif // #ifndef ALE_HTTP_MANAGER_H
diff --git a/src/LuaEngine/LuaEngine.cpp b/src/LuaEngine/LuaEngine.cpp
index 3b14538..e355427 100644
--- a/src/LuaEngine/LuaEngine.cpp
+++ b/src/LuaEngine/LuaEngine.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (C) 2010 - 2016 Eluna Lua Engine
+* Copyright (C) 2010 - 2025 Eluna Lua Engine
* This program is free software licensed under GPL version 3
* Please see the included DOCS/LICENSE.md for more information
*/
@@ -8,16 +8,16 @@
#include "LuaEngine.h"
#include "BindingMap.h"
#include "Chat.h"
-#include "ElunaCompat.h"
-#include "ElunaEventMgr.h"
-#include "ElunaIncludes.h"
-#include "ElunaTemplate.h"
-#include "ElunaUtility.h"
-#include "ElunaCreatureAI.h"
-#include "ElunaInstanceAI.h"
+#include "ALECompat.h"
+#include "ALEEventMgr.h"
+#include "ALEIncludes.h"
+#include "ALETemplate.h"
+#include "ALEUtility.h"
+#include "ALECreatureAI.h"
+#include "ALEInstanceAI.h"
#if AC_PLATFORM == AC_PLATFORM_WINDOWS
-#define ELUNA_WINDOWS
+#define ALE_WINDOWS
#endif
// Some dummy includes containing BOOST_VERSION:
@@ -41,27 +41,27 @@ extern "C"
// Additional lua libraries
};
-Eluna::ScriptList Eluna::lua_scripts;
-Eluna::ScriptList Eluna::lua_extensions;
-std::string Eluna::lua_folderpath;
-std::string Eluna::lua_requirepath;
-std::string Eluna::lua_requirecpath;
-Eluna* Eluna::GEluna = NULL;
-bool Eluna::reload = false;
-bool Eluna::initialized = false;
-Eluna::LockType Eluna::lock;
-std::unique_ptr Eluna::fileWatcher;
+ALE::ScriptList ALE::lua_scripts;
+ALE::ScriptList ALE::lua_extensions;
+std::string ALE::lua_folderpath;
+std::string ALE::lua_requirepath;
+std::string ALE::lua_requirecpath;
+ALE* ALE::GALE = NULL;
+bool ALE::reload = false;
+bool ALE::initialized = false;
+ALE::LockType ALE::lock;
+std::unique_ptr ALE::fileWatcher;
-// Global bytecode cache that survives Eluna reloads
+// Global bytecode cache that survives ALE reloads
static std::unordered_map globalBytecodeCache;
static std::unordered_map timestampCache;
static std::mutex globalCacheMutex;
-extern void RegisterFunctions(Eluna* E);
+extern void RegisterFunctions(ALE* E);
-void Eluna::Initialize()
+void ALE::Initialize()
{
- LOCK_ELUNA;
+ LOCK_ALE;
ASSERT(!IsInitialized());
// For instance data the data column needs to be able to hold more than 255 characters (tinytext)
@@ -70,25 +70,25 @@ void Eluna::Initialize()
LoadScriptPaths();
- // Must be before creating GEluna
- // This is checked on Eluna creation
+ // Must be before creating GALE
+ // This is checked on ALE creation
initialized = true;
- // Create global eluna
- GEluna = new Eluna();
+ // Create global ALE
+ GALE = new ALE();
// Start file watcher if enabled
- if (ElunaConfig::GetInstance().IsAutoReloadEnabled())
+ if (ALEConfig::GetInstance().IsAutoReloadEnabled())
{
- uint32 watchInterval = eConfigMgr->GetOption("Eluna.AutoReloadInterval", 1);
- fileWatcher = std::make_unique();
+ uint32 watchInterval = eConfigMgr->GetOption("ALE.AutoReloadInterval", 1);
+ fileWatcher = std::make_unique();
fileWatcher->StartWatching(lua_folderpath, watchInterval);
}
}
-void Eluna::Uninitialize()
+void ALE::Uninitialize()
{
- LOCK_ELUNA;
+ LOCK_ALE;
ASSERT(IsInitialized());
// Stop file watcher
@@ -98,8 +98,8 @@ void Eluna::Uninitialize()
fileWatcher.reset();
}
- delete GEluna;
- GEluna = NULL;
+ delete GALE;
+ GALE = NULL;
lua_scripts.clear();
lua_extensions.clear();
@@ -110,23 +110,23 @@ void Eluna::Uninitialize()
initialized = false;
}
-void Eluna::LoadScriptPaths()
+void ALE::LoadScriptPaths()
{
- uint32 oldMSTime = ElunaUtil::GetCurrTime();
+ uint32 oldMSTime = ALEUtil::GetCurrTime();
lua_scripts.clear();
lua_extensions.clear();
- lua_folderpath = ElunaConfig::GetInstance().GetScriptPath();
- const std::string& lua_path_extra = static_cast(ElunaConfig::GetInstance().GetRequirePath());
- const std::string& lua_cpath_extra = static_cast(ElunaConfig::GetInstance().GetRequireCPath());
+ lua_folderpath = ALEConfig::GetInstance().GetScriptPath();
+ const std::string& lua_path_extra = static_cast(ALEConfig::GetInstance().GetRequirePath());
+ const std::string& lua_cpath_extra = static_cast(ALEConfig::GetInstance().GetRequireCPath());
-#ifndef ELUNA_WINDOWS
+#ifndef ALE_WINDOWS
if (lua_folderpath[0] == '~')
if (const char* home = getenv("HOME"))
lua_folderpath.replace(0, 1, home);
#endif
- ELUNA_LOG_INFO("[Eluna]: Searching scripts from `{}`", lua_folderpath);
+ ALE_LOG_INFO("[ALE]: Searching scripts from `{}`", lua_folderpath);
// clear all cache variables
lua_requirepath.clear();
@@ -148,38 +148,38 @@ void Eluna::LoadScriptPaths()
if (!lua_requirecpath.empty())
lua_requirecpath.erase(lua_requirecpath.end() - 1);
- ELUNA_LOG_DEBUG("[Eluna]: Loaded {} scripts in {} ms", lua_scripts.size() + lua_extensions.size(), ElunaUtil::GetTimeDiff(oldMSTime));
+ ALE_LOG_DEBUG("[ALE]: Loaded {} scripts in {} ms", lua_scripts.size() + lua_extensions.size(), ALEUtil::GetTimeDiff(oldMSTime));
}
-void Eluna::_ReloadEluna()
+void ALE::_ReloadALE()
{
- LOCK_ELUNA;
+ LOCK_ALE;
ASSERT(IsInitialized());
- if (eConfigMgr->GetOption("Eluna.PlayerAnnounceReload", false))
- eWorldSessionMgr->SendServerMessage(SERVER_MSG_STRING, "Reloading Eluna...");
+ if (eConfigMgr->GetOption("ALE.PlayerAnnounceReload", false))
+ eWorldSessionMgr->SendServerMessage(SERVER_MSG_STRING, "Reloading ALE...");
else
- ChatHandler(nullptr).SendGMText(SERVER_MSG_STRING, "Reloading Eluna...");
+ ChatHandler(nullptr).SendGMText(SERVER_MSG_STRING, "Reloading ALE...");
// Remove all timed events
- sEluna->eventMgr->SetStates(LUAEVENT_STATE_ERASE);
+ sALE->eventMgr->SetStates(LUAEVENT_STATE_ERASE);
// Close lua
- sEluna->CloseLua();
+ sALE->CloseLua();
// Reload script paths
LoadScriptPaths();
// Open new lua and libaraies
- sEluna->OpenLua();
+ sALE->OpenLua();
// Run scripts from laoded paths
- sEluna->RunScripts();
+ sALE->RunScripts();
reload = false;
}
-Eluna::Eluna() :
+ALE::ALE() :
event_level(0),
push_counter(0),
@@ -217,12 +217,12 @@ CreatureUniqueBindings(NULL)
// Replace this with map insert if making multithread version
- // Set event manager. Must be after setting sEluna
+ // Set event manager. Must be after setting sALE
// on multithread have a map of state pointers and here insert this pointer to the map and then save a pointer of that pointer to the EventMgr
- eventMgr = new EventMgr(&Eluna::GEluna);
+ eventMgr = new EventMgr(&ALE::GALE);
}
-Eluna::~Eluna()
+ALE::~ALE()
{
ASSERT(IsInitialized());
@@ -232,7 +232,7 @@ Eluna::~Eluna()
eventMgr = NULL;
}
-void Eluna::CloseLua()
+void ALE::CloseLua()
{
OnLuaStateClose();
@@ -247,18 +247,18 @@ void Eluna::CloseLua()
continentDataRefs.clear();
}
-void Eluna::OpenLua()
+void ALE::OpenLua()
{
- if (!ElunaConfig::GetInstance().IsElunaEnabled())
+ if (!ALEConfig::GetInstance().IsALEEnabled())
{
- ELUNA_LOG_INFO("[Eluna]: Eluna is disabled in config");
+ ALE_LOG_INFO("[ALE]: ALE is disabled in config");
return;
}
L = luaL_newstate();
lua_pushlightuserdata(L, this);
- lua_setfield(L, LUA_REGISTRYINDEX, ELUNA_STATE_PTR);
+ lua_setfield(L, LUA_REGISTRYINDEX, ALE_STATE_PTR);
CreateBindStores();
@@ -288,7 +288,7 @@ void Eluna::OpenLua()
lua_pop(L, 1);
}
-void Eluna::CreateBindStores()
+void ALE::CreateBindStores()
{
DestroyBindStores();
@@ -316,7 +316,7 @@ void Eluna::CreateBindStores()
CreatureUniqueBindings = new BindingMap< UniqueObjectKey >(L);
}
-void Eluna::DestroyBindStores()
+void ALE::DestroyBindStores()
{
delete ServerEventBindings;
delete PlayerEventBindings;
@@ -363,9 +363,9 @@ void Eluna::DestroyBindStores()
CreatureUniqueBindings = NULL;
}
-void Eluna::AddScriptPath(std::string filename, const std::string& fullpath)
+void ALE::AddScriptPath(std::string filename, const std::string& fullpath)
{
- ELUNA_LOG_DEBUG("[Eluna]: AddScriptPath Checking file `{}`", fullpath);
+ ALE_LOG_DEBUG("[ALE]: AddScriptPath Checking file `{}`", fullpath);
// split file name
std::size_t extDot = filename.find_last_of('.');
@@ -388,10 +388,10 @@ void Eluna::AddScriptPath(std::string filename, const std::string& fullpath)
lua_extensions.push_back(script);
else
lua_scripts.push_back(script);
- ELUNA_LOG_DEBUG("[Eluna]: AddScriptPath add path `{}`", fullpath);
+ ALE_LOG_DEBUG("[ALE]: AddScriptPath add path `{}`", fullpath);
}
-std::time_t Eluna::GetFileModTime(const std::string& filepath)
+std::time_t ALE::GetFileModTime(const std::string& filepath)
{
struct stat fileInfo;
if (stat(filepath.c_str(), &fileInfo) == 0)
@@ -399,7 +399,7 @@ std::time_t Eluna::GetFileModTime(const std::string& filepath)
return 0;
}
-std::time_t Eluna::GetFileModTimeWithCache(const std::string& filepath)
+std::time_t ALE::GetFileModTimeWithCache(const std::string& filepath)
{
auto it = timestampCache.find(filepath);
if (it != timestampCache.end())
@@ -410,7 +410,7 @@ std::time_t Eluna::GetFileModTimeWithCache(const std::string& filepath)
return modTime;
}
-bool Eluna::CompileScriptToGlobalCache(const std::string& filepath)
+bool ALE::CompileScriptToGlobalCache(const std::string& filepath)
{
std::lock_guard lock(globalCacheMutex);
@@ -458,7 +458,7 @@ bool Eluna::CompileScriptToGlobalCache(const std::string& filepath)
return true;
}
-bool Eluna::CompileMoonScriptToGlobalCache(const std::string& filepath)
+bool ALE::CompileMoonScriptToGlobalCache(const std::string& filepath)
{
std::lock_guard lock(globalCacheMutex);
@@ -516,7 +516,7 @@ bool Eluna::CompileMoonScriptToGlobalCache(const std::string& filepath)
return true;
}
-int Eluna::TryLoadFromGlobalCache(lua_State* L, const std::string& filepath)
+int ALE::TryLoadFromGlobalCache(lua_State* L, const std::string& filepath)
{
std::lock_guard lock(globalCacheMutex);
@@ -531,9 +531,9 @@ int Eluna::TryLoadFromGlobalCache(lua_State* L, const std::string& filepath)
return luaL_loadbuffer(L, reinterpret_cast(it->second.bytecode.data()), it->second.bytecode.size(), filepath.c_str());
}
-int Eluna::LoadScriptWithCache(lua_State* L, const std::string& filepath, bool isMoonScript, uint32* compiledCount, uint32* cachedCount)
+int ALE::LoadScriptWithCache(lua_State* L, const std::string& filepath, bool isMoonScript, uint32* compiledCount, uint32* cachedCount)
{
- bool cacheEnabled = ElunaConfig::GetInstance().IsByteCodeCacheEnabled();
+ bool cacheEnabled = ALEConfig::GetInstance().IsByteCodeCacheEnabled();
if (cacheEnabled)
{
@@ -576,27 +576,27 @@ int Eluna::LoadScriptWithCache(lua_State* L, const std::string& filepath, bool i
}
}
-void Eluna::ClearGlobalCache()
+void ALE::ClearGlobalCache()
{
std::lock_guard lock(globalCacheMutex);
globalBytecodeCache.clear();
timestampCache.clear();
- ELUNA_LOG_INFO("[Eluna]: Global bytecode cache cleared");
+ ALE_LOG_INFO("[ALE]: Global bytecode cache cleared");
}
-void Eluna::ClearTimestampCache()
+void ALE::ClearTimestampCache()
{
std::lock_guard lock(globalCacheMutex);
timestampCache.clear();
}
-size_t Eluna::GetGlobalCacheSize()
+size_t ALE::GetGlobalCacheSize()
{
std::lock_guard lock(globalCacheMutex);
return globalBytecodeCache.size();
}
-int Eluna::LoadCompiledScript(lua_State* L, const std::string& filepath)
+int ALE::LoadCompiledScript(lua_State* L, const std::string& filepath)
{
std::ifstream file(filepath, std::ios::binary);
if (!file.is_open())
@@ -614,9 +614,9 @@ int Eluna::LoadCompiledScript(lua_State* L, const std::string& filepath)
}
// Finds lua script files from given path (including subdirectories) and pushes them to scripts
-void Eluna::GetScripts(std::string path)
+void ALE::GetScripts(std::string path)
{
- ELUNA_LOG_DEBUG("[Eluna]: GetScripts from path `{}`", path);
+ ALE_LOG_DEBUG("[ALE]: GetScripts from path `{}`", path);
boost::filesystem::path someDir(path);
boost::filesystem::directory_iterator end_iter;
@@ -637,7 +637,7 @@ void Eluna::GetScripts(std::string path)
std::string fullpath = dir_iter->path().generic_string();
// Check if file is hidden
-#ifdef ELUNA_WINDOWS
+#ifdef ALE_WINDOWS
DWORD dwAttrib = GetFileAttributes(fullpath.c_str());
if (dwAttrib != INVALID_FILE_ATTRIBUTES && (dwAttrib & FILE_ATTRIBUTE_HIDDEN))
continue;
@@ -669,18 +669,18 @@ static bool ScriptPathComparator(const LuaScript& first, const LuaScript& second
return first.filepath < second.filepath;
}
-void Eluna::RunScripts()
+void ALE::RunScripts()
{
- LOCK_ELUNA;
- if (!ElunaConfig::GetInstance().IsElunaEnabled())
+ LOCK_ALE;
+ if (!ALEConfig::GetInstance().IsALEEnabled())
return;
- uint32 oldMSTime = ElunaUtil::GetCurrTime();
+ uint32 oldMSTime = ALEUtil::GetCurrTime();
uint32 count = 0;
uint32 compiledCount = 0;
uint32 cachedCount = 0;
uint32 precompiledCount = 0;
- bool cacheEnabled = eConfigMgr->GetOption("Eluna.BytecodeCache", true);
+ bool cacheEnabled = eConfigMgr->GetOption("ALE.BytecodeCache", true);
if (cacheEnabled)
ClearTimestampCache();
@@ -703,7 +703,7 @@ void Eluna::RunScripts()
// Check that no duplicate names exist
if (loaded.find(it->filename) != loaded.end())
{
- ELUNA_LOG_ERROR("[Eluna]: Error loading `{}`. File with same name already loaded from `{}`, rename either file", it->filepath, loaded[it->filename]);
+ ALE_LOG_ERROR("[ALE]: Error loading `{}`. File with same name already loaded from `{}`, rename either file", it->filepath, loaded[it->filename]);
continue;
}
loaded[it->filename] = it->filepath;
@@ -713,7 +713,7 @@ void Eluna::RunScripts()
if (!lua_isnoneornil(L, -1))
{
lua_pop(L, 1);
- ELUNA_LOG_DEBUG("[Eluna]: `{}` was already loaded or required", it->filepath);
+ ALE_LOG_DEBUG("[ALE]: `{}` was already loaded or required", it->filepath);
continue;
}
lua_pop(L, 1);
@@ -724,7 +724,7 @@ void Eluna::RunScripts()
if (LoadScriptWithCache(L, it->filepath, true, &compiledCount, &cachedCount))
{
// Stack: package, modules, errmsg
- ELUNA_LOG_ERROR("[Eluna]: Error loading MoonScript `{}`", it->filepath);
+ ALE_LOG_ERROR("[ALE]: Error loading MoonScript `{}`", it->filepath);
Report(L);
// Stack: package, modules
continue;
@@ -735,7 +735,7 @@ void Eluna::RunScripts()
if (LoadCompiledScript(L, it->filepath))
{
// Stack: package, modules, errmsg
- ELUNA_LOG_ERROR("[Eluna]: Error loading compiled script `{}`", it->filepath);
+ ALE_LOG_ERROR("[ALE]: Error loading compiled script `{}`", it->filepath);
Report(L);
// Stack: package, modules
continue;
@@ -747,7 +747,7 @@ void Eluna::RunScripts()
if (LoadScriptWithCache(L, it->filepath, false, &compiledCount, &cachedCount))
{
// Stack: package, modules, errmsg
- ELUNA_LOG_ERROR("[Eluna]: Error loading `{}`", it->filepath);
+ ALE_LOG_ERROR("[ALE]: Error loading `{}`", it->filepath);
Report(L);
// Stack: package, modules
continue;
@@ -758,7 +758,7 @@ void Eluna::RunScripts()
if (luaL_loadfile(L, it->filepath.c_str()))
{
// Stack: package, modules, errmsg
- ELUNA_LOG_ERROR("[Eluna]: Error loading `{}`", it->filepath);
+ ALE_LOG_ERROR("[ALE]: Error loading `{}`", it->filepath);
Report(L);
// Stack: package, modules
continue;
@@ -779,7 +779,7 @@ void Eluna::RunScripts()
// Stack: package, modules
// successfully loaded and ran file
- ELUNA_LOG_DEBUG("[Eluna]: Successfully loaded `{}`", it->filepath);
+ ALE_LOG_DEBUG("[ALE]: Successfully loaded `{}`", it->filepath);
++count;
continue;
}
@@ -792,26 +792,26 @@ void Eluna::RunScripts()
{
details = fmt::format("({} compiled, {} cached, {} pre-compiled)", compiledCount, cachedCount, precompiledCount);
}
- ELUNA_LOG_INFO("[Eluna]: Executed {} Lua scripts in {} ms {}", count, ElunaUtil::GetTimeDiff(oldMSTime), details);
+ ALE_LOG_INFO("[ALE]: Executed {} Lua scripts in {} ms {}", count, ALEUtil::GetTimeDiff(oldMSTime), details);
OnLuaStateOpen();
}
-void Eluna::InvalidateObjects()
+void ALE::InvalidateObjects()
{
++callstackid;
ASSERT(callstackid && "Callstackid overflow");
}
-void Eluna::Report(lua_State* _L)
+void ALE::Report(lua_State* _L)
{
const char* msg = lua_tostring(_L, -1);
- ELUNA_LOG_ERROR("{}", msg);
+ ALE_LOG_ERROR("{}", msg);
lua_pop(_L, 1);
}
// Borrowed from http://stackoverflow.com/questions/12256455/print-stacktrace-from-c-code-with-embedded-lua
-int Eluna::StackTrace(lua_State *_L)
+int ALE::StackTrace(lua_State *_L)
{
// Stack: errmsg
if (!lua_isstring(_L, -1)) /* 'message' not a string? */
@@ -837,11 +837,11 @@ int Eluna::StackTrace(lua_State *_L)
// dirty stack?
// Stack: errmsg, debug, tracemsg
- sEluna->OnError(std::string(lua_tostring(_L, -1)));
+ sALE->OnError(std::string(lua_tostring(_L, -1)));
return 1;
}
-bool Eluna::ExecuteCall(int params, int res)
+bool ALE::ExecuteCall(int params, int res)
{
int top = lua_gettop(L);
int base = top - params;
@@ -852,11 +852,11 @@ bool Eluna::ExecuteCall(int params, int res)
// Check function type
if (!lua_isfunction(L, base))
{
- ELUNA_LOG_ERROR("[Eluna]: Cannot execute call: registered value is {}, not a function.", luaL_tolstring(L, base, NULL));
+ ALE_LOG_ERROR("[ALE]: Cannot execute call: registered value is {}, not a function.", luaL_tolstring(L, base, NULL));
ASSERT(false); // stack probably corrupt
}
- bool usetrace = ElunaConfig::GetInstance().IsTraceBackEnabled();
+ bool usetrace = ALEConfig::GetInstance().IsTraceBackEnabled();
if (usetrace)
{
lua_pushcfunction(L, &StackTrace);
@@ -898,63 +898,63 @@ bool Eluna::ExecuteCall(int params, int res)
return true;
}
-void Eluna::Push(lua_State* luastate)
+void ALE::Push(lua_State* luastate)
{
lua_pushnil(luastate);
}
-void Eluna::Push(lua_State* luastate, const long long l)
+void ALE::Push(lua_State* luastate, const long long l)
{
- ElunaTemplate::Push(luastate, new long long(l));
+ ALETemplate::Push(luastate, new long long(l));
}
-void Eluna::Push(lua_State* luastate, const unsigned long long l)
+void ALE::Push(lua_State* luastate, const unsigned long long l)
{
- ElunaTemplate::Push(luastate, new unsigned long long(l));
+ ALETemplate::Push(luastate, new unsigned long long(l));
}
-void Eluna::Push(lua_State* luastate, const long l)
+void ALE::Push(lua_State* luastate, const long l)
{
Push(luastate, static_cast(l));
}
-void Eluna::Push(lua_State* luastate, const unsigned long l)
+void ALE::Push(lua_State* luastate, const unsigned long l)
{
Push(luastate, static_cast(l));
}
-void Eluna::Push(lua_State* luastate, const int i)
+void ALE::Push(lua_State* luastate, const int i)
{
lua_pushinteger(luastate, i);
}
-void Eluna::Push(lua_State* luastate, const unsigned int u)
+void ALE::Push(lua_State* luastate, const unsigned int u)
{
lua_pushunsigned(luastate, u);
}
-void Eluna::Push(lua_State* luastate, const double d)
+void ALE::Push(lua_State* luastate, const double d)
{
lua_pushnumber(luastate, d);
}
-void Eluna::Push(lua_State* luastate, const float f)
+void ALE::Push(lua_State* luastate, const float f)
{
lua_pushnumber(luastate, f);
}
-void Eluna::Push(lua_State* luastate, const bool b)
+void ALE::Push(lua_State* luastate, const bool b)
{
lua_pushboolean(luastate, b);
}
-void Eluna::Push(lua_State* luastate, const std::string& str)
+void ALE::Push(lua_State* luastate, const std::string& str)
{
lua_pushstring(luastate, str.c_str());
}
-void Eluna::Push(lua_State* luastate, const char* str)
+void ALE::Push(lua_State* luastate, const char* str)
{
lua_pushstring(luastate, str);
}
-void Eluna::Push(lua_State* luastate, Pet const* pet)
+void ALE::Push(lua_State* luastate, Pet const* pet)
{
Push(luastate, pet);
}
-void Eluna::Push(lua_State* luastate, TempSummon const* summon)
+void ALE::Push(lua_State* luastate, TempSummon const* summon)
{
Push(luastate, summon);
}
-void Eluna::Push(lua_State* luastate, Unit const* unit)
+void ALE::Push(lua_State* luastate, Unit const* unit)
{
if (!unit)
{
@@ -970,10 +970,10 @@ void Eluna::Push(lua_State* luastate, Unit const* unit)
Push(luastate, unit->ToPlayer());
break;
default:
- ElunaTemplate::Push(luastate, unit);
+ ALETemplate::Push(luastate, unit);
}
}
-void Eluna::Push(lua_State* luastate, WorldObject const* obj)
+void ALE::Push(lua_State* luastate, WorldObject const* obj)
{
if (!obj)
{
@@ -995,10 +995,10 @@ void Eluna::Push(lua_State* luastate, WorldObject const* obj)
Push(luastate, obj->ToCorpse());
break;
default:
- ElunaTemplate::Push(luastate, obj);
+ ALETemplate::Push(luastate, obj);
}
}
-void Eluna::Push(lua_State* luastate, Object const* obj)
+void ALE::Push(lua_State* luastate, Object const* obj)
{
if (!obj)
{
@@ -1020,30 +1020,30 @@ void Eluna::Push(lua_State* luastate, Object const* obj)
Push(luastate, obj->ToCorpse());
break;
default:
- ElunaTemplate::Push(luastate, obj);
+ ALETemplate::Push(luastate, obj);
}
}
-void Eluna::Push(lua_State* luastate, ObjectGuid const guid)
+void ALE::Push(lua_State* luastate, ObjectGuid const guid)
{
- ElunaTemplate::Push(luastate, new unsigned long long(guid.GetRawValue()));
+ ALETemplate::Push(luastate, new unsigned long long(guid.GetRawValue()));
}
-void Eluna::Push(lua_State* luastate, GemPropertiesEntry const& gemProperties)
+void ALE::Push(lua_State* luastate, GemPropertiesEntry const& gemProperties)
{
Push(luastate, &gemProperties);
}
-void Eluna::Push(lua_State* luastate, SpellEntry const& spell)
+void ALE::Push(lua_State* luastate, SpellEntry const& spell)
{
Push(luastate, &spell);
}
-void Eluna::Push(lua_State* luastate, CreatureTemplate const* creatureTemplate)
+void ALE::Push(lua_State* luastate, CreatureTemplate const* creatureTemplate)
{
Push(luastate, creatureTemplate);
}
-std::string Eluna::FormatQuery(lua_State* L, const char* query)
+std::string ALE::FormatQuery(lua_State* L, const char* query)
{
int numArgs = lua_gettop(L);
std::string formattedQuery = query;
@@ -1122,85 +1122,85 @@ static unsigned int CheckUnsignedRange(lua_State* luastate, int narg, unsigned i
return static_cast(value);
}
-template<> bool Eluna::CHECKVAL(lua_State* luastate, int narg)
+template<> bool ALE::CHECKVAL(lua_State* luastate, int narg)
{
return lua_toboolean(luastate, narg) != 0;
}
-template<> float Eluna::CHECKVAL(lua_State* luastate, int narg)
+template<> float ALE::CHECKVAL(lua_State* luastate, int narg)
{
return static_cast(luaL_checknumber(luastate, narg));
}
-template<> double Eluna::CHECKVAL(lua_State* luastate, int narg)
+template<> double ALE::CHECKVAL(lua_State* luastate, int narg)
{
return luaL_checknumber(luastate, narg);
}
-template<> signed char Eluna::CHECKVAL(lua_State* luastate, int narg)
+template<> signed char ALE::CHECKVAL(lua_State* luastate, int narg)
{
return CheckIntegerRange(luastate, narg, SCHAR_MIN, SCHAR_MAX);
}
-template<> unsigned char Eluna::CHECKVAL(lua_State* luastate, int narg)
+template<> unsigned char ALE::CHECKVAL(lua_State* luastate, int narg)
{
return CheckUnsignedRange(luastate, narg, UCHAR_MAX);
}
-template<> short Eluna::CHECKVAL(lua_State* luastate, int narg)
+template<> short ALE::CHECKVAL(lua_State* luastate, int narg)
{
return CheckIntegerRange(luastate, narg, SHRT_MIN, SHRT_MAX);
}
-template<> unsigned short Eluna::CHECKVAL(lua_State* luastate, int narg)
+template<> unsigned short ALE::CHECKVAL(lua_State* luastate, int narg)
{
return CheckUnsignedRange(luastate, narg, USHRT_MAX);
}
-template<> int Eluna::CHECKVAL(lua_State* luastate, int narg)
+template<> int ALE::CHECKVAL(lua_State* luastate, int narg)
{
return CheckIntegerRange(luastate, narg, INT_MIN, INT_MAX);
}
-template<> unsigned int Eluna::CHECKVAL(lua_State* luastate, int narg)
+template<> unsigned int ALE::CHECKVAL(lua_State* luastate, int narg)
{
return CheckUnsignedRange(luastate, narg, UINT_MAX);
}
-template<> const char* Eluna::CHECKVAL(lua_State* luastate, int narg)
+template<> const char* ALE::CHECKVAL(lua_State* luastate, int narg)
{
return luaL_checkstring(luastate, narg);
}
-template<> std::string Eluna::CHECKVAL(lua_State* luastate, int narg)
+template<> std::string ALE::CHECKVAL(lua_State* luastate, int narg)
{
return luaL_checkstring(luastate, narg);
}
-template<> long long Eluna::CHECKVAL(lua_State* luastate, int narg)
+template<> long long ALE::CHECKVAL(lua_State* luastate, int narg)
{
if (lua_isnumber(luastate, narg))
return static_cast(CHECKVAL(luastate, narg));
- return *(Eluna::CHECKOBJ(luastate, narg, true));
+ return *(ALE::CHECKOBJ(luastate, narg, true));
}
-template<> unsigned long long Eluna::CHECKVAL(lua_State* luastate, int narg)
+template<> unsigned long long ALE::CHECKVAL(lua_State* luastate, int narg)
{
if (lua_isnumber(luastate, narg))
return static_cast(CHECKVAL(luastate, narg));
- return *(Eluna::CHECKOBJ(luastate, narg, true));
+ return *(ALE::CHECKOBJ(luastate, narg, true));
}
-template<> long Eluna::CHECKVAL(lua_State* luastate, int narg)
+template<> long ALE::CHECKVAL(lua_State* luastate, int narg)
{
return static_cast(CHECKVAL(luastate, narg));
}
-template<> unsigned long Eluna::CHECKVAL(lua_State* luastate, int narg)
+template<> unsigned long ALE::CHECKVAL(lua_State* luastate, int narg)
{
return static_cast(CHECKVAL(luastate, narg));
}
-template<> ObjectGuid Eluna::CHECKVAL(lua_State* luastate, int narg)
+template<> ObjectGuid ALE::CHECKVAL(lua_State* luastate, int narg)
{
return ObjectGuid(uint64((CHECKVAL(luastate, narg))));
}
-template<> Object* Eluna::CHECKOBJ(lua_State* luastate, int narg, bool error)
+template<> Object* ALE::CHECKOBJ(lua_State* luastate, int narg, bool error)
{
Object* obj = CHECKOBJ(luastate, narg, false);
if (!obj)
obj = CHECKOBJ- (luastate, narg, false);
if (!obj)
- obj = ElunaTemplate
::Check(luastate, narg, error);
+ obj = ALETemplate::Check(luastate, narg, error);
return obj;
}
-template<> WorldObject* Eluna::CHECKOBJ(lua_State* luastate, int narg, bool error)
+template<> WorldObject* ALE::CHECKOBJ(lua_State* luastate, int narg, bool error)
{
WorldObject* obj = CHECKOBJ(luastate, narg, false);
if (!obj)
@@ -1208,25 +1208,25 @@ template<> WorldObject* Eluna::CHECKOBJ(lua_State* luastate, int na
if (!obj)
obj = CHECKOBJ(luastate, narg, false);
if (!obj)
- obj = ElunaTemplate::Check(luastate, narg, error);
+ obj = ALETemplate::Check(luastate, narg, error);
return obj;
}
-template<> Unit* Eluna::CHECKOBJ(lua_State* luastate, int narg, bool error)
+template<> Unit* ALE::CHECKOBJ(lua_State* luastate, int narg, bool error)
{
Unit* obj = CHECKOBJ(luastate, narg, false);
if (!obj)
obj = CHECKOBJ(luastate, narg, false);
if (!obj)
- obj = ElunaTemplate::Check(luastate, narg, error);
+ obj = ALETemplate::Check(luastate, narg, error);
return obj;
}
-template<> ElunaObject* Eluna::CHECKOBJ(lua_State* luastate, int narg, bool error)
+template<> ALEObject* ALE::CHECKOBJ(lua_State* luastate, int narg, bool error)
{
return CHECKTYPE(luastate, narg, NULL, error);
}
-ElunaObject* Eluna::CHECKTYPE(lua_State* luastate, int narg, const char* tname, bool error)
+ALEObject* ALE::CHECKTYPE(lua_State* luastate, int narg, const char* tname, bool error)
{
if (lua_islightuserdata(luastate, narg))
{
@@ -1235,14 +1235,14 @@ ElunaObject* Eluna::CHECKTYPE(lua_State* luastate, int narg, const char* tname,
return NULL;
}
- ElunaObject** ptrHold = static_cast(lua_touserdata(luastate, narg));
+ ALEObject** ptrHold = static_cast(lua_touserdata(luastate, narg));
if (!ptrHold || (tname && (*ptrHold)->GetTypeName() != tname))
{
if (error)
{
char buff[256];
- snprintf(buff, 256, "bad argument : %s expected, got %s", tname ? tname : "ElunaObject", ptrHold ? (*ptrHold)->GetTypeName() : luaL_typename(luastate, narg));
+ snprintf(buff, 256, "bad argument : %s expected, got %s", tname ? tname : "ALEObject", ptrHold ? (*ptrHold)->GetTypeName() : luaL_typename(luastate, narg));
luaL_argerror(luastate, narg, buff);
}
return NULL;
@@ -1253,7 +1253,7 @@ ElunaObject* Eluna::CHECKTYPE(lua_State* luastate, int narg, const char* tname,
template
static int cancelBinding(lua_State *L)
{
- uint64 bindingID = Eluna::CHECKVAL(L, lua_upvalueindex(1));
+ uint64 bindingID = ALE::CHECKVAL(L, lua_upvalueindex(1));
BindingMap* bindings = (BindingMap*)lua_touserdata(L, lua_upvalueindex(2));
ASSERT(bindings != NULL);
@@ -1266,7 +1266,7 @@ static int cancelBinding(lua_State *L)
template
static void createCancelCallback(lua_State* L, uint64 bindingID, BindingMap* bindings)
{
- Eluna::Push(L, bindingID);
+ ALE::Push(L, bindingID);
lua_pushlightuserdata(L, bindings);
// Stack: bindingID, bindings
@@ -1275,7 +1275,7 @@ static void createCancelCallback(lua_State* L, uint64 bindingID, BindingMap*
}
// Saves the function reference ID given to the register type's store for given entry under the given event
-int Eluna::Register(lua_State* L, uint8 regtype, uint32 entry, ObjectGuid guid, uint32 instanceId, uint32 event_id, int functionRef, uint32 shots)
+int ALE::Register(lua_State* L, uint8 regtype, uint32 entry, ObjectGuid guid, uint32 instanceId, uint32 event_id, int functionRef, uint32 shots)
{
uint64 bindingID;
@@ -1553,7 +1553,7 @@ int Eluna::Register(lua_State* L, uint8 regtype, uint32 entry, ObjectGuid guid,
/*
* Cleans up the stack, effectively undoing all Push calls and the Setup call.
*/
-void Eluna::CleanUpStack(int number_of_arguments)
+void ALE::CleanUpStack(int number_of_arguments)
{
// Stack: event_id, [arguments]
@@ -1569,7 +1569,7 @@ void Eluna::CleanUpStack(int number_of_arguments)
*
* The caller is responsible for keeping track of how many times this should be called.
*/
-int Eluna::CallOneFunction(int number_of_functions, int number_of_arguments, int number_of_results)
+int ALE::CallOneFunction(int number_of_functions, int number_of_arguments, int number_of_results)
{
++number_of_arguments; // Caller doesn't know about `event_id`.
ASSERT(number_of_functions > 0 && number_of_arguments > 0 && number_of_results >= 0);
@@ -1594,9 +1594,9 @@ int Eluna::CallOneFunction(int number_of_functions, int number_of_arguments, int
return functions_top + 1; // Return the location of the first result (if any exist).
}
-CreatureAI* Eluna::GetAI(Creature* creature)
+CreatureAI* ALE::GetAI(Creature* creature)
{
- if (!ElunaConfig::GetInstance().IsElunaEnabled())
+ if (!ALEConfig::GetInstance().IsALEEnabled())
return NULL;
for (int i = 1; i < Hooks::CREATURE_EVENT_COUNT; ++i)
@@ -1608,15 +1608,15 @@ CreatureAI* Eluna::GetAI(Creature* creature)
if (CreatureEventBindings->HasBindingsFor(entryKey) ||
CreatureUniqueBindings->HasBindingsFor(uniqueKey))
- return new ElunaCreatureAI(creature);
+ return new ALECreatureAI(creature);
}
return NULL;
}
-InstanceData* Eluna::GetInstanceData(Map* map)
+InstanceData* ALE::GetInstanceData(Map* map)
{
- if (!ElunaConfig::GetInstance().IsElunaEnabled())
+ if (!ALEConfig::GetInstance().IsALEEnabled())
return NULL;
for (int i = 1; i < Hooks::INSTANCE_EVENT_COUNT; ++i)
@@ -1627,13 +1627,13 @@ InstanceData* Eluna::GetInstanceData(Map* map)
if (MapEventBindings->HasBindingsFor(key) ||
InstanceEventBindings->HasBindingsFor(key))
- return new ElunaInstanceAI(map);
+ return new ALEInstanceAI(map);
}
return NULL;
}
-bool Eluna::HasInstanceData(Map const* map)
+bool ALE::HasInstanceData(Map const* map)
{
if (!map->Instanceable())
return continentDataRefs.find(map->GetId()) != continentDataRefs.end();
@@ -1641,7 +1641,7 @@ bool Eluna::HasInstanceData(Map const* map)
return instanceDataRefs.find(map->GetInstanceId()) != instanceDataRefs.end();
}
-void Eluna::CreateInstanceData(Map const* map)
+void ALE::CreateInstanceData(Map const* map)
{
ASSERT(lua_istable(L, -1));
int ref = luaL_ref(L, LUA_REGISTRYINDEX);
@@ -1678,11 +1678,11 @@ void Eluna::CreateInstanceData(Map const* map)
* Unrefs the instanceId related events and data
* Does all required actions for when an instance is freed.
*/
-void Eluna::FreeInstanceId(uint32 instanceId)
+void ALE::FreeInstanceId(uint32 instanceId)
{
- LOCK_ELUNA;
+ LOCK_ALE;
- if (!ElunaConfig::GetInstance().IsElunaEnabled())
+ if (!ALEConfig::GetInstance().IsALEEnabled())
return;
for (int i = 1; i < Hooks::INSTANCE_EVENT_COUNT; ++i)
@@ -1703,9 +1703,9 @@ void Eluna::FreeInstanceId(uint32 instanceId)
}
}
-void Eluna::PushInstanceData(lua_State* L, ElunaInstanceAI* ai, bool incrementCounter)
+void ALE::PushInstanceData(lua_State* L, ALEInstanceAI* ai, bool incrementCounter)
{
- // Check if the instance data is missing (i.e. someone reloaded Eluna).
+ // Check if the instance data is missing (i.e. someone reloaded ALE).
if (!HasInstanceData(ai->instance))
ai->Reload();
diff --git a/src/LuaEngine/LuaEngine.h b/src/LuaEngine/LuaEngine.h
index d6331bb..46fe62c 100644
--- a/src/LuaEngine/LuaEngine.h
+++ b/src/LuaEngine/LuaEngine.h
@@ -1,5 +1,5 @@
/*
-* Copyright (C) 2010 - 2016 Eluna Lua Engine
+* Copyright (C) 2010 - 2025 Eluna Lua Engine
* This program is free software licensed under GPL version 3
* Please see the included DOCS/LICENSE.md for more information
*/
@@ -19,13 +19,13 @@
#include "World.h"
#include "Hooks.h"
#include "LFG.h"
-#include "ElunaUtility.h"
+#include "ALEUtility.h"
#include "HttpManager.h"
#include "EventEmitter.h"
#include "TicketMgr.h"
#include "LootMgr.h"
-#include "ElunaFileWatcher.h"
-#include "ElunaConfig.h"
+#include "ALEFileWatcher.h"
+#include "ALEConfig.h"
#include
#include