mirror of
https://github.com/azerothcore/mod-ale
synced 2025-11-29 15:38:17 +08:00
chore: rename Eluna to ALE (#318)
Co-authored-by: Francesco Borzì <borzifrancesco@gmail.com>
This commit is contained in:
32
README.md
32
README.md
@@ -1,6 +1,6 @@
|
||||
<div align="center">
|
||||
|
||||
# [](https://github.com/azerothcore/mod-eluna)
|
||||
# ALE - AzerothCore Lua Engine
|
||||
|
||||
*Unleash the power of Lua scripting in your AzerothCore server*
|
||||
|
||||
@@ -12,11 +12,11 @@
|
||||
</div>
|
||||
|
||||
> [!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 <azerothcore-path>/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 <azerothcore-build-directory>
|
||||
@@ -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.
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<sub>Developed with ❤️ by the AzerothCore and mod-eluna community</sub>
|
||||
<sub>Developed with ❤️ by the AzerothCore and ALE community</sub>
|
||||
|
||||
[⬆ Back to Top](#-overview)
|
||||
</div>
|
||||
|
||||
@@ -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
|
||||
File diff suppressed because it is too large
Load Diff
@@ -16,10 +16,10 @@
|
||||
*/
|
||||
|
||||
// From SC
|
||||
void AddSC_ElunaLuaEngine();
|
||||
void AddSC_ALE();
|
||||
|
||||
// Add all
|
||||
void Addmod_elunaScripts()
|
||||
void Addmod_ALEScripts()
|
||||
{
|
||||
AddSC_ElunaLuaEngine();
|
||||
AddSC_ALE();
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2024 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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) {
|
||||
@@ -1,11 +1,11 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2024 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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"
|
||||
{
|
||||
30
src/LuaEngine/ALEConfig.cpp
Normal file
30
src/LuaEngine/ALEConfig.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
#include "ALEConfig.h"
|
||||
|
||||
ALEConfig& ALEConfig::GetInstance()
|
||||
{
|
||||
static ALEConfig instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
ALEConfig::ALEConfig() : ConfigValueCache<ALEConfigValues>(ALEConfigValues::CONFIG_VALUE_COUNT)
|
||||
{
|
||||
}
|
||||
|
||||
void ALEConfig::Initialize(bool reload)
|
||||
{
|
||||
ConfigValueCache<ALEConfigValues>::Initialize(reload);
|
||||
}
|
||||
|
||||
void ALEConfig::BuildConfigCache()
|
||||
{
|
||||
SetConfigValue<bool>(ALEConfigValues::ENABLED, "ALE.Enabled", "false");
|
||||
SetConfigValue<bool>(ALEConfigValues::TRACEBACK_ENABLED, "ALE.TraceBack", "false");
|
||||
SetConfigValue<bool>(ALEConfigValues::AUTORELOAD_ENABLED, "ALE.AutoReload", "false");
|
||||
SetConfigValue<bool>(ALEConfigValues::BYTECODE_CACHE_ENABLED, "ALE.BytecodeCache", "false");
|
||||
|
||||
SetConfigValue<std::string>(ALEConfigValues::SCRIPT_PATH, "ALE.ScriptPath", "lua_scripts");
|
||||
SetConfigValue<std::string>(ALEConfigValues::REQUIRE_PATH, "ALE.RequirePaths", "");
|
||||
SetConfigValue<std::string>(ALEConfigValues::REQUIRE_CPATH, "ALE.RequireCPaths", "");
|
||||
|
||||
SetConfigValue<uint32>(ALEConfigValues::AUTORELOAD_INTERVAL, "ALE.AutoReloadInterval", 1);
|
||||
}
|
||||
@@ -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<ElunaConfigValues>
|
||||
class ALEConfig final : public ConfigValueCache<ALEConfigValues>
|
||||
{
|
||||
public:
|
||||
static ElunaConfig& GetInstance();
|
||||
static ALEConfig& GetInstance();
|
||||
|
||||
void Initialize(bool reload = false);
|
||||
|
||||
bool IsElunaEnabled() const { return GetConfigValue<bool>(ElunaConfigValues::ENABLED); }
|
||||
bool IsTraceBackEnabled() const { return GetConfigValue<bool>(ElunaConfigValues::TRACEBACK_ENABLED); }
|
||||
bool IsAutoReloadEnabled() const { return GetConfigValue<bool>(ElunaConfigValues::AUTORELOAD_ENABLED); }
|
||||
bool IsByteCodeCacheEnabled() const { return GetConfigValue<bool>(ElunaConfigValues::BYTECODE_CACHE_ENABLED); }
|
||||
bool IsALEEnabled() const { return GetConfigValue<bool>(ALEConfigValues::ENABLED); }
|
||||
bool IsTraceBackEnabled() const { return GetConfigValue<bool>(ALEConfigValues::TRACEBACK_ENABLED); }
|
||||
bool IsAutoReloadEnabled() const { return GetConfigValue<bool>(ALEConfigValues::AUTORELOAD_ENABLED); }
|
||||
bool IsByteCodeCacheEnabled() const { return GetConfigValue<bool>(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<uint32>(ElunaConfigValues::AUTORELOAD_INTERVAL); }
|
||||
uint32 GetAutoReloadInterval() const { return GetConfigValue<uint32>(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
|
||||
#endif // ALE_CONFIG_H
|
||||
@@ -1,27 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<uint32, uint32> > 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);
|
||||
}
|
||||
};
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "ElunaDBCRegistry.h"
|
||||
#include "ALEDBCRegistry.h"
|
||||
|
||||
std::vector<DBCDefinition> dbcRegistry = {
|
||||
REGISTER_DBC(GemProperties, GemPropertiesEntry, sGemPropertiesStore),
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef ELUNADBCREGISTRY_H
|
||||
#define ELUNADBCREGISTRY_H
|
||||
#ifndef ALEDBCREGISTRY_H
|
||||
#define ALEDBCREGISTRY_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -30,9 +30,9 @@ extern std::vector<DBCDefinition> dbcRegistry;
|
||||
}, \
|
||||
[](lua_State* L, const void* entry) { \
|
||||
auto cast_entry = static_cast<const entryType*>(entry); \
|
||||
Eluna::Push(L, *cast_entry); \
|
||||
ALE::Push(L, *cast_entry); \
|
||||
} \
|
||||
}
|
||||
|
||||
#endif // ELUNADBCREGISTRY_H
|
||||
#endif // ALEDBCREGISTRY_H
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<uint64, LuaEvent*>(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)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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 <map>
|
||||
|
||||
#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<uint64, LuaEvent*> EventList;
|
||||
typedef std::unordered_map<int, LuaEvent*> 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<ElunaEventProcessor*> ProcessorSet;
|
||||
typedef std::unordered_set<ALEEventProcessor*> 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
|
||||
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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 <boost/filesystem.hpp>
|
||||
|
||||
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;
|
||||
@@ -1,11 +1,11 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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 <thread>
|
||||
#include <atomic>
|
||||
@@ -15,11 +15,11 @@
|
||||
#include <boost/filesystem.hpp>
|
||||
#include "Common.h"
|
||||
|
||||
class ElunaFileWatcher
|
||||
class ALEFileWatcher
|
||||
{
|
||||
public:
|
||||
ElunaFileWatcher();
|
||||
~ElunaFileWatcher();
|
||||
ALEFileWatcher();
|
||||
~ALEFileWatcher();
|
||||
|
||||
void StartWatching(const std::string& scriptPath, uint32 intervalSeconds = 1);
|
||||
void StopWatching();
|
||||
@@ -1,11 +1,11 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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
|
||||
@@ -1,31 +1,31 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<ElunaInstanceAI*>(this);
|
||||
ALEInstanceAI* self = const_cast<ALEInstanceAI*>(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<ElunaInstanceAI*>(this), false);
|
||||
sALE->PushInstanceData(L, const_cast<ALEInstanceAI*>(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<uint32>(L, -1, 0);
|
||||
uint32 value = ALE::CHECKVAL<uint32>(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<ElunaInstanceAI*>(this), false);
|
||||
sALE->PushInstanceData(L, const_cast<ALEInstanceAI*>(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<uint64>(L, -1, 0);
|
||||
uint64 value = ALE::CHECKVAL<uint64>(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);
|
||||
@@ -1,42 +1,42 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<ElunaInstanceAI*>(this));
|
||||
return sALE->OnCheckEncounterInProgress(const_cast<ALEInstanceAI*>(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
|
||||
@@ -1,11 +1,11 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<typename T>
|
||||
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<typename T>
|
||||
struct ElunaRegister
|
||||
struct ALERegister
|
||||
{
|
||||
const char* name;
|
||||
int(*mfunc)(lua_State*, T*);
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
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/<core>
|
||||
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<typename C>
|
||||
static void SetMethods(Eluna* E, ElunaRegister<C>* methodTable)
|
||||
static void SetMethods(ALE* E, ALERegister<C>* methodTable)
|
||||
{
|
||||
ASSERT(E);
|
||||
ASSERT(tname);
|
||||
@@ -261,21 +261,21 @@ public:
|
||||
}
|
||||
|
||||
// Create new userdata
|
||||
ElunaObject** ptrHold = static_cast<ElunaObject**>(lua_newuserdata(L, sizeof(ElunaObject*)));
|
||||
ALEObject** ptrHold = static_cast<ALEObject**>(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<T*>(obj), manageMemory);
|
||||
*ptrHold = new ALEObject(const_cast<T*>(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<T*>(elunaObj->GetObj());
|
||||
return static_cast<T*>(ALEObj->GetObj());
|
||||
}
|
||||
|
||||
static int GetType(lua_State* L)
|
||||
@@ -315,25 +315,25 @@ public:
|
||||
|
||||
static int SetInvalidation(lua_State* L)
|
||||
{
|
||||
ElunaObject* elunaObj = Eluna::CHECKOBJ<ElunaObject>(L, 1);
|
||||
bool invalidate = Eluna::CHECKVAL<bool>(L, 2);
|
||||
ALEObject* ALEObj = ALE::CHECKOBJ<ALEObject>(L, 1);
|
||||
bool invalidate = ALE::CHECKVAL<bool>(L, 2);
|
||||
|
||||
elunaObj->SetValidation(invalidate);
|
||||
ALEObj->SetValidation(invalidate);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int CallMethod(lua_State* L)
|
||||
{
|
||||
T* obj = Eluna::CHECKOBJ<T>(L, 1); // get self
|
||||
T* obj = ALE::CHECKOBJ<T>(L, 1); // get self
|
||||
if (!obj)
|
||||
return 0;
|
||||
ElunaRegister<T>* l = static_cast<ElunaRegister<T>*>(lua_touserdata(L, lua_upvalueindex(1)));
|
||||
ALERegister<T>* l = static_cast<ALERegister<T>*>(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<Vehicle>::CollectGarbage
|
||||
// Remember special cases like ALETemplate<Vehicle>::CollectGarbage
|
||||
static int CollectGarbage(lua_State* L)
|
||||
{
|
||||
// Get object pointer (and check type, no error)
|
||||
ElunaObject* obj = Eluna::CHECKOBJ<ElunaObject>(L, 1, false);
|
||||
ALEObject* obj = ALE::CHECKOBJ<ALEObject>(L, 1, false);
|
||||
if (obj && manageMemory)
|
||||
delete static_cast<T*>(obj->GetObj());
|
||||
delete obj;
|
||||
@@ -355,7 +355,7 @@ public:
|
||||
|
||||
static int ToString(lua_State* L)
|
||||
{
|
||||
T* obj = Eluna::CHECKOBJ<T>(L, 1, true); // get self
|
||||
T* obj = ALE::CHECKOBJ<T>(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<T>(L, 1) == Eluna::CHECKOBJ<T>(L, 2)); return 1; }
|
||||
static int Equal(lua_State* L) { ALE::Push(L, ALE::CHECKOBJ<T>(L, 1) == ALE::CHECKOBJ<T>(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<typename T>
|
||||
ElunaObject::ElunaObject(T * obj, bool manageMemory) : callstackid(1), _invalidate(!manageMemory), object(obj), type_name(ElunaTemplate<T>::tname)
|
||||
ALEObject::ALEObject(T * obj, bool manageMemory) : callstackid(1), _invalidate(!manageMemory), object(obj), type_name(ALETemplate<T>::tname)
|
||||
{
|
||||
SetValid(true);
|
||||
}
|
||||
|
||||
template<typename T> const char* ElunaTemplate<T>::tname = NULL;
|
||||
template<typename T> bool ElunaTemplate<T>::manageMemory = false;
|
||||
template<typename T> const char* ALETemplate<T>::tname = NULL;
|
||||
template<typename T> bool ALETemplate<T>::manageMemory = false;
|
||||
|
||||
#endif
|
||||
@@ -1,44 +1,44 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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();
|
||||
@@ -1,11 +1,11 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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 <unordered_map>
|
||||
#include <unordered_set>
|
||||
@@ -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();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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 <memory>
|
||||
#include "Common.h"
|
||||
#include "ElunaUtility.h"
|
||||
#include "ALEUtility.h"
|
||||
#include <type_traits>
|
||||
|
||||
extern "C"
|
||||
@@ -23,7 +23,7 @@ extern "C"
|
||||
* A set of bindings from keys of type `K` to Lua references.
|
||||
*/
|
||||
template<typename K>
|
||||
class BindingMap : public ElunaUtil::Lockable
|
||||
class BindingMap : public ALEUtil::Lockable
|
||||
{
|
||||
private:
|
||||
lua_State* L;
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
#include "ElunaConfig.h"
|
||||
|
||||
ElunaConfig& ElunaConfig::GetInstance()
|
||||
{
|
||||
static ElunaConfig instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
ElunaConfig::ElunaConfig() : ConfigValueCache<ElunaConfigValues>(ElunaConfigValues::CONFIG_VALUE_COUNT)
|
||||
{
|
||||
}
|
||||
|
||||
void ElunaConfig::Initialize(bool reload)
|
||||
{
|
||||
ConfigValueCache<ElunaConfigValues>::Initialize(reload);
|
||||
}
|
||||
|
||||
void ElunaConfig::BuildConfigCache()
|
||||
{
|
||||
SetConfigValue<bool>(ElunaConfigValues::ENABLED, "Eluna.Enabled", "false");
|
||||
SetConfigValue<bool>(ElunaConfigValues::TRACEBACK_ENABLED, "Eluna.TraceBack", "false");
|
||||
SetConfigValue<bool>(ElunaConfigValues::AUTORELOAD_ENABLED, "Eluna.AutoReload", "false");
|
||||
SetConfigValue<bool>(ElunaConfigValues::BYTECODE_CACHE_ENABLED, "Eluna.BytecodeCache", "false");
|
||||
|
||||
SetConfigValue<std::string>(ElunaConfigValues::SCRIPT_PATH, "Eluna.ScriptPath", "lua_scripts");
|
||||
SetConfigValue<std::string>(ElunaConfigValues::REQUIRE_PATH, "Eluna.RequirePaths", "");
|
||||
SetConfigValue<std::string>(ElunaConfigValues::REQUIRE_CPATH, "Eluna.RequireCPaths", "");
|
||||
|
||||
SetConfigValue<uint32>(ElunaConfigValues::AUTORELOAD_INTERVAL, "Eluna.AutoReloadInterval", 1);
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<typename K1, typename K2>
|
||||
int Eluna::SetupStack(BindingMap<K1>* bindings1, BindingMap<K2>* bindings2, const K1& key1, const K2& key2, int number_of_arguments)
|
||||
int ALE::SetupStack(BindingMap<K1>* bindings1, BindingMap<K2>* 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<K1>* bindings1, BindingMap<K2>* bindings2, cons
|
||||
* Replace one of the arguments pushed before `SetupStack` with a new value.
|
||||
*/
|
||||
template<typename T>
|
||||
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<typename K1, typename K2>
|
||||
void Eluna::CallAllFunctions(BindingMap<K1>* bindings1, BindingMap<K2>* bindings2, const K1& key1, const K2& key2)
|
||||
void ALE::CallAllFunctions(BindingMap<K1>* bindings1, BindingMap<K2>* bindings2, const K1& key1, const K2& key2)
|
||||
{
|
||||
int number_of_arguments = this->push_counter;
|
||||
// Stack: [arguments]
|
||||
@@ -89,7 +89,7 @@ void Eluna::CallAllFunctions(BindingMap<K1>* bindings1, BindingMap<K2>* bindings
|
||||
* otherwise returns the opposite of `default_value`.
|
||||
*/
|
||||
template<typename K1, typename K2>
|
||||
bool Eluna::CallAllFunctionsBool(BindingMap<K1>* bindings1, BindingMap<K2>* bindings2, const K1& key1, const K2& key2, bool default_value/* = false*/)
|
||||
bool ALE::CallAllFunctionsBool(BindingMap<K1>* bindings1, BindingMap<K2>* 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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 <regex>
|
||||
|
||||
@@ -58,4 +58,4 @@ private:
|
||||
std::regex parseUrlRegex;
|
||||
};
|
||||
|
||||
#endif // #ifndef ELUNA_HTTP_MANAGER_H
|
||||
#endif // #ifndef ALE_HTTP_MANAGER_H
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<ElunaFileWatcher> 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<ALEFileWatcher> ALE::fileWatcher;
|
||||
|
||||
// Global bytecode cache that survives Eluna reloads
|
||||
// Global bytecode cache that survives ALE reloads
|
||||
static std::unordered_map<std::string, GlobalCacheEntry> globalBytecodeCache;
|
||||
static std::unordered_map<std::string, std::time_t> 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<uint32>("Eluna.AutoReloadInterval", 1);
|
||||
fileWatcher = std::make_unique<ElunaFileWatcher>();
|
||||
uint32 watchInterval = eConfigMgr->GetOption<uint32>("ALE.AutoReloadInterval", 1);
|
||||
fileWatcher = std::make_unique<ALEFileWatcher>();
|
||||
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<std::string>(ElunaConfig::GetInstance().GetRequirePath());
|
||||
const std::string& lua_cpath_extra = static_cast<std::string>(ElunaConfig::GetInstance().GetRequireCPath());
|
||||
lua_folderpath = ALEConfig::GetInstance().GetScriptPath();
|
||||
const std::string& lua_path_extra = static_cast<std::string>(ALEConfig::GetInstance().GetRequirePath());
|
||||
const std::string& lua_cpath_extra = static_cast<std::string>(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<bool>("Eluna.PlayerAnnounceReload", false))
|
||||
eWorldSessionMgr->SendServerMessage(SERVER_MSG_STRING, "Reloading Eluna...");
|
||||
if (eConfigMgr->GetOption<bool>("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<Hooks::CreatureEvents> >(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<std::mutex> 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<std::mutex> 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<std::mutex> lock(globalCacheMutex);
|
||||
|
||||
@@ -531,9 +531,9 @@ int Eluna::TryLoadFromGlobalCache(lua_State* L, const std::string& filepath)
|
||||
return luaL_loadbuffer(L, reinterpret_cast<const char*>(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<std::mutex> 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<std::mutex> lock(globalCacheMutex);
|
||||
timestampCache.clear();
|
||||
}
|
||||
|
||||
size_t Eluna::GetGlobalCacheSize()
|
||||
size_t ALE::GetGlobalCacheSize()
|
||||
{
|
||||
std::lock_guard<std::mutex> 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<bool>("Eluna.BytecodeCache", true);
|
||||
bool cacheEnabled = eConfigMgr->GetOption<bool>("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<long long>::Push(luastate, new long long(l));
|
||||
ALETemplate<long long>::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<unsigned long long>::Push(luastate, new unsigned long long(l));
|
||||
ALETemplate<unsigned long long>::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<long long>(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<unsigned long long>(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<Creature>(luastate, pet);
|
||||
}
|
||||
void Eluna::Push(lua_State* luastate, TempSummon const* summon)
|
||||
void ALE::Push(lua_State* luastate, TempSummon const* summon)
|
||||
{
|
||||
Push<Creature>(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<Unit>::Push(luastate, unit);
|
||||
ALETemplate<Unit>::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<WorldObject>::Push(luastate, obj);
|
||||
ALETemplate<WorldObject>::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<Object>::Push(luastate, obj);
|
||||
ALETemplate<Object>::Push(luastate, obj);
|
||||
}
|
||||
}
|
||||
void Eluna::Push(lua_State* luastate, ObjectGuid const guid)
|
||||
void ALE::Push(lua_State* luastate, ObjectGuid const guid)
|
||||
{
|
||||
ElunaTemplate<unsigned long long>::Push(luastate, new unsigned long long(guid.GetRawValue()));
|
||||
ALETemplate<unsigned long long>::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<CreatureTemplate>(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<unsigned int>(value);
|
||||
}
|
||||
|
||||
template<> bool Eluna::CHECKVAL<bool>(lua_State* luastate, int narg)
|
||||
template<> bool ALE::CHECKVAL<bool>(lua_State* luastate, int narg)
|
||||
{
|
||||
return lua_toboolean(luastate, narg) != 0;
|
||||
}
|
||||
template<> float Eluna::CHECKVAL<float>(lua_State* luastate, int narg)
|
||||
template<> float ALE::CHECKVAL<float>(lua_State* luastate, int narg)
|
||||
{
|
||||
return static_cast<float>(luaL_checknumber(luastate, narg));
|
||||
}
|
||||
template<> double Eluna::CHECKVAL<double>(lua_State* luastate, int narg)
|
||||
template<> double ALE::CHECKVAL<double>(lua_State* luastate, int narg)
|
||||
{
|
||||
return luaL_checknumber(luastate, narg);
|
||||
}
|
||||
template<> signed char Eluna::CHECKVAL<signed char>(lua_State* luastate, int narg)
|
||||
template<> signed char ALE::CHECKVAL<signed char>(lua_State* luastate, int narg)
|
||||
{
|
||||
return CheckIntegerRange(luastate, narg, SCHAR_MIN, SCHAR_MAX);
|
||||
}
|
||||
template<> unsigned char Eluna::CHECKVAL<unsigned char>(lua_State* luastate, int narg)
|
||||
template<> unsigned char ALE::CHECKVAL<unsigned char>(lua_State* luastate, int narg)
|
||||
{
|
||||
return CheckUnsignedRange(luastate, narg, UCHAR_MAX);
|
||||
}
|
||||
template<> short Eluna::CHECKVAL<short>(lua_State* luastate, int narg)
|
||||
template<> short ALE::CHECKVAL<short>(lua_State* luastate, int narg)
|
||||
{
|
||||
return CheckIntegerRange(luastate, narg, SHRT_MIN, SHRT_MAX);
|
||||
}
|
||||
template<> unsigned short Eluna::CHECKVAL<unsigned short>(lua_State* luastate, int narg)
|
||||
template<> unsigned short ALE::CHECKVAL<unsigned short>(lua_State* luastate, int narg)
|
||||
{
|
||||
return CheckUnsignedRange(luastate, narg, USHRT_MAX);
|
||||
}
|
||||
template<> int Eluna::CHECKVAL<int>(lua_State* luastate, int narg)
|
||||
template<> int ALE::CHECKVAL<int>(lua_State* luastate, int narg)
|
||||
{
|
||||
return CheckIntegerRange(luastate, narg, INT_MIN, INT_MAX);
|
||||
}
|
||||
template<> unsigned int Eluna::CHECKVAL<unsigned int>(lua_State* luastate, int narg)
|
||||
template<> unsigned int ALE::CHECKVAL<unsigned int>(lua_State* luastate, int narg)
|
||||
{
|
||||
return CheckUnsignedRange(luastate, narg, UINT_MAX);
|
||||
}
|
||||
template<> const char* Eluna::CHECKVAL<const char*>(lua_State* luastate, int narg)
|
||||
template<> const char* ALE::CHECKVAL<const char*>(lua_State* luastate, int narg)
|
||||
{
|
||||
return luaL_checkstring(luastate, narg);
|
||||
}
|
||||
template<> std::string Eluna::CHECKVAL<std::string>(lua_State* luastate, int narg)
|
||||
template<> std::string ALE::CHECKVAL<std::string>(lua_State* luastate, int narg)
|
||||
{
|
||||
return luaL_checkstring(luastate, narg);
|
||||
}
|
||||
template<> long long Eluna::CHECKVAL<long long>(lua_State* luastate, int narg)
|
||||
template<> long long ALE::CHECKVAL<long long>(lua_State* luastate, int narg)
|
||||
{
|
||||
if (lua_isnumber(luastate, narg))
|
||||
return static_cast<long long>(CHECKVAL<double>(luastate, narg));
|
||||
return *(Eluna::CHECKOBJ<long long>(luastate, narg, true));
|
||||
return *(ALE::CHECKOBJ<long long>(luastate, narg, true));
|
||||
}
|
||||
template<> unsigned long long Eluna::CHECKVAL<unsigned long long>(lua_State* luastate, int narg)
|
||||
template<> unsigned long long ALE::CHECKVAL<unsigned long long>(lua_State* luastate, int narg)
|
||||
{
|
||||
if (lua_isnumber(luastate, narg))
|
||||
return static_cast<unsigned long long>(CHECKVAL<uint32>(luastate, narg));
|
||||
return *(Eluna::CHECKOBJ<unsigned long long>(luastate, narg, true));
|
||||
return *(ALE::CHECKOBJ<unsigned long long>(luastate, narg, true));
|
||||
}
|
||||
template<> long Eluna::CHECKVAL<long>(lua_State* luastate, int narg)
|
||||
template<> long ALE::CHECKVAL<long>(lua_State* luastate, int narg)
|
||||
{
|
||||
return static_cast<long>(CHECKVAL<long long>(luastate, narg));
|
||||
}
|
||||
template<> unsigned long Eluna::CHECKVAL<unsigned long>(lua_State* luastate, int narg)
|
||||
template<> unsigned long ALE::CHECKVAL<unsigned long>(lua_State* luastate, int narg)
|
||||
{
|
||||
return static_cast<unsigned long>(CHECKVAL<unsigned long long>(luastate, narg));
|
||||
}
|
||||
template<> ObjectGuid Eluna::CHECKVAL<ObjectGuid>(lua_State* luastate, int narg)
|
||||
template<> ObjectGuid ALE::CHECKVAL<ObjectGuid>(lua_State* luastate, int narg)
|
||||
{
|
||||
return ObjectGuid(uint64((CHECKVAL<unsigned long long>(luastate, narg))));
|
||||
}
|
||||
|
||||
template<> Object* Eluna::CHECKOBJ<Object>(lua_State* luastate, int narg, bool error)
|
||||
template<> Object* ALE::CHECKOBJ<Object>(lua_State* luastate, int narg, bool error)
|
||||
{
|
||||
Object* obj = CHECKOBJ<WorldObject>(luastate, narg, false);
|
||||
if (!obj)
|
||||
obj = CHECKOBJ<Item>(luastate, narg, false);
|
||||
if (!obj)
|
||||
obj = ElunaTemplate<Object>::Check(luastate, narg, error);
|
||||
obj = ALETemplate<Object>::Check(luastate, narg, error);
|
||||
return obj;
|
||||
}
|
||||
template<> WorldObject* Eluna::CHECKOBJ<WorldObject>(lua_State* luastate, int narg, bool error)
|
||||
template<> WorldObject* ALE::CHECKOBJ<WorldObject>(lua_State* luastate, int narg, bool error)
|
||||
{
|
||||
WorldObject* obj = CHECKOBJ<Unit>(luastate, narg, false);
|
||||
if (!obj)
|
||||
@@ -1208,25 +1208,25 @@ template<> WorldObject* Eluna::CHECKOBJ<WorldObject>(lua_State* luastate, int na
|
||||
if (!obj)
|
||||
obj = CHECKOBJ<Corpse>(luastate, narg, false);
|
||||
if (!obj)
|
||||
obj = ElunaTemplate<WorldObject>::Check(luastate, narg, error);
|
||||
obj = ALETemplate<WorldObject>::Check(luastate, narg, error);
|
||||
return obj;
|
||||
}
|
||||
template<> Unit* Eluna::CHECKOBJ<Unit>(lua_State* luastate, int narg, bool error)
|
||||
template<> Unit* ALE::CHECKOBJ<Unit>(lua_State* luastate, int narg, bool error)
|
||||
{
|
||||
Unit* obj = CHECKOBJ<Player>(luastate, narg, false);
|
||||
if (!obj)
|
||||
obj = CHECKOBJ<Creature>(luastate, narg, false);
|
||||
if (!obj)
|
||||
obj = ElunaTemplate<Unit>::Check(luastate, narg, error);
|
||||
obj = ALETemplate<Unit>::Check(luastate, narg, error);
|
||||
return obj;
|
||||
}
|
||||
|
||||
template<> ElunaObject* Eluna::CHECKOBJ<ElunaObject>(lua_State* luastate, int narg, bool error)
|
||||
template<> ALEObject* ALE::CHECKOBJ<ALEObject>(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<ElunaObject**>(lua_touserdata(luastate, narg));
|
||||
ALEObject** ptrHold = static_cast<ALEObject**>(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<typename K>
|
||||
static int cancelBinding(lua_State *L)
|
||||
{
|
||||
uint64 bindingID = Eluna::CHECKVAL<uint64>(L, lua_upvalueindex(1));
|
||||
uint64 bindingID = ALE::CHECKVAL<uint64>(L, lua_upvalueindex(1));
|
||||
|
||||
BindingMap<K>* bindings = (BindingMap<K>*)lua_touserdata(L, lua_upvalueindex(2));
|
||||
ASSERT(bindings != NULL);
|
||||
@@ -1266,7 +1266,7 @@ static int cancelBinding(lua_State *L)
|
||||
template<typename K>
|
||||
static void createCancelCallback(lua_State* L, uint64 bindingID, BindingMap<K>* 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<K>*
|
||||
}
|
||||
|
||||
// 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();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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 <mutex>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "lua.h"
|
||||
#include <lua.h>
|
||||
};
|
||||
|
||||
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<typename T> class ElunaTemplate;
|
||||
class ALEObject;
|
||||
template<typename T> class ALETemplate;
|
||||
|
||||
template<typename K> class BindingMap;
|
||||
template<typename T> 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<LuaScript> ScriptList;
|
||||
@@ -122,7 +122,7 @@ private:
|
||||
static bool reload;
|
||||
static bool initialized;
|
||||
static LockType lock;
|
||||
static std::unique_ptr<ElunaFileWatcher> fileWatcher;
|
||||
static std::unique_ptr<ALEFileWatcher> fileWatcher;
|
||||
|
||||
// Lua script locations
|
||||
static ScriptList lua_scripts;
|
||||
@@ -152,12 +152,12 @@ private:
|
||||
// Map from map ID -> Lua table ref
|
||||
std::unordered_map<uint32, int> 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<Eluna*>(lua_touserdata(L, -1));
|
||||
ALE* E = static_cast<ALE*>(lua_touserdata(L, -1));
|
||||
lua_pop(L, 1);
|
||||
ASSERT(E);
|
||||
return E;
|
||||
@@ -305,7 +305,7 @@ public:
|
||||
template<typename T>
|
||||
static void Push(lua_State* luastate, T const* ptr)
|
||||
{
|
||||
ElunaTemplate<T>::Push(luastate, ptr);
|
||||
ALETemplate<T>::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<typename T> static T* CHECKOBJ(lua_State* luastate, int narg, bool error = true)
|
||||
{
|
||||
return ElunaTemplate<T>::Check(luastate, narg, error);
|
||||
return ALETemplate<T>::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<Unit>(lua_State* L, int narg, bool error);
|
||||
template<> Object* Eluna::CHECKOBJ<Object>(lua_State* L, int narg, bool error);
|
||||
template<> WorldObject* Eluna::CHECKOBJ<WorldObject>(lua_State* L, int narg, bool error);
|
||||
template<> ElunaObject* Eluna::CHECKOBJ<ElunaObject>(lua_State* L, int narg, bool error);
|
||||
template<> Unit* ALE::CHECKOBJ<Unit>(lua_State* L, int narg, bool error);
|
||||
template<> Object* ALE::CHECKOBJ<Object>(lua_State* L, int narg, bool error);
|
||||
template<> WorldObject* ALE::CHECKOBJ<WorldObject>(lua_State* L, int narg, bool error);
|
||||
template<> ALEObject* ALE::CHECKOBJ<ALEObject>(lua_State* L, int narg, bool error);
|
||||
|
||||
#define sEluna Eluna::GEluna
|
||||
#define sALE ALE::GALE
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<Object> ObjectMethods[] =
|
||||
ALERegister<Object> ObjectMethods[] =
|
||||
{
|
||||
// Getters
|
||||
{ "GetEntry", &LuaObject::GetEntry },
|
||||
@@ -228,7 +228,7 @@ ElunaRegister<Object> ObjectMethods[] =
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
ElunaRegister<WorldObject> WorldObjectMethods[] =
|
||||
ALERegister<WorldObject> WorldObjectMethods[] =
|
||||
{
|
||||
// Getters
|
||||
{ "GetName", &LuaWorldObject::GetName },
|
||||
@@ -286,7 +286,7 @@ ElunaRegister<WorldObject> WorldObjectMethods[] =
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
ElunaRegister<Unit> UnitMethods[] =
|
||||
ALERegister<Unit> UnitMethods[] =
|
||||
{
|
||||
// Getters
|
||||
{ "GetLevel", &LuaUnit::GetLevel },
|
||||
@@ -473,7 +473,7 @@ ElunaRegister<Unit> UnitMethods[] =
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
ElunaRegister<Player> PlayerMethods[] =
|
||||
ALERegister<Player> PlayerMethods[] =
|
||||
{
|
||||
// Getters
|
||||
{ "GetSelection", &LuaPlayer::GetSelection },
|
||||
@@ -833,7 +833,7 @@ ElunaRegister<Player> PlayerMethods[] =
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
ElunaRegister<Creature> CreatureMethods[] =
|
||||
ALERegister<Creature> CreatureMethods[] =
|
||||
{
|
||||
// Getters
|
||||
{ "GetAITarget", &LuaCreature::GetAITarget },
|
||||
@@ -937,7 +937,7 @@ ElunaRegister<Creature> CreatureMethods[] =
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
ElunaRegister<GameObject> GameObjectMethods[] =
|
||||
ALERegister<GameObject> GameObjectMethods[] =
|
||||
{
|
||||
// Getters
|
||||
{ "GetDisplayId", &LuaGameObject::GetDisplayId },
|
||||
@@ -971,7 +971,7 @@ ElunaRegister<GameObject> GameObjectMethods[] =
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
ElunaRegister<Item> ItemMethods[] =
|
||||
ALERegister<Item> ItemMethods[] =
|
||||
{
|
||||
// Getters
|
||||
{ "GetOwnerGUID", &LuaItem::GetOwnerGUID },
|
||||
@@ -1040,7 +1040,7 @@ ElunaRegister<Item> ItemMethods[] =
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
ElunaRegister<ItemTemplate> ItemTemplateMethods[] =
|
||||
ALERegister<ItemTemplate> ItemTemplateMethods[] =
|
||||
{
|
||||
{ "GetItemId", &LuaItemTemplate::GetItemId },
|
||||
{ "GetClass", &LuaItemTemplate::GetClass },
|
||||
@@ -1062,7 +1062,7 @@ ElunaRegister<ItemTemplate> ItemTemplateMethods[] =
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
ElunaRegister<Aura> AuraMethods[] =
|
||||
ALERegister<Aura> AuraMethods[] =
|
||||
{
|
||||
// Getters
|
||||
{ "GetCaster", &LuaAura::GetCaster },
|
||||
@@ -1085,7 +1085,7 @@ ElunaRegister<Aura> AuraMethods[] =
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
ElunaRegister<Spell> SpellMethods[] =
|
||||
ALERegister<Spell> SpellMethods[] =
|
||||
{
|
||||
// Getters
|
||||
{ "GetCaster", &LuaSpell::GetCaster },
|
||||
@@ -1111,7 +1111,7 @@ ElunaRegister<Spell> SpellMethods[] =
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
ElunaRegister<Quest> QuestMethods[] =
|
||||
ALERegister<Quest> QuestMethods[] =
|
||||
{
|
||||
// Getters
|
||||
{ "GetId", &LuaQuest::GetId },
|
||||
@@ -1132,7 +1132,7 @@ ElunaRegister<Quest> QuestMethods[] =
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
ElunaRegister<Group> GroupMethods[] =
|
||||
ALERegister<Group> GroupMethods[] =
|
||||
{
|
||||
// Getters
|
||||
{ "GetMembers", &LuaGroup::GetMembers },
|
||||
@@ -1172,7 +1172,7 @@ ElunaRegister<Group> GroupMethods[] =
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
ElunaRegister<Guild> GuildMethods[] =
|
||||
ALERegister<Guild> GuildMethods[] =
|
||||
{
|
||||
// Getters
|
||||
{ "GetMembers", &LuaGuild::GetMembers },
|
||||
@@ -1209,7 +1209,7 @@ ElunaRegister<Guild> GuildMethods[] =
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
ElunaRegister<Vehicle> VehicleMethods[] =
|
||||
ALERegister<Vehicle> VehicleMethods[] =
|
||||
{
|
||||
// Getters
|
||||
{ "GetOwner", &LuaVehicle::GetOwner },
|
||||
@@ -1226,7 +1226,7 @@ ElunaRegister<Vehicle> VehicleMethods[] =
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
ElunaRegister<ElunaQuery> QueryMethods[] =
|
||||
ALERegister<ALEQuery> QueryMethods[] =
|
||||
{
|
||||
// Getters
|
||||
{ "GetColumnCount", &LuaQuery::GetColumnCount },
|
||||
@@ -1252,7 +1252,7 @@ ElunaRegister<ElunaQuery> QueryMethods[] =
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
ElunaRegister<WorldPacket> PacketMethods[] =
|
||||
ALERegister<WorldPacket> PacketMethods[] =
|
||||
{
|
||||
// Getters
|
||||
{ "GetOpcode", &LuaPacket::GetOpcode },
|
||||
@@ -1290,7 +1290,7 @@ ElunaRegister<WorldPacket> PacketMethods[] =
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
ElunaRegister<Map> MapMethods[] =
|
||||
ALERegister<Map> MapMethods[] =
|
||||
{
|
||||
// Getters
|
||||
{ "GetName", &LuaMap::GetName },
|
||||
@@ -1324,7 +1324,7 @@ ElunaRegister<Map> MapMethods[] =
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
ElunaRegister<Corpse> CorpseMethods[] =
|
||||
ALERegister<Corpse> CorpseMethods[] =
|
||||
{
|
||||
// Getters
|
||||
{ "GetOwnerGUID", &LuaCorpse::GetOwnerGUID },
|
||||
@@ -1338,12 +1338,12 @@ ElunaRegister<Corpse> CorpseMethods[] =
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
ElunaRegister<AuctionHouseEntry> AuctionMethods[] =
|
||||
ALERegister<AuctionHouseEntry> AuctionMethods[] =
|
||||
{
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
ElunaRegister<BattleGround> BattleGroundMethods[] =
|
||||
ALERegister<BattleGround> BattleGroundMethods[] =
|
||||
{
|
||||
// Getters
|
||||
{ "GetName", &LuaBattleGround::GetName },
|
||||
@@ -1367,7 +1367,7 @@ ElunaRegister<BattleGround> BattleGroundMethods[] =
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
ElunaRegister<ChatHandler> ChatHandlerMethods[] =
|
||||
ALERegister<ChatHandler> ChatHandlerMethods[] =
|
||||
{
|
||||
{ "SendSysMessage", &LuaChatHandler::SendSysMessage },
|
||||
{ "IsConsole", &LuaChatHandler::IsConsole },
|
||||
@@ -1387,7 +1387,7 @@ ElunaRegister<ChatHandler> ChatHandlerMethods[] =
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
ElunaRegister<AchievementEntry> AchievementMethods[] =
|
||||
ALERegister<AchievementEntry> AchievementMethods[] =
|
||||
{
|
||||
{ "GetId", &LuaAchievement::GetId },
|
||||
{ "GetName", &LuaAchievement::GetName },
|
||||
@@ -1395,7 +1395,7 @@ ElunaRegister<AchievementEntry> AchievementMethods[] =
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
ElunaRegister<Roll> RollMethods[] =
|
||||
ALERegister<Roll> RollMethods[] =
|
||||
{
|
||||
{ "GetItemGUID", &LuaRoll::GetItemGUID },
|
||||
{ "GetItemId", &LuaRoll::GetItemId },
|
||||
@@ -1414,7 +1414,7 @@ ElunaRegister<Roll> RollMethods[] =
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
ElunaRegister<GmTicket> TicketMethods[] =
|
||||
ALERegister<GmTicket> TicketMethods[] =
|
||||
{
|
||||
{ "IsClosed", &LuaTicket::IsClosed },
|
||||
{ "IsCompleted", &LuaTicket::IsCompleted },
|
||||
@@ -1447,7 +1447,7 @@ ElunaRegister<GmTicket> TicketMethods[] =
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
ElunaRegister<SpellInfo> SpellInfoMethods[] =
|
||||
ALERegister<SpellInfo> SpellInfoMethods[] =
|
||||
{
|
||||
// Getters
|
||||
{ "GetAttributes", &LuaSpellInfo::GetAttributes },
|
||||
@@ -1518,7 +1518,7 @@ ElunaRegister<SpellInfo> SpellInfoMethods[] =
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
ElunaRegister<GemPropertiesEntry> GemPropertiesEntryMethods[] =
|
||||
ALERegister<GemPropertiesEntry> GemPropertiesEntryMethods[] =
|
||||
{
|
||||
// Getters
|
||||
{ "GetId", &LuaGemPropertiesEntry::GetId },
|
||||
@@ -1527,7 +1527,7 @@ ElunaRegister<GemPropertiesEntry> GemPropertiesEntryMethods[] =
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
ElunaRegister<SpellEntry> SpellEntryMethods[] =
|
||||
ALERegister<SpellEntry> SpellEntryMethods[] =
|
||||
{
|
||||
// Getters
|
||||
{ "GetId", &LuaSpellEntry::GetId },
|
||||
@@ -1687,7 +1687,7 @@ ElunaRegister<SpellEntry> SpellEntryMethods[] =
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
ElunaRegister<Pet> PetMethods[] =
|
||||
ALERegister<Pet> PetMethods[] =
|
||||
{
|
||||
// Getters
|
||||
{ "GetPetType", &LuaPet::GetPetType },
|
||||
@@ -1746,7 +1746,7 @@ ElunaRegister<Pet> PetMethods[] =
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
ElunaRegister<Loot> LootMethods[] =
|
||||
ALERegister<Loot> LootMethods[] =
|
||||
{
|
||||
// Get
|
||||
{ "GetMoney", &LuaLoot::GetMoney },
|
||||
@@ -1789,165 +1789,165 @@ ElunaRegister<Loot> LootMethods[] =
|
||||
};
|
||||
|
||||
// fix compile error about accessing vehicle destructor
|
||||
template<> int ElunaTemplate<Vehicle>::CollectGarbage(lua_State* L)
|
||||
template<> int ALETemplate<Vehicle>::CollectGarbage(lua_State* L)
|
||||
{
|
||||
ASSERT(!manageMemory);
|
||||
|
||||
// Get object pointer (and check type, no error)
|
||||
ElunaObject* obj = Eluna::CHECKOBJ<ElunaObject>(L, 1, false);
|
||||
ALEObject* obj = ALE::CHECKOBJ<ALEObject>(L, 1, false);
|
||||
delete obj;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Template by Mud from http://stackoverflow.com/questions/4484437/lua-integer-type/4485511#4485511
|
||||
template<> int ElunaTemplate<unsigned long long>::Add(lua_State* L) { Eluna::Push(L, Eluna::CHECKVAL<unsigned long long>(L, 1) + Eluna::CHECKVAL<unsigned long long>(L, 2)); return 1; }
|
||||
template<> int ElunaTemplate<unsigned long long>::Substract(lua_State* L) { Eluna::Push(L, Eluna::CHECKVAL<unsigned long long>(L, 1) - Eluna::CHECKVAL<unsigned long long>(L, 2)); return 1; }
|
||||
template<> int ElunaTemplate<unsigned long long>::Multiply(lua_State* L) { Eluna::Push(L, Eluna::CHECKVAL<unsigned long long>(L, 1) * Eluna::CHECKVAL<unsigned long long>(L, 2)); return 1; }
|
||||
template<> int ElunaTemplate<unsigned long long>::Divide(lua_State* L) { Eluna::Push(L, Eluna::CHECKVAL<unsigned long long>(L, 1) / Eluna::CHECKVAL<unsigned long long>(L, 2)); return 1; }
|
||||
template<> int ElunaTemplate<unsigned long long>::Mod(lua_State* L) { Eluna::Push(L, Eluna::CHECKVAL<unsigned long long>(L, 1) % Eluna::CHECKVAL<unsigned long long>(L, 2)); return 1; }
|
||||
// template<> int ElunaTemplate<unsigned long long>::UnaryMinus(lua_State* L) { Eluna::Push(L, -Eluna::CHECKVAL<unsigned long long>(L, 1)); return 1; }
|
||||
template<> int ElunaTemplate<unsigned long long>::Equal(lua_State* L) { Eluna::Push(L, Eluna::CHECKVAL<unsigned long long>(L, 1) == Eluna::CHECKVAL<unsigned long long>(L, 2)); return 1; }
|
||||
template<> int ElunaTemplate<unsigned long long>::Less(lua_State* L) { Eluna::Push(L, Eluna::CHECKVAL<unsigned long long>(L, 1) < Eluna::CHECKVAL<unsigned long long>(L, 2)); return 1; }
|
||||
template<> int ElunaTemplate<unsigned long long>::LessOrEqual(lua_State* L) { Eluna::Push(L, Eluna::CHECKVAL<unsigned long long>(L, 1) <= Eluna::CHECKVAL<unsigned long long>(L, 2)); return 1; }
|
||||
template<> int ElunaTemplate<unsigned long long>::Pow(lua_State* L)
|
||||
template<> int ALETemplate<unsigned long long>::Add(lua_State* L) { ALE::Push(L, ALE::CHECKVAL<unsigned long long>(L, 1) + ALE::CHECKVAL<unsigned long long>(L, 2)); return 1; }
|
||||
template<> int ALETemplate<unsigned long long>::Substract(lua_State* L) { ALE::Push(L, ALE::CHECKVAL<unsigned long long>(L, 1) - ALE::CHECKVAL<unsigned long long>(L, 2)); return 1; }
|
||||
template<> int ALETemplate<unsigned long long>::Multiply(lua_State* L) { ALE::Push(L, ALE::CHECKVAL<unsigned long long>(L, 1) * ALE::CHECKVAL<unsigned long long>(L, 2)); return 1; }
|
||||
template<> int ALETemplate<unsigned long long>::Divide(lua_State* L) { ALE::Push(L, ALE::CHECKVAL<unsigned long long>(L, 1) / ALE::CHECKVAL<unsigned long long>(L, 2)); return 1; }
|
||||
template<> int ALETemplate<unsigned long long>::Mod(lua_State* L) { ALE::Push(L, ALE::CHECKVAL<unsigned long long>(L, 1) % ALE::CHECKVAL<unsigned long long>(L, 2)); return 1; }
|
||||
// template<> int ALETemplate<unsigned long long>::UnaryMinus(lua_State* L) { ALE::Push(L, -ALE::CHECKVAL<unsigned long long>(L, 1)); return 1; }
|
||||
template<> int ALETemplate<unsigned long long>::Equal(lua_State* L) { ALE::Push(L, ALE::CHECKVAL<unsigned long long>(L, 1) == ALE::CHECKVAL<unsigned long long>(L, 2)); return 1; }
|
||||
template<> int ALETemplate<unsigned long long>::Less(lua_State* L) { ALE::Push(L, ALE::CHECKVAL<unsigned long long>(L, 1) < ALE::CHECKVAL<unsigned long long>(L, 2)); return 1; }
|
||||
template<> int ALETemplate<unsigned long long>::LessOrEqual(lua_State* L) { ALE::Push(L, ALE::CHECKVAL<unsigned long long>(L, 1) <= ALE::CHECKVAL<unsigned long long>(L, 2)); return 1; }
|
||||
template<> int ALETemplate<unsigned long long>::Pow(lua_State* L)
|
||||
{
|
||||
Eluna::Push(L, static_cast<unsigned long long>(powl(static_cast<long double>(Eluna::CHECKVAL<unsigned long long>(L, 1)), static_cast<long double>(Eluna::CHECKVAL<unsigned long long>(L, 2)))));
|
||||
ALE::Push(L, static_cast<unsigned long long>(powl(static_cast<long double>(ALE::CHECKVAL<unsigned long long>(L, 1)), static_cast<long double>(ALE::CHECKVAL<unsigned long long>(L, 2)))));
|
||||
return 1;
|
||||
}
|
||||
template<> int ElunaTemplate<unsigned long long>::ToString(lua_State* L)
|
||||
template<> int ALETemplate<unsigned long long>::ToString(lua_State* L)
|
||||
{
|
||||
unsigned long long l = Eluna::CHECKVAL<unsigned long long>(L, 1);
|
||||
unsigned long long l = ALE::CHECKVAL<unsigned long long>(L, 1);
|
||||
std::ostringstream ss;
|
||||
ss << l;
|
||||
Eluna::Push(L, ss.str());
|
||||
ALE::Push(L, ss.str());
|
||||
return 1;
|
||||
}
|
||||
|
||||
template<> int ElunaTemplate<long long>::Add(lua_State* L) { Eluna::Push(L, Eluna::CHECKVAL<long long>(L, 1) + Eluna::CHECKVAL<long long>(L, 2)); return 1; }
|
||||
template<> int ElunaTemplate<long long>::Substract(lua_State* L) { Eluna::Push(L, Eluna::CHECKVAL<long long>(L, 1) - Eluna::CHECKVAL<long long>(L, 2)); return 1; }
|
||||
template<> int ElunaTemplate<long long>::Multiply(lua_State* L) { Eluna::Push(L, Eluna::CHECKVAL<long long>(L, 1) * Eluna::CHECKVAL<long long>(L, 2)); return 1; }
|
||||
template<> int ElunaTemplate<long long>::Divide(lua_State* L) { Eluna::Push(L, Eluna::CHECKVAL<long long>(L, 1) / Eluna::CHECKVAL<long long>(L, 2)); return 1; }
|
||||
template<> int ElunaTemplate<long long>::Mod(lua_State* L) { Eluna::Push(L, Eluna::CHECKVAL<long long>(L, 1) % Eluna::CHECKVAL<long long>(L, 2)); return 1; }
|
||||
template<> int ElunaTemplate<long long>::UnaryMinus(lua_State* L) { Eluna::Push(L, -Eluna::CHECKVAL<long long>(L, 1)); return 1; }
|
||||
template<> int ElunaTemplate<long long>::Equal(lua_State* L) { Eluna::Push(L, Eluna::CHECKVAL<long long>(L, 1) == Eluna::CHECKVAL<long long>(L, 2)); return 1; }
|
||||
template<> int ElunaTemplate<long long>::Less(lua_State* L) { Eluna::Push(L, Eluna::CHECKVAL<long long>(L, 1) < Eluna::CHECKVAL<long long>(L, 2)); return 1; }
|
||||
template<> int ElunaTemplate<long long>::LessOrEqual(lua_State* L) { Eluna::Push(L, Eluna::CHECKVAL<long long>(L, 1) <= Eluna::CHECKVAL<long long>(L, 2)); return 1; }
|
||||
template<> int ElunaTemplate<long long>::Pow(lua_State* L)
|
||||
template<> int ALETemplate<long long>::Add(lua_State* L) { ALE::Push(L, ALE::CHECKVAL<long long>(L, 1) + ALE::CHECKVAL<long long>(L, 2)); return 1; }
|
||||
template<> int ALETemplate<long long>::Substract(lua_State* L) { ALE::Push(L, ALE::CHECKVAL<long long>(L, 1) - ALE::CHECKVAL<long long>(L, 2)); return 1; }
|
||||
template<> int ALETemplate<long long>::Multiply(lua_State* L) { ALE::Push(L, ALE::CHECKVAL<long long>(L, 1) * ALE::CHECKVAL<long long>(L, 2)); return 1; }
|
||||
template<> int ALETemplate<long long>::Divide(lua_State* L) { ALE::Push(L, ALE::CHECKVAL<long long>(L, 1) / ALE::CHECKVAL<long long>(L, 2)); return 1; }
|
||||
template<> int ALETemplate<long long>::Mod(lua_State* L) { ALE::Push(L, ALE::CHECKVAL<long long>(L, 1) % ALE::CHECKVAL<long long>(L, 2)); return 1; }
|
||||
template<> int ALETemplate<long long>::UnaryMinus(lua_State* L) { ALE::Push(L, -ALE::CHECKVAL<long long>(L, 1)); return 1; }
|
||||
template<> int ALETemplate<long long>::Equal(lua_State* L) { ALE::Push(L, ALE::CHECKVAL<long long>(L, 1) == ALE::CHECKVAL<long long>(L, 2)); return 1; }
|
||||
template<> int ALETemplate<long long>::Less(lua_State* L) { ALE::Push(L, ALE::CHECKVAL<long long>(L, 1) < ALE::CHECKVAL<long long>(L, 2)); return 1; }
|
||||
template<> int ALETemplate<long long>::LessOrEqual(lua_State* L) { ALE::Push(L, ALE::CHECKVAL<long long>(L, 1) <= ALE::CHECKVAL<long long>(L, 2)); return 1; }
|
||||
template<> int ALETemplate<long long>::Pow(lua_State* L)
|
||||
{
|
||||
Eluna::Push(L, static_cast<long long>(powl(static_cast<long double>(Eluna::CHECKVAL<long long>(L, 1)), static_cast<long double>(Eluna::CHECKVAL<long long>(L, 2)))));
|
||||
ALE::Push(L, static_cast<long long>(powl(static_cast<long double>(ALE::CHECKVAL<long long>(L, 1)), static_cast<long double>(ALE::CHECKVAL<long long>(L, 2)))));
|
||||
return 1;
|
||||
}
|
||||
template<> int ElunaTemplate<long long>::ToString(lua_State* L)
|
||||
template<> int ALETemplate<long long>::ToString(lua_State* L)
|
||||
{
|
||||
long long l = Eluna::CHECKVAL<long long>(L, 1);
|
||||
long long l = ALE::CHECKVAL<long long>(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<Object>::Register(E, "Object");
|
||||
ElunaTemplate<Object>::SetMethods(E, ObjectMethods);
|
||||
ALETemplate<Object>::Register(E, "Object");
|
||||
ALETemplate<Object>::SetMethods(E, ObjectMethods);
|
||||
|
||||
ElunaTemplate<WorldObject>::Register(E, "WorldObject");
|
||||
ElunaTemplate<WorldObject>::SetMethods(E, ObjectMethods);
|
||||
ElunaTemplate<WorldObject>::SetMethods(E, WorldObjectMethods);
|
||||
ALETemplate<WorldObject>::Register(E, "WorldObject");
|
||||
ALETemplate<WorldObject>::SetMethods(E, ObjectMethods);
|
||||
ALETemplate<WorldObject>::SetMethods(E, WorldObjectMethods);
|
||||
|
||||
ElunaTemplate<Unit>::Register(E, "Unit");
|
||||
ElunaTemplate<Unit>::SetMethods(E, ObjectMethods);
|
||||
ElunaTemplate<Unit>::SetMethods(E, WorldObjectMethods);
|
||||
ElunaTemplate<Unit>::SetMethods(E, UnitMethods);
|
||||
ALETemplate<Unit>::Register(E, "Unit");
|
||||
ALETemplate<Unit>::SetMethods(E, ObjectMethods);
|
||||
ALETemplate<Unit>::SetMethods(E, WorldObjectMethods);
|
||||
ALETemplate<Unit>::SetMethods(E, UnitMethods);
|
||||
|
||||
ElunaTemplate<Player>::Register(E, "Player");
|
||||
ElunaTemplate<Player>::SetMethods(E, ObjectMethods);
|
||||
ElunaTemplate<Player>::SetMethods(E, WorldObjectMethods);
|
||||
ElunaTemplate<Player>::SetMethods(E, UnitMethods);
|
||||
ElunaTemplate<Player>::SetMethods(E, PlayerMethods);
|
||||
ALETemplate<Player>::Register(E, "Player");
|
||||
ALETemplate<Player>::SetMethods(E, ObjectMethods);
|
||||
ALETemplate<Player>::SetMethods(E, WorldObjectMethods);
|
||||
ALETemplate<Player>::SetMethods(E, UnitMethods);
|
||||
ALETemplate<Player>::SetMethods(E, PlayerMethods);
|
||||
|
||||
ElunaTemplate<Creature>::Register(E, "Creature");
|
||||
ElunaTemplate<Creature>::SetMethods(E, ObjectMethods);
|
||||
ElunaTemplate<Creature>::SetMethods(E, WorldObjectMethods);
|
||||
ElunaTemplate<Creature>::SetMethods(E, UnitMethods);
|
||||
ElunaTemplate<Creature>::SetMethods(E, CreatureMethods);
|
||||
ALETemplate<Creature>::Register(E, "Creature");
|
||||
ALETemplate<Creature>::SetMethods(E, ObjectMethods);
|
||||
ALETemplate<Creature>::SetMethods(E, WorldObjectMethods);
|
||||
ALETemplate<Creature>::SetMethods(E, UnitMethods);
|
||||
ALETemplate<Creature>::SetMethods(E, CreatureMethods);
|
||||
|
||||
ElunaTemplate<GameObject>::Register(E, "GameObject");
|
||||
ElunaTemplate<GameObject>::SetMethods(E, ObjectMethods);
|
||||
ElunaTemplate<GameObject>::SetMethods(E, WorldObjectMethods);
|
||||
ElunaTemplate<GameObject>::SetMethods(E, GameObjectMethods);
|
||||
ALETemplate<GameObject>::Register(E, "GameObject");
|
||||
ALETemplate<GameObject>::SetMethods(E, ObjectMethods);
|
||||
ALETemplate<GameObject>::SetMethods(E, WorldObjectMethods);
|
||||
ALETemplate<GameObject>::SetMethods(E, GameObjectMethods);
|
||||
|
||||
ElunaTemplate<Corpse>::Register(E, "Corpse");
|
||||
ElunaTemplate<Corpse>::SetMethods(E, ObjectMethods);
|
||||
ElunaTemplate<Corpse>::SetMethods(E, WorldObjectMethods);
|
||||
ElunaTemplate<Corpse>::SetMethods(E, CorpseMethods);
|
||||
ALETemplate<Corpse>::Register(E, "Corpse");
|
||||
ALETemplate<Corpse>::SetMethods(E, ObjectMethods);
|
||||
ALETemplate<Corpse>::SetMethods(E, WorldObjectMethods);
|
||||
ALETemplate<Corpse>::SetMethods(E, CorpseMethods);
|
||||
|
||||
ElunaTemplate<Item>::Register(E, "Item");
|
||||
ElunaTemplate<Item>::SetMethods(E, ObjectMethods);
|
||||
ElunaTemplate<Item>::SetMethods(E, ItemMethods);
|
||||
ALETemplate<Item>::Register(E, "Item");
|
||||
ALETemplate<Item>::SetMethods(E, ObjectMethods);
|
||||
ALETemplate<Item>::SetMethods(E, ItemMethods);
|
||||
|
||||
ElunaTemplate<ItemTemplate>::Register(E, "ItemTemplate");
|
||||
ElunaTemplate<ItemTemplate>::SetMethods(E, ItemTemplateMethods);
|
||||
ALETemplate<ItemTemplate>::Register(E, "ItemTemplate");
|
||||
ALETemplate<ItemTemplate>::SetMethods(E, ItemTemplateMethods);
|
||||
|
||||
ElunaTemplate<Vehicle>::Register(E, "Vehicle");
|
||||
ElunaTemplate<Vehicle>::SetMethods(E, VehicleMethods);
|
||||
ALETemplate<Vehicle>::Register(E, "Vehicle");
|
||||
ALETemplate<Vehicle>::SetMethods(E, VehicleMethods);
|
||||
|
||||
ElunaTemplate<Group>::Register(E, "Group");
|
||||
ElunaTemplate<Group>::SetMethods(E, GroupMethods);
|
||||
ALETemplate<Group>::Register(E, "Group");
|
||||
ALETemplate<Group>::SetMethods(E, GroupMethods);
|
||||
|
||||
ElunaTemplate<Guild>::Register(E, "Guild");
|
||||
ElunaTemplate<Guild>::SetMethods(E, GuildMethods);
|
||||
ALETemplate<Guild>::Register(E, "Guild");
|
||||
ALETemplate<Guild>::SetMethods(E, GuildMethods);
|
||||
|
||||
ElunaTemplate<Aura>::Register(E, "Aura");
|
||||
ElunaTemplate<Aura>::SetMethods(E, AuraMethods);
|
||||
ALETemplate<Aura>::Register(E, "Aura");
|
||||
ALETemplate<Aura>::SetMethods(E, AuraMethods);
|
||||
|
||||
ElunaTemplate<Spell>::Register(E, "Spell");
|
||||
ElunaTemplate<Spell>::SetMethods(E, SpellMethods);
|
||||
ALETemplate<Spell>::Register(E, "Spell");
|
||||
ALETemplate<Spell>::SetMethods(E, SpellMethods);
|
||||
|
||||
ElunaTemplate<Quest>::Register(E, "Quest");
|
||||
ElunaTemplate<Quest>::SetMethods(E, QuestMethods);
|
||||
ALETemplate<Quest>::Register(E, "Quest");
|
||||
ALETemplate<Quest>::SetMethods(E, QuestMethods);
|
||||
|
||||
ElunaTemplate<Map>::Register(E, "Map");
|
||||
ElunaTemplate<Map>::SetMethods(E, MapMethods);
|
||||
ALETemplate<Map>::Register(E, "Map");
|
||||
ALETemplate<Map>::SetMethods(E, MapMethods);
|
||||
|
||||
ElunaTemplate<AuctionHouseEntry>::Register(E, "AuctionHouseEntry");
|
||||
ElunaTemplate<AuctionHouseEntry>::SetMethods(E, AuctionMethods);
|
||||
ALETemplate<AuctionHouseEntry>::Register(E, "AuctionHouseEntry");
|
||||
ALETemplate<AuctionHouseEntry>::SetMethods(E, AuctionMethods);
|
||||
|
||||
ElunaTemplate<BattleGround>::Register(E, "BattleGround");
|
||||
ElunaTemplate<BattleGround>::SetMethods(E, BattleGroundMethods);
|
||||
ALETemplate<BattleGround>::Register(E, "BattleGround");
|
||||
ALETemplate<BattleGround>::SetMethods(E, BattleGroundMethods);
|
||||
|
||||
ElunaTemplate<ChatHandler>::Register(E, "ChatHandler");
|
||||
ElunaTemplate<ChatHandler>::SetMethods(E, ChatHandlerMethods);
|
||||
ALETemplate<ChatHandler>::Register(E, "ChatHandler");
|
||||
ALETemplate<ChatHandler>::SetMethods(E, ChatHandlerMethods);
|
||||
|
||||
ElunaTemplate<WorldPacket>::Register(E, "WorldPacket", true);
|
||||
ElunaTemplate<WorldPacket>::SetMethods(E, PacketMethods);
|
||||
ALETemplate<WorldPacket>::Register(E, "WorldPacket", true);
|
||||
ALETemplate<WorldPacket>::SetMethods(E, PacketMethods);
|
||||
|
||||
ElunaTemplate<ElunaQuery>::Register(E, "ElunaQuery", true);
|
||||
ElunaTemplate<ElunaQuery>::SetMethods(E, QueryMethods);
|
||||
ALETemplate<ALEQuery>::Register(E, "ALEQuery", true);
|
||||
ALETemplate<ALEQuery>::SetMethods(E, QueryMethods);
|
||||
|
||||
ElunaTemplate<AchievementEntry>::Register(E, "AchievementEntry");
|
||||
ElunaTemplate<AchievementEntry>::SetMethods(E, AchievementMethods);
|
||||
ALETemplate<AchievementEntry>::Register(E, "AchievementEntry");
|
||||
ALETemplate<AchievementEntry>::SetMethods(E, AchievementMethods);
|
||||
|
||||
ElunaTemplate<Roll>::Register(E, "Roll");
|
||||
ElunaTemplate<Roll>::SetMethods(E, RollMethods);
|
||||
ALETemplate<Roll>::Register(E, "Roll");
|
||||
ALETemplate<Roll>::SetMethods(E, RollMethods);
|
||||
|
||||
ElunaTemplate<GmTicket>::Register(E, "Ticket");
|
||||
ElunaTemplate<GmTicket>::SetMethods(E, TicketMethods);
|
||||
ALETemplate<GmTicket>::Register(E, "Ticket");
|
||||
ALETemplate<GmTicket>::SetMethods(E, TicketMethods);
|
||||
|
||||
ElunaTemplate<SpellInfo>::Register(E, "SpellInfo");
|
||||
ElunaTemplate<SpellInfo>::SetMethods(E, SpellInfoMethods);
|
||||
ALETemplate<SpellInfo>::Register(E, "SpellInfo");
|
||||
ALETemplate<SpellInfo>::SetMethods(E, SpellInfoMethods);
|
||||
|
||||
ElunaTemplate<GemPropertiesEntry>::Register(E, "GemPropertiesEntry");
|
||||
ElunaTemplate<GemPropertiesEntry>::SetMethods(E, GemPropertiesEntryMethods);
|
||||
ALETemplate<GemPropertiesEntry>::Register(E, "GemPropertiesEntry");
|
||||
ALETemplate<GemPropertiesEntry>::SetMethods(E, GemPropertiesEntryMethods);
|
||||
|
||||
ElunaTemplate<SpellEntry>::Register(E, "SpellEntry");
|
||||
ElunaTemplate<SpellEntry>::SetMethods(E, SpellEntryMethods);
|
||||
ALETemplate<SpellEntry>::Register(E, "SpellEntry");
|
||||
ALETemplate<SpellEntry>::SetMethods(E, SpellEntryMethods);
|
||||
|
||||
ElunaTemplate<CreatureTemplate>::Register(E, "CreatureTemplate");
|
||||
ALETemplate<CreatureTemplate>::Register(E, "CreatureTemplate");
|
||||
|
||||
ElunaTemplate<long long>::Register(E, "long long", true);
|
||||
ALETemplate<long long>::Register(E, "long long", true);
|
||||
|
||||
ElunaTemplate<unsigned long long>::Register(E, "unsigned long long", true);
|
||||
ALETemplate<unsigned long long>::Register(E, "unsigned long long", true);
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.5 KiB |
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<AllCreatureEvents>(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<AllCreatureEvents>(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);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<BGEvents>(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);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<CreatureEvents>(EVENT, CREATURE->GetEntry());\
|
||||
auto unique_key = UniqueObjectKey<CreatureEvents>(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<CreatureEvents>(EVENT, CREATURE->GetEntry());\
|
||||
auto unique_key = UniqueObjectKey<CreatureEvents>(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<uint32>(L, r + 1);
|
||||
damage = ALE::CHECKVAL<uint32>(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<uint32>(L, r + 1);
|
||||
respawnDelay = ALE::CHECKVAL<uint32>(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);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<GameObjectEvents>(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<GameObjectEvents>(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);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<GossipEvents>(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<GossipEvents>(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;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<GroupEvents>(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);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<GuildEvents>(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);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<InstanceEvents>(EVENT, AI->instance->GetId());\
|
||||
auto instanceKey = EntryKey<InstanceEvents>(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<InstanceEvents>(EVENT, AI->instance->GetId());\
|
||||
auto instanceKey = EntryKey<InstanceEvents>(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);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<ItemEvents>(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<ItemEvents>(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);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<ServerEvents>(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<PacketEvents>(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));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<PlayerEvents>(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<PlayerEvents>(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);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<ServerEvents>(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<ServerEvents>(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);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<SpellEvents>(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<SpellEvents>(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);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<TicketEvents>(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<TicketEvents>(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);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<VehicleEvents>(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);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* lmarshal.c
|
||||
* A Lua library for serializing and deserializing Lua values
|
||||
* Richard Hundt <richardhundt@gmail.com>, Eluna Lua Engine <http://emudevs.com/>
|
||||
* Richard Hundt <richardhundt@gmail.com>, Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
*
|
||||
* License: MIT
|
||||
*
|
||||
@@ -32,7 +32,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <cstdint>
|
||||
#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)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* This program is free software licensed under GPL version 3
|
||||
* Please see the included DOCS/LICENSE.md for more information
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<uint32>(L, 2);
|
||||
uint32 field = ALE::CHECKVAL<uint32>(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<uint32>(L, 2);
|
||||
uint32 col = ALE::CHECKVAL<uint32>(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<uint32>(L, 2);
|
||||
uint32 col = ALE::CHECKVAL<uint32>(L, 2);
|
||||
CheckFields(L, result);
|
||||
Eluna::Push(L, RESULT->Fetch()[col].Get<bool>());
|
||||
ALE::Push(L, RESULT->Fetch()[col].Get<bool>());
|
||||
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<uint32>(L, 2);
|
||||
uint32 col = ALE::CHECKVAL<uint32>(L, 2);
|
||||
CheckFields(L, result);
|
||||
Eluna::Push(L, RESULT->Fetch()[col].Get<uint8>());
|
||||
ALE::Push(L, RESULT->Fetch()[col].Get<uint8>());
|
||||
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<uint32>(L, 2);
|
||||
uint32 col = ALE::CHECKVAL<uint32>(L, 2);
|
||||
CheckFields(L, result);
|
||||
Eluna::Push(L, RESULT->Fetch()[col].Get<uint16>());
|
||||
ALE::Push(L, RESULT->Fetch()[col].Get<uint16>());
|
||||
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<uint32>(L, 2);
|
||||
uint32 col = ALE::CHECKVAL<uint32>(L, 2);
|
||||
CheckFields(L, result);
|
||||
Eluna::Push(L, RESULT->Fetch()[col].Get<uint32>());
|
||||
ALE::Push(L, RESULT->Fetch()[col].Get<uint32>());
|
||||
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<uint32>(L, 2);
|
||||
uint32 col = ALE::CHECKVAL<uint32>(L, 2);
|
||||
CheckFields(L, result);
|
||||
Eluna::Push(L, RESULT->Fetch()[col].Get<uint64>());
|
||||
ALE::Push(L, RESULT->Fetch()[col].Get<uint64>());
|
||||
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<uint32>(L, 2);
|
||||
uint32 col = ALE::CHECKVAL<uint32>(L, 2);
|
||||
CheckFields(L, result);
|
||||
Eluna::Push(L, RESULT->Fetch()[col].Get<int8>());
|
||||
ALE::Push(L, RESULT->Fetch()[col].Get<int8>());
|
||||
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<uint32>(L, 2);
|
||||
uint32 col = ALE::CHECKVAL<uint32>(L, 2);
|
||||
CheckFields(L, result);
|
||||
Eluna::Push(L, RESULT->Fetch()[col].Get<int16>());
|
||||
ALE::Push(L, RESULT->Fetch()[col].Get<int16>());
|
||||
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<uint32>(L, 2);
|
||||
uint32 col = ALE::CHECKVAL<uint32>(L, 2);
|
||||
CheckFields(L, result);
|
||||
Eluna::Push(L, RESULT->Fetch()[col].Get<int32>());
|
||||
ALE::Push(L, RESULT->Fetch()[col].Get<int32>());
|
||||
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<uint32>(L, 2);
|
||||
uint32 col = ALE::CHECKVAL<uint32>(L, 2);
|
||||
CheckFields(L, result);
|
||||
Eluna::Push(L, RESULT->Fetch()[col].Get<int64>());
|
||||
ALE::Push(L, RESULT->Fetch()[col].Get<int64>());
|
||||
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<uint32>(L, 2);
|
||||
uint32 col = ALE::CHECKVAL<uint32>(L, 2);
|
||||
CheckFields(L, result);
|
||||
Eluna::Push(L, RESULT->Fetch()[col].Get<float>());
|
||||
ALE::Push(L, RESULT->Fetch()[col].Get<float>());
|
||||
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<uint32>(L, 2);
|
||||
uint32 col = ALE::CHECKVAL<uint32>(L, 2);
|
||||
CheckFields(L, result);
|
||||
Eluna::Push(L, RESULT->Fetch()[col].Get<double>());
|
||||
ALE::Push(L, RESULT->Fetch()[col].Get<double>());
|
||||
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<uint32>(L, 2);
|
||||
uint32 col = ALE::CHECKVAL<uint32>(L, 2);
|
||||
CheckFields(L, result);
|
||||
Eluna::Push(L, RESULT->Fetch()[col].Get<std::string>());
|
||||
ALE::Push(L, RESULT->Fetch()[col].Get<std::string>());
|
||||
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<std::string>();
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<uint8>(L, 2, DEFAULT_LOCALE);
|
||||
uint8 locale = ALE::CHECKVAL<uint8>(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;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<int32>(L, 2);
|
||||
int32 duration = ALE::CHECKVAL<int32>(L, 2);
|
||||
aura->SetDuration(duration);
|
||||
return 0;
|
||||
}
|
||||
@@ -136,7 +136,7 @@ namespace LuaAura
|
||||
*/
|
||||
int SetMaxDuration(lua_State* L, Aura* aura)
|
||||
{
|
||||
int32 duration = Eluna::CHECKVAL<int32>(L, 2);
|
||||
int32 duration = ALE::CHECKVAL<int32>(L, 2);
|
||||
aura->SetMaxDuration(duration);
|
||||
return 0;
|
||||
}
|
||||
@@ -151,7 +151,7 @@ namespace LuaAura
|
||||
*/
|
||||
int SetStackAmount(lua_State* L, Aura* aura)
|
||||
{
|
||||
uint8 amount = Eluna::CHECKVAL<uint8>(L, 2);
|
||||
uint8 amount = ALE::CHECKVAL<uint8>(L, 2);
|
||||
aura->SetStackAmount(amount);
|
||||
return 0;
|
||||
}
|
||||
@@ -162,7 +162,7 @@ namespace LuaAura
|
||||
int Remove(lua_State* L, Aura* aura)
|
||||
{
|
||||
aura->Remove();
|
||||
Eluna::CHECKOBJ<ElunaObject>(L, 1)->Invalidate();
|
||||
ALE::CHECKOBJ<ALEObject>(L, 1)->Invalidate();
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<uint32>(L, 2);
|
||||
uint32 team = ALE::CHECKVAL<uint32>(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<uint32>(L, 2);
|
||||
uint32 kills = ALE::CHECKVAL<uint32>(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<uint32>(L, 2);
|
||||
uint32 team = ALE::CHECKVAL<uint32>(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;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<uint32>(L, 2);
|
||||
uint32 entry = ALE::CHECKVAL<uint32>(L, 2);
|
||||
handler->SendSysMessage(entry);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string text = Eluna::CHECKVAL<std::string>(L, 2);
|
||||
std::string text = ALE::CHECKVAL<std::string>(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<std::string>(L, 2);
|
||||
std::string text = ALE::CHECKVAL<std::string>(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<std::string>(L, 2);
|
||||
std::string text = ALE::CHECKVAL<std::string>(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<Player>(L, 2);
|
||||
bool strong = Eluna::CHECKVAL<bool>(L, 3);
|
||||
Eluna::Push(L, handler->HasLowerSecurity(player, ObjectGuid::Empty, strong));
|
||||
Player* player = ALE::CHECKOBJ<Player>(L, 2);
|
||||
bool strong = ALE::CHECKVAL<bool>(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<uint32>(L, 2);
|
||||
bool strong = Eluna::CHECKVAL<bool>(L, 3);
|
||||
Eluna::Push(L, handler->HasLowerSecurityAccount(nullptr, account, strong));
|
||||
uint32 account = ALE::CHECKVAL<uint32>(L, 2);
|
||||
bool strong = ALE::CHECKVAL<bool>(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<uint32>(L, 2);
|
||||
Eluna::Push(L, handler->IsAvailable(securityLevel));
|
||||
uint32 securityLevel = ALE::CHECKVAL<uint32>(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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<bool>(L, 2, true);
|
||||
bool enable = ALE::CHECKVAL<bool>(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<uint32>(L, 2);
|
||||
uint32 quest_id = ALE::CHECKVAL<uint32>(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<bool>(L, 2, false);
|
||||
bool mustBeDead = ALE::CHECKVAL<bool>(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<Unit>(L, 2);
|
||||
Unit* enemy = Eluna::CHECKOBJ<Unit>(L, 3);
|
||||
bool checkfaction = Eluna::CHECKVAL<bool>(L, 4, true);
|
||||
Unit* u = ALE::CHECKOBJ<Unit>(L, 2);
|
||||
Unit* enemy = ALE::CHECKOBJ<Unit>(L, 3);
|
||||
bool checkfaction = ALE::CHECKVAL<bool>(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<Player>(L, 2);
|
||||
Player* player = ALE::CHECKOBJ<Player>(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<uint32>(L, 2);
|
||||
uint32 spell = ALE::CHECKVAL<uint32>(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<uint32>(L, 2);
|
||||
uint32 id = ALE::CHECKVAL<uint32>(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<uint32>(L, 2);
|
||||
uint32 questId = ALE::CHECKVAL<uint32>(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<uint32>(L, 2);
|
||||
uint32 spellId = ALE::CHECKVAL<uint32>(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<Unit>(L, 2);
|
||||
Unit* target = ALE::CHECKOBJ<Unit>(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<uint16>(L, 2);
|
||||
uint16 lootMode = ALE::CHECKVAL<uint16>(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<Unit>(L, 2);
|
||||
Unit* target = ALE::CHECKOBJ<Unit>(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<uint32>(L, 2);
|
||||
uint32 spell = ALE::CHECKVAL<uint32>(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<float>(L, 2);
|
||||
float y = Eluna::CHECKVAL<float>(L, 3);
|
||||
float z = Eluna::CHECKVAL<float>(L, 4);
|
||||
float o = Eluna::CHECKVAL<float>(L, 5);
|
||||
float x = ALE::CHECKVAL<float>(L, 2);
|
||||
float y = ALE::CHECKVAL<float>(L, 3);
|
||||
float z = ALE::CHECKVAL<float>(L, 4);
|
||||
float o = ALE::CHECKVAL<float>(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<uint32>(L, 2);
|
||||
bool playerOnly = Eluna::CHECKVAL<bool>(L, 3, false);
|
||||
uint32 position = Eluna::CHECKVAL<uint32>(L, 4, 0);
|
||||
float dist = Eluna::CHECKVAL<float>(L, 5, 0.0f);
|
||||
int32 aura = Eluna::CHECKVAL<int32>(L, 6, 0);
|
||||
uint32 targetType = ALE::CHECKVAL<uint32>(L, 2);
|
||||
bool playerOnly = ALE::CHECKVAL<bool>(L, 3, false);
|
||||
uint32 position = ALE::CHECKVAL<uint32>(L, 4, 0);
|
||||
float dist = ALE::CHECKVAL<float>(L, 5, 0.0f);
|
||||
int32 aura = ALE::CHECKVAL<int32>(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<Unit*>::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<Unit*>::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<uint32>(L, 2);
|
||||
uint32 flags = ALE::CHECKVAL<uint32>(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<uint32>(L, 2);
|
||||
uint32 flags = ALE::CHECKVAL<uint32>(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<uint32>(L, 2);
|
||||
uint32 flags = ALE::CHECKVAL<uint32>(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<uint32>(L, 2);
|
||||
uint32 state = ALE::CHECKVAL<uint32>(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<bool>(L, 2);
|
||||
bool disable = ALE::CHECKVAL<bool>(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<uint16>(L, 2);
|
||||
uint16 lootMode = ALE::CHECKVAL<uint16>(L, 2);
|
||||
|
||||
creature->SetLootMode(lootMode);
|
||||
return 0;
|
||||
@@ -963,7 +963,7 @@ namespace LuaCreature
|
||||
*/
|
||||
int SetDeathState(lua_State* L, Creature* creature)
|
||||
{
|
||||
int32 state = Eluna::CHECKVAL<int32>(L, 2);
|
||||
int32 state = ALE::CHECKVAL<int32>(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<bool>(L, 2, true);
|
||||
bool enable = ALE::CHECKVAL<bool>(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<uint32>(L, 2);
|
||||
uint32 off_hand = Eluna::CHECKVAL<uint32>(L, 3);
|
||||
uint32 ranged = Eluna::CHECKVAL<uint32>(L, 4);
|
||||
uint32 main_hand = ALE::CHECKVAL<uint32>(L, 2);
|
||||
uint32 off_hand = ALE::CHECKVAL<uint32>(L, 3);
|
||||
uint32 ranged = ALE::CHECKVAL<uint32>(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<bool>(L, 2, true);
|
||||
bool allow = ALE::CHECKVAL<bool>(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<bool>(L, 2, true);
|
||||
bool disable = ALE::CHECKVAL<bool>(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<float>(L, 2);
|
||||
float dist = ALE::CHECKVAL<float>(L, 2);
|
||||
|
||||
creature->SetWanderDistance(dist);
|
||||
|
||||
@@ -1067,7 +1067,7 @@ namespace LuaCreature
|
||||
*/
|
||||
int SetRespawnDelay(lua_State* L, Creature* creature)
|
||||
{
|
||||
uint32 delay = Eluna::CHECKVAL<uint32>(L, 2);
|
||||
uint32 delay = ALE::CHECKVAL<uint32>(L, 2);
|
||||
|
||||
creature->SetRespawnDelay(delay);
|
||||
return 0;
|
||||
@@ -1080,7 +1080,7 @@ namespace LuaCreature
|
||||
*/
|
||||
int SetDefaultMovementType(lua_State* L, Creature* creature)
|
||||
{
|
||||
int32 type = Eluna::CHECKVAL<int32>(L, 2);
|
||||
int32 type = ALE::CHECKVAL<int32>(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<bool>(L, 2, true);
|
||||
bool val = ALE::CHECKVAL<bool>(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<bool>(L, 2, true);
|
||||
bool val = ALE::CHECKVAL<bool>(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<bool>(L, 2, true);
|
||||
bool enable = ALE::CHECKVAL<bool>(L, 2, true);
|
||||
|
||||
creature->SetHover(enable);
|
||||
|
||||
@@ -1133,7 +1133,7 @@ namespace LuaCreature
|
||||
*/
|
||||
int DespawnOrUnsummon(lua_State* L, Creature* creature)
|
||||
{
|
||||
uint32 msTimeToDespawn = Eluna::CHECKVAL<uint32>(L, 2, 0);
|
||||
uint32 msTimeToDespawn = ALE::CHECKVAL<uint32>(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<uint32>(L, 2);
|
||||
uint32 delay = ALE::CHECKVAL<uint32>(L, 2);
|
||||
creature->SetCorpseDelay(delay);
|
||||
return 0;
|
||||
}
|
||||
@@ -1195,7 +1195,7 @@ namespace LuaCreature
|
||||
*/
|
||||
int CallForHelp(lua_State* L, Creature* creature)
|
||||
{
|
||||
float radius = Eluna::CHECKVAL<float>(L, 2);
|
||||
float radius = ALE::CHECKVAL<float>(L, 2);
|
||||
|
||||
creature->CallForHelp(radius);
|
||||
return 0;
|
||||
@@ -1217,7 +1217,7 @@ namespace LuaCreature
|
||||
*/
|
||||
int AttackStart(lua_State* L, Creature* creature)
|
||||
{
|
||||
Unit* target = Eluna::CHECKOBJ<Unit>(L, 2);
|
||||
Unit* target = ALE::CHECKOBJ<Unit>(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<uint32>(L, 2);
|
||||
uint32 dataGuidLow = Eluna::CHECKVAL<uint32>(L, 3, 0);
|
||||
uint32 entry = ALE::CHECKVAL<uint32>(L, 2);
|
||||
uint32 dataGuidLow = ALE::CHECKVAL<uint32>(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<uint16>(L, 2);
|
||||
uint16 lootMode = ALE::CHECKVAL<uint16>(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<uint16>(L, 2);
|
||||
uint16 lootMode = ALE::CHECKVAL<uint16>(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;
|
||||
}
|
||||
@@ -1365,7 +1365,7 @@ namespace LuaCreature
|
||||
*/
|
||||
int GetLoot(lua_State* L, Creature* creature)
|
||||
{
|
||||
Eluna::Push(L, &creature->loot);
|
||||
ALE::Push(L, &creature->loot);
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<uint32>(L, 2);
|
||||
uint32 questId = ALE::CHECKVAL<uint32>(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<uint32>(L, 2, 0);
|
||||
uint32 state = ALE::CHECKVAL<uint32>(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<uint32>(L, 2, 0);
|
||||
uint32 state = ALE::CHECKVAL<uint32>(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<uint32>(L, ++i);
|
||||
uint32 amount = Eluna::CHECKVAL<uint32>(L, ++i);
|
||||
uint32 entry = ALE::CHECKVAL<uint32>(L, ++i);
|
||||
uint32 amount = ALE::CHECKVAL<uint32>(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<bool>(L, 2, false);
|
||||
bool deldb = ALE::CHECKVAL<bool>(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<ElunaObject>(L, 1)->Invalidate();
|
||||
ALE::CHECKOBJ<ALEObject>(L, 1)->Invalidate();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -314,7 +314,7 @@ namespace LuaGameObject
|
||||
*/
|
||||
int UseDoorOrButton(lua_State* L, GameObject* go)
|
||||
{
|
||||
uint32 delay = Eluna::CHECKVAL<uint32>(L, 2, 0);
|
||||
uint32 delay = ALE::CHECKVAL<uint32>(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<int32>(L, 2);
|
||||
int32 respawn = ALE::CHECKVAL<int32>(L, 2);
|
||||
|
||||
go->SetRespawnTime(respawn);
|
||||
return 0;
|
||||
@@ -364,7 +364,7 @@ namespace LuaGameObject
|
||||
*/
|
||||
int SetRespawnDelay(lua_State* L, GameObject* go)
|
||||
{
|
||||
int32 respawn = Eluna::CHECKVAL<int32>(L, 2);
|
||||
int32 respawn = ALE::CHECKVAL<int32>(L, 2);
|
||||
|
||||
go->SetRespawnDelay(respawn);
|
||||
return 0;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<ObjectGuid>(L, 2);
|
||||
Eluna::Push(L, group->IsLeader(guid));
|
||||
ObjectGuid guid = ALE::CHECKVAL<ObjectGuid>(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<ObjectGuid>(L, 2);
|
||||
Eluna::Push(L, group->IsMember(guid));
|
||||
ObjectGuid guid = ALE::CHECKVAL<ObjectGuid>(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<ObjectGuid>(L, 2);
|
||||
Eluna::Push(L, group->IsAssistant(guid));
|
||||
ObjectGuid guid = ALE::CHECKVAL<ObjectGuid>(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<Player>(L, 2);
|
||||
Player* player2 = Eluna::CHECKOBJ<Player>(L, 3);
|
||||
Eluna::Push(L, group->SameSubGroup(player1, player2));
|
||||
Player* player1 = ALE::CHECKOBJ<Player>(L, 2);
|
||||
Player* player2 = ALE::CHECKOBJ<Player>(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<uint8>(L, 2);
|
||||
uint8 subGroup = ALE::CHECKVAL<uint8>(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<Player>(L, 2);
|
||||
Player* player = ALE::CHECKOBJ<Player>(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<const char*>(L, 2);
|
||||
const char* name = ALE::CHECKVAL<const char*>(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<ObjectGuid>(L, 2);
|
||||
Eluna::Push(L, group->GetMemberGroup(guid));
|
||||
ObjectGuid guid = ALE::CHECKVAL<ObjectGuid>(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<ObjectGuid>(L, 2);
|
||||
ObjectGuid guid = ALE::CHECKVAL<ObjectGuid>(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<WorldPacket>(L, 2);
|
||||
bool ignorePlayersInBg = Eluna::CHECKVAL<bool>(L, 3);
|
||||
ObjectGuid ignore = Eluna::CHECKVAL<ObjectGuid>(L, 4);
|
||||
WorldPacket* data = ALE::CHECKOBJ<WorldPacket>(L, 2);
|
||||
bool ignorePlayersInBg = ALE::CHECKVAL<bool>(L, 3);
|
||||
ObjectGuid ignore = ALE::CHECKVAL<ObjectGuid>(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<ObjectGuid>(L, 2);
|
||||
uint32 method = Eluna::CHECKVAL<uint32>(L, 3, 0);
|
||||
ObjectGuid guid = ALE::CHECKVAL<ObjectGuid>(L, 2);
|
||||
uint32 method = ALE::CHECKVAL<uint32>(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<ObjectGuid>(L, 2);
|
||||
uint8 subGroup = Eluna::CHECKVAL<uint8>(L, 3);
|
||||
ObjectGuid guid = ALE::CHECKVAL<ObjectGuid>(L, 2);
|
||||
uint8 subGroup = ALE::CHECKVAL<uint8>(L, 3);
|
||||
|
||||
if (subGroup >= MAX_RAID_SUBGROUPS)
|
||||
{
|
||||
@@ -388,9 +388,9 @@ namespace LuaGroup
|
||||
*/
|
||||
int SetTargetIcon(lua_State* L, Group* group)
|
||||
{
|
||||
uint8 icon = Eluna::CHECKVAL<uint8>(L, 2);
|
||||
ObjectGuid target = Eluna::CHECKVAL<ObjectGuid>(L, 3);
|
||||
ObjectGuid setter = Eluna::CHECKVAL<ObjectGuid>(L, 4, ObjectGuid());
|
||||
uint8 icon = ALE::CHECKVAL<uint8>(L, 2);
|
||||
ObjectGuid target = ALE::CHECKVAL<ObjectGuid>(L, 3);
|
||||
ObjectGuid setter = ALE::CHECKVAL<ObjectGuid>(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<ObjectGuid>(L, 2);
|
||||
bool apply = Eluna::CHECKVAL<bool>(L, 3);
|
||||
GroupMemberFlags flag = static_cast<GroupMemberFlags>(Eluna::CHECKVAL<uint32>(L, 4));
|
||||
ObjectGuid target = ALE::CHECKVAL<ObjectGuid>(L, 2);
|
||||
bool apply = ALE::CHECKVAL<bool>(L, 3);
|
||||
GroupMemberFlags flag = static_cast<GroupMemberFlags>(ALE::CHECKVAL<uint32>(L, 4));
|
||||
|
||||
group->SetGroupMemberFlag(target, apply, flag);
|
||||
return 0;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<Player>(L, 2);
|
||||
Player* player = ALE::CHECKOBJ<Player>(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<uint8>(L, 2);
|
||||
const char* text = Eluna::CHECKVAL<const char*>(L, 3);
|
||||
uint8 tabId = ALE::CHECKVAL<uint8>(L, 2);
|
||||
const char* text = ALE::CHECKVAL<const char*>(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<WorldPacket>(L, 2);
|
||||
WorldPacket* data = ALE::CHECKOBJ<WorldPacket>(L, 2);
|
||||
|
||||
guild->BroadcastPacket(data);
|
||||
return 0;
|
||||
@@ -174,8 +174,8 @@ namespace LuaGuild
|
||||
*/
|
||||
int SendPacketToRanked(lua_State* L, Guild* guild)
|
||||
{
|
||||
WorldPacket* data = Eluna::CHECKOBJ<WorldPacket>(L, 2);
|
||||
uint8 ranked = Eluna::CHECKVAL<uint8>(L, 3);
|
||||
WorldPacket* data = ALE::CHECKOBJ<WorldPacket>(L, 2);
|
||||
uint8 ranked = ALE::CHECKVAL<uint8>(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<Player>(L, 2);
|
||||
uint8 rankId = Eluna::CHECKVAL<uint8>(L, 3, GUILD_RANK_NONE);
|
||||
Player* player = ALE::CHECKOBJ<Player>(L, 2);
|
||||
uint8 rankId = ALE::CHECKVAL<uint8>(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<Player>(L, 2);
|
||||
bool isDisbanding = Eluna::CHECKVAL<bool>(L, 3, false);
|
||||
Player* player = ALE::CHECKOBJ<Player>(L, 2);
|
||||
bool isDisbanding = ALE::CHECKVAL<bool>(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<Player>(L, 2);
|
||||
uint8 newRank = Eluna::CHECKVAL<uint8>(L, 3);
|
||||
Player* player = ALE::CHECKOBJ<Player>(L, 2);
|
||||
uint8 newRank = ALE::CHECKVAL<uint8>(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<std::string>(L, 2);
|
||||
std::string name = ALE::CHECKVAL<std::string>(L, 2);
|
||||
|
||||
guild->SetName(name);
|
||||
return 0;
|
||||
@@ -265,9 +265,9 @@ namespace LuaGuild
|
||||
*/
|
||||
int UpdateMemberData(lua_State* L, Guild* guild)
|
||||
{
|
||||
Player* player = Eluna::CHECKOBJ<Player>(L, 2);
|
||||
uint8 dataid = Eluna::CHECKVAL<uint8>(L, 3);
|
||||
uint32 value = Eluna::CHECKVAL<uint32>(L, 4);
|
||||
Player* player = ALE::CHECKOBJ<Player>(L, 2);
|
||||
uint8 dataid = ALE::CHECKVAL<uint8>(L, 3);
|
||||
uint32 value = ALE::CHECKVAL<uint32>(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<Player>(L, 2);
|
||||
bool officerOnly = Eluna::CHECKVAL<bool>(L, 3, false);
|
||||
std::string msg = Eluna::CHECKVAL<std::string>(L, 4);
|
||||
uint32 language = Eluna::CHECKVAL<uint32>(L, 5, false);
|
||||
Player* player = ALE::CHECKOBJ<Player>(L, 2);
|
||||
bool officerOnly = ALE::CHECKVAL<bool>(L, 3, false);
|
||||
std::string msg = ALE::CHECKVAL<std::string>(L, 4);
|
||||
uint32 language = ALE::CHECKVAL<uint32>(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<Player>(L, 2);
|
||||
uint32 minLevel = Eluna::CHECKVAL<uint32>(L, 3);
|
||||
uint32 maxLevel = Eluna::CHECKVAL<uint32>(L, 4);
|
||||
uint32 minRank = Eluna::CHECKVAL<uint32>(L, 5);
|
||||
Player* player = ALE::CHECKOBJ<Player>(L, 2);
|
||||
uint32 minLevel = ALE::CHECKVAL<uint32>(L, 3);
|
||||
uint32 maxLevel = ALE::CHECKVAL<uint32>(L, 4);
|
||||
uint32 minRank = ALE::CHECKVAL<uint32>(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<Player>(L, 2);
|
||||
uint8 tabId = Eluna::CHECKVAL<uint32>(L, 3);
|
||||
uint8 slotId = Eluna::CHECKVAL<uint32>(L, 4);
|
||||
uint8 destTabId = Eluna::CHECKVAL<uint32>(L, 5);
|
||||
uint8 destSlotId = Eluna::CHECKVAL<uint32>(L, 6);
|
||||
uint32 splitedAmount = Eluna::CHECKVAL<uint32>(L, 7);
|
||||
Player* player = ALE::CHECKOBJ<Player>(L, 2);
|
||||
uint8 tabId = ALE::CHECKVAL<uint32>(L, 3);
|
||||
uint8 slotId = ALE::CHECKVAL<uint32>(L, 4);
|
||||
uint8 destTabId = ALE::CHECKVAL<uint32>(L, 5);
|
||||
uint8 destSlotId = ALE::CHECKVAL<uint32>(L, 6);
|
||||
uint32 splitedAmount = ALE::CHECKVAL<uint32>(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<Player>(L, 2);
|
||||
bool toChar = Eluna::CHECKVAL<bool>(L, 3, false);
|
||||
uint8 tabId = Eluna::CHECKVAL<uint8>(L, 4);
|
||||
uint8 slotId = Eluna::CHECKVAL<uint8>(L, 5);
|
||||
uint8 playerBag = Eluna::CHECKVAL<uint8>(L, 6);
|
||||
uint8 playerSlotId = Eluna::CHECKVAL<uint8>(L, 7);
|
||||
uint32 splitedAmount = Eluna::CHECKVAL<uint32>(L, 8);
|
||||
Player* player = ALE::CHECKOBJ<Player>(L, 2);
|
||||
bool toChar = ALE::CHECKVAL<bool>(L, 3, false);
|
||||
uint8 tabId = ALE::CHECKVAL<uint8>(L, 4);
|
||||
uint8 slotId = ALE::CHECKVAL<uint8>(L, 5);
|
||||
uint8 playerBag = ALE::CHECKVAL<uint8>(L, 6);
|
||||
uint8 playerSlotId = ALE::CHECKVAL<uint8>(L, 7);
|
||||
uint32 splitedAmount = ALE::CHECKVAL<uint32>(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<uint64>(L, 2);
|
||||
bool add = Eluna::CHECKVAL<bool>(L, 2);
|
||||
uint64 amount = ALE::CHECKVAL<uint64>(L, 2);
|
||||
bool add = ALE::CHECKVAL<bool>(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;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<Player>(L, 2);
|
||||
Player* player = ALE::CHECKOBJ<Player>(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<bool>(L, 2, false);
|
||||
Eluna::Push(L, item->CanBeTraded(mail));
|
||||
bool mail = ALE::CHECKVAL<bool>(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<uint32>(L, 2);
|
||||
Eluna::Push(L, item->hasQuest(quest));
|
||||
uint32 quest = ALE::CHECKVAL<uint32>(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<uint8>(L, 2, DEFAULT_LOCALE);
|
||||
uint8 locale = ALE::CHECKVAL<uint8>(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<uint32>(L, 2);
|
||||
uint32 enchant_slot = ALE::CHECKVAL<uint32>(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<uint32>(L, 2);
|
||||
uint32 index = ALE::CHECKVAL<uint32>(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<uint32>(L, 2);
|
||||
uint32 index = ALE::CHECKVAL<uint32>(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<Player>(L, 2);
|
||||
Player* player = ALE::CHECKOBJ<Player>(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<bool>(L, 2);
|
||||
bool soulbound = ALE::CHECKVAL<bool>(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<uint32>(L, 2);
|
||||
uint32 count = ALE::CHECKVAL<uint32>(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<uint32>(L, 2);
|
||||
uint32 enchant = ALE::CHECKVAL<uint32>(L, 2);
|
||||
if (!sSpellItemEnchantmentStore.LookupEntry(enchant))
|
||||
{
|
||||
Eluna::Push(L, false);
|
||||
ALE::Push(L, false);
|
||||
return 1;
|
||||
}
|
||||
|
||||
EnchantmentSlot slot = (EnchantmentSlot)Eluna::CHECKVAL<uint32>(L, 3);
|
||||
EnchantmentSlot slot = (EnchantmentSlot)ALE::CHECKVAL<uint32>(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<uint32>(L, 2);
|
||||
uint32 randomPropId = ALE::CHECKVAL<uint32>(L, 2);
|
||||
item->SetItemRandomProperties(randomPropId);
|
||||
return 0;
|
||||
}
|
||||
@@ -723,7 +723,7 @@ namespace LuaItem
|
||||
*/
|
||||
int SetRandomSuffix(lua_State* L, Item* item)
|
||||
{
|
||||
uint32 randomPropId = Eluna::CHECKVAL<uint32>(L, 2);
|
||||
uint32 randomPropId = ALE::CHECKVAL<uint32>(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<uint32>(L, 2);
|
||||
EnchantmentSlot slot = (EnchantmentSlot)ALE::CHECKVAL<uint32>(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;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<uint32>(L, 2, LocaleConstant::LOCALE_enUS);
|
||||
uint32 loc_idx = ALE::CHECKVAL<uint32>(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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<uint32>(L, 2);
|
||||
uint8 min_count = Eluna::CHECKVAL<uint8>(L, 3);
|
||||
uint8 max_count = Eluna::CHECKVAL<uint8>(L, 4);
|
||||
float chance = Eluna::CHECKVAL<float>(L, 5);
|
||||
uint16 loot_mode = Eluna::CHECKVAL<uint16>(L, 6);
|
||||
bool needs_quest = Eluna::CHECKVAL<bool>(L, 7, false);
|
||||
bool allow_stacking = Eluna::CHECKVAL<bool>(L, 8, true);
|
||||
uint32 itemid = ALE::CHECKVAL<uint32>(L, 2);
|
||||
uint8 min_count = ALE::CHECKVAL<uint8>(L, 3);
|
||||
uint8 max_count = ALE::CHECKVAL<uint8>(L, 4);
|
||||
float chance = ALE::CHECKVAL<float>(L, 5);
|
||||
uint16 loot_mode = ALE::CHECKVAL<uint16>(L, 6);
|
||||
bool needs_quest = ALE::CHECKVAL<bool>(L, 7, false);
|
||||
bool allow_stacking = ALE::CHECKVAL<bool>(L, 8, true);
|
||||
|
||||
if (allow_stacking)
|
||||
{
|
||||
@@ -81,8 +81,8 @@ namespace LuaLoot
|
||||
*/
|
||||
int HasItem(lua_State* L, Loot* loot)
|
||||
{
|
||||
uint32 itemid = Eluna::CHECKVAL<uint32>(L, 2, false);
|
||||
uint32 count = Eluna::CHECKVAL<uint32>(L, 3, false);
|
||||
uint32 itemid = ALE::CHECKVAL<uint32>(L, 2, false);
|
||||
uint32 count = ALE::CHECKVAL<uint32>(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<uint32>(L, 2);
|
||||
bool isCountSpecified = Eluna::CHECKVAL<bool>(L, 3, false);
|
||||
uint32 count = isCountSpecified ? Eluna::CHECKVAL<uint32>(L, 4) : 0;
|
||||
uint32 itemid = ALE::CHECKVAL<uint32>(L, 2);
|
||||
bool isCountSpecified = ALE::CHECKVAL<bool>(L, 3, false);
|
||||
uint32 count = isCountSpecified ? ALE::CHECKVAL<uint32>(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<uint32>(L, 2);
|
||||
uint32 gold = ALE::CHECKVAL<uint32>(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<uint32>(L, 2);
|
||||
uint32 max_gold = Eluna::CHECKVAL<uint32>(L, 3);
|
||||
uint32 min_gold = ALE::CHECKVAL<uint32>(L, 2);
|
||||
uint32 max_gold = ALE::CHECKVAL<uint32>(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<uint32>(L, 2);
|
||||
uint32 count = ALE::CHECKVAL<uint32>(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<uint32>(L, 2);
|
||||
uint32 count = Eluna::CHECKVAL<uint32>(L, 3);
|
||||
bool looted = Eluna::CHECKVAL<bool>(L, 4, true);
|
||||
uint32 itemid = ALE::CHECKVAL<uint32>(L, 2);
|
||||
uint32 count = ALE::CHECKVAL<uint32>(L, 3);
|
||||
bool looted = ALE::CHECKVAL<bool>(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<uint32>(L, 2);
|
||||
uint32 lootType = ALE::CHECKVAL<uint32>(L, 2);
|
||||
loot->loot_type = static_cast<LootType>(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<ObjectGuid>(L, 2);
|
||||
ObjectGuid guid = ALE::CHECKVAL<ObjectGuid>(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<ObjectGuid>(L, 2);
|
||||
ObjectGuid guid = ALE::CHECKVAL<ObjectGuid>(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<ObjectGuid>(L, 2);
|
||||
ObjectGuid guid = ALE::CHECKVAL<ObjectGuid>(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<ObjectGuid>(L, 2);
|
||||
ObjectGuid guid = ALE::CHECKVAL<ObjectGuid>(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<uint32>(loot->items.size() + loot->quest_items.size()));
|
||||
ALE::Push(L, static_cast<uint32>(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<Player>(L, 2);
|
||||
Eluna::Push(L, loot->GetMaxSlotInLootFor(player));
|
||||
Player* player = ALE::CHECKOBJ<Player>(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<Player>(L, 2);
|
||||
Player* player = ALE::CHECKOBJ<Player>(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<Player>(L, 2);
|
||||
Player* player = ALE::CHECKOBJ<Player>(L, 2);
|
||||
loot->RemoveLooter(player->GetGUID());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<float>(L, 2);
|
||||
float y = Eluna::CHECKVAL<float>(L, 3);
|
||||
uint32 phasemask = Eluna::CHECKVAL<uint32>(L, 4, 1);
|
||||
float x = ALE::CHECKVAL<float>(L, 2);
|
||||
float y = ALE::CHECKVAL<float>(L, 3);
|
||||
uint32 phasemask = ALE::CHECKVAL<uint32>(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<float>(L, 2);
|
||||
float y = Eluna::CHECKVAL<float>(L, 3);
|
||||
float z = Eluna::CHECKVAL<float>(L, 4);
|
||||
float phasemask = Eluna::CHECKVAL<uint32>(L, 5, PHASEMASK_NORMAL);
|
||||
float x = ALE::CHECKVAL<float>(L, 2);
|
||||
float y = ALE::CHECKVAL<float>(L, 3);
|
||||
float z = ALE::CHECKVAL<float>(L, 4);
|
||||
float phasemask = ALE::CHECKVAL<uint32>(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<ObjectGuid>(L, 2);
|
||||
ObjectGuid guid = ALE::CHECKVAL<ObjectGuid>(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<uint32>(L, 2);
|
||||
uint32 weatherType = Eluna::CHECKVAL<uint32>(L, 3);
|
||||
float grade = Eluna::CHECKVAL<float>(L, 4);
|
||||
uint32 zoneId = ALE::CHECKVAL<uint32>(L, 2);
|
||||
uint32 weatherType = ALE::CHECKVAL<uint32>(L, 3);
|
||||
float grade = ALE::CHECKVAL<float>(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<ElunaInstanceAI*>(inst->GetInstanceScript());
|
||||
iAI = dynamic_cast<ALEInstanceAI*>(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<ElunaInstanceAI*>(inst->GetInstanceScript());
|
||||
iAI = dynamic_cast<ALEInstanceAI*>(inst->GetInstanceScript());
|
||||
|
||||
if (iAI)
|
||||
iAI->SaveToDB();
|
||||
@@ -300,7 +300,7 @@ namespace LuaMap
|
||||
*/
|
||||
int GetPlayers(lua_State* L, Map* map)
|
||||
{
|
||||
uint32 team = Eluna::CHECKVAL<uint32>(L, 2, TEAM_NEUTRAL);
|
||||
uint32 team = ALE::CHECKVAL<uint32>(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<int32>(L, 2, -1);
|
||||
int32 areaId = ALE::CHECKVAL<int32>(L, 2, -1);
|
||||
std::vector<Creature*> 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());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<uint16>(L, 2);
|
||||
uint32 flag = Eluna::CHECKVAL<uint32>(L, 3);
|
||||
uint16 index = ALE::CHECKVAL<uint16>(L, 2);
|
||||
uint32 flag = ALE::CHECKVAL<uint32>(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<uint16>(L, 2);
|
||||
Eluna::Push(L, obj->GetInt32Value(index));
|
||||
uint16 index = ALE::CHECKVAL<uint16>(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<uint16>(L, 2);
|
||||
Eluna::Push(L, obj->GetUInt32Value(index));
|
||||
uint16 index = ALE::CHECKVAL<uint16>(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<uint16>(L, 2);
|
||||
Eluna::Push(L, obj->GetFloatValue(index));
|
||||
uint16 index = ALE::CHECKVAL<uint16>(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<uint16>(L, 2);
|
||||
uint8 offset = Eluna::CHECKVAL<uint8>(L, 3);
|
||||
Eluna::Push(L, obj->GetByteValue(index, offset));
|
||||
uint16 index = ALE::CHECKVAL<uint16>(L, 2);
|
||||
uint8 offset = ALE::CHECKVAL<uint8>(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<uint16>(L, 2);
|
||||
uint8 offset = Eluna::CHECKVAL<uint8>(L, 3);
|
||||
Eluna::Push(L, obj->GetUInt16Value(index, offset));
|
||||
uint16 index = ALE::CHECKVAL<uint16>(L, 2);
|
||||
uint8 offset = ALE::CHECKVAL<uint8>(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<uint16>(L, 2);
|
||||
Eluna::Push(L, obj->GetUInt64Value(index));
|
||||
uint16 index = ALE::CHECKVAL<uint16>(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<uint16>(L, 2);
|
||||
uint32 flag = Eluna::CHECKVAL<uint32>(L, 3);
|
||||
uint16 index = ALE::CHECKVAL<uint16>(L, 2);
|
||||
uint32 flag = ALE::CHECKVAL<uint32>(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<uint16>(L, 2);
|
||||
int32 value = Eluna::CHECKVAL<int32>(L, 3);
|
||||
uint16 index = ALE::CHECKVAL<uint16>(L, 2);
|
||||
int32 value = ALE::CHECKVAL<int32>(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<uint16>(L, 2);
|
||||
uint32 value = Eluna::CHECKVAL<uint32>(L, 3);
|
||||
uint16 index = ALE::CHECKVAL<uint16>(L, 2);
|
||||
uint32 value = ALE::CHECKVAL<uint32>(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<uint16>(L, 2);
|
||||
uint32 value = Eluna::CHECKVAL<uint32>(L, 3);
|
||||
uint16 index = ALE::CHECKVAL<uint16>(L, 2);
|
||||
uint32 value = ALE::CHECKVAL<uint32>(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<uint16>(L, 2);
|
||||
float value = Eluna::CHECKVAL<float>(L, 3);
|
||||
uint16 index = ALE::CHECKVAL<uint16>(L, 2);
|
||||
float value = ALE::CHECKVAL<float>(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<uint16>(L, 2);
|
||||
uint8 offset = Eluna::CHECKVAL<uint8>(L, 3);
|
||||
uint8 value = Eluna::CHECKVAL<uint8>(L, 4);
|
||||
uint16 index = ALE::CHECKVAL<uint16>(L, 2);
|
||||
uint8 offset = ALE::CHECKVAL<uint8>(L, 3);
|
||||
uint8 value = ALE::CHECKVAL<uint8>(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<uint16>(L, 2);
|
||||
uint8 offset = Eluna::CHECKVAL<uint8>(L, 3);
|
||||
uint16 value = Eluna::CHECKVAL<uint16>(L, 4);
|
||||
uint16 index = ALE::CHECKVAL<uint16>(L, 2);
|
||||
uint8 offset = ALE::CHECKVAL<uint8>(L, 3);
|
||||
uint16 value = ALE::CHECKVAL<uint16>(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<uint16>(L, 2);
|
||||
uint8 offset = Eluna::CHECKVAL<uint8>(L, 3);
|
||||
int16 value = Eluna::CHECKVAL<int16>(L, 4);
|
||||
uint16 index = ALE::CHECKVAL<uint16>(L, 2);
|
||||
uint8 offset = ALE::CHECKVAL<uint8>(L, 3);
|
||||
int16 value = ALE::CHECKVAL<int16>(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<float>(L, 2);
|
||||
float size = ALE::CHECKVAL<float>(L, 2);
|
||||
|
||||
obj->SetObjectScale(size);
|
||||
return 0;
|
||||
@@ -378,8 +378,8 @@ namespace LuaObject
|
||||
*/
|
||||
int SetUInt64Value(lua_State* L, Object* obj)
|
||||
{
|
||||
uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
|
||||
uint64 value = Eluna::CHECKVAL<uint64>(L, 3);
|
||||
uint16 index = ALE::CHECKVAL<uint16>(L, 2);
|
||||
uint64 value = ALE::CHECKVAL<uint64>(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<uint16>(L, 2);
|
||||
uint32 flag = Eluna::CHECKVAL<uint32>(L, 3);
|
||||
uint16 index = ALE::CHECKVAL<uint16>(L, 2);
|
||||
uint32 flag = ALE::CHECKVAL<uint32>(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;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<uint32>(L, 2);
|
||||
uint32 petType = ALE::CHECKVAL<uint32>(L, 2);
|
||||
pet->setPetType(static_cast<PetType>(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<Player>(L, 2);
|
||||
Eluna::Push(L, pet->IsPermanentPetFor(owner));
|
||||
Player* owner = ALE::CHECKOBJ<Player>(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<Creature>(L, 2);
|
||||
Eluna::Push(L, pet->CreateBaseAtCreature(creature));
|
||||
Creature* creature = ALE::CHECKOBJ<Creature>(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<uint32>(L, 2);
|
||||
uint32 duration = ALE::CHECKVAL<uint32>(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<uint32>(L, 2);
|
||||
uint32 xp = ALE::CHECKVAL<uint32>(L, 2);
|
||||
pet->GivePetXP(xp);
|
||||
return 0;
|
||||
}
|
||||
@@ -168,7 +168,7 @@ namespace LuaPet
|
||||
*/
|
||||
int GivePetLevel(lua_State* L, Pet* pet)
|
||||
{
|
||||
uint8 level = Eluna::CHECKVAL<uint8>(L, 2);
|
||||
uint8 level = ALE::CHECKVAL<uint8>(L, 2);
|
||||
pet->GivePetLevel(level);
|
||||
return 0;
|
||||
}
|
||||
@@ -192,8 +192,8 @@ namespace LuaPet
|
||||
*/
|
||||
int HaveInDiet(lua_State* L, Pet* pet)
|
||||
{
|
||||
Item* item = Eluna::CHECKOBJ<Item>(L, 2);
|
||||
Eluna::Push(L, pet->HaveInDiet(item->GetTemplate()));
|
||||
Item* item = ALE::CHECKOBJ<Item>(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<uint32>(L, 2);
|
||||
Eluna::Push(L, pet->GetCurrentFoodBenefitLevel(itemLevel));
|
||||
uint32 itemLevel = ALE::CHECKVAL<uint32>(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<uint32>(L, 2);
|
||||
bool apply = Eluna::CHECKVAL<bool>(L, 3);
|
||||
uint32 spellId = ALE::CHECKVAL<uint32>(L, 2);
|
||||
bool apply = ALE::CHECKVAL<bool>(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<uint32>(L, 2);
|
||||
Unit* target = Eluna::CHECKOBJ<Unit>(L, 3);
|
||||
uint32 spellId = ALE::CHECKVAL<uint32>(L, 2);
|
||||
Unit* target = ALE::CHECKOBJ<Unit>(L, 3);
|
||||
ObjectGuid oldTarget = ObjectGuid::Empty;
|
||||
bool isPositive = Eluna::CHECKVAL<bool>(L, 4, false);
|
||||
bool isPositive = ALE::CHECKVAL<bool>(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<uint32>(L, 2);
|
||||
uint32 active = Eluna::CHECKVAL<uint32>(L, 3, ACT_DECIDE);
|
||||
uint32 state = Eluna::CHECKVAL<uint32>(L, 4, PETSPELL_NEW);
|
||||
uint32 type = Eluna::CHECKVAL<uint32>(L, 5, PETSPELL_NORMAL);
|
||||
uint32 spellId = ALE::CHECKVAL<uint32>(L, 2);
|
||||
uint32 active = ALE::CHECKVAL<uint32>(L, 3, ACT_DECIDE);
|
||||
uint32 state = ALE::CHECKVAL<uint32>(L, 4, PETSPELL_NEW);
|
||||
uint32 type = ALE::CHECKVAL<uint32>(L, 5, PETSPELL_NORMAL);
|
||||
|
||||
Eluna::Push(L, pet->addSpell(spellId, static_cast<ActiveStates>(active), static_cast<PetSpellState>(state), static_cast<PetSpellType>(type)));
|
||||
ALE::Push(L, pet->addSpell(spellId, static_cast<ActiveStates>(active), static_cast<PetSpellState>(state), static_cast<PetSpellType>(type)));
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -325,8 +325,8 @@ namespace LuaPet
|
||||
*/
|
||||
int LearnSpell(lua_State* L, Pet* pet)
|
||||
{
|
||||
uint32 spellId = Eluna::CHECKVAL<uint32>(L, 2);
|
||||
Eluna::Push(L, pet->learnSpell(spellId));
|
||||
uint32 spellId = ALE::CHECKVAL<uint32>(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<uint32>(L, 2);
|
||||
uint32 spellId = ALE::CHECKVAL<uint32>(L, 2);
|
||||
pet->learnSpellHighRank(spellId);
|
||||
return 0;
|
||||
}
|
||||
@@ -363,11 +363,11 @@ namespace LuaPet
|
||||
*/
|
||||
int UnlearnSpell(lua_State* L, Pet* pet)
|
||||
{
|
||||
uint32 spellId = Eluna::CHECKVAL<uint32>(L, 2);
|
||||
bool learnPrev = Eluna::CHECKVAL<bool>(L, 3, false);
|
||||
bool clearAb = Eluna::CHECKVAL<bool>(L, 4, true);
|
||||
uint32 spellId = ALE::CHECKVAL<uint32>(L, 2);
|
||||
bool learnPrev = ALE::CHECKVAL<bool>(L, 3, false);
|
||||
bool clearAb = ALE::CHECKVAL<bool>(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<uint32>(L, 2);
|
||||
bool learnPrev = Eluna::CHECKVAL<bool>(L, 3, false);
|
||||
bool clearAb = Eluna::CHECKVAL<bool>(L, 4, true);
|
||||
uint32 spellId = ALE::CHECKVAL<uint32>(L, 2);
|
||||
bool learnPrev = ALE::CHECKVAL<bool>(L, 3, false);
|
||||
bool clearAb = ALE::CHECKVAL<bool>(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<uint8>(L, 2);
|
||||
Eluna::Push(L, pet->GetMaxTalentPointsForLevel(level));
|
||||
uint8 level = ALE::CHECKVAL<uint8>(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<uint8>(L, 2);
|
||||
uint8 points = ALE::CHECKVAL<uint8>(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<uint32>(L, 2);
|
||||
uint32 count = ALE::CHECKVAL<uint32>(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<uint8>(L, 2);
|
||||
uint8 slot = ALE::CHECKVAL<uint8>(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<bool>(L, 2);
|
||||
bool removed = ALE::CHECKVAL<bool>(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<uint8>(L, 2);
|
||||
Eluna::Push(L, pet->GetPetAutoSpellOnPos(pos));
|
||||
uint8 pos = ALE::CHECKVAL<uint8>(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<uint32>(L, 2);
|
||||
uint32 mode = ALE::CHECKVAL<uint32>(L, 2);
|
||||
pet->SavePetToDB(static_cast<PetSaveMode>(mode));
|
||||
return 0;
|
||||
}
|
||||
@@ -644,8 +644,8 @@ namespace LuaPet
|
||||
*/
|
||||
int Remove(lua_State* L, Pet* pet)
|
||||
{
|
||||
uint32 mode = Eluna::CHECKVAL<uint32>(L, 2);
|
||||
bool returnReagent = Eluna::CHECKVAL<bool>(L, 3, false);
|
||||
uint32 mode = ALE::CHECKVAL<uint32>(L, 2);
|
||||
bool returnReagent = ALE::CHECKVAL<bool>(L, 3, false);
|
||||
pet->Remove(static_cast<PetSaveMode>(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;
|
||||
}
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<uint32>(L, 2);
|
||||
Eluna::Push(L, quest->HasFlag(flag));
|
||||
uint32 flag = ALE::CHECKVAL<uint32>(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;
|
||||
}*/
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<ObjectGuid>(L, 2);
|
||||
ObjectGuid guid = ALE::CHECKVAL<ObjectGuid>(L, 2);
|
||||
|
||||
bool found = false;
|
||||
for (std::pair<const ObjectGuid, RollVote>& 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<const ObjectGuid, RollVote>& 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;
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2024 Eluna Lua Engine <https://forgeluaengine.github.io/>
|
||||
* Copyright (C) 2010 - 2024 ALE Lua Engine <https://forgeluaengine.github.io/>
|
||||
* 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<uint8>(L, 2, DEFAULT_LOCALE);
|
||||
Eluna::Push(L, spell_info->SpellName[static_cast<LocaleConstant>(locale)]);
|
||||
uint8 locale = ALE::CHECKVAL<uint8>(L, 2, DEFAULT_LOCALE);
|
||||
ALE::Push(L, spell_info->SpellName[static_cast<LocaleConstant>(locale)]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -72,8 +72,8 @@ namespace LuaSpellInfo
|
||||
*/
|
||||
int HasAttribute(lua_State* L, SpellInfo* spell_info)
|
||||
{
|
||||
int8 attributeType = Eluna::CHECKVAL<int8>(L, 2);
|
||||
uint32 attribute = Eluna::CHECKVAL<uint32>(L, 3);
|
||||
int8 attributeType = ALE::CHECKVAL<int8>(L, 2);
|
||||
uint32 attribute = ALE::CHECKVAL<uint32>(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<int8>(L, 2);
|
||||
int8 attributeType = ALE::CHECKVAL<int8>(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<uint8>(L, 2);
|
||||
Eluna::Push(L, spell_info->HasEffect(static_cast<SpellEffects>(effect)));
|
||||
uint8 effect = ALE::CHECKVAL<uint8>(L, 2);
|
||||
ALE::Push(L, spell_info->HasEffect(static_cast<SpellEffects>(effect)));
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -237,8 +237,8 @@ namespace LuaSpellInfo
|
||||
*/
|
||||
int HasAura(lua_State* L, SpellInfo* spell_info)
|
||||
{
|
||||
uint32 aura = Eluna::CHECKVAL<uint32>(L, 2);
|
||||
Eluna::Push(L, spell_info->HasAura(static_cast<AuraType>(aura)));
|
||||
uint32 aura = ALE::CHECKVAL<uint32>(L, 2);
|
||||
ALE::Push(L, spell_info->HasAura(static_cast<AuraType>(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<uint32>(L, 2);
|
||||
Eluna::Push(L, spell_info->IsAbilityOfSkillType(skillType));
|
||||
uint32 skillType = ALE::CHECKVAL<uint32>(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<SpellInfo>(L, 2);
|
||||
Eluna::Push(L, spell_info->NeedsToBeTriggeredByCaster(triggeringSpell));
|
||||
const SpellInfo* triggeringSpell = ALE::CHECKOBJ<SpellInfo>(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<uint32>(L, 2);
|
||||
Eluna::Push(L, spell_info->IsPositiveEffect(effIndex));
|
||||
uint8 effIndex = ALE::CHECKVAL<uint32>(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<SpellInfo>(L, 2);
|
||||
Eluna::Push(L, spell_info->IsAffectedBySpellMod(auraSpellInfo));
|
||||
const SpellInfo* auraSpellInfo = ALE::CHECKOBJ<SpellInfo>(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<SpellInfo>(L, 2);
|
||||
Eluna::Push(L, spell_info->CanPierceImmuneAura(auraSpellInfo));
|
||||
const SpellInfo* auraSpellInfo = ALE::CHECKOBJ<SpellInfo>(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<SpellInfo>(L, 2);
|
||||
Eluna::Push(L, spell_info->CanDispelAura(auraSpellInfo));
|
||||
const SpellInfo* auraSpellInfo = ALE::CHECKOBJ<SpellInfo>(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<SpellInfo>(L, 2);
|
||||
Eluna::Push(L, spell_info->IsAuraExclusiveBySpecificWith(spellInfo));
|
||||
const SpellInfo* spellInfo = ALE::CHECKOBJ<SpellInfo>(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<SpellInfo>(L, 2);
|
||||
Eluna::Push(L, spell_info->IsAuraExclusiveBySpecificPerCasterWith(spellInfo));
|
||||
const SpellInfo* spellInfo = ALE::CHECKOBJ<SpellInfo>(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<uint32>(L, 2);
|
||||
Eluna::Push(L, spell_info->CheckShapeshift(form));
|
||||
uint32 form = ALE::CHECKVAL<uint32>(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<uint32>(L, 2);
|
||||
uint32 zone_id = Eluna::CHECKVAL<uint32>(L, 3);
|
||||
uint32 area_id = Eluna::CHECKVAL<uint32>(L, 4);
|
||||
Player* player = Eluna::CHECKOBJ<Player>(L, 5);
|
||||
bool strict = Eluna::CHECKVAL<bool>(L, 6, false);
|
||||
uint32 map_id = ALE::CHECKVAL<uint32>(L, 2);
|
||||
uint32 zone_id = ALE::CHECKVAL<uint32>(L, 3);
|
||||
uint32 area_id = ALE::CHECKVAL<uint32>(L, 4);
|
||||
Player* player = ALE::CHECKOBJ<Player>(L, 5);
|
||||
bool strict = ALE::CHECKVAL<bool>(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<Unit>(L, 2);
|
||||
const WorldObject* target = Eluna::CHECKOBJ<WorldObject>(L, 3);
|
||||
bool implicit = Eluna::CHECKVAL<bool>(L, 4, true);
|
||||
const Unit* caster = ALE::CHECKOBJ<Unit>(L, 2);
|
||||
const WorldObject* target = ALE::CHECKOBJ<WorldObject>(L, 3);
|
||||
bool implicit = ALE::CHECKVAL<bool>(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<Unit>(L, 2);
|
||||
const WorldObject* target = Eluna::CHECKOBJ<WorldObject>(L, 3);
|
||||
const Item* item = Eluna::CHECKOBJ<Item>(L, 4, true);
|
||||
const Unit* caster = ALE::CHECKOBJ<Unit>(L, 2);
|
||||
const WorldObject* target = ALE::CHECKOBJ<WorldObject>(L, 3);
|
||||
const Item* item = ALE::CHECKOBJ<Item>(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<Unit>(L, 2);
|
||||
const Unit* target = ALE::CHECKOBJ<Unit>(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<uint32>(L, 2);
|
||||
uint32 effIndex = ALE::CHECKVAL<uint32>(L, 2);
|
||||
|
||||
Eluna::Push(L, spell_info->GetEffectMechanicMask(static_cast<SpellEffIndex>(effIndex)));
|
||||
ALE::Push(L, spell_info->GetEffectMechanicMask(static_cast<SpellEffIndex>(effIndex)));
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -852,9 +852,9 @@ namespace LuaSpellInfo
|
||||
*/
|
||||
int GetSpellMechanicMaskByEffectMask(lua_State* L, SpellInfo* spell_info)
|
||||
{
|
||||
uint32 effectmask = Eluna::CHECKVAL<uint32>(L, 2);
|
||||
uint32 effectmask = ALE::CHECKVAL<uint32>(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<uint32>(L, 2);
|
||||
uint32 effIndex = ALE::CHECKVAL<uint32>(L, 2);
|
||||
|
||||
Eluna::Push(L, spell_info->GetEffectMechanic(static_cast<SpellEffIndex>(effIndex)));
|
||||
ALE::Push(L, spell_info->GetEffectMechanic(static_cast<SpellEffIndex>(effIndex)));
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -882,9 +882,9 @@ namespace LuaSpellInfo
|
||||
*/
|
||||
int GetDispelMask(lua_State* L, SpellInfo* spell_info)
|
||||
{
|
||||
uint32 type = Eluna::CHECKVAL<uint32>(L, 2, false);
|
||||
uint32 type = ALE::CHECKVAL<uint32>(L, 2, false);
|
||||
|
||||
Eluna::Push(L, type != 0 ? spell_info->GetDispelMask(static_cast<DispelType>(type)) : spell_info->GetDispelMask());
|
||||
ALE::Push(L, type != 0 ? spell_info->GetDispelMask(static_cast<DispelType>(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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<bool>(L, 2);
|
||||
bool repeat = ALE::CHECKVAL<bool>(L, 2);
|
||||
spell->SetAutoRepeat(repeat);
|
||||
return 0;
|
||||
}
|
||||
@@ -170,7 +170,7 @@ namespace LuaSpell
|
||||
*/
|
||||
int Cast(lua_State* L, Spell* spell)
|
||||
{
|
||||
bool skipCheck = Eluna::CHECKVAL<bool>(L, 2, false);
|
||||
bool skipCheck = ALE::CHECKVAL<bool>(L, 2, false);
|
||||
spell->cast(skipCheck);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<ObjectGuid>(L, 2);
|
||||
ObjectGuid guid = ALE::CHECKVAL<ObjectGuid>(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<ObjectGuid>(L, 2);
|
||||
ObjectGuid guid = ALE::CHECKVAL<ObjectGuid>(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<ObjectGuid>(L, 2);
|
||||
ObjectGuid guid = ALE::CHECKVAL<ObjectGuid>(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<ObjectGuid>(L, 2);
|
||||
bool is_admin = Eluna::CHECKVAL<bool>(L, 2, false);
|
||||
ObjectGuid guid = ALE::CHECKVAL<ObjectGuid>(L, 2);
|
||||
bool is_admin = ALE::CHECKVAL<bool>(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<ObjectGuid>(L, 2);
|
||||
ObjectGuid guid = ALE::CHECKVAL<ObjectGuid>(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<std::string>(L, 2);
|
||||
std::string message = ALE::CHECKVAL<std::string>(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<std::string>(L, 2);
|
||||
std::string comment = ALE::CHECKVAL<std::string>(L, 2);
|
||||
|
||||
ticket->SetComment(comment);
|
||||
return 0;
|
||||
@@ -264,10 +264,10 @@ namespace LuaTicket
|
||||
*/
|
||||
int SetPosition(lua_State* L, GmTicket* ticket)
|
||||
{
|
||||
uint32 mapId = Eluna::CHECKVAL<uint32>(L, 2);
|
||||
float x = Eluna::CHECKVAL<float>(L, 2);
|
||||
float y = Eluna::CHECKVAL<float>(L, 2);
|
||||
float z = Eluna::CHECKVAL<float>(L, 2);
|
||||
uint32 mapId = ALE::CHECKVAL<uint32>(L, 2);
|
||||
float x = ALE::CHECKVAL<float>(L, 2);
|
||||
float y = ALE::CHECKVAL<float>(L, 2);
|
||||
float z = ALE::CHECKVAL<float>(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<std::string>(L, 2);
|
||||
std::string response = ALE::CHECKVAL<std::string>(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;
|
||||
}
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<Unit>(L, 2);
|
||||
Eluna::Push(L, passenger->IsOnVehicle(vehicle->GetBase()));
|
||||
Unit* passenger = ALE::CHECKOBJ<Unit>(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<int8>(L, 2);
|
||||
Eluna::Push(L, vehicle->GetPassenger(seatId));
|
||||
int8 seatId = ALE::CHECKVAL<int8>(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<Unit>(L, 2);
|
||||
int8 seatId = Eluna::CHECKVAL<int8>(L, 3);
|
||||
Unit* passenger = ALE::CHECKOBJ<Unit>(L, 2);
|
||||
int8 seatId = ALE::CHECKVAL<int8>(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<Unit>(L, 2);
|
||||
Unit* passenger = ALE::CHECKOBJ<Unit>(L, 2);
|
||||
vehicle->RemovePassenger(passenger);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<uint32>(L, 2);
|
||||
bool update = Eluna::CHECKVAL<bool>(L, 3, true);
|
||||
uint32 phaseMask = ALE::CHECKVAL<uint32>(L, 2);
|
||||
bool update = ALE::CHECKVAL<bool>(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<float>(L, 2, SIZE_OF_GRIDS);
|
||||
uint32 hostile = Eluna::CHECKVAL<uint32>(L, 3, 0);
|
||||
uint32 dead = Eluna::CHECKVAL<uint32>(L, 4, 1);
|
||||
float range = ALE::CHECKVAL<float>(L, 2, SIZE_OF_GRIDS);
|
||||
uint32 hostile = ALE::CHECKVAL<uint32>(L, 3, 0);
|
||||
uint32 dead = ALE::CHECKVAL<uint32>(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<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker);
|
||||
Acore::UnitLastSearcher<ALEUtil::WorldObjectInRangeCheck> 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<float>(L, 2, SIZE_OF_GRIDS);
|
||||
uint32 entry = Eluna::CHECKVAL<uint32>(L, 3, 0);
|
||||
uint32 hostile = Eluna::CHECKVAL<uint32>(L, 4, 0);
|
||||
float range = ALE::CHECKVAL<float>(L, 2, SIZE_OF_GRIDS);
|
||||
uint32 entry = ALE::CHECKVAL<uint32>(L, 3, 0);
|
||||
uint32 hostile = ALE::CHECKVAL<uint32>(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<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker);
|
||||
Acore::GameObjectLastSearcher<ALEUtil::WorldObjectInRangeCheck> 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<float>(L, 2, SIZE_OF_GRIDS);
|
||||
uint32 entry = Eluna::CHECKVAL<uint32>(L, 3, 0);
|
||||
uint32 hostile = Eluna::CHECKVAL<uint32>(L, 4, 0);
|
||||
uint32 dead = Eluna::CHECKVAL<uint32>(L, 5, 1);
|
||||
float range = ALE::CHECKVAL<float>(L, 2, SIZE_OF_GRIDS);
|
||||
uint32 entry = ALE::CHECKVAL<uint32>(L, 3, 0);
|
||||
uint32 hostile = ALE::CHECKVAL<uint32>(L, 4, 0);
|
||||
uint32 dead = ALE::CHECKVAL<uint32>(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<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker);
|
||||
Acore::CreatureLastSearcher<ALEUtil::WorldObjectInRangeCheck> 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<float>(L, 2, SIZE_OF_GRIDS);
|
||||
uint32 hostile = Eluna::CHECKVAL<uint32>(L, 3, 0);
|
||||
uint32 dead = Eluna::CHECKVAL<uint32>(L, 4, 1);
|
||||
float range = ALE::CHECKVAL<float>(L, 2, SIZE_OF_GRIDS);
|
||||
uint32 hostile = ALE::CHECKVAL<uint32>(L, 3, 0);
|
||||
uint32 dead = ALE::CHECKVAL<uint32>(L, 4, 1);
|
||||
|
||||
std::list<Player*> 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<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker);
|
||||
Acore::PlayerListSearcher<ALEUtil::WorldObjectInRangeCheck> searcher(obj, list, checker);
|
||||
Cell::VisitObjects(obj, searcher, range);
|
||||
|
||||
lua_createtable(L, list.size(), 0);
|
||||
@@ -270,7 +270,7 @@ namespace LuaWorldObject
|
||||
|
||||
for (std::list<Player*>::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<float>(L, 2, SIZE_OF_GRIDS);
|
||||
uint32 entry = Eluna::CHECKVAL<uint32>(L, 3, 0);
|
||||
uint32 hostile = Eluna::CHECKVAL<uint32>(L, 4, 0);
|
||||
uint32 dead = Eluna::CHECKVAL<uint32>(L, 5, 1);
|
||||
float range = ALE::CHECKVAL<float>(L, 2, SIZE_OF_GRIDS);
|
||||
uint32 entry = ALE::CHECKVAL<uint32>(L, 3, 0);
|
||||
uint32 hostile = ALE::CHECKVAL<uint32>(L, 4, 0);
|
||||
uint32 dead = ALE::CHECKVAL<uint32>(L, 5, 1);
|
||||
|
||||
std::list<Creature*> 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<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker);
|
||||
Acore::CreatureListSearcher<ALEUtil::WorldObjectInRangeCheck> searcher(obj, list, checker);
|
||||
Cell::VisitObjects(obj, searcher, range);
|
||||
|
||||
lua_createtable(L, list.size(), 0);
|
||||
@@ -307,7 +307,7 @@ namespace LuaWorldObject
|
||||
|
||||
for (std::list<Creature*>::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<float>(L, 2, SIZE_OF_GRIDS);
|
||||
uint32 entry = Eluna::CHECKVAL<uint32>(L, 3, 0);
|
||||
uint32 hostile = Eluna::CHECKVAL<uint32>(L, 4, 0);
|
||||
float range = ALE::CHECKVAL<float>(L, 2, SIZE_OF_GRIDS);
|
||||
uint32 entry = ALE::CHECKVAL<uint32>(L, 3, 0);
|
||||
uint32 hostile = ALE::CHECKVAL<uint32>(L, 4, 0);
|
||||
|
||||
std::list<GameObject*> list;
|
||||
ElunaUtil::WorldObjectInRangeCheck checker(false, obj, range, TYPEMASK_GAMEOBJECT, entry, hostile);
|
||||
ALEUtil::WorldObjectInRangeCheck checker(false, obj, range, TYPEMASK_GAMEOBJECT, entry, hostile);
|
||||
|
||||
Acore::GameObjectListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker);
|
||||
Acore::GameObjectListSearcher<ALEUtil::WorldObjectInRangeCheck> searcher(obj, list, checker);
|
||||
Cell::VisitObjects(obj, searcher, range);
|
||||
|
||||
lua_createtable(L, list.size(), 0);
|
||||
@@ -342,7 +342,7 @@ namespace LuaWorldObject
|
||||
|
||||
for (std::list<GameObject*>::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<float>(L, 2, SIZE_OF_GRIDS);
|
||||
uint16 type = Eluna::CHECKVAL<uint16>(L, 3, 0); // TypeMask
|
||||
uint32 entry = Eluna::CHECKVAL<uint32>(L, 4, 0);
|
||||
uint32 hostile = Eluna::CHECKVAL<uint32>(L, 5, 0); // 0 none, 1 hostile, 2 friendly
|
||||
uint32 dead = Eluna::CHECKVAL<uint32>(L, 6, 1); // 0 both, 1 alive, 2 dead
|
||||
float range = ALE::CHECKVAL<float>(L, 2, SIZE_OF_GRIDS);
|
||||
uint16 type = ALE::CHECKVAL<uint16>(L, 3, 0); // TypeMask
|
||||
uint32 entry = ALE::CHECKVAL<uint32>(L, 4, 0);
|
||||
uint32 hostile = ALE::CHECKVAL<uint32>(L, 5, 0); // 0 none, 1 hostile, 2 friendly
|
||||
uint32 dead = ALE::CHECKVAL<uint32>(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<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, target, checker);
|
||||
Acore::WorldObjectLastSearcher<ALEUtil::WorldObjectInRangeCheck> 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<float>(L, 2, SIZE_OF_GRIDS);
|
||||
uint16 type = Eluna::CHECKVAL<uint16>(L, 3, 0); // TypeMask
|
||||
uint32 entry = Eluna::CHECKVAL<uint32>(L, 4, 0);
|
||||
uint32 hostile = Eluna::CHECKVAL<uint32>(L, 5, 0); // 0 none, 1 hostile, 2 friendly
|
||||
uint32 dead = Eluna::CHECKVAL<uint32>(L, 6, 1); // 0 both, 1 alive, 2 dead
|
||||
float range = ALE::CHECKVAL<float>(L, 2, SIZE_OF_GRIDS);
|
||||
uint16 type = ALE::CHECKVAL<uint16>(L, 3, 0); // TypeMask
|
||||
uint32 entry = ALE::CHECKVAL<uint32>(L, 4, 0);
|
||||
uint32 hostile = ALE::CHECKVAL<uint32>(L, 5, 0); // 0 none, 1 hostile, 2 friendly
|
||||
uint32 dead = ALE::CHECKVAL<uint32>(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<WorldObject*> list;
|
||||
|
||||
Acore::WorldObjectListSearcher<ElunaUtil::WorldObjectInRangeCheck> searcher(obj, list, checker);
|
||||
Acore::WorldObjectListSearcher<ALEUtil::WorldObjectInRangeCheck> searcher(obj, list, checker);
|
||||
Cell::VisitObjects(obj, searcher, range);
|
||||
|
||||
lua_createtable(L, list.size(), 0);
|
||||
@@ -418,7 +418,7 @@ namespace LuaWorldObject
|
||||
|
||||
for (std::list<WorldObject*>::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<WorldObject>(L, 2, false);
|
||||
WorldObject* target = ALE::CHECKOBJ<WorldObject>(L, 2, false);
|
||||
if (target)
|
||||
Eluna::Push(L, obj->GetDistance(target));
|
||||
ALE::Push(L, obj->GetDistance(target));
|
||||
else
|
||||
{
|
||||
float X = Eluna::CHECKVAL<float>(L, 2);
|
||||
float Y = Eluna::CHECKVAL<float>(L, 3);
|
||||
float Z = Eluna::CHECKVAL<float>(L, 4);
|
||||
Eluna::Push(L, obj->GetDistance(X, Y, Z));
|
||||
float X = ALE::CHECKVAL<float>(L, 2);
|
||||
float Y = ALE::CHECKVAL<float>(L, 3);
|
||||
float Z = ALE::CHECKVAL<float>(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<WorldObject>(L, 2, false);
|
||||
WorldObject* target = ALE::CHECKOBJ<WorldObject>(L, 2, false);
|
||||
if (target)
|
||||
{
|
||||
float x2, y2, z2;
|
||||
@@ -486,12 +486,12 @@ namespace LuaWorldObject
|
||||
}
|
||||
else
|
||||
{
|
||||
x -= Eluna::CHECKVAL<float>(L, 2);
|
||||
y -= Eluna::CHECKVAL<float>(L, 3);
|
||||
z -= Eluna::CHECKVAL<float>(L, 4);
|
||||
x -= ALE::CHECKVAL<float>(L, 2);
|
||||
y -= ALE::CHECKVAL<float>(L, 3);
|
||||
z -= ALE::CHECKVAL<float>(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<WorldObject>(L, 2, false);
|
||||
WorldObject* target = ALE::CHECKOBJ<WorldObject>(L, 2, false);
|
||||
if (target)
|
||||
Eluna::Push(L, obj->GetDistance2d(target));
|
||||
ALE::Push(L, obj->GetDistance2d(target));
|
||||
else
|
||||
{
|
||||
float X = Eluna::CHECKVAL<float>(L, 2);
|
||||
float Y = Eluna::CHECKVAL<float>(L, 3);
|
||||
Eluna::Push(L, obj->GetDistance2d(X, Y));
|
||||
float X = ALE::CHECKVAL<float>(L, 2);
|
||||
float Y = ALE::CHECKVAL<float>(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<WorldObject>(L, 2, false);
|
||||
WorldObject* target = ALE::CHECKOBJ<WorldObject>(L, 2, false);
|
||||
if (target)
|
||||
{
|
||||
float x2, y2, z2;
|
||||
@@ -551,11 +551,11 @@ namespace LuaWorldObject
|
||||
}
|
||||
else
|
||||
{
|
||||
x -= Eluna::CHECKVAL<float>(L, 2);
|
||||
y -= Eluna::CHECKVAL<float>(L, 3);
|
||||
x -= ALE::CHECKVAL<float>(L, 2);
|
||||
y -= ALE::CHECKVAL<float>(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<float>(L, 2);
|
||||
float rad = Eluna::CHECKVAL<float>(L, 3);
|
||||
float dist = ALE::CHECKVAL<float>(L, 2);
|
||||
float rad = ALE::CHECKVAL<float>(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<WorldObject>(L, 2, false);
|
||||
WorldObject* target = ALE::CHECKOBJ<WorldObject>(L, 2, false);
|
||||
if (target)
|
||||
Eluna::Push(L, obj->GetAbsoluteAngle(target));
|
||||
ALE::Push(L, obj->GetAbsoluteAngle(target));
|
||||
else
|
||||
{
|
||||
float x = Eluna::CHECKVAL<float>(L, 2);
|
||||
float y = Eluna::CHECKVAL<float>(L, 3);
|
||||
Eluna::Push(L, obj->GetAbsoluteAngle(x, y));
|
||||
float x = ALE::CHECKVAL<float>(L, 2);
|
||||
float y = ALE::CHECKVAL<float>(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<WorldPacket>(L, 2);
|
||||
WorldPacket* data = ALE::CHECKOBJ<WorldPacket>(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<uint32>(L, 2);
|
||||
float x = Eluna::CHECKVAL<float>(L, 3);
|
||||
float y = Eluna::CHECKVAL<float>(L, 4);
|
||||
float z = Eluna::CHECKVAL<float>(L, 5);
|
||||
float o = Eluna::CHECKVAL<float>(L, 6);
|
||||
uint32 respawnDelay = Eluna::CHECKVAL<uint32>(L, 7, 30);
|
||||
uint32 entry = ALE::CHECKVAL<uint32>(L, 2);
|
||||
float x = ALE::CHECKVAL<float>(L, 3);
|
||||
float y = ALE::CHECKVAL<float>(L, 4);
|
||||
float z = ALE::CHECKVAL<float>(L, 5);
|
||||
float o = ALE::CHECKVAL<float>(L, 6);
|
||||
uint32 respawnDelay = ALE::CHECKVAL<uint32>(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<uint32>(L, 2);
|
||||
float x = Eluna::CHECKVAL<float>(L, 3);
|
||||
float y = Eluna::CHECKVAL<float>(L, 4);
|
||||
float z = Eluna::CHECKVAL<float>(L, 5);
|
||||
float o = Eluna::CHECKVAL<float>(L, 6);
|
||||
uint32 spawnType = Eluna::CHECKVAL<uint32>(L, 7, 8);
|
||||
uint32 despawnTimer = Eluna::CHECKVAL<uint32>(L, 8, 0);
|
||||
uint32 entry = ALE::CHECKVAL<uint32>(L, 2);
|
||||
float x = ALE::CHECKVAL<float>(L, 3);
|
||||
float y = ALE::CHECKVAL<float>(L, 4);
|
||||
float z = ALE::CHECKVAL<float>(L, 5);
|
||||
float o = ALE::CHECKVAL<float>(L, 6);
|
||||
uint32 spawnType = ALE::CHECKVAL<uint32>(L, 7, 8);
|
||||
uint32 despawnTimer = ALE::CHECKVAL<uint32>(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<uint32>(L, -1);
|
||||
Eluna::Push(L, 2);
|
||||
min = ALE::CHECKVAL<uint32>(L, -1);
|
||||
ALE::Push(L, 2);
|
||||
lua_gettable(L, 3);
|
||||
max = Eluna::CHECKVAL<uint32>(L, -1);
|
||||
max = ALE::CHECKVAL<uint32>(L, -1);
|
||||
lua_pop(L, 2);
|
||||
}
|
||||
else
|
||||
min = max = Eluna::CHECKVAL<uint32>(L, 3);
|
||||
uint32 repeats = Eluna::CHECKVAL<uint32>(L, 4, 1);
|
||||
min = max = ALE::CHECKVAL<uint32>(L, 3);
|
||||
uint32 repeats = ALE::CHECKVAL<uint32>(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<int>(L, 2);
|
||||
obj->elunaEvents->SetState(eventId, LUAEVENT_STATE_ABORT);
|
||||
int eventId = ALE::CHECKVAL<int>(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<WorldObject>(L, 2, false);
|
||||
WorldObject* target = ALE::CHECKOBJ<WorldObject>(L, 2, false);
|
||||
|
||||
if (target)
|
||||
Eluna::Push(L, obj->IsWithinLOSInMap(target));
|
||||
ALE::Push(L, obj->IsWithinLOSInMap(target));
|
||||
else
|
||||
{
|
||||
float x = Eluna::CHECKVAL<float>(L, 2);
|
||||
float y = Eluna::CHECKVAL<float>(L, 3);
|
||||
float z = Eluna::CHECKVAL<float>(L, 4);
|
||||
Eluna::Push(L, obj->IsWithinLOS(x, y, z));
|
||||
float x = ALE::CHECKVAL<float>(L, 2);
|
||||
float y = ALE::CHECKVAL<float>(L, 3);
|
||||
float z = ALE::CHECKVAL<float>(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<WorldObject>(L, 2, true);
|
||||
Eluna::Push(L, obj->IsInMap(target));
|
||||
WorldObject* target = ALE::CHECKOBJ<WorldObject>(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<float>(L, 2);
|
||||
float y = Eluna::CHECKVAL<float>(L, 3);
|
||||
float z = Eluna::CHECKVAL<float>(L, 4);
|
||||
float dist = Eluna::CHECKVAL<float>(L, 5);
|
||||
Eluna::Push(L, obj->IsWithinDist3d(x, y, z, dist));
|
||||
float x = ALE::CHECKVAL<float>(L, 2);
|
||||
float y = ALE::CHECKVAL<float>(L, 3);
|
||||
float z = ALE::CHECKVAL<float>(L, 4);
|
||||
float dist = ALE::CHECKVAL<float>(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<float>(L, 2);
|
||||
float y = Eluna::CHECKVAL<float>(L, 3);
|
||||
float dist = Eluna::CHECKVAL<float>(L, 4);
|
||||
Eluna::Push(L, obj->IsWithinDist2d(x, y, dist));
|
||||
float x = ALE::CHECKVAL<float>(L, 2);
|
||||
float y = ALE::CHECKVAL<float>(L, 3);
|
||||
float dist = ALE::CHECKVAL<float>(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<WorldObject>(L, 2, true);
|
||||
float distance = Eluna::CHECKVAL<float>(L, 3);
|
||||
bool is3D = Eluna::CHECKVAL<bool>(L, 4, true);
|
||||
Eluna::Push(L, obj->IsWithinDist(target, distance, is3D));
|
||||
WorldObject* target = ALE::CHECKOBJ<WorldObject>(L, 2, true);
|
||||
float distance = ALE::CHECKVAL<float>(L, 3);
|
||||
bool is3D = ALE::CHECKVAL<bool>(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<WorldObject>(L, 2);
|
||||
float distance = Eluna::CHECKVAL<float>(L, 3);
|
||||
bool is3D = Eluna::CHECKVAL<bool>(L, 4, true);
|
||||
WorldObject* target = ALE::CHECKOBJ<WorldObject>(L, 2);
|
||||
float distance = ALE::CHECKVAL<float>(L, 3);
|
||||
bool is3D = ALE::CHECKVAL<bool>(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<WorldObject>(L, 2);
|
||||
float minrange = Eluna::CHECKVAL<float>(L, 3);
|
||||
float maxrange = Eluna::CHECKVAL<float>(L, 4);
|
||||
bool is3D = Eluna::CHECKVAL<bool>(L, 5, true);
|
||||
WorldObject* target = ALE::CHECKOBJ<WorldObject>(L, 2);
|
||||
float minrange = ALE::CHECKVAL<float>(L, 3);
|
||||
float maxrange = ALE::CHECKVAL<float>(L, 4);
|
||||
bool is3D = ALE::CHECKVAL<bool>(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<float>(L, 2);
|
||||
float y = Eluna::CHECKVAL<float>(L, 3);
|
||||
float minrange = Eluna::CHECKVAL<float>(L, 4);
|
||||
float maxrange = Eluna::CHECKVAL<float>(L, 5);
|
||||
float x = ALE::CHECKVAL<float>(L, 2);
|
||||
float y = ALE::CHECKVAL<float>(L, 3);
|
||||
float minrange = ALE::CHECKVAL<float>(L, 4);
|
||||
float maxrange = ALE::CHECKVAL<float>(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<float>(L, 2);
|
||||
float y = Eluna::CHECKVAL<float>(L, 3);
|
||||
float z = Eluna::CHECKVAL<float>(L, 4);
|
||||
float minrange = Eluna::CHECKVAL<float>(L, 5);
|
||||
float maxrange = Eluna::CHECKVAL<float>(L, 6);
|
||||
float x = ALE::CHECKVAL<float>(L, 2);
|
||||
float y = ALE::CHECKVAL<float>(L, 3);
|
||||
float z = ALE::CHECKVAL<float>(L, 4);
|
||||
float minrange = ALE::CHECKVAL<float>(L, 5);
|
||||
float maxrange = ALE::CHECKVAL<float>(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<WorldObject>(L, 2);
|
||||
float arc = Eluna::CHECKVAL<float>(L, 3, static_cast<float>(M_PI));
|
||||
WorldObject* target = ALE::CHECKOBJ<WorldObject>(L, 2);
|
||||
float arc = ALE::CHECKVAL<float>(L, 3, static_cast<float>(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<WorldObject>(L, 2);
|
||||
float arc = Eluna::CHECKVAL<float>(L, 3, static_cast<float>(M_PI));
|
||||
WorldObject* target = ALE::CHECKOBJ<WorldObject>(L, 2);
|
||||
float arc = ALE::CHECKVAL<float>(L, 3, static_cast<float>(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<uint32>(L, 2);
|
||||
Player* player = Eluna::CHECKOBJ<Player>(L, 3, false);
|
||||
uint32 musicid = ALE::CHECKVAL<uint32>(L, 2);
|
||||
Player* player = ALE::CHECKOBJ<Player>(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<uint32>(L, 2);
|
||||
Player* player = Eluna::CHECKOBJ<Player>(L, 3, false);
|
||||
uint32 soundId = ALE::CHECKVAL<uint32>(L, 2);
|
||||
Player* player = ALE::CHECKOBJ<Player>(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<uint32>(L, 2);
|
||||
Player* player = Eluna::CHECKOBJ<Player>(L, 3, false);
|
||||
uint32 soundId = ALE::CHECKVAL<uint32>(L, 2);
|
||||
Player* player = ALE::CHECKOBJ<Player>(L, 3, false);
|
||||
if (!sSoundEntriesStore.LookupEntry(soundId))
|
||||
return 0;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
|
||||
* 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<uint32>(L, 2);
|
||||
uint32 opcode = ALE::CHECKVAL<uint32>(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<ObjectGuid>(L, 2);
|
||||
ObjectGuid guid = ALE::CHECKVAL<ObjectGuid>(L, 2);
|
||||
(*packet) << guid;
|
||||
return 0;
|
||||
}
|
||||
@@ -219,7 +219,7 @@ namespace LuaPacket
|
||||
*/
|
||||
int WritePackedGUID(lua_State* L, WorldPacket* packet)
|
||||
{
|
||||
ObjectGuid guid = Eluna::CHECKVAL<ObjectGuid>(L, 2);
|
||||
ObjectGuid guid = ALE::CHECKVAL<ObjectGuid>(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<std::string>(L, 2);
|
||||
std::string _val = ALE::CHECKVAL<std::string>(L, 2);
|
||||
(*packet) << _val;
|
||||
return 0;
|
||||
}
|
||||
@@ -244,7 +244,7 @@ namespace LuaPacket
|
||||
*/
|
||||
int WriteByte(lua_State* L, WorldPacket* packet)
|
||||
{
|
||||
int8 byte = Eluna::CHECKVAL<int8>(L, 2);
|
||||
int8 byte = ALE::CHECKVAL<int8>(L, 2);
|
||||
(*packet) << byte;
|
||||
return 0;
|
||||
}
|
||||
@@ -256,7 +256,7 @@ namespace LuaPacket
|
||||
*/
|
||||
int WriteUByte(lua_State* L, WorldPacket* packet)
|
||||
{
|
||||
uint8 byte = Eluna::CHECKVAL<uint8>(L, 2);
|
||||
uint8 byte = ALE::CHECKVAL<uint8>(L, 2);
|
||||
(*packet) << byte;
|
||||
return 0;
|
||||
}
|
||||
@@ -268,7 +268,7 @@ namespace LuaPacket
|
||||
*/
|
||||
int WriteShort(lua_State* L, WorldPacket* packet)
|
||||
{
|
||||
int16 _short = Eluna::CHECKVAL<int16>(L, 2);
|
||||
int16 _short = ALE::CHECKVAL<int16>(L, 2);
|
||||
(*packet) << _short;
|
||||
return 0;
|
||||
}
|
||||
@@ -280,7 +280,7 @@ namespace LuaPacket
|
||||
*/
|
||||
int WriteUShort(lua_State* L, WorldPacket* packet)
|
||||
{
|
||||
uint16 _ushort = Eluna::CHECKVAL<uint16>(L, 2);
|
||||
uint16 _ushort = ALE::CHECKVAL<uint16>(L, 2);
|
||||
(*packet) << _ushort;
|
||||
return 0;
|
||||
}
|
||||
@@ -292,7 +292,7 @@ namespace LuaPacket
|
||||
*/
|
||||
int WriteLong(lua_State* L, WorldPacket* packet)
|
||||
{
|
||||
int32 _long = Eluna::CHECKVAL<int32>(L, 2);
|
||||
int32 _long = ALE::CHECKVAL<int32>(L, 2);
|
||||
(*packet) << _long;
|
||||
return 0;
|
||||
}
|
||||
@@ -304,7 +304,7 @@ namespace LuaPacket
|
||||
*/
|
||||
int WriteULong(lua_State* L, WorldPacket* packet)
|
||||
{
|
||||
uint32 _ulong = Eluna::CHECKVAL<uint32>(L, 2);
|
||||
uint32 _ulong = ALE::CHECKVAL<uint32>(L, 2);
|
||||
(*packet) << _ulong;
|
||||
return 0;
|
||||
}
|
||||
@@ -316,7 +316,7 @@ namespace LuaPacket
|
||||
*/
|
||||
int WriteFloat(lua_State* L, WorldPacket* packet)
|
||||
{
|
||||
float _val = Eluna::CHECKVAL<float>(L, 2);
|
||||
float _val = ALE::CHECKVAL<float>(L, 2);
|
||||
(*packet) << _val;
|
||||
return 0;
|
||||
}
|
||||
@@ -328,7 +328,7 @@ namespace LuaPacket
|
||||
*/
|
||||
int WriteDouble(lua_State* L, WorldPacket* packet)
|
||||
{
|
||||
double _val = Eluna::CHECKVAL<double>(L, 2);
|
||||
double _val = ALE::CHECKVAL<double>(L, 2);
|
||||
(*packet) << _val;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user