Browse Source

Merge remote-tracking branch 'origin/feature-lore-ruleset' into magicbox-1.5.2

combat-2
MagicBot 9 months ago
parent
commit
a8cd6f4f74
  1. 382
      src/engine/Enum.java
  2. 2
      src/engine/db/archive/GuildRecord.java
  3. 20
      src/engine/db/handlers/dbGuildHandler.java
  4. 1
      src/engine/db/handlers/dbItemBaseHandler.java
  5. 80
      src/engine/devcmd/cmds/ItemInfoCmd.java
  6. 12
      src/engine/devcmd/cmds/SlotNpcCmd.java
  7. 3
      src/engine/gameManager/ConfigManager.java
  8. 36
      src/engine/gameManager/DbManager.java
  9. 1
      src/engine/gameManager/DevCmdManager.java
  10. 10
      src/engine/gameManager/GuildManager.java
  11. 21
      src/engine/gameManager/PowersManager.java
  12. 2
      src/engine/net/client/handlers/ChangeGuildLeaderHandler.java
  13. 2
      src/engine/net/client/handlers/ChangeRankHandler.java
  14. 11
      src/engine/net/client/handlers/GroupInviteHandler.java
  15. 4
      src/engine/net/client/handlers/GuildCreationFinalizeHandler.java
  16. 12
      src/engine/net/client/handlers/InviteToGuildHandler.java
  17. 11
      src/engine/net/client/handlers/InviteToSubHandler.java
  18. 13
      src/engine/net/client/handlers/LeaveGuildHandler.java
  19. 2
      src/engine/net/client/msg/guild/GuildListMsg.java
  20. 9
      src/engine/objects/AbstractCharacter.java
  21. 37
      src/engine/objects/City.java
  22. 6
      src/engine/objects/Guild.java
  23. 161
      src/engine/objects/ItemBase.java
  24. 30
      src/engine/objects/PlayerCharacter.java

382
src/engine/Enum.java

