1. These forums are still being retired! Please use GitHub discussions or Discord. You cannot create new threads or new accounts now. If you need to contact some user of the forums, you should do it sooner, rather than later. This notice was last updated on May 30th, 2021.

2.0 (obsolete) KeyChangerSSC 2.2

Changes special keys into their respective items.

  1. Enerdy

    Enerdy Satellite Admin
    TShock Mod Plugin Developer Zero Day Plugin Author

    Joined:
    Nov 14, 2012
    Messages:
    506
    [​IMG]
    The Keychanging Machine

    KeyChangerSSC [​IMG]
    Changes special keys into their respective items

    ApiVersion: 1.16
    Terraria Version: 1.2.4.1
    Plugin Version: 2.0.0.2018

    Author: Enerdy
    DISCLAIMER: This plugin requires ServerSideCharacters to be enabled on your server, or it won't be able to modify a player's inventory.

    Features:
    • Changes special dungeon chest keys into an item specified in the config file. Available keys:
      • Temple Key
      • Jungle Key
      • Corruption Key
      • Crimson Key
      • Hallowed Key
      • Frozen Key
    • Includes three main exchange modes:
      • Normal, which is the default mode, allowing the commands to be executed everywhere.
      • Region, which uses regions specified in the config file as exchange points.
      • Market, an extension of the Region mode, which automatically sets all keys' exchange regions to one single market region, defined in the config file.
    • Multiple items can be assigned to one key, a list from which the plugin will select one at random when exchanging!
      • Default items are the same as the featured item found inside corresponding chests.
    • No item dropping required - in collaboration with Terraria's SSC feature, the server can modify a player's inventory directly, allowing smooth trades between items.
    Permissions:
    • key - Gives access to the entire /key command branch.
    • key.change - Allows the use of /key change.
    • key.reload - Allows the use of /key reload.
    • key.mode - Allows the use of /key mode.
    Commands:
    • /help key provides a list of every available command branching from /key.
    • /key change <type> - Exchanges a key defined by the <type> parameter by one of its assigned items.
    • /key reload - Reloads KeyChangerConfig.json. Useful for assigning new exchange regions as this cannot be done through a command in-game.
    • /key mode <mode>- Changes the requirements to perform an exchange. Available modes:
      • normal - removes requirements;
      • market - requires the player to be inside a region to perform an exchange. This region can be defined in the config file at the "MarketRegion" setting.
      • region - same as market, but every key has its own region. Those regions can be defined in the config file at the "[KEYNAME]Region" setting, where [KEYNAME] is the name of the key.
    Note: When modifying region names in the config for the first time, you will find that their parameter is set to null. In order to add a region name, you must use inverted commas surrounding the name. Ex: "JungleRegion": null -> "JungleRegion": "TestRegion".
    Config:
    • EnableRegionExchanges: <true/false>
      • Enables / disables region mode. Explanation above.
    • MarketMode: <true/false>
      • Enables / disables market mode. Note that if this is manually set through the config, you must set EnableRegionExchanges to true as well, or it will not have any effect. The `/key mode market` command does it all automatically.
    • Enable[KEYNAME]: <true/false>
      • Enables / disables the key. A disabled key will return an error message when an user attempts to exchange it.
    • [KEYNAME]Item:<list of item ids>
      • A list of item IDs from where the plugin can pick when returning the item to exchange for the key. Here's how to add more than one item:
      PHP:
      "JungleKeyItem": [
          
      1156,
          
      1200,
          
      1500
        
      ],
    • MarketRegion: "<text>"
      • The name of the region to use as the general exchange point if MarketMode is in use.
    • [KEYNAME]Region: "<text>"
      • The name of the region to use as the key's separate exchange region if EnableRegionExchanges is in use.
    Changelog:
    Not much to add here, since I lost the previous changelog.
    2.0.0.2018
    • Fixed a bug with the latest TShock build, which introduces a new SSC module and moves around the config options for it.
    2.0.0.0
    • /key mode now persists between sessions by writing the new value to the config.
    • /help key brings up a list of every available command and their correspondent function.
    • Added example KeyChangerConfig.json as a downloadable file.
    A commit-based change log can be found here

    Links:
     
    • Like Like x 5
    #1 Enerdy, Oct 30, 2013
    Last edited: Feb 22, 2015
  2. DarkOS

    DarkOS tShock supporter and programming hack.

    Joined:
    Aug 17, 2011
    Messages:
    849
    Works great on our server. Thanks for the plugin!
     
  3. Ijwu

    Ijwu Level 11

    Joined:
    Apr 4, 2012
    Messages:
    644
    This is a cool idea, I like it.
     
  4. Enerdy

    Enerdy Satellite Admin
    TShock Mod Plugin Developer Zero Day Plugin Author

    Joined:
    Nov 14, 2012
    Messages:
    506
    I have the plan of expanding this into user made recipes instead of just keys, but need more insight in how collections work before doing that. Will take a look at aMoka's source on the MultiBuffs plugin for that (coincidentally, I also used his / her format to submit the plugin. Being useful, heh?).

    Need to make it read new user inputs in the config instead of just what's defined already, but how to do that? MultiBuffs does it (since you can create buff lists).
     
  5. aMoka

    Plugin Developer Zero Day Plugin Author

    Joined:
    Nov 14, 2012
    Messages:
    162
    Recipes! I remember I did those with the Quest system when I ran a small server. Those were useful since certain limited supply/rare/hard to attain items often upset the playerbase.

    As for the format, I more or less mix-matched stuff from other devs' threads. :)
     
    • Like Like x 1
  6. Brockway

    Brockway Level 6

    Joined:
    Aug 10, 2011
    Messages:
    143
    Did chests give only 1 items ? If not, it is possible to extend the plugin to a list of item per key ?
    So when they exchange the key, the item is randomly picked on the list.
     
  7. Enerdy

    Enerdy Satellite Admin
    TShock Mod Plugin Developer Zero Day Plugin Author

    Joined:
    Nov 14, 2012
    Messages:
    506
    I though of this, and was actually going to make it that way, but Keys are hard to obtain (you have to craft them from various items), so it would be crappy not to get the biome item unless every item on the list is good. Will see.
     
  8. Brockway

    Brockway Level 6

    Joined:
    Aug 10, 2011
    Messages:
    143
    Yeah i was thinking about Nice items not some crappy melon :) but i dont really know of there is more than 1 rare Item of each biome.
    Also your plugin is great because this way you CAN farm dungeon for gold key in exchange of some regular randoms items that the world curently dont have anymore.
     
  9. Enerdy

    Enerdy Satellite Admin
    TShock Mod Plugin Developer Zero Day Plugin Author

    Joined:
    Nov 14, 2012
    Messages:
    506
    That's the point here. After I get the hang on working with random arrays I will add Gold Key. The reason I haven't added it yet is that I feel like it's too easily obtainable to trade for items.

    Plan on transforming Gold Keys in some type of currency, where better items cost more gold keys at once.
     
  10. Brockway

    Brockway Level 6

    Joined:
    Aug 10, 2011
    Messages:
    143
    Even better ! You have lot of great ideas ! Also a simple way will be to just wiping more than 1key from the inventory. Number will be enter un the command. This way you will not have to code the currency system. :)
     
  11. Enerdy

    Enerdy Satellite Admin
    TShock Mod Plugin Developer Zero Day Plugin Author

    Joined:
    Nov 14, 2012
    Messages:
    506
    Just released v1.3, check out the Changelog for details!
     
    • Like Like x 1
  12. specialops0

    Plugin Developer

    Joined:
    Jul 29, 2013
    Messages:
    415
    Works wonderfully so far! Going to do more testing.
     
  13. DankBud

    DankBud Level 8

    Joined:
    Jul 23, 2011
    Messages:
    228
    Fantastic, can you add Golden and Shadow key's?
     
  14. Enerdy

    Enerdy Satellite Admin
    TShock Mod Plugin Developer Zero Day Plugin Author

    Joined:
    Nov 14, 2012
    Messages:
    506
    Ew, haven't worked this in a while. But a future update could include a preliminary bug fix for lag stealing (an exploitable lag bug) and Gold Key support.

    Shadow keys themselves are not spent when opening Shadow Chests, so I don't think I'd bother making an exchange for them here. Gold Key plan is to exchange in amounts, with a configurable setting for creating recipes (ex. 5 gold keys for 1 gold chest, for example).
     
  15. Brockway

    Brockway Level 6

    Joined:
    Aug 10, 2011
    Messages:
    143
    if i understant correctly, if i set this line like this : "EnableRegionExchanges": false,

    server will change from normal mode for market mode without any run of command ?
     
  16. Enerdy

    Enerdy Satellite Admin
    TShock Mod Plugin Developer Zero Day Plugin Author

    Joined:
    Nov 14, 2012
    Messages:
    506
    False's default...

    If you mean true, then you still need to reload the config for it to work, with /key reload. I didn't really add /key reload in the command list, besides in the permission list. I will add it to the OP now thanks for pointing this out.
     
  17. Brockway

    Brockway Level 6

    Joined:
    Aug 10, 2011
    Messages:
    143
    Yes i mean "true" sorry ^^

    Okey i get it now, anyway after updating a config file i always restart my server, this is doing the job as well right ? :p
     
  18. Enerdy

    Enerdy Satellite Admin
    TShock Mod Plugin Developer Zero Day Plugin Author

    Joined:
    Nov 14, 2012
    Messages:
    506
    Of course it is, it's just easier to reload a config than it is to restart a server, specially when there are lots of players online.
     
  19. Brockway

    Brockway Level 6

    Joined:
    Aug 10, 2011
    Messages:
    143
  20. Enerdy

    Enerdy Satellite Admin
    TShock Mod Plugin Developer Zero Day Plugin Author

    Joined:
    Nov 14, 2012
    Messages:
    506
    Region needs to be inside quotation marks, "autelfrost", for it to work. Null means nothing basically, so it doesn't require such, but any string set in the config requires quotation marks.
     
    • Like Like x 1