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

FREE ShopSystem : 1.0.0 1.0.0

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

namespace Oxide.Plugins
{
    [Info("ShopSystem", "XAVIER", "1.0.0")]
    public class ShopSystem : RustPlugin
    {
        
        #region ChatCommand && UI

        
        [ConsoleCommand("open.shoptab")]
        void OpenInfo(ConsoleSystem.Arg args)
        {
            BasePlayer player = args.Player();
            CuiHelper.DestroyUi(player, "StaticMenu");
            CuiElementContainer container = new CuiElementContainer();
            container.Add(new CuiElement 
            {
                Parent = "UI_MenuLayer",
                Name = "StaticMenu",
                Components =
                {
                    new CuiImageComponent { Color = "0 0 0 0"},
                    new CuiRectTransformComponent {AnchorMin = "0.125 0.08333331", AnchorMax = "0.8755208 0.8324074"}
                }
            });
            
            container.Add(new CuiButton
            {
                RectTransform = { AnchorMin = "0 0.8850433", AnchorMax = "1 0.8862795", OffsetMax = "0 0" },
                Button = { Color = HexToCuiColor("#FBFBFF", 20)},
                Text = { Text = "",Font = "robotocondensed-regular.ttf", FontSize = 23, Color = HexToCuiColor("#BFBFBF"), Align = TextAnchor.MiddleCenter }
            }, "StaticMenu");
            
            

            CuiHelper.AddUi(player, container);
            
            

            OpenMenuInfo(player, "");
        }


        void OpenMenuInfo(BasePlayer player, string button)
        {
            CuiElementContainer container = new CuiElementContainer();

            for (int i = 0; i < config.LCategory.Count; i++)
            {
                CuiHelper.DestroyUi(player, "StaticMenu" + $".{i}.ListButton");
            }

            foreach (var check in config.LCategory.Select((i, t) => new { A = i, B = t }))
            {
                container.Add(new CuiButton
                {
                    RectTransform =
                    {
                        AnchorMin =
                            $"{0.04510755 + check.B * 0.0800 - Math.Floor((double) check.B / 15) * 15 * 0.0800} {0.8850433 - Math.Floor((double) check.B / 15) * 0.305}",
                        AnchorMax =
                            $"{0.1235253 + check.B * 0.0800 - Math.Floor((double) check.B / 15) * 15 * 0.0800} {0.998764 - Math.Floor((double) check.B / 15) * 0.305}",
                        OffsetMax = "0 0"
                    },
                    Button =
                    {
                        Color = "0 0 0 0",
                        Command = button == check.A.NameCategory ? "" : $"shop.tab select {check.A.NameCategory}"
                    },
                    Text =
                    {
                        Color = button == check.A.NameCategory ? HexToCuiColor("#FBFBFF") : HexToCuiColor($"#FBFBFF", 50),
                        Text = check.A.NameCategory, Align = TextAnchor.MiddleCenter, Font = "robotocondensed-regular.ttf", FontSize = 12
                    }
                }, "StaticMenu", "StaticMenu" + $".{check.B}.ListButton");
                
                container.Add(new CuiButton
                {
                    RectTransform =
                    {
                        AnchorMin = "0 0", AnchorMax = "1 0.01086855"
                    },
                    Button =
                    { 
                        Color = button == check.A.NameCategory ? HexToCuiColor("#FBFBFF") : HexToCuiColor($"#BFBFBF", 0),
                    },
                    Text =
                    {
                        Text = $"", Align = TextAnchor.LowerRight, Font = "robotocondensed-bold.ttf", FontSize = 15
                    }
                }, "StaticMenu" + $".{check.B}.ListButton");
            }

            CuiHelper.AddUi(player, container);
        }
        
        
        [ConsoleCommand("shop.tab")]
        void ConsoleInfo(ConsoleSystem.Arg args)
        {
            BasePlayer player = args.Player();
            if (args.Args[0] == "select")
            {
                var name = string.Join(" ", args.Args.Skip(1).ToArray());
                var select = config.LCategory.FirstOrDefault(p => p.NameCategory == name);
                OpenMenuInfo(player, name);

                OpenSelectCategory(player, select, 1);
            }
            else if (args.Args[0] == "page")
            {
                int page = 1;
                if (int.TryParse(args.Args[1], out page))
                {
                    var find = config.LCategory.FirstOrDefault(p =>
                        p.NameCategory == string.Join(" ", args.Args.Skip(2).ToArray()));
                    if (find != null && page > 0 && (page - 1) * 12 <= find.ItemSell.Count)
                    {
                        OpenSelectCategory(player, find, page);
                    }
                }
            }
            else if (args.Args[0] == "buy")
            {
                var find = config.LCategory.FirstOrDefault(p => p.NameCategory == args.Args[1]);
                if (find == null) return;
                var findshortname = find.ItemSell.FirstOrDefault(p =>
                    p.ShortNameElseCommandItem == string.Join(" ", args.Args.Skip(2).ToArray()));
                if (findshortname == null) return;
                int price = findshortname.Priceitem;

                if (_playerData[player.userID] < price)
                {
                    player.ChatMessage($"У вас недостаточно денег для покупки данного предмета!");
                    return;
                }

                _playerData[player.userID] -= price;
                if (ItemManager.FindItemDefinition(findshortname.ShortNameElseCommandItem) == null)
                {
                    GiveCommands(player, findshortname.ShortNameElseCommandItem);
                }
                else if (ItemManager.FindItemDefinition(findshortname.ShortNameElseCommandItem) != null)
                {
                    var item = ItemManager.CreateByName(findshortname.ShortNameElseCommandItem,
                        findshortname.AmountItem, findshortname.skinIDItem);
                    if (item == null) return;
                    player.GiveItem(item, BaseEntity.GiveItemReason.PickedUp);
                }

                Effect.server.Run("assets/prefabs/deployable/vendingmachine/effects/vending-machine-purchase-human.prefab", player.transform.position);
            }
        }


