Rename and clean up MapleLootManager
This commit is contained in:
@@ -45,7 +45,7 @@ import scripting.event.EventInstanceManager;
|
||||
import server.MapleStatEffect;
|
||||
import server.TimerManager;
|
||||
import server.life.LifeFactory.BanishInfo;
|
||||
import server.loot.MapleLootManager;
|
||||
import server.loot.LootManager;
|
||||
import server.maps.AbstractAnimatedMapleMapObject;
|
||||
import server.maps.MapleMap;
|
||||
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) {
|
||||
|
||||
@@ -28,11 +28,10 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Ronan
|
||||
*/
|
||||
public class MapleLootManager {
|
||||
|
||||
public class LootManager {
|
||||
|
||||
private static boolean isRelevantDrop(MonsterDropEntry dropEntry, List<Character> players, List<LootInventory> playersInv) {
|
||||
int qStartAmount = 0, qCompleteAmount = 0;
|
||||
MapleQuest quest = MapleQuest.getInstance(dropEntry.questid);
|
||||
@@ -40,11 +39,11 @@ public class MapleLootManager {
|
||||
qStartAmount = quest.getStartItemAmountNeeded(dropEntry.itemId);
|
||||
qCompleteAmount = quest.getCompleteItemAmountNeeded(dropEntry.itemId);
|
||||
}
|
||||
|
||||
|
||||
//boolean restricted = MapleItemInformationProvider.getInstance().isPickupRestricted(dropEntry.itemId);
|
||||
for (int i = 0; i < players.size(); i++) {
|
||||
LootInventory chrInv = playersInv.get(i);
|
||||
|
||||
|
||||
if (dropEntry.questid > 0) {
|
||||
int qItemAmount, chrQuestStatus = players.get(i).getQuestStatus(dropEntry.questid);
|
||||
if (chrQuestStatus == 0) {
|
||||
@@ -54,9 +53,9 @@ public class MapleLootManager {
|
||||
} else {
|
||||
qItemAmount = qCompleteAmount;
|
||||
}
|
||||
|
||||
|
||||
// thanks kvmba for noticing quest items with no required amount failing to be detected as such
|
||||
|
||||
|
||||
int qItemStatus = chrInv.hasItem(dropEntry.itemId, qItemAmount);
|
||||
if (qItemStatus == 2) {
|
||||
continue;
|
||||
@@ -66,31 +65,33 @@ public class MapleLootManager {
|
||||
} /*else if (restricted && chrInv.hasItem(dropEntry.itemId, 1) > 0) { // thanks Conrad, Legalize for noticing eligible loots not being available to drop for non-killer parties
|
||||
continue;
|
||||
}*/
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static List<MonsterDropEntry> retrieveRelevantDrops(int monsterId, List<Character> players) {
|
||||
List<MonsterDropEntry> loots = MonsterInformationProvider.getInstance().retrieveEffectiveDrop(monsterId);
|
||||
if(loots.isEmpty()) return loots;
|
||||
|
||||
if (loots.isEmpty()) {
|
||||
return loots;
|
||||
}
|
||||
|
||||
List<LootInventory> playersInv = new LinkedList<>();
|
||||
for(Character chr : players) {
|
||||
for (Character chr : players) {
|
||||
LootInventory lootInv = new LootInventory(chr);
|
||||
playersInv.add(lootInv);
|
||||
}
|
||||
|
||||
|
||||
List<MonsterDropEntry> effectiveLoot = new LinkedList<>();
|
||||
for(MonsterDropEntry mde : loots) {
|
||||
if(isRelevantDrop(mde, players, playersInv)) {
|
||||
for (MonsterDropEntry mde : loots) {
|
||||
if (isRelevantDrop(mde, players, playersInv)) {
|
||||
effectiveLoot.add(mde);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return effectiveLoot;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user