Пример #1
0
        static Ninja CreateNinja(int piratesKilled, Clothing? clothes)
        {
            Ninja ninja = new Ninja();
            ninja.Name = "Sarutobi Sasuke";
            Weapon katana = new Weapon(WeaponType.Katana);
            Weapon shuriken = new Weapon(WeaponType.Shuriken);
            Weapon bow = new Weapon(WeaponType.Bow);
            List<Weapon> weapons = new List<Weapon>();
            weapons.Add(katana);
            weapons.Add(shuriken);
            weapons.Add(bow);
            ninja.Weapons = weapons;

            if (piratesKilled < 1)
            {
                ninja.PiratesKilled = 1;
            }
            else
            {
                ninja.PiratesKilled = piratesKilled;
            }

            if (clothes.HasValue)
            {
                ninja.Clothes = clothes.Value;
            }
            else
            {
                ninja.Clothes = Clothing.Shozoku;
            }

            return ninja;
        }
Пример #2
0
 static Ninja CreateNinja(int piratesKilled, Clothing? clothes)
 {
     return new Ninja
     {
         Name = "Sarutobi Sasuke",
         Weapons = new[]
         {
             new Weapon(WeaponType.Katana),
             new Weapon(WeaponType.Shuriken),
             new Weapon(WeaponType.Bow)
         },
         PiratesKilled = piratesKilled < 1 ?
             1 : piratesKilled,
         Clothes = clothes ?? Clothing.Shozoku
     };
 }
        public static Item getItem(string type, int index = -1, string name = "none")
        {
            Item item = null;

            if (type == "Object")
            {
                if (index != -1)
                {
                    item = new StardewValley.Object(index, 1);
                }
                else if (name != "none")
                {
                    item = new StardewValley.Object(Game1.objectInformation.getIndexByName(name), 1);
                }
            }
            else if (type == "BigObject")
            {
                if (index != -1)
                {
                    item = new StardewValley.Object(Vector2.Zero, index);
                }
                else if (name != "none")
                {
                    item = new StardewValley.Object(Vector2.Zero, Game1.bigCraftablesInformation.getIndexByName(name));
                }
            }
            else if (type == "Ring")
            {
                if (index != -1)
                {
                    item = new Ring(index);
                }
                else if (name != "none")
                {
                    item = new Ring(Game1.objectInformation.getIndexByName(name));
                }
            }
            else if (type == "Hat")
            {
                if (index != -1)
                {
                    item = new Hat(index);
                }
                else if (name != "none")
                {
                    item = new Hat(TMXLoaderMod.helper.Content.Load <Dictionary <int, string> >(@"Data/hats", ContentSource.GameContent).getIndexByName(name));
                }
            }
            else if (type == "Boots")
            {
                if (index != -1)
                {
                    item = new Boots(index);
                }
                else if (name != "none")
                {
                    item = new Boots(TMXLoaderMod.helper.Content.Load <Dictionary <int, string> >(@"Data/Boots", ContentSource.GameContent).getIndexByName(name));
                }
            }
            else if (type == "Clothing")
            {
                if (index != -1)
                {
                    item = new Clothing(index);
                }
                else if (name != "none")
                {
                    item = new Clothing(TMXLoaderMod.helper.Content.Load <Dictionary <int, string> >(@"Data/ClothingInformation", ContentSource.GameContent).getIndexByName(name));
                }
            }
            else if (type == "TV")
            {
                if (index != -1)
                {
                    item = new StardewValley.Objects.TV(index, Vector2.Zero);
                }
                else if (name != "none")
                {
                    item = new TV(TMXLoaderMod.helper.Content.Load <Dictionary <int, string> >(@"Data/Furniture", ContentSource.GameContent).getIndexByName(name), Vector2.Zero);
                }
            }
            else if (type == "IndoorPot")
            {
                item = new StardewValley.Objects.IndoorPot(Vector2.Zero);
            }
            else if (type == "CrabPot")
            {
                item = new StardewValley.Objects.CrabPot(Vector2.Zero);
            }
            else if (type == "Chest")
            {
                item = new StardewValley.Objects.Chest(true);
            }
            else if (type == "Cask")
            {
                item = new StardewValley.Objects.Cask(Vector2.Zero);
            }
            else if (type == "Cask")
            {
                item = new StardewValley.Objects.Cask(Vector2.Zero);
            }
            else if (type == "Furniture")
            {
                if (index != -1)
                {
                    item = new StardewValley.Objects.Furniture(index, Vector2.Zero);
                }
                else if (name != "none")
                {
                    item = new Furniture(TMXLoaderMod.helper.Content.Load <Dictionary <int, string> >(@"Data/Furniture", ContentSource.GameContent).getIndexByName(name), Vector2.Zero);
                }
            }
            else if (type == "Sign")
            {
                item = new StardewValley.Objects.Sign(Vector2.Zero, index);
            }
            else if (type == "Wallpaper")
            {
                item = new StardewValley.Objects.Wallpaper(Math.Abs(index), false);
            }
            else if (type == "Floors")
            {
                item = new StardewValley.Objects.Wallpaper(Math.Abs(index), true);
            }
            else if (type == "MeleeWeapon")
            {
                if (index != -1)
                {
                    item = new MeleeWeapon(index);
                }
                else if (name != "none")
                {
                    item = new MeleeWeapon(TMXLoaderMod.helper.Content.Load <Dictionary <int, string> >(@"Data/weapons", ContentSource.GameContent).getIndexByName(name));
                }
            }
            else if (type == "CustomObject" && PyTK.CustomElementHandler.CustomObjectData.collection.ContainsKey(name))
            {
                item = PyTK.CustomElementHandler.CustomObjectData.collection[name].getObject();
            }
            else if (type == "SDVType")
            {
                try
                {
                    if (index == -1)
                    {
                        item = Activator.CreateInstance(PyUtils.getTypeSDV(name)) is Item i ? i : null;
                    }
                    else
                    {
                        item = Activator.CreateInstance(PyUtils.getTypeSDV(name), index) is Item i ? i : null;
                    }
                }
                catch (Exception ex)
                {
                    TMXLoaderMod.monitor.Log(ex.Message + ":" + ex.StackTrace, LogLevel.Error);
                    TMXLoaderMod.monitor.Log("Couldn't load item SDVType: " + name);
                }
            }
            else if (type == "ByType")
            {
                try
                {
                    if (index == -1)
                    {
                        item = Activator.CreateInstance(Type.GetType(name)) is Item i ? i : null;
                    }
                    else
                    {
                        item = Activator.CreateInstance(Type.GetType(name), index) is Item i ? i : null;
                    }
                }
                catch (Exception ex)
                {
                    TMXLoaderMod.monitor.Log(ex.Message + ":" + ex.StackTrace, LogLevel.Error);
                    TMXLoaderMod.monitor.Log("Couldn't load item ByType: " + name);
                }
            }

            return(item);
        }
        // GET: StoreManager/Delete/5
        public ActionResult Delete(int id)
        {
            Clothing clothing = db.Clothes.Find(id);

            return(View(clothing));
        }
Пример #5
0
        public void drawItem(PipeNode pipe, SpriteBatch spriteBatch, int x, int y)
        {
            Item      item = pipe.StoredItem;
            Texture2D SpriteSheet;
            Rectangle srcRect;
            Vector2   originalPosition;
            Vector2   position;

            //How to handle drawing custom mod items
            //Igual hacer como coger la sprite y redimensionarla
            //relativamente a su size original y listo
            //try catch para loadear la sprite
            if (item is PipeItem)
            {
                PipeItem pipeItem = (PipeItem)item;
                SpriteSheet      = pipeItem.ItemTexture;
                srcRect          = new Rectangle(0, 0, 16, 16);
                originalPosition = Game1.GlobalToLocal(Game1.viewport, new Vector2(x * 64, y * 64 - 64));
                position         = new Vector2(originalPosition.X + 16, originalPosition.Y + 64 + 16);
                spriteBatch.Draw(SpriteSheet, position, srcRect, Color.White, 0f, Vector2.Zero, 2f, SpriteEffects.None,
                                 ((float)(y * 64 + 32) / 10000f) + 0.002f);
            }
            else if (item is PPMItem)
            {
                PPMItem PPM = (PPMItem)item;
                SpriteSheet      = PPM.ItemTexture;
                srcRect          = new Rectangle(0, 0, 16, 32);
                originalPosition = Game1.GlobalToLocal(Game1.viewport, new Vector2(x * 64, y * 64 - 64));
                position         = new Vector2(originalPosition.X + 23, originalPosition.Y + 64 + 10);
                spriteBatch.Draw(SpriteSheet, position, srcRect, Color.White, 0f, Vector2.Zero, 1.2f, SpriteEffects.None,
                                 ((float)(y * 64 + 32) / 10000f) + 0.002f);
            }
            else if (item is SObject && (item as SObject).bigCraftable.Value)
            {
                SpriteSheet      = Game1.bigCraftableSpriteSheet;
                srcRect          = SObject.getSourceRectForBigCraftable(item.ParentSheetIndex);
                originalPosition = Game1.GlobalToLocal(Game1.viewport, new Vector2(x * 64, y * 64 - 64));
                position         = new Vector2(originalPosition.X + 23, originalPosition.Y + 64 + 10);
                spriteBatch.Draw(SpriteSheet, position, srcRect, Color.White, 0f, Vector2.Zero, 1.2f, SpriteEffects.None,
                                 ((float)(y * 64 + 32) / 10000f) + 0.002f);
            }
            else if (item is Tool)
            {
                Tool tool = (Tool)item;
                if (item is MeleeWeapon || item is Slingshot || item is Sword)
                {
                    SpriteSheet      = Tool.weaponsTexture;
                    srcRect          = Game1.getSquareSourceRectForNonStandardTileSheet(SpriteSheet, 16, 16, tool.IndexOfMenuItemView);
                    originalPosition = Game1.GlobalToLocal(Game1.viewport, new Vector2(x * 64, y * 64 - 64));
                    position         = new Vector2(originalPosition.X + 19, originalPosition.Y + 64 + 19);
                    spriteBatch.Draw(SpriteSheet, position, srcRect, Color.White, 0f, Vector2.Zero, 1.7f, SpriteEffects.None,
                                     ((float)(y * 64 + 32) / 10000f) + 0.002f);
                }
                else
                {
                    SpriteSheet      = Game1.toolSpriteSheet;
                    srcRect          = Game1.getSquareSourceRectForNonStandardTileSheet(SpriteSheet, 16, 16, tool.IndexOfMenuItemView);
                    originalPosition = Game1.GlobalToLocal(Game1.viewport, new Vector2(x * 64, y * 64 - 64));
                    position         = new Vector2(originalPosition.X + 19, originalPosition.Y + 64 + 18);
                    spriteBatch.Draw(SpriteSheet, position, srcRect, Color.White, 0f, Vector2.Zero, 1.7f, SpriteEffects.None,
                                     ((float)(y * 64 + 32) / 10000f) + 0.002f);
                }
            }
            //Boots = standard
            else if (item is Boots)
            {
                Boots boot = (Boots)item;
                SpriteSheet      = Game1.objectSpriteSheet;
                srcRect          = Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, boot.indexInTileSheet.Value, 16, 16);
                originalPosition = Game1.GlobalToLocal(Game1.viewport, new Vector2(x * 64, y * 64 - 64));
                position         = new Vector2(originalPosition.X + 18, originalPosition.Y + 64 + 16);
                spriteBatch.Draw(SpriteSheet, position, srcRect, Color.White, 0f, Vector2.Zero, 2f, SpriteEffects.None,
                                 ((float)(y * 64 + 32) / 10000f) + 0.002f);
            }
            //rings = standard
            else if (item is Ring)
            {
                SpriteSheet      = Game1.objectSpriteSheet;
                srcRect          = Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, item.ParentSheetIndex, 16, 16);
                originalPosition = Game1.GlobalToLocal(Game1.viewport, new Vector2(x * 64, y * 64 - 64));
                position         = new Vector2(originalPosition.X + 10, originalPosition.Y + 64 + 14);
                spriteBatch.Draw(SpriteSheet, position, srcRect, Color.White, 0f, Vector2.Zero, 2.5f, SpriteEffects.None,
                                 ((float)(y * 64 + 32) / 10000f) + 0.002f);
            }
            else if (item is Hat)
            {
                Hat hat = (Hat)item;
                SpriteSheet      = FarmerRenderer.hatsTexture;
                srcRect          = new Rectangle((int)hat.which * 20 % FarmerRenderer.hatsTexture.Width, (int)hat.which * 20 / FarmerRenderer.hatsTexture.Width * 20 * 4, 20, 20);
                originalPosition = Game1.GlobalToLocal(Game1.viewport, new Vector2(x * 64, y * 64 - 64));
                position         = new Vector2(originalPosition.X + 12, originalPosition.Y + 64 + 18);
                spriteBatch.Draw(SpriteSheet, position, srcRect, Color.White, 0f, Vector2.Zero, 2f, SpriteEffects.None,
                                 ((float)(y * 64 + 32) / 10000f) + 0.002f);
            }
            else if (item is Clothing)
            {
                Clothing cloth         = (Clothing)item;
                Color    clothes_color = cloth.clothesColor;
                if (cloth.isPrismatic.Value)
                {
                    clothes_color = Utility.GetPrismaticColor();
                }
                if (cloth.clothesType.Value == 0)
                {
                    SpriteSheet      = FarmerRenderer.shirtsTexture;
                    srcRect          = new Rectangle(cloth.indexInTileSheetMale.Value * 8 % 128, cloth.indexInTileSheetMale.Value * 8 / 128 * 32, 8, 8);
                    originalPosition = Game1.GlobalToLocal(Game1.viewport, new Vector2(x * 64, y * 64 - 64));
                    position         = new Vector2(originalPosition.X + 20, originalPosition.Y + 64 + 20);
                    spriteBatch.Draw(SpriteSheet, position, srcRect, clothes_color, 0f, Vector2.Zero, 3f, SpriteEffects.None,
                                     ((float)(y * 64 + 32) / 10000f) + 0.002f);
                }
                else if (cloth.clothesType.Value == 1)
                {
                    SpriteSheet      = FarmerRenderer.pantsTexture;
                    srcRect          = new Rectangle(192 * (cloth.indexInTileSheetMale.Value % (FarmerRenderer.pantsTexture.Width / 192)), 688 * (cloth.indexInTileSheetMale.Value / (FarmerRenderer.pantsTexture.Width / 192)) + 672, 16, 16);
                    originalPosition = Game1.GlobalToLocal(Game1.viewport, new Vector2(x * 64, y * 64 - 64));
                    position         = new Vector2(originalPosition.X + 8, originalPosition.Y + 64 + 10);
                    spriteBatch.Draw(SpriteSheet, position, srcRect, clothes_color, 0f, Vector2.Zero, 3f, SpriteEffects.None,
                                     ((float)(y * 64 + 32) / 10000f) + 0.002f);
                }
            }
            else
            {
                SpriteSheet      = Game1.objectSpriteSheet;
                srcRect          = Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, item.ParentSheetIndex, 16, 16);
                originalPosition = Game1.GlobalToLocal(Game1.viewport, new Vector2(x * 64, y * 64 - 64));
                position         = new Vector2(originalPosition.X + 17, originalPosition.Y + 64 + 17);
                spriteBatch.Draw(SpriteSheet, position, srcRect, Color.White, 0f, Vector2.Zero, 1.9f, SpriteEffects.None,
                                 ((float)(y * 64 + 32) / 10000f) + 0.002f);
            }
        }
