Thread: [OSRSPK/Elvarg] Item value in example item

Results 1 to 8 of 8
  1. #1 [OSRSPK/Elvarg] Item value in example item 
    Registered Member
    Join Date
    Apr 2017
    Posts
    301
    Thanks given
    34
    Thanks received
    59
    Rep Power
    65
    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) {
    Code:
    if(itemDef != null) {
    			player.getPacketSender().sendMessage(itemDef.getExamine() + " - @blu@Common trade value: @bla@" + player.getShop().checkItemValue(item));
    		}
    Now in your Shop class add this method.
    Code:
    	public static String checkItemValue(int item)
    	{
    		ItemDefinition defined = ItemDefinition.forId(item);
    		int itemValue = defined.getValue();
    		return Misc.format(itemValue);
    	}
    TADA, add a boolean for players to toggle on or off as for their preference in use.
    Attached image
    Reply With Quote  
     

  2. #2  
    Registered Member

    Join Date
    Feb 2013
    Posts
    1,682
    Thanks given
    401
    Thanks received
    402
    Rep Power
    446
    Quote Originally Posted by VenomRS View Post
    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) {
    Code:
    if(itemDef != null) {
                player.getPacketSender().sendMessage(itemDef.getExamine() + " - @blu@Common trade value: @bla@" + player.getShop().checkItemValue(item));
            }
    Now in your Shop class add this method.
    Code:
        public static String checkItemValue(int item)
        {
            ItemDefinition defined = ItemDefinition.forId(item);
            int itemValue = defined.getValue();
            return Misc.format(itemValue);
        }
    TADA, add a boolean for players to toggle on or off as for their preference in use.
    Attached image
    Did mostly the same thing for my project. Mostly copied OSBuddy though, haha. Simple, but useful, good job.

    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Apr 2017
    Posts
    30
    Thanks given
    7
    Thanks received
    0
    Rep Power
    11
    very nice thanks
    Reply With Quote  
     

  4. #4  
    Extreme Donator


    Join Date
    Oct 2010
    Posts
    2,853
    Thanks given
    1,213
    Thanks received
    1,622
    Rep Power
    5000
    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);
    }
    [Today 01:29 AM] RSTrials: Nice 0.97 Win/Loss Ratio luke. That's pretty bad.
    [Today 01:30 AM] Luke132: Ok u fucking moron i forgot i could influence misc.random
    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Apr 2017
    Posts
    301
    Thanks given
    34
    Thanks received
    59
    Rep Power
    65
    Quote Originally Posted by Professor Oak View Post
    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()));
    Reply With Quote  
     

  6. #6  
    Registered Member
    Zivik's Avatar
    Join Date
    Oct 2007
    Age
    28
    Posts
    4,421
    Thanks given
    891
    Thanks received
    1,527
    Rep Power
    3285
    Thanks for the share
    Reply With Quote  
     

  7. #7  
    Registered Member
    Join Date
    Mar 2017
    Posts
    17
    Thanks given
    4
    Thanks received
    0
    Rep Power
    11
    very nice thanks!
    Reply With Quote  
     

  8. #8  
    Registered Member

    Join Date
    May 2016
    Age
    26
    Posts
    281
    Thanks given
    162
    Thanks received
    64
    Rep Power
    96
    Quote Originally Posted by VenomRS View Post
    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()));
    Alternatively, you can shorten it even further by removing the unnecessary brackets.
    Code:
    if(itemDef != null)
    	player.getPacketSender().sendMessage(itemDef.getExamine() + " - @blu@Common trade value: @bla@" + Misc.format(itemDef.getValue());
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. //////
    By Hyped in forum Help
    Replies: 1
    Last Post: 04-24-2017, 12:58 PM
  2. Replies: 3
    Last Post: 12-16-2016, 02:14 PM
  3. Replies: 1
    Last Post: 11-10-2015, 01:16 AM
  4. Replies: 2
    Last Post: 07-26-2010, 09:50 PM
  5. [req]how to change how much items cost in store[req]
    By tomthebomb80 in forum Tutorials
    Replies: 3
    Last Post: 02-07-2008, 05:44 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •