RELEASED [SMAPI] Showcase

Discussion in 'Mods' started by Igorious, Jan 15, 2017.

  1. Igorious

    Igorious Sandwich Man

    Hi!
    I've seen the request and tried to implement showcase logic.
    Latest version here: MOD PAGE.
    Please, write a comment if it works correctly or not. It will really help to me!

    Mod adds two items: «table» and «painting», that can display their content.

    4.png
    Stand.png
    Menu.png

    Please, backup your save files before mod usage.
    The mod is in progress and it may be unstable.

    By default, these items use FurnitureID 1228, 1230, 1231, 1826, -1, -2 :D

    To get items:
    • option 1: go to Carpenter's Shop and buy them;
    • option 2: create them with Furniture Catalogue;
    • option 3: write «player_addfurniture 1228» (or 1230, 1231, 1826) in the console.
    To interact with items:
    • click the left mouse button to move item;
    • click the right mouse button with empty hands to open storage menu;
    • click the right mouse button with an item in hands to put the item to the storage.
    You can move showcase with all items to inventory.
    Only items that satisfy to filter are allowed.

    Source code:
    GitHub.
     
      Last edited: Jan 29, 2017
      aemilia, Starbeak87, Yoseiri and 11 others like this.
    • Coolwyngs

      Coolwyngs Existential Complex

      Wow very cool thank you for making this
       
      • Igorious

        Igorious Sandwich Man

        Showcase v. 0.3 (beta)

        Fixed crashes after changing Rows or Columns to downwards.
        Fixed position of container menu.
        Added showcase in the Chinese style (1x3) (FurnitureID 1826):
        China.png

        Please, give feedback :)
         
          Last edited: Jan 17, 2017
          Coolwyngs and IronZelly like this.
        • Igorious

          Igorious Sandwich Man

          Showcase v. 0.4 (still beta)
          Updated to latest SMAPI (1.6), removed warnings.

          Fixed crash after adding Weapon item to Inventory.
          Showcases can display Weapon (swords, hammers, and daggers).
          Added item filters (you can say to showcase to acquire fish or not acquire cooking).

          Shield.png
           
            eemie, Coolwyngs and IronZelly like this.
          • Igorious

            Igorious Sandwich Man

            Showcase v. 0.5 (beta :))

            Updated to latest SMAPI (1.7).

            Added support of furniture with rotation:
            Rotations.png
            Showcases can display Tools (Pickaxe, Axe, Hoe, Scythe, Milk Pail, Shears, Copper Pan, FishingRod). First fourth are more just fun because you will get a basic-level copy of the tool on next day.

            @Coolwyngs, @IronZelly, thank you for supporting! :)
             
              Last edited: Jan 20, 2017
              IronZelly and Coolwyngs like this.
            • Minakie

              Minakie Cosmic Narwhal

              Good to see that this mod is taking off. Any idea if it would be able to support custom displays, like the one eemie is working on? (on the left)
              [​IMG]
               
              • Coolwyngs

                Coolwyngs Existential Complex

                Looks very nice I like that display shelf of eemie's. I hope that would work and that any other cool ones that people make will work as well.
                 
                • eemie

                  eemie Hard-To-Destroy Reptile

                  Oh yeah, what @Minakie said. Let me know if my cabinet would work with your mod.

                  Just PM me if you want the png
                   
                  • Igorious

                    Igorious Sandwich Man

                    Showcase v.0.6.2 (beta, again)

                    Fixed crash when you try to rotate showcase without items.
                    Fixed work of item filter when you put in an item via right mouse button click.
                    Fixed item missing when you try to put an item to showcase and hold item stack>1.
                    Fixed various draw issues.
                    Added cute icons to inventory menu, shop menu and under cursor.
                    MenuIcons.png
                    Added glow and lights around gold- and iridium-quality items (and some swords).
                     
                      Last edited: Jan 21, 2017
                      foghorn and Minakie like this.
                    • Igorious

                      Igorious Sandwich Man

                      @Minakie, @eemie there should be no problem use custom texture.
                      Here's guide how to create a custom item. It requires an image and some patience.

                      0. Open the image in image editor (I'm using Paint.net):
                      0.png

                      1. Remember a size of BoundingBox:
                      1.png

                      2. Find an area where items can be drawn:
                      2.png

                      3. Mark places for items, calculate Scale, remember numbers of Rows and Columns:
                      3.png

                      4. Now calculate offset from left, top right and bottom edges:
                      4.png

                      5. Okay, now let's find a place for our item in sprite-sheet (Furniture.xnb):
                      5.png

                      6. Calculate FurnitureID of the item (index of top-left tile).
                      You don't need to repack .xnb file! It's just for calculation of place where a sprite from Resources\Furniture.png will be copied!
                      6.png

                      7. Add the sprite to Resources\Furniture.png:
                      7.png
                      Remember SpriteIndex of the item (index of top-left tile) and Size of the sprite.

                      8. Open Configuration\Showcases.json and add information about item:
                      8.png
                      Add Name, Price and Filter for items.

                      9. Run SMAPI, buy the item in Carpenter's Shop or create from Furniture Catalogue. Voilà:
                      9.png


                      Oh, and syntax of Filters:
                      Code:
                      "([Allowed category name] )*(![Forbidden category name] )*"
                      So filter "Shippable !Fish !Cooking" allows to put all shippable items excepting fish and cooking.
                      Not all item types are supported yet.
                      Shippable
                      Greens
                      Gem
                      Vegetable
                      Fish
                      Eggs
                      Milks
                      Cooking
                      Crafting
                      BigCraftable
                      Fruits
                      Seeds
                      Minerals
                      Flowers
                      Meat
                      MetalResources
                      BuildingResources
                      SellAtPierres
                      SellAtPierresAndMarnies
                      Fertilizer
                      Junk
                      Baits
                      Tackle
                      SellAtFishShop
                      Furniture
                      Ingredients
                      ArtisanGoods
                      Syrup
                      MonsterLoot
                      Equipment
                      Hat
                      Ring
                      Weapon
                      Boots
                      Tool
                       
                        Last edited: Jan 21, 2017
                        Acerbicon, IronZelly and Minakie like this.
                      • Coolwyngs

                        Coolwyngs Existential Complex

                        So dose this mean with this mod you can not use custom furniture if you cannot program this?
                         
                        • Entoarox

                          Entoarox Oxygen Tank

                          You can use the "programming" done by others, you just wont be able to make your own custom stuff :p
                           
                            Igorious likes this.
                          • eemie

                            eemie Hard-To-Destroy Reptile


                            whoa, magic! thanks for explaining all of this, im gonna have to try this out next week.
                             
                              Igorious likes this.
                            • Igorious

                              Igorious Sandwich Man

                              It's not programming, it's more math :p

                              I will try to fix remaining issues in nearest days, move some hard-coded logic to configs and add release-candidate to the Mods repository.
                               
                              • Coolwyngs

                                Coolwyngs Existential Complex

                                how would you add the custom furniture to this mod
                                 
                                • Entoarox

                                  Entoarox Oxygen Tank

                                  His explaination contains it all... but it does assume you know how spritesheets work....
                                   
                                  • eemie

                                    eemie Hard-To-Destroy Reptile

                                    Do you actually have to add the cabinet as a whole new furniture piece like you did or can you just use a resprite an existing cabinet like i have now?
                                     
                                    • Igorious

                                      Igorious Sandwich Man

                                      Sorry, I've not understood your message :(

                                      Now all showcases are separate items. It's possible to override existing furniture — I had done this with machines once. I've not tried yet this for furniture, but it should work automatically.
                                      I have no more strength to check it today.
                                      It's also possible now to use sprites as from attached .png, as from in-game .xnb.

                                      ---------------

                                      Version 0.7.4 (beta)
                                      So much work was done!
                                      • Fixed issues with incorrect rotation, wrong icons in inventory, missing icons in shop menu...
                                      • Extracted code of item positioning. I hope, it will possible soon to define separate points for complex item layouts, instead of current grid-like layout. Now it has just two options: Fixed (default), that means item grid will be directly mapped to sprite grid; and Auto, that ignores empty rows and columns in the container.
                                      • Moved glowing effects to config.
                                      • Showcase no more linked to fixed place in the .xnb. You can define FurnitureID and SpriteIndex independently. Particularly, this means that you can re-use resources from .xnb, or can use negative IDs for your new items:
                                      xnb.png
                                      (sprite re-used from .xnb)
                                       
                                        Last edited: Jan 22, 2017
                                        Acerbicon and Minakie like this.
                                      • Igorious

                                        Igorious Sandwich Man

                                        Version 0.8.1 β
                                        What's new:
                                        — Tinting!
                                        Colors.png
                                        — With color picker!
                                        Picker.png
                                        — Configurable item rotation:
                                        Rotation.png
                                        — Supported item description:
                                        Description.png

                                        The algorithm of showcase drawing was been rethought. Some parameters, like TextureSize, Alpha, IsTwoLayout, InverseLayouts have been removed.
                                        Now it work like this: Final Image = (Sprite + Tint) + (Item-Glows + Items) + (SecondSprite + SecondTint). I think it's enough for drawing any complex item.

                                        -------
                                        What's in TODO: to add custom layout, when you can manually set (x, y, scale) for each item. I really want to use this thing: CustomLayout.png
                                        Do some optimizations, fix issue with menu position after window resizing.

                                        Mod is near release. If you want to add/remove/change something, give you feedback, please :)
                                         
                                          Last edited: Jan 24, 2017
                                          foghorn, IronZelly and eemie like this.
                                        • SpringsSong

                                          SpringsSong Cosmic Narwhal

                                          Okay, so I'm having an issue. This mod hasn't wanted to work for me at all - the showcases don't show up in the Item Spawner or any other shop, and when I put in the code to the console, it said that it wasn't registered. My error log is attached.
                                           

                                            Attached Files:

                                          Share This Page