Пример #6
0
        /// <summary>Raised as the day ends. Checks to see if it is raining. If it is, unequip rain equipment.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event data.</param>
        private void OnDayEnding(object sender, DayEndingEventArgs e)
        {
            // ignore if player hasn't loaded a save yet
            if (!Context.IsWorldReady)
            {
                return;
            }

            // ignore if the rainy clothes aren't loaded
            if (!this.Helper.ModRegistry.IsLoaded("IMS.JA.RainyDayClothing"))
            {
                return;
            }


            // When it is raining, unequip Rain Hood, Coat, and Boots at end of day
            if (this.WeatherJustifiesRainCoat())
            {
                this.Monitor.Log($"Previous Shirt: {this.previousShirt?.displayName}", LogLevel.Debug);
                this.Monitor.Log($"Previous Hat: {this.previousHat?.DisplayName}", LogLevel.Debug);
                this.Monitor.Log($"Previous Boots: {this.previousBoots?.DisplayName}", LogLevel.Debug);

                foreach (Furniture furniture in Game1.player.currentLocation.furniture)
                {
                    if (furniture is StorageFurniture)
                    {
                        this.dresserList.Add(furniture as StorageFurniture);
                    }
                }
                foreach (KeyValuePair <Vector2, StardewValley.Object> pair in Game1.player.currentLocation.Objects.Pairs)
                {
                    if (pair.Value is Chest)
                    {
                        this.chestList.Add(pair.Value as Chest);
                    }
                }

                // Read what was previously equipped and equip it
                if (this.Config.RainCoatEnabled)
                {
                    // only change back if player is still wearing the rain coat
                    if (Game1.player.shirtItem.Value.displayName.Equals(RAIN_SHIRT_DISPLAY_NAME))
                    {
                        // put previous shirt back on
                        Game1.player.changeShirt(ConvertToMaleOrFemaleIndex(this.previousShirt));
                        Game1.player.ConvertClothingOverrideToClothesItems();
                        // remove previous shirt from inventory
                        this.RemoveItemFromInventoryOrContainer(this.previousShirt as Item);

                        // put rain coat back in dresser or player's inventory
                        Clothing rainCoat = new Clothing(this.rainCoatIndex);
                        this.PutItemAway(rainCoat);
                    }
                }

                if (this.Config.RainHoodEnabled)
                {
                    // if is currently wearing the rain hat, remove it
                    if (Game1.player.hat.Value.which.Value == this.rainHatIndex)
                    {
                        // if the player was previously wearing a hat, put it back on, else just take the rain hood off
                        if (this.isWearingHat)
                        {
                            Game1.player.changeHat(this.previousHat.which);
                            // find and remove player's previous hat from their inventory or a nearby dresser or chest
                            this.RemoveItemFromInventoryOrContainer(this.previousHat as Item);
                        }
                        else
                        {
                            Game1.player.hat.Value = null;
                        }

                        // put rain hood back in nearby dresser or player's inventory
                        Hat rainHood = new Hat(this.rainHatIndex);
                        this.PutItemAway(rainHood);
                    }
                }

                if (this.Config.RainBootsEnabled)
                {
                    Boots rainBoots = new Boots(this.rainBootsIndex);
                    // if player is currently wearing the rain boots, EXECUTE THE LOGIC!
                    if (Game1.player.boots.Value.DisplayName == rainBoots.DisplayName)
                    {
                        // Step 1 - take off rain boots
                        Game1.player.boots.Value.onUnequip();

                        // Step 2 - put the boots in a nearby dresser  or player inventory
                        Boots rainBooties = new Boots(this.rainBootsIndex);
                        this.PutItemAway(rainBooties);

                        // Step 3 - equip previous boots
                        if (this.previousBoots != null)
                        {
                            // find and remove player's previous boots from their inventory or a nearby dresser or chest
                            this.RemoveItemFromInventoryOrContainer(this.previousBoots as Item);

                            // put the player's previous boots back on
                            Game1.player.boots.Value = this.previousBoots;
                            Game1.player.boots.Value.onEquip();
                        }
                        else
                        {
                            // if player didn't have previousBoots, unequip the rain boots
                            Game1.player.boots.Value.onUnequip();
                            Game1.player.boots.Value = null;
                        }
                    }
                }

                this.Monitor.Log($"Chances of it raining tomorrow: {Game1.chanceToRainTomorrow}", LogLevel.Debug);
                this.Monitor.Log($"Weather Int tomorrow: {Game1.weatherForTomorrow}", LogLevel.Debug);
                //this.Monitor.Log($"Weather Int Tomorrow (save): {SaveGame.weatherForTomorrow}", LogLevel.Debug);

                if (this.Config.RainBootsEnabled || this.Config.RainCoatEnabled || this.Config.RainHoodEnabled)
                {
                    Game1.player.UpdateClothing();
                }

                this.ResetPreviousData();
            }
            // clear these lists to ensure they stay up to date during each function exection
            this.dresserList.Clear();
            this.chestList.Clear();
        }
Пример #7
0
        public ISalable GetSalable(string type, int index = -1, string name = "none")
        {
            Item item = null;

            if (type == "Object")
            {
                if (index != -1)
                {
                    item = new StardewValley.Object(index, 1);
                }
                else if (name != "none")
                {
                    item = new StardewValley.Object(GetIndexByName(Game1.objectInformation, name), 1);
                }
            }
            else if (type == "BigObject")
            {
                if (index != -1)
                {
                    item = new StardewValley.Object(Vector2.Zero, index);
                }
                else if (name != "none")
                {
                    item = new StardewValley.Object(Vector2.Zero, GetIndexByName(Game1.bigCraftablesInformation, name));
                }
            }
            else if (type == "Ring")
            {
                if (index != -1)
                {
                    item = new Ring(index);
                }
                else if (name != "none")
                {
                    item = new Ring(GetIndexByName(Game1.objectInformation, name));
                }
            }
            else if (type == "Hat")
            {
                if (index != -1)
                {
                    item = new Hat(index);
                }
                else if (name != "none")
                {
                    item = new Hat(GetIndexByName(Plato.ModHelper.Content.Load <Dictionary <int, string> >(@"Data/hats", ContentSource.GameContent), name));
                }
            }
            else if (type == "Boots")
            {
                if (index != -1)
                {
                    item = new Boots(index);
                }
                else if (name != "none")
                {
                    item = new Boots(GetIndexByName(Plato.ModHelper.Content.Load <Dictionary <int, string> >(@"Data/Boots", ContentSource.GameContent), name));
                }
            }
            else if (type == "Clothing")
            {
                if (index != -1)
                {
                    item = new Clothing(index);
                }
                else if (name != "none")
                {
                    item = new Clothing(GetIndexByName(Plato.ModHelper.Content.Load <Dictionary <int, string> >(@"Data/ClothingInformation", ContentSource.GameContent), name));
                }
            }
            else if (type == "TV")
            {
                if (index != -1)
                {
                    item = new StardewValley.Objects.TV(index, Vector2.Zero);
                }
                else if (name != "none")
                {
                    item = new TV(GetIndexByName(Plato.ModHelper.Content.Load <Dictionary <int, string> >(@"Data/Furniture", ContentSource.GameContent), name), Vector2.Zero);
                }
            }
            else if (type == "IndoorPot")
            {
                item = new StardewValley.Objects.IndoorPot(Vector2.Zero);
            }
            else if (type == "CrabPot")
            {
                item = new StardewValley.Objects.CrabPot(Vector2.Zero);
            }
            else if (type == "Chest")
            {
                item = new StardewValley.Objects.Chest(true);
            }
            else if (type == "Cask")
            {
                item = new StardewValley.Objects.Cask(Vector2.Zero);
            }
            else if (type == "Cask")
            {
                item = new StardewValley.Objects.Cask(Vector2.Zero);
            }
            else if (type == "Furniture")
            {
                if (index != -1)
                {
                    item = new StardewValley.Objects.Furniture(index, Vector2.Zero);
                }
                else if (name != "none")
                {
                    item = new Furniture(GetIndexByName(Plato.ModHelper.Content.Load <Dictionary <int, string> >(@"Data/Furniture", ContentSource.GameContent), name), Vector2.Zero);
                }
            }
            else if (type == "Sign")
            {
                item = new StardewValley.Objects.Sign(Vector2.Zero, index);
            }
            else if (type == "Wallpaper")
            {
                item = new StardewValley.Objects.Wallpaper(Math.Abs(index), false);
            }
            else if (type == "Floors")
            {
                item = new StardewValley.Objects.Wallpaper(Math.Abs(index), true);
            }
            else if (type == "MeleeWeapon")
            {
                if (index != -1)
                {
                    item = new MeleeWeapon(index);
                }
                else if (name != "none")
                {
                    item = new MeleeWeapon(GetIndexByName(Plato.ModHelper.Content.Load <Dictionary <int, string> >(@"Data/weapons", ContentSource.GameContent), name));
                }
            }
            else if (type == "SDVType")
            {
                if (index == -1)
                {
                    item = Activator.CreateInstance(GetTypeSDV(name)) is Item i ? i : null;
                }
                else
                {
                    item = Activator.CreateInstance(GetTypeSDV(name), index) is Item i ? i : null;
                }
            }
            else if (type == "ByType")
            {
                try
                {
                    if (index == -1)
                    {
                        item = Activator.CreateInstance(Type.GetType(name)) is Item i ? i : null;
                    }
                    else
                    {
                        item = Activator.CreateInstance(Type.GetType(name), index) is Item i ? i : null;
                    }
                }
                catch (Exception ex)
                {
                }
            }

            return(item);
        }
 public void InsertClothing(Clothing clothing)
 {
     clothingRepository.Insert(clothing);
 }
