From 69d02b7e7209e3b346e556c4d69112ba9dc69231 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Mon, 9 Mar 2015 06:40:13 -0400 Subject: [PATCH] perl $npc->GetCombatState --- zone/npc.cpp | 4 +--- zone/perl_npc.cpp | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/zone/npc.cpp b/zone/npc.cpp index a9a383d55..22fb5f188 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -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; diff --git a/zone/perl_npc.cpp b/zone/perl_npc.cpp index febee6941..0c9cec797 100644 --- a/zone/perl_npc.cpp +++ b/zone/perl_npc.cpp @@ -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; }