Added new Perl/LUA GetSpellIDByBookSlot (#1151)

Added a new questAPI GetSpellIDByBookSlot to allow for sorting spellbooks by various attributes (level, type, etc).  Allows to determine which spell is in what book slot.
This commit is contained in:
neckkola
2020-12-21 19:06:48 -04:00
committed by GitHub
parent c6d4d8f291
commit a1cc68d214
5 changed files with 43 additions and 0 deletions
+28
View File
@@ -5297,6 +5297,33 @@ XS(XS_Client_GetSpellBookSlotBySpellID) {
XSRETURN(1);
}
XS(XS_Client_GetSpellIDByBookSlot); /* prototype to pass -Wmissing-prototypes */
XS(XS_Client_GetSpellIDByBookSlot) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Client::GetSpellIDByBookSlot(THIS, int slot_id)");
{
Client* THIS;
int RETVAL;
int slot_id = SvUV(ST(1));
dXSTARG;
if (sv_derived_from(ST(0), "Client")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Client*, tmp);
}
else
Perl_croak(aTHX_ "THIS is not of type Client");
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetSpellIDByBookSlot(slot_id);
XSprePUSH;
PUSHi((IV)RETVAL);
}
XSRETURN(1);
}
XS(XS_Client_UpdateTaskActivity); /* prototype to pass -Wmissing-prototypes */
XS(XS_Client_UpdateTaskActivity) {
dXSARGS;
@@ -6821,6 +6848,7 @@ XS(boot_Client) {
newXSproto(strcpy(buf, "GetRawSkill"), XS_Client_GetRawSkill, file, "$$");
newXSproto(strcpy(buf, "GetSkillPoints"), XS_Client_GetSkillPoints, file, "$");
newXSproto(strcpy(buf, "GetSpellBookSlotBySpellID"), XS_Client_GetSpellBookSlotBySpellID, file, "$$");
newXSproto(strcpy(buf, "GetSpellIDByBookSlot"), XS_Client_GetSpellIDByBookSlot, file, "$$");
newXSproto(strcpy(buf, "GetSpentAA"), XS_Client_GetSpentAA, file, "$$");
newXSproto(strcpy(buf, "GetStartZone"), XS_Client_GetStartZone, file, "$");
newXSproto(strcpy(buf, "GetTargetRingX"), XS_Client_GetTargetRingX, file, "$$");