Пример #9
0
        public Task RegisterUser(User player, string username, string password)
        {
            Console.WriteLine("151");
            //Check if user exists
            var dbUser = Main.database.UserCollection.AsQueryable().FirstOrDefault(x => x.Username.ToLower() == username.ToLower());

            if (dbUser != null)
            {
                player.Emit("client:login:modal", "Fehler", "Dieser Benutzername ist bereits vergeben!");
                return(Task.CompletedTask);
            }
            //hash pw
            var hashedPw = BCrypt.Net.BCrypt.HashString(password);

            Console.WriteLine("161");
            //create user
            var newUser = new Users()
            {
                Username = username, Password = hashedPw
            };

            //emit client success
            player.Emit("server:register:finished");

            //add to db
            Main.database.UserCollection.InsertOne(newUser);
            Console.WriteLine("170");
            var Clothes = new Clothing()
            {
                Mask = new Component()
                {
                    drawableId = 0, colorId = 0
                },
                Torso = new Component()
                {
                    drawableId = 0, colorId = 0
                },
                Legs = new Component()
                {
                    drawableId = 0, colorId = 0
                },
                Bag = new Component()
                {
                    drawableId = 0, colorId = 0
                },
                Shoes = new Component()
                {
                    drawableId = 0, colorId = 0
                },
                Accessoires = new Component()
                {
                    drawableId = 0, colorId = 0
                },
                Undershirt = new Component()
                {
                    drawableId = 0, colorId = 0
                },
                Armor = new Component()
                {
                    drawableId = 0, colorId = 0
                },
                Decals = new Component()
                {
                    drawableId = 0, colorId = 0
                },
                Tops = new Component()
                {
                    drawableId = 0, colorId = 0
                },
                Hats = new Component()
                {
                    drawableId = 0, colorId = 0
                },
                Glasses = new Component()
                {
                    drawableId = 0, colorId = 0
                },
                Ears = new Component()
                {
                    drawableId = 0, colorId = 0
                },
                Watches = new Component()
                {
                    drawableId = 0, colorId = 0
                },
                Bracelets = new Component()
                {
                    drawableId = 0, colorId = 0
                },
            };

            Console.WriteLine("190");
            var charList = Main.database.CharacterCollection.AsQueryable().ToList();
            int nextPlayerId;

            if (charList.Count == 0)
            {
                nextPlayerId = 1;
            }
            else
            {
                nextPlayerId = charList.Last().playerId + 1;
            }



            bool numberNotExisting = false;
            int  nummer            = 0;

            Console.WriteLine("197");
            do
            {
                var rand = new Random();
                nummer = rand.Next(10000, 99999);

                var nummerExists = Main.database.CharacterCollection.AsQueryable().Where(c => c.Number == nummer);
                if (nummerExists != null)
                {
                    numberNotExisting = true;
                }
            } while (!numberNotExisting);

            Console.WriteLine("211");
            //create new char
            var newChar = new Characters()
            {
                ownerObjId = newUser.id, moneyHand = 5000, Clothes = Clothes, playerId = nextPlayerId, Inventar = new List <Item>(), Number = nummer
            };

            //create new Bankacc
            var nextKontoId = Main.database.BankCollection.AsQueryable().ToList().Count + 1;

            Console.WriteLine("217");
            var newBankAcc = new KontoCollection()
            {
                kontoNummer = nextKontoId, kontoPin = 0000, kontoStand = 0, objectOwnerId = newChar.id
            };

            Main.database.BankCollection.InsertOne(newBankAcc);
            Console.WriteLine("219");
            //add to db
            Main.database.CharacterCollection.InsertOne(newChar);
            player.playerId = newChar.playerId;
            player.uid      = newUser.id;


            Console.WriteLine("227");
            player.Spawn(new Position(-812.0f, 175.0f, 76f), 0);
            player.Rotation = new Rotation(0, 0, 102.1003189086914f);
            //start charcreator
            player.Emit("character:Edit");
            player.Dimension = player.Id;



            return(Task.CompletedTask);
        }
Пример #10
0
        public async Task ValidateLoginAsync(User player, string username, string password)
        {
            Users dbUser = Main.database.UserCollection.AsQueryable().FirstOrDefault(x => x.Username == username);

            if (dbUser == null)
            {
                return;
            }
            if (!BCrypt.Net.BCrypt.Verify(password, dbUser.Password))
            {
                player.Emit("client:login:modal", "Fehler", "Falsches Passwort!");
                return;
            }
            Characters dbChar   = Main.database.CharacterCollection.AsQueryable().FirstOrDefault(c => c.ownerObjId == dbUser.id);
            var        tempChar = dbChar;

            if (dbChar == null)
            {
                return;
            }

            if (!dbUser.IsWhitelisted)
            {
                player.Emit("client:login:modal", "Fehler", "Dieser Account ist noch nicht gewhitelisted!");
                return;
            }
            player.Username   = dbUser.Username;
            player.Dimension  = 0;
            player.adminLevel = dbUser.adminLevel;
            player.Model      = (uint)PedModel.FreemodeMale01;
            if (dbChar.charData.sex != null)
            {
                player.sex = dbChar.charData.sex.Value;
            }
            player.playerId = dbChar.playerId;
            if (dbChar.frakId.HasValue)
            {
                player.frakId = dbChar.frakId.Value;
            }
            player.Emit("server:login:finished");


            //an alter pos spawnen
            if (dbChar.pos_x.HasValue)
            {
                var chardata = JsonConvert.SerializeObject(dbChar.charData);
                player.Spawn(new Position(dbChar.pos_x.Value, dbChar.pos_y.Value, (dbChar.pos_z.Value + 0.1f)), 0);
                player.Emit("character:Sync", chardata, true);
            }
            else
            {
                player.Spawn(new Position(-1045.6171875f, -2750.943115234375f, 21.36341667175293f), 0);
                player.Rotation = new Rotation(0, 0, 326.61578369140625f);
            }
            if (dbChar.Clothes == null)
            {
                var Clothes = new Clothing()
                {
                    Mask = new Component()
                    {
                        drawableId = 0, colorId = 0
                    },
                    Torso = new Component()
                    {
                        drawableId = 0, colorId = 0
                    },
                    Legs = new Component()
                    {
                        drawableId = 0, colorId = 0
                    },
                    Bag = new Component()
                    {
                        drawableId = 0, colorId = 0
                    },
                    Shoes = new Component()
                    {
                        drawableId = 0, colorId = 0
                    },
                    Accessoires = new Component()
                    {
                        drawableId = 0, colorId = 0
                    },
                    Undershirt = new Component()
                    {
                        drawableId = 0, colorId = 0
                    },
                    Armor = new Component()
                    {
                        drawableId = 0, colorId = 0
                    },
                    Decals = new Component()
                    {
                        drawableId = 0, colorId = 0
                    },
                    Tops = new Component()
                    {
                        drawableId = 0, colorId = 0
                    },
                    Hats = new Component()
                    {
                        drawableId = 0, colorId = 0
                    },
                    Glasses = new Component()
                    {
                        drawableId = 0, colorId = 0
                    },
                    Ears = new Component()
                    {
                        drawableId = 0, colorId = 0
                    },
                    Watches = new Component()
                    {
                        drawableId = 0, colorId = 0
                    },
                    Bracelets = new Component()
                    {
                        drawableId = 0, colorId = 0
                    },
                };
                tempChar.Clothes = Clothes;
            }
            if (dbChar.Inventar == null)
            {
                tempChar.Inventar = new List <Item> {
                    new Item {
                        amount = 39, itemId = 1
                    }
                };
            }


            player.Emit("client:hud:displayNotify", "Erfolgreich eingeloggt!");
            player.Emit("SaltyChat_OnConnected");
            Alt.Emit("PlayerLoggedIn", player);

            player.uid            = dbUser.id;
            player.Health         = dbChar.health;
            player.Armor          = dbChar.armor;
            player.paintballArena = 0;

            var tempUser = dbUser;

            tempUser.lastLogin = System.DateTime.Now.ToLocalTime().ToString("dd.MM.yyyy HH:mm:ss");
            tempChar.isOnline  = true;


            await Main.database.CharacterCollection.ReplaceOneAsync(c => c.ownerObjId == player.uid, tempChar);

            await Main.database.UserCollection.ReplaceOneAsync(x => x.Username == username, tempUser);

            var itemshopList    = JsonConvert.SerializeObject(itemShopInteraction.shopList);
            var garageList      = JsonConvert.SerializeObject(GarageInteractions.garageList);
            var tankstellenList = JsonConvert.SerializeObject(fuelStationInteract.fuelStationList);
            var vehshopList     = JsonConvert.SerializeObject(VehShopInteraction.vehShops);

            var discountStoreList = JsonConvert.SerializeObject(ClothingStoreInteraction.clothingStores.Where(c => c.storeType == 3));
            var suburbanList      = JsonConvert.SerializeObject(ClothingStoreInteraction.clothingStores.Where(c => c.storeType == 2));
            var ponsonlist        =
                JsonConvert.SerializeObject(ClothingStoreInteraction.clothingStores.Where(c => c.storeType == 1));

            var frakgaragelist = JsonConvert.SerializeObject(FrakGarageInteraction.frakGarages);
            var frakNpcList    = JsonConvert.SerializeObject(FrakNPCInteraction.frakNPCList);
            var ammunationList = JsonConvert.SerializeObject(AmmunationInteraction.AmmunationList);

            player.Emit("client:interactions:loadGarage", garageList);
            player.Emit("client:interactions:loadShops", itemshopList);
            player.Emit("client:interactions:loadFuelstations", tankstellenList);
            player.Emit("client:interactions:loadClothingStores", discountStoreList, suburbanList, ponsonlist);
            player.Emit("client:interactions:loadCarDealers", vehshopList);
            player.Emit("client:interactions:loadFrakGarages", frakgaragelist);
            player.Emit("client:interactions:loadFrakNPCs", frakNpcList);
            player.Emit("client:interactions:loadAmmunations", ammunationList);

            player.Emit("server:createHud", dbChar.moneyHand);

            await Utils.Utils.LoadClothes(player, dbChar);

            player.SetStreamSyncedMetaData("sharedUsername", dbChar.firstName + " " + dbChar.lastName);
            player.SetSyncedMetaData("ADMINLEVEL", dbUser.adminLevel);
            player.SetStreamSyncedMetaData("sharedId", dbChar.playerId);
            player.IsJobDuty = false;
        }
Пример #11
0
 private void OnClothingChanged(Clothing clothing)
 {
     ChangeAnimation();
 }
Пример #12
0
        private Dictionary <ISalable, int[]> sandyShopStock()
        {
            Dictionary <ISalable, int[]> dictionary = new Dictionary <ISalable, int[]>();

            Utility.AddStock(dictionary, (Item) new Object(802, int.MaxValue),
                             (int)(75.0 * (double)Game1.MasterPlayer.difficultyModifier));
            Utility.AddStock(dictionary, (Item) new Object(478, int.MaxValue));
            Utility.AddStock(dictionary, (Item) new Object(486, int.MaxValue));
            Utility.AddStock(dictionary, (Item) new Object(494, int.MaxValue));
            Dictionary <ISalable, int[]> stock = dictionary;
            Object @object = new Object(Vector2.Zero, 196);

            @object.Stack = int.MaxValue;
            Utility.AddStock(stock, (Item)@object);
            switch (Game1.dayOfMonth % 7)
            {
            case 0:
                Utility.AddStock(dictionary, (Item) new Object(233, int.MaxValue));
                break;

            case 1:
                Utility.AddStock(dictionary, (Item) new Object(88, 1), 200, 10);
                break;

            case 2:
                Utility.AddStock(dictionary, (Item) new Object(90, int.MaxValue));
                break;

            case 3:
                Utility.AddStock(dictionary, (Item) new Object(749, 1), 500, 3);
                break;

            case 4:
                Utility.AddStock(dictionary, (Item) new Object(466, int.MaxValue));
                break;

            case 5:
                Utility.AddStock(dictionary, (Item) new Object(340, int.MaxValue));
                break;

            case 6:
                Utility.AddStock(dictionary, (Item) new Object(371, int.MaxValue), 100);
                break;
            }

            Random   random   = new Random((int)Game1.stats.DaysPlayed + (int)Game1.uniqueIDForThisGame / 2);
            Clothing clothing = new Clothing(1000 + random.Next((int)sbyte.MaxValue));

            dictionary.Add((ISalable)clothing, new int[2]
            {
                1000,
                int.MaxValue
            });
            dictionary.Add((ISalable) new Furniture(2655, Vector2.Zero), new int[2]
            {
                700,
                int.MaxValue
            });
            switch (Game1.dayOfMonth % 7)
            {
            case 0:
                dictionary.Add((ISalable) new Furniture(2720, Vector2.Zero), new int[2]
                {
                    3000,
                    int.MaxValue
                });
                break;

            case 1:
                dictionary.Add((ISalable) new Furniture(2802, Vector2.Zero), new int[2]
                {
                    2000,
                    int.MaxValue
                });
                break;

            case 2:
                dictionary.Add((ISalable) new Furniture(2734 + random.Next(4) * 2, Vector2.Zero), new int[2]
                {
                    500,
                    int.MaxValue
                });
                break;

            case 3:
                dictionary.Add((ISalable) new Furniture(2584, Vector2.Zero), new int[2]
                {
                    5000,
                    int.MaxValue
                });
                break;

            case 4:
                dictionary.Add((ISalable) new Furniture(2794, Vector2.Zero), new int[2]
                {
                    2500,
                    int.MaxValue
                });
                break;

            case 5:
                dictionary.Add((ISalable) new Furniture(2784, Vector2.Zero), new int[2]
                {
                    2500,
                    int.MaxValue
                });
                break;

            case 6:
                dictionary.Add((ISalable) new Furniture(2748, Vector2.Zero), new int[2]
                {
                    500,
                    int.MaxValue
                });
                dictionary.Add((ISalable) new Furniture(2812, Vector2.Zero), new int[2]
                {
                    500,
                    int.MaxValue
                });
                break;
            }

            Game1.player.team.synchronizedShopStock.UpdateLocalStockWithSyncedQuanitities(
                SynchronizedShopStock.SynchedShop.Sandy, dictionary);
            return(dictionary);
        }
