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
|
This code is from 2013 so pls dont hate thx guys.
Code: https://gist.github.com/Tyluur/074ab...1b6824777304ad
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
Cool release, I was just looking at the code and a question:
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.Code:List<Item> items = null;
Does eachcontain the entire inventory (or at least the items we want) or is this a bug in the code?Code:Entry<String, List<Item>> entry = it$.next();
I haven't looked at the rest of the code.
thanks will use rep++
At least you contribute regardless so good job T
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.
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.
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.
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
This should be a bannable offence in rune-server.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); } } }
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |