[Quest API] Modify GetItemStat() and GetSpellStat() functionality. (#1509)

- Added quest::getitemstat(item_id, stat_identifier) to Perl.
- Added quest::getspellstat(spell_id, stat_identifier, slot) to Perl.
- Added eq.get_item_stat(item_id, stat_identifier) to Lua.
- Added eq.get_spell_stat(spell_id, stat_identifier, slot) to Lua.

Wasn't sure where to put the GetItemStatValue() method so I put it in inventory profile, I can move it wherever is preferred.

These additions will allow people to grab item and spell stat values in plugins without needing a mob object.
This commit is contained in:
Kinglykrab
2021-08-31 02:31:56 -04:00
committed by GitHub
parent 87a4f64ff0
commit fec1b1538e
9 changed files with 523 additions and 450 deletions
+15
View File
@@ -2479,6 +2479,18 @@ std::string lua_get_data_remaining(std::string bucket_name) {
return DataBucket::GetDataRemaining(bucket_name);
}
int lua_get_item_stat(uint32 item_id, std::string stat_identifier) {
return quest_manager.getitemstat(item_id, stat_identifier);
}
int lua_get_spell_stat(uint32 spell_id, std::string stat_identifier) {
return quest_manager.getspellstat(spell_id, stat_identifier);
}
int lua_get_spell_stat(uint32 spell_id, std::string stat_identifier, uint8 slot) {
return quest_manager.getspellstat(spell_id, stat_identifier, slot);
}
#define LuaCreateNPCParse(name, c_type, default_value) do { \
cur = table[#name]; \
if(luabind::type(cur) != LUA_TNIL) { \
@@ -3049,6 +3061,9 @@ luabind::scope lua_register_general() {
luabind::def("get_inventory_slot_name", &lua_get_inventory_slot_name),
luabind::def("rename", &lua_rename),
luabind::def("get_data_remaining", &lua_get_data_remaining),
luabind::def("get_item_stat", &lua_get_item_stat),
luabind::def("get_spell_stat", (int(*)(uint32,std::string))&lua_get_spell_stat),
luabind::def("get_spell_stat", (int(*)(uint32,std::string,uint8))&lua_get_spell_stat),
/**
* Expansions