Perl Mob function GetSpellStat(spellid, identifier, slot)

indentifier is the spell_new field
slot is used for effectids,base,base2, max ect where 1 = first slot.
Will add a wiki page
This commit is contained in:
KayenEQ
2014-09-27 16:12:10 -04:00
parent f232bf1ccd
commit 8567fd928a
3 changed files with 151 additions and 0 deletions
+34
View File
@@ -8137,6 +8137,39 @@ XS(XS_Mob_GetFlurryChance)
XSRETURN(1);
}
XS(XS_Mob_GetSpellStat); /* prototype to pass -Wmissing-prototypes */
XS(XS_Mob_GetSpellStat)
{
dXSARGS;
if (items < 3 || items > 4)
Perl_croak(aTHX_ "Usage: Mob::GetSpellStat(THIS, itemid, stat, slot)");
{
Mob * THIS;
int32 RETVAL;
uint32 spellid = (uint32)SvUV(ST(1));
Const_char * stat = (Const_char *)SvPV_nolen(ST(2));
uint8 slot = (uint8)SvUV(ST(3));
dXSTARG;
if (sv_derived_from(ST(0), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Mob *,tmp);
}
else
Perl_croak(aTHX_ "THIS is not of type Mob");
if(THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (items > 4) { slot = 0; }
RETVAL = THIS->GetSpellStat(spellid, stat, slot);
XSprePUSH; PUSHi((IV)RETVAL);
}
XSRETURN(1);
}
#ifdef __cplusplus
extern "C"
#endif
@@ -8436,6 +8469,7 @@ XS(boot_Mob)
newXSproto(strcpy(buf, "IsMeleeDisabled"), XS_Mob_IsMeleeDisabled, file, "$$");
newXSproto(strcpy(buf, "SetFlurryChance"), XS_Mob_SetFlurryChance, file, "$$");
newXSproto(strcpy(buf, "GetFlurryChance"), XS_Mob_GetFlurryChance, file, "$");
newXSproto(strcpy(buf, "GetSpellStat"), XS_Mob_GetSpellStat, file, "$$$$");
XSRETURN_YES;
}