From 726d68df3146fa0059d1bac4eae8a29059288cfa Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Wed, 7 Feb 2024 19:20:29 -0600 Subject: [PATCH 01/39] server side race/cass restrictions --- src/engine/Enum.java | 7 ++ src/engine/db/handlers/dbGuildHandler.java | 63 ++++++++++++++ src/engine/db/handlers/dbItemBaseHandler.java | 15 +++- src/engine/objects/AbstractCharacter.java | 5 ++ src/engine/objects/ItemBase.java | 86 +++++++++++++++++++ src/engine/objects/PlayerCharacter.java | 11 +++ 6 files changed, 186 insertions(+), 1 deletion(-) diff --git a/src/engine/Enum.java b/src/engine/Enum.java index e4b4b9a3..62950b2d 100644 --- a/src/engine/Enum.java +++ b/src/engine/Enum.java @@ -10,6 +10,7 @@ package engine; import ch.claude_martin.enumbitset.EnumBitSetHelper; import engine.gameManager.ConfigManager; +import engine.gameManager.DbManager; import engine.gameManager.PowersManager; import engine.gameManager.ZoneManager; import engine.math.Vector2f; @@ -2518,11 +2519,17 @@ public class Enum { private final String name; private final String[][] ranks; //Stored Rank#->Gender(M,F) private final String[] leadershipTypes; + public final ArrayList requiredClasses; + public final ArrayList requiredRaces; + public final SexType sexRequired; GuildType(String name, String[][] ranks, String[] leadershipTypes) { this.name = name; this.ranks = ranks; this.leadershipTypes = leadershipTypes; + this.requiredClasses = DbManager.GuildQueries.LOAD_CHARTER_CLASS_RESTRICTIONS(this.name); + this.requiredRaces = DbManager.GuildQueries.LOAD_CHARTER_RACE_RESTRICTIONS(this.name); + this.sexRequired = DbManager.GuildQueries.LOAD_CHARTER_SEX_RESTRICTIONS(this.name); } public static GuildType getGuildTypeFromCharter(ItemBase itemBase) { diff --git a/src/engine/db/handlers/dbGuildHandler.java b/src/engine/db/handlers/dbGuildHandler.java index a4f1998e..fcebe3ac 100644 --- a/src/engine/db/handlers/dbGuildHandler.java +++ b/src/engine/db/handlers/dbGuildHandler.java @@ -714,5 +714,68 @@ public class dbGuildHandler extends dbHandlerBase { // // } + public ArrayList LOAD_CHARTER_RACE_RESTRICTIONS(String name){ + ArrayList 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 LOAD_CHARTER_CLASS_RESTRICTIONS(String name){ + ArrayList 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; + } } diff --git a/src/engine/db/handlers/dbItemBaseHandler.java b/src/engine/db/handlers/dbItemBaseHandler.java index bf12b434..b2969c61 100644 --- a/src/engine/db/handlers/dbItemBaseHandler.java +++ b/src/engine/db/handlers/dbItemBaseHandler.java @@ -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> LOAD_RUNES_FOR_NPC_AND_MOBS() { HashMap> runeSets = new HashMap<>(); diff --git a/src/engine/objects/AbstractCharacter.java b/src/engine/objects/AbstractCharacter.java index 03aebf86..092991a9 100644 --- a/src/engine/objects/AbstractCharacter.java +++ b/src/engine/objects/AbstractCharacter.java @@ -125,6 +125,11 @@ public abstract class AbstractCharacter extends AbstractWorldObject { public ArrayList runes; + public Enum.MonsterType absRace = null; + public Enum.PromoteType absClass = null; + + public Enum.SexType absGender = null; + public AbstractCharacter() { super(); this.firstName = ""; diff --git a/src/engine/objects/ItemBase.java b/src/engine/objects/ItemBase.java index dfc3c03b..3169d269 100644 --- a/src/engine/objects/ItemBase.java +++ b/src/engine/objects/ItemBase.java @@ -9,6 +9,7 @@ package engine.objects; +import engine.Enum; import engine.Enum.DamageType; import engine.Enum.GameObjectType; import engine.Enum.ItemType; @@ -77,6 +78,15 @@ public class ItemBase { private ArrayList offHandAnimations = new ArrayList<>(); private boolean autoID = false; + //requirements/restrictions + public ArrayList restrictedRaces; + public ArrayList requiredRaces; + public ArrayList restrictedClasses; + public ArrayList requiredClasses; + public ArrayList requiredDiscs; + public ArrayList restrictedDiscs; + public Enum.SexType requiredSex; + /** * ResultSet Constructor */ @@ -212,6 +222,7 @@ public class ItemBase { public static void loadAllItemBases() { DbManager.ItemBaseQueries.LOAD_ALL_ITEMBASES(); + DbManager.ItemBaseQueries.LOAD_ALL_ITEM_REQUIREMENTS(); AnniverseryGifts.add(971000); AnniverseryGifts.add(971001); AnniverseryGifts.add(971002); @@ -468,6 +479,15 @@ public class ItemBase { if (!validForSkills(abstractCharacter.getSkills())) return false; + if (!validRace(item.getItemBase(), abstractCharacter)) + return false; + + if (!validClass(item.getItemBase(), abstractCharacter)) + return false; + + if (!validDisc(item.getItemBase(), abstractCharacter)) + return false; + return item.getItemBase().value != 0 || Kit.IsNoobGear(item.getItemBase().uuid); //players can't wear 0 value items. @@ -476,6 +496,33 @@ public class ItemBase { return true; //Mobiles and NPC's don't need to check equip } + public static boolean validRace(ItemBase ib, AbstractCharacter absChar){ + if(ib.requiredRaces == null || ib.requiredRaces.isEmpty()) + if(ib.restrictedRaces == null || ib.restrictedRaces.isEmpty()) + return true; + + return ib.requiredRaces.contains(absChar.absRace) && !ib.restrictedRaces.contains(absChar.absRace); + } + public static boolean validClass(ItemBase ib, AbstractCharacter absChar){ + if(ib.requiredClasses == null || ib.requiredClasses.isEmpty()) + if(ib.restrictedClasses == null || ib.restrictedClasses.isEmpty()) + return true; + + return ib.requiredClasses.contains(absChar.absClass) && !ib.restrictedClasses.contains(absChar.absClass); + } + + public static boolean validDisc(ItemBase ib, AbstractCharacter absChar){ + + if(ib.requiredDiscs == null || ib.requiredDiscs.isEmpty()) + if(ib.restrictedDiscs == null || ib.restrictedDiscs.isEmpty()) + return true; + + for(CharacterRune rune : absChar.runes) + if(ib.requiredDiscs.contains(rune.getRuneBaseID()) == true && ib.restrictedDiscs.contains(rune.getRuneBaseID()) == false) + return true; + + return false; + } public int getValidSlot() { int slotValue = 0; @@ -931,4 +978,43 @@ public class ItemBase { return false; } + + public void LoadRequirements(String racesRequired, String racesRestricted, String classesRequired, String classesRestricted, String discsRequired, String discsRestricted){ + this.requiredRaces = new ArrayList<>(); + this.restrictedRaces = new ArrayList<>(); + this.requiredClasses = new ArrayList<>(); + this.restrictedClasses = new ArrayList<>(); + this.requiredDiscs = new ArrayList<>(); + this.restrictedDiscs = new ArrayList<>(); + if(racesRequired != null){ + for(String entry : racesRequired.split(";")){ + requiredRaces.add(Enum.MonsterType.valueOf(entry)); + } + } + if(racesRestricted != null){ + for(String entry : racesRestricted.split(";")){ + restrictedRaces.add(Enum.MonsterType.valueOf(entry)); + } + } + if(classesRequired != null){ + for(String entry : classesRequired.split(";")){ + requiredClasses.add(Enum.PromoteType.valueOf(entry)); + } + } + if(classesRestricted != null){ + for(String entry : classesRestricted.split(";")){ + restrictedClasses.add(Enum.PromoteType.valueOf(entry)); + } + } + if(discsRequired != null){ + for(String entry : discsRequired.split(";")){ + //TODO find way to load disc runebaseID from name + } + } + if(discsRestricted != null){ + for(String entry : discsRestricted.split(";")) { + //TODO find way to load disc runebaseID from name + } + } + } } diff --git a/src/engine/objects/PlayerCharacter.java b/src/engine/objects/PlayerCharacter.java index d68c16cd..36ed401e 100644 --- a/src/engine/objects/PlayerCharacter.java +++ b/src/engine/objects/PlayerCharacter.java @@ -4559,6 +4559,17 @@ public class PlayerCharacter extends AbstractCharacter { Bounds playerBounds = Bounds.borrow(); playerBounds.setBounds(this.getLoc()); this.setBounds(playerBounds); + + //assign enum values for restrictions + this.absRace = Enum.MonsterType.valueOf(this.getRace().getName().replace("-","")); + + if(this.promotionClass != null) + this.absClass = Enum.PromoteType.valueOf(this.getPromotionClass().getName()); + + if(this.isMale()) + this.absGender = SexType.MALE; + else + this.absGender = SexType.FEMALE; } @Override From ca09587d8713b52815ca1916a0d01c3f6f5f48b1 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Wed, 7 Feb 2024 19:25:48 -0600 Subject: [PATCH 02/39] server side race/cass restrictions --- src/engine/objects/PlayerCharacter.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/engine/objects/PlayerCharacter.java b/src/engine/objects/PlayerCharacter.java index 36ed401e..194f6930 100644 --- a/src/engine/objects/PlayerCharacter.java +++ b/src/engine/objects/PlayerCharacter.java @@ -4561,7 +4561,8 @@ public class PlayerCharacter extends AbstractCharacter { this.setBounds(playerBounds); //assign enum values for restrictions - this.absRace = Enum.MonsterType.valueOf(this.getRace().getName().replace("-","")); + String race = this.getRace().getName().replace("-",""); + this.absRace = Enum.MonsterType.valueOf(race); if(this.promotionClass != null) this.absClass = Enum.PromoteType.valueOf(this.getPromotionClass().getName()); From 8000d523f1e6b1614626f6b4ed8de83a93615aa7 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Wed, 7 Feb 2024 19:28:18 -0600 Subject: [PATCH 03/39] server side race/cass restrictions --- src/engine/objects/PlayerCharacter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/objects/PlayerCharacter.java b/src/engine/objects/PlayerCharacter.java index 194f6930..b5dfc333 100644 --- a/src/engine/objects/PlayerCharacter.java +++ b/src/engine/objects/PlayerCharacter.java @@ -4561,7 +4561,7 @@ public class PlayerCharacter extends AbstractCharacter { this.setBounds(playerBounds); //assign enum values for restrictions - String race = this.getRace().getName().replace("-",""); + String race = this.getRace().getName().replace("-","").replace(", Male","").replace(", Female",""); this.absRace = Enum.MonsterType.valueOf(race); if(this.promotionClass != null) From 7e29ecde9be5d0a30dfffab5424983724286bb65 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Wed, 7 Feb 2024 19:33:37 -0600 Subject: [PATCH 04/39] server side race/cass restrictions --- src/engine/db/handlers/dbItemBaseHandler.java | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/engine/db/handlers/dbItemBaseHandler.java b/src/engine/db/handlers/dbItemBaseHandler.java index b2969c61..c935672a 100644 --- a/src/engine/db/handlers/dbItemBaseHandler.java +++ b/src/engine/db/handlers/dbItemBaseHandler.java @@ -97,17 +97,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")); + 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()); + } } - } catch (SQLException e) { - Logger.error("No Entry In static_item_requirements for item UUID: " + itemBase.getUUID()); - } + } public HashMap> LOAD_RUNES_FOR_NPC_AND_MOBS() { From 45a0747176e664dc1e425aac05c97e0655206608 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Wed, 7 Feb 2024 19:35:56 -0600 Subject: [PATCH 05/39] server side race/cass restrictions --- src/engine/db/handlers/dbItemBaseHandler.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/engine/db/handlers/dbItemBaseHandler.java b/src/engine/db/handlers/dbItemBaseHandler.java index c935672a..24ef36a0 100644 --- a/src/engine/db/handlers/dbItemBaseHandler.java +++ b/src/engine/db/handlers/dbItemBaseHandler.java @@ -102,9 +102,9 @@ public void LOAD_ALL_ITEM_REQUIREMENTS(){ PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_item_requirements WHERE 'itemID' = ?")) { preparedStatement.setInt(1, itemBase.getUUID()); ResultSet rs = preparedStatement.executeQuery(); - while(rs.next()) { + //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()); } From 0e44293231d13a1c485e5cd9382219a79468494d Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Wed, 7 Feb 2024 19:43:04 -0600 Subject: [PATCH 06/39] server side race/cass restrictions --- src/engine/db/handlers/dbItemBaseHandler.java | 31 +++++++++++++++++-- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/src/engine/db/handlers/dbItemBaseHandler.java b/src/engine/db/handlers/dbItemBaseHandler.java index 24ef36a0..bd247835 100644 --- a/src/engine/db/handlers/dbItemBaseHandler.java +++ b/src/engine/db/handlers/dbItemBaseHandler.java @@ -102,9 +102,34 @@ public void LOAD_ALL_ITEM_REQUIREMENTS(){ 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")); - //} + while(rs.next()) { + + String racesRequired = ""; + if(rs.getString("racesRequired") != null) + racesRequired = rs.getString("racesRequired"); + + String racesRestricted = ""; + if(rs.getString("racesRestricted") != null) + racesRestricted = rs.getString("racesRestricted"); + + String classesRequired = ""; + if(rs.getString("classesRequired") != null) + classesRequired = rs.getString("classesRequired"); + + String classesRestricted = ""; + if(rs.getString("classesRestricted") != null) + classesRestricted = rs.getString("classesRestricted"); + + String discsRequired = ""; + if(rs.getString("discsRequired") != null) + discsRequired = rs.getString("discsRequired"); + + String discsRestricted = ""; + if(rs.getString("discsRestricted") != null) + discsRestricted = rs.getString("discsRestricted"); + + itemBase.LoadRequirements(racesRequired,racesRestricted,classesRequired, classesRestricted, discsRequired, discsRestricted); + } } catch (SQLException e) { Logger.error("No Entry In static_item_requirements for item UUID: " + itemBase.getUUID()); } From 28bf0413cc97907f9b2cfc2bbd4452e09f695d14 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Wed, 7 Feb 2024 19:44:33 -0600 Subject: [PATCH 07/39] server side race/cass restrictions --- src/engine/db/handlers/dbItemBaseHandler.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/engine/db/handlers/dbItemBaseHandler.java b/src/engine/db/handlers/dbItemBaseHandler.java index bd247835..202f6546 100644 --- a/src/engine/db/handlers/dbItemBaseHandler.java +++ b/src/engine/db/handlers/dbItemBaseHandler.java @@ -102,7 +102,7 @@ public void LOAD_ALL_ITEM_REQUIREMENTS(){ PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_item_requirements WHERE 'itemID' = ?")) { preparedStatement.setInt(1, itemBase.getUUID()); ResultSet rs = preparedStatement.executeQuery(); - while(rs.next()) { + //while(rs.next()) { String racesRequired = ""; if(rs.getString("racesRequired") != null) @@ -129,7 +129,7 @@ public void LOAD_ALL_ITEM_REQUIREMENTS(){ discsRestricted = rs.getString("discsRestricted"); itemBase.LoadRequirements(racesRequired,racesRestricted,classesRequired, classesRestricted, discsRequired, discsRestricted); - } + //} } catch (SQLException e) { Logger.error("No Entry In static_item_requirements for item UUID: " + itemBase.getUUID()); } From d487a9d1abe9119765d9f4c74186a893d82ba950 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Wed, 7 Feb 2024 19:51:58 -0600 Subject: [PATCH 08/39] server side race/cass restrictions --- src/engine/db/handlers/dbItemBaseHandler.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/engine/db/handlers/dbItemBaseHandler.java b/src/engine/db/handlers/dbItemBaseHandler.java index 202f6546..a190e230 100644 --- a/src/engine/db/handlers/dbItemBaseHandler.java +++ b/src/engine/db/handlers/dbItemBaseHandler.java @@ -99,8 +99,8 @@ public class dbItemBaseHandler extends dbHandlerBase { 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()); + PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_item_requirements WHERE 'itemName' = ?")) { + preparedStatement.setString(1, itemBase.getName()); ResultSet rs = preparedStatement.executeQuery(); //while(rs.next()) { From b3b6a9a9136974390697e62ef31057755f7be094 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Thu, 8 Feb 2024 13:11:37 -0500 Subject: [PATCH 09/39] Class requirements refactored to enumset. --- src/engine/Enum.java | 147 +++++++++++------- src/engine/db/archive/GuildRecord.java | 2 +- .../handlers/ChangeGuildLeaderHandler.java | 2 +- .../client/handlers/ChangeRankHandler.java | 2 +- .../GuildCreationFinalizeHandler.java | 4 +- .../client/handlers/InviteToGuildHandler.java | 4 +- .../net/client/msg/guild/GuildListMsg.java | 2 +- src/engine/objects/Guild.java | 6 +- 8 files changed, 103 insertions(+), 66 deletions(-) diff --git a/src/engine/Enum.java b/src/engine/Enum.java index 62950b2d..7fe0a7c4 100644 --- a/src/engine/Enum.java +++ b/src/engine/Enum.java @@ -2318,8 +2318,10 @@ public class Enum { } } - public enum GuildType { - NONE("None", new String[][]{{"None"}}, new String[]{"Thearchy", "Common Rule", "Theocracy", "Republic Rule"}), + public enum GuildCharterType { + NONE("None", new String[][]{{"None"}}, new String[]{"Thearchy", "Common Rule", "Theocracy", "Republic Rule"}, + EnumSet.noneOf(PromoteType.class)), + CATHEDRAL("Church of the All-Father", new String[][]{ {"Acolyte", "Acolyte"}, {"Catechist"}, @@ -2329,7 +2331,9 @@ public class Enum { {"Bishop", "Bishop"}, {"Lord Cardinal", "Lady Cardinal"}, {"Patriarch", "Matriarch"}}, - new String[]{"Thearchy", "Common Rule", "Theocracy", "Republic Rule"}), + new String[]{"Thearchy", "Common Rule", "Theocracy", "Republic Rule"}, + EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Crusader, PromoteType.Nightstalker, + PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, PromoteType.Scout)), MILITARY("Military", new String[][]{ {"Recruit"}, {"Footman"}, @@ -2339,7 +2343,9 @@ public class Enum { {"Captain"}, {"General"}, {"Lord Marshall", "Lady Marshall"}}, - new String[]{"Autocracy", "Common Rule", "Council Rule", "Militocracy"}), + new String[]{"Autocracy", "Common Rule", "Council Rule", "Militocracy"}, + EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Crusader, PromoteType.Nightstalker, + PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, PromoteType.Scout)), TEMPLE("Temple of the Cleansing Flame", new String[][]{ {"Aspirant"}, {"Novice"}, @@ -2350,7 +2356,9 @@ public class Enum { {"Lictor"}, {"Justiciar"}, {"Pontifex", "Pontifectrix"}}, - new String[]{"Despot Rule", "Common Rule", "Protectorship", "Republic Rule"}), + new String[]{"Despot Rule", "Common Rule", "Protectorship", "Republic Rule"}, + EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Crusader, PromoteType.Nightstalker, + PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, PromoteType.Scout)), BARBARIAN("Barbarian Clan", new String[][]{ {"Barbarian"}, {"Skald"}, @@ -2359,7 +2367,9 @@ public class Enum { {"Jarl"}, {"Chieftain"}, {"Thane"}}, - new String[]{"Chiefdom", "Common Rule", "Council Rule", "Republic Rule"}), + new String[]{"Chiefdom", "Common Rule", "Council Rule", "Republic Rule"}, + EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Crusader, PromoteType.Nightstalker, + PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, PromoteType.Scout)), RANGER("Ranger's Brotherhood", new String[][]{ {"Yeoman"}, {"Pathfinder"}, @@ -2368,7 +2378,9 @@ public class Enum { {"Protector"}, {"Guardian"}, {"Lord Protector", "Lady Protector"}}, - new String[]{"Despot Rule", "Collectivism", "Council Rule", "Republic Rule"}), + new String[]{"Despot Rule", "Collectivism", "Council Rule", "Republic Rule"}, + EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Crusader, PromoteType.Nightstalker, + PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, PromoteType.Scout)), AMAZON("Amazon Temple", new String[][]{ {"Amazon Thrall", "Amazon"}, {"Amazon Slave", "Amazon Warrior"}, @@ -2376,7 +2388,9 @@ public class Enum { {"Amazon Consort", "Amazon Princess"}, {"Amazon Seneschal", "Majestrix"}, {"Amazon Regent", "Imperatrix"}}, - new String[]{"Despot Rule", "Common Rule", "Gynarchy", "Gynocracy"}), + new String[]{"Despot Rule", "Common Rule", "Gynarchy", "Gynocracy"}, + EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Crusader, PromoteType.Nightstalker, + PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, PromoteType.Scout)), NOBLE("Noble House", new String[][]{ {"Serf"}, {"Vassal"}, @@ -2387,7 +2401,9 @@ public class Enum { {"Duke", "Duchess"}, {"King", "Queen"}, {"Emperor", "Empress"}}, - new String[]{"Monarchy", "Common Rule", "Feodality", "Republic"}), + new String[]{"Monarchy", "Common Rule", "Feodality", "Republic"}, + EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Crusader, PromoteType.Nightstalker, + PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, PromoteType.Scout)), WIZARD("Wizard's Conclave", new String[][]{ {"Apprentice"}, {"Neophyte"}, @@ -2396,7 +2412,9 @@ public class Enum { {"Magus"}, {"High Magus"}, {"Archmagus"}}, - new String[]{"Despot Rule", "Common Rule", "Council Rule", "Magocracy"}), + new String[]{"Despot Rule", "Common Rule", "Council Rule", "Magocracy"}, + EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Crusader, PromoteType.Nightstalker, + PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, PromoteType.Scout)), MERCENARY("Mercenary Company", new String[][]{ {"Soldier"}, {"Man-at-Arms"}, @@ -2406,7 +2424,9 @@ public class Enum { {"Commander"}, {"High Commander"}, {"Warlord"}}, - new String[]{"Magistrature", "Mob Law", "Council Rule", "Republic Rule"}), + new String[]{"Magistrature", "Mob Law", "Council Rule", "Republic Rule"}, + EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Crusader, PromoteType.Nightstalker, + PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, PromoteType.Scout)), THIEVES("Thieve's Den", new String[][]{ {"Urchin"}, {"Footpad"}, @@ -2417,7 +2437,9 @@ public class Enum { {"Treasurer"}, {"Grandmaster Thief"}, {"Grandfather"}}, - new String[]{"Despot Rule", "Common Rule", "Oligarchy", "Republic Rule"}), + new String[]{"Despot Rule", "Common Rule", "Oligarchy", "Republic Rule"}, + EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Crusader, PromoteType.Nightstalker, + PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, PromoteType.Scout)), DWARF("Dwarf Hold", new String[][]{ {"Citizen"}, {"Master"}, @@ -2425,7 +2447,9 @@ public class Enum { {"Thane"}, {"Great Thane"}, {"High Thane"}}, - new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}), + new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}, + EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Crusader, PromoteType.Nightstalker, + PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, PromoteType.Scout)), HIGHCOURT("High Court", new String[][]{ {"Eccekebe"}, {"Saedulor"}, @@ -2436,7 +2460,9 @@ public class Enum { {"Dar Thaelostor", "Dar Thaelostril"}, {"Aglaeron"}, {"Ellestor", "Elestril"}}, - new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}), + new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}, + EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Crusader, PromoteType.Nightstalker, + PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, PromoteType.Scout)), VIRAKT("Virakt", new String[][]{ {"Jov'uus"}, {"Urikhan"}, @@ -2446,7 +2472,9 @@ public class Enum { {"Khal'uvho"}, {"Khar'uus"}, {"Kryqh'khalin"}}, - new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}), + new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}, + EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Crusader, PromoteType.Nightstalker, + PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, PromoteType.Scout)), BRIALIA("Coven of Brialia", new String[][]{ // Unknown Rank names {"Devotee"}, {"Initiated"}, @@ -2456,7 +2484,9 @@ public class Enum { {"Elder"}, {"Hierophant"}, {"Witch King", "Witch Queen"}}, - new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}), + new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}, + EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Crusader, PromoteType.Nightstalker, + PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, PromoteType.Scout)), UNHOLY("Unholy Legion", new String[][]{ // Unknown Rank names {"Footman"}, {"Fell Legionaire"}, @@ -2466,14 +2496,18 @@ public class Enum { {"Dark Master", "Dark Mistress"}, {"Dread Master", "Dread Mistress"}, {"Dread Lord", "Dread Lady"}}, - new String[]{"Despot Rule", "Despot Rule", "Council Rule", "Republic Rule"}), + new String[]{"Despot Rule", "Despot Rule", "Council Rule", "Republic Rule"}, + EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Crusader, PromoteType.Nightstalker, + PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, PromoteType.Scout)), SCOURGE("Cult of the Scourge", new String[][]{ {"Thrall"}, {"Mudir"}, {"Dark Brother", "Dark Sister"}, {"Hand of the Dark"}, {"Dark Father", "Dark Mother"}}, - new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}), + new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}, + EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Crusader, PromoteType.Nightstalker, + PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, PromoteType.Scout)), PIRATE("Pirate Crew", new String[][]{ {"Midshipman", "Midshipwoman"}, {"Sailor"}, @@ -2481,7 +2515,9 @@ public class Enum { {"Second Mat"}, {"First Mate"}, {"Captain"}}, - new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}), + new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}, + EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Crusader, PromoteType.Nightstalker, + PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, PromoteType.Scout)), HERALD("Academy of Heralds", new String[][]{ {"Pupil"}, {"Scribe"}, @@ -2491,7 +2527,9 @@ public class Enum { {"Scholar"}, {"Archivist"}, {"Loremaster"}}, - new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}), + new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}, + EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Crusader, PromoteType.Nightstalker, + PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, PromoteType.Scout)), CENTAUR("Centaur Cohort", new String[][]{ {"Hoplite"}, {"Peltast"}, @@ -2501,7 +2539,9 @@ public class Enum { {"Septenrion"}, {"Praetorian"}, {"Paragon"}}, - new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}), + new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}, + EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Crusader, PromoteType.Nightstalker, + PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, PromoteType.Scout)), KHREE("Aracoix Kh'ree", new String[][]{ {"Duriacor"}, {"Exarch"}, @@ -2513,107 +2553,104 @@ public class Enum { {"Erentar"}, {"Araceos"}, {"Hierarch"}}, - - new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}); + new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}, + EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Crusader, PromoteType.Nightstalker, + PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, PromoteType.Scout)); private final String name; private final String[][] ranks; //Stored Rank#->Gender(M,F) private final String[] leadershipTypes; - public final ArrayList requiredClasses; + public final EnumSet requiredClasses; public final ArrayList requiredRaces; public final SexType sexRequired; - GuildType(String name, String[][] ranks, String[] leadershipTypes) { + GuildCharterType(String name, String[][] ranks, String[] leadershipTypes, EnumSet requiredClasses) { this.name = name; this.ranks = ranks; this.leadershipTypes = leadershipTypes; - this.requiredClasses = DbManager.GuildQueries.LOAD_CHARTER_CLASS_RESTRICTIONS(this.name); + this.requiredClasses = requiredClasses; this.requiredRaces = DbManager.GuildQueries.LOAD_CHARTER_RACE_RESTRICTIONS(this.name); this.sexRequired = DbManager.GuildQueries.LOAD_CHARTER_SEX_RESTRICTIONS(this.name); } - public static GuildType getGuildTypeFromCharter(ItemBase itemBase) { + public static GuildCharterType getGuildTypeFromCharter(ItemBase itemBase) { - GuildType charterType; + GuildCharterType charterType; // Must be a valid charter object if (itemBase.getType().equals(ItemType.GUILDCHARTER) == false) - return GuildType.NONE; //No guild Type - - // No switches on long in java. Cast to int - // when refactor to long uuid's. Loss won't matter - // with values this small. + return GuildCharterType.NONE; //No guild Type switch (itemBase.getUUID()) { case 559: - charterType = GuildType.CATHEDRAL; + charterType = GuildCharterType.CATHEDRAL; break; case 560: - charterType = GuildType.MILITARY; + charterType = GuildCharterType.MILITARY; break; case 561: - charterType = GuildType.TEMPLE; + charterType = GuildCharterType.TEMPLE; break; case 562: - charterType = GuildType.BARBARIAN; + charterType = GuildCharterType.BARBARIAN; break; case 563: - charterType = GuildType.RANGER; + charterType = GuildCharterType.RANGER; break; case 564: - charterType = GuildType.AMAZON; + charterType = GuildCharterType.AMAZON; break; case 565: - charterType = GuildType.NOBLE; + charterType = GuildCharterType.NOBLE; break; case 566: - charterType = GuildType.WIZARD; + charterType = GuildCharterType.WIZARD; break; case 567: - charterType = GuildType.MERCENARY; + charterType = GuildCharterType.MERCENARY; break; case 568: - charterType = GuildType.THIEVES; + charterType = GuildCharterType.THIEVES; break; case 569: - charterType = GuildType.DWARF; + charterType = GuildCharterType.DWARF; break; case 570: - charterType = GuildType.HIGHCOURT; + charterType = GuildCharterType.HIGHCOURT; break; case 571: - charterType = GuildType.VIRAKT; + charterType = GuildCharterType.VIRAKT; break; case 572: - charterType = GuildType.SCOURGE; + charterType = GuildCharterType.SCOURGE; break; case 573: - charterType = GuildType.KHREE; + charterType = GuildCharterType.KHREE; break; case 574: - charterType = GuildType.CENTAUR; + charterType = GuildCharterType.CENTAUR; break; case 575: - charterType = GuildType.UNHOLY; + charterType = GuildCharterType.UNHOLY; break; case 576: - charterType = GuildType.PIRATE; + charterType = GuildCharterType.PIRATE; break; case 577: - charterType = GuildType.BRIALIA; + charterType = GuildCharterType.BRIALIA; break; default: - charterType = GuildType.HERALD; + charterType = GuildCharterType.HERALD; } return charterType; } - public static GuildType getGuildTypeFromInt(int i) { - return GuildType.values()[i]; + public static GuildCharterType getGuildTypeFromInt(int i) { + return GuildCharterType.values()[i]; } public String getCharterName() { diff --git a/src/engine/db/archive/GuildRecord.java b/src/engine/db/archive/GuildRecord.java index 9447fd54..213b000b 100644 --- a/src/engine/db/archive/GuildRecord.java +++ b/src/engine/db/archive/GuildRecord.java @@ -89,7 +89,7 @@ public class GuildRecord extends DataRecord { guildRecord.guildHash = guildRecord.guild.getHash(); guildRecord.guildID = guildRecord.guild.getObjectUUID(); guildRecord.guildName = guildRecord.guild.getName(); - guildRecord.charterName = Enum.GuildType.getGuildTypeFromInt(guildRecord.guild.getCharter()).getCharterName(); + guildRecord.charterName = Enum.GuildCharterType.getGuildTypeFromInt(guildRecord.guild.getCharter()).getCharterName(); guildRecord.GLHash = DataWarehouse.hasher.encrypt(guildRecord.guild.getGuildLeaderUUID()); diff --git a/src/engine/net/client/handlers/ChangeGuildLeaderHandler.java b/src/engine/net/client/handlers/ChangeGuildLeaderHandler.java index fe21996b..2fa29725 100644 --- a/src/engine/net/client/handlers/ChangeGuildLeaderHandler.java +++ b/src/engine/net/client/handlers/ChangeGuildLeaderHandler.java @@ -76,7 +76,7 @@ public class ChangeGuildLeaderHandler extends AbstractClientMsgHandler { boolean isMale = true; boolean updateTarget; - Enum.GuildType t = Enum.GuildType.getGuildTypeFromInt(sourcePlayer.getGuild().getCharter()); + Enum.GuildCharterType t = Enum.GuildCharterType.getGuildTypeFromInt(sourcePlayer.getGuild().getCharter()); if (!DbManager.GuildQueries.SET_GUILD_LEADER(targetPlayer.getObjectUUID(), glGuild.getObjectUUID())) { diff --git a/src/engine/net/client/handlers/ChangeRankHandler.java b/src/engine/net/client/handlers/ChangeRankHandler.java index 8197fbff..36b5fcaf 100644 --- a/src/engine/net/client/handlers/ChangeRankHandler.java +++ b/src/engine/net/client/handlers/ChangeRankHandler.java @@ -60,7 +60,7 @@ public class ChangeRankHandler extends AbstractClientMsgHandler { boolean isMale; if (msg.getPreviousRank() != msg.getNewRank()) { - Enum.GuildType t = Enum.GuildType.getGuildTypeFromInt(sourcePlayer.getGuild().getCharter()); + Enum.GuildCharterType t = Enum.GuildCharterType.getGuildTypeFromInt(sourcePlayer.getGuild().getCharter()); if (targetPlayer != null) { targetPlayer.setGuildTitle(msg.getNewRank()); diff --git a/src/engine/net/client/handlers/GuildCreationFinalizeHandler.java b/src/engine/net/client/handlers/GuildCreationFinalizeHandler.java index aed341f4..0bcdb7b3 100644 --- a/src/engine/net/client/handlers/GuildCreationFinalizeHandler.java +++ b/src/engine/net/client/handlers/GuildCreationFinalizeHandler.java @@ -43,7 +43,7 @@ public class GuildCreationFinalizeHandler extends AbstractClientMsgHandler { PlayerCharacter player; GuildCreationFinalizeMsg msg; - Enum.GuildType charterType; + Enum.GuildCharterType charterType; Guild newGuild; Guild playerGuild; ItemBase itemBase; @@ -78,7 +78,7 @@ public class GuildCreationFinalizeHandler extends AbstractClientMsgHandler { return true; } - charterType = Enum.GuildType.getGuildTypeFromCharter(itemBase); + charterType = Enum.GuildCharterType.getGuildTypeFromCharter(itemBase); if (charterType == null) { ErrorPopupMsg.sendErrorPopup(player, GuildManager.NO_CHARTER_FOUND); diff --git a/src/engine/net/client/handlers/InviteToGuildHandler.java b/src/engine/net/client/handlers/InviteToGuildHandler.java index cce00445..34d63d7a 100644 --- a/src/engine/net/client/handlers/InviteToGuildHandler.java +++ b/src/engine/net/client/handlers/InviteToGuildHandler.java @@ -84,9 +84,9 @@ public class InviteToGuildHandler extends AbstractClientMsgHandler { return true; } - Enum.GuildType guildType = Enum.GuildType.values()[sourcePlayer.getGuild().getCharter()]; + Enum.GuildCharterType guildCharterType = Enum.GuildCharterType.values()[sourcePlayer.getGuild().getCharter()]; - if (guildType == null) { + if (guildCharterType == null) { ErrorPopupMsg.sendErrorPopup(sourcePlayer, GuildManager.NO_CHARTER_FOUND); return true; } diff --git a/src/engine/net/client/msg/guild/GuildListMsg.java b/src/engine/net/client/msg/guild/GuildListMsg.java index f40783be..80cc6cef 100644 --- a/src/engine/net/client/msg/guild/GuildListMsg.java +++ b/src/engine/net/client/msg/guild/GuildListMsg.java @@ -125,7 +125,7 @@ class GuildListMessageType1 extends GuildListMessageType { @Override void _serialize(ByteBufferWriter writer) { - Enum.GuildType gt = Enum.GuildType.getGuildTypeFromInt(g.getCharter()); + Enum.GuildCharterType gt = Enum.GuildCharterType.getGuildTypeFromInt(g.getCharter()); writer.putInt(1); writer.putInt(gt.ordinal()); //Charter Type diff --git a/src/engine/objects/Guild.java b/src/engine/objects/Guild.java index 9ea566e4..b84f6def 100644 --- a/src/engine/objects/Guild.java +++ b/src/engine/objects/Guild.java @@ -965,12 +965,12 @@ public class Guild extends AbstractWorldObject { DataWarehouse.writeHash(Enum.DataRecordType.GUILD, this.getObjectUUID()); } - public Enum.GuildType getGuildType() { + public GuildCharterType getGuildType() { try { - return Enum.GuildType.values()[this.charter]; + return GuildCharterType.values()[this.charter]; } catch (Exception e) { Logger.error(e); - return Enum.GuildType.NONE; + return GuildCharterType.NONE; } } From 544e715905be9fbc7cf57f3025d4e3dc304c3363 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Thu, 8 Feb 2024 13:59:40 -0500 Subject: [PATCH 10/39] Enumset partial update. --- src/engine/Enum.java | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/engine/Enum.java b/src/engine/Enum.java index 7fe0a7c4..21ffe345 100644 --- a/src/engine/Enum.java +++ b/src/engine/Enum.java @@ -2344,8 +2344,8 @@ public class Enum { {"General"}, {"Lord Marshall", "Lady Marshall"}}, new String[]{"Autocracy", "Common Rule", "Council Rule", "Militocracy"}, - EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Crusader, PromoteType.Nightstalker, - PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, PromoteType.Scout)), + EnumSet.of(PromoteType.Bard, PromoteType.Priest, PromoteType.Scout, PromoteType.Warlock, + PromoteType.Warrior, PromoteType.Wizard)), TEMPLE("Temple of the Cleansing Flame", new String[][]{ {"Aspirant"}, {"Novice"}, @@ -2357,8 +2357,8 @@ public class Enum { {"Justiciar"}, {"Pontifex", "Pontifectrix"}}, new String[]{"Despot Rule", "Common Rule", "Protectorship", "Republic Rule"}, - EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Crusader, PromoteType.Nightstalker, - PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, PromoteType.Scout)), + EnumSet.of(PromoteType.Assassin, PromoteType.Bard, PromoteType.Channeler, PromoteType.Confessor, + PromoteType.Nightstalker, PromoteType.Priest, PromoteType.Scout, PromoteType.Templar)), BARBARIAN("Barbarian Clan", new String[][]{ {"Barbarian"}, {"Skald"}, @@ -2368,8 +2368,8 @@ public class Enum { {"Chieftain"}, {"Thane"}}, new String[]{"Chiefdom", "Common Rule", "Council Rule", "Republic Rule"}, - EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Crusader, PromoteType.Nightstalker, - PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, PromoteType.Scout)), + EnumSet.of(PromoteType.Barbarian, PromoteType.Bard, PromoteType.Doomsayer, PromoteType.Fury, + PromoteType.Priest, PromoteType.Scout, PromoteType.Thief, PromoteType.Warrior)), RANGER("Ranger's Brotherhood", new String[][]{ {"Yeoman"}, {"Pathfinder"}, @@ -2379,8 +2379,8 @@ public class Enum { {"Guardian"}, {"Lord Protector", "Lady Protector"}}, new String[]{"Despot Rule", "Collectivism", "Council Rule", "Republic Rule"}, - EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Crusader, PromoteType.Nightstalker, - PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, PromoteType.Scout)), + EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Druid, PromoteType.Priest, + PromoteType.Ranger, PromoteType.Scout, PromoteType.Warrior)), AMAZON("Amazon Temple", new String[][]{ {"Amazon Thrall", "Amazon"}, {"Amazon Slave", "Amazon Warrior"}, @@ -2389,8 +2389,8 @@ public class Enum { {"Amazon Seneschal", "Majestrix"}, {"Amazon Regent", "Imperatrix"}}, new String[]{"Despot Rule", "Common Rule", "Gynarchy", "Gynocracy"}, - EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Crusader, PromoteType.Nightstalker, - PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, PromoteType.Scout)), + EnumSet.of(PromoteType.Bard, PromoteType.Druid, PromoteType.Fury, PromoteType.Huntress, + PromoteType.Priest, PromoteType.Scout, PromoteType.Warrior, PromoteType.Wizard)), NOBLE("Noble House", new String[][]{ {"Serf"}, {"Vassal"}, @@ -2402,8 +2402,8 @@ public class Enum { {"King", "Queen"}, {"Emperor", "Empress"}}, new String[]{"Monarchy", "Common Rule", "Feodality", "Republic"}, - EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Crusader, PromoteType.Nightstalker, - PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, PromoteType.Scout)), + EnumSet.of(PromoteType.Assassin, PromoteType.Bard, PromoteType.Channeler, PromoteType.Priest, + PromoteType.Scout, PromoteType.Thief, PromoteType.Warlock, PromoteType.Warrior, PromoteType.Wizard)), WIZARD("Wizard's Conclave", new String[][]{ {"Apprentice"}, {"Neophyte"}, From 6a021f938d50ee3ca923477045b42f4fbeeaca44 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Fri, 9 Feb 2024 12:00:33 -0500 Subject: [PATCH 11/39] charter class enum completed. --- src/engine/Enum.java | 55 +++++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/src/engine/Enum.java b/src/engine/Enum.java index 21ffe345..81ec857a 100644 --- a/src/engine/Enum.java +++ b/src/engine/Enum.java @@ -2413,8 +2413,8 @@ public class Enum { {"High Magus"}, {"Archmagus"}}, new String[]{"Despot Rule", "Common Rule", "Council Rule", "Magocracy"}, - EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Crusader, PromoteType.Nightstalker, - PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, PromoteType.Scout)), + EnumSet.of(PromoteType.Assassin, PromoteType.Bard, PromoteType.Channeler, PromoteType.Doomsayer, + PromoteType.Fury, PromoteType.Necromancer, PromoteType.Priest, PromoteType.Warlock, PromoteType.Wizard)), MERCENARY("Mercenary Company", new String[][]{ {"Soldier"}, {"Man-at-Arms"}, @@ -2425,8 +2425,8 @@ public class Enum { {"High Commander"}, {"Warlord"}}, new String[]{"Magistrature", "Mob Law", "Council Rule", "Republic Rule"}, - EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Crusader, PromoteType.Nightstalker, - PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, PromoteType.Scout)), + EnumSet.of(PromoteType.Assassin, PromoteType.Bard, PromoteType.Priest, PromoteType.Scout, + PromoteType.Thief, PromoteType.Warlock, PromoteType.Warrior)), THIEVES("Thieve's Den", new String[][]{ {"Urchin"}, {"Footpad"}, @@ -2438,8 +2438,8 @@ public class Enum { {"Grandmaster Thief"}, {"Grandfather"}}, new String[]{"Despot Rule", "Common Rule", "Oligarchy", "Republic Rule"}, - EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Crusader, PromoteType.Nightstalker, - PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, PromoteType.Scout)), + EnumSet.of(PromoteType.Assassin, PromoteType.Barbarian, PromoteType.Bard, PromoteType.Priest, + PromoteType.Scout, PromoteType.Thief, PromoteType.Wizard)), DWARF("Dwarf Hold", new String[][]{ {"Citizen"}, {"Master"}, @@ -2448,8 +2448,8 @@ public class Enum { {"Great Thane"}, {"High Thane"}}, new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}, - EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Crusader, PromoteType.Nightstalker, - PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, PromoteType.Scout)), + EnumSet.of(PromoteType.Crusader, PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, + PromoteType.Warrior)), HIGHCOURT("High Court", new String[][]{ {"Eccekebe"}, {"Saedulor"}, @@ -2461,8 +2461,9 @@ public class Enum { {"Aglaeron"}, {"Ellestor", "Elestril"}}, new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}, - EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Crusader, PromoteType.Nightstalker, - PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, PromoteType.Scout)), + EnumSet.of(PromoteType.Assassin, PromoteType.Bard, PromoteType.Channeler, PromoteType.Druid, + PromoteType.Necromancer, PromoteType.Priest, PromoteType.Ranger, PromoteType.Scout, + PromoteType.Thief, PromoteType.Warrior, PromoteType.Wizard)), VIRAKT("Virakt", new String[][]{ {"Jov'uus"}, {"Urikhan"}, @@ -2473,8 +2474,9 @@ public class Enum { {"Khar'uus"}, {"Kryqh'khalin"}}, new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}, - EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Crusader, PromoteType.Nightstalker, - PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, PromoteType.Scout)), + EnumSet.of(PromoteType.Assassin, PromoteType.Bard, PromoteType.Channeler, PromoteType.Fury, + PromoteType.Huntress, PromoteType.Nightstalker, PromoteType.Priest, PromoteType.Ranger, + PromoteType.Scout, PromoteType.Thief, PromoteType.Warrior, PromoteType.Wizard)), BRIALIA("Coven of Brialia", new String[][]{ // Unknown Rank names {"Devotee"}, {"Initiated"}, @@ -2485,8 +2487,8 @@ public class Enum { {"Hierophant"}, {"Witch King", "Witch Queen"}}, new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}, - EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Crusader, PromoteType.Nightstalker, - PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, PromoteType.Scout)), + EnumSet.allOf(PromoteType.class)), + UNHOLY("Unholy Legion", new String[][]{ // Unknown Rank names {"Footman"}, {"Fell Legionaire"}, @@ -2497,8 +2499,9 @@ public class Enum { {"Dread Master", "Dread Mistress"}, {"Dread Lord", "Dread Lady"}}, new String[]{"Despot Rule", "Despot Rule", "Council Rule", "Republic Rule"}, - EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Crusader, PromoteType.Nightstalker, - PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, PromoteType.Scout)), + EnumSet.of(PromoteType.Assassin, PromoteType.Channeler, PromoteType.Necromancer, PromoteType.Priest, + PromoteType.Scout, PromoteType.Thief, PromoteType.Warlock, PromoteType.Warrior, + PromoteType.Wizard)), SCOURGE("Cult of the Scourge", new String[][]{ {"Thrall"}, {"Mudir"}, @@ -2506,8 +2509,8 @@ public class Enum { {"Hand of the Dark"}, {"Dark Father", "Dark Mother"}}, new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}, - EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Crusader, PromoteType.Nightstalker, - PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, PromoteType.Scout)), + EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Doomsayer, PromoteType.Priest, + PromoteType.Scout, PromoteType.Warrior, PromoteType.Wizard)), PIRATE("Pirate Crew", new String[][]{ {"Midshipman", "Midshipwoman"}, {"Sailor"}, @@ -2516,8 +2519,7 @@ public class Enum { {"First Mate"}, {"Captain"}}, new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}, - EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Crusader, PromoteType.Nightstalker, - PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, PromoteType.Scout)), + EnumSet.allOf(PromoteType.class)), HERALD("Academy of Heralds", new String[][]{ {"Pupil"}, {"Scribe"}, @@ -2528,8 +2530,7 @@ public class Enum { {"Archivist"}, {"Loremaster"}}, new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}, - EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Crusader, PromoteType.Nightstalker, - PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, PromoteType.Scout)), + EnumSet.allOf(PromoteType.class)), CENTAUR("Centaur Cohort", new String[][]{ {"Hoplite"}, {"Peltast"}, @@ -2540,8 +2541,9 @@ public class Enum { {"Praetorian"}, {"Paragon"}}, new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}, - EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Crusader, PromoteType.Nightstalker, - PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, PromoteType.Scout)), + EnumSet.of(PromoteType.Barbarian, PromoteType.Crusader, PromoteType.Druid, PromoteType.Huntress, + PromoteType.Prelate, PromoteType.Priest, PromoteType.Ranger, PromoteType.Sentinel, + PromoteType.Warrior)), KHREE("Aracoix Kh'ree", new String[][]{ {"Duriacor"}, {"Exarch"}, @@ -2554,8 +2556,9 @@ public class Enum { {"Araceos"}, {"Hierarch"}}, new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}, - EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Crusader, PromoteType.Nightstalker, - PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, PromoteType.Scout)); + EnumSet.of(PromoteType.Assassin, PromoteType.Barbarian, PromoteType.Bard, PromoteType.Huntress, + PromoteType.Priest, PromoteType.Ranger, PromoteType.Scout, PromoteType.Thief, + PromoteType.Warlock, PromoteType.Warrior)); private final String name; private final String[][] ranks; //Stored Rank#->Gender(M,F) From 4fac0c39210dc145b2e87ad130a2314870aaf645 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Fri, 9 Feb 2024 13:42:30 -0500 Subject: [PATCH 12/39] charter class requirements added --- src/engine/Enum.java | 72 +++++++++++++++++++++++++++++--------------- 1 file changed, 48 insertions(+), 24 deletions(-) diff --git a/src/engine/Enum.java b/src/engine/Enum.java index 81ec857a..5131f1da 100644 --- a/src/engine/Enum.java +++ b/src/engine/Enum.java @@ -2320,7 +2320,8 @@ public class Enum { public enum GuildCharterType { NONE("None", new String[][]{{"None"}}, new String[]{"Thearchy", "Common Rule", "Theocracy", "Republic Rule"}, - EnumSet.noneOf(PromoteType.class)), + EnumSet.noneOf(PromoteType.class), + EnumSet.noneOf(MonsterType.class)), CATHEDRAL("Church of the All-Father", new String[][]{ {"Acolyte", "Acolyte"}, @@ -2333,7 +2334,9 @@ public class Enum { {"Patriarch", "Matriarch"}}, new String[]{"Thearchy", "Common Rule", "Theocracy", "Republic Rule"}, EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Crusader, PromoteType.Nightstalker, - PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, PromoteType.Scout)), + PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, PromoteType.Scout), + EnumSet.of(MonsterType.Aelfborn, MonsterType.Centaur, MonsterType.Elf, MonsterType.HalfGiant, + MonsterType.Human)), MILITARY("Military", new String[][]{ {"Recruit"}, {"Footman"}, @@ -2345,7 +2348,8 @@ public class Enum { {"Lord Marshall", "Lady Marshall"}}, new String[]{"Autocracy", "Common Rule", "Council Rule", "Militocracy"}, EnumSet.of(PromoteType.Bard, PromoteType.Priest, PromoteType.Scout, PromoteType.Warlock, - PromoteType.Warrior, PromoteType.Wizard)), + PromoteType.Warrior, PromoteType.Wizard), + EnumSet.of(MonsterType.Centaur, MonsterType.HalfGiant, MonsterType.Human)), TEMPLE("Temple of the Cleansing Flame", new String[][]{ {"Aspirant"}, {"Novice"}, @@ -2358,7 +2362,8 @@ public class Enum { {"Pontifex", "Pontifectrix"}}, new String[]{"Despot Rule", "Common Rule", "Protectorship", "Republic Rule"}, EnumSet.of(PromoteType.Assassin, PromoteType.Bard, PromoteType.Channeler, PromoteType.Confessor, - PromoteType.Nightstalker, PromoteType.Priest, PromoteType.Scout, PromoteType.Templar)), + PromoteType.Nightstalker, PromoteType.Priest, PromoteType.Scout, PromoteType.Templar), + EnumSet.of(MonsterType.HalfGiant, MonsterType.Human)), BARBARIAN("Barbarian Clan", new String[][]{ {"Barbarian"}, {"Skald"}, @@ -2369,7 +2374,8 @@ public class Enum { {"Thane"}}, new String[]{"Chiefdom", "Common Rule", "Council Rule", "Republic Rule"}, EnumSet.of(PromoteType.Barbarian, PromoteType.Bard, PromoteType.Doomsayer, PromoteType.Fury, - PromoteType.Priest, PromoteType.Scout, PromoteType.Thief, PromoteType.Warrior)), + PromoteType.Priest, PromoteType.Scout, PromoteType.Thief, PromoteType.Warrior), + EnumSet.of(MonsterType.Aelfborn, MonsterType.HalfGiant, MonsterType.Human, MonsterType.Minotaur)), RANGER("Ranger's Brotherhood", new String[][]{ {"Yeoman"}, {"Pathfinder"}, @@ -2380,7 +2386,8 @@ public class Enum { {"Lord Protector", "Lady Protector"}}, new String[]{"Despot Rule", "Collectivism", "Council Rule", "Republic Rule"}, EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Druid, PromoteType.Priest, - PromoteType.Ranger, PromoteType.Scout, PromoteType.Warrior)), + PromoteType.Ranger, PromoteType.Scout, PromoteType.Warrior), + EnumSet.of(MonsterType.Aelfborn, MonsterType.Elf, MonsterType.HalfGiant, MonsterType.Human, MonsterType.Shade)), AMAZON("Amazon Temple", new String[][]{ {"Amazon Thrall", "Amazon"}, {"Amazon Slave", "Amazon Warrior"}, @@ -2390,7 +2397,8 @@ public class Enum { {"Amazon Regent", "Imperatrix"}}, new String[]{"Despot Rule", "Common Rule", "Gynarchy", "Gynocracy"}, EnumSet.of(PromoteType.Bard, PromoteType.Druid, PromoteType.Fury, PromoteType.Huntress, - PromoteType.Priest, PromoteType.Scout, PromoteType.Warrior, PromoteType.Wizard)), + PromoteType.Priest, PromoteType.Scout, PromoteType.Warrior, PromoteType.Wizard), + EnumSet.of(MonsterType.Aelfborn, MonsterType.Elf, MonsterType.HalfGiant, MonsterType.Human)), NOBLE("Noble House", new String[][]{ {"Serf"}, {"Vassal"}, @@ -2403,7 +2411,8 @@ public class Enum { {"Emperor", "Empress"}}, new String[]{"Monarchy", "Common Rule", "Feodality", "Republic"}, EnumSet.of(PromoteType.Assassin, PromoteType.Bard, PromoteType.Channeler, PromoteType.Priest, - PromoteType.Scout, PromoteType.Thief, PromoteType.Warlock, PromoteType.Warrior, PromoteType.Wizard)), + PromoteType.Scout, PromoteType.Thief, PromoteType.Warlock, PromoteType.Warrior, PromoteType.Wizard), + EnumSet.of(MonsterType.Aelfborn, MonsterType.HalfGiant, MonsterType.Human)), WIZARD("Wizard's Conclave", new String[][]{ {"Apprentice"}, {"Neophyte"}, @@ -2414,7 +2423,8 @@ public class Enum { {"Archmagus"}}, new String[]{"Despot Rule", "Common Rule", "Council Rule", "Magocracy"}, EnumSet.of(PromoteType.Assassin, PromoteType.Bard, PromoteType.Channeler, PromoteType.Doomsayer, - PromoteType.Fury, PromoteType.Necromancer, PromoteType.Priest, PromoteType.Warlock, PromoteType.Wizard)), + PromoteType.Fury, PromoteType.Necromancer, PromoteType.Priest, PromoteType.Warlock, PromoteType.Wizard), + EnumSet.of(MonsterType.Aelfborn, MonsterType.Elf, MonsterType.Human, MonsterType.Nephilim, MonsterType.Shade)), MERCENARY("Mercenary Company", new String[][]{ {"Soldier"}, {"Man-at-Arms"}, @@ -2426,7 +2436,8 @@ public class Enum { {"Warlord"}}, new String[]{"Magistrature", "Mob Law", "Council Rule", "Republic Rule"}, EnumSet.of(PromoteType.Assassin, PromoteType.Bard, PromoteType.Priest, PromoteType.Scout, - PromoteType.Thief, PromoteType.Warlock, PromoteType.Warrior)), + PromoteType.Thief, PromoteType.Warlock, PromoteType.Warrior), + EnumSet.of(MonsterType.Aelfborn, MonsterType.Aracoix, MonsterType.HalfGiant, MonsterType.Human, MonsterType.Shade)), THIEVES("Thieve's Den", new String[][]{ {"Urchin"}, {"Footpad"}, @@ -2439,7 +2450,9 @@ public class Enum { {"Grandfather"}}, new String[]{"Despot Rule", "Common Rule", "Oligarchy", "Republic Rule"}, EnumSet.of(PromoteType.Assassin, PromoteType.Barbarian, PromoteType.Bard, PromoteType.Priest, - PromoteType.Scout, PromoteType.Thief, PromoteType.Wizard)), + PromoteType.Scout, PromoteType.Thief, PromoteType.Wizard), + EnumSet.of(MonsterType.Aelfborn, MonsterType.Aracoix, MonsterType.Elf, MonsterType.Human, MonsterType.Irekei, + MonsterType.Nephilim, MonsterType.Shade, MonsterType.Vampire)), DWARF("Dwarf Hold", new String[][]{ {"Citizen"}, {"Master"}, @@ -2449,7 +2462,8 @@ public class Enum { {"High Thane"}}, new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}, EnumSet.of(PromoteType.Crusader, PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, - PromoteType.Warrior)), + PromoteType.Warrior), + EnumSet.of(MonsterType.Dwarf)), HIGHCOURT("High Court", new String[][]{ {"Eccekebe"}, {"Saedulor"}, @@ -2463,7 +2477,8 @@ public class Enum { new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}, EnumSet.of(PromoteType.Assassin, PromoteType.Bard, PromoteType.Channeler, PromoteType.Druid, PromoteType.Necromancer, PromoteType.Priest, PromoteType.Ranger, PromoteType.Scout, - PromoteType.Thief, PromoteType.Warrior, PromoteType.Wizard)), + PromoteType.Thief, PromoteType.Warrior, PromoteType.Wizard), + EnumSet.of(MonsterType.Elf, MonsterType.Minotaur)), VIRAKT("Virakt", new String[][]{ {"Jov'uus"}, {"Urikhan"}, @@ -2476,7 +2491,8 @@ public class Enum { new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}, EnumSet.of(PromoteType.Assassin, PromoteType.Bard, PromoteType.Channeler, PromoteType.Fury, PromoteType.Huntress, PromoteType.Nightstalker, PromoteType.Priest, PromoteType.Ranger, - PromoteType.Scout, PromoteType.Thief, PromoteType.Warrior, PromoteType.Wizard)), + PromoteType.Scout, PromoteType.Thief, PromoteType.Warrior, PromoteType.Wizard), + EnumSet.of(MonsterType.Irekei)), BRIALIA("Coven of Brialia", new String[][]{ // Unknown Rank names {"Devotee"}, {"Initiated"}, @@ -2487,7 +2503,8 @@ public class Enum { {"Hierophant"}, {"Witch King", "Witch Queen"}}, new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}, - EnumSet.allOf(PromoteType.class)), + EnumSet.allOf(PromoteType.class), + EnumSet.allOf(MonsterType.class)), UNHOLY("Unholy Legion", new String[][]{ // Unknown Rank names {"Footman"}, @@ -2501,7 +2518,8 @@ public class Enum { new String[]{"Despot Rule", "Despot Rule", "Council Rule", "Republic Rule"}, EnumSet.of(PromoteType.Assassin, PromoteType.Channeler, PromoteType.Necromancer, PromoteType.Priest, PromoteType.Scout, PromoteType.Thief, PromoteType.Warlock, PromoteType.Warrior, - PromoteType.Wizard)), + PromoteType.Wizard), + EnumSet.of(MonsterType.Human, MonsterType.Shade, MonsterType.Vampire)), SCOURGE("Cult of the Scourge", new String[][]{ {"Thrall"}, {"Mudir"}, @@ -2510,7 +2528,8 @@ public class Enum { {"Dark Father", "Dark Mother"}}, new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}, EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Doomsayer, PromoteType.Priest, - PromoteType.Scout, PromoteType.Warrior, PromoteType.Wizard)), + PromoteType.Scout, PromoteType.Warrior, PromoteType.Wizard), + EnumSet.of(MonsterType.Aelfborn, MonsterType.Human, MonsterType.Minotaur, MonsterType.Nephilim)), PIRATE("Pirate Crew", new String[][]{ {"Midshipman", "Midshipwoman"}, {"Sailor"}, @@ -2519,7 +2538,8 @@ public class Enum { {"First Mate"}, {"Captain"}}, new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}, - EnumSet.allOf(PromoteType.class)), + EnumSet.allOf(PromoteType.class), + EnumSet.allOf(MonsterType.class)), HERALD("Academy of Heralds", new String[][]{ {"Pupil"}, {"Scribe"}, @@ -2530,7 +2550,8 @@ public class Enum { {"Archivist"}, {"Loremaster"}}, new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}, - EnumSet.allOf(PromoteType.class)), + EnumSet.allOf(PromoteType.class), + EnumSet.allOf(MonsterType.class)), CENTAUR("Centaur Cohort", new String[][]{ {"Hoplite"}, {"Peltast"}, @@ -2543,7 +2564,8 @@ public class Enum { new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}, EnumSet.of(PromoteType.Barbarian, PromoteType.Crusader, PromoteType.Druid, PromoteType.Huntress, PromoteType.Prelate, PromoteType.Priest, PromoteType.Ranger, PromoteType.Sentinel, - PromoteType.Warrior)), + PromoteType.Warrior), + EnumSet.of(MonsterType.Centaur)), KHREE("Aracoix Kh'ree", new String[][]{ {"Duriacor"}, {"Exarch"}, @@ -2558,21 +2580,23 @@ public class Enum { new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}, EnumSet.of(PromoteType.Assassin, PromoteType.Barbarian, PromoteType.Bard, PromoteType.Huntress, PromoteType.Priest, PromoteType.Ranger, PromoteType.Scout, PromoteType.Thief, - PromoteType.Warlock, PromoteType.Warrior)); + PromoteType.Warlock, PromoteType.Warrior), + EnumSet.of(MonsterType.Aracoix)); private final String name; private final String[][] ranks; //Stored Rank#->Gender(M,F) private final String[] leadershipTypes; public final EnumSet requiredClasses; - public final ArrayList requiredRaces; + public final EnumSet requiredRaces; public final SexType sexRequired; - GuildCharterType(String name, String[][] ranks, String[] leadershipTypes, EnumSet requiredClasses) { + GuildCharterType(String name, String[][] ranks, String[] leadershipTypes, EnumSet requiredClasses, + EnumSet requiredRaces) { this.name = name; this.ranks = ranks; this.leadershipTypes = leadershipTypes; this.requiredClasses = requiredClasses; - this.requiredRaces = DbManager.GuildQueries.LOAD_CHARTER_RACE_RESTRICTIONS(this.name); + this.requiredRaces = requiredRaces; this.sexRequired = DbManager.GuildQueries.LOAD_CHARTER_SEX_RESTRICTIONS(this.name); } From 2ea38519e4426643b709f4216768308305d41b9f Mon Sep 17 00:00:00 2001 From: MagicBot Date: Fri, 9 Feb 2024 13:48:15 -0500 Subject: [PATCH 13/39] charter sex requirements added --- src/engine/Enum.java | 70 ++++++++++++++++++++++++++++---------------- 1 file changed, 45 insertions(+), 25 deletions(-) diff --git a/src/engine/Enum.java b/src/engine/Enum.java index 5131f1da..629b2dfc 100644 --- a/src/engine/Enum.java +++ b/src/engine/Enum.java @@ -10,7 +10,6 @@ package engine; import ch.claude_martin.enumbitset.EnumBitSetHelper; import engine.gameManager.ConfigManager; -import engine.gameManager.DbManager; import engine.gameManager.PowersManager; import engine.gameManager.ZoneManager; import engine.math.Vector2f; @@ -2321,7 +2320,8 @@ public class Enum { public enum GuildCharterType { NONE("None", new String[][]{{"None"}}, new String[]{"Thearchy", "Common Rule", "Theocracy", "Republic Rule"}, EnumSet.noneOf(PromoteType.class), - EnumSet.noneOf(MonsterType.class)), + EnumSet.noneOf(MonsterType.class), + EnumSet.noneOf(SexType.class)), CATHEDRAL("Church of the All-Father", new String[][]{ {"Acolyte", "Acolyte"}, @@ -2336,7 +2336,8 @@ public class Enum { EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Crusader, PromoteType.Nightstalker, PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, PromoteType.Scout), EnumSet.of(MonsterType.Aelfborn, MonsterType.Centaur, MonsterType.Elf, MonsterType.HalfGiant, - MonsterType.Human)), + MonsterType.Human), + EnumSet.allOf(SexType.class)), MILITARY("Military", new String[][]{ {"Recruit"}, {"Footman"}, @@ -2349,7 +2350,8 @@ public class Enum { new String[]{"Autocracy", "Common Rule", "Council Rule", "Militocracy"}, EnumSet.of(PromoteType.Bard, PromoteType.Priest, PromoteType.Scout, PromoteType.Warlock, PromoteType.Warrior, PromoteType.Wizard), - EnumSet.of(MonsterType.Centaur, MonsterType.HalfGiant, MonsterType.Human)), + EnumSet.of(MonsterType.Centaur, MonsterType.HalfGiant, MonsterType.Human), + EnumSet.allOf(SexType.class)), TEMPLE("Temple of the Cleansing Flame", new String[][]{ {"Aspirant"}, {"Novice"}, @@ -2363,7 +2365,8 @@ public class Enum { new String[]{"Despot Rule", "Common Rule", "Protectorship", "Republic Rule"}, EnumSet.of(PromoteType.Assassin, PromoteType.Bard, PromoteType.Channeler, PromoteType.Confessor, PromoteType.Nightstalker, PromoteType.Priest, PromoteType.Scout, PromoteType.Templar), - EnumSet.of(MonsterType.HalfGiant, MonsterType.Human)), + EnumSet.of(MonsterType.HalfGiant, MonsterType.Human), + EnumSet.allOf(SexType.class)), BARBARIAN("Barbarian Clan", new String[][]{ {"Barbarian"}, {"Skald"}, @@ -2375,7 +2378,8 @@ public class Enum { new String[]{"Chiefdom", "Common Rule", "Council Rule", "Republic Rule"}, EnumSet.of(PromoteType.Barbarian, PromoteType.Bard, PromoteType.Doomsayer, PromoteType.Fury, PromoteType.Priest, PromoteType.Scout, PromoteType.Thief, PromoteType.Warrior), - EnumSet.of(MonsterType.Aelfborn, MonsterType.HalfGiant, MonsterType.Human, MonsterType.Minotaur)), + EnumSet.of(MonsterType.Aelfborn, MonsterType.HalfGiant, MonsterType.Human, MonsterType.Minotaur), + EnumSet.allOf(SexType.class)), RANGER("Ranger's Brotherhood", new String[][]{ {"Yeoman"}, {"Pathfinder"}, @@ -2387,7 +2391,8 @@ public class Enum { new String[]{"Despot Rule", "Collectivism", "Council Rule", "Republic Rule"}, EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Druid, PromoteType.Priest, PromoteType.Ranger, PromoteType.Scout, PromoteType.Warrior), - EnumSet.of(MonsterType.Aelfborn, MonsterType.Elf, MonsterType.HalfGiant, MonsterType.Human, MonsterType.Shade)), + EnumSet.of(MonsterType.Aelfborn, MonsterType.Elf, MonsterType.HalfGiant, MonsterType.Human, MonsterType.Shade), + EnumSet.allOf(SexType.class)), AMAZON("Amazon Temple", new String[][]{ {"Amazon Thrall", "Amazon"}, {"Amazon Slave", "Amazon Warrior"}, @@ -2398,7 +2403,8 @@ public class Enum { new String[]{"Despot Rule", "Common Rule", "Gynarchy", "Gynocracy"}, EnumSet.of(PromoteType.Bard, PromoteType.Druid, PromoteType.Fury, PromoteType.Huntress, PromoteType.Priest, PromoteType.Scout, PromoteType.Warrior, PromoteType.Wizard), - EnumSet.of(MonsterType.Aelfborn, MonsterType.Elf, MonsterType.HalfGiant, MonsterType.Human)), + EnumSet.of(MonsterType.Aelfborn, MonsterType.Elf, MonsterType.HalfGiant, MonsterType.Human), + EnumSet.of(SexType.FEMALE)), NOBLE("Noble House", new String[][]{ {"Serf"}, {"Vassal"}, @@ -2412,7 +2418,8 @@ public class Enum { new String[]{"Monarchy", "Common Rule", "Feodality", "Republic"}, EnumSet.of(PromoteType.Assassin, PromoteType.Bard, PromoteType.Channeler, PromoteType.Priest, PromoteType.Scout, PromoteType.Thief, PromoteType.Warlock, PromoteType.Warrior, PromoteType.Wizard), - EnumSet.of(MonsterType.Aelfborn, MonsterType.HalfGiant, MonsterType.Human)), + EnumSet.of(MonsterType.Aelfborn, MonsterType.HalfGiant, MonsterType.Human), + EnumSet.allOf(SexType.class)), WIZARD("Wizard's Conclave", new String[][]{ {"Apprentice"}, {"Neophyte"}, @@ -2424,7 +2431,8 @@ public class Enum { new String[]{"Despot Rule", "Common Rule", "Council Rule", "Magocracy"}, EnumSet.of(PromoteType.Assassin, PromoteType.Bard, PromoteType.Channeler, PromoteType.Doomsayer, PromoteType.Fury, PromoteType.Necromancer, PromoteType.Priest, PromoteType.Warlock, PromoteType.Wizard), - EnumSet.of(MonsterType.Aelfborn, MonsterType.Elf, MonsterType.Human, MonsterType.Nephilim, MonsterType.Shade)), + EnumSet.of(MonsterType.Aelfborn, MonsterType.Elf, MonsterType.Human, MonsterType.Nephilim, MonsterType.Shade), + EnumSet.allOf(SexType.class)), MERCENARY("Mercenary Company", new String[][]{ {"Soldier"}, {"Man-at-Arms"}, @@ -2437,7 +2445,8 @@ public class Enum { new String[]{"Magistrature", "Mob Law", "Council Rule", "Republic Rule"}, EnumSet.of(PromoteType.Assassin, PromoteType.Bard, PromoteType.Priest, PromoteType.Scout, PromoteType.Thief, PromoteType.Warlock, PromoteType.Warrior), - EnumSet.of(MonsterType.Aelfborn, MonsterType.Aracoix, MonsterType.HalfGiant, MonsterType.Human, MonsterType.Shade)), + EnumSet.of(MonsterType.Aelfborn, MonsterType.Aracoix, MonsterType.HalfGiant, MonsterType.Human, MonsterType.Shade), + EnumSet.allOf(SexType.class)), THIEVES("Thieve's Den", new String[][]{ {"Urchin"}, {"Footpad"}, @@ -2452,7 +2461,8 @@ public class Enum { EnumSet.of(PromoteType.Assassin, PromoteType.Barbarian, PromoteType.Bard, PromoteType.Priest, PromoteType.Scout, PromoteType.Thief, PromoteType.Wizard), EnumSet.of(MonsterType.Aelfborn, MonsterType.Aracoix, MonsterType.Elf, MonsterType.Human, MonsterType.Irekei, - MonsterType.Nephilim, MonsterType.Shade, MonsterType.Vampire)), + MonsterType.Nephilim, MonsterType.Shade, MonsterType.Vampire), + EnumSet.allOf(SexType.class)), DWARF("Dwarf Hold", new String[][]{ {"Citizen"}, {"Master"}, @@ -2463,7 +2473,8 @@ public class Enum { new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}, EnumSet.of(PromoteType.Crusader, PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, PromoteType.Warrior), - EnumSet.of(MonsterType.Dwarf)), + EnumSet.of(MonsterType.Dwarf), + EnumSet.allOf(SexType.class)), HIGHCOURT("High Court", new String[][]{ {"Eccekebe"}, {"Saedulor"}, @@ -2478,7 +2489,8 @@ public class Enum { EnumSet.of(PromoteType.Assassin, PromoteType.Bard, PromoteType.Channeler, PromoteType.Druid, PromoteType.Necromancer, PromoteType.Priest, PromoteType.Ranger, PromoteType.Scout, PromoteType.Thief, PromoteType.Warrior, PromoteType.Wizard), - EnumSet.of(MonsterType.Elf, MonsterType.Minotaur)), + EnumSet.of(MonsterType.Elf, MonsterType.Minotaur), + EnumSet.allOf(SexType.class)), VIRAKT("Virakt", new String[][]{ {"Jov'uus"}, {"Urikhan"}, @@ -2492,7 +2504,8 @@ public class Enum { EnumSet.of(PromoteType.Assassin, PromoteType.Bard, PromoteType.Channeler, PromoteType.Fury, PromoteType.Huntress, PromoteType.Nightstalker, PromoteType.Priest, PromoteType.Ranger, PromoteType.Scout, PromoteType.Thief, PromoteType.Warrior, PromoteType.Wizard), - EnumSet.of(MonsterType.Irekei)), + EnumSet.of(MonsterType.Irekei), + EnumSet.allOf(SexType.class)), BRIALIA("Coven of Brialia", new String[][]{ // Unknown Rank names {"Devotee"}, {"Initiated"}, @@ -2504,7 +2517,8 @@ public class Enum { {"Witch King", "Witch Queen"}}, new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}, EnumSet.allOf(PromoteType.class), - EnumSet.allOf(MonsterType.class)), + EnumSet.allOf(MonsterType.class), + EnumSet.allOf(SexType.class)), UNHOLY("Unholy Legion", new String[][]{ // Unknown Rank names {"Footman"}, @@ -2519,7 +2533,8 @@ public class Enum { EnumSet.of(PromoteType.Assassin, PromoteType.Channeler, PromoteType.Necromancer, PromoteType.Priest, PromoteType.Scout, PromoteType.Thief, PromoteType.Warlock, PromoteType.Warrior, PromoteType.Wizard), - EnumSet.of(MonsterType.Human, MonsterType.Shade, MonsterType.Vampire)), + EnumSet.of(MonsterType.Human, MonsterType.Shade, MonsterType.Vampire), + EnumSet.allOf(SexType.class)), SCOURGE("Cult of the Scourge", new String[][]{ {"Thrall"}, {"Mudir"}, @@ -2529,7 +2544,8 @@ public class Enum { new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}, EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Doomsayer, PromoteType.Priest, PromoteType.Scout, PromoteType.Warrior, PromoteType.Wizard), - EnumSet.of(MonsterType.Aelfborn, MonsterType.Human, MonsterType.Minotaur, MonsterType.Nephilim)), + EnumSet.of(MonsterType.Aelfborn, MonsterType.Human, MonsterType.Minotaur, MonsterType.Nephilim), + EnumSet.allOf(SexType.class)), PIRATE("Pirate Crew", new String[][]{ {"Midshipman", "Midshipwoman"}, {"Sailor"}, @@ -2539,7 +2555,8 @@ public class Enum { {"Captain"}}, new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}, EnumSet.allOf(PromoteType.class), - EnumSet.allOf(MonsterType.class)), + EnumSet.allOf(MonsterType.class), + EnumSet.allOf(SexType.class)), HERALD("Academy of Heralds", new String[][]{ {"Pupil"}, {"Scribe"}, @@ -2551,7 +2568,8 @@ public class Enum { {"Loremaster"}}, new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}, EnumSet.allOf(PromoteType.class), - EnumSet.allOf(MonsterType.class)), + EnumSet.allOf(MonsterType.class), + EnumSet.allOf(SexType.class)), CENTAUR("Centaur Cohort", new String[][]{ {"Hoplite"}, {"Peltast"}, @@ -2565,7 +2583,8 @@ public class Enum { EnumSet.of(PromoteType.Barbarian, PromoteType.Crusader, PromoteType.Druid, PromoteType.Huntress, PromoteType.Prelate, PromoteType.Priest, PromoteType.Ranger, PromoteType.Sentinel, PromoteType.Warrior), - EnumSet.of(MonsterType.Centaur)), + EnumSet.of(MonsterType.Centaur), + EnumSet.allOf(SexType.class)), KHREE("Aracoix Kh'ree", new String[][]{ {"Duriacor"}, {"Exarch"}, @@ -2581,23 +2600,24 @@ public class Enum { EnumSet.of(PromoteType.Assassin, PromoteType.Barbarian, PromoteType.Bard, PromoteType.Huntress, PromoteType.Priest, PromoteType.Ranger, PromoteType.Scout, PromoteType.Thief, PromoteType.Warlock, PromoteType.Warrior), - EnumSet.of(MonsterType.Aracoix)); + EnumSet.of(MonsterType.Aracoix), + EnumSet.allOf(SexType.class)); private final String name; private final String[][] ranks; //Stored Rank#->Gender(M,F) private final String[] leadershipTypes; public final EnumSet requiredClasses; public final EnumSet requiredRaces; - public final SexType sexRequired; + public final EnumSet sexRequired; GuildCharterType(String name, String[][] ranks, String[] leadershipTypes, EnumSet requiredClasses, - EnumSet requiredRaces) { + EnumSet requiredRaces, EnumSet sexRequired) { this.name = name; this.ranks = ranks; this.leadershipTypes = leadershipTypes; this.requiredClasses = requiredClasses; this.requiredRaces = requiredRaces; - this.sexRequired = DbManager.GuildQueries.LOAD_CHARTER_SEX_RESTRICTIONS(this.name); + this.sexRequired = sexRequired; } public static GuildCharterType getGuildTypeFromCharter(ItemBase itemBase) { From 5f71ff2db5f0ae43282f3146a1f0f6ab95e40f84 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Fri, 9 Feb 2024 13:51:13 -0500 Subject: [PATCH 14/39] Removed unused handlers. --- src/engine/db/handlers/dbGuildHandler.java | 83 ---------------------- 1 file changed, 83 deletions(-) diff --git a/src/engine/db/handlers/dbGuildHandler.java b/src/engine/db/handlers/dbGuildHandler.java index fcebe3ac..7a61f1a7 100644 --- a/src/engine/db/handlers/dbGuildHandler.java +++ b/src/engine/db/handlers/dbGuildHandler.java @@ -695,87 +695,4 @@ public class dbGuildHandler extends dbHandlerBase { } } - //TODO uncomment this when finished with guild history warehouse integration -// public HashMap GET_WAREHOUSE_GUILD_HISTORY(){ -// -// HashMap tempMap = new HashMap<>(); -// prepareCallable("SELECT * FROM `warehouse_guildhistory` WHERE `eventType` = 'CREATE'"); -// try { -// ResultSet rs = executeQuery(); -// -// while (rs.next()) { -// GuildRecord guildRecord = new GuildRecord(rs); -// tempMap.put(guildRecord.guildID, guildRecord); -// } -// }catch (Exception e){ -// Logger.error(e); -// } -// return tempMap; -// -// } - - public ArrayList LOAD_CHARTER_RACE_RESTRICTIONS(String name){ - ArrayList 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 LOAD_CHARTER_CLASS_RESTRICTIONS(String name){ - ArrayList 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; - } } From d2cbfd491a9aad4899376bd80540648a180e2657 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Fri, 9 Feb 2024 14:10:28 -0500 Subject: [PATCH 15/39] Devcmd output cleanup --- src/engine/devcmd/cmds/SlotNpcCmd.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/engine/devcmd/cmds/SlotNpcCmd.java b/src/engine/devcmd/cmds/SlotNpcCmd.java index dcf2631e..38b06c7e 100644 --- a/src/engine/devcmd/cmds/SlotNpcCmd.java +++ b/src/engine/devcmd/cmds/SlotNpcCmd.java @@ -53,7 +53,7 @@ public class SlotNpcCmd extends AbstractDevCmd { if (stringIndex == -1) return false; - // Validate we have a corrent building group name + // Validate we have a correct building group name for (BuildingGroup group : BuildingGroup.values()) { if (group.name().equals(userInput[0].toUpperCase())) @@ -114,8 +114,7 @@ public class SlotNpcCmd extends AbstractDevCmd { if (!DbManager.ContractQueries.updateAllowedBuildings(contract, contract.getAllowedBuildings().toLong())) { Logger.error("Failed to update Database for Contract Allowed buildings"); - ChatManager.chatSystemError(pc, "Failed to update Database for Contract Allowed buildings. " + - "Contact A CCR, oh wait, you are a CCR. You're Fubared."); + ChatManager.chatSystemError(pc, "Failed to update Database for Contract Allowed buildings. "); return; } @@ -125,8 +124,7 @@ public class SlotNpcCmd extends AbstractDevCmd { contract.getAllowedBuildings().remove(buildingGroup); if (!DbManager.ContractQueries.updateAllowedBuildings(contract, contract.getAllowedBuildings().toLong())) { Logger.error("Failed to update Database for Contract Allowed buildings"); - ChatManager.chatSystemError(pc, "Failed to update Database for Contract Allowed buildings. " + - "Contact A CCR, oh wait, you are a CCR. You're Fubared."); + ChatManager.chatSystemError(pc, "Failed to update Database for Contract Allowed buildings. "); return; } @@ -138,14 +136,14 @@ public class SlotNpcCmd extends AbstractDevCmd { @Override protected String _getHelpString() { - return "Sets a building slot on a targeted npc"; + return "Toggles a building group on a targeted npc"; } // Class methods @Override protected String _getUsageString() { - String usage = "/npcslot [BuildingType] on-off \n"; + String usage = "/npcslot [BuildingGroup] on-off \n"; for (BuildingGroup group : BuildingGroup.values()) { usage += group.name() + ' '; From 141a65d48eb6495029155b8d5df2962461f4f049 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sat, 10 Feb 2024 10:39:25 -0500 Subject: [PATCH 16/39] Discripline type enum created --- src/engine/Enum.java | 175 +++++++++++++++++++++++++++---------------- 1 file changed, 111 insertions(+), 64 deletions(-) diff --git a/src/engine/Enum.java b/src/engine/Enum.java index 629b2dfc..0c7b2962 100644 --- a/src/engine/Enum.java +++ b/src/engine/Enum.java @@ -46,7 +46,7 @@ public class Enum { EXPLOIT, BUG, GAME_STOPPER, - TECH_SUPPORT; + TECH_SUPPORT } @@ -112,7 +112,7 @@ public class Enum { Undead, Nephilim, Vampire, - SiegeEngineer; + SiegeEngineer } @@ -120,7 +120,7 @@ public class Enum { MALE, FEMALE, FUZZY, - OTHER; + OTHER } public enum RaceType { @@ -155,13 +155,13 @@ public class Enum { VAMPFEMALE(2029, MonsterType.Vampire, RunSpeed.STANDARD, CharacterSex.FEMALE, 1); @SuppressWarnings("unchecked") - private static HashMap _raceTypeByID = new HashMap<>(); + private static final HashMap _raceTypeByID = new HashMap<>(); int runeID; - private MonsterType monsterType; - private CharacterSex characterSex; - private RunSpeed runSpeed; - private float scaleHeight; + private final MonsterType monsterType; + private final CharacterSex characterSex; + private final RunSpeed runSpeed; + private final float scaleHeight; RaceType(int runeID, MonsterType aggroType, RunSpeed runspeed, CharacterSex characterSex, float scaleHeight) { this.runeID = runeID; @@ -210,13 +210,13 @@ public class Enum { CENTAUR(6.1900001f, 16.940001f, 5.5500002f, 16.940001f, 6.3299999f, 18.379999f, 6.5f), MINOTAUR(6.6300001f, 15.95f, 4.2199998f, 15.95f, 6.3299999f, 18.379999f, 6.5f); - private float walkStandard; - private float walkCombat; - private float runStandard; - private float runCombat; - private float swim; - private float flyRun; - private float flyWalk; + private final float walkStandard; + private final float walkCombat; + private final float runStandard; + private final float runCombat; + private final float swim; + private final float flyRun; + private final float flyWalk; RunSpeed(float walkStandard, float runStandard, float walkCombat, float runCombat, float flyWalk, float flyRun, float swim) { this.walkStandard = walkStandard; @@ -310,13 +310,13 @@ public class Enum { public enum PvpHistoryType { KILLS, - DEATHS; + DEATHS } public enum ChatMessageType { ERROR, INFO, - MOTD; + MOTD } public enum DataRecordType { @@ -327,7 +327,7 @@ public class Enum { CITY, ZONE, REALM, - MINE; + MINE } public enum RecordEventType { @@ -338,7 +338,7 @@ public class Enum { TRANSFER, PENDING, DEFEND, - LOST; // Realm event + LOST // Realm event } public enum CharterType { @@ -346,8 +346,8 @@ public class Enum { MERCANTILE(-15978914, 5060400), BELLIGERENT(762228431, 5060800); - private int charterID; - private int meshID; + private final int charterID; + private final int meshID; CharterType(int charterID, int meshID) { this.charterID = charterID; @@ -402,7 +402,7 @@ public class Enum { Npc, PlayerCharacter, Account, - Mob; + Mob } public enum SiegePhase { @@ -410,20 +410,20 @@ public class Enum { CHALLENGE, STANDOFF, WAR, - CEASEFIRE; + CEASEFIRE } public enum SiegeResult { PENDING, DEFEND, DESTROY, - CAPTURE; + CAPTURE } public enum TaxType { PROFIT, WEEKLY, - NONE; + NONE } @@ -1261,7 +1261,7 @@ public class Enum { SITTING, RUNNING, FLYING, - SWIMMING; + SWIMMING } public enum DoorState { @@ -1269,7 +1269,7 @@ public class Enum { OPEN, CLOSED, LOCKED, - UNLOCKED; + UNLOCKED } // Used with stored procedure GET_UID_ENUM() for @@ -1290,11 +1290,9 @@ public class Enum { SHRINE, WORLDSERVER, ZONE, - WAREHOUSE; + WAREHOUSE } - ; - /** * Enumeration of Building Protection Status stored in the database as a * mysql enumfield. WARNING: This enumeration is fragile. Do not rename. Do @@ -1309,11 +1307,64 @@ public class Enum { CONTRACT, DESTROYED, PENDING, - NPC; + NPC + } + + public enum DisciplineType { + + Alchemist, + Animator, + Archer, + Berserker, + BlackMask, + Blacksmith, + BladeMaster, + BladeWeaver, + BloodProphet, + BountyHunter, + Clanwarden, + Commander, + DarkKnight, + Duelist, + ForgeMaster, + GiantKiller, + Gladiator, + Huntsman, + Knight, + RatCatcher, + RuneCaster, + Enchanter, + StormLord, + Summoner, + Sundancer, + Trainer, + Traveler, + UndeadHunter, + Werebear, + Wererat, + Werewolf, + Wyrmslayer, + Conjurer, + Darksworn, + Valkyr, + BloodHorn, + Shroudborne, + Archmage, + Thrall, + Artillerist, + Savant, + SkyDancer, + Prospector, + Belgosch, + Drannok, + Gorgoi, + Strigoi, + Sapper, + Saboteur, + BattleMagus, + Sanctifier, } - ; - public enum CharacterSkills { Archery((1L << 1), -529201545, 20), @@ -1382,7 +1433,7 @@ public class Enum { private long flag; private int token; - private int reqLvl; + private final int reqLvl; CharacterSkills(long flag, int token, int reqLvl) { this.flag = flag; @@ -1421,8 +1472,6 @@ public class Enum { } } - ; - public enum GuildHistoryType { JOIN(1), LEAVE(4), @@ -1443,14 +1492,14 @@ public class Enum { public enum SexType { NONE, MALE, - FEMALE; + FEMALE } public enum ClassType { FIGHTER, HEALER, ROGUE, - MAGE; + MAGE } public enum PromoteType { @@ -1478,7 +1527,7 @@ public class Enum { Necromancer(SexType.NONE), ; - private SexType sexRestriction; + private final SexType sexRestriction; PromoteType(SexType sexRestriction) { this.sexRestriction = sexRestriction; @@ -1660,13 +1709,13 @@ public class Enum { REGEN, FLIGHT, LOCATION, - MOVEMENTSTATE; + MOVEMENTSTATE } public enum ServerType { WORLDSERVER, LOGINSERVER, - NONE; + NONE } public enum ChatChannel implements EnumBitSetHelper { @@ -1720,7 +1769,7 @@ public class Enum { Thief, Warlock, Warrior, - Wizard; + Wizard } @@ -1728,13 +1777,13 @@ public class Enum { RecommendedAlly, RecommendedEnemy, Ally, - Enemy; + Enemy } public enum FriendStatus { Available, Away, - Busy; + Busy } public enum ProfitType { @@ -1749,7 +1798,7 @@ public class Enum { public String dbField; - private ProfitType(String dbField) { + ProfitType(String dbField) { this.dbField = dbField; } } @@ -1842,17 +1891,15 @@ public class Enum { WorldServerInfoSnapshot, Shrine, Zone, - Transaction; + Transaction } public enum ContainerType { BANK, INVENTORY, - VAULT; + VAULT } - ; - public enum CompoundCurveType { DefaultFlat(0), DefaultSlope(1), @@ -2160,7 +2207,7 @@ public class Enum { private final double value; - private CompoundCurveType(double value) { + CompoundCurveType(double value) { this.value = value; } @@ -2183,7 +2230,7 @@ public class Enum { Sit, TakeDamage, TerritoryClaim, - UnEquip; + UnEquip } public enum PowerSubType { @@ -2193,7 +2240,7 @@ public class Enum { DamageType1, DamageType2, DamageType3, - Cancel; + Cancel } public enum PowerCategoryType { @@ -2228,7 +2275,7 @@ public class Enum { RECALL, SPIREPROOFTELEPORT, SPIREDISABLE, - THIEF; + THIEF } public enum PowerTargetType { @@ -2247,7 +2294,7 @@ public class Enum { JEWELRY, WEAPONARMOR, ARMOR, - ITEM; + ITEM } public enum objectMaskType { @@ -2280,7 +2327,7 @@ public class Enum { BANK, VAULT, FORGE, - WAREHOUSE; + WAREHOUSE } public enum ItemSlotType implements EnumBitSetHelper { @@ -2301,7 +2348,7 @@ public class Enum { UPARM, WINGS, BEARD, - HAIR; + HAIR } public enum CityBoundsType { @@ -2603,12 +2650,12 @@ public class Enum { EnumSet.of(MonsterType.Aracoix), EnumSet.allOf(SexType.class)); - private final String name; - private final String[][] ranks; //Stored Rank#->Gender(M,F) - private final String[] leadershipTypes; public final EnumSet requiredClasses; public final EnumSet requiredRaces; public final EnumSet sexRequired; + private final String name; + private final String[][] ranks; //Stored Rank#->Gender(M,F) + private final String[] leadershipTypes; GuildCharterType(String name, String[][] ranks, String[] leadershipTypes, EnumSet requiredClasses, EnumSet requiredRaces, EnumSet sexRequired) { @@ -2728,7 +2775,7 @@ public class Enum { public enum MinionClass { MELEE, ARCHER, - MAGE; + MAGE } public enum MinionType { @@ -2798,14 +2845,14 @@ public class Enum { return race; } - public Boolean isMage(){ + public Boolean isMage() { return this.minionClass.ordinal() == MinionClass.MAGE.ordinal(); } } public enum GridObjectType { STATIC, - DYNAMIC; + DYNAMIC } public enum SupportMsgType { @@ -2908,7 +2955,7 @@ public class Enum { public enum AccountStatus { BANNED, ACTIVE, - ADMIN; + ADMIN } public enum MobBehaviourType { @@ -2973,6 +3020,6 @@ public class Enum { GUARDWALLARCHER, PET, CHARMED, - SIEGEENGINE; + SIEGEENGINE } } From e05d0d8daa543a9c2bbe8d1c24de8f2d343c41f7 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sat, 10 Feb 2024 13:13:11 -0500 Subject: [PATCH 17/39] promote type upgraded to class type. --- src/engine/Enum.java | 103 +++++++++++----------- src/engine/objects/AbstractCharacter.java | 3 +- src/engine/objects/ItemBase.java | 12 +-- src/engine/objects/PlayerCharacter.java | 2 +- 4 files changed, 58 insertions(+), 62 deletions(-) diff --git a/src/engine/Enum.java b/src/engine/Enum.java index 0c7b2962..88f5ff19 100644 --- a/src/engine/Enum.java +++ b/src/engine/Enum.java @@ -1496,13 +1496,10 @@ public class Enum { } public enum ClassType { - FIGHTER, - HEALER, - ROGUE, - MAGE - } - - public enum PromoteType { + FIGHTER(SexType.NONE), + HEALER(SexType.NONE), + ROGUE(SexType.NONE), + MAGE(SexType.NONE), Assassin(SexType.NONE), Barbarian(SexType.NONE), Bard(SexType.NONE), @@ -1529,7 +1526,7 @@ public class Enum { private final SexType sexRestriction; - PromoteType(SexType sexRestriction) { + ClassType(SexType sexRestriction) { this.sexRestriction = sexRestriction; } @@ -2366,7 +2363,7 @@ public class Enum { public enum GuildCharterType { NONE("None", new String[][]{{"None"}}, new String[]{"Thearchy", "Common Rule", "Theocracy", "Republic Rule"}, - EnumSet.noneOf(PromoteType.class), + EnumSet.noneOf(ClassType.class), EnumSet.noneOf(MonsterType.class), EnumSet.noneOf(SexType.class)), @@ -2380,8 +2377,8 @@ public class Enum { {"Lord Cardinal", "Lady Cardinal"}, {"Patriarch", "Matriarch"}}, new String[]{"Thearchy", "Common Rule", "Theocracy", "Republic Rule"}, - EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Crusader, PromoteType.Nightstalker, - PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, PromoteType.Scout), + EnumSet.of(ClassType.Bard, ClassType.Channeler, ClassType.Crusader, ClassType.Nightstalker, + ClassType.Prelate, ClassType.Priest, ClassType.Sentinel, ClassType.Scout), EnumSet.of(MonsterType.Aelfborn, MonsterType.Centaur, MonsterType.Elf, MonsterType.HalfGiant, MonsterType.Human), EnumSet.allOf(SexType.class)), @@ -2395,8 +2392,8 @@ public class Enum { {"General"}, {"Lord Marshall", "Lady Marshall"}}, new String[]{"Autocracy", "Common Rule", "Council Rule", "Militocracy"}, - EnumSet.of(PromoteType.Bard, PromoteType.Priest, PromoteType.Scout, PromoteType.Warlock, - PromoteType.Warrior, PromoteType.Wizard), + EnumSet.of(ClassType.Bard, ClassType.Priest, ClassType.Scout, ClassType.Warlock, + ClassType.Warrior, ClassType.Wizard), EnumSet.of(MonsterType.Centaur, MonsterType.HalfGiant, MonsterType.Human), EnumSet.allOf(SexType.class)), TEMPLE("Temple of the Cleansing Flame", new String[][]{ @@ -2410,8 +2407,8 @@ public class Enum { {"Justiciar"}, {"Pontifex", "Pontifectrix"}}, new String[]{"Despot Rule", "Common Rule", "Protectorship", "Republic Rule"}, - EnumSet.of(PromoteType.Assassin, PromoteType.Bard, PromoteType.Channeler, PromoteType.Confessor, - PromoteType.Nightstalker, PromoteType.Priest, PromoteType.Scout, PromoteType.Templar), + EnumSet.of(ClassType.Assassin, ClassType.Bard, ClassType.Channeler, ClassType.Confessor, + ClassType.Nightstalker, ClassType.Priest, ClassType.Scout, ClassType.Templar), EnumSet.of(MonsterType.HalfGiant, MonsterType.Human), EnumSet.allOf(SexType.class)), BARBARIAN("Barbarian Clan", new String[][]{ @@ -2423,8 +2420,8 @@ public class Enum { {"Chieftain"}, {"Thane"}}, new String[]{"Chiefdom", "Common Rule", "Council Rule", "Republic Rule"}, - EnumSet.of(PromoteType.Barbarian, PromoteType.Bard, PromoteType.Doomsayer, PromoteType.Fury, - PromoteType.Priest, PromoteType.Scout, PromoteType.Thief, PromoteType.Warrior), + EnumSet.of(ClassType.Barbarian, ClassType.Bard, ClassType.Doomsayer, ClassType.Fury, + ClassType.Priest, ClassType.Scout, ClassType.Thief, ClassType.Warrior), EnumSet.of(MonsterType.Aelfborn, MonsterType.HalfGiant, MonsterType.Human, MonsterType.Minotaur), EnumSet.allOf(SexType.class)), RANGER("Ranger's Brotherhood", new String[][]{ @@ -2436,8 +2433,8 @@ public class Enum { {"Guardian"}, {"Lord Protector", "Lady Protector"}}, new String[]{"Despot Rule", "Collectivism", "Council Rule", "Republic Rule"}, - EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Druid, PromoteType.Priest, - PromoteType.Ranger, PromoteType.Scout, PromoteType.Warrior), + EnumSet.of(ClassType.Bard, ClassType.Channeler, ClassType.Druid, ClassType.Priest, + ClassType.Ranger, ClassType.Scout, ClassType.Warrior), EnumSet.of(MonsterType.Aelfborn, MonsterType.Elf, MonsterType.HalfGiant, MonsterType.Human, MonsterType.Shade), EnumSet.allOf(SexType.class)), AMAZON("Amazon Temple", new String[][]{ @@ -2448,8 +2445,8 @@ public class Enum { {"Amazon Seneschal", "Majestrix"}, {"Amazon Regent", "Imperatrix"}}, new String[]{"Despot Rule", "Common Rule", "Gynarchy", "Gynocracy"}, - EnumSet.of(PromoteType.Bard, PromoteType.Druid, PromoteType.Fury, PromoteType.Huntress, - PromoteType.Priest, PromoteType.Scout, PromoteType.Warrior, PromoteType.Wizard), + EnumSet.of(ClassType.Bard, ClassType.Druid, ClassType.Fury, ClassType.Huntress, + ClassType.Priest, ClassType.Scout, ClassType.Warrior, ClassType.Wizard), EnumSet.of(MonsterType.Aelfborn, MonsterType.Elf, MonsterType.HalfGiant, MonsterType.Human), EnumSet.of(SexType.FEMALE)), NOBLE("Noble House", new String[][]{ @@ -2463,8 +2460,8 @@ public class Enum { {"King", "Queen"}, {"Emperor", "Empress"}}, new String[]{"Monarchy", "Common Rule", "Feodality", "Republic"}, - EnumSet.of(PromoteType.Assassin, PromoteType.Bard, PromoteType.Channeler, PromoteType.Priest, - PromoteType.Scout, PromoteType.Thief, PromoteType.Warlock, PromoteType.Warrior, PromoteType.Wizard), + EnumSet.of(ClassType.Assassin, ClassType.Bard, ClassType.Channeler, ClassType.Priest, + ClassType.Scout, ClassType.Thief, ClassType.Warlock, ClassType.Warrior, ClassType.Wizard), EnumSet.of(MonsterType.Aelfborn, MonsterType.HalfGiant, MonsterType.Human), EnumSet.allOf(SexType.class)), WIZARD("Wizard's Conclave", new String[][]{ @@ -2476,8 +2473,8 @@ public class Enum { {"High Magus"}, {"Archmagus"}}, new String[]{"Despot Rule", "Common Rule", "Council Rule", "Magocracy"}, - EnumSet.of(PromoteType.Assassin, PromoteType.Bard, PromoteType.Channeler, PromoteType.Doomsayer, - PromoteType.Fury, PromoteType.Necromancer, PromoteType.Priest, PromoteType.Warlock, PromoteType.Wizard), + EnumSet.of(ClassType.Assassin, ClassType.Bard, ClassType.Channeler, ClassType.Doomsayer, + ClassType.Fury, ClassType.Necromancer, ClassType.Priest, ClassType.Warlock, ClassType.Wizard), EnumSet.of(MonsterType.Aelfborn, MonsterType.Elf, MonsterType.Human, MonsterType.Nephilim, MonsterType.Shade), EnumSet.allOf(SexType.class)), MERCENARY("Mercenary Company", new String[][]{ @@ -2490,8 +2487,8 @@ public class Enum { {"High Commander"}, {"Warlord"}}, new String[]{"Magistrature", "Mob Law", "Council Rule", "Republic Rule"}, - EnumSet.of(PromoteType.Assassin, PromoteType.Bard, PromoteType.Priest, PromoteType.Scout, - PromoteType.Thief, PromoteType.Warlock, PromoteType.Warrior), + EnumSet.of(ClassType.Assassin, ClassType.Bard, ClassType.Priest, ClassType.Scout, + ClassType.Thief, ClassType.Warlock, ClassType.Warrior), EnumSet.of(MonsterType.Aelfborn, MonsterType.Aracoix, MonsterType.HalfGiant, MonsterType.Human, MonsterType.Shade), EnumSet.allOf(SexType.class)), THIEVES("Thieve's Den", new String[][]{ @@ -2505,8 +2502,8 @@ public class Enum { {"Grandmaster Thief"}, {"Grandfather"}}, new String[]{"Despot Rule", "Common Rule", "Oligarchy", "Republic Rule"}, - EnumSet.of(PromoteType.Assassin, PromoteType.Barbarian, PromoteType.Bard, PromoteType.Priest, - PromoteType.Scout, PromoteType.Thief, PromoteType.Wizard), + EnumSet.of(ClassType.Assassin, ClassType.Barbarian, ClassType.Bard, ClassType.Priest, + ClassType.Scout, ClassType.Thief, ClassType.Wizard), EnumSet.of(MonsterType.Aelfborn, MonsterType.Aracoix, MonsterType.Elf, MonsterType.Human, MonsterType.Irekei, MonsterType.Nephilim, MonsterType.Shade, MonsterType.Vampire), EnumSet.allOf(SexType.class)), @@ -2518,8 +2515,8 @@ public class Enum { {"Great Thane"}, {"High Thane"}}, new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}, - EnumSet.of(PromoteType.Crusader, PromoteType.Prelate, PromoteType.Priest, PromoteType.Sentinel, - PromoteType.Warrior), + EnumSet.of(ClassType.Crusader, ClassType.Prelate, ClassType.Priest, ClassType.Sentinel, + ClassType.Warrior), EnumSet.of(MonsterType.Dwarf), EnumSet.allOf(SexType.class)), HIGHCOURT("High Court", new String[][]{ @@ -2533,9 +2530,9 @@ public class Enum { {"Aglaeron"}, {"Ellestor", "Elestril"}}, new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}, - EnumSet.of(PromoteType.Assassin, PromoteType.Bard, PromoteType.Channeler, PromoteType.Druid, - PromoteType.Necromancer, PromoteType.Priest, PromoteType.Ranger, PromoteType.Scout, - PromoteType.Thief, PromoteType.Warrior, PromoteType.Wizard), + EnumSet.of(ClassType.Assassin, ClassType.Bard, ClassType.Channeler, ClassType.Druid, + ClassType.Necromancer, ClassType.Priest, ClassType.Ranger, ClassType.Scout, + ClassType.Thief, ClassType.Warrior, ClassType.Wizard), EnumSet.of(MonsterType.Elf, MonsterType.Minotaur), EnumSet.allOf(SexType.class)), VIRAKT("Virakt", new String[][]{ @@ -2548,9 +2545,9 @@ public class Enum { {"Khar'uus"}, {"Kryqh'khalin"}}, new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}, - EnumSet.of(PromoteType.Assassin, PromoteType.Bard, PromoteType.Channeler, PromoteType.Fury, - PromoteType.Huntress, PromoteType.Nightstalker, PromoteType.Priest, PromoteType.Ranger, - PromoteType.Scout, PromoteType.Thief, PromoteType.Warrior, PromoteType.Wizard), + EnumSet.of(ClassType.Assassin, ClassType.Bard, ClassType.Channeler, ClassType.Fury, + ClassType.Huntress, ClassType.Nightstalker, ClassType.Priest, ClassType.Ranger, + ClassType.Scout, ClassType.Thief, ClassType.Warrior, ClassType.Wizard), EnumSet.of(MonsterType.Irekei), EnumSet.allOf(SexType.class)), BRIALIA("Coven of Brialia", new String[][]{ // Unknown Rank names @@ -2563,7 +2560,7 @@ public class Enum { {"Hierophant"}, {"Witch King", "Witch Queen"}}, new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}, - EnumSet.allOf(PromoteType.class), + EnumSet.allOf(ClassType.class), EnumSet.allOf(MonsterType.class), EnumSet.allOf(SexType.class)), @@ -2577,9 +2574,9 @@ public class Enum { {"Dread Master", "Dread Mistress"}, {"Dread Lord", "Dread Lady"}}, new String[]{"Despot Rule", "Despot Rule", "Council Rule", "Republic Rule"}, - EnumSet.of(PromoteType.Assassin, PromoteType.Channeler, PromoteType.Necromancer, PromoteType.Priest, - PromoteType.Scout, PromoteType.Thief, PromoteType.Warlock, PromoteType.Warrior, - PromoteType.Wizard), + EnumSet.of(ClassType.Assassin, ClassType.Channeler, ClassType.Necromancer, ClassType.Priest, + ClassType.Scout, ClassType.Thief, ClassType.Warlock, ClassType.Warrior, + ClassType.Wizard), EnumSet.of(MonsterType.Human, MonsterType.Shade, MonsterType.Vampire), EnumSet.allOf(SexType.class)), SCOURGE("Cult of the Scourge", new String[][]{ @@ -2589,8 +2586,8 @@ public class Enum { {"Hand of the Dark"}, {"Dark Father", "Dark Mother"}}, new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}, - EnumSet.of(PromoteType.Bard, PromoteType.Channeler, PromoteType.Doomsayer, PromoteType.Priest, - PromoteType.Scout, PromoteType.Warrior, PromoteType.Wizard), + EnumSet.of(ClassType.Bard, ClassType.Channeler, ClassType.Doomsayer, ClassType.Priest, + ClassType.Scout, ClassType.Warrior, ClassType.Wizard), EnumSet.of(MonsterType.Aelfborn, MonsterType.Human, MonsterType.Minotaur, MonsterType.Nephilim), EnumSet.allOf(SexType.class)), PIRATE("Pirate Crew", new String[][]{ @@ -2601,7 +2598,7 @@ public class Enum { {"First Mate"}, {"Captain"}}, new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}, - EnumSet.allOf(PromoteType.class), + EnumSet.allOf(ClassType.class), EnumSet.allOf(MonsterType.class), EnumSet.allOf(SexType.class)), HERALD("Academy of Heralds", new String[][]{ @@ -2614,7 +2611,7 @@ public class Enum { {"Archivist"}, {"Loremaster"}}, new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}, - EnumSet.allOf(PromoteType.class), + EnumSet.allOf(ClassType.class), EnumSet.allOf(MonsterType.class), EnumSet.allOf(SexType.class)), CENTAUR("Centaur Cohort", new String[][]{ @@ -2627,9 +2624,9 @@ public class Enum { {"Praetorian"}, {"Paragon"}}, new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}, - EnumSet.of(PromoteType.Barbarian, PromoteType.Crusader, PromoteType.Druid, PromoteType.Huntress, - PromoteType.Prelate, PromoteType.Priest, PromoteType.Ranger, PromoteType.Sentinel, - PromoteType.Warrior), + EnumSet.of(ClassType.Barbarian, ClassType.Crusader, ClassType.Druid, ClassType.Huntress, + ClassType.Prelate, ClassType.Priest, ClassType.Ranger, ClassType.Sentinel, + ClassType.Warrior), EnumSet.of(MonsterType.Centaur), EnumSet.allOf(SexType.class)), KHREE("Aracoix Kh'ree", new String[][]{ @@ -2644,20 +2641,20 @@ public class Enum { {"Araceos"}, {"Hierarch"}}, new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}, - EnumSet.of(PromoteType.Assassin, PromoteType.Barbarian, PromoteType.Bard, PromoteType.Huntress, - PromoteType.Priest, PromoteType.Ranger, PromoteType.Scout, PromoteType.Thief, - PromoteType.Warlock, PromoteType.Warrior), + EnumSet.of(ClassType.Assassin, ClassType.Barbarian, ClassType.Bard, ClassType.Huntress, + ClassType.Priest, ClassType.Ranger, ClassType.Scout, ClassType.Thief, + ClassType.Warlock, ClassType.Warrior), EnumSet.of(MonsterType.Aracoix), EnumSet.allOf(SexType.class)); - public final EnumSet requiredClasses; + public final EnumSet requiredClasses; public final EnumSet requiredRaces; public final EnumSet sexRequired; private final String name; private final String[][] ranks; //Stored Rank#->Gender(M,F) private final String[] leadershipTypes; - GuildCharterType(String name, String[][] ranks, String[] leadershipTypes, EnumSet requiredClasses, + GuildCharterType(String name, String[][] ranks, String[] leadershipTypes, EnumSet requiredClasses, EnumSet requiredRaces, EnumSet sexRequired) { this.name = name; this.ranks = ranks; diff --git a/src/engine/objects/AbstractCharacter.java b/src/engine/objects/AbstractCharacter.java index 092991a9..12898d1a 100644 --- a/src/engine/objects/AbstractCharacter.java +++ b/src/engine/objects/AbstractCharacter.java @@ -27,7 +27,6 @@ import engine.math.Bounds; import engine.math.Vector3fImmutable; import engine.net.ByteBufferWriter; import engine.net.DispatchMessage; -import engine.net.client.msg.ErrorPopupMsg; import engine.net.client.msg.UpdateStateMsg; import engine.powers.EffectsBase; import engine.server.MBServerStatics; @@ -126,7 +125,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject { public ArrayList runes; public Enum.MonsterType absRace = null; - public Enum.PromoteType absClass = null; + public ClassType absClass = null; public Enum.SexType absGender = null; diff --git a/src/engine/objects/ItemBase.java b/src/engine/objects/ItemBase.java index 3169d269..e9b15471 100644 --- a/src/engine/objects/ItemBase.java +++ b/src/engine/objects/ItemBase.java @@ -81,10 +81,10 @@ public class ItemBase { //requirements/restrictions public ArrayList restrictedRaces; public ArrayList requiredRaces; - public ArrayList restrictedClasses; - public ArrayList requiredClasses; - public ArrayList requiredDiscs; - public ArrayList restrictedDiscs; + public ArrayList restrictedClasses; + public ArrayList requiredClasses; + public ArrayList requiredDiscs; + public ArrayList restrictedDiscs; public Enum.SexType requiredSex; /** @@ -998,12 +998,12 @@ public class ItemBase { } if(classesRequired != null){ for(String entry : classesRequired.split(";")){ - requiredClasses.add(Enum.PromoteType.valueOf(entry)); + requiredClasses.add(Enum.ClassType.valueOf(entry)); } } if(classesRestricted != null){ for(String entry : classesRestricted.split(";")){ - restrictedClasses.add(Enum.PromoteType.valueOf(entry)); + restrictedClasses.add(Enum.ClassType.valueOf(entry)); } } if(discsRequired != null){ diff --git a/src/engine/objects/PlayerCharacter.java b/src/engine/objects/PlayerCharacter.java index b5dfc333..ec87a8cd 100644 --- a/src/engine/objects/PlayerCharacter.java +++ b/src/engine/objects/PlayerCharacter.java @@ -4565,7 +4565,7 @@ public class PlayerCharacter extends AbstractCharacter { this.absRace = Enum.MonsterType.valueOf(race); if(this.promotionClass != null) - this.absClass = Enum.PromoteType.valueOf(this.getPromotionClass().getName()); + this.absClass = ClassType.valueOf(this.getPromotionClass().getName()); if(this.isMale()) this.absGender = SexType.MALE; From e1e722f09f8bac0ec78b5a24c936cab024d3af85 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 11 Feb 2024 07:29:42 -0500 Subject: [PATCH 18/39] Remove old loader in preb for refactor --- src/engine/db/handlers/dbItemBaseHandler.java | 39 -------------- src/engine/objects/ItemBase.java | 54 +++---------------- 2 files changed, 8 insertions(+), 85 deletions(-) diff --git a/src/engine/db/handlers/dbItemBaseHandler.java b/src/engine/db/handlers/dbItemBaseHandler.java index a190e230..e1b11523 100644 --- a/src/engine/db/handlers/dbItemBaseHandler.java +++ b/src/engine/db/handlers/dbItemBaseHandler.java @@ -96,46 +96,7 @@ 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 'itemName' = ?")) { - preparedStatement.setString(1, itemBase.getName()); - ResultSet rs = preparedStatement.executeQuery(); - //while(rs.next()) { - - String racesRequired = ""; - if(rs.getString("racesRequired") != null) - racesRequired = rs.getString("racesRequired"); - - String racesRestricted = ""; - if(rs.getString("racesRestricted") != null) - racesRestricted = rs.getString("racesRestricted"); - - String classesRequired = ""; - if(rs.getString("classesRequired") != null) - classesRequired = rs.getString("classesRequired"); - - String classesRestricted = ""; - if(rs.getString("classesRestricted") != null) - classesRestricted = rs.getString("classesRestricted"); - - String discsRequired = ""; - if(rs.getString("discsRequired") != null) - discsRequired = rs.getString("discsRequired"); - - String discsRestricted = ""; - if(rs.getString("discsRestricted") != null) - discsRestricted = rs.getString("discsRestricted"); - - itemBase.LoadRequirements(racesRequired,racesRestricted,classesRequired, classesRestricted, discsRequired, discsRestricted); - //} - } catch (SQLException e) { - Logger.error("No Entry In static_item_requirements for item UUID: " + itemBase.getUUID()); - } - } -} public HashMap> LOAD_RUNES_FOR_NPC_AND_MOBS() { HashMap> runeSets = new HashMap<>(); diff --git a/src/engine/objects/ItemBase.java b/src/engine/objects/ItemBase.java index e9b15471..bca6e6da 100644 --- a/src/engine/objects/ItemBase.java +++ b/src/engine/objects/ItemBase.java @@ -20,6 +20,7 @@ import org.pmw.tinylog.Logger; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; +import java.util.EnumSet; import java.util.HashMap; import java.util.HashSet; import java.util.concurrent.ConcurrentHashMap; @@ -79,13 +80,12 @@ public class ItemBase { private boolean autoID = false; //requirements/restrictions - public ArrayList restrictedRaces; - public ArrayList requiredRaces; - public ArrayList restrictedClasses; - public ArrayList requiredClasses; - public ArrayList requiredDiscs; - public ArrayList restrictedDiscs; - public Enum.SexType requiredSex; + public EnumSet restrictedRaces; + public EnumSet requiredRaces; + public EnumSet restrictedClasses; + public EnumSet requiredClasses; + public EnumSet requiredDiscs; + public EnumSet restrictedDiscs; /** * ResultSet Constructor @@ -222,7 +222,7 @@ public class ItemBase { public static void loadAllItemBases() { DbManager.ItemBaseQueries.LOAD_ALL_ITEMBASES(); - DbManager.ItemBaseQueries.LOAD_ALL_ITEM_REQUIREMENTS(); + AnniverseryGifts.add(971000); AnniverseryGifts.add(971001); AnniverseryGifts.add(971002); @@ -979,42 +979,4 @@ public class ItemBase { return false; } - public void LoadRequirements(String racesRequired, String racesRestricted, String classesRequired, String classesRestricted, String discsRequired, String discsRestricted){ - this.requiredRaces = new ArrayList<>(); - this.restrictedRaces = new ArrayList<>(); - this.requiredClasses = new ArrayList<>(); - this.restrictedClasses = new ArrayList<>(); - this.requiredDiscs = new ArrayList<>(); - this.restrictedDiscs = new ArrayList<>(); - if(racesRequired != null){ - for(String entry : racesRequired.split(";")){ - requiredRaces.add(Enum.MonsterType.valueOf(entry)); - } - } - if(racesRestricted != null){ - for(String entry : racesRestricted.split(";")){ - restrictedRaces.add(Enum.MonsterType.valueOf(entry)); - } - } - if(classesRequired != null){ - for(String entry : classesRequired.split(";")){ - requiredClasses.add(Enum.ClassType.valueOf(entry)); - } - } - if(classesRestricted != null){ - for(String entry : classesRestricted.split(";")){ - restrictedClasses.add(Enum.ClassType.valueOf(entry)); - } - } - if(discsRequired != null){ - for(String entry : discsRequired.split(";")){ - //TODO find way to load disc runebaseID from name - } - } - if(discsRestricted != null){ - for(String entry : discsRestricted.split(";")) { - //TODO find way to load disc runebaseID from name - } - } - } } From 5e1ebeb4dfac83c879beb88fc0e50fe34ce4e939 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 11 Feb 2024 07:55:38 -0500 Subject: [PATCH 19/39] Enumset helper created --- src/engine/gameManager/DbManager.java | 31 +++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/engine/gameManager/DbManager.java b/src/engine/gameManager/DbManager.java index cbd52a3d..6dc9c392 100644 --- a/src/engine/gameManager/DbManager.java +++ b/src/engine/gameManager/DbManager.java @@ -22,6 +22,7 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.EnumMap; +import java.util.EnumSet; import java.util.concurrent.ConcurrentHashMap; public enum DbManager { @@ -266,6 +267,35 @@ public enum DbManager { } + public static > EnumSet parseEnumSet(String mysqlSet, Class enumClass) { + + // Create empty EnumSet of the given class + + EnumSet enumSet = EnumSet.noneOf(enumClass); + + // Remove the leading and trailing brackets from the MySQL set + + mysqlSet = mysqlSet.substring(1, mysqlSet.length() - 1); + + // Split set string and trim each element + + String[] elements = mysqlSet.split(","); + + for (String element : elements) { + + element = element.trim(); + + // Parse the element into an enum and add to set + + E enumConstant = java.lang.Enum.valueOf(enumClass, element); + enumSet.add(enumConstant); + } + + // Return the EnumSet + + return enumSet; + } + public static void printCacheCount(PlayerCharacter pc) { ChatManager.chatSystemInfo(pc, "Cache Lists"); @@ -324,4 +354,5 @@ public enum DbManager { Logger.info("Database configured with " + connectionCount + " connections"); } + } From dc6bce6f530a3830ab723778b8514e849c8eda92 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 11 Feb 2024 08:01:42 -0500 Subject: [PATCH 20/39] Testing of new helper at bootstrap. --- src/engine/objects/ItemBase.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/engine/objects/ItemBase.java b/src/engine/objects/ItemBase.java index bca6e6da..c94e1a14 100644 --- a/src/engine/objects/ItemBase.java +++ b/src/engine/objects/ItemBase.java @@ -126,6 +126,8 @@ public class ItemBase { this.minDamage = rs.getShort("minDamage"); this.maxDamage = rs.getShort("maxDamage"); + this.requiredRaces = DbManager.parseEnumSet(rs.getString("races_required"), Enum.MonsterType.class); + this.mastery = rs.getString("mastery"); damageType = DamageType.valueOf(rs.getString("damageType")); From 3666331de863b8478423a9463be9ae142e08a2ba Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 11 Feb 2024 08:04:03 -0500 Subject: [PATCH 21/39] Column name fix --- src/engine/objects/ItemBase.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/objects/ItemBase.java b/src/engine/objects/ItemBase.java index c94e1a14..f1879217 100644 --- a/src/engine/objects/ItemBase.java +++ b/src/engine/objects/ItemBase.java @@ -126,7 +126,7 @@ public class ItemBase { this.minDamage = rs.getShort("minDamage"); this.maxDamage = rs.getShort("maxDamage"); - this.requiredRaces = DbManager.parseEnumSet(rs.getString("races_required"), Enum.MonsterType.class); + this.requiredRaces = DbManager.parseEnumSet(rs.getString("race_required"), Enum.MonsterType.class); this.mastery = rs.getString("mastery"); damageType = DamageType.valueOf(rs.getString("damageType")); From bd2547046a18350335b1f9f24c537f21e22130bb Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 11 Feb 2024 08:07:22 -0500 Subject: [PATCH 22/39] Early exit on empty sets. --- src/engine/gameManager/DbManager.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/engine/gameManager/DbManager.java b/src/engine/gameManager/DbManager.java index 6dc9c392..9cd60359 100644 --- a/src/engine/gameManager/DbManager.java +++ b/src/engine/gameManager/DbManager.java @@ -273,6 +273,11 @@ public enum DbManager { EnumSet enumSet = EnumSet.noneOf(enumClass); + // Early exit for empty sets + + if (mysqlSet.isEmpty()) + return enumSet; + // Remove the leading and trailing brackets from the MySQL set mysqlSet = mysqlSet.substring(1, mysqlSet.length() - 1); From 20bebafc8985bd6c5175c3c5c825fa4dff8b7952 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 11 Feb 2024 08:09:31 -0500 Subject: [PATCH 23/39] Tweak to string cleanup. --- src/engine/gameManager/DbManager.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/engine/gameManager/DbManager.java b/src/engine/gameManager/DbManager.java index 9cd60359..76912425 100644 --- a/src/engine/gameManager/DbManager.java +++ b/src/engine/gameManager/DbManager.java @@ -278,10 +278,6 @@ public enum DbManager { if (mysqlSet.isEmpty()) return enumSet; - // Remove the leading and trailing brackets from the MySQL set - - mysqlSet = mysqlSet.substring(1, mysqlSet.length() - 1); - // Split set string and trim each element String[] elements = mysqlSet.split(","); From 42362dca90a81e57683b2cc5fa03790b1d269f7e Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 11 Feb 2024 08:12:18 -0500 Subject: [PATCH 24/39] Method cleanup --- src/engine/gameManager/DbManager.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/engine/gameManager/DbManager.java b/src/engine/gameManager/DbManager.java index 76912425..a5abbdb0 100644 --- a/src/engine/gameManager/DbManager.java +++ b/src/engine/gameManager/DbManager.java @@ -269,7 +269,7 @@ public enum DbManager { public static > EnumSet parseEnumSet(String mysqlSet, Class enumClass) { - // Create empty EnumSet of the given class + // Create empty output set of the passed Enum class EnumSet enumSet = EnumSet.noneOf(enumClass); @@ -278,7 +278,7 @@ public enum DbManager { if (mysqlSet.isEmpty()) return enumSet; - // Split set string and trim each element + // Split set string and trim each element String[] elements = mysqlSet.split(","); @@ -286,13 +286,13 @@ public enum DbManager { element = element.trim(); - // Parse the element into an enum and add to set + // Parse the element into an enum; add to the output set E enumConstant = java.lang.Enum.valueOf(enumClass, element); enumSet.add(enumConstant); } - // Return the EnumSet + // Return the output set return enumSet; } From 608324c5004fcd82d1205a60f07cce7c5420bd6e Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 11 Feb 2024 08:15:31 -0500 Subject: [PATCH 25/39] Updated rs constructor to use new enumset system. --- src/engine/objects/ItemBase.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/engine/objects/ItemBase.java b/src/engine/objects/ItemBase.java index f1879217..269c073d 100644 --- a/src/engine/objects/ItemBase.java +++ b/src/engine/objects/ItemBase.java @@ -126,7 +126,12 @@ public class ItemBase { this.minDamage = rs.getShort("minDamage"); this.maxDamage = rs.getShort("maxDamage"); + // Item restrictions and requirements + this.requiredRaces = DbManager.parseEnumSet(rs.getString("race_required"), Enum.MonsterType.class); + this.restrictedRaces = DbManager.parseEnumSet(rs.getString("race_restricted"), Enum.MonsterType.class); + this.requiredClasses = DbManager.parseEnumSet(rs.getString("class_required"), Enum.ClassType.class); + this.requiredDiscs = DbManager.parseEnumSet(rs.getString("disc_required"), Enum.DisciplineType.class); this.mastery = rs.getString("mastery"); damageType = DamageType.valueOf(rs.getString("damageType")); From 6259cd7803e8fd5dd06e1239525ea2017b14faf1 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 11 Feb 2024 08:23:01 -0500 Subject: [PATCH 26/39] Error handling for parsing of enum --- src/engine/gameManager/DbManager.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/engine/gameManager/DbManager.java b/src/engine/gameManager/DbManager.java index a5abbdb0..619e87ee 100644 --- a/src/engine/gameManager/DbManager.java +++ b/src/engine/gameManager/DbManager.java @@ -288,8 +288,12 @@ public enum DbManager { // Parse the element into an enum; add to the output set - E enumConstant = java.lang.Enum.valueOf(enumClass, element); - enumSet.add(enumConstant); + try { + E enumConstant = java.lang.Enum.valueOf(enumClass, element); + enumSet.add(enumConstant); + } catch (Exception e) { + Logger.error(mysqlSet); + } } // Return the output set From 4f441340ea817da5f60ed53b9193e4d22a10672c Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 11 Feb 2024 08:25:11 -0500 Subject: [PATCH 27/39] Error handling for parsing of enum --- src/engine/gameManager/DbManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/gameManager/DbManager.java b/src/engine/gameManager/DbManager.java index 619e87ee..def73c1d 100644 --- a/src/engine/gameManager/DbManager.java +++ b/src/engine/gameManager/DbManager.java @@ -292,7 +292,7 @@ public enum DbManager { E enumConstant = java.lang.Enum.valueOf(enumClass, element); enumSet.add(enumConstant); } catch (Exception e) { - Logger.error(mysqlSet); + Logger.error(enumClass.getName() + " : " + mysqlSet); } } From 8f88da6016d01615f5d41f973de1e7f330109da0 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 11 Feb 2024 08:27:48 -0500 Subject: [PATCH 28/39] Error handling for parsing of enum --- src/engine/gameManager/DbManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/gameManager/DbManager.java b/src/engine/gameManager/DbManager.java index def73c1d..3402615b 100644 --- a/src/engine/gameManager/DbManager.java +++ b/src/engine/gameManager/DbManager.java @@ -292,7 +292,7 @@ public enum DbManager { E enumConstant = java.lang.Enum.valueOf(enumClass, element); enumSet.add(enumConstant); } catch (Exception e) { - Logger.error(enumClass.getName() + " : " + mysqlSet); + Logger.error(enumClass.getCanonicalName() + " : " + mysqlSet); } } From cc8f817006c0898d34f29c2a1ce36f8fabe990be Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 11 Feb 2024 08:31:38 -0500 Subject: [PATCH 29/39] Generics lose type information --- src/engine/gameManager/DbManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/gameManager/DbManager.java b/src/engine/gameManager/DbManager.java index 3402615b..855eb840 100644 --- a/src/engine/gameManager/DbManager.java +++ b/src/engine/gameManager/DbManager.java @@ -292,7 +292,7 @@ public enum DbManager { E enumConstant = java.lang.Enum.valueOf(enumClass, element); enumSet.add(enumConstant); } catch (Exception e) { - Logger.error(enumClass.getCanonicalName() + " : " + mysqlSet); + Logger.error(" Parse error: " + mysqlSet); } } From 9be32a3ebf9167dfba3c7fc4b0e655785c1fcb51 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 11 Feb 2024 08:34:05 -0500 Subject: [PATCH 30/39] Case fix in elements --- src/engine/Enum.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/engine/Enum.java b/src/engine/Enum.java index 88f5ff19..073edd04 100644 --- a/src/engine/Enum.java +++ b/src/engine/Enum.java @@ -1496,10 +1496,10 @@ public class Enum { } public enum ClassType { - FIGHTER(SexType.NONE), - HEALER(SexType.NONE), - ROGUE(SexType.NONE), - MAGE(SexType.NONE), + FighterR(SexType.NONE), + Healer(SexType.NONE), + Rogue(SexType.NONE), + Mage(SexType.NONE), Assassin(SexType.NONE), Barbarian(SexType.NONE), Bard(SexType.NONE), From 7fcbfba7e069a6a0cd3a74fea233b88dac03a9e1 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 11 Feb 2024 08:35:03 -0500 Subject: [PATCH 31/39] Case fix in elements --- src/engine/Enum.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/Enum.java b/src/engine/Enum.java index 073edd04..5889059c 100644 --- a/src/engine/Enum.java +++ b/src/engine/Enum.java @@ -1496,7 +1496,7 @@ public class Enum { } public enum ClassType { - FighterR(SexType.NONE), + Fighter(SexType.NONE), Healer(SexType.NONE), Rogue(SexType.NONE), Mage(SexType.NONE), From 8a769c60f20b1c9c965aaff3f107d8d8c2ef1896 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Tue, 13 Feb 2024 20:35:25 -0600 Subject: [PATCH 32/39] implement server side restrictions --- src/engine/Enum.java | 3 + src/engine/objects/AbstractCharacter.java | 7 +- src/engine/objects/ItemBase.java | 79 +++++++++++++---------- src/engine/objects/PlayerCharacter.java | 12 +++- 4 files changed, 63 insertions(+), 38 deletions(-) diff --git a/src/engine/Enum.java b/src/engine/Enum.java index 5889059c..a171d4d9 100644 --- a/src/engine/Enum.java +++ b/src/engine/Enum.java @@ -2767,6 +2767,9 @@ public class Enum { return leadershipTypes[i]; } + public boolean canJoin(AbstractCharacter character){ + return this.requiredRaces.contains(character.absRace) && this.requiredClasses.contains(character.absPromotionClass) && this.sexRequired.contains(character.absGender); + } } public enum MinionClass { diff --git a/src/engine/objects/AbstractCharacter.java b/src/engine/objects/AbstractCharacter.java index 12898d1a..3c953c9b 100644 --- a/src/engine/objects/AbstractCharacter.java +++ b/src/engine/objects/AbstractCharacter.java @@ -35,6 +35,7 @@ import org.pmw.tinylog.Logger; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; +import java.util.EnumSet; import java.util.HashSet; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CopyOnWriteArrayList; @@ -124,10 +125,12 @@ public abstract class AbstractCharacter extends AbstractWorldObject { public ArrayList runes; - public Enum.MonsterType absRace = null; - public ClassType absClass = null; + public Enum.MonsterType absRace; + public ClassType absBaseClass = null; + public ClassType absPromotionClass = null; public Enum.SexType absGender = null; + public EnumSet absDisciplines; public AbstractCharacter() { super(); diff --git a/src/engine/objects/ItemBase.java b/src/engine/objects/ItemBase.java index 269c073d..4200ab7f 100644 --- a/src/engine/objects/ItemBase.java +++ b/src/engine/objects/ItemBase.java @@ -486,13 +486,7 @@ public class ItemBase { if (!validForSkills(abstractCharacter.getSkills())) return false; - if (!validRace(item.getItemBase(), abstractCharacter)) - return false; - - if (!validClass(item.getItemBase(), abstractCharacter)) - return false; - - if (!validDisc(item.getItemBase(), abstractCharacter)) + if(this.canCharacterEquip(abstractCharacter) == false) return false; return item.getItemBase().value != 0 || Kit.IsNoobGear(item.getItemBase().uuid); @@ -502,34 +496,6 @@ public class ItemBase { return true; //Mobiles and NPC's don't need to check equip } - - public static boolean validRace(ItemBase ib, AbstractCharacter absChar){ - if(ib.requiredRaces == null || ib.requiredRaces.isEmpty()) - if(ib.restrictedRaces == null || ib.restrictedRaces.isEmpty()) - return true; - - return ib.requiredRaces.contains(absChar.absRace) && !ib.restrictedRaces.contains(absChar.absRace); - } - public static boolean validClass(ItemBase ib, AbstractCharacter absChar){ - if(ib.requiredClasses == null || ib.requiredClasses.isEmpty()) - if(ib.restrictedClasses == null || ib.restrictedClasses.isEmpty()) - return true; - - return ib.requiredClasses.contains(absChar.absClass) && !ib.restrictedClasses.contains(absChar.absClass); - } - - public static boolean validDisc(ItemBase ib, AbstractCharacter absChar){ - - if(ib.requiredDiscs == null || ib.requiredDiscs.isEmpty()) - if(ib.restrictedDiscs == null || ib.restrictedDiscs.isEmpty()) - return true; - - for(CharacterRune rune : absChar.runes) - if(ib.requiredDiscs.contains(rune.getRuneBaseID()) == true && ib.restrictedDiscs.contains(rune.getRuneBaseID()) == false) - return true; - - return false; - } public int getValidSlot() { int slotValue = 0; @@ -985,5 +951,48 @@ public class ItemBase { return false; } + public Boolean canCharacterEquip(AbstractCharacter character){ + return ValidRace(character.absRace) && ValidClass(character.absBaseClass,character.absPromotionClass) && ValidDiscipline(character.absDisciplines); + } + public Boolean ValidRace(Enum.MonsterType race){ + if(this.requiredRaces.isEmpty() && this.restrictedRaces.isEmpty()) + return true; + + if(this.requiredRaces.isEmpty() == false && race.elementOf(this.requiredRaces) == true) + return true; + + if(this.restrictedRaces.isEmpty() == false && race.elementOf(this.restrictedRaces) == false) + return true; + + return false; + } + + public Boolean ValidClass(Enum.ClassType base,Enum.ClassType profession){ + if(this.requiredClasses.isEmpty() && this.restrictedClasses.isEmpty()) + return true; + + if(this.requiredClasses.isEmpty() == false) + if(this.requiredClasses.contains(base) || this.requiredClasses.contains(profession)) + return true; + + if(this.restrictedClasses.isEmpty() == false) + if(this.restrictedClasses.contains(base) == false && this.restrictedClasses.contains(profession) == false) + return true; + + return false; + } + + public Boolean ValidDiscipline(EnumSet discs){ + if(this.requiredDiscs.isEmpty() && this.restrictedDiscs.isEmpty()) + return true; + + for(Enum.DisciplineType disc : discs){ + if(this.requiredDiscs.isEmpty() == false && this.requiredDiscs.contains(disc)) + return true; + if(this.restrictedDiscs.isEmpty() == false && this.restrictedDiscs.contains(disc)) + return false; + } + return false; + } } diff --git a/src/engine/objects/PlayerCharacter.java b/src/engine/objects/PlayerCharacter.java index ec87a8cd..477878c4 100644 --- a/src/engine/objects/PlayerCharacter.java +++ b/src/engine/objects/PlayerCharacter.java @@ -4564,13 +4564,23 @@ public class PlayerCharacter extends AbstractCharacter { String race = this.getRace().getName().replace("-","").replace(", Male","").replace(", Female",""); this.absRace = Enum.MonsterType.valueOf(race); + if(this.baseClass != null) + this.absBaseClass = ClassType.valueOf(this.getBaseClass().getName()); + if(this.promotionClass != null) - this.absClass = ClassType.valueOf(this.getPromotionClass().getName()); + this.absPromotionClass = ClassType.valueOf(this.getPromotionClass().getName()); if(this.isMale()) this.absGender = SexType.MALE; else this.absGender = SexType.FEMALE; + + for(CharacterRune rune : this.runes){ + DisciplineType disc = DisciplineType.valueOf(RuneBase.getRuneBase(rune.getRuneBaseID()).getName().replace("-", "").replace(" ", "")); + if(disc != null){ + this.absDisciplines.add(disc); + } + } } @Override From f952785c8e1f0ff4809472658d026107d1658523 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Tue, 13 Feb 2024 20:46:28 -0600 Subject: [PATCH 33/39] implement server side restrictions --- src/engine/objects/PlayerCharacter.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/engine/objects/PlayerCharacter.java b/src/engine/objects/PlayerCharacter.java index 477878c4..c973b61c 100644 --- a/src/engine/objects/PlayerCharacter.java +++ b/src/engine/objects/PlayerCharacter.java @@ -4576,9 +4576,13 @@ public class PlayerCharacter extends AbstractCharacter { this.absGender = SexType.FEMALE; for(CharacterRune rune : this.runes){ - DisciplineType disc = DisciplineType.valueOf(RuneBase.getRuneBase(rune.getRuneBaseID()).getName().replace("-", "").replace(" ", "")); - if(disc != null){ - this.absDisciplines.add(disc); + try { + DisciplineType disc = DisciplineType.valueOf(RuneBase.getRuneBase(rune.getRuneBaseID()).getName().replace("-", "").replace(" ", "")); + if (disc != null) { + this.absDisciplines.add(disc); + } + } catch(Exception e){ + } } } From 6c1e2f1280d21934716f5701672a9cf0c9edf9a7 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Tue, 13 Feb 2024 21:01:09 -0600 Subject: [PATCH 34/39] implement server side restrictions --- src/engine/objects/ItemBase.java | 12 ++++++++---- src/engine/objects/PlayerCharacter.java | 6 +++++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/engine/objects/ItemBase.java b/src/engine/objects/ItemBase.java index 4200ab7f..6f449203 100644 --- a/src/engine/objects/ItemBase.java +++ b/src/engine/objects/ItemBase.java @@ -969,14 +969,16 @@ public class ItemBase { } public Boolean ValidClass(Enum.ClassType base,Enum.ClassType profession){ - if(this.requiredClasses.isEmpty() && this.restrictedClasses.isEmpty()) + boolean requiredEmpty = this.requiredClasses == null || this.requiredClasses.isEmpty(); + boolean restrictedEmpty = this.restrictedClasses == null || this.restrictedClasses.isEmpty(); + if(requiredEmpty && restrictedEmpty) return true; - if(this.requiredClasses.isEmpty() == false) + if(this.requiredClasses != null && this.requiredClasses.isEmpty() == false) if(this.requiredClasses.contains(base) || this.requiredClasses.contains(profession)) return true; - if(this.restrictedClasses.isEmpty() == false) + if(this.restrictedClasses != null && this.restrictedClasses.isEmpty() == false) if(this.restrictedClasses.contains(base) == false && this.restrictedClasses.contains(profession) == false) return true; @@ -984,7 +986,9 @@ public class ItemBase { } public Boolean ValidDiscipline(EnumSet discs){ - if(this.requiredDiscs.isEmpty() && this.restrictedDiscs.isEmpty()) + boolean requiredEmpty = this.requiredDiscs == null || this.requiredDiscs.isEmpty(); + boolean restrictedEmpty = this.restrictedDiscs == null || this.restrictedDiscs.isEmpty(); + if(requiredEmpty && restrictedEmpty) return true; for(Enum.DisciplineType disc : discs){ diff --git a/src/engine/objects/PlayerCharacter.java b/src/engine/objects/PlayerCharacter.java index c973b61c..eecca954 100644 --- a/src/engine/objects/PlayerCharacter.java +++ b/src/engine/objects/PlayerCharacter.java @@ -4575,11 +4575,15 @@ public class PlayerCharacter extends AbstractCharacter { else this.absGender = SexType.FEMALE; + for(CharacterRune rune : this.runes){ try { DisciplineType disc = DisciplineType.valueOf(RuneBase.getRuneBase(rune.getRuneBaseID()).getName().replace("-", "").replace(" ", "")); if (disc != null) { - this.absDisciplines.add(disc); + if(this.absDisciplines == null) + this.absDisciplines = EnumSet.of(disc); + else + this.absDisciplines.add(disc); } } catch(Exception e){ From d46b2dc298ee77eea19c7b56ae91f0e688089c63 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Wed, 14 Feb 2024 12:29:42 -0500 Subject: [PATCH 35/39] File reformat. --- src/engine/objects/ItemBase.java | 155 +++++++++++++++---------------- 1 file changed, 76 insertions(+), 79 deletions(-) diff --git a/src/engine/objects/ItemBase.java b/src/engine/objects/ItemBase.java index 6f449203..9dda9502 100644 --- a/src/engine/objects/ItemBase.java +++ b/src/engine/objects/ItemBase.java @@ -34,59 +34,58 @@ public class ItemBase { public static HashMap _itemBaseByUUID = new HashMap<>(); public static HashMap> ItemBaseTypeMap = new HashMap<>(); // Internal cache - private static HashMap itemHashIDMap = new HashMap<>(); - private static HashMap _IDsByNames = new HashMap<>(); - private static ArrayList _resourceList = new ArrayList<>(); + private static final HashMap itemHashIDMap = new HashMap<>(); + private static final HashMap _IDsByNames = new HashMap<>(); + private static final ArrayList _resourceList = new ArrayList<>(); private final int uuid; private final String name; - private float durability; - private int value; - private short weight; - private short color; - private ItemType type; + //requirements/restrictions + public EnumSet restrictedRaces; + public EnumSet requiredRaces; + public EnumSet restrictedClasses; + public EnumSet requiredClasses; + public EnumSet requiredDiscs; + public EnumSet restrictedDiscs; + private final float durability; + private final int value; + private final short weight; + private final short color; + private final ItemType type; private int vendorType; - private int modTable; - private int useID; + private final int modTable; + private final int useID; private int hashID; - private byte useAmount; + private final byte useAmount; // Armor and weapon related values - private int equipFlag; - private int restrictFlag; - private String skillRequired; - private short percentRequired; - private float slashResist; - private float crushResist; - private float pierceResist; - private float blockMod; - private short defense; - private float dexPenalty; - private float speed; - private float range; - private short minDamage; - private short maxDamage; - private String mastery; - private engine.Enum.DamageType damageType; - private boolean twoHanded; + private final int equipFlag; + private final int restrictFlag; + private final String skillRequired; + private final short percentRequired; + private final float slashResist; + private final float crushResist; + private final float pierceResist; + private final float blockMod; + private final short defense; + private final float dexPenalty; + private final float speed; + private final float range; + private final short minDamage; + private final short maxDamage; + private final String mastery; + private final engine.Enum.DamageType damageType; + private final boolean twoHanded; private boolean isConsumable; private boolean isStackable; - private int numCharges; + private final int numCharges; // Item stat modifiers - private HashMap bakedInStats = new HashMap<>(); - private HashMap usedStats = new HashMap<>(); - private float parryBonus; - private boolean isStrBased; + private final HashMap bakedInStats = new HashMap<>(); + private final HashMap usedStats = new HashMap<>(); + private final float parryBonus; + private final boolean isStrBased; private ArrayList animations = new ArrayList<>(); private ArrayList offHandAnimations = new ArrayList<>(); private boolean autoID = false; - //requirements/restrictions - public EnumSet restrictedRaces; - public EnumSet requiredRaces; - public EnumSet restrictedClasses; - public EnumSet requiredClasses; - public EnumSet requiredDiscs; - public EnumSet restrictedDiscs; - /** * ResultSet Constructor */ @@ -324,11 +323,8 @@ public class ItemBase { public boolean isDiscRune() { int ID = uuid; - if (ID > 2499 && ID < 3050) { //class, discipline runes - return true; - } else { - return false; - } + //class, discipline runes + return ID > 2499 && ID < 3050; } public boolean isGlass() { @@ -486,7 +482,7 @@ public class ItemBase { if (!validForSkills(abstractCharacter.getSkills())) return false; - if(this.canCharacterEquip(abstractCharacter) == false) + if (this.canCharacterEquip(abstractCharacter) == false) return false; return item.getItemBase().value != 0 || Kit.IsNoobGear(item.getItemBase().uuid); @@ -496,6 +492,7 @@ public class ItemBase { return true; //Mobiles and NPC's don't need to check equip } + public int getValidSlot() { int slotValue = 0; @@ -772,19 +769,19 @@ public class ItemBase { } public boolean isThrowing() { - return this.mastery.equals("Throwing") ? true : false; + return this.mastery.equals("Throwing"); } public boolean isStaff() { - return this.mastery.equals("Staff") ? true : false; + return this.mastery.equals("Staff"); } public boolean isScepter() { - return this.mastery.equals("Benediction") ? true : false; + return this.mastery.equals("Benediction"); } public boolean isArchery() { - return this.mastery.equals("Archery") ? true : false; + return this.mastery.equals("Archery"); } public boolean isMelee() { @@ -935,66 +932,66 @@ public class ItemBase { this.autoID = autoID; } - public boolean isArmor(){ + public boolean isArmor() { - if(this.isHeavyArmor()) + if (this.isHeavyArmor()) return true; - if(this.isMediumArmor()) + if (this.isMediumArmor()) return true; - if(this.isLightArmor()) + if (this.isLightArmor()) return true; - if(this.isClothArmor()) - return true; - - return false; + return this.isClothArmor(); } - public Boolean canCharacterEquip(AbstractCharacter character){ - return ValidRace(character.absRace) && ValidClass(character.absBaseClass,character.absPromotionClass) && ValidDiscipline(character.absDisciplines); + + public Boolean canCharacterEquip(AbstractCharacter character) { + return ValidRace(character.absRace) && ValidClass(character.absBaseClass, character.absPromotionClass) && ValidDiscipline(character.absDisciplines); } - public Boolean ValidRace(Enum.MonsterType race){ - if(this.requiredRaces.isEmpty() && this.restrictedRaces.isEmpty()) - return true; + public Boolean ValidRace(Enum.MonsterType race) { - if(this.requiredRaces.isEmpty() == false && race.elementOf(this.requiredRaces) == true) + if (this.requiredRaces.isEmpty() && this.restrictedRaces.isEmpty()) return true; - if(this.restrictedRaces.isEmpty() == false && race.elementOf(this.restrictedRaces) == false) + if (this.requiredRaces.isEmpty() == false && race.elementOf(this.requiredRaces) == true) return true; - return false; + return this.restrictedRaces.isEmpty() == false && race.elementOf(this.restrictedRaces) == false; } - public Boolean ValidClass(Enum.ClassType base,Enum.ClassType profession){ + public Boolean ValidClass(Enum.ClassType base, Enum.ClassType profession) { + boolean requiredEmpty = this.requiredClasses == null || this.requiredClasses.isEmpty(); boolean restrictedEmpty = this.restrictedClasses == null || this.restrictedClasses.isEmpty(); - if(requiredEmpty && restrictedEmpty) + + if (requiredEmpty && restrictedEmpty) return true; - if(this.requiredClasses != null && this.requiredClasses.isEmpty() == false) - if(this.requiredClasses.contains(base) || this.requiredClasses.contains(profession)) + if (this.requiredClasses != null && this.requiredClasses.isEmpty() == false) + if (this.requiredClasses.contains(base) || this.requiredClasses.contains(profession)) return true; - if(this.restrictedClasses != null && this.restrictedClasses.isEmpty() == false) - if(this.restrictedClasses.contains(base) == false && this.restrictedClasses.contains(profession) == false) - return true; + if (this.restrictedClasses != null && this.restrictedClasses.isEmpty() == false) + return this.restrictedClasses.contains(base) == false && this.restrictedClasses.contains(profession) == false; return false; } - public Boolean ValidDiscipline(EnumSet discs){ + public Boolean ValidDiscipline(EnumSet discs) { + boolean requiredEmpty = this.requiredDiscs == null || this.requiredDiscs.isEmpty(); boolean restrictedEmpty = this.restrictedDiscs == null || this.restrictedDiscs.isEmpty(); - if(requiredEmpty && restrictedEmpty) + + if (requiredEmpty && restrictedEmpty) return true; - for(Enum.DisciplineType disc : discs){ - if(this.requiredDiscs.isEmpty() == false && this.requiredDiscs.contains(disc)) + for (Enum.DisciplineType disc : discs) { + if (this.requiredDiscs.isEmpty() == false && this.requiredDiscs.contains(disc)) return true; - if(this.restrictedDiscs.isEmpty() == false && this.restrictedDiscs.contains(disc)) + + if (this.restrictedDiscs.isEmpty() == false && this.restrictedDiscs.contains(disc)) return false; } return false; From f36e2f19b81acec3c035751bc338572d85cbd8a4 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Thu, 15 Feb 2024 11:31:22 -0500 Subject: [PATCH 36/39] MB_RULESET config entry added --- src/engine/gameManager/ConfigManager.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/engine/gameManager/ConfigManager.java b/src/engine/gameManager/ConfigManager.java index 7541a4e1..55e45912 100644 --- a/src/engine/gameManager/ConfigManager.java +++ b/src/engine/gameManager/ConfigManager.java @@ -30,6 +30,7 @@ public enum ConfigManager { MB_BIND_ADDR, MB_EXTERNAL_ADDR, + // Database connection config MB_DATABASE_ADDRESS, @@ -66,6 +67,7 @@ public enum ConfigManager { MB_WORLD_GREETING, MB_WORLD_KEYCLONE_MAX, MB_USE_RUINS, + MB_RULESET, // Mobile AI modifiers MB_AI_CAST_FREQUENCY, @@ -134,7 +136,6 @@ public enum ConfigManager { File file = new File("mbbranch.sh"); if (file.exists() && !file.isDirectory()) { - String[] command = {"./mbbranch.sh"}; try { From c1de1f148bdff2ee07f27ee3bd26789bb4edb37f Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 15 Feb 2024 18:47:43 -0600 Subject: [PATCH 37/39] dev command for item requirement info --- src/engine/devcmd/cmds/ItemInfoCmd.java | 80 +++++++++++++++++++++++ src/engine/gameManager/DevCmdManager.java | 1 + 2 files changed, 81 insertions(+) create mode 100644 src/engine/devcmd/cmds/ItemInfoCmd.java diff --git a/src/engine/devcmd/cmds/ItemInfoCmd.java b/src/engine/devcmd/cmds/ItemInfoCmd.java new file mode 100644 index 00000000..5c18572f --- /dev/null +++ b/src/engine/devcmd/cmds/ItemInfoCmd.java @@ -0,0 +1,80 @@ +// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ . +// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌· +// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀ +// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌ +// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀ +// Magicbane Emulator Project © 2013 - 2022 +// www.magicbane.com + + +package engine.devcmd.cmds; + +import engine.Enum; +import engine.Enum.BuildingGroup; +import engine.Enum.GameObjectType; +import engine.Enum.TargetColor; +import engine.devcmd.AbstractDevCmd; +import engine.gameManager.BuildingManager; +import engine.gameManager.SessionManager; +import engine.math.Vector3fImmutable; +import engine.objects.*; +import engine.util.StringUtils; + +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.concurrent.ConcurrentHashMap; + + +/** + * @author + */ +public class ItemInfoCmd extends AbstractDevCmd { + + public ItemInfoCmd() { + super("iteminfo"); + } + + @Override + protected void _doCmd(PlayerCharacter pc, String[] words,AbstractGameObject target) { + if (pc == null) { + return; + } + if(target.getObjectType().equals(GameObjectType.Item) == false){ + throwbackInfo(pc, "Must Select An Item"); + return; + } + Item item = (Item)target; + String newline = "\r\n "; + String output = ""; + output += "Required Races:" + newline; + for(Enum.MonsterType required : item.getItemBase().requiredRaces) + output += " " + required.name() + newline; + output += "Restricted Races:" + newline; + for(Enum.MonsterType required : item.getItemBase().restrictedRaces) + output += " " + required.name() + newline; + output += "Required Classes:" + newline; + for(Enum.ClassType required : item.getItemBase().requiredClasses) + output += " " + required.name() + newline; + output += "Restricted Classes:" + newline; + for(Enum.ClassType required : item.getItemBase().restrictedClasses) + output += " " + required.name() + newline; + output += "Required Disciplines:" + newline; + for(Enum.DisciplineType required : item.getItemBase().requiredDiscs) + output += " " + required.name() + newline; + output += "Restricted Disciplines:" + newline; + for(Enum.DisciplineType required : item.getItemBase().restrictedDiscs) + output += " " + required.name() + newline; + throwbackInfo(pc, output); + } + + @Override + protected String _getHelpString() { + return "Gets information on an Object."; + } + + @Override + protected String _getUsageString() { + return "' /iteminfo'"; + } + +} diff --git a/src/engine/gameManager/DevCmdManager.java b/src/engine/gameManager/DevCmdManager.java index 52c730b6..b79cb8de 100644 --- a/src/engine/gameManager/DevCmdManager.java +++ b/src/engine/gameManager/DevCmdManager.java @@ -58,6 +58,7 @@ public enum DevCmdManager { DevCmdManager.registerDevCmd(new PrintResistsCmd()); DevCmdManager.registerDevCmd(new PrintLocationCmd()); DevCmdManager.registerDevCmd(new InfoCmd()); + DevCmdManager.registerDevCmd(new ItemInfoCmd()); DevCmdManager.registerDevCmd(new aiInfoCmd()); DevCmdManager.registerDevCmd(new SimulateBootyCmd()); DevCmdManager.registerDevCmd(new GetHeightCmd()); From c80b9013d26ef04906614182ba4b2fd6abcc7d84 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 15 Feb 2024 19:46:41 -0600 Subject: [PATCH 38/39] Lore Rules --- src/engine/gameManager/GuildManager.java | 10 ++++- src/engine/gameManager/PowersManager.java | 21 ++++++++++- .../client/handlers/GroupInviteHandler.java | 11 ++++++ .../client/handlers/InviteToGuildHandler.java | 8 +++- .../client/handlers/InviteToSubHandler.java | 11 ++++-- .../client/handlers/LeaveGuildHandler.java | 13 +++---- src/engine/objects/City.java | 37 ++++++++++++++++--- 7 files changed, 91 insertions(+), 20 deletions(-) diff --git a/src/engine/gameManager/GuildManager.java b/src/engine/gameManager/GuildManager.java index e6b285ae..d5eef974 100644 --- a/src/engine/gameManager/GuildManager.java +++ b/src/engine/gameManager/GuildManager.java @@ -200,5 +200,13 @@ public enum GuildManager { } } - + public static Boolean meetsLoreRequirements(Guild guild, PlayerCharacter player){ + Enum.GuildCharterType charter = guild.getGuildType(); + if(charter.requiredClasses.contains(player.absPromotionClass)) + if(charter.requiredRaces.contains(player.absRace)) + if(charter.sexRequired.contains(player.absGender)) + return true; + + return false; + } } diff --git a/src/engine/gameManager/PowersManager.java b/src/engine/gameManager/PowersManager.java index 1875a898..00c26948 100644 --- a/src/engine/gameManager/PowersManager.java +++ b/src/engine/gameManager/PowersManager.java @@ -170,6 +170,19 @@ public enum PowersManager { public static void usePower(final PerformActionMsg msg, ClientConnection origin, boolean sendCastToSelf) { + if(ConfigManager.MB_RULESET.getValue() == "LORE") { + PowersBase pb = PowersManager.powersBaseByToken.get(msg.getPowerUsedID()); + PlayerCharacter caster = origin.getPlayerCharacter(); + PlayerCharacter target = PlayerCharacter.getFromCache(msg.getTargetID()); + if(pb != null && pb.isHarmful == false) { + if (caster.guild.equals(Guild.getErrantGuild())) + return; + + if (target != null && caster.guild.getGuildType().equals(target.guild.getGuildType()) == false) + return; + } + } + if (usePowerA(msg, origin, sendCastToSelf)) { // Cast failed for some reason, reset timer @@ -1258,7 +1271,13 @@ public enum PowersManager { return; } - + if(ConfigManager.MB_RULESET.getValue() == "LORE") { + if (pc.guild.getGuildType().equals(target.guild.getGuildType()) == false) { + ChatManager.chatInfoError(pc, + "Cannot summon player outside your charter."); + return; + } + } PerformActionMsg pam = new PerformActionMsg(msg.getPowerToken(), msg .getTrains(), msg.getSourceType(), msg.getSourceID(), target .getObjectType().ordinal(), target.getObjectUUID(), 0f, 0f, 0f, 1, 0); diff --git a/src/engine/net/client/handlers/GroupInviteHandler.java b/src/engine/net/client/handlers/GroupInviteHandler.java index bef9a198..5bba9132 100644 --- a/src/engine/net/client/handlers/GroupInviteHandler.java +++ b/src/engine/net/client/handlers/GroupInviteHandler.java @@ -12,7 +12,9 @@ package engine.net.client.handlers; import engine.Enum; import engine.Enum.GameObjectType; import engine.exception.MsgSendException; +import engine.gameManager.ConfigManager; import engine.gameManager.GroupManager; +import engine.gameManager.GuildManager; import engine.gameManager.SessionManager; import engine.net.Dispatch; import engine.net.DispatchMessage; @@ -21,6 +23,7 @@ import engine.net.client.msg.ClientNetMsg; import engine.net.client.msg.group.GroupInviteMsg; import engine.net.client.msg.group.GroupUpdateMsg; import engine.objects.Group; +import engine.objects.Guild; import engine.objects.PlayerCharacter; public class GroupInviteHandler extends AbstractClientMsgHandler { @@ -103,7 +106,15 @@ public class GroupInviteHandler extends AbstractClientMsgHandler { if (target.isIgnoringPlayer(source)) return false; + if(ConfigManager.MB_RULESET.getValue() == "LORE") { + if(source.guild.equals(Guild.getErrantGuild())) + return false; + if (source.guild.getGuildType() != null) { + if (source.guild.getGuildType().equals(target.guild.getGuildType()) == false) + return false; + } + } // dont block invites to people already in a group and // dont check for pending invites, the client does it // Send invite message to target diff --git a/src/engine/net/client/handlers/InviteToGuildHandler.java b/src/engine/net/client/handlers/InviteToGuildHandler.java index 34d63d7a..0c533798 100644 --- a/src/engine/net/client/handlers/InviteToGuildHandler.java +++ b/src/engine/net/client/handlers/InviteToGuildHandler.java @@ -14,6 +14,7 @@ import engine.Enum; import engine.Enum.GameObjectType; import engine.exception.MsgSendException; import engine.gameManager.ChatManager; +import engine.gameManager.ConfigManager; import engine.gameManager.GuildManager; import engine.gameManager.SessionManager; import engine.net.Dispatch; @@ -124,7 +125,12 @@ public class InviteToGuildHandler extends AbstractClientMsgHandler { ErrorPopupMsg.sendErrorPopup(sourcePlayer, 135);// you do not meet the level required for this SWORN guild return true; } - + if(ConfigManager.MB_RULESET.getValue() == "LORE") { + if (GuildManager.meetsLoreRequirements(sourcePlayer.guild, targetPlayer) == false) { + ChatManager.chatGuildError(sourcePlayer,targetPlayer.getFirstName() + " does not meet charter requirements!"); + return true; + } + } targetPlayer.setLastGuildToInvite(sourcePlayer.getGuild().getObjectUUID()); // setup guild invite message to send to targetPlayer diff --git a/src/engine/net/client/handlers/InviteToSubHandler.java b/src/engine/net/client/handlers/InviteToSubHandler.java index bab06111..6492a231 100644 --- a/src/engine/net/client/handlers/InviteToSubHandler.java +++ b/src/engine/net/client/handlers/InviteToSubHandler.java @@ -12,9 +12,7 @@ package engine.net.client.handlers; import engine.Enum; import engine.Enum.GameObjectType; import engine.exception.MsgSendException; -import engine.gameManager.ChatManager; -import engine.gameManager.DbManager; -import engine.gameManager.SessionManager; +import engine.gameManager.*; import engine.net.Dispatch; import engine.net.DispatchMessage; import engine.net.client.ClientConnection; @@ -111,7 +109,12 @@ public class InviteToSubHandler extends AbstractClientMsgHandler { sendChat(source, "This Guild can't be subbed."); return true; } - + if(ConfigManager.MB_RULESET.getValue() == "LORE") { + if (source.guild.getGuildType().equals(target.guild.getGuildType()) == false){ + sendChat(source, "You Must Be The Same Charter To Form A Nation."); + return true; + } + } //all tests passed, let's send invite. if (target.getClientConnection() != null) { diff --git a/src/engine/net/client/handlers/LeaveGuildHandler.java b/src/engine/net/client/handlers/LeaveGuildHandler.java index 0483469e..1dbc7306 100644 --- a/src/engine/net/client/handlers/LeaveGuildHandler.java +++ b/src/engine/net/client/handlers/LeaveGuildHandler.java @@ -11,17 +11,13 @@ package engine.net.client.handlers; import engine.Enum.GuildHistoryType; import engine.exception.MsgSendException; -import engine.gameManager.ChatManager; -import engine.gameManager.SessionManager; +import engine.gameManager.*; import engine.net.Dispatch; import engine.net.DispatchMessage; import engine.net.client.ClientConnection; import engine.net.client.msg.ClientNetMsg; import engine.net.client.msg.guild.LeaveGuildMsg; -import engine.objects.Guild; -import engine.objects.GuildStatusController; -import engine.objects.Mine; -import engine.objects.PlayerCharacter; +import engine.objects.*; public class LeaveGuildHandler extends AbstractClientMsgHandler { @@ -65,7 +61,10 @@ public class LeaveGuildHandler extends AbstractClientMsgHandler { ChatManager.chatGuildInfo(oldGuild, playerCharacter.getFirstName() + " has left the guild."); oldGuild.removePlayer(playerCharacter, GuildHistoryType.LEAVE); - + if(ConfigManager.MB_RULESET.getValue() == "LORE") { + if(GroupManager.getGroup(playerCharacter) != null) + GroupManager.getGroup(playerCharacter).removeGroupMember(playerCharacter); + } // Send message back to client msg.setMessage("You have left the guild."); dispatch = Dispatch.borrow(playerCharacter, msg); diff --git a/src/engine/objects/City.java b/src/engine/objects/City.java index d8c45c4d..d51c176f 100644 --- a/src/engine/objects/City.java +++ b/src/engine/objects/City.java @@ -325,8 +325,15 @@ public class City extends AbstractWorldObject { if (city.open && city.getTOL() != null && city.getTOL().getRank() > 4) { - if (!BuildingManager.IsPlayerHostile(city.getTOL(), pc)) - cities.add(city); //verify nation or guild is same + if (!BuildingManager.IsPlayerHostile(city.getTOL(), pc)) { + if(ConfigManager.MB_RULESET.getValue() == "LORE") { + if(city.getGuild().getGuildType().equals(pc.guild.getGuildType())){ + cities.add(city); + } + }else { + cities.add(city); //verify nation or guild is same + } + } } else if (Guild.sameNationExcludeErrant(city.getGuild(), pcG)) cities.add(city); @@ -345,7 +352,13 @@ public class City extends AbstractWorldObject { cities.add(city); } else if (pc.getLevel() >= g.getTeleportMin() && pc.getLevel() <= g.getTeleportMax()) - cities.add(city); + if(ConfigManager.MB_RULESET.getValue() == "LORE") { + if(city.getGuild().getGuildType().equals(pc.guild.getGuildType())){ + cities.add(city); + } + }else { + cities.add(city); //verify nation or guild is same + } } } @@ -398,12 +411,24 @@ public class City extends AbstractWorldObject { if (city.isNpc == 1) if (city.isNoobIsle == 1) { if (playerCharacter.getLevel() < 21) - cities.add(city); + cities.add(city); //verify nation or guild is same } else if (playerCharacter.getLevel() > 9) - cities.add(city); + if(ConfigManager.MB_RULESET.getValue() == "LORE") { + if(city.getGuild().getGuildType().equals(playerCharacter.guild.getGuildType())){ + cities.add(city); + } + }else { + cities.add(city); //verify nation or guild is same + } } else if (playerCharacter.getLevel() >= guild.getRepledgeMin() && playerCharacter.getLevel() <= guild.getRepledgeMax()) { - cities.add(city); + if(ConfigManager.MB_RULESET.getValue() == "LORE") { + if(city.getGuild().getGuildType().equals(playerCharacter.guild.getGuildType())){ + cities.add(city); + } + }else { + cities.add(city); //verify nation or guild is same + } } } } From c0a7ddc7117c5c10c9bbf4cd5fb1dee259483294 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 18 Feb 2024 08:20:34 -0500 Subject: [PATCH 39/39] Using a string instead of a set. --- src/engine/gameManager/DbManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/gameManager/DbManager.java b/src/engine/gameManager/DbManager.java index 855eb840..97040017 100644 --- a/src/engine/gameManager/DbManager.java +++ b/src/engine/gameManager/DbManager.java @@ -280,7 +280,7 @@ public enum DbManager { // Split set string and trim each element - String[] elements = mysqlSet.split(","); + String[] elements = mysqlSet.split(";"); for (String element : elements) {