/// <summary> /// Set object's maximum hit points; will not work on PCs. /// </summary> /// <param name="creature"></param> /// <param name="hp"></param> public static void SetMaxHitPoints(NWGameObject creature, int hp) { string sFunc = "SetMaxHitPoints"; NWNXCore.NWNX_PushArgumentInt(NWNX_Object, sFunc, hp); NWNXCore.NWNX_PushArgumentObject(NWNX_Object, sFunc, creature); NWNXCore.NWNX_CallFunction(NWNX_Object, sFunc); }
/// <summary> /// Set obj's appearance. Will not update for PCs until they /// re-enter the area. /// </summary> /// <param name="obj"></param> /// <param name="app"></param> public static void SetAppearance(NWGameObject obj, int app) { string sFunc = "SetAppearance"; NWNXCore.NWNX_PushArgumentInt(NWNX_Object, sFunc, app); NWNXCore.NWNX_PushArgumentObject(NWNX_Object, sFunc, obj); NWNXCore.NWNX_CallFunction(NWNX_Object, sFunc); }
/// <summary> /// Return damage immunity (in percent) against given damage type /// Use DAMAGE_TYPE_* constants for damageType /// </summary> /// <param name="obj"></param> /// <param name="damageType"></param> /// <returns></returns> public static int GetDamageImmunity(NWGameObject obj, int damageType) { string sFunc = "GetDamageImmunity"; NWNXCore.NWNX_PushArgumentInt(NWNX_Object, sFunc, damageType); NWNXCore.NWNX_PushArgumentObject(NWNX_Object, sFunc, obj); NWNXCore.NWNX_CallFunction(NWNX_Object, sFunc); return(NWNXCore.NWNX_GetReturnValueInt(NWNX_Object, sFunc)); }
/// <summary> /// Return true if an item of baseitem type can fit in object's inventory /// </summary> /// <param name="obj"></param> /// <param name="baseitem"></param> /// <returns></returns> public static bool CheckFit(NWGameObject item, int baseitem) { string sFunc = "CheckFit"; NWNXCore.NWNX_PushArgumentInt(NWNX_Object, sFunc, baseitem); NWNXCore.NWNX_PushArgumentObject(NWNX_Object, sFunc, item); NWNXCore.NWNX_CallFunction(NWNX_Object, sFunc); return(NWNXCore.NWNX_GetReturnValueInt(NWNX_Object, sFunc) == 1); }
/// <summary> /// Return true if obj has visual effect nVFX applied to it /// </summary> /// <param name="obj"></param> /// <param name="nVFX"></param> /// <returns></returns> public static bool GetHasVisualEffect(NWGameObject obj, int nVFX) { string sFunc = "GetHasVisualEffect"; NWNXCore.NWNX_PushArgumentInt(NWNX_Object, sFunc, nVFX); NWNXCore.NWNX_PushArgumentObject(NWNX_Object, sFunc, obj); NWNXCore.NWNX_CallFunction(NWNX_Object, sFunc); return(NWNXCore.NWNX_GetReturnValueInt(NWNX_Object, sFunc) == 1); }
/// <summary> /// Returns a local variable at the specified index. /// </summary> /// <param name="obj"></param> /// <param name="index"></param> /// <returns></returns> public static LocalVariable GetLocalVariable(NWGameObject obj, int index) { string sFunc = "GetLocalVariable"; NWNXCore.NWNX_PushArgumentInt(NWNX_Object, sFunc, index); NWNXCore.NWNX_PushArgumentObject(NWNX_Object, sFunc, obj); NWNXCore.NWNX_CallFunction(NWNX_Object, sFunc); LocalVariable var = new LocalVariable(); var.Key = NWNXCore.NWNX_GetReturnValueString(NWNX_Object, sFunc); var.Type = (LocalVariableType)NWNXCore.NWNX_GetReturnValueInt(NWNX_Object, sFunc); return(var); }
// Convert unpacked itemproperty structure to native type. public static Core.ItemProperty PackIP(ItemPropertyUnpacked itemProperty) { const string sFunc = "PackIP"; NWNXCore.NWNX_PushArgumentString(PLUGIN_NAME, sFunc, itemProperty.Tag); NWNXCore.NWNX_PushArgumentObject(PLUGIN_NAME, sFunc, itemProperty.Creator); NWNXCore.NWNX_PushArgumentInt(PLUGIN_NAME, sFunc, itemProperty.SpellID); NWNXCore.NWNX_PushArgumentInt(PLUGIN_NAME, sFunc, itemProperty.IsUseable ? 1 : 0); NWNXCore.NWNX_PushArgumentInt(PLUGIN_NAME, sFunc, itemProperty.ChanceToAppear); NWNXCore.NWNX_PushArgumentInt(PLUGIN_NAME, sFunc, itemProperty.UsesPerDay); NWNXCore.NWNX_PushArgumentInt(PLUGIN_NAME, sFunc, itemProperty.Param1Value); NWNXCore.NWNX_PushArgumentInt(PLUGIN_NAME, sFunc, itemProperty.Param1); NWNXCore.NWNX_PushArgumentInt(PLUGIN_NAME, sFunc, itemProperty.CostTableValue); NWNXCore.NWNX_PushArgumentInt(PLUGIN_NAME, sFunc, itemProperty.CostTable); NWNXCore.NWNX_PushArgumentInt(PLUGIN_NAME, sFunc, itemProperty.SubType); NWNXCore.NWNX_PushArgumentInt(PLUGIN_NAME, sFunc, itemProperty.Property); NWNXCore.NWNX_CallFunction(PLUGIN_NAME, sFunc); return(NWNXCore.NWNX_GetReturnValueItemProperty(PLUGIN_NAME, sFunc)); }
/// @brief Gets the active item property at the index /// @param oItem - the item with the property /// @param nIndex - the index such as returned by some Item Events /// @return A constructed NWNX_IPUnpacked, except for creator, and spell id. public static ItemPropertyUnpacked GetActiveProperty(uint oItem, int nIndex) { const string sFunc = "GetActiveProperty"; NWNXCore.NWNX_PushArgumentInt(PLUGIN_NAME, sFunc, nIndex); NWNXCore.NWNX_PushArgumentObject(PLUGIN_NAME, sFunc, oItem); NWNXCore.NWNX_CallFunction(PLUGIN_NAME, sFunc); return(new ItemPropertyUnpacked { Property = NWNXCore.NWNX_GetReturnValueInt(PLUGIN_NAME, sFunc), SubType = NWNXCore.NWNX_GetReturnValueInt(PLUGIN_NAME, sFunc), CostTable = NWNXCore.NWNX_GetReturnValueInt(PLUGIN_NAME, sFunc), CostTableValue = NWNXCore.NWNX_GetReturnValueInt(PLUGIN_NAME, sFunc), Param1 = NWNXCore.NWNX_GetReturnValueInt(PLUGIN_NAME, sFunc), Param1Value = NWNXCore.NWNX_GetReturnValueInt(PLUGIN_NAME, sFunc), UsesPerDay = NWNXCore.NWNX_GetReturnValueInt(PLUGIN_NAME, sFunc), ChanceToAppear = NWNXCore.NWNX_GetReturnValueInt(PLUGIN_NAME, sFunc), IsUseable = Convert.ToBoolean(NWNXCore.NWNX_GetReturnValueInt(PLUGIN_NAME, sFunc)), Tag = NWNXCore.NWNX_GetReturnValueString(PLUGIN_NAME, sFunc) }); }