Rename and clean up MapleLootInventory
This commit is contained in:
@@ -28,19 +28,18 @@ import java.util.Map;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author Ronan
|
* @author Ronan
|
||||||
*/
|
*/
|
||||||
public class MapleLootInventory {
|
public class LootInventory {
|
||||||
Map<Integer, Integer> items = new HashMap<>(50);
|
Map<Integer, Integer> items = new HashMap<>(50);
|
||||||
|
|
||||||
public MapleLootInventory(Character from) {
|
public LootInventory(Character from) {
|
||||||
for (InventoryType values : InventoryType.values()) {
|
for (InventoryType values : InventoryType.values()) {
|
||||||
|
|
||||||
for(Item it : from.getInventory(values).list()) {
|
for (Item it : from.getInventory(values).list()) {
|
||||||
Integer itemQty = items.get(it.getItemId());
|
Integer itemQty = items.get(it.getItemId());
|
||||||
|
|
||||||
if(itemQty == null) {
|
if (itemQty == null) {
|
||||||
items.put(it.getItemId(), (int) it.getQuantity());
|
items.put(it.getItemId(), (int) it.getQuantity());
|
||||||
} else {
|
} else {
|
||||||
items.put(it.getItemId(), itemQty + it.getQuantity());
|
items.put(it.getItemId(), itemQty + it.getQuantity());
|
||||||
@@ -33,7 +33,7 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public class MapleLootManager {
|
public class MapleLootManager {
|
||||||
|
|
||||||
private static boolean isRelevantDrop(MonsterDropEntry dropEntry, List<Character> players, List<MapleLootInventory> 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);
|
||||||
if (quest != null) {
|
if (quest != null) {
|
||||||
@@ -43,7 +43,7 @@ public class MapleLootManager {
|
|||||||
|
|
||||||
//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++) {
|
||||||
MapleLootInventory 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);
|
||||||
@@ -77,9 +77,9 @@ public class MapleLootManager {
|
|||||||
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<MapleLootInventory> playersInv = new LinkedList<>();
|
List<LootInventory> playersInv = new LinkedList<>();
|
||||||
for(Character chr : players) {
|
for(Character chr : players) {
|
||||||
MapleLootInventory lootInv = new MapleLootInventory(chr);
|
LootInventory lootInv = new LootInventory(chr);
|
||||||
playersInv.add(lootInv);
|
playersInv.add(lootInv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user