        void OpenSelectCategory(BasePlayer player, CategorySettings settings, int page)
        {
            CuiElementContainer container = new CuiElementContainer();
            
            CuiHelper.DestroyUi(player, "StaticMenu" + ".back");
            CuiHelper.DestroyUi(player, "StaticMenu" + ".next");
            
            
            for (int i = 0; i < 12; i++)
            {
                CuiHelper.DestroyUi(player, "StaticMenu" + $".{i}.ListItem");
            }
            
            int pagex = page + 1;
            
            

            container.Add(new CuiElement
            {
                Parent = "StaticMenu",
                Name = "StaticMenu" + ".next",
                Components =
                {
                    new CuiRawImageComponent
                    {
                        Png = (string)ImageLibrary?.Call("GetImage", "https://i.imgur.com/P5rDCQP.png"), Color = pagex > 0 && (pagex - 1) * 12 < settings.ItemSell.Count ? HexToCuiColor("") : HexToCuiColor("#FFFFFF", 10)
                    },
                    new CuiRectTransformComponent
                        { AnchorMin = "0.9104796 0.05933254", AnchorMax = "0.9437898 0.118665" },
                }
            });
            container.Add(new CuiButton
            {
                RectTransform = { AnchorMin = "0 0", AnchorMax = "1 1" },
                Button =
                {
                    Color = "0 0 0 0",
                    Command = pagex > 0 && (pagex - 1) * 12 < settings.ItemSell.Count
                        ? $"shop.tab page {page + 1} {settings.NameCategory}"
                        : ""
                },
                Text =
                {
                    Text = "", Font = "robotocondensed-regular.ttf",
                    FontSize = 20, Align = TextAnchor.MiddleCenter
                }
            }, "StaticMenu" + ".next");
            container.Add(new CuiElement
            {
                Parent = "StaticMenu",
                Name = "StaticMenu" + ".back",
                Components =
                {
                    new CuiRawImageComponent
                    {
                        Png = (string)ImageLibrary?.Call("GetImage", "https://i.imgur.com/b4TUg0Z.png"), Color = page != 1 ? HexToCuiColor("") : HexToCuiColor("#FFFFFF", 10)
                    },
                    new CuiRectTransformComponent
                        { AnchorMin = "0.8716169 0.05933254", AnchorMax = "0.9049271 0.118665" },
                }
            });
            container.Add(new CuiButton
            {
                RectTransform = { AnchorMin = "0 0", AnchorMax = "1 1" },
                Button =
                {
                    Color = "0 0 0 0",
                    Command = page != 1
                        ? $"shop.tab page {page - 1} {settings.NameCategory}"
                        : ""
                },
                Text =
                {
                    Text = "", Font = "robotocondensed-regular.ttf",
                    FontSize = 20, Align = TextAnchor.MiddleCenter
                }
            }, "StaticMenu" + ".back");
            
            foreach (var check in settings.ItemSell.Select((i, t) => new { A = i, B = t - (page - 1) * 12 }).Skip((page - 1) * 12).Take(12))
            {
                container.Add(new CuiButton
                {
                    RectTransform =
                    {
                        AnchorMin =
                            $"{0.05551699 + check.B * 0.150 - Math.Floor((double)check.B / 6) * 6 * 0.150} {0.5179234 - Math.Floor((double)check.B / 6) * 0.350}",
                        AnchorMax =
                            $"{0.1943095 + check.B * 0.150 - Math.Floor((double)check.B / 6) * 6 * 0.150} {0.8257107 - Math.Floor((double)check.B / 6) * 0.350}",
                        OffsetMax = "0 0"
                    },
                    Button =
                    {
                        Color = "0 0 0 0",
                        Command = $"",
                    },
                    Text =
                    {
                        Text = "", Align = TextAnchor.UpperLeft, Font = "robotocondensed-regular.ttf",
                        FontSize = 14, Color = HexToCuiColor($"#FBFBFF", 40),
                    }
                }, "StaticMenu", "StaticMenu" + $".{check.B}.ListItem");
                
                container.Add(new CuiElement
                {
                    Parent = "StaticMenu" + $".{check.B}.ListItem",
                    Components =
                    {
                        new CuiRawImageComponent
                        {
                            Png = (string)ImageLibrary?.Call("GetImage", "https://i.imgur.com/TTKdOtq.png")
                        },
                        new CuiRectTransformComponent
                            { AnchorMin = "0 0", AnchorMax = "1 1" },
                    }
                });
                
                if (string.IsNullOrEmpty(check.A.ImageItem) &&
                    ItemManager.FindItemDefinition(check.A.ShortNameElseCommandItem) != null)
                {
                    container.Add(new CuiElement
                    {
                        FadeOut = 0.3f,
                        Parent = "StaticMenu" + $".{check.B}.ListItem",
                        Components =
                        {
                            new CuiRawImageComponent
                            {
                                FadeIn = 0.3f,
                                Png = (string) ImageLibrary?.Call("GetImage", check.A.ShortNameElseCommandItem)
                            },
                            new CuiRectTransformComponent
                                {AnchorMin = "0.2600001 0.5622489", AnchorMax = "0.7400002 0.9477913"}
                        }
                    });
                }
                else
                {
                    container.Add(new CuiElement
                    {
                        FadeOut = 0.3f,
                        Parent = "StaticMenu" + $".{check.B}.ListItem",
                        Components =
                        {
                            new CuiRawImageComponent
                                {FadeIn = 0.3f, Png = (string) ImageLibrary?.Call("GetImage", check.A.ImageItem)},
                            new CuiRectTransformComponent
                                {AnchorMin = "0.2600001 0.5622489", AnchorMax = "0.7400002 0.9477913"}
                        }
                    });
                }
                
                container.Add(new CuiButton
                {
                    RectTransform = {AnchorMin = "0 0.3654619", AnchorMax = "1 0.4939758"},
                    Button = {Color = "0 0 0 0", FadeIn = 0.1f},
                    Text =
                    {
                        Text =
                            $"{check.A.NameItem} ( {check.A.AmountItem}X )",
                        FontSize = 10, Align = TextAnchor.MiddleCenter, Font = "robotocondensed-regular.ttf"
                    }
                }, "StaticMenu" + $".{check.B}.ListItem");
                
                container.Add(new CuiElement
                {
                    FadeOut = 0.3f,
                    Parent = "StaticMenu" + $".{check.B}.ListItem",
                    Components =
                    {
                        new CuiRawImageComponent
                            {FadeIn = 0.3f, Png = (string) ImageLibrary?.Call("GetImage", "https://i.imgur.com/XKkbCY1.png")},
                        new CuiRectTransformComponent
                            {AnchorMin = "0.3250001 0.257028", AnchorMax = "0.4450001 0.3534136"}
                    }
                });
                
                container.Add(new CuiButton
                {
                    RectTransform = {AnchorMin = "0.4850001 0.257028", AnchorMax = "0.9500002 0.3534136"},
                    Button = {Color = "0 0 0 0", FadeIn = 0.1f},
                    Text =
                    {
                        Text =
                            $"{check.A.Priceitem}",
                        FontSize = 10, Align = TextAnchor.MiddleLeft, Font = "robotocondensed-regular.ttf"
                    }
                }, "StaticMenu" + $".{check.B}.ListItem");
                
                container.Add(new CuiButton
                {
                    RectTransform = {AnchorMin = "0.3200002 0.04417646", AnchorMax = "0.5900002 0.1445784"},
                    Button = {Color = "0 0 0 0", FadeIn = 0.1f},
                    Text =
                    {
                        Text = $"Купить",
                        FontSize = 10, Align = TextAnchor.MiddleLeft, Font = "robotocondensed-regular.ttf"
                    }
                }, "StaticMenu" + $".{check.B}.ListItem");
                
                container.Add(new CuiElement
                {
                    FadeOut = 0.3f,
                    Parent = "StaticMenu" + $".{check.B}.ListItem",
                    Components =
                    {
                        new CuiRawImageComponent
                            {FadeIn = 0.3f, Png = (string) ImageLibrary?.Call("GetImage", "https://i.imgur.com/UDb5coz.png")},
                        new CuiRectTransformComponent
                            {AnchorMin = "0.6200002 0.06024094", AnchorMax = "0.7250001 0.136546"}
                    }
                });
                
                container.Add(new CuiButton
                {
                    RectTransform = {AnchorMin = "0 0", AnchorMax = "1 0.1927711"},
                    Button =
                    {
                        Color = "0 0 0 0",
                        Command = $"shop.tab buy {settings.NameCategory} {check.A.ShortNameElseCommandItem}",
                        FadeIn = 0.1f
                    },
                    Text =
                    {
                        Text = $"", FontSize = 10, Align = TextAnchor.MiddleCenter,
                        Font = "robotocondensed-regular.ttf"
                    }
                }, "StaticMenu" + $".{check.B}.ListItem");
            }

            CuiHelper.AddUi(player, container);
        }
        


        #endregion

        

        #region Hooks


        void OnServerInitialized()
        {
            if (ImageLibrary == null || !ImageLibrary.IsLoaded)
            {
                PrintError("IMAGE LIBRARY IS NOT INSTALLED!");
            }
            else
            {
                var imagesList = new Dictionary<string, string>();


                if (!imagesList.ContainsKey("https://i.imgur.com/TTKdOtq.png")) // shoposnova
                    imagesList.Add("https://i.imgur.com/TTKdOtq.png", "https://i.imgur.com/TTKdOtq.png");

                if (!imagesList.ContainsKey("https://i.imgur.com/UDb5coz.png")) // arrow
                    imagesList.Add("https://i.imgur.com/UDb5coz.png", "https://i.imgur.com/UDb5coz.png");
                
                if (!imagesList.ContainsKey("https://i.imgur.com/P5rDCQP.png")) // vpered
                    imagesList.Add("https://i.imgur.com/P5rDCQP.png", "https://i.imgur.com/P5rDCQP.png");
                
                if (!imagesList.ContainsKey("https://i.imgur.com/b4TUg0Z.png")) // nazad
                    imagesList.Add("https://i.imgur.com/b4TUg0Z.png", "https://i.imgur.com/b4TUg0Z.png");


                foreach (var category in config.LCategory)
                {
                    category.ItemSell.FindAll(mode => !string.IsNullOrEmpty(mode.ImageItem)).ForEach(mode =>
                    {
                        if (!string.IsNullOrEmpty(mode.ImageItem) && !imagesList.ContainsKey(mode.ImageItem))
                          imagesList.Add(mode.ImageItem, mode.ImageItem);
                    });
                }

                
                ImageLibrary?.Call("ImportImageList", Title, imagesList, 0UL, true);
            }

            try
            {
                _playerData = Interface.GetMod().DataFileSystem.ReadObject<Dictionary<ulong, int>>(Name);
            }
            catch
            {
                _playerData = new Dictionary<ulong, int>();
            }

            foreach (var player in BasePlayer.activePlayerList)
            {
                OnPlayerConnected(player);
            }
        }

        void OnPlayerConnected(BasePlayer player)
        {
            if (!_playerData.ContainsKey(player.userID))
                _playerData.Add(player.userID, 0);
        }


        [ChatCommand("give.coin")]
        void GiveCoins(BasePlayer player, string command, string[] args)
        {
            if (!player.IsAdmin) return;
            _playerData[player.userID] += int.Parse(args[0]);
        }


        void Unload()
        {
            Interface.Oxide.DataFileSystem.WriteObject(Name, _playerData);
        }

        #endregion

        #region Helper


        [PluginReference] private Plugin ImageLibrary;


        public string HexToCuiColor(string HEX, float Alpha = 100)
        {
            if (string.IsNullOrEmpty(HEX)) HEX = "#FFFFFF";

            var str = HEX.Trim('#');
            var r = byte.Parse(str.Substring(0, 2), NumberStyles.HexNumber);
            var g = byte.Parse(str.Substring(2, 2), NumberStyles.HexNumber);
            var b = byte.Parse(str.Substring(4, 2), NumberStyles.HexNumber);

            return $"{(double) r / 255} {(double) g / 255} {(double) b / 255} {Alpha / 100}";
        }

        void GiveCommands(BasePlayer player, string text)
        {
            string command = text.Replace("{steamid}", player.UserIDString);
            ConsoleSystem.Arg arg = new ConsoleSystem.Arg(ConsoleSystem.Option.Server, command);
            arg.cmd.Call(arg);
        }

        #endregion

        #region Functional
        
        
        [ConsoleCommand("give.coin")]
        void GiveFireTool(ConsoleSystem.Arg args)
        {
            if (!args.IsAdmin) return;
            if (args.Args.Length < 2)
            {
                PrintWarning($"Error! Example: give.coin Xavier 100");
                return;
            }
            var target = BasePlayer.Find(args.Args[0]);
            if (target == null)
            {
                PrintWarning($"Error! Player {args.Args[0]} not found!");
                return;
            }

            int amount = 0;
            if (int.TryParse(args.Args[1], out amount))
            {
                var createItem = ItemManager.CreateByName("xmas.present.medium", amount, config.SkinID);
                target.GiveItem(createItem, BaseEntity.GiveItemReason.PickedUp);
            }
            else
            {
                PrintWarning("Error! Amount not found!");
            }
            
        }


        string GetCoin(ulong player)
        {
            return _playerData[player].ToString();
        }


        private Item OnItemSplit(Item item, int amount)
        {
            if (item.info.shortname == "xmas.present.medium" && item.skin == config.SkinID)
            {
                item.amount = item.amount - amount;
                Item splitAmount1 = ItemManager.CreateByItemID(item.info.itemid, amount, item.skin);
                splitAmount1.MarkDirty();
                item.MarkDirty();
                return splitAmount1;
            }

            return null;
        }
        
        private List<uint> handledContainers = new List<uint>();

