mirror of
https://github.com/EQEmu/Server.git
synced 2026-03-27 10:32:26 +00:00
Perl: NPC AddRangedProc(spellid, chance)
Perl: NPC AddDefensiveProc(spellid, chance)
This commit is contained in:
parent
ab5d0ad43f
commit
d69552d4df
@ -2301,7 +2301,57 @@ XS(XS_NPC_AddMeleeProc);
|
|||||||
XS(XS_NPC_AddMeleeProc) {
|
XS(XS_NPC_AddMeleeProc) {
|
||||||
dXSARGS;
|
dXSARGS;
|
||||||
if (items != 3)
|
if (items != 3)
|
||||||
Perl_croak(aTHX_ "Usage: NPC::AddMeleePro(THIS,spellid,chance)");
|
Perl_croak(aTHX_ "Usage: NPC::AddMeleeProc(THIS,spellid,chance)");
|
||||||
|
{
|
||||||
|
NPC * THIS;
|
||||||
|
int spell_id = (int)SvIV(ST(1));
|
||||||
|
int chance = (int)SvIV(ST(2));
|
||||||
|
dXSTARG;
|
||||||
|
|
||||||
|
if (sv_derived_from(ST(0), "NPC")) {
|
||||||
|
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
||||||
|
THIS = INT2PTR(NPC *,tmp);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Perl_croak(aTHX_ "THIS is not of type NPC");
|
||||||
|
if(THIS == NULL)
|
||||||
|
Perl_croak(aTHX_ "THIS is NULL, avoiding crash.");
|
||||||
|
|
||||||
|
THIS->AddProcToWeapon(spell_id, true, chance);
|
||||||
|
}
|
||||||
|
XSRETURN_EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
|
XS(XS_NPC_AddRangedProc);
|
||||||
|
XS(XS_NPC_AddRangedProc) {
|
||||||
|
dXSARGS;
|
||||||
|
if (items != 3)
|
||||||
|
Perl_croak(aTHX_ "Usage: NPC::AddRangedProc(THIS,spellid,chance)");
|
||||||
|
{
|
||||||
|
NPC * THIS;
|
||||||
|
int spell_id = (int)SvIV(ST(1));
|
||||||
|
int chance = (int)SvIV(ST(2));
|
||||||
|
dXSTARG;
|
||||||
|
|
||||||
|
if (sv_derived_from(ST(0), "NPC")) {
|
||||||
|
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
||||||
|
THIS = INT2PTR(NPC *,tmp);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Perl_croak(aTHX_ "THIS is not of type NPC");
|
||||||
|
if(THIS == NULL)
|
||||||
|
Perl_croak(aTHX_ "THIS is NULL, avoiding crash.");
|
||||||
|
|
||||||
|
THIS->AddDefensiveProc(spell_id,chance);
|
||||||
|
}
|
||||||
|
XSRETURN_EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
|
XS(XS_NPC_AddDefensiveProc);
|
||||||
|
XS(XS_NPC_AddDefensiveProc) {
|
||||||
|
dXSARGS;
|
||||||
|
if (items != 3)
|
||||||
|
Perl_croak(aTHX_ "Usage: NPC::AddDefensiveProc(THIS,spellid,chance)");
|
||||||
{
|
{
|
||||||
NPC * THIS;
|
NPC * THIS;
|
||||||
int spell_id = (int)SvIV(ST(1));
|
int spell_id = (int)SvIV(ST(1));
|
||||||
@ -2427,6 +2477,8 @@ XS(boot_NPC)
|
|||||||
newXSproto(strcpy(buf, "SetMerchantProbability"), XS_NPC_SetMerchantProbability, file, "$$");
|
newXSproto(strcpy(buf, "SetMerchantProbability"), XS_NPC_SetMerchantProbability, file, "$$");
|
||||||
newXSproto(strcpy(buf, "GetMerchantProbability"), XS_NPC_GetMerchantProbability, file, "$");
|
newXSproto(strcpy(buf, "GetMerchantProbability"), XS_NPC_GetMerchantProbability, file, "$");
|
||||||
newXSproto(strcpy(buf, "AddMeleeProc"), XS_NPC_AddMeleeProc, file, "$$$");
|
newXSproto(strcpy(buf, "AddMeleeProc"), XS_NPC_AddMeleeProc, file, "$$$");
|
||||||
|
newXSproto(strcpy(buf, "AddRangedProc"), XS_NPC_AddRangedProc, file, "$$$");
|
||||||
|
newXSproto(strcpy(buf, "AddDefensiveProc"), XS_NPC_AddDefensiveProc, file, "$$$");
|
||||||
XSRETURN_YES;
|
XSRETURN_YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user