Beispiel #1
0
        public static void DeletePlayerCharacter(uint oPC, bool bPreserveBackup = true, string sKickMessage = "")
        {
            var sFunc = "DeletePlayerCharacter";

            NWNXCore.NWNX_PushArgumentString(sKickMessage);
            NWNXCore.NWNX_PushArgumentInt(bPreserveBackup ? 1 : 0);
            NWNXCore.NWNX_PushArgumentObject(oPC);
            NWNXCore.NWNX_CallFunction(NWNX_Administration, sFunc);
        }
        // Convert unpacked itemproperty structure to native type.
        public static Lite.ItemProperty PackIP(ItemPropertyUnpacked itemProperty)
        {
            const string sFunc = "PackIP";

            NWNXCore.NWNX_PushArgumentString(itemProperty.Tag);
            NWNXCore.NWNX_PushArgumentObject(itemProperty.Creator);
            NWNXCore.NWNX_PushArgumentInt(itemProperty.SpellId);
            NWNXCore.NWNX_PushArgumentInt(itemProperty.IsUseable ? 1 : 0);
            NWNXCore.NWNX_PushArgumentInt(itemProperty.ChanceToAppear);
            NWNXCore.NWNX_PushArgumentInt(itemProperty.UsesPerDay);
            NWNXCore.NWNX_PushArgumentInt(itemProperty.Param1Value);
            NWNXCore.NWNX_PushArgumentInt(itemProperty.Param1);
            NWNXCore.NWNX_PushArgumentInt(itemProperty.CostTableValue);
            NWNXCore.NWNX_PushArgumentInt(itemProperty.CostTable);
            NWNXCore.NWNX_PushArgumentInt(itemProperty.SubType);
            NWNXCore.NWNX_PushArgumentInt(itemProperty.Property);

            NWNXCore.NWNX_CallFunction(PLUGIN_NAME, sFunc);
            return(NWNXCore.NWNX_GetReturnValueItemProperty());
        }
        /// @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(nIndex);
            NWNXCore.NWNX_PushArgumentObject(oItem);
            NWNXCore.NWNX_CallFunction(PLUGIN_NAME, sFunc);

            return(new ItemPropertyUnpacked
            {
                Property = NWNXCore.NWNX_GetReturnValueInt(),
                SubType = NWNXCore.NWNX_GetReturnValueInt(),
                CostTable = NWNXCore.NWNX_GetReturnValueInt(),
                CostTableValue = NWNXCore.NWNX_GetReturnValueInt(),
                Param1 = NWNXCore.NWNX_GetReturnValueInt(),
                Param1Value = NWNXCore.NWNX_GetReturnValueInt(),
                UsesPerDay = NWNXCore.NWNX_GetReturnValueInt(),
                ChanceToAppear = NWNXCore.NWNX_GetReturnValueInt(),
                IsUseable = Convert.ToBoolean(NWNXCore.NWNX_GetReturnValueInt()),
                Tag = NWNXCore.NWNX_GetReturnValueString()
            });
        }