Roaring tiger + party EXP fix + Owl leaderboard

Fixed Roaring Tiger messenger effect sticking on the client after the end on the animation. Fixed an issue with party EXP handing to low-level players leech EXP. Fixed party EXP system giving players way too much EXP in some cases. Added Owl item search ranking feature, items most searched can be displayed by the Owl instead of the hard-coded counterpart.
This commit is contained in:
ronancpl
2017-10-20 12:48:49 -02:00
parent 57c29603d1
commit 75e11e1996
54 changed files with 146 additions and 51 deletions

View File

@@ -40,7 +40,10 @@ import java.util.List;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import java.util.Set;
import java.util.HashSet;
import java.util.concurrent.ScheduledFuture;
@@ -69,6 +72,7 @@ import tools.Pair;
/**
*
* @author kevintjuh93
* @author Ronan (thread-oriented world schedules)
*/
public class World {
@@ -84,6 +88,9 @@ public class World {
private PlayerStorage players = new PlayerStorage();
private Set<Integer> queuedGuilds = new HashSet<>();
private Map<Integer, Integer> owlSearched = new LinkedHashMap<>();
private Lock owlLock = new ReentrantLock();
private Map<Integer, Byte> activePets = new LinkedHashMap<>();
private ScheduledFuture<?> petsSchedule;
private long petUpdate;
@@ -720,6 +727,39 @@ public class World {
return (chr.getId() << 2) + petSlot;
}
public void addOwlItemSearch(Integer itemid) {
owlLock.lock();
try {
Integer cur = owlSearched.get(itemid);
if(cur != null) {
owlSearched.put(itemid, cur + 1);
} else {
owlSearched.put(itemid, 1);
}
} finally {
owlLock.unlock();
}
}
public List<Pair<Integer, Integer>> getOwlSearchedItems() {
if(ServerConstants.USE_ENFORCE_OWL_SUGGESTIONS) {
return new ArrayList<>(0);
}
owlLock.lock();
try {
List<Pair<Integer, Integer>> searchCounts = new ArrayList<>(owlSearched.size());
for(Entry<Integer, Integer> e : owlSearched.entrySet()) {
searchCounts.add(new Pair<>(e.getKey(), e.getValue()));
}
return searchCounts;
} finally {
owlLock.unlock();
}
}
public void registerPetHunger(MapleCharacter chr, byte petSlot) {
if(chr.isGM() && ServerConstants.GM_PETS_NEVER_HUNGRY || ServerConstants.PETS_NEVER_HUNGRY) {
return;