        object CanLootEntity(BasePlayer player, StorageContainer container)
        {
            if (container == null) return null;
            if (container.OwnerID > 0) return null;
            if (handledContainers.Contains(container.net.ID)) return null;
            handledContainers.Add(container.net.ID);
            foreach (var key in config._listCoin)
            {
                if (key.Prefab.ContainsKey(container.ShortPrefabName))
                {
                    if (UnityEngine.Random.Range(0, 100) < key.Prefab[container.ShortPrefabName].Chance)
                    {
                        if (container.inventory.itemList.Count == container.inventory.capacity)
                        {
                            container.inventory.capacity++;
                        }
                        var item = ItemManager.CreateByName("xmas.present.medium", 1, key.SkinID);
                        item.name = $"Монеты ( {key.CoinGive} ШТ )";
                        item.MoveToContainer(container.inventory);
                    }
                }
            }
            return null;
        }
        
        
        object OnItemAction(Item item, string action, BasePlayer player)
        {
            if (item == null) return null;
            if (action != "unwrap") return null;
            if (player == null) return null;
            if (item.info.shortname != "xmas.present.medium") return null;
            if (item.skin == 0) return null;
            var find = config._listCoin.FirstOrDefault(p => p.SkinID == item.skin);
            if (find != null)
            {
                if (_playerData.ContainsKey(
                        player.userID))
                {
                    _playerData[player.userID] += find.CoinGive;
                }
                if (item.amount > 1)
                    item.amount--;
                else item.RemoveFromContainer();
                return false;
            }
            return null;
        }


        public Dictionary<ulong, int> _playerData = new Dictionary<ulong, int>(
        );





        #endregion

        #region Configuration

        private PluginConfig config;

        protected override void LoadDefaultConfig()
        {
            config = PluginConfig.DefaultConfig();
        }

        protected override void LoadConfig()
        {
            base.LoadConfig();
            config = Config.ReadObject<PluginConfig>();

            if (config.PluginVersion < Version)
                UpdateConfigValues();

            Config.WriteObject(config, true);
        }

        private void UpdateConfigValues()
        {
            PluginConfig baseConfig = PluginConfig.DefaultConfig();
            if (config.PluginVersion < new VersionNumber(1, 0, 0))
            {
                PrintWarning("Config update detected! Updating config values...");
                PrintWarning("Config update completed!");
            }

            config.PluginVersion = Version;
        }

        protected override void SaveConfig()
        {
            Config.WriteObject(config);
        }
        
        public class Drop
        {
            [JsonProperty("Минимальное количество выпадения")]
            public int Min;
            [JsonProperty("Максимальное количество выпадения")]
            public int Max;
            [JsonProperty("Шанс что он появится в луте")]
            public int Chance;
        }

        public class CoinSettings
        {
            [JsonProperty("SkinID предмета")] 
            public ulong SkinID;

            [JsonProperty("Картинка предмета")] 
            public string ImageBook;

            [JsonProperty("Сколько он будет давать монет при использовании")]
            public int CoinGive;

            [JsonProperty("Настройка выпадения предмета")]
            public Dictionary<string, Drop> Prefab;

        }

        private class PluginConfig
        {

            [JsonProperty("Настройка категорий и предметов")]
            public List<CategorySettings> LCategory = new List<CategorySettings>();


            [JsonProperty("SkinID Money")]
            public ulong SkinID;
            
            
            [JsonProperty("Настройка монет")] 
            public List<CoinSettings> _listCoin = new List<CoinSettings>();
            
            [JsonProperty("Версия конфигурации")] 
            public VersionNumber PluginVersion = new VersionNumber();