Пример #13
0
        public VendorClothing GetVariantFromVendorClothings(List <VendorClothing> vendorClothings, Clothing clothingVariant)
        {
            // Get by type, color, and size
            VendorClothing vendorClothing = vendorClothings.FirstOrDefault(x =>
                                                                           x.Clothing.GetType() == clothingVariant.GetType() &&
                                                                           x.Clothing.Color == clothingVariant.Color &&
                                                                           x.Clothing.Size == clothingVariant.Size);

            return(vendorClothing);
        }
Пример #14
0
    // -------------- Class constructor --------------
    public Player(DBPlayer player, string token) // gets the html from server, sets up player data
    {
        Username = player.username;
        Token    = token;

        // -------- load all the info into the private fields, DBPlayer loses referance and dies afterwards --------
        // Equipment
        Debug.Log("Right hand: " + player.equipped[5]);
        equipped = player.equipped;
        foreach (string name in player.clothing)   // Clothing
        {
            if (clothing.ContainsKey(name))
            {
                clothing[name].NewCount(clothing[name].HowMany() + 1);
            }
            else
            {
                clothing[name] = new Clothing(this, name, game.equipments["Clothing"][name]);
            }
        }

        foreach (string name in player.weapons)   // Weapons
        {
            if (weapons.ContainsKey(name))
            {
                weapons[name].NewCount(weapons[name].HowMany() + 1);
            }
            else
            {
                weapons[name] = new Weapon(this, name, game.equipments["Weapons"][name]);
            }
        }

        foreach (string name in player.items)   // Items
        {
            if (items.ContainsKey(name))
            {
                items[name].NewCount(items[name].HowMany() + 1);
            }
            else
            {
                items[name] = new Item(this, name, game.equipments["Items"][name]);
            }
        }

        // stats
        gold        = player.gold;
        score       = player.score;
        chosenTitle = player.chosenTitle;
        titles      = new List <string>(player.titles);

        // quests
        mainProgress = player.questProg;
        for (int i = 0; i < player.optionalQuests.Length; i++)
        {
            optionalQuests[player.optionalQuests[i]] = player.optionalProg[i];
        }

        // skills
        foreach (string name in player.magicSpells)
        {
            magicSpells[name] = new Magic(name);
        }
        foreach (string name in player.attackSkills)
        {
            attackSkills[name] = new Attack(name);
        }
        foreach (string name in player.playerAbilities)
        {
            playerAbilities[name] = new Skill(name);
        }

        ReCalculate(); // get new stats and all for player before slapping them into the game

        hp[1]      = hp[0];
        mana[1]    = mana[0];
        stamina[1] = stamina[0];
    }
Пример #15
0
        public static void DoWindowContents(Rect inRect)
        {
            Listing_Standard listingStandard = new Listing_Standard();

            listingStandard.ColumnWidth = inRect.width / 3.15f;
            listingStandard.Begin(inRect);
            listingStandard.Gap(4f);
            listingStandard.Label("SexTypeFrequency".Translate());
            listingStandard.Gap(6f);
            listingStandard.Label("  " + "vaginal".Translate() + ": " + Math.Round(vaginal * 100, 0), -1, "vaginal_desc".Translate());
            vaginal = listingStandard.Slider(vaginal, 0.01f, 3.0f);
            listingStandard.Label("  " + "anal".Translate() + ": " + Math.Round(anal * 100, 0), -1, "anal_desc".Translate());
            anal = listingStandard.Slider(anal, 0.01f, 3.0f);
            listingStandard.Label("  " + "double_penetration".Translate() + ": " + Math.Round(double_penetration * 100, 0), -1, "double_penetration_desc".Translate());
            double_penetration = listingStandard.Slider(double_penetration, 0.01f, 3.0f);
            listingStandard.Label("  " + "f******o".Translate() + ": " + Math.Round(f******o * 100, 0), -1, "fellatio_desc".Translate());
            f******o = listingStandard.Slider(f******o, 0.01f, 3.0f);
            listingStandard.Label("  " + "cunnilingus".Translate() + ": " + Math.Round(cunnilingus * 100, 0), -1, "cunnilingus_desc".Translate());
            cunnilingus = listingStandard.Slider(cunnilingus, 0.01f, 3.0f);
            listingStandard.Label("  " + "rimming".Translate() + ": " + Math.Round(rimming * 100, 0), -1, "rimming_desc".Translate());
            rimming = listingStandard.Slider(rimming, 0.01f, 3.0f);
            listingStandard.Label("  " + "sixtynine".Translate() + ": " + Math.Round(sixtynine * 100, 0), -1, "sixtynine_desc".Translate());
            sixtynine = listingStandard.Slider(sixtynine, 0.01f, 3.0f);
            listingStandard.CheckboxLabeled("FapEverywhere".Translate(), ref FapEverywhere, "FapEverywhere_desc".Translate());
            listingStandard.CheckboxLabeled("FapInBed".Translate(), ref FapInBed, "FapInBed_desc".Translate());

            listingStandard.NewColumn();
            listingStandard.Gap(4f);
            if (listingStandard.ButtonText("Reset".Translate()))
            {
                vaginal             = 1.20f;
                anal                = 0.80f;
                f******o            = 0.80f;
                cunnilingus         = 0.80f;
                rimming             = 0.40f;
                double_penetration  = 0.60f;
                breastjob           = 0.50f;
                handjob             = 0.80f;
                mutual_masturbation = 0.70f;
                fingering           = 0.50f;
                footjob             = 0.30f;
                scissoring          = 0.50f;
                fisting             = 0.30f;
                sixtynine           = 0.69f;
            }
            listingStandard.Gap(6f);
            listingStandard.Label("  " + "breastjob".Translate() + ": " + Math.Round(breastjob * 100, 0), -1, "breastjob_desc".Translate());
            breastjob = listingStandard.Slider(breastjob, 0.01f, 3.0f);
            listingStandard.Label("  " + "handjob".Translate() + ": " + Math.Round(handjob * 100, 0), -1, "handjob_desc".Translate());
            handjob = listingStandard.Slider(handjob, 0.01f, 3.0f);
            listingStandard.Label("  " + "fingering".Translate() + ": " + Math.Round(fingering * 100, 0), -1, "fingering_desc".Translate());
            fingering = listingStandard.Slider(fingering, 0.01f, 3.0f);
            listingStandard.Label("  " + "fisting".Translate() + ": " + Math.Round(fisting * 100, 0), -1, "fisting_desc".Translate());
            fisting = listingStandard.Slider(fisting, 0.01f, 3.0f);
            listingStandard.Label("  " + "mutual_masturbation".Translate() + ": " + Math.Round(mutual_masturbation * 100, 0), -1, "mutual_masturbation_desc".Translate());
            mutual_masturbation = listingStandard.Slider(mutual_masturbation, 0.01f, 3.0f);
            listingStandard.Label("  " + "footjob".Translate() + ": " + Math.Round(footjob * 100, 0), -1, "footjob_desc".Translate());
            footjob = listingStandard.Slider(footjob, 0.01f, 3.0f);
            listingStandard.Label("  " + "scissoring".Translate() + ": " + Math.Round(scissoring * 100, 0), -1, "scissoring_desc".Translate());
            scissoring = listingStandard.Slider(scissoring, 0.01f, 3.0f);

            if (listingStandard.ButtonText("Malesex".Translate() + Malesex.ToString()))
            {
                Find.WindowStack.Add(new FloatMenu(new List <FloatMenuOption>()
                {
                    new FloatMenuOption("AllowedSex.All".Translate(), (() => Malesex = AllowedSex.All)),
                    new FloatMenuOption("AllowedSex.H**o".Translate(), (() => Malesex = AllowedSex.H**o)),
                    new FloatMenuOption("AllowedSex.Nohomo".Translate(), (() => Malesex = AllowedSex.Nohomo))
                }));
            }
            if (listingStandard.ButtonText("FeMalesex".Translate() + FeMalesex.ToString()))
            {
                Find.WindowStack.Add(new FloatMenu(new List <FloatMenuOption>()
                {
                    new FloatMenuOption("AllowedSex.All".Translate(), (() => FeMalesex = AllowedSex.All)),
                    new FloatMenuOption("AllowedSex.H**o".Translate(), (() => FeMalesex = AllowedSex.H**o)),
                    new FloatMenuOption("AllowedSex.Nohomo".Translate(), (() => FeMalesex = AllowedSex.Nohomo))
                }));
            }

            listingStandard.NewColumn();
            listingStandard.Gap(4f);
            // TODO: Add translation
            if (listingStandard.ButtonText("SexClothing".Translate() + sex_wear.ToString()))
            {
                Find.WindowStack.Add(new FloatMenu(new List <FloatMenuOption>()
                {
                    new FloatMenuOption("SexClothingNude".Translate(), (() => sex_wear = Clothing.Nude)),
                    new FloatMenuOption("SexClothingHeadwear".Translate(), (() => sex_wear = Clothing.Headgear)),
                    new FloatMenuOption("SexClothingFull".Translate(), (() => sex_wear = Clothing.Clothed))
                }));
            }
            listingStandard.Gap(4f);
            if (listingStandard.ButtonText("RapeAttemptAlert".Translate() + rape_attempt_alert.ToString()))
            {
                Find.WindowStack.Add(new FloatMenu(new List <FloatMenuOption>()
                {
                    new FloatMenuOption("RapeAttemptAlertAlways".Translate(), (() => rape_attempt_alert = RapeAlert.Enabled)),
                    new FloatMenuOption("RapeAttemptAlertHumanlike".Translate(), (() => rape_attempt_alert = RapeAlert.Humanlikes)),
                    new FloatMenuOption("RapeAttemptAlertColonist".Translate(), (() => rape_attempt_alert = RapeAlert.Colonists)),
                    new FloatMenuOption("RapeAttemptAlertSilent".Translate(), (() => rape_attempt_alert = RapeAlert.Silent)),
                    new FloatMenuOption("RapeAttemptAlertDisabled".Translate(), (() => rape_attempt_alert = RapeAlert.Disabled))
                }));
            }
            if (listingStandard.ButtonText("RapeAlert".Translate() + rape_alert.ToString()))
            {
                Find.WindowStack.Add(new FloatMenu(new List <FloatMenuOption>()
                {
                    new FloatMenuOption("RapeAlertAlways".Translate(), (() => rape_alert = RapeAlert.Enabled)),
                    new FloatMenuOption("RapeAlertHumanlike".Translate(), (() => rape_alert = RapeAlert.Humanlikes)),
                    new FloatMenuOption("RapeAlertColonist".Translate(), (() => rape_alert = RapeAlert.Colonists)),
                    new FloatMenuOption("RapeAlertSilent".Translate(), (() => rape_alert = RapeAlert.Silent)),
                    new FloatMenuOption("RapeAlertDisabled".Translate(), (() => rape_alert = RapeAlert.Disabled))
                }));
            }
            listingStandard.CheckboxLabeled("RapeAlertCP".Translate(), ref ShowForCP, "RapeAlertCP_desc".Translate());
            listingStandard.CheckboxLabeled("RapeAlertBreeding".Translate(), ref ShowForBreeding, "RapeAlertBreeding_desc".Translate());

            listingStandard.Gap(26f);
            listingStandard.Label("SexualitySpread1".Translate(), -1, "SexualitySpread2".Translate());
            if (listingStandard.ButtonText(sexuality_distribution.ToString()))
            {
                Find.WindowStack.Add(new FloatMenu(new List <FloatMenuOption>()
                {
                    new FloatMenuOption("Vanilla", () => sexuality_distribution = Rjw_sexuality.Vanilla),
                    //new FloatMenuOption("RimJobWorld", () => sexuality_distribution = Rjw_sexuality.RimJobWorld),
                    new FloatMenuOption("SYRIndividuality", () => sexuality_distribution = Rjw_sexuality.SYRIndividuality),
                    new FloatMenuOption("Psychology", () => sexuality_distribution       = Rjw_sexuality.Psychology)
                }));
            }
            if (sexuality_distribution == Rjw_sexuality.RimJobWorld)
            {
                listingStandard.Label("SexualityAsexual".Translate() + Math.Round((asexual_ratio / GetTotal()) * 100, 1) + "%", -1, "SexualityAsexual_desc".Translate());
                asexual_ratio = listingStandard.Slider(asexual_ratio, 0.0f, 1.0f);
                listingStandard.Label("SexualityPansexual".Translate() + Math.Round((pansexual_ratio / GetTotal()) * 100, 1) + "%", -1, "SexualityPansexual_desc".Translate());
                pansexual_ratio = listingStandard.Slider(pansexual_ratio, 0.0f, 1.0f);
                listingStandard.Label("SexualityHeterosexual".Translate() + Math.Round((heterosexual_ratio / GetTotal()) * 100, 1) + "%", -1, "SexualityHeterosexual_desc".Translate());
                heterosexual_ratio = listingStandard.Slider(heterosexual_ratio, 0.0f, 1.0f);
                listingStandard.Label("SexualityBisexual".Translate() + Math.Round((bisexual_ratio / GetTotal()) * 100, 1) + "%", -1, "SexualityBisexual_desc".Translate());
                bisexual_ratio = listingStandard.Slider(bisexual_ratio, 0.0f, 1.0f);
                listingStandard.Label("SexualityGay".Translate() + Math.Round((homosexual_ratio / GetTotal()) * 100, 1) + "%", -1, "SexualityGay_desc".Translate());
                homosexual_ratio = listingStandard.Slider(homosexual_ratio, 0.0f, 1.0f);
            }
            else
            {
                if (!xxx.IndividualityIsActive && sexuality_distribution == Rjw_sexuality.SYRIndividuality)
                {
                    sexuality_distribution = Rjw_sexuality.Vanilla;
                }
                else if (sexuality_distribution == Rjw_sexuality.SYRIndividuality)
                {
                    listingStandard.Label("SexualitySpreadIndividuality".Translate());
                }

                else if (!xxx.PsychologyIsActive && sexuality_distribution == Rjw_sexuality.Psychology)
                {
                    sexuality_distribution = Rjw_sexuality.Vanilla;
                }
                else if (sexuality_distribution == Rjw_sexuality.Psychology)
                {
                    listingStandard.Label("SexualitySpreadPsychology".Translate());
                }

                else
                {
                    listingStandard.Label("SexualitySpreadVanilla".Translate());
                }
            }
            listingStandard.Label("MaxQuirks".Translate() + ": " + MaxQuirks, -1f, "MaxQuirks_desc".Translate());
            MaxQuirks = (int)listingStandard.Slider(MaxQuirks, 0, 10);

            listingStandard.End();
        }
