Thread: Matrix Decanting [667/718/*]

Page 1 of 2 12 LastLast
Results 1 to 10 of 19
  1. #1 Matrix Decanting [667/718/*] 
    Super Donator

    Tyluur's Avatar
    Join Date
    Jun 2010
    Age
    23
    Posts
    4,559
    Thanks given
    1,594
    Thanks received
    1,474
    Rep Power
    1222
    This code is from 2013 so pls dont hate thx guys.

    Code: [Only registered and activated users can see links. ]
    Last edited by Tyluur; 01-04-2021 at 07:10 PM.

    [Only registered and activated users can see links. ] | [Only registered and activated users can see links. ] | [Only registered and activated users can see links. ] (official dog of rune-server)
    -------------------
    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  2. #2  
    Registered Member

    Join Date
    Feb 2010
    Posts
    3,117
    Thanks given
    1,098
    Thanks received
    786
    Rep Power
    1261
    why did u write a book for this though

    maybe i'm missing something but wouldn't a simple method replacing one vial with another do the job?

    edit: synchronized blocks for decanting? is this a joke Tyluur
    Reply With Quote  
     

  3. Thankful users:


  4. #3  
    Registered Member
    Join Date
    Dec 2013
    Posts
    285
    Thanks given
    98
    Thanks received
    65
    Rep Power
    326
    Cool release, I was just looking at the code and a question:

    Code:
    List<Item> items = null;
    This gets re-initialized at every iteration in your while loop. So the previous iterations are not getting cached. You then after the while loop, foreach over that items list and check if the players inventory contains the item.

    Does each
    Code:
    Entry<String, List<Item>> entry = it$.next();
    contain the entire inventory (or at least the items we want) or is this a bug in the code?

    I haven't looked at the rest of the code.
    Reply With Quote  
     

  5. Thankful user:


  6. #4  
    Developer


    Join Date
    Aug 2012
    Age
    22
    Posts
    2,489
    Thanks given
    175
    Thanks received
    1,655
    Rep Power
    2319
    thanks will use rep++
    Reply With Quote  
     

  7. Thankful user:


  8. #5  
    Donator

    .css's Avatar
    Join Date
    Dec 2018
    Age
    26
    Posts
    268
    Thanks given
    38
    Thanks received
    77
    Rep Power
    107
    At least you contribute regardless so good job T

    Check out Neos! A #718 RSPS. Click below.
    [Only registered and activated users can see links. ]

    Zed#3343
    Reply With Quote  
     

  9. Thankful user:


  10. #6  
    Super Donator

    Tyluur's Avatar
    Join Date
    Jun 2010
    Age
    23
    Posts
    4,559
    Thanks given
    1,594
    Thanks received
    1,474
    Rep Power
    1222
    Quote Originally Posted by Kiissmyswagb View Post
    Cool release, I was just looking at the code and a question:

    Code:
    List<Item> items = null;
    This gets re-initialized at every iteration in your while loop. So the previous iterations are not getting cached. You then after the while loop, foreach over that items list and check if the players inventory contains the item.

    Does each
    Code:
    Entry<String, List<Item>> entry = it$.next();
    contain the entire inventory (or at least the items we want) or is this a bug in the code?

    I haven't looked at the rest of the code.
    If that's the case, there's some improvements that can be made . I didn't really go over all of it indepth, just thought it would be valuable to somebody, rather than sit in my archives.

    Quote Originally Posted by Fire Cape View Post
    why did u write a book for this though

    maybe i'm missing something but wouldn't a simple method replacing one vial with another do the job?

    edit: synchronized blocks for decanting? is this a joke Tyluur
    Well you have to take into account every vial in the runescape universe. There's emptying, putting one vial with another, checking compatibility. I manipulated strings [used item names] for these functions. You can do it in lots more ways though. The cache is a very helpful resource once decoded.

    Quote Originally Posted by Fire Cape View Post
    why did u write a book for this though

    maybe i'm missing something but wouldn't a simple method replacing one vial with another do the job?

    edit: synchronized blocks for decanting? is this a joke Tyluur
    Well you have to take into account every vial in the runescape universe. There's emptying, putting one vial with another, checking compatibility. I manipulated strings [used item names] for these functions. You can do it in lots more ways though. The cache is a very helpful resource once decoded.

    [Only registered and activated users can see links. ] | [Only registered and activated users can see links. ] | [Only registered and activated users can see links. ] (official dog of rune-server)
    -------------------
    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  11. #7  
    Registered Member
    JayArrowz's Avatar
    Join Date
    Sep 2008
    Posts
    37
    Thanks given
    35
    Thanks received
    43
    Rep Power
    303
    Do you even know how to use synchronized locks properly?

    You are creating a new lock object every time u call the method, which means the lock is redundant. Also multiple threads dont hit ur synchronized blocks which makes it 2x redundant.
    Shit code srry


    Reply With Quote  
     

  12. #8  
    Contributor Kris's Avatar
    Join Date
    Jun 2016
    Age
    23
    Posts
    3,516
    Thanks given
    680
    Thanks received
    2,274
    Rep Power
    4844
    Code:
    		Object lock = new Object();
    		for (Item item : player.getInventory().getItems().toArray()) {
    			if (item == null || item.getDefinitions().isNoted() || !isPotion(item.getName())) {
    				continue;
    			}
    			synchronized (lock) {
    				String name = item.getName();
    				String base = Decanting.getBaseName(name);
    				int doses = getPotionDoses(name.split(" "));
    				if (map.containsKey(base)) {
    					int amt = map.get(base);
    					map.remove(base);
    					map.put(base, amt + doses);
    				} else {
    					map.put(base, doses);
    				}
    			}
    		}
    This should be a bannable offence in rune-server.
    Reply With Quote  
     


  13. #9  
    Super Donator

    Tyluur's Avatar
    Join Date
    Jun 2010
    Age
    23
    Posts
    4,559
    Thanks given
    1,594
    Thanks received
    1,474
    Rep Power
    1222
    Quote Originally Posted by Kris View Post
    Code:
    		Object lock = new Object();
    		for (Item item : player.getInventory().getItems().toArray()) {
    			if (item == null || item.getDefinitions().isNoted() || !isPotion(item.getName())) {
    				continue;
    			}
    			synchronized (lock) {
    				String name = item.getName();
    				String base = Decanting.getBaseName(name);
    				int doses = getPotionDoses(name.split(" "));
    				if (map.containsKey(base)) {
    					int amt = map.get(base);
    					map.remove(base);
    					map.put(base, amt + doses);
    				} else {
    					map.put(base, doses);
    				}
    			}
    		}
    This should be a bannable offence in rune-server.
    Are you spamming or are you going to post something meaningful?

    --- EDIT ---

    It's been two years, Kris. Give something back.


    [Only registered and activated users can see links. ] | [Only registered and activated users can see links. ] | [Only registered and activated users can see links. ] (official dog of rune-server)
    -------------------
    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  14. #10  
    Registered Member
    JayArrowz's Avatar
    Join Date
    Sep 2008
    Posts
    37
    Thanks given
    35
    Thanks received
    43
    Rep Power
    303
    Quote Originally Posted by Tyluur View Post
    Are you spamming or are you going to post something meaningful?

    --- EDIT ---

    It's been two years, Kris. Give something back.

    I mean all your giving back here is a bunch of technical debt prob worse than giving nothing back
    Reply With Quote  
     


Page 1 of 2 12 LastLast

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. Replies: 8
    Last Post: 08-22-2017, 06:16 AM
  2. Matrix 667/718 Client Equipment Screen Bug
    By janie177 in forum Help
    Replies: 7
    Last Post: 01-20-2016, 05:14 PM
  3. Replies: 4
    Last Post: 03-29-2014, 04:23 PM
  4. Replies: 0
    Last Post: 06-28-2013, 04:22 PM
  5. 667/718 Matrix Shop help?!?!!?
    By lighter xd in forum Help
    Replies: 6
    Last Post: 04-17-2013, 03:56 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
  •