Update to fix ArmourTypes freeze.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
apply plugin: 'java'
|
apply plugin: 'java'
|
||||||
|
|
||||||
group "mod.sin"
|
group "mod.sin"
|
||||||
version "2.2"
|
version "2.3"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
@@ -10,7 +10,7 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'com.github.Sindusk:sindusklibrary:v1.5'
|
compile 'com.github.Sindusk:sindusklibrary:v1.6'
|
||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.wurmonline.server.items.*;
|
|||||||
import javassist.ClassPool;
|
import javassist.ClassPool;
|
||||||
import javassist.CtClass;
|
import javassist.CtClass;
|
||||||
import javassist.NotFoundException;
|
import javassist.NotFoundException;
|
||||||
|
import mod.sin.lib.ArmourAssist;
|
||||||
import mod.sin.lib.Util;
|
import mod.sin.lib.Util;
|
||||||
import mod.sin.lib.WoundAssist;
|
import mod.sin.lib.WoundAssist;
|
||||||
import org.gotti.wurmunlimited.modloader.ReflectionUtil;
|
import org.gotti.wurmunlimited.modloader.ReflectionUtil;
|
||||||
@@ -19,10 +20,8 @@ import java.util.logging.Logger;
|
|||||||
public class ArmourTweaks {
|
public class ArmourTweaks {
|
||||||
public static Logger logger = Logger.getLogger(ArmourTweaks.class.getName());
|
public static Logger logger = Logger.getLogger(ArmourTweaks.class.getName());
|
||||||
|
|
||||||
public static String[] armourTypes = {"cloth", "leather", "studded", "chain", "plate", "drake", "dragonscale", // Worn armour pieces
|
//public static 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 static HashMap<String, Integer> armourNameToType = new HashMap<>();
|
|
||||||
public static HashMap<Integer, String> armourTypeToName = new HashMap<>();
|
|
||||||
|
|
||||||
public static HashMap<Integer, Float> armourDamageReduction = new HashMap<>();
|
public static HashMap<Integer, Float> armourDamageReduction = new HashMap<>();
|
||||||
public static HashMap<Integer, HashMap<Byte, Float>> armourEffectiveness = new HashMap<>();
|
public static HashMap<Integer, HashMap<Byte, Float>> armourEffectiveness = new HashMap<>();
|
||||||
@@ -107,14 +106,8 @@ public class ArmourTweaks {
|
|||||||
toReturn *= materialGlanceRate.get(armourMaterial).get(damageType);
|
toReturn *= materialGlanceRate.get(armourMaterial).get(damageType);
|
||||||
//logger.info(String.format("Found material %s, adjusting glance rate by %.2f%%.", armourMaterial, materialGlanceRate.get(armourMaterial).get(damageType)));
|
//logger.info(String.format("Found material %s, adjusting glance rate by %.2f%%.", armourMaterial, materialGlanceRate.get(armourMaterial).get(damageType)));
|
||||||
}
|
}
|
||||||
String name = String.valueOf(armourType);
|
String name = ArmourAssist.getArmourName(armourType);
|
||||||
if(ArmourTweaks.armourTypeToName.containsKey(armourType)){
|
String wound = WoundAssist.getWoundName(damageType);
|
||||||
name = ArmourTweaks.armourTypeToName.get(armourType);
|
|
||||||
}
|
|
||||||
String wound = String.valueOf(damageType);
|
|
||||||
if(WoundAssist.woundTypeToName.containsKey(damageType)){
|
|
||||||
wound = WoundAssist.woundTypeToName.get(damageType);
|
|
||||||
}
|
|
||||||
//logger.info(String.format("Glance rate for %s against %s: %.2f", name, wound, toReturn));
|
//logger.info(String.format("Glance rate for %s against %s: %.2f", name, wound, toReturn));
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
@@ -265,7 +258,7 @@ public class ArmourTweaks {
|
|||||||
|
|
||||||
public static void initializeArmourMaps(){
|
public static void initializeArmourMaps(){
|
||||||
// Armour name mapping:
|
// Armour name mapping:
|
||||||
armourNameToType.put("cloth", ArmourTypes.ARMOUR_CLOTH);
|
/*armourNameToType.put("cloth", ArmourTypes.ARMOUR_CLOTH);
|
||||||
armourNameToType.put("leather", ArmourTypes.ARMOUR_LEATHER);
|
armourNameToType.put("leather", ArmourTypes.ARMOUR_LEATHER);
|
||||||
armourNameToType.put("studded", ArmourTypes.ARMOUR_STUDDED);
|
armourNameToType.put("studded", ArmourTypes.ARMOUR_STUDDED);
|
||||||
armourNameToType.put("chain", ArmourTypes.ARMOUR_CHAIN);
|
armourNameToType.put("chain", ArmourTypes.ARMOUR_CHAIN);
|
||||||
@@ -277,7 +270,7 @@ public class ArmourTweaks {
|
|||||||
armourNameToType.put("splint", ArmourTypes.ARMOUR_SPLINT);
|
armourNameToType.put("splint", ArmourTypes.ARMOUR_SPLINT);
|
||||||
for(String name : armourNameToType.keySet()){
|
for(String name : armourNameToType.keySet()){
|
||||||
armourTypeToName.put(armourNameToType.get(name), name);
|
armourTypeToName.put(armourNameToType.get(name), name);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
// Default material movement speed modifiers:
|
// Default material movement speed modifiers:
|
||||||
materialMovementModifier.put(Materials.MATERIAL_ADAMANTINE, 0.95f);
|
materialMovementModifier.put(Materials.MATERIAL_ADAMANTINE, 0.95f);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package mod.sin.armoury;
|
|||||||
import com.wurmonline.server.creatures.CreatureTemplate;
|
import com.wurmonline.server.creatures.CreatureTemplate;
|
||||||
import com.wurmonline.server.creatures.CreatureTemplateFactory;
|
import com.wurmonline.server.creatures.CreatureTemplateFactory;
|
||||||
import com.wurmonline.server.items.Materials;
|
import com.wurmonline.server.items.Materials;
|
||||||
|
import mod.sin.lib.ArmourAssist;
|
||||||
import mod.sin.lib.Prop;
|
import mod.sin.lib.Prop;
|
||||||
import mod.sin.lib.WoundAssist;
|
import mod.sin.lib.WoundAssist;
|
||||||
import org.gotti.wurmunlimited.modloader.interfaces.*;
|
import org.gotti.wurmunlimited.modloader.interfaces.*;
|
||||||
@@ -62,13 +63,6 @@ implements WurmServerMod, Configurable, PreInitable, ItemTemplatesCreatedListene
|
|||||||
public static HashMap<Integer, Float> weaponParryPercent = new HashMap<>();
|
public static HashMap<Integer, Float> weaponParryPercent = new HashMap<>();
|
||||||
public static HashMap<Integer, Double> weaponSkillPenalty = new HashMap<>();
|
public static HashMap<Integer, Double> weaponSkillPenalty = new HashMap<>();
|
||||||
|
|
||||||
public static int parseArmourType(String str){
|
|
||||||
if(ArmourTweaks.armourNameToType.containsKey(str.toLowerCase())){
|
|
||||||
return ArmourTweaks.armourNameToType.get(str.toLowerCase());
|
|
||||||
}
|
|
||||||
return Integer.parseInt(str);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static byte parseMaterialType(String str){
|
public static byte parseMaterialType(String str){
|
||||||
byte mat = Materials.convertMaterialStringIntoByte(str);
|
byte mat = Materials.convertMaterialStringIntoByte(str);
|
||||||
if(mat > 0){
|
if(mat > 0){
|
||||||
@@ -148,17 +142,17 @@ implements WurmServerMod, Configurable, PreInitable, ItemTemplatesCreatedListene
|
|||||||
armourReductionOverride.put(armourId, reductionValue);
|
armourReductionOverride.put(armourId, reductionValue);
|
||||||
} else if (name.startsWith("armourDamageReduction")) {
|
} else if (name.startsWith("armourDamageReduction")) {
|
||||||
String[] split = value.split(",");
|
String[] split = value.split(",");
|
||||||
int armourId = parseArmourType(split[0]);
|
int armourId = ArmourAssist.getArmourType(split[0]);
|
||||||
float reductionValue = Float.parseFloat(split[1]);
|
float reductionValue = Float.parseFloat(split[1]);
|
||||||
ArmourTweaks.addArmourDamageReduction(armourId, reductionValue);
|
ArmourTweaks.addArmourDamageReduction(armourId, reductionValue);
|
||||||
} else if (name.startsWith("armourEffectiveness")) {
|
} else if (name.startsWith("armourEffectiveness")) {
|
||||||
String[] split = value.split(";");
|
String[] split = value.split(";");
|
||||||
int armourType = parseArmourType(split[0]);
|
int armourType = ArmourAssist.getArmourType(split[0]);
|
||||||
String[] split2 = split[1].split(",");
|
String[] split2 = split[1].split(",");
|
||||||
ArmourTweaks.addArmourEffectiveness(armourType, split2);
|
ArmourTweaks.addArmourEffectiveness(armourType, split2);
|
||||||
} else if (name.startsWith("armourGlanceRate")) {
|
} else if (name.startsWith("armourGlanceRate")) {
|
||||||
String[] split = value.split(";");
|
String[] split = value.split(";");
|
||||||
int armourType = parseArmourType(split[0]);
|
int armourType = ArmourAssist.getArmourType(split[0]);
|
||||||
String[] split2 = split[1].split(",");
|
String[] split2 = split[1].split(",");
|
||||||
ArmourTweaks.addArmourGlanceRate(armourType, split2);
|
ArmourTweaks.addArmourGlanceRate(armourType, split2);
|
||||||
} else if (name.startsWith("materialDamageReduction")) {
|
} else if (name.startsWith("materialDamageReduction")) {
|
||||||
@@ -326,19 +320,21 @@ implements WurmServerMod, Configurable, PreInitable, ItemTemplatesCreatedListene
|
|||||||
logger.log(Level.INFO, "unarmouredReduction: " + ArmourTweaks.unarmouredReduction);
|
logger.log(Level.INFO, "unarmouredReduction: " + ArmourTweaks.unarmouredReduction);
|
||||||
logger.info("> Armour Base DR Settings <");
|
logger.info("> Armour Base DR Settings <");
|
||||||
for(int armourType : ArmourTweaks.armourDamageReduction.keySet()){
|
for(int armourType : ArmourTweaks.armourDamageReduction.keySet()){
|
||||||
String name = String.valueOf(armourType);
|
String name = ArmourAssist.getArmourName(armourType);
|
||||||
|
/*String name = String.valueOf(armourType);
|
||||||
if(ArmourTweaks.armourTypeToName.containsKey(armourType)){
|
if(ArmourTweaks.armourTypeToName.containsKey(armourType)){
|
||||||
name = ArmourTweaks.armourTypeToName.get(armourType);
|
name = ArmourTweaks.armourTypeToName.get(armourType);
|
||||||
}
|
}*/
|
||||||
//logger.info("Base DR for "+name+": "+(ArmourTweaks.armourDamageReduction.get(armourType)*100f) +"%");
|
//logger.info("Base DR for "+name+": "+(ArmourTweaks.armourDamageReduction.get(armourType)*100f) +"%");
|
||||||
logger.info(String.format("Base DR for %s: %.2f%%", name, ArmourTweaks.armourDamageReduction.get(armourType)*100f));
|
logger.info(String.format("Base DR for %s: %.2f%%", name, ArmourTweaks.armourDamageReduction.get(armourType)*100f));
|
||||||
}
|
}
|
||||||
logger.info("> Armour Effectiveness Settings <");
|
logger.info("> Armour Effectiveness Settings <");
|
||||||
for(int armourType : ArmourTweaks.armourEffectiveness.keySet()){
|
for(int armourType : ArmourTweaks.armourEffectiveness.keySet()){
|
||||||
String name = String.valueOf(armourType);
|
String name = ArmourAssist.getArmourName(armourType);
|
||||||
|
/*String name = String.valueOf(armourType);
|
||||||
if(ArmourTweaks.armourTypeToName.containsKey(armourType)){
|
if(ArmourTweaks.armourTypeToName.containsKey(armourType)){
|
||||||
name = ArmourTweaks.armourTypeToName.get(armourType);
|
name = ArmourTweaks.armourTypeToName.get(armourType);
|
||||||
}
|
}*/
|
||||||
HashMap<Byte, Float> woundMap = ArmourTweaks.armourEffectiveness.get(armourType);
|
HashMap<Byte, Float> woundMap = ArmourTweaks.armourEffectiveness.get(armourType);
|
||||||
for(byte woundType : woundMap.keySet()){
|
for(byte woundType : woundMap.keySet()){
|
||||||
String wound = WoundAssist.getWoundName(woundType);
|
String wound = WoundAssist.getWoundName(woundType);
|
||||||
@@ -348,10 +344,11 @@ implements WurmServerMod, Configurable, PreInitable, ItemTemplatesCreatedListene
|
|||||||
}
|
}
|
||||||
logger.info("> Armour Glance Rate Settings <");
|
logger.info("> Armour Glance Rate Settings <");
|
||||||
for(int armourType : ArmourTweaks.armourGlanceRates.keySet()){
|
for(int armourType : ArmourTweaks.armourGlanceRates.keySet()){
|
||||||
String name = String.valueOf(armourType);
|
String name = ArmourAssist.getArmourName(armourType);
|
||||||
|
/*String name = String.valueOf(armourType);
|
||||||
if(ArmourTweaks.armourTypeToName.containsKey(armourType)){
|
if(ArmourTweaks.armourTypeToName.containsKey(armourType)){
|
||||||
name = ArmourTweaks.armourTypeToName.get(armourType);
|
name = ArmourTweaks.armourTypeToName.get(armourType);
|
||||||
}
|
}*/
|
||||||
HashMap<Byte, Float> woundMap = ArmourTweaks.armourGlanceRates.get(armourType);
|
HashMap<Byte, Float> woundMap = ArmourTweaks.armourGlanceRates.get(armourType);
|
||||||
for(byte woundType : woundMap.keySet()){
|
for(byte woundType : woundMap.keySet()){
|
||||||
String wound = WoundAssist.getWoundName(woundType);
|
String wound = WoundAssist.getWoundName(woundType);
|
||||||
@@ -506,8 +503,8 @@ implements WurmServerMod, Configurable, PreInitable, ItemTemplatesCreatedListene
|
|||||||
public void onServerStarted(){
|
public void onServerStarted(){
|
||||||
WeaponTweaks.onServerStarted();
|
WeaponTweaks.onServerStarted();
|
||||||
for(CreatureTemplate template : CreatureTemplateFactory.getInstance().getTemplates()){
|
for(CreatureTemplate template : CreatureTemplateFactory.getInstance().getTemplates()){
|
||||||
if(ArmourTweaks.armourTypeToName.containsKey((int) template.getArmourType())) {
|
if(ArmourAssist.armourTypeToName.containsKey((int) template.getArmourType())) {
|
||||||
logger.info(template.getName() + " - " + ArmourTweaks.armourTypeToName.get((int) template.getArmourType()));
|
logger.info(template.getName() + " - " + ArmourAssist.armourTypeToName.get((int) template.getArmourType()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user