Browse Source

Refactored out character skill enum.

combat-2
MagicBot 8 months ago
parent
commit
84e74c5052
  1. 99
      src/engine/Enum.java
  2. 26
      src/engine/objects/ItemTemplate.java
  3. 2
      src/engine/objects/PlayerCharacter.java

99
src/engine/Enum.java

@ -1323,105 +1323,6 @@ public class Enum { @@ -1323,105 +1323,6 @@ public class Enum {
Sanctifier,
}
public enum CharacterSkills {
Animation,
Archery,
Athletics,
AxeMastery,
Axe,
Bardsong,
Bargaining,
Beastcraft,
Benediction,
BladeMastery,
BladeWeaving,
Block,
Bow,
Channeling,
Cloth,
Conditioning,
Crossbow,
DaggerMastery,
Dagger,
Dodge,
Dueling,
Enchantment,
Endurance,
FlameCalling,
Focus,
GreatAxeMastery,
GreatHammerMastery,
GreatSwordMastery,
HammerMastery,
Hammer,
Leadership,
Learning,
Liturgy,
Meditation,
NatureLore,
None,
Opening,
Parry,
PoleArmMastery,
PoleArm,
ResistanceAcid,
ResistanceCold,
ResistanceCrushing,
ResistanceDisease,
ResistanceEarth,
ResistanceFire,
ResistanceHoly,
ResistanceLightning,
ResistanceMagic,
ResistanceMental,
ResistancePiercing,
ResistancePoison,
ResistanceSlashing,
ResistanceUnholy,
Restoration,
Runecarving,
Running,
Shadowmastery,
Shapechanging,
Sorcery,
SpearMastery,
Spear,
StaffMastery,
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;
}
public enum GuildHistoryType {
JOIN(1),
LEAVE(4),

26
src/engine/objects/ItemTemplate.java

@ -50,8 +50,8 @@ public class ItemTemplate { @@ -50,8 +50,8 @@ public class ItemTemplate {
public int item_render_object_female;
public float item_health_full;
public int item_parry_anim_id;
public EnumSet<Enum.CharacterSkills> item_skill_used = EnumSet.noneOf(Enum.CharacterSkills.class);
public EnumSet<Enum.CharacterSkills> item_skill_mastery_used = EnumSet.noneOf(Enum.CharacterSkills.class);
public String item_skill_used = "";
public String item_skill_mastery_used = "";
public float item_bulk_factor;
public int item_defense_rating;
public float item_weapon_wepspeed;
@ -67,7 +67,7 @@ public class ItemTemplate { @@ -67,7 +67,7 @@ public class ItemTemplate {
public EnumSet<Enum.ItemFlags> item_flags = EnumSet.noneOf(Enum.ItemFlags.class);
public EnumSet<Enum.ItemUseFlags> item_use_flags = EnumSet.noneOf(Enum.ItemUseFlags.class);
public int item_initial_charges;
public HashMap<Enum.CharacterSkills, Integer> item_skill_required = new HashMap<>();
public HashMap<String, Integer> item_skill_required = new HashMap<>();
public EnumSet<Enum.MonsterType> item_race_req = EnumSet.noneOf(Enum.MonsterType.class);
public EnumSet<Enum.MonsterType> item_race_res = EnumSet.noneOf(Enum.MonsterType.class);
@ -163,21 +163,13 @@ public class ItemTemplate { @@ -163,21 +163,13 @@ public class ItemTemplate {
Object skill_used = jsonObject.get("item_skill_used");
if (skill_used instanceof String) {
String skilString = (String) skill_used;
skilString = skilString.replaceAll("\\s", "");
skilString = skilString.replaceAll(",", "");
item_skill_used.add(Enum.CharacterSkills.valueOf(skilString));
}
if (skill_used instanceof String)
item_skill_used = (String) skill_used;
Object mastery_used = jsonObject.get("item_skill_mastery_used");
if (mastery_used instanceof String) {
String masteryString = (String) mastery_used;
masteryString = masteryString.replaceAll("\\s", "");
masteryString = masteryString.replaceAll(",", "");
item_skill_mastery_used.add(Enum.CharacterSkills.valueOf(masteryString));
}
if (mastery_used instanceof String)
item_skill_mastery_used = (String) mastery_used;
item_parry_anim_id = ((Long) jsonObject.get("item_parry_anim_id")).intValue();
@ -258,10 +250,8 @@ public class ItemTemplate { @@ -258,10 +250,8 @@ public class ItemTemplate {
for (Object o : skill_required) {
JSONObject skill_req = (JSONObject) o;
String skill_type = (String) skill_req.get("skill_type");
skill_type = skill_type.replaceAll("\\s", "");
skill_type = skill_type.replaceAll(",", "");
int skill_level = ((Long) skill_req.get("skill_level")).intValue();
item_skill_required.put(Enum.CharacterSkills.valueOf(skill_type), skill_level);
item_skill_required.put(skill_type, skill_level);
}
JSONObject race_required = (JSONObject) jsonObject.get("item_race_req");

2
src/engine/objects/PlayerCharacter.java

@ -5485,7 +5485,7 @@ public class PlayerCharacter extends AbstractCharacter { @@ -5485,7 +5485,7 @@ public class PlayerCharacter extends AbstractCharacter {
public float getBargain() {
float bargain = 0;
CharacterSkill bargainSkill = this.getSkills().get(engine.Enum.CharacterSkills.Bargaining.name());
CharacterSkill bargainSkill = this.getSkills().get("Bargaining");
if (bargainSkill != null)
bargain = bargainSkill.getModifiedAmountBeforeMods();

Loading…
Cancel
Save