Пример #16
0
 public Clothing(Clothing cloth)
 {
     this.id = cloth.id;
     this.texture = cloth.texture;
     this.description = cloth.description;
 }
Пример #17
0
        public void Clothing_getDamage()
        {
            Item w = new Clothing("WhatAreYouDoing");

            Assert.AreEqual(10, w.Damage);
        }
Пример #18
0
        public override List <Item> getExtraDropItems()
        {
            List <Item> extraDrops = new List <Item>();

            if ((bool)cursedDoll && Game1.random.NextDouble() < 0.1429 && (bool)hauntedSkull)
            {
                switch (Game1.random.Next(11))
                {
                case 0:
                    switch (Game1.random.Next(6))
                    {
                    case 0:
                    {
                        Clothing v2 = new Clothing(10);
                        v2.clothesColor.Value = Color.DimGray;
                        extraDrops.Add(v2);
                        break;
                    }

                    case 1:
                        extraDrops.Add(new Clothing(1004));
                        break;

                    case 2:
                        extraDrops.Add(new Clothing(1014));
                        break;

                    case 3:
                        extraDrops.Add(new Clothing(1263));
                        break;

                    case 4:
                        extraDrops.Add(new Clothing(1262));
                        break;

                    case 5:
                    {
                        Clothing v2 = new Clothing(12);
                        v2.clothesColor.Value = Color.DimGray;
                        extraDrops.Add(v2);
                        break;
                    }
                    }
                    break;

                case 1:
                    extraDrops.Add(new MeleeWeapon(2));
                    break;

                case 2:
                    extraDrops.Add(new Object(288, 1));
                    break;

                case 3:
                    extraDrops.Add(new Ring(534));
                    break;

                case 4:
                    extraDrops.Add(new Ring(531));
                    break;

                case 5:
                    do
                    {
                        extraDrops.Add(new Object(768, 1));
                        extraDrops.Add(new Object(769, 1));
                    }while (Game1.random.NextDouble() < 0.33);
                    break;

                case 6:
                    extraDrops.Add(new Object(581, 1));
                    break;

                case 7:
                    extraDrops.Add(new Object(582, 1));
                    break;

                case 8:
                    extraDrops.Add(new Object(725, 1));
                    break;

                case 9:
                    extraDrops.Add(new Object(86, 1));
                    break;

                case 10:
                    if (Utility.doesMasterPlayerHaveMailReceivedButNotMailForTomorrow("ccVault"))
                    {
                        extraDrops.Add(new Object(275, 1));
                    }
                    else
                    {
                        extraDrops.Add(new Object(749, 1));
                    }
                    break;
                }
                return(extraDrops);
            }
            if ((bool)hauntedSkull && Game1.random.NextDouble() < 0.25 && Game1.currentSeason == "winter")
            {
                do
                {
                    extraDrops.Add(new Object(273, 1));
                }while (Game1.random.NextDouble() < 0.4);
            }
            if ((bool)hauntedSkull && Game1.random.NextDouble() < 0.001502)
            {
                extraDrops.Add(new Object(279, 1));
            }
            if (extraDrops.Count > 0)
            {
                return(extraDrops);
            }
            return(base.getExtraDropItems());
        }
Пример #19
0
        protected void grdInventorySearched_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            bool bolAdded = false;

            if (Session["ItemsInCart"] != null)
            {
                itemsInCart = (List <Cart>)Session["ItemsInCart"];
            }
            int itemKey = Convert.ToInt32(e.CommandArgument.ToString());

            if (e.CommandName == "AddItem")
            {
                foreach (var cart in itemsInCart)
                {
                    if (cart.sku == itemKey && !bolAdded)
                    {
                        cart.quantity = cart.quantity + 1;
                        bolAdded      = true;
                    }
                }

                //int locationID = Convert.ToInt32(lblLocationID.Text);
                int locationID = 0;
                //Finding the min and max range for trade ins
                int[] range = idu.tradeInSkuRange(locationID);

                //If the itemKey is between or equal to the ranges, do trade in
                if (itemKey >= range[0] && itemKey < range[1])
                {
                    //Trade In Sku to add in SK
                    string redirect = "<script>window.open('TradeINEntry.aspx');</script>";
                    Response.Write(redirect);
                }
                else if (itemsInCart.Count == 0 || !bolAdded)
                {
                    Clubs       c  = ssm.singleItemLookUp(itemKey);
                    Clothing    cl = ssm.getClothing(itemKey);
                    Accessories ac = ssm.getAccessory(itemKey);
                    if (c.sku != 0)
                    {
                        o = c as Object;
                    }
                    else if (cl.sku != 0)
                    {
                        o = cl as Object;
                    }
                    else if (ac.sku != 0)
                    {
                        o = ac as Object;
                    }
                    itemsInCart.Add(idu.addingToCart(o));
                }
            }
            Session["ItemsInCart"]  = itemsInCart;
            grdCartItems.DataSource = itemsInCart;
            grdCartItems.DataBind();
            List <Items> nullGrid = new List <Items>();

            nullGrid = null;
            grdInventorySearched.DataSource = nullGrid;
            grdInventorySearched.DataBind();
            lblSubtotalDisplay.Text = "$ " + ssm.returnSubtotalAmount(itemsInCart).ToString("#.00");
        }
Пример #20
0
 public void UpdateClothing(Clothing clothing)
 {
     clothingRepository.Update(clothing);
 }
Пример #21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["itemKey"] != null)
            {
                if (!IsPostBack)
                {
                    string itemType = Session["itemType"].ToString();
                    int    itemSKU  = Convert.ToInt32(Session["itemKey"].ToString());
                    lblTypeDisplay.Text = itemType;
                    if (itemType == "Clubs")
                    {
                        c = ssm.singleItemLookUp(itemSKU);
                        lblSKUDisplay.Text      = c.sku.ToString();
                        lblCostDisplay.Text     = c.cost.ToString();
                        lblBrandDisplay.Text    = idu.brandType(c.brandID);
                        lblPriceDisplay.Text    = c.price.ToString();
                        lblQuantityDisplay.Text = c.quantity.ToString();
                        lblPremiumDisplay.Text  = c.premium.ToString();

                        lblClubTypeDisplay.Text      = c.clubType.ToString();
                        lblModelDisplay.Text         = idu.modelType(c.modelID);
                        lblShaftDisplay.Text         = c.shaft.ToString();
                        lblNumberofClubsDisplay.Text = c.numberOfClubs.ToString();
                        lblClubSpecDisplay.Text      = c.clubSpec.ToString();
                        lblShaftSpecDisplay.Text     = c.shaftSpec.ToString();
                        lblShaftFlexDisplay.Text     = c.shaftFlex.ToString();
                        lblDexterityDisplay.Text     = c.dexterity.ToString();
                        chkUsed.Checked         = c.used;
                        lblCommentsDisplay.Text = c.comments.ToString();
                    }
                    else if (itemType == "Accessories")
                    {
                        a = ssm.getAccessory(itemSKU);
                        lblSKUDisplay.Text        = a.sku.ToString();
                        lblCostDisplay.Text       = a.cost.ToString();
                        lblBrandDisplay.Text      = idu.brandType(a.brandID);
                        lblPriceDisplay.Text      = a.price.ToString();
                        lblQuantityDisplay.Text   = a.quantity.ToString();
                        txtPremium.Visible        = false;
                        lblPremiumDisplay.Visible = false;

                        lblClubType.Text                = "Size: ";
                        lblClubTypeDisplay.Text         = a.size.ToString();
                        lblModel.Visible                = false;
                        lblModelDisplay.Visible         = false;
                        lblShaft.Text                   = "Colour: ";
                        lblShaftDisplay.Text            = a.colour.ToString();
                        lblNumberofClubs.Visible        = false;
                        lblNumberofClubsDisplay.Visible = false;
                        lblClubSpec.Visible             = false;
                        lblClubSpecDisplay.Visible      = false;
                        lblShaftSpec.Visible            = false;
                        lblShaftSpecDisplay.Visible     = false;
                        lblShaftFlex.Visible            = false;
                        lblShaftFlexDisplay.Visible     = false;
                        lblDexterity.Visible            = false;
                        lblDexterityDisplay.Visible     = false;
                        lblComments.Visible             = false;
                        lblCommentsDisplay.Visible      = false;
                        chkUsed.Visible                 = false;
                    }
                    else if (itemType == "Clothing")
                    {
                        cl = ssm.getClothing(itemSKU);
                        lblSKUDisplay.Text        = cl.sku.ToString();
                        lblCostDisplay.Text       = cl.cost.ToString();
                        lblBrandDisplay.Text      = idu.brandType(cl.brandID);
                        lblPriceDisplay.Text      = cl.price.ToString();
                        lblQuantityDisplay.Text   = cl.quantity.ToString();
                        txtPremium.Visible        = false;
                        lblPremiumDisplay.Visible = false;

                        lblClubType.Text                = "Size: ";
                        lblClubTypeDisplay.Text         = cl.size.ToString();
                        lblModel.Visible                = false;
                        lblModelDisplay.Visible         = false;
                        lblShaft.Text                   = "Colour: ";
                        lblShaftDisplay.Text            = cl.colour.ToString();
                        lblNumberofClubs.Visible        = false;
                        lblNumberofClubsDisplay.Visible = false;
                        lblClubSpec.Text                = "Gender: ";
                        lblClubSpecDisplay.Text         = cl.gender.ToString();
                        lblShaftFlex.Text               = "Style: ";
                        lblShaftFlexDisplay.Text        = cl.style.ToString();
                        lblShaftSpec.Visible            = false;
                        lblShaftSpecDisplay.Visible     = false;
                        lblDexterity.Visible            = false;
                        lblDexterityDisplay.Visible     = false;
                        lblComments.Visible             = false;
                        lblCommentsDisplay.Visible      = false;
                        chkUsed.Visible                 = false;
                    }
                }
            }
            else
            {
                ddlType.Visible        = true;
                lblTypeDisplay.Visible = false;

                txtCost.Visible        = true;
                lblCostDisplay.Visible = false;

                ddlBrand.Visible        = true;
                lblBrandDisplay.Visible = false;

                txtPrice.Visible        = true;
                lblPriceDisplay.Visible = false;

                txtQuantity.Visible        = true;
                lblQuantityDisplay.Visible = false;

                lblPremiumDisplay.Visible       = false;
                lblClubTypeDisplay.Visible      = false;
                lblModelDisplay.Visible         = false;
                lblShaftDisplay.Visible         = false;
                lblNumberofClubsDisplay.Visible = false;
                lblClubSpecDisplay.Visible      = false;
                lblShaftSpecDisplay.Visible     = false;
                lblShaftFlexDisplay.Visible     = false;
                lblDexterityDisplay.Visible     = false;
                lblCommentsDisplay.Visible      = false;

                //Accessories
                if (ddlType.SelectedIndex <= 0)
                {
                    lblPremium.Visible        = false;
                    lblPremiumDisplay.Visible = false;

                    lblClubType.Text         = "Size: ";
                    txtClubType.Visible      = true;
                    lblShaft.Text            = "Colour: ";
                    txtShaft.Visible         = true;
                    txtClubSpec.Visible      = false;
                    txtShaftFlex.Visible     = false;
                    chkUsed.Visible          = false;
                    lblModel.Visible         = false;
                    ddlModel.Visible         = false;
                    lblNumberofClubs.Visible = false;
                    txtNumberofClubs.Visible = false;
                    lblClubSpec.Visible      = false;
                    lblShaftSpec.Visible     = false;
                    txtShaftSpec.Visible     = false;
                    lblShaftFlex.Visible     = false;
                    lblDexterity.Visible     = false;
                    txtDexterity.Visible     = false;
                    lblComments.Visible      = false;
                    txtComments.Visible      = false;
                }
                //Clubs
                else if (ddlType.SelectedIndex == 2)
                {
                    lblPremium.Visible = true;
                    txtPremium.Visible = true;

                    txtClubType.Visible      = true;
                    ddlModel.Visible         = true;
                    txtShaft.Visible         = true;
                    txtNumberofClubs.Visible = true;
                    txtClubSpec.Visible      = true;
                    txtShaftSpec.Visible     = true;
                    txtShaftFlex.Visible     = true;
                    txtDexterity.Visible     = true;
                    txtComments.Visible      = true;
                    chkUsed.Enabled          = true;
                    lblClubType.Text         = "Club Type: ";
                    lblShaft.Text            = "Shaft: ";
                    lblClubSpec.Text         = "Club Spec: ";
                    lblClubSpec.Visible      = true;
                    lblShaftFlex.Text        = "Shaft Flex: ";
                    lblShaftFlex.Visible     = true;
                    lblModel.Visible         = true;
                    lblNumberofClubs.Visible = true;
                    lblShaftSpec.Visible     = true;
                    lblDexterity.Visible     = true;
                    lblComments.Visible      = true;
                    chkUsed.Visible          = true;
                }
                //Clothing
                else if (ddlType.SelectedIndex == 1)
                {
                    lblPremium.Visible        = false;
                    lblPremiumDisplay.Visible = false;

                    lblClubType.Text         = "Size: ";
                    txtClubType.Visible      = true;
                    lblShaft.Text            = "Colour: ";
                    txtShaft.Visible         = true;
                    lblClubSpec.Text         = "Gender: ";
                    lblClubSpec.Visible      = true;
                    txtClubSpec.Visible      = true;
                    lblShaftFlex.Text        = "Style: ";
                    lblShaftFlex.Visible     = true;
                    txtShaftFlex.Visible     = true;
                    chkUsed.Visible          = false;
                    txtPremium.Visible       = false;
                    ddlModel.Visible         = false;
                    txtNumberofClubs.Visible = false;
                    txtShaftSpec.Visible     = false;
                    txtDexterity.Visible     = false;
                    txtComments.Visible      = false;
                    lblShaftSpec.Visible     = false;
                    lblModel.Visible         = false;
                    lblNumberofClubs.Visible = false;
                    lblDexterity.Visible     = false;
                    lblComments.Visible      = false;
                }


                btnSaveItem.Visible            = false;
                btnAddItem.Visible             = true;
                pnlDefaultButton.DefaultButton = "btnAddItem";
                btnEditItem.Visible            = false;
                btnCancel.Visible       = false;
                btnBackToSearch.Visible = true;
            }
        }
