rollTable() method added to loot classes.
This commit is contained in:
@@ -8,8 +8,11 @@
|
||||
|
||||
package engine.loot;
|
||||
|
||||
import engine.gameManager.LootManager;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemTableEntry {
|
||||
public int minRoll;
|
||||
@@ -25,4 +28,18 @@ public class ItemTableEntry {
|
||||
this.minSpawn = rs.getInt("minSpawn");
|
||||
this.maxSpawn = rs.getInt("maxSpawn");
|
||||
}
|
||||
|
||||
public static ItemTableEntry rollTable(int itemTable, int roll) {
|
||||
|
||||
ItemTableEntry itemTableEntry = null;
|
||||
List<ItemTableEntry> itemTableEntryList;
|
||||
|
||||
itemTableEntryList = LootManager._itemTables.get(itemTable);
|
||||
|
||||
for (ItemTableEntry iteration : itemTableEntryList)
|
||||
if (roll >= iteration.minRoll && roll <= iteration.maxRoll)
|
||||
itemTableEntry = iteration;
|
||||
|
||||
return itemTableEntry;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user