Update to WU 1.8.
Removal of all Armour-related options. Removed options for fixArmourLimitSpellEffect and fixArmourLimitBuffBug. These were fixed in vanilla WU 1.8.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
apply plugin: 'java'
|
apply plugin: 'java'
|
||||||
|
|
||||||
group "mod.sin"
|
group "mod.sin"
|
||||||
version "2.4"
|
version "3.0"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
@@ -10,7 +10,8 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'com.github.Sindusk:sindusklibrary:v1.6'
|
compile 'org.gotti.wurmunlimited:server-modlauncher:0.39-beta1'
|
||||||
|
compile 'com.github.Sindusk:sindusklibrary:v1.7'
|
||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
|
|||||||
@@ -8,175 +8,11 @@ sharedClassLoader=true
|
|||||||
#enableNonPlayerCrits: Allows critical strikes against non-player characters. In vanilla Wurm, creatures can only deal critical strikes against players.
|
#enableNonPlayerCrits: Allows critical strikes against non-player characters. In vanilla Wurm, creatures can only deal critical strikes against players.
|
||||||
# Note: this will allow creatures to crit creatures as well, so tamed/charmed/dominated creatures can also be critically hit by aggressive mobs.
|
# Note: this will allow creatures to crit creatures as well, so tamed/charmed/dominated creatures can also be critically hit by aggressive mobs.
|
||||||
enableNonPlayerCrits=true
|
enableNonPlayerCrits=true
|
||||||
#fixArmourLimitBuffBug: Go into a server without this enabled. Equip a full set of plate. Take it off. Look at your buff bar. This fixes that. It's added as an option in case a WU update breaks the hook.
|
|
||||||
fixArmourLimitBuffBug=true
|
|
||||||
#fixArmourLimitSpellEffect: Similar to the above, the Spell Effect in the Spell Effects window of the game doesn't show armour limits properly. This helps correct that mistake. Option in case WU update breaks the hook.
|
|
||||||
fixArmourLimitSpellEffect=true
|
|
||||||
|
|
||||||
# -- Armour configuration section -- #
|
|
||||||
#enableArmourReductionModifications: Enable to enable the whole armour configuration section and material configuration section.
|
|
||||||
# Disabling this will eliminate almost everything that Armoury does to armour.
|
|
||||||
enableArmourModifications=true
|
|
||||||
|
|
||||||
#Armour types:
|
|
||||||
# Leather = 1 ; Studded = 2 ; Chain = 3 ; Plate = 4 ; *Ring = 5
|
|
||||||
# Cloth = 6 ; *Scale = 7 ; *Splint = 8 ; Drake = 9 ; Dragonscale = 10
|
|
||||||
# Note: Types marked with * do not have an in-game armour associated with them.
|
|
||||||
# These values can be useful for the creation of custom armours, though.
|
|
||||||
|
|
||||||
# > Armour Reduction < #
|
|
||||||
#This section allows you to configure the armour damage reduction values for each armour type. The values displayed here are the damage reduction multiplier at 100QL, scaling down using the Wurm formula.
|
|
||||||
# For example: plate is by default 0.7, giving 70% damage reduction to incoming attacks for a 100QL steel plate set.
|
|
||||||
# I have my own personal tastes when it comes to the armour reduction, so I will leave the default configuration commented out if you wish to use it, then include my personal setup.
|
|
||||||
|
|
||||||
# Unarmoured reduction is applied to most creatures, and scales using Oakshell. While the option is here, I recommend leaving it set at the default 0.05.
|
|
||||||
unarmouredReduction=0.05
|
|
||||||
|
|
||||||
#armourDamageReduction: Adjust the base DR of certain armour types
|
|
||||||
# Syntax: armourDamageReduction-##:material,reduction
|
|
||||||
# Example: armourDamageReduction-1:6,0.40
|
|
||||||
# The example sets cloth (6) armour to have 40% damage reduction at 100QL.
|
|
||||||
# Quality scales the damage reduction
|
|
||||||
#> Default Configuration:
|
|
||||||
# Leather
|
|
||||||
#armourDamageReduction-1:1,0.50
|
|
||||||
# Studded
|
|
||||||
#armourDamageReduction-2:2,0.55
|
|
||||||
# Chain
|
|
||||||
#armourDamageReduction-3:3,0.60
|
|
||||||
# Plate
|
|
||||||
#armourDamageReduction-4:4,0.70
|
|
||||||
# *Ring
|
|
||||||
#armourDamageReduction-5:5,0.55
|
|
||||||
# Cloth
|
|
||||||
#armourDamageReduction-6:6,0.40
|
|
||||||
# *Scale
|
|
||||||
#armourDamageReduction-7:7,0.50
|
|
||||||
# *Splint
|
|
||||||
#armourDamageReduction-8:8,0.60
|
|
||||||
# Drake
|
|
||||||
#armourDamageReduction-9:9,0.70
|
|
||||||
# Dragonscale
|
|
||||||
#armourDamageReduction-10:10,0.75
|
|
||||||
#Custom configuration [EPIC]:
|
|
||||||
armourDamageReduction-6:cloth,0.50
|
|
||||||
armourDamageReduction-1:leather,0.60
|
|
||||||
armourDamageReduction-2:studded,0.625
|
|
||||||
armourDamageReduction-3:chain,0.625
|
|
||||||
armourDamageReduction-4:plate,0.65
|
|
||||||
armourDamageReduction-9:drake,0.65
|
|
||||||
armourDamageReduction-10:dragonscale,0.70
|
|
||||||
# Unused types:
|
|
||||||
armourDamageReduction-5:5,0.55
|
|
||||||
armourDamageReduction-7:7,0.50
|
|
||||||
armourDamageReduction-8:8,0.60
|
|
||||||
# - OLD - Custom configuration [EPIC] (Worn armour):
|
|
||||||
#clothReduction=0.5
|
|
||||||
#leatherReduction=0.6
|
|
||||||
#studdedReduction=0.625
|
|
||||||
#chainReduction=0.625
|
|
||||||
#plateReduction=0.70
|
|
||||||
#drakeReduction=0.70
|
|
||||||
#dragonscaleReduction=0.75
|
|
||||||
#These are either unused or applied to creatures, not worn by players. I do not recommend changing them unless you know what you're doing
|
|
||||||
#scaleReduction=0.5
|
|
||||||
#ringReduction=0.55
|
|
||||||
#splintReduction=0.6
|
|
||||||
|
|
||||||
# > Armour Effectiveness < #
|
|
||||||
#armourEffectiveness: Adjust the effectiveness of an armour type against a wound type.
|
|
||||||
# Wound Types:
|
|
||||||
# Crush = 0 ; Slash = 1 ; Pierce = 2 ; Bite = 3 ; Burn = 4 ; Poison = 5
|
|
||||||
# Infection = 6 ; Water = 7 ; Cold = 8 ; Internal = 9 ; Acid = 10
|
|
||||||
# Syntax: armourEffectiveness-##:armourtype;woundtype,effectiveness
|
|
||||||
# Example: armourEffectiveness-1:9;8,1.05
|
|
||||||
# The example sets drake (9) armour to have 105% effectiveness (+5% more DR) against cold (8)
|
|
||||||
# Alternative to wound types, you can also use the keys "physical" "elemental" and "other"
|
|
||||||
# Physical: Crush (0), Slash (1), Pierce (2), Bite (3)
|
|
||||||
# Elemental: Burn (4), Cold (8), Acid (10)
|
|
||||||
# Other: Poison (5), Infection (6), Water (7), Internal (9)
|
|
||||||
armourEffectiveness-1:cloth;bite,0.90
|
|
||||||
armourEffectiveness-2:dragonscale;burn,1.10
|
|
||||||
|
|
||||||
#> Armour Glance Rates < #
|
|
||||||
#armourGlanceRate: Adjust the glance rate of an armour type against a wound type.
|
|
||||||
armourGlanceRate-1:dragonscale;crush,0.20
|
|
||||||
armourGlanceRate-2:drake;slash,0.30
|
|
||||||
|
|
||||||
# > Custom Item ID Overrides < #
|
# > Custom Item ID Overrides < #
|
||||||
#These are used to override the damage reduction calculation per item ID.
|
#These are used to override the damage reduction calculation per item ID.
|
||||||
# If you want to add challenge helms, masks, and similar here, you are welcome to do so and have their DR work.
|
# If you want to add challenge helms, masks, and similar here, you are welcome to do so and have their DR work.
|
||||||
|
|
||||||
# - My custom server settings - #
|
|
||||||
#Spectral Armour
|
|
||||||
armourReductionOverride-100:22702,0.70
|
|
||||||
armourReductionOverride-101:22701,0.70
|
|
||||||
armourReductionOverride-102:22700,0.70
|
|
||||||
armourReductionOverride-103:22699,0.70
|
|
||||||
armourReductionOverride-104:22710,0.70
|
|
||||||
armourReductionOverride-105:22698,0.70
|
|
||||||
#Glimmerscale Armour
|
|
||||||
armourReductionOverride-106:22689,0.64
|
|
||||||
armourReductionOverride-107:22688,0.64
|
|
||||||
armourReductionOverride-108:22687,0.64
|
|
||||||
armourReductionOverride-109:22686,0.64
|
|
||||||
armourReductionOverride-110:22685,0.64
|
|
||||||
armourReductionOverride-111:22690,0.64
|
|
||||||
|
|
||||||
|
|
||||||
# > Material Modifiers < #
|
|
||||||
#These are material modifier definitions. Items made from these materials will have the benefits listed.
|
|
||||||
# List of metallic material ids:
|
|
||||||
# Gold - 7 ; Silver - 8 ; Steel - 9 ; Copper - 10 ; Iron - 11 ; Lead - 12 ; Zinc - 13
|
|
||||||
# Brass - 30 ; Bronze - 31 ; Tin - 34 ; Adamantine - 56 ; Glimmersteel - 57 ; Seryll - 67
|
|
||||||
# Full list of materials for other types can be found under the "Materials" tab on this spreadsheet:
|
|
||||||
# https://docs.google.com/spreadsheets/d/15LXwuTEXdoBbd5agghwDslb-a5xOpA2u1lYshYMxW8A/edit#gid=311529250
|
|
||||||
|
|
||||||
#> Damage Reduction
|
|
||||||
# **ADDITIVE** damage reduction if the armour is created from this material. This is very specifically what it says after the item.
|
|
||||||
# Example: "chain jacket, iron" would use the iron modifier (11). Even if the armour type is different, the material is still used.
|
|
||||||
# Example 2: "dragonscale jacket, glimmersteel" would use the dragonscale base armour value and add the glimmersteel property below.
|
|
||||||
#materialDamageReduction: Additional percentage of damage reduction from material.
|
|
||||||
# For example, adamantine by default gives 0.05, meaning 5% damage reduction on top the 70% that plate gives.
|
|
||||||
# Adamantine plate would give 75% damage reduction at 100QL with this setting.
|
|
||||||
# Note that if no value is set, the default wurm values will be used.
|
|
||||||
# If you want to remove the DR penalty for lead armour, you'll have to use materialDamageReduction-##:12,0.00
|
|
||||||
# Ensure that each property has it's own unique identifier number and none of them clash.
|
|
||||||
|
|
||||||
# Default non-epic values for moon metals:
|
|
||||||
#materialDamageReduction-1:56,0.05
|
|
||||||
#materialDamageReduction-2:57,0.10
|
|
||||||
#materialDamageReduction-3:67,0.10
|
|
||||||
|
|
||||||
# Default epic values for moon metals:
|
|
||||||
#materialDamageReduction-1:adamantine,0.05
|
|
||||||
#materialDamageReduction-2:glimmersteel,0.05
|
|
||||||
#materialDamageReduction-3:seryll,0.05
|
|
||||||
|
|
||||||
# - My custom server settings - #
|
|
||||||
materialDamageReduction-1:adamantine,0.04
|
|
||||||
materialDamageReduction-2:glimmersteel,0.05
|
|
||||||
materialDamageReduction-3:seryll,0.06
|
|
||||||
|
|
||||||
#materialMovementModifier: Adjust the movement speed penalty of any armour created from this material.
|
|
||||||
# This is a multiplier on the base movement speed penalty.
|
|
||||||
materialMovementModifier-1:adamantine,0.96
|
|
||||||
|
|
||||||
#materialEffectiveness: Adjust the material DR effectiveness against certain wound types.
|
|
||||||
# This is a multiplier on the base DR.
|
|
||||||
# Wound Types:
|
|
||||||
# Crush = 0 ; Slash = 1 ; Pierce = 2 ; Bite = 3 ; Burn = 4 ; Poison = 5
|
|
||||||
# Infection = 6 ; Water = 7 ; Cold = 8 ; Internal = 9 ; Acid = 10
|
|
||||||
# Syntax: materialEffectiveness-##:material;woundtype,effectiveness
|
|
||||||
# Example: materialEffectiveness-1:56;3,1.05
|
|
||||||
# The example sets adamantine (56) armour to have 105% effectiveness (+5% more DR) against bites (3)
|
|
||||||
# Note this is a modifier on the base DR values.
|
|
||||||
# Alternative to wound types, you can also use the keys "physical" "elemental" and "other"
|
|
||||||
# Physical: Crush (0), Slash (1), Pierce (2), Bite (3)
|
|
||||||
# Elemental: Burn (4), Cold (8), Acid (10)
|
|
||||||
# Other: Poison (5), Infection (6), Water (7), Internal (9)
|
|
||||||
materialEffectiveness-1:adamantine;crush,1.02
|
|
||||||
|
|
||||||
#materialGlanceRate: Adjust the glance rate of an armour against a certain wound type if created from a specified material.
|
#materialGlanceRate: Adjust the glance rate of an armour against a certain wound type if created from a specified material.
|
||||||
# This is a multiplier on the base glance rate.
|
# This is a multiplier on the base glance rate.
|
||||||
materialGlanceRate-1:adamantine;physical,1.02
|
materialGlanceRate-1:adamantine;physical,1.02
|
||||||
@@ -288,58 +124,6 @@ materialRepairSpeed-5:steel,1.00
|
|||||||
# Lower values reduce bash damage, higher values increase bash damage. 1.10 = 10% more bash damage. 0.90 = 10% less bash damage.
|
# Lower values reduce bash damage, higher values increase bash damage. 1.10 = 10% more bash damage. 0.90 = 10% less bash damage.
|
||||||
materialBashModifier-1:copper,0.92
|
materialBashModifier-1:copper,0.92
|
||||||
|
|
||||||
# > Limit Factor < #
|
|
||||||
#enableCustomArmourLimitFactors: This will enable or disable the usage of the section below entirely.
|
|
||||||
enableCustomArmourLimitFactors=true
|
|
||||||
#These values are meant to determine the bonus or reduction to spellcasting and archery while wearing armour.
|
|
||||||
# ** Valid values are between -0.99 and 0.3 only. Anything lower than -0.99 risks damaging the calculations in the game. Anything over 0.3 will simply apply as 0.3.
|
|
||||||
# I personally do not like the original setup of them, and will only leave a commented out "vanilla" setup, then using my own below.
|
|
||||||
#Vanilla Setup:
|
|
||||||
#clothArmourLimitFactor=0.3
|
|
||||||
#leatherArmourLimitFactor=0.3
|
|
||||||
#studdedArmourLimitFactor=0
|
|
||||||
#chainArmourLimitFactor=-0.15
|
|
||||||
#plateArmourLimitFactor=-0.3
|
|
||||||
#drakeArmourLimitFactor=-0.3
|
|
||||||
#dragonscaleArmourLimitFactor=-0.3
|
|
||||||
#Custom setup:
|
|
||||||
clothArmourLimitFactor=0.3
|
|
||||||
leatherArmourLimitFactor=0.3
|
|
||||||
studdedArmourLimitFactor=0.15
|
|
||||||
chainArmourLimitFactor=0.0
|
|
||||||
plateArmourLimitFactor=-0.15
|
|
||||||
drakeArmourLimitFactor=0.15
|
|
||||||
dragonscaleArmourLimitFactor=0
|
|
||||||
# > Movement Modifications < #
|
|
||||||
#enableArmourMovementModifications: This will enable or disable the usage of the section below entirely.
|
|
||||||
enableArmourMovementModifications=true
|
|
||||||
#This section will allow you to edit the percent reduction on all the default armor pieces.
|
|
||||||
#Simply add a property "armourMovement" then a dash and number. No two properties can be the same, so ensure they are all unique.
|
|
||||||
#> Setting plate body armour to 0.08 movement instead of 0.09
|
|
||||||
armourMovement-1:breast plate,0.06
|
|
||||||
#> Setting plate leggings to 0.08 movement instead of 0.09
|
|
||||||
armourMovement-2:plate leggings,0.06
|
|
||||||
|
|
||||||
# - My custom server settings - #
|
|
||||||
armourMovement-100:great helm,0.02
|
|
||||||
armourMovement-101:basinet helm,0.02
|
|
||||||
armourMovement-102:open helm,0.02
|
|
||||||
armourMovement-103:chain jacket,0.05
|
|
||||||
armourMovement-104:chain pants,0.05
|
|
||||||
armourMovement-105:studded leather jacket,0.04
|
|
||||||
armourMovement-106:studded leather pants,0.04
|
|
||||||
armourMovement-107:leather jacket,0.03
|
|
||||||
armourMovement-108:leather pants,0.03
|
|
||||||
|
|
||||||
#Full list of vanilla Wurm armour piece names:
|
|
||||||
# cloth hood ; cloth sleeve ; cloth jacket ; cloth shirt ; cloth glove ; cloth pants ; cloth shoe
|
|
||||||
# leather adventurer hat ; leather cap ; leather sleeve ; leather jacket ; leather glove ; leather pants ; leather boot
|
|
||||||
# studded leather cap ; studded leather sleeve ; studded leather jacket ; studded leather glove ; studded leather pants ; studded leather boot
|
|
||||||
# chain coif ; chain sleeve ; chain jacket ; chain gauntlet ; chain pants ; chain boot
|
|
||||||
# great helm ; basinet helm ; open helm ; plate vambrace ; breast plate ; plate gauntlet ; plate leggings ; plate sabaton
|
|
||||||
# drake hide cap ; drake hide sleeve ; drake hide jacket ; drake hide glove ; drake hide pants ; drake hide boot
|
|
||||||
# dragon scale sleeve ; dragon scale jacket ; dragon scale glove ; dragon scale pants ; dragon scale boot
|
|
||||||
|
|
||||||
# -- Shield Configuration Section -- #
|
# -- Shield Configuration Section -- #
|
||||||
#enableShieldDamageEnchants: This will allow AOSP to work as a reflector for any damage enchant that is applied to the shield, applying a wound to the attacker on block.
|
#enableShieldDamageEnchants: This will allow AOSP to work as a reflector for any damage enchant that is applied to the shield, applying a wound to the attacker on block.
|
||||||
# AOSP acts as the "chance" for the reflect, and the damage applied to it acts as the "type"
|
# AOSP acts as the "chance" for the reflect, and the damage applied to it acts as the "type"
|
||||||
|
|||||||
@@ -1,459 +0,0 @@
|
|||||||
package mod.sin.armoury;
|
|
||||||
|
|
||||||
import com.wurmonline.server.Server;
|
|
||||||
import com.wurmonline.server.combat.Armour;
|
|
||||||
import com.wurmonline.server.combat.ArmourTypes;
|
|
||||||
import com.wurmonline.server.items.*;
|
|
||||||
import javassist.ClassPool;
|
|
||||||
import javassist.CtClass;
|
|
||||||
import javassist.NotFoundException;
|
|
||||||
import mod.sin.lib.ArmourAssist;
|
|
||||||
import mod.sin.lib.Util;
|
|
||||||
import mod.sin.lib.WoundAssist;
|
|
||||||
import org.gotti.wurmunlimited.modloader.ReflectionUtil;
|
|
||||||
import org.gotti.wurmunlimited.modloader.classhooks.HookManager;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
public class ArmourTweaks {
|
|
||||||
public static Logger logger = Logger.getLogger(ArmourTweaks.class.getName());
|
|
||||||
|
|
||||||
//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
|
|
||||||
|
|
||||||
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>> armourGlanceRates = new HashMap<>();
|
|
||||||
|
|
||||||
public static HashMap<Byte, Float> materialDamageReduction = new HashMap<>();
|
|
||||||
public static HashMap<Byte, HashMap<Byte, Float>> materialEffectiveness = new HashMap<>();
|
|
||||||
public static HashMap<Byte, HashMap<Byte, Float>> materialGlanceRate = new HashMap<>();
|
|
||||||
public static HashMap<Byte, Float> materialMovementModifier = new HashMap<>();
|
|
||||||
|
|
||||||
public static HashMap<String, Integer> armourNameToItemTemplate = new HashMap<>();
|
|
||||||
|
|
||||||
public static ArrayList<Armour> clothArmour = new ArrayList<>();
|
|
||||||
public static ArrayList<Armour> leatherArmour = new ArrayList<>();
|
|
||||||
public static ArrayList<Armour> studdedArmour = new ArrayList<>();
|
|
||||||
public static ArrayList<Armour> chainArmour = new ArrayList<>();
|
|
||||||
public static ArrayList<Armour> plateArmour = new ArrayList<>();
|
|
||||||
public static ArrayList<Armour> drakeArmour = new ArrayList<>();
|
|
||||||
public static ArrayList<Armour> dragonscaleArmour = new ArrayList<>();
|
|
||||||
|
|
||||||
public static float unarmouredReduction = 0.05f;
|
|
||||||
|
|
||||||
public static float newGetArmourModFor(Item armour, byte woundType){
|
|
||||||
float toReturn = 0.0f;
|
|
||||||
if(armour != null){
|
|
||||||
int armourType = armour.getArmourType();
|
|
||||||
// Use custom armour reductions if available:
|
|
||||||
if(armourDamageReduction.containsKey(armourType)){
|
|
||||||
toReturn = armourDamageReduction.get(armourType);
|
|
||||||
}else{ // Otherwise simply use the vanilla base DR
|
|
||||||
toReturn = ArmourTypes.getArmourBaseDR(armourType);
|
|
||||||
//logger.warning("Could not find armour reduction reference for armour type "+armourType+". Using default value ("+toReturn+")");
|
|
||||||
}
|
|
||||||
// Overwrite again if item template is in the armour reduction override (custom armour):
|
|
||||||
if (ArmouryMod.armourReductionOverride.containsKey(armour.getTemplateId())){
|
|
||||||
toReturn = ArmouryMod.armourReductionOverride.get(armour.getTemplateId())-unarmouredReduction;
|
|
||||||
}
|
|
||||||
//logger.info("Base DR: "+toReturn);
|
|
||||||
if(armourType > -1){
|
|
||||||
byte material = armour.getMaterial();
|
|
||||||
// Use the material damage reduction set from configs if available
|
|
||||||
if(materialDamageReduction.containsKey(material)){
|
|
||||||
toReturn += materialDamageReduction.get(material);
|
|
||||||
//logger.info(String.format("Found armour made of material %s. Adding %.1f Base DR", material, materialDamageReduction.get(material)*100f));
|
|
||||||
}else { // Otherwise simply use the vanilla material bonuses
|
|
||||||
toReturn += ArmourTypes.getArmourMatBonus(material);
|
|
||||||
}
|
|
||||||
//logger.info("Post-Material DR: "+toReturn);
|
|
||||||
|
|
||||||
// Base armour effectiveness calculations
|
|
||||||
float armourEff;
|
|
||||||
if(armourEffectiveness.containsKey(armourType) && armourEffectiveness.get(armourType).containsKey(woundType)){
|
|
||||||
armourEff = armourEffectiveness.get(armourType).get(woundType);
|
|
||||||
//logger.info(String.format("Found of type %s. Adding %.2f effectiveness.", armourType, armourEffectiveness.get(armourType).get(woundType)*100f));
|
|
||||||
}else{
|
|
||||||
armourEff = ArmourTypes.getArmourEffModifier(armourType, woundType);
|
|
||||||
}
|
|
||||||
//logger.info("Base effectiveness: "+armourEff);
|
|
||||||
|
|
||||||
// Material effectiveness calculations
|
|
||||||
if(materialEffectiveness.containsKey(material) && materialEffectiveness.get(material).containsKey(woundType)){
|
|
||||||
float mod = materialEffectiveness.get(material).get(woundType);
|
|
||||||
//logger.info(String.format("Found armour made of material %s against %s. Multiplying by %.3f", material, woundType, mod));
|
|
||||||
toReturn *= (armourEff*mod);
|
|
||||||
}else {
|
|
||||||
toReturn *= armourEff;
|
|
||||||
}
|
|
||||||
//logger.info("Post-Effectiveness: "+toReturn);
|
|
||||||
|
|
||||||
toReturn *= 1.0f + Armour.getRarityArmourBonus(armour.getRarity());
|
|
||||||
toReturn = unarmouredReduction + (float)((double)toReturn * Server.getBuffedQualityEffect(armour.getCurrentQualityLevel() / 100.0f));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 1.0f - Math.min(1.0f, toReturn);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float newGetArmourGlanceModifier(int armourType, byte armourMaterial, byte damageType){
|
|
||||||
if(armourGlanceRates.containsKey(armourType) && armourGlanceRates.get(armourType).containsKey(damageType)){
|
|
||||||
float toReturn = armourGlanceRates.get(armourType).get(damageType);
|
|
||||||
//logger.info("Base glance rate: "+toReturn);
|
|
||||||
if(materialGlanceRate.containsKey(armourMaterial) && materialGlanceRate.get(armourMaterial).containsKey(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)));
|
|
||||||
}
|
|
||||||
String name = ArmourAssist.getArmourName(armourType);
|
|
||||||
String wound = WoundAssist.getWoundName(damageType);
|
|
||||||
//logger.info(String.format("Glance rate for %s against %s: %.2f", name, wound, toReturn));
|
|
||||||
return toReturn;
|
|
||||||
}
|
|
||||||
logger.warning("Found no glance rate for armour type "+armourType+" against "+damageType);
|
|
||||||
return 0.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float newGetMaterialMovementModifier(byte armourMaterial){
|
|
||||||
if(materialMovementModifier.containsKey(armourMaterial)){
|
|
||||||
//logger.info(String.format("Adjusting movement speed to %.2f%% because of material %s", materialMovementModifier.get(armourMaterial)*100f, armourMaterial));
|
|
||||||
return materialMovementModifier.get(armourMaterial);
|
|
||||||
}
|
|
||||||
return 1.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setArmourLimitFactors(){
|
|
||||||
try{
|
|
||||||
logger.info("Setting armour limit factors");
|
|
||||||
for(Armour armour : clothArmour){
|
|
||||||
ReflectionUtil.setPrivateField(armour, ReflectionUtil.getField(armour.getClass(), "limitingFactor"), ArmouryMod.clothArmourLimitFactor);
|
|
||||||
}
|
|
||||||
for(Armour armour : leatherArmour){
|
|
||||||
ReflectionUtil.setPrivateField(armour, ReflectionUtil.getField(armour.getClass(), "limitingFactor"), ArmouryMod.leatherArmourLimitFactor);
|
|
||||||
}
|
|
||||||
for(Armour armour : studdedArmour){
|
|
||||||
ReflectionUtil.setPrivateField(armour, ReflectionUtil.getField(armour.getClass(), "limitingFactor"), ArmouryMod.studdedArmourLimitFactor);
|
|
||||||
}
|
|
||||||
for(Armour armour : chainArmour){
|
|
||||||
ReflectionUtil.setPrivateField(armour, ReflectionUtil.getField(armour.getClass(), "limitingFactor"), ArmouryMod.chainArmourLimitFactor);
|
|
||||||
}
|
|
||||||
for(Armour armour : plateArmour){
|
|
||||||
ReflectionUtil.setPrivateField(armour, ReflectionUtil.getField(armour.getClass(), "limitingFactor"), ArmouryMod.plateArmourLimitFactor);
|
|
||||||
}
|
|
||||||
for(Armour armour : drakeArmour){
|
|
||||||
ReflectionUtil.setPrivateField(armour, ReflectionUtil.getField(armour.getClass(), "limitingFactor"), ArmouryMod.drakeArmourLimitFactor);
|
|
||||||
}
|
|
||||||
for(Armour armour : dragonscaleArmour){
|
|
||||||
ReflectionUtil.setPrivateField(armour, ReflectionUtil.getField(armour.getClass(), "limitingFactor"), ArmouryMod.dragonscaleArmourLimitFactor);
|
|
||||||
}
|
|
||||||
} catch (IllegalArgumentException | IllegalAccessException | ClassCastException | NoSuchFieldException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static ArrayList<Byte> getWoundTypes(String[] split){
|
|
||||||
ArrayList<Byte> woundTypes = new ArrayList<>();
|
|
||||||
int i = 0;
|
|
||||||
while(i < split.length-1){
|
|
||||||
if(split[i].equalsIgnoreCase("all")){
|
|
||||||
byte x = 0;
|
|
||||||
while(x <= 10){
|
|
||||||
woundTypes.add(x);
|
|
||||||
x++;
|
|
||||||
}
|
|
||||||
}else if(split[i].equalsIgnoreCase("physical")){
|
|
||||||
woundTypes.add((byte) 0); // Crush
|
|
||||||
woundTypes.add((byte) 1); // Slash
|
|
||||||
woundTypes.add((byte) 2); // Pierce
|
|
||||||
woundTypes.add((byte) 3); // Bite
|
|
||||||
}else if(split[i].equalsIgnoreCase("elemental")){
|
|
||||||
woundTypes.add((byte) 4); // Burn
|
|
||||||
woundTypes.add((byte) 8); // Cold
|
|
||||||
woundTypes.add((byte) 10); // Acid
|
|
||||||
}else if(split[i].equalsIgnoreCase("other")){
|
|
||||||
woundTypes.add((byte) 5); // Poison
|
|
||||||
woundTypes.add((byte) 6); // Infection
|
|
||||||
woundTypes.add((byte) 7); // Water
|
|
||||||
woundTypes.add((byte) 9); // Internal
|
|
||||||
}else{
|
|
||||||
woundTypes.add(WoundAssist.getWoundType(split[i]));
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
return woundTypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void addArmourDamageReduction(int armourType, float reduction){
|
|
||||||
armourDamageReduction.put(armourType, reduction);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void addArmourEffectiveness(int armourType, String[] split){
|
|
||||||
float reduction = Float.parseFloat(split[split.length-1]);
|
|
||||||
ArrayList<Byte> woundTypes = getWoundTypes(split);
|
|
||||||
for(byte woundType : woundTypes) {
|
|
||||||
HashMap<Byte, Float> map;
|
|
||||||
if (armourEffectiveness.containsKey(armourType)) {
|
|
||||||
map = armourEffectiveness.get(armourType);
|
|
||||||
} else {
|
|
||||||
map = new HashMap<>();
|
|
||||||
}
|
|
||||||
map.put(woundType, reduction);
|
|
||||||
armourEffectiveness.put(armourType, map);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void addArmourGlanceRate(int armourType, String[] split){
|
|
||||||
float rate = Float.parseFloat(split[split.length-1]);
|
|
||||||
ArrayList<Byte> woundTypes = getWoundTypes(split);
|
|
||||||
for(byte woundType : woundTypes) {
|
|
||||||
HashMap<Byte, Float> map;
|
|
||||||
if (armourGlanceRates.containsKey(armourType)) {
|
|
||||||
map = armourGlanceRates.get(armourType);
|
|
||||||
} else {
|
|
||||||
map = new HashMap<>();
|
|
||||||
}
|
|
||||||
map.put(woundType, rate);
|
|
||||||
armourGlanceRates.put(armourType, map);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void addMaterialReduction(byte material, float reduction){
|
|
||||||
materialDamageReduction.put(material, reduction);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void addMaterialEffectiveness(byte material, String[] split){
|
|
||||||
float reduction = Float.parseFloat(split[split.length-1]);
|
|
||||||
ArrayList<Byte> woundTypes = getWoundTypes(split);
|
|
||||||
for(byte woundType : woundTypes) {
|
|
||||||
HashMap<Byte, Float> map;
|
|
||||||
if (materialEffectiveness.containsKey(material)) {
|
|
||||||
map = materialEffectiveness.get(material);
|
|
||||||
} else {
|
|
||||||
map = new HashMap<>();
|
|
||||||
}
|
|
||||||
map.put(woundType, reduction);
|
|
||||||
materialEffectiveness.put(material, map);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void addMaterialGlanceRate(byte material, String[] split){
|
|
||||||
float rate = Float.parseFloat(split[split.length-1]);
|
|
||||||
ArrayList<Byte> woundTypes = getWoundTypes(split);
|
|
||||||
for(byte woundType : woundTypes) {
|
|
||||||
HashMap<Byte, Float> map;
|
|
||||||
if (materialGlanceRate.containsKey(material)) {
|
|
||||||
map = materialGlanceRate.get(material);
|
|
||||||
} else {
|
|
||||||
map = new HashMap<>();
|
|
||||||
}
|
|
||||||
map.put(woundType, rate);
|
|
||||||
materialGlanceRate.put(material, map);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void addMaterialMovementModifier(byte material, float speed){
|
|
||||||
materialMovementModifier.put(material, speed);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void initializeArmourMaps(){
|
|
||||||
// Armour name mapping:
|
|
||||||
/*armourNameToType.put("cloth", ArmourTypes.ARMOUR_CLOTH);
|
|
||||||
armourNameToType.put("leather", ArmourTypes.ARMOUR_LEATHER);
|
|
||||||
armourNameToType.put("studded", ArmourTypes.ARMOUR_STUDDED);
|
|
||||||
armourNameToType.put("chain", ArmourTypes.ARMOUR_CHAIN);
|
|
||||||
armourNameToType.put("plate", ArmourTypes.ARMOUR_PLATE);
|
|
||||||
armourNameToType.put("drake", ArmourTypes.ARMOUR_LEATHER_DRAGON);
|
|
||||||
armourNameToType.put("dragonscale", ArmourTypes.ARMOUR_SCALE_DRAGON);
|
|
||||||
armourNameToType.put("scale", ArmourTypes.ARMOUR_SCALE);
|
|
||||||
armourNameToType.put("ring", ArmourTypes.ARMOUR_RING);
|
|
||||||
armourNameToType.put("splint", ArmourTypes.ARMOUR_SPLINT);
|
|
||||||
for(String name : armourNameToType.keySet()){
|
|
||||||
armourTypeToName.put(armourNameToType.get(name), name);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
// Default material movement speed modifiers:
|
|
||||||
materialMovementModifier.put(Materials.MATERIAL_ADAMANTINE, 0.95f);
|
|
||||||
materialMovementModifier.put(Materials.MATERIAL_COPPER, 0.99f);
|
|
||||||
materialMovementModifier.put(Materials.MATERIAL_GLIMMERSTEEL, 0.90f);
|
|
||||||
materialMovementModifier.put(Materials.MATERIAL_GOLD, 1.05f);
|
|
||||||
materialMovementModifier.put(Materials.MATERIAL_LEAD, 1.025f);
|
|
||||||
materialMovementModifier.put(Materials.MATERIAL_SERYLL, 0.90f);
|
|
||||||
materialMovementModifier.put(Materials.MATERIAL_SILVER, 1.02f);
|
|
||||||
materialMovementModifier.put(Materials.MATERIAL_TIN, 0.98f);
|
|
||||||
materialMovementModifier.put(Materials.MATERIAL_ZINC, 0.975f);
|
|
||||||
|
|
||||||
// Defaults
|
|
||||||
/*materialDamageReduction.put(Materials.MATERIAL_GOLD, -0.01f);
|
|
||||||
materialDamageReduction.put(Materials.MATERIAL_SILVER, -0.0075f);
|
|
||||||
materialDamageReduction.put(Materials.MATERIAL_STEEL, 0.025f);
|
|
||||||
materialDamageReduction.put(Materials.MATERIAL_COPPER, -0.01f);
|
|
||||||
materialDamageReduction.put(Materials.MATERIAL_IRON, 0.0f);
|
|
||||||
materialDamageReduction.put(Materials.MATERIAL_LEAD, -0.025f);
|
|
||||||
materialDamageReduction.put(Materials.MATERIAL_ZINC, -0.02f);
|
|
||||||
materialDamageReduction.put(Materials.MATERIAL_BRASS, 0.01f);
|
|
||||||
materialDamageReduction.put(Materials.MATERIAL_BRONZE, 0.01f);
|
|
||||||
materialDamageReduction.put(Materials.MATERIAL_TIN, -0.0175f);
|
|
||||||
materialDamageReduction.put(Materials.MATERIAL_ADAMANTINE, 0.05f);
|
|
||||||
materialDamageReduction.put(Materials.MATERIAL_GLIMMERSTEEL, 0.1f);
|
|
||||||
materialDamageReduction.put(Materials.MATERIAL_SERYLL, 0.1f);*/
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void addArmour(ArrayList<Armour> typeList, int itemTemplate){
|
|
||||||
ItemTemplate it = ItemTemplateFactory.getInstance().getTemplateOrNull(itemTemplate);
|
|
||||||
if(it != null){
|
|
||||||
armourNameToItemTemplate.put(it.getName(), itemTemplate);
|
|
||||||
}
|
|
||||||
typeList.add(Armour.getArmour(itemTemplate));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void createArmourTemplateLists(){
|
|
||||||
addArmour(clothArmour, ItemList.clothHood);
|
|
||||||
addArmour(clothArmour, ItemList.clothSleeve);
|
|
||||||
addArmour(clothArmour, ItemList.clothJacket);
|
|
||||||
addArmour(clothArmour, ItemList.clothShirt);
|
|
||||||
addArmour(clothArmour, ItemList.clothGlove);
|
|
||||||
addArmour(clothArmour, ItemList.clothHose);
|
|
||||||
addArmour(clothArmour, ItemList.clothShoes);
|
|
||||||
addArmour(leatherArmour, ItemList.leatherHat0);
|
|
||||||
addArmour(leatherArmour, ItemList.leatherCap);
|
|
||||||
addArmour(leatherArmour, ItemList.leatherSleeve);
|
|
||||||
addArmour(leatherArmour, ItemList.leatherJacket);
|
|
||||||
addArmour(leatherArmour, ItemList.leatherGlove);
|
|
||||||
addArmour(leatherArmour, ItemList.leatherHose);
|
|
||||||
addArmour(leatherArmour, ItemList.leatherBoot);
|
|
||||||
addArmour(studdedArmour, ItemList.studdedLeatherCap);
|
|
||||||
addArmour(studdedArmour, ItemList.studdedLeatherSleeve);
|
|
||||||
addArmour(studdedArmour, ItemList.studdedLeatherJacket);
|
|
||||||
addArmour(studdedArmour, ItemList.studdedLeatherGlove);
|
|
||||||
addArmour(studdedArmour, ItemList.studdedLeatherHose);
|
|
||||||
addArmour(studdedArmour, ItemList.studdedLeatherBoot);
|
|
||||||
addArmour(chainArmour, ItemList.chainCoif);
|
|
||||||
addArmour(chainArmour, ItemList.chainSleeve);
|
|
||||||
addArmour(chainArmour, ItemList.chainJacket);
|
|
||||||
addArmour(chainArmour, ItemList.chainGlove);
|
|
||||||
addArmour(chainArmour, ItemList.chainHose);
|
|
||||||
addArmour(chainArmour, ItemList.chainBoot);
|
|
||||||
addArmour(plateArmour, ItemList.helmetGreat);
|
|
||||||
addArmour(plateArmour, ItemList.helmetBasinet);
|
|
||||||
addArmour(plateArmour, ItemList.helmetOpen);
|
|
||||||
addArmour(plateArmour, ItemList.plateSleeve);
|
|
||||||
addArmour(plateArmour, ItemList.plateJacket);
|
|
||||||
addArmour(plateArmour, ItemList.plateGauntlet);
|
|
||||||
addArmour(plateArmour, ItemList.plateHose);
|
|
||||||
addArmour(plateArmour, ItemList.plateBoot);
|
|
||||||
addArmour(drakeArmour, ItemList.dragonLeatherCap);
|
|
||||||
addArmour(drakeArmour, ItemList.dragonLeatherSleeve);
|
|
||||||
addArmour(drakeArmour, ItemList.dragonLeatherJacket);
|
|
||||||
addArmour(drakeArmour, ItemList.dragonLeatherGlove);
|
|
||||||
addArmour(drakeArmour, ItemList.dragonLeatherHose);
|
|
||||||
addArmour(drakeArmour, ItemList.dragonLeatherBoot);
|
|
||||||
addArmour(dragonscaleArmour, ItemList.dragonScaleSleeve);
|
|
||||||
addArmour(dragonscaleArmour, ItemList.dragonScaleJacket);
|
|
||||||
addArmour(dragonscaleArmour, ItemList.dragonScaleGauntlet);
|
|
||||||
addArmour(dragonscaleArmour, ItemList.dragonScaleHose);
|
|
||||||
addArmour(dragonscaleArmour, ItemList.dragonScaleBoot);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static void loadDefaultGlanceRates(){
|
|
||||||
// Initialize glance rates:
|
|
||||||
float[][] types = new float[11][];
|
|
||||||
types[0] = ArmourTypes.ARMOUR_GLANCE_CRUSH;
|
|
||||||
types[1] = ArmourTypes.ARMOUR_GLANCE_SLASH;
|
|
||||||
types[2] = ArmourTypes.ARMOUR_GLANCE_PIERCE;
|
|
||||||
types[3] = ArmourTypes.ARMOUR_GLANCE_BITE;
|
|
||||||
types[4] = ArmourTypes.ARMOUR_GLANCE_BURN;
|
|
||||||
types[5] = ArmourTypes.ARMOUR_GLANCE_POISON;
|
|
||||||
types[6] = ArmourTypes.ARMOUR_GLANCE_INFECTION;
|
|
||||||
types[7] = ArmourTypes.ARMOUR_GLANCE_WATER;
|
|
||||||
types[8] = ArmourTypes.ARMOUR_GLANCE_COLD;
|
|
||||||
types[9] = ArmourTypes.ARMOUR_GLANCE_INTERNAL;
|
|
||||||
types[10] = ArmourTypes.ARMOUR_GLANCE_ACID;
|
|
||||||
byte woundType = 0;
|
|
||||||
while(woundType < types.length){
|
|
||||||
int armourType = 0;
|
|
||||||
while(armourType < types[woundType].length){
|
|
||||||
HashMap<Byte, Float> map;
|
|
||||||
if(armourGlanceRates.containsKey(armourType)){
|
|
||||||
map = armourGlanceRates.get(armourType);
|
|
||||||
}else{
|
|
||||||
map = new HashMap<>();
|
|
||||||
}
|
|
||||||
if(!map.containsKey(woundType)) {
|
|
||||||
map.put(woundType, types[woundType][armourType]);
|
|
||||||
//logger.info(String.format("Putting glance rate for %s against %s to %.2f", armourTypeToName.get(armourType), WoundAssist.woundTypeToName.get(woundType), types[woundType][armourType]));
|
|
||||||
}/*else{
|
|
||||||
logger.info(String.format("Glance rate for %s against %s already set to %.2f", armourTypeToName.get(armourType), WoundAssist.woundTypeToName.get(woundType), map.get(woundType)));
|
|
||||||
}*/
|
|
||||||
armourGlanceRates.put(armourType, map);
|
|
||||||
armourType++;
|
|
||||||
}
|
|
||||||
woundType++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void preInit(){
|
|
||||||
try {
|
|
||||||
ClassPool classPool = HookManager.getInstance().getClassPool();
|
|
||||||
final Class<ArmourTweaks> thisClass = ArmourTweaks.class;
|
|
||||||
String replace;
|
|
||||||
|
|
||||||
if(ArmouryMod.enableArmourModifications){
|
|
||||||
Util.setReason("Enable armour damage reduction modifications.");
|
|
||||||
CtClass ctArmour = classPool.get("com.wurmonline.server.combat.Armour");
|
|
||||||
replace = "{"
|
|
||||||
+ " return "+ArmourTweaks.class.getName()+".newGetArmourModFor($1, $2);"
|
|
||||||
+ "}";
|
|
||||||
Util.setBodyDeclared(thisClass, ctArmour, "getArmourModFor", replace);
|
|
||||||
|
|
||||||
Util.setReason("Enable armour glance rate modifications.");
|
|
||||||
CtClass ctArmourTypes = classPool.get("com.wurmonline.server.combat.ArmourTypes");
|
|
||||||
replace = "{"
|
|
||||||
+ " return "+ArmourTweaks.class.getName()+".newGetArmourGlanceModifier($1, $2, $3);"
|
|
||||||
+ "}";
|
|
||||||
Util.setBodyDeclared(thisClass, ctArmourTypes, "getArmourGlanceModifier", replace);
|
|
||||||
|
|
||||||
Util.setReason("Enable material movement modifications.");
|
|
||||||
replace = "{"
|
|
||||||
+ " return "+ArmourTweaks.class.getName()+".newGetMaterialMovementModifier($1);"
|
|
||||||
+ "}";
|
|
||||||
Util.setBodyDeclared(thisClass, ctArmourTypes, "getMaterialMovementModifier", replace);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (NotFoundException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void onItemTemplatesCreated(){
|
|
||||||
createArmourTemplateLists();
|
|
||||||
loadDefaultGlanceRates();
|
|
||||||
try {
|
|
||||||
if(ArmouryMod.enableArmourMovementModifications){
|
|
||||||
logger.info("Starting armour movement modifications...");
|
|
||||||
for(String armourName : ArmouryMod.armourMovement.keySet()){
|
|
||||||
int armourTemplate;
|
|
||||||
if(armourNameToItemTemplate.containsKey(armourName)){
|
|
||||||
armourTemplate = armourNameToItemTemplate.get(armourName);
|
|
||||||
}else{
|
|
||||||
logger.severe("[ERROR]: Could not edit armour movement for item name \""+armourName+"\". It may be invalid.");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
Armour armourToEdit = Armour.getArmour(armourTemplate);
|
|
||||||
if(armourToEdit != null){
|
|
||||||
float oldValue = ReflectionUtil.getPrivateField(armourToEdit, ReflectionUtil.getField(armourToEdit.getClass(), "movemodifier"));
|
|
||||||
ReflectionUtil.setPrivateField(armourToEdit, ReflectionUtil.getField(armourToEdit.getClass(), "movemodifier"), ArmouryMod.armourMovement.get(armourName));
|
|
||||||
logger.info("Editing movement modifier for armour \""+armourName+"\": From "+oldValue+" to "+ ArmouryMod.armourMovement.get(armourName));
|
|
||||||
}else{
|
|
||||||
logger.severe("[ERROR]: Could not edit armour movement for item name \""+armourName+"\". It may be invalid.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(ArmouryMod.enableCustomArmourLimitFactors){
|
|
||||||
setArmourLimitFactors();
|
|
||||||
}
|
|
||||||
} catch (IllegalArgumentException | IllegalAccessException | ClassCastException | NoSuchFieldException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +1,7 @@
|
|||||||
package mod.sin.armoury;
|
package mod.sin.armoury;
|
||||||
|
|
||||||
import com.wurmonline.server.creatures.CreatureTemplate;
|
|
||||||
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 org.gotti.wurmunlimited.modloader.interfaces.*;
|
import org.gotti.wurmunlimited.modloader.interfaces.*;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -19,28 +15,6 @@ implements WurmServerMod, Configurable, PreInitable, ItemTemplatesCreatedListene
|
|||||||
|
|
||||||
// Configuration options
|
// Configuration options
|
||||||
public static boolean enableNonPlayerCrits = true;
|
public static boolean enableNonPlayerCrits = true;
|
||||||
public static boolean fixArmourLimitBuffBug = true;
|
|
||||||
public static boolean fixArmourLimitSpellEffect = true;
|
|
||||||
|
|
||||||
// -- Armour configuration -- //
|
|
||||||
public static boolean enableArmourModifications = true;
|
|
||||||
// Armour modifiers
|
|
||||||
//public static float adamantineMaterialMod = 0.05f;
|
|
||||||
//public static float glimmersteelMaterialMod = 0.1f;
|
|
||||||
//public static float seryllMaterialMod = 0.1f;
|
|
||||||
// Armour limit factors
|
|
||||||
public static boolean enableCustomArmourLimitFactors = true;
|
|
||||||
public static float clothArmourLimitFactor = 0.3f;
|
|
||||||
public static float leatherArmourLimitFactor = 0.3f;
|
|
||||||
public static float studdedArmourLimitFactor = 0.0f;
|
|
||||||
public static float chainArmourLimitFactor = -0.15f;
|
|
||||||
public static float plateArmourLimitFactor = -0.3f;
|
|
||||||
public static float drakeArmourLimitFactor = -0.3f;
|
|
||||||
public static float dragonscaleArmourLimitFactor = -0.3f;
|
|
||||||
public static HashMap<Integer, Float> armourReductionOverride = new HashMap<>();
|
|
||||||
// Armour movement
|
|
||||||
public static boolean enableArmourMovementModifications = true;
|
|
||||||
public static HashMap<String, Float> armourMovement = new HashMap<>();
|
|
||||||
|
|
||||||
// - Shield configuration -- //
|
// - Shield configuration -- //
|
||||||
public static boolean enableShieldDamageEnchants = true;
|
public static boolean enableShieldDamageEnchants = true;
|
||||||
@@ -78,37 +52,17 @@ implements WurmServerMod, Configurable, PreInitable, ItemTemplatesCreatedListene
|
|||||||
|
|
||||||
// Initialization sequences
|
// Initialization sequences
|
||||||
MaterialTweaks.initializeMaterialMaps();
|
MaterialTweaks.initializeMaterialMaps();
|
||||||
ArmourTweaks.initializeArmourMaps();
|
|
||||||
WeaponTweaks.initializeWeaponMaps();
|
WeaponTweaks.initializeWeaponMaps();
|
||||||
|
|
||||||
// Base configuration options
|
// Base configuration options
|
||||||
enableNonPlayerCrits = Prop.getBooleanProperty("enableNonPlayerCrits", enableNonPlayerCrits);
|
enableNonPlayerCrits = Prop.getBooleanProperty("enableNonPlayerCrits", enableNonPlayerCrits);
|
||||||
//enableNonPlayerCrits = Boolean.parseBoolean(properties.getProperty("enableNonPlayerCrits", Boolean.toString(enableNonPlayerCrits)));
|
|
||||||
fixArmourLimitBuffBug = Prop.getBooleanProperty("fixArmourLimitBuffBug", fixArmourLimitBuffBug);
|
|
||||||
//fixArmourLimitBuffBug = Boolean.parseBoolean(properties.getProperty("fixArmourLimitBuffBug", Boolean.toString(fixArmourLimitBuffBug)));
|
|
||||||
fixArmourLimitSpellEffect = Prop.getBooleanProperty("fixArmourLimitSpellEffect", fixArmourLimitSpellEffect);
|
|
||||||
//fixArmourLimitSpellEffect = Boolean.parseBoolean(properties.getProperty("fixArmourLimitSpellEffect", Boolean.toString(fixArmourLimitSpellEffect)));
|
|
||||||
enableArmourModifications = Prop.getBooleanProperty("enableArmourReductionModifications", enableArmourModifications);
|
|
||||||
//enableArmourModifications = Boolean.parseBoolean(properties.getProperty("enableArmourModifications", Boolean.toString(enableArmourModifications)));
|
|
||||||
ArmourTweaks.unarmouredReduction = Prop.getFloatProperty("unarmouredReduction", ArmourTweaks.unarmouredReduction);
|
|
||||||
/*if(enableArmourModifications){
|
/*if(enableArmourModifications){
|
||||||
ArmourTweaks.configure();
|
ArmourTweaks.configure();
|
||||||
}*/
|
}*/
|
||||||
//adamantineMaterialMod = Float.parseFloat(properties.getProperty("adamantineMaterialMod", Float.toString(adamantineMaterialMod)));
|
//adamantineMaterialMod = Float.parseFloat(properties.getProperty("adamantineMaterialMod", Float.toString(adamantineMaterialMod)));
|
||||||
//glimmersteelMaterialMod = Float.parseFloat(properties.getProperty("glimmersteelMaterialMod", Float.toString(glimmersteelMaterialMod)));
|
//glimmersteelMaterialMod = Float.parseFloat(properties.getProperty("glimmersteelMaterialMod", Float.toString(glimmersteelMaterialMod)));
|
||||||
//seryllMaterialMod = Float.parseFloat(properties.getProperty("seryllMaterialMod", Float.toString(seryllMaterialMod)));
|
//seryllMaterialMod = Float.parseFloat(properties.getProperty("seryllMaterialMod", Float.toString(seryllMaterialMod)));
|
||||||
// Armour limit factors
|
// Shield configuration
|
||||||
enableCustomArmourLimitFactors = Boolean.parseBoolean(properties.getProperty("enableCustomArmourLimitFactors", Boolean.toString(enableCustomArmourLimitFactors)));
|
|
||||||
clothArmourLimitFactor = Float.parseFloat(properties.getProperty("clothArmourLimitFactor", Float.toString(clothArmourLimitFactor)));
|
|
||||||
leatherArmourLimitFactor = Float.parseFloat(properties.getProperty("leatherArmourLimitFactor", Float.toString(leatherArmourLimitFactor)));
|
|
||||||
studdedArmourLimitFactor = Float.parseFloat(properties.getProperty("studdedArmourLimitFactor", Float.toString(studdedArmourLimitFactor)));
|
|
||||||
chainArmourLimitFactor = Float.parseFloat(properties.getProperty("chainArmourLimitFactor", Float.toString(chainArmourLimitFactor)));
|
|
||||||
plateArmourLimitFactor = Float.parseFloat(properties.getProperty("plateArmourLimitFactor", Float.toString(plateArmourLimitFactor)));
|
|
||||||
drakeArmourLimitFactor = Float.parseFloat(properties.getProperty("drakeArmourLimitFactor", Float.toString(drakeArmourLimitFactor)));
|
|
||||||
dragonscaleArmourLimitFactor = Float.parseFloat(properties.getProperty("dragonscaleArmourLimitFactor", Float.toString(dragonscaleArmourLimitFactor)));
|
|
||||||
// Armour movement modifiers
|
|
||||||
enableArmourMovementModifications = Boolean.parseBoolean(properties.getProperty("enableArmourMovementModifications", Boolean.toString(enableArmourMovementModifications)));
|
|
||||||
// Shield configuration
|
|
||||||
enableShieldDamageEnchants = Boolean.parseBoolean(properties.getProperty("enableShieldDamageEnchants", Boolean.toString(enableShieldDamageEnchants)));
|
enableShieldDamageEnchants = Boolean.parseBoolean(properties.getProperty("enableShieldDamageEnchants", Boolean.toString(enableShieldDamageEnchants)));
|
||||||
// Weapon configuration
|
// Weapon configuration
|
||||||
minimumSwingTime = Float.parseFloat(properties.getProperty("minimumSwingTime", Float.toString(minimumSwingTime)));
|
minimumSwingTime = Float.parseFloat(properties.getProperty("minimumSwingTime", Float.toString(minimumSwingTime)));
|
||||||
@@ -130,52 +84,7 @@ implements WurmServerMod, Configurable, PreInitable, ItemTemplatesCreatedListene
|
|||||||
case "depend.suggests":
|
case "depend.suggests":
|
||||||
break; //ignore
|
break; //ignore
|
||||||
default:
|
default:
|
||||||
if (name.startsWith("armourMovement")) {
|
if (name.startsWith("materialWeaponDamage")) {
|
||||||
String[] split = value.split(",");
|
|
||||||
String armourName = split[0];
|
|
||||||
float newVal = Float.parseFloat(split[1]);
|
|
||||||
armourMovement.put(armourName, newVal);
|
|
||||||
} else if (name.startsWith("armourReductionOverride")) {
|
|
||||||
String[] split = value.split(",");
|
|
||||||
int armourId = Integer.parseInt(split[0]);
|
|
||||||
float reductionValue = Float.parseFloat(split[1]);
|
|
||||||
armourReductionOverride.put(armourId, reductionValue);
|
|
||||||
} else if (name.startsWith("armourDamageReduction")) {
|
|
||||||
String[] split = value.split(",");
|
|
||||||
int armourId = ArmourAssist.getArmourType(split[0]);
|
|
||||||
float reductionValue = Float.parseFloat(split[1]);
|
|
||||||
ArmourTweaks.addArmourDamageReduction(armourId, reductionValue);
|
|
||||||
} else if (name.startsWith("armourEffectiveness")) {
|
|
||||||
String[] split = value.split(";");
|
|
||||||
int armourType = ArmourAssist.getArmourType(split[0]);
|
|
||||||
String[] split2 = split[1].split(",");
|
|
||||||
ArmourTweaks.addArmourEffectiveness(armourType, split2);
|
|
||||||
} else if (name.startsWith("armourGlanceRate")) {
|
|
||||||
String[] split = value.split(";");
|
|
||||||
int armourType = ArmourAssist.getArmourType(split[0]);
|
|
||||||
String[] split2 = split[1].split(",");
|
|
||||||
ArmourTweaks.addArmourGlanceRate(armourType, split2);
|
|
||||||
} else if (name.startsWith("materialDamageReduction")) {
|
|
||||||
String[] split = value.split(",");
|
|
||||||
byte material = parseMaterialType(split[0]);
|
|
||||||
float reduction = Float.parseFloat(split[1]);
|
|
||||||
ArmourTweaks.addMaterialReduction(material, reduction);
|
|
||||||
} else if (name.startsWith("materialEffectiveness")) {
|
|
||||||
String[] split = value.split(";");
|
|
||||||
byte material = parseMaterialType(split[0]);
|
|
||||||
String[] split2 = split[1].split(",");
|
|
||||||
ArmourTweaks.addMaterialEffectiveness(material, split2);
|
|
||||||
} else if (name.startsWith("materialGlanceRate")) {
|
|
||||||
String[] split = value.split(";");
|
|
||||||
byte material = parseMaterialType(split[0]);
|
|
||||||
String[] split2 = split[1].split(",");
|
|
||||||
ArmourTweaks.addMaterialGlanceRate(material, split2);
|
|
||||||
} else if (name.startsWith("materialMovementModifier")) {
|
|
||||||
String[] split = value.split(",");
|
|
||||||
byte material = parseMaterialType(split[0]);
|
|
||||||
float speed = Float.parseFloat(split[1]);
|
|
||||||
ArmourTweaks.addMaterialMovementModifier(material, speed);
|
|
||||||
} else if (name.startsWith("materialWeaponDamage")) {
|
|
||||||
String[] split = value.split(",");
|
String[] split = value.split(",");
|
||||||
byte material = parseMaterialType(split[0]);
|
byte material = parseMaterialType(split[0]);
|
||||||
double mult = Double.parseDouble(split[1]);
|
double mult = Double.parseDouble(split[1]);
|
||||||
@@ -312,77 +221,7 @@ implements WurmServerMod, Configurable, PreInitable, ItemTemplatesCreatedListene
|
|||||||
// Print values of main.java.armoury.mod configuration
|
// Print values of main.java.armoury.mod configuration
|
||||||
logger.info(" -- Mod Configuration -- ");
|
logger.info(" -- Mod Configuration -- ");
|
||||||
logger.log(Level.INFO, "enableNonPlayerCrits: " + enableNonPlayerCrits);
|
logger.log(Level.INFO, "enableNonPlayerCrits: " + enableNonPlayerCrits);
|
||||||
logger.log(Level.INFO, "fixArmourLimitBuffBug: " + fixArmourLimitBuffBug);
|
|
||||||
logger.log(Level.INFO, "fixArmourLimitSpellEffect: " + fixArmourLimitSpellEffect);
|
|
||||||
logger.info(" -- Armour Configuration -- ");
|
|
||||||
logger.log(Level.INFO, "enableArmourModifications: " + enableArmourModifications);
|
|
||||||
if(enableArmourModifications){
|
|
||||||
logger.log(Level.INFO, "unarmouredReduction: " + ArmourTweaks.unarmouredReduction);
|
|
||||||
logger.info("> Armour Base DR Settings <");
|
|
||||||
for(int armourType : ArmourTweaks.armourDamageReduction.keySet()){
|
|
||||||
String name = ArmourAssist.getArmourName(armourType);
|
|
||||||
/*String name = String.valueOf(armourType);
|
|
||||||
if(ArmourTweaks.armourTypeToName.containsKey(armourType)){
|
|
||||||
name = ArmourTweaks.armourTypeToName.get(armourType);
|
|
||||||
}*/
|
|
||||||
//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("> Armour Effectiveness Settings <");
|
|
||||||
for(int armourType : ArmourTweaks.armourEffectiveness.keySet()){
|
|
||||||
String name = ArmourAssist.getArmourName(armourType);
|
|
||||||
/*String name = String.valueOf(armourType);
|
|
||||||
if(ArmourTweaks.armourTypeToName.containsKey(armourType)){
|
|
||||||
name = ArmourTweaks.armourTypeToName.get(armourType);
|
|
||||||
}*/
|
|
||||||
HashMap<Byte, Float> woundMap = ArmourTweaks.armourEffectiveness.get(armourType);
|
|
||||||
for(byte woundType : woundMap.keySet()){
|
|
||||||
String wound = WoundAssist.getWoundName(woundType);
|
|
||||||
logger.info(String.format("Effectiveness for armour %s against %s: %.2f%%", name, wound, woundMap.get(woundType)*100f));
|
|
||||||
//logger.info("Effectiveness for "+name+" against "+woundType+": "+(woundMap.get(woundType)*100f) +"%");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
logger.info("> Armour Glance Rate Settings <");
|
|
||||||
for(int armourType : ArmourTweaks.armourGlanceRates.keySet()){
|
|
||||||
String name = ArmourAssist.getArmourName(armourType);
|
|
||||||
/*String name = String.valueOf(armourType);
|
|
||||||
if(ArmourTweaks.armourTypeToName.containsKey(armourType)){
|
|
||||||
name = ArmourTweaks.armourTypeToName.get(armourType);
|
|
||||||
}*/
|
|
||||||
HashMap<Byte, Float> woundMap = ArmourTweaks.armourGlanceRates.get(armourType);
|
|
||||||
for(byte woundType : woundMap.keySet()){
|
|
||||||
String wound = WoundAssist.getWoundName(woundType);
|
|
||||||
logger.info(String.format("Glance rate for armour %s against %s: %.2f%%", name, wound, woundMap.get(woundType)*100f));
|
|
||||||
//logger.info("Effectiveness for "+name+" against "+woundType+": "+(woundMap.get(woundType)*100f) +"%");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
logger.info(" -- Material Configuration -- ");
|
logger.info(" -- Material Configuration -- ");
|
||||||
logger.info("> Armour Material Damage Reduction Settings <");
|
|
||||||
for(byte material : ArmourTweaks.materialDamageReduction.keySet()){
|
|
||||||
logger.info(String.format("Base DR modifier for material %s: %.2f%%", MaterialTweaks.getMaterialName(material), ArmourTweaks.materialDamageReduction.get(material)*100f));
|
|
||||||
}
|
|
||||||
logger.info("> Armour Material Effectiveness Settings <");
|
|
||||||
for(byte material : ArmourTweaks.materialEffectiveness.keySet()){
|
|
||||||
HashMap<Byte, Float> woundMap = ArmourTweaks.materialEffectiveness.get(material);
|
|
||||||
for(byte woundType : woundMap.keySet()){
|
|
||||||
String wound = WoundAssist.getWoundName(woundType);
|
|
||||||
logger.info(String.format("Effectiveness for material %s against %s: %.2f%%", MaterialTweaks.getMaterialName(material), wound, woundMap.get(woundType)*100f));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
logger.info("> Armour Material Glance Rate Settings <");
|
|
||||||
for(byte material : ArmourTweaks.materialGlanceRate.keySet()){
|
|
||||||
//String name = materialNameReference.containsKey(material) ? materialNameReference.get(material) : String.valueOf(material);
|
|
||||||
HashMap<Byte, Float> woundMap = ArmourTweaks.materialGlanceRate.get(material);
|
|
||||||
for(byte woundType : woundMap.keySet()){
|
|
||||||
String wound = WoundAssist.getWoundName(woundType);
|
|
||||||
logger.info(String.format("Glance Rate for material %s against %s: %.2f%%", MaterialTweaks.getMaterialName(material), wound, woundMap.get(woundType)*100f));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
logger.info("> Armour Material Movement Modifier Settings <");
|
|
||||||
for(byte material : ArmourTweaks.materialMovementModifier.keySet()){
|
|
||||||
logger.info(String.format("Movement Speed modifier for material %s: %.2f%%", MaterialTweaks.getMaterialName(material), ArmourTweaks.materialMovementModifier.get(material)*100f));
|
|
||||||
}
|
|
||||||
logger.info("> Weapon Material Damage Settings <");
|
logger.info("> Weapon Material Damage Settings <");
|
||||||
for(byte material : WeaponTweaks.materialWeaponDamage.keySet()){
|
for(byte material : WeaponTweaks.materialWeaponDamage.keySet()){
|
||||||
logger.info(String.format("Damage modifier for material %s: %.2f%%", MaterialTweaks.getMaterialName(material), WeaponTweaks.materialWeaponDamage.get(material)*100f));
|
logger.info(String.format("Damage modifier for material %s: %.2f%%", MaterialTweaks.getMaterialName(material), WeaponTweaks.materialWeaponDamage.get(material)*100f));
|
||||||
@@ -459,20 +298,6 @@ implements WurmServerMod, Configurable, PreInitable, ItemTemplatesCreatedListene
|
|||||||
for(byte material : MaterialTweaks.materialActionSpeedModifier.keySet()){
|
for(byte material : MaterialTweaks.materialActionSpeedModifier.keySet()){
|
||||||
logger.info(String.format("Action Speed modifier for material %s: %.2f%%", MaterialTweaks.getMaterialName(material), MaterialTweaks.materialActionSpeedModifier.get(material)*100f));
|
logger.info(String.format("Action Speed modifier for material %s: %.2f%%", MaterialTweaks.getMaterialName(material), MaterialTweaks.materialActionSpeedModifier.get(material)*100f));
|
||||||
}
|
}
|
||||||
/*logger.log(Level.INFO, "adamantineMaterialMod: " + adamantineMaterialMod);
|
|
||||||
logger.log(Level.INFO, "glimmersteelMaterialMod: " + glimmersteelMaterialMod);
|
|
||||||
logger.log(Level.INFO, "seryllMaterialMod: " + seryllMaterialMod);*/
|
|
||||||
logger.info(" -- Armour Limit Configuration -- ");
|
|
||||||
logger.log(Level.INFO, "enableCustomArmourLimitFactors: " + enableCustomArmourLimitFactors);
|
|
||||||
if(enableCustomArmourLimitFactors){
|
|
||||||
logger.log(Level.INFO, "clothArmourLimitFactor: " + clothArmourLimitFactor);
|
|
||||||
logger.log(Level.INFO, "leatherArmourLimitFactor: " + leatherArmourLimitFactor);
|
|
||||||
logger.log(Level.INFO, "studdedArmourLimitFactor: " + studdedArmourLimitFactor);
|
|
||||||
logger.log(Level.INFO, "chainArmourLimitFactor: " + chainArmourLimitFactor);
|
|
||||||
logger.log(Level.INFO, "plateArmourLimitFactor: " + plateArmourLimitFactor);
|
|
||||||
logger.log(Level.INFO, "drakeArmourLimitFactor: " + drakeArmourLimitFactor);
|
|
||||||
logger.log(Level.INFO, "dragonscaleArmourLimitFactor: " + dragonscaleArmourLimitFactor);
|
|
||||||
}
|
|
||||||
logger.info(" -- Shield Configuration -- ");
|
logger.info(" -- Shield Configuration -- ");
|
||||||
logger.log(Level.INFO, "enableShieldDamageEnchants: " + enableShieldDamageEnchants);
|
logger.log(Level.INFO, "enableShieldDamageEnchants: " + enableShieldDamageEnchants);
|
||||||
logger.info(" -- Weapon Configuration -- ");
|
logger.info(" -- Weapon Configuration -- ");
|
||||||
@@ -487,7 +312,6 @@ implements WurmServerMod, Configurable, PreInitable, ItemTemplatesCreatedListene
|
|||||||
@Override
|
@Override
|
||||||
public void preInit(){
|
public void preInit(){
|
||||||
CombatTweaks.preInit();
|
CombatTweaks.preInit();
|
||||||
ArmourTweaks.preInit();
|
|
||||||
ShieldTweaks.preInit();
|
ShieldTweaks.preInit();
|
||||||
WeaponTweaks.preInit();
|
WeaponTweaks.preInit();
|
||||||
MaterialTweaks.preInit();
|
MaterialTweaks.preInit();
|
||||||
@@ -496,17 +320,10 @@ implements WurmServerMod, Configurable, PreInitable, ItemTemplatesCreatedListene
|
|||||||
@Override
|
@Override
|
||||||
public void onItemTemplatesCreated(){
|
public void onItemTemplatesCreated(){
|
||||||
logger.info("Beginning onItemTemplatesCreated...");
|
logger.info("Beginning onItemTemplatesCreated...");
|
||||||
ArmourTweaks.onItemTemplatesCreated();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onServerStarted(){
|
public void onServerStarted(){
|
||||||
WeaponTweaks.onServerStarted();
|
WeaponTweaks.onServerStarted();
|
||||||
CombatTweaks.onServerStarted();
|
|
||||||
for(CreatureTemplate template : CreatureTemplateFactory.getInstance().getTemplates()){
|
|
||||||
if(ArmourAssist.armourTypeToName.containsKey((int) template.getArmourType())) {
|
|
||||||
logger.info(template.getName() + " - " + ArmourAssist.armourTypeToName.get((int) template.getArmourType()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +1,14 @@
|
|||||||
package mod.sin.armoury;
|
package mod.sin.armoury;
|
||||||
|
|
||||||
import mod.sin.lib.Util;
|
|
||||||
import org.gotti.wurmunlimited.modloader.ReflectionUtil;
|
|
||||||
import org.gotti.wurmunlimited.modloader.classhooks.HookManager;
|
|
||||||
|
|
||||||
import com.wurmonline.server.Server;
|
import com.wurmonline.server.Server;
|
||||||
import com.wurmonline.server.creatures.CombatHandler;
|
import com.wurmonline.server.creatures.CombatHandler;
|
||||||
import com.wurmonline.server.creatures.Creature;
|
import com.wurmonline.server.creatures.Creature;
|
||||||
import com.wurmonline.server.creatures.SpellEffectsEnum;
|
|
||||||
import com.wurmonline.server.items.Item;
|
import com.wurmonline.server.items.Item;
|
||||||
|
import javassist.*;
|
||||||
import javassist.CannotCompileException;
|
|
||||||
import javassist.ClassPool;
|
|
||||||
import javassist.CtClass;
|
|
||||||
import javassist.CtPrimitiveType;
|
|
||||||
import javassist.NotFoundException;
|
|
||||||
import javassist.bytecode.Descriptor;
|
import javassist.bytecode.Descriptor;
|
||||||
import javassist.expr.ExprEditor;
|
import mod.sin.lib.Util;
|
||||||
import javassist.expr.MethodCall;
|
import org.gotti.wurmunlimited.modloader.ReflectionUtil;
|
||||||
|
import org.gotti.wurmunlimited.modloader.classhooks.HookManager;
|
||||||
|
|
||||||
public class CombatTweaks {
|
public class CombatTweaks {
|
||||||
public static Item handleDualWieldAttack(CombatHandler handler, Creature opponent, float delta){
|
public static Item handleDualWieldAttack(CombatHandler handler, Creature opponent, float delta){
|
||||||
@@ -39,20 +30,6 @@ public class CombatTweaks {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onServerStarted(){
|
|
||||||
// - Make spell effects hud show your armour limit properly - //
|
|
||||||
if(ArmouryMod.fixArmourLimitSpellEffect){
|
|
||||||
try {
|
|
||||||
ReflectionUtil.setPrivateField(SpellEffectsEnum.ARMOUR_LIMIT_HEAVY, ReflectionUtil.getField(SpellEffectsEnum.ARMOUR_LIMIT_HEAVY.getClass(), "name"), "Armour Penalty");
|
|
||||||
ReflectionUtil.setPrivateField(SpellEffectsEnum.ARMOUR_LIMIT_MEDIUM, ReflectionUtil.getField(SpellEffectsEnum.ARMOUR_LIMIT_MEDIUM.getClass(), "name"), "Armour Penalty");
|
|
||||||
ReflectionUtil.setPrivateField(SpellEffectsEnum.ARMOUR_LIMIT_LIGHT, ReflectionUtil.getField(SpellEffectsEnum.ARMOUR_LIMIT_LIGHT.getClass(), "name"), "Armour Bonus");
|
|
||||||
ReflectionUtil.setPrivateField(SpellEffectsEnum.ARMOUR_LIMIT_NONE, ReflectionUtil.getField(SpellEffectsEnum.ARMOUR_LIMIT_NONE.getClass(), "name"), "Armour Bonus");
|
|
||||||
} catch (IllegalAccessException | NoSuchFieldException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void preInit(){
|
public static void preInit(){
|
||||||
try {
|
try {
|
||||||
ClassPool classPool = HookManager.getInstance().getClassPool();
|
ClassPool classPool = HookManager.getInstance().getClassPool();
|
||||||
@@ -94,47 +71,6 @@ public class CombatTweaks {
|
|||||||
}
|
}
|
||||||
});*/
|
});*/
|
||||||
}
|
}
|
||||||
|
|
||||||
// - Fix the Armour Limit being shown in the buff bar at all times -
|
|
||||||
if(ArmouryMod.fixArmourLimitBuffBug){
|
|
||||||
CtClass ctPlayerInfo = classPool.get("com.wurmonline.server.players.PlayerInfo");
|
|
||||||
String replace = ""
|
|
||||||
+ "communicator.sendRemoveSpellEffect(com.wurmonline.server.creatures.SpellEffectsEnum.ARMOUR_LIMIT_NONE);"
|
|
||||||
+ "communicator.sendRemoveSpellEffect(com.wurmonline.server.creatures.SpellEffectsEnum.ARMOUR_LIMIT_MEDIUM);"
|
|
||||||
+ "communicator.sendRemoveSpellEffect(com.wurmonline.server.creatures.SpellEffectsEnum.ARMOUR_LIMIT_HEAVY);"
|
|
||||||
+ "$_ = $proceed($$);";
|
|
||||||
Util.setReason("Fix armour limit buff bug.");
|
|
||||||
Util.instrumentDeclared(thisClass, ctPlayerInfo, "setArmourLimitingFactor", "sendRemoveSpellEffect", replace);
|
|
||||||
/*ctPlayerInfo.getDeclaredMethod("setArmourLimitingFactor").instrument(new ExprEditor(){
|
|
||||||
public void edit(MethodCall m) throws CannotCompileException {
|
|
||||||
if (m.getMethodName().equals("sendRemoveSpellEffect")) {
|
|
||||||
m.replace("communicator.sendRemoveSpellEffect(com.wurmonline.server.creatures.SpellEffectsEnum.ARMOUR_LIMIT_NONE);"
|
|
||||||
+ "communicator.sendRemoveSpellEffect(com.wurmonline.server.creatures.SpellEffectsEnum.ARMOUR_LIMIT_MEDIUM);"
|
|
||||||
+ "communicator.sendRemoveSpellEffect(com.wurmonline.server.creatures.SpellEffectsEnum.ARMOUR_LIMIT_HEAVY);"
|
|
||||||
+ "$_ = $proceed($$);");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});*/
|
|
||||||
replace = "if($1 == null){"
|
|
||||||
+ " $1 = com.wurmonline.server.creatures.SpellEffectsEnum.ARMOUR_LIMIT_NONE;"
|
|
||||||
+ "}"
|
|
||||||
+ "$_ = $proceed($$);"
|
|
||||||
+ "communicator.sendAddSpellEffect($1, 100000, this.limitingArmourFactor*100.0f);";
|
|
||||||
Util.setReason("Fix armour limit buff bug.");
|
|
||||||
Util.instrumentDeclared(thisClass, ctPlayerInfo, "setArmourLimitingFactor", "sendAddStatusEffect", replace);
|
|
||||||
ctPlayerInfo.getDeclaredMethod("setArmourLimitingFactor").instrument(new ExprEditor(){
|
|
||||||
public void edit(MethodCall m) throws CannotCompileException {
|
|
||||||
if (m.getMethodName().equals("sendAddStatusEffect")) {
|
|
||||||
m.replace("if($1 == null){"
|
|
||||||
+ " $1 = com.wurmonline.server.creatures.SpellEffectsEnum.ARMOUR_LIMIT_NONE;"
|
|
||||||
+ "}"
|
|
||||||
+ "$_ = $proceed($$);"
|
|
||||||
+ "communicator.sendAddSpellEffect($1, 100000, this.limitingArmourFactor*100.0f);");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// - Change the minimum swing timer - //
|
// - Change the minimum swing timer - //
|
||||||
if(ArmouryMod.minimumSwingTime != 3.0f){
|
if(ArmouryMod.minimumSwingTime != 3.0f){
|
||||||
@@ -299,7 +235,7 @@ public class CombatTweaks {
|
|||||||
desc = Descriptor.ofMethod(CtClass.booleanType, params3);
|
desc = Descriptor.ofMethod(CtClass.booleanType, params3);
|
||||||
ctCombatHandler.getMethod("attack", desc).insertBefore("logger.info(\"Calling attack(Creature, Item, boolean)\");");*/
|
ctCombatHandler.getMethod("attack", desc).insertBefore("logger.info(\"Calling attack(Creature, Item, boolean)\");");*/
|
||||||
|
|
||||||
} catch (CannotCompileException | NotFoundException | IllegalArgumentException | ClassCastException e) {
|
} catch ( NotFoundException | IllegalArgumentException | ClassCastException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user