Reworked CharacterSkill enum.

This commit is contained in:
2024-02-23 11:58:56 -05:00
parent 62e13ade01
commit 4e2578f3e0
2 changed files with 96 additions and 110 deletions
+93 -102
View File
@@ -1390,109 +1390,100 @@ public class Enum {
public enum CharacterSkills { public enum CharacterSkills {
Archery((1L << 1), -529201545, 20), Animation,
Athletics((1L << 2), -327713877, 15), Archery,
AxeMastery((1L << 3), 1103042709, 20), Athletics,
Axe((1L << 4), 73505, 1), AxeMastery,
Bardsong((1L << 5), 454246953, 10), Axe,
Bargaining((1L << 6), 372927577, 10), Bardsong,
Beastcraft((1L << 7), 56772766, 10), Bargaining,
Benediction((1L << 8), 1464998706, 1), Beastcraft,
BladeMastery((1L << 9), -59908956, 20), Benediction,
BladeWeaving((1L << 10), -1839362429, 20), BladeMastery,
Block((1L << 11), 76592546, 3), BladeWeaving,
Bow((1L << 12), 87490, 1), Block,
Channeling((1L << 13), -1899060872, 20), Bow,
Crossbow((1L << 14), 1092138184, 1), Channeling,
DaggerMastery((1L << 15), -1549224741, 20), Cloth,
Dagger((1L << 16), -1603103740, 1), Conditioning,
Dodge((1L << 17), 74619332, 5), Crossbow,
FlameCalling((1L << 18), -1839578206, 20), DaggerMastery,
GreatAxeMastery((1L << 19), 1427003458, 20), Dagger,
GreatHammerMastery((1L << 20), -309659310, 20), Dodge,
GreatSwordMastery((1L << 21), 2054956946, 20), Dueling,
HammerMastery((1L << 22), -1548903209, 20), Enchantment,
Hammer((1L << 23), -1602765816, 1), Endurance,
Leadership((1L << 24), 1618560984, 20), FlameCalling,
Liturgy((1L << 25), -888415974, 10), Focus,
NatureLore((1L << 26), -1911171474, 10), GreatAxeMastery,
Parry((1L << 27), 95961104, 5), GreatHammerMastery,
PoleArmMastery((1L << 28), -1432303709, 20), GreatSwordMastery,
PoleArm((1L << 29), -1037845588, 1), HammerMastery,
Restoration((1L << 30), -504697054, 1), HammerLeadership,
Running((1L << 31), 1488335491, 10), Learning,
Shadowmastery((1L << 32), 1389222957, 10), Liturgy,
Sorcery((1L << 33), -529481275, 1), Meditation,
SpearMastery((1L << 34), -48279755, 20), NatureLore,
Spear((1L << 35), 83992115, 1), None,
StaffMastery((1L << 36), -61022283, 20), Opening,
Staff((1L << 37), 71438003, 1), Parry,
Stormcalling((1L << 38), -532064061, 10), PoleArmMastery,
SwordMastery((1L << 39), -59316267, 20), PoleArm,
Sword((1L << 40), 73938643, 1), ResistanceAcid,
Thaumaturgy((1L << 41), -2020131447, 10), ResistanceCold,
Theurgy((1L << 42), -888431326, 10), ResistanceCrushing,
Throwing((1L << 43), 391562015, 20), ResistanceDisease,
Toughness((1L << 44), -660435875, 10), ResistanceEarth,
UnarmedCombatMastery((1L << 45), 1692733771, 20), ResistanceFire,
UnarmedCombat((1L << 46), -1094332856, 1), ResistanceHoly,
Warding((1L << 47), 1488142342, 1), ResistanceLightning,
Warlockry((1L << 48), 1121393557, 10), ResistanceMagic,
WayoftheGaana((1L << 49), -1954832975, 10), ResistanceMental,
WearArmorHeavy((1L << 50), 1112121635, 15), ResistancePiercing,
WearArmorLight((1L << 51), 38031547, 1), ResistancePoison,
WearArmorMedium((1L << 52), 468015203, 5), ResistanceSlashing,
Wizardry((1L << 53), 218227659, 10), ResistanceUnholy,
Corruption((1L << 54), -1519268706, 10), Restoration,
Abjuration((1L << 55), -2029900484, 10), Runecarving,
WayoftheWolf((1L << 56), 1668913067, 20), Running,
WayoftheRat((1L << 57), -2114353637, 20), Shadowmastery,
WayoftheBear((1L << 58), -906390863, 20), Shapechanging,
Orthanatos((1L << 59), -666929185, 20), Sorcery,
Bloodcraft((1L << 60), 40661438, 10), SpearMastery,
Exorcism((1L << 61), 1444427097, 10), Spear,
Necromancy((1L << 62), -556571154, 10), StaffMastery,
SunDancing((1L << 63), 22329752, 20); Staff,
Stormcalling,
Subterfuge,
Summoning,
SwordMastery,
Sword,
Thaumaturgy,
Theurgy,
Throwing,
Toughness,
UnarmedCombatMastery,
UnarmedCombat,
Unknown,
Warding,
Warlockry,
WayoftheGaana,
WearArmorHeavy,
WearArmorLight,
WearArmorMedium,
Willpower,
Wizardry,
Corruption,
Abjuration,
WayoftheWolf,
WayoftheRat,
WayoftheBear,
Orthanatos,
Bloodcraft,
Exorcism,
Necromancy,
SunDancing;
private final int reqLvl;
private long flag;
private int token;
CharacterSkills(long flag, int token, int reqLvl) {
this.flag = flag;
this.token = token;
this.reqLvl = reqLvl;
}
public static CharacterSkills GetCharacterSkillByToken(int token) {
for (CharacterSkills skill : CharacterSkills.values()) {
if (skill.token == token)
return skill;
}
Logger.info("Returned No Skill for token " + token + ". Defaulting to Axe");
return CharacterSkills.Axe;
}
public long getFlag() {
return flag;
}
public void setFlag(long flag) {
this.flag = flag;
}
public int getReqLvl() {
return this.reqLvl;
}
public int getToken() {
return token;
}
public void setToken(int token) {
this.token = token;
}
} }
public enum GuildHistoryType { public enum GuildHistoryType {
+3 -8
View File
@@ -10,7 +10,6 @@
package engine.objects; package engine.objects;
import engine.Enum; import engine.Enum;
import engine.Enum.CharacterSkills;
import engine.Enum.ModType; import engine.Enum.ModType;
import engine.Enum.SourceType; import engine.Enum.SourceType;
import engine.gameManager.DbManager; import engine.gameManager.DbManager;
@@ -195,8 +194,6 @@ public class CharacterSkill extends AbstractGameObject {
private SkillsBase skillsBase; private SkillsBase skillsBase;
private AtomicInteger numTrains = new AtomicInteger(); private AtomicInteger numTrains = new AtomicInteger();
private CharacterSkills skillType;
//Skill% before trains and before any effects or item bonuses //Skill% before trains and before any effects or item bonuses
private float baseAmountBeforeMods; private float baseAmountBeforeMods;
@@ -224,7 +221,6 @@ public class CharacterSkill extends AbstractGameObject {
this.ownerUID = pc.getObjectUUID(); this.ownerUID = pc.getObjectUUID();
calculateBaseAmount(); calculateBaseAmount();
calculateModifiedAmount(false); calculateModifiedAmount(false);
this.skillType = CharacterSkills.GetCharacterSkillByToken(this.skillsBase.getToken());
} }
/** /**
@@ -239,7 +235,7 @@ public class CharacterSkill extends AbstractGameObject {
this.trained = true; this.trained = true;
calculateBaseAmount(); calculateBaseAmount();
calculateModifiedAmount(false); calculateModifiedAmount(false);
this.skillType = CharacterSkills.GetCharacterSkillByToken(this.skillsBase.getToken());
} }
@@ -255,7 +251,7 @@ public class CharacterSkill extends AbstractGameObject {
this.ownerUID = pc.getObjectUUID(); this.ownerUID = pc.getObjectUUID();
calculateBaseAmount(); calculateBaseAmount();
calculateModifiedAmount(false); calculateModifiedAmount(false);
this.skillType = CharacterSkills.GetCharacterSkillByToken(this.skillsBase.getToken());
} }
public CharacterSkill(SkillsBase sb, Mob mob, int trains) { public CharacterSkill(SkillsBase sb, Mob mob, int trains) {
@@ -267,7 +263,7 @@ public class CharacterSkill extends AbstractGameObject {
boolean isGuard = mob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN) || mob.agentType.equals(Enum.AIAgentType.GUARDMINION); boolean isGuard = mob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN) || mob.agentType.equals(Enum.AIAgentType.GUARDMINION);
calculateMobBaseAmount(isGuard); calculateMobBaseAmount(isGuard);
calculateModifiedAmount(isGuard); calculateModifiedAmount(isGuard);
this.skillType = CharacterSkills.GetCharacterSkillByToken(this.skillsBase.getToken());
} }
public CharacterSkill(ResultSet rs) throws SQLException { public CharacterSkill(ResultSet rs) throws SQLException {
@@ -279,7 +275,6 @@ public class CharacterSkill extends AbstractGameObject {
// this.owner = DbManager.PlayerCharacterQueries.GET_PLAYER_CHARACTER(rs.getInt("CharacterID")); // this.owner = DbManager.PlayerCharacterQueries.GET_PLAYER_CHARACTER(rs.getInt("CharacterID"));
calculateBaseAmount(); calculateBaseAmount();
calculateModifiedAmount(false); calculateModifiedAmount(false);
this.skillType = CharacterSkills.GetCharacterSkillByToken(this.skillsBase.getToken());
} }
public static AbstractCharacter GetOwner(CharacterSkill cs) { public static AbstractCharacter GetOwner(CharacterSkill cs) {