// Set Damage Event Data (to use only on Damage Event Script) public static void SetDamageEventData(DamageEventData data) { Internal.NativeFunctions.nwnxSetFunction(PLUGIN_NAME, "SetDamageEventData"); Internal.NativeFunctions.nwnxPushInt(data.Base); Internal.NativeFunctions.nwnxPushInt(data.Sonic); Internal.NativeFunctions.nwnxPushInt(data.Positive); Internal.NativeFunctions.nwnxPushInt(data.Negative); Internal.NativeFunctions.nwnxPushInt(data.Fire); Internal.NativeFunctions.nwnxPushInt(data.Electrical); Internal.NativeFunctions.nwnxPushInt(data.Divine); Internal.NativeFunctions.nwnxPushInt(data.Cold); Internal.NativeFunctions.nwnxPushInt(data.Acid); Internal.NativeFunctions.nwnxPushInt(data.Magical); Internal.NativeFunctions.nwnxPushInt(data.Slash); Internal.NativeFunctions.nwnxPushInt(data.Pierce); Internal.NativeFunctions.nwnxPushInt(data.Bludgeoning); Internal.NativeFunctions.nwnxCallFunction(); }
/// <summary> /// Set Damage Event Data (to use only on Damage Event Script) /// </summary> /// <param name="data"></param> public static void SetDamageEventData(DamageEventData data) { string sFunc = "SetDamageEventData"; NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.Base); NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.Sonic); NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.Positive); NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.Negative); NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.Fire); NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.Electrical); NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.Divine); NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.Cold); NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.Acid); NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.Magical); NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.Slash); NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.Pierce); NWNX_PushArgumentInt(NWNX_Damage, sFunc, data.Bludgeoning); NWNX_CallFunction(NWNX_Damage, sFunc); }
// Get Damage Event Data (to use only on Damage Event Script) public static DamageEventData GetDamageEventData() { var data = new DamageEventData(); Internal.NativeFunctions.nwnxSetFunction(PLUGIN_NAME, "GetDamageEventData"); Internal.NativeFunctions.nwnxCallFunction(); data.Damager = Internal.NativeFunctions.nwnxPopObject(); data.Bludgeoning = Internal.NativeFunctions.nwnxPopInt(); data.Pierce = Internal.NativeFunctions.nwnxPopInt(); data.Slash = Internal.NativeFunctions.nwnxPopInt(); data.Magical = Internal.NativeFunctions.nwnxPopInt(); data.Acid = Internal.NativeFunctions.nwnxPopInt(); data.Cold = Internal.NativeFunctions.nwnxPopInt(); data.Divine = Internal.NativeFunctions.nwnxPopInt(); data.Electrical = Internal.NativeFunctions.nwnxPopInt(); data.Fire = Internal.NativeFunctions.nwnxPopInt(); data.Negative = Internal.NativeFunctions.nwnxPopInt(); data.Positive = Internal.NativeFunctions.nwnxPopInt(); data.Sonic = Internal.NativeFunctions.nwnxPopInt(); data.Base = Internal.NativeFunctions.nwnxPopInt(); return(data); }
// Deal damage to target - permits multiple damage types and checks enhancement bonus for overcoming DR public static void DealDamage(DamageEventData data, uint oTarget, uint oSource, bool iRanged = false) { Internal.NativeFunctions.nwnxSetFunction(PLUGIN_NAME, "SetAttackEventData"); Internal.NativeFunctions.nwnxSetFunction(PLUGIN_NAME, "DealDamage"); Internal.NativeFunctions.nwnxPushInt(iRanged ? 1 : 0); Internal.NativeFunctions.nwnxPushInt(data.Base); Internal.NativeFunctions.nwnxPushInt(data.Sonic); Internal.NativeFunctions.nwnxPushInt(data.Positive); Internal.NativeFunctions.nwnxPushInt(data.Negative); Internal.NativeFunctions.nwnxPushInt(data.Fire); Internal.NativeFunctions.nwnxPushInt(data.Electrical); Internal.NativeFunctions.nwnxPushInt(data.Divine); Internal.NativeFunctions.nwnxPushInt(data.Cold); Internal.NativeFunctions.nwnxPushInt(data.Acid); Internal.NativeFunctions.nwnxPushInt(data.Magical); Internal.NativeFunctions.nwnxPushInt(data.Slash); Internal.NativeFunctions.nwnxPushInt(data.Pierce); Internal.NativeFunctions.nwnxPushInt(data.Bludgeoning); Internal.NativeFunctions.nwnxPushObject(oTarget); Internal.NativeFunctions.nwnxPushObject(oSource); Internal.NativeFunctions.nwnxCallFunction(); }
/// <summary> /// Get Damage Event Data (to use only on Damage Event Script) /// </summary> /// <returns></returns> public static DamageEventData GetDamageEventData() { string sFunc = "GetDamageEventData"; DamageEventData data = new DamageEventData(); NWNX_CallFunction(NWNX_Damage, sFunc); data.Damager = NWNX_GetReturnValueObject(NWNX_Damage, sFunc); data.Bludgeoning = NWNX_GetReturnValueInt(NWNX_Damage, sFunc); data.Pierce = NWNX_GetReturnValueInt(NWNX_Damage, sFunc); data.Slash = NWNX_GetReturnValueInt(NWNX_Damage, sFunc); data.Magical = NWNX_GetReturnValueInt(NWNX_Damage, sFunc); data.Acid = NWNX_GetReturnValueInt(NWNX_Damage, sFunc); data.Cold = NWNX_GetReturnValueInt(NWNX_Damage, sFunc); data.Divine = NWNX_GetReturnValueInt(NWNX_Damage, sFunc); data.Electrical = NWNX_GetReturnValueInt(NWNX_Damage, sFunc); data.Fire = NWNX_GetReturnValueInt(NWNX_Damage, sFunc); data.Negative = NWNX_GetReturnValueInt(NWNX_Damage, sFunc); data.Positive = NWNX_GetReturnValueInt(NWNX_Damage, sFunc); data.Sonic = NWNX_GetReturnValueInt(NWNX_Damage, sFunc); data.Base = NWNX_GetReturnValueInt(NWNX_Damage, sFunc); return(data); }