            public static PluginConfig DefaultConfig()
            {
                return new PluginConfig()
                {
                    _listCoin = new List<CoinSettings>()
                    {
                        new CoinSettings()
                        {
                            SkinID = 2783868504,
                            CoinGive = 15,
                            ImageBook = "https://i.imgur.com/MIk0beb.png",
                            Prefab = new Dictionary<string, Drop>()
                            {
                                ["crate_basic"] = new Drop()
                                {
                                    Max = 1,
                                    Min = 1,
                                    Chance = 25
                                }
                            },
                        },
                        new CoinSettings()
                        {
                            SkinID = 2783868626,
                            CoinGive = 25,
                            ImageBook = "https://i.imgur.com/O6OJady.png",
                            Prefab = new Dictionary<string, Drop>()
                            {
                                ["crate_basic"] = new Drop()
                                {
                                    Max = 1,
                                    Min = 1,
                                    Chance = 25
                                }
                            },
                        },
                        new CoinSettings()
                        {
                            SkinID = 2783868707,
                            CoinGive = 35,
                            ImageBook = "https://i.imgur.com/P2kKwEr.png",
                            Prefab = new Dictionary<string, Drop>()
                            {
                                ["crate_basic"] = new Drop()
                                {
                                    Max = 1,
                                    Min = 1,
                                    Chance = 25
                                }
                            },
                        },
                        new CoinSettings()
                        {
                            SkinID = 2783868829,
                            CoinGive = 50,
                            ImageBook = "https://i.imgur.com/iPlFPqj.png",
                            Prefab = new Dictionary<string, Drop>()
                            {
                                ["crate_basic"] = new Drop()
                                {
                                    Max = 1,
                                    Min = 1,
                                    Chance = 25
                                }
                            },
                        },
                        new CoinSettings()
                        {
                            SkinID = 2783868902,
                            CoinGive = 75,
                            ImageBook = "https://i.imgur.com/CTCJClU.png",
                            Prefab = new Dictionary<string, Drop>()
                            {
                                ["crate_basic"] = new Drop()
                                {
                                    Max = 1,
                                    Min = 1,
                                    Chance = 25
                                }
                            },
                        },
                        new CoinSettings()
                        {
                            SkinID = 2783868978,
                            CoinGive = 100,
                            ImageBook = "https://i.imgur.com/9Nla1WA.png",
                            Prefab = new Dictionary<string, Drop>()
                            {
                                ["crate_basic"] = new Drop()
                                {
                                    Max = 15,
                                    Min = 10,
                                    Chance = 25
                                }
                            },
                        },
                    },
                    
                    LCategory = new List<CategorySettings>()
                    {
                        new CategorySettings()
                        {
                            NameCategory = "Электричество",
                            ItemSell = new List<ItemSettings>()
                            {
                                new ItemSettings()
                                {
                                    ShortNameElseCommandItem = "autoturret",
                                    AmountItem = 1,
                                    skinIDItem = 0,
                                    ImageItem = null,
                                    Priceitem = 500,
                                    NameItem = "Premium",
                                },
                                new ItemSettings()
                                {
                                    ShortNameElseCommandItem = "generator.wind.scrap",
                                    AmountItem = 1,
                                    skinIDItem = 0,
                                    ImageItem = null,
                                    Priceitem = 300,
                                    NameItem = "Premium",
                                }
                            },
                        },
                        new CategorySettings()
                        {
                            NameCategory = "Привилегии",
                            ItemSell = new List<ItemSettings>()
                            {
                                new ItemSettings()
                                {
                                    ShortNameElseCommandItem = "grant.group {steamid} vip 7d",
                                    AmountItem = 1,
                                    skinIDItem = 0,
                                    ImageItem = "https://i.imgur.com/qCnfvIj.png",
                                    Priceitem = 1000,
                                    NameItem = "Premium",
                                },
                                new ItemSettings()
                                {
                                    ShortNameElseCommandItem = "grant.group {steamid} premium 7d",
                                    AmountItem = 1,
                                    skinIDItem = 0,
                                    ImageItem = "https://i.imgur.com/eGHV1s9.png",
                                    Priceitem = 2000,
                                    NameItem = "Premium",
                                },
                            }
                        }
                    },
                    PluginVersion = new VersionNumber(),
                };
            }
        }
        

        public class ItemSettings
        {
            [JsonProperty("Шортнейм предмета или команда ( Аргумент {steamid} в команде заменит на steamid64 игрока! )")]
            public string ShortNameElseCommandItem;

            [JsonProperty("Кол-во предмета")]
            public int AmountItem;

            [JsonProperty("SkinID Предмета")] 
            public ulong skinIDItem;

            [JsonProperty("Картинка предмета ( оставьте null, если картинка не нужна )")]
            public string ImageItem = null;

            [JsonProperty("Цена предмета")] 
            public int Priceitem;

            [JsonProperty("Название предмета")] 
            public string NameItem;
        }

        public class CategorySettings
        {
            [JsonProperty("Название категории")] public string NameCategory;

            [JsonProperty("Предметы, которые будут там продаваться")]
            public List<ItemSettings> ItemSell = new List<ItemSettings>();

        }

        #endregion
    }
}

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