Иконка ресурса

FREE BigWheelCustomLoot : 1.0.1 1.0.1

Нет прав для скачивания
C#:
using System;
using System.Linq;
using System.Collections.Generic;
using Oxide.Core.Plugins;
using UnityEngine;
using Newtonsoft.Json;

namespace Oxide.Plugins
{
    [Info("BigWheelCustomLoot", "Own3r update", "1.0.1")]
    class BigWheelCustomLoot : RustPlugin
    {

        #region Instruments
        private bool IsAllowedItem(Item item)
        {
            bool result = false;
            foreach(var allowed in configData.Items)
            {
                if(allowed.Contains(item.info.shortname))
                {
                    result = true;
                }
            }

            return result;
        }
        #endregion

        #region Hooks
        private object CanMoveItem(Item item, PlayerInventory inventory, uint targetContainer, int targetSlot)
        {
            BasePlayer player = inventory.GetComponent<BasePlayer>();
            if(player == null)
            {
                return null;
            }
            ItemContainer container = inventory?.FindContainer(targetContainer);
            if (container == null) return null;
            BigWheelBettingTerminal terminal = container?.entityOwner as BigWheelBettingTerminal;
            if (terminal == null) return null;
            if (!IsAllowedItem(item))
            {
                SendReply(player, $"Эта вещь '{item.info.displayName.translated}' не является ставкой для колеса");
                return null;
            }
            else
            {
                terminal.allowedItem = item.info;
                terminal.inventory.onlyAllowedItem = item.info;

                return null;
            }
        }
		#endregion
		
		#region Config        				
        private static ConfigData configData;
        private class ConfigData
        {            
			[JsonProperty("Игровое название предмета для ставок")]
			public List<string> Items { get; set; }

            public static ConfigData Prototype()
            {
                return new ConfigData()
                {
                    Items = new List<string>()
                    {
                        "sulfur",
                    },
                };
            }
        }

        protected override void LoadDefaultConfig()
        {
            configData = ConfigData.Prototype();
        }
        protected override void SaveConfig()
        {
            Config.WriteObject(configData);
        }
        protected override void LoadConfig()
        {
            base.LoadConfig();
            configData = Config.ReadObject<ConfigData>();
        }
        #endregion

    }	
	
}

Автор
15FPS
Скачиваний
0
Просмотры
1
Первый выпуск
Обновление
Оценка
0.00 звёзд 0 оценок
Сверху