Thread: Matrix Decanting [667/718/*]

Page 1 of 2 12 LastLast
Results 1 to 10 of 19
  1. #1 Matrix Decanting [667/718/*] 
    Registered Member
    Tyluur's Avatar
    Join Date
    Jun 2010
    Age
    26
    Posts
    5,102
    Thanks given
    1,817
    Thanks received
    1,767
    Rep Power
    2413
    This code is from 2013 so pls dont hate thx guys.

    Code: https://gist.github.com/Tyluur/074ab...1b6824777304ad
    Last edited by Tyluur; 01-04-2021 at 07:10 PM.
    Quote Originally Posted by blakeman8192 View Post
    Keep trying. Quitting is the only true failure.
    Spoiler for skrrrrr:

    Attached image
    Reply With Quote  
     

  2. #2  
    Registered Member

    Join Date
    Feb 2010
    Posts
    3,253
    Thanks given
    1,145
    Thanks received
    909
    Rep Power
    2081
    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
    419
    Thanks given
    127
    Thanks received
    85
    Rep Power
    349
    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
    Posts
    2,493
    Thanks given
    180
    Thanks received
    1,732
    Rep Power
    2487
    thanks will use rep++
    Reply With Quote  
     

  7. Thankful user:


  8. #5  
    Donator

    .css's Avatar
    Join Date
    Dec 2018
    Age
    29
    Posts
    578
    Thanks given
    89
    Thanks received
    269
    Rep Power
    351
    At least you contribute regardless so good job T
    Reply With Quote  
     

  9. Thankful user:


  10. #6  
    Registered Member
    Tyluur's Avatar
    Join Date
    Jun 2010
    Age
    26
    Posts
    5,102
    Thanks given
    1,817
    Thanks received
    1,767
    Rep Power
    2413
    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.
    Quote Originally Posted by blakeman8192 View Post
    Keep trying. Quitting is the only true failure.
    Spoiler for skrrrrr:

    Attached image
    Reply With Quote  
     

  11. #7  
    Extreme Donator

    JayArrowz's Avatar
    Join Date
    Sep 2008
    Posts
    104
    Thanks given
    99
    Thanks received
    107
    Rep Power
    810
    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


    Attached image
    Reply With Quote  
     

  12. #8  
    Respected Member


    Kris's Avatar
    Join Date
    Jun 2016
    Age
    26
    Posts
    3,638
    Thanks given
    820
    Thanks received
    2,642
    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.
    Attached image
    Reply With Quote  
     


  13. #9  
    Registered Member
    Tyluur's Avatar
    Join Date
    Jun 2010
    Age
    26
    Posts
    5,102
    Thanks given
    1,817
    Thanks received
    1,767
    Rep Power
    2413
    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.

    Attached image
    Quote Originally Posted by blakeman8192 View Post
    Keep trying. Quitting is the only true failure.
    Spoiler for skrrrrr:

    Attached image
    Reply With Quote  
     

  14. #10  
    Extreme Donator

    JayArrowz's Avatar
    Join Date
    Sep 2008
    Posts
    104
    Thanks given
    99
    Thanks received
    107
    Rep Power
    810
    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.

    Attached image
    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
  •