@ -46,7 +46,7 @@ public class Enum {
EXPLOIT, EXPLOIT,
BUG, BUG,
GAME_STOPPER, GAME_STOPPER,
TECH_SUPPORT; TECH_SUPPORT
} }
@ -112,7 +112,7 @@ public class Enum {
Undead, Undead,
Nephilim, Nephilim,
Vampire, Vampire,
SiegeEngineer; SiegeEngineer
} }
@ -120,7 +120,7 @@ public class Enum {
MALE, MALE,
FEMALE, FEMALE,
FUZZY, FUZZY,
OTHER; OTHER
} }
public enum RaceType { public enum RaceType {
@ -155,13 +155,13 @@ public class Enum {
VAMPFEMALE(2029, MonsterType.Vampire, RunSpeed.STANDARD, CharacterSex.FEMALE, 1); VAMPFEMALE(2029, MonsterType.Vampire, RunSpeed.STANDARD, CharacterSex.FEMALE, 1);
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private static HashMap<Integer, RaceType> _raceTypeByID = new HashMap<>(); private static final HashMap<Integer, RaceType> _raceTypeByID = new HashMap<>();
int runeID; int runeID;
private MonsterType monsterType; private final MonsterType monsterType;
private CharacterSex characterSex; private final CharacterSex characterSex;
private RunSpeed runSpeed; private final RunSpeed runSpeed;
private float scaleHeight; private final float scaleHeight;
RaceType(int runeID, MonsterType aggroType, RunSpeed runspeed, CharacterSex characterSex, float scaleHeight) { RaceType(int runeID, MonsterType aggroType, RunSpeed runspeed, CharacterSex characterSex, float scaleHeight) {
this.runeID = runeID; 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), 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); MINOTAUR(6.6300001f, 15.95f, 4.2199998f, 15.95f, 6.3299999f, 18.379999f, 6.5f);
private float walkStandard; private final float walkStandard;
private float walkCombat; private final float walkCombat;
private float runStandard; private final float runStandard;
private float runCombat; private final float runCombat;
private float swim; private final float swim;
private float flyRun; private final float flyRun;
private float flyWalk; private final float flyWalk;
RunSpeed(float walkStandard, float runStandard, float walkCombat, float runCombat, float flyWalk, float flyRun, float swim) { RunSpeed(float walkStandard, float runStandard, float walkCombat, float runCombat, float flyWalk, float flyRun, float swim) {
this.walkStandard = walkStandard; this.walkStandard = walkStandard;
@ -310,13 +310,13 @@ public class Enum {
public enum PvpHistoryType { public enum PvpHistoryType {
KILLS, KILLS,
DEATHS; DEATHS
} }
public enum ChatMessageType { public enum ChatMessageType {
ERROR, ERROR,
INFO, INFO,
MOTD; MOTD
} }
public enum DataRecordType { public enum DataRecordType {
@ -327,7 +327,7 @@ public class Enum {
CITY, CITY,
ZONE, ZONE,
REALM, REALM,
MINE; MINE
} }
public enum RecordEventType { public enum RecordEventType {
@ -338,7 +338,7 @@ public class Enum {
TRANSFER, TRANSFER,
PENDING, PENDING,
DEFEND, DEFEND,
LOST; // Realm event LOST // Realm event
} }
public enum CharterType { public enum CharterType {
@ -346,8 +346,8 @@ public class Enum {
MERCANTILE(-15978914, 5060400), MERCANTILE(-15978914, 5060400),
BELLIGERENT(762228431, 5060800); BELLIGERENT(762228431, 5060800);
private int charterID; private final int charterID;
private int meshID; private final int meshID;
CharterType(int charterID, int meshID) { CharterType(int charterID, int meshID) {
this.charterID = charterID; this.charterID = charterID;
@ -402,7 +402,7 @@ public class Enum {
Npc, Npc,
PlayerCharacter, PlayerCharacter,
Account, Account,
Mob; Mob
} }
public enum SiegePhase { public enum SiegePhase {
@ -410,20 +410,20 @@ public class Enum {
CHALLENGE, CHALLENGE,
STANDOFF, STANDOFF,
WAR, WAR,
CEASEFIRE; CEASEFIRE
} }
public enum SiegeResult { public enum SiegeResult {
PENDING, PENDING,
DEFEND, DEFEND,
DESTROY, DESTROY,
CAPTURE; CAPTURE
} }
public enum TaxType { public enum TaxType {
PROFIT, PROFIT,
WEEKLY, WEEKLY,
NONE; NONE
} }
@ -1261,7 +1261,7 @@ public class Enum {
SITTING, SITTING,
RUNNING, RUNNING,
FLYING, FLYING,
SWIMMING; SWIMMING
} }
public enum DoorState { public enum DoorState {
@ -1269,7 +1269,7 @@ public class Enum {
OPEN, OPEN,
CLOSED, CLOSED,
LOCKED, LOCKED,
UNLOCKED; UNLOCKED
} }
// Used with stored procedure GET_UID_ENUM() for // Used with stored procedure GET_UID_ENUM() for
@ -1290,11 +1290,9 @@ public class Enum {
SHRINE, SHRINE,
WORLDSERVER, WORLDSERVER,
ZONE, ZONE,
WAREHOUSE; WAREHOUSE
} }
;
/** /**
* Enumeration of Building Protection Status stored in the database as a * Enumeration of Building Protection Status stored in the database as a
* mysql enumfield. WARNING: This enumeration is fragile. Do not rename. Do * mysql enumfield. WARNING: This enumeration is fragile. Do not rename. Do
@ -1309,11 +1307,64 @@ public class Enum {
CONTRACT, CONTRACT,
DESTROYED, DESTROYED,
PENDING, 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 { public enum CharacterSkills {
Archery((1L << 1), -529201545, 20), Archery((1L << 1), -529201545, 20),
@ -1382,7 +1433,7 @@ public class Enum {
private long flag; private long flag;
private int token; private int token;
private int reqLvl; private final int reqLvl;
CharacterSkills(long flag, int token, int reqLvl) { CharacterSkills(long flag, int token, int reqLvl) {
this.flag = flag; this.flag = flag;
@ -1421,8 +1472,6 @@ public class Enum {
} }
} }
;
public enum GuildHistoryType { public enum GuildHistoryType {
JOIN(1), JOIN(1),
LEAVE(4), LEAVE(4),
@ -1443,17 +1492,14 @@ public class Enum {
public enum SexType { public enum SexType {
NONE, NONE,
MALE, MALE,
FEMALE; FEMALE
} }
public enum ClassType { public enum ClassType {
FIGHTER, Fighter(SexType.NONE),
HEALER, Healer(SexType.NONE),
ROGUE, Rogue(SexType.NONE),
MAGE; Mage(SexType.NONE),
}
public enum PromoteType {
Assassin(SexType.NONE), Assassin(SexType.NONE),
Barbarian(SexType.NONE), Barbarian(SexType.NONE),
Bard(SexType.NONE), Bard(SexType.NONE),
@ -1478,9 +1524,9 @@ public class Enum {
Necromancer(SexType.NONE), Necromancer(SexType.NONE),
; ;
private SexType sexRestriction; private final SexType sexRestriction;
PromoteType(SexType sexRestriction) { ClassType(SexType sexRestriction) {
this.sexRestriction = sexRestriction; this.sexRestriction = sexRestriction;
} }
@ -1660,13 +1706,13 @@ public class Enum {
REGEN, REGEN,
FLIGHT, FLIGHT,
LOCATION, LOCATION,
MOVEMENTSTATE; MOVEMENTSTATE
} }
public enum ServerType { public enum ServerType {
WORLDSERVER, WORLDSERVER,
LOGINSERVER, LOGINSERVER,
NONE; NONE
} }
public enum ChatChannel implements EnumBitSetHelper<ChatChannel> { public enum ChatChannel implements EnumBitSetHelper<ChatChannel> {
@ -1720,7 +1766,7 @@ public class Enum {
Thief, Thief,
Warlock, Warlock,
Warrior, Warrior,
Wizard; Wizard
} }
@ -1728,13 +1774,13 @@ public class Enum {
RecommendedAlly, RecommendedAlly,
RecommendedEnemy, RecommendedEnemy,
Ally, Ally,
Enemy; Enemy
} }
public enum FriendStatus { public enum FriendStatus {
Available, Available,
Away, Away,
Busy; Busy
} }
public enum ProfitType { public enum ProfitType {
@ -1749,7 +1795,7 @@ public class Enum {
public String dbField; public String dbField;
private ProfitType(String dbField) { ProfitType(String dbField) {
this.dbField = dbField; this.dbField = dbField;
} }
} }
@ -1842,17 +1888,15 @@ public class Enum {
WorldServerInfoSnapshot, WorldServerInfoSnapshot,
Shrine, Shrine,
Zone, Zone,
Transaction; Transaction
} }
public enum ContainerType { public enum ContainerType {
BANK, BANK,
INVENTORY, INVENTORY,
VAULT; VAULT
} }
;
public enum CompoundCurveType { public enum CompoundCurveType {
DefaultFlat(0), DefaultFlat(0),
DefaultSlope(1), DefaultSlope(1),
@ -2160,7 +2204,7 @@ public class Enum {
private final double value; private final double value;
private CompoundCurveType(double value) { CompoundCurveType(double value) {
this.value = value; this.value = value;
} }
@ -2183,7 +2227,7 @@ public class Enum {
Sit, Sit,
TakeDamage, TakeDamage,
TerritoryClaim, TerritoryClaim,
UnEquip; UnEquip
} }
public enum PowerSubType { public enum PowerSubType {
@ -2193,7 +2237,7 @@ public class Enum {
DamageType1, DamageType1,
DamageType2, DamageType2,
DamageType3, DamageType3,
Cancel; Cancel
} }
public enum PowerCategoryType { public enum PowerCategoryType {
@ -2228,7 +2272,7 @@ public class Enum {
RECALL, RECALL,
SPIREPROOFTELEPORT, SPIREPROOFTELEPORT,
SPIREDISABLE, SPIREDISABLE,
THIEF; THIEF
} }
public enum PowerTargetType { public enum PowerTargetType {
@ -2247,7 +2291,7 @@ public class Enum {
JEWELRY, JEWELRY,
WEAPONARMOR, WEAPONARMOR,
ARMOR, ARMOR,
ITEM; ITEM
} }
public enum objectMaskType { public enum objectMaskType {
@ -2280,7 +2324,7 @@ public class Enum {
BANK, BANK,
VAULT, VAULT,
FORGE, FORGE,
WAREHOUSE; WAREHOUSE
} }
public enum ItemSlotType implements EnumBitSetHelper<ItemSlotType> { public enum ItemSlotType implements EnumBitSetHelper<ItemSlotType> {
@ -2301,7 +2345,7 @@ public class Enum {
UPARM, UPARM,
WINGS, WINGS,
BEARD, BEARD,
HAIR; HAIR
} }
public enum CityBoundsType { public enum CityBoundsType {
@ -2317,8 +2361,12 @@ public class Enum {
} }
} }
public enum GuildType { public enum GuildCharterType {
NONE("None", new String[][]{{"None"}}, new String[]{"Thearchy", "Common Rule", "Theocracy", "Republic Rule"}), NONE("None", new String[][]{{"None"}}, new String[]{"Thearchy", "Common Rule", "Theocracy", "Republic Rule"},
EnumSet.noneOf(ClassType.class),
EnumSet.noneOf(MonsterType.class),
EnumSet.noneOf(SexType.class)),
CATHEDRAL("Church of the All-Father", new String[][]{ CATHEDRAL("Church of the All-Father", new String[][]{
{"Acolyte", "Acolyte"}, {"Acolyte", "Acolyte"},
{"Catechist"}, {"Catechist"},
@ -2328,7 +2376,12 @@ public class Enum {
{"Bishop", "Bishop"}, {"Bishop", "Bishop"},
{"Lord Cardinal", "Lady Cardinal"}, {"Lord Cardinal", "Lady Cardinal"},
{"Patriarch", "Matriarch"}}, {"Patriarch", "Matriarch"}},
new String[]{"Thearchy", "Common Rule", "Theocracy", "Republic Rule"}), new String[]{"Thearchy", "Common Rule", "Theocracy", "Republic Rule"},
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)),
MILITARY("Military", new String[][]{ MILITARY("Military", new String[][]{
{"Recruit"}, {"Recruit"},
{"Footman"}, {"Footman"},
@ -2338,7 +2391,11 @@ public class Enum {
{"Captain"}, {"Captain"},
{"General"}, {"General"},
{"Lord Marshall", "Lady Marshall"}}, {"Lord Marshall", "Lady Marshall"}},
new String[]{"Autocracy", "Common Rule", "Council Rule", "Militocracy"}), new String[]{"Autocracy", "Common Rule", "Council Rule", "Militocracy"},
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[][]{ TEMPLE("Temple of the Cleansing Flame", new String[][]{
{"Aspirant"}, {"Aspirant"},
{"Novice"}, {"Novice"},
@ -2349,7 +2406,11 @@ public class Enum {
{"Lictor"}, {"Lictor"},
{"Justiciar"}, {"Justiciar"},
{"Pontifex", "Pontifectrix"}}, {"Pontifex", "Pontifectrix"}},
new String[]{"Despot Rule", "Common Rule", "Protectorship", "Republic Rule"}), new String[]{"Despot Rule", "Common Rule", "Protectorship", "Republic Rule"},
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[][]{ BARBARIAN("Barbarian Clan", new String[][]{
{"Barbarian"}, {"Barbarian"},
{"Skald"}, {"Skald"},
@ -2358,7 +2419,11 @@ public class Enum {
{"Jarl"}, {"Jarl"},
{"Chieftain"}, {"Chieftain"},
{"Thane"}}, {"Thane"}},
new String[]{"Chiefdom", "Common Rule", "Council Rule", "Republic Rule"}), new String[]{"Chiefdom", "Common Rule", "Council Rule", "Republic Rule"},
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[][]{ RANGER("Ranger's Brotherhood", new String[][]{
{"Yeoman"}, {"Yeoman"},
{"Pathfinder"}, {"Pathfinder"},
@ -2367,7 +2432,11 @@ public class Enum {
{"Protector"}, {"Protector"},
{"Guardian"}, {"Guardian"},
{"Lord Protector", "Lady Protector"}}, {"Lord Protector", "Lady Protector"}},
new String[]{"Despot Rule", "Collectivism", "Council Rule", "Republic Rule"}), new String[]{"Despot Rule", "Collectivism", "Council Rule", "Republic Rule"},
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[][]{ AMAZON("Amazon Temple", new String[][]{
{"Amazon Thrall", "Amazon"}, {"Amazon Thrall", "Amazon"},
{"Amazon Slave", "Amazon Warrior"}, {"Amazon Slave", "Amazon Warrior"},
@ -2375,7 +2444,11 @@ public class Enum {
{"Amazon Consort", "Amazon Princess"}, {"Amazon Consort", "Amazon Princess"},
{"Amazon Seneschal", "Majestrix"}, {"Amazon Seneschal", "Majestrix"},
{"Amazon Regent", "Imperatrix"}}, {"Amazon Regent", "Imperatrix"}},
new String[]{"Despot Rule", "Common Rule", "Gynarchy", "Gynocracy"}), new String[]{"Despot Rule", "Common Rule", "Gynarchy", "Gynocracy"},
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[][]{ NOBLE("Noble House", new String[][]{
{"Serf"}, {"Serf"},
{"Vassal"}, {"Vassal"},
@ -2386,7 +2459,11 @@ public class Enum {
{"Duke", "Duchess"}, {"Duke", "Duchess"},
{"King", "Queen"}, {"King", "Queen"},
{"Emperor", "Empress"}}, {"Emperor", "Empress"}},
new String[]{"Monarchy", "Common Rule", "Feodality", "Republic"}), new String[]{"Monarchy", "Common Rule", "Feodality", "Republic"},
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[][]{ WIZARD("Wizard's Conclave", new String[][]{
{"Apprentice"}, {"Apprentice"},
{"Neophyte"}, {"Neophyte"},
@ -2395,7 +2472,11 @@ public class Enum {
{"Magus"}, {"Magus"},
{"High Magus"}, {"High Magus"},
{"Archmagus"}}, {"Archmagus"}},
new String[]{"Despot Rule", "Common Rule", "Council Rule", "Magocracy"}), new String[]{"Despot Rule", "Common Rule", "Council Rule", "Magocracy"},
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[][]{ MERCENARY("Mercenary Company", new String[][]{
{"Soldier"}, {"Soldier"},
{"Man-at-Arms"}, {"Man-at-Arms"},
@ -2405,7 +2486,11 @@ public class Enum {
{"Commander"}, {"Commander"},
{"High Commander"}, {"High Commander"},
{"Warlord"}}, {"Warlord"}},
new String[]{"Magistrature", "Mob Law", "Council Rule", "Republic Rule"}), new String[]{"Magistrature", "Mob Law", "Council Rule", "Republic Rule"},
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[][]{ THIEVES("Thieve's Den", new String[][]{
{"Urchin"}, {"Urchin"},
{"Footpad"}, {"Footpad"},
@ -2416,7 +2501,12 @@ public class Enum {
{"Treasurer"}, {"Treasurer"},
{"Grandmaster Thief"}, {"Grandmaster Thief"},
{"Grandfather"}}, {"Grandfather"}},
new String[]{"Despot Rule", "Common Rule", "Oligarchy", "Republic Rule"}), new String[]{"Despot Rule", "Common Rule", "Oligarchy", "Republic Rule"},
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)),
DWARF("Dwarf Hold", new String[][]{ DWARF("Dwarf Hold", new String[][]{
{"Citizen"}, {"Citizen"},
{"Master"}, {"Master"},
@ -2424,7 +2514,11 @@ public class Enum {
{"Thane"}, {"Thane"},
{"Great Thane"}, {"Great Thane"},
{"High 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(ClassType.Crusader, ClassType.Prelate, ClassType.Priest, ClassType.Sentinel,
ClassType.Warrior),
EnumSet.of(MonsterType.Dwarf),
EnumSet.allOf(SexType.class)),
HIGHCOURT("High Court", new String[][]{ HIGHCOURT("High Court", new String[][]{
{"Eccekebe"}, {"Eccekebe"},
{"Saedulor"}, {"Saedulor"},
@ -2435,7 +2529,12 @@ public class Enum {
{"Dar Thaelostor", "Dar Thaelostril"}, {"Dar Thaelostor", "Dar Thaelostril"},
{"Aglaeron"}, {"Aglaeron"},
{"Ellestor", "Elestril"}}, {"Ellestor", "Elestril"}},
new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}), new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"},
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[][]{ VIRAKT("Virakt", new String[][]{
{"Jov'uus"}, {"Jov'uus"},
{"Urikhan"}, {"Urikhan"},
@ -2445,7 +2544,12 @@ public class Enum {
{"Khal'uvho"}, {"Khal'uvho"},
{"Khar'uus"}, {"Khar'uus"},
{"Kryqh'khalin"}}, {"Kryqh'khalin"}},
new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}), new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"},
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 BRIALIA("Coven of Brialia", new String[][]{ // Unknown Rank names
{"Devotee"}, {"Devotee"},
{"Initiated"}, {"Initiated"},
@ -2455,7 +2559,11 @@ public class Enum {
{"Elder"}, {"Elder"},
{"Hierophant"}, {"Hierophant"},
{"Witch King", "Witch Queen"}}, {"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.allOf(ClassType.class),
EnumSet.allOf(MonsterType.class),
EnumSet.allOf(SexType.class)),
UNHOLY("Unholy Legion", new String[][]{ // Unknown Rank names UNHOLY("Unholy Legion", new String[][]{ // Unknown Rank names
{"Footman"}, {"Footman"},
{"Fell Legionaire"}, {"Fell Legionaire"},
@ -2465,14 +2573,23 @@ public class Enum {
{"Dark Master", "Dark Mistress"}, {"Dark Master", "Dark Mistress"},
{"Dread Master", "Dread Mistress"}, {"Dread Master", "Dread Mistress"},
{"Dread Lord", "Dread Lady"}}, {"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(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[][]{ SCOURGE("Cult of the Scourge", new String[][]{
{"Thrall"}, {"Thrall"},
{"Mudir"}, {"Mudir"},
{"Dark Brother", "Dark Sister"}, {"Dark Brother", "Dark Sister"},
{"Hand of the Dark"}, {"Hand of the Dark"},
{"Dark Father", "Dark Mother"}}, {"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(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[][]{ PIRATE("Pirate Crew", new String[][]{
{"Midshipman", "Midshipwoman"}, {"Midshipman", "Midshipwoman"},
{"Sailor"}, {"Sailor"},
@ -2480,7 +2597,10 @@ public class Enum {
{"Second Mat"}, {"Second Mat"},
{"First Mate"}, {"First Mate"},
{"Captain"}}, {"Captain"}},
new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}), new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"},
EnumSet.allOf(ClassType.class),
EnumSet.allOf(MonsterType.class),
EnumSet.allOf(SexType.class)),
HERALD("Academy of Heralds", new String[][]{ HERALD("Academy of Heralds", new String[][]{
{"Pupil"}, {"Pupil"},
{"Scribe"}, {"Scribe"},
@ -2490,7 +2610,10 @@ public class Enum {
{"Scholar"}, {"Scholar"},
{"Archivist"}, {"Archivist"},
{"Loremaster"}}, {"Loremaster"}},
new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}), new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"},
EnumSet.allOf(ClassType.class),
EnumSet.allOf(MonsterType.class),
EnumSet.allOf(SexType.class)),
CENTAUR("Centaur Cohort", new String[][]{ CENTAUR("Centaur Cohort", new String[][]{
{"Hoplite"}, {"Hoplite"},
{"Peltast"}, {"Peltast"},
@ -2500,7 +2623,12 @@ public class Enum {
{"Septenrion"}, {"Septenrion"},
{"Praetorian"}, {"Praetorian"},
{"Paragon"}}, {"Paragon"}},
new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}), new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"},
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[][]{ KHREE("Aracoix Kh'ree", new String[][]{
{"Duriacor"}, {"Duriacor"},
{"Exarch"}, {"Exarch"},
@ -2512,101 +2640,108 @@ public class Enum {
{"Erentar"}, {"Erentar"},
{"Araceos"}, {"Araceos"},
{"Hierarch"}}, {"Hierarch"}},
new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"},
new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}); 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<ClassType> requiredClasses;
public final EnumSet<MonsterType> requiredRaces;
public final EnumSet<SexType> sexRequired;
private final String name; private final String name;
private final String[][] ranks; //Stored Rank#->Gender(M,F) private final String[][] ranks; //Stored Rank#->Gender(M,F)
private final String[] leadershipTypes; private final String[] leadershipTypes;
GuildType(String name, String[][] ranks, String[] leadershipTypes) { GuildCharterType(String name, String[][] ranks, String[] leadershipTypes, EnumSet<ClassType> requiredClasses,
EnumSet<MonsterType> requiredRaces, EnumSet<SexType> sexRequired) {
this.name = name; this.name = name;
this.ranks = ranks; this.ranks = ranks;
this.leadershipTypes = leadershipTypes; this.leadershipTypes = leadershipTypes;
this.requiredClasses = requiredClasses;
this.requiredRaces = requiredRaces;
this.sexRequired = sexRequired;
} }
public static GuildType getGuildTypeFromCharter(ItemBase itemBase) { public static GuildCharterType getGuildTypeFromCharter(ItemBase itemBase) {
GuildType charterType; GuildCharterType charterType;
// Must be a valid charter object // Must be a valid charter object
if (itemBase.getType().equals(ItemType.GUILDCHARTER) == false) if (itemBase.getType().equals(ItemType.GUILDCHARTER) == false)
return GuildType.NONE; //No guild Type return GuildCharterType.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.
switch (itemBase.getUUID()) { switch (itemBase.getUUID()) {
case 559: case 559:
charterType = GuildType.CATHEDRAL; charterType = GuildCharterType.CATHEDRAL;
break; break;
case 560: case 560:
charterType = GuildType.MILITARY; charterType = GuildCharterType.MILITARY;
break; break;
case 561: case 561:
charterType = GuildType.TEMPLE; charterType = GuildCharterType.TEMPLE;
break; break;
case 562: case 562:
charterType = GuildType.BARBARIAN; charterType = GuildCharterType.BARBARIAN;
break; break;
case 563: case 563:
charterType = GuildType.RANGER; charterType = GuildCharterType.RANGER;
break; break;
case 564: case 564:
charterType = GuildType.AMAZON; charterType = GuildCharterType.AMAZON;
break; break;
case 565: case 565:
charterType = GuildType.NOBLE; charterType = GuildCharterType.NOBLE;
break; break;
case 566: case 566:
charterType = GuildType.WIZARD; charterType = GuildCharterType.WIZARD;
break; break;
case 567: case 567:
charterType = GuildType.MERCENARY; charterType = GuildCharterType.MERCENARY;
break; break;
case 568: case 568:
charterType = GuildType.THIEVES; charterType = GuildCharterType.THIEVES;
break; break;
case 569: case 569:
charterType = GuildType.DWARF; charterType = GuildCharterType.DWARF;
break; break;
case 570: case 570:
charterType = GuildType.HIGHCOURT; charterType = GuildCharterType.HIGHCOURT;
break; break;
case 571: case 571:
charterType = GuildType.VIRAKT; charterType = GuildCharterType.VIRAKT;
break; break;
case 572: case 572:
charterType = GuildType.SCOURGE; charterType = GuildCharterType.SCOURGE;
break; break;
case 573: case 573:
charterType = GuildType.KHREE; charterType = GuildCharterType.KHREE;
break; break;
case 574: case 574:
charterType = GuildType.CENTAUR; charterType = GuildCharterType.CENTAUR;
break; break;
case 575: case 575:
charterType = GuildType.UNHOLY; charterType = GuildCharterType.UNHOLY;
break; break;
case 576: case 576:
charterType = GuildType.PIRATE; charterType = GuildCharterType.PIRATE;
break; break;
case 577: case 577:
charterType = GuildType.BRIALIA; charterType = GuildCharterType.BRIALIA;
break; break;
default: default:
charterType = GuildType.HERALD; charterType = GuildCharterType.HERALD;
} }
return charterType; return charterType;
} }
public static GuildType getGuildTypeFromInt(int i) { public static GuildCharterType getGuildTypeFromInt(int i) {
return GuildType.values()[i]; return GuildCharterType.values()[i];
} }
public String getCharterName() { public String getCharterName() {
@ -2632,12 +2767,15 @@ public class Enum {
return leadershipTypes[i]; 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 { public enum MinionClass {
MELEE, MELEE,
ARCHER, ARCHER,
MAGE; MAGE
} }
public enum MinionType { public enum MinionType {
@ -2707,14 +2845,14 @@ public class Enum {
return race; return race;
} }
public Boolean isMage(){ public Boolean isMage() {
return this.minionClass.ordinal() == MinionClass.MAGE.ordinal(); return this.minionClass.ordinal() == MinionClass.MAGE.ordinal();
} }
} }
public enum GridObjectType { public enum GridObjectType {
STATIC, STATIC,
DYNAMIC; DYNAMIC
} }
public enum SupportMsgType { public enum SupportMsgType {
@ -2817,7 +2955,7 @@ public class Enum {
public enum AccountStatus { public enum AccountStatus {
BANNED, BANNED,
ACTIVE, ACTIVE,
ADMIN; ADMIN
} }
public enum MobBehaviourType { public enum MobBehaviourType {
@ -2882,6 +3020,6 @@ public class Enum {
GUARDWALLARCHER, GUARDWALLARCHER,
PET, PET,
CHARMED, CHARMED,
SIEGEENGINE; SIEGEENGINE
} }
} }

2
src/engine/db/archive/GuildRecord.java

@ -89,7 +89,7 @@ public class GuildRecord extends DataRecord {
guildRecord.guildHash = guildRecord.guild.getHash(); guildRecord.guildHash = guildRecord.guild.getHash();
guildRecord.guildID = guildRecord.guild.getObjectUUID(); guildRecord.guildID = guildRecord.guild.getObjectUUID();
guildRecord.guildName = guildRecord.guild.getName(); 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()); guildRecord.GLHash = DataWarehouse.hasher.encrypt(guildRecord.guild.getGuildLeaderUUID());

20
src/engine/db/handlers/dbGuildHandler.java

@ -695,24 +695,4 @@ public class dbGuildHandler extends dbHandlerBase {
} }
} }
//TODO uncomment this when finished with guild history warehouse integration
// public HashMap<Integer, GuildRecord> GET_WAREHOUSE_GUILD_HISTORY(){
//
// HashMap<Integer, GuildRecord> 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;
//
// }
} }

1
src/engine/db/handlers/dbItemBaseHandler.java

@ -86,6 +86,7 @@ public class dbItemBaseHandler extends dbHandlerBase {
while (rs.next()) { while (rs.next()) {
recordsRead++; recordsRead++;
itemBase = new ItemBase(rs); itemBase = new ItemBase(rs);
ItemBase.addToCache(itemBase); ItemBase.addToCache(itemBase);
} }

80
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'";
}
}

12
src/engine/devcmd/cmds/SlotNpcCmd.java

@ -53,7 +53,7 @@ public class SlotNpcCmd extends AbstractDevCmd {
if (stringIndex == -1) if (stringIndex == -1)
return false; return false;
// Validate we have a corrent building group name // Validate we have a correct building group name
for (BuildingGroup group : BuildingGroup.values()) { for (BuildingGroup group : BuildingGroup.values()) {
if (group.name().equals(userInput[0].toUpperCase())) if (group.name().equals(userInput[0].toUpperCase()))
@ -114,8 +114,7 @@ public class SlotNpcCmd extends AbstractDevCmd {
if (!DbManager.ContractQueries.updateAllowedBuildings(contract, contract.getAllowedBuildings().toLong())) { if (!DbManager.ContractQueries.updateAllowedBuildings(contract, contract.getAllowedBuildings().toLong())) {
Logger.error("Failed to update Database for Contract Allowed buildings"); Logger.error("Failed to update Database for Contract Allowed buildings");
ChatManager.chatSystemError(pc, "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.");
return; return;
} }
@ -125,8 +124,7 @@ public class SlotNpcCmd extends AbstractDevCmd {
contract.getAllowedBuildings().remove(buildingGroup); contract.getAllowedBuildings().remove(buildingGroup);
if (!DbManager.ContractQueries.updateAllowedBuildings(contract, contract.getAllowedBuildings().toLong())) { if (!DbManager.ContractQueries.updateAllowedBuildings(contract, contract.getAllowedBuildings().toLong())) {
Logger.error("Failed to update Database for Contract Allowed buildings"); Logger.error("Failed to update Database for Contract Allowed buildings");
ChatManager.chatSystemError(pc, "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.");
return; return;
} }
@ -138,14 +136,14 @@ public class SlotNpcCmd extends AbstractDevCmd {
@Override @Override
protected String _getHelpString() { protected String _getHelpString() {
return "Sets a building slot on a targeted npc"; return "Toggles a building group on a targeted npc";
} }
// Class methods // Class methods
@Override @Override
protected String _getUsageString() { protected String _getUsageString() {
String usage = "/npcslot [BuildingType] on-off \n"; String usage = "/npcslot [BuildingGroup] on-off \n";
for (BuildingGroup group : BuildingGroup.values()) { for (BuildingGroup group : BuildingGroup.values()) {
usage += group.name() + ' '; usage += group.name() + ' ';

3
src/engine/gameManager/ConfigManager.java

@ -30,6 +30,7 @@ public enum ConfigManager {
MB_BIND_ADDR, MB_BIND_ADDR,
MB_EXTERNAL_ADDR, MB_EXTERNAL_ADDR,
// Database connection config // Database connection config
MB_DATABASE_ADDRESS, MB_DATABASE_ADDRESS,
@ -66,6 +67,7 @@ public enum ConfigManager {
MB_WORLD_GREETING, MB_WORLD_GREETING,
MB_WORLD_KEYCLONE_MAX, MB_WORLD_KEYCLONE_MAX,
MB_USE_RUINS, MB_USE_RUINS,
MB_RULESET,
// Mobile AI modifiers // Mobile AI modifiers
MB_AI_CAST_FREQUENCY, MB_AI_CAST_FREQUENCY,
@ -134,7 +136,6 @@ public enum ConfigManager {
File file = new File("mbbranch.sh"); File file = new File("mbbranch.sh");
if (file.exists() && !file.isDirectory()) { if (file.exists() && !file.isDirectory()) {
String[] command = {"./mbbranch.sh"}; String[] command = {"./mbbranch.sh"};
try { try {

36
src/engine/gameManager/DbManager.java

@ -22,6 +22,7 @@ import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.EnumMap; import java.util.EnumMap;
import java.util.EnumSet;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
public enum DbManager { public enum DbManager {
@ -266,6 +267,40 @@ public enum DbManager {
} }
public static <E extends java.lang.Enum<E>> EnumSet<E> parseEnumSet(String mysqlSet, Class<E> enumClass) {
// Create empty output set of the passed Enum class
EnumSet<E> enumSet = EnumSet.noneOf(enumClass);
// Early exit for empty sets
if (mysqlSet.isEmpty())
return enumSet;
// Split set string and trim each element
String[] elements = mysqlSet.split(";");
for (String element : elements) {
element = element.trim();
// Parse the element into an enum; add to the output set
try {
E enumConstant = java.lang.Enum.valueOf(enumClass, element);
enumSet.add(enumConstant);
} catch (Exception e) {
Logger.error(" Parse error: " + mysqlSet);
}
}
// Return the output set
return enumSet;
}
public static void printCacheCount(PlayerCharacter pc) { public static void printCacheCount(PlayerCharacter pc) {
ChatManager.chatSystemInfo(pc, "Cache Lists"); ChatManager.chatSystemInfo(pc, "Cache Lists");
@ -324,4 +359,5 @@ public enum DbManager {
Logger.info("Database configured with " + connectionCount + " connections"); Logger.info("Database configured with " + connectionCount + " connections");
} }
} }

1
src/engine/gameManager/DevCmdManager.java

@ -58,6 +58,7 @@ public enum DevCmdManager {
DevCmdManager.registerDevCmd(new PrintResistsCmd()); DevCmdManager.registerDevCmd(new PrintResistsCmd());
DevCmdManager.registerDevCmd(new PrintLocationCmd()); DevCmdManager.registerDevCmd(new PrintLocationCmd());
DevCmdManager.registerDevCmd(new InfoCmd()); DevCmdManager.registerDevCmd(new InfoCmd());
DevCmdManager.registerDevCmd(new ItemInfoCmd());
DevCmdManager.registerDevCmd(new aiInfoCmd()); DevCmdManager.registerDevCmd(new aiInfoCmd());
DevCmdManager.registerDevCmd(new SimulateBootyCmd()); DevCmdManager.registerDevCmd(new SimulateBootyCmd());
DevCmdManager.registerDevCmd(new GetHeightCmd()); DevCmdManager.registerDevCmd(new GetHeightCmd());

10
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;
}
} }

21
src/engine/gameManager/PowersManager.java

@ -170,6 +170,19 @@ public enum PowersManager {
public static void usePower(final PerformActionMsg msg, ClientConnection origin, public static void usePower(final PerformActionMsg msg, ClientConnection origin,
boolean sendCastToSelf) { 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)) { if (usePowerA(msg, origin, sendCastToSelf)) {
// Cast failed for some reason, reset timer // Cast failed for some reason, reset timer
@ -1258,7 +1271,13 @@ public enum PowersManager {
return; 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 PerformActionMsg pam = new PerformActionMsg(msg.getPowerToken(), msg
.getTrains(), msg.getSourceType(), msg.getSourceID(), target .getTrains(), msg.getSourceType(), msg.getSourceID(), target
.getObjectType().ordinal(), target.getObjectUUID(), 0f, 0f, 0f, 1, 0); .getObjectType().ordinal(), target.getObjectUUID(), 0f, 0f, 0f, 1, 0);

2
src/engine/net/client/handlers/ChangeGuildLeaderHandler.java

@ -76,7 +76,7 @@ public class ChangeGuildLeaderHandler extends AbstractClientMsgHandler {
boolean isMale = true; boolean isMale = true;
boolean updateTarget; 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())) { if (!DbManager.GuildQueries.SET_GUILD_LEADER(targetPlayer.getObjectUUID(), glGuild.getObjectUUID())) {

2
src/engine/net/client/handlers/ChangeRankHandler.java

@ -60,7 +60,7 @@ public class ChangeRankHandler extends AbstractClientMsgHandler {
boolean isMale; boolean isMale;
if (msg.getPreviousRank() != msg.getNewRank()) { 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) { if (targetPlayer != null) {
targetPlayer.setGuildTitle(msg.getNewRank()); targetPlayer.setGuildTitle(msg.getNewRank());

11
src/engine/net/client/handlers/GroupInviteHandler.java

@ -12,7 +12,9 @@ package engine.net.client.handlers;
import engine.Enum; import engine.Enum;
import engine.Enum.GameObjectType; import engine.Enum.GameObjectType;
import engine.exception.MsgSendException; import engine.exception.MsgSendException;
import engine.gameManager.ConfigManager;
import engine.gameManager.GroupManager; import engine.gameManager.GroupManager;
import engine.gameManager.GuildManager;
import engine.gameManager.SessionManager; import engine.gameManager.SessionManager;
import engine.net.Dispatch; import engine.net.Dispatch;
import engine.net.DispatchMessage; 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.GroupInviteMsg;
import engine.net.client.msg.group.GroupUpdateMsg; import engine.net.client.msg.group.GroupUpdateMsg;
import engine.objects.Group; import engine.objects.Group;
import engine.objects.Guild;
import engine.objects.PlayerCharacter; import engine.objects.PlayerCharacter;
public class GroupInviteHandler extends AbstractClientMsgHandler { public class GroupInviteHandler extends AbstractClientMsgHandler {
@ -103,7 +106,15 @@ public class GroupInviteHandler extends AbstractClientMsgHandler {
if (target.isIgnoringPlayer(source)) if (target.isIgnoringPlayer(source))
return false; 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 block invites to people already in a group and
// dont check for pending invites, the client does it // dont check for pending invites, the client does it
// Send invite message to target // Send invite message to target

4
src/engine/net/client/handlers/GuildCreationFinalizeHandler.java

@ -43,7 +43,7 @@ public class GuildCreationFinalizeHandler extends AbstractClientMsgHandler {
PlayerCharacter player; PlayerCharacter player;
GuildCreationFinalizeMsg msg; GuildCreationFinalizeMsg msg;
Enum.GuildType charterType; Enum.GuildCharterType charterType;
Guild newGuild; Guild newGuild;
Guild playerGuild; Guild playerGuild;
ItemBase itemBase; ItemBase itemBase;
@ -78,7 +78,7 @@ public class GuildCreationFinalizeHandler extends AbstractClientMsgHandler {
return true; return true;
} }
charterType = Enum.GuildType.getGuildTypeFromCharter(itemBase); charterType = Enum.GuildCharterType.getGuildTypeFromCharter(itemBase);
if (charterType == null) { if (charterType == null) {
ErrorPopupMsg.sendErrorPopup(player, GuildManager.NO_CHARTER_FOUND); ErrorPopupMsg.sendErrorPopup(player, GuildManager.NO_CHARTER_FOUND);

12
src/engine/net/client/handlers/InviteToGuildHandler.java

@ -14,6 +14,7 @@ import engine.Enum;
import engine.Enum.GameObjectType; import engine.Enum.GameObjectType;
import engine.exception.MsgSendException; import engine.exception.MsgSendException;
import engine.gameManager.ChatManager; import engine.gameManager.ChatManager;
import engine.gameManager.ConfigManager;
import engine.gameManager.GuildManager; import engine.gameManager.GuildManager;
import engine.gameManager.SessionManager; import engine.gameManager.SessionManager;
import engine.net.Dispatch; import engine.net.Dispatch;
@ -84,9 +85,9 @@ public class InviteToGuildHandler extends AbstractClientMsgHandler {
return true; 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); ErrorPopupMsg.sendErrorPopup(sourcePlayer, GuildManager.NO_CHARTER_FOUND);
return true; return true;
} }
@ -124,7 +125,12 @@ public class InviteToGuildHandler extends AbstractClientMsgHandler {
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 135);// you do not meet the level required for this SWORN guild ErrorPopupMsg.sendErrorPopup(sourcePlayer, 135);// you do not meet the level required for this SWORN guild
return true; 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()); targetPlayer.setLastGuildToInvite(sourcePlayer.getGuild().getObjectUUID());
// setup guild invite message to send to targetPlayer // setup guild invite message to send to targetPlayer

11
src/engine/net/client/handlers/InviteToSubHandler.java

@ -12,9 +12,7 @@ package engine.net.client.handlers;
import engine.Enum; import engine.Enum;
import engine.Enum.GameObjectType; import engine.Enum.GameObjectType;
import engine.exception.MsgSendException; import engine.exception.MsgSendException;
import engine.gameManager.ChatManager; import engine.gameManager.*;
import engine.gameManager.DbManager;
import engine.gameManager.SessionManager;
import engine.net.Dispatch; import engine.net.Dispatch;
import engine.net.DispatchMessage; import engine.net.DispatchMessage;
import engine.net.client.ClientConnection; import engine.net.client.ClientConnection;
@ -111,7 +109,12 @@ public class InviteToSubHandler extends AbstractClientMsgHandler {
sendChat(source, "This Guild can't be subbed."); sendChat(source, "This Guild can't be subbed.");
return true; 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. //all tests passed, let's send invite.
if (target.getClientConnection() != null) { if (target.getClientConnection() != null) {

13
src/engine/net/client/handlers/LeaveGuildHandler.java

@ -11,17 +11,13 @@ package engine.net.client.handlers;
import engine.Enum.GuildHistoryType; import engine.Enum.GuildHistoryType;
import engine.exception.MsgSendException; import engine.exception.MsgSendException;
import engine.gameManager.ChatManager; import engine.gameManager.*;
import engine.gameManager.SessionManager;
import engine.net.Dispatch; import engine.net.Dispatch;
import engine.net.DispatchMessage; import engine.net.DispatchMessage;
import engine.net.client.ClientConnection; import engine.net.client.ClientConnection;
import engine.net.client.msg.ClientNetMsg; import engine.net.client.msg.ClientNetMsg;
import engine.net.client.msg.guild.LeaveGuildMsg; import engine.net.client.msg.guild.LeaveGuildMsg;
import engine.objects.Guild; import engine.objects.*;
import engine.objects.GuildStatusController;
import engine.objects.Mine;
import engine.objects.PlayerCharacter;
public class LeaveGuildHandler extends AbstractClientMsgHandler { public class LeaveGuildHandler extends AbstractClientMsgHandler {
@ -65,7 +61,10 @@ public class LeaveGuildHandler extends AbstractClientMsgHandler {
ChatManager.chatGuildInfo(oldGuild, playerCharacter.getFirstName() + " has left the guild."); ChatManager.chatGuildInfo(oldGuild, playerCharacter.getFirstName() + " has left the guild.");
oldGuild.removePlayer(playerCharacter, GuildHistoryType.LEAVE); 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 // Send message back to client
msg.setMessage("You have left the guild."); msg.setMessage("You have left the guild.");
dispatch = Dispatch.borrow(playerCharacter, msg); dispatch = Dispatch.borrow(playerCharacter, msg);

2
src/engine/net/client/msg/guild/GuildListMsg.java

@ -125,7 +125,7 @@ class GuildListMessageType1 extends GuildListMessageType {
@Override @Override
void _serialize(ByteBufferWriter writer) { 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(1);
writer.putInt(gt.ordinal()); //Charter Type writer.putInt(gt.ordinal()); //Charter Type

9
src/engine/objects/AbstractCharacter.java

@ -27,7 +27,6 @@ import engine.math.Bounds;
import engine.math.Vector3fImmutable; import engine.math.Vector3fImmutable;
import engine.net.ByteBufferWriter; import engine.net.ByteBufferWriter;
import engine.net.DispatchMessage; import engine.net.DispatchMessage;
import engine.net.client.msg.ErrorPopupMsg;
import engine.net.client.msg.UpdateStateMsg; import engine.net.client.msg.UpdateStateMsg;
import engine.powers.EffectsBase; import engine.powers.EffectsBase;
import engine.server.MBServerStatics; import engine.server.MBServerStatics;
@ -36,6 +35,7 @@ import org.pmw.tinylog.Logger;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashSet; import java.util.HashSet;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList;
@ -125,6 +125,13 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
public ArrayList<CharacterRune> runes; public ArrayList<CharacterRune> runes;
public Enum.MonsterType absRace;
public ClassType absBaseClass = null;
public ClassType absPromotionClass = null;
public Enum.SexType absGender = null;
public EnumSet<DisciplineType> absDisciplines;
public AbstractCharacter() { public AbstractCharacter() {
super(); super();
this.firstName = ""; this.firstName = "";

37
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 (city.open && city.getTOL() != null && city.getTOL().getRank() > 4) {
if (!BuildingManager.IsPlayerHostile(city.getTOL(), pc)) if (!BuildingManager.IsPlayerHostile(city.getTOL(), pc)) {
cities.add(city); //verify nation or guild is same 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)) } else if (Guild.sameNationExcludeErrant(city.getGuild(), pcG))
cities.add(city); cities.add(city);
@ -345,7 +352,13 @@ public class City extends AbstractWorldObject {
cities.add(city); cities.add(city);
} else if (pc.getLevel() >= g.getTeleportMin() && pc.getLevel() <= g.getTeleportMax()) } 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.isNpc == 1)
if (city.isNoobIsle == 1) { if (city.isNoobIsle == 1) {
if (playerCharacter.getLevel() < 21) if (playerCharacter.getLevel() < 21)
cities.add(city); cities.add(city); //verify nation or guild is same
} else if (playerCharacter.getLevel() > 9) } 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()) { } 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
}
} }
} }
} }

6
src/engine/objects/Guild.java

@ -965,12 +965,12 @@ public class Guild extends AbstractWorldObject {
DataWarehouse.writeHash(Enum.DataRecordType.GUILD, this.getObjectUUID()); DataWarehouse.writeHash(Enum.DataRecordType.GUILD, this.getObjectUUID());
} }
public Enum.GuildType getGuildType() { public GuildCharterType getGuildType() {
try { try {
return Enum.GuildType.values()[this.charter]; return GuildCharterType.values()[this.charter];
} catch (Exception e) { } catch (Exception e) {
Logger.error(e); Logger.error(e);
return Enum.GuildType.NONE; return GuildCharterType.NONE;
} }
} }

161
src/engine/objects/ItemBase.java

@ -9,6 +9,7 @@
package engine.objects; package engine.objects;
import engine.Enum;
import engine.Enum.DamageType; import engine.Enum.DamageType;
import engine.Enum.GameObjectType; import engine.Enum.GameObjectType;
import engine.Enum.ItemType; import engine.Enum.ItemType;
@ -19,6 +20,7 @@ import org.pmw.tinylog.Logger;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
@ -32,47 +34,54 @@ public class ItemBase {
public static HashMap<Integer, ItemBase> _itemBaseByUUID = new HashMap<>(); public static HashMap<Integer, ItemBase> _itemBaseByUUID = new HashMap<>();
public static HashMap<engine.Enum.ItemType, HashSet<ItemBase>> ItemBaseTypeMap = new HashMap<>(); public static HashMap<engine.Enum.ItemType, HashSet<ItemBase>> ItemBaseTypeMap = new HashMap<>();
// Internal cache // Internal cache
private static HashMap<Integer, Integer> itemHashIDMap = new HashMap<>(); private static final HashMap<Integer, Integer> itemHashIDMap = new HashMap<>();
private static HashMap<String, Integer> _IDsByNames = new HashMap<>(); private static final HashMap<String, Integer> _IDsByNames = new HashMap<>();
private static ArrayList<ItemBase> _resourceList = new ArrayList<>(); private static final ArrayList<ItemBase> _resourceList = new ArrayList<>();
private final int uuid; private final int uuid;
private final String name; private final String name;
private float durability; //requirements/restrictions
private int value; public EnumSet<Enum.MonsterType> restrictedRaces;
private short weight; public EnumSet<Enum.MonsterType> requiredRaces;
private short color; public EnumSet<Enum.ClassType> restrictedClasses;
private ItemType type; public EnumSet<Enum.ClassType> requiredClasses;
public EnumSet<Enum.DisciplineType> requiredDiscs;
public EnumSet<Enum.DisciplineType> 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 vendorType;
private int modTable; private final int modTable;
private int useID; private final int useID;
private int hashID; private int hashID;
private byte useAmount; private final byte useAmount;
// Armor and weapon related values // Armor and weapon related values
private int equipFlag; private final int equipFlag;
private int restrictFlag; private final int restrictFlag;
private String skillRequired; private final String skillRequired;
private short percentRequired; private final short percentRequired;
private float slashResist; private final float slashResist;
private float crushResist; private final float crushResist;
private float pierceResist; private final float pierceResist;
private float blockMod; private final float blockMod;
private short defense; private final short defense;
private float dexPenalty; private final float dexPenalty;
private float speed; private final float speed;
private float range; private final float range;
private short minDamage; private final short minDamage;
private short maxDamage; private final short maxDamage;
private String mastery; private final String mastery;
private engine.Enum.DamageType damageType; private final engine.Enum.DamageType damageType;
private boolean twoHanded; private final boolean twoHanded;
private boolean isConsumable; private boolean isConsumable;
private boolean isStackable; private boolean isStackable;
private int numCharges; private final int numCharges;
// Item stat modifiers // Item stat modifiers
private HashMap<Integer, Integer> bakedInStats = new HashMap<>(); private final HashMap<Integer, Integer> bakedInStats = new HashMap<>();
private HashMap<Integer, Integer> usedStats = new HashMap<>(); private final HashMap<Integer, Integer> usedStats = new HashMap<>();
private float parryBonus; private final float parryBonus;
private boolean isStrBased; private final boolean isStrBased;
private ArrayList<Integer> animations = new ArrayList<>(); private ArrayList<Integer> animations = new ArrayList<>();
private ArrayList<Integer> offHandAnimations = new ArrayList<>(); private ArrayList<Integer> offHandAnimations = new ArrayList<>();
private boolean autoID = false; private boolean autoID = false;
@ -116,6 +125,13 @@ public class ItemBase {
this.minDamage = rs.getShort("minDamage"); this.minDamage = rs.getShort("minDamage");
this.maxDamage = rs.getShort("maxDamage"); 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"); this.mastery = rs.getString("mastery");
damageType = DamageType.valueOf(rs.getString("damageType")); damageType = DamageType.valueOf(rs.getString("damageType"));
@ -212,6 +228,7 @@ public class ItemBase {
public static void loadAllItemBases() { public static void loadAllItemBases() {
DbManager.ItemBaseQueries.LOAD_ALL_ITEMBASES(); DbManager.ItemBaseQueries.LOAD_ALL_ITEMBASES();
AnniverseryGifts.add(971000); AnniverseryGifts.add(971000);
AnniverseryGifts.add(971001); AnniverseryGifts.add(971001);
AnniverseryGifts.add(971002); AnniverseryGifts.add(971002);
@ -306,11 +323,8 @@ public class ItemBase {
public boolean isDiscRune() { public boolean isDiscRune() {
int ID = uuid; int ID = uuid;
if (ID > 2499 && ID < 3050) { //class, discipline runes //class, discipline runes
return true; return ID > 2499 && ID < 3050;
} else {
return false;
}
} }
public boolean isGlass() { public boolean isGlass() {
@ -468,6 +482,9 @@ public class ItemBase {
if (!validForSkills(abstractCharacter.getSkills())) if (!validForSkills(abstractCharacter.getSkills()))
return false; return false;
if (this.canCharacterEquip(abstractCharacter) == false)
return false;
return item.getItemBase().value != 0 || Kit.IsNoobGear(item.getItemBase().uuid); return item.getItemBase().value != 0 || Kit.IsNoobGear(item.getItemBase().uuid);
//players can't wear 0 value items. //players can't wear 0 value items.
@ -752,19 +769,19 @@ public class ItemBase {
} }
public boolean isThrowing() { public boolean isThrowing() {
return this.mastery.equals("Throwing") ? true : false; return this.mastery.equals("Throwing");
} }
public boolean isStaff() { public boolean isStaff() {
return this.mastery.equals("Staff") ? true : false; return this.mastery.equals("Staff");
} }
public boolean isScepter() { public boolean isScepter() {
return this.mastery.equals("Benediction") ? true : false; return this.mastery.equals("Benediction");
} }
public boolean isArchery() { public boolean isArchery() {
return this.mastery.equals("Archery") ? true : false; return this.mastery.equals("Archery");
} }
public boolean isMelee() { public boolean isMelee() {
@ -915,20 +932,68 @@ public class ItemBase {
this.autoID = autoID; this.autoID = autoID;
} }
public boolean isArmor(){ public boolean isArmor() {
if (this.isHeavyArmor())
return true;
if (this.isMediumArmor())
return true;
if (this.isLightArmor())
return true;
return this.isClothArmor();
}
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.isHeavyArmor()) if (this.requiredRaces.isEmpty() && this.restrictedRaces.isEmpty())
return true; return true;
if(this.isMediumArmor()) if (this.requiredRaces.isEmpty() == false && race.elementOf(this.requiredRaces) == true)
return true; return true;
if(this.isLightArmor()) return this.restrictedRaces.isEmpty() == false && race.elementOf(this.restrictedRaces) == false;
}
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)
return true; return true;
if(this.isClothArmor()) 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)
return this.restrictedClasses.contains(base) == false && this.restrictedClasses.contains(profession) == false;
return false;
}
public Boolean ValidDiscipline(EnumSet<Enum.DisciplineType> discs) {
boolean requiredEmpty = this.requiredDiscs == null || this.requiredDiscs.isEmpty();
boolean restrictedEmpty = this.restrictedDiscs == null || this.restrictedDiscs.isEmpty();
if (requiredEmpty && restrictedEmpty)
return true; return true;
return false; 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;
} }
} }

30
src/engine/objects/PlayerCharacter.java

@ -4559,6 +4559,36 @@ public class PlayerCharacter extends AbstractCharacter {
Bounds playerBounds = Bounds.borrow(); Bounds playerBounds = Bounds.borrow();
playerBounds.setBounds(this.getLoc()); playerBounds.setBounds(this.getLoc());
this.setBounds(playerBounds); this.setBounds(playerBounds);
//assign enum values for restrictions
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.absPromotionClass = ClassType.valueOf(this.getPromotionClass().getName());
if(this.isMale())
this.absGender = SexType.MALE;
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) {
if(this.absDisciplines == null)
this.absDisciplines = EnumSet.of(disc);
else
this.absDisciplines.add(disc);
}
} catch(Exception e){
}
}
} }
@Override @Override

Loading…
Cancel
Save