Thread: Matrix Decanting [667/718/*]

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

    Join Date
    Jun 2010
    Age
    23
    Posts
    4,836
    Thanks given
    1,676
    Thanks received
    1,563
    Discord
    View profile
    Rep Power
    0
    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.
    Reply With Quote  
     

  2. #2  
    Registered Member

    Join Date
    Feb 2010
    Posts
    3,187
    Thanks given
    1,124
    Thanks received
    834
    Discord
    View profile
    Rep Power
    1514
    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
    318
    Thanks given
    109
    Thanks received
    72
    Rep Power
    309
    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,491
    Thanks given
    179
    Thanks received
    1,703
    Rep Power
    2470
    thanks will use rep++
    Reply With Quote  
     

  7. Thankful user:


  8. #5  
    Donator

    .css's Avatar
    Join Date
    Dec 2018
    Age
    26
    Posts
    291
    Thanks given
    46
    Thanks received
    93
    Discord
    View profile
    Rep Power
    114
    At least you contribute regardless so good job T

    [Only registered and activated users can see links. ] - [Only registered and activated users can see links. ]
    [Only registered and activated users can see links. ]

    Zed#3343
    Reply With Quote  
     

  9. Thankful user:


  10. #6  
    Banned

    Join Date
    Jun 2010
    Age
    23
    Posts
    4,836
    Thanks given
    1,676
    Thanks received
    1,563
    Discord
    View profile
    Rep Power
    0
    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.
    Reply With Quote  
     

  11. #7  
    Registered Member
    JayArrowz's Avatar
    Join Date
    Sep 2008
    Posts
    67
    Thanks given
    60
    Thanks received
    64
    Discord
    View profile
    Rep Power
    392
    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,536
    Thanks given
    703
    Thanks received
    2,322
    Discord
    View profile
    Rep Power
    5000
    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  
    Banned

    Join Date
    Jun 2010
    Age
    23
    Posts
    4,836
    Thanks given
    1,676
    Thanks received
    1,563
    Discord
    View profile
    Rep Power
    0
    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.

    Reply With Quote  
     

  14. #10  
    Registered Member
    JayArrowz's Avatar
    Join Date
    Sep 2008
    Posts
    67
    Thanks given
    60
    Thanks received
    64
    Discord
    View profile
    Rep Power
    392
    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
  •