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.
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.
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?
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...
That is actually 100% perfect, and the separate signs kicks the crap out of the original "buy mode" idea Take your time.
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.
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.
That's fine. I have no idea what time it is by you either haha, so sorry if I'm bothering you really late.
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.
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.
It has methods to check, that's how I've done this Blacksmith plugin. How about I just do the ingots mcMMO style?
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.
Thanks to the help of some on IRC, I've done it: http://forums.bukkit.org/threads/mech-blacksmith-v1-0-repair-your-tools-617.11660/