Minor code cleanup.
This commit is contained in:
@@ -105,7 +105,7 @@ public class ArmourTweaks {
|
||||
if(mod.enableArmourMovementModifications){
|
||||
logger.info("Starting armour movement modifications...");
|
||||
for(String armourName : mod.armourMovement.keySet()){
|
||||
int armourTemplate = 0;
|
||||
int armourTemplate;
|
||||
if(mod.armourNameToItemTemplate.containsKey(armourName)){
|
||||
armourTemplate = mod.armourNameToItemTemplate.get(armourName);
|
||||
}else{
|
||||
|
||||
@@ -34,8 +34,8 @@ implements WurmServerMod, Configurable, PreInitable, ItemTemplatesCreatedListene
|
||||
// Armour Mapping
|
||||
public String[] armourTypes = {"cloth", "leather", "studded", "chain", "plate", "drake", "dragonscale", // Worn armour pieces
|
||||
"scale", "ring", "splint"}; // Used by the system but not worn by players
|
||||
public HashMap<Integer, Float> armourTypeReduction = new HashMap<Integer, Float>();
|
||||
public HashMap<String, Integer> armourTypeReference = new HashMap<String, Integer>();
|
||||
public HashMap<Integer, Float> armourTypeReduction = new HashMap<>();
|
||||
public HashMap<String, Integer> armourTypeReference = new HashMap<>();
|
||||
// Armour modifiers
|
||||
public float adamantineMaterialMod = 0.05f;
|
||||
public float glimmersteelMaterialMod = 0.1f;
|
||||
@@ -49,10 +49,10 @@ implements WurmServerMod, Configurable, PreInitable, ItemTemplatesCreatedListene
|
||||
public float plateArmourLimitFactor = -0.3f;
|
||||
public float drakeArmourLimitFactor = -0.3f;
|
||||
public float dragonscaleArmourLimitFactor = -0.3f;
|
||||
public HashMap<Integer, Float> armourReductionOverride = new HashMap<Integer, Float>();
|
||||
public HashMap<Integer, Float> armourReductionOverride = new HashMap<>();
|
||||
// Armour movement
|
||||
public boolean enableArmourMovementModifications = true;
|
||||
public HashMap<String, Float> armourMovement = new HashMap<String, Float>();
|
||||
public HashMap<String, Float> armourMovement = new HashMap<>();
|
||||
|
||||
// - Shield configuration -- //
|
||||
public boolean enableShieldDamageEnchants = true;
|
||||
@@ -65,13 +65,13 @@ implements WurmServerMod, Configurable, PreInitable, ItemTemplatesCreatedListene
|
||||
public boolean fixSavedSwingTimer = true;
|
||||
public boolean betterDualWield = true; // HIGHLY EXPERIMENTAL
|
||||
// Weapon variable changes
|
||||
public HashMap<Integer, Float> weaponDamage = new HashMap<Integer, Float>();
|
||||
public HashMap<Integer, Float> weaponSpeed = new HashMap<Integer, Float>();
|
||||
public HashMap<Integer, Float> weaponCritChance = new HashMap<Integer, Float>();
|
||||
public HashMap<Integer, Integer> weaponReach = new HashMap<Integer, Integer>();
|
||||
public HashMap<Integer, Integer> weaponWeightGroup = new HashMap<Integer, Integer>();
|
||||
public HashMap<Integer, Float> weaponParryPercent = new HashMap<Integer, Float>();
|
||||
public HashMap<Integer, Double> weaponSkillPenalty = new HashMap<Integer, Double>();
|
||||
public HashMap<Integer, Float> weaponDamage = new HashMap<>();
|
||||
public HashMap<Integer, Float> weaponSpeed = new HashMap<>();
|
||||
public HashMap<Integer, Float> weaponCritChance = new HashMap<>();
|
||||
public HashMap<Integer, Integer> weaponReach = new HashMap<>();
|
||||
public HashMap<Integer, Integer> weaponWeightGroup = new HashMap<>();
|
||||
public HashMap<Integer, Float> weaponParryPercent = new HashMap<>();
|
||||
public HashMap<Integer, Double> weaponSkillPenalty = new HashMap<>();
|
||||
|
||||
public ArmouryMod(){
|
||||
this.logger = Logger.getLogger(this.getClass().getName());
|
||||
@@ -177,7 +177,7 @@ implements WurmServerMod, Configurable, PreInitable, ItemTemplatesCreatedListene
|
||||
double newVal = Double.parseDouble(split[1]);
|
||||
weaponSkillPenalty.put(weaponId, newVal);
|
||||
} else {
|
||||
//Debug("Unknown config property: " + name);
|
||||
Debug("Unknown config property: " + name);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@@ -251,15 +251,15 @@ implements WurmServerMod, Configurable, PreInitable, ItemTemplatesCreatedListene
|
||||
WeaponTweaks.onServerStarted(this);
|
||||
}
|
||||
|
||||
public HashMap<String, Integer> armourNameToItemTemplate = new HashMap<String, Integer>();
|
||||
public HashMap<String, Integer> armourNameToItemTemplate = new HashMap<>();
|
||||
|
||||
public ArrayList<Armour> clothArmour = new ArrayList<Armour>();
|
||||
public ArrayList<Armour> leatherArmour = new ArrayList<Armour>();
|
||||
public ArrayList<Armour> studdedArmour = new ArrayList<Armour>();
|
||||
public ArrayList<Armour> chainArmour = new ArrayList<Armour>();
|
||||
public ArrayList<Armour> plateArmour = new ArrayList<Armour>();
|
||||
public ArrayList<Armour> drakeArmour = new ArrayList<Armour>();
|
||||
public ArrayList<Armour> dragonscaleArmour = new ArrayList<Armour>();
|
||||
public ArrayList<Armour> clothArmour = new ArrayList<>();
|
||||
public ArrayList<Armour> leatherArmour = new ArrayList<>();
|
||||
public ArrayList<Armour> studdedArmour = new ArrayList<>();
|
||||
public ArrayList<Armour> chainArmour = new ArrayList<>();
|
||||
public ArrayList<Armour> plateArmour = new ArrayList<>();
|
||||
public ArrayList<Armour> drakeArmour = new ArrayList<>();
|
||||
public ArrayList<Armour> dragonscaleArmour = new ArrayList<>();
|
||||
|
||||
private void addArmour(ArrayList<Armour> typeList, int itemTemplate){
|
||||
ItemTemplate it = ItemTemplateFactory.getInstance().getTemplateOrNull(itemTemplate);
|
||||
|
||||
@@ -117,7 +117,6 @@ public class CombatTweaks {
|
||||
+ "}"
|
||||
+ "$_ = $proceed($$);"
|
||||
+ "communicator.sendAddSpellEffect($1, 100000, this.limitingArmourFactor*100.0f);");
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -19,8 +19,8 @@ import javassist.NotFoundException;
|
||||
public class ShieldTweaks {
|
||||
public static Logger logger = Logger.getLogger(ShieldTweaks.class.getName());
|
||||
public static boolean checkShieldSpeed(Item shield){
|
||||
if(shield != null && shield.getSpellSpeedBonus() > Server.rand.nextInt(500)){
|
||||
return true;
|
||||
if ((shield != null)) {
|
||||
return (shield.getSpellSpeedBonus() > Server.rand.nextInt(500));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -41,8 +41,7 @@ public class WeaponTweaks {
|
||||
try {
|
||||
Weapon cw;
|
||||
ItemTemplate it;
|
||||
String tweakType = "";
|
||||
if(mod.weaponDamage.keySet() != null){
|
||||
String tweakType;
|
||||
tweakType = "damage";
|
||||
logger.info("Beginning weapon "+tweakType+" tweaks...");
|
||||
for(int id : mod.weaponDamage.keySet()){
|
||||
@@ -58,7 +57,7 @@ public class WeaponTweaks {
|
||||
}
|
||||
float oldValue = ReflectionUtil.getPrivateField(cw, ReflectionUtil.getField(cw.getClass(), "damage"));
|
||||
float newValue = mod.weaponDamage.get(id);
|
||||
String diff = "";
|
||||
String diff;
|
||||
if(newValue > oldValue){
|
||||
diff = "+"+(newValue-oldValue);
|
||||
}else{
|
||||
@@ -67,8 +66,6 @@ public class WeaponTweaks {
|
||||
logger.info("Setting damage on "+it.sizeString+it.getName()+" to "+newValue+" from "+oldValue+" ("+diff+")");
|
||||
ReflectionUtil.setPrivateField(cw, ReflectionUtil.getField(cw.getClass(), "damage"), newValue);
|
||||
}
|
||||
}
|
||||
if(mod.weaponSpeed.keySet() != null){
|
||||
tweakType = "speed";
|
||||
logger.info("Beginning weapon "+tweakType+" tweaks...");
|
||||
for(int id : mod.weaponSpeed.keySet()){
|
||||
@@ -84,7 +81,7 @@ public class WeaponTweaks {
|
||||
}
|
||||
float oldValue = ReflectionUtil.getPrivateField(cw, ReflectionUtil.getField(cw.getClass(), "speed"));
|
||||
float newValue = mod.weaponSpeed.get(id);
|
||||
String diff = "";
|
||||
String diff;
|
||||
if(newValue > oldValue){
|
||||
diff = "+"+(newValue-oldValue);
|
||||
}else{
|
||||
@@ -93,8 +90,6 @@ public class WeaponTweaks {
|
||||
logger.info("Setting speed on "+it.sizeString+it.getName()+" to "+newValue+" from "+oldValue+" ("+diff+")");
|
||||
ReflectionUtil.setPrivateField(cw, ReflectionUtil.getField(cw.getClass(), "speed"), newValue);
|
||||
}
|
||||
}
|
||||
if(mod.weaponCritChance.keySet() != null){
|
||||
tweakType = "crit chance";
|
||||
logger.info("Beginning weapon "+tweakType+" tweaks...");
|
||||
for(int id : mod.weaponCritChance.keySet()){
|
||||
@@ -110,7 +105,7 @@ public class WeaponTweaks {
|
||||
}
|
||||
float oldValue = ReflectionUtil.getPrivateField(cw, ReflectionUtil.getField(cw.getClass(), "critchance"));
|
||||
float newValue = mod.weaponCritChance.get(id);
|
||||
String diff = "";
|
||||
String diff;
|
||||
if(newValue > oldValue){
|
||||
diff = "+"+(newValue-oldValue);
|
||||
}else{
|
||||
@@ -119,8 +114,6 @@ public class WeaponTweaks {
|
||||
logger.info("Setting crit chance on "+it.sizeString+it.getName()+" to "+newValue+" from "+oldValue+" ("+diff+")");
|
||||
ReflectionUtil.setPrivateField(cw, ReflectionUtil.getField(cw.getClass(), "critchance"), newValue);
|
||||
}
|
||||
}
|
||||
if(mod.weaponReach.keySet() != null){
|
||||
tweakType = "reach";
|
||||
logger.info("Beginning weapon "+tweakType+" tweaks...");
|
||||
for(int id : mod.weaponReach.keySet()){
|
||||
@@ -136,7 +129,7 @@ public class WeaponTweaks {
|
||||
}
|
||||
int oldValue = ReflectionUtil.getPrivateField(cw, ReflectionUtil.getField(cw.getClass(), "reach"));
|
||||
int newValue = mod.weaponReach.get(id);
|
||||
String diff = "";
|
||||
String diff;
|
||||
if(newValue > oldValue){
|
||||
diff = "+"+(newValue-oldValue);
|
||||
}else{
|
||||
@@ -145,8 +138,6 @@ public class WeaponTweaks {
|
||||
logger.info("Setting reach on "+it.sizeString+it.getName()+" to "+newValue+" from "+oldValue+" ("+diff+")");
|
||||
ReflectionUtil.setPrivateField(cw, ReflectionUtil.getField(cw.getClass(), "reach"), newValue);
|
||||
}
|
||||
}
|
||||
if(mod.weaponWeightGroup.keySet() != null){
|
||||
tweakType = "weight group";
|
||||
logger.info("Beginning weapon "+tweakType+" tweaks...");
|
||||
for(int id : mod.weaponWeightGroup.keySet()){
|
||||
@@ -162,7 +153,7 @@ public class WeaponTweaks {
|
||||
}
|
||||
int oldValue = ReflectionUtil.getPrivateField(cw, ReflectionUtil.getField(cw.getClass(), "weightGroup"));
|
||||
int newValue = mod.weaponWeightGroup.get(id);
|
||||
String diff = "";
|
||||
String diff;
|
||||
if(newValue > oldValue){
|
||||
diff = "+"+(newValue-oldValue);
|
||||
}else{
|
||||
@@ -171,8 +162,6 @@ public class WeaponTweaks {
|
||||
logger.info("Setting weight group on "+it.sizeString+it.getName()+" to "+newValue+" from "+oldValue+" ("+diff+")");
|
||||
ReflectionUtil.setPrivateField(cw, ReflectionUtil.getField(cw.getClass(), "weightGroup"), newValue);
|
||||
}
|
||||
}
|
||||
if(mod.weaponParryPercent.keySet() != null){
|
||||
tweakType = "parry percent";
|
||||
logger.info("Beginning weapon "+tweakType+" tweaks...");
|
||||
for(int id : mod.weaponParryPercent.keySet()){
|
||||
@@ -188,7 +177,7 @@ public class WeaponTweaks {
|
||||
}
|
||||
float oldValue = ReflectionUtil.getPrivateField(cw, ReflectionUtil.getField(cw.getClass(), "parryPercent"));
|
||||
float newValue = mod.weaponParryPercent.get(id);
|
||||
String diff = "";
|
||||
String diff;
|
||||
if(newValue > oldValue){
|
||||
diff = "+"+(newValue-oldValue);
|
||||
}else{
|
||||
@@ -197,8 +186,6 @@ public class WeaponTweaks {
|
||||
logger.info("Setting parry percent on "+it.sizeString+it.getName()+" to "+newValue+" from "+oldValue+" ("+diff+")");
|
||||
ReflectionUtil.setPrivateField(cw, ReflectionUtil.getField(cw.getClass(), "parryPercent"), newValue);
|
||||
}
|
||||
}
|
||||
if(mod.weaponSkillPenalty.keySet() != null){
|
||||
tweakType = "skill penalty";
|
||||
logger.info("Beginning weapon "+tweakType+" tweaks...");
|
||||
for(int id : mod.weaponSkillPenalty.keySet()){
|
||||
@@ -214,7 +201,7 @@ public class WeaponTweaks {
|
||||
}
|
||||
double oldValue = ReflectionUtil.getPrivateField(cw, ReflectionUtil.getField(cw.getClass(), "skillPenalty"));
|
||||
double newValue = mod.weaponSkillPenalty.get(id);
|
||||
String diff = "";
|
||||
String diff;
|
||||
if(newValue > oldValue){
|
||||
diff = "+"+(newValue-oldValue);
|
||||
}else{
|
||||
@@ -223,7 +210,6 @@ public class WeaponTweaks {
|
||||
logger.info("Setting skill penalty on "+it.sizeString+it.getName()+" to "+newValue+" from "+oldValue+" ("+diff+")");
|
||||
ReflectionUtil.setPrivateField(cw, ReflectionUtil.getField(cw.getClass(), "skillPenalty"), newValue);
|
||||
}
|
||||
}
|
||||
} catch (IllegalArgumentException | IllegalAccessException | ClassCastException | NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user