Beispiel #1
0
        void RecordInventoryPlayer(NetUser Player)
        {
            if (Inventarios.ContainsKey(Player.userID))
            {
                return;
            }
            var            Ropas            = new Colecciones::List <object>();
            var            Armas            = new Colecciones::List <object>();
            var            CosasInventarios = new Colecciones::List <object>();
            var            InfoInventario   = new Colecciones::Dictionary <string, object>();
            IInventoryItem Item;
            Inventory      PlayerInventory = Player.playerClient.rootControllable.idMain.GetComponent <Inventory>();

            try
            {
                for (int i = 0; i < 40; i++)
                {
                    if (PlayerInventory.GetItem(i, out Item))
                    {
                        if (i >= 0 && i < 30)
                        {
                            CosasInventarios.Add(new Colecciones::Dictionary <string, int>()
                            {
                                { Item.datablock.name, Item.datablock._splittable ? (int)Item.uses : 1 }
                            });
                            continue;
                        }
                        if (i >= 30 && i < 36)
                        {
                            Armas.Add(new Colecciones::Dictionary <string, int>()
                            {
                                { Item.datablock.name, Item.datablock._splittable ? (int)Item.uses : 1 }
                            });
                            continue;
                        }
                        Ropas.Add(new Colecciones::Dictionary <string, int>()
                        {
                            { Item.datablock.name, Item.datablock._splittable ? (int)Item.uses : 1 }
                        });
                    }
                }
                InfoInventario.Add("Ropas", new Colecciones::List <object>(Ropas));
                InfoInventario.Add("Armas", new Colecciones::List <object>(Armas));
                InfoInventario.Add("CosasInventario", new Colecciones::List <object>(CosasInventarios));
                Inventarios.Add(Player.userID, new Colecciones::Dictionary <string, object>(InfoInventario));
                InfoInventario.Clear();
                Ropas.Clear();
                Armas.Clear();
                CosasInventarios.Clear();
                rust.Notice(Player, "Your Inventory Save, if you inventory dont return type /hg Inventory");
                PlayerInventory.Clear();
            }
            catch (Exception ex)
            {
                Debug.LogError("Error the record Player Inventory in Plugin HungerGames " + ex.Message);
            }
        }