Пример #22
0
        /// <summary>Raised after the day starts. Checks to see if it is raining. If yes, equips rain equipment.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event data.</param>
        private void OnDayStarted(object sender, DayStartedEventArgs e)
        {
            this.Monitor.Log("Rain Coat ID: " + this.rainCoatIndex, LogLevel.Debug);
            this.Monitor.Log("Gumboots ID: " + this.rainBootsIndex, LogLevel.Debug);
            this.Monitor.Log("Rain Hood ID: " + this.rainHatIndex, LogLevel.Debug);
            this.Monitor.Log($"Rain Coat ID transformed into Clothes: {new Clothing(this.rainCoatIndex).displayName}", LogLevel.Debug);
            this.Monitor.Log($"Rain Boots ID transformed into Boots: {new Boots(this.rainBootsIndex).DisplayName}", LogLevel.Debug);
            this.Monitor.Log($"Rain Hat ID transformed into Hat: {new Hat(this.rainHatIndex).DisplayName}", LogLevel.Debug);

            // ignore if player hasn't loaded a save yet
            if (!Context.IsWorldReady)
            {
                return;
            }

            // ignore if the rainy clothes aren't loaded
            if (!this.Helper.ModRegistry.IsLoaded("IMS.JA.RainyDayClothing"))
            {
                return;
            }

            try {
                foreach (Furniture furniture in Game1.player.currentLocation.furniture)
                {
                    if (furniture is StorageFurniture)
                    {
                        this.dresserList.Add(furniture as StorageFurniture);
                    }
                }
                foreach (KeyValuePair <Vector2, StardewValley.Object> pair in Game1.player.currentLocation.Objects.Pairs)
                {
                    if (pair.Value is Chest)
                    {
                        this.chestList.Add(pair.Value as Chest);
                    }
                }
            } catch (Exception exception)
            {
                this.Monitor.Log("Exception ocurred while attempting to store Game1.player.currentLocation furniture and Objects as Lists", LogLevel.Error);
                this.Monitor.Log(exception.Message);
                this.Monitor.Log(exception.StackTrace);
            }


            /*
             *
             *              public readonly NetRef<Clothing> shirtItem;
             *              public readonly NetRef<Boots> boots;
             *              public readonly NetRef<Hat> hat;
             *
             *              //note: changeShirt appears to use female/male tilesheet index, whereas the initialization uses something else
             *              public void changeShirt(int whichShirt, bool is_customization_screen = false);
             *              public void ConvertClothingOverrideToClothesItems();
             *
             *              public Color GetShirtColor();
             *              public List<string> GetShirtExtraData();
             *              public int GetShirtIndex();
             *
             *              public bool hasItemInInventory(int itemIndex, int quantity, int minPrice = 0);
             *              public bool hasItemInInventoryNamed(string name);
             *              public Item hasItemWithNameThatContains(string name);
             *
             *              public void removeFirstOfThisItemFromInventory(int parentSheetIndexOfItem);
             *              public void removeItemFromInventory(Item which);
             *              public Item removeItemFromInventory(int whichItemIndex);
             *              public bool removeItemsFromInventory(int index, int stack);
             */

            //When it is raining, equip Rain Hood, Coat, and Boots at start of day
            if (this.WeatherJustifiesRainCoat())
            {
                // Rain Coat!
                if (this.Config.RainCoatEnabled)
                {
                    // Look to see if the player owns a rain coat
                    bool ownsRainCoat = Game1.player.hasItemInInventoryNamed(RAIN_SHIRT_DISPLAY_NAME);
                    if (!ownsRainCoat)
                    {
                        // check to see if there is a rain coat in any nearby containers
                        ownsRainCoat = IsAnyRainItem(RAIN_SHIRT_DISPLAY_NAME);
                    }

                    // only change player into raincoat if one is available
                    if (ownsRainCoat)
                    {
                        // save current shirt for later retrieval (reequip at end of rainy day)
                        this.previousShirt = Game1.player.shirtItem.Value;
                        this.PutItemAway(this.previousShirt);

                        // Change current shirt to be rain coat!
                        Clothing raincoat = new Clothing(this.rainCoatIndex);
                        Game1.player.changeShirt(ConvertToMaleOrFemaleIndex(raincoat));
                        Game1.player.ConvertClothingOverrideToClothesItems();

                        // remove rain coat from inventory
                        this.RemoveItemFromInventoryOrContainer(raincoat as Item);
                    }
                }


                // Rain Hood!
                if (this.Config.RainHoodEnabled)
                {
                    // Look to see if the player owns a rain hood
                    bool ownsRainHood = Game1.player.hasItemInInventoryNamed(RAIN_HAT_DISPLAY_NAME);
                    if (!ownsRainHood)
                    {
                        ownsRainHood = IsAnyRainItem(RAIN_HAT_DISPLAY_NAME);
                    }

                    // only change player into rain hood if one is available
                    if (ownsRainHood)
                    {
                        // Ensure hat is not null (no need to save hat if there is none!)
                        if (Game1.player.hat.Value != null)
                        {
                            // save current hat for later retrieval (reequip at end of rainy day)
                            this.isWearingHat = true;
                            this.previousHat  = Game1.player.hat.Value;
                            // put previous hat into player's inventory or nearby dresser
                            this.PutItemAway(this.previousHat);
                        }
                        // Replace hat with rain hood
                        Game1.player.changeHat(this.rainHatIndex);

                        // Remove rain hood from inventory
                        this.RemoveItemFromInventoryOrContainer(new Hat(this.rainHatIndex) as Item);

                        //this.Monitor.Log($"CURRENT HAIR??: {Game1.player.hair}", LogLevel.Debug);
                        //TODO: add config option to force change hair on rainy days - hair 8 (index 7)
                        // Game1.player.changeHairStyle();
                    }
                }

                // Rain Boots!
                if (this.Config.RainBootsEnabled)
                {
                    // Step 0 - Look to see if the player owns rain booties (named Gumshoes)
                    bool ownsRainBooties = Game1.player.hasItemInInventoryNamed(RAIN_BOOTIES_DISPLAY_NAME);
                    if (!ownsRainBooties)
                    {
                        ownsRainBooties = IsAnyRainItem(RAIN_BOOTIES_DISPLAY_NAME);
                    }

                    // only change into rain booties if they are available
                    if (ownsRainBooties)
                    {
                        // Step 1 - take off old boots, put in nearby dresser or player's inventory
                        if (Game1.player.boots.Value != null && Game1.player.boots.Value.DisplayName != new Boots(this.rainBootsIndex).DisplayName)
                        {
                            this.previousBoots = Game1.player.boots.Value;
                            Game1.player.boots.Value.onUnequip();
                            // put boots into nearby dresser or player's inventory
                            this.PutItemAway(this.previousBoots);
                        }
                        // Step 2 - equip new boots (rain boots!)
                        Game1.player.boots.Value = new Boots(this.rainBootsIndex);
                        Game1.player.boots.Value.onEquip();

                        // Step 3 - remove rain boots from inventory
                        this.RemoveItemFromInventoryOrContainer(new Boots(this.rainBootsIndex) as Item);
                    }
                }

                if (this.Config.RainBootsEnabled || this.Config.RainCoatEnabled || this.Config.RainHoodEnabled)
                {
                    Game1.player.UpdateClothing();
                }
            }
            // clear these lists to ensure they stay up to date during each function exection
            this.dresserList.Clear();
            this.chestList.Clear();
        }
Пример #23
0
 public Person()
 {
     Clothing.Add(new ClothingItem("pajamas", ClothingType.Pajamas));
 }
Пример #24
0
            /// <summary>Generates an item described by a saved object.</summary>
            /// <param name="save">A saved object of the "Item" type.</param>
            /// <param name="tile">The object's intended tile location. Generally necessary for items derived from StardewValley.Object.</param>
            public static Item CreateItem(SavedObject save, Vector2 tile = default(Vector2))
            {
                switch (save.Type) //check the object's type
                {
                case SavedObject.ObjectType.Object:
                case SavedObject.ObjectType.Item:
                case SavedObject.ObjectType.Container:
                    //these are valid item types
                    break;

                default:
                    Monitor.Log($"Failed to create an item. Saved object does not appear to be an item.", LogLevel.Debug);
                    Monitor.Log($"Item name: {save.Name}", LogLevel.Debug);
                    return(null);
                }

                if (!save.ID.HasValue && save.Type != SavedObject.ObjectType.Container) //if this save doesn't have an ID (and isn't a container)
                {
                    Monitor.Log("Failed to create an item. Saved object contained no ID.", LogLevel.Debug);
                    Monitor.Log($"Item name: {save.Name}", LogLevel.Debug);
                    return(null);
                }

                Item       item       = null;            //the item to be generated
                ConfigItem configItem = save.ConfigItem; //the ConfigItem class describing the item (null if unavailable)

                //parse container contents, if applicable
                List <Item> contents = new List <Item>();

                if (save.Type == SavedObject.ObjectType.Container)                                                //if this is a container
                {
                    string             areaID       = $"[unknown; parsing chest contents at {save.MapName}]";     //placeholder string; this method has no easy access to the areaID that created a given item
                    List <SavedObject> contentSaves = ParseSavedObjectsFromItemList(configItem.Contents, areaID); //parse the contents into saved objects for validation purposes

                    foreach (SavedObject contentSave in contentSaves)                                             //for each successfully parsed save
                    {
                        Item content = CreateItem(contentSave);                                                   //call this method recursively to create this item
                        if (content != null)                                                                      //if this item was created successfully
                        {
                            contents.Add(content);                                                                //add it to the contents list
                        }
                    }
                }

                string category = "item";

                if (configItem != null && configItem.Category != null)
                {
                    category = configItem.Category.ToLower();
                }

                switch (category) //based on the category
                {
                case "barrel":
                case "barrels":
                    item = new BreakableContainerFTM(tile, contents, true);     //create a mineshaft-style breakable barrel with the given contents
                    break;

                case "bigcraftable":
                case "bigcraftables":
                case "big craftable":
                case "big craftables":
                    item = new StardewValley.Object(tile, save.ID.Value, false); //create an object as a "big craftable" item
                    if (configItem?.Stack > 1)                                   //if this item has a valid stack setting
                    {
                        item.Stack = configItem.Stack.Value;                     //apply it
                    }
                    break;

                case "boot":
                case "boots":
                    item = new Boots(save.ID.Value);
                    break;

                case "breakable":
                case "breakables":
                    bool barrel = RNG.Next(0, 2) == 0 ? true : false;     //randomly select whether this is a barrel or crate
                    if (configItem != null)
                    {
                        //rewrite the category to save the selection
                        if (barrel)
                        {
                            configItem.Category = "barrel";
                        }
                        else
                        {
                            configItem.Category = "crate";
                        }
                    }
                    item = new BreakableContainerFTM(tile, contents, barrel);     //create a mineshaft-style breakable container with the given contents
                    break;

                case "chest":
                case "chests":
                    item = new Chest(0, contents, tile, false, 0);     //create a mineshaft-style chest with the given contents
                    break;

                case "cloth":
                case "clothes":
                case "clothing":
                case "clothings":
                    item = new Clothing(save.ID.Value);
                    break;

                case "crate":
                case "crates":
                    item = new BreakableContainerFTM(tile, contents, false);     //create a mineshaft-style breakable crate with the given contents
                    break;

                case "furniture":
                    item = new Furniture(save.ID.Value, tile);
                    break;

                case "hat":
                case "hats":
                    item = new Hat(save.ID.Value);
                    break;

                case "object":
                case "objects":
                    item = new StardewValley.Object(tile, save.ID.Value, null, false, true, false, true);     //create an object with the preferred constructor for "placed" objects
                    break;

                case "item":
                case "items":
                    int stackSize = 1;
                    if (configItem?.Stack > 1)                                       //if this item has a valid stack setting
                    {
                        stackSize = configItem.Stack.Value;                          //apply it
                    }
                    item = new StardewValley.Object(tile, save.ID.Value, stackSize); //create an object with the preferred constructor for "held" or "dropped" items
                    break;

                case "ring":
                case "rings":
                    item = new Ring(save.ID.Value);
                    break;

                case "weapon":
                case "weapons":
                    item = new MeleeWeapon(save.ID.Value);
                    break;
                }

                if (item == null) //if no item could be generated
                {
                    Monitor.Log("Failed to create an item. Category setting was not recognized.", LogLevel.Debug);
                    Monitor.Log($"Item Category: {category}", LogLevel.Debug);
                    return(null);
                }

                if (save.ID.HasValue)                      //if this object type uses an ID
                {
                    item.ParentSheetIndex = save.ID.Value; //manually set this index value, due to it being ignored by some item subclasses
                }

                return(item);
            }
