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 GenTableEntry {
|
||||
public int minRoll;
|
||||
@@ -25,4 +28,18 @@ public class GenTableEntry {
|
||||
this.pModTable = rs.getInt("pModTableID");
|
||||
this.sModTable = rs.getInt("sModTableID");
|
||||
}
|
||||
|
||||
public static GenTableEntry rollTable(int genTable, int roll) {
|
||||
|
||||
GenTableEntry genTableEntry = null;
|
||||
List<GenTableEntry> genTableEntryList;
|
||||
|
||||
genTableEntryList = LootManager._genTables.get(genTable);
|
||||
|
||||
for (GenTableEntry iteration : genTableEntryList)
|
||||
if (roll >= iteration.minRoll && roll <= iteration.maxRoll)
|
||||
genTableEntry = iteration;
|
||||
|
||||
return genTableEntry;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 ModTableEntry {
|
||||
public int minRoll;
|
||||
@@ -23,4 +26,18 @@ public class ModTableEntry {
|
||||
this.action = rs.getString("action");
|
||||
this.level = rs.getInt("level");
|
||||
}
|
||||
|
||||
public static ModTableEntry rollTable(int modTablwe, int roll) {
|
||||
|
||||
ModTableEntry modTableEntry = null;
|
||||
List<ModTableEntry> itemTableEntryList;
|
||||
|
||||
itemTableEntryList = LootManager._modTables.get(modTablwe);
|
||||
|
||||
for (ModTableEntry iteration : itemTableEntryList)
|
||||
if (roll >= iteration.minRoll && roll <= iteration.maxRoll)
|
||||
modTableEntry = iteration;
|
||||
|
||||
return modTableEntry;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 ModTypeTableEntry {
|
||||
public int minRoll;
|
||||
@@ -21,4 +24,18 @@ public class ModTypeTableEntry {
|
||||
this.maxRoll = rs.getInt("maxRoll");
|
||||
this.modTableID = rs.getInt("subTableID");
|
||||
}
|
||||
|
||||
public static ModTypeTableEntry rollTable(int modTablwe, int roll) {
|
||||
|
||||
ModTypeTableEntry modTypeTableEntry = null;
|
||||
List<ModTypeTableEntry> modTypeTableEntryList;
|
||||
|
||||
modTypeTableEntryList = LootManager._modTypeTables.get(modTablwe);
|
||||
|
||||
for (ModTypeTableEntry iteration : modTypeTableEntryList)
|
||||
if (roll >= iteration.minRoll && roll <= iteration.maxRoll)
|
||||
modTypeTableEntry = iteration;
|
||||
|
||||
return modTypeTableEntry;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user