diff --git a/common/database_schema.h b/common/database_schema.h index f4f3644fc..1c0cf66f3 100644 --- a/common/database_schema.h +++ b/common/database_schema.h @@ -414,6 +414,7 @@ namespace DatabaseSchema { "bot_spell_settings", "bot_spells_entries", "bot_stances", + "bot_stat_caps", "bot_timers" }; } diff --git a/common/emu_constants.cpp b/common/emu_constants.cpp index ecb1e4c58..a6a8319c6 100644 --- a/common/emu_constants.cpp +++ b/common/emu_constants.cpp @@ -471,3 +471,13 @@ bool PetType::IsValid(uint8 pet_type) { return pet_types.find(pet_type) != pet_types.end(); } + +std::string StatCap::GetName(uint8 stat_id) +{ + return IsValid(stat_id) ? stat_caps[stat_id] : "UNKNOWN STAT CAP"; +} + +bool StatCap::IsValid(uint8 stat_id) +{ + return stat_caps.find(stat_id) != stat_caps.end(); +} diff --git a/common/emu_constants.h b/common/emu_constants.h index 04355c78f..6d6340cba 100644 --- a/common/emu_constants.h +++ b/common/emu_constants.h @@ -942,6 +942,34 @@ namespace StatCap { constexpr uint8 Stat = 19; constexpr uint8 Strikethrough = 20; constexpr uint8 StunResist = 21; + + static std::map stat_caps = { + { Accuracy, "Accuracy" }, + { Attack, "Attack" }, + { Avoidance, "Avoidance" }, + { Clairvoyance, "Clairvoyance" }, + { CombatEffects, "Combat Effects" }, + { DamageShield, "Damage Shield" }, + { DOTShielding, "Damage Over Time Shielding" }, + { DSMitigation, "Damage Shield Mitigation" }, + { EnduranceRegen, "Endurance Regen" }, + { ExtraDamage, "Extra Damage" }, + { Haste, "Haste" }, + { HasteV3, "Haste V3" }, + { HealAmount, "Heal Amount" }, + { HealthRegen, "Health Regen" }, + { ManaRegen, "Mana Regen" }, + { QuiverHaste, "Quiver Haste" }, + { Shielding, "Shielding" }, + { SpellDamage, "Spell Damage" }, + { SpellShielding, "Spell Shielding" }, + { Stat, "Stat" }, + { Strikethrough, "Strikethrough" }, + { StunResist, "Stun Resist" } + }; + + std::string GetName(uint8 stat_id); + bool IsValid(uint8 stat_id); } #endif /*COMMON_EMU_CONSTANTS_H*/ diff --git a/zone/embparser_api.cpp b/zone/embparser_api.cpp index feedab7fd..6b26d13ec 100644 --- a/zone/embparser_api.cpp +++ b/zone/embparser_api.cpp @@ -6049,6 +6049,11 @@ std::string Perl__get_pet_type_name(uint8 pet_type) return PetType::GetName(pet_type); } +std::string Perl__get_stat_cap_name(uint8 stat_id) +{ + return StatCap::GetName(stat_id); +} + void perl_register_quest() { perl::interpreter perl(PERL_GET_THX); @@ -6760,6 +6765,7 @@ void perl_register_quest() package.add("getspellstat", (int(*)(uint32, std::string))&Perl__getspellstat); package.add("getspellstat", (int(*)(uint32, std::string, uint8))&Perl__getspellstat); package.add("getskillname", &Perl__getskillname); + package.add("get_stat_cap_name", &Perl__get_stat_cap_name); package.add("get_timers", &Perl__get_timers); package.add("getlevel", &Perl__getlevel); package.add("getplayerburiedcorpsecount", &Perl__getplayerburiedcorpsecount); diff --git a/zone/lua_general.cpp b/zone/lua_general.cpp index ae8c4b2af..9b7477bbf 100644 --- a/zone/lua_general.cpp +++ b/zone/lua_general.cpp @@ -5711,6 +5711,11 @@ std::string lua_get_pet_type_name(uint8 pet_type) return PetType::GetName(pet_type); } +std::string lua_get_stat_cap_name(uint8 stat_id) +{ + return StatCap::GetName(stat_id); +} + #define LuaCreateNPCParse(name, c_type, default_value) do { \ cur = table[#name]; \ if(luabind::type(cur) != LUA_TNIL) { \ @@ -6526,6 +6531,7 @@ luabind::scope lua_register_general() { luabind::def("get_timers", &lua_get_timers), luabind::def("get_pet_command_name", &lua_get_pet_command_name), luabind::def("get_pet_type_name", &lua_get_pet_type_name), + luabind::def("get_stat_cap_name", &lua_get_stat_cap_name), /* Cross Zone */