Пример #25
0
 /// <summary>
 /// Evaluates whether the person is wearing the specified type of clothing.
 /// </summary>
 /// <param name="clothingType">The clothing type to check for.</param>
 /// <returns>The boolean value indicating whether the person is wearing the passed clothing type.</returns>
 public bool IsWearing(ClothingType clothingType)
 {
     return(Clothing.Any(item => item.ClothingType == clothingType));
 }
        public void ImportNewItem(DataRow row, CurrentUser cu, object[] objPageDetails)
        {
            ItemDataUtilities IDU = new ItemDataUtilities();
            int    inventoryID    = 0;
            int    itemTypeID     = Convert.ToInt32(row[14]);
            string sku            = row[0].ToString();
            Object o = new Object();

            inventoryID = IDU.CheckIfSkuAlreadyInDatabase(sku, itemTypeID, objPageDetails);

            if (inventoryID > 0)
            {
                //Check for item in table
                if (itemTypeID == 1)
                {
                    Clubs club = new Clubs();
                    //if item type is club then save as club class
                    club.intInventoryID           = inventoryID;
                    club.fltCost                  = Convert.ToDouble(row[7]);
                    club.intBrandID               = Convert.ToInt32(row[1]);
                    club.fltPrice                 = Convert.ToDouble(row[8]);
                    club.intQuantity              = Convert.ToInt32(row[9]);
                    club.intLocationID            = Convert.ToInt32(row[15]);
                    club.varTypeOfClub            = row[3].ToString();
                    club.intModelID               = Convert.ToInt32(row[2]);
                    club.varShaftType             = row[4].ToString();
                    club.varNumberOfClubs         = row[5].ToString();
                    club.varClubSpecification     = row[10].ToString();
                    club.varShaftSpecification    = row[11].ToString();
                    club.varShaftFlexability      = row[12].ToString();
                    club.varClubDexterity         = row[13].ToString();
                    club.varAdditionalInformation = row[16].ToString();
                    club.bitIsUsedProduct         = Convert.ToBoolean(row[17]);
                    o = club as Object;
                }
                else if (itemTypeID == 2)
                {
                    Accessories accessory = new Accessories();
                    //if item type is accesory then save as accessory class
                    accessory.intInventoryID           = inventoryID;
                    accessory.intBrandID               = Convert.ToInt32(row[1]);
                    accessory.fltCost                  = Convert.ToDouble(row[7]);
                    accessory.fltPrice                 = Convert.ToDouble(row[8]);
                    accessory.intQuantity              = Convert.ToInt32(row[9]);
                    accessory.intLocationID            = Convert.ToInt32(row[15]);
                    accessory.varSize                  = row[5].ToString();
                    accessory.varColour                = row[4].ToString();
                    accessory.varTypeOfAccessory       = row[3].ToString();
                    accessory.intModelID               = Convert.ToInt32(row[2]);
                    accessory.varAdditionalInformation = row[16].ToString();
                    o = accessory as Object;
                }
                else if (itemTypeID == 3)
                {
                    Clothing clothing = new Clothing();
                    //if item type is clothing then save as clothing class
                    clothing.intInventoryID           = inventoryID;
                    clothing.intBrandID               = Convert.ToInt32(row[1]);
                    clothing.fltCost                  = Convert.ToDouble(row[7]);
                    clothing.fltPrice                 = Convert.ToDouble(row[8]);
                    clothing.intQuantity              = Convert.ToInt32(row[9]);
                    clothing.intLocationID            = Convert.ToInt32(row[15]);
                    clothing.varSize                  = row[5].ToString();
                    clothing.varColour                = row[4].ToString();
                    clothing.varGender                = row[10].ToString();
                    clothing.varStyle                 = row[3].ToString();
                    clothing.varAdditionalInformation = row[16].ToString();
                    o = clothing as Object;
                }
                IDU.UpdateItemInDatabase(o, objPageDetails);
            }
            else
            {
                if (itemTypeID == 1)
                {
                    Clubs club = new Clubs();
                    //Transfers all info into Club class
                    string[] inventoryInfo = IDU.CallReturnMaxSku(itemTypeID, cu.location.intLocationID, objPageDetails);
                    club.intInventoryID           = Convert.ToInt32(inventoryInfo[1]);
                    club.varSku                   = sku;
                    club.fltCost                  = Convert.ToDouble(row[7]);
                    club.intBrandID               = Convert.ToInt32(row[1]);
                    club.fltPrice                 = Convert.ToDouble(row[8]);
                    club.intQuantity              = Convert.ToInt32(row[9]);
                    club.intLocationID            = Convert.ToInt32(row[15]);
                    club.varTypeOfClub            = row[3].ToString();
                    club.intModelID               = Convert.ToInt32(row[2]);
                    club.varShaftType             = row[4].ToString();
                    club.varNumberOfClubs         = row[5].ToString();
                    club.varClubSpecification     = row[10].ToString();
                    club.varShaftSpecification    = row[11].ToString();
                    club.varShaftFlexability      = row[12].ToString();
                    club.varClubDexterity         = row[13].ToString();
                    club.bitIsUsedProduct         = Convert.ToBoolean(row[17]);
                    club.varAdditionalInformation = row[16].ToString();
                    club.intItemTypeID            = itemTypeID;
                    //stores club as an object
                    o = club as Object;
                }
                else if (itemTypeID == 2)
                {
                    Accessories accessory = new Accessories();
                    //Transfers all info into Accessory class
                    string[] inventoryInfo = IDU.CallReturnMaxSku(itemTypeID, cu.location.intLocationID, objPageDetails);
                    accessory.intInventoryID           = Convert.ToInt32(inventoryInfo[1]);
                    accessory.varSku                   = sku;
                    accessory.intBrandID               = Convert.ToInt32(row[1]);
                    accessory.intModelID               = Convert.ToInt32(row[2]);
                    accessory.fltCost                  = Convert.ToDouble(row[7]);
                    accessory.fltPrice                 = Convert.ToDouble(row[8]);
                    accessory.intQuantity              = Convert.ToInt32(row[9]);
                    accessory.intLocationID            = Convert.ToInt32(row[15]);
                    accessory.intItemTypeID            = itemTypeID;
                    accessory.varSize                  = row[5].ToString();
                    accessory.varColour                = row[4].ToString();
                    accessory.varTypeOfAccessory       = row[3].ToString();
                    accessory.varAdditionalInformation = row[16].ToString();
                    //stores accessory as an object
                    o = accessory as Object;
                }
                else if (itemTypeID == 3)
                {
                    Clothing clothing = new Clothing();
                    //Transfers all info into Clothing class
                    string[] inventoryInfo = IDU.CallReturnMaxSku(itemTypeID, cu.location.intLocationID, objPageDetails);
                    clothing.intInventoryID           = Convert.ToInt32(inventoryInfo[1]);
                    clothing.varSku                   = sku;
                    clothing.intBrandID               = Convert.ToInt32(row[1]);
                    clothing.fltCost                  = Convert.ToDouble(row[7]);
                    clothing.fltPrice                 = Convert.ToDouble(row[8]);
                    clothing.intQuantity              = Convert.ToInt32(row[9]);
                    clothing.intLocationID            = Convert.ToInt32(row[15]);
                    clothing.intItemTypeID            = itemTypeID;
                    clothing.varSize                  = row[5].ToString();
                    clothing.varColour                = row[4].ToString();
                    clothing.varGender                = row[10].ToString();
                    clothing.varStyle                 = row[3].ToString();
                    clothing.varAdditionalInformation = row[16].ToString();
                    //stores clothing as an object
                    o = clothing as Object;
                }
                IDU.AddNewItemToDatabase(o, objPageDetails);
            }
        }
Пример #27
0
        public static IEnumerable <string> RetrieveExampleList(string word)
        {
            word = word.ToLower();
            if (!word.StartsWith("something"))
            {
                if (word.StartsWith("the title") || word.StartsWith("a title"))
                {
                    word = word.Replace("the title ", string.Empty).Replace("a title ", string.Empty);
                }
                else
                {
                    Regex firstWordRegex = new Regex(@"^\w+ ");
                    word = firstWordRegex.Replace(word, "");
                    word = word.Replace("type of ", string.Empty);
                    word = word.Replace("kind of ", string.Empty);
                }
            }
            switch (word)
            {
            case "noun":
                return(Nouns.Take(3));

            case "adjective":
                return(Adjectives.Take(3));

            case "plural noun":
            case "noun (plural)":
                return(PluralNouns.Take(3));

            case "verb":
                return(Verbs.Take(3));

            case "number":
                Random rand = new Random();
                return(new List <string>()
                {
                    rand.Next(1, 999).ToString(), rand.Next(1, 999).ToString(), rand.Next(1, 999).ToString()
                });

            case @"verb ending in ""ing""":
                return(GerundVerbs.Take(3));

            case "adverb":
                return(Adverbs.Take(3));

            case "part of the body":
            case "body part":
                return(PartsOfBody.Take(3));

            case "liquid":
                return(Liquids.Take(3));

            case "place":
                return(Places.Take(3));

            case "animal":
                return(Animals.Take(3));

            case "food":
                return(Foods.Take(3));

            case "color":
                return(Colors.Take(3));

            case "verb (past tense)":
                return(PastTenseVerbs.Take(3));

            case "celebrity":
                return(Celebrities.Take(3));

            case "exclamation":
                return(Exclamations.Take(3));

            case "part of the body (plural)":
            case "body part (plural)":
                return(PluralBodyParts.Take(3));

            case "silly word":
                return(SillyWords.Take(3));

            case "animal (plural)":
                return(PluralAnimals.Take(3));

            case "city":
                return(Cities.Take(3));

            case "nonsense word":
                return(NonsenseWords.Take(3));

            case "famous person":
                return(FamousPeople.Take(3));

            case "article of clothing":
                return(Clothing.Take(3));

            case "vehicle":
                return(Vehicles.Take(3));

            case "something alive (plural)":
                return(PluralAliveSomethings.Take(3));

            case "geographical location":
                return(GeographicalLocations.Take(3));

            case "town":
                return(Towns.Take(3));

            case "country":
                return(Countries.Take(3));

            case "container":
                return(Containers.Take(3));

            case "last name":
                return(LastNames.Take(3));

            case "name":
                return(Names.Take(3));

            case @"verb ending in ""s""":
                return(VerbsEndingInS.Take(3));

            case "occupation":
            case "occupation or job":
            case "profession":
                return(Occupations.Take(3));

            case "silly noise":
                return(SillyNoises.Take(3));

            case "male celebrity":
            case "celebrity (male)":
                return(MaleCelebrities.Take(3));

            case "article of clothing (plural)":
                return(PluralClothing.Take(3));

            case "name of a school":
            case "school":
                return(Schools.Take(3));

            case "building":
                return(Buildings.Take(3));

            case "bird":
                return(Birds.Take(3));

            case @"adjective ending in ""est""":
            case "adjective (superlative)":
                return(Superlatives.Take(3));

            case "letter":
                return(Letters.Take(3));

            case "game":
                return(Games.Take(3));

            case "holiday":
                return(Holidays.Take(3));

            case "silly word (plural)":
                return(PluralSillyWords.Take(3));

            case "something round":
                return(RoundSomethings.Take(3));

            case "piece of furniture":
                return(Furniture.Take(3));

            case "vegetable":
                return(Vegetables.Take(3));

            case "spanish word":
                return(SpanishWords.Take(3));

            case "tv actor":
                return(TVActors.Take(3));

            case "boy's name":
                return(BoyNames.Take(3));

            case "something alive":
                return(AliveSomethings.Take(3));

            case "female celebrity":
            case "celebrity (female)":
                return(FemaleCelebrities.Take(3));

            case "italian word":
                return(ItalianWords.Take(3));

            case "occupation (plural)":
                return(PluralOccupations.Take(3));

            case "first name":
                return(FirstNames.Take(3));

            case "room in a house":
                return(HouseRooms.Take(3));

            case "relative":
                return(Relatives.Take(3));

            case "movie star":
                return(MovieStars.Take(3));

            case "disease":
                return(Diseases.Take(3));

            case "sport":
                return(Sports.Take(3));

            case "something icky":
                return(IckySomethings.Take(3));

            case "actor":
                return(Actors.Take(3));

            case "concept or ideal":
                return(Concepts.Take(3));

            default:
                return(new string[3] {
                    string.Empty, string.Empty, string.Empty
                });
            }
        }
