From f8a72296e633a2f1f2c3ddf662f1985b782cf324 Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 16 Jun 2021 11:45:38 -0400 Subject: [PATCH] [Quest API] Add getdeityname(deity_id) to Perl/Lua. (#1404) - Add quest::getdeityname(deity_id) to Perl. - Add eq.get_deity_name(deity_id) to Lua. Co-authored-by: Chris Miles --- zone/embparser_api.cpp | 14 ++++++++++++++ zone/lua_general.cpp | 7 ++++++- zone/questmgr.cpp | 8 +++++++- zone/questmgr.h | 1 + 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/zone/embparser_api.cpp b/zone/embparser_api.cpp index 94af4cdee..1ab1f05df 100644 --- a/zone/embparser_api.cpp +++ b/zone/embparser_api.cpp @@ -6774,6 +6774,19 @@ XS(XS__getcleannpcnamebyid) { XSRETURN(1); } + +XS(XS__getdeityname); +XS(XS__getdeityname) { + dXSARGS; + if (items != 1) + Perl_croak(aTHX_ "Usage: quest::getdeityname(uint32 deity_id)"); + + dXSTARG; + uint32 deity_id = (uint32) SvUV(ST(0)); + auto deity_name = quest_manager.getdeityname(deity_id); + sv_setpv(TARG, deity_name.c_str()); +} + XS(XS__getinventoryslotname); XS(XS__getinventoryslotname) { dXSARGS; @@ -7041,6 +7054,7 @@ EXTERN_C XS(boot_quest) { newXS(strcpy(buf, "get_spawn_condition"), XS__get_spawn_condition, file); newXS(strcpy(buf, "getcharnamebyid"), XS__getcharnamebyid, file); newXS(strcpy(buf, "getcurrencyitemid"), XS__getcurrencyitemid, file); + newXS(strcpy(buf, "getdeityname"), XS__getdeityname, file); newXS(strcpy(buf, "getguildnamebyid"), XS__getguildnamebyid, file); newXS(strcpy(buf, "getguildidbycharid"), XS__getguildidbycharid, file); newXS(strcpy(buf, "getgroupidbycharid"), XS__getgroupidbycharid, file); diff --git a/zone/lua_general.cpp b/zone/lua_general.cpp index 896bb4051..9bfd0b9fb 100644 --- a/zone/lua_general.cpp +++ b/zone/lua_general.cpp @@ -2460,6 +2460,10 @@ std::string lua_get_clean_npc_name_by_id(uint32 npc_id) { } +std::string lua_get_deity_name(uint32 deity_id) { + return quest_manager.getdeityname(deity_id); +} + std::string lua_get_inventory_slot_name(int16 slot_id) { return quest_manager.getinventoryslotname(slot_id); } @@ -3033,9 +3037,10 @@ luabind::scope lua_register_general() { luabind::def("cross_zone_add_ldon_loss_by_expedition_id", &lua_cross_zone_add_ldon_loss_by_expedition_id), luabind::def("cross_zone_add_ldon_points_by_expedition_id", &lua_cross_zone_add_ldon_points_by_expedition_id), luabind::def("cross_zone_add_ldon_win_by_expedition_id", &lua_cross_zone_add_ldon_win_by_expedition_id), + luabind::def("get_deity_name", &lua_get_deity_name), luabind::def("get_inventory_slot_name", &lua_get_inventory_slot_name), luabind::def("rename", &lua_rename), - + /** * Expansions */ diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index 83ed76ce7..b796834bc 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -4601,6 +4601,7 @@ std::string QuestManager::gethexcolorcode(std::string color_name) { double QuestManager::GetAAEXPModifierByCharID(uint32 character_id, uint32 zone_id) const { return database.GetAAEXPModifier(character_id, zone_id); } + double QuestManager::GetEXPModifierByCharID(uint32 character_id, uint32 zone_id) const { return database.GetEXPModifier(character_id, zone_id); } @@ -4625,6 +4626,11 @@ void QuestManager::CrossZoneLDoNUpdate(uint8 type, uint8 subtype, int identifier safe_delete(pack); } +std::string QuestManager::getdeityname(uint32 deity_id) { + return EQ::deity::DeityName(static_cast(deity_id)); +} + std::string QuestManager::getinventoryslotname(int16 slot_id) { return EQ::invslot::GetInvPossessionsSlotName(slot_id); -} \ No newline at end of file +} + diff --git a/zone/questmgr.h b/zone/questmgr.h index bf615835b..f58337cbf 100644 --- a/zone/questmgr.h +++ b/zone/questmgr.h @@ -381,6 +381,7 @@ public: double GetEXPModifierByCharID(uint32 character_id, uint32 zone_id) const; void SetAAEXPModifierByCharID(uint32 character_id, uint32 zone_id, double aa_modifier); void SetEXPModifierByCharID(uint32 character_id, uint32 zone_id, double exp_modifier); + std::string getdeityname(uint32 deity_id); std::string getinventoryslotname(int16 slot_id); Client *GetInitiator() const;