Exemple #1
0
 // Deletes the player character from the servervault
 // The PC will be immediately booted from the game with a "Delete Character" message
 public static void DeletePlayerCharacter(uint pc, bool bPreserveBackup = true, string kickMessage = "")
 {
     // NativeFunction calls don't work for this method and cause a crash. Use the core methods instead.
     NWNXCore.NWNX_PushArgumentString(PLUGIN_NAME, "DeletePlayerCharacter", kickMessage);
     NWNXCore.NWNX_PushArgumentInt(PLUGIN_NAME, "DeletePlayerCharacter", bPreserveBackup ? 1 : 0);
     NWNXCore.NWNX_PushArgumentObject(PLUGIN_NAME, "DeletePlayerCharacter", pc);
     NWNXCore.NWNX_CallFunction(PLUGIN_NAME, "DeletePlayerCharacter");
 }
        // Convert unpacked itemproperty structure to native type.
        public static 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));
        }
Exemple #3
0
        /// @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)
            });
        }
        // Convert native itemproperty type to unpacked structure
        public static ItemPropertyUnpacked UnpackIP(ItemProperty ip)
        {
            const string func = "UnpackIP";

            NWNXCore.NWNX_PushArgumentItemProperty(PLUGIN_NAME, func, ip);
            NWNXCore.NWNX_CallFunction(PLUGIN_NAME, func);

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