perl $npc->GetCombatState

This commit is contained in:
KayenEQ 2015-03-09 06:40:13 -04:00
parent c96ee79b1e
commit 69d02b7e72
2 changed files with 28 additions and 3 deletions

View File

@ -1839,7 +1839,7 @@ void NPC::PetOnSpawn(NewSpawn_Struct* ns)
if(swarmOwner->IsClient())
{
SetPetOwnerClient(true); //Simple flag to determine if pet belongs to a client
SetAllowBeneficial(1);//Allow temp pets to receive buffs and heals if owner is client.
SetAllowBeneficial(true);//Allow temp pets to receive buffs and heals if owner is client.
//This will allow CLIENT swarm pets NOT to be targeted with F8.
ns->spawn.targetable_with_hotkey = 0;
no_target_hotkey = 1;
@ -2258,8 +2258,6 @@ bool NPC::CanTalk()
0,0,420,0,0,0,0,425,0,0,0,0,0,0,0,433,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,458,0,0,0,0,0,0,0,0,467,0,0,470,0,0,473};
int talk_check = TalkRace[GetRace() - 1];
if (TalkRace[GetRace() - 1] > 0)
return true;

View File

@ -2530,6 +2530,32 @@ XS(XS_NPC_ClearLastName)
XSRETURN_EMPTY;
}
XS(XS_NPC_GetCombatState); /* prototype to pass -Wmissing-prototypes */
XS(XS_NPC_GetCombatState)
{
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: NPC::GetCombatState(THIS)");
{
NPC * THIS;
bool RETVAL;
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 == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetCombatEvent();
ST(0) = boolSV(RETVAL);
sv_2mortal(ST(0));
}
XSRETURN(1);
}
#ifdef __cplusplus
extern "C"
#endif
@ -2643,6 +2669,7 @@ XS(boot_NPC)
newXSproto(strcpy(buf, "RemoveDefensiveProc"), XS_NPC_RemoveDefensiveProc, file, "$$");
newXSproto(strcpy(buf, "ChangeLastName"), XS_NPC_ChangeLastName, file, "$:$");
newXSproto(strcpy(buf, "ClearLastName"), XS_NPC_ClearLastName, file, "$");
newXSproto(strcpy(buf, "GetCombatState"), XS_NPC_GetCombatState, file, "$");
XSRETURN_YES;
}