Beispiel #1
0
        private void OnItemsCommand(string cmd, string[] args)
        {
            Dictionary <ISalable, int[]> stock = new();

            {
                stock.Add(new AnimalGauntlets(), new int[] { 0, int.MaxValue });
                {
                    var mp = Helper.Reflection.GetField <Multiplayer>(typeof(Game1), "multiplayer").GetValue();
                    var ag = new AnimalGauntlets();
                    ag.holding.Value = new LunarAnimal(LunarAnimalType.Cow, Vector2.Zero, mp.getNewID());
                    stock.Add(ag, new int[] { 0, int.MaxValue });
                }
                {
                    var mp = Helper.Reflection.GetField <Multiplayer>(typeof(Game1), "multiplayer").GetValue();
                    var ag = new AnimalGauntlets();
                    ag.holding.Value = new LunarAnimal(LunarAnimalType.Chicken, Vector2.Zero, mp.getNewID());
                    stock.Add(ag, new int[] { 0, int.MaxValue });
                }
                foreach (var type in Enum.GetValues <Necklace.Type>())
                {
                    stock.Add(new Necklace(type), new int[] { 0, int.MaxValue });
                }
                foreach (var data in dgaPack.GetItems())
                {
                    var item = data.ToItem();
                    if (item == null)
                    {
                        continue;
                    }
                    stock.Add(item, new int[] { 0, int.MaxValue });
                }
            }
            Game1.activeClickableMenu = new ShopMenu(stock);
        }
Beispiel #2
0
        protected void PlaceChestAt(AsteroidsDungeon location, Random rand, int tx, int ty, bool rare)
        {
            Vector2 position = new Vector2(tx, ty);
            Chest   chest    = new Chest(playerChest: false, position);

            chest.dropContents.Value = true;
            chest.synchronized.Value = true;
            chest.type.Value         = "interactive";
            if (rare)
            {
                chest.SetBigCraftableSpriteIndex(227);
                switch (rand.Next(7))
                {
                case 0:
                case 1:
                case 2:
                    chest.addItem(new Necklace(Necklace.Type.Lunar));
                    break;

                case 3:
                case 4:
                    chest.addItem(new DynamicGameAssets.Game.CustomObject(DynamicGameAssets.Mod.Find(ItemIds.SoulSapphire) as ObjectPackData));
                    break;

                case 5:
                    chest.addItem(new DynamicGameAssets.Game.CustomBoots(DynamicGameAssets.Mod.Find(ItemIds.CosmosBoots) as BootsPackData));
                    break;

                case 6:
                    var item = new AnimalGauntlets();
                    var mp   = Mod.instance.Helper.Reflection.GetField <Multiplayer>(typeof(Game1), "multiplayer").GetValue();
                    switch (rand.Next(5))
                    {
                    case 0:
                    case 1:
                    case 2:
                        break;

                    case 3:
                        item.holding.Value = new LunarAnimal(LunarAnimalType.Cow, Vector2.Zero, mp.getNewID());
                        break;

                    case 4:
                        item.holding.Value = new LunarAnimal(LunarAnimalType.Chicken, Vector2.Zero, mp.getNewID());
                        break;
                    }
                    chest.addItem(item);
                    break;
                }
            }
            else
            {
                chest.SetBigCraftableSpriteIndex(223);
                switch (rand.Next(6))
                {
                case 0:
                case 1:
                case 2:
                    chest.addItem(new DynamicGameAssets.Game.CustomObject(DynamicGameAssets.Mod.Find(ItemIds.MythiciteOre) as ObjectPackData)
                    {
                        Stack = 3 + rand.Next(12)
                    });
                    break;

                case 3:
                    chest.addItem(new DynamicGameAssets.Game.CustomObject(DynamicGameAssets.Mod.Find(ItemIds.MythiciteBar) as ObjectPackData)
                    {
                        Stack = 1 + rand.Next(7)
                    });
                    break;

                case 4:
                    chest.addItem(new DynamicGameAssets.Game.CustomObject(DynamicGameAssets.Mod.Find(ItemIds.StellarEssence) as ObjectPackData)
                    {
                        Stack = 4 + rand.Next(9)
                    });
                    break;

                case 5:
                    chest.addItem(new DynamicGameAssets.Game.CustomObject(DynamicGameAssets.Mod.Find(ItemIds.PersistiumDust) as ObjectPackData)
                    {
                        Stack = 2 + rand.Next(6)
                    });
                    break;
                }
            }
            if (location.netObjects.ContainsKey(position))
            {
                location.netObjects.Remove(position);
            }
            location.netObjects.Add(position, chest);
        }