RepairShop - Tool repair costs based on tool and damage values

Discussion in 'Archived: Plugin Requests' started by Kevin Forte, Apr 3, 2011.

  1. Offline

    Kevin Forte

    I've seen plugins that repair your tools, but I'd like to have sort of a shop set up for my server. Ideally, it would just be a sign that said [RepairShop] or even [BlackSmith] or something and when you right click it with whatever tool you wanted repaired it would give you back a price in chat along with "Right click again to fix!" (and activate buy mode for like... 30 seconds) and once active, if you right click the sign you pay the amount shown and your tool is fixed. The amounts would be based first on the type of tool and then on the amount of damage. For a formula, maybe

    A = T*(d/m)

    where A=the final amount rounded to an integer, m=the max hits a tool has, d=the current hits already used, and then T=the tool base cost, definable in a config file.

    For instance, a diamond pick might have a set cost of 250. If it had 60/70 hits used, (yes, I know that isn't how much they have, I just picked numbers, work with me) then the cost would be 250*(60/70) (=214). If it had 1/70 hits used, then the cost would be 250*(1/70) (=4).

    Maybe I'm getting ahead of myself, but this would be perfect.
     
  2. Offline

    retsrif

    As I said in my thread, looking at javadocs, there doesn't seem to be a method that gets the current uses, so I can't do this. If I find a method I will though.
     
  3. Offline

    Kevin Forte

    Hmm, is it possible to do it if you ignore the formula part? Like, is the cost return in chat and specific costs based on item type (defined in a config file) possible?
     
  4. Offline

    retsrif

    I take that back. After loads of time in the java files, I noticed I was an extreme idiot and missed a method that gets current uses. I'll be doing this but in around a week's time since I'm away. Might start templates now though.

    EDIT: So all signs will have the first line as [Black Smith]. There can be two things on the second line: Value, or Repair. Value gives the cost of repair, and repair, well, repairs it. In the config file, you can set the repair for wood, stone, iron, gold, diamond. I might change it to make it for specific tools later...
     
  5. Offline

    Kevin Forte

    That is actually 100% perfect, and the separate signs kicks the crap out of the original "buy mode" idea :D Take your time.
     
  6. Offline

    retsrif

    Also what should it cost? iConomy money? ingots maybe?
     
  7. Offline

    Kevin Forte

    Oh, right. iConomy money would be ideal for me, but I'm sure an ingot option would be nice for users that don't use iConomy.
     
  8. Offline

    retsrif

    I'll start with iConomy then... implement ingots later :p
     
  9. Offline

    Kevin Forte

    Awesome, thanks again :D
     
  10. Offline

    retsrif

    Almost done. Just subtracting player money left. Totally untested though, so if you don't mind could you test it for me later? Goin outside now though so maybe tonight.
     
  11. Offline

    Kevin Forte

    Yeah, I can definitely do that. Drop a link on here and I'll test it asap.
     
  12. Offline

    retsrif

    Ok just fixing iConomy hooking.
     
  13. Offline

    Kevin Forte

    Awesome :) Ready when you are.
     
  14. Offline

    retsrif

    Try and tell me if it works: <Edit by Moderator: Redacted mediafire url>
     
    Last edited by a moderator: Dec 14, 2016
  15. Offline

    Kevin Forte

     
    Last edited by a moderator: Dec 14, 2016
  16. Offline

    retsrif

    Hmm... I really can't see why it would do that... I'll leave this for tomorrow.
     
  17. Offline

    Kevin Forte

    That's fine. I have no idea what time it is by you either haha, so sorry if I'm bothering you really late.
     
  18. Offline

    retsrif

    No not at all. I wanted to do this anyway. :p
     
  19. Offline

    Kevin Forte

    Haha alright :D
     
  20. Offline

    retsrif

    I tried a small fix: <Edit by Moderator: Redacted mediafire url>

    Ok as I can't even test this and I keep getting errors, I'm going to wait until I CAN test it (saturday btw).

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Dec 14, 2016
  21. Offline

    Kevin Forte

    Alright, that's fine. Should I test that fix then?
     
  22. Offline

    marshall007

    For those of us that don't use iConomy and prefer a more vanilla style of gameplay, it would be nice for it to use the same materials the object is made from. This would be much more difficult to implement, though because I'm not sure if bukkit provides functions for determining what a given crafted item is made of. Example of a diamond pickaxe:

    Items[]: 3xDiamond; 2xStick
    Repair Needed: (Player Uses/Max Uses)+Repair Bonus
    Cost: (1-Repair Needed)*Items[]

    'Repair Bonus' is a decimal value (0-1) set in the config file, and determines how effective repairs are.

    Common Exceptions:
    1) Cost of any required items is less than 1.
    2) Player doesn't have enough of the required items in their inventory.
     
  23. Offline

    retsrif

    It has methods to check, that's how I've done this Blacksmith plugin. How about I just do the ingots mcMMO style?
     
  24. Offline

    marshall007

    What, specifically, does that mean?
     
  25. Offline

    retsrif

    It just measures your uses, and depending on how much it charges you a different amount of ingots.
     
  26. Offline

    marshall007

    That's fine I guess, but it results in unrealistic gameplay. Perhaps you could simply charge one stick and X of the type of tool? That would be pretty easy.
     
  27. Offline

    retsrif

Share This Page