1.23 (obsolete) CommandRecipes 1.5.0.0

Command-based crafting with server-defined recipes

  1. aMoka

    Plugin Developer Zero Day Plugin Author

    Joined:
    Nov 14, 2012
    Messages:
    162
    CommandRecipes
    Config-defined recipes because crafting at an anvil is so last update.
    ApiVersion: 1.16
    Terraria Version: 1.2.4.1
    Plugin Version: 1.4.4.0

    Author: aMoka and Enerdy

    Features:
    • Allows crafting items via commands.
    • Allows pre-made, config-based, recipes (one or more items).
    • Allows restriction of crafting recipes to regions or permissions.
    • Crafting can be done via dropping items or inventory in SSC.
    • Logs all crafted recipes (player, ingredients, and products).
    • Because collecting 1000 shackles should really reward something.
    • Meow.
    Permissions:
    • cmdrec.player.craft - gives access to the sorta all-powerful craft command (/craft)
    • cmdrec.admin.reload - gives access to reload the config (/recrld)
    Commands:
    • /craft <recipename/-quit/-list/-allcats/-cat/-confirm>
      • recipename - name of the recipe as defined in config.
      • -quit - quits crafting and gives back all items invested into crafting.
      • -list - lists all recipes available for crafting.
      • -allcats - lists all categories that recipes are a part of.
      • -cat <category name> - lists all recipes in a category.
      • -confirm - confirms inventory crafting (applicable in SSC and config enabled only)
    • /recrld - Reloads AllRecipes.json.
    Config:
    Code:
    {
      "CraftFromInventory": true,
      "Recipes": [
        {
          "name": "1",
          "ingredients": [
            {
              "name": "Copper Bar",
              "stack": 8,
              "prefix": 0,
              "group": 1
            },
            {
              "name": "22",
              "stack": 8,
              "prefix": 0,
              "group": 1
            },
            {
              "name": "Stone Block",
              "stack": 20,
              "prefix": 0,
              "group": 0
            },
            {
              "name": "Wooden Hammer",
              "stack": 1,
              "prefix": -1,
              "group": 0
            }
          ],
          "products": [
            {
              "name": "Copper Broadsword",
              "stack": 1,
              "prefix": 41,
              "group": 1,
              "weight": 50
            },
            {
              "name": "-15",
              "stack": 1,
              "prefix": 41,
              "group": 1,
              "weight": 50
            },
            {
              "name": "Wooden Hammer",
              "stack": 1,
              "prefix": 39,
              "group": 0,
              "weight": 100
            }
          ],
          "categories": [
            "Example"
          ],
          "permissions": [
            ""
          ],
          "regions": [
            ""
          ]
        },
        {
          "name": "Iron Broadsword",
          "ingredients": [
            {
              "name": "Iron Bar",
              "stack": 8,
              "prefix": 0,
              "group": 0
            },
            {
              "name": "Stone Block",
              "stack": 20,
              "prefix": 0,
              "group": 0
            },
            {
              "name": "Wooden Hammer",
              "stack": 1,
              "prefix": -1,
              "group": 0
            }
          ],
          "products": [
            {
              "name": "Iron Broadsword",
              "stack": 1,
              "prefix": 41,
              "group": 0,
              "weight": 100
            },
            {
              "name": "Wooden Hammer",
              "stack": 1,
              "prefix": 39,
              "group": 0,
              "weight": 100
            }
          ],
          "categories": [
            "Example",
            "Example2"
          ],
          "permissions": [
            "cmdrec.craft.example",
            "craft"
          ],
          "regions": [
            ""
          ],
          "invisibility": true,
          "commands": [
          "/i \"Dynamite\"",
          "/firework $playername red"
          ]
        }
      ]
    }
    • CraftFromInventory: <bool>
      • True only works in SSC. Instead of dropping items to craft, items are taken directly from inventory. False works in both non-SSC and SSC.
    • name: <string>
      • Name of the recipe, does not have to be the name of the item.
    • ingredients: List<item>
      • A list of all the items required to complete the recipe.
      • name: <string>
        • The name of the item.
      • stack: <number>
        • How many need to be dropped.
      • prefix: <number>
        • The prefix of the item. If set to -1, the recipe will accept items of any prefix.
      • group: <number>
        • The group of the item. Only one ingredient of the group is required to fulfill the recipe. All ingredients of group 0 are individually required.
    • products: List<item>
      • A list of all the items that get pooped out when all ingredients are fulfilled.
      • name: <string>
        • The name of the item.
      • stack: <number>
        • How many are received.
      • prefix: <number>
        • The prefix of the item. If set to -1, the product's prefix will be randomized with a weight on 0. If set to -2, the product's prefix will be randomized with equal chances for all valid prefixes.
      • group: <number>
        • The group of the item. Only one product of the group is given, according to weight (see below). All products of group 0 are given.
      • weight: <number>
        • The percentage chance the item of a group will be selected out of 100 percent. The sum of the weight of all products of a group must not exceed 100! Accepts whole numbers.
    • categories: List<string>
      • A list of categories you want your recipe to be a part of.
    • permissions: List<string>
      • A list of permissions that your recipe requires only one of to allow the person to craft. Permissions are added to the group.
    • regions: List<string>
      • A list of regions that your recipe can only be crafted in.
    • invisible: <bool>
      • makes recipes invisible to any listing, for your covert, shady needs.
    • commands: string[]
      • a list of command strings ("/command [args...]") which are executed once the recipe has finished crafting.
      • Available Wildcards
        • $group - the player's group name;
        • $ip - the player's current session IP;
        • $playername - the player's character name;
        • $username - the player's user account name.
    Links:
    Todo:
    • Fully fix drop crafting overlaps.
    • SEconomy as ingredient/product(?)
    • Crafting station req?
     
    • Like Like x 8
  2. Strinkor

    Plugin Developer Zero Day Plugin Author

    Joined:
    Jun 4, 2014
    Messages:
    64
    Interesting thing, good work!
     
  3. Enerdy

    Enerdy Satellite Admin
    TShock Mod Plugin Developer Zero Day Plugin Author

    Joined:
    Nov 14, 2012
    Messages:
    507
    Ooh the recipes. Guess it took me too long, haha.
     
  4. Ijwu

    Ijwu Level 11

    Joined:
    Apr 4, 2012
    Messages:
    647
    Sweet. Cool stuff there.
     
  5. bippity

    Plugin Developer

    Joined:
    Jan 14, 2012
    Messages:
    293
    This is pretty neat! :)
    Do you think you could add an option to check if SSC is enabled so that it'll take the ingredients directly out of the player's inventory without having to make the player drop them? (Kinda like KeyChangerSSC)
     
  6. Ijwu

    Ijwu Level 11

    Joined:
    Apr 4, 2012
    Messages:
    647
    Approved. :D
     
    • Like Like x 4
  7. aMoka

    Plugin Developer Zero Day Plugin Author

    Joined:
    Nov 14, 2012
    Messages:
    162
    Updated to v.1.2.0.0

    [c] Commandeered /craft (previously /craftr) for this plugin's own evil purposes. (Didn't see any other releases use this command so... but if I'm wrong... please notify.)
    [+] Added logging to .txt. (Yay Enerdy!)
    [+] Prefix changes! prefix = 0 now only accepts a non-prefixed item. Prefixes can also be assigned to products at random. See OP for more prefix details.
     
  8. aMoka

    Plugin Developer Zero Day Plugin Author

    Joined:
    Nov 14, 2012
    Messages:
    162
    Updated to v.1.3.0.0

    [+] Crafting from inventory with SSC enabled is now possible!
    [c] Partially fixed craft overlap. Don't stand on other people when crafting the exact same recipe for now.

    EDIT:
    Updated to v.1.3.1.0:
    [c] Fixed craft overlap completely.

    Updated to v1.3.2.0
    [c] Fixed -allcats bug.
     
  9. aMoka

    Plugin Developer Zero Day Plugin Author

    Joined:
    Nov 14, 2012
    Messages:
    162
    Updated to v.1.4.0.0

    [+] Added grouping of ingredients and products. Ingredients may now be configured to be fulfilled by more than one item. Products may now be configured to have a "chance" to craft.
     
  10. Yazir

    Yazir Level 1

    Joined:
    Apr 8, 2014
    Messages:
    23
    This plugin is great, but i have got a problem with adding recipes:
    Code:
    {
      "CraftFromInventory": true,
      "Recipes": [
        {
          "name": "S.D.M.G.",
          "ingredients": [
            {
              "name": "Minishark",
              "stack": 1,
              "prefix": -1,
              "group": 1
            },
            {
              "name": "Megashark",
              "stack": 1,
              "prefix": -1,
              "group": 1
            },
            {
              "name": "Gatligator",
              "stack": 1,
              "prefix": -1,
              "group": 0
            },
            {
              "name": "Chain Gun",
              "stack": 1,
              "prefix": -1,
              "group": 0
            }
            {
              "name": "Sniper Scope",
              "stack": 1,
              "prefix": -1,
              "group": 0
            }
            {
              "name": "Ranger Emblem",
              "stack": 1,
              "prefix": -1,
              "group": 0
            }
            {
              "name": "Coal",
              "stack": 2,
              "prefix": 0,
              "group": 0
            }
     
          ],
          "products": [
            {
              "name": "S.D.M.G.",
              "stack": 1,
              "prefix": -2,
              "group": 1,
              "weight": 100
            },
          ],
          "categories": [
            "Unobtainable"
          ],
          "permissions": [
            ""
          ],
          "regions": [
            ""
          ]
        },
        {
          "name": "VIP S.D.M.G.",
          "ingredients": [
            {
              "name": "Gatligator",
              "stack": 1,
              "prefix": -1,
              "group": 0
            },
            {
              "name": "Megashark",
              "stack": 1,
              "prefix": -1,
              "group": 0
            },
            {
              "name": "Rifle Scope",
              "stack": 1,
              "prefix": -1,
              "group": 0
            },
            {
              "name": "Coal",
              "stack": 3,
              "prefix": -1,
              "group": 0
            }
          ],
          "products": [
            {
              "name": "S.D.M.G.",
              "stack": 1,
              "prefix": 82,
              "group": 0,
              "weight": 100
            },
            {
              "name": "Gold Coin",
              "stack": 40,
              "prefix": 0,
              "group": 1,
              "weight": 100
            },
          ],
          "categories": [
            "VIP",
          ],
          "permissions": [
            "cmdrec.craft.vip",
          ],
          "regions": [
            ""
          ]
        },
        {
          "name": "Gravity Globe",
          "ingredients": [
            {
              "name": "Gravitation Potion",
              "stack": 16,
              "prefix": 0,
              "group": 0
            },
            {
              "name": "Feather",
              "stack": 60,
              "prefix": 0,
              "group": 0
            },
            {
              "name": "Shiny Red Balloon",
              "stack": 1,
              "prefix": 0,
              "group": 0
            },
            {
              "name": "Coal",
              "stack": 1,
              "prefix": 0,
              "group": 0
            }
          ],
          "products": [
            {
              "name": "Gravity Globe",
              "stack": 1,
              "prefix": -1,
              "group": 0,
              "weight": 100
            },
          ],
          "categories": [
            "Unobtainable",
          ],
          "permissions": [
            "",
          ],
          "regions": [
            ""
          ]
        },
          {
        {
          "name": "VIP Gravity Globe",
          "ingredients": [
            {
              "name": "Gravitation Potion",
              "stack": 8,
              "prefix": 0,
              "group": 0
            },
            {
              "name": "Feather",
              "stack": 15,
              "prefix": 0,
              "group": 0
            },
            {
              "name": "Coal",
              "stack": 2,
              "prefix": 0,
              "group": 0
            }
          ],
          "products": [
            {
              "name": "Gravity Globe",
              "stack": 1,
              "prefix": -1,
              "group": 0,
              "weight": 100
            },
          ],
          "categories": [
            "Unobtainable",
          ],
          "permissions": [
            "cmdrec.craft.vip",
          ],
          "regions": [
            ""
          ]
        },
              {
        {
          "name": "VIP Gravity Globe",
          "ingredients": [
            {
              "name": "Gravitation Potion",
              "stack": 8,
              "prefix": 0,
              "group": 0
            },
            {
              "name": "Feather",
              "stack": 15,
              "prefix": 0,
              "group": 0
            },
            {
              "name": "Coal",
              "stack": 1,
              "prefix": 0,
              "group": 0
            }
          ],
          "products": [
            {
              "name": "Gravity Globe",
              "stack": 1,
              "prefix": -2,
              "group": 0,
              "weight": 100
            },
          ],
          "categories": [
            "Unobtainable",
          ],
          "permissions": [
            "cmdrec.craft.vip",
          ],
          "regions": [
            ""
          ]
        },
        {
          "name": "Losowanie",
          "ingredients": [
            {
              "name": "Gold Coin",
              "stack": 15,
              "prefix": 0,
              "group": 0
            },
          ],
          "products": [
            {
              "name": "Gold Coin",
              "stack": 1,
              "prefix": 0,
              "group": 1,
              "weight": 50
            },
            {
              "name": "Gold Coin",
              "stack": 5,
              "prefix": 0,
              "group": 1,
              "weight": 20
            },
            {
              "name": "Gold Coin",
              "stack": 10,
              "prefix": 0,
              "group": 1,
              "weight": 15
            },
            {
              "name": "Gold Coin",
              "stack": 15,
              "prefix": 0,
              "group": 1,
              "weight": 9
            },
            {
              "name": "Gold Coin",
              "stack": 25,
              "prefix": 0,
              "group": 1,
              "weight": 6
            },
            {
              "name": "Coal",
              "stack": 1,
              "prefix": 0,
              "group": 1,
              "weight": 1
            },
          ],
          "categories": [
            "Inne",
          ],
          "permissions": [
            "",
          ],
          "regions": [
            ""
          ]
        }
    ]
    }
    When i type /craft -list or any other command from /craft, it says to check the logs. There is nothing about the error in logs :/.

    @edit, nvm fixed
     
  11. aMoka

    Plugin Developer Zero Day Plugin Author

    Joined:
    Nov 14, 2012
    Messages:
    162
    Your recipe file isn't a valid .json.
    In your "S.D.M.G." recipe, some ingredients don't have commas.
    Use this site to validate your JSON.
     
  12. Yazir

    Yazir Level 1

    Joined:
    Apr 8, 2014
    Messages:
    23
    Yup thanks, i found it before :) .
     
  13. Yazir

    Yazir Level 1

    Joined:
    Apr 8, 2014
    Messages:
    23
    Btw. i found a bug. I needed to change VIP permission items to the bottom of the config and non-vip above VIP. I didn't worked while a player type /craft Losowanie it said that "You don't have enough permission to craft VIP S.D.M.G" .
     
  14. aMoka

    Plugin Developer Zero Day Plugin Author

    Joined:
    Nov 14, 2012
    Messages:
    162
    Just to make sure,
    1. In the AllRecipes.json file, you added a permission to a recipe
    2. You added the created permission from said recipe to the VIP group
    3. You executed the craft command for said recipe as a VIP group member
    4. You got the following error message: "You do not have the required permission to craft the recipe: VIP S.D.M.G!"?
     
  15. Yazir

    Yazir Level 1

    Joined:
    Apr 8, 2014
    Messages:
    23
    Yes, other items worked properly but "Losowanie". The fix was to change order of recipes. Changed the VIP items to the bottom of config and non-vip to the top and it worked.
     
  16. aMoka

    Plugin Developer Zero Day Plugin Author

    Joined:
    Nov 14, 2012
    Messages:
    162
    Fixed. Thanks Yazir.

    Updated to v.1.4.1.0:
    [c] Ensures the correct recipe is selected prior to checking permissions.
     
    • Like Like x 2
  17. Terrabear

    Terrabear Level 6

    Joined:
    Jun 26, 2014
    Messages:
    138
    Two teachers made cool stuff.

    Awesome :D
     
  18. Yazir

    Yazir Level 1

    Joined:
    Apr 8, 2014
    Messages:
    23
    Yeah! Will i need to change something in the config after replacing the plugin? Thanks! ;)
     
  19. Enerdy

    Enerdy Satellite Admin
    TShock Mod Plugin Developer Zero Day Plugin Author

    Joined:
    Nov 14, 2012
    Messages:
    507
    Teachers? :eek:

    And I drafted a file (the log writer), that's all, aMoka is just too kind. Lol.
     
  20. aMoka

    Plugin Developer Zero Day Plugin Author

    Joined:
    Nov 14, 2012
    Messages:
    162
    Nope. No major changes, just a small bug fix. ^^

    Meanwhile Enerdy is responsible for lots of details in the plugin and is being super modest.