Rename and clean up MapleLootManager
This commit is contained in:
@@ -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) {
|
||||||
|
|||||||
@@ -28,11 +28,10 @@ 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;
|
||||||
MapleQuest quest = MapleQuest.getInstance(dropEntry.questid);
|
MapleQuest quest = MapleQuest.getInstance(dropEntry.questid);
|
||||||
@@ -40,11 +39,11 @@ public class MapleLootManager {
|
|||||||
qStartAmount = quest.getStartItemAmountNeeded(dropEntry.itemId);
|
qStartAmount = quest.getStartItemAmountNeeded(dropEntry.itemId);
|
||||||
qCompleteAmount = quest.getCompleteItemAmountNeeded(dropEntry.itemId);
|
qCompleteAmount = quest.getCompleteItemAmountNeeded(dropEntry.itemId);
|
||||||
}
|
}
|
||||||
|
|
||||||
//boolean restricted = MapleItemInformationProvider.getInstance().isPickupRestricted(dropEntry.itemId);
|
//boolean restricted = MapleItemInformationProvider.getInstance().isPickupRestricted(dropEntry.itemId);
|
||||||
for (int i = 0; i < players.size(); i++) {
|
for (int i = 0; i < players.size(); i++) {
|
||||||
LootInventory chrInv = playersInv.get(i);
|
LootInventory chrInv = playersInv.get(i);
|
||||||
|
|
||||||
if (dropEntry.questid > 0) {
|
if (dropEntry.questid > 0) {
|
||||||
int qItemAmount, chrQuestStatus = players.get(i).getQuestStatus(dropEntry.questid);
|
int qItemAmount, chrQuestStatus = players.get(i).getQuestStatus(dropEntry.questid);
|
||||||
if (chrQuestStatus == 0) {
|
if (chrQuestStatus == 0) {
|
||||||
@@ -54,9 +53,9 @@ public class MapleLootManager {
|
|||||||
} else {
|
} else {
|
||||||
qItemAmount = qCompleteAmount;
|
qItemAmount = qCompleteAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
// thanks kvmba for noticing quest items with no required amount failing to be detected as such
|
// thanks kvmba for noticing quest items with no required amount failing to be detected as such
|
||||||
|
|
||||||
int qItemStatus = chrInv.hasItem(dropEntry.itemId, qItemAmount);
|
int qItemStatus = chrInv.hasItem(dropEntry.itemId, qItemAmount);
|
||||||
if (qItemStatus == 2) {
|
if (qItemStatus == 2) {
|
||||||
continue;
|
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
|
} /*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;
|
continue;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return effectiveLoot;
|
return effectiveLoot;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user