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