forked from MagicBane/Server
server side race/cass restrictions
This commit is contained in:
@@ -714,5 +714,68 @@ public class dbGuildHandler extends dbHandlerBase {
|
||||
//
|
||||
// }
|
||||
|
||||
public ArrayList<Enum.MonsterType> LOAD_CHARTER_RACE_RESTRICTIONS(String name){
|
||||
ArrayList<Enum.MonsterType> reqRaces= new ArrayList<>();
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `lore_charter_restrictions` WHERE `GUILDTYPE` = ?")) {
|
||||
|
||||
preparedStatement.setString(1, name);
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
while (rs.next()) {
|
||||
String read = rs.getString("RACE_REQUIRED");
|
||||
if(read != null){
|
||||
for(String entry : read.split(";"))
|
||||
reqRaces.add(Enum.MonsterType.valueOf(entry.replace("-","")));
|
||||
}
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
|
||||
return reqRaces;
|
||||
}
|
||||
public ArrayList<Enum.PromoteType> LOAD_CHARTER_CLASS_RESTRICTIONS(String name){
|
||||
ArrayList<Enum.PromoteType> reqClasses= new ArrayList<>();
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `lore_charter_restrictions` WHERE `GUILDTYPE` = ?")) {
|
||||
|
||||
preparedStatement.setString(1, name);
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
while (rs.next()) {
|
||||
String read = rs.getString("CLASS_REQUIRED");
|
||||
if(read != null){
|
||||
for(String entry : read.split(";"))
|
||||
reqClasses.add(Enum.PromoteType.valueOf(entry));
|
||||
}
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
|
||||
return reqClasses;
|
||||
}
|
||||
public Enum.SexType LOAD_CHARTER_SEX_RESTRICTIONS(String name){
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `lore_charter_restrictions` WHERE `GUILDTYPE` = ?")) {
|
||||
|
||||
preparedStatement.setString(1, name);
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
while (rs.next()) {
|
||||
String read = rs.getString("SEX_REQUIRED");
|
||||
if(read != null){
|
||||
if(read == "Female")
|
||||
return Enum.SexType.FEMALE;
|
||||
}
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
return Enum.SexType.NONE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,6 +86,7 @@ public class dbItemBaseHandler extends dbHandlerBase {
|
||||
while (rs.next()) {
|
||||
recordsRead++;
|
||||
itemBase = new ItemBase(rs);
|
||||
|
||||
ItemBase.addToCache(itemBase);
|
||||
}
|
||||
|
||||
@@ -95,7 +96,19 @@ public class dbItemBaseHandler extends dbHandlerBase {
|
||||
|
||||
Logger.info("read: " + recordsRead + " cached: " + ItemBase.getUUIDCache().size());
|
||||
}
|
||||
|
||||
public void LOAD_ALL_ITEM_REQUIREMENTS(){
|
||||
for(ItemBase itemBase : ItemBase._itemBaseByUUID.values())
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_item_requirements WHERE 'itemID' = ?")) {
|
||||
preparedStatement.setInt(1, itemBase.getUUID());
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
while(rs.next()) {
|
||||
itemBase.LoadRequirements(rs.getString("racesRequired"),rs.getString("racesRestricted"),rs.getString("classesRequired"),rs.getString("classesRestricted"),rs.getString("discsRequired"),rs.getString("discsRestricted"));
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
Logger.error("No Entry In static_item_requirements for item UUID: " + itemBase.getUUID());
|
||||
}
|
||||
}
|
||||
public HashMap<Integer, ArrayList<Integer>> LOAD_RUNES_FOR_NPC_AND_MOBS() {
|
||||
|
||||
HashMap<Integer, ArrayList<Integer>> runeSets = new HashMap<>();
|
||||
|
||||
Reference in New Issue
Block a user