From 81d3f0267903ae762aa021e7e557404544ff0666 Mon Sep 17 00:00:00 2001 From: Foe Date: Thu, 23 Oct 2025 12:53:30 +0200 Subject: [PATCH] chore: rename Eluna to ALE (#318) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Francesco Borzì --- README.md | 32 +- ...{mod_eluna.conf.dist => mod_ale.conf.dist} | 48 +- src/{ElunaLuaEngine_SC.cpp => ALE_SC.cpp} | 502 ++++---- src/{eluna_loader.cpp => ALE_loader.cpp} | 6 +- .../{ElunaCompat.cpp => ALECompat.cpp} | 4 +- src/LuaEngine/{ElunaCompat.h => ALECompat.h} | 6 +- src/LuaEngine/ALEConfig.cpp | 30 + src/LuaEngine/{ElunaConfig.h => ALEConfig.h} | 36 +- .../{ElunaCreatureAI.h => ALECreatureAI.h} | 54 +- ...lunaDBCRegistry.cpp => ALEDBCRegistry.cpp} | 2 +- .../{ElunaDBCRegistry.h => ALEDBCRegistry.h} | 8 +- .../{ElunaEventMgr.cpp => ALEEventMgr.cpp} | 32 +- .../{ElunaEventMgr.h => ALEEventMgr.h} | 30 +- ...lunaFileWatcher.cpp => ALEFileWatcher.cpp} | 52 +- .../{ElunaFileWatcher.h => ALEFileWatcher.h} | 12 +- .../{ElunaIncludes.h => ALEIncludes.h} | 8 +- ...{ElunaInstanceAI.cpp => ALEInstanceAI.cpp} | 106 +- .../{ElunaInstanceAI.h => ALEInstanceAI.h} | 48 +- .../{ElunaTemplate.h => ALETemplate.h} | 78 +- .../{ElunaUtility.cpp => ALEUtility.cpp} | 26 +- .../{ElunaUtility.h => ALEUtility.h} | 16 +- src/LuaEngine/BindingMap.h | 6 +- src/LuaEngine/ElunaConfig.cpp | 30 - src/LuaEngine/HookHelpers.h | 14 +- src/LuaEngine/Hooks.h | 14 +- src/LuaEngine/HttpManager.cpp | 24 +- src/LuaEngine/HttpManager.h | 6 +- src/LuaEngine/LuaEngine.cpp | 350 +++--- src/LuaEngine/LuaEngine.h | 90 +- src/LuaEngine/LuaFunctions.cpp | 280 ++--- src/LuaEngine/docs/Eluna.png | Bin 2570 -> 0 bytes src/LuaEngine/hooks/AllCreatureHooks.cpp | 22 +- src/LuaEngine/hooks/BattleGroundHooks.cpp | 16 +- src/LuaEngine/hooks/CreatureHooks.cpp | 80 +- src/LuaEngine/hooks/GameObjectHooks.cpp | 44 +- src/LuaEngine/hooks/GossipHooks.cpp | 32 +- src/LuaEngine/hooks/GroupHooks.cpp | 20 +- src/LuaEngine/hooks/GuildHooks.cpp | 30 +- src/LuaEngine/hooks/InstanceHooks.cpp | 30 +- src/LuaEngine/hooks/ItemHooks.cpp | 26 +- src/LuaEngine/hooks/PacketHooks.cpp | 26 +- src/LuaEngine/hooks/PlayerHooks.cpp | 148 +-- src/LuaEngine/hooks/ServerHooks.cpp | 78 +- src/LuaEngine/hooks/SpellHooks.cpp | 20 +- src/LuaEngine/hooks/TicketHooks.cpp | 22 +- src/LuaEngine/hooks/VehicleHooks.cpp | 18 +- src/LuaEngine/lmarshal.cpp | 4 +- src/LuaEngine/lmarshal.h | 2 +- ...{ElunaQueryMethods.h => ALEQueryMethods.h} | 112 +- src/LuaEngine/methods/AchievementMethods.h | 8 +- src/LuaEngine/methods/AuraMethods.h | 26 +- src/LuaEngine/methods/BattleGroundMethods.h | 42 +- src/LuaEngine/methods/ChatHandlerMethods.h | 42 +- src/LuaEngine/methods/CorpseMethods.h | 8 +- src/LuaEngine/methods/CreatureMethods.h | 238 ++-- src/LuaEngine/methods/GameObjectMethods.h | 46 +- .../methods/GemPropertiesEntryMethods.h | 6 +- src/LuaEngine/methods/GlobalMethods.h | 724 ++++++------ src/LuaEngine/methods/GroupMethods.h | 90 +- src/LuaEngine/methods/GuildMethods.h | 102 +- src/LuaEngine/methods/ItemMethods.h | 142 +-- src/LuaEngine/methods/ItemTemplateMethods.h | 38 +- src/LuaEngine/methods/LootMethods.h | 110 +- src/LuaEngine/methods/MapMethods.h | 88 +- src/LuaEngine/methods/ObjectMethods.h | 108 +- src/LuaEngine/methods/PetMethods.h | 120 +- src/LuaEngine/methods/PlayerMethods.h | 1012 ++++++++--------- src/LuaEngine/methods/QuestMethods.h | 28 +- src/LuaEngine/methods/RollMethods.h | 32 +- src/LuaEngine/methods/SpellEntryMethods.h | 304 ++--- src/LuaEngine/methods/SpellInfoMethods.h | 180 +-- src/LuaEngine/methods/SpellMethods.h | 38 +- src/LuaEngine/methods/TicketMethods.h | 58 +- src/LuaEngine/methods/UnitMethods.h | 504 ++++---- src/LuaEngine/methods/VehicleMethods.h | 20 +- src/LuaEngine/methods/WorldObjectMethods.h | 364 +++--- src/LuaEngine/methods/WorldPacketMethods.h | 52 +- 77 files changed, 3605 insertions(+), 3605 deletions(-) rename conf/{mod_eluna.conf.dist => mod_ale.conf.dist} (90%) rename src/{ElunaLuaEngine_SC.cpp => ALE_SC.cpp} (64%) rename src/{eluna_loader.cpp => ALE_loader.cpp} (90%) rename src/LuaEngine/{ElunaCompat.cpp => ALECompat.cpp} (96%) rename src/LuaEngine/{ElunaCompat.h => ALECompat.h} (92%) create mode 100644 src/LuaEngine/ALEConfig.cpp rename src/LuaEngine/{ElunaConfig.h => ALEConfig.h} (51%) rename src/LuaEngine/{ElunaCreatureAI.h => ALECreatureAI.h} (77%) rename src/LuaEngine/{ElunaDBCRegistry.cpp => ALEDBCRegistry.cpp} (86%) rename src/LuaEngine/{ElunaDBCRegistry.h => ALEDBCRegistry.h} (87%) rename src/LuaEngine/{ElunaEventMgr.cpp => ALEEventMgr.cpp} (78%) rename src/LuaEngine/{ElunaEventMgr.h => ALEEventMgr.h} (81%) rename src/LuaEngine/{ElunaFileWatcher.cpp => ALEFileWatcher.cpp} (71%) rename src/LuaEngine/{ElunaFileWatcher.h => ALEFileWatcher.h} (80%) rename src/LuaEngine/{ElunaIncludes.h => ALEIncludes.h} (92%) rename src/LuaEngine/{ElunaInstanceAI.cpp => ALEInstanceAI.cpp} (57%) rename src/LuaEngine/{ElunaInstanceAI.h => ALEInstanceAI.h} (65%) rename src/LuaEngine/{ElunaTemplate.h => ALETemplate.h} (80%) rename src/LuaEngine/{ElunaUtility.cpp => ALEUtility.cpp} (84%) rename src/LuaEngine/{ElunaUtility.h => ALEUtility.h} (91%) delete mode 100644 src/LuaEngine/ElunaConfig.cpp delete mode 100644 src/LuaEngine/docs/Eluna.png rename src/LuaEngine/methods/{ElunaQueryMethods.h => ALEQueryMethods.h} (66%) diff --git a/README.md b/README.md index 35ea371..599b3a1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@
-# [![mod-eluna](src/LuaEngine/docs/Eluna.png)](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 #include @@ -34,7 +34,7 @@ extern "C" { -#include "lua.h" +#include }; struct ItemTemplate; @@ -54,7 +54,7 @@ class Guild; class Group; class InstanceScript; typedef InstanceScript InstanceData; -class ElunaInstanceAI; +class ALEInstanceAI; class Item; class Pet; class Player; @@ -70,8 +70,8 @@ class Vehicle; struct lua_State; class EventMgr; -class ElunaObject; -template class ElunaTemplate; +class ALEObject; +template class ALETemplate; template class BindingMap; template struct EventKey; @@ -102,12 +102,12 @@ struct LuaScript LuaScript() {} }; -#define ELUNA_STATE_PTR "Eluna State Ptr" -#define LOCK_ELUNA Eluna::Guard __guard(Eluna::GetLock()) +#define ALE_STATE_PTR "ALE State Ptr" +#define LOCK_ALE ALE::Guard __guard(ALE::GetLock()) -#define ELUNA_GAME_API AC_GAME_API +#define ALE_GAME_API AC_GAME_API -class ELUNA_GAME_API Eluna +class ALE_GAME_API ALE { public: typedef std::list ScriptList; @@ -122,7 +122,7 @@ private: static bool reload; static bool initialized; static LockType lock; - static std::unique_ptr fileWatcher; + static std::unique_ptr fileWatcher; // Lua script locations static ScriptList lua_scripts; @@ -152,12 +152,12 @@ private: // Map from map ID -> Lua table ref std::unordered_map continentDataRefs; - Eluna(); - ~Eluna(); + ALE(); + ~ALE(); // Prevent copy - Eluna(Eluna const&) = delete; - Eluna& operator=(const Eluna&) = delete; + ALE(ALE const&) = delete; + ALE& operator=(const ALE&) = delete; void OpenLua(); void CloseLua(); @@ -165,9 +165,9 @@ private: void CreateBindStores(); void InvalidateObjects(); - // Use ReloadEluna() to make eluna reload - // This is called on world update to reload eluna - static void _ReloadEluna(); + // Use ReloadALE() to make ALE reload + // This is called on world update to reload ALE + static void _ReloadALE(); static void LoadScriptPaths(); static void GetScripts(std::string path); static void AddScriptPath(std::string filename, const std::string& fullpath); @@ -231,7 +231,7 @@ private: void Push(T const* ptr) { Push(L, ptr); ++push_counter; } public: - static Eluna* GEluna; + static ALE* GALE; lua_State* L; EventMgr* eventMgr; @@ -264,17 +264,17 @@ public: static void Initialize(); static void Uninitialize(); - // This function is used to make eluna reload - static void ReloadEluna() { LOCK_ELUNA; reload = true; } + // This function is used to make ALE reload + static void ReloadALE() { LOCK_ALE; reload = true; } static LockType& GetLock() { return lock; }; static bool IsInitialized() { return initialized; } // Never returns nullptr - static Eluna* GetEluna(lua_State* L) + static ALE* GetALE(lua_State* L) { - lua_pushstring(L, ELUNA_STATE_PTR); + lua_pushstring(L, ALE_STATE_PTR); lua_rawget(L, LUA_REGISTRYINDEX); ASSERT(lua_islightuserdata(L, -1)); - Eluna* E = static_cast(lua_touserdata(L, -1)); + ALE* E = static_cast(lua_touserdata(L, -1)); lua_pop(L, 1); ASSERT(E); return E; @@ -305,7 +305,7 @@ public: template static void Push(lua_State* luastate, T const* ptr) { - ElunaTemplate::Push(luastate, ptr); + ALETemplate::Push(luastate, ptr); } static std::string FormatQuery(lua_State* L, const char* query); @@ -313,7 +313,7 @@ public: bool ExecuteCall(int params, int res); /* - * Returns `true` if Eluna has instance data for `map`. + * Returns `true` if ALE has instance data for `map`. */ bool HasInstanceData(Map const* map); @@ -327,14 +327,14 @@ public: * Retrieve the instance data for the `Map` scripted by `ai` and push it * onto the stack. * - * An `ElunaInstanceAI` is needed because the instance data might - * not exist (i.e. Eluna has been reloaded). + * An `ALEInstanceAI` is needed because the instance data might + * not exist (i.e. ALE has been reloaded). * * In that case, the AI is "reloaded" (new instance data table is created * and loaded with the last known save state, and `Load`/`Initialize` * hooks are called). */ - void PushInstanceData(lua_State* L, ElunaInstanceAI* ai, bool incrementCounter = true); + void PushInstanceData(lua_State* L, ALEInstanceAI* ai, bool incrementCounter = true); void RunScripts(); bool ShouldReload() const { return reload; } @@ -350,9 +350,9 @@ public: } template static T* CHECKOBJ(lua_State* luastate, int narg, bool error = true) { - return ElunaTemplate::Check(luastate, narg, error); + return ALETemplate::Check(luastate, narg, error); } - static ElunaObject* CHECKTYPE(lua_State* luastate, int narg, const char *tname, bool error = true); + static ALEObject* CHECKTYPE(lua_State* luastate, int narg, const char *tname, bool error = true); CreatureAI* GetAI(Creature* creature); InstanceData* GetInstanceData(Map* map); @@ -555,13 +555,13 @@ public: void OnRemove(GameObject* gameobject); /* Instance */ - void OnInitialize(ElunaInstanceAI* ai); - void OnLoad(ElunaInstanceAI* ai); - void OnUpdateInstance(ElunaInstanceAI* ai, uint32 diff); - void OnPlayerEnterInstance(ElunaInstanceAI* ai, Player* player); - void OnCreatureCreate(ElunaInstanceAI* ai, Creature* creature); - void OnGameObjectCreate(ElunaInstanceAI* ai, GameObject* gameobject); - bool OnCheckEncounterInProgress(ElunaInstanceAI* ai); + void OnInitialize(ALEInstanceAI* ai); + void OnLoad(ALEInstanceAI* ai); + void OnUpdateInstance(ALEInstanceAI* ai, uint32 diff); + void OnPlayerEnterInstance(ALEInstanceAI* ai, Player* player); + void OnCreatureCreate(ALEInstanceAI* ai, Creature* creature); + void OnGameObjectCreate(ALEInstanceAI* ai, GameObject* gameobject); + bool OnCheckEncounterInProgress(ALEInstanceAI* ai); /* World */ void OnOpenStateChange(bool open); @@ -596,10 +596,10 @@ public: void OnAllCreatureSelectLevel(const CreatureTemplate* cinfo, Creature* creature); void OnAllCreatureBeforeSelectLevel(const CreatureTemplate* cinfo, Creature* creature, uint8& level); }; -template<> Unit* Eluna::CHECKOBJ(lua_State* L, int narg, bool error); -template<> Object* Eluna::CHECKOBJ(lua_State* L, int narg, bool error); -template<> WorldObject* Eluna::CHECKOBJ(lua_State* L, int narg, bool error); -template<> ElunaObject* Eluna::CHECKOBJ(lua_State* L, int narg, bool error); +template<> Unit* ALE::CHECKOBJ(lua_State* L, int narg, bool error); +template<> Object* ALE::CHECKOBJ(lua_State* L, int narg, bool error); +template<> WorldObject* ALE::CHECKOBJ(lua_State* L, int narg, bool error); +template<> ALEObject* ALE::CHECKOBJ(lua_State* L, int narg, bool error); -#define sEluna Eluna::GEluna +#define sALE ALE::GALE #endif diff --git a/src/LuaEngine/LuaFunctions.cpp b/src/LuaEngine/LuaFunctions.cpp index d2e699e..824c910 100644 --- a/src/LuaEngine/LuaFunctions.cpp +++ b/src/LuaEngine/LuaFunctions.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 */ @@ -9,12 +9,12 @@ extern "C" #include "lua.h" }; -// Eluna +// ALE #include "LuaEngine.h" -#include "ElunaEventMgr.h" -#include "ElunaIncludes.h" -#include "ElunaTemplate.h" -#include "ElunaUtility.h" +#include "ALEEventMgr.h" +#include "ALEIncludes.h" +#include "ALETemplate.h" +#include "ALEUtility.h" // Method includes #include "GlobalMethods.h" @@ -26,7 +26,7 @@ extern "C" #include "GroupMethods.h" #include "GuildMethods.h" #include "GameObjectMethods.h" -#include "ElunaQueryMethods.h" +#include "ALEQueryMethods.h" #include "AuraMethods.h" #include "ItemMethods.h" #include "WorldPacketMethods.h" @@ -149,7 +149,7 @@ luaL_Reg GlobalMethods[] = { "IsGameEventActive", &LuaGlobalFunctions::IsGameEventActive }, // Other - { "ReloadEluna", &LuaGlobalFunctions::ReloadEluna }, + { "ReloadALE", &LuaGlobalFunctions::ReloadALE }, { "RunCommand", &LuaGlobalFunctions::RunCommand }, { "SendWorldMessage", &LuaGlobalFunctions::SendWorldMessage }, { "WorldDBQuery", &LuaGlobalFunctions::WorldDBQuery }, @@ -185,7 +185,7 @@ luaL_Reg GlobalMethods[] = { NULL, NULL } }; -ElunaRegister ObjectMethods[] = +ALERegister ObjectMethods[] = { // Getters { "GetEntry", &LuaObject::GetEntry }, @@ -228,7 +228,7 @@ ElunaRegister ObjectMethods[] = { NULL, NULL } }; -ElunaRegister WorldObjectMethods[] = +ALERegister WorldObjectMethods[] = { // Getters { "GetName", &LuaWorldObject::GetName }, @@ -286,7 +286,7 @@ ElunaRegister WorldObjectMethods[] = { NULL, NULL } }; -ElunaRegister UnitMethods[] = +ALERegister UnitMethods[] = { // Getters { "GetLevel", &LuaUnit::GetLevel }, @@ -473,7 +473,7 @@ ElunaRegister UnitMethods[] = { NULL, NULL } }; -ElunaRegister PlayerMethods[] = +ALERegister PlayerMethods[] = { // Getters { "GetSelection", &LuaPlayer::GetSelection }, @@ -833,7 +833,7 @@ ElunaRegister PlayerMethods[] = { NULL, NULL } }; -ElunaRegister CreatureMethods[] = +ALERegister CreatureMethods[] = { // Getters { "GetAITarget", &LuaCreature::GetAITarget }, @@ -937,7 +937,7 @@ ElunaRegister CreatureMethods[] = { NULL, NULL } }; -ElunaRegister GameObjectMethods[] = +ALERegister GameObjectMethods[] = { // Getters { "GetDisplayId", &LuaGameObject::GetDisplayId }, @@ -971,7 +971,7 @@ ElunaRegister GameObjectMethods[] = { NULL, NULL } }; -ElunaRegister ItemMethods[] = +ALERegister ItemMethods[] = { // Getters { "GetOwnerGUID", &LuaItem::GetOwnerGUID }, @@ -1040,7 +1040,7 @@ ElunaRegister ItemMethods[] = { NULL, NULL } }; -ElunaRegister ItemTemplateMethods[] = +ALERegister ItemTemplateMethods[] = { { "GetItemId", &LuaItemTemplate::GetItemId }, { "GetClass", &LuaItemTemplate::GetClass }, @@ -1062,7 +1062,7 @@ ElunaRegister ItemTemplateMethods[] = { NULL, NULL } }; -ElunaRegister AuraMethods[] = +ALERegister AuraMethods[] = { // Getters { "GetCaster", &LuaAura::GetCaster }, @@ -1085,7 +1085,7 @@ ElunaRegister AuraMethods[] = { NULL, NULL } }; -ElunaRegister SpellMethods[] = +ALERegister SpellMethods[] = { // Getters { "GetCaster", &LuaSpell::GetCaster }, @@ -1111,7 +1111,7 @@ ElunaRegister SpellMethods[] = { NULL, NULL } }; -ElunaRegister QuestMethods[] = +ALERegister QuestMethods[] = { // Getters { "GetId", &LuaQuest::GetId }, @@ -1132,7 +1132,7 @@ ElunaRegister QuestMethods[] = { NULL, NULL } }; -ElunaRegister GroupMethods[] = +ALERegister GroupMethods[] = { // Getters { "GetMembers", &LuaGroup::GetMembers }, @@ -1172,7 +1172,7 @@ ElunaRegister GroupMethods[] = { NULL, NULL } }; -ElunaRegister GuildMethods[] = +ALERegister GuildMethods[] = { // Getters { "GetMembers", &LuaGuild::GetMembers }, @@ -1209,7 +1209,7 @@ ElunaRegister GuildMethods[] = { NULL, NULL } }; -ElunaRegister VehicleMethods[] = +ALERegister VehicleMethods[] = { // Getters { "GetOwner", &LuaVehicle::GetOwner }, @@ -1226,7 +1226,7 @@ ElunaRegister VehicleMethods[] = { NULL, NULL } }; -ElunaRegister QueryMethods[] = +ALERegister QueryMethods[] = { // Getters { "GetColumnCount", &LuaQuery::GetColumnCount }, @@ -1252,7 +1252,7 @@ ElunaRegister QueryMethods[] = { NULL, NULL } }; -ElunaRegister PacketMethods[] = +ALERegister PacketMethods[] = { // Getters { "GetOpcode", &LuaPacket::GetOpcode }, @@ -1290,7 +1290,7 @@ ElunaRegister PacketMethods[] = { NULL, NULL } }; -ElunaRegister MapMethods[] = +ALERegister MapMethods[] = { // Getters { "GetName", &LuaMap::GetName }, @@ -1324,7 +1324,7 @@ ElunaRegister MapMethods[] = { NULL, NULL } }; -ElunaRegister CorpseMethods[] = +ALERegister CorpseMethods[] = { // Getters { "GetOwnerGUID", &LuaCorpse::GetOwnerGUID }, @@ -1338,12 +1338,12 @@ ElunaRegister CorpseMethods[] = { NULL, NULL } }; -ElunaRegister AuctionMethods[] = +ALERegister AuctionMethods[] = { { NULL, NULL } }; -ElunaRegister BattleGroundMethods[] = +ALERegister BattleGroundMethods[] = { // Getters { "GetName", &LuaBattleGround::GetName }, @@ -1367,7 +1367,7 @@ ElunaRegister BattleGroundMethods[] = { NULL, NULL } }; -ElunaRegister ChatHandlerMethods[] = +ALERegister ChatHandlerMethods[] = { { "SendSysMessage", &LuaChatHandler::SendSysMessage }, { "IsConsole", &LuaChatHandler::IsConsole }, @@ -1387,7 +1387,7 @@ ElunaRegister ChatHandlerMethods[] = { NULL, NULL } }; -ElunaRegister AchievementMethods[] = +ALERegister AchievementMethods[] = { { "GetId", &LuaAchievement::GetId }, { "GetName", &LuaAchievement::GetName }, @@ -1395,7 +1395,7 @@ ElunaRegister AchievementMethods[] = { NULL, NULL } }; -ElunaRegister RollMethods[] = +ALERegister RollMethods[] = { { "GetItemGUID", &LuaRoll::GetItemGUID }, { "GetItemId", &LuaRoll::GetItemId }, @@ -1414,7 +1414,7 @@ ElunaRegister RollMethods[] = { NULL, NULL } }; -ElunaRegister TicketMethods[] = +ALERegister TicketMethods[] = { { "IsClosed", &LuaTicket::IsClosed }, { "IsCompleted", &LuaTicket::IsCompleted }, @@ -1447,7 +1447,7 @@ ElunaRegister TicketMethods[] = { NULL, NULL } }; -ElunaRegister SpellInfoMethods[] = +ALERegister SpellInfoMethods[] = { // Getters { "GetAttributes", &LuaSpellInfo::GetAttributes }, @@ -1518,7 +1518,7 @@ ElunaRegister SpellInfoMethods[] = { NULL, NULL } }; -ElunaRegister GemPropertiesEntryMethods[] = +ALERegister GemPropertiesEntryMethods[] = { // Getters { "GetId", &LuaGemPropertiesEntry::GetId }, @@ -1527,7 +1527,7 @@ ElunaRegister GemPropertiesEntryMethods[] = { NULL, NULL } }; -ElunaRegister SpellEntryMethods[] = +ALERegister SpellEntryMethods[] = { // Getters { "GetId", &LuaSpellEntry::GetId }, @@ -1687,7 +1687,7 @@ ElunaRegister SpellEntryMethods[] = { NULL, NULL } }; -ElunaRegister PetMethods[] = +ALERegister PetMethods[] = { // Getters { "GetPetType", &LuaPet::GetPetType }, @@ -1746,7 +1746,7 @@ ElunaRegister PetMethods[] = { NULL, NULL } }; -ElunaRegister LootMethods[] = +ALERegister LootMethods[] = { // Get { "GetMoney", &LuaLoot::GetMoney }, @@ -1789,165 +1789,165 @@ ElunaRegister LootMethods[] = }; // fix compile error about accessing vehicle destructor -template<> int ElunaTemplate::CollectGarbage(lua_State* L) +template<> int ALETemplate::CollectGarbage(lua_State* L) { ASSERT(!manageMemory); // Get object pointer (and check type, no error) - ElunaObject* obj = Eluna::CHECKOBJ(L, 1, false); + ALEObject* obj = ALE::CHECKOBJ(L, 1, false); delete obj; return 0; } // Template by Mud from http://stackoverflow.com/questions/4484437/lua-integer-type/4485511#4485511 -template<> int ElunaTemplate::Add(lua_State* L) { Eluna::Push(L, Eluna::CHECKVAL(L, 1) + Eluna::CHECKVAL(L, 2)); return 1; } -template<> int ElunaTemplate::Substract(lua_State* L) { Eluna::Push(L, Eluna::CHECKVAL(L, 1) - Eluna::CHECKVAL(L, 2)); return 1; } -template<> int ElunaTemplate::Multiply(lua_State* L) { Eluna::Push(L, Eluna::CHECKVAL(L, 1) * Eluna::CHECKVAL(L, 2)); return 1; } -template<> int ElunaTemplate::Divide(lua_State* L) { Eluna::Push(L, Eluna::CHECKVAL(L, 1) / Eluna::CHECKVAL(L, 2)); return 1; } -template<> int ElunaTemplate::Mod(lua_State* L) { Eluna::Push(L, Eluna::CHECKVAL(L, 1) % Eluna::CHECKVAL(L, 2)); return 1; } -// template<> int ElunaTemplate::UnaryMinus(lua_State* L) { Eluna::Push(L, -Eluna::CHECKVAL(L, 1)); return 1; } -template<> int ElunaTemplate::Equal(lua_State* L) { Eluna::Push(L, Eluna::CHECKVAL(L, 1) == Eluna::CHECKVAL(L, 2)); return 1; } -template<> int ElunaTemplate::Less(lua_State* L) { Eluna::Push(L, Eluna::CHECKVAL(L, 1) < Eluna::CHECKVAL(L, 2)); return 1; } -template<> int ElunaTemplate::LessOrEqual(lua_State* L) { Eluna::Push(L, Eluna::CHECKVAL(L, 1) <= Eluna::CHECKVAL(L, 2)); return 1; } -template<> int ElunaTemplate::Pow(lua_State* L) +template<> int ALETemplate::Add(lua_State* L) { ALE::Push(L, ALE::CHECKVAL(L, 1) + ALE::CHECKVAL(L, 2)); return 1; } +template<> int ALETemplate::Substract(lua_State* L) { ALE::Push(L, ALE::CHECKVAL(L, 1) - ALE::CHECKVAL(L, 2)); return 1; } +template<> int ALETemplate::Multiply(lua_State* L) { ALE::Push(L, ALE::CHECKVAL(L, 1) * ALE::CHECKVAL(L, 2)); return 1; } +template<> int ALETemplate::Divide(lua_State* L) { ALE::Push(L, ALE::CHECKVAL(L, 1) / ALE::CHECKVAL(L, 2)); return 1; } +template<> int ALETemplate::Mod(lua_State* L) { ALE::Push(L, ALE::CHECKVAL(L, 1) % ALE::CHECKVAL(L, 2)); return 1; } +// template<> int ALETemplate::UnaryMinus(lua_State* L) { ALE::Push(L, -ALE::CHECKVAL(L, 1)); return 1; } +template<> int ALETemplate::Equal(lua_State* L) { ALE::Push(L, ALE::CHECKVAL(L, 1) == ALE::CHECKVAL(L, 2)); return 1; } +template<> int ALETemplate::Less(lua_State* L) { ALE::Push(L, ALE::CHECKVAL(L, 1) < ALE::CHECKVAL(L, 2)); return 1; } +template<> int ALETemplate::LessOrEqual(lua_State* L) { ALE::Push(L, ALE::CHECKVAL(L, 1) <= ALE::CHECKVAL(L, 2)); return 1; } +template<> int ALETemplate::Pow(lua_State* L) { - Eluna::Push(L, static_cast(powl(static_cast(Eluna::CHECKVAL(L, 1)), static_cast(Eluna::CHECKVAL(L, 2))))); + ALE::Push(L, static_cast(powl(static_cast(ALE::CHECKVAL(L, 1)), static_cast(ALE::CHECKVAL(L, 2))))); return 1; } -template<> int ElunaTemplate::ToString(lua_State* L) +template<> int ALETemplate::ToString(lua_State* L) { - unsigned long long l = Eluna::CHECKVAL(L, 1); + unsigned long long l = ALE::CHECKVAL(L, 1); std::ostringstream ss; ss << l; - Eluna::Push(L, ss.str()); + ALE::Push(L, ss.str()); return 1; } -template<> int ElunaTemplate::Add(lua_State* L) { Eluna::Push(L, Eluna::CHECKVAL(L, 1) + Eluna::CHECKVAL(L, 2)); return 1; } -template<> int ElunaTemplate::Substract(lua_State* L) { Eluna::Push(L, Eluna::CHECKVAL(L, 1) - Eluna::CHECKVAL(L, 2)); return 1; } -template<> int ElunaTemplate::Multiply(lua_State* L) { Eluna::Push(L, Eluna::CHECKVAL(L, 1) * Eluna::CHECKVAL(L, 2)); return 1; } -template<> int ElunaTemplate::Divide(lua_State* L) { Eluna::Push(L, Eluna::CHECKVAL(L, 1) / Eluna::CHECKVAL(L, 2)); return 1; } -template<> int ElunaTemplate::Mod(lua_State* L) { Eluna::Push(L, Eluna::CHECKVAL(L, 1) % Eluna::CHECKVAL(L, 2)); return 1; } -template<> int ElunaTemplate::UnaryMinus(lua_State* L) { Eluna::Push(L, -Eluna::CHECKVAL(L, 1)); return 1; } -template<> int ElunaTemplate::Equal(lua_State* L) { Eluna::Push(L, Eluna::CHECKVAL(L, 1) == Eluna::CHECKVAL(L, 2)); return 1; } -template<> int ElunaTemplate::Less(lua_State* L) { Eluna::Push(L, Eluna::CHECKVAL(L, 1) < Eluna::CHECKVAL(L, 2)); return 1; } -template<> int ElunaTemplate::LessOrEqual(lua_State* L) { Eluna::Push(L, Eluna::CHECKVAL(L, 1) <= Eluna::CHECKVAL(L, 2)); return 1; } -template<> int ElunaTemplate::Pow(lua_State* L) +template<> int ALETemplate::Add(lua_State* L) { ALE::Push(L, ALE::CHECKVAL(L, 1) + ALE::CHECKVAL(L, 2)); return 1; } +template<> int ALETemplate::Substract(lua_State* L) { ALE::Push(L, ALE::CHECKVAL(L, 1) - ALE::CHECKVAL(L, 2)); return 1; } +template<> int ALETemplate::Multiply(lua_State* L) { ALE::Push(L, ALE::CHECKVAL(L, 1) * ALE::CHECKVAL(L, 2)); return 1; } +template<> int ALETemplate::Divide(lua_State* L) { ALE::Push(L, ALE::CHECKVAL(L, 1) / ALE::CHECKVAL(L, 2)); return 1; } +template<> int ALETemplate::Mod(lua_State* L) { ALE::Push(L, ALE::CHECKVAL(L, 1) % ALE::CHECKVAL(L, 2)); return 1; } +template<> int ALETemplate::UnaryMinus(lua_State* L) { ALE::Push(L, -ALE::CHECKVAL(L, 1)); return 1; } +template<> int ALETemplate::Equal(lua_State* L) { ALE::Push(L, ALE::CHECKVAL(L, 1) == ALE::CHECKVAL(L, 2)); return 1; } +template<> int ALETemplate::Less(lua_State* L) { ALE::Push(L, ALE::CHECKVAL(L, 1) < ALE::CHECKVAL(L, 2)); return 1; } +template<> int ALETemplate::LessOrEqual(lua_State* L) { ALE::Push(L, ALE::CHECKVAL(L, 1) <= ALE::CHECKVAL(L, 2)); return 1; } +template<> int ALETemplate::Pow(lua_State* L) { - Eluna::Push(L, static_cast(powl(static_cast(Eluna::CHECKVAL(L, 1)), static_cast(Eluna::CHECKVAL(L, 2))))); + ALE::Push(L, static_cast(powl(static_cast(ALE::CHECKVAL(L, 1)), static_cast(ALE::CHECKVAL(L, 2))))); return 1; } -template<> int ElunaTemplate::ToString(lua_State* L) +template<> int ALETemplate::ToString(lua_State* L) { - long long l = Eluna::CHECKVAL(L, 1); + long long l = ALE::CHECKVAL(L, 1); std::ostringstream ss; ss << l; - Eluna::Push(L, ss.str()); + ALE::Push(L, ss.str()); return 1; } -void RegisterFunctions(Eluna* E) +void RegisterFunctions(ALE* E) { - ElunaGlobal::SetMethods(E, GlobalMethods); + ALEGlobal::SetMethods(E, GlobalMethods); - ElunaTemplate::Register(E, "Object"); - ElunaTemplate::SetMethods(E, ObjectMethods); + ALETemplate::Register(E, "Object"); + ALETemplate::SetMethods(E, ObjectMethods); - ElunaTemplate::Register(E, "WorldObject"); - ElunaTemplate::SetMethods(E, ObjectMethods); - ElunaTemplate::SetMethods(E, WorldObjectMethods); + ALETemplate::Register(E, "WorldObject"); + ALETemplate::SetMethods(E, ObjectMethods); + ALETemplate::SetMethods(E, WorldObjectMethods); - ElunaTemplate::Register(E, "Unit"); - ElunaTemplate::SetMethods(E, ObjectMethods); - ElunaTemplate::SetMethods(E, WorldObjectMethods); - ElunaTemplate::SetMethods(E, UnitMethods); + ALETemplate::Register(E, "Unit"); + ALETemplate::SetMethods(E, ObjectMethods); + ALETemplate::SetMethods(E, WorldObjectMethods); + ALETemplate::SetMethods(E, UnitMethods); - ElunaTemplate::Register(E, "Player"); - ElunaTemplate::SetMethods(E, ObjectMethods); - ElunaTemplate::SetMethods(E, WorldObjectMethods); - ElunaTemplate::SetMethods(E, UnitMethods); - ElunaTemplate::SetMethods(E, PlayerMethods); + ALETemplate::Register(E, "Player"); + ALETemplate::SetMethods(E, ObjectMethods); + ALETemplate::SetMethods(E, WorldObjectMethods); + ALETemplate::SetMethods(E, UnitMethods); + ALETemplate::SetMethods(E, PlayerMethods); - ElunaTemplate::Register(E, "Creature"); - ElunaTemplate::SetMethods(E, ObjectMethods); - ElunaTemplate::SetMethods(E, WorldObjectMethods); - ElunaTemplate::SetMethods(E, UnitMethods); - ElunaTemplate::SetMethods(E, CreatureMethods); + ALETemplate::Register(E, "Creature"); + ALETemplate::SetMethods(E, ObjectMethods); + ALETemplate::SetMethods(E, WorldObjectMethods); + ALETemplate::SetMethods(E, UnitMethods); + ALETemplate::SetMethods(E, CreatureMethods); - ElunaTemplate::Register(E, "GameObject"); - ElunaTemplate::SetMethods(E, ObjectMethods); - ElunaTemplate::SetMethods(E, WorldObjectMethods); - ElunaTemplate::SetMethods(E, GameObjectMethods); + ALETemplate::Register(E, "GameObject"); + ALETemplate::SetMethods(E, ObjectMethods); + ALETemplate::SetMethods(E, WorldObjectMethods); + ALETemplate::SetMethods(E, GameObjectMethods); - ElunaTemplate::Register(E, "Corpse"); - ElunaTemplate::SetMethods(E, ObjectMethods); - ElunaTemplate::SetMethods(E, WorldObjectMethods); - ElunaTemplate::SetMethods(E, CorpseMethods); + ALETemplate::Register(E, "Corpse"); + ALETemplate::SetMethods(E, ObjectMethods); + ALETemplate::SetMethods(E, WorldObjectMethods); + ALETemplate::SetMethods(E, CorpseMethods); - ElunaTemplate::Register(E, "Item"); - ElunaTemplate::SetMethods(E, ObjectMethods); - ElunaTemplate::SetMethods(E, ItemMethods); + ALETemplate::Register(E, "Item"); + ALETemplate::SetMethods(E, ObjectMethods); + ALETemplate::SetMethods(E, ItemMethods); - ElunaTemplate::Register(E, "ItemTemplate"); - ElunaTemplate::SetMethods(E, ItemTemplateMethods); + ALETemplate::Register(E, "ItemTemplate"); + ALETemplate::SetMethods(E, ItemTemplateMethods); - ElunaTemplate::Register(E, "Vehicle"); - ElunaTemplate::SetMethods(E, VehicleMethods); + ALETemplate::Register(E, "Vehicle"); + ALETemplate::SetMethods(E, VehicleMethods); - ElunaTemplate::Register(E, "Group"); - ElunaTemplate::SetMethods(E, GroupMethods); + ALETemplate::Register(E, "Group"); + ALETemplate::SetMethods(E, GroupMethods); - ElunaTemplate::Register(E, "Guild"); - ElunaTemplate::SetMethods(E, GuildMethods); + ALETemplate::Register(E, "Guild"); + ALETemplate::SetMethods(E, GuildMethods); - ElunaTemplate::Register(E, "Aura"); - ElunaTemplate::SetMethods(E, AuraMethods); + ALETemplate::Register(E, "Aura"); + ALETemplate::SetMethods(E, AuraMethods); - ElunaTemplate::Register(E, "Spell"); - ElunaTemplate::SetMethods(E, SpellMethods); + ALETemplate::Register(E, "Spell"); + ALETemplate::SetMethods(E, SpellMethods); - ElunaTemplate::Register(E, "Quest"); - ElunaTemplate::SetMethods(E, QuestMethods); + ALETemplate::Register(E, "Quest"); + ALETemplate::SetMethods(E, QuestMethods); - ElunaTemplate::Register(E, "Map"); - ElunaTemplate::SetMethods(E, MapMethods); + ALETemplate::Register(E, "Map"); + ALETemplate::SetMethods(E, MapMethods); - ElunaTemplate::Register(E, "AuctionHouseEntry"); - ElunaTemplate::SetMethods(E, AuctionMethods); + ALETemplate::Register(E, "AuctionHouseEntry"); + ALETemplate::SetMethods(E, AuctionMethods); - ElunaTemplate::Register(E, "BattleGround"); - ElunaTemplate::SetMethods(E, BattleGroundMethods); + ALETemplate::Register(E, "BattleGround"); + ALETemplate::SetMethods(E, BattleGroundMethods); - ElunaTemplate::Register(E, "ChatHandler"); - ElunaTemplate::SetMethods(E, ChatHandlerMethods); + ALETemplate::Register(E, "ChatHandler"); + ALETemplate::SetMethods(E, ChatHandlerMethods); - ElunaTemplate::Register(E, "WorldPacket", true); - ElunaTemplate::SetMethods(E, PacketMethods); + ALETemplate::Register(E, "WorldPacket", true); + ALETemplate::SetMethods(E, PacketMethods); - ElunaTemplate::Register(E, "ElunaQuery", true); - ElunaTemplate::SetMethods(E, QueryMethods); + ALETemplate::Register(E, "ALEQuery", true); + ALETemplate::SetMethods(E, QueryMethods); - ElunaTemplate::Register(E, "AchievementEntry"); - ElunaTemplate::SetMethods(E, AchievementMethods); + ALETemplate::Register(E, "AchievementEntry"); + ALETemplate::SetMethods(E, AchievementMethods); - ElunaTemplate::Register(E, "Roll"); - ElunaTemplate::SetMethods(E, RollMethods); + ALETemplate::Register(E, "Roll"); + ALETemplate::SetMethods(E, RollMethods); - ElunaTemplate::Register(E, "Ticket"); - ElunaTemplate::SetMethods(E, TicketMethods); + ALETemplate::Register(E, "Ticket"); + ALETemplate::SetMethods(E, TicketMethods); - ElunaTemplate::Register(E, "SpellInfo"); - ElunaTemplate::SetMethods(E, SpellInfoMethods); + ALETemplate::Register(E, "SpellInfo"); + ALETemplate::SetMethods(E, SpellInfoMethods); - ElunaTemplate::Register(E, "GemPropertiesEntry"); - ElunaTemplate::SetMethods(E, GemPropertiesEntryMethods); + ALETemplate::Register(E, "GemPropertiesEntry"); + ALETemplate::SetMethods(E, GemPropertiesEntryMethods); - ElunaTemplate::Register(E, "SpellEntry"); - ElunaTemplate::SetMethods(E, SpellEntryMethods); + ALETemplate::Register(E, "SpellEntry"); + ALETemplate::SetMethods(E, SpellEntryMethods); - ElunaTemplate::Register(E, "CreatureTemplate"); + ALETemplate::Register(E, "CreatureTemplate"); - ElunaTemplate::Register(E, "long long", true); + ALETemplate::Register(E, "long long", true); - ElunaTemplate::Register(E, "unsigned long long", true); + ALETemplate::Register(E, "unsigned long long", true); } diff --git a/src/LuaEngine/docs/Eluna.png b/src/LuaEngine/docs/Eluna.png deleted file mode 100644 index b450d336e26ae35f47541220697a61448cbf36d4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2570 zcmV+l3ib7gP)1^@s6O0H^40000PbVXQnQ*UN; zcVTj606}DLVr3vnZDD6+Qe|Oed2z{QJOBU*tVu*cRCwC#olkb!IuyoLPUd9?aaT|> z$hfe8oRVQiF=GZKD>nf1&_Ca_bjel8(Rkdkz_%?-#KpH zBLo{;{`}pmE2+f*0KhOUoB{xVY0j)UlHt+`|LutFYq+(=Z#s$p_QlUlxcv&ZAl%mM z@oJ4r2>^trsMz$wf4_wr|LI8H!3AXzZod@^;d}_$qxZ!py5u1$= znz!xG$E!^ZLE}y+z$FIYZx$XBoUsrcnX{SK5}WM)?u46~AQS`OZxo*4@*(_pBngXr zAq>8z{qj)kNeJ7$GEoBnSS&nr_>2m)t$L2j1mv zMMziId9~x_J#Kx5oDTp;=6I;L$Sv?rSGbE05$f2$fKjf8JGCjA0|3Y1c&JY2XT`tf z?qa?Td75+@!(~^5i6lfOYKs7X-=VIq#VjgSifTSF~!1s^Os_Ud}4Kro(TXW!HpX%-^nFrb=>oBzbLK`3Sh1dA#CX>R-0*CYzMz&S+&Y@$8A8 zE_%2Cut9j@WO0&>vRn)oAjZBh>San24Q+4@oRg%8_R&NDXx{P2ZbY>SU~)h_RJagf zR+1;};zRk7XusdlL;z4v*;OWFH{uUX0~g zPH`7ITn3OkSgIk*6Q7P{;v*A~U7>k@@gyk*CloE^iRLoGlP#38NzthhEdIpW>cC=u zK!%fOcl*TWqw!iF5)LQz>MRtRK=N+ccNwehUN0j&|K^-nn-~a((mlG`3UJJh+e?J| zX__rGB*7RM1(ehR&O$#+ni!l>tX>}vqYI91h&QuVz9aY3tY2>I-8d)#gJ4v0?^ z55qCbcAw8hPA3mpuIEnliYei&3Wdk z0j%VG(%aK+OcomM>pnlkMB?7~I4&i%a%Fq9(vyC5EWY?$v7H({TwO-9D?)fcm5{&3 z@+ZmDUua0(=V_7fMbFh?DDgZmC}!G)Cp{Y7(KJ9)1(C9kD*pXBQ$4#P_`AgC@#>oG z4roro3k_d2_6*l?I}tM`?_RI%*veKeFC<^6&*CM3ZMyKh^4Jp>*r_nQqr>VY!eev+_DXns*X)R>Y$SVAuiam_BIUsp=yava!J0Eext;LsplDNRdp{I~z zEC~osU3|DhFjHtq-RHWO;jZ1iUZrw*o;h*0hFc_*eg$#tBFqAc+oH$fIy1TWsNs&8 znMKkSc_c%^LnknO^2Qcl@_7Yu{9Yj*2B65j)7v9HqgtO&-RC2N->C9^e^%pW9`D4e z!{xn|qo;Xc*KirIa=EAtmH`Hu+GAAf^UAWr82So?AnkVeXs!xw<&^wE)2J~y-)YTdQdJBkvJv51#nwW3|e#uuR35(yHY z3#M|`0Xko9rY)!t9S%<<=M@!R-YgDOLMsv;?rgZj*&XpZ+V&#Z=@gz>@u?hrP0r0_ z`Lp_~WK#11pgJ+>v;Ebsf#k`rGUt)E&!(NvCgFTki0nA0EvV#PxU%-nL!yG|Xw^7z z9@`x*VIrGe{RzVxTM@^B$+ntsqo#SYq+RlmKD}~E6}RI`#4D&00v&KYo1AE%^fak; z=i^Cd>HCVOA64DJySUG-W6sPDfZf!-(bWskfYqyoGvRh3W;xfZl<810=W==^>yuUU z^z4RP-*BH>1{I<8423@w_La;>7!sd*mS5|$&+R-&LRIx{=dkPPm&wbWDL7$#H27B* z=TO=rKEJRo+%i{hK{t_9L5HM|by?Al#>Ghj0sOHJ~J!Dhq~3_cmOy#;h`Hm%Fu5T;$zEFA093{0L}7A z>!(vM5_daY@k+obx$EQ90|4RC3(c;dTr8f4ViWW(0RZ9AEk4nhj%aWxEk%RLwg7 + * 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,42 +8,42 @@ #include "HookHelpers.h" #include "LuaEngine.h" #include "BindingMap.h" -#include "ElunaIncludes.h" -#include "ElunaTemplate.h" +#include "ALEIncludes.h" +#include "ALETemplate.h" using namespace Hooks; #define START_HOOK(EVENT) \ - if (!ElunaConfig::GetInstance().IsElunaEnabled())\ + if (!ALEConfig::GetInstance().IsALEEnabled())\ return;\ auto key = EventKey(EVENT);\ if (!AllCreatureEventBindings->HasBindingsFor(key))\ return;\ - LOCK_ELUNA + LOCK_ALE #define START_HOOK_WITH_RETVAL(EVENT, RETVAL) \ - if (!ElunaConfig::GetInstance().IsElunaEnabled())\ + if (!ALEConfig::GetInstance().IsALEEnabled())\ return RETVAL;\ auto key = EventKey(EVENT);\ if (!AllCreatureEventBindings->HasBindingsFor(key))\ return RETVAL;\ - LOCK_ELUNA + LOCK_ALE -void Eluna::OnAllCreatureAddToWorld(Creature* creature) +void ALE::OnAllCreatureAddToWorld(Creature* creature) { START_HOOK(ALL_CREATURE_EVENT_ON_ADD); Push(creature); CallAllFunctions(AllCreatureEventBindings, key); } -void Eluna::OnAllCreatureRemoveFromWorld(Creature* creature) +void ALE::OnAllCreatureRemoveFromWorld(Creature* creature) { START_HOOK(ALL_CREATURE_EVENT_ON_REMOVE); Push(creature); CallAllFunctions(AllCreatureEventBindings, key); } -void Eluna::OnAllCreatureSelectLevel(const CreatureTemplate* cinfo, Creature* creature) +void ALE::OnAllCreatureSelectLevel(const CreatureTemplate* cinfo, Creature* creature) { START_HOOK(ALL_CREATURE_EVENT_ON_SELECT_LEVEL); Push(cinfo); @@ -51,7 +51,7 @@ void Eluna::OnAllCreatureSelectLevel(const CreatureTemplate* cinfo, Creature* cr CallAllFunctions(AllCreatureEventBindings, key); } -void Eluna::OnAllCreatureBeforeSelectLevel(const CreatureTemplate* cinfo, Creature* creature, uint8& level) +void ALE::OnAllCreatureBeforeSelectLevel(const CreatureTemplate* cinfo, Creature* creature, uint8& level) { START_HOOK(ALL_CREATURE_EVENT_ON_BEFORE_SELECT_LEVEL); Push(cinfo); diff --git a/src/LuaEngine/hooks/BattleGroundHooks.cpp b/src/LuaEngine/hooks/BattleGroundHooks.cpp index da32e22..ec70cf5 100644 --- a/src/LuaEngine/hooks/BattleGroundHooks.cpp +++ b/src/LuaEngine/hooks/BattleGroundHooks.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,19 +8,19 @@ #include "HookHelpers.h" #include "LuaEngine.h" #include "BindingMap.h" -#include "ElunaTemplate.h" +#include "ALETemplate.h" using namespace Hooks; #define START_HOOK(EVENT) \ - if (!ElunaConfig::GetInstance().IsElunaEnabled())\ + if (!ALEConfig::GetInstance().IsALEEnabled())\ return;\ auto key = EventKey(EVENT);\ if (!BGEventBindings->HasBindingsFor(key))\ return;\ - LOCK_ELUNA + LOCK_ALE -void Eluna::OnBGStart(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId) +void ALE::OnBGStart(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId) { START_HOOK(BG_EVENT_ON_START); Push(bg); @@ -29,7 +29,7 @@ void Eluna::OnBGStart(BattleGround* bg, BattleGroundTypeId bgId, uint32 instance CallAllFunctions(BGEventBindings, key); } -void Eluna::OnBGEnd(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId, TeamId winner) +void ALE::OnBGEnd(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId, TeamId winner) { START_HOOK(BG_EVENT_ON_END); Push(bg); @@ -39,7 +39,7 @@ void Eluna::OnBGEnd(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId CallAllFunctions(BGEventBindings, key); } -void Eluna::OnBGCreate(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId) +void ALE::OnBGCreate(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId) { START_HOOK(BG_EVENT_ON_CREATE); Push(bg); @@ -48,7 +48,7 @@ void Eluna::OnBGCreate(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanc CallAllFunctions(BGEventBindings, key); } -void Eluna::OnBGDestroy(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId) +void ALE::OnBGDestroy(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId) { START_HOOK(BG_EVENT_ON_PRE_DESTROY); Push(bg); diff --git a/src/LuaEngine/hooks/CreatureHooks.cpp b/src/LuaEngine/hooks/CreatureHooks.cpp index a478025..5a0248b 100644 --- a/src/LuaEngine/hooks/CreatureHooks.cpp +++ b/src/LuaEngine/hooks/CreatureHooks.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,32 +8,32 @@ #include "HookHelpers.h" #include "LuaEngine.h" #include "BindingMap.h" -#include "ElunaIncludes.h" -#include "ElunaTemplate.h" +#include "ALEIncludes.h" +#include "ALETemplate.h" using namespace Hooks; #define START_HOOK(EVENT, CREATURE) \ - if (!ElunaConfig::GetInstance().IsElunaEnabled())\ + if (!ALEConfig::GetInstance().IsALEEnabled())\ return;\ auto entry_key = EntryKey(EVENT, CREATURE->GetEntry());\ auto unique_key = UniqueObjectKey(EVENT, CREATURE->GET_GUID(), CREATURE->GetInstanceId());\ if (!CreatureEventBindings->HasBindingsFor(entry_key))\ if (!CreatureUniqueBindings->HasBindingsFor(unique_key))\ return;\ - LOCK_ELUNA + LOCK_ALE #define START_HOOK_WITH_RETVAL(EVENT, CREATURE, RETVAL) \ - if (!ElunaConfig::GetInstance().IsElunaEnabled())\ + if (!ALEConfig::GetInstance().IsALEEnabled())\ return RETVAL;\ auto entry_key = EntryKey(EVENT, CREATURE->GetEntry());\ auto unique_key = UniqueObjectKey(EVENT, CREATURE->GET_GUID(), CREATURE->GetInstanceId());\ if (!CreatureEventBindings->HasBindingsFor(entry_key))\ if (!CreatureUniqueBindings->HasBindingsFor(unique_key))\ return RETVAL;\ - LOCK_ELUNA + LOCK_ALE -void Eluna::OnDummyEffect(WorldObject* pCaster, uint32 spellId, SpellEffIndex effIndex, Creature* pTarget) +void ALE::OnDummyEffect(WorldObject* pCaster, uint32 spellId, SpellEffIndex effIndex, Creature* pTarget) { START_HOOK(CREATURE_EVENT_ON_DUMMY_EFFECT, pTarget); Push(pCaster); @@ -43,7 +43,7 @@ void Eluna::OnDummyEffect(WorldObject* pCaster, uint32 spellId, SpellEffIndex ef CallAllFunctions(CreatureEventBindings, CreatureUniqueBindings, entry_key, unique_key); } -bool Eluna::OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* pQuest) +bool ALE::OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* pQuest) { START_HOOK_WITH_RETVAL(CREATURE_EVENT_ON_QUEST_ACCEPT, pCreature, false); Push(pPlayer); @@ -52,7 +52,7 @@ bool Eluna::OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* pQu return CallAllFunctionsBool(CreatureEventBindings, CreatureUniqueBindings, entry_key, unique_key); } -bool Eluna::OnQuestReward(Player* pPlayer, Creature* pCreature, Quest const* pQuest, uint32 opt) +bool ALE::OnQuestReward(Player* pPlayer, Creature* pCreature, Quest const* pQuest, uint32 opt) { START_HOOK_WITH_RETVAL(CREATURE_EVENT_ON_QUEST_REWARD, pCreature, false); Push(pPlayer); @@ -62,7 +62,7 @@ bool Eluna::OnQuestReward(Player* pPlayer, Creature* pCreature, Quest const* pQu return CallAllFunctionsBool(CreatureEventBindings, CreatureUniqueBindings, entry_key, unique_key); } -void Eluna::GetDialogStatus(const Player* pPlayer, const Creature* pCreature) +void ALE::GetDialogStatus(const Player* pPlayer, const Creature* pCreature) { START_HOOK(CREATURE_EVENT_ON_DIALOG_STATUS, pCreature); Push(pPlayer); @@ -70,21 +70,21 @@ void Eluna::GetDialogStatus(const Player* pPlayer, const Creature* pCreature) CallAllFunctions(CreatureEventBindings, CreatureUniqueBindings, entry_key, unique_key); } -void Eluna::OnAddToWorld(Creature* pCreature) +void ALE::OnAddToWorld(Creature* pCreature) { START_HOOK(CREATURE_EVENT_ON_ADD, pCreature); Push(pCreature); CallAllFunctions(CreatureEventBindings, CreatureUniqueBindings, entry_key, unique_key); } -void Eluna::OnRemoveFromWorld(Creature* pCreature) +void ALE::OnRemoveFromWorld(Creature* pCreature) { START_HOOK(CREATURE_EVENT_ON_REMOVE, pCreature); Push(pCreature); CallAllFunctions(CreatureEventBindings, CreatureUniqueBindings, entry_key, unique_key); } -bool Eluna::OnSummoned(Creature* pCreature, Unit* pSummoner) +bool ALE::OnSummoned(Creature* pCreature, Unit* pSummoner) { START_HOOK_WITH_RETVAL(CREATURE_EVENT_ON_SUMMONED, pCreature, false); Push(pCreature); @@ -92,7 +92,7 @@ bool Eluna::OnSummoned(Creature* pCreature, Unit* pSummoner) return CallAllFunctionsBool(CreatureEventBindings, CreatureUniqueBindings, entry_key, unique_key); } -bool Eluna::UpdateAI(Creature* me, const uint32 diff) +bool ALE::UpdateAI(Creature* me, const uint32 diff) { START_HOOK_WITH_RETVAL(CREATURE_EVENT_ON_AIUPDATE, me, false); Push(me); @@ -102,7 +102,7 @@ bool Eluna::UpdateAI(Creature* me, const uint32 diff) //Called for reaction at enter to combat if not in combat yet (enemy can be NULL) //Called at creature aggro either by MoveInLOS or Attack Start -bool Eluna::EnterCombat(Creature* me, Unit* target) +bool ALE::EnterCombat(Creature* me, Unit* target) { START_HOOK_WITH_RETVAL(CREATURE_EVENT_ON_ENTER_COMBAT, me, false); Push(me); @@ -111,7 +111,7 @@ bool Eluna::EnterCombat(Creature* me, Unit* target) } // Called at any Damage from any attacker (before damage apply) -bool Eluna::DamageTaken(Creature* me, Unit* attacker, uint32& damage) +bool ALE::DamageTaken(Creature* me, Unit* attacker, uint32& damage) { START_HOOK_WITH_RETVAL(CREATURE_EVENT_ON_DAMAGE_TAKEN, me, false); bool result = false; @@ -130,7 +130,7 @@ bool Eluna::DamageTaken(Creature* me, Unit* attacker, uint32& damage) if (lua_isnumber(L, r + 1)) { - damage = Eluna::CHECKVAL(L, r + 1); + damage = ALE::CHECKVAL(L, r + 1); // Update the stack for subsequent calls. ReplaceArgument(damage, damageIndex); } @@ -143,7 +143,7 @@ bool Eluna::DamageTaken(Creature* me, Unit* attacker, uint32& damage) } //Called at creature death -bool Eluna::JustDied(Creature* me, Unit* killer) +bool ALE::JustDied(Creature* me, Unit* killer) { On_Reset(me); START_HOOK_WITH_RETVAL(CREATURE_EVENT_ON_DIED, me, false); @@ -153,7 +153,7 @@ bool Eluna::JustDied(Creature* me, Unit* killer) } //Called at creature killing another unit -bool Eluna::KilledUnit(Creature* me, Unit* victim) +bool ALE::KilledUnit(Creature* me, Unit* victim) { START_HOOK_WITH_RETVAL(CREATURE_EVENT_ON_TARGET_DIED, me, false); Push(me); @@ -162,7 +162,7 @@ bool Eluna::KilledUnit(Creature* me, Unit* victim) } // Called when the creature summon successfully other creature -bool Eluna::JustSummoned(Creature* me, Creature* summon) +bool ALE::JustSummoned(Creature* me, Creature* summon) { START_HOOK_WITH_RETVAL(CREATURE_EVENT_ON_JUST_SUMMONED_CREATURE, me, false); Push(me); @@ -171,7 +171,7 @@ bool Eluna::JustSummoned(Creature* me, Creature* summon) } // Called when a summoned creature is despawned -bool Eluna::SummonedCreatureDespawn(Creature* me, Creature* summon) +bool ALE::SummonedCreatureDespawn(Creature* me, Creature* summon) { START_HOOK_WITH_RETVAL(CREATURE_EVENT_ON_SUMMONED_CREATURE_DESPAWN, me, false); Push(me); @@ -180,7 +180,7 @@ bool Eluna::SummonedCreatureDespawn(Creature* me, Creature* summon) } //Called at waypoint reached or PointMovement end -bool Eluna::MovementInform(Creature* me, uint32 type, uint32 id) +bool ALE::MovementInform(Creature* me, uint32 type, uint32 id) { START_HOOK_WITH_RETVAL(CREATURE_EVENT_ON_REACH_WP, me, false); Push(me); @@ -190,7 +190,7 @@ bool Eluna::MovementInform(Creature* me, uint32 type, uint32 id) } // Called before EnterCombat even before the creature is in combat. -bool Eluna::AttackStart(Creature* me, Unit* target) +bool ALE::AttackStart(Creature* me, Unit* target) { START_HOOK_WITH_RETVAL(CREATURE_EVENT_ON_PRE_COMBAT, me, false); Push(me); @@ -199,7 +199,7 @@ bool Eluna::AttackStart(Creature* me, Unit* target) } // Called for reaction at stopping attack at no attackers or targets -bool Eluna::EnterEvadeMode(Creature* me) +bool ALE::EnterEvadeMode(Creature* me) { On_Reset(me); START_HOOK_WITH_RETVAL(CREATURE_EVENT_ON_LEAVE_COMBAT, me, false); @@ -208,7 +208,7 @@ bool Eluna::EnterEvadeMode(Creature* me) } // Called when creature is spawned or respawned (for reseting variables) -bool Eluna::JustRespawned(Creature* me) +bool ALE::JustRespawned(Creature* me) { On_Reset(me); START_HOOK_WITH_RETVAL(CREATURE_EVENT_ON_SPAWN, me, false); @@ -217,7 +217,7 @@ bool Eluna::JustRespawned(Creature* me) } // Called at reaching home after evade -bool Eluna::JustReachedHome(Creature* me) +bool ALE::JustReachedHome(Creature* me) { START_HOOK_WITH_RETVAL(CREATURE_EVENT_ON_REACH_HOME, me, false); Push(me); @@ -225,7 +225,7 @@ bool Eluna::JustReachedHome(Creature* me) } // Called at text emote receive from player -bool Eluna::ReceiveEmote(Creature* me, Player* player, uint32 emoteId) +bool ALE::ReceiveEmote(Creature* me, Player* player, uint32 emoteId) { START_HOOK_WITH_RETVAL(CREATURE_EVENT_ON_RECEIVE_EMOTE, me, false); Push(me); @@ -235,7 +235,7 @@ bool Eluna::ReceiveEmote(Creature* me, Player* player, uint32 emoteId) } // called when the corpse of this creature gets removed -bool Eluna::CorpseRemoved(Creature* me, uint32& respawnDelay) +bool ALE::CorpseRemoved(Creature* me, uint32& respawnDelay) { START_HOOK_WITH_RETVAL(CREATURE_EVENT_ON_CORPSE_REMOVED, me, false); bool result = false; @@ -253,7 +253,7 @@ bool Eluna::CorpseRemoved(Creature* me, uint32& respawnDelay) if (lua_isnumber(L, r + 1)) { - respawnDelay = Eluna::CHECKVAL(L, r + 1); + respawnDelay = ALE::CHECKVAL(L, r + 1); // Update the stack for subsequent calls. ReplaceArgument(respawnDelay, respawnDelayIndex); } @@ -265,7 +265,7 @@ bool Eluna::CorpseRemoved(Creature* me, uint32& respawnDelay) return result; } -bool Eluna::MoveInLineOfSight(Creature* me, Unit* who) +bool ALE::MoveInLineOfSight(Creature* me, Unit* who) { START_HOOK_WITH_RETVAL(CREATURE_EVENT_ON_MOVE_IN_LOS, me, false); Push(me); @@ -274,7 +274,7 @@ bool Eluna::MoveInLineOfSight(Creature* me, Unit* who) } // Called on creature initial spawn, respawn, death, evade (leave combat) -void Eluna::On_Reset(Creature* me) // Not an override, custom +void ALE::On_Reset(Creature* me) // Not an override, custom { START_HOOK(CREATURE_EVENT_ON_RESET, me); Push(me); @@ -282,7 +282,7 @@ void Eluna::On_Reset(Creature* me) // Not an override, custom } // Called when hit by a spell -bool Eluna::SpellHit(Creature* me, WorldObject* caster, SpellInfo const* spell) +bool ALE::SpellHit(Creature* me, WorldObject* caster, SpellInfo const* spell) { START_HOOK_WITH_RETVAL(CREATURE_EVENT_ON_HIT_BY_SPELL, me, false); Push(me); @@ -292,7 +292,7 @@ bool Eluna::SpellHit(Creature* me, WorldObject* caster, SpellInfo const* spell) } // Called when spell hits a target -bool Eluna::SpellHitTarget(Creature* me, WorldObject* target, SpellInfo const* spell) +bool ALE::SpellHitTarget(Creature* me, WorldObject* target, SpellInfo const* spell) { START_HOOK_WITH_RETVAL(CREATURE_EVENT_ON_SPELL_HIT_TARGET, me, false); Push(me); @@ -301,7 +301,7 @@ bool Eluna::SpellHitTarget(Creature* me, WorldObject* target, SpellInfo const* s return CallAllFunctionsBool(CreatureEventBindings, CreatureUniqueBindings, entry_key, unique_key); } -bool Eluna::SummonedCreatureDies(Creature* me, Creature* summon, Unit* killer) +bool ALE::SummonedCreatureDies(Creature* me, Creature* summon, Unit* killer) { START_HOOK_WITH_RETVAL(CREATURE_EVENT_ON_SUMMONED_CREATURE_DIED, me, false); Push(me); @@ -311,7 +311,7 @@ bool Eluna::SummonedCreatureDies(Creature* me, Creature* summon, Unit* killer) } // Called when owner takes damage -bool Eluna::OwnerAttackedBy(Creature* me, Unit* attacker) +bool ALE::OwnerAttackedBy(Creature* me, Unit* attacker) { START_HOOK_WITH_RETVAL(CREATURE_EVENT_ON_OWNER_ATTACKED_AT, me, false); Push(me); @@ -320,7 +320,7 @@ bool Eluna::OwnerAttackedBy(Creature* me, Unit* attacker) } // Called when owner attacks something -bool Eluna::OwnerAttacked(Creature* me, Unit* target) +bool ALE::OwnerAttacked(Creature* me, Unit* target) { START_HOOK_WITH_RETVAL(CREATURE_EVENT_ON_OWNER_ATTACKED, me, false); Push(me); @@ -328,7 +328,7 @@ bool Eluna::OwnerAttacked(Creature* me, Unit* target) return CallAllFunctionsBool(CreatureEventBindings, CreatureUniqueBindings, entry_key, unique_key); } -void Eluna::OnCreatureAuraApply(Creature* me, Aura* aura) +void ALE::OnCreatureAuraApply(Creature* me, Aura* aura) { START_HOOK(CREATURE_EVENT_ON_AURA_APPLY, me); Push(me); @@ -336,7 +336,7 @@ void Eluna::OnCreatureAuraApply(Creature* me, Aura* aura) CallAllFunctions(CreatureEventBindings, CreatureUniqueBindings, entry_key, unique_key); } -void Eluna::OnCreatureHeal(Creature* me, Unit* target, uint32& gain) +void ALE::OnCreatureHeal(Creature* me, Unit* target, uint32& gain) { START_HOOK(CREATURE_EVENT_ON_HEAL, me); Push(me); @@ -361,7 +361,7 @@ void Eluna::OnCreatureHeal(Creature* me, Unit* target, uint32& gain) CleanUpStack(3); } -void Eluna::OnCreatureDamage(Creature* me, Unit* target, uint32& damage) +void ALE::OnCreatureDamage(Creature* me, Unit* target, uint32& damage) { START_HOOK(CREATURE_EVENT_ON_DAMAGE, me); Push(me); diff --git a/src/LuaEngine/hooks/GameObjectHooks.cpp b/src/LuaEngine/hooks/GameObjectHooks.cpp index 3eff02e..7dd8508 100644 --- a/src/LuaEngine/hooks/GameObjectHooks.cpp +++ b/src/LuaEngine/hooks/GameObjectHooks.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,29 +8,29 @@ #include "HookHelpers.h" #include "LuaEngine.h" #include "BindingMap.h" -#include "ElunaIncludes.h" -#include "ElunaEventMgr.h" -#include "ElunaTemplate.h" +#include "ALEIncludes.h" +#include "ALEEventMgr.h" +#include "ALETemplate.h" using namespace Hooks; #define START_HOOK(EVENT, ENTRY) \ - if (!ElunaConfig::GetInstance().IsElunaEnabled())\ + if (!ALEConfig::GetInstance().IsALEEnabled())\ return;\ auto key = EntryKey(EVENT, ENTRY);\ if (!GameObjectEventBindings->HasBindingsFor(key))\ return;\ - LOCK_ELUNA + LOCK_ALE #define START_HOOK_WITH_RETVAL(EVENT, ENTRY, RETVAL) \ - if (!ElunaConfig::GetInstance().IsElunaEnabled())\ + if (!ALEConfig::GetInstance().IsALEEnabled())\ return RETVAL;\ auto key = EntryKey(EVENT, ENTRY);\ if (!GameObjectEventBindings->HasBindingsFor(key))\ return RETVAL;\ - LOCK_ELUNA + LOCK_ALE -void Eluna::OnDummyEffect(WorldObject* pCaster, uint32 spellId, SpellEffIndex effIndex, GameObject* pTarget) +void ALE::OnDummyEffect(WorldObject* pCaster, uint32 spellId, SpellEffIndex effIndex, GameObject* pTarget) { START_HOOK(GAMEOBJECT_EVENT_ON_DUMMY_EFFECT, pTarget->GetEntry()); Push(pCaster); @@ -40,16 +40,16 @@ void Eluna::OnDummyEffect(WorldObject* pCaster, uint32 spellId, SpellEffIndex ef CallAllFunctions(GameObjectEventBindings, key); } -void Eluna::UpdateAI(GameObject* pGameObject, uint32 diff) +void ALE::UpdateAI(GameObject* pGameObject, uint32 diff) { - pGameObject->elunaEvents->Update(diff); + pGameObject->ALEEvents->Update(diff); START_HOOK(GAMEOBJECT_EVENT_ON_AIUPDATE, pGameObject->GetEntry()); Push(pGameObject); Push(diff); CallAllFunctions(GameObjectEventBindings, key); } -bool Eluna::OnQuestAccept(Player* pPlayer, GameObject* pGameObject, Quest const* pQuest) +bool ALE::OnQuestAccept(Player* pPlayer, GameObject* pGameObject, Quest const* pQuest) { START_HOOK_WITH_RETVAL(GAMEOBJECT_EVENT_ON_QUEST_ACCEPT, pGameObject->GetEntry(), false); Push(pPlayer); @@ -58,7 +58,7 @@ bool Eluna::OnQuestAccept(Player* pPlayer, GameObject* pGameObject, Quest const* return CallAllFunctionsBool(GameObjectEventBindings, key); } -bool Eluna::OnQuestReward(Player* pPlayer, GameObject* pGameObject, Quest const* pQuest, uint32 opt) +bool ALE::OnQuestReward(Player* pPlayer, GameObject* pGameObject, Quest const* pQuest, uint32 opt) { START_HOOK_WITH_RETVAL(GAMEOBJECT_EVENT_ON_QUEST_REWARD, pGameObject->GetEntry(), false); Push(pPlayer); @@ -68,7 +68,7 @@ bool Eluna::OnQuestReward(Player* pPlayer, GameObject* pGameObject, Quest const* return CallAllFunctionsBool(GameObjectEventBindings, key); } -void Eluna::GetDialogStatus(const Player* pPlayer, const GameObject* pGameObject) +void ALE::GetDialogStatus(const Player* pPlayer, const GameObject* pGameObject) { START_HOOK(GAMEOBJECT_EVENT_ON_DIALOG_STATUS, pGameObject->GetEntry()); Push(pPlayer); @@ -76,7 +76,7 @@ void Eluna::GetDialogStatus(const Player* pPlayer, const GameObject* pGameObject CallAllFunctions(GameObjectEventBindings, key); } -void Eluna::OnDestroyed(GameObject* pGameObject, WorldObject* attacker) +void ALE::OnDestroyed(GameObject* pGameObject, WorldObject* attacker) { START_HOOK(GAMEOBJECT_EVENT_ON_DESTROYED, pGameObject->GetEntry()); Push(pGameObject); @@ -84,7 +84,7 @@ void Eluna::OnDestroyed(GameObject* pGameObject, WorldObject* attacker) CallAllFunctions(GameObjectEventBindings, key); } -void Eluna::OnDamaged(GameObject* pGameObject, WorldObject* attacker) +void ALE::OnDamaged(GameObject* pGameObject, WorldObject* attacker) { START_HOOK(GAMEOBJECT_EVENT_ON_DAMAGED, pGameObject->GetEntry()); Push(pGameObject); @@ -92,7 +92,7 @@ void Eluna::OnDamaged(GameObject* pGameObject, WorldObject* attacker) CallAllFunctions(GameObjectEventBindings, key); } -void Eluna::OnLootStateChanged(GameObject* pGameObject, uint32 state) +void ALE::OnLootStateChanged(GameObject* pGameObject, uint32 state) { START_HOOK(GAMEOBJECT_EVENT_ON_LOOT_STATE_CHANGE, pGameObject->GetEntry()); Push(pGameObject); @@ -100,7 +100,7 @@ void Eluna::OnLootStateChanged(GameObject* pGameObject, uint32 state) CallAllFunctions(GameObjectEventBindings, key); } -void Eluna::OnGameObjectStateChanged(GameObject* pGameObject, uint32 state) +void ALE::OnGameObjectStateChanged(GameObject* pGameObject, uint32 state) { START_HOOK(GAMEOBJECT_EVENT_ON_GO_STATE_CHANGED, pGameObject->GetEntry()); Push(pGameObject); @@ -108,28 +108,28 @@ void Eluna::OnGameObjectStateChanged(GameObject* pGameObject, uint32 state) CallAllFunctions(GameObjectEventBindings, key); } -void Eluna::OnSpawn(GameObject* pGameObject) +void ALE::OnSpawn(GameObject* pGameObject) { START_HOOK(GAMEOBJECT_EVENT_ON_SPAWN, pGameObject->GetEntry()); Push(pGameObject); CallAllFunctions(GameObjectEventBindings, key); } -void Eluna::OnAddToWorld(GameObject* pGameObject) +void ALE::OnAddToWorld(GameObject* pGameObject) { START_HOOK(GAMEOBJECT_EVENT_ON_ADD, pGameObject->GetEntry()); Push(pGameObject); CallAllFunctions(GameObjectEventBindings, key); } -void Eluna::OnRemoveFromWorld(GameObject* pGameObject) +void ALE::OnRemoveFromWorld(GameObject* pGameObject) { START_HOOK(GAMEOBJECT_EVENT_ON_REMOVE, pGameObject->GetEntry()); Push(pGameObject); CallAllFunctions(GameObjectEventBindings, key); } -bool Eluna::OnGameObjectUse(Player* pPlayer, GameObject* pGameObject) +bool ALE::OnGameObjectUse(Player* pPlayer, GameObject* pGameObject) { START_HOOK_WITH_RETVAL(GAMEOBJECT_EVENT_ON_USE, pGameObject->GetEntry(), false); Push(pGameObject); diff --git a/src/LuaEngine/hooks/GossipHooks.cpp b/src/LuaEngine/hooks/GossipHooks.cpp index 5eaf4d1..5fa3245 100644 --- a/src/LuaEngine/hooks/GossipHooks.cpp +++ b/src/LuaEngine/hooks/GossipHooks.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,28 +8,28 @@ #include "HookHelpers.h" #include "LuaEngine.h" #include "BindingMap.h" -#include "ElunaIncludes.h" -#include "ElunaTemplate.h" +#include "ALEIncludes.h" +#include "ALETemplate.h" using namespace Hooks; #define START_HOOK(BINDINGS, EVENT, ENTRY) \ - if (!ElunaConfig::GetInstance().IsElunaEnabled())\ + if (!ALEConfig::GetInstance().IsALEEnabled())\ return;\ auto key = EntryKey(EVENT, ENTRY);\ if (!BINDINGS->HasBindingsFor(key))\ return;\ - LOCK_ELUNA + LOCK_ALE #define START_HOOK_WITH_RETVAL(BINDINGS, EVENT, ENTRY, RETVAL) \ - if (!ElunaConfig::GetInstance().IsElunaEnabled())\ + if (!ALEConfig::GetInstance().IsALEEnabled())\ return RETVAL;\ auto key = EntryKey(EVENT, ENTRY);\ if (!BINDINGS->HasBindingsFor(key))\ return RETVAL;\ - LOCK_ELUNA + LOCK_ALE -bool Eluna::OnGossipHello(Player* pPlayer, GameObject* pGameObject) +bool ALE::OnGossipHello(Player* pPlayer, GameObject* pGameObject) { START_HOOK_WITH_RETVAL(GameObjectGossipBindings, GOSSIP_EVENT_ON_HELLO, pGameObject->GetEntry(), false); pPlayer->PlayerTalkClass->ClearMenus(); @@ -38,7 +38,7 @@ bool Eluna::OnGossipHello(Player* pPlayer, GameObject* pGameObject) return CallAllFunctionsBool(GameObjectGossipBindings, key, true); } -bool Eluna::OnGossipSelect(Player* pPlayer, GameObject* pGameObject, uint32 sender, uint32 action) +bool ALE::OnGossipSelect(Player* pPlayer, GameObject* pGameObject, uint32 sender, uint32 action) { START_HOOK_WITH_RETVAL(GameObjectGossipBindings, GOSSIP_EVENT_ON_SELECT, pGameObject->GetEntry(), false); pPlayer->PlayerTalkClass->ClearMenus(); @@ -49,7 +49,7 @@ bool Eluna::OnGossipSelect(Player* pPlayer, GameObject* pGameObject, uint32 send return CallAllFunctionsBool(GameObjectGossipBindings, key, true); } -bool Eluna::OnGossipSelectCode(Player* pPlayer, GameObject* pGameObject, uint32 sender, uint32 action, const char* code) +bool ALE::OnGossipSelectCode(Player* pPlayer, GameObject* pGameObject, uint32 sender, uint32 action, const char* code) { START_HOOK_WITH_RETVAL(GameObjectGossipBindings, GOSSIP_EVENT_ON_SELECT, pGameObject->GetEntry(), false); pPlayer->PlayerTalkClass->ClearMenus(); @@ -61,7 +61,7 @@ bool Eluna::OnGossipSelectCode(Player* pPlayer, GameObject* pGameObject, uint32 return CallAllFunctionsBool(GameObjectGossipBindings, key, true); } -void Eluna::HandleGossipSelectOption(Player* pPlayer, uint32 menuId, uint32 sender, uint32 action, const std::string& code) +void ALE::HandleGossipSelectOption(Player* pPlayer, uint32 menuId, uint32 sender, uint32 action, const std::string& code) { START_HOOK(PlayerGossipBindings, GOSSIP_EVENT_ON_SELECT, menuId); pPlayer->PlayerTalkClass->ClearMenus(); @@ -78,7 +78,7 @@ void Eluna::HandleGossipSelectOption(Player* pPlayer, uint32 menuId, uint32 send CallAllFunctions(PlayerGossipBindings, key); } -bool Eluna::OnItemGossip(Player* pPlayer, Item* pItem, SpellCastTargets const& /*targets*/) +bool ALE::OnItemGossip(Player* pPlayer, Item* pItem, SpellCastTargets const& /*targets*/) { START_HOOK_WITH_RETVAL(ItemGossipBindings, GOSSIP_EVENT_ON_HELLO, pItem->GetEntry(), true); pPlayer->PlayerTalkClass->ClearMenus(); @@ -87,7 +87,7 @@ bool Eluna::OnItemGossip(Player* pPlayer, Item* pItem, SpellCastTargets const& / return CallAllFunctionsBool(ItemGossipBindings, key, true); } -void Eluna::HandleGossipSelectOption(Player* pPlayer, Item* pItem, uint32 sender, uint32 action, const std::string& code) +void ALE::HandleGossipSelectOption(Player* pPlayer, Item* pItem, uint32 sender, uint32 action, const std::string& code) { START_HOOK(ItemGossipBindings, GOSSIP_EVENT_ON_SELECT, pItem->GetEntry()); pPlayer->PlayerTalkClass->ClearMenus(); @@ -104,7 +104,7 @@ void Eluna::HandleGossipSelectOption(Player* pPlayer, Item* pItem, uint32 sender CallAllFunctions(ItemGossipBindings, key); } -bool Eluna::OnGossipHello(Player* pPlayer, Creature* pCreature) +bool ALE::OnGossipHello(Player* pPlayer, Creature* pCreature) { START_HOOK_WITH_RETVAL(CreatureGossipBindings, GOSSIP_EVENT_ON_HELLO, pCreature->GetEntry(), false); pPlayer->PlayerTalkClass->ClearMenus(); @@ -113,7 +113,7 @@ bool Eluna::OnGossipHello(Player* pPlayer, Creature* pCreature) return CallAllFunctionsBool(CreatureGossipBindings, key, true); } -bool Eluna::OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 sender, uint32 action) +bool ALE::OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 sender, uint32 action) { START_HOOK_WITH_RETVAL(CreatureGossipBindings, GOSSIP_EVENT_ON_SELECT, pCreature->GetEntry(), false); auto originalMenu = *pPlayer->PlayerTalkClass; @@ -129,7 +129,7 @@ bool Eluna::OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 sender, return preventDefault; } -bool Eluna::OnGossipSelectCode(Player* pPlayer, Creature* pCreature, uint32 sender, uint32 action, const char* code) +bool ALE::OnGossipSelectCode(Player* pPlayer, Creature* pCreature, uint32 sender, uint32 action, const char* code) { START_HOOK_WITH_RETVAL(CreatureGossipBindings, GOSSIP_EVENT_ON_SELECT, pCreature->GetEntry(), false); auto originalMenu = *pPlayer->PlayerTalkClass; diff --git a/src/LuaEngine/hooks/GroupHooks.cpp b/src/LuaEngine/hooks/GroupHooks.cpp index d21a974..aac809d 100644 --- a/src/LuaEngine/hooks/GroupHooks.cpp +++ b/src/LuaEngine/hooks/GroupHooks.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,19 +8,19 @@ #include "HookHelpers.h" #include "LuaEngine.h" #include "BindingMap.h" -#include "ElunaTemplate.h" +#include "ALETemplate.h" using namespace Hooks; #define START_HOOK(EVENT) \ - if (!ElunaConfig::GetInstance().IsElunaEnabled())\ + if (!ALEConfig::GetInstance().IsALEEnabled())\ return;\ auto key = EventKey(EVENT);\ if (!GroupEventBindings->HasBindingsFor(key))\ return;\ - LOCK_ELUNA + LOCK_ALE -void Eluna::OnAddMember(Group* group, ObjectGuid guid) +void ALE::OnAddMember(Group* group, ObjectGuid guid) { START_HOOK(GROUP_EVENT_ON_MEMBER_ADD); Push(group); @@ -28,7 +28,7 @@ void Eluna::OnAddMember(Group* group, ObjectGuid guid) CallAllFunctions(GroupEventBindings, key); } -void Eluna::OnInviteMember(Group* group, ObjectGuid guid) +void ALE::OnInviteMember(Group* group, ObjectGuid guid) { START_HOOK(GROUP_EVENT_ON_MEMBER_INVITE); Push(group); @@ -36,7 +36,7 @@ void Eluna::OnInviteMember(Group* group, ObjectGuid guid) CallAllFunctions(GroupEventBindings, key); } -void Eluna::OnRemoveMember(Group* group, ObjectGuid guid, uint8 method) +void ALE::OnRemoveMember(Group* group, ObjectGuid guid, uint8 method) { START_HOOK(GROUP_EVENT_ON_MEMBER_REMOVE); Push(group); @@ -45,7 +45,7 @@ void Eluna::OnRemoveMember(Group* group, ObjectGuid guid, uint8 method) CallAllFunctions(GroupEventBindings, key); } -void Eluna::OnChangeLeader(Group* group, ObjectGuid newLeaderGuid, ObjectGuid oldLeaderGuid) +void ALE::OnChangeLeader(Group* group, ObjectGuid newLeaderGuid, ObjectGuid oldLeaderGuid) { START_HOOK(GROUP_EVENT_ON_LEADER_CHANGE); Push(group); @@ -54,14 +54,14 @@ void Eluna::OnChangeLeader(Group* group, ObjectGuid newLeaderGuid, ObjectGuid ol CallAllFunctions(GroupEventBindings, key); } -void Eluna::OnDisband(Group* group) +void ALE::OnDisband(Group* group) { START_HOOK(GROUP_EVENT_ON_DISBAND); Push(group); CallAllFunctions(GroupEventBindings, key); } -void Eluna::OnCreate(Group* group, ObjectGuid leaderGuid, GroupType groupType) +void ALE::OnCreate(Group* group, ObjectGuid leaderGuid, GroupType groupType) { START_HOOK(GROUP_EVENT_ON_CREATE); Push(group); diff --git a/src/LuaEngine/hooks/GuildHooks.cpp b/src/LuaEngine/hooks/GuildHooks.cpp index ccfc37c..8b3adf9 100644 --- a/src/LuaEngine/hooks/GuildHooks.cpp +++ b/src/LuaEngine/hooks/GuildHooks.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,19 +8,19 @@ #include "HookHelpers.h" #include "LuaEngine.h" #include "BindingMap.h" -#include "ElunaTemplate.h" +#include "ALETemplate.h" using namespace Hooks; #define START_HOOK(EVENT) \ - if (!ElunaConfig::GetInstance().IsElunaEnabled())\ + if (!ALEConfig::GetInstance().IsALEEnabled())\ return;\ auto key = EventKey(EVENT);\ if (!GuildEventBindings->HasBindingsFor(key))\ return;\ - LOCK_ELUNA + LOCK_ALE -void Eluna::OnAddMember(Guild* guild, Player* player, uint32 plRank) +void ALE::OnAddMember(Guild* guild, Player* player, uint32 plRank) { START_HOOK(GUILD_EVENT_ON_ADD_MEMBER); Push(guild); @@ -29,7 +29,7 @@ void Eluna::OnAddMember(Guild* guild, Player* player, uint32 plRank) CallAllFunctions(GuildEventBindings, key); } -void Eluna::OnRemoveMember(Guild* guild, Player* player, bool isDisbanding) +void ALE::OnRemoveMember(Guild* guild, Player* player, bool isDisbanding) { START_HOOK(GUILD_EVENT_ON_REMOVE_MEMBER); Push(guild); @@ -38,7 +38,7 @@ void Eluna::OnRemoveMember(Guild* guild, Player* player, bool isDisbanding) CallAllFunctions(GuildEventBindings, key); } -void Eluna::OnMOTDChanged(Guild* guild, const std::string& newMotd) +void ALE::OnMOTDChanged(Guild* guild, const std::string& newMotd) { START_HOOK(GUILD_EVENT_ON_MOTD_CHANGE); Push(guild); @@ -46,7 +46,7 @@ void Eluna::OnMOTDChanged(Guild* guild, const std::string& newMotd) CallAllFunctions(GuildEventBindings, key); } -void Eluna::OnInfoChanged(Guild* guild, const std::string& newInfo) +void ALE::OnInfoChanged(Guild* guild, const std::string& newInfo) { START_HOOK(GUILD_EVENT_ON_INFO_CHANGE); Push(guild); @@ -54,7 +54,7 @@ void Eluna::OnInfoChanged(Guild* guild, const std::string& newInfo) CallAllFunctions(GuildEventBindings, key); } -void Eluna::OnCreate(Guild* guild, Player* leader, const std::string& name) +void ALE::OnCreate(Guild* guild, Player* leader, const std::string& name) { START_HOOK(GUILD_EVENT_ON_CREATE); Push(guild); @@ -63,14 +63,14 @@ void Eluna::OnCreate(Guild* guild, Player* leader, const std::string& name) CallAllFunctions(GuildEventBindings, key); } -void Eluna::OnDisband(Guild* guild) +void ALE::OnDisband(Guild* guild) { START_HOOK(GUILD_EVENT_ON_DISBAND); Push(guild); CallAllFunctions(GuildEventBindings, key); } -void Eluna::OnMemberWitdrawMoney(Guild* guild, Player* player, uint32& amount, bool isRepair) +void ALE::OnMemberWitdrawMoney(Guild* guild, Player* player, uint32& amount, bool isRepair) { START_HOOK(GUILD_EVENT_ON_MONEY_WITHDRAW); Push(guild); @@ -97,7 +97,7 @@ void Eluna::OnMemberWitdrawMoney(Guild* guild, Player* player, uint32& amount, b CleanUpStack(4); } -void Eluna::OnMemberDepositMoney(Guild* guild, Player* player, uint32& amount) +void ALE::OnMemberDepositMoney(Guild* guild, Player* player, uint32& amount) { START_HOOK(GUILD_EVENT_ON_MONEY_DEPOSIT); Push(guild); @@ -123,7 +123,7 @@ void Eluna::OnMemberDepositMoney(Guild* guild, Player* player, uint32& amount) CleanUpStack(3); } -void Eluna::OnItemMove(Guild* guild, Player* player, Item* pItem, bool isSrcBank, uint8 srcContainer, uint8 srcSlotId, +void ALE::OnItemMove(Guild* guild, Player* player, Item* pItem, bool isSrcBank, uint8 srcContainer, uint8 srcSlotId, bool isDestBank, uint8 destContainer, uint8 destSlotId) { START_HOOK(GUILD_EVENT_ON_ITEM_MOVE); @@ -139,7 +139,7 @@ void Eluna::OnItemMove(Guild* guild, Player* player, Item* pItem, bool isSrcBank CallAllFunctions(GuildEventBindings, key); } -void Eluna::OnEvent(Guild* guild, uint8 eventType, uint32 playerGuid1, uint32 playerGuid2, uint8 newRank) +void ALE::OnEvent(Guild* guild, uint8 eventType, uint32 playerGuid1, uint32 playerGuid2, uint8 newRank) { START_HOOK(GUILD_EVENT_ON_EVENT); Push(guild); @@ -150,7 +150,7 @@ void Eluna::OnEvent(Guild* guild, uint8 eventType, uint32 playerGuid1, uint32 pl CallAllFunctions(GuildEventBindings, key); } -void Eluna::OnBankEvent(Guild* guild, uint8 eventType, uint8 tabId, uint32 playerGuid, uint32 itemOrMoney, uint16 itemStackCount, uint8 destTabId) +void ALE::OnBankEvent(Guild* guild, uint8 eventType, uint8 tabId, uint32 playerGuid, uint32 itemOrMoney, uint16 itemStackCount, uint8 destTabId) { START_HOOK(GUILD_EVENT_ON_BANK_EVENT); Push(guild); diff --git a/src/LuaEngine/hooks/InstanceHooks.cpp b/src/LuaEngine/hooks/InstanceHooks.cpp index 7da9126..113ca2b 100644 --- a/src/LuaEngine/hooks/InstanceHooks.cpp +++ b/src/LuaEngine/hooks/InstanceHooks.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,75 +8,75 @@ #include "HookHelpers.h" #include "LuaEngine.h" #include "BindingMap.h" -#include "ElunaIncludes.h" -#include "ElunaTemplate.h" -#include "ElunaInstanceAI.h" +#include "ALEIncludes.h" +#include "ALETemplate.h" +#include "ALEInstanceAI.h" using namespace Hooks; #define START_HOOK(EVENT, AI) \ - if (!ElunaConfig::GetInstance().IsElunaEnabled())\ + if (!ALEConfig::GetInstance().IsALEEnabled())\ return;\ auto mapKey = EntryKey(EVENT, AI->instance->GetId());\ auto instanceKey = EntryKey(EVENT, AI->instance->GetInstanceId());\ if (!MapEventBindings->HasBindingsFor(mapKey) && !InstanceEventBindings->HasBindingsFor(instanceKey))\ return;\ - LOCK_ELUNA;\ + LOCK_ALE;\ PushInstanceData(L, AI);\ Push(AI->instance) #define START_HOOK_WITH_RETVAL(EVENT, AI, RETVAL) \ - if (!ElunaConfig::GetInstance().IsElunaEnabled())\ + if (!ALEConfig::GetInstance().IsALEEnabled())\ return RETVAL;\ auto mapKey = EntryKey(EVENT, AI->instance->GetId());\ auto instanceKey = EntryKey(EVENT, AI->instance->GetInstanceId());\ if (!MapEventBindings->HasBindingsFor(mapKey) && !InstanceEventBindings->HasBindingsFor(instanceKey))\ return RETVAL;\ - LOCK_ELUNA;\ + LOCK_ALE;\ PushInstanceData(L, AI);\ Push(AI->instance) -void Eluna::OnInitialize(ElunaInstanceAI* ai) +void ALE::OnInitialize(ALEInstanceAI* ai) { START_HOOK(INSTANCE_EVENT_ON_INITIALIZE, ai); CallAllFunctions(MapEventBindings, InstanceEventBindings, mapKey, instanceKey); } -void Eluna::OnLoad(ElunaInstanceAI* ai) +void ALE::OnLoad(ALEInstanceAI* ai) { START_HOOK(INSTANCE_EVENT_ON_LOAD, ai); CallAllFunctions(MapEventBindings, InstanceEventBindings, mapKey, instanceKey); } -void Eluna::OnUpdateInstance(ElunaInstanceAI* ai, uint32 diff) +void ALE::OnUpdateInstance(ALEInstanceAI* ai, uint32 diff) { START_HOOK(INSTANCE_EVENT_ON_UPDATE, ai); Push(diff); CallAllFunctions(MapEventBindings, InstanceEventBindings, mapKey, instanceKey); } -void Eluna::OnPlayerEnterInstance(ElunaInstanceAI* ai, Player* player) +void ALE::OnPlayerEnterInstance(ALEInstanceAI* ai, Player* player) { START_HOOK(INSTANCE_EVENT_ON_PLAYER_ENTER, ai); Push(player); CallAllFunctions(MapEventBindings, InstanceEventBindings, mapKey, instanceKey); } -void Eluna::OnCreatureCreate(ElunaInstanceAI* ai, Creature* creature) +void ALE::OnCreatureCreate(ALEInstanceAI* ai, Creature* creature) { START_HOOK(INSTANCE_EVENT_ON_CREATURE_CREATE, ai); Push(creature); CallAllFunctions(MapEventBindings, InstanceEventBindings, mapKey, instanceKey); } -void Eluna::OnGameObjectCreate(ElunaInstanceAI* ai, GameObject* gameobject) +void ALE::OnGameObjectCreate(ALEInstanceAI* ai, GameObject* gameobject) { START_HOOK(INSTANCE_EVENT_ON_GAMEOBJECT_CREATE, ai); Push(gameobject); CallAllFunctions(MapEventBindings, InstanceEventBindings, mapKey, instanceKey); } -bool Eluna::OnCheckEncounterInProgress(ElunaInstanceAI* ai) +bool ALE::OnCheckEncounterInProgress(ALEInstanceAI* ai) { START_HOOK_WITH_RETVAL(INSTANCE_EVENT_ON_CHECK_ENCOUNTER_IN_PROGRESS, ai, false); return CallAllFunctionsBool(MapEventBindings, InstanceEventBindings, mapKey, instanceKey); diff --git a/src/LuaEngine/hooks/ItemHooks.cpp b/src/LuaEngine/hooks/ItemHooks.cpp index cc617ba..9bc3474 100644 --- a/src/LuaEngine/hooks/ItemHooks.cpp +++ b/src/LuaEngine/hooks/ItemHooks.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,28 +8,28 @@ #include "HookHelpers.h" #include "LuaEngine.h" #include "BindingMap.h" -#include "ElunaIncludes.h" -#include "ElunaTemplate.h" +#include "ALEIncludes.h" +#include "ALETemplate.h" using namespace Hooks; #define START_HOOK(EVENT, ENTRY) \ - if (!ElunaConfig::GetInstance().IsElunaEnabled())\ + if (!ALEConfig::GetInstance().IsALEEnabled())\ return;\ auto key = EntryKey(EVENT, ENTRY);\ if (!ItemEventBindings->HasBindingsFor(key))\ return;\ - LOCK_ELUNA + LOCK_ALE #define START_HOOK_WITH_RETVAL(EVENT, ENTRY, RETVAL) \ - if (!ElunaConfig::GetInstance().IsElunaEnabled())\ + if (!ALEConfig::GetInstance().IsALEEnabled())\ return RETVAL;\ auto key = EntryKey(EVENT, ENTRY);\ if (!ItemEventBindings->HasBindingsFor(key))\ return RETVAL;\ - LOCK_ELUNA + LOCK_ALE -void Eluna::OnDummyEffect(WorldObject* pCaster, uint32 spellId, SpellEffIndex effIndex, Item* pTarget) +void ALE::OnDummyEffect(WorldObject* pCaster, uint32 spellId, SpellEffIndex effIndex, Item* pTarget) { START_HOOK(ITEM_EVENT_ON_DUMMY_EFFECT, pTarget->GetEntry()); Push(pCaster); @@ -39,7 +39,7 @@ void Eluna::OnDummyEffect(WorldObject* pCaster, uint32 spellId, SpellEffIndex ef CallAllFunctions(ItemEventBindings, key); } -bool Eluna::OnQuestAccept(Player* pPlayer, Item* pItem, Quest const* pQuest) +bool ALE::OnQuestAccept(Player* pPlayer, Item* pItem, Quest const* pQuest) { START_HOOK_WITH_RETVAL(ITEM_EVENT_ON_QUEST_ACCEPT, pItem->GetEntry(), false); Push(pPlayer); @@ -48,7 +48,7 @@ bool Eluna::OnQuestAccept(Player* pPlayer, Item* pItem, Quest const* pQuest) return CallAllFunctionsBool(ItemEventBindings, key); } -bool Eluna::OnUse(Player* pPlayer, Item* pItem, SpellCastTargets const& targets) +bool ALE::OnUse(Player* pPlayer, Item* pItem, SpellCastTargets const& targets) { ObjectGuid guid = pItem->GET_GUID(); bool castSpell = true; @@ -78,7 +78,7 @@ bool Eluna::OnUse(Player* pPlayer, Item* pItem, SpellCastTargets const& targets) return false; } -bool Eluna::OnItemUse(Player* pPlayer, Item* pItem, SpellCastTargets const& targets) +bool ALE::OnItemUse(Player* pPlayer, Item* pItem, SpellCastTargets const& targets) { START_HOOK_WITH_RETVAL(ITEM_EVENT_ON_USE, pItem->GetEntry(), true); Push(pPlayer); @@ -100,7 +100,7 @@ bool Eluna::OnItemUse(Player* pPlayer, Item* pItem, SpellCastTargets const& targ return CallAllFunctionsBool(ItemEventBindings, key, true); } -bool Eluna::OnExpire(Player* pPlayer, ItemTemplate const* pProto) +bool ALE::OnExpire(Player* pPlayer, ItemTemplate const* pProto) { START_HOOK_WITH_RETVAL(ITEM_EVENT_ON_EXPIRE, pProto->ItemId, false); Push(pPlayer); @@ -108,7 +108,7 @@ bool Eluna::OnExpire(Player* pPlayer, ItemTemplate const* pProto) return CallAllFunctionsBool(ItemEventBindings, key); } -bool Eluna::OnRemove(Player* pPlayer, Item* pItem) +bool ALE::OnRemove(Player* pPlayer, Item* pItem) { START_HOOK_WITH_RETVAL(ITEM_EVENT_ON_REMOVE, pItem->GetEntry(), false); Push(pPlayer); diff --git a/src/LuaEngine/hooks/PacketHooks.cpp b/src/LuaEngine/hooks/PacketHooks.cpp index 84c95e6..db9ca34 100644 --- a/src/LuaEngine/hooks/PacketHooks.cpp +++ b/src/LuaEngine/hooks/PacketHooks.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,28 +8,28 @@ #include "HookHelpers.h" #include "LuaEngine.h" #include "BindingMap.h" -#include "ElunaIncludes.h" -#include "ElunaTemplate.h" +#include "ALEIncludes.h" +#include "ALETemplate.h" using namespace Hooks; #define START_HOOK_SERVER(EVENT) \ - if (!ElunaConfig::GetInstance().IsElunaEnabled())\ + if (!ALEConfig::GetInstance().IsALEEnabled())\ return;\ auto key = EventKey(EVENT);\ if (!ServerEventBindings->HasBindingsFor(key))\ return;\ - LOCK_ELUNA + LOCK_ALE #define START_HOOK_PACKET(EVENT, OPCODE) \ - if (!ElunaConfig::GetInstance().IsElunaEnabled())\ + if (!ALEConfig::GetInstance().IsALEEnabled())\ return;\ auto key = EntryKey(EVENT, OPCODE);\ if (!PacketEventBindings->HasBindingsFor(key))\ return;\ - LOCK_ELUNA + LOCK_ALE -bool Eluna::OnPacketSend(WorldSession* session, const WorldPacket& packet) +bool ALE::OnPacketSend(WorldSession* session, const WorldPacket& packet) { bool result = true; Player* player = NULL; @@ -39,7 +39,7 @@ bool Eluna::OnPacketSend(WorldSession* session, const WorldPacket& packet) OnPacketSendOne(player, packet, result); return result; } -void Eluna::OnPacketSendAny(Player* player, const WorldPacket& packet, bool& result) +void ALE::OnPacketSendAny(Player* player, const WorldPacket& packet, bool& result) { START_HOOK_SERVER(SERVER_EVENT_ON_PACKET_SEND); Push(new WorldPacket(packet)); @@ -59,7 +59,7 @@ void Eluna::OnPacketSendAny(Player* player, const WorldPacket& packet, bool& res CleanUpStack(2); } -void Eluna::OnPacketSendOne(Player* player, const WorldPacket& packet, bool& result) +void ALE::OnPacketSendOne(Player* player, const WorldPacket& packet, bool& result) { START_HOOK_PACKET(PACKET_EVENT_ON_PACKET_SEND, packet.GetOpcode()); Push(new WorldPacket(packet)); @@ -79,7 +79,7 @@ void Eluna::OnPacketSendOne(Player* player, const WorldPacket& packet, bool& res CleanUpStack(2); } -bool Eluna::OnPacketReceive(WorldSession* session, WorldPacket& packet) +bool ALE::OnPacketReceive(WorldSession* session, WorldPacket& packet) { bool result = true; Player* player = NULL; @@ -90,7 +90,7 @@ bool Eluna::OnPacketReceive(WorldSession* session, WorldPacket& packet) return result; } -void Eluna::OnPacketReceiveAny(Player* player, WorldPacket& packet, bool& result) +void ALE::OnPacketReceiveAny(Player* player, WorldPacket& packet, bool& result) { START_HOOK_SERVER(SERVER_EVENT_ON_PACKET_RECEIVE); Push(new WorldPacket(packet)); @@ -114,7 +114,7 @@ void Eluna::OnPacketReceiveAny(Player* player, WorldPacket& packet, bool& result CleanUpStack(2); } -void Eluna::OnPacketReceiveOne(Player* player, WorldPacket& packet, bool& result) +void ALE::OnPacketReceiveOne(Player* player, WorldPacket& packet, bool& result) { START_HOOK_PACKET(PACKET_EVENT_ON_PACKET_RECEIVE, packet.GetOpcode()); Push(new WorldPacket(packet)); diff --git a/src/LuaEngine/hooks/PlayerHooks.cpp b/src/LuaEngine/hooks/PlayerHooks.cpp index 198c75f..dfb29dd 100644 --- a/src/LuaEngine/hooks/PlayerHooks.cpp +++ b/src/LuaEngine/hooks/PlayerHooks.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,28 +8,28 @@ #include "HookHelpers.h" #include "LuaEngine.h" #include "BindingMap.h" -#include "ElunaIncludes.h" -#include "ElunaTemplate.h" +#include "ALEIncludes.h" +#include "ALETemplate.h" using namespace Hooks; #define START_HOOK(EVENT) \ - if (!ElunaConfig::GetInstance().IsElunaEnabled())\ + if (!ALEConfig::GetInstance().IsALEEnabled())\ return;\ auto key = EventKey(EVENT);\ if (!PlayerEventBindings->HasBindingsFor(key))\ return;\ - LOCK_ELUNA + LOCK_ALE #define START_HOOK_WITH_RETVAL(EVENT, RETVAL) \ - if (!ElunaConfig::GetInstance().IsElunaEnabled())\ + if (!ALEConfig::GetInstance().IsALEEnabled())\ return RETVAL;\ auto key = EventKey(EVENT);\ if (!PlayerEventBindings->HasBindingsFor(key))\ return RETVAL;\ - LOCK_ELUNA + LOCK_ALE -void Eluna::OnLearnTalents(Player* pPlayer, uint32 talentId, uint32 talentRank, uint32 spellid) +void ALE::OnLearnTalents(Player* pPlayer, uint32 talentId, uint32 talentRank, uint32 spellid) { START_HOOK(PLAYER_EVENT_ON_LEARN_TALENTS); Push(pPlayer); @@ -39,7 +39,7 @@ void Eluna::OnLearnTalents(Player* pPlayer, uint32 talentId, uint32 talentRank, CallAllFunctions(PlayerEventBindings, key); } -bool Eluna::OnCommand(ChatHandler& handler, const char* text) +bool ALE::OnCommand(ChatHandler& handler, const char* text) { Player* player = handler.IsConsole() ? nullptr : handler.GetSession()->GetPlayer(); // If from console, player is NULL @@ -47,9 +47,9 @@ bool Eluna::OnCommand(ChatHandler& handler, const char* text) { std::string reload = text; std::transform(reload.begin(), reload.end(), reload.begin(), ::tolower); - if (reload.find("reload eluna") == 0) + if (reload.find("reload ALE") == 0) { - ReloadEluna(); + ReloadALE(); return false; } } @@ -61,7 +61,7 @@ bool Eluna::OnCommand(ChatHandler& handler, const char* text) return CallAllFunctionsBool(PlayerEventBindings, key, true); } -void Eluna::OnLootItem(Player* pPlayer, Item* pItem, uint32 count, ObjectGuid guid) +void ALE::OnLootItem(Player* pPlayer, Item* pItem, uint32 count, ObjectGuid guid) { START_HOOK(PLAYER_EVENT_ON_LOOT_ITEM); Push(pPlayer); @@ -71,7 +71,7 @@ void Eluna::OnLootItem(Player* pPlayer, Item* pItem, uint32 count, ObjectGuid gu CallAllFunctions(PlayerEventBindings, key); } -void Eluna::OnLootMoney(Player* pPlayer, uint32 amount) +void ALE::OnLootMoney(Player* pPlayer, uint32 amount) { START_HOOK(PLAYER_EVENT_ON_LOOT_MONEY); Push(pPlayer); @@ -79,28 +79,28 @@ void Eluna::OnLootMoney(Player* pPlayer, uint32 amount) CallAllFunctions(PlayerEventBindings, key); } -void Eluna::OnFirstLogin(Player* pPlayer) +void ALE::OnFirstLogin(Player* pPlayer) { START_HOOK(PLAYER_EVENT_ON_FIRST_LOGIN); Push(pPlayer); CallAllFunctions(PlayerEventBindings, key); } -void Eluna::OnRepop(Player* pPlayer) +void ALE::OnRepop(Player* pPlayer) { START_HOOK(PLAYER_EVENT_ON_REPOP); Push(pPlayer); CallAllFunctions(PlayerEventBindings, key); } -void Eluna::OnResurrect(Player* pPlayer) +void ALE::OnResurrect(Player* pPlayer) { START_HOOK(PLAYER_EVENT_ON_RESURRECT); Push(pPlayer); CallAllFunctions(PlayerEventBindings, key); } -void Eluna::OnQuestAbandon(Player* pPlayer, uint32 questId) +void ALE::OnQuestAbandon(Player* pPlayer, uint32 questId) { START_HOOK(PLAYER_EVENT_ON_QUEST_ABANDON); Push(pPlayer); @@ -108,7 +108,7 @@ void Eluna::OnQuestAbandon(Player* pPlayer, uint32 questId) CallAllFunctions(PlayerEventBindings, key); } -void Eluna::OnEquip(Player* pPlayer, Item* pItem, uint8 bag, uint8 slot) +void ALE::OnEquip(Player* pPlayer, Item* pItem, uint8 bag, uint8 slot) { START_HOOK(PLAYER_EVENT_ON_EQUIP); Push(pPlayer); @@ -118,7 +118,7 @@ void Eluna::OnEquip(Player* pPlayer, Item* pItem, uint8 bag, uint8 slot) CallAllFunctions(PlayerEventBindings, key); } -InventoryResult Eluna::OnCanUseItem(const Player* pPlayer, uint32 itemEntry) +InventoryResult ALE::OnCanUseItem(const Player* pPlayer, uint32 itemEntry) { START_HOOK_WITH_RETVAL(PLAYER_EVENT_ON_CAN_USE_ITEM, EQUIP_ERR_OK); InventoryResult result = EQUIP_ERR_OK; @@ -139,7 +139,7 @@ InventoryResult Eluna::OnCanUseItem(const Player* pPlayer, uint32 itemEntry) CleanUpStack(2); return result; } -void Eluna::OnPlayerEnterCombat(Player* pPlayer, Unit* pEnemy) +void ALE::OnPlayerEnterCombat(Player* pPlayer, Unit* pEnemy) { START_HOOK(PLAYER_EVENT_ON_ENTER_COMBAT); Push(pPlayer); @@ -147,14 +147,14 @@ void Eluna::OnPlayerEnterCombat(Player* pPlayer, Unit* pEnemy) CallAllFunctions(PlayerEventBindings, key); } -void Eluna::OnPlayerLeaveCombat(Player* pPlayer) +void ALE::OnPlayerLeaveCombat(Player* pPlayer) { START_HOOK(PLAYER_EVENT_ON_LEAVE_COMBAT); Push(pPlayer); CallAllFunctions(PlayerEventBindings, key); } -void Eluna::OnPVPKill(Player* pKiller, Player* pKilled) +void ALE::OnPVPKill(Player* pKiller, Player* pKilled) { START_HOOK(PLAYER_EVENT_ON_KILL_PLAYER); Push(pKiller); @@ -162,7 +162,7 @@ void Eluna::OnPVPKill(Player* pKiller, Player* pKilled) CallAllFunctions(PlayerEventBindings, key); } -void Eluna::OnCreatureKill(Player* pKiller, Creature* pKilled) +void ALE::OnCreatureKill(Player* pKiller, Creature* pKilled) { START_HOOK(PLAYER_EVENT_ON_KILL_CREATURE); Push(pKiller); @@ -170,7 +170,7 @@ void Eluna::OnCreatureKill(Player* pKiller, Creature* pKilled) CallAllFunctions(PlayerEventBindings, key); } -void Eluna::OnPlayerKilledByCreature(Creature* pKiller, Player* pKilled) +void ALE::OnPlayerKilledByCreature(Creature* pKiller, Player* pKilled) { START_HOOK(PLAYER_EVENT_ON_KILLED_BY_CREATURE); Push(pKiller); @@ -178,7 +178,7 @@ void Eluna::OnPlayerKilledByCreature(Creature* pKiller, Player* pKilled) CallAllFunctions(PlayerEventBindings, key); } -void Eluna::OnLevelChanged(Player* pPlayer, uint8 oldLevel) +void ALE::OnLevelChanged(Player* pPlayer, uint8 oldLevel) { START_HOOK(PLAYER_EVENT_ON_LEVEL_CHANGE); Push(pPlayer); @@ -186,7 +186,7 @@ void Eluna::OnLevelChanged(Player* pPlayer, uint8 oldLevel) CallAllFunctions(PlayerEventBindings, key); } -void Eluna::OnFreeTalentPointsChanged(Player* pPlayer, uint32 newPoints) +void ALE::OnFreeTalentPointsChanged(Player* pPlayer, uint32 newPoints) { START_HOOK(PLAYER_EVENT_ON_TALENTS_CHANGE); Push(pPlayer); @@ -194,7 +194,7 @@ void Eluna::OnFreeTalentPointsChanged(Player* pPlayer, uint32 newPoints) CallAllFunctions(PlayerEventBindings, key); } -void Eluna::OnTalentsReset(Player* pPlayer, bool noCost) +void ALE::OnTalentsReset(Player* pPlayer, bool noCost) { START_HOOK(PLAYER_EVENT_ON_TALENTS_RESET); Push(pPlayer); @@ -202,7 +202,7 @@ void Eluna::OnTalentsReset(Player* pPlayer, bool noCost) CallAllFunctions(PlayerEventBindings, key); } -void Eluna::OnMoneyChanged(Player* pPlayer, int32& amount) +void ALE::OnMoneyChanged(Player* pPlayer, int32& amount) { START_HOOK(PLAYER_EVENT_ON_MONEY_CHANGE); Push(pPlayer); @@ -227,7 +227,7 @@ void Eluna::OnMoneyChanged(Player* pPlayer, int32& amount) CleanUpStack(2); } -void Eluna::OnGiveXP(Player* pPlayer, uint32& amount, Unit* pVictim, uint8 xpSource) +void ALE::OnGiveXP(Player* pPlayer, uint32& amount, Unit* pVictim, uint8 xpSource) { START_HOOK(PLAYER_EVENT_ON_GIVE_XP); Push(pPlayer); @@ -254,7 +254,7 @@ void Eluna::OnGiveXP(Player* pPlayer, uint32& amount, Unit* pVictim, uint8 xpSou CleanUpStack(4); } -bool Eluna::OnReputationChange(Player* pPlayer, uint32 factionID, int32& standing, bool incremental) +bool ALE::OnReputationChange(Player* pPlayer, uint32 factionID, int32& standing, bool incremental) { START_HOOK_WITH_RETVAL(PLAYER_EVENT_ON_REPUTATION_CHANGE, true); bool result = true; @@ -285,7 +285,7 @@ bool Eluna::OnReputationChange(Player* pPlayer, uint32 factionID, int32& standin return result; } -void Eluna::OnDuelRequest(Player* pTarget, Player* pChallenger) +void ALE::OnDuelRequest(Player* pTarget, Player* pChallenger) { START_HOOK(PLAYER_EVENT_ON_DUEL_REQUEST); Push(pTarget); @@ -293,7 +293,7 @@ void Eluna::OnDuelRequest(Player* pTarget, Player* pChallenger) CallAllFunctions(PlayerEventBindings, key); } -void Eluna::OnDuelStart(Player* pStarter, Player* pChallenger) +void ALE::OnDuelStart(Player* pStarter, Player* pChallenger) { START_HOOK(PLAYER_EVENT_ON_DUEL_START); Push(pStarter); @@ -301,7 +301,7 @@ void Eluna::OnDuelStart(Player* pStarter, Player* pChallenger) CallAllFunctions(PlayerEventBindings, key); } -void Eluna::OnDuelEnd(Player* pWinner, Player* pLoser, DuelCompleteType type) +void ALE::OnDuelEnd(Player* pWinner, Player* pLoser, DuelCompleteType type) { START_HOOK(PLAYER_EVENT_ON_DUEL_END); Push(pWinner); @@ -310,7 +310,7 @@ void Eluna::OnDuelEnd(Player* pWinner, Player* pLoser, DuelCompleteType type) CallAllFunctions(PlayerEventBindings, key); } -void Eluna::OnEmote(Player* pPlayer, uint32 emote) +void ALE::OnEmote(Player* pPlayer, uint32 emote) { START_HOOK(PLAYER_EVENT_ON_EMOTE); Push(pPlayer); @@ -318,7 +318,7 @@ void Eluna::OnEmote(Player* pPlayer, uint32 emote) CallAllFunctions(PlayerEventBindings, key); } -void Eluna::OnTextEmote(Player* pPlayer, uint32 textEmote, uint32 emoteNum, ObjectGuid guid) +void ALE::OnTextEmote(Player* pPlayer, uint32 textEmote, uint32 emoteNum, ObjectGuid guid) { START_HOOK(PLAYER_EVENT_ON_TEXT_EMOTE); Push(pPlayer); @@ -328,7 +328,7 @@ void Eluna::OnTextEmote(Player* pPlayer, uint32 textEmote, uint32 emoteNum, Obje CallAllFunctions(PlayerEventBindings, key); } -void Eluna::OnPlayerSpellCast(Player* pPlayer, Spell* pSpell, bool skipCheck) +void ALE::OnPlayerSpellCast(Player* pPlayer, Spell* pSpell, bool skipCheck) { START_HOOK(PLAYER_EVENT_ON_SPELL_CAST); Push(pPlayer); @@ -337,42 +337,42 @@ void Eluna::OnPlayerSpellCast(Player* pPlayer, Spell* pSpell, bool skipCheck) CallAllFunctions(PlayerEventBindings, key); } -void Eluna::OnLogin(Player* pPlayer) +void ALE::OnLogin(Player* pPlayer) { START_HOOK(PLAYER_EVENT_ON_LOGIN); Push(pPlayer); CallAllFunctions(PlayerEventBindings, key); } -void Eluna::OnLogout(Player* pPlayer) +void ALE::OnLogout(Player* pPlayer) { START_HOOK(PLAYER_EVENT_ON_LOGOUT); Push(pPlayer); CallAllFunctions(PlayerEventBindings, key); } -void Eluna::OnCreate(Player* pPlayer) +void ALE::OnCreate(Player* pPlayer) { START_HOOK(PLAYER_EVENT_ON_CHARACTER_CREATE); Push(pPlayer); CallAllFunctions(PlayerEventBindings, key); } -void Eluna::OnDelete(uint32 guidlow) +void ALE::OnDelete(uint32 guidlow) { START_HOOK(PLAYER_EVENT_ON_CHARACTER_DELETE); Push(guidlow); CallAllFunctions(PlayerEventBindings, key); } -void Eluna::OnSave(Player* pPlayer) +void ALE::OnSave(Player* pPlayer) { START_HOOK(PLAYER_EVENT_ON_SAVE); Push(pPlayer); CallAllFunctions(PlayerEventBindings, key); } -void Eluna::OnBindToInstance(Player* pPlayer, Difficulty difficulty, uint32 mapid, bool permanent) +void ALE::OnBindToInstance(Player* pPlayer, Difficulty difficulty, uint32 mapid, bool permanent) { START_HOOK(PLAYER_EVENT_ON_BIND_TO_INSTANCE); Push(pPlayer); @@ -382,7 +382,7 @@ void Eluna::OnBindToInstance(Player* pPlayer, Difficulty difficulty, uint32 mapi CallAllFunctions(PlayerEventBindings, key); } -void Eluna::OnUpdateArea(Player* pPlayer, uint32 oldArea, uint32 newArea) +void ALE::OnUpdateArea(Player* pPlayer, uint32 oldArea, uint32 newArea) { START_HOOK(PLAYER_EVENT_ON_UPDATE_AREA); Push(pPlayer); @@ -391,7 +391,7 @@ void Eluna::OnUpdateArea(Player* pPlayer, uint32 oldArea, uint32 newArea) CallAllFunctions(PlayerEventBindings, key); } -void Eluna::OnUpdateZone(Player* pPlayer, uint32 newZone, uint32 newArea) +void ALE::OnUpdateZone(Player* pPlayer, uint32 newZone, uint32 newArea) { START_HOOK(PLAYER_EVENT_ON_UPDATE_ZONE); Push(pPlayer); @@ -400,14 +400,14 @@ void Eluna::OnUpdateZone(Player* pPlayer, uint32 newZone, uint32 newArea) CallAllFunctions(PlayerEventBindings, key); } -void Eluna::OnMapChanged(Player* player) +void ALE::OnMapChanged(Player* player) { START_HOOK(PLAYER_EVENT_ON_MAP_CHANGE); Push(player); CallAllFunctions(PlayerEventBindings, key); } -bool Eluna::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg) +bool ALE::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg) { if (lang == LANG_ADDON) return OnAddonMessage(pPlayer, type, msg, NULL, NULL, NULL, NULL); @@ -437,7 +437,7 @@ bool Eluna::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg) return result; } -bool Eluna::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg, Group* pGroup) +bool ALE::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg, Group* pGroup) { if (lang == LANG_ADDON) return OnAddonMessage(pPlayer, type, msg, NULL, NULL, pGroup, NULL); @@ -468,7 +468,7 @@ bool Eluna::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg, return result; } -bool Eluna::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg, Guild* pGuild) +bool ALE::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg, Guild* pGuild) { if (lang == LANG_ADDON) return OnAddonMessage(pPlayer, type, msg, NULL, pGuild, NULL, NULL); @@ -499,7 +499,7 @@ bool Eluna::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg, return result; } -bool Eluna::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg, Channel* pChannel) +bool ALE::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg, Channel* pChannel) { if (lang == LANG_ADDON) return OnAddonMessage(pPlayer, type, msg, NULL, NULL, NULL, pChannel); @@ -530,7 +530,7 @@ bool Eluna::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg, return result; } -bool Eluna::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg, Player* pReceiver) +bool ALE::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg, Player* pReceiver) { if (lang == LANG_ADDON) return OnAddonMessage(pPlayer, type, msg, pReceiver, NULL, NULL, NULL); @@ -561,7 +561,7 @@ bool Eluna::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg, return result; } -void Eluna::OnPetAddedToWorld(Player* player, Creature* pet) +void ALE::OnPetAddedToWorld(Player* player, Creature* pet) { START_HOOK(PLAYER_EVENT_ON_PET_ADDED_TO_WORLD); Push(player); @@ -569,7 +569,7 @@ void Eluna::OnPetAddedToWorld(Player* player, Creature* pet) CallAllFunctions(PlayerEventBindings, key); } -void Eluna::OnLearnSpell(Player* player, uint32 spellId) +void ALE::OnLearnSpell(Player* player, uint32 spellId) { START_HOOK(PLAYER_EVENT_ON_LEARN_SPELL); Push(player); @@ -577,7 +577,7 @@ void Eluna::OnLearnSpell(Player* player, uint32 spellId) CallAllFunctions(PlayerEventBindings, key); } -void Eluna::OnAchiComplete(Player* player, AchievementEntry const* achievement) +void ALE::OnAchiComplete(Player* player, AchievementEntry const* achievement) { START_HOOK(PLAYER_EVENT_ON_ACHIEVEMENT_COMPLETE); Push(player); @@ -585,7 +585,7 @@ void Eluna::OnAchiComplete(Player* player, AchievementEntry const* achievement) CallAllFunctions(PlayerEventBindings, key); } -void Eluna::OnFfaPvpStateUpdate(Player* player, bool hasFfaPvp) +void ALE::OnFfaPvpStateUpdate(Player* player, bool hasFfaPvp) { START_HOOK(PLAYER_EVENT_ON_FFAPVP_CHANGE); Push(player); @@ -593,7 +593,7 @@ void Eluna::OnFfaPvpStateUpdate(Player* player, bool hasFfaPvp) CallAllFunctions(PlayerEventBindings, key); } -bool Eluna::OnCanInitTrade(Player* player, Player* target) +bool ALE::OnCanInitTrade(Player* player, Player* target) { START_HOOK_WITH_RETVAL(PLAYER_EVENT_ON_CAN_INIT_TRADE, true); Push(player); @@ -601,7 +601,7 @@ bool Eluna::OnCanInitTrade(Player* player, Player* target) return CallAllFunctionsBool(PlayerEventBindings, key); } -bool Eluna::OnCanSendMail(Player* player, ObjectGuid receiverGuid, ObjectGuid mailbox, std::string& subject, std::string& body, uint32 money, uint32 cod, Item* item) +bool ALE::OnCanSendMail(Player* player, ObjectGuid receiverGuid, ObjectGuid mailbox, std::string& subject, std::string& body, uint32 money, uint32 cod, Item* item) { START_HOOK_WITH_RETVAL(PLAYER_EVENT_ON_CAN_SEND_MAIL, true); Push(player); @@ -615,7 +615,7 @@ bool Eluna::OnCanSendMail(Player* player, ObjectGuid receiverGuid, ObjectGuid ma return CallAllFunctionsBool(PlayerEventBindings, key); } -bool Eluna::OnCanJoinLfg(Player* player, uint8 roles, lfg::LfgDungeonSet& dungeons, const std::string& comment) +bool ALE::OnCanJoinLfg(Player* player, uint8 roles, lfg::LfgDungeonSet& dungeons, const std::string& comment) { START_HOOK_WITH_RETVAL(PLAYER_EVENT_ON_CAN_JOIN_LFG, true); Push(player); @@ -626,7 +626,7 @@ bool Eluna::OnCanJoinLfg(Player* player, uint8 roles, lfg::LfgDungeonSet& dungeo uint32 counter = 1; for (uint32 dungeon : dungeons) { - Eluna::Push(L, dungeon); + ALE::Push(L, dungeon); lua_rawseti(L, table, counter); ++counter; } @@ -637,7 +637,7 @@ bool Eluna::OnCanJoinLfg(Player* player, uint8 roles, lfg::LfgDungeonSet& dungeo return CallAllFunctionsBool(PlayerEventBindings, key); } -void Eluna::OnQuestRewardItem(Player* player, Item* item, uint32 count) +void ALE::OnQuestRewardItem(Player* player, Item* item, uint32 count) { START_HOOK(PLAYER_EVENT_ON_QUEST_REWARD_ITEM); Push(player); @@ -646,7 +646,7 @@ void Eluna::OnQuestRewardItem(Player* player, Item* item, uint32 count) CallAllFunctions(PlayerEventBindings, key); } -void Eluna::OnCreateItem(Player* player, Item* item, uint32 count) +void ALE::OnCreateItem(Player* player, Item* item, uint32 count) { START_HOOK(PLAYER_EVENT_ON_CREATE_ITEM); Push(player); @@ -655,7 +655,7 @@ void Eluna::OnCreateItem(Player* player, Item* item, uint32 count) CallAllFunctions(PlayerEventBindings, key); } -void Eluna::OnStoreNewItem(Player* player, Item* item, uint32 count) +void ALE::OnStoreNewItem(Player* player, Item* item, uint32 count) { START_HOOK(PLAYER_EVENT_ON_STORE_NEW_ITEM); Push(player); @@ -664,7 +664,7 @@ void Eluna::OnStoreNewItem(Player* player, Item* item, uint32 count) CallAllFunctions(PlayerEventBindings, key); } -void Eluna::OnPlayerCompleteQuest(Player* player, Quest const* quest) +void ALE::OnPlayerCompleteQuest(Player* player, Quest const* quest) { START_HOOK(PLAYER_EVENT_ON_COMPLETE_QUEST); Push(player); @@ -672,7 +672,7 @@ void Eluna::OnPlayerCompleteQuest(Player* player, Quest const* quest) CallAllFunctions(PlayerEventBindings, key); } -bool Eluna::OnCanGroupInvite(Player* player, std::string& memberName) +bool ALE::OnCanGroupInvite(Player* player, std::string& memberName) { START_HOOK_WITH_RETVAL(PLAYER_EVENT_ON_CAN_GROUP_INVITE, true); Push(player); @@ -680,7 +680,7 @@ bool Eluna::OnCanGroupInvite(Player* player, std::string& memberName) return CallAllFunctionsBool(PlayerEventBindings, key); } -void Eluna::OnGroupRollRewardItem(Player* player, Item* item, uint32 count, RollVote voteType, Roll* roll) +void ALE::OnGroupRollRewardItem(Player* player, Item* item, uint32 count, RollVote voteType, Roll* roll) { START_HOOK(PLAYER_EVENT_ON_GROUP_ROLL_REWARD_ITEM); Push(player); @@ -691,7 +691,7 @@ void Eluna::OnGroupRollRewardItem(Player* player, Item* item, uint32 count, Roll CallAllFunctions(PlayerEventBindings, key); } -void Eluna::OnBattlegroundDesertion(Player* player, const BattlegroundDesertionType type) +void ALE::OnBattlegroundDesertion(Player* player, const BattlegroundDesertionType type) { START_HOOK(PLAYER_EVENT_ON_BG_DESERTION); Push(player); @@ -699,7 +699,7 @@ void Eluna::OnBattlegroundDesertion(Player* player, const BattlegroundDesertionT CallAllFunctions(PlayerEventBindings, key); } -void Eluna::OnCreatureKilledByPet(Player* player, Creature* killed) +void ALE::OnCreatureKilledByPet(Player* player, Creature* killed) { START_HOOK(PLAYER_EVENT_ON_PET_KILL); Push(player); @@ -707,7 +707,7 @@ void Eluna::OnCreatureKilledByPet(Player* player, Creature* killed) CallAllFunctions(PlayerEventBindings, key); } -bool Eluna::OnPlayerCanUpdateSkill(Player* player, uint32 skill_id) +bool ALE::OnPlayerCanUpdateSkill(Player* player, uint32 skill_id) { START_HOOK_WITH_RETVAL(PLAYER_EVENT_ON_CAN_UPDATE_SKILL, true); Push(player); @@ -715,7 +715,7 @@ bool Eluna::OnPlayerCanUpdateSkill(Player* player, uint32 skill_id) return CallAllFunctionsBool(PlayerEventBindings, key); } -void Eluna::OnPlayerBeforeUpdateSkill(Player* player, uint32 skill_id, uint32& value, uint32 max, uint32 step) +void ALE::OnPlayerBeforeUpdateSkill(Player* player, uint32 skill_id, uint32& value, uint32 max, uint32 step) { START_HOOK(PLAYER_EVENT_ON_BEFORE_UPDATE_SKILL); Push(player); @@ -742,7 +742,7 @@ void Eluna::OnPlayerBeforeUpdateSkill(Player* player, uint32 skill_id, uint32& v CleanUpStack(5); } -void Eluna::OnPlayerUpdateSkill(Player* player, uint32 skill_id, uint32 value, uint32 max, uint32 step, uint32 new_value) +void ALE::OnPlayerUpdateSkill(Player* player, uint32 skill_id, uint32 value, uint32 max, uint32 step, uint32 new_value) { START_HOOK(PLAYER_EVENT_ON_UPDATE_SKILL); Push(player); @@ -754,14 +754,14 @@ void Eluna::OnPlayerUpdateSkill(Player* player, uint32 skill_id, uint32 value, u CallAllFunctions(PlayerEventBindings, key); } -bool Eluna::CanPlayerResurrect(Player* player) +bool ALE::CanPlayerResurrect(Player* player) { START_HOOK_WITH_RETVAL(PLAYER_EVENT_ON_CAN_RESURRECT, true); Push(player); return CallAllFunctionsBool(PlayerEventBindings, key); } -void Eluna::OnPlayerQuestAccept(Player* player, Quest const* quest) +void ALE::OnPlayerQuestAccept(Player* player, Quest const* quest) { START_HOOK(PLAYER_EVENT_ON_QUEST_ACCEPT); Push(player); @@ -769,7 +769,7 @@ void Eluna::OnPlayerQuestAccept(Player* player, Quest const* quest) CallAllFunctions(PlayerEventBindings, key); } -void Eluna::OnPlayerAuraApply(Player* player, Aura* aura) +void ALE::OnPlayerAuraApply(Player* player, Aura* aura) { START_HOOK(PLAYER_EVENT_ON_AURA_APPLY); Push(player); @@ -777,7 +777,7 @@ void Eluna::OnPlayerAuraApply(Player* player, Aura* aura) CallAllFunctions(PlayerEventBindings, key); } -void Eluna::OnPlayerHeal(Player* player, Unit* target, uint32& gain) +void ALE::OnPlayerHeal(Player* player, Unit* target, uint32& gain) { START_HOOK(PLAYER_EVENT_ON_HEAL); Push(player); @@ -802,7 +802,7 @@ void Eluna::OnPlayerHeal(Player* player, Unit* target, uint32& gain) CleanUpStack(3); } -void Eluna::OnPlayerDamage(Player* player, Unit* target, uint32& damage) +void ALE::OnPlayerDamage(Player* player, Unit* target, uint32& damage) { START_HOOK(PLAYER_EVENT_ON_DAMAGE); Push(player); diff --git a/src/LuaEngine/hooks/ServerHooks.cpp b/src/LuaEngine/hooks/ServerHooks.cpp index 7228a1f..f305c97 100644 --- a/src/LuaEngine/hooks/ServerHooks.cpp +++ b/src/LuaEngine/hooks/ServerHooks.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,29 +8,29 @@ #include "HookHelpers.h" #include "LuaEngine.h" #include "BindingMap.h" -#include "ElunaEventMgr.h" -#include "ElunaIncludes.h" -#include "ElunaTemplate.h" +#include "ALEEventMgr.h" +#include "ALEIncludes.h" +#include "ALETemplate.h" using namespace Hooks; #define START_HOOK(EVENT) \ - if (!ElunaConfig::GetInstance().IsElunaEnabled())\ + if (!ALEConfig::GetInstance().IsALEEnabled())\ return;\ auto key = EventKey(EVENT);\ if (!ServerEventBindings->HasBindingsFor(key))\ return;\ - LOCK_ELUNA + LOCK_ALE #define START_HOOK_WITH_RETVAL(EVENT, RETVAL) \ - if (!ElunaConfig::GetInstance().IsElunaEnabled())\ + if (!ALEConfig::GetInstance().IsALEEnabled())\ return RETVAL;\ auto key = EventKey(EVENT);\ if (!ServerEventBindings->HasBindingsFor(key))\ return RETVAL;\ - LOCK_ELUNA + LOCK_ALE -bool Eluna::OnAddonMessage(Player* sender, uint32 type, std::string& msg, Player* receiver, Guild* guild, Group* group, Channel* channel) +bool ALE::OnAddonMessage(Player* sender, uint32 type, std::string& msg, Player* receiver, Guild* guild, Group* group, Channel* channel) { START_HOOK_WITH_RETVAL(ADDON_EVENT_ON_MESSAGE, true); Push(sender); @@ -64,9 +64,9 @@ bool Eluna::OnAddonMessage(Player* sender, uint32 type, std::string& msg, Player return CallAllFunctionsBool(ServerEventBindings, key, true); } -void Eluna::OnTimedEvent(int funcRef, uint32 delay, uint32 calls, WorldObject* obj) +void ALE::OnTimedEvent(int funcRef, uint32 delay, uint32 calls, WorldObject* obj) { - LOCK_ELUNA; + LOCK_ALE; ASSERT(!event_level); // Get function @@ -85,34 +85,34 @@ void Eluna::OnTimedEvent(int funcRef, uint32 delay, uint32 calls, WorldObject* o InvalidateObjects(); } -void Eluna::OnGameEventStart(uint32 eventid) +void ALE::OnGameEventStart(uint32 eventid) { START_HOOK(GAME_EVENT_START); Push(eventid); CallAllFunctions(ServerEventBindings, key); } -void Eluna::OnGameEventStop(uint32 eventid) +void ALE::OnGameEventStop(uint32 eventid) { START_HOOK(GAME_EVENT_STOP); Push(eventid); CallAllFunctions(ServerEventBindings, key); } -void Eluna::OnLuaStateClose() +void ALE::OnLuaStateClose() { - START_HOOK(ELUNA_EVENT_ON_LUA_STATE_CLOSE); + START_HOOK(ALE_EVENT_ON_LUA_STATE_CLOSE); CallAllFunctions(ServerEventBindings, key); } -void Eluna::OnLuaStateOpen() +void ALE::OnLuaStateOpen() { - START_HOOK(ELUNA_EVENT_ON_LUA_STATE_OPEN); + START_HOOK(ALE_EVENT_ON_LUA_STATE_OPEN); CallAllFunctions(ServerEventBindings, key); } // AreaTrigger -bool Eluna::OnAreaTrigger(Player* pPlayer, AreaTriggerEntry const* pTrigger) +bool ALE::OnAreaTrigger(Player* pPlayer, AreaTriggerEntry const* pTrigger) { START_HOOK_WITH_RETVAL(TRIGGER_EVENT_ON_TRIGGER, false); Push(pPlayer); @@ -122,7 +122,7 @@ bool Eluna::OnAreaTrigger(Player* pPlayer, AreaTriggerEntry const* pTrigger) } // Weather -void Eluna::OnChange(Weather* /*weather*/, uint32 zone, WeatherState state, float grade) +void ALE::OnChange(Weather* /*weather*/, uint32 zone, WeatherState state, float grade) { START_HOOK(WEATHER_EVENT_ON_CHANGE); Push(zone); @@ -132,7 +132,7 @@ void Eluna::OnChange(Weather* /*weather*/, uint32 zone, WeatherState state, floa } // Auction House -void Eluna::OnAdd(AuctionHouseObject* /*ah*/, AuctionEntry* entry) +void ALE::OnAdd(AuctionHouseObject* /*ah*/, AuctionEntry* entry) { Player* owner = eObjectAccessor()FindPlayer(entry->owner); @@ -154,7 +154,7 @@ void Eluna::OnAdd(AuctionHouseObject* /*ah*/, AuctionEntry* entry) CallAllFunctions(ServerEventBindings, key); } -void Eluna::OnRemove(AuctionHouseObject* /*ah*/, AuctionEntry* entry) +void ALE::OnRemove(AuctionHouseObject* /*ah*/, AuctionEntry* entry) { Player* owner = eObjectAccessor()FindPlayer(entry->owner); @@ -176,7 +176,7 @@ void Eluna::OnRemove(AuctionHouseObject* /*ah*/, AuctionEntry* entry) CallAllFunctions(ServerEventBindings, key); } -void Eluna::OnSuccessful(AuctionHouseObject* /*ah*/, AuctionEntry* entry) +void ALE::OnSuccessful(AuctionHouseObject* /*ah*/, AuctionEntry* entry) { Player* owner = eObjectAccessor()FindPlayer(entry->owner); @@ -198,7 +198,7 @@ void Eluna::OnSuccessful(AuctionHouseObject* /*ah*/, AuctionEntry* entry) CallAllFunctions(ServerEventBindings, key); } -void Eluna::OnExpire(AuctionHouseObject* /*ah*/, AuctionEntry* entry) +void ALE::OnExpire(AuctionHouseObject* /*ah*/, AuctionEntry* entry) { Player* owner = eObjectAccessor()FindPlayer(entry->owner); @@ -220,14 +220,14 @@ void Eluna::OnExpire(AuctionHouseObject* /*ah*/, AuctionEntry* entry) CallAllFunctions(ServerEventBindings, key); } -void Eluna::OnOpenStateChange(bool open) +void ALE::OnOpenStateChange(bool open) { START_HOOK(WORLD_EVENT_ON_OPEN_STATE_CHANGE); Push(open); CallAllFunctions(ServerEventBindings, key); } -void Eluna::OnConfigLoad(bool reload, bool isBefore) +void ALE::OnConfigLoad(bool reload, bool isBefore) { START_HOOK(WORLD_EVENT_ON_CONFIG_LOAD); Push(reload); @@ -235,7 +235,7 @@ void Eluna::OnConfigLoad(bool reload, bool isBefore) CallAllFunctions(ServerEventBindings, key); } -void Eluna::OnShutdownInitiate(ShutdownExitCode code, ShutdownMask mask) +void ALE::OnShutdownInitiate(ShutdownExitCode code, ShutdownMask mask) { START_HOOK(WORLD_EVENT_ON_SHUTDOWN_INIT); Push(code); @@ -243,18 +243,18 @@ void Eluna::OnShutdownInitiate(ShutdownExitCode code, ShutdownMask mask) CallAllFunctions(ServerEventBindings, key); } -void Eluna::OnShutdownCancel() +void ALE::OnShutdownCancel() { START_HOOK(WORLD_EVENT_ON_SHUTDOWN_CANCEL); CallAllFunctions(ServerEventBindings, key); } -void Eluna::OnWorldUpdate(uint32 diff) +void ALE::OnWorldUpdate(uint32 diff) { { - LOCK_ELUNA; + LOCK_ALE; if (ShouldReload()) - _ReloadEluna(); + _ReloadALE(); } eventMgr->globalProcessor->Update(diff); @@ -266,34 +266,34 @@ void Eluna::OnWorldUpdate(uint32 diff) CallAllFunctions(ServerEventBindings, key); } -void Eluna::OnStartup() +void ALE::OnStartup() { START_HOOK(WORLD_EVENT_ON_STARTUP); CallAllFunctions(ServerEventBindings, key); } -void Eluna::OnShutdown() +void ALE::OnShutdown() { START_HOOK(WORLD_EVENT_ON_SHUTDOWN); CallAllFunctions(ServerEventBindings, key); } /* Map */ -void Eluna::OnCreate(Map* map) +void ALE::OnCreate(Map* map) { START_HOOK(MAP_EVENT_ON_CREATE); Push(map); CallAllFunctions(ServerEventBindings, key); } -void Eluna::OnDestroy(Map* map) +void ALE::OnDestroy(Map* map) { START_HOOK(MAP_EVENT_ON_DESTROY); Push(map); CallAllFunctions(ServerEventBindings, key); } -void Eluna::OnPlayerEnter(Map* map, Player* player) +void ALE::OnPlayerEnter(Map* map, Player* player) { START_HOOK(MAP_EVENT_ON_PLAYER_ENTER); Push(map); @@ -301,7 +301,7 @@ void Eluna::OnPlayerEnter(Map* map, Player* player) CallAllFunctions(ServerEventBindings, key); } -void Eluna::OnPlayerLeave(Map* map, Player* player) +void ALE::OnPlayerLeave(Map* map, Player* player) { START_HOOK(MAP_EVENT_ON_PLAYER_LEAVE); Push(map); @@ -309,7 +309,7 @@ void Eluna::OnPlayerLeave(Map* map, Player* player) CallAllFunctions(ServerEventBindings, key); } -void Eluna::OnUpdate(Map* map, uint32 diff) +void ALE::OnUpdate(Map* map, uint32 diff) { START_HOOK(MAP_EVENT_ON_UPDATE); // enable this for multithread @@ -319,14 +319,14 @@ void Eluna::OnUpdate(Map* map, uint32 diff) CallAllFunctions(ServerEventBindings, key); } -void Eluna::OnRemove(GameObject* gameobject) +void ALE::OnRemove(GameObject* gameobject) { START_HOOK(WORLD_EVENT_ON_DELETE_GAMEOBJECT); Push(gameobject); CallAllFunctions(ServerEventBindings, key); } -void Eluna::OnRemove(Creature* creature) +void ALE::OnRemove(Creature* creature) { START_HOOK(WORLD_EVENT_ON_DELETE_CREATURE); Push(creature); diff --git a/src/LuaEngine/hooks/SpellHooks.cpp b/src/LuaEngine/hooks/SpellHooks.cpp index 2c18e0a..8c08018 100644 --- a/src/LuaEngine/hooks/SpellHooks.cpp +++ b/src/LuaEngine/hooks/SpellHooks.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,28 +8,28 @@ #include "HookHelpers.h" #include "LuaEngine.h" #include "BindingMap.h" -#include "ElunaIncludes.h" -#include "ElunaTemplate.h" +#include "ALEIncludes.h" +#include "ALETemplate.h" using namespace Hooks; #define START_HOOK(EVENT, ENTRY) \ - if (!ElunaConfig::GetInstance().IsElunaEnabled())\ + if (!ALEConfig::GetInstance().IsALEEnabled())\ return;\ auto key = EntryKey(EVENT, ENTRY);\ if (!SpellEventBindings->HasBindingsFor(key))\ return;\ - LOCK_ELUNA + LOCK_ALE #define START_HOOK_WITH_RETVAL(EVENT, ENTRY, RETVAL) \ - if (!ElunaConfig::GetInstance().IsElunaEnabled())\ + if (!ALEConfig::GetInstance().IsALEEnabled())\ return RETVAL;\ auto key = EntryKey(EVENT, ENTRY);\ if (!SpellEventBindings->HasBindingsFor(key))\ return RETVAL;\ - LOCK_ELUNA + LOCK_ALE -void Eluna::OnSpellCastCancel(Unit* caster, Spell* spell, SpellInfo const* spellInfo, bool bySelf) +void ALE::OnSpellCastCancel(Unit* caster, Spell* spell, SpellInfo const* spellInfo, bool bySelf) { START_HOOK(SPELL_EVENT_ON_CAST_CANCEL, spellInfo->Id); Push(caster); @@ -39,7 +39,7 @@ void Eluna::OnSpellCastCancel(Unit* caster, Spell* spell, SpellInfo const* spell CallAllFunctions(SpellEventBindings, key); } -void Eluna::OnSpellCast(Unit* caster, Spell* spell, SpellInfo const* spellInfo, bool skipCheck) +void ALE::OnSpellCast(Unit* caster, Spell* spell, SpellInfo const* spellInfo, bool skipCheck) { START_HOOK(SPELL_EVENT_ON_CAST, spellInfo->Id); Push(caster); @@ -49,7 +49,7 @@ void Eluna::OnSpellCast(Unit* caster, Spell* spell, SpellInfo const* spellInfo, CallAllFunctions(SpellEventBindings, key); } -void Eluna::OnSpellPrepare(Unit* caster, Spell* spell, SpellInfo const* spellInfo) +void ALE::OnSpellPrepare(Unit* caster, Spell* spell, SpellInfo const* spellInfo) { START_HOOK(SPELL_EVENT_ON_PREPARE, spellInfo->Id); Push(caster); diff --git a/src/LuaEngine/hooks/TicketHooks.cpp b/src/LuaEngine/hooks/TicketHooks.cpp index c27c10a..594d7e4 100644 --- a/src/LuaEngine/hooks/TicketHooks.cpp +++ b/src/LuaEngine/hooks/TicketHooks.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,49 +8,49 @@ #include "HookHelpers.h" #include "LuaEngine.h" #include "BindingMap.h" -#include "ElunaIncludes.h" -#include "ElunaTemplate.h" +#include "ALEIncludes.h" +#include "ALETemplate.h" using namespace Hooks; #define START_HOOK(EVENT) \ - if (!ElunaConfig::GetInstance().IsElunaEnabled())\ + if (!ALEConfig::GetInstance().IsALEEnabled())\ return;\ auto key = EventKey(EVENT);\ if (!TicketEventBindings->HasBindingsFor(key))\ return;\ - LOCK_ELUNA + LOCK_ALE #define START_HOOK(EVENT) \ - if (!ElunaConfig::GetInstance().IsElunaEnabled())\ + if (!ALEConfig::GetInstance().IsALEEnabled())\ return;\ auto key = EventKey(EVENT);\ if (!TicketEventBindings->HasBindingsFor(key))\ return;\ - LOCK_ELUNA + LOCK_ALE -void Eluna::OnTicketCreate(GmTicket* ticket) +void ALE::OnTicketCreate(GmTicket* ticket) { START_HOOK(TICKET_EVENT_ON_CREATE); Push(ticket); CallAllFunctions(TicketEventBindings, key); } -void Eluna::OnTicketUpdateLastChange(GmTicket* ticket) +void ALE::OnTicketUpdateLastChange(GmTicket* ticket) { START_HOOK(TICKET_EVENT_UPDATE_LAST_CHANGE); Push(ticket); CallAllFunctions(TicketEventBindings, key); } -void Eluna::OnTicketClose(GmTicket* ticket) +void ALE::OnTicketClose(GmTicket* ticket) { START_HOOK(TICKET_EVENT_ON_CLOSE); Push(ticket); CallAllFunctions(TicketEventBindings, key); } -void Eluna::OnTicketResolve(GmTicket* ticket) +void ALE::OnTicketResolve(GmTicket* ticket) { START_HOOK(TICKET_EVENT_ON_RESOLVE); Push(ticket); diff --git a/src/LuaEngine/hooks/VehicleHooks.cpp b/src/LuaEngine/hooks/VehicleHooks.cpp index b460798..f03a965 100644 --- a/src/LuaEngine/hooks/VehicleHooks.cpp +++ b/src/LuaEngine/hooks/VehicleHooks.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,33 +8,33 @@ #include "HookHelpers.h" #include "LuaEngine.h" #include "BindingMap.h" -#include "ElunaTemplate.h" +#include "ALETemplate.h" using namespace Hooks; #define START_HOOK(EVENT) \ - if (!ElunaConfig::GetInstance().IsElunaEnabled())\ + if (!ALEConfig::GetInstance().IsALEEnabled())\ return;\ auto key = EventKey(EVENT);\ if (!VehicleEventBindings->HasBindingsFor(key))\ return;\ - LOCK_ELUNA + LOCK_ALE -void Eluna::OnInstall(Vehicle* vehicle) +void ALE::OnInstall(Vehicle* vehicle) { START_HOOK(VEHICLE_EVENT_ON_INSTALL); Push(vehicle); CallAllFunctions(VehicleEventBindings, key); } -void Eluna::OnUninstall(Vehicle* vehicle) +void ALE::OnUninstall(Vehicle* vehicle) { START_HOOK(VEHICLE_EVENT_ON_UNINSTALL); Push(vehicle); CallAllFunctions(VehicleEventBindings, key); } -void Eluna::OnInstallAccessory(Vehicle* vehicle, Creature* accessory) +void ALE::OnInstallAccessory(Vehicle* vehicle, Creature* accessory) { START_HOOK(VEHICLE_EVENT_ON_INSTALL_ACCESSORY); Push(vehicle); @@ -42,7 +42,7 @@ void Eluna::OnInstallAccessory(Vehicle* vehicle, Creature* accessory) CallAllFunctions(VehicleEventBindings, key); } -void Eluna::OnAddPassenger(Vehicle* vehicle, Unit* passenger, int8 seatId) +void ALE::OnAddPassenger(Vehicle* vehicle, Unit* passenger, int8 seatId) { START_HOOK(VEHICLE_EVENT_ON_ADD_PASSENGER); Push(vehicle); @@ -51,7 +51,7 @@ void Eluna::OnAddPassenger(Vehicle* vehicle, Unit* passenger, int8 seatId) CallAllFunctions(VehicleEventBindings, key); } -void Eluna::OnRemovePassenger(Vehicle* vehicle, Unit* passenger) +void ALE::OnRemovePassenger(Vehicle* vehicle, Unit* passenger) { START_HOOK(VEHICLE_EVENT_ON_REMOVE_PASSENGER); Push(vehicle); diff --git a/src/LuaEngine/lmarshal.cpp b/src/LuaEngine/lmarshal.cpp index 788db97..936d677 100644 --- a/src/LuaEngine/lmarshal.cpp +++ b/src/LuaEngine/lmarshal.cpp @@ -1,7 +1,7 @@ /* * lmarshal.c * A Lua library for serializing and deserializing Lua values - * Richard Hundt , Eluna Lua Engine + * Richard Hundt , Eluna Lua Engine * * License: MIT * @@ -32,7 +32,7 @@ #include #include #include -#include "ElunaCompat.h" +#include "ALECompat.h" #if LUA_VERSION_NUM == 501 && !defined(luaL_setfuncs) #define luaL_setfuncs(L, l, n) luaL_register(L, NULL, l) diff --git a/src/LuaEngine/lmarshal.h b/src/LuaEngine/lmarshal.h index b0ad721..fed50b9 100644 --- a/src/LuaEngine/lmarshal.h +++ b/src/LuaEngine/lmarshal.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 Eluna Lua Engine + * Copyright (C) 2025 Eluna Lua Engine * This program is free software licensed under GPL version 3 * Please see the included DOCS/LICENSE.md for more information */ diff --git a/src/LuaEngine/methods/ElunaQueryMethods.h b/src/LuaEngine/methods/ALEQueryMethods.h similarity index 66% rename from src/LuaEngine/methods/ElunaQueryMethods.h rename to src/LuaEngine/methods/ALEQueryMethods.h index b2efe4f..474c4ec 100644 --- a/src/LuaEngine/methods/ElunaQueryMethods.h +++ b/src/LuaEngine/methods/ALEQueryMethods.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 */ @@ -18,9 +18,9 @@ */ namespace LuaQuery { - static void CheckFields(lua_State* L, ElunaQuery* result) + static void CheckFields(lua_State* L, ALEQuery* result) { - uint32 field = Eluna::CHECKVAL(L, 2); + uint32 field = ALE::CHECKVAL(L, 2); uint32 count = RESULT->GetFieldCount(); if (field >= count) { @@ -36,12 +36,12 @@ namespace LuaQuery * @param uint32 column * @return bool isNull */ - int IsNull(lua_State* L, ElunaQuery* result) + int IsNull(lua_State* L, ALEQuery* result) { - uint32 col = Eluna::CHECKVAL(L, 2); + uint32 col = ALE::CHECKVAL(L, 2); CheckFields(L, result); - Eluna::Push(L, RESULT->Fetch()[col].IsNull()); + ALE::Push(L, RESULT->Fetch()[col].IsNull()); return 1; } @@ -50,9 +50,9 @@ namespace LuaQuery * * @return uint32 columnCount */ - int GetColumnCount(lua_State* L, ElunaQuery* result) + int GetColumnCount(lua_State* L, ALEQuery* result) { - Eluna::Push(L, RESULT->GetFieldCount()); + ALE::Push(L, RESULT->GetFieldCount()); return 1; } @@ -61,12 +61,12 @@ namespace LuaQuery * * @return uint32 rowCount */ - int GetRowCount(lua_State* L, ElunaQuery* result) + int GetRowCount(lua_State* L, ALEQuery* result) { if (RESULT->GetRowCount() > (uint32)-1) - Eluna::Push(L, (uint32)-1); + ALE::Push(L, (uint32)-1); else - Eluna::Push(L, (uint32)(RESULT->GetRowCount())); + ALE::Push(L, (uint32)(RESULT->GetRowCount())); return 1; } @@ -76,11 +76,11 @@ namespace LuaQuery * @param uint32 column * @return bool data */ - int GetBool(lua_State* L, ElunaQuery* result) + int GetBool(lua_State* L, ALEQuery* result) { - uint32 col = Eluna::CHECKVAL(L, 2); + uint32 col = ALE::CHECKVAL(L, 2); CheckFields(L, result); - Eluna::Push(L, RESULT->Fetch()[col].Get()); + ALE::Push(L, RESULT->Fetch()[col].Get()); return 1; } @@ -90,11 +90,11 @@ namespace LuaQuery * @param uint32 column * @return uint8 data */ - int GetUInt8(lua_State* L, ElunaQuery* result) + int GetUInt8(lua_State* L, ALEQuery* result) { - uint32 col = Eluna::CHECKVAL(L, 2); + uint32 col = ALE::CHECKVAL(L, 2); CheckFields(L, result); - Eluna::Push(L, RESULT->Fetch()[col].Get()); + ALE::Push(L, RESULT->Fetch()[col].Get()); return 1; } @@ -104,11 +104,11 @@ namespace LuaQuery * @param uint32 column * @return uint16 data */ - int GetUInt16(lua_State* L, ElunaQuery* result) + int GetUInt16(lua_State* L, ALEQuery* result) { - uint32 col = Eluna::CHECKVAL(L, 2); + uint32 col = ALE::CHECKVAL(L, 2); CheckFields(L, result); - Eluna::Push(L, RESULT->Fetch()[col].Get()); + ALE::Push(L, RESULT->Fetch()[col].Get()); return 1; } @@ -118,11 +118,11 @@ namespace LuaQuery * @param uint32 column * @return uint32 data */ - int GetUInt32(lua_State* L, ElunaQuery* result) + int GetUInt32(lua_State* L, ALEQuery* result) { - uint32 col = Eluna::CHECKVAL(L, 2); + uint32 col = ALE::CHECKVAL(L, 2); CheckFields(L, result); - Eluna::Push(L, RESULT->Fetch()[col].Get()); + ALE::Push(L, RESULT->Fetch()[col].Get()); return 1; } @@ -132,11 +132,11 @@ namespace LuaQuery * @param uint32 column * @return uint64 data */ - int GetUInt64(lua_State* L, ElunaQuery* result) + int GetUInt64(lua_State* L, ALEQuery* result) { - uint32 col = Eluna::CHECKVAL(L, 2); + uint32 col = ALE::CHECKVAL(L, 2); CheckFields(L, result); - Eluna::Push(L, RESULT->Fetch()[col].Get()); + ALE::Push(L, RESULT->Fetch()[col].Get()); return 1; } @@ -146,11 +146,11 @@ namespace LuaQuery * @param uint32 column * @return int8 data */ - int GetInt8(lua_State* L, ElunaQuery* result) + int GetInt8(lua_State* L, ALEQuery* result) { - uint32 col = Eluna::CHECKVAL(L, 2); + uint32 col = ALE::CHECKVAL(L, 2); CheckFields(L, result); - Eluna::Push(L, RESULT->Fetch()[col].Get()); + ALE::Push(L, RESULT->Fetch()[col].Get()); return 1; } @@ -160,11 +160,11 @@ namespace LuaQuery * @param uint32 column * @return int16 data */ - int GetInt16(lua_State* L, ElunaQuery* result) + int GetInt16(lua_State* L, ALEQuery* result) { - uint32 col = Eluna::CHECKVAL(L, 2); + uint32 col = ALE::CHECKVAL(L, 2); CheckFields(L, result); - Eluna::Push(L, RESULT->Fetch()[col].Get()); + ALE::Push(L, RESULT->Fetch()[col].Get()); return 1; } @@ -174,11 +174,11 @@ namespace LuaQuery * @param uint32 column * @return int32 data */ - int GetInt32(lua_State* L, ElunaQuery* result) + int GetInt32(lua_State* L, ALEQuery* result) { - uint32 col = Eluna::CHECKVAL(L, 2); + uint32 col = ALE::CHECKVAL(L, 2); CheckFields(L, result); - Eluna::Push(L, RESULT->Fetch()[col].Get()); + ALE::Push(L, RESULT->Fetch()[col].Get()); return 1; } @@ -188,11 +188,11 @@ namespace LuaQuery * @param uint32 column * @return int64 data */ - int GetInt64(lua_State* L, ElunaQuery* result) + int GetInt64(lua_State* L, ALEQuery* result) { - uint32 col = Eluna::CHECKVAL(L, 2); + uint32 col = ALE::CHECKVAL(L, 2); CheckFields(L, result); - Eluna::Push(L, RESULT->Fetch()[col].Get()); + ALE::Push(L, RESULT->Fetch()[col].Get()); return 1; } @@ -202,11 +202,11 @@ namespace LuaQuery * @param uint32 column * @return float data */ - int GetFloat(lua_State* L, ElunaQuery* result) + int GetFloat(lua_State* L, ALEQuery* result) { - uint32 col = Eluna::CHECKVAL(L, 2); + uint32 col = ALE::CHECKVAL(L, 2); CheckFields(L, result); - Eluna::Push(L, RESULT->Fetch()[col].Get()); + ALE::Push(L, RESULT->Fetch()[col].Get()); return 1; } @@ -216,11 +216,11 @@ namespace LuaQuery * @param uint32 column * @return double data */ - int GetDouble(lua_State* L, ElunaQuery* result) + int GetDouble(lua_State* L, ALEQuery* result) { - uint32 col = Eluna::CHECKVAL(L, 2); + uint32 col = ALE::CHECKVAL(L, 2); CheckFields(L, result); - Eluna::Push(L, RESULT->Fetch()[col].Get()); + ALE::Push(L, RESULT->Fetch()[col].Get()); return 1; } @@ -230,16 +230,16 @@ namespace LuaQuery * @param uint32 column * @return string data */ - int GetString(lua_State* L, ElunaQuery* result) + int GetString(lua_State* L, ALEQuery* result) { - uint32 col = Eluna::CHECKVAL(L, 2); + uint32 col = ALE::CHECKVAL(L, 2); CheckFields(L, result); - Eluna::Push(L, RESULT->Fetch()[col].Get()); + ALE::Push(L, RESULT->Fetch()[col].Get()); return 1; } /** - * Advances the [ElunaQuery] to the next row in the result set. + * Advances the [ALEQuery] to the next row in the result set. * * *Do not* call this immediately after a query, or you'll skip the first row. * @@ -247,9 +247,9 @@ namespace LuaQuery * * @return bool hadNextRow */ - int NextRow(lua_State* L, ElunaQuery* result) + int NextRow(lua_State* L, ALEQuery* result) { - Eluna::Push(L, RESULT->NextRow()); + ALE::Push(L, RESULT->NextRow()); return 1; } @@ -266,11 +266,11 @@ namespace LuaQuery * * { entry = 123, name = "some creature name" } * - * To move to next row use [ElunaQuery:NextRow]. + * To move to next row use [ALEQuery:NextRow]. * * @return table rowData : table filled with row columns and data where `T[column] = data` */ - int GetRow(lua_State* L, ElunaQuery* result) + int GetRow(lua_State* L, ALEQuery* result) { uint32 col = RESULT->GetFieldCount(); Field* row = RESULT->Fetch(); @@ -280,12 +280,12 @@ namespace LuaQuery for (uint32 i = 0; i < col; ++i) { - Eluna::Push(L, RESULT->GetFieldName(i)); + ALE::Push(L, RESULT->GetFieldName(i)); std::string _str = row[i].Get(); const char* str = _str.c_str(); if (row[i].IsNull() || !str) - Eluna::Push(L); + ALE::Push(L); else { // MYSQL_TYPE_LONGLONG Interpreted as string for lua @@ -297,10 +297,10 @@ namespace LuaQuery case DatabaseFieldTypes::Int64: case DatabaseFieldTypes::Float: case DatabaseFieldTypes::Double: - Eluna::Push(L, strtod(str, NULL)); + ALE::Push(L, strtod(str, NULL)); break; default: - Eluna::Push(L, str); + ALE::Push(L, str); break; } } diff --git a/src/LuaEngine/methods/AchievementMethods.h b/src/LuaEngine/methods/AchievementMethods.h index 330fc55..e5d34e6 100644 --- a/src/LuaEngine/methods/AchievementMethods.h +++ b/src/LuaEngine/methods/AchievementMethods.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 */ @@ -21,7 +21,7 @@ namespace LuaAchievement */ int GetId(lua_State* L, AchievementEntry* const achievement) { - Eluna::Push(L, achievement->ID); + ALE::Push(L, achievement->ID); return 1; } @@ -46,13 +46,13 @@ namespace LuaAchievement */ int GetName(lua_State* L, AchievementEntry* const achievement) { - uint8 locale = Eluna::CHECKVAL(L, 2, DEFAULT_LOCALE); + uint8 locale = ALE::CHECKVAL(L, 2, DEFAULT_LOCALE); if (locale >= TOTAL_LOCALES) { return luaL_argerror(L, 2, "valid LocaleConstant expected"); } - Eluna::Push(L, achievement->name[locale]); + ALE::Push(L, achievement->name[locale]); return 1; } }; diff --git a/src/LuaEngine/methods/AuraMethods.h b/src/LuaEngine/methods/AuraMethods.h index 91345a5..3f63743 100644 --- a/src/LuaEngine/methods/AuraMethods.h +++ b/src/LuaEngine/methods/AuraMethods.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 */ @@ -28,7 +28,7 @@ namespace LuaAura */ int GetCaster(lua_State* L, Aura* aura) { - Eluna::Push(L, aura->GetCaster()); + ALE::Push(L, aura->GetCaster()); return 1; } @@ -39,7 +39,7 @@ namespace LuaAura */ int GetCasterGUID(lua_State* L, Aura* aura) { - Eluna::Push(L, aura->GetCasterGUID()); + ALE::Push(L, aura->GetCasterGUID()); return 1; } @@ -50,7 +50,7 @@ namespace LuaAura */ int GetCasterLevel(lua_State* L, Aura* aura) { - Eluna::Push(L, aura->GetCaster()->GetLevel()); + ALE::Push(L, aura->GetCaster()->GetLevel()); return 1; } @@ -61,7 +61,7 @@ namespace LuaAura */ int GetDuration(lua_State* L, Aura* aura) { - Eluna::Push(L, aura->GetDuration()); + ALE::Push(L, aura->GetDuration()); return 1; } @@ -72,7 +72,7 @@ namespace LuaAura */ int GetAuraId(lua_State* L, Aura* aura) { - Eluna::Push(L, aura->GetId()); + ALE::Push(L, aura->GetId()); return 1; } @@ -86,7 +86,7 @@ namespace LuaAura */ int GetMaxDuration(lua_State* L, Aura* aura) { - Eluna::Push(L, aura->GetMaxDuration()); + ALE::Push(L, aura->GetMaxDuration()); return 1; } @@ -99,7 +99,7 @@ namespace LuaAura */ int GetStackAmount(lua_State* L, Aura* aura) { - Eluna::Push(L, aura->GetStackAmount()); + ALE::Push(L, aura->GetStackAmount()); return 1; } @@ -110,7 +110,7 @@ namespace LuaAura */ int GetOwner(lua_State* L, Aura* aura) { - Eluna::Push(L, aura->GetOwner()); + ALE::Push(L, aura->GetOwner()); return 1; } @@ -121,7 +121,7 @@ namespace LuaAura */ int SetDuration(lua_State* L, Aura* aura) { - int32 duration = Eluna::CHECKVAL(L, 2); + int32 duration = ALE::CHECKVAL(L, 2); aura->SetDuration(duration); return 0; } @@ -136,7 +136,7 @@ namespace LuaAura */ int SetMaxDuration(lua_State* L, Aura* aura) { - int32 duration = Eluna::CHECKVAL(L, 2); + int32 duration = ALE::CHECKVAL(L, 2); aura->SetMaxDuration(duration); return 0; } @@ -151,7 +151,7 @@ namespace LuaAura */ int SetStackAmount(lua_State* L, Aura* aura) { - uint8 amount = Eluna::CHECKVAL(L, 2); + uint8 amount = ALE::CHECKVAL(L, 2); aura->SetStackAmount(amount); return 0; } @@ -162,7 +162,7 @@ namespace LuaAura int Remove(lua_State* L, Aura* aura) { aura->Remove(); - Eluna::CHECKOBJ(L, 1)->Invalidate(); + ALE::CHECKOBJ(L, 1)->Invalidate(); return 0; } }; diff --git a/src/LuaEngine/methods/BattleGroundMethods.h b/src/LuaEngine/methods/BattleGroundMethods.h index 935e6c2..70e97bb 100644 --- a/src/LuaEngine/methods/BattleGroundMethods.h +++ b/src/LuaEngine/methods/BattleGroundMethods.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 */ @@ -21,7 +21,7 @@ namespace LuaBattleGround */ int GetName(lua_State* L, BattleGround* bg) { - Eluna::Push(L, bg->GetName()); + ALE::Push(L, bg->GetName()); return 1; } @@ -33,9 +33,9 @@ namespace LuaBattleGround */ int GetAlivePlayersCountByTeam(lua_State* L, BattleGround* bg) { - uint32 team = Eluna::CHECKVAL(L, 2); + uint32 team = ALE::CHECKVAL(L, 2); - Eluna::Push(L, bg->GetAlivePlayersCountByTeam((TeamId)team)); + ALE::Push(L, bg->GetAlivePlayersCountByTeam((TeamId)team)); return 1; } @@ -46,7 +46,7 @@ namespace LuaBattleGround */ int GetMap(lua_State* L, BattleGround* bg) { - Eluna::Push(L, bg->GetBgMap()); + ALE::Push(L, bg->GetBgMap()); return 1; } @@ -58,9 +58,9 @@ namespace LuaBattleGround */ int GetBonusHonorFromKillCount(lua_State* L, BattleGround* bg) { - uint32 kills = Eluna::CHECKVAL(L, 2); + uint32 kills = ALE::CHECKVAL(L, 2); - Eluna::Push(L, bg->GetBonusHonorFromKill(kills)); + ALE::Push(L, bg->GetBonusHonorFromKill(kills)); return 1; } @@ -71,7 +71,7 @@ namespace LuaBattleGround */ int GetEndTime(lua_State* L, BattleGround* bg) { - Eluna::Push(L, bg->GetEndTime()); + ALE::Push(L, bg->GetEndTime()); return 1; } @@ -83,9 +83,9 @@ namespace LuaBattleGround */ int GetFreeSlotsForTeam(lua_State* L, BattleGround* bg) { - uint32 team = Eluna::CHECKVAL(L, 2); + uint32 team = ALE::CHECKVAL(L, 2); - Eluna::Push(L, bg->GetFreeSlotsForTeam((TeamId)team)); + ALE::Push(L, bg->GetFreeSlotsForTeam((TeamId)team)); return 1; } @@ -96,7 +96,7 @@ namespace LuaBattleGround */ int GetInstanceId(lua_State* L, BattleGround* bg) { - Eluna::Push(L, bg->GetInstanceID()); + ALE::Push(L, bg->GetInstanceID()); return 1; } @@ -107,7 +107,7 @@ namespace LuaBattleGround */ int GetMapId(lua_State* L, BattleGround* bg) { - Eluna::Push(L, bg->GetMapId()); + ALE::Push(L, bg->GetMapId()); return 1; } @@ -118,7 +118,7 @@ namespace LuaBattleGround */ int GetTypeId(lua_State* L, BattleGround* bg) { - Eluna::Push(L, bg->GetBgTypeID()); + ALE::Push(L, bg->GetBgTypeID()); return 1; } @@ -129,7 +129,7 @@ namespace LuaBattleGround */ int GetMaxLevel(lua_State* L, BattleGround* bg) { - Eluna::Push(L, bg->GetMaxLevel()); + ALE::Push(L, bg->GetMaxLevel()); return 1; } @@ -140,7 +140,7 @@ namespace LuaBattleGround */ int GetMinLevel(lua_State* L, BattleGround* bg) { - Eluna::Push(L, bg->GetMinLevel()); + ALE::Push(L, bg->GetMinLevel()); return 1; } @@ -151,7 +151,7 @@ namespace LuaBattleGround */ int GetMaxPlayers(lua_State* L, BattleGround* bg) { - Eluna::Push(L, bg->GetMaxPlayersPerTeam() * 2); + ALE::Push(L, bg->GetMaxPlayersPerTeam() * 2); return 1; } @@ -162,7 +162,7 @@ namespace LuaBattleGround */ int GetMinPlayers(lua_State* L, BattleGround* bg) { - Eluna::Push(L, bg->GetMaxPlayersPerTeam() * 2); + ALE::Push(L, bg->GetMaxPlayersPerTeam() * 2); return 1; } @@ -173,7 +173,7 @@ namespace LuaBattleGround */ int GetMaxPlayersPerTeam(lua_State* L, BattleGround* bg) { - Eluna::Push(L, bg->GetMaxPlayersPerTeam()); + ALE::Push(L, bg->GetMaxPlayersPerTeam()); return 1; } @@ -184,7 +184,7 @@ namespace LuaBattleGround */ int GetMinPlayersPerTeam(lua_State* L, BattleGround* bg) { - Eluna::Push(L, bg->GetMinPlayersPerTeam()); + ALE::Push(L, bg->GetMinPlayersPerTeam()); return 1; } @@ -195,7 +195,7 @@ namespace LuaBattleGround */ int GetWinner(lua_State* L, BattleGround* bg) { - Eluna::Push(L, bg->GetWinner()); + ALE::Push(L, bg->GetWinner()); return 1; } @@ -206,7 +206,7 @@ namespace LuaBattleGround */ int GetStatus(lua_State* L, BattleGround* bg) { - Eluna::Push(L, bg->GetStatus()); + ALE::Push(L, bg->GetStatus()); return 1; } }; diff --git a/src/LuaEngine/methods/ChatHandlerMethods.h b/src/LuaEngine/methods/ChatHandlerMethods.h index 4e877a6..ac6f9a2 100644 --- a/src/LuaEngine/methods/ChatHandlerMethods.h +++ b/src/LuaEngine/methods/ChatHandlerMethods.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 */ @@ -30,12 +30,12 @@ namespace LuaChatHandler { if (lua_isnumber(L, 2)) { - uint32 entry = Eluna::CHECKVAL(L, 2); + uint32 entry = ALE::CHECKVAL(L, 2); handler->SendSysMessage(entry); } else { - std::string text = Eluna::CHECKVAL(L, 2); + std::string text = ALE::CHECKVAL(L, 2); handler->SendSysMessage(text); } return 0; @@ -48,7 +48,7 @@ namespace LuaChatHandler */ int IsConsole(lua_State* L, ChatHandler* handler) { - Eluna::Push(L, handler->IsConsole()); + ALE::Push(L, handler->IsConsole()); return 1; } @@ -59,7 +59,7 @@ namespace LuaChatHandler */ int GetPlayer(lua_State* L, ChatHandler* handler) { - Eluna::Push(L, handler->GetPlayer()); + ALE::Push(L, handler->GetPlayer()); return 1; } @@ -70,7 +70,7 @@ namespace LuaChatHandler */ int SendGlobalSysMessage(lua_State* L, ChatHandler* handler) { - std::string text = Eluna::CHECKVAL(L, 2); + std::string text = ALE::CHECKVAL(L, 2); handler->SendGlobalSysMessage(text.c_str()); return 0; } @@ -82,7 +82,7 @@ namespace LuaChatHandler */ int SendGlobalGMSysMessage(lua_State* L, ChatHandler* handler) { - std::string text = Eluna::CHECKVAL(L, 2); + std::string text = ALE::CHECKVAL(L, 2); handler->SendGlobalGMSysMessage(text.c_str()); return 0; } @@ -96,9 +96,9 @@ namespace LuaChatHandler */ int HasLowerSecurity(lua_State* L, ChatHandler* handler) { - Player* player = Eluna::CHECKOBJ(L, 2); - bool strong = Eluna::CHECKVAL(L, 3); - Eluna::Push(L, handler->HasLowerSecurity(player, ObjectGuid::Empty, strong)); + Player* player = ALE::CHECKOBJ(L, 2); + bool strong = ALE::CHECKVAL(L, 3); + ALE::Push(L, handler->HasLowerSecurity(player, ObjectGuid::Empty, strong)); return 1; } @@ -111,9 +111,9 @@ namespace LuaChatHandler */ int HasLowerSecurityAccount(lua_State* L, ChatHandler* handler) { - uint32 account = Eluna::CHECKVAL(L, 2); - bool strong = Eluna::CHECKVAL(L, 3); - Eluna::Push(L, handler->HasLowerSecurityAccount(nullptr, account, strong)); + uint32 account = ALE::CHECKVAL(L, 2); + bool strong = ALE::CHECKVAL(L, 3); + ALE::Push(L, handler->HasLowerSecurityAccount(nullptr, account, strong)); return 1; } @@ -124,7 +124,7 @@ namespace LuaChatHandler */ int GetSelectedPlayer(lua_State* L, ChatHandler* handler) { - Eluna::Push(L, handler->getSelectedPlayer()); + ALE::Push(L, handler->getSelectedPlayer()); return 1; } @@ -135,7 +135,7 @@ namespace LuaChatHandler */ int GetSelectedCreature(lua_State* L, ChatHandler* handler) { - Eluna::Push(L, handler->getSelectedCreature()); + ALE::Push(L, handler->getSelectedCreature()); return 1; } @@ -146,7 +146,7 @@ namespace LuaChatHandler */ int GetSelectedUnit(lua_State* L, ChatHandler* handler) { - Eluna::Push(L, handler->getSelectedUnit()); + ALE::Push(L, handler->getSelectedUnit()); return 1; } @@ -157,7 +157,7 @@ namespace LuaChatHandler */ int GetSelectedObject(lua_State* L, ChatHandler* handler) { - Eluna::Push(L, handler->getSelectedObject()); + ALE::Push(L, handler->getSelectedObject()); return 1; } @@ -168,7 +168,7 @@ namespace LuaChatHandler */ int GetSelectedPlayerOrSelf(lua_State* L, ChatHandler* handler) { - Eluna::Push(L, handler->getSelectedPlayerOrSelf()); + ALE::Push(L, handler->getSelectedPlayerOrSelf()); return 1; } @@ -180,8 +180,8 @@ namespace LuaChatHandler */ int IsAvailable(lua_State* L, ChatHandler* handler) { - uint32 securityLevel = Eluna::CHECKVAL(L, 2); - Eluna::Push(L, handler->IsAvailable(securityLevel)); + uint32 securityLevel = ALE::CHECKVAL(L, 2); + ALE::Push(L, handler->IsAvailable(securityLevel)); return 1; } @@ -192,7 +192,7 @@ namespace LuaChatHandler */ int HasSentErrorMessage(lua_State* L, ChatHandler* handler) { - Eluna::Push(L, handler->HasSentErrorMessage()); + ALE::Push(L, handler->HasSentErrorMessage()); return 1; } } diff --git a/src/LuaEngine/methods/CorpseMethods.h b/src/LuaEngine/methods/CorpseMethods.h index b78c499..cf8f6f7 100644 --- a/src/LuaEngine/methods/CorpseMethods.h +++ b/src/LuaEngine/methods/CorpseMethods.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 */ @@ -21,7 +21,7 @@ namespace LuaCorpse */ int GetOwnerGUID(lua_State* L, Corpse* corpse) { - Eluna::Push(L, corpse->GetOwnerGUID()); + ALE::Push(L, corpse->GetOwnerGUID()); return 1; } @@ -32,7 +32,7 @@ namespace LuaCorpse */ int GetGhostTime(lua_State* L, Corpse* corpse) { - Eluna::Push(L, corpse->GetGhostTime()); + ALE::Push(L, corpse->GetGhostTime()); return 1; } @@ -50,7 +50,7 @@ namespace LuaCorpse */ int GetType(lua_State* L, Corpse* corpse) { - Eluna::Push(L, corpse->GetType()); + ALE::Push(L, corpse->GetType()); return 1; } diff --git a/src/LuaEngine/methods/CreatureMethods.h b/src/LuaEngine/methods/CreatureMethods.h index 30f1984..e0341ef 100644 --- a/src/LuaEngine/methods/CreatureMethods.h +++ b/src/LuaEngine/methods/CreatureMethods.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 */ @@ -22,7 +22,7 @@ namespace LuaCreature */ int IsRegeneratingHealth(lua_State* L, Creature* creature) { - Eluna::Push(L, creature->isRegeneratingHealth()); + ALE::Push(L, creature->isRegeneratingHealth()); return 1; } @@ -33,7 +33,7 @@ namespace LuaCreature */ int SetRegeneratingHealth(lua_State* L, Creature* creature) { - bool enable = Eluna::CHECKVAL(L, 2, true); + bool enable = ALE::CHECKVAL(L, 2, true); creature->SetRegeneratingHealth(enable); return 0; @@ -47,7 +47,7 @@ namespace LuaCreature */ int IsReputationGainDisabled(lua_State* L, Creature* creature) { - Eluna::Push(L, creature->IsReputationRewardDisabled()); + ALE::Push(L, creature->IsReputationRewardDisabled()); return 1; } @@ -60,9 +60,9 @@ namespace LuaCreature */ int CanCompleteQuest(lua_State* L, Creature* creature) { - uint32 quest_id = Eluna::CHECKVAL(L, 2); + uint32 quest_id = ALE::CHECKVAL(L, 2); - Eluna::Push(L, creature->hasInvolvedQuest(quest_id)); + ALE::Push(L, creature->hasInvolvedQuest(quest_id)); return 1; } @@ -75,9 +75,9 @@ namespace LuaCreature */ int IsTargetableForAttack(lua_State* L, Creature* creature) { - bool mustBeDead = Eluna::CHECKVAL(L, 2, false); + bool mustBeDead = ALE::CHECKVAL(L, 2, false); - Eluna::Push(L, creature->isTargetableForAttack(mustBeDead)); + ALE::Push(L, creature->isTargetableForAttack(mustBeDead)); return 1; } @@ -92,11 +92,11 @@ namespace LuaCreature */ int CanAssistTo(lua_State* L, Creature* creature) { - Unit* u = Eluna::CHECKOBJ(L, 2); - Unit* enemy = Eluna::CHECKOBJ(L, 3); - bool checkfaction = Eluna::CHECKVAL(L, 4, true); + Unit* u = ALE::CHECKOBJ(L, 2); + Unit* enemy = ALE::CHECKOBJ(L, 3); + bool checkfaction = ALE::CHECKVAL(L, 4, true); - Eluna::Push(L, creature->CanAssistTo(u, enemy, checkfaction)); + ALE::Push(L, creature->CanAssistTo(u, enemy, checkfaction)); return 1; } @@ -108,7 +108,7 @@ namespace LuaCreature */ int HasSearchedAssistance(lua_State* L, Creature* creature) { - Eluna::Push(L, creature->HasSearchedAssistance()); + ALE::Push(L, creature->HasSearchedAssistance()); return 1; } @@ -120,9 +120,9 @@ namespace LuaCreature */ int IsTappedBy(lua_State* L, Creature* creature) { - Player* player = Eluna::CHECKOBJ(L, 2); + Player* player = ALE::CHECKOBJ(L, 2); - Eluna::Push(L, creature->isTappedBy(player)); + ALE::Push(L, creature->isTappedBy(player)); return 1; } @@ -134,7 +134,7 @@ namespace LuaCreature */ int HasLootRecipient(lua_State* L, Creature* creature) { - Eluna::Push(L, creature->hasLootRecipient()); + ALE::Push(L, creature->hasLootRecipient()); return 1; } @@ -146,7 +146,7 @@ namespace LuaCreature */ int CanAggro(lua_State* L, Creature* creature) { - Eluna::Push(L, !creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC)); + ALE::Push(L, !creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC)); return 1; } @@ -158,7 +158,7 @@ namespace LuaCreature */ int CanSwim(lua_State* L, Creature* creature) { - Eluna::Push(L, creature->CanSwim()); + ALE::Push(L, creature->CanSwim()); return 1; } @@ -170,7 +170,7 @@ namespace LuaCreature */ int CanWalk(lua_State* L, Creature* creature) { - Eluna::Push(L, creature->CanWalk()); + ALE::Push(L, creature->CanWalk()); return 1; } @@ -182,7 +182,7 @@ namespace LuaCreature */ int IsInEvadeMode(lua_State* L, Creature* creature) { - Eluna::Push(L, creature->IsInEvadeMode()); + ALE::Push(L, creature->IsInEvadeMode()); return 1; } @@ -194,7 +194,7 @@ namespace LuaCreature */ int IsElite(lua_State* L, Creature* creature) { - Eluna::Push(L, creature->isElite()); + ALE::Push(L, creature->isElite()); return 1; } @@ -206,7 +206,7 @@ namespace LuaCreature */ int IsGuard(lua_State* L, Creature* creature) { - Eluna::Push(L, creature->IsGuard()); + ALE::Push(L, creature->IsGuard()); return 1; } @@ -218,7 +218,7 @@ namespace LuaCreature */ int IsCivilian(lua_State* L, Creature* creature) { - Eluna::Push(L, creature->IsCivilian()); + ALE::Push(L, creature->IsCivilian()); return 1; } @@ -230,7 +230,7 @@ namespace LuaCreature */ int IsRacialLeader(lua_State* L, Creature* creature) { - Eluna::Push(L, creature->IsRacialLeader()); + ALE::Push(L, creature->IsRacialLeader()); return 1; } @@ -242,7 +242,7 @@ namespace LuaCreature */ int IsDungeonBoss(lua_State* L, Creature* creature) { - Eluna::Push(L, creature->IsDungeonBoss()); + ALE::Push(L, creature->IsDungeonBoss()); return 1; } @@ -254,7 +254,7 @@ namespace LuaCreature */ int IsWorldBoss(lua_State* L, Creature* creature) { - Eluna::Push(L, creature->isWorldBoss()); + ALE::Push(L, creature->isWorldBoss()); return 1; } @@ -267,12 +267,12 @@ namespace LuaCreature */ int HasCategoryCooldown(lua_State* L, Creature* creature) { - uint32 spell = Eluna::CHECKVAL(L, 2); + uint32 spell = ALE::CHECKVAL(L, 2); if (const SpellInfo* info = sSpellMgr->GetSpellInfo(spell)) - Eluna::Push(L, info->GetCategory() && creature->HasSpellCooldown(spell)); + ALE::Push(L, info->GetCategory() && creature->HasSpellCooldown(spell)); else - Eluna::Push(L, false); + ALE::Push(L, false); return 1; } @@ -285,9 +285,9 @@ namespace LuaCreature */ int HasSpell(lua_State* L, Creature* creature) { - uint32 id = Eluna::CHECKVAL(L, 2); + uint32 id = ALE::CHECKVAL(L, 2); - Eluna::Push(L, creature->HasSpell(id)); + ALE::Push(L, creature->HasSpell(id)); return 1; } @@ -300,9 +300,9 @@ namespace LuaCreature */ int HasQuest(lua_State* L, Creature* creature) { - uint32 questId = Eluna::CHECKVAL(L, 2); + uint32 questId = ALE::CHECKVAL(L, 2); - Eluna::Push(L, creature->hasQuest(questId)); + ALE::Push(L, creature->hasQuest(questId)); return 1; } @@ -315,9 +315,9 @@ namespace LuaCreature */ int HasSpellCooldown(lua_State* L, Creature* creature) { - uint32 spellId = Eluna::CHECKVAL(L, 2); + uint32 spellId = ALE::CHECKVAL(L, 2); - Eluna::Push(L, creature->HasSpellCooldown(spellId)); + ALE::Push(L, creature->HasSpellCooldown(spellId)); return 1; } @@ -329,7 +329,7 @@ namespace LuaCreature */ int CanFly(lua_State* L, Creature* creature) { - Eluna::Push(L, creature->CanFly()); + ALE::Push(L, creature->CanFly()); return 1; } @@ -341,7 +341,7 @@ namespace LuaCreature */ int IsTrigger(lua_State* L, Creature* creature) { - Eluna::Push(L, creature->IsTrigger()); + ALE::Push(L, creature->IsTrigger()); return 1; } @@ -352,7 +352,7 @@ namespace LuaCreature */ int IsDamageEnoughForLootingAndReward(lua_State* L, Creature* creature) { - Eluna::Push(L, creature->IsDamageEnoughForLootingAndReward()); + ALE::Push(L, creature->IsDamageEnoughForLootingAndReward()); return 1; } @@ -366,9 +366,9 @@ namespace LuaCreature */ int CanStartAttack(lua_State* L, Creature* creature) // TODO: Implement core side { - Unit* target = Eluna::CHECKOBJ(L, 2); + Unit* target = ALE::CHECKOBJ(L, 2); - Eluna::Push(L, creature->CanStartAttack(target)); + ALE::Push(L, creature->CanStartAttack(target)); return 1; } @@ -380,9 +380,9 @@ namespace LuaCreature */ int HasLootMode(lua_State* L, Creature* creature) // TODO: Implement LootMode features { - uint16 lootMode = Eluna::CHECKVAL(L, 2); + uint16 lootMode = ALE::CHECKVAL(L, 2); - Eluna::Push(L, creature->HasLootMode(lootMode)); + ALE::Push(L, creature->HasLootMode(lootMode)); return 1; } @@ -396,7 +396,7 @@ namespace LuaCreature */ int GetRespawnDelay(lua_State* L, Creature* creature) { - Eluna::Push(L, creature->GetRespawnDelay()); + ALE::Push(L, creature->GetRespawnDelay()); return 1; } @@ -408,7 +408,7 @@ namespace LuaCreature */ int GetWanderRadius(lua_State* L, Creature* creature) { - Eluna::Push(L, creature->GetWanderDistance()); + ALE::Push(L, creature->GetWanderDistance()); return 1; } @@ -419,7 +419,7 @@ namespace LuaCreature */ int GetWaypointPath(lua_State* L, Creature* creature) { - Eluna::Push(L, creature->GetWaypointPath()); + ALE::Push(L, creature->GetWaypointPath()); return 1; } @@ -430,7 +430,7 @@ namespace LuaCreature */ int GetCurrentWaypointId(lua_State* L, Creature* creature) { - Eluna::Push(L, creature->GetCurrentWaypointID()); + ALE::Push(L, creature->GetCurrentWaypointID()); return 1; } @@ -441,7 +441,7 @@ namespace LuaCreature */ int GetSpawnId(lua_State* L, Creature* creature) { - Eluna::Push(L, creature->GetSpawnId()); + ALE::Push(L, creature->GetSpawnId()); return 1; } @@ -452,7 +452,7 @@ namespace LuaCreature */ int GetDefaultMovementType(lua_State* L, Creature* creature) { - Eluna::Push(L, creature->GetDefaultMovementType()); + ALE::Push(L, creature->GetDefaultMovementType()); return 1; } @@ -464,9 +464,9 @@ namespace LuaCreature */ int GetAggroRange(lua_State* L, Creature* creature) { - Unit* target = Eluna::CHECKOBJ(L, 2); + Unit* target = ALE::CHECKOBJ(L, 2); - Eluna::Push(L, creature->GetAggroRange(target)); + ALE::Push(L, creature->GetAggroRange(target)); return 1; } @@ -477,7 +477,7 @@ namespace LuaCreature */ int GetLootRecipientGroup(lua_State* L, Creature* creature) { - Eluna::Push(L, creature->GetLootRecipientGroup()); + ALE::Push(L, creature->GetLootRecipientGroup()); return 1; } @@ -488,7 +488,7 @@ namespace LuaCreature */ int GetLootRecipient(lua_State* L, Creature* creature) { - Eluna::Push(L, creature->GetLootRecipient()); + ALE::Push(L, creature->GetLootRecipient()); return 1; } @@ -497,13 +497,13 @@ namespace LuaCreature * * This is used by the core to apply C++ scripts to the Creature. * - * It is not used by Eluna. Eluna will override AI scripts. + * It is not used by ALE. ALE will override AI scripts. * * @return string scriptName */ int GetScriptName(lua_State* L, Creature* creature) { - Eluna::Push(L, creature->GetScriptName()); + ALE::Push(L, creature->GetScriptName()); return 1; } @@ -512,13 +512,13 @@ namespace LuaCreature * * This is used by the core to assign the Creature's default AI. * - * If the Creature is scripted by Eluna, the AI is overriden. + * If the Creature is scripted by ALE, the AI is overriden. * * @return string AIName */ int GetAIName(lua_State* L, Creature* creature) { - Eluna::Push(L, creature->GetAIName()); + ALE::Push(L, creature->GetAIName()); return 1; } @@ -532,7 +532,7 @@ namespace LuaCreature */ int GetScriptId(lua_State* L, Creature* creature) { - Eluna::Push(L, creature->GetScriptId()); + ALE::Push(L, creature->GetScriptId()); return 1; } @@ -544,12 +544,12 @@ namespace LuaCreature */ int GetCreatureSpellCooldownDelay(lua_State* L, Creature* creature) { - uint32 spell = Eluna::CHECKVAL(L, 2); + uint32 spell = ALE::CHECKVAL(L, 2); if (sSpellMgr->GetSpellInfo(spell)) - Eluna::Push(L, creature->GetSpellCooldown(spell)); + ALE::Push(L, creature->GetSpellCooldown(spell)); else - Eluna::Push(L, 0); + ALE::Push(L, 0); return 1; } @@ -561,7 +561,7 @@ namespace LuaCreature */ int GetCorpseDelay(lua_State* L, Creature* creature) { - Eluna::Push(L, creature->GetCorpseDelay()); + ALE::Push(L, creature->GetCorpseDelay()); return 1; } @@ -579,10 +579,10 @@ namespace LuaCreature float x, y, z, o; creature->GetHomePosition(x, y, z, o); - Eluna::Push(L, x); - Eluna::Push(L, y); - Eluna::Push(L, z); - Eluna::Push(L, o); + ALE::Push(L, x); + ALE::Push(L, y); + ALE::Push(L, z); + ALE::Push(L, o); return 4; } @@ -597,10 +597,10 @@ namespace LuaCreature */ int SetHomePosition(lua_State* L, Creature* creature) { - float x = Eluna::CHECKVAL(L, 2); - float y = Eluna::CHECKVAL(L, 3); - float z = Eluna::CHECKVAL(L, 4); - float o = Eluna::CHECKVAL(L, 5); + float x = ALE::CHECKVAL(L, 2); + float y = ALE::CHECKVAL(L, 3); + float z = ALE::CHECKVAL(L, 4); + float o = ALE::CHECKVAL(L, 5); creature->SetHomePosition(x, y, z, o); return 0; @@ -643,11 +643,11 @@ namespace LuaCreature */ int GetAITarget(lua_State* L, Creature* creature) { - uint32 targetType = Eluna::CHECKVAL(L, 2); - bool playerOnly = Eluna::CHECKVAL(L, 3, false); - uint32 position = Eluna::CHECKVAL(L, 4, 0); - float dist = Eluna::CHECKVAL(L, 5, 0.0f); - int32 aura = Eluna::CHECKVAL(L, 6, 0); + uint32 targetType = ALE::CHECKVAL(L, 2); + bool playerOnly = ALE::CHECKVAL(L, 3, false); + uint32 position = ALE::CHECKVAL(L, 4, 0); + float dist = ALE::CHECKVAL(L, 5, 0.0f); + int32 aura = ALE::CHECKVAL(L, 6, 0); auto const& threatlist = creature->GetThreatMgr().GetThreatList(); @@ -683,7 +683,7 @@ namespace LuaCreature return 1; if (targetType == SELECT_TARGET_NEAREST || targetType == SELECT_TARGET_FARTHEST) - targetList.sort(ElunaUtil::ObjectDistanceOrderPred(creature)); + targetList.sort(ALEUtil::ObjectDistanceOrderPred(creature)); switch (targetType) { @@ -693,7 +693,7 @@ namespace LuaCreature std::list::const_iterator itr = targetList.begin(); if (position) std::advance(itr, position); - Eluna::Push(L, *itr); + ALE::Push(L, *itr); } break; case SELECT_TARGET_FARTHEST: @@ -702,7 +702,7 @@ namespace LuaCreature std::list::reverse_iterator ritr = targetList.rbegin(); if (position) std::advance(ritr, position); - Eluna::Push(L, *ritr); + ALE::Push(L, *ritr); } break; case SELECT_TARGET_RANDOM: @@ -712,7 +712,7 @@ namespace LuaCreature std::advance(itr, urand(0, position)); else std::advance(itr, urand(0, targetList.size() - 1)); - Eluna::Push(L, *itr); + ALE::Push(L, *itr); } break; default: @@ -742,7 +742,7 @@ namespace LuaCreature if (!target) continue; - Eluna::Push(L, target); + ALE::Push(L, target); lua_rawseti(L, tbl, ++i); } @@ -757,7 +757,7 @@ namespace LuaCreature */ int GetAITargetsCount(lua_State* L, Creature* creature) { - Eluna::Push(L, creature->GetThreatMgr().GetThreatListSize()); + ALE::Push(L, creature->GetThreatMgr().GetThreatListSize()); return 1; } @@ -771,7 +771,7 @@ namespace LuaCreature */ int GetNPCFlags(lua_State* L, Creature* creature) { - Eluna::Push(L, creature->GetUInt32Value(UNIT_NPC_FLAGS)); + ALE::Push(L, creature->GetUInt32Value(UNIT_NPC_FLAGS)); return 1; } @@ -784,7 +784,7 @@ namespace LuaCreature */ int GetUnitFlags(lua_State* L, Creature* creature) { - Eluna::Push(L, creature->GetUInt32Value(UNIT_FIELD_FLAGS)); + ALE::Push(L, creature->GetUInt32Value(UNIT_FIELD_FLAGS)); return 1; } @@ -795,7 +795,7 @@ namespace LuaCreature */ int GetUnitFlagsTwo(lua_State* L, Creature* creature) { - Eluna::Push(L, creature->GetUInt32Value(UNIT_FIELD_FLAGS_2)); + ALE::Push(L, creature->GetUInt32Value(UNIT_FIELD_FLAGS_2)); return 1; } @@ -809,7 +809,7 @@ namespace LuaCreature */ int GetExtraFlags(lua_State* L, Creature* creature) { - Eluna::Push(L, creature->GetCreatureTemplate()->flags_extra); + ALE::Push(L, creature->GetCreatureTemplate()->flags_extra); return 1; } @@ -820,7 +820,7 @@ namespace LuaCreature */ int GetRank(lua_State* L, Creature* creature) { - Eluna::Push(L, creature->GetCreatureTemplate()->rank); + ALE::Push(L, creature->GetCreatureTemplate()->rank); return 1; } @@ -831,7 +831,7 @@ namespace LuaCreature */ int GetShieldBlockValue(lua_State* L, Creature* creature) { - Eluna::Push(L, creature->GetShieldBlockValue()); + ALE::Push(L, creature->GetShieldBlockValue()); return 1; } @@ -843,7 +843,7 @@ namespace LuaCreature */ int GetLootMode(lua_State* L, Creature* creature) // TODO: Implement LootMode features { - Eluna::Push(L, creature->GetLootMode()); + ALE::Push(L, creature->GetLootMode()); return 1; } @@ -854,7 +854,7 @@ namespace LuaCreature */ int GetDBTableGUIDLow(lua_State* L, Creature* creature) { - Eluna::Push(L, creature->GetSpawnId()); + ALE::Push(L, creature->GetSpawnId()); return 1; } @@ -886,7 +886,7 @@ namespace LuaCreature */ int SetNPCFlags(lua_State* L, Creature* creature) { - uint32 flags = Eluna::CHECKVAL(L, 2); + uint32 flags = ALE::CHECKVAL(L, 2); creature->SetUInt32Value(UNIT_NPC_FLAGS, flags); return 0; @@ -899,7 +899,7 @@ namespace LuaCreature */ int SetUnitFlags(lua_State* L, Creature* creature) { - uint32 flags = Eluna::CHECKVAL(L, 2); + uint32 flags = ALE::CHECKVAL(L, 2); creature->SetUInt32Value(UNIT_FIELD_FLAGS, flags); return 0; } @@ -911,7 +911,7 @@ namespace LuaCreature */ int SetUnitFlagsTwo(lua_State* L, Creature* creature) { - uint32 flags = Eluna::CHECKVAL(L, 2); + uint32 flags = ALE::CHECKVAL(L, 2); creature->SetUInt32Value(UNIT_FIELD_FLAGS_2, flags); return 0; } @@ -923,7 +923,7 @@ namespace LuaCreature */ int SetReactState(lua_State* L, Creature* creature) { - uint32 state = Eluna::CHECKVAL(L, 2); + uint32 state = ALE::CHECKVAL(L, 2); creature->SetReactState((ReactStates)state); return 0; @@ -936,7 +936,7 @@ namespace LuaCreature */ int SetDisableGravity(lua_State* L, Creature* creature) { - bool disable = Eluna::CHECKVAL(L, 2); + bool disable = ALE::CHECKVAL(L, 2); creature->SetDisableGravity(disable); return 0; @@ -950,7 +950,7 @@ namespace LuaCreature */ int SetLootMode(lua_State* L, Creature* creature) // TODO: Implement LootMode features { - uint16 lootMode = Eluna::CHECKVAL(L, 2); + uint16 lootMode = ALE::CHECKVAL(L, 2); creature->SetLootMode(lootMode); return 0; @@ -963,7 +963,7 @@ namespace LuaCreature */ int SetDeathState(lua_State* L, Creature* creature) { - int32 state = Eluna::CHECKVAL(L, 2); + int32 state = ALE::CHECKVAL(L, 2); creature->setDeathState((DeathState)state); return 0; @@ -976,7 +976,7 @@ namespace LuaCreature */ int SetWalk(lua_State* L, Creature* creature) // TODO: Move same to Player ? { - bool enable = Eluna::CHECKVAL(L, 2, true); + bool enable = ALE::CHECKVAL(L, 2, true); creature->SetWalk(enable); return 0; @@ -991,9 +991,9 @@ namespace LuaCreature */ int SetEquipmentSlots(lua_State* L, Creature* creature) { - uint32 main_hand = Eluna::CHECKVAL(L, 2); - uint32 off_hand = Eluna::CHECKVAL(L, 3); - uint32 ranged = Eluna::CHECKVAL(L, 4); + uint32 main_hand = ALE::CHECKVAL(L, 2); + uint32 off_hand = ALE::CHECKVAL(L, 3); + uint32 ranged = ALE::CHECKVAL(L, 4); creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, main_hand); creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, off_hand); @@ -1009,7 +1009,7 @@ namespace LuaCreature */ int SetAggroEnabled(lua_State* L, Creature* creature) { - bool allow = Eluna::CHECKVAL(L, 2, true); + bool allow = ALE::CHECKVAL(L, 2, true); if (allow) creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); @@ -1026,7 +1026,7 @@ namespace LuaCreature */ int SetDisableReputationGain(lua_State* L, Creature* creature) { - bool disable = Eluna::CHECKVAL(L, 2, true); + bool disable = ALE::CHECKVAL(L, 2, true); creature->SetReputationRewardDisabled(disable); return 0; @@ -1053,7 +1053,7 @@ namespace LuaCreature */ int SetWanderRadius(lua_State* L, Creature* creature) { - float dist = Eluna::CHECKVAL(L, 2); + float dist = ALE::CHECKVAL(L, 2); creature->SetWanderDistance(dist); @@ -1067,7 +1067,7 @@ namespace LuaCreature */ int SetRespawnDelay(lua_State* L, Creature* creature) { - uint32 delay = Eluna::CHECKVAL(L, 2); + uint32 delay = ALE::CHECKVAL(L, 2); creature->SetRespawnDelay(delay); return 0; @@ -1080,7 +1080,7 @@ namespace LuaCreature */ int SetDefaultMovementType(lua_State* L, Creature* creature) { - int32 type = Eluna::CHECKVAL(L, 2); + int32 type = ALE::CHECKVAL(L, 2); creature->SetDefaultMovementType((MovementGeneratorType)type); return 0; @@ -1093,7 +1093,7 @@ namespace LuaCreature */ int SetNoSearchAssistance(lua_State* L, Creature* creature) { - bool val = Eluna::CHECKVAL(L, 2, true); + bool val = ALE::CHECKVAL(L, 2, true); creature->SetNoSearchAssistance(val); return 0; @@ -1106,7 +1106,7 @@ namespace LuaCreature */ int SetNoCallAssistance(lua_State* L, Creature* creature) { - bool val = Eluna::CHECKVAL(L, 2, true); + bool val = ALE::CHECKVAL(L, 2, true); creature->SetNoCallAssistance(val); return 0; @@ -1119,7 +1119,7 @@ namespace LuaCreature */ int SetHover(lua_State* L, Creature* creature) { - bool enable = Eluna::CHECKVAL(L, 2, true); + bool enable = ALE::CHECKVAL(L, 2, true); creature->SetHover(enable); @@ -1133,7 +1133,7 @@ namespace LuaCreature */ int DespawnOrUnsummon(lua_State* L, Creature* creature) { - uint32 msTimeToDespawn = Eluna::CHECKVAL(L, 2, 0); + uint32 msTimeToDespawn = ALE::CHECKVAL(L, 2, 0); creature->DespawnOrUnsummon(Milliseconds(msTimeToDespawn)); return 0; @@ -1164,7 +1164,7 @@ namespace LuaCreature */ int SetCorpseDelay(lua_State* L, Creature* creature) { - uint32 delay = Eluna::CHECKVAL(L, 2); + uint32 delay = ALE::CHECKVAL(L, 2); creature->SetCorpseDelay(delay); return 0; } @@ -1195,7 +1195,7 @@ namespace LuaCreature */ int CallForHelp(lua_State* L, Creature* creature) { - float radius = Eluna::CHECKVAL(L, 2); + float radius = ALE::CHECKVAL(L, 2); creature->CallForHelp(radius); return 0; @@ -1217,7 +1217,7 @@ namespace LuaCreature */ int AttackStart(lua_State* L, Creature* creature) { - Unit* target = Eluna::CHECKOBJ(L, 2); + Unit* target = ALE::CHECKOBJ(L, 2); creature->AI()->AttackStart(target); return 0; @@ -1239,7 +1239,7 @@ namespace LuaCreature */ int SelectVictim(lua_State* L, Creature* creature) { - Eluna::Push(L, creature->SelectVictim()); + ALE::Push(L, creature->SelectVictim()); return 1; } @@ -1251,8 +1251,8 @@ namespace LuaCreature */ int UpdateEntry(lua_State* L, Creature* creature) { - uint32 entry = Eluna::CHECKVAL(L, 2); - uint32 dataGuidLow = Eluna::CHECKVAL(L, 3, 0); + uint32 entry = ALE::CHECKVAL(L, 2); + uint32 dataGuidLow = ALE::CHECKVAL(L, 3, 0); creature->UpdateEntry(entry, dataGuidLow ? eObjectMgr->GetCreatureData(dataGuidLow) : NULL); return 0; @@ -1274,7 +1274,7 @@ namespace LuaCreature */ int RemoveLootMode(lua_State* L, Creature* creature) // TODO: Implement LootMode features { - uint16 lootMode = Eluna::CHECKVAL(L, 2); + uint16 lootMode = ALE::CHECKVAL(L, 2); creature->RemoveLootMode(lootMode); return 0; @@ -1287,7 +1287,7 @@ namespace LuaCreature */ int AddLootMode(lua_State* L, Creature* creature) // TODO: Implement LootMode features { - uint16 lootMode = Eluna::CHECKVAL(L, 2); + uint16 lootMode = ALE::CHECKVAL(L, 2); creature->AddLootMode(lootMode); return 0; @@ -1353,7 +1353,7 @@ namespace LuaCreature CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(entry); if (cInfo) - Eluna::Push(L, cInfo->family); + ALE::Push(L, cInfo->family); return 1; } @@ -1363,9 +1363,9 @@ namespace LuaCreature * * @return [Loot] loot : the loot object */ - int GetLoot(lua_State*L, Creature* creature) + int GetLoot(lua_State* L, Creature* creature) { - Eluna::Push(L, &creature->loot); + ALE::Push(L, &creature->loot); return 1; } }; diff --git a/src/LuaEngine/methods/GameObjectMethods.h b/src/LuaEngine/methods/GameObjectMethods.h index 98efedf..43e8ffd 100644 --- a/src/LuaEngine/methods/GameObjectMethods.h +++ b/src/LuaEngine/methods/GameObjectMethods.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 */ @@ -22,9 +22,9 @@ namespace LuaGameObject */ int HasQuest(lua_State* L, GameObject* go) { - uint32 questId = Eluna::CHECKVAL(L, 2); + uint32 questId = ALE::CHECKVAL(L, 2); - Eluna::Push(L, go->hasQuest(questId)); + ALE::Push(L, go->hasQuest(questId)); return 1; } @@ -35,7 +35,7 @@ namespace LuaGameObject */ int IsSpawned(lua_State* L, GameObject* go) { - Eluna::Push(L, go->isSpawned()); + ALE::Push(L, go->isSpawned()); return 1; } @@ -46,7 +46,7 @@ namespace LuaGameObject */ int IsTransport(lua_State* L, GameObject* go) { - Eluna::Push(L, go->IsTransport()); + ALE::Push(L, go->IsTransport()); return 1; } @@ -57,13 +57,13 @@ namespace LuaGameObject */ int IsActive(lua_State* L, GameObject* go) { - Eluna::Push(L, go->isActiveObject()); + ALE::Push(L, go->isActiveObject()); return 1; } /*int IsDestructible(lua_State* L, GameObject* go) // TODO: Implementation core side { - Eluna::Push(L, go->IsDestructibleBuilding()); + ALE::Push(L, go->IsDestructibleBuilding()); return 1; }*/ @@ -74,7 +74,7 @@ namespace LuaGameObject */ int GetDisplayId(lua_State* L, GameObject* go) { - Eluna::Push(L, go->GetDisplayId()); + ALE::Push(L, go->GetDisplayId()); return 1; } @@ -95,7 +95,7 @@ namespace LuaGameObject */ int GetGoState(lua_State* L, GameObject* go) { - Eluna::Push(L, go->GetGoState()); + ALE::Push(L, go->GetGoState()); return 1; } @@ -117,7 +117,7 @@ namespace LuaGameObject */ int GetLootState(lua_State* L, GameObject* go) { - Eluna::Push(L, go->getLootState()); + ALE::Push(L, go->getLootState()); return 1; } @@ -130,7 +130,7 @@ namespace LuaGameObject */ int GetLootRecipient(lua_State* L, GameObject* go) { - Eluna::Push(L, go->GetLootRecipient()); + ALE::Push(L, go->GetLootRecipient()); return 1; } @@ -143,7 +143,7 @@ namespace LuaGameObject */ int GetLootRecipientGroup(lua_State* L, GameObject* go) { - Eluna::Push(L, go->GetLootRecipientGroup()); + ALE::Push(L, go->GetLootRecipientGroup()); return 1; } @@ -154,7 +154,7 @@ namespace LuaGameObject */ int GetSpawnId(lua_State* L, GameObject* go) { - Eluna::Push(L, go->GetSpawnId()); + ALE::Push(L, go->GetSpawnId()); return 1; } @@ -174,7 +174,7 @@ namespace LuaGameObject */ int SetGoState(lua_State* L, GameObject* go) { - uint32 state = Eluna::CHECKVAL(L, 2, 0); + uint32 state = ALE::CHECKVAL(L, 2, 0); if (state == 0) go->SetGoState(GO_STATE_ACTIVE); @@ -204,7 +204,7 @@ namespace LuaGameObject */ int SetLootState(lua_State* L, GameObject* go) { - uint32 state = Eluna::CHECKVAL(L, 2, 0); + uint32 state = ALE::CHECKVAL(L, 2, 0); if (state == 0) go->SetLootState(GO_NOT_READY); @@ -236,8 +236,8 @@ namespace LuaGameObject uint8 addedItems = 0; while (i + 2 <= argAmount) { - uint32 entry = Eluna::CHECKVAL(L, ++i); - uint32 amount = Eluna::CHECKVAL(L, ++i); + uint32 entry = ALE::CHECKVAL(L, ++i); + uint32 amount = ALE::CHECKVAL(L, ++i); ItemTemplate const* item_proto = eObjectMgr->GetItemTemplate(entry); if (!item_proto) @@ -255,7 +255,7 @@ namespace LuaGameObject item->SaveToDB(trans); LootStoreItem storeItem(item->GetEntry(), 0, 100, 0, LOOT_MODE_DEFAULT, 0, item->GetCount(), item->GetCount()); go->loot.AddItem(storeItem); - Eluna::Push(L, item->GetGUID().GetCounter()); + ALE::Push(L, item->GetGUID().GetCounter()); ++addedItems; } } @@ -284,7 +284,7 @@ namespace LuaGameObject */ int RemoveFromWorld(lua_State* L, GameObject* go) { - bool deldb = Eluna::CHECKVAL(L, 2, false); + bool deldb = ALE::CHECKVAL(L, 2, false); // cs_gobject.cpp copy paste ObjectGuid ownerGuid = go->GetOwnerGUID(); @@ -303,7 +303,7 @@ namespace LuaGameObject go->SetRespawnTime(0); go->Delete(); - Eluna::CHECKOBJ(L, 1)->Invalidate(); + ALE::CHECKOBJ(L, 1)->Invalidate(); return 0; } @@ -314,7 +314,7 @@ namespace LuaGameObject */ int UseDoorOrButton(lua_State* L, GameObject* go) { - uint32 delay = Eluna::CHECKVAL(L, 2, 0); + uint32 delay = ALE::CHECKVAL(L, 2, 0); go->UseDoorOrButton(delay); return 0; @@ -349,7 +349,7 @@ namespace LuaGameObject */ int SetRespawnTime(lua_State* L, GameObject* go) { - int32 respawn = Eluna::CHECKVAL(L, 2); + int32 respawn = ALE::CHECKVAL(L, 2); go->SetRespawnTime(respawn); return 0; @@ -364,7 +364,7 @@ namespace LuaGameObject */ int SetRespawnDelay(lua_State* L, GameObject* go) { - int32 respawn = Eluna::CHECKVAL(L, 2); + int32 respawn = ALE::CHECKVAL(L, 2); go->SetRespawnDelay(respawn); return 0; diff --git a/src/LuaEngine/methods/GemPropertiesEntryMethods.h b/src/LuaEngine/methods/GemPropertiesEntryMethods.h index 17979a2..b76edae 100644 --- a/src/LuaEngine/methods/GemPropertiesEntryMethods.h +++ b/src/LuaEngine/methods/GemPropertiesEntryMethods.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 */ @@ -27,7 +27,7 @@ namespace LuaGemPropertiesEntry */ int GetId(lua_State* L, GemPropertiesEntry* gemProperties) { - Eluna::Push(L, gemProperties->ID); + ALE::Push(L, gemProperties->ID); return 1; } @@ -40,7 +40,7 @@ namespace LuaGemPropertiesEntry */ int GetSpellItemEnchantement(lua_State* L, GemPropertiesEntry* entry) { - Eluna::Push(L, entry->spellitemenchantement); + ALE::Push(L, entry->spellitemenchantement); return 1; } } diff --git a/src/LuaEngine/methods/GlobalMethods.h b/src/LuaEngine/methods/GlobalMethods.h index 46dfdc1..40bf84c 100644 --- a/src/LuaEngine/methods/GlobalMethods.h +++ b/src/LuaEngine/methods/GlobalMethods.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 GLOBALMETHODS_H #include "BindingMap.h" -#include "ElunaDBCRegistry.h" +#include "ALEDBCRegistry.h" #include "BanMgr.h" #include "GameTime.h" @@ -32,13 +32,13 @@ namespace LuaGlobalFunctions /** * Returns Lua engine's name. * - * Always returns "ElunaEngine" on Eluna. + * Always returns "ALEEngine" on ALE. * * @return string engineName */ int GetLuaEngine(lua_State* L) { - Eluna::Push(L, "ElunaEngine"); + ALE::Push(L, "ALEEngine"); return 1; } @@ -51,7 +51,7 @@ namespace LuaGlobalFunctions */ int GetCoreName(lua_State* L) { - Eluna::Push(L, CORE_NAME); + ALE::Push(L, CORE_NAME); return 1; } @@ -63,14 +63,14 @@ namespace LuaGlobalFunctions */ int GetConfigValue(lua_State* L) { - const char* key = Eluna::CHECKVAL(L, 1); + const char* key = ALE::CHECKVAL(L, 1); if (!key) return 0; std::string val = sConfigMgr->GetOption(key, "", false); if (val.empty()) { - Eluna::Push(L, val); + ALE::Push(L, val); return 1; } @@ -79,22 +79,22 @@ namespace LuaGlobalFunctions if (lower == "true") { - Eluna::Push(L, true); + ALE::Push(L, true); return 1; } else if (lower == "false") { - Eluna::Push(L, false); + ALE::Push(L, false); return 1; } auto intVal = Acore::StringTo(val); if (intVal) { - Eluna::Push(L, *intVal); + ALE::Push(L, *intVal); return 1; } - Eluna::Push(L, val); + ALE::Push(L, val); return 1; } @@ -107,7 +107,7 @@ namespace LuaGlobalFunctions */ int GetRealmID(lua_State* L) { - Eluna::Push(L, sConfigMgr->GetOption("RealmID", 1)); + ALE::Push(L, sConfigMgr->GetOption("RealmID", 1)); return 1; } @@ -122,7 +122,7 @@ namespace LuaGlobalFunctions */ int GetCoreVersion(lua_State* L) { - Eluna::Push(L, CORE_VERSION); + ALE::Push(L, CORE_VERSION); return 1; } @@ -135,7 +135,7 @@ namespace LuaGlobalFunctions */ int GetCoreExpansion(lua_State* L) { - Eluna::Push(L, 2); + ALE::Push(L, 2); return 1; } @@ -147,7 +147,7 @@ namespace LuaGlobalFunctions int GetStateMap(lua_State* L) { // Until AC supports multistate, this will always return nil - Eluna::Push(L); + ALE::Push(L); return 1; } @@ -159,7 +159,7 @@ namespace LuaGlobalFunctions int GetStateMapId(lua_State* L) { // Until AC supports multistate, this will always return -1 - Eluna::Push(L, -1); + ALE::Push(L, -1); return 1; } @@ -171,7 +171,7 @@ namespace LuaGlobalFunctions int GetStateInstanceId(lua_State* L) { // Until AC supports multistate, this will always return 0 - Eluna::Push(L, 0); + ALE::Push(L, 0); return 1; } @@ -183,9 +183,9 @@ namespace LuaGlobalFunctions */ int GetQuest(lua_State* L) { - uint32 questId = Eluna::CHECKVAL(L, 1); + uint32 questId = ALE::CHECKVAL(L, 1); - Eluna::Push(L, eObjectMgr->GetQuestTemplate(questId)); + ALE::Push(L, eObjectMgr->GetQuestTemplate(questId)); return 1; } @@ -197,8 +197,8 @@ namespace LuaGlobalFunctions */ int GetPlayerByGUID(lua_State* L) { - ObjectGuid guid = Eluna::CHECKVAL(L, 1); - Eluna::Push(L, eObjectAccessor()FindPlayer(guid)); + ObjectGuid guid = ALE::CHECKVAL(L, 1); + ALE::Push(L, eObjectAccessor()FindPlayer(guid)); return 1; } @@ -210,8 +210,8 @@ namespace LuaGlobalFunctions */ int GetPlayerByName(lua_State* L) { - const char* name = Eluna::CHECKVAL(L, 1); - Eluna::Push(L, eObjectAccessor()FindPlayerByName(name)); + const char* name = ALE::CHECKVAL(L, 1); + ALE::Push(L, eObjectAccessor()FindPlayerByName(name)); return 1; } @@ -222,7 +222,7 @@ namespace LuaGlobalFunctions */ int GetGameTime(lua_State* L) { - Eluna::Push(L, GameTime::GetGameTime().count()); + ALE::Push(L, GameTime::GetGameTime().count()); return 1; } @@ -244,8 +244,8 @@ namespace LuaGlobalFunctions */ int GetPlayersInWorld(lua_State* L) { - uint32 team = Eluna::CHECKVAL(L, 1, TEAM_NEUTRAL); - bool onlyGM = Eluna::CHECKVAL(L, 2, false); + uint32 team = ALE::CHECKVAL(L, 1, TEAM_NEUTRAL); + bool onlyGM = ALE::CHECKVAL(L, 2, false); lua_newtable(L); int tbl = lua_gettop(L); @@ -263,7 +263,7 @@ namespace LuaGlobalFunctions if ((team == TEAM_NEUTRAL || player->GetTeamId() == team) && (!onlyGM || player->IsGameMaster())) { - Eluna::Push(L, player); + ALE::Push(L, player); lua_rawseti(L, tbl, ++i); } } @@ -282,8 +282,8 @@ namespace LuaGlobalFunctions */ int GetGuildByName(lua_State* L) { - const char* name = Eluna::CHECKVAL(L, 1); - Eluna::Push(L, eGuildMgr->GetGuildByName(name)); + const char* name = ALE::CHECKVAL(L, 1); + ALE::Push(L, eGuildMgr->GetGuildByName(name)); return 1; } @@ -296,10 +296,10 @@ namespace LuaGlobalFunctions */ int GetMapById(lua_State* L) { - uint32 mapid = Eluna::CHECKVAL(L, 1); - uint32 instance = Eluna::CHECKVAL(L, 2, 0); + uint32 mapid = ALE::CHECKVAL(L, 1); + uint32 instance = ALE::CHECKVAL(L, 2, 0); - Eluna::Push(L, eMapMgr->FindMap(mapid, instance)); + ALE::Push(L, eMapMgr->FindMap(mapid, instance)); return 1; } @@ -311,9 +311,9 @@ namespace LuaGlobalFunctions */ int GetGuildByLeaderGUID(lua_State* L) { - ObjectGuid guid = Eluna::CHECKVAL(L, 1); + ObjectGuid guid = ALE::CHECKVAL(L, 1); - Eluna::Push(L, eGuildMgr->GetGuildByLeader(guid)); + ALE::Push(L, eGuildMgr->GetGuildByLeader(guid)); return 1; } @@ -324,7 +324,7 @@ namespace LuaGlobalFunctions */ int GetPlayerCount(lua_State* L) { - Eluna::Push(L, eWorldSessionMgr->GetActiveSessionCount()); + ALE::Push(L, eWorldSessionMgr->GetActiveSessionCount()); return 1; } @@ -340,8 +340,8 @@ namespace LuaGlobalFunctions */ int GetPlayerGUID(lua_State* L) { - uint32 lowguid = Eluna::CHECKVAL(L, 1); - Eluna::Push(L, MAKE_NEW_GUID(lowguid, 0, HIGHGUID_PLAYER)); + uint32 lowguid = ALE::CHECKVAL(L, 1); + ALE::Push(L, MAKE_NEW_GUID(lowguid, 0, HIGHGUID_PLAYER)); return 1; } @@ -356,8 +356,8 @@ namespace LuaGlobalFunctions */ int GetItemGUID(lua_State* L) { - uint32 lowguid = Eluna::CHECKVAL(L, 1); - Eluna::Push(L, MAKE_NEW_GUID(lowguid, 0, HIGHGUID_ITEM)); + uint32 lowguid = ALE::CHECKVAL(L, 1); + ALE::Push(L, MAKE_NEW_GUID(lowguid, 0, HIGHGUID_ITEM)); return 1; } @@ -369,8 +369,8 @@ namespace LuaGlobalFunctions */ int GetItemTemplate(lua_State* L) { - uint32 entry = Eluna::CHECKVAL(L, 1); - Eluna::Push(L, eObjectMgr->GetItemTemplate(entry)); + uint32 entry = ALE::CHECKVAL(L, 1); + ALE::Push(L, eObjectMgr->GetItemTemplate(entry)); return 1; } @@ -387,9 +387,9 @@ namespace LuaGlobalFunctions */ int GetObjectGUID(lua_State* L) { - uint32 lowguid = Eluna::CHECKVAL(L, 1); - uint32 entry = Eluna::CHECKVAL(L, 2); - Eluna::Push(L, MAKE_NEW_GUID(lowguid, entry, HIGHGUID_GAMEOBJECT)); + uint32 lowguid = ALE::CHECKVAL(L, 1); + uint32 entry = ALE::CHECKVAL(L, 2); + ALE::Push(L, MAKE_NEW_GUID(lowguid, entry, HIGHGUID_GAMEOBJECT)); return 1; } @@ -406,9 +406,9 @@ namespace LuaGlobalFunctions */ int GetUnitGUID(lua_State* L) { - uint32 lowguid = Eluna::CHECKVAL(L, 1); - uint32 entry = Eluna::CHECKVAL(L, 2); - Eluna::Push(L, MAKE_NEW_GUID(lowguid, entry, HIGHGUID_UNIT)); + uint32 lowguid = ALE::CHECKVAL(L, 1); + uint32 entry = ALE::CHECKVAL(L, 2); + ALE::Push(L, MAKE_NEW_GUID(lowguid, entry, HIGHGUID_UNIT)); return 1; } @@ -433,9 +433,9 @@ namespace LuaGlobalFunctions */ int GetGUIDLow(lua_State* L) { - ObjectGuid guid = Eluna::CHECKVAL(L, 1); + ObjectGuid guid = ALE::CHECKVAL(L, 1); - Eluna::Push(L, guid.GetCounter()); + ALE::Push(L, guid.GetCounter()); return 1; } @@ -461,8 +461,8 @@ namespace LuaGlobalFunctions */ int GetItemLink(lua_State* L) { - uint32 entry = Eluna::CHECKVAL(L, 1); - uint8 locale = Eluna::CHECKVAL(L, 2, DEFAULT_LOCALE); + uint32 entry = ALE::CHECKVAL(L, 1); + uint8 locale = ALE::CHECKVAL(L, 2, DEFAULT_LOCALE); if (locale >= TOTAL_LOCALES) return luaL_argerror(L, 2, "valid LocaleConstant expected"); @@ -480,7 +480,7 @@ namespace LuaGlobalFunctions "0:0:0:0:" << "0:0:0:0|h[" << name << "]|h|r"; - Eluna::Push(L, oss.str()); + ALE::Push(L, oss.str()); return 1; } @@ -496,8 +496,8 @@ namespace LuaGlobalFunctions */ int GetGUIDType(lua_State* L) { - ObjectGuid guid = Eluna::CHECKVAL(L, 1); - Eluna::Push(L, static_cast(guid.GetHigh())); + ObjectGuid guid = ALE::CHECKVAL(L, 1); + ALE::Push(L, static_cast(guid.GetHigh())); return 1; } @@ -511,8 +511,8 @@ namespace LuaGlobalFunctions */ int GetGUIDEntry(lua_State* L) { - ObjectGuid guid = Eluna::CHECKVAL(L, 1); - Eluna::Push(L, guid.GetEntry()); + ObjectGuid guid = ALE::CHECKVAL(L, 1); + ALE::Push(L, guid.GetEntry()); return 1; } @@ -524,9 +524,9 @@ namespace LuaGlobalFunctions */ int GetPackedGUIDSize(lua_State* L) { - ObjectGuid guid = Eluna::CHECKVAL(L, 1); + ObjectGuid guid = ALE::CHECKVAL(L, 1); PackedGuid packedGuid(guid); - Eluna::Push(L, static_cast(packedGuid.size())); + ALE::Push(L, static_cast(packedGuid.size())); return 1; } @@ -552,8 +552,8 @@ namespace LuaGlobalFunctions */ int GetAreaName(lua_State* L) { - uint32 areaOrZoneId = Eluna::CHECKVAL(L, 1); - uint8 locale = Eluna::CHECKVAL(L, 2, DEFAULT_LOCALE); + uint32 areaOrZoneId = ALE::CHECKVAL(L, 1); + uint8 locale = ALE::CHECKVAL(L, 2, DEFAULT_LOCALE); if (locale >= TOTAL_LOCALES) return luaL_argerror(L, 2, "valid LocaleConstant expected"); @@ -562,7 +562,7 @@ namespace LuaGlobalFunctions if (!areaEntry) return luaL_argerror(L, 1, "valid Area or Zone ID expected"); - Eluna::Push(L, areaEntry->area_name[locale]); + ALE::Push(L, areaEntry->area_name[locale]); return 1; } @@ -580,7 +580,7 @@ namespace LuaGlobalFunctions for (GameEventMgr::ActiveEvents::const_iterator i = activeEvents.begin(); i != activeEvents.end(); ++i) { - Eluna::Push(L, *i); + ALE::Push(L, *i); lua_rawseti(L, tbl, counter); counter++; @@ -592,15 +592,15 @@ namespace LuaGlobalFunctions static int RegisterEntryHelper(lua_State* L, int regtype) { - uint32 id = Eluna::CHECKVAL(L, 1); - uint32 ev = Eluna::CHECKVAL(L, 2); + uint32 id = ALE::CHECKVAL(L, 1); + uint32 ev = ALE::CHECKVAL(L, 2); luaL_checktype(L, 3, LUA_TFUNCTION); - uint32 shots = Eluna::CHECKVAL(L, 4, 0); + uint32 shots = ALE::CHECKVAL(L, 4, 0); lua_pushvalue(L, 3); int functionRef = luaL_ref(L, LUA_REGISTRYINDEX); if (functionRef >= 0) - return Eluna::GetEluna(L)->Register(L, regtype, id, ObjectGuid(), 0, ev, functionRef, shots); + return ALE::GetALE(L)->Register(L, regtype, id, ObjectGuid(), 0, ev, functionRef, shots); else luaL_argerror(L, 3, "unable to make a ref to function"); return 0; @@ -608,14 +608,14 @@ namespace LuaGlobalFunctions static int RegisterEventHelper(lua_State* L, int regtype) { - uint32 ev = Eluna::CHECKVAL(L, 1); + uint32 ev = ALE::CHECKVAL(L, 1); luaL_checktype(L, 2, LUA_TFUNCTION); - uint32 shots = Eluna::CHECKVAL(L, 3, 0); + uint32 shots = ALE::CHECKVAL(L, 3, 0); lua_pushvalue(L, 2); int functionRef = luaL_ref(L, LUA_REGISTRYINDEX); if (functionRef >= 0) - return Eluna::GetEluna(L)->Register(L, regtype, 0, ObjectGuid(), 0, ev, functionRef, shots); + return ALE::GetALE(L)->Register(L, regtype, 0, ObjectGuid(), 0, ev, functionRef, shots); else luaL_argerror(L, 2, "unable to make a ref to function"); return 0; @@ -623,16 +623,16 @@ namespace LuaGlobalFunctions static int RegisterUniqueHelper(lua_State* L, int regtype) { - ObjectGuid guid = Eluna::CHECKVAL(L, 1); - uint32 instanceId = Eluna::CHECKVAL(L, 2); - uint32 ev = Eluna::CHECKVAL(L, 3); + ObjectGuid guid = ALE::CHECKVAL(L, 1); + uint32 instanceId = ALE::CHECKVAL(L, 2); + uint32 ev = ALE::CHECKVAL(L, 3); luaL_checktype(L, 4, LUA_TFUNCTION); - uint32 shots = Eluna::CHECKVAL(L, 5, 0); + uint32 shots = ALE::CHECKVAL(L, 5, 0); lua_pushvalue(L, 4); int functionRef = luaL_ref(L, LUA_REGISTRYINDEX); if (functionRef >= 0) - return Eluna::GetEluna(L)->Register(L, regtype, 0, guid, instanceId, ev, functionRef, shots); + return ALE::GetALE(L)->Register(L, regtype, 0, guid, instanceId, ev, functionRef, shots); else luaL_argerror(L, 4, "unable to make a ref to function"); return 0; @@ -662,8 +662,8 @@ namespace LuaGlobalFunctions * 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) @@ -692,8 +692,8 @@ namespace LuaGlobalFunctions * 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) @@ -1364,9 +1364,9 @@ namespace LuaGlobalFunctions /** * Reloads the Lua engine. */ - int ReloadEluna(lua_State* /*L*/) + int ReloadALE(lua_State* /*L*/) { - Eluna::ReloadEluna(); + ALE::ReloadALE(); return 0; } @@ -1377,13 +1377,13 @@ namespace LuaGlobalFunctions */ int RunCommand(lua_State* L) { - const char* command = Eluna::CHECKVAL(L, 1); + const char* command = ALE::CHECKVAL(L, 1); eWorld->QueueCliCommand(new CliCommandHolder(nullptr, command, [](void*, std::string_view view) { std::string str = { view.begin(), view.end() }; str.erase(std::find_if(str.rbegin(), str.rend(), [](unsigned char ch) { return !std::isspace(ch); }).base(), str.end()); // Remove trailing spaces and line breaks - ELUNA_LOG_INFO("{}", str); + ALE_LOG_INFO("{}", str); }, nullptr)); return 0; @@ -1396,7 +1396,7 @@ namespace LuaGlobalFunctions */ int SendWorldMessage(lua_State* L) { - const char* message = Eluna::CHECKVAL(L, 1); + const char* message = ALE::CHECKVAL(L, 1); eWorldSessionMgr->SendServerMessage(SERVER_MSG_STRING, message); return 0; } @@ -1404,7 +1404,7 @@ namespace LuaGlobalFunctions template static int DBQueryAsync(lua_State* L, DatabaseWorkerPool& db) { - const char* query = Eluna::CHECKVAL(L, 1); + const char* query = ALE::CHECKVAL(L, 1); luaL_checktype(L, 2, LUA_TFUNCTION); lua_pushvalue(L, 2); int funcRef = luaL_ref(L, LUA_REGISTRYINDEX); @@ -1414,20 +1414,20 @@ namespace LuaGlobalFunctions return 0; } - Eluna::GEluna->queryProcessor.AddCallback(db.AsyncQuery(query).WithCallback([L, funcRef](QueryResult result) + ALE::GALE->queryProcessor.AddCallback(db.AsyncQuery(query).WithCallback([L, funcRef](QueryResult result) { - ElunaQuery* eq = result ? new ElunaQuery(result) : nullptr; + ALEQuery* eq = result ? new ALEQuery(result) : nullptr; - LOCK_ELUNA; + LOCK_ALE; // Get function lua_rawgeti(L, LUA_REGISTRYINDEX, funcRef); // Push parameters - Eluna::Push(L, eq); + ALE::Push(L, eq); // Call function - Eluna::GEluna->ExecuteCall(1, 0); + ALE::GALE->ExecuteCall(1, 0); luaL_unref(L, LUA_REGISTRYINDEX, funcRef); })); @@ -1436,7 +1436,7 @@ namespace LuaGlobalFunctions } /** - * Executes a SQL query on the world database and returns an [ElunaQuery]. + * Executes a SQL query on the world database and returns an [ALEQuery]. * * The query is always executed synchronously * (i.e. execution halts until the query has finished and then results are returned). @@ -1451,26 +1451,26 @@ namespace LuaGlobalFunctions * end * * @param string sql : query to execute - * @return [ElunaQuery] results or nil if no rows found or nil if no rows found + * @return [ALEQuery] results or nil if no rows found or nil if no rows found */ int WorldDBQuery(lua_State* L) { - const char* query = Eluna::CHECKVAL(L, 1); + const char* query = ALE::CHECKVAL(L, 1); int numArgs = lua_gettop(L); if (numArgs > 1) - query = Eluna::FormatQuery(L, query).c_str(); + query = ALE::FormatQuery(L, query).c_str(); - ElunaQuery result = WorldDatabase.Query(query); + ALEQuery result = WorldDatabase.Query(query); if (result) - Eluna::Push(L, new ElunaQuery(result)); + ALE::Push(L, new ALEQuery(result)); else - Eluna::Push(L); + ALE::Push(L); return 1; } /** - * Executes an asynchronous SQL query on the world database and passes an [ElunaQuery] to a callback function. + * Executes an asynchronous SQL query on the world database and passes an [ALEQuery] to a callback function. * * The query is executed asynchronously * (i.e. the server keeps running while the query is executed in parallel, and results are passed to a callback function). @@ -1508,18 +1508,18 @@ namespace LuaGlobalFunctions */ int WorldDBExecute(lua_State* L) { - const char* query = Eluna::CHECKVAL(L, 1); + const char* query = ALE::CHECKVAL(L, 1); int numArgs = lua_gettop(L); if (numArgs > 1) - query = Eluna::FormatQuery(L, query).c_str(); + query = ALE::FormatQuery(L, query).c_str(); WorldDatabase.Execute(query); return 0; } /** - * Executes a SQL query on the character database and returns an [ElunaQuery]. + * Executes a SQL query on the character database and returns an [ALEQuery]. * * The query is always executed synchronously * (i.e. execution halts until the query has finished and then results are returned). @@ -1528,26 +1528,26 @@ namespace LuaGlobalFunctions * For an example see [Global:WorldDBQuery]. * * @param string sql : query to execute - * @return [ElunaQuery] results or nil if no rows found + * @return [ALEQuery] results or nil if no rows found */ int CharDBQuery(lua_State* L) { - const char* query = Eluna::CHECKVAL(L, 1); + const char* query = ALE::CHECKVAL(L, 1); int numArgs = lua_gettop(L); if (numArgs > 1) - query = Eluna::FormatQuery(L, query).c_str(); + query = ALE::FormatQuery(L, query).c_str(); QueryResult result = CharacterDatabase.Query(query); if (result) - Eluna::Push(L, new QueryResult(result)); + ALE::Push(L, new QueryResult(result)); else - Eluna::Push(L); + ALE::Push(L); return 1; } /** - * Executes an asynchronous SQL query on the character database and passes an [ElunaQuery] to a callback function. + * Executes an asynchronous SQL query on the character database and passes an [ALEQuery] to a callback function. * * The query is executed asynchronously * (i.e. the server keeps running while the query is executed in parallel, and results are passed to a callback function). @@ -1578,18 +1578,18 @@ namespace LuaGlobalFunctions */ int CharDBExecute(lua_State* L) { - const char* query = Eluna::CHECKVAL(L, 1); + const char* query = ALE::CHECKVAL(L, 1); int numArgs = lua_gettop(L); if (numArgs > 1) - query = Eluna::FormatQuery(L, query).c_str(); + query = ALE::FormatQuery(L, query).c_str(); CharacterDatabase.Execute(query); return 0; } /** - * Executes a SQL query on the login database and returns an [ElunaQuery]. + * Executes a SQL query on the login database and returns an [ALEQuery]. * * The query is always executed synchronously * (i.e. execution halts until the query has finished and then results are returned). @@ -1598,26 +1598,26 @@ namespace LuaGlobalFunctions * For an example see [Global:WorldDBQuery]. * * @param string sql : query to execute - * @return [ElunaQuery] results or nil if no rows found + * @return [ALEQuery] results or nil if no rows found */ int AuthDBQuery(lua_State* L) { - const char* query = Eluna::CHECKVAL(L, 1); + const char* query = ALE::CHECKVAL(L, 1); int numArgs = lua_gettop(L); if (numArgs > 1) - query = Eluna::FormatQuery(L, query).c_str(); + query = ALE::FormatQuery(L, query).c_str(); QueryResult result = LoginDatabase.Query(query); if (result) - Eluna::Push(L, new QueryResult(result)); + ALE::Push(L, new QueryResult(result)); else - Eluna::Push(L); + ALE::Push(L); return 1; } /** - * Executes an asynchronous SQL query on the character database and passes an [ElunaQuery] to a callback function. + * Executes an asynchronous SQL query on the character database and passes an [ALEQuery] to a callback function. * * The query is executed asynchronously * (i.e. the server keeps running while the query is executed in parallel, and results are passed to a callback function). @@ -1648,11 +1648,11 @@ namespace LuaGlobalFunctions */ int AuthDBExecute(lua_State* L) { - const char* query = Eluna::CHECKVAL(L, 1); + const char* query = ALE::CHECKVAL(L, 1); int numArgs = lua_gettop(L); if (numArgs > 1) - query = Eluna::FormatQuery(L, query).c_str(); + query = ALE::FormatQuery(L, query).c_str(); LoginDatabase.Execute(query); return 0; @@ -1682,17 +1682,17 @@ namespace LuaGlobalFunctions uint32 min, max; if (lua_istable(L, 2)) { - Eluna::Push(L, 1); + ALE::Push(L, 1); lua_gettable(L, 2); - min = Eluna::CHECKVAL(L, -1); - Eluna::Push(L, 2); + min = ALE::CHECKVAL(L, -1); + ALE::Push(L, 2); lua_gettable(L, 2); - max = Eluna::CHECKVAL(L, -1); + max = ALE::CHECKVAL(L, -1); lua_pop(L, 2); } else - min = max = Eluna::CHECKVAL(L, 2); - uint32 repeats = Eluna::CHECKVAL(L, 3, 1); + min = max = ALE::CHECKVAL(L, 2); + uint32 repeats = ALE::CHECKVAL(L, 3, 1); if (min > max) return luaL_argerror(L, 2, "min is bigger than max delay"); @@ -1701,8 +1701,8 @@ namespace LuaGlobalFunctions int functionRef = luaL_ref(L, LUA_REGISTRYINDEX); if (functionRef != LUA_REFNIL && functionRef != LUA_NOREF) { - Eluna::GetEluna(L)->eventMgr->globalProcessor->AddEvent(functionRef, min, max, repeats); - Eluna::Push(L, functionRef); + ALE::GetALE(L)->eventMgr->globalProcessor->AddEvent(functionRef, min, max, repeats); + ALE::Push(L, functionRef); } return 1; } @@ -1715,14 +1715,14 @@ namespace LuaGlobalFunctions */ int RemoveEventById(lua_State* L) { - int eventId = Eluna::CHECKVAL(L, 1); - bool all_Events = Eluna::CHECKVAL(L, 1, false); + int eventId = ALE::CHECKVAL(L, 1); + bool all_Events = ALE::CHECKVAL(L, 1, false); // not thread safe if (all_Events) - Eluna::GetEluna(L)->eventMgr->SetState(eventId, LUAEVENT_STATE_ABORT); + ALE::GetALE(L)->eventMgr->SetState(eventId, LUAEVENT_STATE_ABORT); else - Eluna::GetEluna(L)->eventMgr->globalProcessor->SetState(eventId, LUAEVENT_STATE_ABORT); + ALE::GetALE(L)->eventMgr->globalProcessor->SetState(eventId, LUAEVENT_STATE_ABORT); return 0; } @@ -1733,13 +1733,13 @@ namespace LuaGlobalFunctions */ int RemoveEvents(lua_State* L) { - bool all_Events = Eluna::CHECKVAL(L, 1, false); + bool all_Events = ALE::CHECKVAL(L, 1, false); // not thread safe if (all_Events) - Eluna::GetEluna(L)->eventMgr->SetStates(LUAEVENT_STATE_ABORT); + ALE::GetALE(L)->eventMgr->SetStates(LUAEVENT_STATE_ABORT); else - Eluna::GetEluna(L)->eventMgr->globalProcessor->SetStates(LUAEVENT_STATE_ABORT); + ALE::GetALE(L)->eventMgr->globalProcessor->SetStates(LUAEVENT_STATE_ABORT); return 0; } @@ -1761,29 +1761,29 @@ namespace LuaGlobalFunctions */ int PerformIngameSpawn(lua_State* L) { - int spawntype = Eluna::CHECKVAL(L, 1); - uint32 entry = Eluna::CHECKVAL(L, 2); - uint32 mapID = Eluna::CHECKVAL(L, 3); - uint32 instanceID = Eluna::CHECKVAL(L, 4); + int spawntype = ALE::CHECKVAL(L, 1); + uint32 entry = ALE::CHECKVAL(L, 2); + uint32 mapID = ALE::CHECKVAL(L, 3); + uint32 instanceID = ALE::CHECKVAL(L, 4); - float x = Eluna::CHECKVAL(L, 5); - float y = Eluna::CHECKVAL(L, 6); - float z = Eluna::CHECKVAL(L, 7); - float o = Eluna::CHECKVAL(L, 8); - bool save = Eluna::CHECKVAL(L, 9, false); - uint32 durorresptime = Eluna::CHECKVAL(L, 10, 0); - uint32 phase = Eluna::CHECKVAL(L, 11, PHASEMASK_NORMAL); + float x = ALE::CHECKVAL(L, 5); + float y = ALE::CHECKVAL(L, 6); + float z = ALE::CHECKVAL(L, 7); + float o = ALE::CHECKVAL(L, 8); + bool save = ALE::CHECKVAL(L, 9, false); + uint32 durorresptime = ALE::CHECKVAL(L, 10, 0); + uint32 phase = ALE::CHECKVAL(L, 11, PHASEMASK_NORMAL); if (!phase) { - Eluna::Push(L); + ALE::Push(L); return 1; } Map* map = eMapMgr->FindMap(mapID, instanceID); if (!map) { - Eluna::Push(L); + ALE::Push(L); return 1; } @@ -1797,7 +1797,7 @@ namespace LuaGlobalFunctions if (!creature->Create(map->GenerateLowGuid(), map, phase, entry, 0, x, y, z, o)) { delete creature; - Eluna::Push(L); + ALE::Push(L); return 1; } @@ -1814,19 +1814,19 @@ namespace LuaGlobalFunctions if (!creature->LoadCreatureFromDB(db_guid, map, true, true)) { delete creature; - Eluna::Push(L); + ALE::Push(L); return 1; } eObjectMgr->AddCreatureToGrid(db_guid, eObjectMgr->GetCreatureData(db_guid)); - Eluna::Push(L, creature); + ALE::Push(L, creature); } else { TempSummon* creature = map->SummonCreature(entry, pos, NULL, durorresptime); if (!creature) { - Eluna::Push(L); + ALE::Push(L); return 1; } @@ -1835,7 +1835,7 @@ namespace LuaGlobalFunctions else creature->SetTempSummonType(TEMPSUMMON_MANUAL_DESPAWN); - Eluna::Push(L, creature); + ALE::Push(L, creature); } return 1; @@ -1846,13 +1846,13 @@ namespace LuaGlobalFunctions const GameObjectTemplate* objectInfo = eObjectMgr->GetGameObjectTemplate(entry); if (!objectInfo) { - Eluna::Push(L); + ALE::Push(L); return 1; } if (objectInfo->displayId && !sGameObjectDisplayInfoStore.LookupEntry(objectInfo->displayId)) { - Eluna::Push(L); + ALE::Push(L); return 1; } @@ -1862,7 +1862,7 @@ namespace LuaGlobalFunctions if (!object->Create(guidLow, entry, map, phase, x, y, z, o, G3D::Quat(0.0f, 0.0f, 0.0f, 0.0f), 100, GO_STATE_READY)) { delete object; - Eluna::Push(L); + ALE::Push(L); return 1; } @@ -1884,7 +1884,7 @@ namespace LuaGlobalFunctions if (!object->LoadGameObjectFromDB(guidLow, map, true)) { delete object; - Eluna::Push(L); + ALE::Push(L); return 1; } @@ -1892,10 +1892,10 @@ namespace LuaGlobalFunctions } else map->AddToMap(object); - Eluna::Push(L, object); + ALE::Push(L, object); return 1; } - Eluna::Push(L); + ALE::Push(L); return 1; } @@ -1908,12 +1908,12 @@ namespace LuaGlobalFunctions */ int CreatePacket(lua_State* L) { - uint32 opcode = Eluna::CHECKVAL(L, 1); - size_t size = Eluna::CHECKVAL(L, 2); + uint32 opcode = ALE::CHECKVAL(L, 1); + size_t size = ALE::CHECKVAL(L, 2); if (opcode >= NUM_MSG_TYPES) return luaL_argerror(L, 1, "valid opcode expected"); - Eluna::Push(L, new WorldPacket((OpcodesList)opcode, size)); + ALE::Push(L, new WorldPacket((OpcodesList)opcode, size)); return 1; } @@ -1928,11 +1928,11 @@ namespace LuaGlobalFunctions */ int AddVendorItem(lua_State* L) { - uint32 entry = Eluna::CHECKVAL(L, 1); - uint32 item = Eluna::CHECKVAL(L, 2); - int maxcount = Eluna::CHECKVAL(L, 3); - uint32 incrtime = Eluna::CHECKVAL(L, 4); - uint32 extendedcost = Eluna::CHECKVAL(L, 5); + uint32 entry = ALE::CHECKVAL(L, 1); + uint32 item = ALE::CHECKVAL(L, 2); + int maxcount = ALE::CHECKVAL(L, 3); + uint32 incrtime = ALE::CHECKVAL(L, 4); + uint32 extendedcost = ALE::CHECKVAL(L, 5); if (!eObjectMgr->IsVendorItemValid(entry, item, maxcount, incrtime, extendedcost)) return 0; @@ -1949,8 +1949,8 @@ namespace LuaGlobalFunctions */ int VendorRemoveItem(lua_State* L) { - uint32 entry = Eluna::CHECKVAL(L, 1); - uint32 item = Eluna::CHECKVAL(L, 2); + uint32 entry = ALE::CHECKVAL(L, 1); + uint32 item = ALE::CHECKVAL(L, 2); if (!eObjectMgr->GetCreatureTemplate(entry)) return luaL_argerror(L, 1, "valid CreatureEntry expected"); @@ -1965,7 +1965,7 @@ namespace LuaGlobalFunctions */ int VendorRemoveAllItems(lua_State* L) { - uint32 entry = Eluna::CHECKVAL(L, 1); + uint32 entry = ALE::CHECKVAL(L, 1); VendorItemData const* items = eObjectMgr->GetNpcVendorItemList(entry); if (!items || items->Empty()) @@ -1984,7 +1984,7 @@ namespace LuaGlobalFunctions */ int Kick(lua_State* L) { - Player* player = Eluna::CHECKOBJ(L, 1); + Player* player = ALE::CHECKOBJ(L, 1); player->GetSession()->KickPlayer(); return 0; } @@ -2008,11 +2008,11 @@ namespace LuaGlobalFunctions */ int Ban(lua_State* L) { - int banMode = Eluna::CHECKVAL(L, 1); - std::string nameOrIP = Eluna::CHECKVAL(L, 2); - uint32 duration = Eluna::CHECKVAL(L, 3); - const char* reason = Eluna::CHECKVAL(L, 4, ""); - const char* whoBanned = Eluna::CHECKVAL(L, 5, ""); + int banMode = ALE::CHECKVAL(L, 1); + std::string nameOrIP = ALE::CHECKVAL(L, 2); + uint32 duration = ALE::CHECKVAL(L, 3); + const char* reason = ALE::CHECKVAL(L, 4, ""); + const char* whoBanned = ALE::CHECKVAL(L, 5, ""); const int BAN_ACCOUNT = 0; const int BAN_CHARACTER = 1; @@ -2053,16 +2053,16 @@ namespace LuaGlobalFunctions switch (result) { case BanReturn::BAN_SUCCESS: - Eluna::Push(L, 0); + ALE::Push(L, 0); break; case BanReturn::BAN_SYNTAX_ERROR: - Eluna::Push(L, 1); + ALE::Push(L, 1); break; case BanReturn::BAN_NOTFOUND: - Eluna::Push(L, 2); + ALE::Push(L, 2); break; case BanReturn::BAN_LONGER_EXISTS: - Eluna::Push(L, 3); + ALE::Push(L, 3); break; } return 1; @@ -2109,14 +2109,14 @@ namespace LuaGlobalFunctions int SendMail(lua_State* L) { int i = 0; - std::string subject = Eluna::CHECKVAL(L, ++i); - std::string text = Eluna::CHECKVAL(L, ++i); - uint32 receiverGUIDLow = Eluna::CHECKVAL(L, ++i); - uint32 senderGUIDLow = Eluna::CHECKVAL(L, ++i, 0); - uint32 stationary = Eluna::CHECKVAL(L, ++i, MAIL_STATIONERY_DEFAULT); - uint32 delay = Eluna::CHECKVAL(L, ++i, 0); - uint32 money = Eluna::CHECKVAL(L, ++i, 0); - uint32 cod = Eluna::CHECKVAL(L, ++i, 0); + std::string subject = ALE::CHECKVAL(L, ++i); + std::string text = ALE::CHECKVAL(L, ++i); + uint32 receiverGUIDLow = ALE::CHECKVAL(L, ++i); + uint32 senderGUIDLow = ALE::CHECKVAL(L, ++i, 0); + uint32 stationary = ALE::CHECKVAL(L, ++i, MAIL_STATIONERY_DEFAULT); + uint32 delay = ALE::CHECKVAL(L, ++i, 0); + uint32 money = ALE::CHECKVAL(L, ++i, 0); + uint32 cod = ALE::CHECKVAL(L, ++i, 0); int argAmount = lua_gettop(L); MailSender sender(MAIL_NORMAL, senderGUIDLow, (MailStationery)stationary); @@ -2131,8 +2131,8 @@ namespace LuaGlobalFunctions uint8 addedItems = 0; while (addedItems <= MAX_MAIL_ITEMS && i + 2 <= argAmount) { - uint32 entry = Eluna::CHECKVAL(L, ++i); - uint32 amount = Eluna::CHECKVAL(L, ++i); + uint32 entry = ALE::CHECKVAL(L, ++i); + uint32 amount = ALE::CHECKVAL(L, ++i); ItemTemplate const* item_proto = eObjectMgr->GetItemTemplate(entry); if (!item_proto) @@ -2149,7 +2149,7 @@ namespace LuaGlobalFunctions { item->SaveToDB(trans); draft.AddItem(item); - Eluna::Push(L, item->GetGUID().GetCounter()); + ALE::Push(L, item->GetGUID().GetCounter()); ++addedItems; } } @@ -2169,9 +2169,9 @@ namespace LuaGlobalFunctions */ int bit_and(lua_State* L) { - uint32 a = Eluna::CHECKVAL(L, 1); - uint32 b = Eluna::CHECKVAL(L, 2); - Eluna::Push(L, a & b); + uint32 a = ALE::CHECKVAL(L, 1); + uint32 b = ALE::CHECKVAL(L, 2); + ALE::Push(L, a & b); return 1; } @@ -2184,9 +2184,9 @@ namespace LuaGlobalFunctions */ int bit_or(lua_State* L) { - uint32 a = Eluna::CHECKVAL(L, 1); - uint32 b = Eluna::CHECKVAL(L, 2); - Eluna::Push(L, a | b); + uint32 a = ALE::CHECKVAL(L, 1); + uint32 b = ALE::CHECKVAL(L, 2); + ALE::Push(L, a | b); return 1; } @@ -2199,9 +2199,9 @@ namespace LuaGlobalFunctions */ int bit_lshift(lua_State* L) { - uint32 a = Eluna::CHECKVAL(L, 1); - uint32 b = Eluna::CHECKVAL(L, 2); - Eluna::Push(L, a << b); + uint32 a = ALE::CHECKVAL(L, 1); + uint32 b = ALE::CHECKVAL(L, 2); + ALE::Push(L, a << b); return 1; } @@ -2214,9 +2214,9 @@ namespace LuaGlobalFunctions */ int bit_rshift(lua_State* L) { - uint32 a = Eluna::CHECKVAL(L, 1); - uint32 b = Eluna::CHECKVAL(L, 2); - Eluna::Push(L, a >> b); + uint32 a = ALE::CHECKVAL(L, 1); + uint32 b = ALE::CHECKVAL(L, 2); + ALE::Push(L, a >> b); return 1; } @@ -2229,9 +2229,9 @@ namespace LuaGlobalFunctions */ int bit_xor(lua_State* L) { - uint32 a = Eluna::CHECKVAL(L, 1); - uint32 b = Eluna::CHECKVAL(L, 2); - Eluna::Push(L, a ^ b); + uint32 a = ALE::CHECKVAL(L, 1); + uint32 b = ALE::CHECKVAL(L, 2); + ALE::Push(L, a ^ b); return 1; } @@ -2243,8 +2243,8 @@ namespace LuaGlobalFunctions */ int bit_not(lua_State* L) { - uint32 a = Eluna::CHECKVAL(L, 1); - Eluna::Push(L, ~a); + uint32 a = ALE::CHECKVAL(L, 1); + ALE::Push(L, ~a); return 1; } @@ -2273,10 +2273,10 @@ namespace LuaGlobalFunctions int AddTaxiPath(lua_State* L) { luaL_checktype(L, 1, LUA_TTABLE); - uint32 mountA = Eluna::CHECKVAL(L, 2); - uint32 mountH = Eluna::CHECKVAL(L, 3); - uint32 price = Eluna::CHECKVAL(L, 4, 0); - uint32 pathId = Eluna::CHECKVAL(L, 5, 0); + uint32 mountA = ALE::CHECKVAL(L, 2); + uint32 mountH = ALE::CHECKVAL(L, 3); + uint32 price = ALE::CHECKVAL(L, 4, 0); + uint32 pathId = ALE::CHECKVAL(L, 5, 0); lua_pushvalue(L, 1); // Stack: {nodes}, mountA, mountH, price, pathid, {nodes} @@ -2285,13 +2285,13 @@ namespace LuaGlobalFunctions int start = lua_gettop(L); int end = start; - Eluna::Push(L); + ALE::Push(L); // Stack: {nodes}, mountA, mountH, price, pathid, {nodes}, nil while (lua_next(L, -2) != 0) { // Stack: {nodes}, mountA, mountH, price, pathid, {nodes}, key, value luaL_checktype(L, -1, LUA_TTABLE); - Eluna::Push(L); + ALE::Push(L); // Stack: {nodes}, mountA, mountH, price, pathid, {nodes}, key, value, nil while (lua_next(L, -2) != 0) { @@ -2307,19 +2307,19 @@ namespace LuaGlobalFunctions while (end - start < 8) // fill optional args with 0 { - Eluna::Push(L, 0); + ALE::Push(L, 0); lua_insert(L, end++); // Stack: {nodes}, mountA, mountH, price, pathid, {nodes}, node, key, value } TaxiPathNodeEntry entry; // mandatory - entry.mapid = Eluna::CHECKVAL(L, start); - entry.x = Eluna::CHECKVAL(L, start + 1); - entry.y = Eluna::CHECKVAL(L, start + 2); - entry.z = Eluna::CHECKVAL(L, start + 3); + entry.mapid = ALE::CHECKVAL(L, start); + entry.x = ALE::CHECKVAL(L, start + 1); + entry.y = ALE::CHECKVAL(L, start + 2); + entry.z = ALE::CHECKVAL(L, start + 3); // optional - entry.actionFlag = Eluna::CHECKVAL(L, start + 4, 0); - entry.delay = Eluna::CHECKVAL(L, start + 5, 0); + entry.actionFlag = ALE::CHECKVAL(L, start + 4, 0); + entry.delay = ALE::CHECKVAL(L, start + 5, 0); nodes.push_back(entry); @@ -2375,19 +2375,19 @@ namespace LuaGlobalFunctions sTaxiPathStore.SetEntry(pathId, pathEntry); sTaxiPathSetBySource[startNode][nodeId - 1] = pathEntry; - Eluna::Push(L, pathId); + ALE::Push(L, pathId); return 1; } /** - * Returns `true` if Eluna is in compatibility mode, `false` if in multistate. + * Returns `true` if ALE is in compatibility mode, `false` if in multistate. * * @return bool isCompatibilityMode */ int IsCompatibilityMode(lua_State* L) { // Until AC supports multistate, this will always return true - Eluna::Push(L, true); + ALE::Push(L, true); return 1; } @@ -2419,10 +2419,10 @@ namespace LuaGlobalFunctions */ int IsInventoryPos(lua_State* L) { - uint8 bag = Eluna::CHECKVAL(L, 1); - uint8 slot = Eluna::CHECKVAL(L, 2); + uint8 bag = ALE::CHECKVAL(L, 1); + uint8 slot = ALE::CHECKVAL(L, 2); - Eluna::Push(L, Player::IsInventoryPos(bag, slot)); + ALE::Push(L, Player::IsInventoryPos(bag, slot)); return 1; } @@ -2437,10 +2437,10 @@ namespace LuaGlobalFunctions */ int IsEquipmentPos(lua_State* L) { - uint8 bag = Eluna::CHECKVAL(L, 1); - uint8 slot = Eluna::CHECKVAL(L, 2); + uint8 bag = ALE::CHECKVAL(L, 1); + uint8 slot = ALE::CHECKVAL(L, 2); - Eluna::Push(L, Player::IsEquipmentPos(bag, slot)); + ALE::Push(L, Player::IsEquipmentPos(bag, slot)); return 1; } @@ -2455,10 +2455,10 @@ namespace LuaGlobalFunctions */ int IsBankPos(lua_State* L) { - uint8 bag = Eluna::CHECKVAL(L, 1); - uint8 slot = Eluna::CHECKVAL(L, 2); + uint8 bag = ALE::CHECKVAL(L, 1); + uint8 slot = ALE::CHECKVAL(L, 2); - Eluna::Push(L, Player::IsBankPos(bag, slot)); + ALE::Push(L, Player::IsBankPos(bag, slot)); return 1; } @@ -2473,10 +2473,10 @@ namespace LuaGlobalFunctions */ int IsBagPos(lua_State* L) { - uint8 bag = Eluna::CHECKVAL(L, 1); - uint8 slot = Eluna::CHECKVAL(L, 2); + uint8 bag = ALE::CHECKVAL(L, 1); + uint8 slot = ALE::CHECKVAL(L, 2); - Eluna::Push(L, Player::IsBagPos((bag << 8) + slot)); + ALE::Push(L, Player::IsBagPos((bag << 8) + slot)); return 1; } @@ -2488,9 +2488,9 @@ namespace LuaGlobalFunctions */ int IsGameEventActive(lua_State* L) { - uint16 eventId = Eluna::CHECKVAL(L, 1); + uint16 eventId = ALE::CHECKVAL(L, 1); - Eluna::Push(L, eGameEventMgr->IsActiveEvent(eventId)); + ALE::Push(L, eGameEventMgr->IsActiveEvent(eventId)); return 1; } @@ -2501,7 +2501,7 @@ namespace LuaGlobalFunctions */ int GetCurrTime(lua_State* L) { - Eluna::Push(L, ElunaUtil::GetCurrTime()); + ALE::Push(L, ALEUtil::GetCurrTime()); return 1; } @@ -2513,9 +2513,9 @@ namespace LuaGlobalFunctions */ int GetTimeDiff(lua_State* L) { - uint32 oldtimems = Eluna::CHECKVAL(L, 1); + uint32 oldtimems = ALE::CHECKVAL(L, 1); - Eluna::Push(L, ElunaUtil::GetTimeDiff(oldtimems)); + ALE::Push(L, ALEUtil::GetTimeDiff(oldtimems)); return 1; } @@ -2538,7 +2538,7 @@ namespace LuaGlobalFunctions */ int PrintInfo(lua_State* L) { - ELUNA_LOG_INFO("{}", GetStackAsString(L)); + ALE_LOG_INFO("{}", GetStackAsString(L)); return 0; } @@ -2549,7 +2549,7 @@ namespace LuaGlobalFunctions */ int PrintError(lua_State* L) { - ELUNA_LOG_ERROR("{}", GetStackAsString(L)); + ALE_LOG_ERROR("{}", GetStackAsString(L)); return 0; } @@ -2560,7 +2560,7 @@ namespace LuaGlobalFunctions */ int PrintDebug(lua_State* L) { - ELUNA_LOG_DEBUG("{}", GetStackAsString(L)); + ALE_LOG_DEBUG("{}", GetStackAsString(L)); return 0; } @@ -2572,8 +2572,8 @@ namespace LuaGlobalFunctions */ int StartGameEvent(lua_State* L) { - uint16 eventId = Eluna::CHECKVAL(L, 1); - bool force = Eluna::CHECKVAL(L, 2, false); + uint16 eventId = ALE::CHECKVAL(L, 1); + bool force = ALE::CHECKVAL(L, 2, false); eGameEventMgr->StartEvent(eventId, force); return 0; @@ -2587,8 +2587,8 @@ namespace LuaGlobalFunctions */ int StopGameEvent(lua_State* L) { - uint16 eventId = Eluna::CHECKVAL(L, 1); - bool force = Eluna::CHECKVAL(L, 2, false); + uint16 eventId = ALE::CHECKVAL(L, 1); + bool force = ALE::CHECKVAL(L, 2, false); eGameEventMgr->StopEvent(eventId, force); return 0; @@ -2610,7 +2610,7 @@ namespace LuaGlobalFunctions * end) * * -- Example with request headers - * HttpRequest("GET", "https://postman-echo.com/headers", { Accept = "application/json", ["User-Agent"] = "Eluna Lua Engine" }, function(status, body, headers) + * HttpRequest("GET", "https://postman-echo.com/headers", { Accept = "application/json", ["User-Agent"] = "ALE Lua Engine" }, function(status, body, headers) * print(body) * end) * @@ -2628,8 +2628,8 @@ namespace LuaGlobalFunctions */ int HttpRequest(lua_State* L) { - std::string httpVerb = Eluna::CHECKVAL(L, 1); - std::string url = Eluna::CHECKVAL(L, 2); + std::string httpVerb = ALE::CHECKVAL(L, 1); + std::string url = ALE::CHECKVAL(L, 2); std::string body; std::string bodyContentType; httplib::Headers headers; @@ -2639,8 +2639,8 @@ namespace LuaGlobalFunctions if (!lua_istable(L, headersIdx) && lua_isstring(L, headersIdx) && lua_isstring(L, headersIdx + 1)) { - body = Eluna::CHECKVAL(L, 3); - bodyContentType = Eluna::CHECKVAL(L, 4); + body = ALE::CHECKVAL(L, 3); + bodyContentType = ALE::CHECKVAL(L, 4); headersIdx = 5; callbackIdx = 5; } @@ -2668,7 +2668,7 @@ namespace LuaGlobalFunctions int funcRef = luaL_ref(L, LUA_REGISTRYINDEX); if (funcRef >= 0) { - Eluna::GEluna->httpManager.PushRequest(new HttpWorkItem(funcRef, httpVerb, url, body, bodyContentType, headers)); + ALE::GALE->httpManager.PushRequest(new HttpWorkItem(funcRef, httpVerb, url, body, bodyContentType, headers)); } else { @@ -2697,16 +2697,16 @@ namespace LuaGlobalFunctions long long init = 0; if (lua_isstring(L, 1)) { - std::string str = Eluna::CHECKVAL(L, 1); + std::string str = ALE::CHECKVAL(L, 1); std::istringstream iss(str); iss >> init; if (iss.bad()) return luaL_argerror(L, 1, "long long (as string) could not be converted"); } else if (!lua_isnoneornil(L, 1)) - init = Eluna::CHECKVAL(L, 1); + init = ALE::CHECKVAL(L, 1); - Eluna::Push(L, init); + ALE::Push(L, init); return 1; } @@ -2729,16 +2729,16 @@ namespace LuaGlobalFunctions unsigned long long init = 0; if (lua_isstring(L, 1)) { - std::string str = Eluna::CHECKVAL(L, 1); + std::string str = ALE::CHECKVAL(L, 1); std::istringstream iss(str); iss >> init; if (iss.bad()) return luaL_argerror(L, 1, "unsigned long long (as string) could not be converted"); } else if (!lua_isnoneornil(L, 1)) - init = Eluna::CHECKVAL(L, 1); + init = ALE::CHECKVAL(L, 1); - Eluna::Push(L, init); + ALE::Push(L, init); return 1; } @@ -2759,12 +2759,12 @@ namespace LuaGlobalFunctions if (lua_isnoneornil(L, 1)) { - Eluna::GetEluna(L)->BGEventBindings->Clear(); + ALE::GetALE(L)->BGEventBindings->Clear(); } else { - uint32 event_type = Eluna::CHECKVAL(L, 1); - Eluna::GetEluna(L)->BGEventBindings->Clear(Key((Hooks::BGEvents)event_type)); + uint32 event_type = ALE::CHECKVAL(L, 1); + ALE::GetALE(L)->BGEventBindings->Clear(Key((Hooks::BGEvents)event_type)); } return 0; } @@ -2790,17 +2790,17 @@ namespace LuaGlobalFunctions if (lua_isnoneornil(L, 2)) { - uint32 entry = Eluna::CHECKVAL(L, 1); + uint32 entry = ALE::CHECKVAL(L, 1); - Eluna* E = Eluna::GetEluna(L); + ALE* E = ALE::GetALE(L); for (uint32 i = 1; i < Hooks::CREATURE_EVENT_COUNT; ++i) E->CreatureEventBindings->Clear(Key((Hooks::CreatureEvents)i, entry)); } else { - uint32 entry = Eluna::CHECKVAL(L, 1); - uint32 event_type = Eluna::CHECKVAL(L, 2); - Eluna::GetEluna(L)->CreatureEventBindings->Clear(Key((Hooks::CreatureEvents)event_type, entry)); + uint32 entry = ALE::CHECKVAL(L, 1); + uint32 event_type = ALE::CHECKVAL(L, 2); + ALE::GetALE(L)->CreatureEventBindings->Clear(Key((Hooks::CreatureEvents)event_type, entry)); } return 0; } @@ -2827,19 +2827,19 @@ namespace LuaGlobalFunctions if (lua_isnoneornil(L, 3)) { - ObjectGuid guid = Eluna::CHECKVAL(L, 1); - uint32 instanceId = Eluna::CHECKVAL(L, 2); + ObjectGuid guid = ALE::CHECKVAL(L, 1); + uint32 instanceId = ALE::CHECKVAL(L, 2); - Eluna* E = Eluna::GetEluna(L); + ALE* E = ALE::GetALE(L); for (uint32 i = 1; i < Hooks::CREATURE_EVENT_COUNT; ++i) E->CreatureUniqueBindings->Clear(Key((Hooks::CreatureEvents)i, guid, instanceId)); } else { - ObjectGuid guid = Eluna::CHECKVAL(L, 1); - uint32 instanceId = Eluna::CHECKVAL(L, 2); - uint32 event_type = Eluna::CHECKVAL(L, 3); - Eluna::GetEluna(L)->CreatureUniqueBindings->Clear(Key((Hooks::CreatureEvents)event_type, guid, instanceId)); + ObjectGuid guid = ALE::CHECKVAL(L, 1); + uint32 instanceId = ALE::CHECKVAL(L, 2); + uint32 event_type = ALE::CHECKVAL(L, 3); + ALE::GetALE(L)->CreatureUniqueBindings->Clear(Key((Hooks::CreatureEvents)event_type, guid, instanceId)); } return 0; } @@ -2852,7 +2852,7 @@ namespace LuaGlobalFunctions * Otherwise, only event handlers for `event_type` are cleared. * * **NOTE:** this will affect all instances of the [Creature], not just one. - * To bind and unbind gossip events to a single [Creature], tell the Eluna developers to implement that. + * To bind and unbind gossip events to a single [Creature], tell the ALE developers to implement that. * * @proto (entry) * @proto (entry, event_type) @@ -2865,17 +2865,17 @@ namespace LuaGlobalFunctions if (lua_isnoneornil(L, 2)) { - uint32 entry = Eluna::CHECKVAL(L, 1); + uint32 entry = ALE::CHECKVAL(L, 1); - Eluna* E = Eluna::GetEluna(L); + ALE* E = ALE::GetALE(L); for (uint32 i = 1; i < Hooks::GOSSIP_EVENT_COUNT; ++i) E->CreatureGossipBindings->Clear(Key((Hooks::GossipEvents)i, entry)); } else { - uint32 entry = Eluna::CHECKVAL(L, 1); - uint32 event_type = Eluna::CHECKVAL(L, 2); - Eluna::GetEluna(L)->CreatureGossipBindings->Clear(Key((Hooks::GossipEvents)event_type, entry)); + uint32 entry = ALE::CHECKVAL(L, 1); + uint32 event_type = ALE::CHECKVAL(L, 2); + ALE::GetALE(L)->CreatureGossipBindings->Clear(Key((Hooks::GossipEvents)event_type, entry)); } return 0; } @@ -2888,7 +2888,7 @@ namespace LuaGlobalFunctions * Otherwise, only event handlers for `event_type` are cleared. * * **NOTE:** this will affect all instances of the [GameObject], not just one. - * To bind and unbind events to a single [GameObject], tell the Eluna developers to implement that. + * To bind and unbind events to a single [GameObject], tell the ALE developers to implement that. * * @proto (entry) * @proto (entry, event_type) @@ -2901,17 +2901,17 @@ namespace LuaGlobalFunctions if (lua_isnoneornil(L, 2)) { - uint32 entry = Eluna::CHECKVAL(L, 1); + uint32 entry = ALE::CHECKVAL(L, 1); - Eluna* E = Eluna::GetEluna(L); + ALE* E = ALE::GetALE(L); for (uint32 i = 1; i < Hooks::GAMEOBJECT_EVENT_COUNT; ++i) E->GameObjectEventBindings->Clear(Key((Hooks::GameObjectEvents)i, entry)); } else { - uint32 entry = Eluna::CHECKVAL(L, 1); - uint32 event_type = Eluna::CHECKVAL(L, 2); - Eluna::GetEluna(L)->GameObjectEventBindings->Clear(Key((Hooks::GameObjectEvents)event_type, entry)); + uint32 entry = ALE::CHECKVAL(L, 1); + uint32 event_type = ALE::CHECKVAL(L, 2); + ALE::GetALE(L)->GameObjectEventBindings->Clear(Key((Hooks::GameObjectEvents)event_type, entry)); } return 0; } @@ -2924,7 +2924,7 @@ namespace LuaGlobalFunctions * Otherwise, only event handlers for `event_type` are cleared. * * **NOTE:** this will affect all instances of the [GameObject], not just one. - * To bind and unbind gossip events to a single [GameObject], tell the Eluna developers to implement that. + * To bind and unbind gossip events to a single [GameObject], tell the ALE developers to implement that. * * @proto (entry) * @proto (entry, event_type) @@ -2937,17 +2937,17 @@ namespace LuaGlobalFunctions if (lua_isnoneornil(L, 2)) { - uint32 entry = Eluna::CHECKVAL(L, 1); + uint32 entry = ALE::CHECKVAL(L, 1); - Eluna* E = Eluna::GetEluna(L); + ALE* E = ALE::GetALE(L); for (uint32 i = 1; i < Hooks::GOSSIP_EVENT_COUNT; ++i) E->GameObjectGossipBindings->Clear(Key((Hooks::GossipEvents)i, entry)); } else { - uint32 entry = Eluna::CHECKVAL(L, 1); - uint32 event_type = Eluna::CHECKVAL(L, 2); - Eluna::GetEluna(L)->GameObjectGossipBindings->Clear(Key((Hooks::GossipEvents)event_type, entry)); + uint32 entry = ALE::CHECKVAL(L, 1); + uint32 event_type = ALE::CHECKVAL(L, 2); + ALE::GetALE(L)->GameObjectGossipBindings->Clear(Key((Hooks::GossipEvents)event_type, entry)); } return 0; } @@ -2969,12 +2969,12 @@ namespace LuaGlobalFunctions if (lua_isnoneornil(L, 1)) { - Eluna::GetEluna(L)->GroupEventBindings->Clear(); + ALE::GetALE(L)->GroupEventBindings->Clear(); } else { - uint32 event_type = Eluna::CHECKVAL(L, 1); - Eluna::GetEluna(L)->GroupEventBindings->Clear(Key((Hooks::GroupEvents)event_type)); + uint32 event_type = ALE::CHECKVAL(L, 1); + ALE::GetALE(L)->GroupEventBindings->Clear(Key((Hooks::GroupEvents)event_type)); } return 0; } @@ -2996,12 +2996,12 @@ namespace LuaGlobalFunctions if (lua_isnoneornil(L, 1)) { - Eluna::GetEluna(L)->GuildEventBindings->Clear(); + ALE::GetALE(L)->GuildEventBindings->Clear(); } else { - uint32 event_type = Eluna::CHECKVAL(L, 1); - Eluna::GetEluna(L)->GuildEventBindings->Clear(Key((Hooks::GuildEvents)event_type)); + uint32 event_type = ALE::CHECKVAL(L, 1); + ALE::GetALE(L)->GuildEventBindings->Clear(Key((Hooks::GuildEvents)event_type)); } return 0; } @@ -3014,7 +3014,7 @@ namespace LuaGlobalFunctions * Otherwise, only event handlers for `event_type` are cleared. * * **NOTE:** this will affect all instances of the [Item], not just one. - * To bind and unbind events to a single [Item], tell the Eluna developers to implement that. + * To bind and unbind events to a single [Item], tell the ALE developers to implement that. * * @proto (entry) * @proto (entry, event_type) @@ -3027,17 +3027,17 @@ namespace LuaGlobalFunctions if (lua_isnoneornil(L, 2)) { - uint32 entry = Eluna::CHECKVAL(L, 1); + uint32 entry = ALE::CHECKVAL(L, 1); - Eluna* E = Eluna::GetEluna(L); + ALE* E = ALE::GetALE(L); for (uint32 i = 1; i < Hooks::ITEM_EVENT_COUNT; ++i) E->ItemEventBindings->Clear(Key((Hooks::ItemEvents)i, entry)); } else { - uint32 entry = Eluna::CHECKVAL(L, 1); - uint32 event_type = Eluna::CHECKVAL(L, 2); - Eluna::GetEluna(L)->ItemEventBindings->Clear(Key((Hooks::ItemEvents)event_type, entry)); + uint32 entry = ALE::CHECKVAL(L, 1); + uint32 event_type = ALE::CHECKVAL(L, 2); + ALE::GetALE(L)->ItemEventBindings->Clear(Key((Hooks::ItemEvents)event_type, entry)); } return 0; } @@ -3050,7 +3050,7 @@ namespace LuaGlobalFunctions * Otherwise, only event handlers for `event_type` are cleared. * * **NOTE:** this will affect all instances of the [Item], not just one. - * To bind and unbind gossip events to a single [Item], tell the Eluna developers to implement that. + * To bind and unbind gossip events to a single [Item], tell the ALE developers to implement that. * * @proto (entry) * @proto (entry, event_type) @@ -3063,17 +3063,17 @@ namespace LuaGlobalFunctions if (lua_isnoneornil(L, 2)) { - uint32 entry = Eluna::CHECKVAL(L, 1); + uint32 entry = ALE::CHECKVAL(L, 1); - Eluna* E = Eluna::GetEluna(L); + ALE* E = ALE::GetALE(L); for (uint32 i = 1; i < Hooks::GOSSIP_EVENT_COUNT; ++i) E->ItemGossipBindings->Clear(Key((Hooks::GossipEvents)i, entry)); } else { - uint32 entry = Eluna::CHECKVAL(L, 1); - uint32 event_type = Eluna::CHECKVAL(L, 2); - Eluna::GetEluna(L)->ItemGossipBindings->Clear(Key((Hooks::GossipEvents)event_type, entry)); + uint32 entry = ALE::CHECKVAL(L, 1); + uint32 event_type = ALE::CHECKVAL(L, 2); + ALE::GetALE(L)->ItemGossipBindings->Clear(Key((Hooks::GossipEvents)event_type, entry)); } return 0; } @@ -3096,17 +3096,17 @@ namespace LuaGlobalFunctions if (lua_isnoneornil(L, 2)) { - uint32 entry = Eluna::CHECKVAL(L, 1); + uint32 entry = ALE::CHECKVAL(L, 1); - Eluna* E = Eluna::GetEluna(L); + ALE* E = ALE::GetALE(L); for (uint32 i = 1; i < Hooks::PACKET_EVENT_COUNT; ++i) E->PacketEventBindings->Clear(Key((Hooks::PacketEvents)i, entry)); } else { - uint32 entry = Eluna::CHECKVAL(L, 1); - uint32 event_type = Eluna::CHECKVAL(L, 2); - Eluna::GetEluna(L)->PacketEventBindings->Clear(Key((Hooks::PacketEvents)event_type, entry)); + uint32 entry = ALE::CHECKVAL(L, 1); + uint32 event_type = ALE::CHECKVAL(L, 2); + ALE::GetALE(L)->PacketEventBindings->Clear(Key((Hooks::PacketEvents)event_type, entry)); } return 0; } @@ -3128,12 +3128,12 @@ namespace LuaGlobalFunctions if (lua_isnoneornil(L, 1)) { - Eluna::GetEluna(L)->PlayerEventBindings->Clear(); + ALE::GetALE(L)->PlayerEventBindings->Clear(); } else { - uint32 event_type = Eluna::CHECKVAL(L, 1); - Eluna::GetEluna(L)->PlayerEventBindings->Clear(Key((Hooks::PlayerEvents)event_type)); + uint32 event_type = ALE::CHECKVAL(L, 1); + ALE::GetALE(L)->PlayerEventBindings->Clear(Key((Hooks::PlayerEvents)event_type)); } return 0; } @@ -3156,17 +3156,17 @@ namespace LuaGlobalFunctions if (lua_isnoneornil(L, 2)) { - uint32 entry = Eluna::CHECKVAL(L, 1); + uint32 entry = ALE::CHECKVAL(L, 1); - Eluna* E = Eluna::GetEluna(L); + ALE* E = ALE::GetALE(L); for (uint32 i = 1; i < Hooks::GOSSIP_EVENT_COUNT; ++i) E->PlayerGossipBindings->Clear(Key((Hooks::GossipEvents)i, entry)); } else { - uint32 entry = Eluna::CHECKVAL(L, 1); - uint32 event_type = Eluna::CHECKVAL(L, 2); - Eluna::GetEluna(L)->PlayerGossipBindings->Clear(Key((Hooks::GossipEvents)event_type, entry)); + uint32 entry = ALE::CHECKVAL(L, 1); + uint32 event_type = ALE::CHECKVAL(L, 2); + ALE::GetALE(L)->PlayerGossipBindings->Clear(Key((Hooks::GossipEvents)event_type, entry)); } return 0; } @@ -3188,12 +3188,12 @@ namespace LuaGlobalFunctions if (lua_isnoneornil(L, 1)) { - Eluna::GetEluna(L)->ServerEventBindings->Clear(); + ALE::GetALE(L)->ServerEventBindings->Clear(); } else { - uint32 event_type = Eluna::CHECKVAL(L, 1); - Eluna::GetEluna(L)->ServerEventBindings->Clear(Key((Hooks::ServerEvents)event_type)); + uint32 event_type = ALE::CHECKVAL(L, 1); + ALE::GetALE(L)->ServerEventBindings->Clear(Key((Hooks::ServerEvents)event_type)); } return 0; } @@ -3216,17 +3216,17 @@ namespace LuaGlobalFunctions if (lua_isnoneornil(L, 2)) { - uint32 entry = Eluna::CHECKVAL(L, 1); + uint32 entry = ALE::CHECKVAL(L, 1); - Eluna* E = Eluna::GetEluna(L); + ALE* E = ALE::GetALE(L); for (uint32 i = 1; i < Hooks::INSTANCE_EVENT_COUNT; ++i) E->MapEventBindings->Clear(Key((Hooks::InstanceEvents)i, entry)); } else { - uint32 entry = Eluna::CHECKVAL(L, 1); - uint32 event_type = Eluna::CHECKVAL(L, 2); - Eluna::GetEluna(L)->MapEventBindings->Clear(Key((Hooks::InstanceEvents)event_type, entry)); + uint32 entry = ALE::CHECKVAL(L, 1); + uint32 event_type = ALE::CHECKVAL(L, 2); + ALE::GetALE(L)->MapEventBindings->Clear(Key((Hooks::InstanceEvents)event_type, entry)); } return 0; @@ -3250,17 +3250,17 @@ namespace LuaGlobalFunctions if (lua_isnoneornil(L, 2)) { - uint32 entry = Eluna::CHECKVAL(L, 1); + uint32 entry = ALE::CHECKVAL(L, 1); - Eluna* E = Eluna::GetEluna(L); + ALE* E = ALE::GetALE(L); for (uint32 i = 1; i < Hooks::INSTANCE_EVENT_COUNT; ++i) E->InstanceEventBindings->Clear(Key((Hooks::InstanceEvents)i, entry)); } else { - uint32 entry = Eluna::CHECKVAL(L, 1); - uint32 event_type = Eluna::CHECKVAL(L, 2); - Eluna::GetEluna(L)->InstanceEventBindings->Clear(Key((Hooks::InstanceEvents)event_type, entry)); + uint32 entry = ALE::CHECKVAL(L, 1); + uint32 event_type = ALE::CHECKVAL(L, 2); + ALE::GetALE(L)->InstanceEventBindings->Clear(Key((Hooks::InstanceEvents)event_type, entry)); } return 0; @@ -3283,12 +3283,12 @@ namespace LuaGlobalFunctions if (lua_isnoneornil(L, 1)) { - Eluna::GetEluna(L)->TicketEventBindings->Clear(); + ALE::GetALE(L)->TicketEventBindings->Clear(); } else { - uint32 event_type = Eluna::CHECKVAL(L, 1); - Eluna::GetEluna(L)->TicketEventBindings->Clear(Key((Hooks::TicketEvents)event_type)); + uint32 event_type = ALE::CHECKVAL(L, 1); + ALE::GetALE(L)->TicketEventBindings->Clear(Key((Hooks::TicketEvents)event_type)); } return 0; } @@ -3312,17 +3312,17 @@ namespace LuaGlobalFunctions if (lua_isnoneornil(L, 2)) { - uint32 entry = Eluna::CHECKVAL(L, 1); + uint32 entry = ALE::CHECKVAL(L, 1); - Eluna* E = Eluna::GetEluna(L); + ALE* E = ALE::GetALE(L); for (uint32 i = 1; i < Hooks::SPELL_EVENT_COUNT; ++i) E->SpellEventBindings->Clear(Key((Hooks::SpellEvents)i, entry)); } else { - uint32 entry = Eluna::CHECKVAL(L, 1); - uint32 event_type = Eluna::CHECKVAL(L, 2); - Eluna::GetEluna(L)->SpellEventBindings->Clear(Key((Hooks::SpellEvents)event_type, entry)); + uint32 entry = ALE::CHECKVAL(L, 1); + uint32 event_type = ALE::CHECKVAL(L, 2); + ALE::GetALE(L)->SpellEventBindings->Clear(Key((Hooks::SpellEvents)event_type, entry)); } return 0; } @@ -3344,12 +3344,12 @@ namespace LuaGlobalFunctions if (lua_isnoneornil(L, 1)) { - Eluna::GetEluna(L)->AllCreatureEventBindings->Clear(); + ALE::GetALE(L)->AllCreatureEventBindings->Clear(); } else { - uint32 event_type = Eluna::CHECKVAL(L, 1); - Eluna::GetEluna(L)->AllCreatureEventBindings->Clear(Key((Hooks::AllCreatureEvents)event_type)); + uint32 event_type = ALE::CHECKVAL(L, 1); + ALE::GetALE(L)->AllCreatureEventBindings->Clear(Key((Hooks::AllCreatureEvents)event_type)); } return 0; } @@ -3369,8 +3369,8 @@ namespace LuaGlobalFunctions { OutdoorPvPNA* nagrandPvp = (OutdoorPvPNA*)sOutdoorPvPMgr->GetOutdoorPvPToZoneId(3518); OPvPCapturePointNA* halaa = nagrandPvp->GetCapturePoint(); - Eluna::Push(L, halaa->GetControllingFaction()); - Eluna::Push(L, halaa->GetSlider()); + ALE::Push(L, halaa->GetControllingFaction()); + ALE::Push(L, halaa->GetSlider()); return 2; } @@ -3384,7 +3384,7 @@ namespace LuaGlobalFunctions */ int SetOwnerHalaa(lua_State* L) { - uint16 teamId = Eluna::CHECKVAL(L, 1); + uint16 teamId = ALE::CHECKVAL(L, 1); OutdoorPvPNA* nagrandPvp = (OutdoorPvPNA*)sOutdoorPvPMgr->GetOutdoorPvPToZoneId(3518); OPvPCapturePointNA* halaa = nagrandPvp->GetCapturePoint(); @@ -3417,9 +3417,9 @@ namespace LuaGlobalFunctions */ int GetGossipMenuOptionLocale(lua_State* L) { - uint32 menuId = Eluna::CHECKVAL(L, 1); - uint32 optionId = Eluna::CHECKVAL(L, 2); - uint8 locale = Eluna::CHECKVAL(L, 3); + uint32 menuId = ALE::CHECKVAL(L, 1); + uint32 optionId = ALE::CHECKVAL(L, 2); + uint8 locale = ALE::CHECKVAL(L, 3); std::string strOptionText; std::string strBoxText; @@ -3449,8 +3449,8 @@ namespace LuaGlobalFunctions } } - Eluna::Push(L, strOptionText); - Eluna::Push(L, strBoxText); + ALE::Push(L, strOptionText); + ALE::Push(L, strBoxText); return 2; } @@ -3466,7 +3466,7 @@ namespace LuaGlobalFunctions */ int GetMapEntrance(lua_State* L) { - uint32 mapId = Eluna::CHECKVAL(L, 1); + uint32 mapId = ALE::CHECKVAL(L, 1); AreaTriggerTeleport const* at = sObjectMgr->GetMapEntranceTrigger(mapId); if (!at) @@ -3475,10 +3475,10 @@ namespace LuaGlobalFunctions return 1; } - Eluna::Push(L, at->target_X); - Eluna::Push(L, at->target_Y); - Eluna::Push(L, at->target_Z); - Eluna::Push(L, at->target_Orientation); + ALE::Push(L, at->target_X); + ALE::Push(L, at->target_Y); + ALE::Push(L, at->target_Z); + ALE::Push(L, at->target_Orientation); return 5; } @@ -3491,8 +3491,8 @@ namespace LuaGlobalFunctions */ int GetSpellInfo(lua_State* L) { - uint32 spellId = Eluna::CHECKVAL(L, 1); - Eluna::Push(L, sSpellMgr->GetSpellInfo(spellId)); + uint32 spellId = ALE::CHECKVAL(L, 1); + ALE::Push(L, sSpellMgr->GetSpellInfo(spellId)); return 1; } @@ -3509,8 +3509,8 @@ namespace LuaGlobalFunctions */ int LookupEntry(lua_State* L) { - const char* dbcName = Eluna::CHECKVAL(L, 1); - uint32 id = Eluna::CHECKVAL(L, 2); + const char* dbcName = ALE::CHECKVAL(L, 1); + uint32 id = ALE::CHECKVAL(L, 2); for (const auto& dbc : dbcRegistry) { diff --git a/src/LuaEngine/methods/GroupMethods.h b/src/LuaEngine/methods/GroupMethods.h index bd5dbac..5c0fc37 100644 --- a/src/LuaEngine/methods/GroupMethods.h +++ b/src/LuaEngine/methods/GroupMethods.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 */ @@ -22,8 +22,8 @@ namespace LuaGroup */ int IsLeader(lua_State* L, Group* group) { - ObjectGuid guid = Eluna::CHECKVAL(L, 2); - Eluna::Push(L, group->IsLeader(guid)); + ObjectGuid guid = ALE::CHECKVAL(L, 2); + ALE::Push(L, group->IsLeader(guid)); return 1; } @@ -34,7 +34,7 @@ namespace LuaGroup */ int IsFull(lua_State* L, Group* group) { - Eluna::Push(L, group->IsFull()); + ALE::Push(L, group->IsFull()); return 1; } @@ -45,7 +45,7 @@ namespace LuaGroup */ int IsLFGGroup(lua_State* L, Group* group) { - Eluna::Push(L, group->isLFGGroup()); + ALE::Push(L, group->isLFGGroup()); return 1; } @@ -56,7 +56,7 @@ namespace LuaGroup */ int IsRaidGroup(lua_State* L, Group* group) { - Eluna::Push(L, group->isRaidGroup()); + ALE::Push(L, group->isRaidGroup()); return 1; } @@ -67,7 +67,7 @@ namespace LuaGroup */ int IsBGGroup(lua_State* L, Group* group) { - Eluna::Push(L, group->isBGGroup()); + ALE::Push(L, group->isBGGroup()); return 1; } @@ -79,8 +79,8 @@ namespace LuaGroup */ int IsMember(lua_State* L, Group* group) { - ObjectGuid guid = Eluna::CHECKVAL(L, 2); - Eluna::Push(L, group->IsMember(guid)); + ObjectGuid guid = ALE::CHECKVAL(L, 2); + ALE::Push(L, group->IsMember(guid)); return 1; } @@ -92,8 +92,8 @@ namespace LuaGroup */ int IsAssistant(lua_State* L, Group* group) { - ObjectGuid guid = Eluna::CHECKVAL(L, 2); - Eluna::Push(L, group->IsAssistant(guid)); + ObjectGuid guid = ALE::CHECKVAL(L, 2); + ALE::Push(L, group->IsAssistant(guid)); return 1; } @@ -106,9 +106,9 @@ namespace LuaGroup */ int SameSubGroup(lua_State* L, Group* group) { - Player* player1 = Eluna::CHECKOBJ(L, 2); - Player* player2 = Eluna::CHECKOBJ(L, 3); - Eluna::Push(L, group->SameSubGroup(player1, player2)); + Player* player1 = ALE::CHECKOBJ(L, 2); + Player* player2 = ALE::CHECKOBJ(L, 3); + ALE::Push(L, group->SameSubGroup(player1, player2)); return 1; } @@ -120,7 +120,7 @@ namespace LuaGroup */ int HasFreeSlotSubGroup(lua_State* L, Group* group) { - uint8 subGroup = Eluna::CHECKVAL(L, 2); + uint8 subGroup = ALE::CHECKVAL(L, 2); if (subGroup >= MAX_RAID_SUBGROUPS) { @@ -128,7 +128,7 @@ namespace LuaGroup return 0; } - Eluna::Push(L, group->HasFreeSlotSubGroup(subGroup)); + ALE::Push(L, group->HasFreeSlotSubGroup(subGroup)); return 1; } @@ -140,11 +140,11 @@ namespace LuaGroup */ int AddMember(lua_State* L, Group* group) { - Player* player = Eluna::CHECKOBJ(L, 2); + Player* player = ALE::CHECKOBJ(L, 2); if (player->GetGroup() || !group->IsCreated() || group->IsFull()) { - Eluna::Push(L, false); + ALE::Push(L, false); return 1; } @@ -155,19 +155,19 @@ namespace LuaGroup if (success) group->BroadcastGroupUpdate(); - Eluna::Push(L, success); + ALE::Push(L, success); return 1; } /*int IsLFGGroup(lua_State* L, Group* group) // TODO: Implementation { - Eluna::Push(L, group->isLFGGroup()); + ALE::Push(L, group->isLFGGroup()); return 1; }*/ /*int IsBFGroup(lua_State* L, Group* group) // TODO: Implementation { - Eluna::Push(L, group->isBFGroup()); + ALE::Push(L, group->isBFGroup()); return 1; }*/ @@ -189,7 +189,7 @@ namespace LuaGroup if (!member || !member->GetSession()) continue; - Eluna::Push(L, member); + ALE::Push(L, member); lua_rawseti(L, tbl, ++i); } @@ -204,7 +204,7 @@ namespace LuaGroup */ int GetLeaderGUID(lua_State* L, Group* group) { - Eluna::Push(L, group->GetLeaderGUID()); + ALE::Push(L, group->GetLeaderGUID()); return 1; } @@ -215,7 +215,7 @@ namespace LuaGroup */ int GetGUID(lua_State* L, Group* group) { - Eluna::Push(L, group->GET_GUID()); + ALE::Push(L, group->GET_GUID()); return 1; } @@ -227,9 +227,9 @@ namespace LuaGroup */ int GetMemberGUID(lua_State* L, Group* group) { - const char* name = Eluna::CHECKVAL(L, 2); + const char* name = ALE::CHECKVAL(L, 2); - Eluna::Push(L, group->GetMemberGUID(name)); + ALE::Push(L, group->GetMemberGUID(name)); return 1; } @@ -240,7 +240,7 @@ namespace LuaGroup */ int GetMembersCount(lua_State* L, Group* group) { - Eluna::Push(L, group->GetMembersCount()); + ALE::Push(L, group->GetMembersCount()); return 1; } @@ -262,7 +262,7 @@ namespace LuaGroup */ int GetGroupType(lua_State* L, Group* group) { - Eluna::Push(L, group->GetGroupType()); + ALE::Push(L, group->GetGroupType()); return 1; } @@ -274,8 +274,8 @@ namespace LuaGroup */ int GetMemberGroup(lua_State* L, Group* group) { - ObjectGuid guid = Eluna::CHECKVAL(L, 2); - Eluna::Push(L, group->GetMemberGroup(guid)); + ObjectGuid guid = ALE::CHECKVAL(L, 2); + ALE::Push(L, group->GetMemberGroup(guid)); return 1; } @@ -286,7 +286,7 @@ namespace LuaGroup */ int SetLeader(lua_State* L, Group* group) { - ObjectGuid guid = Eluna::CHECKVAL(L, 2); + ObjectGuid guid = ALE::CHECKVAL(L, 2); group->ChangeLeader(guid); group->SendUpdate(); return 0; @@ -301,9 +301,9 @@ namespace LuaGroup */ int SendPacket(lua_State* L, Group* group) { - WorldPacket* data = Eluna::CHECKOBJ(L, 2); - bool ignorePlayersInBg = Eluna::CHECKVAL(L, 3); - ObjectGuid ignore = Eluna::CHECKVAL(L, 4); + WorldPacket* data = ALE::CHECKOBJ(L, 2); + bool ignorePlayersInBg = ALE::CHECKVAL(L, 3); + ObjectGuid ignore = ALE::CHECKVAL(L, 4); group->BroadcastPacket(data, ignorePlayersInBg, -1, ignore); return 0; @@ -328,10 +328,10 @@ namespace LuaGroup */ int RemoveMember(lua_State* L, Group* group) { - ObjectGuid guid = Eluna::CHECKVAL(L, 2); - uint32 method = Eluna::CHECKVAL(L, 3, 0); + ObjectGuid guid = ALE::CHECKVAL(L, 2); + uint32 method = ALE::CHECKVAL(L, 3, 0); - Eluna::Push(L, group->RemoveMember(guid, (RemoveMethod)method)); + ALE::Push(L, group->RemoveMember(guid, (RemoveMethod)method)); return 1; } @@ -363,8 +363,8 @@ namespace LuaGroup */ int SetMembersGroup(lua_State* L, Group* group) { - ObjectGuid guid = Eluna::CHECKVAL(L, 2); - uint8 subGroup = Eluna::CHECKVAL(L, 3); + ObjectGuid guid = ALE::CHECKVAL(L, 2); + uint8 subGroup = ALE::CHECKVAL(L, 3); if (subGroup >= MAX_RAID_SUBGROUPS) { @@ -388,9 +388,9 @@ namespace LuaGroup */ int SetTargetIcon(lua_State* L, Group* group) { - uint8 icon = Eluna::CHECKVAL(L, 2); - ObjectGuid target = Eluna::CHECKVAL(L, 3); - ObjectGuid setter = Eluna::CHECKVAL(L, 4, ObjectGuid()); + uint8 icon = ALE::CHECKVAL(L, 2); + ObjectGuid target = ALE::CHECKVAL(L, 3); + ObjectGuid setter = ALE::CHECKVAL(L, 4, ObjectGuid()); if (icon >= TARGETICONCOUNT) return luaL_argerror(L, 2, "valid target icon expected"); @@ -417,9 +417,9 @@ namespace LuaGroup */ int SetMemberFlag(lua_State* L, Group* group) { - ObjectGuid target = Eluna::CHECKVAL(L, 2); - bool apply = Eluna::CHECKVAL(L, 3); - GroupMemberFlags flag = static_cast(Eluna::CHECKVAL(L, 4)); + ObjectGuid target = ALE::CHECKVAL(L, 2); + bool apply = ALE::CHECKVAL(L, 3); + GroupMemberFlags flag = static_cast(ALE::CHECKVAL(L, 4)); group->SetGroupMemberFlag(target, apply, flag); return 0; diff --git a/src/LuaEngine/methods/GuildMethods.h b/src/LuaEngine/methods/GuildMethods.h index 5977c2a..979f564 100644 --- a/src/LuaEngine/methods/GuildMethods.h +++ b/src/LuaEngine/methods/GuildMethods.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 */ @@ -36,7 +36,7 @@ namespace LuaGuild { if (player->IsInWorld() && player->GetGuildId() == guild->GetId()) { - Eluna::Push(L, player); + ALE::Push(L, player); lua_rawseti(L, tbl, ++i); } } @@ -54,7 +54,7 @@ namespace LuaGuild */ int GetMemberCount(lua_State* L, Guild* guild) { - Eluna::Push(L, guild->GetMemberCount()); + ALE::Push(L, guild->GetMemberCount()); return 1; } @@ -65,7 +65,7 @@ namespace LuaGuild */ int GetLeader(lua_State* L, Guild* guild) { - Eluna::Push(L, eObjectAccessor()FindPlayer(guild->GetLeaderGUID())); + ALE::Push(L, eObjectAccessor()FindPlayer(guild->GetLeaderGUID())); return 1; } @@ -76,7 +76,7 @@ namespace LuaGuild */ int GetLeaderGUID(lua_State* L, Guild* guild) { - Eluna::Push(L, guild->GetLeaderGUID()); + ALE::Push(L, guild->GetLeaderGUID()); return 1; } @@ -87,7 +87,7 @@ namespace LuaGuild */ int GetId(lua_State* L, Guild* guild) { - Eluna::Push(L, guild->GetId()); + ALE::Push(L, guild->GetId()); return 1; } @@ -98,7 +98,7 @@ namespace LuaGuild */ int GetName(lua_State* L, Guild* guild) { - Eluna::Push(L, guild->GetName()); + ALE::Push(L, guild->GetName()); return 1; } @@ -109,7 +109,7 @@ namespace LuaGuild */ int GetMOTD(lua_State* L, Guild* guild) { - Eluna::Push(L, guild->GetMOTD()); + ALE::Push(L, guild->GetMOTD()); return 1; } @@ -120,7 +120,7 @@ namespace LuaGuild */ int GetInfo(lua_State* L, Guild* guild) { - Eluna::Push(L, guild->GetInfo()); + ALE::Push(L, guild->GetInfo()); return 1; } @@ -131,7 +131,7 @@ namespace LuaGuild */ int SetLeader(lua_State* L, Guild* guild) { - Player* player = Eluna::CHECKOBJ(L, 2); + Player* player = ALE::CHECKOBJ(L, 2); guild->HandleSetLeader(player->GetSession(), player->GetName()); return 0; @@ -145,8 +145,8 @@ namespace LuaGuild */ int SetBankTabText(lua_State* L, Guild* guild) { - uint8 tabId = Eluna::CHECKVAL(L, 2); - const char* text = Eluna::CHECKVAL(L, 3); + uint8 tabId = ALE::CHECKVAL(L, 2); + const char* text = ALE::CHECKVAL(L, 3); guild->SetBankTabText(tabId, text); return 0; } @@ -159,7 +159,7 @@ namespace LuaGuild */ int SendPacket(lua_State* L, Guild* guild) { - WorldPacket* data = Eluna::CHECKOBJ(L, 2); + WorldPacket* data = ALE::CHECKOBJ(L, 2); guild->BroadcastPacket(data); return 0; @@ -174,8 +174,8 @@ namespace LuaGuild */ int SendPacketToRanked(lua_State* L, Guild* guild) { - WorldPacket* data = Eluna::CHECKOBJ(L, 2); - uint8 ranked = Eluna::CHECKVAL(L, 3); + WorldPacket* data = ALE::CHECKOBJ(L, 2); + uint8 ranked = ALE::CHECKVAL(L, 3); guild->BroadcastPacketToRank(data, ranked); return 0; @@ -200,8 +200,8 @@ namespace LuaGuild */ int AddMember(lua_State* L, Guild* guild) { - Player* player = Eluna::CHECKOBJ(L, 2); - uint8 rankId = Eluna::CHECKVAL(L, 3, GUILD_RANK_NONE); + Player* player = ALE::CHECKOBJ(L, 2); + uint8 rankId = ALE::CHECKVAL(L, 3, GUILD_RANK_NONE); guild->AddMember(player->GET_GUID(), rankId); return 0; @@ -215,8 +215,8 @@ namespace LuaGuild */ int DeleteMember(lua_State* L, Guild* guild) { - Player* player = Eluna::CHECKOBJ(L, 2); - bool isDisbanding = Eluna::CHECKVAL(L, 3, false); + Player* player = ALE::CHECKOBJ(L, 2); + bool isDisbanding = ALE::CHECKVAL(L, 3, false); guild->DeleteMember(player->GET_GUID(), isDisbanding); return 0; @@ -230,8 +230,8 @@ namespace LuaGuild */ int SetMemberRank(lua_State* L, Guild* guild) { - Player* player = Eluna::CHECKOBJ(L, 2); - uint8 newRank = Eluna::CHECKVAL(L, 3); + Player* player = ALE::CHECKOBJ(L, 2); + uint8 newRank = ALE::CHECKVAL(L, 3); guild->ChangeMemberRank(player->GET_GUID(), newRank); return 0; @@ -244,7 +244,7 @@ namespace LuaGuild */ int SetName(lua_State* L, Guild* guild) { - std::string name = Eluna::CHECKVAL(L, 2); + std::string name = ALE::CHECKVAL(L, 2); guild->SetName(name); return 0; @@ -265,9 +265,9 @@ namespace LuaGuild */ int UpdateMemberData(lua_State* L, Guild* guild) { - Player* player = Eluna::CHECKOBJ(L, 2); - uint8 dataid = Eluna::CHECKVAL(L, 3); - uint32 value = Eluna::CHECKVAL(L, 4); + Player* player = ALE::CHECKOBJ(L, 2); + uint8 dataid = ALE::CHECKVAL(L, 3); + uint32 value = ALE::CHECKVAL(L, 4); guild->UpdateMemberData(player, dataid, value); return 0; @@ -283,10 +283,10 @@ namespace LuaGuild */ int SendMessage(lua_State* L, Guild* guild) { - Player* player = Eluna::CHECKOBJ(L, 2); - bool officerOnly = Eluna::CHECKVAL(L, 3, false); - std::string msg = Eluna::CHECKVAL(L, 4); - uint32 language = Eluna::CHECKVAL(L, 5, false); + Player* player = ALE::CHECKOBJ(L, 2); + bool officerOnly = ALE::CHECKVAL(L, 3, false); + std::string msg = ALE::CHECKVAL(L, 4); + uint32 language = ALE::CHECKVAL(L, 5, false); guild->BroadcastToGuild(player->GetSession(), officerOnly, msg, language); return 0; @@ -302,10 +302,10 @@ namespace LuaGuild */ int MassInviteToEvent(lua_State* L, Guild* guild) { - Player* player = Eluna::CHECKOBJ(L, 2); - uint32 minLevel = Eluna::CHECKVAL(L, 3); - uint32 maxLevel = Eluna::CHECKVAL(L, 4); - uint32 minRank = Eluna::CHECKVAL(L, 5); + Player* player = ALE::CHECKOBJ(L, 2); + uint32 minLevel = ALE::CHECKVAL(L, 3); + uint32 maxLevel = ALE::CHECKVAL(L, 4); + uint32 minRank = ALE::CHECKVAL(L, 5); guild->MassInviteToEvent(player->GetSession(), minLevel, maxLevel, minRank); return 0; @@ -323,12 +323,12 @@ namespace LuaGuild */ int SwapItems(lua_State* L, Guild* guild) { - Player* player = Eluna::CHECKOBJ(L, 2); - uint8 tabId = Eluna::CHECKVAL(L, 3); - uint8 slotId = Eluna::CHECKVAL(L, 4); - uint8 destTabId = Eluna::CHECKVAL(L, 5); - uint8 destSlotId = Eluna::CHECKVAL(L, 6); - uint32 splitedAmount = Eluna::CHECKVAL(L, 7); + Player* player = ALE::CHECKOBJ(L, 2); + uint8 tabId = ALE::CHECKVAL(L, 3); + uint8 slotId = ALE::CHECKVAL(L, 4); + uint8 destTabId = ALE::CHECKVAL(L, 5); + uint8 destSlotId = ALE::CHECKVAL(L, 6); + uint32 splitedAmount = ALE::CHECKVAL(L, 7); guild->SwapItems(player, tabId, slotId, destTabId, destSlotId, splitedAmount); return 0; @@ -347,13 +347,13 @@ namespace LuaGuild */ int SwapItemsWithInventory(lua_State* L, Guild* guild) { - Player* player = Eluna::CHECKOBJ(L, 2); - bool toChar = Eluna::CHECKVAL(L, 3, false); - uint8 tabId = Eluna::CHECKVAL(L, 4); - uint8 slotId = Eluna::CHECKVAL(L, 5); - uint8 playerBag = Eluna::CHECKVAL(L, 6); - uint8 playerSlotId = Eluna::CHECKVAL(L, 7); - uint32 splitedAmount = Eluna::CHECKVAL(L, 8); + Player* player = ALE::CHECKOBJ(L, 2); + bool toChar = ALE::CHECKVAL(L, 3, false); + uint8 tabId = ALE::CHECKVAL(L, 4); + uint8 slotId = ALE::CHECKVAL(L, 5); + uint8 playerBag = ALE::CHECKVAL(L, 6); + uint8 playerSlotId = ALE::CHECKVAL(L, 7); + uint32 splitedAmount = ALE::CHECKVAL(L, 8); guild->SwapItemsWithInventory(player, toChar, tabId, slotId, playerBag, playerSlotId, splitedAmount); return 0; @@ -366,7 +366,7 @@ namespace LuaGuild */ int GetTotalBankMoney(lua_State* L, Guild* guild) { - Eluna::Push(L, guild->GetTotalBankMoney()); + ALE::Push(L, guild->GetTotalBankMoney()); return 1; } @@ -377,7 +377,7 @@ namespace LuaGuild */ int GetCreatedDate(lua_State* L, Guild* guild) { - Eluna::Push(L, guild->GetCreatedDate()); + ALE::Push(L, guild->GetCreatedDate()); return 1; } @@ -399,11 +399,11 @@ namespace LuaGuild */ int ModifyBankMoney(lua_State* L, Guild* guild) { - uint64 amount = Eluna::CHECKVAL(L, 2); - bool add = Eluna::CHECKVAL(L, 2); + uint64 amount = ALE::CHECKVAL(L, 2); + bool add = ALE::CHECKVAL(L, 2); CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction(); - Eluna::Push(L, guild->ModifyBankMoney(trans, amount, add)); + ALE::Push(L, guild->ModifyBankMoney(trans, amount, add)); CharacterDatabase.CommitTransaction(trans); return 1; diff --git a/src/LuaEngine/methods/ItemMethods.h b/src/LuaEngine/methods/ItemMethods.h index 018cf9a..06ddf1d 100644 --- a/src/LuaEngine/methods/ItemMethods.h +++ b/src/LuaEngine/methods/ItemMethods.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 */ @@ -21,7 +21,7 @@ namespace LuaItem */ int IsSoulBound(lua_State* L, Item* item) { - Eluna::Push(L, item->IsSoulBound()); + ALE::Push(L, item->IsSoulBound()); return 1; } @@ -32,7 +32,7 @@ namespace LuaItem */ int IsBoundAccountWide(lua_State* L, Item* item) { - Eluna::Push(L, item->IsBoundAccountWide()); + ALE::Push(L, item->IsBoundAccountWide()); return 1; } @@ -43,7 +43,7 @@ namespace LuaItem */ int IsBoundByEnchant(lua_State* L, Item* item) { - Eluna::Push(L, item->IsBoundByEnchant()); + ALE::Push(L, item->IsBoundByEnchant()); return 1; } @@ -55,9 +55,9 @@ namespace LuaItem */ int IsNotBoundToPlayer(lua_State* L, Item* item) { - Player* player = Eluna::CHECKOBJ(L, 2); + Player* player = ALE::CHECKOBJ(L, 2); - Eluna::Push(L, item->IsBindedNotWith(player)); + ALE::Push(L, item->IsBindedNotWith(player)); return 1; } @@ -68,7 +68,7 @@ namespace LuaItem */ int IsLocked(lua_State* L, Item* item) { - Eluna::Push(L, item->IsLocked()); + ALE::Push(L, item->IsLocked()); return 1; } @@ -79,7 +79,7 @@ namespace LuaItem */ int IsBag(lua_State* L, Item* item) { - Eluna::Push(L, item->IsBag()); + ALE::Push(L, item->IsBag()); return 1; } @@ -90,7 +90,7 @@ namespace LuaItem */ int IsCurrencyToken(lua_State* L, Item* item) { - Eluna::Push(L, item->IsCurrencyToken()); + ALE::Push(L, item->IsCurrencyToken()); return 1; } @@ -101,7 +101,7 @@ namespace LuaItem */ int IsNotEmptyBag(lua_State* L, Item* item) { - Eluna::Push(L, item->IsNotEmptyBag()); + ALE::Push(L, item->IsNotEmptyBag()); return 1; } @@ -112,7 +112,7 @@ namespace LuaItem */ int IsBroken(lua_State* L, Item* item) { - Eluna::Push(L, item->IsBroken()); + ALE::Push(L, item->IsBroken()); return 1; } @@ -123,8 +123,8 @@ namespace LuaItem */ int CanBeTraded(lua_State* L, Item* item) { - bool mail = Eluna::CHECKVAL(L, 2, false); - Eluna::Push(L, item->CanBeTraded(mail)); + bool mail = ALE::CHECKVAL(L, 2, false); + ALE::Push(L, item->CanBeTraded(mail)); return 1; } @@ -135,7 +135,7 @@ namespace LuaItem */ int IsInTrade(lua_State* L, Item* item) { - Eluna::Push(L, item->IsInTrade()); + ALE::Push(L, item->IsInTrade()); return 1; } @@ -146,7 +146,7 @@ namespace LuaItem */ int IsInBag(lua_State* L, Item* item) { - Eluna::Push(L, item->IsInBag()); + ALE::Push(L, item->IsInBag()); return 1; } @@ -157,7 +157,7 @@ namespace LuaItem */ int IsEquipped(lua_State* L, Item* item) { - Eluna::Push(L, item->IsEquipped()); + ALE::Push(L, item->IsEquipped()); return 1; } @@ -169,8 +169,8 @@ namespace LuaItem */ int HasQuest(lua_State* L, Item* item) { - uint32 quest = Eluna::CHECKVAL(L, 2); - Eluna::Push(L, item->hasQuest(quest)); + uint32 quest = ALE::CHECKVAL(L, 2); + ALE::Push(L, item->hasQuest(quest)); return 1; } @@ -181,7 +181,7 @@ namespace LuaItem */ int IsPotion(lua_State* L, Item* item) { - Eluna::Push(L, item->IsPotion()); + ALE::Push(L, item->IsPotion()); return 1; } @@ -192,7 +192,7 @@ namespace LuaItem */ int IsWeaponVellum(lua_State* L, Item* item) { - Eluna::Push(L, item->IsWeaponVellum()); + ALE::Push(L, item->IsWeaponVellum()); return 1; } @@ -203,7 +203,7 @@ namespace LuaItem */ int IsArmorVellum(lua_State* L, Item* item) { - Eluna::Push(L, item->IsArmorVellum()); + ALE::Push(L, item->IsArmorVellum()); return 1; } @@ -214,13 +214,13 @@ namespace LuaItem */ int IsConjuredConsumable(lua_State* L, Item* item) { - Eluna::Push(L, item->IsConjuredConsumable()); + ALE::Push(L, item->IsConjuredConsumable()); return 1; } /*int IsRefundExpired(lua_State* L, Item* item)// TODO: Implement core support { - Eluna::Push(L, item->IsRefundExpired()); + ALE::Push(L, item->IsRefundExpired()); return 1; }*/ @@ -247,7 +247,7 @@ namespace LuaItem */ int GetItemLink(lua_State* L, Item* item) { - uint8 locale = Eluna::CHECKVAL(L, 2, DEFAULT_LOCALE); + uint8 locale = ALE::CHECKVAL(L, 2, DEFAULT_LOCALE); if (locale >= TOTAL_LOCALES) return luaL_argerror(L, 2, "valid LocaleConstant expected"); @@ -296,7 +296,7 @@ namespace LuaItem item->GetItemRandomPropertyId() << ":" << item->GetItemSuffixFactor() << ":" << (uint32)(owner ? owner->GetLevel() : 0) << "|h[" << name << "]|h|r"; - Eluna::Push(L, oss.str()); + ALE::Push(L, oss.str()); return 1; } @@ -308,7 +308,7 @@ namespace LuaItem */ int GetOwnerGUID(lua_State* L, Item* item) { - Eluna::Push(L, item->GetOwnerGUID()); + ALE::Push(L, item->GetOwnerGUID()); return 1; } @@ -319,7 +319,7 @@ namespace LuaItem */ int GetOwner(lua_State* L, Item* item) { - Eluna::Push(L, item->GetOwner()); + ALE::Push(L, item->GetOwner()); return 1; } @@ -330,7 +330,7 @@ namespace LuaItem */ int GetCount(lua_State* L, Item* item) { - Eluna::Push(L, item->GetCount()); + ALE::Push(L, item->GetCount()); return 1; } @@ -341,7 +341,7 @@ namespace LuaItem */ int GetMaxStackCount(lua_State* L, Item* item) { - Eluna::Push(L, item->GetMaxStackCount()); + ALE::Push(L, item->GetMaxStackCount()); return 1; } @@ -352,7 +352,7 @@ namespace LuaItem */ int GetSlot(lua_State* L, Item* item) { - Eluna::Push(L, item->GetSlot()); + ALE::Push(L, item->GetSlot()); return 1; } @@ -363,7 +363,7 @@ namespace LuaItem */ int GetBagSlot(lua_State* L, Item* item) { - Eluna::Push(L, item->GetBagSlot()); + ALE::Push(L, item->GetBagSlot()); return 1; } @@ -375,12 +375,12 @@ namespace LuaItem */ int GetEnchantmentId(lua_State* L, Item* item) { - uint32 enchant_slot = Eluna::CHECKVAL(L, 2); + uint32 enchant_slot = ALE::CHECKVAL(L, 2); if (enchant_slot >= MAX_INSPECTED_ENCHANTMENT_SLOT) return luaL_argerror(L, 2, "valid EnchantmentSlot expected"); - Eluna::Push(L, item->GetEnchantmentId(EnchantmentSlot(enchant_slot))); + ALE::Push(L, item->GetEnchantmentId(EnchantmentSlot(enchant_slot))); return 1; } @@ -392,11 +392,11 @@ namespace LuaItem */ int GetSpellId(lua_State* L, Item* item) { - uint32 index = Eluna::CHECKVAL(L, 2); + uint32 index = ALE::CHECKVAL(L, 2); if (index >= MAX_ITEM_PROTO_SPELLS) return luaL_argerror(L, 2, "valid SpellIndex expected"); - Eluna::Push(L, item->GetTemplate()->Spells[index].SpellId); + ALE::Push(L, item->GetTemplate()->Spells[index].SpellId); return 1; } @@ -408,11 +408,11 @@ namespace LuaItem */ int GetSpellTrigger(lua_State* L, Item* item) { - uint32 index = Eluna::CHECKVAL(L, 2); + uint32 index = ALE::CHECKVAL(L, 2); if (index >= MAX_ITEM_PROTO_SPELLS) return luaL_argerror(L, 2, "valid SpellIndex expected"); - Eluna::Push(L, item->GetTemplate()->Spells[index].SpellTrigger); + ALE::Push(L, item->GetTemplate()->Spells[index].SpellTrigger); return 1; } @@ -423,7 +423,7 @@ namespace LuaItem */ int GetClass(lua_State* L, Item* item) { - Eluna::Push(L, item->GetTemplate()->Class); + ALE::Push(L, item->GetTemplate()->Class); return 1; } @@ -434,7 +434,7 @@ namespace LuaItem */ int GetSubClass(lua_State* L, Item* item) { - Eluna::Push(L, item->GetTemplate()->SubClass); + ALE::Push(L, item->GetTemplate()->SubClass); return 1; } @@ -445,7 +445,7 @@ namespace LuaItem */ int GetName(lua_State* L, Item* item) { - Eluna::Push(L, item->GetTemplate()->Name1); + ALE::Push(L, item->GetTemplate()->Name1); return 1; } @@ -456,7 +456,7 @@ namespace LuaItem */ int GetDisplayId(lua_State* L, Item* item) { - Eluna::Push(L, item->GetTemplate()->DisplayInfoID); + ALE::Push(L, item->GetTemplate()->DisplayInfoID); return 1; } @@ -467,7 +467,7 @@ namespace LuaItem */ int GetQuality(lua_State* L, Item* item) { - Eluna::Push(L, item->GetTemplate()->Quality); + ALE::Push(L, item->GetTemplate()->Quality); return 1; } @@ -478,7 +478,7 @@ namespace LuaItem */ int GetBuyCount(lua_State* L, Item* item) { - Eluna::Push(L, item->GetTemplate()->BuyCount); + ALE::Push(L, item->GetTemplate()->BuyCount); return 1; } @@ -489,7 +489,7 @@ namespace LuaItem */ int GetBuyPrice(lua_State* L, Item* item) { - Eluna::Push(L, item->GetTemplate()->BuyPrice); + ALE::Push(L, item->GetTemplate()->BuyPrice); return 1; } @@ -500,7 +500,7 @@ namespace LuaItem */ int GetSellPrice(lua_State* L, Item* item) { - Eluna::Push(L, item->GetTemplate()->SellPrice); + ALE::Push(L, item->GetTemplate()->SellPrice); return 1; } @@ -511,7 +511,7 @@ namespace LuaItem */ int GetInventoryType(lua_State* L, Item* item) { - Eluna::Push(L, item->GetTemplate()->InventoryType); + ALE::Push(L, item->GetTemplate()->InventoryType); return 1; } @@ -522,7 +522,7 @@ namespace LuaItem */ int GetAllowableClass(lua_State* L, Item* item) { - Eluna::Push(L, item->GetTemplate()->AllowableClass); + ALE::Push(L, item->GetTemplate()->AllowableClass); return 1; } @@ -533,7 +533,7 @@ namespace LuaItem */ int GetAllowableRace(lua_State* L, Item* item) { - Eluna::Push(L, item->GetTemplate()->AllowableRace); + ALE::Push(L, item->GetTemplate()->AllowableRace); return 1; } @@ -544,7 +544,7 @@ namespace LuaItem */ int GetItemLevel(lua_State* L, Item* item) { - Eluna::Push(L, item->GetTemplate()->ItemLevel); + ALE::Push(L, item->GetTemplate()->ItemLevel); return 1; } @@ -555,7 +555,7 @@ namespace LuaItem */ int GetRequiredLevel(lua_State* L, Item* item) { - Eluna::Push(L, item->GetTemplate()->RequiredLevel); + ALE::Push(L, item->GetTemplate()->RequiredLevel); return 1; } @@ -567,7 +567,7 @@ namespace LuaItem */ int GetStatsCount(lua_State* L, Item* item) { - Eluna::Push(L, item->GetTemplate()->StatsCount); + ALE::Push(L, item->GetTemplate()->StatsCount); return 1; } @@ -578,7 +578,7 @@ namespace LuaItem */ int GetRandomProperty(lua_State* L, Item* item) { - Eluna::Push(L, item->GetTemplate()->RandomProperty); + ALE::Push(L, item->GetTemplate()->RandomProperty); return 1; } @@ -590,7 +590,7 @@ namespace LuaItem */ int GetRandomSuffix(lua_State* L, Item* item) { - Eluna::Push(L, item->GetTemplate()->RandomSuffix); + ALE::Push(L, item->GetTemplate()->RandomSuffix); return 1; } @@ -601,7 +601,7 @@ namespace LuaItem */ int GetItemSet(lua_State* L, Item* item) { - Eluna::Push(L, item->GetTemplate()->ItemSet); + ALE::Push(L, item->GetTemplate()->ItemSet); return 1; } @@ -613,9 +613,9 @@ namespace LuaItem int GetBagSize(lua_State* L, Item* item) { if (Bag* bag = item->ToBag()) - Eluna::Push(L, bag->GetBagSize()); + ALE::Push(L, bag->GetBagSize()); else - Eluna::Push(L, 0); + ALE::Push(L, 0); return 1; } @@ -626,7 +626,7 @@ namespace LuaItem */ int GetItemTemplate(lua_State* L, Item* item) { - Eluna::Push(L, item->GetTemplate()); + ALE::Push(L, item->GetTemplate()); return 1; } @@ -637,7 +637,7 @@ namespace LuaItem */ int SetOwner(lua_State* L, Item* item) { - Player* player = Eluna::CHECKOBJ(L, 2); + Player* player = ALE::CHECKOBJ(L, 2); item->SetOwnerGUID(player->GET_GUID()); return 0; } @@ -649,7 +649,7 @@ namespace LuaItem */ int SetBinding(lua_State* L, Item* item) { - bool soulbound = Eluna::CHECKVAL(L, 2); + bool soulbound = ALE::CHECKVAL(L, 2); item->SetBinding(soulbound); item->SetState(ITEM_CHANGED, item->GetOwner()); @@ -664,7 +664,7 @@ namespace LuaItem */ int SetCount(lua_State* L, Item* item) { - uint32 count = Eluna::CHECKVAL(L, 2); + uint32 count = ALE::CHECKVAL(L, 2); item->SetCount(count); return 0; } @@ -681,25 +681,25 @@ namespace LuaItem Player* owner = item->GetOwner(); if (!owner) { - Eluna::Push(L, false); + ALE::Push(L, false); return 1; } - uint32 enchant = Eluna::CHECKVAL(L, 2); + uint32 enchant = ALE::CHECKVAL(L, 2); if (!sSpellItemEnchantmentStore.LookupEntry(enchant)) { - Eluna::Push(L, false); + ALE::Push(L, false); return 1; } - EnchantmentSlot slot = (EnchantmentSlot)Eluna::CHECKVAL(L, 3); + EnchantmentSlot slot = (EnchantmentSlot)ALE::CHECKVAL(L, 3); if (slot >= MAX_INSPECTED_ENCHANTMENT_SLOT) return luaL_argerror(L, 2, "valid EnchantmentSlot expected"); owner->ApplyEnchantment(item, slot, false); item->SetEnchantment(slot, enchant, 0, 0); owner->ApplyEnchantment(item, slot, true); - Eluna::Push(L, true); + ALE::Push(L, true); return 1; } @@ -711,7 +711,7 @@ namespace LuaItem */ int SetRandomProperty(lua_State* L, Item* item) { - uint32 randomPropId = Eluna::CHECKVAL(L, 2); + uint32 randomPropId = ALE::CHECKVAL(L, 2); item->SetItemRandomProperties(randomPropId); return 0; } @@ -723,7 +723,7 @@ namespace LuaItem */ int SetRandomSuffix(lua_State* L, Item* item) { - uint32 randomPropId = Eluna::CHECKVAL(L, 2); + uint32 randomPropId = ALE::CHECKVAL(L, 2); item->SetItemRandomProperties(-randomPropId); return 0; } @@ -741,23 +741,23 @@ namespace LuaItem Player* owner = item->GetOwner(); if (!owner) { - Eluna::Push(L, false); + ALE::Push(L, false); return 1; } - EnchantmentSlot slot = (EnchantmentSlot)Eluna::CHECKVAL(L, 2); + EnchantmentSlot slot = (EnchantmentSlot)ALE::CHECKVAL(L, 2); if (slot >= MAX_INSPECTED_ENCHANTMENT_SLOT) return luaL_argerror(L, 2, "valid EnchantmentSlot expected"); if (!item->GetEnchantmentId(slot)) { - Eluna::Push(L, false); + ALE::Push(L, false); return 1; } owner->ApplyEnchantment(item, slot, false); item->ClearEnchantment(slot); - Eluna::Push(L, true); + ALE::Push(L, true); return 1; } diff --git a/src/LuaEngine/methods/ItemTemplateMethods.h b/src/LuaEngine/methods/ItemTemplateMethods.h index 6b8e1c9..317ae91 100644 --- a/src/LuaEngine/methods/ItemTemplateMethods.h +++ b/src/LuaEngine/methods/ItemTemplateMethods.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 */ @@ -25,7 +25,7 @@ namespace LuaItemTemplate */ int GetItemId(lua_State* L, ItemTemplate* itemTemplate) { - Eluna::Push(L, itemTemplate->ItemId); + ALE::Push(L, itemTemplate->ItemId); return 1; } @@ -36,7 +36,7 @@ namespace LuaItemTemplate */ int GetClass(lua_State* L, ItemTemplate* itemTemplate) { - Eluna::Push(L, itemTemplate->Class); + ALE::Push(L, itemTemplate->Class); return 1; } @@ -47,7 +47,7 @@ namespace LuaItemTemplate */ int GetSubClass(lua_State* L, ItemTemplate* itemTemplate) { - Eluna::Push(L, itemTemplate->SubClass); + ALE::Push(L, itemTemplate->SubClass); return 1; } @@ -60,7 +60,7 @@ namespace LuaItemTemplate */ int GetName(lua_State* L, ItemTemplate* itemTemplate) { - uint32 loc_idx = Eluna::CHECKVAL(L, 2, LocaleConstant::LOCALE_enUS); + uint32 loc_idx = ALE::CHECKVAL(L, 2, LocaleConstant::LOCALE_enUS); const ItemLocale* itemLocale = eObjectMgr->GetItemLocale(itemTemplate->ItemId); std::string name = itemTemplate->Name1; @@ -68,7 +68,7 @@ namespace LuaItemTemplate if (itemLocale && !itemLocale->Name[loc_idx].empty()) name = itemLocale->Name[loc_idx]; - Eluna::Push(L, name); + ALE::Push(L, name); return 1; } @@ -79,7 +79,7 @@ namespace LuaItemTemplate */ int GetDisplayId(lua_State* L, ItemTemplate* itemTemplate) { - Eluna::Push(L, itemTemplate->DisplayInfoID); + ALE::Push(L, itemTemplate->DisplayInfoID); return 1; } @@ -90,7 +90,7 @@ namespace LuaItemTemplate */ int GetQuality(lua_State* L, ItemTemplate* itemTemplate) { - Eluna::Push(L, itemTemplate->Quality); + ALE::Push(L, itemTemplate->Quality); return 1; } @@ -101,7 +101,7 @@ namespace LuaItemTemplate */ int GetFlags(lua_State* L, ItemTemplate* itemTemplate) { - Eluna::Push(L, itemTemplate->Flags); + ALE::Push(L, itemTemplate->Flags); return 1; } @@ -112,7 +112,7 @@ namespace LuaItemTemplate */ int GetExtraFlags(lua_State* L, ItemTemplate* itemTemplate) { - Eluna::Push(L, itemTemplate->Flags2); + ALE::Push(L, itemTemplate->Flags2); return 1; } @@ -123,7 +123,7 @@ namespace LuaItemTemplate */ int GetBuyCount(lua_State* L, ItemTemplate* itemTemplate) { - Eluna::Push(L, itemTemplate->BuyCount); + ALE::Push(L, itemTemplate->BuyCount); return 1; } @@ -134,7 +134,7 @@ namespace LuaItemTemplate */ int GetBuyPrice(lua_State* L, ItemTemplate* itemTemplate) { - Eluna::Push(L, itemTemplate->BuyPrice); + ALE::Push(L, itemTemplate->BuyPrice); return 1; } @@ -145,7 +145,7 @@ namespace LuaItemTemplate */ int GetSellPrice(lua_State* L, ItemTemplate* itemTemplate) { - Eluna::Push(L, itemTemplate->SellPrice); + ALE::Push(L, itemTemplate->SellPrice); return 1; } @@ -156,7 +156,7 @@ namespace LuaItemTemplate */ int GetInventoryType(lua_State* L, ItemTemplate* itemTemplate) { - Eluna::Push(L, itemTemplate->InventoryType); + ALE::Push(L, itemTemplate->InventoryType); return 1; } @@ -167,7 +167,7 @@ namespace LuaItemTemplate */ int GetAllowableClass(lua_State* L, ItemTemplate* itemTemplate) { - Eluna::Push(L, itemTemplate->AllowableClass); + ALE::Push(L, itemTemplate->AllowableClass); return 1; } @@ -178,7 +178,7 @@ namespace LuaItemTemplate */ int GetAllowableRace(lua_State* L, ItemTemplate* itemTemplate) { - Eluna::Push(L, itemTemplate->AllowableRace); + ALE::Push(L, itemTemplate->AllowableRace); return 1; } @@ -189,7 +189,7 @@ namespace LuaItemTemplate */ int GetItemLevel(lua_State* L, ItemTemplate* itemTemplate) { - Eluna::Push(L, itemTemplate->ItemLevel); + ALE::Push(L, itemTemplate->ItemLevel); return 1; } @@ -200,7 +200,7 @@ namespace LuaItemTemplate */ int GetRequiredLevel(lua_State* L, ItemTemplate* itemTemplate) { - Eluna::Push(L, itemTemplate->RequiredLevel); + ALE::Push(L, itemTemplate->RequiredLevel); return 1; } @@ -216,7 +216,7 @@ namespace LuaItemTemplate ItemDisplayInfoEntry const* displayInfo = sItemDisplayInfoStore.LookupEntry(display_id); const char* icon = displayInfo->inventoryIcon; - Eluna::Push(L, icon); + ALE::Push(L, icon); return 1; } } diff --git a/src/LuaEngine/methods/LootMethods.h b/src/LuaEngine/methods/LootMethods.h index 0be89bc..a48ff2d 100644 --- a/src/LuaEngine/methods/LootMethods.h +++ b/src/LuaEngine/methods/LootMethods.h @@ -1,5 +1,5 @@ /* -* Copyright (C) 2010 - 2025 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 */ @@ -23,7 +23,7 @@ namespace LuaLoot */ int IsLooted(lua_State* L, Loot* loot) { - Eluna::Push(L, loot->isLooted()); + ALE::Push(L, loot->isLooted()); return 1; } @@ -42,13 +42,13 @@ namespace LuaLoot */ int AddItem(lua_State* L, Loot* loot) { - uint32 itemid = Eluna::CHECKVAL(L, 2); - uint8 min_count = Eluna::CHECKVAL(L, 3); - uint8 max_count = Eluna::CHECKVAL(L, 4); - float chance = Eluna::CHECKVAL(L, 5); - uint16 loot_mode = Eluna::CHECKVAL(L, 6); - bool needs_quest = Eluna::CHECKVAL(L, 7, false); - bool allow_stacking = Eluna::CHECKVAL(L, 8, true); + uint32 itemid = ALE::CHECKVAL(L, 2); + uint8 min_count = ALE::CHECKVAL(L, 3); + uint8 max_count = ALE::CHECKVAL(L, 4); + float chance = ALE::CHECKVAL(L, 5); + uint16 loot_mode = ALE::CHECKVAL(L, 6); + bool needs_quest = ALE::CHECKVAL(L, 7, false); + bool allow_stacking = ALE::CHECKVAL(L, 8, true); if (allow_stacking) { @@ -81,8 +81,8 @@ namespace LuaLoot */ int HasItem(lua_State* L, Loot* loot) { - uint32 itemid = Eluna::CHECKVAL(L, 2, false); - uint32 count = Eluna::CHECKVAL(L, 3, false); + uint32 itemid = ALE::CHECKVAL(L, 2, false); + uint32 count = ALE::CHECKVAL(L, 3, false); bool has_item = false; if (itemid) @@ -108,7 +108,7 @@ namespace LuaLoot } } - Eluna::Push(L, has_item); + ALE::Push(L, has_item); return 1; } @@ -123,9 +123,9 @@ namespace LuaLoot */ int RemoveItem(lua_State* L, Loot* loot) { - uint32 itemid = Eluna::CHECKVAL(L, 2); - bool isCountSpecified = Eluna::CHECKVAL(L, 3, false); - uint32 count = isCountSpecified ? Eluna::CHECKVAL(L, 4) : 0; + uint32 itemid = ALE::CHECKVAL(L, 2); + bool isCountSpecified = ALE::CHECKVAL(L, 3, false); + uint32 count = isCountSpecified ? ALE::CHECKVAL(L, 4) : 0; auto removeFromContainer = [&](auto& container, uint32& remaining) { @@ -177,7 +177,7 @@ namespace LuaLoot */ int GetMoney(lua_State* L, Loot* loot) { - Eluna::Push(L, loot->gold); + ALE::Push(L, loot->gold); return 1; } @@ -188,7 +188,7 @@ namespace LuaLoot */ int SetMoney(lua_State* L, Loot* loot) { - uint32 gold = Eluna::CHECKVAL(L, 2); + uint32 gold = ALE::CHECKVAL(L, 2); loot->gold = gold; return 0; @@ -202,8 +202,8 @@ namespace LuaLoot */ int GenerateMoney(lua_State* L, Loot* loot) { - uint32 min_gold = Eluna::CHECKVAL(L, 2); - uint32 max_gold = Eluna::CHECKVAL(L, 3); + uint32 min_gold = ALE::CHECKVAL(L, 2); + uint32 max_gold = ALE::CHECKVAL(L, 3); loot->generateMoneyLoot(min_gold, max_gold); return 0; @@ -225,7 +225,7 @@ namespace LuaLoot */ int SetUnlootedCount(lua_State* L, Loot* loot) { - uint32 count = Eluna::CHECKVAL(L, 2); + uint32 count = ALE::CHECKVAL(L, 2); loot->unlootedCount = count; return 0; @@ -238,7 +238,7 @@ namespace LuaLoot */ int GetUnlootedCount(lua_State* L, Loot* loot) { - Eluna::Push(L, loot->unlootedCount); + ALE::Push(L, loot->unlootedCount); return 1; } @@ -264,22 +264,22 @@ namespace LuaLoot { lua_newtable(L); - Eluna::Push(L, loot->items[i].itemid); + ALE::Push(L, loot->items[i].itemid); lua_setfield(L, -2, "id"); - Eluna::Push(L, loot->items[i].itemIndex); + ALE::Push(L, loot->items[i].itemIndex); lua_setfield(L, -2, "index"); - Eluna::Push(L, loot->items[i].count); + ALE::Push(L, loot->items[i].count); lua_setfield(L, -2, "count"); - Eluna::Push(L, loot->items[i].needs_quest); + ALE::Push(L, loot->items[i].needs_quest); lua_setfield(L, -2, "needs_quest"); - Eluna::Push(L, loot->items[i].is_looted); + ALE::Push(L, loot->items[i].is_looted); lua_setfield(L, -2, "is_looted"); - Eluna::Push(L, loot->items[i].rollWinnerGUID); + ALE::Push(L, loot->items[i].rollWinnerGUID); lua_setfield(L, -2, "roll_winner_guid"); lua_rawseti(L, tbl, i + 1); @@ -311,22 +311,22 @@ namespace LuaLoot { lua_newtable(L); - Eluna::Push(L, loot->quest_items[i].itemid); + ALE::Push(L, loot->quest_items[i].itemid); lua_setfield(L, -2, "id"); - Eluna::Push(L, loot->quest_items[i].itemIndex); + ALE::Push(L, loot->quest_items[i].itemIndex); lua_setfield(L, -2, "index"); - Eluna::Push(L, loot->quest_items[i].count); + ALE::Push(L, loot->quest_items[i].count); lua_setfield(L, -2, "count"); - Eluna::Push(L, loot->quest_items[i].needs_quest); + ALE::Push(L, loot->quest_items[i].needs_quest); lua_setfield(L, -2, "needs_quest"); - Eluna::Push(L, loot->quest_items[i].is_looted); + ALE::Push(L, loot->quest_items[i].is_looted); lua_setfield(L, -2, "is_looted"); - Eluna::Push(L, loot->quest_items[i].rollWinnerGUID); + ALE::Push(L, loot->quest_items[i].rollWinnerGUID); lua_setfield(L, -2, "roll_winner_guid"); lua_rawseti(L, tbl, i + 1); @@ -363,9 +363,9 @@ namespace LuaLoot */ int SetItemLooted(lua_State* L, Loot* loot) { - uint32 itemid = Eluna::CHECKVAL(L, 2); - uint32 count = Eluna::CHECKVAL(L, 3); - bool looted = Eluna::CHECKVAL(L, 4, true); + uint32 itemid = ALE::CHECKVAL(L, 2); + uint32 count = ALE::CHECKVAL(L, 3); + bool looted = ALE::CHECKVAL(L, 4, true); for (auto &lootItem : loot->items) { @@ -385,7 +385,7 @@ namespace LuaLoot */ int IsEmpty(lua_State* L, Loot* loot) { - Eluna::Push(L, loot->empty()); + ALE::Push(L, loot->empty()); return 1; } @@ -396,7 +396,7 @@ namespace LuaLoot */ int GetLootType(lua_State* L, Loot* loot) { - Eluna::Push(L, loot->loot_type); + ALE::Push(L, loot->loot_type); return 1; } @@ -424,7 +424,7 @@ namespace LuaLoot */ int SetLootType(lua_State* L, Loot* loot) { - uint32 lootType = Eluna::CHECKVAL(L, 2); + uint32 lootType = ALE::CHECKVAL(L, 2); loot->loot_type = static_cast(lootType); return 0; } @@ -436,7 +436,7 @@ namespace LuaLoot */ int GetRoundRobinPlayer(lua_State* L, Loot* loot) { - Eluna::Push(L, loot->roundRobinPlayer); + ALE::Push(L, loot->roundRobinPlayer); return 1; } @@ -447,7 +447,7 @@ namespace LuaLoot */ int SetRoundRobinPlayer(lua_State* L, Loot* loot) { - ObjectGuid guid = Eluna::CHECKVAL(L, 2); + ObjectGuid guid = ALE::CHECKVAL(L, 2); loot->roundRobinPlayer = guid; return 0; } @@ -459,7 +459,7 @@ namespace LuaLoot */ int GetLootOwner(lua_State* L, Loot* loot) { - Eluna::Push(L, loot->lootOwnerGUID); + ALE::Push(L, loot->lootOwnerGUID); return 1; } @@ -470,7 +470,7 @@ namespace LuaLoot */ int SetLootOwner(lua_State* L, Loot* loot) { - ObjectGuid guid = Eluna::CHECKVAL(L, 2); + ObjectGuid guid = ALE::CHECKVAL(L, 2); loot->lootOwnerGUID = guid; return 0; } @@ -482,7 +482,7 @@ namespace LuaLoot */ int GetContainer(lua_State* L, Loot* loot) { - Eluna::Push(L, loot->containerGUID); + ALE::Push(L, loot->containerGUID); return 1; } @@ -493,7 +493,7 @@ namespace LuaLoot */ int SetContainer(lua_State* L, Loot* loot) { - ObjectGuid guid = Eluna::CHECKVAL(L, 2); + ObjectGuid guid = ALE::CHECKVAL(L, 2); loot->containerGUID = guid; return 0; } @@ -505,7 +505,7 @@ namespace LuaLoot */ int GetSourceWorldObject(lua_State* L, Loot* loot) { - Eluna::Push(L, loot->sourceWorldObjectGUID); + ALE::Push(L, loot->sourceWorldObjectGUID); return 1; } @@ -516,7 +516,7 @@ namespace LuaLoot */ int SetSourceWorldObject(lua_State* L, Loot* loot) { - ObjectGuid guid = Eluna::CHECKVAL(L, 2); + ObjectGuid guid = ALE::CHECKVAL(L, 2); loot->sourceWorldObjectGUID = guid; return 0; } @@ -528,7 +528,7 @@ namespace LuaLoot */ int HasQuestItems(lua_State* L, Loot* loot) { - Eluna::Push(L, !loot->quest_items.empty()); + ALE::Push(L, !loot->quest_items.empty()); return 1; } @@ -539,7 +539,7 @@ namespace LuaLoot */ int HasItemForAll(lua_State* L, Loot* loot) { - Eluna::Push(L, loot->hasItemForAll()); + ALE::Push(L, loot->hasItemForAll()); return 1; } @@ -550,7 +550,7 @@ namespace LuaLoot */ int HasOverThresholdItem(lua_State* L, Loot* loot) { - Eluna::Push(L, loot->hasOverThresholdItem()); + ALE::Push(L, loot->hasOverThresholdItem()); return 1; } @@ -561,7 +561,7 @@ namespace LuaLoot */ int GetItemCount(lua_State* L, Loot* loot) { - Eluna::Push(L, static_cast(loot->items.size() + loot->quest_items.size())); + ALE::Push(L, static_cast(loot->items.size() + loot->quest_items.size())); return 1; } @@ -573,8 +573,8 @@ namespace LuaLoot */ int GetMaxSlotForPlayer(lua_State* L, Loot* loot) { - Player* player = Eluna::CHECKOBJ(L, 2); - Eluna::Push(L, loot->GetMaxSlotInLootFor(player)); + Player* player = ALE::CHECKOBJ(L, 2); + ALE::Push(L, loot->GetMaxSlotInLootFor(player)); return 1; } @@ -585,7 +585,7 @@ namespace LuaLoot */ int AddLooter(lua_State* L, Loot* loot) { - Player* player = Eluna::CHECKOBJ(L, 2); + Player* player = ALE::CHECKOBJ(L, 2); loot->AddLooter(player->GetGUID()); return 0; } @@ -597,7 +597,7 @@ namespace LuaLoot */ int RemoveLooter(lua_State* L, Loot* loot) { - Player* player = Eluna::CHECKOBJ(L, 2); + Player* player = ALE::CHECKOBJ(L, 2); loot->RemoveLooter(player->GetGUID()); return 0; } diff --git a/src/LuaEngine/methods/MapMethods.h b/src/LuaEngine/methods/MapMethods.h index f71f507..04eba56 100644 --- a/src/LuaEngine/methods/MapMethods.h +++ b/src/LuaEngine/methods/MapMethods.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 */ @@ -7,7 +7,7 @@ #ifndef MAPMETHODS_H #define MAPMETHODS_H -#include "ElunaInstanceAI.h" +#include "ALEInstanceAI.h" /*** * A game map, e.g. Azeroth, Eastern Kingdoms, the Molten Core, etc. @@ -24,7 +24,7 @@ namespace LuaMap */ int IsArena(lua_State* L, Map* map) { - Eluna::Push(L, map->IsBattleArena()); + ALE::Push(L, map->IsBattleArena()); return 1; } @@ -35,7 +35,7 @@ namespace LuaMap */ int IsBattleground(lua_State* L, Map* map) { - Eluna::Push(L, map->IsBattleground()); + ALE::Push(L, map->IsBattleground()); return 1; } @@ -46,7 +46,7 @@ namespace LuaMap */ int IsDungeon(lua_State* L, Map* map) { - Eluna::Push(L, map->IsDungeon()); + ALE::Push(L, map->IsDungeon()); return 1; } @@ -57,7 +57,7 @@ namespace LuaMap */ int IsEmpty(lua_State* L, Map* map) { - Eluna::Push(L, map->IsEmpty()); + ALE::Push(L, map->IsEmpty()); return 1; } @@ -68,7 +68,7 @@ namespace LuaMap */ int IsHeroic(lua_State* L, Map* map) { - Eluna::Push(L, map->IsHeroic()); + ALE::Push(L, map->IsHeroic()); return 1; } @@ -79,7 +79,7 @@ namespace LuaMap */ int IsRaid(lua_State* L, Map* map) { - Eluna::Push(L, map->IsRaid()); + ALE::Push(L, map->IsRaid()); return 1; } @@ -90,7 +90,7 @@ namespace LuaMap */ int GetName(lua_State* L, Map* map) { - Eluna::Push(L, map->GetMapName()); + ALE::Push(L, map->GetMapName()); return 1; } @@ -105,12 +105,12 @@ namespace LuaMap */ int GetHeight(lua_State* L, Map* map) { - float x = Eluna::CHECKVAL(L, 2); - float y = Eluna::CHECKVAL(L, 3); - uint32 phasemask = Eluna::CHECKVAL(L, 4, 1); + float x = ALE::CHECKVAL(L, 2); + float y = ALE::CHECKVAL(L, 3); + uint32 phasemask = ALE::CHECKVAL(L, 4, 1); float z = map->GetHeight(phasemask, x, y, MAX_HEIGHT); if (z != INVALID_HEIGHT) - Eluna::Push(L, z); + ALE::Push(L, z); return 1; } @@ -123,7 +123,7 @@ namespace LuaMap */ int GetDifficulty(lua_State* L, Map* map) { - Eluna::Push(L, map->GetDifficulty()); + ALE::Push(L, map->GetDifficulty()); return 1; } @@ -134,7 +134,7 @@ namespace LuaMap */ int GetInstanceId(lua_State* L, Map* map) { - Eluna::Push(L, map->GetInstanceId()); + ALE::Push(L, map->GetInstanceId()); return 1; } @@ -145,7 +145,7 @@ namespace LuaMap */ int GetPlayerCount(lua_State* L, Map* map) { - Eluna::Push(L, map->GetPlayersCountExceptGMs()); + ALE::Push(L, map->GetPlayersCountExceptGMs()); return 1; } @@ -156,7 +156,7 @@ namespace LuaMap */ int GetMapId(lua_State* L, Map* map) { - Eluna::Push(L, map->GetId()); + ALE::Push(L, map->GetId()); return 1; } @@ -171,12 +171,12 @@ namespace LuaMap */ int GetAreaId(lua_State* L, Map* map) { - float x = Eluna::CHECKVAL(L, 2); - float y = Eluna::CHECKVAL(L, 3); - float z = Eluna::CHECKVAL(L, 4); - float phasemask = Eluna::CHECKVAL(L, 5, PHASEMASK_NORMAL); + float x = ALE::CHECKVAL(L, 2); + float y = ALE::CHECKVAL(L, 3); + float z = ALE::CHECKVAL(L, 4); + float phasemask = ALE::CHECKVAL(L, 5, PHASEMASK_NORMAL); - Eluna::Push(L, map->GetAreaId(phasemask, x, y, z)); + ALE::Push(L, map->GetAreaId(phasemask, x, y, z)); return 1; } @@ -188,30 +188,30 @@ namespace LuaMap */ int GetWorldObject(lua_State* L, Map* map) { - ObjectGuid guid = Eluna::CHECKVAL(L, 2); + ObjectGuid guid = ALE::CHECKVAL(L, 2); switch (guid.GetHigh()) { case HIGHGUID_PLAYER: - Eluna::Push(L, eObjectAccessor()GetPlayer(map, guid)); + ALE::Push(L, eObjectAccessor()GetPlayer(map, guid)); break; case HIGHGUID_TRANSPORT: case HIGHGUID_MO_TRANSPORT: case HIGHGUID_GAMEOBJECT: - Eluna::Push(L, map->GetGameObject(guid)); + ALE::Push(L, map->GetGameObject(guid)); break; case HIGHGUID_VEHICLE: case HIGHGUID_UNIT: - Eluna::Push(L, map->GetCreature(guid)); + ALE::Push(L, map->GetCreature(guid)); break; case HIGHGUID_PET: - Eluna::Push(L, map->GetPet(guid)); + ALE::Push(L, map->GetPet(guid)); break; case HIGHGUID_DYNAMICOBJECT: - Eluna::Push(L, map->GetDynamicObject(guid)); + ALE::Push(L, map->GetDynamicObject(guid)); break; case HIGHGUID_CORPSE: - Eluna::Push(L, map->GetCorpse(guid)); + ALE::Push(L, map->GetCorpse(guid)); break; default: break; @@ -238,9 +238,9 @@ namespace LuaMap */ int SetWeather(lua_State* L, Map* map) { - uint32 zoneId = Eluna::CHECKVAL(L, 2); - uint32 weatherType = Eluna::CHECKVAL(L, 3); - float grade = Eluna::CHECKVAL(L, 4); + uint32 zoneId = ALE::CHECKVAL(L, 2); + uint32 weatherType = ALE::CHECKVAL(L, 3); + float grade = ALE::CHECKVAL(L, 4); Weather* weather = map->GetOrGenerateZoneDefaultWeather(zoneId); if (weather) @@ -251,21 +251,21 @@ namespace LuaMap /** * Gets the instance data table for the [Map], if it exists. * - * The instance must be scripted using Eluna for this to succeed. + * The instance must be scripted using ALE for this to succeed. * If the instance is scripted in C++ this will return `nil`. * * @return table instance_data : instance data table, or `nil` */ int GetInstanceData(lua_State* L, Map* map) { - ElunaInstanceAI* iAI = NULL; + ALEInstanceAI* iAI = NULL; if (InstanceMap* inst = map->ToInstanceMap()) - iAI = dynamic_cast(inst->GetInstanceScript()); + iAI = dynamic_cast(inst->GetInstanceScript()); if (iAI) - Eluna::GetEluna(L)->PushInstanceData(L, iAI, false); + ALE::GetALE(L)->PushInstanceData(L, iAI, false); else - Eluna::Push(L); // nil + ALE::Push(L); // nil return 1; } @@ -275,9 +275,9 @@ namespace LuaMap */ int SaveInstanceData(lua_State* /*L*/, Map* map) { - ElunaInstanceAI* iAI = NULL; + ALEInstanceAI* iAI = NULL; if (InstanceMap* inst = map->ToInstanceMap()) - iAI = dynamic_cast(inst->GetInstanceScript()); + iAI = dynamic_cast(inst->GetInstanceScript()); if (iAI) iAI->SaveToDB(); @@ -300,7 +300,7 @@ namespace LuaMap */ int GetPlayers(lua_State* L, Map* map) { - uint32 team = Eluna::CHECKVAL(L, 2, TEAM_NEUTRAL); + uint32 team = ALE::CHECKVAL(L, 2, TEAM_NEUTRAL); lua_newtable(L); int tbl = lua_gettop(L); @@ -314,7 +314,7 @@ namespace LuaMap continue; if (player->GetSession() && (team >= TEAM_NEUTRAL || player->GetTeamId() == team)) { - Eluna::Push(L, player); + ALE::Push(L, player); lua_rawseti(L, tbl, ++i); } } @@ -339,7 +339,7 @@ namespace LuaMap { Creature* creature = pair.second; - Eluna::Push(L, creature); + ALE::Push(L, creature); lua_rawseti(L, tbl, creature->GetSpawnId()); } @@ -355,7 +355,7 @@ namespace LuaMap */ int GetCreaturesByAreaId(lua_State* L, Map* map) { - int32 areaId = Eluna::CHECKVAL(L, 2, -1); + int32 areaId = ALE::CHECKVAL(L, 2, -1); std::vector filteredCreatures; for (const auto& pair : map->GetCreatureBySpawnIdStore()) @@ -372,7 +372,7 @@ namespace LuaMap for (Creature* creature : filteredCreatures) { - Eluna::Push(L, creature); + ALE::Push(L, creature); lua_rawseti(L, tbl, creature->GetSpawnId()); } diff --git a/src/LuaEngine/methods/ObjectMethods.h b/src/LuaEngine/methods/ObjectMethods.h index 28ef17a..e99ce4f 100644 --- a/src/LuaEngine/methods/ObjectMethods.h +++ b/src/LuaEngine/methods/ObjectMethods.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 */ @@ -33,10 +33,10 @@ namespace LuaObject */ int HasFlag(lua_State* L, Object* obj) { - uint16 index = Eluna::CHECKVAL(L, 2); - uint32 flag = Eluna::CHECKVAL(L, 3); + uint16 index = ALE::CHECKVAL(L, 2); + uint32 flag = ALE::CHECKVAL(L, 3); - Eluna::Push(L, obj->HasFlag(index, flag)); + ALE::Push(L, obj->HasFlag(index, flag)); return 1; } @@ -47,7 +47,7 @@ namespace LuaObject */ int IsInWorld(lua_State* L, Object* obj) { - Eluna::Push(L, obj->IsInWorld()); + ALE::Push(L, obj->IsInWorld()); return 1; } @@ -58,7 +58,7 @@ namespace LuaObject */ int IsPlayer(lua_State* L, Object* obj) { - Eluna::Push(L, obj->IsPlayer()); + ALE::Push(L, obj->IsPlayer()); return 1; } @@ -70,8 +70,8 @@ namespace LuaObject */ int GetInt32Value(lua_State* L, Object* obj) { - uint16 index = Eluna::CHECKVAL(L, 2); - Eluna::Push(L, obj->GetInt32Value(index)); + uint16 index = ALE::CHECKVAL(L, 2); + ALE::Push(L, obj->GetInt32Value(index)); return 1; } @@ -83,8 +83,8 @@ namespace LuaObject */ int GetUInt32Value(lua_State* L, Object* obj) { - uint16 index = Eluna::CHECKVAL(L, 2); - Eluna::Push(L, obj->GetUInt32Value(index)); + uint16 index = ALE::CHECKVAL(L, 2); + ALE::Push(L, obj->GetUInt32Value(index)); return 1; } @@ -96,8 +96,8 @@ namespace LuaObject */ int GetFloatValue(lua_State* L, Object* obj) { - uint16 index = Eluna::CHECKVAL(L, 2); - Eluna::Push(L, obj->GetFloatValue(index)); + uint16 index = ALE::CHECKVAL(L, 2); + ALE::Push(L, obj->GetFloatValue(index)); return 1; } @@ -112,9 +112,9 @@ namespace LuaObject */ int GetByteValue(lua_State* L, Object* obj) { - uint16 index = Eluna::CHECKVAL(L, 2); - uint8 offset = Eluna::CHECKVAL(L, 3); - Eluna::Push(L, obj->GetByteValue(index, offset)); + uint16 index = ALE::CHECKVAL(L, 2); + uint8 offset = ALE::CHECKVAL(L, 3); + ALE::Push(L, obj->GetByteValue(index, offset)); return 1; } @@ -129,9 +129,9 @@ namespace LuaObject */ int GetUInt16Value(lua_State* L, Object* obj) { - uint16 index = Eluna::CHECKVAL(L, 2); - uint8 offset = Eluna::CHECKVAL(L, 3); - Eluna::Push(L, obj->GetUInt16Value(index, offset)); + uint16 index = ALE::CHECKVAL(L, 2); + uint8 offset = ALE::CHECKVAL(L, 3); + ALE::Push(L, obj->GetUInt16Value(index, offset)); return 1; } @@ -144,7 +144,7 @@ namespace LuaObject */ int GetScale(lua_State* L, Object* obj) { - Eluna::Push(L, obj->GetFloatValue(OBJECT_FIELD_SCALE_X)); + ALE::Push(L, obj->GetFloatValue(OBJECT_FIELD_SCALE_X)); return 1; } @@ -157,7 +157,7 @@ namespace LuaObject */ int GetEntry(lua_State* L, Object* obj) { - Eluna::Push(L, obj->GetEntry()); + ALE::Push(L, obj->GetEntry()); return 1; } @@ -175,7 +175,7 @@ namespace LuaObject */ int GetGUID(lua_State* L, Object* obj) { - Eluna::Push(L, obj->GET_GUID()); + ALE::Push(L, obj->GET_GUID()); return 1; } @@ -193,7 +193,7 @@ namespace LuaObject */ int GetGUIDLow(lua_State* L, Object* obj) { - Eluna::Push(L, obj->GetGUID().GetCounter()); + ALE::Push(L, obj->GetGUID().GetCounter()); return 1; } @@ -216,7 +216,7 @@ namespace LuaObject */ int GetTypeId(lua_State* L, Object* obj) { - Eluna::Push(L, obj->GetTypeId()); + ALE::Push(L, obj->GetTypeId()); return 1; } @@ -228,8 +228,8 @@ namespace LuaObject */ int GetUInt64Value(lua_State* L, Object* obj) { - uint16 index = Eluna::CHECKVAL(L, 2); - Eluna::Push(L, obj->GetUInt64Value(index)); + uint16 index = ALE::CHECKVAL(L, 2); + ALE::Push(L, obj->GetUInt64Value(index)); return 1; } @@ -245,8 +245,8 @@ namespace LuaObject */ int SetFlag(lua_State* L, Object* obj) { - uint16 index = Eluna::CHECKVAL(L, 2); - uint32 flag = Eluna::CHECKVAL(L, 3); + uint16 index = ALE::CHECKVAL(L, 2); + uint32 flag = ALE::CHECKVAL(L, 3); obj->SetFlag(index, flag); return 0; @@ -260,8 +260,8 @@ namespace LuaObject */ int SetInt32Value(lua_State* L, Object* obj) { - uint16 index = Eluna::CHECKVAL(L, 2); - int32 value = Eluna::CHECKVAL(L, 3); + uint16 index = ALE::CHECKVAL(L, 2); + int32 value = ALE::CHECKVAL(L, 3); obj->SetInt32Value(index, value); return 0; } @@ -274,8 +274,8 @@ namespace LuaObject */ int SetUInt32Value(lua_State* L, Object* obj) { - uint16 index = Eluna::CHECKVAL(L, 2); - uint32 value = Eluna::CHECKVAL(L, 3); + uint16 index = ALE::CHECKVAL(L, 2); + uint32 value = ALE::CHECKVAL(L, 3); obj->SetUInt32Value(index, value); return 0; } @@ -288,8 +288,8 @@ namespace LuaObject */ int UpdateUInt32Value(lua_State* L, Object* obj) { - uint16 index = Eluna::CHECKVAL(L, 2); - uint32 value = Eluna::CHECKVAL(L, 3); + uint16 index = ALE::CHECKVAL(L, 2); + uint32 value = ALE::CHECKVAL(L, 3); obj->UpdateUInt32Value(index, value); return 0; } @@ -302,8 +302,8 @@ namespace LuaObject */ int SetFloatValue(lua_State* L, Object* obj) { - uint16 index = Eluna::CHECKVAL(L, 2); - float value = Eluna::CHECKVAL(L, 3); + uint16 index = ALE::CHECKVAL(L, 2); + float value = ALE::CHECKVAL(L, 3); obj->SetFloatValue(index, value); return 0; @@ -318,9 +318,9 @@ namespace LuaObject */ int SetByteValue(lua_State* L, Object* obj) { - uint16 index = Eluna::CHECKVAL(L, 2); - uint8 offset = Eluna::CHECKVAL(L, 3); - uint8 value = Eluna::CHECKVAL(L, 4); + uint16 index = ALE::CHECKVAL(L, 2); + uint8 offset = ALE::CHECKVAL(L, 3); + uint8 value = ALE::CHECKVAL(L, 4); obj->SetByteValue(index, offset, value); return 0; } @@ -334,9 +334,9 @@ namespace LuaObject */ int SetUInt16Value(lua_State* L, Object* obj) { - uint16 index = Eluna::CHECKVAL(L, 2); - uint8 offset = Eluna::CHECKVAL(L, 3); - uint16 value = Eluna::CHECKVAL(L, 4); + uint16 index = ALE::CHECKVAL(L, 2); + uint8 offset = ALE::CHECKVAL(L, 3); + uint16 value = ALE::CHECKVAL(L, 4); obj->SetUInt16Value(index, offset, value); return 0; } @@ -350,9 +350,9 @@ namespace LuaObject */ int SetInt16Value(lua_State* L, Object* obj) { - uint16 index = Eluna::CHECKVAL(L, 2); - uint8 offset = Eluna::CHECKVAL(L, 3); - int16 value = Eluna::CHECKVAL(L, 4); + uint16 index = ALE::CHECKVAL(L, 2); + uint8 offset = ALE::CHECKVAL(L, 3); + int16 value = ALE::CHECKVAL(L, 4); obj->SetInt16Value(index, offset, value); return 0; } @@ -364,7 +364,7 @@ namespace LuaObject */ int SetScale(lua_State* L, Object* obj) { - float size = Eluna::CHECKVAL(L, 2); + float size = ALE::CHECKVAL(L, 2); obj->SetObjectScale(size); return 0; @@ -378,8 +378,8 @@ namespace LuaObject */ int SetUInt64Value(lua_State* L, Object* obj) { - uint16 index = Eluna::CHECKVAL(L, 2); - uint64 value = Eluna::CHECKVAL(L, 3); + uint16 index = ALE::CHECKVAL(L, 2); + uint64 value = ALE::CHECKVAL(L, 3); obj->SetUInt64Value(index, value); return 0; } @@ -392,8 +392,8 @@ namespace LuaObject */ int RemoveFlag(lua_State* L, Object* obj) { - uint16 index = Eluna::CHECKVAL(L, 2); - uint32 flag = Eluna::CHECKVAL(L, 3); + uint16 index = ALE::CHECKVAL(L, 2); + uint32 flag = ALE::CHECKVAL(L, 3); obj->RemoveFlag(index, flag); return 0; @@ -408,7 +408,7 @@ namespace LuaObject */ int ToCorpse(lua_State* L, Object* obj) { - Eluna::Push(L, obj->ToCorpse()); + ALE::Push(L, obj->ToCorpse()); return 1; } @@ -421,7 +421,7 @@ namespace LuaObject */ int ToGameObject(lua_State* L, Object* obj) { - Eluna::Push(L, obj->ToGameObject()); + ALE::Push(L, obj->ToGameObject()); return 1; } @@ -434,7 +434,7 @@ namespace LuaObject */ int ToUnit(lua_State* L, Object* obj) { - Eluna::Push(L, obj->ToUnit()); + ALE::Push(L, obj->ToUnit()); return 1; } @@ -447,7 +447,7 @@ namespace LuaObject */ int ToCreature(lua_State* L, Object* obj) { - Eluna::Push(L, obj->ToCreature()); + ALE::Push(L, obj->ToCreature()); return 1; } @@ -460,7 +460,7 @@ namespace LuaObject */ int ToPlayer(lua_State* L, Object* obj) { - Eluna::Push(L, obj->ToPlayer()); + ALE::Push(L, obj->ToPlayer()); return 1; } }; diff --git a/src/LuaEngine/methods/PetMethods.h b/src/LuaEngine/methods/PetMethods.h index 60c16c8..790da82 100644 --- a/src/LuaEngine/methods/PetMethods.h +++ b/src/LuaEngine/methods/PetMethods.h @@ -1,5 +1,5 @@ /* -* Copyright (C) 2010 - 2025 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 */ @@ -33,7 +33,7 @@ namespace LuaPet */ int GetPetType(lua_State* L, Pet* pet) { - Eluna::Push(L, pet->getPetType()); + ALE::Push(L, pet->getPetType()); return 1; } @@ -53,7 +53,7 @@ namespace LuaPet */ int SetPetType(lua_State* L, Pet* pet) { - uint32 petType = Eluna::CHECKVAL(L, 2); + uint32 petType = ALE::CHECKVAL(L, 2); pet->setPetType(static_cast(petType)); return 0; } @@ -65,7 +65,7 @@ namespace LuaPet */ int IsControlled(lua_State* L, Pet* pet) { - Eluna::Push(L, pet->isControlled()); + ALE::Push(L, pet->isControlled()); return 1; } @@ -76,7 +76,7 @@ namespace LuaPet */ int IsTemporarySummoned(lua_State* L, Pet* pet) { - Eluna::Push(L, pet->isTemporarySummoned()); + ALE::Push(L, pet->isTemporarySummoned()); return 1; } @@ -88,8 +88,8 @@ namespace LuaPet */ int IsPermanentPetFor(lua_State* L, Pet* pet) { - Player* owner = Eluna::CHECKOBJ(L, 2); - Eluna::Push(L, pet->IsPermanentPetFor(owner)); + Player* owner = ALE::CHECKOBJ(L, 2); + ALE::Push(L, pet->IsPermanentPetFor(owner)); return 1; } @@ -101,8 +101,8 @@ namespace LuaPet */ int CreateBaseAtCreature(lua_State* L, Pet* pet) { - Creature* creature = Eluna::CHECKOBJ(L, 2); - Eluna::Push(L, pet->CreateBaseAtCreature(creature)); + Creature* creature = ALE::CHECKOBJ(L, 2); + ALE::Push(L, pet->CreateBaseAtCreature(creature)); return 1; } @@ -113,7 +113,7 @@ namespace LuaPet */ int GetDuration(lua_State* L, Pet* pet) { - Eluna::Push(L, pet->GetDuration().count()); + ALE::Push(L, pet->GetDuration().count()); return 1; } @@ -124,7 +124,7 @@ namespace LuaPet */ int SetDuration(lua_State* L, Pet* pet) { - uint32 duration = Eluna::CHECKVAL(L, 2); + uint32 duration = ALE::CHECKVAL(L, 2); pet->SetDuration(Milliseconds(duration)); return 0; } @@ -145,7 +145,7 @@ namespace LuaPet */ int GetHappinessState(lua_State* L, Pet* pet) { - Eluna::Push(L, pet->GetHappinessState()); + ALE::Push(L, pet->GetHappinessState()); return 1; } @@ -156,7 +156,7 @@ namespace LuaPet */ int GivePetXP(lua_State* L, Pet* pet) { - uint32 xp = Eluna::CHECKVAL(L, 2); + uint32 xp = ALE::CHECKVAL(L, 2); pet->GivePetXP(xp); return 0; } @@ -168,7 +168,7 @@ namespace LuaPet */ int GivePetLevel(lua_State* L, Pet* pet) { - uint8 level = Eluna::CHECKVAL(L, 2); + uint8 level = ALE::CHECKVAL(L, 2); pet->GivePetLevel(level); return 0; } @@ -192,8 +192,8 @@ namespace LuaPet */ int HaveInDiet(lua_State* L, Pet* pet) { - Item* item = Eluna::CHECKOBJ(L, 2); - Eluna::Push(L, pet->HaveInDiet(item->GetTemplate())); + Item* item = ALE::CHECKOBJ(L, 2); + ALE::Push(L, pet->HaveInDiet(item->GetTemplate())); return 1; } @@ -205,8 +205,8 @@ namespace LuaPet */ int GetCurrentFoodBenefitLevel(lua_State* L, Pet* pet) { - uint32 itemLevel = Eluna::CHECKVAL(L, 2); - Eluna::Push(L, pet->GetCurrentFoodBenefitLevel(itemLevel)); + uint32 itemLevel = ALE::CHECKVAL(L, 2); + ALE::Push(L, pet->GetCurrentFoodBenefitLevel(itemLevel)); return 1; } @@ -218,8 +218,8 @@ namespace LuaPet */ int ToggleAutocast(lua_State* L, Pet* pet) { - uint32 spellId = Eluna::CHECKVAL(L, 2); - bool apply = Eluna::CHECKVAL(L, 3); + uint32 spellId = ALE::CHECKVAL(L, 2); + bool apply = ALE::CHECKVAL(L, 3); SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); if (spellInfo) @@ -248,10 +248,10 @@ namespace LuaPet */ int CastWhenWillAvailable(lua_State* L, Pet* pet) { - uint32 spellId = Eluna::CHECKVAL(L, 2); - Unit* target = Eluna::CHECKOBJ(L, 3); + uint32 spellId = ALE::CHECKVAL(L, 2); + Unit* target = ALE::CHECKOBJ(L, 3); ObjectGuid oldTarget = ObjectGuid::Empty; - bool isPositive = Eluna::CHECKVAL(L, 4, false); + bool isPositive = ALE::CHECKVAL(L, 4, false); pet->CastWhenWillAvailable(spellId, target, oldTarget, isPositive); return 0; @@ -308,12 +308,12 @@ namespace LuaPet */ int AddSpell(lua_State* L, Pet* pet) { - uint32 spellId = Eluna::CHECKVAL(L, 2); - uint32 active = Eluna::CHECKVAL(L, 3, ACT_DECIDE); - uint32 state = Eluna::CHECKVAL(L, 4, PETSPELL_NEW); - uint32 type = Eluna::CHECKVAL(L, 5, PETSPELL_NORMAL); + uint32 spellId = ALE::CHECKVAL(L, 2); + uint32 active = ALE::CHECKVAL(L, 3, ACT_DECIDE); + uint32 state = ALE::CHECKVAL(L, 4, PETSPELL_NEW); + uint32 type = ALE::CHECKVAL(L, 5, PETSPELL_NORMAL); - Eluna::Push(L, pet->addSpell(spellId, static_cast(active), static_cast(state), static_cast(type))); + ALE::Push(L, pet->addSpell(spellId, static_cast(active), static_cast(state), static_cast(type))); return 1; } @@ -325,8 +325,8 @@ namespace LuaPet */ int LearnSpell(lua_State* L, Pet* pet) { - uint32 spellId = Eluna::CHECKVAL(L, 2); - Eluna::Push(L, pet->learnSpell(spellId)); + uint32 spellId = ALE::CHECKVAL(L, 2); + ALE::Push(L, pet->learnSpell(spellId)); return 1; } @@ -337,7 +337,7 @@ namespace LuaPet */ int LearnSpellHighRank(lua_State* L, Pet* pet) { - uint32 spellId = Eluna::CHECKVAL(L, 2); + uint32 spellId = ALE::CHECKVAL(L, 2); pet->learnSpellHighRank(spellId); return 0; } @@ -363,11 +363,11 @@ namespace LuaPet */ int UnlearnSpell(lua_State* L, Pet* pet) { - uint32 spellId = Eluna::CHECKVAL(L, 2); - bool learnPrev = Eluna::CHECKVAL(L, 3, false); - bool clearAb = Eluna::CHECKVAL(L, 4, true); + uint32 spellId = ALE::CHECKVAL(L, 2); + bool learnPrev = ALE::CHECKVAL(L, 3, false); + bool clearAb = ALE::CHECKVAL(L, 4, true); - Eluna::Push(L, pet->unlearnSpell(spellId, learnPrev, clearAb)); + ALE::Push(L, pet->unlearnSpell(spellId, learnPrev, clearAb)); return 1; } @@ -381,11 +381,11 @@ namespace LuaPet */ int RemoveSpell(lua_State* L, Pet* pet) { - uint32 spellId = Eluna::CHECKVAL(L, 2); - bool learnPrev = Eluna::CHECKVAL(L, 3, false); - bool clearAb = Eluna::CHECKVAL(L, 4, true); + uint32 spellId = ALE::CHECKVAL(L, 2); + bool learnPrev = ALE::CHECKVAL(L, 3, false); + bool clearAb = ALE::CHECKVAL(L, 4, true); - Eluna::Push(L, pet->removeSpell(spellId, learnPrev, clearAb)); + ALE::Push(L, pet->removeSpell(spellId, learnPrev, clearAb)); return 1; } @@ -405,7 +405,7 @@ namespace LuaPet */ int GenerateActionBarData(lua_State* L, Pet* pet) { - Eluna::Push(L, pet->GenerateActionBarData()); + ALE::Push(L, pet->GenerateActionBarData()); return 1; } @@ -427,7 +427,7 @@ namespace LuaPet */ int ResetTalents(lua_State* L, Pet* pet) { - Eluna::Push(L, pet->resetTalents()); + ALE::Push(L, pet->resetTalents()); return 1; } @@ -450,8 +450,8 @@ namespace LuaPet */ int GetMaxTalentPointsForLevel(lua_State* L, Pet* pet) { - uint8 level = Eluna::CHECKVAL(L, 2); - Eluna::Push(L, pet->GetMaxTalentPointsForLevel(level)); + uint8 level = ALE::CHECKVAL(L, 2); + ALE::Push(L, pet->GetMaxTalentPointsForLevel(level)); return 1; } @@ -462,7 +462,7 @@ namespace LuaPet */ int GetFreeTalentPoints(lua_State* L, Pet* pet) { - Eluna::Push(L, pet->GetFreeTalentPoints()); + ALE::Push(L, pet->GetFreeTalentPoints()); return 1; } @@ -473,7 +473,7 @@ namespace LuaPet */ int SetFreeTalentPoints(lua_State* L, Pet* pet) { - uint8 points = Eluna::CHECKVAL(L, 2); + uint8 points = ALE::CHECKVAL(L, 2); pet->SetFreeTalentPoints(points); return 0; } @@ -485,7 +485,7 @@ namespace LuaPet */ int GetUsedTalentCount(lua_State* L, Pet* pet) { - Eluna::Push(L, pet->m_usedTalentCount); + ALE::Push(L, pet->m_usedTalentCount); return 1; } @@ -496,7 +496,7 @@ namespace LuaPet */ int SetUsedTalentCount(lua_State* L, Pet* pet) { - uint32 count = Eluna::CHECKVAL(L, 2); + uint32 count = ALE::CHECKVAL(L, 2); pet->m_usedTalentCount = count; return 0; } @@ -508,7 +508,7 @@ namespace LuaPet */ int GetAuraUpdateMaskForRaid(lua_State* L, Pet* pet) { - Eluna::Push(L, pet->GetAuraUpdateMaskForRaid()); + ALE::Push(L, pet->GetAuraUpdateMaskForRaid()); return 1; } @@ -519,7 +519,7 @@ namespace LuaPet */ int SetAuraUpdateMaskForRaid(lua_State* L, Pet* pet) { - uint8 slot = Eluna::CHECKVAL(L, 2); + uint8 slot = ALE::CHECKVAL(L, 2); pet->SetAuraUpdateMaskForRaid(slot); return 0; } @@ -540,7 +540,7 @@ namespace LuaPet */ int GetOwner(lua_State* L, Pet* pet) { - Eluna::Push(L, pet->GetOwner()); + ALE::Push(L, pet->GetOwner()); return 1; } @@ -551,7 +551,7 @@ namespace LuaPet */ int HasTempSpell(lua_State* L, Pet* pet) { - Eluna::Push(L, pet->HasTempSpell()); + ALE::Push(L, pet->HasTempSpell()); return 1; } @@ -562,7 +562,7 @@ namespace LuaPet */ int IsRemoved(lua_State* L, Pet* pet) { - Eluna::Push(L, pet->m_removed); + ALE::Push(L, pet->m_removed); return 1; } @@ -573,7 +573,7 @@ namespace LuaPet */ int SetRemoved(lua_State* L, Pet* pet) { - bool removed = Eluna::CHECKVAL(L, 2); + bool removed = ALE::CHECKVAL(L, 2); pet->m_removed = removed; return 0; } @@ -585,7 +585,7 @@ namespace LuaPet */ int GetPetAutoSpellSize(lua_State* L, Pet* pet) { - Eluna::Push(L, pet->GetPetAutoSpellSize()); + ALE::Push(L, pet->GetPetAutoSpellSize()); return 1; } @@ -597,8 +597,8 @@ namespace LuaPet */ int GetPetAutoSpellOnPos(lua_State* L, Pet* pet) { - uint8 pos = Eluna::CHECKVAL(L, 2); - Eluna::Push(L, pet->GetPetAutoSpellOnPos(pos)); + uint8 pos = ALE::CHECKVAL(L, 2); + ALE::Push(L, pet->GetPetAutoSpellOnPos(pos)); return 1; } @@ -620,7 +620,7 @@ namespace LuaPet */ int SavePetToDB(lua_State* L, Pet* pet) { - uint32 mode = Eluna::CHECKVAL(L, 2); + uint32 mode = ALE::CHECKVAL(L, 2); pet->SavePetToDB(static_cast(mode)); return 0; } @@ -644,8 +644,8 @@ namespace LuaPet */ int Remove(lua_State* L, Pet* pet) { - uint32 mode = Eluna::CHECKVAL(L, 2); - bool returnReagent = Eluna::CHECKVAL(L, 3, false); + uint32 mode = ALE::CHECKVAL(L, 2); + bool returnReagent = ALE::CHECKVAL(L, 3, false); pet->Remove(static_cast(mode), returnReagent); return 0; } @@ -657,7 +657,7 @@ namespace LuaPet */ int IsBeingLoaded(lua_State* L, Pet* pet) { - Eluna::Push(L, pet->isBeingLoaded()); + ALE::Push(L, pet->isBeingLoaded()); return 1; } }; diff --git a/src/LuaEngine/methods/PlayerMethods.h b/src/LuaEngine/methods/PlayerMethods.h index 3b51411..6966073 100644 --- a/src/LuaEngine/methods/PlayerMethods.h +++ b/src/LuaEngine/methods/PlayerMethods.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 */ @@ -23,7 +23,7 @@ namespace LuaPlayer */ int CanTitanGrip(lua_State* L, Player* player) { - Eluna::Push(L, player->CanTitanGrip()); + ALE::Push(L, player->CanTitanGrip()); return 1; } @@ -36,12 +36,12 @@ namespace LuaPlayer */ int HasTalent(lua_State* L, Player* player) { - uint32 spellId = Eluna::CHECKVAL(L, 2); + uint32 spellId = ALE::CHECKVAL(L, 2); uint8 maxSpecs = MAX_TALENT_SPECS; - uint8 spec = Eluna::CHECKVAL(L, 3); + uint8 spec = ALE::CHECKVAL(L, 3); if (spec >= maxSpecs) return 1; - Eluna::Push(L, player->HasTalent(spellId, spec)); + ALE::Push(L, player->HasTalent(spellId, spec)); return 1; } @@ -53,8 +53,8 @@ namespace LuaPlayer */ int HasAchieved(lua_State* L, Player* player) { - uint32 achievementId = Eluna::CHECKVAL(L, 2); - Eluna::Push(L, player->HasAchieved(achievementId)); + uint32 achievementId = ALE::CHECKVAL(L, 2); + ALE::Push(L, player->HasAchieved(achievementId)); return 1; } @@ -66,16 +66,16 @@ namespace LuaPlayer */ int GetAchievementCriteriaProgress(lua_State* L, Player* player) { - uint32 criteriaId = Eluna::CHECKVAL(L, 2); + uint32 criteriaId = ALE::CHECKVAL(L, 2); const AchievementCriteriaEntry* criteria = sAchievementCriteriaStore.LookupEntry(criteriaId); CriteriaProgress* progress = player->GetAchievementMgr()->GetCriteriaProgress(criteria); if (progress) { - Eluna::Push(L, progress->counter); + ALE::Push(L, progress->counter); } else { - Eluna::Push(L, (void*)nullptr); + ALE::Push(L, (void*)nullptr); } return 1; } @@ -88,9 +88,9 @@ namespace LuaPlayer */ int HasQuest(lua_State* L, Player* player) { - uint32 quest = Eluna::CHECKVAL(L, 2); + uint32 quest = ALE::CHECKVAL(L, 2); - Eluna::Push(L, player->IsActiveQuest(quest)); + ALE::Push(L, player->IsActiveQuest(quest)); return 1; } @@ -102,9 +102,9 @@ namespace LuaPlayer */ int HasSkill(lua_State* L, Player* player) { - uint32 skill = Eluna::CHECKVAL(L, 2); + uint32 skill = ALE::CHECKVAL(L, 2); - Eluna::Push(L, player->HasSkill(skill)); + ALE::Push(L, player->HasSkill(skill)); return 1; } @@ -116,9 +116,9 @@ namespace LuaPlayer */ int HasSpell(lua_State* L, Player* player) { - uint32 id = Eluna::CHECKVAL(L, 2); + uint32 id = ALE::CHECKVAL(L, 2); - Eluna::Push(L, player->HasSpell(id)); + ALE::Push(L, player->HasSpell(id)); return 1; } @@ -130,9 +130,9 @@ namespace LuaPlayer */ int HasAtLoginFlag(lua_State* L, Player* player) { - uint32 flag = Eluna::CHECKVAL(L, 2); + uint32 flag = ALE::CHECKVAL(L, 2); - Eluna::Push(L, player->HasAtLoginFlag((AtLoginFlags)flag)); + ALE::Push(L, player->HasAtLoginFlag((AtLoginFlags)flag)); return 1; } @@ -144,9 +144,9 @@ namespace LuaPlayer */ int HasQuestForGO(lua_State* L, Player* player) { - int32 entry = Eluna::CHECKVAL(L, 2); + int32 entry = ALE::CHECKVAL(L, 2); - Eluna::Push(L, player->HasQuestForGO(entry)); + ALE::Push(L, player->HasQuestForGO(entry)); return 1; } @@ -158,10 +158,10 @@ namespace LuaPlayer */ int HasTitle(lua_State* L, Player* player) { - uint32 id = Eluna::CHECKVAL(L, 2); + uint32 id = ALE::CHECKVAL(L, 2); CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id); if (titleInfo) - Eluna::Push(L, player->HasTitle(titleInfo)); + ALE::Push(L, player->HasTitle(titleInfo)); return 1; } @@ -175,10 +175,10 @@ namespace LuaPlayer */ int HasItem(lua_State* L, Player* player) { - uint32 itemId = Eluna::CHECKVAL(L, 2); - uint32 count = Eluna::CHECKVAL(L, 3, 1); - bool check_bank = Eluna::CHECKVAL(L, 4, false); - Eluna::Push(L, player->HasItemCount(itemId, count, check_bank)); + uint32 itemId = ALE::CHECKVAL(L, 2); + uint32 count = ALE::CHECKVAL(L, 3, 1); + bool check_bank = ALE::CHECKVAL(L, 4, false); + ALE::Push(L, player->HasItemCount(itemId, count, check_bank)); return 1; } @@ -190,9 +190,9 @@ namespace LuaPlayer */ int HasQuestForItem(lua_State* L, Player* player) { - uint32 entry = Eluna::CHECKVAL(L, 2); + uint32 entry = ALE::CHECKVAL(L, 2); - Eluna::Push(L, player->HasQuestForItem(entry)); + ALE::Push(L, player->HasQuestForItem(entry)); return 1; } @@ -207,17 +207,17 @@ namespace LuaPlayer */ int CanUseItem(lua_State* L, Player* player) { - Item* item = Eluna::CHECKOBJ(L, 2, false); + Item* item = ALE::CHECKOBJ(L, 2, false); if (item) - Eluna::Push(L, player->CanUseItem(item) == EQUIP_ERR_OK); + ALE::Push(L, player->CanUseItem(item) == EQUIP_ERR_OK); else { - uint32 entry = Eluna::CHECKVAL(L, 2); + uint32 entry = ALE::CHECKVAL(L, 2); const ItemTemplate* temp = eObjectMgr->GetItemTemplate(entry); if (temp) - Eluna::Push(L, player->CanUseItem(temp) == EQUIP_ERR_OK); + ALE::Push(L, player->CanUseItem(temp) == EQUIP_ERR_OK); else - Eluna::Push(L, false); + ALE::Push(L, false); } return 1; } @@ -230,9 +230,9 @@ namespace LuaPlayer */ int HasSpellCooldown(lua_State* L, Player* player) { - uint32 spellId = Eluna::CHECKVAL(L, 2); + uint32 spellId = ALE::CHECKVAL(L, 2); - Eluna::Push(L, player->HasSpellCooldown(spellId)); + ALE::Push(L, player->HasSpellCooldown(spellId)); return 1; } @@ -244,9 +244,9 @@ namespace LuaPlayer */ int CanShareQuest(lua_State* L, Player* player) { - uint32 entry = Eluna::CHECKVAL(L, 2); + uint32 entry = ALE::CHECKVAL(L, 2); - Eluna::Push(L, player->CanShareQuest(entry)); + ALE::Push(L, player->CanShareQuest(entry)); return 1; } @@ -257,7 +257,7 @@ namespace LuaPlayer */ int CanSpeak(lua_State* L, Player* player) { - Eluna::Push(L, player->CanSpeak()); + ALE::Push(L, player->CanSpeak()); return 1; } @@ -268,7 +268,7 @@ namespace LuaPlayer */ int CanUninviteFromGroup(lua_State* L, Player* player) { - Eluna::Push(L, player->CanUninviteFromGroup() == ERR_PARTY_RESULT_OK); + ALE::Push(L, player->CanUninviteFromGroup() == ERR_PARTY_RESULT_OK); return 1; } @@ -279,7 +279,7 @@ namespace LuaPlayer */ int CanFly(lua_State* L, Player* player) { - Eluna::Push(L, player->CanFly()); + ALE::Push(L, player->CanFly()); return 1; } @@ -290,7 +290,7 @@ namespace LuaPlayer */ int IsInWater(lua_State* L, Player* player) { - Eluna::Push(L, player->IsInWater()); + ALE::Push(L, player->IsInWater()); return 1; } @@ -301,7 +301,7 @@ namespace LuaPlayer */ int IsMoving(lua_State* L, Player* player) // enable for unit when mangos support it { - Eluna::Push(L, player->isMoving()); + ALE::Push(L, player->isMoving()); return 1; } @@ -312,7 +312,7 @@ namespace LuaPlayer */ int IsFlying(lua_State* L, Player* player) // enable for unit when mangos support it { - Eluna::Push(L, player->IsFlying()); + ALE::Push(L, player->IsFlying()); return 1; } @@ -323,7 +323,7 @@ namespace LuaPlayer */ int HasTankSpec(lua_State* L, Player* player) { - Eluna::Push(L, player->HasTankSpec()); + ALE::Push(L, player->HasTankSpec()); return 1; } @@ -334,7 +334,7 @@ namespace LuaPlayer */ int HasMeleeSpec(lua_State* L, Player* player) { - Eluna::Push(L, player->HasMeleeSpec()); + ALE::Push(L, player->HasMeleeSpec()); return 1; } @@ -345,7 +345,7 @@ namespace LuaPlayer */ int HasCasterSpec(lua_State* L, Player* player) { - Eluna::Push(L, player->HasCasterSpec()); + ALE::Push(L, player->HasCasterSpec()); return 1; } @@ -356,7 +356,7 @@ namespace LuaPlayer */ int HasHealSpec(lua_State* L, Player* player) { - Eluna::Push(L, player->HasHealSpec()); + ALE::Push(L, player->HasHealSpec()); return 1; } @@ -367,7 +367,7 @@ namespace LuaPlayer */ int IsInGroup(lua_State* L, Player* player) { - Eluna::Push(L, (player->GetGroup() != NULL)); + ALE::Push(L, (player->GetGroup() != NULL)); return 1; } @@ -378,7 +378,7 @@ namespace LuaPlayer */ int IsInGuild(lua_State* L, Player* player) { - Eluna::Push(L, (player->GetGuildId() != 0)); + ALE::Push(L, (player->GetGuildId() != 0)); return 1; } @@ -391,7 +391,7 @@ namespace LuaPlayer */ int IsGM(lua_State* L, Player* player) { - Eluna::Push(L, player->IsGameMaster()); + ALE::Push(L, player->IsGameMaster()); return 1; } @@ -403,11 +403,11 @@ namespace LuaPlayer */ int IsInArenaTeam(lua_State* L, Player* player) { - uint32 type = Eluna::CHECKVAL(L, 2); + uint32 type = ALE::CHECKVAL(L, 2); if (type < MAX_ARENA_SLOT && player->GetArenaTeamId(type)) - Eluna::Push(L, true); + ALE::Push(L, true); else - Eluna::Push(L, false); + ALE::Push(L, false); return 1; } @@ -418,7 +418,7 @@ namespace LuaPlayer */ int IsImmuneToDamage(lua_State* L, Player* player) { - Eluna::Push(L, player->isTotalImmune()); + ALE::Push(L, player->isTotalImmune()); return 1; } @@ -430,15 +430,15 @@ namespace LuaPlayer */ int CanCompleteRepeatableQuest(lua_State* L, Player* player) { - uint32 questId = Eluna::CHECKVAL(L, 2); + uint32 questId = ALE::CHECKVAL(L, 2); const Quest* quest = sObjectMgr->GetQuestTemplate(questId); // Retrieve the Quest object if (!quest) { - Eluna::Push(L, false); + ALE::Push(L, false); return 1; } - Eluna::Push(L, player->CanCompleteRepeatableQuest(quest)); + ALE::Push(L, player->CanCompleteRepeatableQuest(quest)); return 1; } @@ -450,15 +450,15 @@ namespace LuaPlayer */ int CanRewardQuest(lua_State* L, Player* player) { - uint32 questId = Eluna::CHECKVAL(L, 2); + uint32 questId = ALE::CHECKVAL(L, 2); const Quest* quest = sObjectMgr->GetQuestTemplate(questId); // Retrieve the Quest object if (!quest) { - Eluna::Push(L, false); + ALE::Push(L, false); return 1; } - Eluna::Push(L, player->CanRewardQuest(quest, true)); // Modify the second argument as needed + ALE::Push(L, player->CanRewardQuest(quest, true)); // Modify the second argument as needed return 1; } @@ -470,9 +470,9 @@ namespace LuaPlayer */ int CanCompleteQuest(lua_State* L, Player* player) { - uint32 entry = Eluna::CHECKVAL(L, 2); + uint32 entry = ALE::CHECKVAL(L, 2); - Eluna::Push(L, player->CanCompleteQuest(entry)); + ALE::Push(L, player->CanCompleteQuest(entry)); return 1; } @@ -483,7 +483,7 @@ namespace LuaPlayer */ int IsHorde(lua_State* L, Player* player) { - Eluna::Push(L, (player->GetTeamId() == TEAM_HORDE)); + ALE::Push(L, (player->GetTeamId() == TEAM_HORDE)); return 1; } @@ -494,7 +494,7 @@ namespace LuaPlayer */ int IsAlliance(lua_State* L, Player* player) { - Eluna::Push(L, (player->GetTeamId() == TEAM_ALLIANCE)); + ALE::Push(L, (player->GetTeamId() == TEAM_ALLIANCE)); return 1; } @@ -505,7 +505,7 @@ namespace LuaPlayer */ int IsDND(lua_State* L, Player* player) { - Eluna::Push(L, player->isDND()); + ALE::Push(L, player->isDND()); return 1; } @@ -516,7 +516,7 @@ namespace LuaPlayer */ int IsAFK(lua_State* L, Player* player) { - Eluna::Push(L, player->isAFK()); + ALE::Push(L, player->isAFK()); return 1; } @@ -527,7 +527,7 @@ namespace LuaPlayer */ int IsFalling(lua_State* L, Player* player) { - Eluna::Push(L, player->IsFalling()); + ALE::Push(L, player->IsFalling()); return 1; } @@ -540,8 +540,8 @@ namespace LuaPlayer */ int IsGroupVisibleFor(lua_State* L, Player* player) { - Player* target = Eluna::CHECKOBJ(L, 2); - Eluna::Push(L, player->IsGroupVisibleFor(target)); + Player* target = ALE::CHECKOBJ(L, 2); + ALE::Push(L, player->IsGroupVisibleFor(target)); return 1; } @@ -553,8 +553,8 @@ namespace LuaPlayer */ int IsInSameRaidWith(lua_State* L, Player* player) { - Player* target = Eluna::CHECKOBJ(L, 2); - Eluna::Push(L, player->IsInSameRaidWith(target)); + Player* target = ALE::CHECKOBJ(L, 2); + ALE::Push(L, player->IsInSameRaidWith(target)); return 1; } @@ -566,8 +566,8 @@ namespace LuaPlayer */ int IsInSameGroupWith(lua_State* L, Player* player) { - Player* target = Eluna::CHECKOBJ(L, 2); - Eluna::Push(L, player->IsInSameGroupWith(target)); + Player* target = ALE::CHECKOBJ(L, 2); + ALE::Push(L, player->IsInSameGroupWith(target)); return 1; } @@ -579,9 +579,9 @@ namespace LuaPlayer */ int IsHonorOrXPTarget(lua_State* L, Player* player) { - Unit* victim = Eluna::CHECKOBJ(L, 2); + Unit* victim = ALE::CHECKOBJ(L, 2); - Eluna::Push(L, player->isHonorOrXPTarget(victim)); + ALE::Push(L, player->isHonorOrXPTarget(victim)); return 1; } @@ -593,9 +593,9 @@ namespace LuaPlayer */ int IsVisibleForPlayer(lua_State* L, Player* player) { - Player* target = Eluna::CHECKOBJ(L, 2); + Player* target = ALE::CHECKOBJ(L, 2); - Eluna::Push(L, player->IsVisibleGloballyFor(target)); + ALE::Push(L, player->IsVisibleGloballyFor(target)); return 1; } @@ -607,7 +607,7 @@ namespace LuaPlayer */ int IsGMVisible(lua_State* L, Player* player) { - Eluna::Push(L, player->isGMVisible()); + ALE::Push(L, player->isGMVisible()); return 1; } @@ -618,7 +618,7 @@ namespace LuaPlayer */ int IsTaxiCheater(lua_State* L, Player* player) { - Eluna::Push(L, player->isTaxiCheater()); + ALE::Push(L, player->isTaxiCheater()); return 1; } @@ -630,7 +630,7 @@ namespace LuaPlayer */ int IsGMChat(lua_State* L, Player* player) { - Eluna::Push(L, player->isGMChat()); + ALE::Push(L, player->isGMChat()); return 1; } @@ -641,7 +641,7 @@ namespace LuaPlayer */ int IsAcceptingWhispers(lua_State* L, Player* player) { - Eluna::Push(L, player->isAcceptWhispers()); + ALE::Push(L, player->isAcceptWhispers()); return 1; } @@ -652,7 +652,7 @@ namespace LuaPlayer */ int IsRested(lua_State* L, Player* player) { - Eluna::Push(L, player->GetRestBonus() > 0.0f); + ALE::Push(L, player->GetRestBonus() > 0.0f); return 1; } @@ -663,7 +663,7 @@ namespace LuaPlayer */ int InBattlegroundQueue(lua_State* L, Player* player) { - Eluna::Push(L, player->InBattlegroundQueue()); + ALE::Push(L, player->InBattlegroundQueue()); return 1; } @@ -674,7 +674,7 @@ namespace LuaPlayer */ int InArena(lua_State* L, Player* player) { - Eluna::Push(L, player->InArena()); + ALE::Push(L, player->InArena()); return 1; } @@ -685,7 +685,7 @@ namespace LuaPlayer */ int InBattleground(lua_State* L, Player* player) { - Eluna::Push(L, player->InBattleground()); + ALE::Push(L, player->InBattleground()); return 1; } @@ -696,7 +696,7 @@ namespace LuaPlayer */ int CanBlock(lua_State* L, Player* player) { - Eluna::Push(L, player->CanBlock()); + ALE::Push(L, player->CanBlock()); return 1; } @@ -707,7 +707,7 @@ namespace LuaPlayer */ int CanParry(lua_State* L, Player* player) { - Eluna::Push(L, player->CanParry()); + ALE::Push(L, player->CanParry()); return 1; } @@ -718,7 +718,7 @@ namespace LuaPlayer */ int GetSpecsCount(lua_State* L, Player* player) { - Eluna::Push(L, player->GetSpecsCount()); + ALE::Push(L, player->GetSpecsCount()); return 1; } @@ -729,7 +729,7 @@ namespace LuaPlayer */ int GetActiveSpec(lua_State* L, Player* player) { - Eluna::Push(L, player->GetActiveSpec()); + ALE::Push(L, player->GetActiveSpec()); return 1; } @@ -740,7 +740,7 @@ namespace LuaPlayer */ int GetPhaseMaskForSpawn(lua_State* L, Player* player) { - Eluna::Push(L, player->GetPhaseMaskForSpawn()); + ALE::Push(L, player->GetPhaseMaskForSpawn()); return 1; } @@ -762,7 +762,7 @@ namespace LuaPlayer } } - Eluna::Push(L, count); + ALE::Push(L, count); return 1; } @@ -774,7 +774,7 @@ namespace LuaPlayer int GetCompletedAchievementsCount(lua_State* L, Player* player) { uint32 count = 0; - bool countFeatsOfStrength = Eluna::CHECKVAL(L, 2, false); + bool countFeatsOfStrength = ALE::CHECKVAL(L, 2, false); const CompletedAchievementMap& completedAchievements = player->GetAchievementMgr()->GetCompletedAchievements(); for (auto& pair : completedAchievements) { @@ -785,7 +785,7 @@ namespace LuaPlayer } } - Eluna::Push(L, count); + ALE::Push(L, count); return 1; } @@ -796,7 +796,7 @@ namespace LuaPlayer */ int GetArenaPoints(lua_State* L, Player* player) { - Eluna::Push(L, player->GetArenaPoints()); + ALE::Push(L, player->GetArenaPoints()); return 1; } @@ -807,7 +807,7 @@ namespace LuaPlayer */ int GetHonorPoints(lua_State* L, Player* player) { - Eluna::Push(L, player->GetHonorPoints()); + ALE::Push(L, player->GetHonorPoints()); return 1; } @@ -818,7 +818,7 @@ namespace LuaPlayer */ int GetShieldBlockValue(lua_State* L, Player* player) { - Eluna::Push(L, player->GetShieldBlockValue()); + ALE::Push(L, player->GetShieldBlockValue()); return 1; } @@ -830,9 +830,9 @@ namespace LuaPlayer */ int GetSpellCooldownDelay(lua_State* L, Player* player) { - uint32 spellId = Eluna::CHECKVAL(L, 2); + uint32 spellId = ALE::CHECKVAL(L, 2); - Eluna::Push(L, uint32(player->GetSpellCooldownDelay(spellId))); + ALE::Push(L, uint32(player->GetSpellCooldownDelay(spellId))); return 1; } @@ -843,7 +843,7 @@ namespace LuaPlayer */ int GetLatency(lua_State* L, Player* player) { - Eluna::Push(L, player->GetSession()->GetLatency()); + ALE::Push(L, player->GetSession()->GetLatency()); return 1; } @@ -854,7 +854,7 @@ namespace LuaPlayer */ int GetChampioningFaction(lua_State* L, Player* player) { - Eluna::Push(L, player->GetChampioningFaction()); + ALE::Push(L, player->GetChampioningFaction()); return 1; } @@ -865,7 +865,7 @@ namespace LuaPlayer */ int GetOriginalSubGroup(lua_State* L, Player* player) { - Eluna::Push(L, player->GetOriginalSubGroup()); + ALE::Push(L, player->GetOriginalSubGroup()); return 1; } @@ -876,7 +876,7 @@ namespace LuaPlayer */ int GetOriginalGroup(lua_State* L, Player* player) { - Eluna::Push(L, player->GetOriginalGroup()); + ALE::Push(L, player->GetOriginalGroup()); return 1; } @@ -888,9 +888,9 @@ namespace LuaPlayer */ int GetNextRandomRaidMember(lua_State* L, Player* player) { - float radius = Eluna::CHECKVAL(L, 2); + float radius = ALE::CHECKVAL(L, 2); - Eluna::Push(L, player->GetNextRandomRaidMember(radius)); + ALE::Push(L, player->GetNextRandomRaidMember(radius)); return 1; } @@ -901,7 +901,7 @@ namespace LuaPlayer */ int GetSubGroup(lua_State* L, Player* player) { - Eluna::Push(L, player->GetSubGroup()); + ALE::Push(L, player->GetSubGroup()); return 1; } @@ -912,7 +912,7 @@ namespace LuaPlayer */ int GetGroupInvite(lua_State* L, Player* player) { - Eluna::Push(L, player->GetGroupInvite()); + ALE::Push(L, player->GetGroupInvite()); return 1; } @@ -923,7 +923,7 @@ namespace LuaPlayer */ int GetXP(lua_State* L, Player* player) { - Eluna::Push(L, player->GetUInt32Value(PLAYER_XP)); + ALE::Push(L, player->GetUInt32Value(PLAYER_XP)); return 1; } @@ -935,9 +935,9 @@ namespace LuaPlayer */ int GetXPRestBonus(lua_State* L, Player* player) { - uint32 xp = Eluna::CHECKVAL(L, 2); + uint32 xp = ALE::CHECKVAL(L, 2); - Eluna::Push(L, player->GetXPRestBonus(xp)); + ALE::Push(L, player->GetXPRestBonus(xp)); return 1; } @@ -948,7 +948,7 @@ namespace LuaPlayer */ int GetBattlegroundTypeId(lua_State* L, Player* player) { - Eluna::Push(L, player->GetBattlegroundTypeId()); + ALE::Push(L, player->GetBattlegroundTypeId()); return 1; } @@ -959,7 +959,7 @@ namespace LuaPlayer */ int GetBattlegroundId(lua_State* L, Player* player) { - Eluna::Push(L, player->GetBattlegroundId()); + ALE::Push(L, player->GetBattlegroundId()); return 1; } @@ -971,9 +971,9 @@ namespace LuaPlayer */ int GetReputationRank(lua_State* L, Player* player) { - uint32 faction = Eluna::CHECKVAL(L, 2); + uint32 faction = ALE::CHECKVAL(L, 2); - Eluna::Push(L, player->GetReputationRank(faction)); + ALE::Push(L, player->GetReputationRank(faction)); return 1; } @@ -984,7 +984,7 @@ namespace LuaPlayer */ int GetDrunkValue(lua_State* L, Player* player) { - Eluna::Push(L, player->GetDrunkValue()); + ALE::Push(L, player->GetDrunkValue()); return 1; } @@ -996,9 +996,9 @@ namespace LuaPlayer */ int GetSkillTempBonusValue(lua_State* L, Player* player) { - uint32 skill = Eluna::CHECKVAL(L, 2); + uint32 skill = ALE::CHECKVAL(L, 2); - Eluna::Push(L, player->GetSkillTempBonusValue(skill)); + ALE::Push(L, player->GetSkillTempBonusValue(skill)); return 1; } @@ -1010,9 +1010,9 @@ namespace LuaPlayer */ int GetSkillPermBonusValue(lua_State* L, Player* player) { - uint32 skill = Eluna::CHECKVAL(L, 2); + uint32 skill = ALE::CHECKVAL(L, 2); - Eluna::Push(L, player->GetSkillPermBonusValue(skill)); + ALE::Push(L, player->GetSkillPermBonusValue(skill)); return 1; } @@ -1024,9 +1024,9 @@ namespace LuaPlayer */ int GetPureSkillValue(lua_State* L, Player* player) { - uint32 skill = Eluna::CHECKVAL(L, 2); + uint32 skill = ALE::CHECKVAL(L, 2); - Eluna::Push(L, player->GetPureSkillValue(skill)); + ALE::Push(L, player->GetPureSkillValue(skill)); return 1; } @@ -1038,9 +1038,9 @@ namespace LuaPlayer */ int GetBaseSkillValue(lua_State* L, Player* player) { - uint32 skill = Eluna::CHECKVAL(L, 2); + uint32 skill = ALE::CHECKVAL(L, 2); - Eluna::Push(L, player->GetBaseSkillValue(skill)); + ALE::Push(L, player->GetBaseSkillValue(skill)); return 1; } @@ -1052,9 +1052,9 @@ namespace LuaPlayer */ int GetSkillValue(lua_State* L, Player* player) { - uint32 skill = Eluna::CHECKVAL(L, 2); + uint32 skill = ALE::CHECKVAL(L, 2); - Eluna::Push(L, player->GetSkillValue(skill)); + ALE::Push(L, player->GetSkillValue(skill)); return 1; } @@ -1066,9 +1066,9 @@ namespace LuaPlayer */ int GetPureMaxSkillValue(lua_State* L, Player* player) { - uint32 skill = Eluna::CHECKVAL(L, 2); + uint32 skill = ALE::CHECKVAL(L, 2); - Eluna::Push(L, player->GetPureMaxSkillValue(skill)); + ALE::Push(L, player->GetPureMaxSkillValue(skill)); return 1; } @@ -1080,9 +1080,9 @@ namespace LuaPlayer */ int GetMaxSkillValue(lua_State* L, Player* player) { - uint32 skill = Eluna::CHECKVAL(L, 2); + uint32 skill = ALE::CHECKVAL(L, 2); - Eluna::Push(L, player->GetMaxSkillValue(skill)); + ALE::Push(L, player->GetMaxSkillValue(skill)); return 1; } @@ -1093,7 +1093,7 @@ namespace LuaPlayer */ int GetManaBonusFromIntellect(lua_State* L, Player* player) { - Eluna::Push(L, player->GetManaBonusFromIntellect()); + ALE::Push(L, player->GetManaBonusFromIntellect()); return 1; } @@ -1104,7 +1104,7 @@ namespace LuaPlayer */ int GetHealthBonusFromStamina(lua_State* L, Player* player) { - Eluna::Push(L, player->GetHealthBonusFromStamina()); + ALE::Push(L, player->GetHealthBonusFromStamina()); return 1; } @@ -1116,8 +1116,8 @@ namespace LuaPlayer */ int GetDifficulty(lua_State* L, Player* player) { - bool isRaid = Eluna::CHECKVAL(L, 2, true); - Eluna::Push(L, player->GetDifficulty(isRaid)); + bool isRaid = ALE::CHECKVAL(L, 2, true); + ALE::Push(L, player->GetDifficulty(isRaid)); return 1; } @@ -1128,7 +1128,7 @@ namespace LuaPlayer */ int GetGuildRank(lua_State* L, Player* player) // TODO: Move to Guild Methods { - Eluna::Push(L, player->GetRank()); + ALE::Push(L, player->GetRank()); return 1; } @@ -1139,7 +1139,7 @@ namespace LuaPlayer */ int GetFreeTalentPoints(lua_State* L, Player* player) { - Eluna::Push(L, player->GetFreeTalentPoints()); + ALE::Push(L, player->GetFreeTalentPoints()); return 1; } @@ -1152,7 +1152,7 @@ namespace LuaPlayer { if (!player->GetGuildId()) return 1; - Eluna::Push(L, eGuildMgr->GetGuildNameById(player->GetGuildId())); + ALE::Push(L, eGuildMgr->GetGuildNameById(player->GetGuildId())); return 1; } @@ -1164,9 +1164,9 @@ namespace LuaPlayer */ int GetReputation(lua_State* L, Player* player) { - uint32 faction = Eluna::CHECKVAL(L, 2); + uint32 faction = ALE::CHECKVAL(L, 2); - Eluna::Push(L, player->GetReputationMgr().GetReputation(faction)); + ALE::Push(L, player->GetReputationMgr().GetReputation(faction)); return 1; } @@ -1177,7 +1177,7 @@ namespace LuaPlayer */ int GetComboTarget(lua_State* L, Player* player) { - Eluna::Push(L, player->GetComboTarget()); + ALE::Push(L, player->GetComboTarget()); return 1; } @@ -1188,7 +1188,7 @@ namespace LuaPlayer */ int GetComboPoints(lua_State* L, Player* player) { - Eluna::Push(L, player->GetComboPoints()); + ALE::Push(L, player->GetComboPoints()); return 1; } @@ -1199,7 +1199,7 @@ namespace LuaPlayer */ int GetInGameTime(lua_State* L, Player* player) { - Eluna::Push(L, player->GetInGameTime()); + ALE::Push(L, player->GetInGameTime()); return 1; } @@ -1211,9 +1211,9 @@ namespace LuaPlayer */ int GetQuestStatus(lua_State* L, Player* player) { - uint32 entry = Eluna::CHECKVAL(L, 2); + uint32 entry = ALE::CHECKVAL(L, 2); - Eluna::Push(L, player->GetQuestStatus(entry)); + ALE::Push(L, player->GetQuestStatus(entry)); return 1; } @@ -1225,9 +1225,9 @@ namespace LuaPlayer */ int GetQuestRewardStatus(lua_State* L, Player* player) { - uint32 questId = Eluna::CHECKVAL(L, 2); + uint32 questId = ALE::CHECKVAL(L, 2); - Eluna::Push(L, player->GetQuestRewardStatus(questId)); + ALE::Push(L, player->GetQuestRewardStatus(questId)); return 1; } @@ -1240,10 +1240,10 @@ namespace LuaPlayer */ int GetReqKillOrCastCurrentCount(lua_State* L, Player* player) { - uint32 questId = Eluna::CHECKVAL(L, 2); - int32 entry = Eluna::CHECKVAL(L, 3); + uint32 questId = ALE::CHECKVAL(L, 2); + int32 entry = ALE::CHECKVAL(L, 3); - Eluna::Push(L, player->GetReqKillOrCastCurrentCount(questId, entry)); + ALE::Push(L, player->GetReqKillOrCastCurrentCount(questId, entry)); return 1; } @@ -1255,9 +1255,9 @@ namespace LuaPlayer */ int GetQuestLevel(lua_State* L, Player* player) { - Quest* quest = Eluna::CHECKOBJ(L, 2); + Quest* quest = ALE::CHECKOBJ(L, 2); - Eluna::Push(L, player->GetQuestLevel(quest)); + ALE::Push(L, player->GetQuestLevel(quest)); return 1; } @@ -1269,12 +1269,12 @@ namespace LuaPlayer */ int GetEquippedItemBySlot(lua_State* L, Player* player) { - uint8 slot = Eluna::CHECKVAL(L, 2); + uint8 slot = ALE::CHECKVAL(L, 2); if (slot >= EQUIPMENT_SLOT_END) return 1; Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot); - Eluna::Push(L, item); + ALE::Push(L, item); return 1; } @@ -1285,7 +1285,7 @@ namespace LuaPlayer */ int GetRestBonus(lua_State* L, Player* player) { - Eluna::Push(L, player->GetRestBonus()); + ALE::Push(L, player->GetRestBonus()); return 1; } @@ -1296,7 +1296,7 @@ namespace LuaPlayer */ int GetChatTag(lua_State* L, Player* player) { - Eluna::Push(L, player->GetChatTag()); + ALE::Push(L, player->GetChatTag()); return 1; } @@ -1327,10 +1327,10 @@ namespace LuaPlayer */ int GetItemByPos(lua_State* L, Player* player) { - uint8 bag = Eluna::CHECKVAL(L, 2); - uint8 slot = Eluna::CHECKVAL(L, 3); + uint8 bag = ALE::CHECKVAL(L, 2); + uint8 slot = ALE::CHECKVAL(L, 3); - Eluna::Push(L, player->GetItemByPos(bag, slot)); + ALE::Push(L, player->GetItemByPos(bag, slot)); return 1; } @@ -1344,9 +1344,9 @@ namespace LuaPlayer */ int GetItemByGUID(lua_State* L, Player* player) { - ObjectGuid guid = Eluna::CHECKVAL(L, 2); + ObjectGuid guid = ALE::CHECKVAL(L, 2); - Eluna::Push(L, player->GetItemByGuid(guid)); + ALE::Push(L, player->GetItemByGuid(guid)); return 1; } @@ -1360,11 +1360,11 @@ namespace LuaPlayer const CharacterCacheEntry* cache = sCharacterCache->GetCharacterCacheByGuid(player->GetGUID()); if (cache) { - Eluna::Push(L, static_cast(cache->MailCount)); + ALE::Push(L, static_cast(cache->MailCount)); } else { - Eluna::Push(L, player->GetMailSize()); + ALE::Push(L, player->GetMailSize()); } return 1; @@ -1378,9 +1378,9 @@ namespace LuaPlayer */ int GetMailItem(lua_State* L, Player* player) { - ObjectGuid guid = Eluna::CHECKVAL(L, 2); + ObjectGuid guid = ALE::CHECKVAL(L, 2); - Eluna::Push(L, player->GetMItem(guid.GetCounter())); + ALE::Push(L, player->GetMItem(guid.GetCounter())); return 1; } @@ -1394,9 +1394,9 @@ namespace LuaPlayer */ int GetItemByEntry(lua_State* L, Player* player) { - uint32 entry = Eluna::CHECKVAL(L, 2); + uint32 entry = ALE::CHECKVAL(L, 2); - Eluna::Push(L, player->GetItemByEntry(entry)); + ALE::Push(L, player->GetItemByEntry(entry)); return 1; } @@ -1408,8 +1408,8 @@ namespace LuaPlayer */ int GetGossipTextId(lua_State* L, Player* player) { - WorldObject* obj = Eluna::CHECKOBJ(L, 2); - Eluna::Push(L, player->GetGossipTextId(obj)); + WorldObject* obj = ALE::CHECKOBJ(L, 2); + ALE::Push(L, player->GetGossipTextId(obj)); return 1; } @@ -1420,7 +1420,7 @@ namespace LuaPlayer */ int GetSelection(lua_State* L, Player* player) { - Eluna::Push(L, player->GetSelectedUnit()); + ALE::Push(L, player->GetSelectedUnit()); return 1; } @@ -1431,7 +1431,7 @@ namespace LuaPlayer */ int GetGMRank(lua_State* L, Player* player) { - Eluna::Push(L, player->GetSession()->GetSecurity()); + ALE::Push(L, player->GetSession()->GetSecurity()); return 1; } @@ -1442,7 +1442,7 @@ namespace LuaPlayer */ int GetCoinage(lua_State* L, Player* player) { - Eluna::Push(L, player->GetMoney()); + ALE::Push(L, player->GetMoney()); return 1; } @@ -1453,7 +1453,7 @@ namespace LuaPlayer */ int GetGuildId(lua_State* L, Player* player) { - Eluna::Push(L, player->GetGuildId()); + ALE::Push(L, player->GetGuildId()); return 1; } @@ -1464,7 +1464,7 @@ namespace LuaPlayer */ int GetTeam(lua_State* L, Player* player) { - Eluna::Push(L, player->GetTeamId()); + ALE::Push(L, player->GetTeamId()); return 1; } @@ -1477,9 +1477,9 @@ namespace LuaPlayer */ int GetItemCount(lua_State* L, Player* player) { - uint32 entry = Eluna::CHECKVAL(L, 2); - bool checkinBank = Eluna::CHECKVAL(L, 3, false); - Eluna::Push(L, player->GetItemCount(entry, checkinBank)); + uint32 entry = ALE::CHECKVAL(L, 2); + bool checkinBank = ALE::CHECKVAL(L, 3, false); + ALE::Push(L, player->GetItemCount(entry, checkinBank)); return 1; } @@ -1490,7 +1490,7 @@ namespace LuaPlayer */ int GetLifetimeKills(lua_State* L, Player* player) { - Eluna::Push(L, player->GetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS)); + ALE::Push(L, player->GetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS)); return 1; } @@ -1501,7 +1501,7 @@ namespace LuaPlayer */ int GetPlayerIP(lua_State* L, Player* player) { - Eluna::Push(L, player->GetSession()->GetRemoteAddress()); + ALE::Push(L, player->GetSession()->GetRemoteAddress()); return 1; } @@ -1512,7 +1512,7 @@ namespace LuaPlayer */ int GetLevelPlayedTime(lua_State* L, Player* player) { - Eluna::Push(L, player->GetLevelPlayedTime()); + ALE::Push(L, player->GetLevelPlayedTime()); return 1; } @@ -1523,7 +1523,7 @@ namespace LuaPlayer */ int GetTotalPlayedTime(lua_State* L, Player* player) { - Eluna::Push(L, player->GetTotalPlayedTime()); + ALE::Push(L, player->GetTotalPlayedTime()); return 1; } @@ -1534,7 +1534,7 @@ namespace LuaPlayer */ int GetGuild(lua_State* L, Player* player) { - Eluna::Push(L, eGuildMgr->GetGuildById(player->GetGuildId())); + ALE::Push(L, eGuildMgr->GetGuildById(player->GetGuildId())); return 1; } @@ -1545,7 +1545,7 @@ namespace LuaPlayer */ int GetGroup(lua_State* L, Player* player) { - Eluna::Push(L, player->GetGroup()); + ALE::Push(L, player->GetGroup()); return 1; } @@ -1556,7 +1556,7 @@ namespace LuaPlayer */ int GetAccountId(lua_State* L, Player* player) { - Eluna::Push(L, player->GetSession()->GetAccountId()); + ALE::Push(L, player->GetSession()->GetAccountId()); return 1; } @@ -1569,7 +1569,7 @@ namespace LuaPlayer { std::string accName; if (AccountMgr::GetName(player->GetSession()->GetAccountId(), accName)) - Eluna::Push(L, accName); + ALE::Push(L, accName); return 1; } @@ -1582,7 +1582,7 @@ namespace LuaPlayer { uint32 count = player->GetRewardedQuestCount(); - Eluna::Push(L, count); + ALE::Push(L, count); return 1; } @@ -1593,7 +1593,7 @@ namespace LuaPlayer */ int GetCorpse(lua_State* L, Player* player) { - Eluna::Push(L, player->GetCorpse()); + ALE::Push(L, player->GetCorpse()); return 1; } @@ -1604,7 +1604,7 @@ namespace LuaPlayer */ int GetDbLocaleIndex(lua_State* L, Player* player) { - Eluna::Push(L, player->GetSession()->GetSessionDbLocaleIndex()); + ALE::Push(L, player->GetSession()->GetSessionDbLocaleIndex()); return 1; } @@ -1615,7 +1615,7 @@ namespace LuaPlayer */ int GetDbcLocale(lua_State* L, Player* player) { - Eluna::Push(L, player->GetSession()->GetSessionDbcLocale()); + ALE::Push(L, player->GetSession()->GetSessionDbcLocale()); return 1; } @@ -1655,25 +1655,25 @@ namespace LuaPlayer /*int GetRecruiterId(lua_State* L, Player* player) { - Eluna::Push(L, player->GetSession()->GetRecruiterId()); + ALE::Push(L, player->GetSession()->GetRecruiterId()); return 1; }*/ /*int GetSelectedPlayer(lua_State* L, Player* player) { - Eluna::Push(L, player->GetSelectedPlayer()); + ALE::Push(L, player->GetSelectedPlayer()); return 1; }*/ /*int GetSelectedUnit(lua_State* L, Player* player) { - Eluna::Push(L, player->GetSelectedUnit()); + ALE::Push(L, player->GetSelectedUnit()); return 1; }*/ /*int GetNearbyGameObject(lua_State* L, Player* player) { - Eluna::Push(L, ChatHandler(player->GetSession()).GetNearbyGameObject()); + ALE::Push(L, ChatHandler(player->GetSession()).GetNearbyGameObject()); return 1; }*/ @@ -1684,7 +1684,7 @@ namespace LuaPlayer */ int SetPlayerLock(lua_State* L, Player* player) { - bool apply = Eluna::CHECKVAL(L, 2, true); + bool apply = ALE::CHECKVAL(L, 2, true); if (apply) { @@ -1706,7 +1706,7 @@ namespace LuaPlayer */ int SetAtLoginFlag(lua_State* L, Player* player) { - uint32 flag = Eluna::CHECKVAL(L, 2); + uint32 flag = ALE::CHECKVAL(L, 2); player->SetAtLoginFlag((AtLoginFlags)flag); return 0; @@ -1719,7 +1719,7 @@ namespace LuaPlayer */ int SetSheath(lua_State* L, Player* player) { - uint32 sheathed = Eluna::CHECKVAL(L, 2); + uint32 sheathed = ALE::CHECKVAL(L, 2); if (sheathed >= MAX_SHEATH_STATE) return 0; @@ -1734,7 +1734,7 @@ namespace LuaPlayer */ int SetDrunkValue(lua_State* L, Player* player) { - uint8 newDrunkValue = Eluna::CHECKVAL(L, 2); + uint8 newDrunkValue = ALE::CHECKVAL(L, 2); player->SetDrunkValue(newDrunkValue); return 0; @@ -1747,7 +1747,7 @@ namespace LuaPlayer */ int SetFactionForRace(lua_State* L, Player* player) { - uint8 race = Eluna::CHECKVAL(L, 2); + uint8 race = ALE::CHECKVAL(L, 2); player->SetFactionForRace(race); return 0; @@ -1763,10 +1763,10 @@ namespace LuaPlayer */ int SetSkill(lua_State* L, Player* player) { - uint16 id = Eluna::CHECKVAL(L, 2); - uint16 step = Eluna::CHECKVAL(L, 3); - uint16 currVal = Eluna::CHECKVAL(L, 4); - uint16 maxVal = Eluna::CHECKVAL(L, 5); + uint16 id = ALE::CHECKVAL(L, 2); + uint16 step = ALE::CHECKVAL(L, 3); + uint16 currVal = ALE::CHECKVAL(L, 4); + uint16 maxVal = ALE::CHECKVAL(L, 5); player->SetSkill(id, currVal, maxVal, step); return 0; @@ -1779,7 +1779,7 @@ namespace LuaPlayer */ int SetGuildRank(lua_State* L, Player* player) // TODO: Move to Guild Methods { - uint8 rank = Eluna::CHECKVAL(L, 2); + uint8 rank = ALE::CHECKVAL(L, 2); if (!player->GetGuildId()) return 0; @@ -1795,7 +1795,7 @@ namespace LuaPlayer */ int SetFreeTalentPoints(lua_State* L, Player* player) { - uint32 points = Eluna::CHECKVAL(L, 2); + uint32 points = ALE::CHECKVAL(L, 2); player->SetFreeTalentPoints(points); player->SendTalentsInfoData(false); @@ -1810,8 +1810,8 @@ namespace LuaPlayer */ int SetReputation(lua_State* L, Player* player) { - uint32 faction = Eluna::CHECKVAL(L, 2); - int32 value = Eluna::CHECKVAL(L, 3); + uint32 faction = ALE::CHECKVAL(L, 2); + int32 value = ALE::CHECKVAL(L, 3); FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction); player->GetReputationMgr().SetReputation(factionEntry, value); @@ -1826,8 +1826,8 @@ namespace LuaPlayer */ int SetQuestStatus(lua_State* L, Player* player) { - uint32 entry = Eluna::CHECKVAL(L, 2); - uint32 status = Eluna::CHECKVAL(L, 3); + uint32 entry = ALE::CHECKVAL(L, 2); + uint32 status = ALE::CHECKVAL(L, 3); if (status >= MAX_QUEST_STATUS) return 0; @@ -1842,7 +1842,7 @@ namespace LuaPlayer */ int SetRestBonus(lua_State* L, Player* player) { - float bonus = Eluna::CHECKVAL(L, 2); + float bonus = ALE::CHECKVAL(L, 2); player->SetRestBonus(bonus); return 0; @@ -1855,7 +1855,7 @@ namespace LuaPlayer */ int SetAcceptWhispers(lua_State* L, Player* player) { - bool on = Eluna::CHECKVAL(L, 2, true); + bool on = ALE::CHECKVAL(L, 2, true); player->SetAcceptWhispers(on); return 0; @@ -1868,7 +1868,7 @@ namespace LuaPlayer */ int SetPvPDeath(lua_State* L, Player* player) { - bool on = Eluna::CHECKVAL(L, 2, true); + bool on = ALE::CHECKVAL(L, 2, true); player->SetPvPDeath(on); return 0; @@ -1881,7 +1881,7 @@ namespace LuaPlayer */ int SetGMVisible(lua_State* L, Player* player) { - bool on = Eluna::CHECKVAL(L, 2, true); + bool on = ALE::CHECKVAL(L, 2, true); player->SetGMVisible(on); return 0; @@ -1922,7 +1922,7 @@ namespace LuaPlayer */ int SetTaxiCheat(lua_State* L, Player* player) { - bool on = Eluna::CHECKVAL(L, 2, true); + bool on = ALE::CHECKVAL(L, 2, true); player->SetTaxiCheater(on); return 0; @@ -1935,7 +1935,7 @@ namespace LuaPlayer */ int SetGMChat(lua_State* L, Player* player) { - bool on = Eluna::CHECKVAL(L, 2, true); + bool on = ALE::CHECKVAL(L, 2, true); player->SetGMChat(on); return 0; @@ -1948,7 +1948,7 @@ namespace LuaPlayer */ int SetGameMaster(lua_State* L, Player* player) { - bool on = Eluna::CHECKVAL(L, 2, true); + bool on = ALE::CHECKVAL(L, 2, true); player->SetGameMaster(on); return 0; @@ -1964,7 +1964,7 @@ namespace LuaPlayer */ int SetGender(lua_State* L, Player* player) { - uint32 _gender = Eluna::CHECKVAL(L, 2); + uint32 _gender = ALE::CHECKVAL(L, 2); Gender gender; switch (_gender) @@ -1992,7 +1992,7 @@ namespace LuaPlayer */ int SetArenaPoints(lua_State* L, Player* player) { - uint32 arenaP = Eluna::CHECKVAL(L, 2); + uint32 arenaP = ALE::CHECKVAL(L, 2); player->SetArenaPoints(arenaP); return 0; } @@ -2004,7 +2004,7 @@ namespace LuaPlayer */ int SetHonorPoints(lua_State* L, Player* player) { - uint32 honorP = Eluna::CHECKVAL(L, 2); + uint32 honorP = ALE::CHECKVAL(L, 2); player->SetHonorPoints(honorP); return 0; } @@ -2016,7 +2016,7 @@ namespace LuaPlayer */ int SetLifetimeKills(lua_State* L, Player* player) { - uint32 val = Eluna::CHECKVAL(L, 2); + uint32 val = ALE::CHECKVAL(L, 2); player->SetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS, val); return 0; } @@ -2028,7 +2028,7 @@ namespace LuaPlayer */ int SetCoinage(lua_State* L, Player* player) { - uint32 amt = Eluna::CHECKVAL(L, 2); + uint32 amt = ALE::CHECKVAL(L, 2); player->SetMoney(amt); return 0; } @@ -2044,11 +2044,11 @@ namespace LuaPlayer */ int SetBindPoint(lua_State* L, Player* player) { - float x = Eluna::CHECKVAL(L, 2); - float y = Eluna::CHECKVAL(L, 3); - float z = Eluna::CHECKVAL(L, 4); - uint32 mapId = Eluna::CHECKVAL(L, 5); - uint32 areaId = Eluna::CHECKVAL(L, 6); + float x = ALE::CHECKVAL(L, 2); + float y = ALE::CHECKVAL(L, 3); + float z = ALE::CHECKVAL(L, 4); + uint32 mapId = ALE::CHECKVAL(L, 5); + uint32 areaId = ALE::CHECKVAL(L, 6); WorldLocation loc(mapId, x, y, z); player->SetHomebind(loc, areaId); @@ -2062,7 +2062,7 @@ namespace LuaPlayer */ int SetKnownTitle(lua_State* L, Player* player) { - uint32 id = Eluna::CHECKVAL(L, 2); + uint32 id = ALE::CHECKVAL(L, 2); CharTitlesEntry const* t = sCharTitlesStore.LookupEntry(id); if (t) player->SetTitle(t, false); @@ -2076,7 +2076,7 @@ namespace LuaPlayer */ int SetAchievement(lua_State* L, Player* player) { - uint32 id = Eluna::CHECKVAL(L, 2); + uint32 id = ALE::CHECKVAL(L, 2); AchievementEntry const* t = sAchievementStore.LookupEntry(id); if (t) player->CompletedAchievement(t); @@ -2085,7 +2085,7 @@ namespace LuaPlayer /*int SetMovement(lua_State* L, Player* player) { - int32 pType = Eluna::CHECKVAL(L, 2); + int32 pType = ALE::CHECKVAL(L, 2); player->SetMovement((PlayerMovementType)pType); return 0; @@ -2107,7 +2107,7 @@ namespace LuaPlayer */ int SendShowMailBox(lua_State* L, Player* player) { - ObjectGuid guid = Eluna::CHECKVAL(L, 2, player->GET_GUID()); + ObjectGuid guid = ALE::CHECKVAL(L, 2, player->GET_GUID()); player->GetSession()->SendShowMailBox(guid); return 0; @@ -2120,7 +2120,7 @@ namespace LuaPlayer */ int ModifyArenaPoints(lua_State* L, Player* player) { - int32 amount = Eluna::CHECKVAL(L, 2); + int32 amount = ALE::CHECKVAL(L, 2); player->ModifyArenaPoints(amount); return 0; @@ -2133,7 +2133,7 @@ namespace LuaPlayer */ int ModifyHonorPoints(lua_State* L, Player* player) { - int32 amount = Eluna::CHECKVAL(L, 2); + int32 amount = ALE::CHECKVAL(L, 2); player->ModifyHonorPoints(amount); return 0; @@ -2155,7 +2155,7 @@ namespace LuaPlayer */ int SummonPlayer(lua_State* L, Player* player) { - Unit* summoner = Eluna::CHECKOBJ(L, 2); + Unit* summoner = ALE::CHECKOBJ(L, 2); float x, y, z; summoner->GetPosition(x,y,z); @@ -2176,7 +2176,7 @@ namespace LuaPlayer */ int Mute(lua_State* L, Player* player) { - uint32 muteseconds = Eluna::CHECKVAL(L, 2); + uint32 muteseconds = ALE::CHECKVAL(L, 2); /*const char* reason = luaL_checkstring(E, 2);*/ // Mangos does not have a reason field in database. time_t muteTime = GameTime::GetGameTime().count() + muteseconds; @@ -2192,7 +2192,7 @@ namespace LuaPlayer */ int RewardQuest(lua_State* L, Player* player) { - uint32 entry = Eluna::CHECKVAL(L, 2); + uint32 entry = ALE::CHECKVAL(L, 2); Quest const* quest = eObjectMgr->GetQuestTemplate(entry); @@ -2211,7 +2211,7 @@ namespace LuaPlayer */ int SendAuctionMenu(lua_State* L, Player* player) { - Unit* unit = Eluna::CHECKOBJ(L, 2); + Unit* unit = ALE::CHECKOBJ(L, 2); AuctionHouseEntry const* ahEntry = AuctionHouseMgr::GetAuctionHouseEntryFromFactionTemplate(unit->GetFaction()); if (!ahEntry) @@ -2232,7 +2232,7 @@ namespace LuaPlayer */ int SendTaxiMenu(lua_State* L, Player* player) { - Creature* creature = Eluna::CHECKOBJ(L, 2); + Creature* creature = ALE::CHECKOBJ(L, 2); player->GetSession()->SendTaxiMenu(creature); return 0; @@ -2254,7 +2254,7 @@ namespace LuaPlayer */ int SendTabardVendorActivate(lua_State* L, Player* player) { - WorldObject* obj = Eluna::CHECKOBJ(L, 2); + WorldObject* obj = ALE::CHECKOBJ(L, 2); player->GetSession()->SendTabardVendorActivate(obj->GET_GUID()); return 0; @@ -2267,7 +2267,7 @@ namespace LuaPlayer */ int SendShowBank(lua_State* L, Player* player) { - WorldObject* obj = Eluna::CHECKOBJ(L, 2); + WorldObject* obj = ALE::CHECKOBJ(L, 2); player->GetSession()->SendShowBank(obj->GET_GUID()); return 0; @@ -2280,8 +2280,8 @@ namespace LuaPlayer */ int SendListInventory(lua_State* L, Player* player) { - WorldObject* obj = Eluna::CHECKOBJ(L, 2); - uint32 vendorId = Eluna::CHECKVAL(L, 3, 0); + WorldObject* obj = ALE::CHECKOBJ(L, 2); + uint32 vendorId = ALE::CHECKVAL(L, 3, 0); player->GetSession()->SendListInventory(obj->GET_GUID(), vendorId); return 0; @@ -2294,7 +2294,7 @@ namespace LuaPlayer */ int SendTrainerList(lua_State* L, Player* player) { - Creature* obj = Eluna::CHECKOBJ(L, 2); + Creature* obj = ALE::CHECKOBJ(L, 2); player->GetSession()->SendTrainerList(obj->GET_GUID()); return 0; @@ -2307,7 +2307,7 @@ namespace LuaPlayer */ int SendGuildInvite(lua_State* L, Player* player) { - Player* plr = Eluna::CHECKOBJ(L, 2); + Player* plr = ALE::CHECKOBJ(L, 2); if (Guild* guild = player->GetGuild()) guild->HandleInviteMember(player->GetSession(), plr->GetName()); @@ -2322,8 +2322,8 @@ namespace LuaPlayer */ int SendUpdateWorldState(lua_State* L, Player* player) { - uint32 field = Eluna::CHECKVAL(L, 2); - uint32 value = Eluna::CHECKVAL(L, 3); + uint32 field = ALE::CHECKVAL(L, 2); + uint32 value = ALE::CHECKVAL(L, 3); player->SendUpdateWorldState(field, value); return 0; @@ -2336,7 +2336,7 @@ namespace LuaPlayer */ int LogoutPlayer(lua_State* L, Player* player) { - bool save = Eluna::CHECKVAL(L, 2, true); + bool save = ALE::CHECKVAL(L, 2, true); player->GetSession()->LogoutPlayer(save); return 0; @@ -2361,8 +2361,8 @@ namespace LuaPlayer */ int UnbindInstance(lua_State* L, Player* player) { - uint32 map = Eluna::CHECKVAL(L, 2); - uint32 difficulty = Eluna::CHECKVAL(L, 3, 0); + uint32 map = ALE::CHECKVAL(L, 2); + uint32 difficulty = ALE::CHECKVAL(L, 3, 0); if (difficulty < MAX_DIFFICULTY) sInstanceSaveMgr->PlayerUnbindInstance(player->GetGUID(), map, Difficulty(difficulty), true, player); @@ -2415,9 +2415,9 @@ namespace LuaPlayer */ int DurabilityRepair(lua_State* L, Player* player) { - uint16 position = Eluna::CHECKVAL(L, 2); - bool takeCost = Eluna::CHECKVAL(L, 3, true); - float discountMod = Eluna::CHECKVAL(L, 4, 1.0f); + uint16 position = ALE::CHECKVAL(L, 2); + bool takeCost = ALE::CHECKVAL(L, 3, true); + float discountMod = ALE::CHECKVAL(L, 4, 1.0f); player->DurabilityRepair(position, takeCost, discountMod, false); return 0; @@ -2432,9 +2432,9 @@ namespace LuaPlayer */ int DurabilityRepairAll(lua_State* L, Player* player) { - bool takeCost = Eluna::CHECKVAL(L, 2, true); - float discountMod = Eluna::CHECKVAL(L, 3, 1.0f); - bool guildBank = Eluna::CHECKVAL(L, 4, false); + bool takeCost = ALE::CHECKVAL(L, 2, true); + float discountMod = ALE::CHECKVAL(L, 3, 1.0f); + bool guildBank = ALE::CHECKVAL(L, 4, false); player->DurabilityRepairAll(takeCost, discountMod, guildBank); return 0; @@ -2447,7 +2447,7 @@ namespace LuaPlayer */ int DurabilityPointLossForEquipSlot(lua_State* L, Player* player) { - int32 slot = Eluna::CHECKVAL(L, 2); + int32 slot = ALE::CHECKVAL(L, 2); if (slot >= EQUIPMENT_SLOT_START && slot < EQUIPMENT_SLOT_END) player->DurabilityPointLossForEquipSlot((EquipmentSlots)slot); @@ -2464,8 +2464,8 @@ namespace LuaPlayer */ int DurabilityPointsLossAll(lua_State* L, Player* player) { - int32 points = Eluna::CHECKVAL(L, 2); - bool inventory = Eluna::CHECKVAL(L, 3, true); + int32 points = ALE::CHECKVAL(L, 2); + bool inventory = ALE::CHECKVAL(L, 3, true); player->DurabilityPointsLossAll(points, inventory); return 0; @@ -2479,8 +2479,8 @@ namespace LuaPlayer */ int DurabilityPointsLoss(lua_State* L, Player* player) { - Item* item = Eluna::CHECKOBJ(L, 2); - int32 points = Eluna::CHECKVAL(L, 3); + Item* item = ALE::CHECKOBJ(L, 2); + int32 points = ALE::CHECKVAL(L, 3); player->DurabilityPointsLoss(item, points); return 0; @@ -2494,8 +2494,8 @@ namespace LuaPlayer */ int DurabilityLoss(lua_State* L, Player* player) { - Item* item = Eluna::CHECKOBJ(L, 2); - double percent = Eluna::CHECKVAL(L, 3); + Item* item = ALE::CHECKOBJ(L, 2); + double percent = ALE::CHECKVAL(L, 3); player->DurabilityLoss(item, percent); return 0; @@ -2509,8 +2509,8 @@ namespace LuaPlayer */ int DurabilityLossAll(lua_State* L, Player* player) { - double percent = Eluna::CHECKVAL(L, 2); - bool inventory = Eluna::CHECKVAL(L, 3, true); + double percent = ALE::CHECKVAL(L, 2); + bool inventory = ALE::CHECKVAL(L, 3, true); player->DurabilityLossAll(percent, inventory); return 0; @@ -2544,7 +2544,7 @@ namespace LuaPlayer */ int ResetTalentsCost(lua_State* L, Player* player) { - Eluna::Push(L, player->resetTalentsCost()); + ALE::Push(L, player->resetTalentsCost()); return 1; } @@ -2555,7 +2555,7 @@ namespace LuaPlayer */ int ResetTalents(lua_State* L, Player* player) { - bool no_cost = Eluna::CHECKVAL(L, 2, true); + bool no_cost = ALE::CHECKVAL(L, 2, true); player->resetTalents(no_cost); player->SendTalentsInfoData(false); @@ -2569,7 +2569,7 @@ namespace LuaPlayer */ int RemoveSpell(lua_State* L, Player* player) { - uint32 entry = Eluna::CHECKVAL(L, 2); + uint32 entry = ALE::CHECKVAL(L, 2); player->removeSpell(entry, SPEC_MASK_ALL, false); return 0; @@ -2592,8 +2592,8 @@ namespace LuaPlayer */ int AddComboPoints(lua_State* L, Player* player) { - Unit* target = Eluna::CHECKOBJ(L, 2); - int8 count = Eluna::CHECKVAL(L, 3); + Unit* target = ALE::CHECKOBJ(L, 2); + int8 count = ALE::CHECKVAL(L, 3); player->AddComboPoints(target, count); return 0; @@ -2607,8 +2607,8 @@ namespace LuaPlayer */ int TalkedToCreature(lua_State* L, Player* player) { - uint32 entry = Eluna::CHECKVAL(L, 2); - Creature* creature = Eluna::CHECKOBJ(L, 3); + uint32 entry = ALE::CHECKVAL(L, 2); + Creature* creature = ALE::CHECKOBJ(L, 3); player->TalkedToCreature(entry, creature->GET_GUID()); return 0; @@ -2621,7 +2621,7 @@ namespace LuaPlayer */ int KilledMonsterCredit(lua_State* L, Player* player) { - uint32 entry = Eluna::CHECKVAL(L, 2); + uint32 entry = ALE::CHECKVAL(L, 2); player->KilledMonsterCredit(entry, player->GET_GUID()); return 0; @@ -2635,8 +2635,8 @@ namespace LuaPlayer */ int GroupEventHappens(lua_State* L, Player* player) { - uint32 questId = Eluna::CHECKVAL(L, 2); - WorldObject* obj = Eluna::CHECKOBJ(L, 3); + uint32 questId = ALE::CHECKVAL(L, 2); + WorldObject* obj = ALE::CHECKOBJ(L, 3); player->GroupEventHappens(questId, obj); return 0; @@ -2649,7 +2649,7 @@ namespace LuaPlayer */ int AreaExploredOrEventHappens(lua_State* L, Player* player) { - uint32 questId = Eluna::CHECKVAL(L, 2); + uint32 questId = ALE::CHECKVAL(L, 2); player->AreaExploredOrEventHappens(questId); return 0; @@ -2662,7 +2662,7 @@ namespace LuaPlayer */ int FailQuest(lua_State* L, Player* player) { - uint32 entry = Eluna::CHECKVAL(L, 2); + uint32 entry = ALE::CHECKVAL(L, 2); player->FailQuest(entry); return 0; @@ -2675,7 +2675,7 @@ namespace LuaPlayer */ int IncompleteQuest(lua_State* L, Player* player) { - uint32 entry = Eluna::CHECKVAL(L, 2); + uint32 entry = ALE::CHECKVAL(L, 2); player->IncompleteQuest(entry); return 0; @@ -2690,7 +2690,7 @@ namespace LuaPlayer */ int CompleteQuest(lua_State* L, Player* player) { - uint32 entry = Eluna::CHECKVAL(L, 2); + uint32 entry = ALE::CHECKVAL(L, 2); Quest const* quest = eObjectMgr->GetQuestTemplate(entry); @@ -2772,7 +2772,7 @@ namespace LuaPlayer */ int AddQuest(lua_State* L, Player* player) { - uint32 entry = Eluna::CHECKVAL(L, 2); + uint32 entry = ALE::CHECKVAL(L, 2); Quest const* quest = eObjectMgr->GetQuestTemplate(entry); if (!quest) @@ -2799,7 +2799,7 @@ namespace LuaPlayer */ int RemoveQuest(lua_State* L, Player* player) { - uint32 entry = Eluna::CHECKVAL(L, 2); + uint32 entry = ALE::CHECKVAL(L, 2); Quest const* quest = eObjectMgr->GetQuestTemplate(entry); @@ -2840,9 +2840,9 @@ namespace LuaPlayer */ int Whisper(lua_State* L, Player* player) { - std::string text = Eluna::CHECKVAL(L, 2); - uint32 lang = Eluna::CHECKVAL(L, 3); - Player* receiver = Eluna::CHECKOBJ(L, 4); + std::string text = ALE::CHECKVAL(L, 2); + uint32 lang = ALE::CHECKVAL(L, 3); + Player* receiver = ALE::CHECKOBJ(L, 4); player->Whisper(text, (Language)lang, receiver); return 0; } @@ -2854,7 +2854,7 @@ namespace LuaPlayer */ int TextEmote(lua_State* L, Player* player) { - std::string text = Eluna::CHECKVAL(L, 2); + std::string text = ALE::CHECKVAL(L, 2); player->TextEmote(text); return 0; @@ -2868,8 +2868,8 @@ namespace LuaPlayer */ int Yell(lua_State* L, Player* player) { - std::string text = Eluna::CHECKVAL(L, 2); - uint32 lang = Eluna::CHECKVAL(L, 3); + std::string text = ALE::CHECKVAL(L, 2); + uint32 lang = ALE::CHECKVAL(L, 3); player->Yell(text, (Language)lang); return 0; } @@ -2882,8 +2882,8 @@ namespace LuaPlayer */ int Say(lua_State* L, Player* player) { - std::string text = Eluna::CHECKVAL(L, 2); - uint32 lang = Eluna::CHECKVAL(L, 3); + std::string text = ALE::CHECKVAL(L, 2); + uint32 lang = ALE::CHECKVAL(L, 3); player->Say(text, (Language)lang); return 0; } @@ -2896,8 +2896,8 @@ namespace LuaPlayer */ int GiveXP(lua_State* L, Player* player) { - uint32 xp = Eluna::CHECKVAL(L, 2); - Unit* victim = Eluna::CHECKOBJ(L, 3, false); + uint32 xp = ALE::CHECKVAL(L, 2); + Unit* victim = ALE::CHECKOBJ(L, 3, false); player->GiveXP(xp, victim); return 0; @@ -2965,15 +2965,15 @@ namespace LuaPlayer int EquipItem(lua_State* L, Player* player) { uint16 dest = 0; - Item* item = Eluna::CHECKOBJ(L, 2, false); - uint32 slot = Eluna::CHECKVAL(L, 3); + Item* item = ALE::CHECKOBJ(L, 2, false); + uint32 slot = ALE::CHECKVAL(L, 3); if (slot >= INVENTORY_SLOT_BAG_END) return 1; if (!item) { - uint32 entry = Eluna::CHECKVAL(L, 2); + uint32 entry = ALE::CHECKVAL(L, 2); item = Item::CreateItem(entry, 1, player); if (!item) return 1; @@ -2995,7 +2995,7 @@ namespace LuaPlayer player->RemoveItem(item->GetBagSlot(), item->GetSlot(), true); } - Eluna::Push(L, player->EquipItem(dest, item, true)); + ALE::Push(L, player->EquipItem(dest, item, true)); player->AutoUnequipOffhandIfNeed(); return 1; } @@ -3012,22 +3012,22 @@ namespace LuaPlayer */ int CanEquipItem(lua_State* L, Player* player) { - Item* item = Eluna::CHECKOBJ(L, 2, false); - uint32 slot = Eluna::CHECKVAL(L, 3); + Item* item = ALE::CHECKOBJ(L, 2, false); + uint32 slot = ALE::CHECKVAL(L, 3); if (slot >= EQUIPMENT_SLOT_END) { - Eluna::Push(L, false); + ALE::Push(L, false); return 1; } if (!item) { - uint32 entry = Eluna::CHECKVAL(L, 2); + uint32 entry = ALE::CHECKVAL(L, 2); uint16 dest; InventoryResult msg = player->CanEquipNewItem(slot, dest, entry, false); if (msg != EQUIP_ERR_OK) { - Eluna::Push(L, false); + ALE::Push(L, false); return 1; } } @@ -3037,11 +3037,11 @@ namespace LuaPlayer InventoryResult msg = player->CanEquipItem(slot, dest, item, false); if (msg != EQUIP_ERR_OK) { - Eluna::Push(L, false); + ALE::Push(L, false); return 1; } } - Eluna::Push(L, true); + ALE::Push(L, true); return 1; } @@ -3052,7 +3052,7 @@ namespace LuaPlayer */ int UnsetKnownTitle(lua_State* L, Player* player) { - uint32 id = Eluna::CHECKVAL(L, 2); + uint32 id = ALE::CHECKVAL(L, 2); CharTitlesEntry const* t = sCharTitlesStore.LookupEntry(id); if (t) player->SetTitle(t, true); @@ -3075,7 +3075,7 @@ namespace LuaPlayer */ int AdvanceAllSkills(lua_State* L, Player* player) { - uint32 step = Eluna::CHECKVAL(L, 2); + uint32 step = ALE::CHECKVAL(L, 2); if (!step) return 0; @@ -3104,14 +3104,14 @@ namespace LuaPlayer */ int AdvanceSkill(lua_State* L, Player* player) { - uint32 _skillId = Eluna::CHECKVAL(L, 2); - uint32 _step = Eluna::CHECKVAL(L, 3); + uint32 _skillId = ALE::CHECKVAL(L, 2); + uint32 _step = ALE::CHECKVAL(L, 3); bool success = false; if (_skillId && _step && player->HasSkill(_skillId)) { success = player->UpdateSkill(_skillId, _step); } - Eluna::Push(L, success); + ALE::Push(L, success); return 1; } @@ -3126,11 +3126,11 @@ namespace LuaPlayer */ int Teleport(lua_State* L, Player* player) { - uint32 mapId = Eluna::CHECKVAL(L, 2); - float x = Eluna::CHECKVAL(L, 3); - float y = Eluna::CHECKVAL(L, 4); - float z = Eluna::CHECKVAL(L, 5); - float o = Eluna::CHECKVAL(L, 6); + uint32 mapId = ALE::CHECKVAL(L, 2); + float x = ALE::CHECKVAL(L, 3); + float y = ALE::CHECKVAL(L, 4); + float z = ALE::CHECKVAL(L, 5); + float o = ALE::CHECKVAL(L, 6); if (player->IsInFlight()) { @@ -3138,7 +3138,7 @@ namespace LuaPlayer player->m_taxi.ClearTaxiDestinations(); } - Eluna::Push(L, player->TeleportTo(mapId, x, y, z, o)); + ALE::Push(L, player->TeleportTo(mapId, x, y, z, o)); return 1; } @@ -3150,7 +3150,7 @@ namespace LuaPlayer */ int AddLifetimeKills(lua_State* L, Player* player) { - uint32 val = Eluna::CHECKVAL(L, 2); + uint32 val = ALE::CHECKVAL(L, 2); uint32 currentKills = player->GetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS); player->SetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS, currentKills + val); return 0; @@ -3165,8 +3165,8 @@ namespace LuaPlayer */ int AddItem(lua_State* L, Player* player) { - uint32 itemId = Eluna::CHECKVAL(L, 2); - uint32 itemCount = Eluna::CHECKVAL(L, 3, 1); + uint32 itemId = ALE::CHECKVAL(L, 2); + uint32 itemCount = ALE::CHECKVAL(L, 3, 1); uint32 noSpaceForCount = 0; ItemPosCountVec dest; @@ -3180,7 +3180,7 @@ namespace LuaPlayer Item* item = player->StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId)); if (item) player->SendNewItem(item, itemCount, true, false); - Eluna::Push(L, item); + ALE::Push(L, item); return 1; } @@ -3196,11 +3196,11 @@ namespace LuaPlayer */ int RemoveItem(lua_State* L, Player* player) { - Item* item = Eluna::CHECKOBJ(L, 2, false); - uint32 itemCount = Eluna::CHECKVAL(L, 3); + Item* item = ALE::CHECKOBJ(L, 2, false); + uint32 itemCount = ALE::CHECKVAL(L, 3); if (!item) { - uint32 itemId = Eluna::CHECKVAL(L, 2); + uint32 itemId = ALE::CHECKVAL(L, 2); player->DestroyItemCount(itemId, itemCount, true); } else @@ -3208,7 +3208,7 @@ namespace LuaPlayer bool all = itemCount >= item->GetCount(); player->DestroyItemCount(item, itemCount, true); if (all) - Eluna::CHECKOBJ(L, 2)->Invalidate(); + ALE::CHECKOBJ(L, 2)->Invalidate(); } return 0; } @@ -3220,7 +3220,7 @@ namespace LuaPlayer */ int RemoveLifetimeKills(lua_State* L, Player* player) { - uint32 val = Eluna::CHECKVAL(L, 2); + uint32 val = ALE::CHECKVAL(L, 2); uint32 currentKills = player->GetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS); if (val > currentKills) val = currentKills; @@ -3236,8 +3236,8 @@ namespace LuaPlayer */ int ResetSpellCooldown(lua_State* L, Player* player) { - uint32 spellId = Eluna::CHECKVAL(L, 2); - bool update = Eluna::CHECKVAL(L, 3, true); + uint32 spellId = ALE::CHECKVAL(L, 2); + bool update = ALE::CHECKVAL(L, 3, true); player->RemoveSpellCooldown(spellId, update); return 0; } @@ -3250,8 +3250,8 @@ namespace LuaPlayer */ int ResetTypeCooldowns(lua_State* L, Player* player) { - uint32 category = Eluna::CHECKVAL(L, 2); - bool update = Eluna::CHECKVAL(L, 3, true); + uint32 category = ALE::CHECKVAL(L, 2); + bool update = ALE::CHECKVAL(L, 3, true); (void)update; // ensure that the variable is referenced in order to pass compiler checks player->RemoveCategoryCooldown(category); @@ -3274,7 +3274,7 @@ namespace LuaPlayer */ int SendBroadcastMessage(lua_State* L, Player* player) { - const char* message = Eluna::CHECKVAL(L, 2); + const char* message = ALE::CHECKVAL(L, 2); if (std::string(message).length() > 0) ChatHandler(player->GetSession()).SendSysMessage(message); return 0; @@ -3287,7 +3287,7 @@ namespace LuaPlayer */ int SendAreaTriggerMessage(lua_State* L, Player* player) { - std::string msg = Eluna::CHECKVAL(L, 2); + std::string msg = ALE::CHECKVAL(L, 2); if (msg.length() > 0) player->GetSession()->SendAreaTriggerMessage("{}", msg.c_str()); return 0; @@ -3300,7 +3300,7 @@ namespace LuaPlayer */ int SendNotification(lua_State* L, Player* player) { - std::string msg = Eluna::CHECKVAL(L, 2); + std::string msg = ALE::CHECKVAL(L, 2); if (msg.length() > 0) ChatHandler(player->GetSession()).SendNotification("{}", msg); return 0; @@ -3314,8 +3314,8 @@ namespace LuaPlayer */ int SendPacket(lua_State* L, Player* player) { - WorldPacket* data = Eluna::CHECKOBJ(L, 2); - bool selfOnly = Eluna::CHECKVAL(L, 3, true); + WorldPacket* data = ALE::CHECKOBJ(L, 2); + bool selfOnly = ALE::CHECKVAL(L, 3, true); if (selfOnly) player->GetSession()->SendPacket(data); else @@ -3334,10 +3334,10 @@ namespace LuaPlayer */ int SendAddonMessage(lua_State* L, Player* player) { - std::string prefix = Eluna::CHECKVAL(L, 2); - std::string message = Eluna::CHECKVAL(L, 3); - uint8 channel = Eluna::CHECKVAL(L, 4); - Player* receiver = Eluna::CHECKOBJ(L, 5); + std::string prefix = ALE::CHECKVAL(L, 2); + std::string message = ALE::CHECKVAL(L, 3); + uint8 channel = ALE::CHECKVAL(L, 4); + Player* receiver = ALE::CHECKOBJ(L, 5); std::string fullmsg = prefix + "\t" + message; @@ -3370,7 +3370,7 @@ namespace LuaPlayer */ int ModifyMoney(lua_State* L, Player* player) { - int32 amt = Eluna::CHECKVAL(L, 2); + int32 amt = ALE::CHECKVAL(L, 2); player->ModifyMoney(amt); return 1; @@ -3383,7 +3383,7 @@ namespace LuaPlayer */ int LearnSpell(lua_State* L, Player* player) { - uint32 id = Eluna::CHECKVAL(L, 2); + uint32 id = ALE::CHECKVAL(L, 2); player->learnSpell(id); return 0; } @@ -3396,8 +3396,8 @@ namespace LuaPlayer */ int LearnTalent(lua_State* L, Player* player) { - uint32 id = Eluna::CHECKVAL(L, 2); - uint32 rank = Eluna::CHECKVAL(L, 3); + uint32 id = ALE::CHECKVAL(L, 2); + uint32 rank = ALE::CHECKVAL(L, 3); player->LearnTalent(id, rank); player->SendTalentsInfoData(false); @@ -3411,7 +3411,7 @@ namespace LuaPlayer */ int RunCommand(lua_State* L, Player* player) { - auto command = Eluna::CHECKVAL(L, 2); + auto command = ALE::CHECKVAL(L, 2); // In _ParseCommands which is used below no leading . or ! is allowed for the command string. if (command[0] == '.' || command[0] == '!') { @@ -3432,8 +3432,8 @@ namespace LuaPlayer */ int SetGlyph(lua_State* L, Player* player) { - uint32 glyphId = Eluna::CHECKVAL(L, 2); - uint32 slotIndex = Eluna::CHECKVAL(L, 3); + uint32 glyphId = ALE::CHECKVAL(L, 2); + uint32 slotIndex = ALE::CHECKVAL(L, 3); player->SetGlyph(slotIndex, glyphId, true); player->SendTalentsInfoData(false); // Also handles GlyphData @@ -3449,8 +3449,8 @@ namespace LuaPlayer */ int GetGlyph(lua_State* L, Player* player) { - auto slotIndex = Eluna::CHECKVAL(L, 2); - Eluna::Push(L,player->GetGlyph(slotIndex)); + auto slotIndex = ALE::CHECKVAL(L, 2); + ALE::Push(L,player->GetGlyph(slotIndex)); return 1; } @@ -3471,8 +3471,8 @@ namespace LuaPlayer */ int ResurrectPlayer(lua_State* L, Player* player) { - float percent = Eluna::CHECKVAL(L, 2, 100.0f); - bool sickness = Eluna::CHECKVAL(L, 3, false); + float percent = ALE::CHECKVAL(L, 2, 100.0f); + bool sickness = ALE::CHECKVAL(L, 3, false); player->ResurrectPlayer(percent, sickness); player->SpawnCorpseBones(); return 0; @@ -3498,13 +3498,13 @@ namespace LuaPlayer */ int GossipMenuAddItem(lua_State* L, Player* player) { - uint32 _icon = Eluna::CHECKVAL(L, 2); - const char* msg = Eluna::CHECKVAL(L, 3); - uint32 _sender = Eluna::CHECKVAL(L, 4); - uint32 _intid = Eluna::CHECKVAL(L, 5); - bool _code = Eluna::CHECKVAL(L, 6, false); - const char* _promptMsg = Eluna::CHECKVAL(L, 7, ""); - uint32 _money = Eluna::CHECKVAL(L, 8, 0); + uint32 _icon = ALE::CHECKVAL(L, 2); + const char* msg = ALE::CHECKVAL(L, 3); + uint32 _sender = ALE::CHECKVAL(L, 4); + uint32 _intid = ALE::CHECKVAL(L, 5); + bool _code = ALE::CHECKVAL(L, 6, false); + const char* _promptMsg = ALE::CHECKVAL(L, 7, ""); + uint32 _money = ALE::CHECKVAL(L, 8, 0); if (player->PlayerTalkClass->GetGossipMenu().GetMenuItemCount() < GOSSIP_MAX_MENU_ITEMS) { player->PlayerTalkClass->GetGossipMenu().AddMenuItem(-1, _icon, msg, _sender, _intid, _promptMsg, _money, @@ -3544,11 +3544,11 @@ namespace LuaPlayer */ int GossipSendMenu(lua_State* L, Player* player) { - uint32 npc_text = Eluna::CHECKVAL(L, 2); - Object* sender = Eluna::CHECKOBJ(L, 3); + uint32 npc_text = ALE::CHECKVAL(L, 2); + Object* sender = ALE::CHECKOBJ(L, 3); if (sender->GetTypeId() == TYPEID_PLAYER) { - uint32 menu_id = Eluna::CHECKVAL(L, 4); + uint32 menu_id = ALE::CHECKVAL(L, 4); player->PlayerTalkClass->GetGossipMenu().SetMenuId(menu_id); } player->PlayerTalkClass->SendGossipMenu(npc_text, sender->GET_GUID()); @@ -3576,7 +3576,7 @@ namespace LuaPlayer */ int StartTaxi(lua_State* L, Player* player) { - uint32 pathId = Eluna::CHECKVAL(L, 2); + uint32 pathId = ALE::CHECKVAL(L, 2); player->ActivateTaxiPathTo(pathId); return 0; @@ -3594,12 +3594,12 @@ namespace LuaPlayer */ int GossipSendPOI(lua_State* L, Player* player) { - float x = Eluna::CHECKVAL(L, 2); - float y = Eluna::CHECKVAL(L, 3); - uint32 icon = Eluna::CHECKVAL(L, 4); - uint32 flags = Eluna::CHECKVAL(L, 5); - uint32 data = Eluna::CHECKVAL(L, 6); - std::string iconText = Eluna::CHECKVAL(L, 7); + float x = ALE::CHECKVAL(L, 2); + float y = ALE::CHECKVAL(L, 3); + uint32 icon = ALE::CHECKVAL(L, 4); + uint32 flags = ALE::CHECKVAL(L, 5); + uint32 data = ALE::CHECKVAL(L, 6); + std::string iconText = ALE::CHECKVAL(L, 7); WorldPacket packet(SMSG_GOSSIP_POI, 4 + 4 + 4 + 4 + 4 + 10); packet << flags; @@ -3619,7 +3619,7 @@ namespace LuaPlayer */ int GossipAddQuests(lua_State* L, Player* player) { - WorldObject* source = Eluna::CHECKOBJ(L, 2); + WorldObject* source = ALE::CHECKOBJ(L, 2); if (source->GetTypeId() == TYPEID_UNIT) { @@ -3642,8 +3642,8 @@ namespace LuaPlayer */ int SendQuestTemplate(lua_State* L, Player* player) { - uint32 questId = Eluna::CHECKVAL(L, 2); - bool activateAccept = Eluna::CHECKVAL(L, 3, true); + uint32 questId = ALE::CHECKVAL(L, 2); + bool activateAccept = ALE::CHECKVAL(L, 3, true); Quest const* quest = eObjectMgr->GetQuestTemplate(questId); if (!quest) @@ -3669,7 +3669,7 @@ namespace LuaPlayer */ int RemovedInsignia(lua_State* L, Player* player) { - Player* looter = Eluna::CHECKOBJ(L, 2); + Player* looter = ALE::CHECKOBJ(L, 2); player->RemovedInsignia(looter); return 0; } @@ -3682,11 +3682,11 @@ namespace LuaPlayer */ int GroupInvite(lua_State* L, Player* player) { - Player* invited = Eluna::CHECKOBJ(L, 2); + Player* invited = ALE::CHECKOBJ(L, 2); if (invited->GetGroup() || invited->GetGroupInvite()) { - Eluna::Push(L, false); + ALE::Push(L, false); return 1; } @@ -3720,7 +3720,7 @@ namespace LuaPlayer invited->GetSession()->SendPacket(&data); } - Eluna::Push(L, success); + ALE::Push(L, success); return 1; } @@ -3732,7 +3732,7 @@ namespace LuaPlayer */ int GroupCreate(lua_State* L, Player* player) { - Player* invited = Eluna::CHECKOBJ(L, 2); + Player* invited = ALE::CHECKOBJ(L, 2); if (player->GetGroup() || invited->GetGroup()) return 0; @@ -3761,7 +3761,7 @@ namespace LuaPlayer if (!group->AddMember(invited)) return 0; group->BroadcastGroupUpdate(); - Eluna::Push(L, group); + ALE::Push(L, group); return 1; } @@ -3772,7 +3772,7 @@ namespace LuaPlayer */ int SendCinematicStart(lua_State* L, Player* player) { - uint32 CinematicSequenceId = Eluna::CHECKVAL(L, 2); + uint32 CinematicSequenceId = ALE::CHECKVAL(L, 2); player->SendCinematicStart(CinematicSequenceId); return 0; @@ -3785,7 +3785,7 @@ namespace LuaPlayer */ int SendMovieStart(lua_State* L, Player* player) { - uint32 MovieId = Eluna::CHECKVAL(L, 2); + uint32 MovieId = ALE::CHECKVAL(L, 2); player->SendMovieStart(MovieId); return 0; @@ -3800,9 +3800,9 @@ namespace LuaPlayer */ int UpdatePlayerSetting(lua_State* L, Player* player) { - std::string source = Eluna::CHECKVAL(L, 2); - uint32 index = Eluna::CHECKVAL(L, 3); - uint32 value = Eluna::CHECKVAL(L, 4); + std::string source = ALE::CHECKVAL(L, 2); + uint32 index = ALE::CHECKVAL(L, 3); + uint32 value = ALE::CHECKVAL(L, 4); player->UpdatePlayerSetting(source, index, value); return 0; } @@ -3815,10 +3815,10 @@ namespace LuaPlayer */ int GetPlayerSettingValue(lua_State* L, Player* player) { - std::string source = Eluna::CHECKVAL(L, 2); - uint32 index = Eluna::CHECKVAL(L, 3); + std::string source = ALE::CHECKVAL(L, 2); + uint32 index = ALE::CHECKVAL(L, 3); uint32 value = player->GetPlayerSetting(source, index).value; - Eluna::Push(L, value); + ALE::Push(L, value); return 1; } @@ -3829,7 +3829,7 @@ namespace LuaPlayer */ int GetTrader(lua_State* L, Player* player) { - Eluna::Push(L, player->GetTrader()); + ALE::Push(L, player->GetTrader()); return 1; } @@ -3841,8 +3841,8 @@ namespace LuaPlayer */ int SetSpellPower(lua_State* L, Player* player) { - int value = Eluna::CHECKVAL(L, 2); - bool apply = Eluna::CHECKVAL(L, 3, false); + int value = ALE::CHECKVAL(L, 2); + bool apply = ALE::CHECKVAL(L, 3, false); player->ApplySpellPowerBonus(value, apply); return 0; @@ -3856,19 +3856,19 @@ namespace LuaPlayer /*int AddTalent(lua_State* L, Player* player) { - uint32 spellId = Eluna::CHECKVAL(L, 2); - uint8 spec = Eluna::CHECKVAL(L, 3); - bool learning = Eluna::CHECKVAL(L, 4, true); + uint32 spellId = ALE::CHECKVAL(L, 2); + uint8 spec = ALE::CHECKVAL(L, 3); + bool learning = ALE::CHECKVAL(L, 4, true); if (spec >= MAX_TALENT_SPECS) - Eluna::Push(L, false); + ALE::Push(L, false); else - Eluna::Push(L, player->AddTalent(spellId, spec, learning)); + ALE::Push(L, player->AddTalent(spellId, spec, learning)); return 1; }*/ /*int GainSpellComboPoints(lua_State* L, Player* player) { - int8 count = Eluna::CHECKVAL(L, 2); + int8 count = ALE::CHECKVAL(L, 2); player->GainSpellComboPoints(count); return 0; @@ -3876,8 +3876,8 @@ namespace LuaPlayer /*int KillGOCredit(lua_State* L, Player* player) { - uint32 entry = Eluna::CHECKVAL(L, 2); - ObjectGuid guid = Eluna::CHECKVAL(L, 3); + uint32 entry = ALE::CHECKVAL(L, 2); + ObjectGuid guid = ALE::CHECKVAL(L, 3); player->KillCreditGO(entry, guid); return 0; }*/ @@ -3890,7 +3890,7 @@ namespace LuaPlayer /*int RemoveRewardedQuest(lua_State* L, Player* player) { - uint32 entry = Eluna::CHECKVAL(L, 2); + uint32 entry = ALE::CHECKVAL(L, 2); player->RemoveRewardedQuest(entry); return 0; @@ -3898,7 +3898,7 @@ namespace LuaPlayer /*int RemoveActiveQuest(lua_State* L, Player* player) { - uint32 entry = Eluna::CHECKVAL(L, 2); + uint32 entry = ALE::CHECKVAL(L, 2); player->RemoveActiveQuest(entry); return 0; @@ -3906,13 +3906,13 @@ namespace LuaPlayer /*int SummonPet(lua_State* L, Player* player) { - uint32 entry = Eluna::CHECKVAL(L, 2); - float x = Eluna::CHECKVAL(L, 3); - float y = Eluna::CHECKVAL(L, 4); - float z = Eluna::CHECKVAL(L, 5); - float o = Eluna::CHECKVAL(L, 6); - uint32 petType = Eluna::CHECKVAL(L, 7); - uint32 despwtime = Eluna::CHECKVAL(L, 8); + uint32 entry = ALE::CHECKVAL(L, 2); + float x = ALE::CHECKVAL(L, 3); + float y = ALE::CHECKVAL(L, 4); + float z = ALE::CHECKVAL(L, 5); + float o = ALE::CHECKVAL(L, 6); + uint32 petType = ALE::CHECKVAL(L, 7); + uint32 despwtime = ALE::CHECKVAL(L, 8); if (petType >= MAX_PET_TYPE) return 0; @@ -3923,8 +3923,8 @@ namespace LuaPlayer /*int RemovePet(lua_State* L, Player* player) { - int mode = Eluna::CHECKVAL(L, 2, PET_SAVE_AS_DELETED); - bool returnreagent = Eluna::CHECKVAL(L, 2, false); + int mode = ALE::CHECKVAL(L, 2, PET_SAVE_AS_DELETED); + bool returnreagent = ALE::CHECKVAL(L, 2, false); if (!player->GetPet()) return 0; @@ -3940,7 +3940,7 @@ namespace LuaPlayer */ int SetBonusTalentCount(lua_State* L, Player* player) { - uint32 value = Eluna::CHECKVAL(L, 2); + uint32 value = ALE::CHECKVAL(L, 2); player->SetBonusTalentCount(value); return 0; @@ -3953,7 +3953,7 @@ namespace LuaPlayer */ int GetBonusTalentCount(lua_State* L, Player* player) { - Eluna::Push(L, player->GetBonusTalentCount()); + ALE::Push(L, player->GetBonusTalentCount()); return 1; } @@ -3973,7 +3973,7 @@ namespace LuaPlayer for (PlayerSpellMap::const_iterator itr = spellMap.begin(); itr != spellMap.end(); ++itr) { SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(itr->first); - Eluna::Push(L, spellInfo->Id); + ALE::Push(L, spellInfo->Id); lua_rawseti(L, tbl, ++i); } @@ -3988,7 +3988,7 @@ namespace LuaPlayer */ int AddBonusTalent(lua_State* L, Player* player) { - uint32 count = Eluna::CHECKVAL(L, 2); + uint32 count = ALE::CHECKVAL(L, 2); player->AddBonusTalent(count); return 0; @@ -4001,7 +4001,7 @@ namespace LuaPlayer */ int RemoveBonusTalent(lua_State* L, Player* player) { - uint32 count = Eluna::CHECKVAL(L, 2); + uint32 count = ALE::CHECKVAL(L, 2); player->RemoveBonusTalent(count); return 0; @@ -4041,7 +4041,7 @@ namespace LuaPlayer */ int TeleportTo(lua_State* L, Player* player) { - std::string tele = Eluna::CHECKVAL(L, 2); + std::string tele = ALE::CHECKVAL(L, 2); const GameTele* game_tele = sObjectMgr->GetGameTele(tele); if (player->IsInFlight()) @@ -4061,7 +4061,7 @@ namespace LuaPlayer */ int GetPet(lua_State* L, Player* player) { - Eluna::Push(L, player->GetPet()); + ALE::Push(L, player->GetPet()); return 1; } @@ -4072,7 +4072,7 @@ namespace LuaPlayer */ int IsMaxLevel(lua_State* L, Player* player) { - Eluna::Push(L, player->IsMaxLevel()); + ALE::Push(L, player->IsMaxLevel()); return 1; } @@ -4091,17 +4091,17 @@ namespace LuaPlayer */ int SummonPet(lua_State* L, Player* player) { - uint32 entry = Eluna::CHECKVAL(L, 2); - float x = Eluna::CHECKVAL(L, 3); - float y = Eluna::CHECKVAL(L, 4); - float z = Eluna::CHECKVAL(L, 5); - float ang = Eluna::CHECKVAL(L, 6); - uint32 petType = Eluna::CHECKVAL(L, 7); - uint32 duration = Eluna::CHECKVAL(L, 8, 0); - uint32 healthPct = Eluna::CHECKVAL(L, 9, 0); + uint32 entry = ALE::CHECKVAL(L, 2); + float x = ALE::CHECKVAL(L, 3); + float y = ALE::CHECKVAL(L, 4); + float z = ALE::CHECKVAL(L, 5); + float ang = ALE::CHECKVAL(L, 6); + uint32 petType = ALE::CHECKVAL(L, 7); + uint32 duration = ALE::CHECKVAL(L, 8, 0); + uint32 healthPct = ALE::CHECKVAL(L, 9, 0); Pet* pet = player->SummonPet(entry, x, y, z, ang, static_cast(petType), Milliseconds(duration), healthPct); - Eluna::Push(L, pet); + ALE::Push(L, pet); return 1; } @@ -4112,7 +4112,7 @@ namespace LuaPlayer */ int GetAverageItemLevel(lua_State* L, Player* player) { - Eluna::Push(L, player->GetAverageItemLevel()); + ALE::Push(L, player->GetAverageItemLevel()); return 1; } @@ -4132,16 +4132,16 @@ namespace LuaPlayer { if (lua_gettop(L) == 2) { - uint32 creatureEntry = Eluna::CHECKVAL(L, 2); + uint32 creatureEntry = ALE::CHECKVAL(L, 2); Pet* pet = player->CreatePet(creatureEntry); - Eluna::Push(L, pet); + ALE::Push(L, pet); } else { - Creature* creatureTarget = Eluna::CHECKOBJ(L, 2); - uint32 spellID = Eluna::CHECKVAL(L, 3, 0); + Creature* creatureTarget = ALE::CHECKOBJ(L, 2); + uint32 spellID = ALE::CHECKVAL(L, 3, 0); Pet* pet = player->CreatePet(creatureTarget, spellID); - Eluna::Push(L, pet); + ALE::Push(L, pet); } return 1; } @@ -4154,8 +4154,8 @@ namespace LuaPlayer */ int IsDailyQuestDone(lua_State* L, Player* player) { - uint32 questId = Eluna::CHECKVAL(L, 2); - Eluna::Push(L, player->IsDailyQuestDone(questId)); + uint32 questId = ALE::CHECKVAL(L, 2); + ALE::Push(L, player->IsDailyQuestDone(questId)); return 1; } @@ -4177,7 +4177,7 @@ namespace LuaPlayer */ int SetPlayerFlag(lua_State* L, Player* player) { - uint32 flag = Eluna::CHECKVAL(L, 2); + uint32 flag = ALE::CHECKVAL(L, 2); player->SetPlayerFlag((PlayerFlags)flag); return 0; } @@ -4191,9 +4191,9 @@ namespace LuaPlayer */ int RemovePet(lua_State* L, Player* player) { - Pet* pet = Eluna::CHECKOBJ(L, 2); - uint32 mode = Eluna::CHECKVAL(L, 3); - bool returnReagent = Eluna::CHECKVAL(L, 4, false); + Pet* pet = ALE::CHECKOBJ(L, 2); + uint32 mode = ALE::CHECKVAL(L, 3); + bool returnReagent = ALE::CHECKVAL(L, 4, false); player->RemovePet(pet, static_cast(mode), returnReagent); return 1; } @@ -4205,7 +4205,7 @@ namespace LuaPlayer */ int RemovePlayerFlag(lua_State* L, Player* player) { - uint32 flag = Eluna::CHECKVAL(L, 2); + uint32 flag = ALE::CHECKVAL(L, 2); player->RemovePlayerFlag((PlayerFlags)flag); return 0; } @@ -4217,7 +4217,7 @@ namespace LuaPlayer */ int CanPetResurrect(lua_State* L, Player* player) { - Eluna::Push(L, player->CanPetResurrect()); + ALE::Push(L, player->CanPetResurrect()); return 1; } @@ -4230,9 +4230,9 @@ namespace LuaPlayer */ int DoRandomRoll(lua_State* L, Player* player) { - uint32 minimum = Eluna::CHECKVAL(L, 2); - uint32 maximum = Eluna::CHECKVAL(L, 3); - Eluna::Push(L, player->DoRandomRoll(minimum, maximum)); + uint32 minimum = ALE::CHECKVAL(L, 2); + uint32 maximum = ALE::CHECKVAL(L, 3); + ALE::Push(L, player->DoRandomRoll(minimum, maximum)); return 1; } @@ -4243,7 +4243,7 @@ namespace LuaPlayer */ int IsPvP(lua_State* L, Player* player) { - Eluna::Push(L, player->IsPvP()); + ALE::Push(L, player->IsPvP()); return 1; } @@ -4254,7 +4254,7 @@ namespace LuaPlayer */ int IsFFAPvP(lua_State* L, Player* player) { - Eluna::Push(L, player->IsFFAPvP()); + ALE::Push(L, player->IsFFAPvP()); return 1; } @@ -4265,7 +4265,7 @@ namespace LuaPlayer */ int IsUsingLfg(lua_State* L, Player* player) { - Eluna::Push(L, player->IsUsingLfg()); + ALE::Push(L, player->IsUsingLfg()); return 1; } @@ -4276,7 +4276,7 @@ namespace LuaPlayer */ int InRandomLfgDungeon(lua_State* L, Player* player) { - Eluna::Push(L, player->inRandomLfgDungeon()); + ALE::Push(L, player->inRandomLfgDungeon()); return 1; } @@ -4288,8 +4288,8 @@ namespace LuaPlayer */ int CanInteractWithQuestGiver(lua_State* L, Player* player) { - Object* questGiver = Eluna::CHECKOBJ(L, 2); - Eluna::Push(L, player->CanInteractWithQuestGiver(questGiver)); + Object* questGiver = ALE::CHECKOBJ(L, 2); + ALE::Push(L, player->CanInteractWithQuestGiver(questGiver)); return 1; } @@ -4301,8 +4301,8 @@ namespace LuaPlayer */ int CanSeeStartQuest(lua_State* L, Player* player) { - Quest const* quest = Eluna::CHECKOBJ(L, 2); - Eluna::Push(L, player->CanSeeStartQuest(quest)); + Quest const* quest = ALE::CHECKOBJ(L, 2); + ALE::Push(L, player->CanSeeStartQuest(quest)); return 1; } @@ -4313,7 +4313,7 @@ namespace LuaPlayer */ int IsExistPet(lua_State* L, Player* player) { - Eluna::Push(L, player->IsExistPet()); + ALE::Push(L, player->IsExistPet()); return 1; } @@ -4326,9 +4326,9 @@ namespace LuaPlayer */ int CanTakeQuest(lua_State* L, Player* player) { - Quest const* quest = Eluna::CHECKOBJ(L, 2); - bool msg = Eluna::CHECKVAL(L, 3, true); - Eluna::Push(L, player->CanTakeQuest(quest, msg)); + Quest const* quest = ALE::CHECKOBJ(L, 2); + bool msg = ALE::CHECKVAL(L, 3, true); + ALE::Push(L, player->CanTakeQuest(quest, msg)); return 1; } @@ -4351,9 +4351,9 @@ namespace LuaPlayer */ int CanAddQuest(lua_State* L, Player* player) { - Quest const* quest = Eluna::CHECKOBJ(L, 2); - bool msg = Eluna::CHECKVAL(L, 3, true); - Eluna::Push(L, player->CanAddQuest(quest, msg)); + Quest const* quest = ALE::CHECKOBJ(L, 2); + bool msg = ALE::CHECKVAL(L, 3, true); + ALE::Push(L, player->CanAddQuest(quest, msg)); return 1; } @@ -4367,10 +4367,10 @@ namespace LuaPlayer */ int GetBarberShopCost(lua_State* L, Player* player) { - uint8 newhairstyle = Eluna::CHECKVAL(L, 2); - uint8 newhaircolor = Eluna::CHECKVAL(L, 3); - uint8 newfacialhair = Eluna::CHECKVAL(L, 4); - Eluna::Push(L, player->GetBarberShopCost(newhairstyle, newhaircolor, newfacialhair)); + uint8 newhairstyle = ALE::CHECKVAL(L, 2); + uint8 newhaircolor = ALE::CHECKVAL(L, 3); + uint8 newfacialhair = ALE::CHECKVAL(L, 4); + ALE::Push(L, player->GetBarberShopCost(newhairstyle, newhaircolor, newfacialhair)); return 1; } @@ -4382,8 +4382,8 @@ namespace LuaPlayer */ int GetSightRange(lua_State* L, Player* player) { - WorldObject* target = Eluna::CHECKOBJ(L, 2, false); - Eluna::Push(L, player->GetSightRange(target)); + WorldObject* target = ALE::CHECKOBJ(L, 2, false); + ALE::Push(L, player->GetSightRange(target)); return 1; } @@ -4399,13 +4399,13 @@ namespace LuaPlayer */ int CalculateReputationGain(lua_State* L, Player* player) { - uint32 source = Eluna::CHECKVAL(L, 2); - uint32 creatureOrQuestLevel = Eluna::CHECKVAL(L, 3); - float rep = Eluna::CHECKVAL(L, 4); - uint32 faction = Eluna::CHECKVAL(L, 5); - bool noQuestBonus = Eluna::CHECKVAL(L, 6, false); + uint32 source = ALE::CHECKVAL(L, 2); + uint32 creatureOrQuestLevel = ALE::CHECKVAL(L, 3); + float rep = ALE::CHECKVAL(L, 4); + uint32 faction = ALE::CHECKVAL(L, 5); + bool noQuestBonus = ALE::CHECKVAL(L, 6, false); - Eluna::Push(L, player->CalculateReputationGain((ReputationSource)source, creatureOrQuestLevel, rep, faction, noQuestBonus)); + ALE::Push(L, player->CalculateReputationGain((ReputationSource)source, creatureOrQuestLevel, rep, faction, noQuestBonus)); return 1; } @@ -4418,9 +4418,9 @@ namespace LuaPlayer */ int EnvironmentalDamage(lua_State* L, Player* player) { - uint32 type = Eluna::CHECKVAL(L, 2); - uint32 damage = Eluna::CHECKVAL(L, 3); - Eluna::Push(L, player->EnvironmentalDamage((EnviromentalDamage)type, damage)); + uint32 type = ALE::CHECKVAL(L, 2); + uint32 damage = ALE::CHECKVAL(L, 3); + ALE::Push(L, player->EnvironmentalDamage((EnviromentalDamage)type, damage)); return 1; } @@ -4442,9 +4442,9 @@ namespace LuaPlayer */ int LearnPetTalent(lua_State* L, Player* player) { - ObjectGuid petGuid = Eluna::CHECKVAL(L, 2); - uint32 talentId = Eluna::CHECKVAL(L, 3); - uint32 talentRank = Eluna::CHECKVAL(L, 4); + ObjectGuid petGuid = ALE::CHECKVAL(L, 2); + uint32 talentId = ALE::CHECKVAL(L, 3); + uint32 talentRank = ALE::CHECKVAL(L, 4); player->LearnPetTalent(petGuid, talentId, talentRank); return 0; } @@ -4457,8 +4457,8 @@ namespace LuaPlayer */ int HasTitleByIndex(lua_State* L, Player* player) { - uint32 bitIndex = Eluna::CHECKVAL(L, 2); - Eluna::Push(L, player->HasTitle(bitIndex)); + uint32 bitIndex = ALE::CHECKVAL(L, 2); + ALE::Push(L, player->HasTitle(bitIndex)); return 1; } @@ -4470,8 +4470,8 @@ namespace LuaPlayer */ int IsAtGroupRewardDistance(lua_State* L, Player* player) { - WorldObject const* target = Eluna::CHECKOBJ(L, 2); - Eluna::Push(L, player->IsAtGroupRewardDistance(target)); + WorldObject const* target = ALE::CHECKOBJ(L, 2); + ALE::Push(L, player->IsAtGroupRewardDistance(target)); return 1; } @@ -4483,8 +4483,8 @@ namespace LuaPlayer */ int IsAtLootRewardDistance(lua_State* L, Player* player) { - WorldObject const* target = Eluna::CHECKOBJ(L, 2); - Eluna::Push(L, player->IsAtLootRewardDistance(target)); + WorldObject const* target = ALE::CHECKOBJ(L, 2); + ALE::Push(L, player->IsAtLootRewardDistance(target)); return 1; } @@ -4495,7 +4495,7 @@ namespace LuaPlayer */ int AbandonQuest(lua_State* L, Player* player) { - uint32 questId = Eluna::CHECKVAL(L, 2); + uint32 questId = ALE::CHECKVAL(L, 2); player->AbandonQuest(questId); return 0; } @@ -4507,7 +4507,7 @@ namespace LuaPlayer */ int CanTameExoticPets(lua_State* L, Player* player) { - Eluna::Push(L, player->CanTameExoticPets()); + ALE::Push(L, player->CanTameExoticPets()); return 1; } @@ -4518,7 +4518,7 @@ namespace LuaPlayer */ int GetWeaponProficiency(lua_State* L, Player* player) { - Eluna::Push(L, player->GetWeaponProficiency()); + ALE::Push(L, player->GetWeaponProficiency()); return 1; } @@ -4529,7 +4529,7 @@ namespace LuaPlayer */ int GetTemporaryUnsummonedPetNumber(lua_State* L, Player* player) { - Eluna::Push(L, player->GetTemporaryUnsummonedPetNumber()); + ALE::Push(L, player->GetTemporaryUnsummonedPetNumber()); return 1; } @@ -4540,7 +4540,7 @@ namespace LuaPlayer */ int GetArmorProficiency(lua_State* L, Player* player) { - Eluna::Push(L, player->GetArmorProficiency()); + ALE::Push(L, player->GetArmorProficiency()); return 1; } @@ -4551,7 +4551,7 @@ namespace LuaPlayer */ int SetTemporaryUnsummonedPetNumber(lua_State* L, Player* player) { - uint32 petNumber = Eluna::CHECKVAL(L, 2); + uint32 petNumber = ALE::CHECKVAL(L, 2); player->SetTemporaryUnsummonedPetNumber(petNumber); return 0; } @@ -4563,7 +4563,7 @@ namespace LuaPlayer */ int AddWeaponProficiency(lua_State* L, Player* player) { - uint32 flag = Eluna::CHECKVAL(L, 2); + uint32 flag = ALE::CHECKVAL(L, 2); player->AddWeaponProficiency(flag); return 0; } @@ -4585,7 +4585,7 @@ namespace LuaPlayer */ int AddArmorProficiency(lua_State* L, Player* player) { - uint32 flag = Eluna::CHECKVAL(L, 2); + uint32 flag = ALE::CHECKVAL(L, 2); player->AddArmorProficiency(flag); return 0; } @@ -4598,7 +4598,7 @@ namespace LuaPlayer */ int IsPetNeedBeTemporaryUnsummoned(lua_State* L, Player* player) { - Eluna::Push(L, player->IsPetNeedBeTemporaryUnsummoned()); + ALE::Push(L, player->IsPetNeedBeTemporaryUnsummoned()); return 1; } @@ -4609,7 +4609,7 @@ namespace LuaPlayer */ int SetAmmo(lua_State* L, Player* player) { - uint32 itemEntry = Eluna::CHECKVAL(L, 2); + uint32 itemEntry = ALE::CHECKVAL(L, 2); player->SetAmmo(itemEntry); return 0; } @@ -4630,7 +4630,7 @@ namespace LuaPlayer */ int GetAmmoDPS(lua_State* L, Player* player) { - Eluna::Push(L, player->GetAmmoDPS()); + ALE::Push(L, player->GetAmmoDPS()); return 1; } @@ -4642,8 +4642,8 @@ namespace LuaPlayer */ int CanResummonPet(lua_State* L, Player* player) { - uint32 spellId = Eluna::CHECKVAL(L, 2); - Eluna::Push(L, player->CanResummonPet(spellId)); + uint32 spellId = ALE::CHECKVAL(L, 2); + ALE::Push(L, player->CanResummonPet(spellId)); return 1; } @@ -4654,7 +4654,7 @@ namespace LuaPlayer */ int GetShield(lua_State* L, Player* player) { - Eluna::Push(L, player->GetShield()); + ALE::Push(L, player->GetShield()); return 1; } @@ -4665,7 +4665,7 @@ namespace LuaPlayer */ int GetLastPetNumber(lua_State* L, Player* player) { - Eluna::Push(L, player->GetLastPetNumber()); + ALE::Push(L, player->GetLastPetNumber()); return 1; } @@ -4676,7 +4676,7 @@ namespace LuaPlayer */ int CanTeleport(lua_State* L, Player* player) { - Eluna::Push(L, player->CanTeleport()); + ALE::Push(L, player->CanTeleport()); return 1; } @@ -4687,7 +4687,7 @@ namespace LuaPlayer */ int SetLastPetNumber(lua_State* L, Player* player) { - uint32 petNumber = Eluna::CHECKVAL(L, 2); + uint32 petNumber = ALE::CHECKVAL(L, 2); player->SetLastPetNumber(petNumber); return 0; } @@ -4699,7 +4699,7 @@ namespace LuaPlayer */ int SetCanTeleport(lua_State* L, Player* player) { - bool canTeleport = Eluna::CHECKVAL(L, 2); + bool canTeleport = ALE::CHECKVAL(L, 2); player->SetCanTeleport(canTeleport); return 0; } @@ -4711,7 +4711,7 @@ namespace LuaPlayer */ int GetLastPetSpell(lua_State* L, Player* player) { - Eluna::Push(L, player->GetLastPetSpell()); + ALE::Push(L, player->GetLastPetSpell()); return 1; } @@ -4722,7 +4722,7 @@ namespace LuaPlayer */ int GetRunesState(lua_State* L, Player* player) { - Eluna::Push(L, player->GetRunesState()); + ALE::Push(L, player->GetRunesState()); return 1; } @@ -4733,7 +4733,7 @@ namespace LuaPlayer */ int SetLastPetSpell(lua_State* L, Player* player) { - uint32 petSpell = Eluna::CHECKVAL(L, 2); + uint32 petSpell = ALE::CHECKVAL(L, 2); player->SetLastPetSpell(petSpell); return 0; } @@ -4745,7 +4745,7 @@ namespace LuaPlayer */ int IsSpectator(lua_State* L, Player* player) { - Eluna::Push(L, player->IsSpectator()); + ALE::Push(L, player->IsSpectator()); return 1; } @@ -4756,7 +4756,7 @@ namespace LuaPlayer */ int SetIsSpectator(lua_State* L, Player* player) { - bool isSpectator = Eluna::CHECKVAL(L, 2); + bool isSpectator = ALE::CHECKVAL(L, 2); player->SetIsSpectator(isSpectator); return 0; } @@ -4768,7 +4768,7 @@ namespace LuaPlayer */ int CanSeeDKPet(lua_State* L, Player* player) { - Eluna::Push(L, player->CanSeeDKPet()); + ALE::Push(L, player->CanSeeDKPet()); return 1; } @@ -4779,7 +4779,7 @@ namespace LuaPlayer */ int GetViewpoint(lua_State* L, Player* player) { - Eluna::Push(L, player->GetViewpoint()); + ALE::Push(L, player->GetViewpoint()); return 1; } @@ -4790,7 +4790,7 @@ namespace LuaPlayer */ int SetShowDKPet(lua_State* L, Player* player) { - bool show = Eluna::CHECKVAL(L, 2); + bool show = ALE::CHECKVAL(L, 2); player->SetShowDKPet(show); return 0; } @@ -4802,8 +4802,8 @@ namespace LuaPlayer */ int SetViewpoint(lua_State* L, Player* player) { - WorldObject* target = Eluna::CHECKOBJ(L, 2); - bool apply = Eluna::CHECKVAL(L, 3, false); + WorldObject* target = ALE::CHECKOBJ(L, 2); + bool apply = ALE::CHECKVAL(L, 3, false); player->SetViewpoint(target, apply); return 0; } @@ -4824,7 +4824,7 @@ namespace LuaPlayer */ int GetCreationTime(lua_State* L, Player* player) { - Eluna::Push(L, static_cast(player->GetCreationTime().count())); + ALE::Push(L, static_cast(player->GetCreationTime().count())); return 1; } @@ -4835,7 +4835,7 @@ namespace LuaPlayer */ int SetCreationTime(lua_State* L, Player* player) { - uint32 creationTime = Eluna::CHECKVAL(L, 2); + uint32 creationTime = ALE::CHECKVAL(L, 2); player->SetCreationTime(Seconds(creationTime)); return 0; } @@ -4849,7 +4849,7 @@ namespace LuaPlayer { float diminishing, nondiminishing; player->GetDodgeFromAgility(diminishing, nondiminishing); - Eluna::Push(L, diminishing + nondiminishing); + ALE::Push(L, diminishing + nondiminishing); return 1; } @@ -4860,7 +4860,7 @@ namespace LuaPlayer */ int GetMeleeCritFromAgility(lua_State* L, Player* player) { - Eluna::Push(L, player->GetMeleeCritFromAgility()); + ALE::Push(L, player->GetMeleeCritFromAgility()); return 1; } @@ -4871,7 +4871,7 @@ namespace LuaPlayer */ int GetSpellCritFromIntellect(lua_State* L, Player* player) { - Eluna::Push(L, player->GetSpellCritFromIntellect()); + ALE::Push(L, player->GetSpellCritFromIntellect()); return 1; } @@ -4883,10 +4883,10 @@ namespace LuaPlayer */ int GetInventoryItem(lua_State* L, Player* player) { - uint32 slot = Eluna::CHECKVAL(L, 2); + uint32 slot = ALE::CHECKVAL(L, 2); if (slot >= INVENTORY_SLOT_ITEM_END) return 1; - Eluna::Push(L, player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot)); + ALE::Push(L, player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot)); return 1; } @@ -4898,10 +4898,10 @@ namespace LuaPlayer */ int GetBankItem(lua_State* L, Player* player) { - uint32 slot = Eluna::CHECKVAL(L, 2); + uint32 slot = ALE::CHECKVAL(L, 2); if (slot >= BANK_SLOT_ITEM_END) return 1; - Eluna::Push(L, player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot + BANK_SLOT_ITEM_START)); + ALE::Push(L, player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot + BANK_SLOT_ITEM_START)); return 1; } }; diff --git a/src/LuaEngine/methods/QuestMethods.h b/src/LuaEngine/methods/QuestMethods.h index 879d9f4..7969cad 100644 --- a/src/LuaEngine/methods/QuestMethods.h +++ b/src/LuaEngine/methods/QuestMethods.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 */ @@ -53,8 +53,8 @@ namespace LuaQuest */ int HasFlag(lua_State* L, Quest* quest) { - uint32 flag = Eluna::CHECKVAL(L, 2); - Eluna::Push(L, quest->HasFlag(flag)); + uint32 flag = ALE::CHECKVAL(L, 2); + ALE::Push(L, quest->HasFlag(flag)); return 1; } @@ -65,7 +65,7 @@ namespace LuaQuest */ int IsDaily(lua_State* L, Quest* quest) { - Eluna::Push(L, quest->IsDaily()); + ALE::Push(L, quest->IsDaily()); return 1; } @@ -76,7 +76,7 @@ namespace LuaQuest */ int IsRepeatable(lua_State* L, Quest* quest) { - Eluna::Push(L, quest->IsRepeatable()); + ALE::Push(L, quest->IsRepeatable()); return 1; } @@ -87,7 +87,7 @@ namespace LuaQuest */ int GetId(lua_State* L, Quest* quest) { - Eluna::Push(L, quest->GetQuestId()); + ALE::Push(L, quest->GetQuestId()); return 1; } @@ -98,7 +98,7 @@ namespace LuaQuest */ int GetLevel(lua_State* L, Quest* quest) { - Eluna::Push(L, quest->GetQuestLevel()); + ALE::Push(L, quest->GetQuestLevel()); return 1; } @@ -109,7 +109,7 @@ namespace LuaQuest */ int GetMinLevel(lua_State* L, Quest* quest) { - Eluna::Push(L, quest->GetMinLevel()); + ALE::Push(L, quest->GetMinLevel()); return 1; } @@ -120,7 +120,7 @@ namespace LuaQuest */ int GetNextQuestId(lua_State* L, Quest* quest) { - Eluna::Push(L, quest->GetNextQuestId()); + ALE::Push(L, quest->GetNextQuestId()); return 1; } @@ -131,7 +131,7 @@ namespace LuaQuest */ int GetPrevQuestId(lua_State* L, Quest* quest) { - Eluna::Push(L, quest->GetPrevQuestId()); + ALE::Push(L, quest->GetPrevQuestId()); return 1; } @@ -142,7 +142,7 @@ namespace LuaQuest */ int GetNextQuestInChain(lua_State* L, Quest* quest) { - Eluna::Push(L, quest->GetNextQuestInChain()); + ALE::Push(L, quest->GetNextQuestInChain()); return 1; } @@ -153,7 +153,7 @@ namespace LuaQuest */ int GetFlags(lua_State* L, Quest* quest) { - Eluna::Push(L, quest->GetFlags()); + ALE::Push(L, quest->GetFlags()); return 1; } @@ -166,13 +166,13 @@ namespace LuaQuest */ int GetType(lua_State* L, Quest* quest) { - Eluna::Push(L, quest->GetType()); + ALE::Push(L, quest->GetType()); return 1; } /*int GetMaxLevel(lua_State* L, Quest* quest) { - Eluna::Push(L, quest->GetMaxLevel()); + ALE::Push(L, quest->GetMaxLevel()); return 1; }*/ }; diff --git a/src/LuaEngine/methods/RollMethods.h b/src/LuaEngine/methods/RollMethods.h index 952461e..fdcbd0b 100644 --- a/src/LuaEngine/methods/RollMethods.h +++ b/src/LuaEngine/methods/RollMethods.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 */ @@ -25,7 +25,7 @@ namespace LuaRoll */ int GetItemGUID(lua_State* L, Roll* roll) { - Eluna::Push(L, roll->itemGUID.GetCounter()); + ALE::Push(L, roll->itemGUID.GetCounter()); return 1; } @@ -36,7 +36,7 @@ namespace LuaRoll */ int GetItemId(lua_State* L, Roll* roll) { - Eluna::Push(L, roll->itemid); + ALE::Push(L, roll->itemid); return 1; } @@ -47,7 +47,7 @@ namespace LuaRoll */ int GetItemRandomPropId(lua_State* L, Roll* roll) { - Eluna::Push(L, roll->itemRandomPropId); + ALE::Push(L, roll->itemRandomPropId); return 1; } @@ -58,7 +58,7 @@ namespace LuaRoll */ int GetItemRandomSuffix(lua_State* L, Roll* roll) { - Eluna::Push(L, roll->itemRandomSuffix); + ALE::Push(L, roll->itemRandomSuffix); return 1; } @@ -69,7 +69,7 @@ namespace LuaRoll */ int GetItemCount(lua_State* L, Roll* roll) { - Eluna::Push(L, roll->itemCount); + ALE::Push(L, roll->itemCount); return 1; } @@ -94,21 +94,21 @@ namespace LuaRoll */ int GetPlayerVote(lua_State* L, Roll* roll) { - ObjectGuid guid = Eluna::CHECKVAL(L, 2); + ObjectGuid guid = ALE::CHECKVAL(L, 2); bool found = false; for (std::pair& pair : roll->playerVote) { if (pair.first == guid) { - Eluna::Push(L, pair.second); + ALE::Push(L, pair.second); found = true; } } if (!found) { - Eluna::Push(L); + ALE::Push(L); } return 1; @@ -127,7 +127,7 @@ namespace LuaRoll uint32 i = 1; for (std::pair& pair : roll->playerVote) { - Eluna::Push(L, pair.first); + ALE::Push(L, pair.first); lua_rawseti(L, table, i); ++i; } @@ -143,7 +143,7 @@ namespace LuaRoll */ int GetTotalPlayersRolling(lua_State* L, Roll* roll) { - Eluna::Push(L, roll->totalPlayersRolling); + ALE::Push(L, roll->totalPlayersRolling); return 1; } @@ -154,7 +154,7 @@ namespace LuaRoll */ int GetTotalNeed(lua_State* L, Roll* roll) { - Eluna::Push(L, roll->totalNeed); + ALE::Push(L, roll->totalNeed); return 1; } @@ -165,7 +165,7 @@ namespace LuaRoll */ int GetTotalGreed(lua_State* L, Roll* roll) { - Eluna::Push(L, roll->totalGreed); + ALE::Push(L, roll->totalGreed); return 1; } @@ -176,7 +176,7 @@ namespace LuaRoll */ int GetTotalPass(lua_State* L, Roll* roll) { - Eluna::Push(L, roll->totalPass); + ALE::Push(L, roll->totalPass); return 1; } @@ -187,7 +187,7 @@ namespace LuaRoll */ int GetItemSlot(lua_State* L, Roll* roll) { - Eluna::Push(L, roll->itemSlot); + ALE::Push(L, roll->itemSlot); return 1; } @@ -211,7 +211,7 @@ namespace LuaRoll */ int GetRollVoteMask(lua_State* L, Roll* roll) { - Eluna::Push(L, roll->rollVoteMask); + ALE::Push(L, roll->rollVoteMask); return 1; } } diff --git a/src/LuaEngine/methods/SpellEntryMethods.h b/src/LuaEngine/methods/SpellEntryMethods.h index b458182..615c2e5 100644 --- a/src/LuaEngine/methods/SpellEntryMethods.h +++ b/src/LuaEngine/methods/SpellEntryMethods.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 */ @@ -23,7 +23,7 @@ namespace LuaSpellEntry */ int GetId(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->Id); + ALE::Push(L, entry->Id); return 1; } @@ -34,7 +34,7 @@ namespace LuaSpellEntry */ int GetCategory(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->Category); + ALE::Push(L, entry->Category); return 1; } @@ -45,7 +45,7 @@ namespace LuaSpellEntry */ int GetDispel(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->Dispel); + ALE::Push(L, entry->Dispel); return 1; } @@ -56,7 +56,7 @@ namespace LuaSpellEntry */ int GetMechanic(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->Mechanic); + ALE::Push(L, entry->Mechanic); return 1; } @@ -67,7 +67,7 @@ namespace LuaSpellEntry */ int GetAttributes(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->Attributes); + ALE::Push(L, entry->Attributes); return 1; } @@ -78,7 +78,7 @@ namespace LuaSpellEntry */ int GetAttributesEx(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->AttributesEx); + ALE::Push(L, entry->AttributesEx); return 1; } @@ -89,7 +89,7 @@ namespace LuaSpellEntry */ int GetAttributesEx2(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->AttributesEx2); + ALE::Push(L, entry->AttributesEx2); return 1; } @@ -100,7 +100,7 @@ namespace LuaSpellEntry */ int GetAttributesEx3(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->AttributesEx3); + ALE::Push(L, entry->AttributesEx3); return 1; } @@ -111,7 +111,7 @@ namespace LuaSpellEntry */ int GetAttributesEx4(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->AttributesEx4); + ALE::Push(L, entry->AttributesEx4); return 1; } @@ -122,7 +122,7 @@ namespace LuaSpellEntry */ int GetAttributesEx5(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->AttributesEx5); + ALE::Push(L, entry->AttributesEx5); return 1; } @@ -133,7 +133,7 @@ namespace LuaSpellEntry */ int GetAttributesEx6(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->AttributesEx6); + ALE::Push(L, entry->AttributesEx6); return 1; } @@ -144,7 +144,7 @@ namespace LuaSpellEntry */ int GetAttributesEx7(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->AttributesEx7); + ALE::Push(L, entry->AttributesEx7); return 1; } @@ -155,7 +155,7 @@ namespace LuaSpellEntry */ int GetStances(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->Stances); + ALE::Push(L, entry->Stances); return 1; } @@ -168,7 +168,7 @@ namespace LuaSpellEntry */ int GetStancesNot(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->StancesNot); + ALE::Push(L, entry->StancesNot); return 1; } @@ -179,7 +179,7 @@ namespace LuaSpellEntry */ int GetTargets(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->Targets); + ALE::Push(L, entry->Targets); return 1; } @@ -190,7 +190,7 @@ namespace LuaSpellEntry */ int GetTargetCreatureType(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->TargetCreatureType); + ALE::Push(L, entry->TargetCreatureType); return 1; } @@ -203,7 +203,7 @@ namespace LuaSpellEntry */ int GetRequiresSpellFocus(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->RequiresSpellFocus); + ALE::Push(L, entry->RequiresSpellFocus); return 1; } @@ -216,7 +216,7 @@ namespace LuaSpellEntry */ int GetFacingCasterFlags(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->FacingCasterFlags); + ALE::Push(L, entry->FacingCasterFlags); return 1; } @@ -229,7 +229,7 @@ namespace LuaSpellEntry */ int GetCasterAuraState(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->CasterAuraState); + ALE::Push(L, entry->CasterAuraState); return 1; } @@ -242,7 +242,7 @@ namespace LuaSpellEntry */ int GetTargetAuraState(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->TargetAuraState); + ALE::Push(L, entry->TargetAuraState); return 1; } @@ -255,7 +255,7 @@ namespace LuaSpellEntry */ int GetCasterAuraStateNot(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->CasterAuraStateNot); + ALE::Push(L, entry->CasterAuraStateNot); return 1; } @@ -268,7 +268,7 @@ namespace LuaSpellEntry */ int GetTargetAuraStateNot(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->TargetAuraStateNot); + ALE::Push(L, entry->TargetAuraStateNot); return 1; } @@ -281,7 +281,7 @@ namespace LuaSpellEntry */ int GetCasterAuraSpell(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->CasterAuraSpell); + ALE::Push(L, entry->CasterAuraSpell); return 1; } @@ -294,7 +294,7 @@ namespace LuaSpellEntry */ int GetTargetAuraSpell(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->TargetAuraSpell); + ALE::Push(L, entry->TargetAuraSpell); return 1; } @@ -307,7 +307,7 @@ namespace LuaSpellEntry */ int GetExcludeCasterAuraSpell(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->ExcludeCasterAuraSpell); + ALE::Push(L, entry->ExcludeCasterAuraSpell); return 1; } @@ -320,7 +320,7 @@ namespace LuaSpellEntry */ int GetExcludeTargetAuraSpell(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->ExcludeTargetAuraSpell); + ALE::Push(L, entry->ExcludeTargetAuraSpell); return 1; } @@ -333,7 +333,7 @@ namespace LuaSpellEntry */ int GetCastingTimeIndex(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->CastingTimeIndex); + ALE::Push(L, entry->CastingTimeIndex); return 1; } @@ -344,7 +344,7 @@ namespace LuaSpellEntry */ int GetRecoveryTime(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->RecoveryTime); + ALE::Push(L, entry->RecoveryTime); return 1; } @@ -355,7 +355,7 @@ namespace LuaSpellEntry */ int GetCategoryRecoveryTime(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->CategoryRecoveryTime); + ALE::Push(L, entry->CategoryRecoveryTime); return 1; } @@ -368,7 +368,7 @@ namespace LuaSpellEntry */ int GetInterruptFlags(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->InterruptFlags); + ALE::Push(L, entry->InterruptFlags); return 1; } @@ -381,7 +381,7 @@ namespace LuaSpellEntry */ int GetAuraInterruptFlags(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->AuraInterruptFlags); + ALE::Push(L, entry->AuraInterruptFlags); return 1; } @@ -394,7 +394,7 @@ namespace LuaSpellEntry */ int GetChannelInterruptFlags(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->ChannelInterruptFlags); + ALE::Push(L, entry->ChannelInterruptFlags); return 1; } @@ -407,7 +407,7 @@ namespace LuaSpellEntry */ int GetProcFlags(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->ProcFlags); + ALE::Push(L, entry->ProcFlags); return 1; } @@ -418,7 +418,7 @@ namespace LuaSpellEntry */ int GetProcChance(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->ProcChance); + ALE::Push(L, entry->ProcChance); return 1; } @@ -429,7 +429,7 @@ namespace LuaSpellEntry */ int GetProcCharges(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->ProcCharges); + ALE::Push(L, entry->ProcCharges); return 1; } @@ -440,7 +440,7 @@ namespace LuaSpellEntry */ int GetMaxLevel(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->MaxLevel); + ALE::Push(L, entry->MaxLevel); return 1; } @@ -451,7 +451,7 @@ namespace LuaSpellEntry */ int GetBaseLevel(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->BaseLevel); + ALE::Push(L, entry->BaseLevel); return 1; } @@ -462,7 +462,7 @@ namespace LuaSpellEntry */ int GetSpellLevel(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->SpellLevel); + ALE::Push(L, entry->SpellLevel); return 1; } @@ -473,7 +473,7 @@ namespace LuaSpellEntry */ int GetDurationIndex(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->DurationIndex); + ALE::Push(L, entry->DurationIndex); return 1; } @@ -484,7 +484,7 @@ namespace LuaSpellEntry */ int GetPowerType(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->PowerType); + ALE::Push(L, entry->PowerType); return 1; } @@ -495,7 +495,7 @@ namespace LuaSpellEntry */ int GetManaCost(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->ManaCost); + ALE::Push(L, entry->ManaCost); return 1; } @@ -506,7 +506,7 @@ namespace LuaSpellEntry */ int GetManaCostPerlevel(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->ManaCostPerlevel); + ALE::Push(L, entry->ManaCostPerlevel); return 1; } @@ -517,7 +517,7 @@ namespace LuaSpellEntry */ int GetManaPerSecond(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->ManaPerSecond); + ALE::Push(L, entry->ManaPerSecond); return 1; } @@ -528,7 +528,7 @@ namespace LuaSpellEntry */ int GetManaPerSecondPerLevel(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->ManaPerSecondPerLevel); + ALE::Push(L, entry->ManaPerSecondPerLevel); return 1; } @@ -539,7 +539,7 @@ namespace LuaSpellEntry */ int GetRangeIndex(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->RangeIndex); + ALE::Push(L, entry->RangeIndex); return 1; } @@ -550,7 +550,7 @@ namespace LuaSpellEntry */ int GetSpeed(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->Speed); + ALE::Push(L, entry->Speed); return 1; } @@ -561,7 +561,7 @@ namespace LuaSpellEntry */ int GetStackAmount(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->StackAmount); + ALE::Push(L, entry->StackAmount); return 1; } @@ -578,7 +578,7 @@ namespace LuaSpellEntry for (size_t index = 0; index < entry->Totem.size(); ++index) { - Eluna::Push(L, entry->Totem[index]); + ALE::Push(L, entry->Totem[index]); lua_rawseti(L, tbl, ++i); } @@ -599,7 +599,7 @@ namespace LuaSpellEntry for (size_t index = 0; index < entry->Reagent.size(); ++index) { - Eluna::Push(L, entry->Reagent[index]); + ALE::Push(L, entry->Reagent[index]); lua_rawseti(L, tbl, ++i); } @@ -620,7 +620,7 @@ namespace LuaSpellEntry for (size_t index = 0; index < entry->ReagentCount.size(); ++index) { - Eluna::Push(L, entry->ReagentCount[index]); + ALE::Push(L, entry->ReagentCount[index]); lua_rawseti(L, tbl, ++i); } @@ -635,7 +635,7 @@ namespace LuaSpellEntry */ int GetEquippedItemClass(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->EquippedItemClass); + ALE::Push(L, entry->EquippedItemClass); return 1; } @@ -646,7 +646,7 @@ namespace LuaSpellEntry */ int GetEquippedItemSubClassMask(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->EquippedItemSubClassMask); + ALE::Push(L, entry->EquippedItemSubClassMask); return 1; } @@ -657,7 +657,7 @@ namespace LuaSpellEntry */ int GetEquippedItemInventoryTypeMask(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->EquippedItemInventoryTypeMask); + ALE::Push(L, entry->EquippedItemInventoryTypeMask); return 1; } @@ -674,7 +674,7 @@ namespace LuaSpellEntry for (size_t index = 0; index < entry->Effect.size(); ++index) { - Eluna::Push(L, entry->Effect[index]); + ALE::Push(L, entry->Effect[index]); lua_rawseti(L, tbl, ++i); } @@ -695,7 +695,7 @@ namespace LuaSpellEntry for (size_t index = 0; index < entry->EffectDieSides.size(); ++index) { - Eluna::Push(L, entry->EffectDieSides[index]); + ALE::Push(L, entry->EffectDieSides[index]); lua_rawseti(L, tbl, ++i); } @@ -716,7 +716,7 @@ namespace LuaSpellEntry for (size_t index = 0; index < entry->EffectRealPointsPerLevel.size(); ++index) { - Eluna::Push(L, entry->EffectRealPointsPerLevel[index]); + ALE::Push(L, entry->EffectRealPointsPerLevel[index]); lua_rawseti(L, tbl, ++i); } @@ -737,7 +737,7 @@ namespace LuaSpellEntry for (size_t index = 0; index < entry->EffectBasePoints.size(); ++index) { - Eluna::Push(L, entry->EffectBasePoints[index]); + ALE::Push(L, entry->EffectBasePoints[index]); lua_rawseti(L, tbl, ++i); } @@ -758,7 +758,7 @@ namespace LuaSpellEntry for (size_t index = 0; index < entry->EffectMechanic.size(); ++index) { - Eluna::Push(L, entry->EffectMechanic[index]); + ALE::Push(L, entry->EffectMechanic[index]); lua_rawseti(L, tbl, ++i); } @@ -779,7 +779,7 @@ namespace LuaSpellEntry for (size_t index = 0; index < entry->EffectImplicitTargetA.size(); ++index) { - Eluna::Push(L, entry->EffectImplicitTargetA[index]); + ALE::Push(L, entry->EffectImplicitTargetA[index]); lua_rawseti(L, tbl, ++i); } @@ -800,7 +800,7 @@ namespace LuaSpellEntry for (size_t index = 0; index < entry->EffectImplicitTargetB.size(); ++index) { - Eluna::Push(L, entry->EffectImplicitTargetB[index]); + ALE::Push(L, entry->EffectImplicitTargetB[index]); lua_rawseti(L, tbl, ++i); } @@ -821,7 +821,7 @@ namespace LuaSpellEntry for (size_t index = 0; index < entry->EffectRadiusIndex.size(); ++index) { - Eluna::Push(L, entry->EffectRadiusIndex[index]); + ALE::Push(L, entry->EffectRadiusIndex[index]); lua_rawseti(L, tbl, ++i); } @@ -842,7 +842,7 @@ namespace LuaSpellEntry for (size_t index = 0; index < entry->EffectApplyAuraName.size(); ++index) { - Eluna::Push(L, entry->EffectApplyAuraName[index]); + ALE::Push(L, entry->EffectApplyAuraName[index]); lua_rawseti(L, tbl, ++i); } @@ -863,7 +863,7 @@ namespace LuaSpellEntry for (size_t index = 0; index < entry->EffectAmplitude.size(); ++index) { - Eluna::Push(L, entry->EffectAmplitude[index]); + ALE::Push(L, entry->EffectAmplitude[index]); lua_rawseti(L, tbl, ++i); } @@ -884,7 +884,7 @@ namespace LuaSpellEntry for (size_t index = 0; index < entry->EffectValueMultiplier.size(); ++index) { - Eluna::Push(L, entry->EffectValueMultiplier[index]); + ALE::Push(L, entry->EffectValueMultiplier[index]); lua_rawseti(L, tbl, ++i); } @@ -905,7 +905,7 @@ namespace LuaSpellEntry for (size_t index = 0; index < entry->EffectChainTarget.size(); ++index) { - Eluna::Push(L, entry->EffectChainTarget[index]); + ALE::Push(L, entry->EffectChainTarget[index]); lua_rawseti(L, tbl, ++i); } @@ -926,7 +926,7 @@ namespace LuaSpellEntry for (size_t index = 0; index < entry->EffectItemType.size(); ++index) { - Eluna::Push(L, entry->EffectItemType[index]); + ALE::Push(L, entry->EffectItemType[index]); lua_rawseti(L, tbl, ++i); } @@ -947,7 +947,7 @@ namespace LuaSpellEntry for (size_t index = 0; index < entry->EffectMiscValue.size(); ++index) { - Eluna::Push(L, entry->EffectMiscValue[index]); + ALE::Push(L, entry->EffectMiscValue[index]); lua_rawseti(L, tbl, ++i); } @@ -968,7 +968,7 @@ namespace LuaSpellEntry for (size_t index = 0; index < entry->EffectMiscValueB.size(); ++index) { - Eluna::Push(L, entry->EffectMiscValueB[index]); + ALE::Push(L, entry->EffectMiscValueB[index]); lua_rawseti(L, tbl, ++i); } @@ -989,7 +989,7 @@ namespace LuaSpellEntry for (size_t index = 0; index < entry->EffectTriggerSpell.size(); ++index) { - Eluna::Push(L, entry->EffectTriggerSpell[index]); + ALE::Push(L, entry->EffectTriggerSpell[index]); lua_rawseti(L, tbl, ++i); } @@ -1010,7 +1010,7 @@ namespace LuaSpellEntry for (size_t index = 0; index < entry->EffectPointsPerComboPoint.size(); ++index) { - Eluna::Push(L, entry->EffectPointsPerComboPoint[index]); + ALE::Push(L, entry->EffectPointsPerComboPoint[index]); lua_rawseti(L, tbl, ++i); } @@ -1034,7 +1034,7 @@ namespace LuaSpellEntry for (size_t index = 0; index < entry->EffectSpellClassMask.size(); ++index) { - Eluna::Push(L, entry->EffectSpellClassMask[index]); + ALE::Push(L, entry->EffectSpellClassMask[index]); lua_rawseti(L, tbl, ++i); } @@ -1055,7 +1055,7 @@ namespace LuaSpellEntry for (size_t index = 0; index < entry->SpellVisual.size(); ++index) { - Eluna::Push(L, entry->SpellVisual[index]); + ALE::Push(L, entry->SpellVisual[index]); lua_rawseti(L, tbl, ++i); } @@ -1070,7 +1070,7 @@ namespace LuaSpellEntry */ int GetSpellIconID(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->SpellIconID); + ALE::Push(L, entry->SpellIconID); return 1; } @@ -1081,7 +1081,7 @@ namespace LuaSpellEntry */ int GetActiveIconID(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->ActiveIconID); + ALE::Push(L, entry->ActiveIconID); return 1; } @@ -1092,7 +1092,7 @@ namespace LuaSpellEntry */ int GetSpellPriority(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->SpellPriority); + ALE::Push(L, entry->SpellPriority); return 1; } @@ -1109,7 +1109,7 @@ namespace LuaSpellEntry for (size_t index = 0; index < entry->SpellName.size(); ++index) { - Eluna::Push(L, entry->SpellName[index]); + ALE::Push(L, entry->SpellName[index]); lua_rawseti(L, tbl, ++i); } @@ -1130,7 +1130,7 @@ namespace LuaSpellEntry for (size_t index = 0; index < entry->Rank.size(); ++index) { - Eluna::Push(L, entry->Rank[index]); + ALE::Push(L, entry->Rank[index]); lua_rawseti(L, tbl, ++i); } @@ -1145,7 +1145,7 @@ namespace LuaSpellEntry */ int GetManaCostPercentage(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->ManaCostPercentage); + ALE::Push(L, entry->ManaCostPercentage); return 1; } @@ -1156,7 +1156,7 @@ namespace LuaSpellEntry */ int GetStartRecoveryCategory(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->StartRecoveryCategory); + ALE::Push(L, entry->StartRecoveryCategory); return 1; } @@ -1167,7 +1167,7 @@ namespace LuaSpellEntry */ int GetStartRecoveryTime(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->StartRecoveryTime); + ALE::Push(L, entry->StartRecoveryTime); return 1; } @@ -1178,7 +1178,7 @@ namespace LuaSpellEntry */ int GetMaxTargetLevel(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->MaxTargetLevel); + ALE::Push(L, entry->MaxTargetLevel); return 1; } @@ -1191,7 +1191,7 @@ namespace LuaSpellEntry */ int GetSpellFamilyName(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->SpellFamilyName); + ALE::Push(L, entry->SpellFamilyName); return 1; } @@ -1204,7 +1204,7 @@ namespace LuaSpellEntry */ int GetSpellFamilyFlags(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->SpellFamilyFlags); + ALE::Push(L, entry->SpellFamilyFlags); return 1; } @@ -1215,7 +1215,7 @@ namespace LuaSpellEntry */ int GetMaxAffectedTargets(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->MaxAffectedTargets); + ALE::Push(L, entry->MaxAffectedTargets); return 1; } @@ -1226,7 +1226,7 @@ namespace LuaSpellEntry */ int GetDmgClass(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->DmgClass); + ALE::Push(L, entry->DmgClass); return 1; } @@ -1237,7 +1237,7 @@ namespace LuaSpellEntry */ int GetPreventionType(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->PreventionType); + ALE::Push(L, entry->PreventionType); return 1; } @@ -1254,7 +1254,7 @@ namespace LuaSpellEntry for (size_t index = 0; index < entry->EffectDamageMultiplier.size(); ++index) { - Eluna::Push(L, entry->EffectDamageMultiplier[index]); + ALE::Push(L, entry->EffectDamageMultiplier[index]); lua_rawseti(L, tbl, ++i); } @@ -1275,7 +1275,7 @@ namespace LuaSpellEntry for (size_t index = 0; index < entry->TotemCategory.size(); ++index) { - Eluna::Push(L, entry->TotemCategory[index]); + ALE::Push(L, entry->TotemCategory[index]); lua_rawseti(L, tbl, ++i); } @@ -1292,7 +1292,7 @@ namespace LuaSpellEntry */ int GetAreaGroupId(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->AreaGroupId); + ALE::Push(L, entry->AreaGroupId); return 1; } @@ -1303,7 +1303,7 @@ namespace LuaSpellEntry */ int GetSchoolMask(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->SchoolMask); + ALE::Push(L, entry->SchoolMask); return 1; } @@ -1314,7 +1314,7 @@ namespace LuaSpellEntry */ int GetRuneCostID(lua_State* L, SpellEntry* entry) { - Eluna::Push(L, entry->RuneCostID); + ALE::Push(L, entry->RuneCostID); return 1; } @@ -1331,7 +1331,7 @@ namespace LuaSpellEntry for (size_t index = 0; index < entry->EffectBonusMultiplier.size(); ++index) { - Eluna::Push(L, entry->EffectBonusMultiplier[index]); + ALE::Push(L, entry->EffectBonusMultiplier[index]); lua_rawseti(L, tbl, ++i); } @@ -1346,7 +1346,7 @@ namespace LuaSpellEntry */ int SetCategory(lua_State* L, SpellEntry* entry) { - uint32 category = Eluna::CHECKVAL(L, 2); + uint32 category = ALE::CHECKVAL(L, 2); entry->Category = category; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -1364,7 +1364,7 @@ namespace LuaSpellEntry */ int SetDispel(lua_State* L, SpellEntry* entry) { - uint32 dispel = Eluna::CHECKVAL(L, 2); + uint32 dispel = ALE::CHECKVAL(L, 2); entry->Dispel = dispel; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -1382,7 +1382,7 @@ namespace LuaSpellEntry */ int SetMechanic(lua_State* L, SpellEntry* entry) { - uint32 mechanic = Eluna::CHECKVAL(L, 2); + uint32 mechanic = ALE::CHECKVAL(L, 2); entry->Mechanic = mechanic; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -1400,7 +1400,7 @@ namespace LuaSpellEntry */ int SetAttributes(lua_State* L, SpellEntry* entry) { - uint32 attributes = Eluna::CHECKVAL(L, 2); + uint32 attributes = ALE::CHECKVAL(L, 2); entry->Attributes = attributes; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -1418,7 +1418,7 @@ namespace LuaSpellEntry */ int SetAttributesEx(lua_State* L, SpellEntry* entry) { - uint32 attributesEx = Eluna::CHECKVAL(L, 2); + uint32 attributesEx = ALE::CHECKVAL(L, 2); entry->AttributesEx = attributesEx; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -1436,7 +1436,7 @@ namespace LuaSpellEntry */ int SetAttributesEx2(lua_State* L, SpellEntry* entry) { - uint32 attributesEx2 = Eluna::CHECKVAL(L, 2); + uint32 attributesEx2 = ALE::CHECKVAL(L, 2); entry->AttributesEx2 = attributesEx2; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -1454,7 +1454,7 @@ namespace LuaSpellEntry */ int SetAttributesEx3(lua_State* L, SpellEntry* entry) { - uint32 attributesEx3 = Eluna::CHECKVAL(L, 2); + uint32 attributesEx3 = ALE::CHECKVAL(L, 2); entry->AttributesEx3 = attributesEx3; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -1472,7 +1472,7 @@ namespace LuaSpellEntry */ int SetAttributesEx4(lua_State* L, SpellEntry* entry) { - uint32 attributesEx4 = Eluna::CHECKVAL(L, 2); + uint32 attributesEx4 = ALE::CHECKVAL(L, 2); entry->AttributesEx4 = attributesEx4; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -1490,7 +1490,7 @@ namespace LuaSpellEntry */ int SetAttributesEx5(lua_State* L, SpellEntry* entry) { - uint32 attributesEx5 = Eluna::CHECKVAL(L, 2); + uint32 attributesEx5 = ALE::CHECKVAL(L, 2); entry->AttributesEx5 = attributesEx5; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -1508,7 +1508,7 @@ namespace LuaSpellEntry */ int SetAttributesEx6(lua_State* L, SpellEntry* entry) { - uint32 attributesEx6 = Eluna::CHECKVAL(L, 2); + uint32 attributesEx6 = ALE::CHECKVAL(L, 2); entry->AttributesEx6 = attributesEx6; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -1526,7 +1526,7 @@ namespace LuaSpellEntry */ int SetAttributesEx7(lua_State* L, SpellEntry* entry) { - uint32 attributesEx7 = Eluna::CHECKVAL(L, 2); + uint32 attributesEx7 = ALE::CHECKVAL(L, 2); entry->AttributesEx7 = attributesEx7; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -1544,7 +1544,7 @@ namespace LuaSpellEntry */ int SetStances(lua_State* L, SpellEntry* entry) { - uint32 stances = Eluna::CHECKVAL(L, 2); + uint32 stances = ALE::CHECKVAL(L, 2); entry->Stances = stances; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -1562,7 +1562,7 @@ namespace LuaSpellEntry */ int SetStancesNot(lua_State* L, SpellEntry* entry) { - uint32 stancesNot = Eluna::CHECKVAL(L, 2); + uint32 stancesNot = ALE::CHECKVAL(L, 2); entry->StancesNot = stancesNot; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -1580,7 +1580,7 @@ namespace LuaSpellEntry */ int SetTargets(lua_State* L, SpellEntry* entry) { - uint32 targets = Eluna::CHECKVAL(L, 2); + uint32 targets = ALE::CHECKVAL(L, 2); entry->Targets = targets; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -1598,7 +1598,7 @@ namespace LuaSpellEntry */ int SetTargetCreatureType(lua_State* L, SpellEntry* entry) { - uint32 targetCreatureType = Eluna::CHECKVAL(L, 2); + uint32 targetCreatureType = ALE::CHECKVAL(L, 2); entry->TargetCreatureType = targetCreatureType; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -1616,7 +1616,7 @@ namespace LuaSpellEntry */ int SetRequiresSpellFocus(lua_State* L, SpellEntry* entry) { - uint32 requiresSpellFocus = Eluna::CHECKVAL(L, 2); + uint32 requiresSpellFocus = ALE::CHECKVAL(L, 2); entry->RequiresSpellFocus = requiresSpellFocus; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -1634,7 +1634,7 @@ namespace LuaSpellEntry */ int SetFacingCasterFlags(lua_State* L, SpellEntry* entry) { - uint32 facingCasterFlags = Eluna::CHECKVAL(L, 2); + uint32 facingCasterFlags = ALE::CHECKVAL(L, 2); entry->FacingCasterFlags = facingCasterFlags; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -1652,7 +1652,7 @@ namespace LuaSpellEntry */ int SetCasterAuraState(lua_State* L, SpellEntry* entry) { - uint32 casterAuraState = Eluna::CHECKVAL(L, 2); + uint32 casterAuraState = ALE::CHECKVAL(L, 2); entry->CasterAuraState = casterAuraState; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -1670,7 +1670,7 @@ namespace LuaSpellEntry */ int SetTargetAuraState(lua_State* L, SpellEntry* entry) { - uint32 targetAuraState = Eluna::CHECKVAL(L, 2); + uint32 targetAuraState = ALE::CHECKVAL(L, 2); entry->TargetAuraState = targetAuraState; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -1688,7 +1688,7 @@ namespace LuaSpellEntry */ int SetCasterAuraStateNot(lua_State* L, SpellEntry* entry) { - uint32 casterAuraStateNot = Eluna::CHECKVAL(L, 2); + uint32 casterAuraStateNot = ALE::CHECKVAL(L, 2); entry->CasterAuraStateNot = casterAuraStateNot; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -1706,7 +1706,7 @@ namespace LuaSpellEntry */ int SetTargetAuraStateNot(lua_State* L, SpellEntry* entry) { - uint32 targetAuraStateNot = Eluna::CHECKVAL(L, 2); + uint32 targetAuraStateNot = ALE::CHECKVAL(L, 2); entry->TargetAuraStateNot = targetAuraStateNot; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -1724,7 +1724,7 @@ namespace LuaSpellEntry */ int SetCasterAuraSpell(lua_State* L, SpellEntry* entry) { - uint32 casterAuraSpell = Eluna::CHECKVAL(L, 2); + uint32 casterAuraSpell = ALE::CHECKVAL(L, 2); entry->CasterAuraSpell = casterAuraSpell; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -1742,7 +1742,7 @@ namespace LuaSpellEntry */ int SetTargetAuraSpell(lua_State* L, SpellEntry* entry) { - uint32 targetAuraSpell = Eluna::CHECKVAL(L, 2); + uint32 targetAuraSpell = ALE::CHECKVAL(L, 2); entry->TargetAuraSpell = targetAuraSpell; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -1760,7 +1760,7 @@ namespace LuaSpellEntry */ int SetExcludeCasterAuraSpell(lua_State* L, SpellEntry* entry) { - uint32 excludeCasterAuraSpell = Eluna::CHECKVAL(L, 2); + uint32 excludeCasterAuraSpell = ALE::CHECKVAL(L, 2); entry->ExcludeCasterAuraSpell = excludeCasterAuraSpell; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -1778,7 +1778,7 @@ namespace LuaSpellEntry */ int SetExcludeTargetAuraSpell(lua_State* L, SpellEntry* entry) { - uint32 excludeTargetAuraSpell = Eluna::CHECKVAL(L, 2); + uint32 excludeTargetAuraSpell = ALE::CHECKVAL(L, 2); entry->ExcludeTargetAuraSpell = excludeTargetAuraSpell; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -1796,7 +1796,7 @@ namespace LuaSpellEntry */ int SetRecoveryTime(lua_State* L, SpellEntry* entry) { - uint32 recoveryTime = Eluna::CHECKVAL(L, 2); + uint32 recoveryTime = ALE::CHECKVAL(L, 2); entry->RecoveryTime = recoveryTime; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -1814,7 +1814,7 @@ namespace LuaSpellEntry */ int SetCategoryRecoveryTime(lua_State* L, SpellEntry* entry) { - uint32 categoryRecoveryTime = Eluna::CHECKVAL(L, 2); + uint32 categoryRecoveryTime = ALE::CHECKVAL(L, 2); entry->CategoryRecoveryTime = categoryRecoveryTime; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -1832,7 +1832,7 @@ namespace LuaSpellEntry */ int SetInterruptFlags(lua_State* L, SpellEntry* entry) { - uint32 interruptFlags = Eluna::CHECKVAL(L, 2); + uint32 interruptFlags = ALE::CHECKVAL(L, 2); entry->InterruptFlags = interruptFlags; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -1850,7 +1850,7 @@ namespace LuaSpellEntry */ int SetAuraInterruptFlags(lua_State* L, SpellEntry* entry) { - uint32 auraInterruptFlags = Eluna::CHECKVAL(L, 2); + uint32 auraInterruptFlags = ALE::CHECKVAL(L, 2); entry->AuraInterruptFlags = auraInterruptFlags; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -1868,7 +1868,7 @@ namespace LuaSpellEntry */ int SetChannelInterruptFlags(lua_State* L, SpellEntry* entry) { - uint32 channelInterruptFlags = Eluna::CHECKVAL(L, 2); + uint32 channelInterruptFlags = ALE::CHECKVAL(L, 2); entry->ChannelInterruptFlags = channelInterruptFlags; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -1886,7 +1886,7 @@ namespace LuaSpellEntry */ int SetProcFlags(lua_State* L, SpellEntry* entry) { - uint32 procFlags = Eluna::CHECKVAL(L, 2); + uint32 procFlags = ALE::CHECKVAL(L, 2); entry->ProcFlags = procFlags; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -1904,7 +1904,7 @@ namespace LuaSpellEntry */ int SetProcChance(lua_State* L, SpellEntry* entry) { - uint32 procChance = Eluna::CHECKVAL(L, 2); + uint32 procChance = ALE::CHECKVAL(L, 2); entry->ProcChance = procChance; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -1922,7 +1922,7 @@ namespace LuaSpellEntry */ int SetProcCharges(lua_State* L, SpellEntry* entry) { - uint32 procCharges = Eluna::CHECKVAL(L, 2); + uint32 procCharges = ALE::CHECKVAL(L, 2); entry->ProcCharges = procCharges; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -1940,7 +1940,7 @@ namespace LuaSpellEntry */ int SetMaxLevel(lua_State* L, SpellEntry* entry) { - uint32 maxLevel = Eluna::CHECKVAL(L, 2); + uint32 maxLevel = ALE::CHECKVAL(L, 2); entry->MaxLevel = maxLevel; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -1958,7 +1958,7 @@ namespace LuaSpellEntry */ int SetBaseLevel(lua_State* L, SpellEntry* entry) { - uint32 baseLevel = Eluna::CHECKVAL(L, 2); + uint32 baseLevel = ALE::CHECKVAL(L, 2); entry->BaseLevel = baseLevel; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -1976,7 +1976,7 @@ namespace LuaSpellEntry */ int SetSpellLevel(lua_State* L, SpellEntry* entry) { - uint32 spellLevel = Eluna::CHECKVAL(L, 2); + uint32 spellLevel = ALE::CHECKVAL(L, 2); entry->SpellLevel = spellLevel; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -1994,7 +1994,7 @@ namespace LuaSpellEntry */ int SetManaCost(lua_State* L, SpellEntry* entry) { - uint32 manaCost = Eluna::CHECKVAL(L, 2); + uint32 manaCost = ALE::CHECKVAL(L, 2); entry->ManaCost = manaCost; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -2012,7 +2012,7 @@ namespace LuaSpellEntry */ int SetPowerType(lua_State* L, SpellEntry* entry) { - uint32 powerType = Eluna::CHECKVAL(L, 2); + uint32 powerType = ALE::CHECKVAL(L, 2); entry->PowerType = powerType; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -2030,7 +2030,7 @@ namespace LuaSpellEntry */ int SetManaCostPerlevel(lua_State* L, SpellEntry* entry) { - uint32 manaCostPerlevel = Eluna::CHECKVAL(L, 2); + uint32 manaCostPerlevel = ALE::CHECKVAL(L, 2); entry->ManaCostPerlevel = manaCostPerlevel; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -2048,7 +2048,7 @@ namespace LuaSpellEntry */ int SetManaPerSecond(lua_State* L, SpellEntry* entry) { - uint32 manaPerSecond = Eluna::CHECKVAL(L, 2); + uint32 manaPerSecond = ALE::CHECKVAL(L, 2); entry->ManaPerSecond = manaPerSecond; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -2066,7 +2066,7 @@ namespace LuaSpellEntry */ int SetManaPerSecondPerLevel(lua_State* L, SpellEntry* entry) { - uint32 manaPerSecondPerLevel = Eluna::CHECKVAL(L, 2); + uint32 manaPerSecondPerLevel = ALE::CHECKVAL(L, 2); entry->ManaPerSecondPerLevel = manaPerSecondPerLevel; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -2084,7 +2084,7 @@ namespace LuaSpellEntry */ int SetSpeed(lua_State* L, SpellEntry* entry) { - float speed = Eluna::CHECKVAL(L, 2); + float speed = ALE::CHECKVAL(L, 2); entry->Speed = speed; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -2102,7 +2102,7 @@ namespace LuaSpellEntry */ int SetStackAmount(lua_State* L, SpellEntry* entry) { - uint32 stackAmount = Eluna::CHECKVAL(L, 2); + uint32 stackAmount = ALE::CHECKVAL(L, 2); entry->StackAmount = stackAmount; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -2120,7 +2120,7 @@ namespace LuaSpellEntry */ int SetEquippedItemClass(lua_State* L, SpellEntry* entry) { - int32 equippedItemClass = Eluna::CHECKVAL(L, 2); + int32 equippedItemClass = ALE::CHECKVAL(L, 2); entry->EquippedItemClass = equippedItemClass; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -2138,7 +2138,7 @@ namespace LuaSpellEntry */ int SetEquippedItemSubClassMask(lua_State* L, SpellEntry* entry) { - int32 equippedItemSubClassMask = Eluna::CHECKVAL(L, 2); + int32 equippedItemSubClassMask = ALE::CHECKVAL(L, 2); entry->EquippedItemSubClassMask = equippedItemSubClassMask; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -2156,7 +2156,7 @@ namespace LuaSpellEntry */ int SetEquippedItemInventoryTypeMask(lua_State* L, SpellEntry* entry) { - int32 equippedItemInventoryTypeMask = Eluna::CHECKVAL(L, 2); + int32 equippedItemInventoryTypeMask = ALE::CHECKVAL(L, 2); entry->EquippedItemInventoryTypeMask = equippedItemInventoryTypeMask; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -2174,7 +2174,7 @@ namespace LuaSpellEntry */ int SetSpellIconID(lua_State* L, SpellEntry* entry) { - uint32 spellIconID = Eluna::CHECKVAL(L, 2); + uint32 spellIconID = ALE::CHECKVAL(L, 2); entry->SpellIconID = spellIconID; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -2192,7 +2192,7 @@ namespace LuaSpellEntry */ int SetActiveIconID(lua_State* L, SpellEntry* entry) { - uint32 activeIconID = Eluna::CHECKVAL(L, 2); + uint32 activeIconID = ALE::CHECKVAL(L, 2); entry->ActiveIconID = activeIconID; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -2210,7 +2210,7 @@ namespace LuaSpellEntry */ int SetSpellPriority(lua_State* L, SpellEntry* entry) { - uint32 spellPriority = Eluna::CHECKVAL(L, 2); + uint32 spellPriority = ALE::CHECKVAL(L, 2); entry->SpellPriority = spellPriority; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -2228,7 +2228,7 @@ namespace LuaSpellEntry */ int SetManaCostPercentage(lua_State* L, SpellEntry* entry) { - uint32 manaCostPercentage = Eluna::CHECKVAL(L, 2); + uint32 manaCostPercentage = ALE::CHECKVAL(L, 2); entry->ManaCostPercentage = manaCostPercentage; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -2246,7 +2246,7 @@ namespace LuaSpellEntry */ int SetStartRecoveryCategory(lua_State* L, SpellEntry* entry) { - uint32 startRecoveryCategory = Eluna::CHECKVAL(L, 2); + uint32 startRecoveryCategory = ALE::CHECKVAL(L, 2); entry->StartRecoveryCategory = startRecoveryCategory; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -2264,7 +2264,7 @@ namespace LuaSpellEntry */ int SetStartRecoveryTime(lua_State* L, SpellEntry* entry) { - uint32 startRecoveryTime = Eluna::CHECKVAL(L, 2); + uint32 startRecoveryTime = ALE::CHECKVAL(L, 2); entry->StartRecoveryTime = startRecoveryTime; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -2282,7 +2282,7 @@ namespace LuaSpellEntry */ int SetMaxTargetLevel(lua_State* L, SpellEntry* entry) { - uint32 maxTargetLevel = Eluna::CHECKVAL(L, 2); + uint32 maxTargetLevel = ALE::CHECKVAL(L, 2); entry->MaxTargetLevel = maxTargetLevel; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -2300,7 +2300,7 @@ namespace LuaSpellEntry */ int SetSpellFamilyName(lua_State* L, SpellEntry* entry) { - uint32 spellFamilyName = Eluna::CHECKVAL(L, 2); + uint32 spellFamilyName = ALE::CHECKVAL(L, 2); entry->SpellFamilyName = spellFamilyName; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -2318,7 +2318,7 @@ namespace LuaSpellEntry */ int SetMaxAffectedTargets(lua_State* L, SpellEntry* entry) { - uint32 maxAffectedTargets = Eluna::CHECKVAL(L, 2); + uint32 maxAffectedTargets = ALE::CHECKVAL(L, 2); entry->MaxAffectedTargets = maxAffectedTargets; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -2336,7 +2336,7 @@ namespace LuaSpellEntry */ int SetDmgClass(lua_State* L, SpellEntry* entry) { - uint32 dmgClass = Eluna::CHECKVAL(L, 2); + uint32 dmgClass = ALE::CHECKVAL(L, 2); entry->DmgClass = dmgClass; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -2354,7 +2354,7 @@ namespace LuaSpellEntry */ int SetPreventionType(lua_State* L, SpellEntry* entry) { - uint32 preventionType = Eluna::CHECKVAL(L, 2); + uint32 preventionType = ALE::CHECKVAL(L, 2); entry->PreventionType = preventionType; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -2372,7 +2372,7 @@ namespace LuaSpellEntry */ int SetSchoolMask(lua_State* L, SpellEntry* entry) { - uint32 schoolMask = Eluna::CHECKVAL(L, 2); + uint32 schoolMask = ALE::CHECKVAL(L, 2); entry->SchoolMask = schoolMask; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) @@ -2390,7 +2390,7 @@ namespace LuaSpellEntry */ int SetRuneCostID(lua_State* L, SpellEntry* entry) { - uint32 runeCostID = Eluna::CHECKVAL(L, 2); + uint32 runeCostID = ALE::CHECKVAL(L, 2); entry->RuneCostID = runeCostID; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->Id)) diff --git a/src/LuaEngine/methods/SpellInfoMethods.h b/src/LuaEngine/methods/SpellInfoMethods.h index 4b4cdab..ea472bb 100644 --- a/src/LuaEngine/methods/SpellInfoMethods.h +++ b/src/LuaEngine/methods/SpellInfoMethods.h @@ -1,5 +1,5 @@ /* -* Copyright (C) 2010 - 2024 Eluna Lua Engine +* Copyright (C) 2010 - 2024 ALE Lua Engine * This program is free software licensed under GPL version 3 * Please see the included DOCS/LICENSE.md for more information */ @@ -41,8 +41,8 @@ namespace LuaSpellInfo */ int GetName(lua_State* L, SpellInfo* spell_info) { - uint8 locale = Eluna::CHECKVAL(L, 2, DEFAULT_LOCALE); - Eluna::Push(L, spell_info->SpellName[static_cast(locale)]); + uint8 locale = ALE::CHECKVAL(L, 2, DEFAULT_LOCALE); + ALE::Push(L, spell_info->SpellName[static_cast(locale)]); return 1; } @@ -72,8 +72,8 @@ namespace LuaSpellInfo */ int HasAttribute(lua_State* L, SpellInfo* spell_info) { - int8 attributeType = Eluna::CHECKVAL(L, 2); - uint32 attribute = Eluna::CHECKVAL(L, 3); + int8 attributeType = ALE::CHECKVAL(L, 2); + uint32 attribute = ALE::CHECKVAL(L, 3); bool hasAttribute = false; if ( attributeType == -1 ) { @@ -110,7 +110,7 @@ namespace LuaSpellInfo } } - Eluna::Push(L, hasAttribute); + ALE::Push(L, hasAttribute); return 1; } @@ -138,7 +138,7 @@ namespace LuaSpellInfo */ int GetAttributes(lua_State* L, SpellInfo* spell_info) { - int8 attributeType = Eluna::CHECKVAL(L, 2); + int8 attributeType = ALE::CHECKVAL(L, 2); uint32 attributes; if ( attributeType == -1 ) { @@ -174,7 +174,7 @@ namespace LuaSpellInfo } } - Eluna::Push(L, attributes); + ALE::Push(L, attributes); return 1; } @@ -191,7 +191,7 @@ namespace LuaSpellInfo */ int IsAffectingArea(lua_State* L, SpellInfo* spell_info) { - Eluna::Push(L, spell_info->IsAffectingArea()); + ALE::Push(L, spell_info->IsAffectingArea()); return 1; } @@ -206,7 +206,7 @@ namespace LuaSpellInfo */ int GetCategory(lua_State* L, SpellInfo* spell_info) { - Eluna::Push(L, spell_info->GetCategory()); + ALE::Push(L, spell_info->GetCategory()); return 1; } @@ -221,8 +221,8 @@ namespace LuaSpellInfo */ int HasEffect(lua_State* L, SpellInfo* spell_info) { - uint8 effect = Eluna::CHECKVAL(L, 2); - Eluna::Push(L, spell_info->HasEffect(static_cast(effect))); + uint8 effect = ALE::CHECKVAL(L, 2); + ALE::Push(L, spell_info->HasEffect(static_cast(effect))); return 1; } @@ -237,8 +237,8 @@ namespace LuaSpellInfo */ int HasAura(lua_State* L, SpellInfo* spell_info) { - uint32 aura = Eluna::CHECKVAL(L, 2); - Eluna::Push(L, spell_info->HasAura(static_cast(aura))); + uint32 aura = ALE::CHECKVAL(L, 2); + ALE::Push(L, spell_info->HasAura(static_cast(aura))); return 1; } @@ -251,7 +251,7 @@ namespace LuaSpellInfo */ int HasAreaAuraEffect(lua_State* L, SpellInfo* spell_info) { - Eluna::Push(L, spell_info->HasAreaAuraEffect()); + ALE::Push(L, spell_info->HasAreaAuraEffect()); return 1; } @@ -266,7 +266,7 @@ namespace LuaSpellInfo */ int IsExplicitDiscovery(lua_State* L, SpellInfo* spell_info) { - Eluna::Push(L, spell_info->IsExplicitDiscovery()); + ALE::Push(L, spell_info->IsExplicitDiscovery()); return 1; } @@ -280,7 +280,7 @@ namespace LuaSpellInfo */ int IsLootCrafting(lua_State* L, SpellInfo* spell_info) { - Eluna::Push(L, spell_info->IsLootCrafting()); + ALE::Push(L, spell_info->IsLootCrafting()); return 1; } @@ -294,7 +294,7 @@ namespace LuaSpellInfo */ int IsProfessionOrRiding(lua_State* L, SpellInfo* spell_info) { - Eluna::Push(L, spell_info->IsProfessionOrRiding()); + ALE::Push(L, spell_info->IsProfessionOrRiding()); return 1; } @@ -308,7 +308,7 @@ namespace LuaSpellInfo */ int IsProfession(lua_State* L, SpellInfo* spell_info) { - Eluna::Push(L, spell_info->IsProfession()); + ALE::Push(L, spell_info->IsProfession()); return 1; } @@ -322,7 +322,7 @@ namespace LuaSpellInfo */ int IsPrimaryProfession(lua_State* L, SpellInfo* spell_info) { - Eluna::Push(L, spell_info->IsPrimaryProfession()); + ALE::Push(L, spell_info->IsPrimaryProfession()); return 1; } @@ -336,7 +336,7 @@ namespace LuaSpellInfo */ int IsPrimaryProfessionFirstRank(lua_State* L, SpellInfo* spell_info) { - Eluna::Push(L, spell_info->IsPrimaryProfessionFirstRank()); + ALE::Push(L, spell_info->IsPrimaryProfessionFirstRank()); return 1; } @@ -350,7 +350,7 @@ namespace LuaSpellInfo */ int IsAbilityLearnedWithProfession(lua_State* L, SpellInfo* spell_info) { - Eluna::Push(L, spell_info->IsAbilityLearnedWithProfession()); + ALE::Push(L, spell_info->IsAbilityLearnedWithProfession()); return 1; } @@ -366,8 +366,8 @@ namespace LuaSpellInfo */ int IsAbilityOfSkillType(lua_State* L, SpellInfo* spell_info) { - uint32 skillType = Eluna::CHECKVAL(L, 2); - Eluna::Push(L, spell_info->IsAbilityOfSkillType(skillType)); + uint32 skillType = ALE::CHECKVAL(L, 2); + ALE::Push(L, spell_info->IsAbilityOfSkillType(skillType)); return 1; } @@ -380,7 +380,7 @@ namespace LuaSpellInfo */ int IsTargetingArea(lua_State* L, SpellInfo* spell_info) { - Eluna::Push(L, spell_info->IsTargetingArea()); + ALE::Push(L, spell_info->IsTargetingArea()); return 1; } @@ -394,7 +394,7 @@ namespace LuaSpellInfo */ int NeedsExplicitUnitTarget(lua_State* L, SpellInfo* spell_info) { - Eluna::Push(L, spell_info->NeedsExplicitUnitTarget()); + ALE::Push(L, spell_info->NeedsExplicitUnitTarget()); return 1; } @@ -410,8 +410,8 @@ namespace LuaSpellInfo */ int NeedsToBeTriggeredByCaster(lua_State* L, SpellInfo* spell_info) { - const SpellInfo* triggeringSpell = Eluna::CHECKOBJ(L, 2); - Eluna::Push(L, spell_info->NeedsToBeTriggeredByCaster(triggeringSpell)); + const SpellInfo* triggeringSpell = ALE::CHECKOBJ(L, 2); + ALE::Push(L, spell_info->NeedsToBeTriggeredByCaster(triggeringSpell)); return 1; } @@ -426,7 +426,7 @@ namespace LuaSpellInfo */ int IsSelfCast(lua_State* L, SpellInfo* spell_info) { - Eluna::Push(L, spell_info->IsSelfCast()); + ALE::Push(L, spell_info->IsSelfCast()); return 1; } @@ -440,7 +440,7 @@ namespace LuaSpellInfo */ int IsPassive(lua_State* L, SpellInfo* spell_info) { - Eluna::Push(L, spell_info->IsPassive()); + ALE::Push(L, spell_info->IsPassive()); return 1; } @@ -455,7 +455,7 @@ namespace LuaSpellInfo */ int IsAutocastable(lua_State* L, SpellInfo* spell_info) { - Eluna::Push(L, spell_info->IsAutocastable()); + ALE::Push(L, spell_info->IsAutocastable()); return 1; } @@ -470,7 +470,7 @@ namespace LuaSpellInfo */ int IsStackableWithRanks(lua_State* L, SpellInfo* spell_info) { - Eluna::Push(L, spell_info->IsStackableWithRanks()); + ALE::Push(L, spell_info->IsStackableWithRanks()); return 1; } @@ -485,7 +485,7 @@ namespace LuaSpellInfo */ int IsPassiveStackableWithRanks(lua_State* L, SpellInfo* spell_info) { - Eluna::Push(L, spell_info->IsPassiveStackableWithRanks()); + ALE::Push(L, spell_info->IsPassiveStackableWithRanks()); return 1; } @@ -499,7 +499,7 @@ namespace LuaSpellInfo */ int IsMultiSlotAura(lua_State* L, SpellInfo* spell_info) { - Eluna::Push(L, spell_info->IsMultiSlotAura()); + ALE::Push(L, spell_info->IsMultiSlotAura()); return 1; } @@ -510,7 +510,7 @@ namespace LuaSpellInfo */ int IsCooldownStartedOnEvent(lua_State* L, SpellInfo* spell_info) { - Eluna::Push(L, spell_info->IsCooldownStartedOnEvent()); + ALE::Push(L, spell_info->IsCooldownStartedOnEvent()); return 1; } @@ -521,7 +521,7 @@ namespace LuaSpellInfo */ int IsDeathPersistent(lua_State* L, SpellInfo* spell_info) { - Eluna::Push(L, spell_info->IsDeathPersistent()); + ALE::Push(L, spell_info->IsDeathPersistent()); return 1; } @@ -532,7 +532,7 @@ namespace LuaSpellInfo */ int IsRequiringDeadTarget(lua_State* L, SpellInfo* spell_info) { - Eluna::Push(L, spell_info->IsRequiringDeadTarget()); + ALE::Push(L, spell_info->IsRequiringDeadTarget()); return 1; } @@ -543,7 +543,7 @@ namespace LuaSpellInfo */ int IsAllowingDeadTarget(lua_State* L, SpellInfo* spell_info) { - Eluna::Push(L, spell_info->IsAllowingDeadTarget()); + ALE::Push(L, spell_info->IsAllowingDeadTarget()); return 1; } @@ -554,7 +554,7 @@ namespace LuaSpellInfo */ int CanBeUsedInCombat(lua_State* L, SpellInfo* spell_info) { - Eluna::Push(L, spell_info->CanBeUsedInCombat()); + ALE::Push(L, spell_info->CanBeUsedInCombat()); return 1; } @@ -565,7 +565,7 @@ namespace LuaSpellInfo */ int IsPositive(lua_State* L, SpellInfo* spell_info) { - Eluna::Push(L, spell_info->IsPositive()); + ALE::Push(L, spell_info->IsPositive()); return 1; } @@ -577,8 +577,8 @@ namespace LuaSpellInfo */ int IsPositiveEffect(lua_State* L, SpellInfo* spell_info) { - uint8 effIndex = Eluna::CHECKVAL(L, 2); - Eluna::Push(L, spell_info->IsPositiveEffect(effIndex)); + uint8 effIndex = ALE::CHECKVAL(L, 2); + ALE::Push(L, spell_info->IsPositiveEffect(effIndex)); return 1; } @@ -589,7 +589,7 @@ namespace LuaSpellInfo */ int IsChanneled(lua_State* L, SpellInfo* spell_info) { - Eluna::Push(L, spell_info->IsChanneled()); + ALE::Push(L, spell_info->IsChanneled()); return 1; } @@ -600,7 +600,7 @@ namespace LuaSpellInfo */ int NeedsComboPoints(lua_State* L, SpellInfo* spell_info) { - Eluna::Push(L, spell_info->NeedsComboPoints()); + ALE::Push(L, spell_info->NeedsComboPoints()); return 1; } @@ -611,7 +611,7 @@ namespace LuaSpellInfo */ int IsBreakingStealth(lua_State* L, SpellInfo* spell_info) { - Eluna::Push(L, spell_info->IsBreakingStealth()); + ALE::Push(L, spell_info->IsBreakingStealth()); return 1; } @@ -622,7 +622,7 @@ namespace LuaSpellInfo */ int IsRangedWeaponSpell(lua_State* L, SpellInfo* spell_info) { - Eluna::Push(L, spell_info->IsRangedWeaponSpell()); + ALE::Push(L, spell_info->IsRangedWeaponSpell()); return 1; } @@ -633,7 +633,7 @@ namespace LuaSpellInfo */ int IsAutoRepeatRangedSpell(lua_State* L, SpellInfo* spell_info) { - Eluna::Push(L, spell_info->IsAutoRepeatRangedSpell()); + ALE::Push(L, spell_info->IsAutoRepeatRangedSpell()); return 1; } @@ -644,14 +644,14 @@ namespace LuaSpellInfo */ int IsAffectedBySpellMods(lua_State* L, SpellInfo* spell_info) { - Eluna::Push(L, spell_info->IsAffectedBySpellMods()); + ALE::Push(L, spell_info->IsAffectedBySpellMods()); return 1; } /* int IsAffectedBySpellMod(lua_State* L, SpellInfo* spell_info) { - const SpellInfo* auraSpellInfo = Eluna::CHECKOBJ(L, 2); - Eluna::Push(L, spell_info->IsAffectedBySpellMod(auraSpellInfo)); + const SpellInfo* auraSpellInfo = ALE::CHECKOBJ(L, 2); + ALE::Push(L, spell_info->IsAffectedBySpellMod(auraSpellInfo)); return 1; } */ @@ -664,8 +664,8 @@ namespace LuaSpellInfo */ int CanPierceImmuneAura(lua_State* L, SpellInfo* spell_info) { - const SpellInfo* auraSpellInfo = Eluna::CHECKOBJ(L, 2); - Eluna::Push(L, spell_info->CanPierceImmuneAura(auraSpellInfo)); + const SpellInfo* auraSpellInfo = ALE::CHECKOBJ(L, 2); + ALE::Push(L, spell_info->CanPierceImmuneAura(auraSpellInfo)); return 1; } @@ -677,8 +677,8 @@ namespace LuaSpellInfo */ int CanDispelAura(lua_State* L, SpellInfo* spell_info) { - const SpellInfo* auraSpellInfo = Eluna::CHECKOBJ(L, 2); - Eluna::Push(L, spell_info->CanDispelAura(auraSpellInfo)); + const SpellInfo* auraSpellInfo = ALE::CHECKOBJ(L, 2); + ALE::Push(L, spell_info->CanDispelAura(auraSpellInfo)); return 1; } @@ -689,7 +689,7 @@ namespace LuaSpellInfo */ int IsSingleTarget(lua_State* L, SpellInfo* spell_info) { - Eluna::Push(L, spell_info->IsSingleTarget()); + ALE::Push(L, spell_info->IsSingleTarget()); return 1; } @@ -701,8 +701,8 @@ namespace LuaSpellInfo */ int IsAuraExclusiveBySpecificWith(lua_State* L, SpellInfo* spell_info) { - const SpellInfo* spellInfo = Eluna::CHECKOBJ(L, 2); - Eluna::Push(L, spell_info->IsAuraExclusiveBySpecificWith(spellInfo)); + const SpellInfo* spellInfo = ALE::CHECKOBJ(L, 2); + ALE::Push(L, spell_info->IsAuraExclusiveBySpecificWith(spellInfo)); return 1; } @@ -714,8 +714,8 @@ namespace LuaSpellInfo */ int IsAuraExclusiveBySpecificPerCasterWith(lua_State* L, SpellInfo* spell_info) { - const SpellInfo* spellInfo = Eluna::CHECKOBJ(L, 2); - Eluna::Push(L, spell_info->IsAuraExclusiveBySpecificPerCasterWith(spellInfo)); + const SpellInfo* spellInfo = ALE::CHECKOBJ(L, 2); + ALE::Push(L, spell_info->IsAuraExclusiveBySpecificPerCasterWith(spellInfo)); return 1; } @@ -727,8 +727,8 @@ namespace LuaSpellInfo */ int CheckShapeshift(lua_State* L, SpellInfo* spell_info) { - uint32 form = Eluna::CHECKVAL(L, 2); - Eluna::Push(L, spell_info->CheckShapeshift(form)); + uint32 form = ALE::CHECKVAL(L, 2); + ALE::Push(L, spell_info->CheckShapeshift(form)); return 1; } @@ -744,13 +744,13 @@ namespace LuaSpellInfo */ int CheckLocation(lua_State* L, SpellInfo* spell_info) { - uint32 map_id = Eluna::CHECKVAL(L, 2); - uint32 zone_id = Eluna::CHECKVAL(L, 3); - uint32 area_id = Eluna::CHECKVAL(L, 4); - Player* player = Eluna::CHECKOBJ(L, 5); - bool strict = Eluna::CHECKVAL(L, 6, false); + uint32 map_id = ALE::CHECKVAL(L, 2); + uint32 zone_id = ALE::CHECKVAL(L, 3); + uint32 area_id = ALE::CHECKVAL(L, 4); + Player* player = ALE::CHECKOBJ(L, 5); + bool strict = ALE::CHECKVAL(L, 6, false); - Eluna::Push(L, spell_info->CheckLocation(map_id, zone_id, area_id, player, strict)); + ALE::Push(L, spell_info->CheckLocation(map_id, zone_id, area_id, player, strict)); return 1; } @@ -764,11 +764,11 @@ namespace LuaSpellInfo */ int CheckTarget(lua_State* L, SpellInfo* spell_info) { - const Unit* caster = Eluna::CHECKOBJ(L, 2); - const WorldObject* target = Eluna::CHECKOBJ(L, 3); - bool implicit = Eluna::CHECKVAL(L, 4, true); + const Unit* caster = ALE::CHECKOBJ(L, 2); + const WorldObject* target = ALE::CHECKOBJ(L, 3); + bool implicit = ALE::CHECKVAL(L, 4, true); - Eluna::Push(L, spell_info->CheckTarget(caster, target, implicit)); + ALE::Push(L, spell_info->CheckTarget(caster, target, implicit)); return 1; } @@ -782,11 +782,11 @@ namespace LuaSpellInfo */ int CheckExplicitTarget(lua_State* L, SpellInfo* spell_info) { - const Unit* caster = Eluna::CHECKOBJ(L, 2); - const WorldObject* target = Eluna::CHECKOBJ(L, 3); - const Item* item = Eluna::CHECKOBJ(L, 4, true); + const Unit* caster = ALE::CHECKOBJ(L, 2); + const WorldObject* target = ALE::CHECKOBJ(L, 3); + const Item* item = ALE::CHECKOBJ(L, 4, true); - Eluna::Push(L, spell_info->CheckExplicitTarget(caster, target, item)); + ALE::Push(L, spell_info->CheckExplicitTarget(caster, target, item)); return 1; } @@ -798,9 +798,9 @@ namespace LuaSpellInfo */ int CheckTargetCreatureType(lua_State* L, SpellInfo* spell_info) { - const Unit* target = Eluna::CHECKOBJ(L, 2); + const Unit* target = ALE::CHECKOBJ(L, 2); - Eluna::Push(L, spell_info->CheckTargetCreatureType(target)); + ALE::Push(L, spell_info->CheckTargetCreatureType(target)); return 1; } @@ -813,7 +813,7 @@ namespace LuaSpellInfo */ int GetSchoolMask(lua_State* L, SpellInfo* spell_info) { - Eluna::Push(L, spell_info->GetSchoolMask()); + ALE::Push(L, spell_info->GetSchoolMask()); return 1; } @@ -826,7 +826,7 @@ namespace LuaSpellInfo */ int GetAllEffectsMechanicMask(lua_State* L, SpellInfo* spell_info) { - Eluna::Push(L, spell_info->GetAllEffectsMechanicMask()); + ALE::Push(L, spell_info->GetAllEffectsMechanicMask()); return 1; } @@ -838,9 +838,9 @@ namespace LuaSpellInfo */ int GetEffectMechanicMask(lua_State* L, SpellInfo* spell_info) { - uint32 effIndex = Eluna::CHECKVAL(L, 2); + uint32 effIndex = ALE::CHECKVAL(L, 2); - Eluna::Push(L, spell_info->GetEffectMechanicMask(static_cast(effIndex))); + ALE::Push(L, spell_info->GetEffectMechanicMask(static_cast(effIndex))); return 1; } @@ -852,9 +852,9 @@ namespace LuaSpellInfo */ int GetSpellMechanicMaskByEffectMask(lua_State* L, SpellInfo* spell_info) { - uint32 effectmask = Eluna::CHECKVAL(L, 2); + uint32 effectmask = ALE::CHECKVAL(L, 2); - Eluna::Push(L, spell_info->GetSpellMechanicMaskByEffectMask(effectmask)); + ALE::Push(L, spell_info->GetSpellMechanicMaskByEffectMask(effectmask)); return 1; } @@ -866,9 +866,9 @@ namespace LuaSpellInfo */ int GetEffectMechanic(lua_State* L, SpellInfo* spell_info) { - uint32 effIndex = Eluna::CHECKVAL(L, 2); + uint32 effIndex = ALE::CHECKVAL(L, 2); - Eluna::Push(L, spell_info->GetEffectMechanic(static_cast(effIndex))); + ALE::Push(L, spell_info->GetEffectMechanic(static_cast(effIndex))); return 1; } @@ -882,9 +882,9 @@ namespace LuaSpellInfo */ int GetDispelMask(lua_State* L, SpellInfo* spell_info) { - uint32 type = Eluna::CHECKVAL(L, 2, false); + uint32 type = ALE::CHECKVAL(L, 2, false); - Eluna::Push(L, type != 0 ? spell_info->GetDispelMask(static_cast(type)) : spell_info->GetDispelMask()); + ALE::Push(L, type != 0 ? spell_info->GetDispelMask(static_cast(type)) : spell_info->GetDispelMask()); return 1; } @@ -897,7 +897,7 @@ namespace LuaSpellInfo */ int GetExplicitTargetMask(lua_State* L, SpellInfo* spell_info) { - Eluna::Push(L, spell_info->GetExplicitTargetMask()); + ALE::Push(L, spell_info->GetExplicitTargetMask()); return 1; } @@ -910,7 +910,7 @@ namespace LuaSpellInfo */ int GetAuraState(lua_State* L, SpellInfo* spell_info) { - Eluna::Push(L, spell_info->GetAuraState()); + ALE::Push(L, spell_info->GetAuraState()); return 1; } @@ -923,7 +923,7 @@ namespace LuaSpellInfo */ int GetSpellSpecific(lua_State* L, SpellInfo* spell_info) { - Eluna::Push(L, spell_info->GetSpellSpecific()); + ALE::Push(L, spell_info->GetSpellSpecific()); return 1; } } diff --git a/src/LuaEngine/methods/SpellMethods.h b/src/LuaEngine/methods/SpellMethods.h index c5283b1..52c14ef 100644 --- a/src/LuaEngine/methods/SpellMethods.h +++ b/src/LuaEngine/methods/SpellMethods.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 */ @@ -21,7 +21,7 @@ namespace LuaSpell */ int IsAutoRepeat(lua_State* L, Spell* spell) { - Eluna::Push(L, spell->IsAutoRepeat()); + ALE::Push(L, spell->IsAutoRepeat()); return 1; } @@ -32,7 +32,7 @@ namespace LuaSpell */ int GetCaster(lua_State* L, Spell* spell) { - Eluna::Push(L, spell->GetCaster()); + ALE::Push(L, spell->GetCaster()); return 1; } @@ -43,7 +43,7 @@ namespace LuaSpell */ int GetCastTime(lua_State* L, Spell* spell) { - Eluna::Push(L, spell->GetCastTime()); + ALE::Push(L, spell->GetCastTime()); return 1; } @@ -54,7 +54,7 @@ namespace LuaSpell */ int GetEntry(lua_State* L, Spell* spell) { - Eluna::Push(L, spell->m_spellInfo->Id); + ALE::Push(L, spell->m_spellInfo->Id); return 1; } @@ -65,7 +65,7 @@ namespace LuaSpell */ int GetPowerCost(lua_State* L, Spell* spell) { - Eluna::Push(L, spell->GetPowerCost()); + ALE::Push(L, spell->GetPowerCost()); return 1; } @@ -86,8 +86,8 @@ namespace LuaSpell continue; auto reagent = eObjectMgr->GetItemTemplate(reagents[i]); auto count = reagentCounts[i]; - Eluna::Push(L, reagent); - Eluna::Push(L, count); + ALE::Push(L, reagent); + ALE::Push(L, count); lua_settable(L, -3); } return 1; @@ -100,7 +100,7 @@ namespace LuaSpell */ int GetDuration(lua_State* L, Spell* spell) { - Eluna::Push(L, spell->GetSpellInfo()->GetDuration()); + ALE::Push(L, spell->GetSpellInfo()->GetDuration()); return 1; } @@ -118,9 +118,9 @@ namespace LuaSpell float x, y, z; spell->m_targets.GetDstPos()->GetPosition(x, y, z); - Eluna::Push(L, x); - Eluna::Push(L, y); - Eluna::Push(L, z); + ALE::Push(L, x); + ALE::Push(L, y); + ALE::Push(L, z); return 3; } @@ -139,15 +139,15 @@ namespace LuaSpell int GetTarget(lua_State* L, Spell* spell) { if (GameObject* target = spell->m_targets.GetGOTarget()) - Eluna::Push(L, target); + ALE::Push(L, target); else if (Item* target = spell->m_targets.GetItemTarget()) - Eluna::Push(L, target); + ALE::Push(L, target); else if (Corpse* target = spell->m_targets.GetCorpseTarget()) - Eluna::Push(L, target); + ALE::Push(L, target); else if (Unit* target = spell->m_targets.GetUnitTarget()) - Eluna::Push(L, target); + ALE::Push(L, target); else if (WorldObject* target = spell->m_targets.GetObjectTarget()) - Eluna::Push(L, target); + ALE::Push(L, target); return 1; } @@ -158,7 +158,7 @@ namespace LuaSpell */ int SetAutoRepeat(lua_State* L, Spell* spell) { - bool repeat = Eluna::CHECKVAL(L, 2); + bool repeat = ALE::CHECKVAL(L, 2); spell->SetAutoRepeat(repeat); return 0; } @@ -170,7 +170,7 @@ namespace LuaSpell */ int Cast(lua_State* L, Spell* spell) { - bool skipCheck = Eluna::CHECKVAL(L, 2, false); + bool skipCheck = ALE::CHECKVAL(L, 2, false); spell->cast(skipCheck); return 0; } diff --git a/src/LuaEngine/methods/TicketMethods.h b/src/LuaEngine/methods/TicketMethods.h index d0a0f1c..c158142 100644 --- a/src/LuaEngine/methods/TicketMethods.h +++ b/src/LuaEngine/methods/TicketMethods.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 */ @@ -21,7 +21,7 @@ namespace LuaTicket */ int IsClosed(lua_State* L, GmTicket* ticket) { - Eluna::Push(L, ticket->IsClosed()); + ALE::Push(L, ticket->IsClosed()); return 1; } @@ -32,7 +32,7 @@ namespace LuaTicket */ int IsCompleted(lua_State* L, GmTicket* ticket) { - Eluna::Push(L, ticket->IsCompleted()); + ALE::Push(L, ticket->IsCompleted()); return 1; } @@ -45,9 +45,9 @@ namespace LuaTicket */ int IsFromPlayer(lua_State* L, GmTicket* ticket) { - ObjectGuid guid = Eluna::CHECKVAL(L, 2); + ObjectGuid guid = ALE::CHECKVAL(L, 2); - Eluna::Push(L, ticket->IsFromPlayer(guid)); + ALE::Push(L, ticket->IsFromPlayer(guid)); return 1; } @@ -58,7 +58,7 @@ namespace LuaTicket */ int IsAssigned(lua_State* L, GmTicket* ticket) { - Eluna::Push(L, ticket->IsAssigned()); + ALE::Push(L, ticket->IsAssigned()); return 1; } @@ -71,9 +71,9 @@ namespace LuaTicket */ int IsAssignedTo(lua_State* L, GmTicket* ticket) { - ObjectGuid guid = Eluna::CHECKVAL(L, 2); + ObjectGuid guid = ALE::CHECKVAL(L, 2); - Eluna::Push(L, ticket->IsAssignedTo(guid)); + ALE::Push(L, ticket->IsAssignedTo(guid)); return 1; } @@ -86,9 +86,9 @@ namespace LuaTicket */ int IsAssignedNotTo(lua_State* L, GmTicket* ticket) { - ObjectGuid guid = Eluna::CHECKVAL(L, 2); + ObjectGuid guid = ALE::CHECKVAL(L, 2); - Eluna::Push(L, ticket->IsAssignedNotTo(guid)); + ALE::Push(L, ticket->IsAssignedNotTo(guid)); return 1; } @@ -99,7 +99,7 @@ namespace LuaTicket */ int GetId(lua_State* L, GmTicket* ticket) { - Eluna::Push(L, ticket->GetId()); + ALE::Push(L, ticket->GetId()); return 1; } @@ -110,7 +110,7 @@ namespace LuaTicket */ int GetPlayer(lua_State* L, GmTicket* ticket) { - Eluna::Push(L, ticket->GetPlayer()); + ALE::Push(L, ticket->GetPlayer()); return 1; } @@ -121,7 +121,7 @@ namespace LuaTicket */ int GetPlayerName(lua_State* L, GmTicket* ticket) { - Eluna::Push(L, ticket->GetPlayerName()); + ALE::Push(L, ticket->GetPlayerName()); return 1; } @@ -132,7 +132,7 @@ namespace LuaTicket */ int GetMessage(lua_State* L, GmTicket* ticket) { - Eluna::Push(L, ticket->GetMessage()); + ALE::Push(L, ticket->GetMessage()); return 1; } @@ -143,7 +143,7 @@ namespace LuaTicket */ int GetAssignedPlayer(lua_State* L, GmTicket* ticket) { - Eluna::Push(L, ticket->GetAssignedPlayer()); + ALE::Push(L, ticket->GetAssignedPlayer()); return 1; } @@ -154,7 +154,7 @@ namespace LuaTicket */ int GetAssignedToGUID(lua_State* L, GmTicket* ticket) { - Eluna::Push(L, ticket->GetAssignedToGUID()); + ALE::Push(L, ticket->GetAssignedToGUID()); return 1; } @@ -165,7 +165,7 @@ namespace LuaTicket */ int GetLastModifiedTime(lua_State* L, GmTicket* ticket) { - Eluna::Push(L, ticket->GetLastModifiedTime()); + ALE::Push(L, ticket->GetLastModifiedTime()); return 1; } @@ -177,8 +177,8 @@ namespace LuaTicket */ int SetAssignedTo(lua_State* L, GmTicket* ticket) { - ObjectGuid guid = Eluna::CHECKVAL(L, 2); - bool is_admin = Eluna::CHECKVAL(L, 2, false); + ObjectGuid guid = ALE::CHECKVAL(L, 2); + bool is_admin = ALE::CHECKVAL(L, 2, false); ticket->SetAssignedTo(guid, is_admin); return 0; } @@ -190,7 +190,7 @@ namespace LuaTicket */ int SetResolvedBy(lua_State* L, GmTicket* ticket) { - ObjectGuid guid = Eluna::CHECKVAL(L, 2); + ObjectGuid guid = ALE::CHECKVAL(L, 2); ticket->SetResolvedBy(guid); return 0; } @@ -213,7 +213,7 @@ namespace LuaTicket */ int SetMessage(lua_State* L, GmTicket* ticket) { - std::string message = Eluna::CHECKVAL(L, 2); + std::string message = ALE::CHECKVAL(L, 2); ticket->SetMessage(message); return 0; @@ -227,7 +227,7 @@ namespace LuaTicket */ int SetComment(lua_State* L, GmTicket* ticket) { - std::string comment = Eluna::CHECKVAL(L, 2); + std::string comment = ALE::CHECKVAL(L, 2); ticket->SetComment(comment); return 0; @@ -264,10 +264,10 @@ namespace LuaTicket */ int SetPosition(lua_State* L, GmTicket* ticket) { - uint32 mapId = Eluna::CHECKVAL(L, 2); - float x = Eluna::CHECKVAL(L, 2); - float y = Eluna::CHECKVAL(L, 2); - float z = Eluna::CHECKVAL(L, 2); + uint32 mapId = ALE::CHECKVAL(L, 2); + float x = ALE::CHECKVAL(L, 2); + float y = ALE::CHECKVAL(L, 2); + float z = ALE::CHECKVAL(L, 2); ticket->SetPosition(mapId, x, y, z); return 0; @@ -281,7 +281,7 @@ namespace LuaTicket */ int AppendResponse(lua_State* L, GmTicket* ticket) { - std::string response = Eluna::CHECKVAL(L, 2); + std::string response = ALE::CHECKVAL(L, 2); ticket->AppendResponse(response); return 0; @@ -294,7 +294,7 @@ namespace LuaTicket */ int GetResponse(lua_State* L, GmTicket* ticket) { - Eluna::Push(L, ticket->GetResponse()); + ALE::Push(L, ticket->GetResponse()); return 1; } @@ -315,7 +315,7 @@ namespace LuaTicket */ int GetChatLog(lua_State* L, GmTicket* ticket) { - Eluna::Push(L, ticket->GetChatLog()); + ALE::Push(L, ticket->GetChatLog()); return 1; } }; diff --git a/src/LuaEngine/methods/UnitMethods.h b/src/LuaEngine/methods/UnitMethods.h index b8ccf83..ff03073 100644 --- a/src/LuaEngine/methods/UnitMethods.h +++ b/src/LuaEngine/methods/UnitMethods.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 */ @@ -57,8 +57,8 @@ namespace LuaUnit */ int SetImmuneTo(lua_State* L, Unit* unit) { - int32 immunity = Eluna::CHECKVAL(L, 2); - bool apply = Eluna::CHECKVAL(L, 3, true); + int32 immunity = ALE::CHECKVAL(L, 2); + bool apply = ALE::CHECKVAL(L, 3, true); unit->ApplySpellImmune(0, 5, immunity, apply); return 0; @@ -75,13 +75,13 @@ namespace LuaUnit */ int HandleStatModifier(lua_State* L, Unit* unit) { - int32 stat = Eluna::CHECKVAL(L, 2); - int8 type = Eluna::CHECKVAL(L, 3); + int32 stat = ALE::CHECKVAL(L, 2); + int8 type = ALE::CHECKVAL(L, 3); - float value = Eluna::CHECKVAL(L, 4); - bool apply = Eluna::CHECKVAL(L, 5, false); + float value = ALE::CHECKVAL(L, 4); + bool apply = ALE::CHECKVAL(L, 5, false); - Eluna::Push(L, unit->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + stat), (UnitModifierType)type, value, apply)); + ALE::Push(L, unit->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + stat), (UnitModifierType)type, value, apply)); return 1; } @@ -94,10 +94,10 @@ namespace LuaUnit */ int Attack(lua_State* L, Unit* unit) { - Unit* who = Eluna::CHECKOBJ(L, 2); - bool meleeAttack = Eluna::CHECKVAL(L, 3, false); + Unit* who = ALE::CHECKOBJ(L, 2); + bool meleeAttack = ALE::CHECKVAL(L, 3, false); - Eluna::Push(L, unit->Attack(who, meleeAttack)); + ALE::Push(L, unit->Attack(who, meleeAttack)); return 1; } @@ -108,7 +108,7 @@ namespace LuaUnit */ int AttackStop(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->AttackStop()); + ALE::Push(L, unit->AttackStop()); return 1; } @@ -119,7 +119,7 @@ namespace LuaUnit */ int IsStandState(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->IsStandState()); + ALE::Push(L, unit->IsStandState()); return 1; } @@ -130,7 +130,7 @@ namespace LuaUnit */ int IsMounted(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->IsMounted()); + ALE::Push(L, unit->IsMounted()); return 1; } @@ -141,7 +141,7 @@ namespace LuaUnit */ int IsRooted(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->HasRootAura() || unit->HasUnitMovementFlag(MOVEMENTFLAG_ROOT)); + ALE::Push(L, unit->HasRootAura() || unit->HasUnitMovementFlag(MOVEMENTFLAG_ROOT)); return 1; } @@ -153,7 +153,7 @@ namespace LuaUnit */ int IsFullHealth(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->IsFullHealth()); + ALE::Push(L, unit->IsFullHealth()); return 1; } @@ -166,9 +166,9 @@ namespace LuaUnit */ int IsInAccessiblePlaceFor(lua_State* L, Unit* unit) { - Creature* creature = Eluna::CHECKOBJ(L, 2); + Creature* creature = ALE::CHECKOBJ(L, 2); - Eluna::Push(L, unit->isInAccessiblePlaceFor(creature)); + ALE::Push(L, unit->isInAccessiblePlaceFor(creature)); return 1; } @@ -180,7 +180,7 @@ namespace LuaUnit */ int IsAuctioneer(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->IsAuctioner()); + ALE::Push(L, unit->IsAuctioner()); return 1; } @@ -192,7 +192,7 @@ namespace LuaUnit */ int IsGuildMaster(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->IsGuildMaster()); + ALE::Push(L, unit->IsGuildMaster()); return 1; } @@ -203,7 +203,7 @@ namespace LuaUnit */ int IsInnkeeper(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->IsInnkeeper()); + ALE::Push(L, unit->IsInnkeeper()); return 1; } @@ -214,7 +214,7 @@ namespace LuaUnit */ int IsTrainer(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->IsTrainer()); + ALE::Push(L, unit->IsTrainer()); return 1; } @@ -225,7 +225,7 @@ namespace LuaUnit */ int IsGossip(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->IsGossip()); + ALE::Push(L, unit->IsGossip()); return 1; } @@ -236,7 +236,7 @@ namespace LuaUnit */ int IsTaxi(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->IsTaxi()); + ALE::Push(L, unit->IsTaxi()); return 1; } @@ -247,7 +247,7 @@ namespace LuaUnit */ int IsSpiritHealer(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->IsSpiritHealer()); + ALE::Push(L, unit->IsSpiritHealer()); return 1; } @@ -258,7 +258,7 @@ namespace LuaUnit */ int IsSpiritGuide(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->IsSpiritGuide()); + ALE::Push(L, unit->IsSpiritGuide()); return 1; } @@ -269,7 +269,7 @@ namespace LuaUnit */ int IsTabardDesigner(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->IsTabardDesigner()); + ALE::Push(L, unit->IsTabardDesigner()); return 1; } @@ -280,7 +280,7 @@ namespace LuaUnit */ int IsServiceProvider(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->IsServiceProvider()); + ALE::Push(L, unit->IsServiceProvider()); return 1; } @@ -291,7 +291,7 @@ namespace LuaUnit */ int IsSpiritService(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->IsSpiritService()); + ALE::Push(L, unit->IsSpiritService()); return 1; } @@ -302,7 +302,7 @@ namespace LuaUnit */ int IsAlive(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->IsAlive()); + ALE::Push(L, unit->IsAlive()); return 1; } @@ -313,7 +313,7 @@ namespace LuaUnit */ int IsDead(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->isDead()); + ALE::Push(L, unit->isDead()); return 1; } @@ -324,7 +324,7 @@ namespace LuaUnit */ int IsDying(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->isDying()); + ALE::Push(L, unit->isDying()); return 1; } @@ -335,7 +335,7 @@ namespace LuaUnit */ int IsBanker(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->IsBanker()); + ALE::Push(L, unit->IsBanker()); return 1; } @@ -346,7 +346,7 @@ namespace LuaUnit */ int IsVendor(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->IsVendor()); + ALE::Push(L, unit->IsVendor()); return 1; } @@ -357,7 +357,7 @@ namespace LuaUnit */ int IsBattleMaster(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->IsBattleMaster()); + ALE::Push(L, unit->IsBattleMaster()); return 1; } @@ -368,7 +368,7 @@ namespace LuaUnit */ int IsCharmed(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->IsCharmed()); + ALE::Push(L, unit->IsCharmed()); return 1; } @@ -379,7 +379,7 @@ namespace LuaUnit */ int IsArmorer(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->IsArmorer()); + ALE::Push(L, unit->IsArmorer()); return 1; } @@ -390,7 +390,7 @@ namespace LuaUnit */ int IsAttackingPlayer(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->isAttackingPlayer()); + ALE::Push(L, unit->isAttackingPlayer()); return 1; } @@ -401,7 +401,7 @@ namespace LuaUnit */ int IsPvPFlagged(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->IsPvP()); + ALE::Push(L, unit->IsPvP()); return 1; } @@ -412,7 +412,7 @@ namespace LuaUnit */ int IsOnVehicle(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->GetVehicle()); + ALE::Push(L, unit->GetVehicle()); return 1; } @@ -423,7 +423,7 @@ namespace LuaUnit */ int IsInCombat(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->IsInCombat()); + ALE::Push(L, unit->IsInCombat()); return 1; } @@ -434,7 +434,7 @@ namespace LuaUnit */ int IsUnderWater(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->IsUnderWater()); + ALE::Push(L, unit->IsUnderWater()); return 1; } @@ -445,7 +445,7 @@ namespace LuaUnit */ int IsInWater(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->IsInWater()); + ALE::Push(L, unit->IsInWater()); return 1; } @@ -456,7 +456,7 @@ namespace LuaUnit */ int IsStopped(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->IsStopped()); + ALE::Push(L, unit->IsStopped()); return 1; } @@ -467,7 +467,7 @@ namespace LuaUnit */ int IsQuestGiver(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->IsQuestGiver()); + ALE::Push(L, unit->IsQuestGiver()); return 1; } @@ -479,7 +479,7 @@ namespace LuaUnit */ int HealthBelowPct(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->HealthBelowPct(Eluna::CHECKVAL(L, 2))); + ALE::Push(L, unit->HealthBelowPct(ALE::CHECKVAL(L, 2))); return 1; } @@ -491,7 +491,7 @@ namespace LuaUnit */ int HealthAbovePct(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->HealthAbovePct(Eluna::CHECKVAL(L, 2))); + ALE::Push(L, unit->HealthAbovePct(ALE::CHECKVAL(L, 2))); return 1; } @@ -503,9 +503,9 @@ namespace LuaUnit */ int HasAura(lua_State* L, Unit* unit) { - uint32 spell = Eluna::CHECKVAL(L, 2); + uint32 spell = ALE::CHECKVAL(L, 2); - Eluna::Push(L, unit->HasAura(spell)); + ALE::Push(L, unit->HasAura(spell)); return 1; } @@ -516,7 +516,7 @@ namespace LuaUnit */ int IsCasting(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->HasUnitState(UNIT_STATE_CASTING)); + ALE::Push(L, unit->HasUnitState(UNIT_STATE_CASTING)); return 1; } @@ -528,26 +528,26 @@ namespace LuaUnit */ int HasUnitState(lua_State* L, Unit* unit) { - uint32 state = Eluna::CHECKVAL(L, 2); - Eluna::Push(L, unit->HasUnitState(state)); + uint32 state = ALE::CHECKVAL(L, 2); + ALE::Push(L, unit->HasUnitState(state)); return 1; } /*int IsVisible(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->IsVisible()); + ALE::Push(L, unit->IsVisible()); return 1; }*/ /*int IsMoving(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->isMoving()); + ALE::Push(L, unit->isMoving()); return 1; }*/ /*int IsFlying(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->IsFlying()); + ALE::Push(L, unit->IsFlying()); return 1; }*/ @@ -558,7 +558,7 @@ namespace LuaUnit */ int GetOwner(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->GetOwner()); + ALE::Push(L, unit->GetOwner()); return 1; } @@ -569,7 +569,7 @@ namespace LuaUnit */ int GetOwnerGUID(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->GetOwnerGUID()); + ALE::Push(L, unit->GetOwnerGUID()); return 1; } @@ -580,7 +580,7 @@ namespace LuaUnit */ int GetMountId(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->GetMountID()); + ALE::Push(L, unit->GetMountID()); return 1; } @@ -591,7 +591,7 @@ namespace LuaUnit */ int GetCreatorGUID(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->GetCreatorGUID()); + ALE::Push(L, unit->GetCreatorGUID()); return 1; } @@ -602,7 +602,7 @@ namespace LuaUnit */ int GetCharmerGUID(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->GetCharmerGUID()); + ALE::Push(L, unit->GetCharmerGUID()); return 1; } @@ -613,7 +613,7 @@ namespace LuaUnit */ int GetCharmGUID(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->GetCharmGUID()); + ALE::Push(L, unit->GetCharmGUID()); return 1; } @@ -624,7 +624,7 @@ namespace LuaUnit */ int GetPetGUID(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->GetPetGUID()); + ALE::Push(L, unit->GetPetGUID()); return 1; } @@ -635,7 +635,7 @@ namespace LuaUnit */ int GetControllerGUID(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->GetCharmerOrOwnerGUID()); + ALE::Push(L, unit->GetCharmerOrOwnerGUID()); return 1; } @@ -646,7 +646,7 @@ namespace LuaUnit */ int GetControllerGUIDS(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->GetCharmerOrOwnerOrOwnGUID()); + ALE::Push(L, unit->GetCharmerOrOwnerOrOwnGUID()); return 1; } @@ -658,12 +658,12 @@ namespace LuaUnit */ int GetStat(lua_State* L, Unit* unit) { - uint32 stat = Eluna::CHECKVAL(L, 2); + uint32 stat = ALE::CHECKVAL(L, 2); if (stat >= MAX_STATS) return 1; - Eluna::Push(L, unit->GetStat((Stats)stat)); + ALE::Push(L, unit->GetStat((Stats)stat)); return 1; } @@ -675,12 +675,12 @@ namespace LuaUnit */ int GetBaseSpellPower(lua_State* L, Unit* unit) { - uint32 spellschool = Eluna::CHECKVAL(L, 2); + uint32 spellschool = ALE::CHECKVAL(L, 2); if (spellschool >= MAX_SPELL_SCHOOL) return 1; - Eluna::Push(L, unit->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + spellschool)); + ALE::Push(L, unit->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + spellschool)); return 1; } @@ -691,7 +691,7 @@ namespace LuaUnit */ int GetVictim(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->GetVictim()); + ALE::Push(L, unit->GetVictim()); return 1; } @@ -713,11 +713,11 @@ namespace LuaUnit */ int GetCurrentSpell(lua_State* L, Unit* unit) { - uint32 type = Eluna::CHECKVAL(L, 2); + uint32 type = ALE::CHECKVAL(L, 2); if (type >= CURRENT_MAX_SPELL) return luaL_argerror(L, 2, "valid CurrentSpellTypes expected"); - Eluna::Push(L, unit->GetCurrentSpell(type)); + ALE::Push(L, unit->GetCurrentSpell(type)); return 1; } @@ -728,7 +728,7 @@ namespace LuaUnit */ int GetStandState(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->getStandState()); + ALE::Push(L, unit->getStandState()); return 1; } @@ -739,7 +739,7 @@ namespace LuaUnit */ int GetDisplayId(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->GetDisplayId()); + ALE::Push(L, unit->GetDisplayId()); return 1; } @@ -750,7 +750,7 @@ namespace LuaUnit */ int GetNativeDisplayId(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->GetNativeDisplayId()); + ALE::Push(L, unit->GetNativeDisplayId()); return 1; } @@ -761,7 +761,7 @@ namespace LuaUnit */ int GetLevel(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->GetLevel()); + ALE::Push(L, unit->GetLevel()); return 1; } @@ -772,7 +772,7 @@ namespace LuaUnit */ int GetHealth(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->GetHealth()); + ALE::Push(L, unit->GetHealth()); return 1; } @@ -809,10 +809,10 @@ namespace LuaUnit */ int GetPower(lua_State* L, Unit* unit) { - int type = Eluna::CHECKVAL(L, 2, -1); + int type = ALE::CHECKVAL(L, 2, -1); Powers power = PowerSelectorHelper(L, unit, type); - Eluna::Push(L, unit->GetPower(power)); + ALE::Push(L, unit->GetPower(power)); return 1; } @@ -838,10 +838,10 @@ namespace LuaUnit */ int GetMaxPower(lua_State* L, Unit* unit) { - int type = Eluna::CHECKVAL(L, 2, -1); + int type = ALE::CHECKVAL(L, 2, -1); Powers power = PowerSelectorHelper(L, unit, type); - Eluna::Push(L, unit->GetMaxPower(power)); + ALE::Push(L, unit->GetMaxPower(power)); return 1; } @@ -867,12 +867,12 @@ namespace LuaUnit */ int GetPowerPct(lua_State* L, Unit* unit) { - int type = Eluna::CHECKVAL(L, 2, -1); + int type = ALE::CHECKVAL(L, 2, -1); Powers power = PowerSelectorHelper(L, unit, type); float percent = ((float)unit->GetPower(power) / (float)unit->GetMaxPower(power)) * 100.0f; - Eluna::Push(L, percent); + ALE::Push(L, percent); return 1; } @@ -897,7 +897,7 @@ namespace LuaUnit */ int GetPowerType(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->getPowerType()); + ALE::Push(L, unit->getPowerType()); return 1; } @@ -908,7 +908,7 @@ namespace LuaUnit */ int GetMaxHealth(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->GetMaxHealth()); + ALE::Push(L, unit->GetMaxHealth()); return 1; } @@ -919,7 +919,7 @@ namespace LuaUnit */ int GetHealthPct(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->GetHealthPct()); + ALE::Push(L, unit->GetHealthPct()); return 1; } @@ -930,7 +930,7 @@ namespace LuaUnit */ int GetGender(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->getGender()); + ALE::Push(L, unit->getGender()); return 1; } @@ -941,7 +941,7 @@ namespace LuaUnit */ int GetRace(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->getRace()); + ALE::Push(L, unit->getRace()); return 1; } @@ -952,7 +952,7 @@ namespace LuaUnit */ int GetClass(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->getClass()); + ALE::Push(L, unit->getClass()); return 1; } @@ -963,7 +963,7 @@ namespace LuaUnit */ int GetRaceMask(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->getRaceMask()); + ALE::Push(L, unit->getRaceMask()); return 1; } @@ -974,7 +974,7 @@ namespace LuaUnit */ int GetClassMask(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->getClassMask()); + ALE::Push(L, unit->getClassMask()); return 1; } @@ -1004,7 +1004,7 @@ namespace LuaUnit */ int GetCreatureType(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->GetCreatureType()); + ALE::Push(L, unit->GetCreatureType()); return 1; } @@ -1031,7 +1031,7 @@ namespace LuaUnit */ int GetClassAsString(lua_State* L, Unit* unit) { - uint8 locale = Eluna::CHECKVAL(L, 2, DEFAULT_LOCALE); + uint8 locale = ALE::CHECKVAL(L, 2, DEFAULT_LOCALE); if (locale >= TOTAL_LOCALES) return luaL_argerror(L, 2, "valid LocaleConstant expected"); @@ -1039,7 +1039,7 @@ namespace LuaUnit if (!entry) return 1; - Eluna::Push(L, entry->name[locale]); + ALE::Push(L, entry->name[locale]); return 1; } @@ -1066,7 +1066,7 @@ namespace LuaUnit */ int GetRaceAsString(lua_State* L, Unit* unit) { - uint8 locale = Eluna::CHECKVAL(L, 2, DEFAULT_LOCALE); + uint8 locale = ALE::CHECKVAL(L, 2, DEFAULT_LOCALE); if (locale >= TOTAL_LOCALES) return luaL_argerror(L, 2, "valid LocaleConstant expected"); @@ -1074,7 +1074,7 @@ namespace LuaUnit if (!entry) return 1; - Eluna::Push(L, entry->name[locale]); + ALE::Push(L, entry->name[locale]); return 1; } @@ -1085,7 +1085,7 @@ namespace LuaUnit */ int GetFaction(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->GetFaction()); + ALE::Push(L, unit->GetFaction()); return 1; } @@ -1097,8 +1097,8 @@ namespace LuaUnit */ int GetAura(lua_State* L, Unit* unit) { - uint32 spellID = Eluna::CHECKVAL(L, 2); - Eluna::Push(L, unit->GetAura(spellID)); + uint32 spellID = ALE::CHECKVAL(L, 2); + ALE::Push(L, unit->GetAura(spellID)); return 1; } @@ -1110,7 +1110,7 @@ namespace LuaUnit */ int GetFriendlyUnitsInRange(lua_State* L, Unit* unit) { - float range = Eluna::CHECKVAL(L, 2, SIZE_OF_GRIDS); + float range = ALE::CHECKVAL(L, 2, SIZE_OF_GRIDS); std::list list; @@ -1118,7 +1118,7 @@ namespace LuaUnit Acore::UnitListSearcher searcher(unit, list, checker); Cell::VisitObjects(unit, searcher, range); - ElunaUtil::ObjectGUIDCheck guidCheck(unit->GET_GUID()); + ALEUtil::ObjectGUIDCheck guidCheck(unit->GET_GUID()); list.remove_if(guidCheck); lua_createtable(L, list.size(), 0); @@ -1127,7 +1127,7 @@ namespace LuaUnit for (std::list::const_iterator it = list.begin(); it != list.end(); ++it) { - Eluna::Push(L, *it); + ALE::Push(L, *it); lua_rawseti(L, tbl, ++i); } @@ -1143,13 +1143,13 @@ namespace LuaUnit */ int GetUnfriendlyUnitsInRange(lua_State* L, Unit* unit) { - float range = Eluna::CHECKVAL(L, 2, SIZE_OF_GRIDS); + float range = ALE::CHECKVAL(L, 2, SIZE_OF_GRIDS); std::list list; Acore::AnyUnfriendlyUnitInObjectRangeCheck checker(unit, unit, range); Acore::UnitListSearcher searcher(unit, list, checker); Cell::VisitObjects(unit, searcher, range); - ElunaUtil::ObjectGUIDCheck guidCheck(unit->GET_GUID()); + ALEUtil::ObjectGUIDCheck guidCheck(unit->GET_GUID()); list.remove_if(guidCheck); lua_createtable(L, list.size(), 0); @@ -1158,7 +1158,7 @@ namespace LuaUnit for (std::list::const_iterator it = list.begin(); it != list.end(); ++it) { - Eluna::Push(L, *it); + ALE::Push(L, *it); lua_rawseti(L, tbl, ++i); } @@ -1173,13 +1173,13 @@ namespace LuaUnit */ int GetVehicleKit(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->GetVehicleKit()); + ALE::Push(L, unit->GetVehicleKit()); return 1; } /*int GetVehicle(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->GetVehicle()); + ALE::Push(L, unit->GetVehicle()); return 1; }*/ @@ -1190,7 +1190,7 @@ namespace LuaUnit */ int GetCritterGUID(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->GetCritterGUID()); + ALE::Push(L, unit->GetCritterGUID()); return 1; } @@ -1217,11 +1217,11 @@ namespace LuaUnit */ int GetSpeed(lua_State* L, Unit* unit) { - uint32 type = Eluna::CHECKVAL(L, 2); + uint32 type = ALE::CHECKVAL(L, 2); if (type >= MAX_MOVE_TYPE) return luaL_argerror(L, 2, "valid UnitMoveType expected"); - Eluna::Push(L, unit->GetSpeed((UnitMoveType)type)); + ALE::Push(L, unit->GetSpeed((UnitMoveType)type)); return 1; } @@ -1249,13 +1249,13 @@ namespace LuaUnit */ int GetSpeedRate(lua_State* L, Unit* unit) { - uint32 type = Eluna::CHECKVAL(L, 2); + uint32 type = ALE::CHECKVAL(L, 2); if (type >= MAX_MOVE_TYPE) { return luaL_argerror(L, 2, "valid UnitMoveType expected"); } - Eluna::Push(L, unit->GetSpeedRate((UnitMoveType)type)); + ALE::Push(L, unit->GetSpeedRate((UnitMoveType)type)); return 1; } @@ -1294,7 +1294,7 @@ namespace LuaUnit */ int GetMovementType(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->GetMotionMaster()->GetCurrentMovementGeneratorType()); + ALE::Push(L, unit->GetMotionMaster()->GetCurrentMovementGeneratorType()); return 1; } @@ -1317,7 +1317,7 @@ namespace LuaUnit continue; } - Eluna::Push(L, attacker); + ALE::Push(L, attacker); lua_rawseti(L, table, i); ++i; } @@ -1333,7 +1333,7 @@ namespace LuaUnit */ int SetOwnerGUID(lua_State* L, Unit* unit) { - ObjectGuid guid = Eluna::CHECKVAL(L, 2); + ObjectGuid guid = ALE::CHECKVAL(L, 2); unit->SetOwnerGUID(guid); return 0; @@ -1346,7 +1346,7 @@ namespace LuaUnit */ int SetPvP(lua_State* L, Unit* unit) { - bool apply = Eluna::CHECKVAL(L, 2, true); + bool apply = ALE::CHECKVAL(L, 2, true); unit->SetPvP(apply); return 0; @@ -1366,7 +1366,7 @@ namespace LuaUnit */ int SetSheath(lua_State* L, Unit* unit) { - uint32 sheathed = Eluna::CHECKVAL(L, 2); + uint32 sheathed = ALE::CHECKVAL(L, 2); if (sheathed >= MAX_SHEATH_STATE) return luaL_argerror(L, 2, "valid SheathState expected"); @@ -1381,7 +1381,7 @@ namespace LuaUnit */ int SetName(lua_State* L, Unit* unit) { - const char* name = Eluna::CHECKVAL(L, 2); + const char* name = ALE::CHECKVAL(L, 2); if (std::string(name).length() > 0) unit->SetName(name); return 0; @@ -1412,9 +1412,9 @@ namespace LuaUnit */ int SetSpeed(lua_State* L, Unit* unit) { - uint32 type = Eluna::CHECKVAL(L, 2); - float rate = Eluna::CHECKVAL(L, 3); - bool forced = Eluna::CHECKVAL(L, 4, false); + uint32 type = ALE::CHECKVAL(L, 2); + float rate = ALE::CHECKVAL(L, 3); + bool forced = ALE::CHECKVAL(L, 4, false); (void)forced; // ensure that the variable is referenced in order to pass compiler checks if (type >= MAX_MOVE_TYPE) return luaL_argerror(L, 2, "valid UnitMoveType expected"); @@ -1449,8 +1449,8 @@ namespace LuaUnit */ int SetSpeedRate(lua_State* L, Unit* unit) { - uint32 type = Eluna::CHECKVAL(L, 2); - float rate = Eluna::CHECKVAL(L, 3); + uint32 type = ALE::CHECKVAL(L, 2); + float rate = ALE::CHECKVAL(L, 3); if (type >= MAX_MOVE_TYPE) return luaL_argerror(L, 2, "valid UnitMoveType expected"); @@ -1466,7 +1466,7 @@ namespace LuaUnit */ int SetFaction(lua_State* L, Unit* unit) { - uint32 factionId = Eluna::CHECKVAL(L, 2); + uint32 factionId = ALE::CHECKVAL(L, 2); unit->SetFaction(factionId); @@ -1480,7 +1480,7 @@ namespace LuaUnit */ int SetLevel(lua_State* L, Unit* unit) { - uint8 newlevel = Eluna::CHECKVAL(L, 2); + uint8 newlevel = ALE::CHECKVAL(L, 2); if (newlevel < 1) return luaL_argerror(L, 2, "level cannot be below 1"); @@ -1504,7 +1504,7 @@ namespace LuaUnit */ int SetHealth(lua_State* L, Unit* unit) { - uint32 amt = Eluna::CHECKVAL(L, 2); + uint32 amt = ALE::CHECKVAL(L, 2); unit->SetHealth(amt); return 0; } @@ -1516,7 +1516,7 @@ namespace LuaUnit */ int SetMaxHealth(lua_State* L, Unit* unit) { - uint32 amt = Eluna::CHECKVAL(L, 2); + uint32 amt = ALE::CHECKVAL(L, 2); unit->SetMaxHealth(amt); return 0; } @@ -1543,8 +1543,8 @@ namespace LuaUnit */ int SetPower(lua_State* L, Unit* unit) { - uint32 amt = Eluna::CHECKVAL(L, 2); - int type = Eluna::CHECKVAL(L, 3, -1); + uint32 amt = ALE::CHECKVAL(L, 2); + int type = ALE::CHECKVAL(L, 3, -1); Powers power = PowerSelectorHelper(L, unit, type); unit->SetPower(power, amt); @@ -1573,8 +1573,8 @@ namespace LuaUnit */ int ModifyPower(lua_State* L, Unit* unit) { - int32 amt = Eluna::CHECKVAL(L, 2); - int type = Eluna::CHECKVAL(L, 3, -1); + int32 amt = ALE::CHECKVAL(L, 2); + int type = ALE::CHECKVAL(L, 3, -1); Powers power = PowerSelectorHelper(L, unit, type); unit->ModifyPower(power, amt); @@ -1603,8 +1603,8 @@ namespace LuaUnit */ int SetMaxPower(lua_State* L, Unit* unit) { - int type = Eluna::CHECKVAL(L, 2, -1); - uint32 amt = Eluna::CHECKVAL(L, 3); + int type = ALE::CHECKVAL(L, 2, -1); + uint32 amt = ALE::CHECKVAL(L, 3); Powers power = PowerSelectorHelper(L, unit, type); unit->SetMaxPower(power, amt); @@ -1632,7 +1632,7 @@ namespace LuaUnit */ int SetPowerType(lua_State* L, Unit* unit) { - uint32 type = Eluna::CHECKVAL(L, 2); + uint32 type = ALE::CHECKVAL(L, 2); if (type >= int(MAX_POWERS)) return luaL_argerror(L, 2, "valid Powers expected"); @@ -1647,7 +1647,7 @@ namespace LuaUnit */ int SetDisplayId(lua_State* L, Unit* unit) { - uint32 model = Eluna::CHECKVAL(L, 2); + uint32 model = ALE::CHECKVAL(L, 2); unit->SetDisplayId(model); return 0; } @@ -1659,7 +1659,7 @@ namespace LuaUnit */ int SetNativeDisplayId(lua_State* L, Unit* unit) { - uint32 model = Eluna::CHECKVAL(L, 2); + uint32 model = ALE::CHECKVAL(L, 2); unit->SetNativeDisplayId(model); return 0; } @@ -1671,7 +1671,7 @@ namespace LuaUnit */ int SetFacing(lua_State* L, Unit* unit) { - float o = Eluna::CHECKVAL(L, 2); + float o = ALE::CHECKVAL(L, 2); unit->SetFacingTo(o); return 0; } @@ -1683,7 +1683,7 @@ namespace LuaUnit */ int SetFacingToObject(lua_State* L, Unit* unit) { - WorldObject* obj = Eluna::CHECKOBJ(L, 2); + WorldObject* obj = ALE::CHECKOBJ(L, 2); unit->SetFacingToObject(obj); return 0; } @@ -1695,7 +1695,7 @@ namespace LuaUnit */ int SetCreatorGUID(lua_State* L, Unit* unit) { - ObjectGuid guid = Eluna::CHECKVAL(L, 2); + ObjectGuid guid = ALE::CHECKVAL(L, 2); unit->SetCreatorGUID(guid); return 0; } @@ -1707,7 +1707,7 @@ namespace LuaUnit */ int SetPetGUID(lua_State* L, Unit* unit) { - ObjectGuid guid = Eluna::CHECKVAL(L, 2); + ObjectGuid guid = ALE::CHECKVAL(L, 2); unit->SetPetGUID(guid); return 0; } @@ -1719,7 +1719,7 @@ namespace LuaUnit */ int SetWaterWalk(lua_State* L, Unit* unit) { - bool enable = Eluna::CHECKVAL(L, 2, true); + bool enable = ALE::CHECKVAL(L, 2, true); unit->SetWaterWalking(enable); return 0; } @@ -1731,7 +1731,7 @@ namespace LuaUnit */ int SetStandState(lua_State* L, Unit* unit) { - uint8 state = Eluna::CHECKVAL(L, 2); + uint8 state = ALE::CHECKVAL(L, 2); unit->SetStandState(state); return 0; } @@ -1743,7 +1743,7 @@ namespace LuaUnit */ int SetInCombatWith(lua_State* L, Unit* unit) { - Unit* enemy = Eluna::CHECKOBJ(L, 2); + Unit* enemy = ALE::CHECKOBJ(L, 2); unit->SetInCombatWith(enemy); return 0; } @@ -1755,7 +1755,7 @@ namespace LuaUnit */ int SetFFA(lua_State* L, Unit* unit) { - bool apply = Eluna::CHECKVAL(L, 2, true); + bool apply = ALE::CHECKVAL(L, 2, true); if (apply) { @@ -1779,7 +1779,7 @@ namespace LuaUnit */ int SetSanctuary(lua_State* L, Unit* unit) { - bool apply = Eluna::CHECKVAL(L, 2, true); + bool apply = ALE::CHECKVAL(L, 2, true); if (apply) { @@ -1802,14 +1802,14 @@ namespace LuaUnit */ int SetCritterGUID(lua_State* L, Unit* unit) { - ObjectGuid guid = Eluna::CHECKVAL(L, 2); + ObjectGuid guid = ALE::CHECKVAL(L, 2); unit->SetCritterGUID(guid); return 0; } /*int SetStunned(lua_State* L, Unit* unit) { - bool apply = Eluna::CHECKVAL(L, 2, true); + bool apply = ALE::CHECKVAL(L, 2, true); unit->SetControlled(apply, UNIT_STATE_STUNNED); return 0; }*/ @@ -1821,7 +1821,7 @@ namespace LuaUnit */ int SetRooted(lua_State* L, Unit* unit) { - bool apply = Eluna::CHECKVAL(L, 2, true); + bool apply = ALE::CHECKVAL(L, 2, true); unit->SetControlled(apply, UNIT_STATE_ROOT); return 0; } @@ -1833,7 +1833,7 @@ namespace LuaUnit */ int SetConfused(lua_State* L, Unit* unit) { - bool apply = Eluna::CHECKVAL(L, 2, true); + bool apply = ALE::CHECKVAL(L, 2, true); unit->SetControlled(apply, UNIT_STATE_CONFUSED); return 0; } @@ -1845,21 +1845,21 @@ namespace LuaUnit */ int SetFeared(lua_State* L, Unit* unit) { - bool apply = Eluna::CHECKVAL(L, 2, true); + bool apply = ALE::CHECKVAL(L, 2, true); unit->SetControlled(apply, UNIT_STATE_FLEEING); return 0; } /*int SetCanFly(lua_State* L, Unit* unit) { - bool apply = Eluna::CHECKVAL(L, 2, true); + bool apply = ALE::CHECKVAL(L, 2, true); unit->SetCanFly(apply); return 0; }*/ /*int SetVisible(lua_State* L, Unit* unit) { - bool x = Eluna::CHECKVAL(L, 2, true); + bool x = ALE::CHECKVAL(L, 2, true); unit->SetVisible(x); return 0; }*/ @@ -1882,7 +1882,7 @@ namespace LuaUnit { if (!unit->CanHaveThreatList()) { - Eluna::Push(L); + ALE::Push(L); return 1; } @@ -1903,7 +1903,7 @@ namespace LuaUnit continue; } - Eluna::Push(L, victim); + ALE::Push(L, victim); lua_rawseti(L, table, i); ++i; } @@ -1919,7 +1919,7 @@ namespace LuaUnit */ int Mount(lua_State* L, Unit* unit) { - uint32 displayId = Eluna::CHECKVAL(L, 2); + uint32 displayId = ALE::CHECKVAL(L, 2); unit->Mount(displayId); return 0; @@ -1946,7 +1946,7 @@ namespace LuaUnit */ int PerformEmote(lua_State* L, Unit* unit) { - unit->HandleEmoteCommand(Eluna::CHECKVAL(L, 2)); + unit->HandleEmoteCommand(ALE::CHECKVAL(L, 2)); return 0; } @@ -1957,7 +1957,7 @@ namespace LuaUnit */ int EmoteState(lua_State* L, Unit* unit) { - uint32 emoteId = Eluna::CHECKVAL(L, 2); + uint32 emoteId = ALE::CHECKVAL(L, 2); unit->SetUInt32Value(UNIT_NPC_EMOTESTATE, emoteId); return 0; @@ -1970,7 +1970,7 @@ namespace LuaUnit */ int CountPctFromCurHealth(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->CountPctFromCurHealth(Eluna::CHECKVAL(L, 2))); + ALE::Push(L, unit->CountPctFromCurHealth(ALE::CHECKVAL(L, 2))); return 1; } @@ -1981,7 +1981,7 @@ namespace LuaUnit */ int CountPctFromMaxHealth(lua_State* L, Unit* unit) { - Eluna::Push(L, unit->CountPctFromMaxHealth(Eluna::CHECKVAL(L, 2))); + ALE::Push(L, unit->CountPctFromMaxHealth(ALE::CHECKVAL(L, 2))); return 1; } @@ -1995,10 +1995,10 @@ namespace LuaUnit */ int SendChatMessageToPlayer(lua_State* L, Unit* unit) { - uint8 type = Eluna::CHECKVAL(L, 2); - uint32 lang = Eluna::CHECKVAL(L, 3); - std::string msg = Eluna::CHECKVAL(L, 4); - Player* target = Eluna::CHECKOBJ(L, 5); + uint8 type = ALE::CHECKVAL(L, 2); + uint32 lang = ALE::CHECKVAL(L, 3); + std::string msg = ALE::CHECKVAL(L, 4); + Player* target = ALE::CHECKOBJ(L, 5); if (type >= MAX_CHAT_MSG_TYPE) return luaL_argerror(L, 2, "valid ChatMsg expected"); @@ -2034,7 +2034,7 @@ namespace LuaUnit */ int MoveExpire(lua_State* L, Unit* unit) { - bool reset = Eluna::CHECKVAL(L, 2, true); + bool reset = ALE::CHECKVAL(L, 2, true); unit->GetMotionMaster()->MovementExpired(reset); return 0; } @@ -2046,7 +2046,7 @@ namespace LuaUnit */ int MoveClear(lua_State* L, Unit* unit) { - bool reset = Eluna::CHECKVAL(L, 2, true); + bool reset = ALE::CHECKVAL(L, 2, true); unit->GetMotionMaster()->Clear(reset); return 0; } @@ -2067,7 +2067,7 @@ namespace LuaUnit */ int MoveRandom(lua_State* L, Unit* unit) { - float radius = Eluna::CHECKVAL(L, 2); + float radius = ALE::CHECKVAL(L, 2); float x, y, z; unit->GetPosition(x, y, z); unit->GetMotionMaster()->MoveRandom(radius); @@ -2092,9 +2092,9 @@ namespace LuaUnit */ int MoveFollow(lua_State* L, Unit* unit) { - Unit* target = Eluna::CHECKOBJ(L, 2); - float dist = Eluna::CHECKVAL(L, 3, 0.0f); - float angle = Eluna::CHECKVAL(L, 4, 0.0f); + Unit* target = ALE::CHECKOBJ(L, 2); + float dist = ALE::CHECKVAL(L, 3, 0.0f); + float angle = ALE::CHECKVAL(L, 4, 0.0f); unit->GetMotionMaster()->MoveFollow(target, dist, angle); return 0; } @@ -2108,9 +2108,9 @@ namespace LuaUnit */ int MoveChase(lua_State* L, Unit* unit) { - Unit* target = Eluna::CHECKOBJ(L, 2); - float dist = Eluna::CHECKVAL(L, 3, 0.0f); - float angle = Eluna::CHECKVAL(L, 4, 0.0f); + Unit* target = ALE::CHECKOBJ(L, 2); + float dist = ALE::CHECKVAL(L, 3, 0.0f); + float angle = ALE::CHECKVAL(L, 4, 0.0f); unit->GetMotionMaster()->MoveChase(target, dist, angle); return 0; } @@ -2132,8 +2132,8 @@ namespace LuaUnit */ int MoveFleeing(lua_State* L, Unit* unit) { - Unit* target = Eluna::CHECKOBJ(L, 2); - uint32 time = Eluna::CHECKVAL(L, 3, 0); + Unit* target = ALE::CHECKOBJ(L, 2); + uint32 time = ALE::CHECKVAL(L, 3, 0); unit->GetMotionMaster()->MoveFleeing(target, time); return 0; } @@ -2149,11 +2149,11 @@ namespace LuaUnit */ int MoveTo(lua_State* L, Unit* unit) { - uint32 id = Eluna::CHECKVAL(L, 2); - float x = Eluna::CHECKVAL(L, 3); - float y = Eluna::CHECKVAL(L, 4); - float z = Eluna::CHECKVAL(L, 5); - bool genPath = Eluna::CHECKVAL(L, 6, true); + uint32 id = ALE::CHECKVAL(L, 2); + float x = ALE::CHECKVAL(L, 3); + float y = ALE::CHECKVAL(L, 4); + float z = ALE::CHECKVAL(L, 5); + bool genPath = ALE::CHECKVAL(L, 6, true); unit->GetMotionMaster()->MovePoint(id, x, y, z, FORCED_MOVEMENT_NONE, 0.f, 0.f, genPath); return 0; } @@ -2170,12 +2170,12 @@ namespace LuaUnit */ int MoveJump(lua_State* L, Unit* unit) { - float x = Eluna::CHECKVAL(L, 2); - float y = Eluna::CHECKVAL(L, 3); - float z = Eluna::CHECKVAL(L, 4); - float zSpeed = Eluna::CHECKVAL(L, 5); - float maxHeight = Eluna::CHECKVAL(L, 6); - uint32 id = Eluna::CHECKVAL(L, 7, 0); + float x = ALE::CHECKVAL(L, 2); + float y = ALE::CHECKVAL(L, 3); + float z = ALE::CHECKVAL(L, 4); + float zSpeed = ALE::CHECKVAL(L, 5); + float maxHeight = ALE::CHECKVAL(L, 6); + uint32 id = ALE::CHECKVAL(L, 7, 0); Position pos(x, y, z); unit->GetMotionMaster()->MoveJump(pos, zSpeed, maxHeight, id); return 0; @@ -2191,11 +2191,11 @@ namespace LuaUnit */ int SendUnitWhisper(lua_State* L, Unit* unit) { - const char* msg = Eluna::CHECKVAL(L, 2); - uint32 lang = Eluna::CHECKVAL(L, 3); + const char* msg = ALE::CHECKVAL(L, 2); + uint32 lang = ALE::CHECKVAL(L, 3); (void)lang; // ensure that the variable is referenced in order to pass compiler checks - Player* receiver = Eluna::CHECKOBJ(L, 4); - bool bossWhisper = Eluna::CHECKVAL(L, 5, false); + Player* receiver = ALE::CHECKOBJ(L, 4); + bool bossWhisper = ALE::CHECKVAL(L, 5, false); if (std::string(msg).length() > 0) unit->Whisper(msg, (Language)lang, receiver, bossWhisper); return 0; @@ -2210,9 +2210,9 @@ namespace LuaUnit */ int SendUnitEmote(lua_State* L, Unit* unit) { - const char* msg = Eluna::CHECKVAL(L, 2); - Unit* receiver = Eluna::CHECKOBJ(L, 3, false); - bool bossEmote = Eluna::CHECKVAL(L, 4, false); + const char* msg = ALE::CHECKVAL(L, 2); + Unit* receiver = ALE::CHECKOBJ(L, 3, false); + bool bossEmote = ALE::CHECKVAL(L, 4, false); if (std::string(msg).length() > 0) unit->TextEmote(msg, receiver, bossEmote); return 0; @@ -2226,8 +2226,8 @@ namespace LuaUnit */ int SendUnitSay(lua_State* L, Unit* unit) { - const char* msg = Eluna::CHECKVAL(L, 2); - uint32 language = Eluna::CHECKVAL(L, 3); + const char* msg = ALE::CHECKVAL(L, 2); + uint32 language = ALE::CHECKVAL(L, 3); if (std::string(msg).length() > 0) unit->Say(msg, (Language)language, unit); return 0; @@ -2241,8 +2241,8 @@ namespace LuaUnit */ int SendUnitYell(lua_State* L, Unit* unit) { - const char* msg = Eluna::CHECKVAL(L, 2); - uint32 language = Eluna::CHECKVAL(L, 3); + const char* msg = ALE::CHECKVAL(L, 2); + uint32 language = ALE::CHECKVAL(L, 3); if (std::string(msg).length() > 0) unit->Yell(msg, (Language)language, unit); return 0; @@ -2266,9 +2266,9 @@ namespace LuaUnit */ int CastSpell(lua_State* L, Unit* unit) { - Unit* target = Eluna::CHECKOBJ(L, 2, false); - uint32 spell = Eluna::CHECKVAL(L, 3); - bool triggered = Eluna::CHECKVAL(L, 4, false); + Unit* target = ALE::CHECKOBJ(L, 2, false); + uint32 spell = ALE::CHECKVAL(L, 3); + bool triggered = ALE::CHECKVAL(L, 4, false); SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(spell); if (!spellEntry) return 0; @@ -2292,17 +2292,17 @@ namespace LuaUnit */ int CastCustomSpell(lua_State* L, Unit* unit) { - Unit* target = Eluna::CHECKOBJ(L, 2, false); - uint32 spell = Eluna::CHECKVAL(L, 3); - bool triggered = Eluna::CHECKVAL(L, 4, false); + Unit* target = ALE::CHECKOBJ(L, 2, false); + uint32 spell = ALE::CHECKVAL(L, 3); + bool triggered = ALE::CHECKVAL(L, 4, false); bool has_bp0 = !lua_isnoneornil(L, 5); - int32 bp0 = Eluna::CHECKVAL(L, 5, 0); + int32 bp0 = ALE::CHECKVAL(L, 5, 0); bool has_bp1 = !lua_isnoneornil(L, 6); - int32 bp1 = Eluna::CHECKVAL(L, 6, 0); + int32 bp1 = ALE::CHECKVAL(L, 6, 0); bool has_bp2 = !lua_isnoneornil(L, 7); - int32 bp2 = Eluna::CHECKVAL(L, 7, 0); - Item* castItem = Eluna::CHECKOBJ(L, 8, false); - ObjectGuid originalCaster = Eluna::CHECKVAL(L, 9, ObjectGuid()); + int32 bp2 = ALE::CHECKVAL(L, 7, 0); + Item* castItem = ALE::CHECKOBJ(L, 8, false); + ObjectGuid originalCaster = ALE::CHECKVAL(L, 9, ObjectGuid()); unit->CastCustomSpell(target, spell, has_bp0 ? &bp0 : NULL, has_bp1 ? &bp1 : NULL, has_bp2 ? &bp2 : NULL, triggered, castItem, NULL, ObjectGuid(originalCaster)); return 0; @@ -2319,11 +2319,11 @@ namespace LuaUnit */ int CastSpellAoF(lua_State* L, Unit* unit) { - float _x = Eluna::CHECKVAL(L, 2); - float _y = Eluna::CHECKVAL(L, 3); - float _z = Eluna::CHECKVAL(L, 4); - uint32 spell = Eluna::CHECKVAL(L, 5); - bool triggered = Eluna::CHECKVAL(L, 6, true); + float _x = ALE::CHECKVAL(L, 2); + float _y = ALE::CHECKVAL(L, 3); + float _z = ALE::CHECKVAL(L, 4); + uint32 spell = ALE::CHECKVAL(L, 5); + bool triggered = ALE::CHECKVAL(L, 6, true); unit->CastSpell(_x, _y, _z, spell, triggered); return 0; } @@ -2344,7 +2344,7 @@ namespace LuaUnit */ int StopSpellCast(lua_State* L, Unit* unit) { - uint32 spellId = Eluna::CHECKVAL(L, 2, 0); + uint32 spellId = ALE::CHECKVAL(L, 2, 0); unit->CastStop(spellId); return 0; } @@ -2359,8 +2359,8 @@ namespace LuaUnit */ int InterruptSpell(lua_State* L, Unit* unit) { - int spellType = Eluna::CHECKVAL(L, 2); - bool delayed = Eluna::CHECKVAL(L, 3, true); + int spellType = ALE::CHECKVAL(L, 2); + bool delayed = ALE::CHECKVAL(L, 3, true); switch (spellType) { case 0: @@ -2392,13 +2392,13 @@ namespace LuaUnit */ int AddAura(lua_State* L, Unit* unit) { - uint32 spell = Eluna::CHECKVAL(L, 2); - Unit* target = Eluna::CHECKOBJ(L, 3); + uint32 spell = ALE::CHECKVAL(L, 2); + Unit* target = ALE::CHECKOBJ(L, 3); SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(spell); if (!spellEntry) return 1; - Eluna::Push(L, unit->AddAura(spell, target)); + ALE::Push(L, unit->AddAura(spell, target)); return 1; } @@ -2409,7 +2409,7 @@ namespace LuaUnit */ int RemoveAura(lua_State* L, Unit* unit) { - uint32 spellId = Eluna::CHECKVAL(L, 2); + uint32 spellId = ALE::CHECKVAL(L, 2); unit->RemoveAurasDueToSpell(spellId); return 0; } @@ -2441,7 +2441,7 @@ namespace LuaUnit */ int AddUnitState(lua_State* L, Unit* unit) { - uint32 state = Eluna::CHECKVAL(L, 2); + uint32 state = ALE::CHECKVAL(L, 2); unit->AddUnitState(state); return 0; @@ -2454,7 +2454,7 @@ namespace LuaUnit */ int ClearUnitState(lua_State* L, Unit* unit) { - uint32 state = Eluna::CHECKVAL(L, 2); + uint32 state = ALE::CHECKVAL(L, 2); unit->ClearUnitState(state); return 0; @@ -2470,10 +2470,10 @@ namespace LuaUnit */ int NearTeleport(lua_State* L, Unit* unit) { - float x = Eluna::CHECKVAL(L, 2); - float y = Eluna::CHECKVAL(L, 3); - float z = Eluna::CHECKVAL(L, 4); - float o = Eluna::CHECKVAL(L, 5); + float x = ALE::CHECKVAL(L, 2); + float y = ALE::CHECKVAL(L, 3); + float z = ALE::CHECKVAL(L, 4); + float o = ALE::CHECKVAL(L, 5); unit->NearTeleportTo(x, y, z, o); return 0; @@ -2504,11 +2504,11 @@ namespace LuaUnit */ int DealDamage(lua_State* L, Unit* unit) { - Unit* target = Eluna::CHECKOBJ(L, 2); - uint32 damage = Eluna::CHECKVAL(L, 3); - bool durabilityloss = Eluna::CHECKVAL(L, 4, true); - uint32 school = Eluna::CHECKVAL(L, 5, MAX_SPELL_SCHOOL); - uint32 spell = Eluna::CHECKVAL(L, 6, 0); + Unit* target = ALE::CHECKOBJ(L, 2); + uint32 damage = ALE::CHECKVAL(L, 3); + bool durabilityloss = ALE::CHECKVAL(L, 4, true); + uint32 school = ALE::CHECKVAL(L, 5, MAX_SPELL_SCHOOL); + uint32 spell = ALE::CHECKVAL(L, 6, 0); if (school > MAX_SPELL_SCHOOL) return luaL_argerror(L, 6, "valid SpellSchool expected"); @@ -2567,10 +2567,10 @@ namespace LuaUnit */ int DealHeal(lua_State* L, Unit* unit) { - Unit* target = Eluna::CHECKOBJ(L, 2); - uint32 spell = Eluna::CHECKVAL(L, 3); - uint32 amount = Eluna::CHECKVAL(L, 4); - bool critical = Eluna::CHECKVAL(L, 5, false); + Unit* target = ALE::CHECKOBJ(L, 2); + uint32 spell = ALE::CHECKVAL(L, 3); + uint32 amount = ALE::CHECKVAL(L, 4); + bool critical = ALE::CHECKVAL(L, 5, false); if (const SpellInfo* info = sSpellMgr->GetSpellInfo(spell)) { @@ -2588,8 +2588,8 @@ namespace LuaUnit */ int Kill(lua_State* L, Unit* unit) { - Unit* target = Eluna::CHECKOBJ(L, 2); - bool durLoss = Eluna::CHECKVAL(L, 3, true); + Unit* target = ALE::CHECKOBJ(L, 2); + bool durLoss = ALE::CHECKVAL(L, 3, true); Unit::Kill(unit, target, durLoss); return 0; @@ -2619,11 +2619,11 @@ namespace LuaUnit */ int AddThreat(lua_State* L, Unit* unit) { - Unit* victim = Eluna::CHECKOBJ(L, 2); - float threat = Eluna::CHECKVAL(L, 3, true); - uint32 spell = Eluna::CHECKVAL(L, 4, 0); + Unit* victim = ALE::CHECKOBJ(L, 2); + float threat = ALE::CHECKVAL(L, 3, true); + uint32 spell = ALE::CHECKVAL(L, 4, 0); - uint32 schoolMask = Eluna::CHECKVAL(L, 5, 0); + uint32 schoolMask = ALE::CHECKVAL(L, 5, 0); if (schoolMask > SPELL_SCHOOL_MASK_ALL) { return luaL_argerror(L, 4, "valid SpellSchoolMask expected"); @@ -2640,8 +2640,8 @@ namespace LuaUnit */ int ModifyThreatPct(lua_State* L, Unit* unit) { - Unit* victim = Eluna::CHECKOBJ(L, 2); - int32 threatPct = Eluna::CHECKVAL(L, 3, true); + Unit* victim = ALE::CHECKOBJ(L, 2); + int32 threatPct = ALE::CHECKVAL(L, 3, true); unit->GetThreatMgr().ModifyThreatByPercent(victim, threatPct); return 0; @@ -2673,7 +2673,7 @@ namespace LuaUnit /*int DisableMelee(lua_State* L, Unit* unit) { - bool apply = Eluna::CHECKVAL(L, 2, true); + bool apply = ALE::CHECKVAL(L, 2, true); if (apply) unit->AddUnitState(UNIT_STATE_CANNOT_AUTOATTACK); @@ -2684,12 +2684,12 @@ namespace LuaUnit /*int SummonGuardian(lua_State* L, Unit* unit) { - uint32 entry = Eluna::CHECKVAL(L, 2); - float x = Eluna::CHECKVAL(L, 3); - float y = Eluna::CHECKVAL(L, 4); - float z = Eluna::CHECKVAL(L, 5); - float o = Eluna::CHECKVAL(L, 6); - uint32 desp = Eluna::CHECKVAL(L, 7, 0); + uint32 entry = ALE::CHECKVAL(L, 2); + float x = ALE::CHECKVAL(L, 3); + float y = ALE::CHECKVAL(L, 4); + float z = ALE::CHECKVAL(L, 5); + float o = ALE::CHECKVAL(L, 6); + uint32 desp = ALE::CHECKVAL(L, 7, 0); SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(61); if (!properties) @@ -2718,7 +2718,7 @@ namespace LuaUnit } summon->AI()->EnterEvadeMode(); - Eluna::Push(L, summon); + ALE::Push(L, summon); return 1; }*/ @@ -2729,7 +2729,7 @@ namespace LuaUnit */ int ClearThreat(lua_State* L, Unit* unit) { - Unit* target = Eluna::CHECKOBJ(L, 2); + Unit* target = ALE::CHECKOBJ(L, 2); unit->GetThreatMgr().ClearThreat(target); return 0; @@ -2752,9 +2752,9 @@ namespace LuaUnit */ int GetThreat(lua_State* L, Unit* unit) { - Unit* target = Eluna::CHECKOBJ(L, 2); + Unit* target = ALE::CHECKOBJ(L, 2); - Eluna::Push(L, unit->GetThreatMgr().GetThreat(target)); + ALE::Push(L, unit->GetThreatMgr().GetThreat(target)); return 1; } }; diff --git a/src/LuaEngine/methods/VehicleMethods.h b/src/LuaEngine/methods/VehicleMethods.h index 833b671..bb0a40c 100644 --- a/src/LuaEngine/methods/VehicleMethods.h +++ b/src/LuaEngine/methods/VehicleMethods.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 */ @@ -22,8 +22,8 @@ namespace LuaVehicle */ int IsOnBoard(lua_State* L, Vehicle* vehicle) { - Unit* passenger = Eluna::CHECKOBJ(L, 2); - Eluna::Push(L, passenger->IsOnVehicle(vehicle->GetBase())); + Unit* passenger = ALE::CHECKOBJ(L, 2); + ALE::Push(L, passenger->IsOnVehicle(vehicle->GetBase())); return 1; } @@ -34,7 +34,7 @@ namespace LuaVehicle */ int GetOwner(lua_State* L, Vehicle* vehicle) { - Eluna::Push(L, vehicle->GetBase()); + ALE::Push(L, vehicle->GetBase()); return 1; } @@ -45,7 +45,7 @@ namespace LuaVehicle */ int GetEntry(lua_State* L, Vehicle* vehicle) { - Eluna::Push(L, vehicle->GetVehicleInfo()->m_ID); + ALE::Push(L, vehicle->GetVehicleInfo()->m_ID); return 1; } @@ -57,8 +57,8 @@ namespace LuaVehicle */ int GetPassenger(lua_State* L, Vehicle* vehicle) { - int8 seatId = Eluna::CHECKVAL(L, 2); - Eluna::Push(L, vehicle->GetPassenger(seatId)); + int8 seatId = ALE::CHECKVAL(L, 2); + ALE::Push(L, vehicle->GetPassenger(seatId)); return 1; } @@ -70,8 +70,8 @@ namespace LuaVehicle */ int AddPassenger(lua_State* L, Vehicle* vehicle) { - Unit* passenger = Eluna::CHECKOBJ(L, 2); - int8 seatId = Eluna::CHECKVAL(L, 3); + Unit* passenger = ALE::CHECKOBJ(L, 2); + int8 seatId = ALE::CHECKVAL(L, 3); vehicle->AddPassenger(passenger, seatId); return 0; @@ -84,7 +84,7 @@ namespace LuaVehicle */ int RemovePassenger(lua_State* L, Vehicle* vehicle) { - Unit* passenger = Eluna::CHECKOBJ(L, 2); + Unit* passenger = ALE::CHECKOBJ(L, 2); vehicle->RemovePassenger(passenger); return 0; } diff --git a/src/LuaEngine/methods/WorldObjectMethods.h b/src/LuaEngine/methods/WorldObjectMethods.h index b90ebc7..1fd0377 100644 --- a/src/LuaEngine/methods/WorldObjectMethods.h +++ b/src/LuaEngine/methods/WorldObjectMethods.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 */ @@ -21,7 +21,7 @@ namespace LuaWorldObject */ int GetName(lua_State* L, WorldObject* obj) { - Eluna::Push(L, obj->GetName()); + ALE::Push(L, obj->GetName()); return 1; } @@ -32,7 +32,7 @@ namespace LuaWorldObject */ int GetMap(lua_State* L, WorldObject* obj) { - Eluna::Push(L, obj->GetMap()); + ALE::Push(L, obj->GetMap()); return 1; } @@ -43,7 +43,7 @@ namespace LuaWorldObject */ int GetPhaseMask(lua_State* L, WorldObject* obj) { - Eluna::Push(L, obj->GetPhaseMask()); + ALE::Push(L, obj->GetPhaseMask()); return 1; } @@ -55,8 +55,8 @@ namespace LuaWorldObject */ int SetPhaseMask(lua_State* L, WorldObject* obj) { - uint32 phaseMask = Eluna::CHECKVAL(L, 2); - bool update = Eluna::CHECKVAL(L, 3, true); + uint32 phaseMask = ALE::CHECKVAL(L, 2); + bool update = ALE::CHECKVAL(L, 3, true); obj->SetPhaseMask(phaseMask, update); return 0; } @@ -68,7 +68,7 @@ namespace LuaWorldObject */ int GetInstanceId(lua_State* L, WorldObject* obj) { - Eluna::Push(L, obj->GetInstanceId()); + ALE::Push(L, obj->GetInstanceId()); return 1; } @@ -79,7 +79,7 @@ namespace LuaWorldObject */ int GetAreaId(lua_State* L, WorldObject* obj) { - Eluna::Push(L, obj->GetAreaId()); + ALE::Push(L, obj->GetAreaId()); return 1; } @@ -90,7 +90,7 @@ namespace LuaWorldObject */ int GetZoneId(lua_State* L, WorldObject* obj) { - Eluna::Push(L, obj->GetZoneId()); + ALE::Push(L, obj->GetZoneId()); return 1; } @@ -101,7 +101,7 @@ namespace LuaWorldObject */ int GetMapId(lua_State* L, WorldObject* obj) { - Eluna::Push(L, obj->GetMapId()); + ALE::Push(L, obj->GetMapId()); return 1; } @@ -112,7 +112,7 @@ namespace LuaWorldObject */ int GetX(lua_State* L, WorldObject* obj) { - Eluna::Push(L, obj->GetPositionX()); + ALE::Push(L, obj->GetPositionX()); return 1; } @@ -123,7 +123,7 @@ namespace LuaWorldObject */ int GetY(lua_State* L, WorldObject* obj) { - Eluna::Push(L, obj->GetPositionY()); + ALE::Push(L, obj->GetPositionY()); return 1; } @@ -134,7 +134,7 @@ namespace LuaWorldObject */ int GetZ(lua_State* L, WorldObject* obj) { - Eluna::Push(L, obj->GetPositionZ()); + ALE::Push(L, obj->GetPositionZ()); return 1; } @@ -145,7 +145,7 @@ namespace LuaWorldObject */ int GetO(lua_State* L, WorldObject* obj) { - Eluna::Push(L, obj->GetOrientation()); + ALE::Push(L, obj->GetOrientation()); return 1; } @@ -159,10 +159,10 @@ namespace LuaWorldObject */ int GetLocation(lua_State* L, WorldObject* obj) { - Eluna::Push(L, obj->GetPositionX()); - Eluna::Push(L, obj->GetPositionY()); - Eluna::Push(L, obj->GetPositionZ()); - Eluna::Push(L, obj->GetOrientation()); + ALE::Push(L, obj->GetPositionX()); + ALE::Push(L, obj->GetPositionY()); + ALE::Push(L, obj->GetPositionZ()); + ALE::Push(L, obj->GetOrientation()); return 4; } @@ -177,17 +177,17 @@ namespace LuaWorldObject */ int GetNearestPlayer(lua_State* L, WorldObject* obj) { - float range = Eluna::CHECKVAL(L, 2, SIZE_OF_GRIDS); - uint32 hostile = Eluna::CHECKVAL(L, 3, 0); - uint32 dead = Eluna::CHECKVAL(L, 4, 1); + float range = ALE::CHECKVAL(L, 2, SIZE_OF_GRIDS); + uint32 hostile = ALE::CHECKVAL(L, 3, 0); + uint32 dead = ALE::CHECKVAL(L, 4, 1); Unit* target = NULL; - ElunaUtil::WorldObjectInRangeCheck checker(true, obj, range, TYPEMASK_PLAYER, 0, hostile, dead); + ALEUtil::WorldObjectInRangeCheck checker(true, obj, range, TYPEMASK_PLAYER, 0, hostile, dead); - Acore::UnitLastSearcher searcher(obj, target, checker); + Acore::UnitLastSearcher searcher(obj, target, checker); Cell::VisitObjects(obj, searcher, range); - Eluna::Push(L, target); + ALE::Push(L, target); return 1; } @@ -202,17 +202,17 @@ namespace LuaWorldObject */ int GetNearestGameObject(lua_State* L, WorldObject* obj) { - float range = Eluna::CHECKVAL(L, 2, SIZE_OF_GRIDS); - uint32 entry = Eluna::CHECKVAL(L, 3, 0); - uint32 hostile = Eluna::CHECKVAL(L, 4, 0); + float range = ALE::CHECKVAL(L, 2, SIZE_OF_GRIDS); + uint32 entry = ALE::CHECKVAL(L, 3, 0); + uint32 hostile = ALE::CHECKVAL(L, 4, 0); GameObject* target = NULL; - ElunaUtil::WorldObjectInRangeCheck checker(true, obj, range, TYPEMASK_GAMEOBJECT, entry, hostile); + ALEUtil::WorldObjectInRangeCheck checker(true, obj, range, TYPEMASK_GAMEOBJECT, entry, hostile); - Acore::GameObjectLastSearcher searcher(obj, target, checker); + Acore::GameObjectLastSearcher searcher(obj, target, checker); Cell::VisitObjects(obj, searcher, range); - Eluna::Push(L, target); + ALE::Push(L, target); return 1; } @@ -228,18 +228,18 @@ namespace LuaWorldObject */ int GetNearestCreature(lua_State* L, WorldObject* obj) { - float range = Eluna::CHECKVAL(L, 2, SIZE_OF_GRIDS); - uint32 entry = Eluna::CHECKVAL(L, 3, 0); - uint32 hostile = Eluna::CHECKVAL(L, 4, 0); - uint32 dead = Eluna::CHECKVAL(L, 5, 1); + float range = ALE::CHECKVAL(L, 2, SIZE_OF_GRIDS); + uint32 entry = ALE::CHECKVAL(L, 3, 0); + uint32 hostile = ALE::CHECKVAL(L, 4, 0); + uint32 dead = ALE::CHECKVAL(L, 5, 1); Creature* target = NULL; - ElunaUtil::WorldObjectInRangeCheck checker(true, obj, range, TYPEMASK_UNIT, entry, hostile, dead); + ALEUtil::WorldObjectInRangeCheck checker(true, obj, range, TYPEMASK_UNIT, entry, hostile, dead); - Acore::CreatureLastSearcher searcher(obj, target, checker); + Acore::CreatureLastSearcher searcher(obj, target, checker); Cell::VisitObjects(obj, searcher, range); - Eluna::Push(L, target); + ALE::Push(L, target); return 1; } @@ -254,14 +254,14 @@ namespace LuaWorldObject */ int GetPlayersInRange(lua_State* L, WorldObject* obj) { - float range = Eluna::CHECKVAL(L, 2, SIZE_OF_GRIDS); - uint32 hostile = Eluna::CHECKVAL(L, 3, 0); - uint32 dead = Eluna::CHECKVAL(L, 4, 1); + float range = ALE::CHECKVAL(L, 2, SIZE_OF_GRIDS); + uint32 hostile = ALE::CHECKVAL(L, 3, 0); + uint32 dead = ALE::CHECKVAL(L, 4, 1); std::list list; - ElunaUtil::WorldObjectInRangeCheck checker(false, obj, range, TYPEMASK_PLAYER, 0, hostile, dead); + ALEUtil::WorldObjectInRangeCheck checker(false, obj, range, TYPEMASK_PLAYER, 0, hostile, dead); - Acore::PlayerListSearcher searcher(obj, list, checker); + Acore::PlayerListSearcher searcher(obj, list, checker); Cell::VisitObjects(obj, searcher, range); lua_createtable(L, list.size(), 0); @@ -270,7 +270,7 @@ namespace LuaWorldObject for (std::list::const_iterator it = list.begin(); it != list.end(); ++it) { - Eluna::Push(L, *it); + ALE::Push(L, *it); lua_rawseti(L, tbl, ++i); } @@ -290,15 +290,15 @@ namespace LuaWorldObject */ int GetCreaturesInRange(lua_State* L, WorldObject* obj) { - float range = Eluna::CHECKVAL(L, 2, SIZE_OF_GRIDS); - uint32 entry = Eluna::CHECKVAL(L, 3, 0); - uint32 hostile = Eluna::CHECKVAL(L, 4, 0); - uint32 dead = Eluna::CHECKVAL(L, 5, 1); + float range = ALE::CHECKVAL(L, 2, SIZE_OF_GRIDS); + uint32 entry = ALE::CHECKVAL(L, 3, 0); + uint32 hostile = ALE::CHECKVAL(L, 4, 0); + uint32 dead = ALE::CHECKVAL(L, 5, 1); std::list list; - ElunaUtil::WorldObjectInRangeCheck checker(false, obj, range, TYPEMASK_UNIT, entry, hostile, dead); + ALEUtil::WorldObjectInRangeCheck checker(false, obj, range, TYPEMASK_UNIT, entry, hostile, dead); - Acore::CreatureListSearcher searcher(obj, list, checker); + Acore::CreatureListSearcher searcher(obj, list, checker); Cell::VisitObjects(obj, searcher, range); lua_createtable(L, list.size(), 0); @@ -307,7 +307,7 @@ namespace LuaWorldObject for (std::list::const_iterator it = list.begin(); it != list.end(); ++it) { - Eluna::Push(L, *it); + ALE::Push(L, *it); lua_rawseti(L, tbl, ++i); } @@ -326,14 +326,14 @@ namespace LuaWorldObject */ int GetGameObjectsInRange(lua_State* L, WorldObject* obj) { - float range = Eluna::CHECKVAL(L, 2, SIZE_OF_GRIDS); - uint32 entry = Eluna::CHECKVAL(L, 3, 0); - uint32 hostile = Eluna::CHECKVAL(L, 4, 0); + float range = ALE::CHECKVAL(L, 2, SIZE_OF_GRIDS); + uint32 entry = ALE::CHECKVAL(L, 3, 0); + uint32 hostile = ALE::CHECKVAL(L, 4, 0); std::list list; - ElunaUtil::WorldObjectInRangeCheck checker(false, obj, range, TYPEMASK_GAMEOBJECT, entry, hostile); + ALEUtil::WorldObjectInRangeCheck checker(false, obj, range, TYPEMASK_GAMEOBJECT, entry, hostile); - Acore::GameObjectListSearcher searcher(obj, list, checker); + Acore::GameObjectListSearcher searcher(obj, list, checker); Cell::VisitObjects(obj, searcher, range); lua_createtable(L, list.size(), 0); @@ -342,7 +342,7 @@ namespace LuaWorldObject for (std::list::const_iterator it = list.begin(); it != list.end(); ++it) { - Eluna::Push(L, *it); + ALE::Push(L, *it); lua_rawseti(L, tbl, ++i); } @@ -364,22 +364,22 @@ namespace LuaWorldObject */ int GetNearObject(lua_State* L, WorldObject* obj) { - float range = Eluna::CHECKVAL(L, 2, SIZE_OF_GRIDS); - uint16 type = Eluna::CHECKVAL(L, 3, 0); // TypeMask - uint32 entry = Eluna::CHECKVAL(L, 4, 0); - uint32 hostile = Eluna::CHECKVAL(L, 5, 0); // 0 none, 1 hostile, 2 friendly - uint32 dead = Eluna::CHECKVAL(L, 6, 1); // 0 both, 1 alive, 2 dead + float range = ALE::CHECKVAL(L, 2, SIZE_OF_GRIDS); + uint16 type = ALE::CHECKVAL(L, 3, 0); // TypeMask + uint32 entry = ALE::CHECKVAL(L, 4, 0); + uint32 hostile = ALE::CHECKVAL(L, 5, 0); // 0 none, 1 hostile, 2 friendly + uint32 dead = ALE::CHECKVAL(L, 6, 1); // 0 both, 1 alive, 2 dead float x, y, z; obj->GetPosition(x, y, z); - ElunaUtil::WorldObjectInRangeCheck checker(true, obj, range, type, entry, hostile, dead); + ALEUtil::WorldObjectInRangeCheck checker(true, obj, range, type, entry, hostile, dead); WorldObject* target = NULL; - Acore::WorldObjectLastSearcher searcher(obj, target, checker); + Acore::WorldObjectLastSearcher searcher(obj, target, checker); Cell::VisitObjects(obj, searcher, range); - Eluna::Push(L, target); + ALE::Push(L, target); return 1; } @@ -397,19 +397,19 @@ namespace LuaWorldObject */ int GetNearObjects(lua_State* L, WorldObject* obj) { - float range = Eluna::CHECKVAL(L, 2, SIZE_OF_GRIDS); - uint16 type = Eluna::CHECKVAL(L, 3, 0); // TypeMask - uint32 entry = Eluna::CHECKVAL(L, 4, 0); - uint32 hostile = Eluna::CHECKVAL(L, 5, 0); // 0 none, 1 hostile, 2 friendly - uint32 dead = Eluna::CHECKVAL(L, 6, 1); // 0 both, 1 alive, 2 dead + float range = ALE::CHECKVAL(L, 2, SIZE_OF_GRIDS); + uint16 type = ALE::CHECKVAL(L, 3, 0); // TypeMask + uint32 entry = ALE::CHECKVAL(L, 4, 0); + uint32 hostile = ALE::CHECKVAL(L, 5, 0); // 0 none, 1 hostile, 2 friendly + uint32 dead = ALE::CHECKVAL(L, 6, 1); // 0 both, 1 alive, 2 dead float x, y, z; obj->GetPosition(x, y, z); - ElunaUtil::WorldObjectInRangeCheck checker(false, obj, range, type, entry, hostile, dead); + ALEUtil::WorldObjectInRangeCheck checker(false, obj, range, type, entry, hostile, dead); std::list list; - Acore::WorldObjectListSearcher searcher(obj, list, checker); + Acore::WorldObjectListSearcher searcher(obj, list, checker); Cell::VisitObjects(obj, searcher, range); lua_createtable(L, list.size(), 0); @@ -418,7 +418,7 @@ namespace LuaWorldObject for (std::list::const_iterator it = list.begin(); it != list.end(); ++it) { - Eluna::Push(L, *it); + ALE::Push(L, *it); lua_rawseti(L, tbl, ++i); } @@ -443,15 +443,15 @@ namespace LuaWorldObject */ int GetDistance(lua_State* L, WorldObject* obj) { - WorldObject* target = Eluna::CHECKOBJ(L, 2, false); + WorldObject* target = ALE::CHECKOBJ(L, 2, false); if (target) - Eluna::Push(L, obj->GetDistance(target)); + ALE::Push(L, obj->GetDistance(target)); else { - float X = Eluna::CHECKVAL(L, 2); - float Y = Eluna::CHECKVAL(L, 3); - float Z = Eluna::CHECKVAL(L, 4); - Eluna::Push(L, obj->GetDistance(X, Y, Z)); + float X = ALE::CHECKVAL(L, 2); + float Y = ALE::CHECKVAL(L, 3); + float Z = ALE::CHECKVAL(L, 4); + ALE::Push(L, obj->GetDistance(X, Y, Z)); } return 1; } @@ -475,7 +475,7 @@ namespace LuaWorldObject { float x, y, z; obj->GetPosition(x, y, z); - WorldObject* target = Eluna::CHECKOBJ(L, 2, false); + WorldObject* target = ALE::CHECKOBJ(L, 2, false); if (target) { float x2, y2, z2; @@ -486,12 +486,12 @@ namespace LuaWorldObject } else { - x -= Eluna::CHECKVAL(L, 2); - y -= Eluna::CHECKVAL(L, 3); - z -= Eluna::CHECKVAL(L, 4); + x -= ALE::CHECKVAL(L, 2); + y -= ALE::CHECKVAL(L, 3); + z -= ALE::CHECKVAL(L, 4); } - Eluna::Push(L, std::sqrt(x*x + y*y + z*z)); + ALE::Push(L, std::sqrt(x*x + y*y + z*z)); return 1; } @@ -511,14 +511,14 @@ namespace LuaWorldObject */ int GetDistance2d(lua_State* L, WorldObject* obj) { - WorldObject* target = Eluna::CHECKOBJ(L, 2, false); + WorldObject* target = ALE::CHECKOBJ(L, 2, false); if (target) - Eluna::Push(L, obj->GetDistance2d(target)); + ALE::Push(L, obj->GetDistance2d(target)); else { - float X = Eluna::CHECKVAL(L, 2); - float Y = Eluna::CHECKVAL(L, 3); - Eluna::Push(L, obj->GetDistance2d(X, Y)); + float X = ALE::CHECKVAL(L, 2); + float Y = ALE::CHECKVAL(L, 3); + ALE::Push(L, obj->GetDistance2d(X, Y)); } return 1; } @@ -541,7 +541,7 @@ namespace LuaWorldObject { float x, y, z; obj->GetPosition(x, y, z); - WorldObject* target = Eluna::CHECKOBJ(L, 2, false); + WorldObject* target = ALE::CHECKOBJ(L, 2, false); if (target) { float x2, y2, z2; @@ -551,11 +551,11 @@ namespace LuaWorldObject } else { - x -= Eluna::CHECKVAL(L, 2); - y -= Eluna::CHECKVAL(L, 3); + x -= ALE::CHECKVAL(L, 2); + y -= ALE::CHECKVAL(L, 3); } - Eluna::Push(L, std::sqrt(x*x + y*y)); + ALE::Push(L, std::sqrt(x*x + y*y)); return 1; } @@ -571,15 +571,15 @@ namespace LuaWorldObject */ int GetRelativePoint(lua_State* L, WorldObject* obj) { - float dist = Eluna::CHECKVAL(L, 2); - float rad = Eluna::CHECKVAL(L, 3); + float dist = ALE::CHECKVAL(L, 2); + float rad = ALE::CHECKVAL(L, 3); float x, y, z; obj->GetClosePoint(x, y, z, 0.0f, dist, rad); - Eluna::Push(L, x); - Eluna::Push(L, y); - Eluna::Push(L, z); + ALE::Push(L, x); + ALE::Push(L, y); + ALE::Push(L, z); return 3; } @@ -599,14 +599,14 @@ namespace LuaWorldObject */ int GetAngle(lua_State* L, WorldObject* obj) { - WorldObject* target = Eluna::CHECKOBJ(L, 2, false); + WorldObject* target = ALE::CHECKOBJ(L, 2, false); if (target) - Eluna::Push(L, obj->GetAbsoluteAngle(target)); + ALE::Push(L, obj->GetAbsoluteAngle(target)); else { - float x = Eluna::CHECKVAL(L, 2); - float y = Eluna::CHECKVAL(L, 3); - Eluna::Push(L, obj->GetAbsoluteAngle(x, y)); + float x = ALE::CHECKVAL(L, 2); + float y = ALE::CHECKVAL(L, 3); + ALE::Push(L, obj->GetAbsoluteAngle(x, y)); } return 1; @@ -619,7 +619,7 @@ namespace LuaWorldObject */ int SendPacket(lua_State* L, WorldObject* obj) { - WorldPacket* data = Eluna::CHECKOBJ(L, 2); + WorldPacket* data = ALE::CHECKOBJ(L, 2); obj->SendMessageToSet(data, true); return 0; } @@ -637,14 +637,14 @@ namespace LuaWorldObject */ int SummonGameObject(lua_State* L, WorldObject* obj) { - uint32 entry = Eluna::CHECKVAL(L, 2); - float x = Eluna::CHECKVAL(L, 3); - float y = Eluna::CHECKVAL(L, 4); - float z = Eluna::CHECKVAL(L, 5); - float o = Eluna::CHECKVAL(L, 6); - uint32 respawnDelay = Eluna::CHECKVAL(L, 7, 30); + uint32 entry = ALE::CHECKVAL(L, 2); + float x = ALE::CHECKVAL(L, 3); + float y = ALE::CHECKVAL(L, 4); + float z = ALE::CHECKVAL(L, 5); + float o = ALE::CHECKVAL(L, 6); + uint32 respawnDelay = ALE::CHECKVAL(L, 7, 30); - Eluna::Push(L, obj->SummonGameObject(entry, x, y, z, o, 0, 0, 0, 0, respawnDelay)); + ALE::Push(L, obj->SummonGameObject(entry, x, y, z, o, 0, 0, 0, 0, respawnDelay)); return 1; } @@ -676,13 +676,13 @@ namespace LuaWorldObject */ int SpawnCreature(lua_State* L, WorldObject* obj) { - uint32 entry = Eluna::CHECKVAL(L, 2); - float x = Eluna::CHECKVAL(L, 3); - float y = Eluna::CHECKVAL(L, 4); - float z = Eluna::CHECKVAL(L, 5); - float o = Eluna::CHECKVAL(L, 6); - uint32 spawnType = Eluna::CHECKVAL(L, 7, 8); - uint32 despawnTimer = Eluna::CHECKVAL(L, 8, 0); + uint32 entry = ALE::CHECKVAL(L, 2); + float x = ALE::CHECKVAL(L, 3); + float y = ALE::CHECKVAL(L, 4); + float z = ALE::CHECKVAL(L, 5); + float o = ALE::CHECKVAL(L, 6); + uint32 spawnType = ALE::CHECKVAL(L, 7, 8); + uint32 despawnTimer = ALE::CHECKVAL(L, 8, 0); TempSummonType type; switch (spawnType) @@ -715,7 +715,7 @@ namespace LuaWorldObject return luaL_argerror(L, 7, "valid SpawnType expected"); } - Eluna::Push(L, obj->SummonCreature(entry, x, y, z, o, type, despawnTimer)); + ALE::Push(L, obj->SummonCreature(entry, x, y, z, o, type, despawnTimer)); return 1; } @@ -750,17 +750,17 @@ namespace LuaWorldObject uint32 min, max; if (lua_istable(L, 3)) { - Eluna::Push(L, 1); + ALE::Push(L, 1); lua_gettable(L, 3); - min = Eluna::CHECKVAL(L, -1); - Eluna::Push(L, 2); + min = ALE::CHECKVAL(L, -1); + ALE::Push(L, 2); lua_gettable(L, 3); - max = Eluna::CHECKVAL(L, -1); + max = ALE::CHECKVAL(L, -1); lua_pop(L, 2); } else - min = max = Eluna::CHECKVAL(L, 3); - uint32 repeats = Eluna::CHECKVAL(L, 4, 1); + min = max = ALE::CHECKVAL(L, 3); + uint32 repeats = ALE::CHECKVAL(L, 4, 1); if (min > max) return luaL_argerror(L, 3, "min is bigger than max delay"); @@ -769,8 +769,8 @@ namespace LuaWorldObject int functionRef = luaL_ref(L, LUA_REGISTRYINDEX); if (functionRef != LUA_REFNIL && functionRef != LUA_NOREF) { - obj->elunaEvents->AddEvent(functionRef, min, max, repeats); - Eluna::Push(L, functionRef); + obj->ALEEvents->AddEvent(functionRef, min, max, repeats); + ALE::Push(L, functionRef); } return 1; } @@ -782,8 +782,8 @@ namespace LuaWorldObject */ int RemoveEventById(lua_State* L, WorldObject* obj) { - int eventId = Eluna::CHECKVAL(L, 2); - obj->elunaEvents->SetState(eventId, LUAEVENT_STATE_ABORT); + int eventId = ALE::CHECKVAL(L, 2); + obj->ALEEvents->SetState(eventId, LUAEVENT_STATE_ABORT); return 0; } @@ -793,7 +793,7 @@ namespace LuaWorldObject */ int RemoveEvents(lua_State* /*L*/, WorldObject* obj) { - obj->elunaEvents->SetStates(LUAEVENT_STATE_ABORT); + obj->ALEEvents->SetStates(LUAEVENT_STATE_ABORT); return 0; } @@ -811,16 +811,16 @@ namespace LuaWorldObject */ int IsWithinLoS(lua_State* L, WorldObject* obj) { - WorldObject* target = Eluna::CHECKOBJ(L, 2, false); + WorldObject* target = ALE::CHECKOBJ(L, 2, false); if (target) - Eluna::Push(L, obj->IsWithinLOSInMap(target)); + ALE::Push(L, obj->IsWithinLOSInMap(target)); else { - float x = Eluna::CHECKVAL(L, 2); - float y = Eluna::CHECKVAL(L, 3); - float z = Eluna::CHECKVAL(L, 4); - Eluna::Push(L, obj->IsWithinLOS(x, y, z)); + float x = ALE::CHECKVAL(L, 2); + float y = ALE::CHECKVAL(L, 3); + float z = ALE::CHECKVAL(L, 4); + ALE::Push(L, obj->IsWithinLOS(x, y, z)); } return 1; @@ -834,8 +834,8 @@ namespace LuaWorldObject */ int IsInMap(lua_State* L, WorldObject* obj) { - WorldObject* target = Eluna::CHECKOBJ(L, 2, true); - Eluna::Push(L, obj->IsInMap(target)); + WorldObject* target = ALE::CHECKOBJ(L, 2, true); + ALE::Push(L, obj->IsInMap(target)); return 1; } @@ -852,11 +852,11 @@ namespace LuaWorldObject */ int IsWithinDist3d(lua_State* L, WorldObject* obj) { - float x = Eluna::CHECKVAL(L, 2); - float y = Eluna::CHECKVAL(L, 3); - float z = Eluna::CHECKVAL(L, 4); - float dist = Eluna::CHECKVAL(L, 5); - Eluna::Push(L, obj->IsWithinDist3d(x, y, z, dist)); + float x = ALE::CHECKVAL(L, 2); + float y = ALE::CHECKVAL(L, 3); + float z = ALE::CHECKVAL(L, 4); + float dist = ALE::CHECKVAL(L, 5); + ALE::Push(L, obj->IsWithinDist3d(x, y, z, dist)); return 1; } @@ -873,10 +873,10 @@ namespace LuaWorldObject */ int IsWithinDist2d(lua_State* L, WorldObject* obj) { - float x = Eluna::CHECKVAL(L, 2); - float y = Eluna::CHECKVAL(L, 3); - float dist = Eluna::CHECKVAL(L, 4); - Eluna::Push(L, obj->IsWithinDist2d(x, y, dist)); + float x = ALE::CHECKVAL(L, 2); + float y = ALE::CHECKVAL(L, 3); + float dist = ALE::CHECKVAL(L, 4); + ALE::Push(L, obj->IsWithinDist2d(x, y, dist)); return 1; } @@ -892,10 +892,10 @@ namespace LuaWorldObject */ int IsWithinDist(lua_State* L, WorldObject* obj) { - WorldObject* target = Eluna::CHECKOBJ(L, 2, true); - float distance = Eluna::CHECKVAL(L, 3); - bool is3D = Eluna::CHECKVAL(L, 4, true); - Eluna::Push(L, obj->IsWithinDist(target, distance, is3D)); + WorldObject* target = ALE::CHECKOBJ(L, 2, true); + float distance = ALE::CHECKVAL(L, 3); + bool is3D = ALE::CHECKVAL(L, 4, true); + ALE::Push(L, obj->IsWithinDist(target, distance, is3D)); return 1; } @@ -911,11 +911,11 @@ namespace LuaWorldObject */ int IsWithinDistInMap(lua_State* L, WorldObject* obj) { - WorldObject* target = Eluna::CHECKOBJ(L, 2); - float distance = Eluna::CHECKVAL(L, 3); - bool is3D = Eluna::CHECKVAL(L, 4, true); + WorldObject* target = ALE::CHECKOBJ(L, 2); + float distance = ALE::CHECKVAL(L, 3); + bool is3D = ALE::CHECKVAL(L, 4, true); - Eluna::Push(L, obj->IsWithinDistInMap(target, distance, is3D)); + ALE::Push(L, obj->IsWithinDistInMap(target, distance, is3D)); return 1; } @@ -932,12 +932,12 @@ namespace LuaWorldObject */ int IsInRange(lua_State* L, WorldObject* obj) { - WorldObject* target = Eluna::CHECKOBJ(L, 2); - float minrange = Eluna::CHECKVAL(L, 3); - float maxrange = Eluna::CHECKVAL(L, 4); - bool is3D = Eluna::CHECKVAL(L, 5, true); + WorldObject* target = ALE::CHECKOBJ(L, 2); + float minrange = ALE::CHECKVAL(L, 3); + float maxrange = ALE::CHECKVAL(L, 4); + bool is3D = ALE::CHECKVAL(L, 5, true); - Eluna::Push(L, obj->IsInRange(target, minrange, maxrange, is3D)); + ALE::Push(L, obj->IsInRange(target, minrange, maxrange, is3D)); return 1; } @@ -954,12 +954,12 @@ namespace LuaWorldObject */ int IsInRange2d(lua_State* L, WorldObject* obj) { - float x = Eluna::CHECKVAL(L, 2); - float y = Eluna::CHECKVAL(L, 3); - float minrange = Eluna::CHECKVAL(L, 4); - float maxrange = Eluna::CHECKVAL(L, 5); + float x = ALE::CHECKVAL(L, 2); + float y = ALE::CHECKVAL(L, 3); + float minrange = ALE::CHECKVAL(L, 4); + float maxrange = ALE::CHECKVAL(L, 5); - Eluna::Push(L, obj->IsInRange2d(x, y, minrange, maxrange)); + ALE::Push(L, obj->IsInRange2d(x, y, minrange, maxrange)); return 1; } @@ -977,13 +977,13 @@ namespace LuaWorldObject */ int IsInRange3d(lua_State* L, WorldObject* obj) { - float x = Eluna::CHECKVAL(L, 2); - float y = Eluna::CHECKVAL(L, 3); - float z = Eluna::CHECKVAL(L, 4); - float minrange = Eluna::CHECKVAL(L, 5); - float maxrange = Eluna::CHECKVAL(L, 6); + float x = ALE::CHECKVAL(L, 2); + float y = ALE::CHECKVAL(L, 3); + float z = ALE::CHECKVAL(L, 4); + float minrange = ALE::CHECKVAL(L, 5); + float maxrange = ALE::CHECKVAL(L, 6); - Eluna::Push(L, obj->IsInRange3d(x, y, z, minrange, maxrange)); + ALE::Push(L, obj->IsInRange3d(x, y, z, minrange, maxrange)); return 1; } @@ -996,10 +996,10 @@ namespace LuaWorldObject */ int IsInFront(lua_State* L, WorldObject* obj) { - WorldObject* target = Eluna::CHECKOBJ(L, 2); - float arc = Eluna::CHECKVAL(L, 3, static_cast(M_PI)); + WorldObject* target = ALE::CHECKOBJ(L, 2); + float arc = ALE::CHECKVAL(L, 3, static_cast(M_PI)); - Eluna::Push(L, obj->isInFront(target, arc)); + ALE::Push(L, obj->isInFront(target, arc)); return 1; } @@ -1012,10 +1012,10 @@ namespace LuaWorldObject */ int IsInBack(lua_State* L, WorldObject* obj) { - WorldObject* target = Eluna::CHECKOBJ(L, 2); - float arc = Eluna::CHECKVAL(L, 3, static_cast(M_PI)); + WorldObject* target = ALE::CHECKOBJ(L, 2); + float arc = ALE::CHECKVAL(L, 3, static_cast(M_PI)); - Eluna::Push(L, obj->isInBack(target, arc)); + ALE::Push(L, obj->isInBack(target, arc)); return 1; } @@ -1032,8 +1032,8 @@ namespace LuaWorldObject */ int PlayMusic(lua_State* L, WorldObject* obj) { - uint32 musicid = Eluna::CHECKVAL(L, 2); - Player* player = Eluna::CHECKOBJ(L, 3, false); + uint32 musicid = ALE::CHECKVAL(L, 2); + Player* player = ALE::CHECKOBJ(L, 3, false); WorldPacket data(SMSG_PLAY_MUSIC, 4); data << uint32(musicid); @@ -1057,8 +1057,8 @@ namespace LuaWorldObject */ int PlayDirectSound(lua_State* L, WorldObject* obj) { - uint32 soundId = Eluna::CHECKVAL(L, 2); - Player* player = Eluna::CHECKOBJ(L, 3, false); + uint32 soundId = ALE::CHECKVAL(L, 2); + Player* player = ALE::CHECKOBJ(L, 3, false); if (!sSoundEntriesStore.LookupEntry(soundId)) return 0; @@ -1083,8 +1083,8 @@ namespace LuaWorldObject */ int PlayDistanceSound(lua_State* L, WorldObject* obj) { - uint32 soundId = Eluna::CHECKVAL(L, 2); - Player* player = Eluna::CHECKOBJ(L, 3, false); + uint32 soundId = ALE::CHECKVAL(L, 2); + Player* player = ALE::CHECKOBJ(L, 3, false); if (!sSoundEntriesStore.LookupEntry(soundId)) return 0; diff --git a/src/LuaEngine/methods/WorldPacketMethods.h b/src/LuaEngine/methods/WorldPacketMethods.h index ecc7b9b..3972eee 100644 --- a/src/LuaEngine/methods/WorldPacketMethods.h +++ b/src/LuaEngine/methods/WorldPacketMethods.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 */ @@ -27,7 +27,7 @@ namespace LuaPacket */ int GetOpcode(lua_State* L, WorldPacket* packet) { - Eluna::Push(L, packet->GetOpcode()); + ALE::Push(L, packet->GetOpcode()); return 1; } @@ -38,7 +38,7 @@ namespace LuaPacket */ int GetSize(lua_State* L, WorldPacket* packet) { - Eluna::Push(L, packet->size()); + ALE::Push(L, packet->size()); return 1; } @@ -49,7 +49,7 @@ namespace LuaPacket */ int SetOpcode(lua_State* L, WorldPacket* packet) { - uint32 opcode = Eluna::CHECKVAL(L, 2); + uint32 opcode = ALE::CHECKVAL(L, 2); if (opcode >= NUM_MSG_TYPES) return luaL_argerror(L, 2, "valid opcode expected"); packet->SetOpcode((OpcodesList)opcode); @@ -65,7 +65,7 @@ namespace LuaPacket { int8 _byte; (*packet) >> _byte; - Eluna::Push(L, _byte); + ALE::Push(L, _byte); return 1; } @@ -78,7 +78,7 @@ namespace LuaPacket { uint8 _ubyte; (*packet) >> _ubyte; - Eluna::Push(L, _ubyte); + ALE::Push(L, _ubyte); return 1; } @@ -91,7 +91,7 @@ namespace LuaPacket { int16 _short; (*packet) >> _short; - Eluna::Push(L, _short); + ALE::Push(L, _short); return 1; } @@ -104,7 +104,7 @@ namespace LuaPacket { uint16 _ushort; (*packet) >> _ushort; - Eluna::Push(L, _ushort); + ALE::Push(L, _ushort); return 1; } @@ -117,7 +117,7 @@ namespace LuaPacket { int32 _long; (*packet) >> _long; - Eluna::Push(L, _long); + ALE::Push(L, _long); return 1; } @@ -130,7 +130,7 @@ namespace LuaPacket { uint32 _ulong; (*packet) >> _ulong; - Eluna::Push(L, _ulong); + ALE::Push(L, _ulong); return 1; } @@ -143,7 +143,7 @@ namespace LuaPacket { float _val; (*packet) >> _val; - Eluna::Push(L, _val); + ALE::Push(L, _val); return 1; } @@ -156,7 +156,7 @@ namespace LuaPacket { double _val; (*packet) >> _val; - Eluna::Push(L, _val); + ALE::Push(L, _val); return 1; } @@ -169,7 +169,7 @@ namespace LuaPacket { ObjectGuid guid; (*packet) >> guid; - Eluna::Push(L, guid); + ALE::Push(L, guid); return 1; } @@ -183,7 +183,7 @@ namespace LuaPacket { uint64 guid; packet->readPackGUID(guid); - Eluna::Push(L, guid); + ALE::Push(L, guid); return 1; } @@ -196,7 +196,7 @@ namespace LuaPacket { std::string _val; (*packet) >> _val; - Eluna::Push(L, _val); + ALE::Push(L, _val); return 1; } @@ -207,7 +207,7 @@ namespace LuaPacket */ int WriteGUID(lua_State* L, WorldPacket* packet) { - ObjectGuid guid = Eluna::CHECKVAL(L, 2); + ObjectGuid guid = ALE::CHECKVAL(L, 2); (*packet) << guid; return 0; } @@ -219,7 +219,7 @@ namespace LuaPacket */ int WritePackedGUID(lua_State* L, WorldPacket* packet) { - ObjectGuid guid = Eluna::CHECKVAL(L, 2); + ObjectGuid guid = ALE::CHECKVAL(L, 2); PackedGuid packedGuid(guid); (*packet) << packedGuid; return 0; @@ -232,7 +232,7 @@ namespace LuaPacket */ int WriteString(lua_State* L, WorldPacket* packet) { - std::string _val = Eluna::CHECKVAL(L, 2); + std::string _val = ALE::CHECKVAL(L, 2); (*packet) << _val; return 0; } @@ -244,7 +244,7 @@ namespace LuaPacket */ int WriteByte(lua_State* L, WorldPacket* packet) { - int8 byte = Eluna::CHECKVAL(L, 2); + int8 byte = ALE::CHECKVAL(L, 2); (*packet) << byte; return 0; } @@ -256,7 +256,7 @@ namespace LuaPacket */ int WriteUByte(lua_State* L, WorldPacket* packet) { - uint8 byte = Eluna::CHECKVAL(L, 2); + uint8 byte = ALE::CHECKVAL(L, 2); (*packet) << byte; return 0; } @@ -268,7 +268,7 @@ namespace LuaPacket */ int WriteShort(lua_State* L, WorldPacket* packet) { - int16 _short = Eluna::CHECKVAL(L, 2); + int16 _short = ALE::CHECKVAL(L, 2); (*packet) << _short; return 0; } @@ -280,7 +280,7 @@ namespace LuaPacket */ int WriteUShort(lua_State* L, WorldPacket* packet) { - uint16 _ushort = Eluna::CHECKVAL(L, 2); + uint16 _ushort = ALE::CHECKVAL(L, 2); (*packet) << _ushort; return 0; } @@ -292,7 +292,7 @@ namespace LuaPacket */ int WriteLong(lua_State* L, WorldPacket* packet) { - int32 _long = Eluna::CHECKVAL(L, 2); + int32 _long = ALE::CHECKVAL(L, 2); (*packet) << _long; return 0; } @@ -304,7 +304,7 @@ namespace LuaPacket */ int WriteULong(lua_State* L, WorldPacket* packet) { - uint32 _ulong = Eluna::CHECKVAL(L, 2); + uint32 _ulong = ALE::CHECKVAL(L, 2); (*packet) << _ulong; return 0; } @@ -316,7 +316,7 @@ namespace LuaPacket */ int WriteFloat(lua_State* L, WorldPacket* packet) { - float _val = Eluna::CHECKVAL(L, 2); + float _val = ALE::CHECKVAL(L, 2); (*packet) << _val; return 0; } @@ -328,7 +328,7 @@ namespace LuaPacket */ int WriteDouble(lua_State* L, WorldPacket* packet) { - double _val = Eluna::CHECKVAL(L, 2); + double _val = ALE::CHECKVAL(L, 2); (*packet) << _val; return 0; }