[ECON] DynamicMarket V0.6.0 - Versatile Shop Plugin [953]

Discussion in 'Inactive/Unsupported Plugins' started by GoalieGuy6, Jul 3, 2011.

  1. Offline

    GoalieGuy6

    DynamicMarket - Dynamic Global Shop Plugin
    Download V0.6.0 (JAR | Source on GitHub)

    Current version: 0.6.0
    Tested against: CraftBukkit build #953

    JAR Mirror (Version 0.6.0)
    Older Versions


    Note: Upon first run the plugin will attempt to convert your database in order to add decimal support to item prices. I was unable to test the conversion code too extensively so if you run into any errors with this please post your server log so I can take a look.

    Most of this was copied from the original thread found here. This is the first plugin I have ever worked on and also the first Java project I have worked on, so I am sure there is a lot that I could've done better. For now I haven't done much more than add a few small features and fix a couple bugs. If you have any requests or experience any bugs/errors please let me know and I'll see what I can do.

    Some of the information below is outdated, I am working on updating the post.

    Requirements:
    Read this before proceeding

    READ THIS (open)
    This plugin has a great deal of flexibility, but the price of more flexibility is more command options to control that flexibility. Computers just aren't very psychic.

    While in-game help exists for commands, the output from /shop help (<topic>) is intended to be a quick reference, not exhaustive documentation. Full instructions simply won't fit on the MineCraft client's tiny text display.

    You should read and understand the following sections before installing this plugin and setting up your shop. If not, you should at least read and understand the following sections while you are setting up your shop items.


    The big feature: Dynamic pricing. Items can be set to increase in price as they are purchased from the shop, and decrease in price as they are sold back, simulating open market conditions. The initial prices of items are just considered a starting point - user transactions will eventually adjust an item's price to a near-ideal level, based on actual value vs. rarity.

    However, as of 0.4.5, the configuration fields are now flexible enough to allow a range of behaviours, from fixed pricing with no stock limits, to fully-dynamic pricing with finite stock levels.

    This is by no means "complete" in the sense of "finished adding features", but it is complete enough to be functional and usable.

    Current Features (open)
    New & Current Features:
    • Buying and selling of items:
      • Item prices can now have decimals in them!
      • Checks if a player has enough space to hold items before purchasing!
      • Item prices can be set to dynamically adjust according to supply and demand. This is highly adjustable, including the rate of price increase/decrease per transaction, optional hard overstock/understock limits, price ceilings/floors, etc. Leaving all the extra features turned off makes an item's price fixed and always-in-stock, like a basic "flat rate" shop.
      • Subtypes of items are fully supported.
      • List of items in the shop is broken into pages, accessible by number.
        • Partial-name searching! "/shop list wood" shows everything with "wood" in the name.
      • Item names for buy/sell/info also use partial substring matches.
      • A dynamically-priced item might cost more for 10 items than the cost of 1 item multiplied by 10, due to stock depletion. So, the "/shop <id>" command now takes an optional ":<count>" parameter, so you can get a quote for the actual buy/sell price of larger numbers of items.
    • Administration:
      • Set OPs to have all admin permissions in the config!
      • Shop items are edited via a "tag" system, so you don't have to re-enter every field for each small change. Plus there's a few utility tags which do other things to an item's record...
      • Item names are now editable, and will persist (independent of items.db) until the item's record is deleted.
        • This also makes items.db a convenience instead of a necessity, since items can be added by ID and then immediately renamed.
      • A "Default" item exists in the shop, which cannot be bought or sold, but serves as the base data for any new items you add to the shop. Any tags not supplied when you add an item will be copied from whatever you put into "Default".
      • Basic sanity-checking on input data has been added. Also, adjusting an item's bundle-size will rescale its price automatically.
      • Items can be set to be purchasable but not sellable, or vice versa. (Set either price to -1 to disable that transaction type for that item.)
        • Tags like "canbuy:n" and "nosell" can now be used.
      • An extended in-game help system. "/shop help" lists available commands and help topics. "/shop help <topic>" gives help on a shop command or other shop-related topic listed in the main help.
      • The list of commands displayed is filtered by the user's current permission level.
      • Shortcuts for all commands (except for database reset).
      • All commands except for "/shop buy" and "/shop sell" can be accessed through the Bukkit console. No need to log in to add or update items!
      • Access to the entire shop is now restrictable by permission.
      • Highly informative error messages, to help reveal why your database exploded. (Which really shouldn't happen, but you never know...)
      • The shop DB can now be exported to a .csv file, edited in your favorite spreadsheet, and re-imported back into the database, making large-scale changes easier.
      • The revenue/cost of transactions can now be transferred to another account. With the basic plugin, this can be an admin's iConomy account, or a dummy "GovernmentBank" account. (Don't use that name, or some bright spark will register that username and exploit you.) With a wrapper plugin, this can be set to link a shop's funds directly to an owning player's iConomy balance.
      • Transaction logging to a comma-delimited file, ready to import into a spreadsheet for nefarious financial analysis!
    Market Mechanics (open)
    Quick Market Mechanics Description:

    • Instead of a "buy price" and a "sell price", items now have a "base price" and a "sales tax". The "buy price" is based on the base price (adjusted by stock, if set to do so), and the "sell price" is based on (<buy price> - <sales tax%>). So if the sales tax is set to 25, then an item's selling price will be 75% of its purchase price. (The sales tax is entered as a number from 0 to 100, representing 0% to 100% tax.)
      • Using the old "/shop add <id> <buyprice> <sellprice>" format still works - the plugin just calculates the base price and sales tax, so that the buying and selling prices come out right.
    • Shop items have a "stock level", which is not necessarily a literal count of items in stock. By default, the stock level is considered an offset from baseline, rather than an absolute count.
      • Items with stock near zero are considered to be in "average" supply, and will be priced at their base price.
      • Items with a positive stock are considered "in surplus", and will be priced below their base price.
      • Items with a negative stock are considered "understocked", and will be priced above their base price.
      • This interpretation of stock levels can be made to behave like literal counted stock, by setting an item's StockFloor to zero, which prohibits negative stock.
    • Items have a "volatility", which indicates how quickly the price changes based on changes in stock level. It represents the percent increase in an item's price per item purchased, multiplied by 10000. V=1 (the lowest level) means that 100 items would have to be purchased to raise the price by 1%. V=10000 (the highest level) means that 1 item purchased would raise the price by 100% (doubling the price). (More examples in tags.txt)
      • There is also "inverse volatility", which represents the number of items needed to be bought in order to double the buying price (or halve it, if selling). This is more convenient for some people's mindsets, and is converted into volatility when entered.
    • The "sell price" is actually calculated from the buy price at the current stock level + 1, rather than the current stock level. This is to prevent gaining endless money by buying an item (driving the price up) then immediately selling it back (dropping the price) - if <sales tax> = 0, then buying-then-selling like this produces zero net gain/loss (as it should).
    • The tag presets "fixed", "float", "finite", and "flat" allow you to quickly set up common options. If used with the "Default" item before adding items to your shop, this will allow you to set the overall behaviour of the shop easily. See Tag Reference for further details.
    Commands (open)
    Commands:


    <Angle Brackets> denote parameters.
    (Round Brackets) denote optional sections.
    The brackets themselves are not part of the command; they are just used to describe syntax. Brackets should not be typed.
    If executing shop commands through the Bukkit console, leave off the initial slash.

    /shop - Shows the main help page. Lists commands and shortcuts.
    /shop help - Ditto.
    /shop help <topic> - Shows help on the given command or subject.
    /shop help tag <tagName> - Shows help on the given item tag.
    /shop <id>( :<count>) - Shows current buy/sell information on the given item.
    <id> can be an item name or a type number with an optional subtype:
    <id> = <itemName> | <itemID> | <itemID>,<subtypeID> | Default
    If <count> is used, shows the total price for the given number of items/bundles.
    /shop list (<partname>) (<pageNum>) - Lists a page of items in the shop. Default page = 1.
    If <partname> is used, lists only items with <partname> as part of their name.
    /shop buy <id>( :<quantity>) - Purchases an item. Default quantity is 1 bundle.
    /shop sell <id>( :<quantity>) - Sells an item. Default quantity is 1 bundle.
    /shop add <id>( :<bundleSize>) (<buyPrice> (<sellPrice>)) <tagList> - Adds an item to the shop list.
    <buyPrice> and <sellPrice> are accepted for convenience, and are internally converted to BasePrice and SalesTax.
    Unused tags will have their data copied from the Default item.
    Transactions will be in multiples of <bundleSize>. Default quantity is 1 item per bundle (unless overriden with the Default record)
    /shop info <id> - Shows much more detailed information about an item in the shop, such as stock level, volatility, etc.
    /shop update <id>( :<bundleSize>) (<buyPrice> (<sellPrice>)) <tagList> - Edits an item's shop data record.
    Data is first copied from the old record, then tags are applied in order of entry.
    <id> can be "all", applying changes to all items in the shop list.
    /shop remove <id> - Removes an item from the shop list.
    /shop reload - Reboots the plugin, reloading the configuration file and items.db.
    /shop reset - Deletes and recreates the shop database from scratch. Asks for an extra confirmation before doing so.
    /shop exportdb - Exports the shop database to a .csv file. The name and location are configured in SimpleMarket.settings. (Default: Plugins/DynamicMarket/shopDB.csv)
    /shop importdb - Imports a .csv file into the shop database. Same file location as used by the exportdb command. Note that the previous contents of the database are NOT cleared out before importing, so you may want to do a "/shop reset" before importing. The file's format MUST match the format of the exported file (except for quote marks, which are stripped out on import).
    Permission Nodes (open)
    Permission Nodes:

    'dynamicmarket.access' : Grants basic access to the root /shop command.
    'dynamicmarket.buy' : Grants purchase rights.
    'dynamicmarket.sell' : Grants selling rights.
    'dynamicmarket.items.add' : Grants the ability to add new items to the shop.
    'dynamicmarket.items.update' : Grants the ability to edit items in the shop.
    'dynamicmarket.items.remove' : Grants the ability to remove items from the shop.
    'dynamicmarket.admin.reload' : Grants the ability to reload the plugin's config and db.
    'dynamicmarket.admin.reset' : Grants the ability to reset the shop's database.
    'dynamicmarket.admin.db' : Grants the ability to export and import the shop's database using .csv files.
    Installation/Setup (open)
    Installation/Setup:
    Step 1) Make sure you have all the required plugins/dependencies
    Step 2) Copy DynamicMarket.jar into your Plugins/ folder.
    Step 3) Add the permissions if you are using a permission plugin.
    Step 4) (Re)Start your MineCraft server. Errors may be thrown to the console, but the file Plugins/DynamicMarket/DynamicMarket.settings should be created.
    Step 5) Edit DynamicMarket.settings to suit your needs.
    Step 6) Use "shop reload" from the console to load the edited config file.
    Step 7) Use /shop add to fill the market with tasty blocks at scandalous prices.

    Note: You WILL want to use "/shop update default" to set up some sensible default values for the items you will be adding, so you don't have to do so much typing for every item. (Or at least inspect the Default entry, to be sure you agree with it.) If you want to make all of the items in the shop use dynamic pricing, set up the parameters in the Default item FIRST, so you don't have to go back and modify 100+ items to support variable pricing.
    Configuration (open)
    Configuration
    Code:
    general:
        # Shop tag is what is displayed before most shop output  Default is [Shop].  Improved coloring system coming soon
        shop-tag: '{BKT}[{}Shop{BKT}]{} '
        transactions:
            # Whether or not shop transactions should be logged
            log-transactions: false
            # The file to log transactions in (located in plugins/DynamicMarket)
            log-file: transactions.log
            # If true the file will save after every transaction.  If false the file will save on server shutdown
            log-auto-flush: true
            # Maximum number of items (not bundles) a user is allowed to buy in one transaction
            max-items-buy: 64
            # Maximum number of items (not bundles) a user is allowed to sell in one transaction
            max-items-sell: 64
    database:
        # Database type, either sqlite or mysql
        type: sqlite
        sqlite:
            # The file to store an sqlite database in (lcoated in plugins/DynamicMarket)
            file: shop.db
        mysql:
            # URI for your mysql database
            database: jdbc:mysql://localhost:3306/minecraft
            # MySQL username
            user: root
            # MySQL password
            password: pass
            # MySQL database engine (recommended MyISAM)
            engine: MyISAM
    permissions:
        # If set to true DynamicMarket will ignore the permissions plugin
        # Regular users get 'dynamicmarket.access', 'dynamicmarket.buy', and 'dynamicmarket.sell'
        ignore-permissions: false
        # Whether or not ops should get all permissions
        op-permissions: false


    Changelog (Full Changelog)
    0.6.0
    • Added message.yml file
      • Almost all messages can be configured
      • Colors supported
    • Bug fixes
      • Fixed some settings not being loaded properly
      • No more NullPointerExceptions (hopefully)
    • Improved auto-update script
    0.5.3
    • Converted config file to yml
      • Your DynamicMarket.settings will be converted automatically
    • Fixed inventory space check for items with subtypes
    0.5.2
    • Rewritten API
      • DMWrapper update coming soon
     
    DJ_Idol and Juze like this.
  2. Offline

    Retricide

    @GoalieGuy6 hasn't been online for over a month now (July 17th).
    I think Dynamic Market is about to die again, unless someone continues this, sadly.
     
  3. Offline

    UFO64

    I hope it doesn't, this mod is great for our players!
     
  4. Offline

    chuiby

    When i type /shop importdb
    it imports the database from ./plugin/DynamicMarketshopDB.csv
    instead of ./plugin/DynamicMarket/shopDB.csv

    Also, decimals doesn't work...

    It just reset the price to 0 or something like that
     
  5. Offline

    jonahverner

    Can someone give me the file on what their prices are? it would be much appreciated
     
  6. Offline

    Jesseg2

    love the plugin, but got a question...
    i dont want player to be able to go mining and just buy all the iron pickaxes and wood WHILE mining, i only want them to be able to use the shop at a certain "Market" area, like right now im using sign shops for my market... but this would be awesome if i could use this ! either using the commands in certatin area or using this as a sign shop
     
  7. Offline

    goldseed

    I like this concept... Price should be controlled by market...


    ... and...
    Economy in the game is not same with real one...
    I think it will be better to go back initial price gradually... after time...
     
  8. Offline

    dpsi

    Someone please Update to atleast the latest build! im getting
    Code:
    [SEVERE] null
    org.bukkit.command.CommandException: Unhandled exception executing command 'shop' in plugin DynamicMarket v0.6.0
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:41)
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:163)
        at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:353)
        at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler.java:755)
        at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:720)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:713)
        at net.minecraft.server.Packet3Chat.a(Packet3Chat.java:33)
        at net.minecraft.server.NetworkManager.b(NetworkManager.java:226)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:91)
        at net.minecraft.server.NetworkListenThread.a(SourceFile:108)
        at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:464)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:374)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:417)
    Caused by: java.lang.NullPointerException
        at com.gmail.haloinverse.DynamicMarket.MarketItem.infoStringBuy(MarketItem.java:635)
        at com.gmail.haloinverse.DynamicMarket.iListen.shopShowItemInfo(iListen.java:461)
        at com.gmail.haloinverse.DynamicMarket.iListen.parseCommand(iListen.java:876)
        at com.gmail.haloinverse.DynamicMarket.DynamicMarket.onCommand(DynamicMarket.java:183)
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:39)
        ... 12 more
    2011-09-18 15:21:05 [SEVERE] null
    org.bukkit.command.CommandException: Unhandled exception executing command 'shop' in plugin DynamicMarket v0.6.0
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:41)
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:163)
        at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:353)
        at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler.java:755)
        at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:720)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:713)
        at net.minecraft.server.Packet3Chat.a(Packet3Chat.java:33)
        at net.minecraft.server.NetworkManager.b(NetworkManager.java:226)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:91)
        at net.minecraft.server.NetworkListenThread.a(SourceFile:108)
        at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:464)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:374)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:417)
    Caused by: java.lang.NullPointerException
        at com.gmail.haloinverse.DynamicMarket.MarketItem.infoStringBuy(MarketItem.java:635)
        at com.gmail.haloinverse.DynamicMarket.iListen.shopShowItemInfo(iListen.java:461)
        at com.gmail.haloinverse.DynamicMarket.iListen.parseCommand(iListen.java:876)
        at com.gmail.haloinverse.DynamicMarket.DynamicMarket.onCommand(DynamicMarket.java:183)
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:39)
        ... 12 more
    running bukkit 1149
     
  9. Offline

    iXTrace

    @dpsi: Works for me on 1149 (12:06:02 [INFO] This server is running Craftbukkit version git-Bukkit-0.0.0-1043-g979f4e1-b1149jnks (MC: 1.8.1))
     
  10. Offline

    Animosity

    Also getting this.
     
  11. Offline

    goldseed

    works on #1193

    my plugins are NarrowtuxLib, BorderGuard, MyWarp, MyHome, Minequery, Multiverse-Core, PistonProtect, WorldGuard, WorldEdit, playerLives, LogBlockQuestioner, ChatCensor, Command iConomy, NaturalGiants, CommandHelper, Multiverse-Portals, PermissionsBukkit, Permissions, CreativeStick, Essentials, iConomy, NoCheat, DynamicMarket, ChestShop, AutoClear, Stats, bcVote, LWC, Achievements, AntiGuest, Showcase, mcMMO, LogBlock, AuthDB, mChat, PreciousStones.

    check yours.
     
  12. Offline

    dpsi

    There is no 1193 yet :eek:
    Current latest build as of 10:21 pst is 1185
     
  13. Offline

    goldseed

    sorry.. #1183
     
  14. Offline

    croxis

    I'll see what I can do for 1185.

    ugg, sorry it is taking so long. I am learning maven and jenkins and am having issues getting the economy plugins working with it.


    UGG, I'm giving up trying to get this working. I'll let someone with a bit more experience take over this.
     
  15. Offline

    dpsi

    out of curiosity are you using mysql or sqlite/h2?
    and are you using iconomy 5 ,6 or essential eco?
     
  16. Offline

    goldseed

    mysql & iconomy5 now 1185..
     
  17. Offline

    Shalobee

    Any other devs wanna fork this again :) its my favorite shop plugin.
     
  18. Offline

    slipcor

    yeah, I'll try - though it was working perfectly with #1185 and now also is with #1240, the data value stuff really bugs me -.- (and my players)
     
  19. Offline

    agafaba

  20. Offline

    dschmitt97

    Does this plugin work on the newest RB of CraftBukkit? If not, could someone fork it, its a really nice plugin because you can set the buy and sell prices differently, and I haven't seen another plugin (that works) do that since this one.
     
  21. Offline

    Revenger

    We want to set this up and want the wrapper locations to make the shop fir into our towns around the map
     

Share This Page