[WIP][ECON]NPC Trader

Discussion in 'WIP and Development Status' started by MatCat, Feb 10, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    MatCat

    I got tired of waiting for a localized iconomy shop plugin, so I am making one myself.

    I am expecting to have an early preview release of this today, but it's going kind of slow for me as I have never written a single line of code in Java before this plugin so I am learning it as I go along (Slowing me down a little), however I have extensive programming experience in other languages so I am chugging along smooth and steady :).

    Been working on this for nearly 24 hours straight so I am tired and will work on reformatting this post for easier readability when my mind is not so fogged :).

    Just a note, this is primarily focused for me and my server's needs, I am going to release this for public use because it is desperately needed, however I am not going to go out of the way to try to accommodate everyone's wishes. I know a few of you aren't going to like the requirements of MySQL + Permissions + iConomy, however that is how it is going to be for now, and when I am not quite so busy I will look into adding in SQLLite options and maybe support for other economy systems. If you have any suggestions or ideas feel free to post them however I may or may not listen to it :).


    NPC Trader will create a human NPC which you can interact with to buy and sell items.

    Percentage Complete: Approx. 70% (I will update this throughout the day)

    Release Features:
    iConomy integration (iConomy Required)
    MySQL Storage (Required for now)
    Permissions (Required)
    Customizable messages per NPC
    Partial name lookup (Of online players)
    Utilizes item names / ID's

    Planned Features:
    Web based administration


    Command Outline - All commands begin with /npctrader (Or /npc for short):
    (NOTE: All commands other then create require you to right click on the NPC to interact!)

    create <name> <ItemSlots> <Units>

    Creates an NPC. ItemSlots is a list of items bought/sold, Units is how many stacks (64) of that item can be stored per slot. Configurable price for cost of slots and units in config.

    remove

    Destroys an NPC, refunds a percentage (set in config)

    AddOwner <Player Name>

    Add's player to owner list.

    RemoveOwner <Player Name>

    Remove's player from owner list.

    AddManager <Player Name>

    Add's player to management.

    RemoveManager <Player Name>

    Removes a player from management.

    SetManager <Permission> <true/false>

    Set's permission flag for manager. Permissions are:
    Stock, Unstock, Move, Pricing, Messages

    Upgrade <Type> <Quantity>

    Upgrades type based on quantity. This can be a positive or negative number which add's / subtract's from current value, I.E., If you have a NPC with 5 ItemSlots and 5 Units and issue Upgrade ItemSlots 1 it will make the new ItemSlots 6.

    This will charge/refund the player based on prices set in configuration.

    Types are:
    ItemSlots, Units

    Move

    Move's NPC to your position, this includes body and head position.

    AdjustBody <pitch> <yaw>

    Adjust the pitch and yaw of the NPC.

    banker <Player>

    Changes who the banker is for the NPC. This is the person all money is deposited/withdrawed from.

    Message <MessageType> <Message>

    Adjust's the NPC's messages.

    MessageType List:
    Greeting, Goodbye, Sell, Buy, InsQtyBuy, InsQtySell, InsFundsBuy, InsFundsSell, NotStocking

    Stock <SlotID> <Quantity>

    Stock's a slot with Quantity of item.

    Unstock <SlotID> <Quantity>

    Unstocks a slot with Quantity of item.

    SlotSetup <SlotID> <Item> <Lot Quantity> <Buy Price> <Sell Price> <Buying> <Selling>

    Sets up a lot. Buying and Selling must be either true or false.

    SlotAdjust <SlotID> <Parameter> <value>

    Adjusts a slot's configuration. Parameters are:
    Item, Lot,BuyPrice,SellPrice,Buying,Selling

    list

    List of everything the NPC is buying and selling (Paginated)

    buy <ItemSlot> <Quantity>

    Purchase Quantity of Item from specified slot.

    sell <ItemSlot> <Quantity>

    Sell Quantity of Item from specified slot.
     
  2. Offline

    Daveyo

    i think i speak for everyone when i say "Yeeeeeeeeeeeeeeeeeeeeeeeessss"
     
  3. Offline

    MatCat

    Yeah don't know if I will get it out today, but I am gonna try, if not tomorrow.
    --- merged: Feb 11, 2011 5:04 AM ---
    Still working on it, I had a job today that sucked up a lot of my time. Being a noob to Java it took me a while to figure out how to properly use hashmaps, and lots of SQL debugging which I am doing right now.

    At the moment the plugin is nearly functional, all I mainly have left to do is finish up a few commands, add friendly error trapping messages, and test. Should have this out by tomorrow!
     
  4. Offline

    uncovery

    this sounds REALLY amazing! Cannot wait to get my hands on this! I understand correctly that the stuff sold is not spawned but has to be filled in by the owner? If so this is great!
     
  5. Offline

    Bilkokuya

    Is there any way you can release what has been done so far and just update it as more gets done?
    I'm sure I'm not the only one who's really looking forward to this and who doesn't care if everything works, so long as there's something to download.
     
  6. Offline

    awem

    Looks extremely promising. Can't wait to see how this ends up.
     
  7. Offline

    MatCat

    It's still got very unfriendly interface to release as I have all kinds of debug messages, but I am going to try to push this out by the end of the night. Yes it has to be stocked, no spawned inventory.
     
  8. Offline

    uncovery

    go man! you can do it! YEEEEEEAAAAAHHHHH!

    ;-)
     
  9. Offline

    MatCat

    I'm gettin there! All that is left is polishing up the output messages, stock and unstock command, and the buy and sell command. I might just have it out tonight !
     
  10. Offline

    nachotp

    epic idea, looking forward for this
     
  11. Offline

    Bilkokuya

    The entire server over here is looking forward to it.
     
  12. Offline

    MatCat

    Still have to implement the buy and sell commands and polish the returned messages. I'm hoping to have a releasable version in the next few hours.
    --- merged: Feb 12, 2011 2:58 PM ---
    All commands now work! All that is left is to polish the messages and move some hardcoded stuff to config.yml.

    Hopefully I can have this out in 2 hours or so.

    Since I am trying to get this out there quickly as I know a lot of servers have been waiting way longer then should be for a full featured localized shop system, I am going to release this with a few things left to be done. Mainly this includes using permissions, and letting admins control other peoples NPC's. Rest assured I will be adding those two things in quickly, but I am going to release the initial version without so I can get it out there and tested.

    IF this plugin is pretty successful you can expect a lot more plugins from me!
     
  13. Offline

    moonmike

    cool cant wait
     
  14. Offline

    MatCat

    Taking longer then I expected on what's left, but there are some cool things I have done that I think everyone will like. Maybe another hour or two!
    --- merged: Feb 12, 2011 8:52 PM ---
    All I have left is to do a config.yml and put all configurable options in there! Hopefully this won't take too long.
    --- merged: Feb 12, 2011 11:32 PM ---
    Almost done with this, last step I have to do is have it setup the database if not already setup. This will be out today and soon!
     
  15. Offline

    Michael Murphy

    awesome! I'll be in your base camping you out.
     
  16. Offline

    MatCat

    I ran into snafoo's when it came to doing the DB checks and config file checks, but I got it mostly ironed out now. Should be ready for testing release soon!
    --- merged: Feb 13, 2011 6:38 AM ---
    Ok I am loading this plugin onto my server for testing and drafting up the post for Plugin Submissions forum, link will be up soon!
     
  17. Offline

    unrivaledneo

    oooo waiting to test it for u :D
     
  18. Offline

    uncovery

    I am having trouble installing the latest iConomy plugin with the latest Craftbukkit. I would be happy if you can tell us which craftbukkit version will be supported!
     
  19. Offline

    MatCat

    Right now it runs stable on 313, iconomy seems to be broken on 318 and it requires it so until iconomy gets updated 313 seems to be stable. I am drafting the post on submissions forum. You can get the jar

    The command structure listed above is slightly different then what it is now, stay tuned to submissions forum for details on use. After first startup it will create a config.yml you will have to edit for your db settings and such.

    IT does give stacktrace errors sometimes, still needs polishing on output on the console and a little bit in game.
     
  20. Offline

    uncovery

    hmm... sorry, dont want to ask you to debug iConomy, but I am getting errors with 2.2b on 313:
    SEVERE: Could not pass event PLAYER_JOIN to General

    You are running 2.2b + 313?
     
  21. Offline

    MatCat

    odd, I don't believe I have gotten that on 313...
     
  22. Offline

    uncovery

    I am quite lost on this. I tried the latest, 313, 289 (since some people told this works). It does not create the directory or config. I have to check the file permissions again I guess.
     
  23. Offline

    MatCat

    If it does not create the folder automatically for you you could just grab the config.yml and items.db from the jar.
     
  24. Offline

    uncovery

    There are only .class files in the .jar. I am not very familiar with Java, so I only can open this in linux and the directories there dont have any of the two files in there.

    When I download the .zip, there are iConomy.settings and logging.settings, and a subfolder templates there...
     
  25. Offline

    MatCat

    In the jar in the src folder
     
  26. Offline

    nachotp

    i got errors wth it :C tihs is a great plugin
     
  27. Offline

    MatCat

    Can you quote the errors?

    BTW since this is now in submissions forum let's close this [WIP] topic and start discussing it on the Submissions one.
     
  28. Offline

    mixxit

    As far as i know since essentials needs GroupManager this is no longe rworking?

    I gave my users all the right npc.x access and it denies them /npc setup etc
     
  29. Offline

    KiloWhiskey

    @MatCat I don't use any form of iconomy on my server and have no use for npcs as npcs but I'm wondering if there is any way to use this plugin to create statues in a structure I'm building? I would just need a player style character (with the skin of my choosing) to stand in one spot an never move. Is that possible? I have two account so if the skin has to be pulled from a player by name I could just set the smooth stone player skin for my alt and have the statues pull that skin. (don't even know if that's possible like it was back with craftizens)
     
  30. Offline

    cjbh1996

    HELP!

    Code:
     [SEVERE] com/nijikokun/bukkit/iConomy/iConomy (Is it up to date?)
    java.lang.NoClassDefFoundError: com/nijikokun/bukkit/iConomy/iConomy
        at com.MatCat.NPCTrader.NPCTrader.checkiConomy(NPCTrader.java:630)
        at com.MatCat.NPCTrader.NPCTrader.onEnable(NPCTrader.java:132)
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:140)
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:426)
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:187)
        at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:79)
        at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:60)
        at net.minecraft.server.MinecraftServer.e(MinecraftServer.java:187)
        at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:174)
        at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:120)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:227)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:366)
    Caused by: java.lang.ClassNotFoundException: com.nijikokun.bukkit.iConomy.iConomy
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:30)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 12 more
    
    I get this when I start Craftbukkit WITH NPCTrader, but when I take it out, it's perfectly fine. Yes, I've installed iConomy, it works, yes I have mySQL installed, yes I've put in the little mySQL connector or whatever it is. I pasted this code because I have no idea what it says, there're no keywords that stand out for me. Could someone decipher this code and tell me how to fix this? It's preventing me from using NPCTrader!
     
Thread Status:
Not open for further replies.

Share This Page