Rename and clean up MapleLootManager

This commit is contained in:
P0nk
2021-09-09 22:14:54 +02:00
parent 7246647ab6
commit af2707120a
2 changed files with 21 additions and 20 deletions

View File

@@ -45,7 +45,7 @@ import scripting.event.EventInstanceManager;
import server.MapleStatEffect; import server.MapleStatEffect;
import server.TimerManager; import server.TimerManager;
import server.life.LifeFactory.BanishInfo; import server.life.LifeFactory.BanishInfo;
import server.loot.MapleLootManager; import server.loot.LootManager;
import server.maps.AbstractAnimatedMapleMapObject; import server.maps.AbstractAnimatedMapleMapObject;
import server.maps.MapleMap; import server.maps.MapleMap;
import server.maps.MapleMapObjectType; import server.maps.MapleMapObjectType;
@@ -751,7 +751,7 @@ public class Monster extends AbstractLoadedLife {
} }
} }
return MapleLootManager.retrieveRelevantDrops(this.getId(), lootChars); return LootManager.retrieveRelevantDrops(this.getId(), lootChars);
} }
public Character killBy(final Character killer) { public Character killBy(final Character killer) {

View File

@@ -28,10 +28,9 @@ import java.util.LinkedList;
import java.util.List; import java.util.List;
/** /**
*
* @author Ronan * @author Ronan
*/ */
public class MapleLootManager { public class LootManager {
private static boolean isRelevantDrop(MonsterDropEntry dropEntry, List<Character> players, List<LootInventory> playersInv) { private static boolean isRelevantDrop(MonsterDropEntry dropEntry, List<Character> players, List<LootInventory> playersInv) {
int qStartAmount = 0, qCompleteAmount = 0; int qStartAmount = 0, qCompleteAmount = 0;
@@ -75,17 +74,19 @@ public class MapleLootManager {
public static List<MonsterDropEntry> retrieveRelevantDrops(int monsterId, List<Character> players) { public static List<MonsterDropEntry> retrieveRelevantDrops(int monsterId, List<Character> players) {
List<MonsterDropEntry> loots = MonsterInformationProvider.getInstance().retrieveEffectiveDrop(monsterId); List<MonsterDropEntry> loots = MonsterInformationProvider.getInstance().retrieveEffectiveDrop(monsterId);
if(loots.isEmpty()) return loots; if (loots.isEmpty()) {
return loots;
}
List<LootInventory> playersInv = new LinkedList<>(); List<LootInventory> playersInv = new LinkedList<>();
for(Character chr : players) { for (Character chr : players) {
LootInventory lootInv = new LootInventory(chr); LootInventory lootInv = new LootInventory(chr);
playersInv.add(lootInv); playersInv.add(lootInv);
} }
List<MonsterDropEntry> effectiveLoot = new LinkedList<>(); List<MonsterDropEntry> effectiveLoot = new LinkedList<>();
for(MonsterDropEntry mde : loots) { for (MonsterDropEntry mde : loots) {
if(isRelevantDrop(mde, players, playersInv)) { if (isRelevantDrop(mde, players, playersInv)) {
effectiveLoot.add(mde); effectiveLoot.add(mde);
} }
} }