Пример #28
0
        public Item UnpackItem(ModDataDictionary modData, string recipientName)
        {
            string[] fields = new[] {
                "giftsender", "giftname", "giftid",
                "giftparentid", "gifttype", "giftstack",
                "giftquality", "giftpreserve", "gifthoney",
                "giftcolour", "giftdata"
            };
            if (fields.Any(field => !modData.ContainsKey(AssetPrefix + field)))
            {
                string msg = fields.Where(field => !modData.ContainsKey(field))
                             .Aggregate("This gift is missing data:", (str, field) => str + "\n" + field)
                             + "\nIf this gift was placed before updating, please revert to the previous version and collect the gift!"
                             + "\nOtherwise, leave a report on the mod page for Gift Wrapper with your log file (https://smapi.io/log).";
                Monitor.Log(msg, LogLevel.Warn);
                return(null);
            }

            // Parse the wrapped gift's serialised modData fields to use in rebuilding its gift item
            long   giftSender   = long.Parse(modData[AssetPrefix + fields[0]]);
            string giftName     = modData[AssetPrefix + fields[1]];
            int    giftId       = int.Parse(modData[AssetPrefix + fields[2]]);
            int    giftParentId = int.Parse(modData[AssetPrefix + fields[3]]);
            int    giftType     = int.Parse(modData[AssetPrefix + fields[4]]);
            int    giftStack    = int.Parse(modData[AssetPrefix + fields[5]]);
            int    giftQuality  = int.Parse(modData[AssetPrefix + fields[6]]);
            int    giftPreserve = int.Parse(modData[AssetPrefix + fields[7]]);
            int    giftHoney    = int.Parse(modData[AssetPrefix + fields[8]]);
            string giftColour   = modData[AssetPrefix + fields[9]];
            string giftData     = modData[AssetPrefix + fields[10]];
            Item   actualGift   = null;

            switch (giftType)
            {
            case (int)GiftType.BedFurniture:
                actualGift = new BedFurniture(which: giftId, tile: Vector2.Zero);
                break;

            case (int)GiftType.Furniture:
                actualGift = new Furniture(which: giftId, tile: Vector2.Zero);
                break;

            case (int)GiftType.BigCraftable:
                actualGift = new StardewValley.Object(tileLocation: Vector2.Zero, parentSheetIndex: giftId, isRecipe: false);
                break;

            case (int)GiftType.MeleeWeapon:
                actualGift = new MeleeWeapon(spriteIndex: giftId);
                break;

            case (int)GiftType.Hat:
                actualGift = new Hat(which: giftId);
                break;

            case (int)GiftType.Boots:
                actualGift = new Boots(which: giftId);                         // todo: test boots colour
                ((Boots)actualGift).appliedBootSheetIndex.Set(giftQuality);
                ((Boots)actualGift).indexInColorSheet.Set(int.Parse(giftColour));
                break;

            case (int)GiftType.Clothing:
                int[] colourSplit = giftColour.Split('/').ToList().ConvertAll(int.Parse).ToArray();
                Color colour      = new Color(r: colourSplit[0], g: colourSplit[1], b: colourSplit[2], a: colourSplit[3]);
                actualGift = new Clothing(item_index: giftId);
                ((Clothing)actualGift).clothesColor.Set(colour);
                break;

            case (int)GiftType.Ring:
                actualGift = new Ring(which: giftId);
                break;

            case (int)GiftType.Object:
                actualGift = new StardewValley.Object(parentSheetIndex: giftId, initialStack: giftStack)
                {
                    Quality = giftQuality
                };
                actualGift.Name = giftName;
                if (giftParentId != -1)
                {
                    ((StardewValley.Object)actualGift).preservedParentSheetIndex.Value = giftParentId;
                }
                if (giftPreserve != -1)
                {
                    ((StardewValley.Object)actualGift).preserve.Value = (StardewValley.Object.PreserveType)giftPreserve;
                }
                if (giftHoney != 0)
                {
                    ((StardewValley.Object)actualGift).honeyType.Value = (StardewValley.Object.HoneyType)giftHoney;
                }
                break;
            }

            if (actualGift == null)
            {
                return(null);
            }

            Dictionary <string, string> giftDataDeserialised = ((Newtonsoft.Json.Linq.JObject)JsonConvert.DeserializeObject(giftData)).ToObject <Dictionary <string, string> >();

            if (giftDataDeserialised != null)
            {
                // Apply serialised mod data back to the gifted item
                actualGift.modData.Set(giftDataDeserialised);
            }

            if (recipientName != null && Game1.player.UniqueMultiplayerID != giftSender)
            {
                // Show a message to all players to celebrate this wonderful event
                Multiplayer multiplayer = Helper.Reflection.GetField <Multiplayer>(typeof(Game1), "multiplayer").GetValue();
                multiplayer.globalChatInfoMessage(AssetPrefix + (giftStack > 1 ? "message.giftopened_quantity" : "message.giftopened"),
                                                  recipientName,                    // Recipient's name
                                                  Game1.getFarmer(giftSender).Name, // Sender's name
                                                  actualGift.DisplayName,           // Gift name
                                                  giftStack.ToString());            // Gift quantity
            }

            return(actualGift);
        }
Пример #29
0
        public static void setUpPlayerControlSequence_Kelly(Event __instance, string id)         // Code originally written by Goldenrevolver: https://github.com/kenny2892/StardewValleyMods/pull/1
        {
            try
            {
                // using the default condition for the method
                if (Monitor is null || __instance is null || Config is null || !Config.AutoRemoveClothes || id != "flowerFestival")
                {
                    return;
                }

                Hat      hat   = null;
                Clothing shirt = null;
                Clothing pants = null;
                Boots    boots = null;

                // undress without actually taking off the items

                if (Game1.player?.hat?.Value != null)
                {
                    hat = Game1.player.hat.Value;
                    Game1.player.hat.Value = null;
                    Monitor.Log("Removed hat: " + hat.DisplayName, LogLevel.Debug);
                }

                if (Game1.player?.shirtItem?.Value != null)
                {
                    shirt = Game1.player.shirtItem.Value;
                    Game1.player.shirtItem.Value = null;
                    Monitor.Log("Removed shirt: " + shirt.DisplayName, LogLevel.Debug);
                }

                if (Game1.player?.pantsItem?.Value != null)
                {
                    pants = Game1.player.pantsItem.Value;
                    Game1.player.pantsItem.Value = null;
                    Monitor.Log("Removed pants: " + pants.DisplayName, LogLevel.Debug);
                }

                if (Game1.player?.boots?.Value != null)
                {
                    boots = Game1.player.boots.Value;
                    Game1.player.boots.Set(null);
                    Monitor.Log("Removed boots: " + boots.DisplayName, LogLevel.Debug);

                    Game1.player.changeShoeColor(12);
                }

                // reequip the clothes

                __instance.onEventFinished += delegate
                {
                    if (id != "flowerFestival")
                    {
                        return;
                    }

                    Monitor.Log("Starting to re-equip items from Flower Dance", LogLevel.Debug);

                    if (hat != null)
                    {
                        Game1.player.hat.Value = hat;
                    }

                    if (shirt != null)
                    {
                        Game1.player.shirtItem.Value = shirt;
                    }

                    if (pants != null)
                    {
                        Game1.player.pantsItem.Value = pants;
                    }

                    if (boots != null)
                    {
                        Game1.player.boots.Set(boots);

                        if (boots != null)
                        {
                            Game1.player.changeShoeColor(boots.indexInColorSheet);
                        }
                    }

                    Monitor.Log("Finished re-equipping items from Flower Dance", LogLevel.Debug);
                };
            }

            catch (Exception e)
            {
                Monitor.Log($"Failed in {nameof(EventPatched)}:\n{e}", LogLevel.Error);
            }
        }
Пример #30
0
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="clothing">The clothing item.</param>
 /// <remarks>Derived from <see cref="Clothing.drawInMenu(SpriteBatch, Vector2, float, float, float, StackDrawType, Color, bool)"/>.</remarks>
 public ShirtSpriteInfo(Clothing clothing)
     : base(FarmerRenderer.shirtsTexture, new Rectangle(clothing.indexInTileSheetMale.Value * 8 % 128, clothing.indexInTileSheetMale.Value * 8 / 128 * 32, 8, 8))
 {
     this.OverlaySourceRectangle = new Rectangle(this.SourceRectangle.X + 128, this.SourceRectangle.Y, this.SourceRectangle.Width, this.SourceRectangle.Height);
     this.OverlayColor           = clothing.clothesColor.Value;
 }
Пример #31
0
 public IActionResult CreateClothings(Clothing clothing)
 {
     _context.Clothing.Add(clothing);
     _context.SaveChanges();
     return(StatusCode(201, clothing));
 }
Пример #32
0
        static public bool EquipmentClick(ClickableComponent icon)
        {
            // Check that item type is compatible.
            // And play corresponding sound.
            var helditem = Game1.player.CursorSlotItem;

            // Convert special items (such as copper pan & Lewis pants)
            if (helditem is StardewValley.Tools.Pan)
            {
                helditem = new Hat(71);
            }
            if (helditem is StardewValley.Object && helditem.ParentSheetIndex == 71)
            {
                helditem = new Clothing(15);
            }
            if (helditem == null)
            {
                if (icon.item == null)
                {
                    return(false);
                }
                Game1.playSound("dwop");
            }
            else
            {
                switch (icon.name)
                {
                case "Hat":
                    if (!(helditem is Hat))
                    {
                        return(false);
                    }
                    Game1.playSound("grassyStep");
                    break;

                case "Shirt":
                    if (!(helditem is Clothing))
                    {
                        return(false);
                    }
                    if ((helditem as Clothing).clothesType.Value != (int)Clothing.ClothesType.SHIRT)
                    {
                        return(false);
                    }
                    Game1.playSound("sandyStep");
                    break;

                case "Pants":
                    if (!(helditem is Clothing))
                    {
                        return(false);
                    }
                    if ((helditem as Clothing).clothesType.Value != (int)Clothing.ClothesType.PANTS)
                    {
                        return(false);
                    }
                    Game1.playSound("sandyStep");
                    break;

                case "Boots":
                    if (!(helditem is Boots))
                    {
                        return(false);
                    }
                    Game1.playSound("sandyStep");
                    DelayedAction.playSoundAfterDelay("sandyStep", 150, null);
                    break;

                default:
                    if (!(helditem is Ring))
                    {
                        return(false);
                    }
                    Game1.playSound("crit");
                    break;
                }
            }

            // I have no idea why StardewValley does this in InventoryPage::setHeldItem, but I guess it might be important.
            if (helditem != null)
            {
                helditem.NetFields.Parent = null;
            }

            // Update inventory
            ActualRings ar = actualdata.GetValue(Game1.player, FarmerNotFound);

            switch (icon.name)
            {
            case "Hat":          Game1.player.hat.Set(helditem as Hat);            break;

            case "Shirt":        Game1.player.shirtItem.Set(helditem as Clothing); break;

            case "Pants":        Game1.player.pantsItem.Set(helditem as Clothing); break;

            case "Boots":        Game1.player.boots.Set(helditem as Boots);        break;

            case "Left Ring":    Game1.player.leftRing.Set(helditem as Ring);      break;

            case "Right Ring":   Game1.player.rightRing.Set(helditem as Ring);     break;

            case "Extra Ring 1": ar.ring1.Set(helditem as Ring);                   break;

            case "Extra Ring 2": ar.ring2.Set(helditem as Ring);                   break;

            case "Extra Ring 3": ar.ring3.Set(helditem as Ring);                   break;

            case "Extra Ring 4": ar.ring4.Set(helditem as Ring);                   break;

            default:
                getInstance().Monitor.Log($"ERROR: Trying to fit equipment item into invalid slot '{icon.name}'", LogLevel.Error);
                return(false);
            }

            // Equip/unequip
            (icon.item as Ring)?.onUnequip(Game1.player, Game1.currentLocation);
            (icon.item as Boots)?.onUnequip();
            (helditem as Ring)?.onEquip(Game1.player, Game1.currentLocation);
            (helditem as Boots)?.onEquip();

            // Swap items
            Game1.player.CursorSlotItem = Utility.PerformSpecialItemGrabReplacement(icon.item);
            icon.item = helditem;
            return(true);
        }
Пример #33
0
 public Inventory(List <Item> items, Clothing clothes)
 {
     this.items   = items;
     this.clothes = clothes;
 }