|
So this is inspired by the osbuddy grand exchange price plugin. I found it useful as a player perspective. You can edit to your needs.
the prices on items on this server is different, so you'll have to set the prices accordingly to your eco, etc.. yourself.
Anyways.
Open up your ExamineItemPacketListener class in your packets.impl folder.
Replace your if statement that looks like this with mine.
Code:if(itemDef != null) {Now in your Shop class add this method.Code:if(itemDef != null) { player.getPacketSender().sendMessage(itemDef.getExamine() + " - @blu@Common trade value: @bla@" + player.getShop().checkItemValue(item)); }
TADA, add a boolean for players to toggle on or off as for their preference in use.Code:public static String checkItemValue(int item) { ItemDefinition defined = ItemDefinition.forId(item); int itemValue = defined.getValue(); return Misc.format(itemValue); }
very nice thanks
Thanks for contributing!
Just a tip: That method in Shop.java is completely unnecessary. You're actually fetching the item definition for the examined item twice.
Could just do the thing directly in the packet, like this:
Code:if(itemDef != null) { int itemValue = itemDef.getValue(); player.getPacketSender().sendMessage(itemDef.getExamine() + " - @blu@Common trade value: @bla@" + Misc.format(itemValue); }
Yeah I overlooked that itemDefinition in the class somehow, realizing now my way is unnecessary.
However, in addition you actually dont even need to create an integer to contain an item value then call it. You can just do this alternatively.
Code:player.getPacketSender().sendMessage(itemDef.getExamine() + " - @blu@Common trade value: @bla@" + Misc.format(itemDef.getValue()));
very nice thanks!
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |