[Quest API] Add getinventoryslotname(slot_id) to Perl/Lua. (#1406)

- Add quest::getinventoryslotname(slot_id) to Perl.
- Add eq.get_inventory_slot_name(slot_id) to Lua.

Co-authored-by: Chris Miles <akkadius1@gmail.com>
This commit is contained in:
Alex 2021-06-16 11:42:06 -04:00 committed by GitHub
parent f1d1731fc7
commit ed6e53be54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 0 deletions

View File

@ -6774,6 +6774,21 @@ XS(XS__getcleannpcnamebyid) {
XSRETURN(1);
}
XS(XS__getinventoryslotname);
XS(XS__getinventoryslotname) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: quest::getinventoryslotname(int16 slot_id)");
dXSTARG;
int16 slot_id = (int16) SvIV(ST(0));
auto slot_name = quest_manager.getinventoryslotname(slot_id);
sv_setpv(TARG, slot_name.c_str());
XSprePUSH;
PUSHTARG;
XSRETURN(1);
}
XS(XS__rename);
XS(XS__rename) {
dXSARGS;
@ -7029,6 +7044,7 @@ EXTERN_C XS(boot_quest) {
newXS(strcpy(buf, "getguildnamebyid"), XS__getguildnamebyid, file);
newXS(strcpy(buf, "getguildidbycharid"), XS__getguildidbycharid, file);
newXS(strcpy(buf, "getgroupidbycharid"), XS__getgroupidbycharid, file);
newXS(strcpy(buf, "getinventoryslotname"), XS__getinventoryslotname, file);
newXS(strcpy(buf, "getraididbycharid"), XS__getraididbycharid, file);
newXS(strcpy(buf, "getracename"), XS__getracename, file);
newXS(strcpy(buf, "getspellname"), XS__getspellname, file);

View File

@ -2459,6 +2459,11 @@ std::string lua_get_clean_npc_name_by_id(uint32 npc_id) {
return quest_manager.getcleannpcnamebyid(npc_id);
}
std::string lua_get_inventory_slot_name(int16 slot_id) {
return quest_manager.getinventoryslotname(slot_id);
}
void lua_rename(std::string name) {
quest_manager.rename(name);
}
@ -3028,7 +3033,9 @@ 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_inventory_slot_name", &lua_get_inventory_slot_name),
luabind::def("rename", &lua_rename),
/**
* Expansions
*/

View File

@ -4624,3 +4624,7 @@ void QuestManager::CrossZoneLDoNUpdate(uint8 type, uint8 subtype, int identifier
worldserver.SendPacket(pack);
safe_delete(pack);
}
std::string QuestManager::getinventoryslotname(int16 slot_id) {
return EQ::invslot::GetInvPossessionsSlotName(slot_id);
}

View File

@ -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 getinventoryslotname(int16 slot_id);
Client *GetInitiator() const;
NPC *GetNPC() const;