mirror of
https://github.com/azerothcore/mod-ale
synced 2025-11-29 15:38:17 +08:00
feat: add DBCStores access via Lua with getters for DBC entries (#222)
This commit is contained in:
7
src/LuaEngine/ElunaDBCRegistry.cpp
Normal file
7
src/LuaEngine/ElunaDBCRegistry.cpp
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "ElunaDBCRegistry.h"
|
||||
|
||||
std::vector<DBCDefinition> dbcRegistry = {
|
||||
REGISTER_DBC(GemProperties, GemPropertiesEntry, sGemPropertiesStore),
|
||||
REGISTER_DBC(Spell, SpellEntry, sSpellStore),
|
||||
};
|
||||
|
||||
38
src/LuaEngine/ElunaDBCRegistry.h
Normal file
38
src/LuaEngine/ElunaDBCRegistry.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#ifndef ELUNADBCREGISTRY_H
|
||||
#define ELUNADBCREGISTRY_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
#include <typeinfo>
|
||||
|
||||
#include "DBCStores.h"
|
||||
#include "LuaEngine.h"
|
||||
|
||||
struct DBCDefinition
|
||||
{
|
||||
std::string name;
|
||||
void* storage;
|
||||
const std::type_info& type;
|
||||
std::function<const void*(uint32)> lookupFunction;
|
||||
std::function<void(lua_State*, const void*)> pushFunction;
|
||||
};
|
||||
|
||||
extern std::vector<DBCDefinition> dbcRegistry;
|
||||
|
||||
#define REGISTER_DBC(dbcName, entryType, store) \
|
||||
{ \
|
||||
#dbcName, \
|
||||
reinterpret_cast<void*>(&store), \
|
||||
typeid(DBCStorage<entryType>), \
|
||||
[](uint32 id) -> const void* { \
|
||||
return store.LookupEntry(id); \
|
||||
}, \
|
||||
[](lua_State* L, const void* entry) { \
|
||||
auto cast_entry = static_cast<const entryType*>(entry); \
|
||||
Eluna::Push(L, *cast_entry); \
|
||||
} \
|
||||
}
|
||||
|
||||
#endif // ELUNADBCREGISTRY_H
|
||||
|
||||
@@ -694,6 +694,16 @@ void Eluna::Push(lua_State* luastate, ObjectGuid const guid)
|
||||
ElunaTemplate<unsigned long long>::Push(luastate, new unsigned long long(guid.GetRawValue()));
|
||||
}
|
||||
|
||||
void Eluna::Push(lua_State* luastate, GemPropertiesEntry const& gemProperties)
|
||||
{
|
||||
Push(luastate, &gemProperties);
|
||||
}
|
||||
|
||||
void Eluna::Push(lua_State* luastate, SpellEntry const& spell)
|
||||
{
|
||||
Push(luastate, &spell);
|
||||
}
|
||||
|
||||
std::string Eluna::FormatQuery(lua_State* L, const char* query)
|
||||
{
|
||||
int numArgs = lua_gettop(L);
|
||||
|
||||
@@ -257,6 +257,8 @@ public:
|
||||
static void Push(lua_State* luastate, Pet const* pet);
|
||||
static void Push(lua_State* luastate, TempSummon const* summon);
|
||||
static void Push(lua_State* luastate, ObjectGuid const guid);
|
||||
static void Push(lua_State* luastate, GemPropertiesEntry const& gemProperties);
|
||||
static void Push(lua_State* luastate, SpellEntry const& spell);
|
||||
template<typename T>
|
||||
static void Push(lua_State* luastate, T const* ptr)
|
||||
{
|
||||
|
||||
@@ -41,6 +41,10 @@ extern "C"
|
||||
#include "ItemTemplateMethods.h"
|
||||
#include "RollMethods.h"
|
||||
|
||||
// DBCStores includes
|
||||
#include "GemPropertiesEntryMethods.h"
|
||||
#include "SpellEntryMethods.h"
|
||||
|
||||
luaL_Reg GlobalMethods[] =
|
||||
{
|
||||
// Hooks
|
||||
@@ -162,6 +166,7 @@ luaL_Reg GlobalMethods[] =
|
||||
{ "StopGameEvent", &LuaGlobalFunctions::StopGameEvent },
|
||||
{ "HttpRequest", &LuaGlobalFunctions::HttpRequest },
|
||||
{ "SetOwnerHalaa", &LuaGlobalFunctions::SetOwnerHalaa },
|
||||
{ "LookupEntry", &LuaGlobalFunctions::LookupEntry },
|
||||
|
||||
{ NULL, NULL }
|
||||
};
|
||||
@@ -1292,6 +1297,114 @@ ElunaRegister<Roll> RollMethods[] =
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
ElunaRegister<GemPropertiesEntry> GemPropertiesEntryMethods[] =
|
||||
{
|
||||
// Getters
|
||||
{ "GetId", &LuaGemPropertiesEntry::GetId },
|
||||
{ "GetSpellItemEnchantement", &LuaGemPropertiesEntry::GetSpellItemEnchantement },
|
||||
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
ElunaRegister<SpellEntry> SpellEntryMethods[] =
|
||||
{
|
||||
// Getters
|
||||
{ "GetId", &LuaSpellEntry::GetId },
|
||||
{ "GetCategory", &LuaSpellEntry::GetCategory },
|
||||
{ "GetDispel", &LuaSpellEntry::GetDispel },
|
||||
{ "GetMechanic", &LuaSpellEntry::GetMechanic },
|
||||
{ "GetAttributes", &LuaSpellEntry::GetAttributes },
|
||||
{ "GetAttributesEx", &LuaSpellEntry::GetAttributesEx },
|
||||
{ "GetAttributesEx2", &LuaSpellEntry::GetAttributesEx2 },
|
||||
{ "GetAttributesEx3", &LuaSpellEntry::GetAttributesEx3 },
|
||||
{ "GetAttributesEx4", &LuaSpellEntry::GetAttributesEx4 },
|
||||
{ "GetAttributesEx5", &LuaSpellEntry::GetAttributesEx5 },
|
||||
{ "GetAttributesEx6", &LuaSpellEntry::GetAttributesEx6 },
|
||||
{ "GetAttributesEx7", &LuaSpellEntry::GetAttributesEx7 },
|
||||
{ "GetStances", &LuaSpellEntry::GetStances },
|
||||
{ "GetStancesNot", &LuaSpellEntry::GetStancesNot },
|
||||
{ "GetTargets", &LuaSpellEntry::GetTargets },
|
||||
{ "GetTargetCreatureType", &LuaSpellEntry::GetTargetCreatureType },
|
||||
{ "GetRequiresSpellFocus", &LuaSpellEntry::GetRequiresSpellFocus },
|
||||
{ "GetFacingCasterFlags", &LuaSpellEntry::GetFacingCasterFlags },
|
||||
{ "GetCasterAuraState", &LuaSpellEntry::GetCasterAuraState },
|
||||
{ "GetTargetAuraState", &LuaSpellEntry::GetTargetAuraState },
|
||||
{ "GetCasterAuraStateNot", &LuaSpellEntry::GetCasterAuraStateNot },
|
||||
{ "GetTargetAuraStateNot", &LuaSpellEntry::GetTargetAuraStateNot },
|
||||
{ "GetCasterAuraSpell", &LuaSpellEntry::GetCasterAuraSpell },
|
||||
{ "GetTargetAuraSpell", &LuaSpellEntry::GetTargetAuraSpell },
|
||||
{ "GetExcludeCasterAuraSpell", &LuaSpellEntry::GetExcludeCasterAuraSpell },
|
||||
{ "GetExcludeTargetAuraSpell", &LuaSpellEntry::GetExcludeTargetAuraSpell },
|
||||
{ "GetCastingTimeIndex", &LuaSpellEntry::GetCastingTimeIndex },
|
||||
{ "GetRecoveryTime", &LuaSpellEntry::GetRecoveryTime },
|
||||
{ "GetCategoryRecoveryTime", &LuaSpellEntry::GetCategoryRecoveryTime },
|
||||
{ "GetInterruptFlags", &LuaSpellEntry::GetInterruptFlags },
|
||||
{ "GetAuraInterruptFlags", &LuaSpellEntry::GetAuraInterruptFlags },
|
||||
{ "GetChannelInterruptFlags", &LuaSpellEntry::GetChannelInterruptFlags },
|
||||
{ "GetProcFlags", &LuaSpellEntry::GetProcFlags },
|
||||
{ "GetProcChance", &LuaSpellEntry::GetProcChance },
|
||||
{ "GetProcCharges", &LuaSpellEntry::GetProcCharges },
|
||||
{ "GetMaxLevel", &LuaSpellEntry::GetMaxLevel },
|
||||
{ "GetBaseLevel", &LuaSpellEntry::GetBaseLevel },
|
||||
{ "GetSpellLevel", &LuaSpellEntry::GetSpellLevel },
|
||||
{ "GetDurationIndex", &LuaSpellEntry::GetDurationIndex },
|
||||
{ "GetPowerType", &LuaSpellEntry::GetPowerType },
|
||||
{ "GetManaCost", &LuaSpellEntry::GetManaCost },
|
||||
{ "GetManaCostPerlevel", &LuaSpellEntry::GetManaCostPerlevel },
|
||||
{ "GetManaPerSecond", &LuaSpellEntry::GetManaPerSecond },
|
||||
{ "GetManaPerSecondPerLevel", &LuaSpellEntry::GetManaPerSecondPerLevel },
|
||||
{ "GetRangeIndex", &LuaSpellEntry::GetRangeIndex },
|
||||
{ "GetSpeed", &LuaSpellEntry::GetSpeed },
|
||||
{ "GetStackAmount", &LuaSpellEntry::GetStackAmount },
|
||||
{ "GetTotem", &LuaSpellEntry::GetTotem },
|
||||
{ "GetReagent", &LuaSpellEntry::GetReagent },
|
||||
{ "GetReagentCount", &LuaSpellEntry::GetReagentCount },
|
||||
{ "GetEquippedItemClass", &LuaSpellEntry::GetEquippedItemClass },
|
||||
{ "GetEquippedItemSubClassMask", &LuaSpellEntry::GetEquippedItemSubClassMask },
|
||||
{ "GetEquippedItemInventoryTypeMask", &LuaSpellEntry::GetEquippedItemInventoryTypeMask },
|
||||
{ "GetEffect", &LuaSpellEntry::GetEffect },
|
||||
{ "GetEffectDieSides", &LuaSpellEntry::GetEffectDieSides },
|
||||
{ "GetEffectRealPointsPerLevel", &LuaSpellEntry::GetEffectRealPointsPerLevel },
|
||||
{ "GetEffectBasePoints", &LuaSpellEntry::GetEffectBasePoints },
|
||||
{ "GetEffectMechanic", &LuaSpellEntry::GetEffectMechanic },
|
||||
{ "GetEffectImplicitTargetA", &LuaSpellEntry::GetEffectImplicitTargetA },
|
||||
{ "GetEffectImplicitTargetB", &LuaSpellEntry::GetEffectImplicitTargetB },
|
||||
{ "GetEffectRadiusIndex", &LuaSpellEntry::GetEffectRadiusIndex },
|
||||
{ "GetEffectApplyAuraName", &LuaSpellEntry::GetEffectApplyAuraName },
|
||||
{ "GetEffectAmplitude", &LuaSpellEntry::GetEffectAmplitude },
|
||||
{ "GetEffectValueMultiplier", &LuaSpellEntry::GetEffectValueMultiplier },
|
||||
{ "GetEffectChainTarget", &LuaSpellEntry::GetEffectChainTarget },
|
||||
{ "GetEffectItemType", &LuaSpellEntry::GetEffectItemType },
|
||||
{ "GetEffectMiscValue", &LuaSpellEntry::GetEffectMiscValue },
|
||||
{ "GetEffectMiscValueB", &LuaSpellEntry::GetEffectMiscValueB },
|
||||
{ "GetEffectTriggerSpell", &LuaSpellEntry::GetEffectTriggerSpell },
|
||||
{ "GetEffectPointsPerComboPoint", &LuaSpellEntry::GetEffectPointsPerComboPoint },
|
||||
{ "GetEffectSpellClassMask", &LuaSpellEntry::GetEffectSpellClassMask },
|
||||
{ "GetSpellVisual", &LuaSpellEntry::GetSpellVisual },
|
||||
{ "GetSpellIconID", &LuaSpellEntry::GetSpellIconID },
|
||||
{ "GetActiveIconID", &LuaSpellEntry::GetActiveIconID },
|
||||
{ "GetSpellPriority", &LuaSpellEntry::GetSpellPriority },
|
||||
{ "GetSpellName", &LuaSpellEntry::GetSpellName },
|
||||
{ "GetRank", &LuaSpellEntry::GetRank },
|
||||
{ "GetManaCostPercentage", &LuaSpellEntry::GetManaCostPercentage },
|
||||
{ "GetStartRecoveryCategory", &LuaSpellEntry::GetStartRecoveryCategory },
|
||||
{ "GetStartRecoveryTime", &LuaSpellEntry::GetStartRecoveryTime },
|
||||
{ "GetMaxTargetLevel", &LuaSpellEntry::GetMaxTargetLevel },
|
||||
{ "GetSpellFamilyName", &LuaSpellEntry::GetSpellFamilyName },
|
||||
{ "GetSpellFamilyFlags", &LuaSpellEntry::GetSpellFamilyFlags },
|
||||
{ "GetMaxAffectedTargets", &LuaSpellEntry::GetMaxAffectedTargets },
|
||||
{ "GetDmgClass", &LuaSpellEntry::GetDmgClass },
|
||||
{ "GetPreventionType", &LuaSpellEntry::GetPreventionType },
|
||||
{ "GetEffectDamageMultiplier", &LuaSpellEntry::GetEffectDamageMultiplier },
|
||||
{ "GetTotemCategory", &LuaSpellEntry::GetTotemCategory },
|
||||
{ "GetAreaGroupId", &LuaSpellEntry::GetAreaGroupId },
|
||||
{ "GetSchoolMask", &LuaSpellEntry::GetSchoolMask },
|
||||
{ "GetRuneCostID", &LuaSpellEntry::GetRuneCostID },
|
||||
{ "GetEffectBonusMultiplier", &LuaSpellEntry::GetEffectBonusMultiplier },
|
||||
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
// fix compile error about accessing vehicle destructor
|
||||
template<> int ElunaTemplate<Vehicle>::CollectGarbage(lua_State* L)
|
||||
{
|
||||
@@ -1437,6 +1550,12 @@ void RegisterFunctions(Eluna* E)
|
||||
ElunaTemplate<Roll>::Register(E, "Roll");
|
||||
ElunaTemplate<Roll>::SetMethods(E, RollMethods);
|
||||
|
||||
ElunaTemplate<GemPropertiesEntry>::Register(E, "GemPropertiesEntry");
|
||||
ElunaTemplate<GemPropertiesEntry>::SetMethods(E, GemPropertiesEntryMethods);
|
||||
|
||||
ElunaTemplate<SpellEntry>::Register(E, "SpellEntry");
|
||||
ElunaTemplate<SpellEntry>::SetMethods(E, SpellEntryMethods);
|
||||
|
||||
ElunaTemplate<long long>::Register(E, "long long", true);
|
||||
|
||||
ElunaTemplate<unsigned long long>::Register(E, "unsigned long long", true);
|
||||
|
||||
41
src/LuaEngine/methods/GemPropertiesEntryMethods.h
Normal file
41
src/LuaEngine/methods/GemPropertiesEntryMethods.h
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* This program is free software licensed under GPL version 3
|
||||
* Please see the included DOCS/LICENSE.md for more information
|
||||
*/
|
||||
|
||||
#ifndef GEMPROPERTIESENTRYMETHODS_H
|
||||
#define GEMPROPERTIESENTRYMETHODS_H
|
||||
|
||||
namespace LuaGemPropertiesEntry
|
||||
{
|
||||
|
||||
/**
|
||||
* Returns the ID of a [GemPropertiesEntry].
|
||||
*
|
||||
* This method retrieves the ID from a given GemPropertiesEntry instance
|
||||
* and pushes it onto the Lua stack.
|
||||
*
|
||||
* @return uint32 id : The ID of the specified GemPropertiesEntry.
|
||||
*/
|
||||
int GetId(lua_State* L, GemPropertiesEntry* gemProperties)
|
||||
{
|
||||
Eluna::Push(L, gemProperties->ID);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the spell item enchantment of a [GemPropertiesEntry].
|
||||
*
|
||||
* This function retrieves the `spellitemenchantement` attribute from the provided `GemPropertiesEntry`.
|
||||
*
|
||||
* @return uint32 spellitemenchantement : The spell item enchantment ID.
|
||||
*/
|
||||
int GetSpellItemEnchantement(lua_State* L, GemPropertiesEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->spellitemenchantement);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#define GLOBALMETHODS_H
|
||||
|
||||
#include "BindingMap.h"
|
||||
#include "ElunaDBCRegistry.h"
|
||||
|
||||
#include "BanMgr.h"
|
||||
#include "GameTime.h"
|
||||
@@ -15,6 +16,7 @@
|
||||
#include "OutdoorPvPMgr.h"
|
||||
#include "../../../../src/server/scripts/OutdoorPvP/OutdoorPvPNA.h"
|
||||
|
||||
|
||||
enum BanMode
|
||||
{
|
||||
BAN_ACCOUNT = 1,
|
||||
@@ -3227,5 +3229,37 @@ namespace LuaGlobalFunctions
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the instance of the specified DBC (DatabaseClient) store.
|
||||
*
|
||||
* This function retrieves the DBC store associated with the provided name
|
||||
* and pushes it onto the Lua stack.
|
||||
*
|
||||
* @param const char* dbcName : The name of the DBC store to retrieve.
|
||||
* @param uint32 id : The ID used to look up within the specified DBC store.
|
||||
*
|
||||
* @return [DBCStore] store : The requested DBC store instance.
|
||||
*/
|
||||
int LookupEntry(lua_State* L)
|
||||
{
|
||||
const char* dbcName = Eluna::CHECKVAL<const char*>(L, 1);
|
||||
uint32 id = Eluna::CHECKVAL<uint32>(L, 2);
|
||||
|
||||
for (const auto& dbc : dbcRegistry)
|
||||
{
|
||||
if (dbc.name == dbcName)
|
||||
{
|
||||
const void* entry = dbc.lookupFunction(id);
|
||||
if (!entry)
|
||||
return 0;
|
||||
|
||||
dbc.pushFunction(L, entry);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return luaL_error(L, "Invalid DBC name: %s", dbcName);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
701
src/LuaEngine/methods/SpellEntryMethods.h
Normal file
701
src/LuaEngine/methods/SpellEntryMethods.h
Normal file
@@ -0,0 +1,701 @@
|
||||
/*
|
||||
* Copyright (C) 2010 - 2016 Eluna Lua Engine <http://emudevs.com/>
|
||||
* This program is free software licensed under GPL version 3
|
||||
* Please see the included DOCS/LICENSE.md for more information
|
||||
*/
|
||||
|
||||
#ifndef SPELLENTRYMETHODS_H
|
||||
#define SPELLENTRYMETHODS_H
|
||||
|
||||
namespace LuaSpellEntry
|
||||
{
|
||||
int GetId(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->Id);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetCategory(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->Category);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetDispel(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->Dispel);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetMechanic(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->Mechanic);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetAttributes(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->Attributes);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetAttributesEx(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->AttributesEx);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetAttributesEx2(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->AttributesEx2);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetAttributesEx3(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->AttributesEx3);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetAttributesEx4(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->AttributesEx4);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetAttributesEx5(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->AttributesEx5);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetAttributesEx6(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->AttributesEx6);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetAttributesEx7(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->AttributesEx7);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetStances(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->Stances);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetStancesNot(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->StancesNot);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetTargets(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->Targets);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetTargetCreatureType(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->TargetCreatureType);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetRequiresSpellFocus(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->RequiresSpellFocus);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetFacingCasterFlags(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->FacingCasterFlags);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetCasterAuraState(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->CasterAuraState);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetTargetAuraState(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->TargetAuraState);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetCasterAuraStateNot(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->CasterAuraStateNot);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetTargetAuraStateNot(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->TargetAuraStateNot);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetCasterAuraSpell(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->CasterAuraSpell);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetTargetAuraSpell(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->TargetAuraSpell);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetExcludeCasterAuraSpell(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->ExcludeCasterAuraSpell);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetExcludeTargetAuraSpell(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->ExcludeTargetAuraSpell);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetCastingTimeIndex(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->CastingTimeIndex);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetRecoveryTime(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->RecoveryTime);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetCategoryRecoveryTime(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->CategoryRecoveryTime);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetInterruptFlags(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->InterruptFlags);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetAuraInterruptFlags(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->AuraInterruptFlags);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetChannelInterruptFlags(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->ChannelInterruptFlags);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetProcFlags(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->ProcFlags);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetProcChance(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->ProcChance);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetProcCharges(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->ProcCharges);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetMaxLevel(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->MaxLevel);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetBaseLevel(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->BaseLevel);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetSpellLevel(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->SpellLevel);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetDurationIndex(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->DurationIndex);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetPowerType(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->PowerType);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetManaCost(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->ManaCost);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetManaCostPerlevel(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->ManaCostPerlevel);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetManaPerSecond(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->ManaPerSecond);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetManaPerSecondPerLevel(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->ManaPerSecondPerLevel);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetRangeIndex(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->RangeIndex);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetSpeed(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->Speed);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetStackAmount(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->StackAmount);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetTotem(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
lua_newtable(L);
|
||||
for (size_t i = 0; i < entry->Totem.size(); ++i)
|
||||
{
|
||||
Eluna::Push(L, entry->Totem[i]);
|
||||
lua_rawseti(L, -2, i + 1);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetReagent(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
lua_newtable(L);
|
||||
for (size_t i = 0; i < entry->Reagent.size(); ++i)
|
||||
{
|
||||
Eluna::Push(L, entry->Reagent[i]);
|
||||
lua_rawseti(L, -2, i + 1);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetReagentCount(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
lua_newtable(L);
|
||||
for (size_t i = 0; i < entry->ReagentCount.size(); ++i)
|
||||
{
|
||||
Eluna::Push(L, entry->ReagentCount[i]);
|
||||
lua_rawseti(L, -2, i + 1);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetEquippedItemClass(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->EquippedItemClass);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetEquippedItemSubClassMask(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->EquippedItemSubClassMask);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetEquippedItemInventoryTypeMask(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->EquippedItemInventoryTypeMask);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetEffect(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
lua_newtable(L);
|
||||
for (size_t i = 0; i < entry->Effect.size(); ++i)
|
||||
{
|
||||
Eluna::Push(L, entry->Effect[i]);
|
||||
lua_rawseti(L, -2, i + 1);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetEffectDieSides(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
lua_newtable(L);
|
||||
for (size_t i = 0; i < entry->EffectDieSides.size(); ++i)
|
||||
{
|
||||
Eluna::Push(L, entry->EffectDieSides[i]);
|
||||
lua_rawseti(L, -2, i + 1);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetEffectRealPointsPerLevel(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
lua_newtable(L);
|
||||
for (size_t i = 0; i < entry->EffectRealPointsPerLevel.size(); ++i)
|
||||
{
|
||||
Eluna::Push(L, entry->EffectRealPointsPerLevel[i]);
|
||||
lua_rawseti(L, -2, i + 1);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetEffectBasePoints(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
lua_newtable(L);
|
||||
for (size_t i = 0; i < entry->EffectBasePoints.size(); ++i)
|
||||
{
|
||||
Eluna::Push(L, entry->EffectBasePoints[i]);
|
||||
lua_rawseti(L, -2, i + 1);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetEffectMechanic(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
lua_newtable(L);
|
||||
for (size_t i = 0; i < entry->EffectMechanic.size(); ++i)
|
||||
{
|
||||
Eluna::Push(L, entry->EffectMechanic[i]);
|
||||
lua_rawseti(L, -2, i + 1);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetEffectImplicitTargetA(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
lua_newtable(L);
|
||||
for (size_t i = 0; i < entry->EffectImplicitTargetA.size(); ++i)
|
||||
{
|
||||
Eluna::Push(L, entry->EffectImplicitTargetA[i]);
|
||||
lua_rawseti(L, -2, i + 1);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetEffectImplicitTargetB(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
lua_newtable(L);
|
||||
for (size_t i = 0; i < entry->EffectImplicitTargetB.size(); ++i)
|
||||
{
|
||||
Eluna::Push(L, entry->EffectImplicitTargetB[i]);
|
||||
lua_rawseti(L, -2, i + 1);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetEffectRadiusIndex(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
lua_newtable(L);
|
||||
for (size_t i = 0; i < entry->EffectRadiusIndex.size(); ++i)
|
||||
{
|
||||
Eluna::Push(L, entry->EffectRadiusIndex[i]);
|
||||
lua_rawseti(L, -2, i + 1);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetEffectApplyAuraName(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
lua_newtable(L);
|
||||
for (size_t i = 0; i < entry->EffectApplyAuraName.size(); ++i)
|
||||
{
|
||||
Eluna::Push(L, entry->EffectApplyAuraName[i]);
|
||||
lua_rawseti(L, -2, i + 1);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetEffectAmplitude(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
lua_newtable(L);
|
||||
for (size_t i = 0; i < entry->EffectAmplitude.size(); ++i)
|
||||
{
|
||||
Eluna::Push(L, entry->EffectAmplitude[i]);
|
||||
lua_rawseti(L, -2, i + 1);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetEffectValueMultiplier(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
lua_newtable(L);
|
||||
for (size_t i = 0; i < entry->EffectValueMultiplier.size(); ++i)
|
||||
{
|
||||
Eluna::Push(L, entry->EffectValueMultiplier[i]);
|
||||
lua_rawseti(L, -2, i + 1);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetEffectChainTarget(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
lua_newtable(L);
|
||||
for (size_t i = 0; i < entry->EffectChainTarget.size(); ++i)
|
||||
{
|
||||
Eluna::Push(L, entry->EffectChainTarget[i]);
|
||||
lua_rawseti(L, -2, i + 1);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetEffectItemType(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
lua_newtable(L);
|
||||
for (size_t i = 0; i < entry->EffectItemType.size(); ++i)
|
||||
{
|
||||
Eluna::Push(L, entry->EffectItemType[i]);
|
||||
lua_rawseti(L, -2, i + 1);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetEffectMiscValue(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
lua_newtable(L);
|
||||
for (size_t i = 0; i < entry->EffectMiscValue.size(); ++i)
|
||||
{
|
||||
Eluna::Push(L, entry->EffectMiscValue[i]);
|
||||
lua_rawseti(L, -2, i + 1);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetEffectMiscValueB(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
lua_newtable(L);
|
||||
for (size_t i = 0; i < entry->EffectMiscValueB.size(); ++i)
|
||||
{
|
||||
Eluna::Push(L, entry->EffectMiscValueB[i]);
|
||||
lua_rawseti(L, -2, i + 1);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetEffectTriggerSpell(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
lua_newtable(L);
|
||||
for (size_t i = 0; i < entry->EffectTriggerSpell.size(); ++i)
|
||||
{
|
||||
Eluna::Push(L, entry->EffectTriggerSpell[i]);
|
||||
lua_rawseti(L, -2, i + 1);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetEffectPointsPerComboPoint(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
lua_newtable(L);
|
||||
for (size_t i = 0; i < entry->EffectPointsPerComboPoint.size(); ++i)
|
||||
{
|
||||
Eluna::Push(L, entry->EffectPointsPerComboPoint[i]);
|
||||
lua_rawseti(L, -2, i + 1);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetEffectSpellClassMask(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
lua_newtable(L);
|
||||
for (size_t i = 0; i < entry->EffectSpellClassMask.size(); ++i)
|
||||
{
|
||||
Eluna::Push(L, entry->EffectSpellClassMask[i]);
|
||||
lua_rawseti(L, -2, i + 1);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetSpellVisual(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
lua_newtable(L);
|
||||
for (size_t i = 0; i < entry->SpellVisual.size(); ++i)
|
||||
{
|
||||
Eluna::Push(L, entry->SpellVisual[i]);
|
||||
lua_rawseti(L, -2, i + 1);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetSpellIconID(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->SpellIconID);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetActiveIconID(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->ActiveIconID);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetSpellPriority(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->SpellPriority);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetSpellName(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
lua_newtable(L);
|
||||
for (size_t i = 0; i < entry->SpellName.size(); ++i)
|
||||
{
|
||||
Eluna::Push(L, entry->SpellName[i]);
|
||||
lua_rawseti(L, -2, i + 1);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetRank(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
lua_newtable(L);
|
||||
for (size_t i = 0; i < entry->Rank.size(); ++i)
|
||||
{
|
||||
Eluna::Push(L, entry->Rank[i]);
|
||||
lua_rawseti(L, -2, i + 1);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetManaCostPercentage(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->ManaCostPercentage);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetStartRecoveryCategory(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->StartRecoveryCategory);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetStartRecoveryTime(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->StartRecoveryTime);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetMaxTargetLevel(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->MaxTargetLevel);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetSpellFamilyName(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->SpellFamilyName);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetSpellFamilyFlags(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->SpellFamilyFlags);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetMaxAffectedTargets(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->MaxAffectedTargets);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetDmgClass(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->DmgClass);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetPreventionType(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->PreventionType);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetEffectDamageMultiplier(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
lua_newtable(L);
|
||||
for (size_t i = 0; i < entry->EffectDamageMultiplier.size(); ++i)
|
||||
{
|
||||
Eluna::Push(L, entry->EffectDamageMultiplier[i]);
|
||||
lua_rawseti(L, -2, i + 1);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetTotemCategory(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
lua_newtable(L);
|
||||
for (size_t i = 0; i < entry->TotemCategory.size(); ++i)
|
||||
{
|
||||
Eluna::Push(L, entry->TotemCategory[i]);
|
||||
lua_rawseti(L, -2, i + 1);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetAreaGroupId(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->AreaGroupId);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetSchoolMask(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->SchoolMask);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetRuneCostID(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
Eluna::Push(L, entry->RuneCostID);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GetEffectBonusMultiplier(lua_State* L, SpellEntry* entry)
|
||||
{
|
||||
lua_newtable(L);
|
||||
for (size_t i = 0; i < entry->EffectBonusMultiplier.size(); ++i)
|
||||
{
|
||||
Eluna::Push(L, entry->EffectBonusMultiplier[i]);
|
||||
lua_rawseti(L, -2, i + 1);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user