[Quest API] Add getgendername(gender_id) to Perl/Lua. (#1405)

- Add quest::getgendername(gender_id) to Perl.
- Add eq.get_gender_name(gender_id) to Lua.

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

View File

@ -6774,6 +6774,17 @@ XS(XS__getcleannpcnamebyid) {
XSRETURN(1);
}
XS(XS__getgendername);
XS(XS__getgendername) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: quest::getgendername(uint32 gender_id)");
dXSTARG;
uint32 gender_id = (uint32) SvUV(ST(0));
auto gender_name = quest_manager.getgendername(gender_id);
sv_setpv(TARG, gender_name.c_str());
}
XS(XS__getdeityname);
XS(XS__getdeityname) {
@ -7054,6 +7065,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, "getgendername"), XS__getgendername, file);
newXS(strcpy(buf, "getdeityname"), XS__getdeityname, file);
newXS(strcpy(buf, "getguildnamebyid"), XS__getguildnamebyid, file);
newXS(strcpy(buf, "getguildidbycharid"), XS__getguildidbycharid, file);

View File

@ -2459,6 +2459,9 @@ std::string lua_get_clean_npc_name_by_id(uint32 npc_id) {
return quest_manager.getcleannpcnamebyid(npc_id);
}
std::string lua_get_gender_name(uint32 gender_id) {
return quest_manager.getgendername(gender_id);
}
std::string lua_get_deity_name(uint32 deity_id) {
return quest_manager.getdeityname(deity_id);
@ -3037,6 +3040,7 @@ 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_gender_name", &lua_get_gender_name),
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),

View File

@ -4626,6 +4626,18 @@ void QuestManager::CrossZoneLDoNUpdate(uint8 type, uint8 subtype, int identifier
safe_delete(pack);
}
std::string QuestManager::getgendername(uint32 gender_id) {
auto gender_name = "Unknown";
if (gender_id == MALE) {
gender_name = "Male";
} else if (gender_id == FEMALE) {
gender_name = "Female";
} else if (gender_id == NEUTER) {
gender_name = "Neuter";
}
return gender_name;
}
std::string QuestManager::getdeityname(uint32 deity_id) {
return EQ::deity::DeityName(static_cast<EQ::deity::DeityType>(deity_id));
}
@ -4634,3 +4646,4 @@ 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 getgendername(uint32 gender_id);
std::string getdeityname(uint32 deity_id);
std::string getinventoryslotname(int16 slot_id);