New armour stat controls
New material modifications Control material statistics Improved configuration Fix for dual wield change error
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
apply plugin: 'java'
|
apply plugin: 'java'
|
||||||
|
|
||||||
group "mod.sin"
|
group "mod.sin"
|
||||||
version "1.0"
|
version "2.0"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
@@ -10,8 +10,7 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'org.gotti.wurmunlimited:server-modlauncher:0.33-beta1'
|
compile 'com.github.Sindusk:sindusklibrary:v1.3'
|
||||||
compile 'com.github.Sindusk:sindusklibrary:v1.0'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
classname=mod.sin.armoury.Armoury
|
classname=mod.sin.armoury.Armoury
|
||||||
classpath=Armoury.jar
|
classpath=Armoury.jar
|
||||||
depend.import=SinduskLibrary
|
depend.import=SinduskLibrary
|
||||||
|
depend.suggests=ServerTweaks
|
||||||
sharedClassLoader=true
|
sharedClassLoader=true
|
||||||
#If true, will print debug messages and log heavily.
|
|
||||||
debug=true
|
|
||||||
|
|
||||||
# -- Mod configuration section -- #
|
# -- Mod configuration section -- #
|
||||||
#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.
|
||||||
@@ -15,35 +14,98 @@ fixArmourLimitBuffBug=true
|
|||||||
fixArmourLimitSpellEffect=true
|
fixArmourLimitSpellEffect=true
|
||||||
|
|
||||||
# -- Armour configuration section -- #
|
# -- 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 < #
|
# > Armour Reduction < #
|
||||||
enableArmourReductionModifications=true
|
|
||||||
#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.
|
#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.
|
# 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.
|
# 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.
|
||||||
# Final note: 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.
|
|
||||||
|
# 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
|
unarmouredReduction=0.05
|
||||||
#Default configuration (Worn armour):
|
|
||||||
#clothReduction=0.4
|
#armourDamageReduction: Adjust the base DR of certain armour types
|
||||||
#leatherReduction=0.5
|
# Syntax: armourDamageReduction-##:material,reduction
|
||||||
#studdedReduction=0.55
|
# Example: armourDamageReduction-1:6,0.40
|
||||||
#chainReduction=0.6
|
# The example sets cloth (6) armour to have 40% damage reduction at 100QL.
|
||||||
#plateReduction=0.7
|
# Quality scales the damage reduction
|
||||||
#drakeReduction=0.7
|
#> 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
|
#dragonscaleReduction=0.75
|
||||||
#Custom configuration (Worn armour):
|
|
||||||
clothReduction=0.5
|
|
||||||
leatherReduction=0.55
|
|
||||||
studdedReduction=0.58
|
|
||||||
chainReduction=0.61
|
|
||||||
plateReduction=0.63
|
|
||||||
drakeReduction=0.665
|
|
||||||
dragonscaleReduction=0.685
|
|
||||||
#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
|
#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
|
#scaleReduction=0.5
|
||||||
ringReduction=0.55
|
#ringReduction=0.55
|
||||||
splintReduction=0.6
|
#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. If you want to add challenge helms, masks, and similar here, you are welcome to do so and have their DR work.
|
#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.
|
||||||
|
|
||||||
# - My custom server settings - #
|
# - My custom server settings - #
|
||||||
#Spectral Armour
|
#Spectral Armour
|
||||||
@@ -63,11 +125,168 @@ armourReductionOverride-111:22690,0.64
|
|||||||
|
|
||||||
|
|
||||||
# > Material Modifiers < #
|
# > Material Modifiers < #
|
||||||
#These are additive modifiers to damage reduction for moon metals.
|
#These are material modifier definitions. Items made from these materials will have the benefits listed.
|
||||||
# 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.
|
# List of metallic material ids:
|
||||||
adamantineMaterialMod=0.03
|
# Gold - 7 ; Silver - 8 ; Steel - 9 ; Copper - 10 ; Iron - 11 ; Lead - 12 ; Zinc - 13
|
||||||
glimmersteelMaterialMod=0.06
|
# Brass - 30 ; Bronze - 31 ; Tin - 34 ; Adamantine - 56 ; Glimmersteel - 57 ; Seryll - 67
|
||||||
seryllMaterialMod=0.08
|
# 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.
|
||||||
|
# This is a multiplier on the base glance rate.
|
||||||
|
materialGlanceRate-1:adamantine;physical,1.02
|
||||||
|
|
||||||
|
# -- Weapon Material Configuration -- #
|
||||||
|
#enableWeaponMaterialChanges: Enables or disables the whole weapon material configuration section.
|
||||||
|
enableWeaponMaterialChanges=true
|
||||||
|
|
||||||
|
#materialWeaponDamage: Adjust the damage of a weapon based on the material it's made from.
|
||||||
|
# This is a multiplier on the base weapon damage.
|
||||||
|
# Lower values deal less damage, higher values deal more damage. 1.10 = 10% more damage. 0.90 = 10% less damage.
|
||||||
|
materialWeaponDamage-1:steel,1.03
|
||||||
|
|
||||||
|
#materialWeaponSpeed: Adjust the swing speed of a weapon based on the material it's made from.
|
||||||
|
# This is a multiplier on the base weapon speed.
|
||||||
|
# Lower values swing faster, higher values swing slower. 1.10 = 10% slower. 0.90 = 10% faster.
|
||||||
|
materialWeaponSpeed-1:bronze,0.98
|
||||||
|
|
||||||
|
#materialWeaponParry: Adjust the parry bonus of a weapon based on the material it's made from.
|
||||||
|
# This is a multiplier for how often the weapon can parry.
|
||||||
|
# Lower values parry more frequently, higher values parry less frequently. 1.10 = 10% less frequent parries. 0.90 = 10% more frequent parries.
|
||||||
|
materialWeaponParry-1:glimmersteel,0.95
|
||||||
|
|
||||||
|
#materialWeaponArmourDamage: Adjust how much damage is dealt to the defender's armour based on the material the weapon is made from.
|
||||||
|
# This is a multiplier on how much damage the armour takes.
|
||||||
|
# Lower values cause less damage, higher values cause more damage. 1.10 = 10% more damage to the armour. 0.90 = 10% less damage to the armour.
|
||||||
|
materialWeaponArmourDamage-1:adamantine,1.05
|
||||||
|
|
||||||
|
# -- Item Material Configuration -- #
|
||||||
|
#enableItemMaterialChanges: Enables or disables the whole item material configuration section.
|
||||||
|
enableItemMaterialChanges=true
|
||||||
|
|
||||||
|
#materialDamageModifier: Adjust how much damage the item takes when receiving non-decay damage (when used).
|
||||||
|
# This is a multiplier on how much damage the item takes.
|
||||||
|
# Lower values reduce damage taken, higher values increase damage taken. 1.10 = 10% more damage taken. 0.90 = 10% less damage taken.
|
||||||
|
materialDamageModifier-1:iron,0.95
|
||||||
|
|
||||||
|
#materialDamageModifier: Adjust how much decay damage the item takes.
|
||||||
|
# This is a multiplier on how much damage the item takes.
|
||||||
|
# Lower values reduce damage taken, higher values increase damage taken. 1.10 = 10% more decay damage taken. 0.90 = 10% less decay damage taken.
|
||||||
|
materialDecayModifier-1:iron,0.95
|
||||||
|
|
||||||
|
#materialDifficultyModifier: Apply a modifier to difficulty of skill checks when using items made of this material.
|
||||||
|
# This is a multiplier for the difficulty of the check.
|
||||||
|
# Lower values will reduce difficulty, higher values will increase difficulty. 1.10 = 10% more difficult, 0.90 = 10% less difficult.
|
||||||
|
# When the difficulty is lower, the result of the check will be higher. When the difficulty is higher, the result of the check will be lower.
|
||||||
|
materialDifficultyModifier-1:adamantine,0.98
|
||||||
|
|
||||||
|
#materialSpellEffectModifier: Apply a modifier to spell effect power on items made of this material.
|
||||||
|
# This is a multiplier for the power of the spell effect.
|
||||||
|
# Lower values reduce the power, higher values increase the power. 1.10 = 10% higher power. 0.90 = 10% less power.
|
||||||
|
materialSpellEffectModifier-1:copper,1.10
|
||||||
|
|
||||||
|
#materialSpecificSpellEffectModifier: Apply a modifier to a specific spell effect power on items made of this material.
|
||||||
|
# This works identically to the above, but only applies to spell effects targeted in the configuration here.
|
||||||
|
# Syntax:
|
||||||
|
# materialSpecificSpellEffectModifier-##:material;spelleffect,spelleffect,spelleffect...,multiplier
|
||||||
|
# Shorthands:
|
||||||
|
# damage - Bloodthirst, Flaming Aura, Frostbrand, Rotting Touch, Venom
|
||||||
|
materialSpecificSpellEffectModifier-1:tin;113,1.20
|
||||||
|
materialSpecificSpellEffectModifier-2:adamantine;damage,32,1.10
|
||||||
|
|
||||||
|
#materialActionSpeedModifier: Apply a modifier to action speeds with items made of this material.
|
||||||
|
# This is a multiplier on the action timer.
|
||||||
|
# Lower values will reduce the timer, higher values will increase the timer. 1.10 = 10% longer timer, 0.90 = 10% faster timer.
|
||||||
|
materialActionSpeedModifier-1:glimmersteel,0.97
|
||||||
|
|
||||||
|
#materialCreationBonus: Apply a bonus to creation with this material as a product.
|
||||||
|
# This is a maximum QL increase equivalent to the value multiplied by difference from 100.
|
||||||
|
# maximum ql = ((100 - currentQL) * modifier) + currentQL
|
||||||
|
# For example, a value of 0.5 would make a 50QL material able to be created up to 75QL (100-50)*0.5 = 25. 25 + 50 = 75.
|
||||||
|
materialCreationBonus-1:steel,0.03
|
||||||
|
|
||||||
|
#materialImproveBonus: Apply a bonus to improvement on items made of this material.
|
||||||
|
# This is a multiplier to the improve amount.
|
||||||
|
# Lower values make improvement harder, higher values make improvement easier. 1.10 = 10% easier to improve. 0.90 = 10% harder to improve.
|
||||||
|
materialImproveBonus-1:iron,1.01
|
||||||
|
|
||||||
|
#materialShatterResistance: Apply a chance to resist shattering from spellcasting for items made of this material.
|
||||||
|
# This is a chance, scaling from 0.00 to 1.00. 0 being 0% chance to resist, 1 being 100% chance to resist.
|
||||||
|
materialShatterResistance-1:brass,0.10
|
||||||
|
|
||||||
|
#materialLockpickBonus: Apply a bonus to lockpicking when using lockpicks made of this material.
|
||||||
|
# This is a bonus factor with a base of zero, with positive values increasing effect and negative values decreasing effect.
|
||||||
|
materialLockpickBonus-1:brass,0.025
|
||||||
|
|
||||||
|
#materialAnchorBonus: Apply a chance to avoid a boat drifting when anchored with an anchor made of this material.
|
||||||
|
# This is a chance, scaling from 0.00 to 1.00. 0 being 0% chance to avoid drifting, 1 being 100% chance to avoid drifting.
|
||||||
|
materialAnchorBonus-1:bronze,0.95
|
||||||
|
|
||||||
|
#materialPendulumEffect: Apply a bonus to area for pendulums when using a pendulum made of this material.
|
||||||
|
# This is a multiplier for radius of the pendulum.
|
||||||
|
# Lower values reduce the radius, higher values increase the radius. 1.10 = 10% larger radius. 0.90 = 10% smaller radius.
|
||||||
|
materialPendulumEffect-1:brass,1.05
|
||||||
|
|
||||||
|
#materialRepairSpeed: Apply a speed modifier when repairing items made of this material.
|
||||||
|
# This is a multiplier for the time to repair.
|
||||||
|
# Lower values make repairing faster, higher values make repairing slower. 1.10 = 10% slower repair. 0.90 = 10% faster repair.
|
||||||
|
# NOTE: There is currently a bug where items with less than 1.00 modifier take no damage from repair.
|
||||||
|
# One of the best uses of this field is to correct this bug by setting all of the faster repair timers to 1.0 to fix this bug.
|
||||||
|
materialRepairSpeed-1:adamantine,1.00
|
||||||
|
materialRepairSpeed-2:bronze,1.00
|
||||||
|
materialRepairSpeed-3:glimmersteel,1.00
|
||||||
|
materialRepairSpeed-4:seryll,1.00
|
||||||
|
materialRepairSpeed-5:steel,1.00
|
||||||
|
|
||||||
|
#materialBashModifier: Apply a modifier to the structure bashing damage dealt with items of this material.
|
||||||
|
# This is a multiplier for damage on the bash.
|
||||||
|
# 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
|
||||||
|
|
||||||
# > Limit Factor < #
|
# > Limit Factor < #
|
||||||
#enableCustomArmourLimitFactors: This will enable or disable the usage of the section below entirely.
|
#enableCustomArmourLimitFactors: This will enable or disable the usage of the section below entirely.
|
||||||
@@ -262,7 +481,7 @@ weaponParryPercent-101:8,0
|
|||||||
## Weapon Skill Penalty ##
|
## Weapon Skill Penalty ##
|
||||||
#> Remove the small axe skill penalty
|
#> Remove the small axe skill penalty
|
||||||
weaponSkillPenalty-100:3,0
|
weaponSkillPenalty-100:3,0
|
||||||
#> Increase carving knife skill penalty to 3
|
#> Increase carving knife skill penalty to 2
|
||||||
weaponSkillPenalty-101:8,2
|
weaponSkillPenalty-101:8,2
|
||||||
|
|
||||||
#Full list of vanilla Wurm weapon names and their stats:
|
#Full list of vanilla Wurm weapon names and their stats:
|
||||||
|
|||||||
@@ -1,113 +1,446 @@
|
|||||||
package mod.sin.armoury;
|
package mod.sin.armoury;
|
||||||
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
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.combat.Armour;
|
import com.wurmonline.server.combat.Armour;
|
||||||
import com.wurmonline.server.combat.ArmourTypes;
|
import com.wurmonline.server.combat.ArmourTypes;
|
||||||
import com.wurmonline.server.items.Item;
|
import com.wurmonline.server.items.*;
|
||||||
import com.wurmonline.server.items.Materials;
|
|
||||||
|
|
||||||
import javassist.ClassPool;
|
import javassist.ClassPool;
|
||||||
import javassist.CtClass;
|
import javassist.CtClass;
|
||||||
import javassist.NotFoundException;
|
import javassist.NotFoundException;
|
||||||
|
import mod.sin.lib.Util;
|
||||||
|
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 class ArmourTweaks {
|
||||||
public static Logger logger = Logger.getLogger(ArmourTweaks.class.getName());
|
public static Logger logger = Logger.getLogger(ArmourTweaks.class.getName());
|
||||||
|
|
||||||
public static ArmouryMod mod;
|
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<String, Integer> armourNameToType = new HashMap<>();
|
||||||
|
public static HashMap<Integer, String> armourTypeToName = new HashMap<>();
|
||||||
|
|
||||||
public static float newGetArmourModFor(Item armour){
|
public static HashMap<Integer, Float> armourDamageReduction = new HashMap<>();
|
||||||
int armourType;
|
public static HashMap<Integer, HashMap<Byte, Float>> armourEffectiveness = new HashMap<>();
|
||||||
float toReturn = 0.0f;
|
public static HashMap<Integer, HashMap<Byte, Float>> armourGlanceRates = new HashMap<>();
|
||||||
if (armour != null && (armourType = armour.getArmourType()) > -1) {
|
|
||||||
if(mod.armourTypeReduction.containsKey(armourType)){
|
public static HashMap<Byte, Float> materialDamageReduction = new HashMap<>();
|
||||||
toReturn = mod.armourTypeReduction.get(armourType)-mod.unarmouredReduction;
|
public static HashMap<Byte, HashMap<Byte, Float>> materialEffectiveness = new HashMap<>();
|
||||||
}else{
|
public static HashMap<Byte, HashMap<Byte, Float>> materialGlanceRate = new HashMap<>();
|
||||||
logger.severe("[ERROR]: Could not find armour reduction reference for armour type "+armourType);
|
public static HashMap<Byte, Float> materialMovementModifier = new HashMap<>();
|
||||||
toReturn = 0f;
|
|
||||||
}
|
public static HashMap<String, Integer> armourNameToItemTemplate = new HashMap<>();
|
||||||
if (mod.armourReductionOverride.containsKey(armour.getTemplateId())){
|
|
||||||
toReturn = mod.armourReductionOverride.get(armour.getTemplateId())-mod.unarmouredReduction;
|
public static ArrayList<Armour> clothArmour = new ArrayList<>();
|
||||||
}
|
public static ArrayList<Armour> leatherArmour = new ArrayList<>();
|
||||||
if ((armourType == ArmourTypes.ARMOUR_RING || armourType == ArmourTypes.ARMOUR_CHAIN) && armour.getMaterial() == Materials.MATERIAL_STEEL){
|
public static ArrayList<Armour> studdedArmour = new ArrayList<>();
|
||||||
toReturn += 0.02f;
|
public static ArrayList<Armour> chainArmour = new ArrayList<>();
|
||||||
}
|
public static ArrayList<Armour> plateArmour = new ArrayList<>();
|
||||||
if (armour.getMaterial() == Materials.MATERIAL_GLIMMERSTEEL){
|
public static ArrayList<Armour> drakeArmour = new ArrayList<>();
|
||||||
toReturn += mod.glimmersteelMaterialMod;
|
public static ArrayList<Armour> dragonscaleArmour = new ArrayList<>();
|
||||||
} else if(armour.getMaterial() == Materials.MATERIAL_SERYLL) {
|
|
||||||
toReturn += mod.seryllMaterialMod;
|
public static float unarmouredReduction = 0.05f;
|
||||||
} else if (armour.getMaterial() == Materials.MATERIAL_ADAMANTINE) {
|
|
||||||
toReturn += mod.adamantineMaterialMod;
|
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));
|
||||||
}
|
}
|
||||||
toReturn *= 1.0f + Armour.getRarityArmourBonus(armour.getRarity());
|
|
||||||
toReturn = mod.unarmouredReduction + (float)((double)toReturn * Server.getBuffedQualityEffect(armour.getCurrentQualityLevel() / 100.0f));
|
|
||||||
}
|
}
|
||||||
return 1.0f - toReturn;
|
return 1.0f - Math.min(1.0f, toReturn);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setArmourLimitFactors(ArmouryMod mod){
|
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 = String.valueOf(armourType);
|
||||||
|
if(ArmourTweaks.armourTypeToName.containsKey(armourType)){
|
||||||
|
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));
|
||||||
|
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{
|
try{
|
||||||
logger.info("Setting armour limit factors");
|
logger.info("Setting armour limit factors");
|
||||||
for(Armour armour : mod.clothArmour){
|
for(Armour armour : clothArmour){
|
||||||
ReflectionUtil.setPrivateField(armour, ReflectionUtil.getField(armour.getClass(), "limitingFactor"), mod.clothArmourLimitFactor);
|
ReflectionUtil.setPrivateField(armour, ReflectionUtil.getField(armour.getClass(), "limitingFactor"), ArmouryMod.clothArmourLimitFactor);
|
||||||
}
|
}
|
||||||
for(Armour armour : mod.leatherArmour){
|
for(Armour armour : leatherArmour){
|
||||||
ReflectionUtil.setPrivateField(armour, ReflectionUtil.getField(armour.getClass(), "limitingFactor"), mod.leatherArmourLimitFactor);
|
ReflectionUtil.setPrivateField(armour, ReflectionUtil.getField(armour.getClass(), "limitingFactor"), ArmouryMod.leatherArmourLimitFactor);
|
||||||
}
|
}
|
||||||
for(Armour armour : mod.studdedArmour){
|
for(Armour armour : studdedArmour){
|
||||||
ReflectionUtil.setPrivateField(armour, ReflectionUtil.getField(armour.getClass(), "limitingFactor"), mod.studdedArmourLimitFactor);
|
ReflectionUtil.setPrivateField(armour, ReflectionUtil.getField(armour.getClass(), "limitingFactor"), ArmouryMod.studdedArmourLimitFactor);
|
||||||
}
|
}
|
||||||
for(Armour armour : mod.chainArmour){
|
for(Armour armour : chainArmour){
|
||||||
ReflectionUtil.setPrivateField(armour, ReflectionUtil.getField(armour.getClass(), "limitingFactor"), mod.chainArmourLimitFactor);
|
ReflectionUtil.setPrivateField(armour, ReflectionUtil.getField(armour.getClass(), "limitingFactor"), ArmouryMod.chainArmourLimitFactor);
|
||||||
}
|
}
|
||||||
for(Armour armour : mod.plateArmour){
|
for(Armour armour : plateArmour){
|
||||||
ReflectionUtil.setPrivateField(armour, ReflectionUtil.getField(armour.getClass(), "limitingFactor"), mod.plateArmourLimitFactor);
|
ReflectionUtil.setPrivateField(armour, ReflectionUtil.getField(armour.getClass(), "limitingFactor"), ArmouryMod.plateArmourLimitFactor);
|
||||||
}
|
}
|
||||||
for(Armour armour : mod.drakeArmour){
|
for(Armour armour : drakeArmour){
|
||||||
ReflectionUtil.setPrivateField(armour, ReflectionUtil.getField(armour.getClass(), "limitingFactor"), mod.drakeArmourLimitFactor);
|
ReflectionUtil.setPrivateField(armour, ReflectionUtil.getField(armour.getClass(), "limitingFactor"), ArmouryMod.drakeArmourLimitFactor);
|
||||||
}
|
}
|
||||||
for(Armour armour : mod.dragonscaleArmour){
|
for(Armour armour : dragonscaleArmour){
|
||||||
ReflectionUtil.setPrivateField(armour, ReflectionUtil.getField(armour.getClass(), "limitingFactor"), mod.dragonscaleArmourLimitFactor);
|
ReflectionUtil.setPrivateField(armour, ReflectionUtil.getField(armour.getClass(), "limitingFactor"), ArmouryMod.dragonscaleArmourLimitFactor);
|
||||||
}
|
}
|
||||||
} catch (IllegalArgumentException | IllegalAccessException | ClassCastException | NoSuchFieldException e) {
|
} catch (IllegalArgumentException | IllegalAccessException | ClassCastException | NoSuchFieldException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void preInit(ArmouryMod mod){
|
protected static ArrayList<Byte> getWoundTypes(String[] split){
|
||||||
ArmourTweaks.mod = mod;
|
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(ArmouryMod.parseWoundType(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 {
|
try {
|
||||||
ClassPool classPool = HookManager.getInstance().getClassPool();
|
ClassPool classPool = HookManager.getInstance().getClassPool();
|
||||||
final Class<ArmourTweaks> thisClass = ArmourTweaks.class;
|
final Class<ArmourTweaks> thisClass = ArmourTweaks.class;
|
||||||
|
String replace;
|
||||||
|
|
||||||
if(mod.enableArmourReductionModifications){
|
if(ArmouryMod.enableArmourModifications){
|
||||||
|
Util.setReason("Enable armour damage reduction modifications.");
|
||||||
CtClass ctArmour = classPool.get("com.wurmonline.server.combat.Armour");
|
CtClass ctArmour = classPool.get("com.wurmonline.server.combat.Armour");
|
||||||
String body = ""
|
replace = "{"
|
||||||
+ "{"
|
+ " return "+ArmourTweaks.class.getName()+".newGetArmourModFor($1, $2);"
|
||||||
+ " return "+ArmourTweaks.class.getName()+".newGetArmourModFor($1);"
|
|
||||||
+ "}";
|
+ "}";
|
||||||
Util.setBodyDeclared(thisClass, ctArmour, "getArmourModFor", body);
|
Util.setBodyDeclared(thisClass, ctArmour, "getArmourModFor", replace);
|
||||||
/*ctArmour.getDeclaredMethod("getArmourModFor").setBody("{ "
|
|
||||||
+ "return "+ArmourTweaks.class.getName()+".newGetArmourModFor($1); }");*/
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loadDefaultGlanceRates();
|
||||||
} catch (NotFoundException e) {
|
} catch (NotFoundException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onItemTemplatesCreated(ArmouryMod mod){
|
public static void onItemTemplatesCreated(){
|
||||||
|
createArmourTemplateLists();
|
||||||
try {
|
try {
|
||||||
if(mod.enableArmourMovementModifications){
|
if(ArmouryMod.enableArmourMovementModifications){
|
||||||
logger.info("Starting armour movement modifications...");
|
logger.info("Starting armour movement modifications...");
|
||||||
for(String armourName : mod.armourMovement.keySet()){
|
for(String armourName : ArmouryMod.armourMovement.keySet()){
|
||||||
int armourTemplate;
|
int armourTemplate;
|
||||||
if(mod.armourNameToItemTemplate.containsKey(armourName)){
|
if(armourNameToItemTemplate.containsKey(armourName)){
|
||||||
armourTemplate = mod.armourNameToItemTemplate.get(armourName);
|
armourTemplate = armourNameToItemTemplate.get(armourName);
|
||||||
}else{
|
}else{
|
||||||
logger.severe("[ERROR]: Could not edit armour movement for item name \""+armourName+"\". It may be invalid.");
|
logger.severe("[ERROR]: Could not edit armour movement for item name \""+armourName+"\". It may be invalid.");
|
||||||
continue;
|
continue;
|
||||||
@@ -115,15 +448,15 @@ public class ArmourTweaks {
|
|||||||
Armour armourToEdit = Armour.getArmour(armourTemplate);
|
Armour armourToEdit = Armour.getArmour(armourTemplate);
|
||||||
if(armourToEdit != null){
|
if(armourToEdit != null){
|
||||||
float oldValue = ReflectionUtil.getPrivateField(armourToEdit, ReflectionUtil.getField(armourToEdit.getClass(), "movemodifier"));
|
float oldValue = ReflectionUtil.getPrivateField(armourToEdit, ReflectionUtil.getField(armourToEdit.getClass(), "movemodifier"));
|
||||||
ReflectionUtil.setPrivateField(armourToEdit, ReflectionUtil.getField(armourToEdit.getClass(), "movemodifier"), mod.armourMovement.get(armourName));
|
ReflectionUtil.setPrivateField(armourToEdit, ReflectionUtil.getField(armourToEdit.getClass(), "movemodifier"), ArmouryMod.armourMovement.get(armourName));
|
||||||
logger.info("Editing movement modifier for armour \""+armourName+"\": From "+oldValue+" to "+mod.armourMovement.get(armourName));
|
logger.info("Editing movement modifier for armour \""+armourName+"\": From "+oldValue+" to "+ ArmouryMod.armourMovement.get(armourName));
|
||||||
}else{
|
}else{
|
||||||
logger.severe("[ERROR]: Could not edit armour movement for item name \""+armourName+"\". It may be invalid.");
|
logger.severe("[ERROR]: Could not edit armour movement for item name \""+armourName+"\". It may be invalid.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(mod.enableCustomArmourLimitFactors){
|
if(ArmouryMod.enableCustomArmourLimitFactors){
|
||||||
setArmourLimitFactors(mod);
|
setArmourLimitFactors();
|
||||||
}
|
}
|
||||||
} catch (IllegalArgumentException | IllegalAccessException | ClassCastException | NoSuchFieldException e) {
|
} catch (IllegalArgumentException | IllegalAccessException | ClassCastException | NoSuchFieldException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|||||||
@@ -1,126 +1,136 @@
|
|||||||
package mod.sin.armoury;
|
package mod.sin.armoury;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import com.wurmonline.server.creatures.CreatureTemplate;
|
||||||
|
import com.wurmonline.server.creatures.CreatureTemplateFactory;
|
||||||
|
import com.wurmonline.server.items.Materials;
|
||||||
|
import mod.sin.lib.Prop;
|
||||||
|
import org.gotti.wurmunlimited.modloader.interfaces.*;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.gotti.wurmunlimited.modloader.interfaces.Configurable;
|
|
||||||
import org.gotti.wurmunlimited.modloader.interfaces.ItemTemplatesCreatedListener;
|
|
||||||
import org.gotti.wurmunlimited.modloader.interfaces.PreInitable;
|
|
||||||
import org.gotti.wurmunlimited.modloader.interfaces.ServerStartedListener;
|
|
||||||
import org.gotti.wurmunlimited.modloader.interfaces.WurmServerMod;
|
|
||||||
|
|
||||||
import com.wurmonline.server.combat.Armour;
|
|
||||||
import com.wurmonline.server.combat.ArmourTypes;
|
|
||||||
import com.wurmonline.server.items.ItemList;
|
|
||||||
import com.wurmonline.server.items.ItemTemplate;
|
|
||||||
import com.wurmonline.server.items.ItemTemplateFactory;
|
|
||||||
|
|
||||||
public class ArmouryMod
|
public class ArmouryMod
|
||||||
implements WurmServerMod, Configurable, PreInitable, ItemTemplatesCreatedListener, ServerStartedListener {
|
implements WurmServerMod, Configurable, PreInitable, ItemTemplatesCreatedListener, ServerStartedListener {
|
||||||
private Logger logger;
|
public static Logger logger = Logger.getLogger(ArmouryMod.class.getName());
|
||||||
|
|
||||||
// Configuration options
|
// Configuration options
|
||||||
public boolean bDebug = false;
|
public static boolean enableNonPlayerCrits = true;
|
||||||
public boolean enableNonPlayerCrits = true;
|
public static boolean fixArmourLimitBuffBug = true;
|
||||||
public boolean fixArmourLimitBuffBug = true;
|
public static boolean fixArmourLimitSpellEffect = true;
|
||||||
public boolean fixArmourLimitSpellEffect = true;
|
|
||||||
|
|
||||||
// -- Armour configuration -- //
|
// -- Armour configuration -- //
|
||||||
public boolean enableArmourReductionModifications = true;
|
public static boolean enableArmourModifications = true;
|
||||||
public float unarmouredReduction = 0.05f;
|
|
||||||
// Armour Mapping
|
|
||||||
public String[] armourTypes = {"cloth", "leather", "studded", "chain", "plate", "drake", "dragonscale", // Worn armour pieces
|
|
||||||
"scale", "ring", "splint"}; // Used by the system but not worn by players
|
|
||||||
public HashMap<Integer, Float> armourTypeReduction = new HashMap<>();
|
|
||||||
public HashMap<String, Integer> armourTypeReference = new HashMap<>();
|
|
||||||
// Armour modifiers
|
// Armour modifiers
|
||||||
public float adamantineMaterialMod = 0.05f;
|
//public static float adamantineMaterialMod = 0.05f;
|
||||||
public float glimmersteelMaterialMod = 0.1f;
|
//public static float glimmersteelMaterialMod = 0.1f;
|
||||||
public float seryllMaterialMod = 0.1f;
|
//public static float seryllMaterialMod = 0.1f;
|
||||||
// Armour limit factors
|
// Armour limit factors
|
||||||
public boolean enableCustomArmourLimitFactors = true;
|
public static boolean enableCustomArmourLimitFactors = true;
|
||||||
public float clothArmourLimitFactor = 0.3f;
|
public static float clothArmourLimitFactor = 0.3f;
|
||||||
public float leatherArmourLimitFactor = 0.3f;
|
public static float leatherArmourLimitFactor = 0.3f;
|
||||||
public float studdedArmourLimitFactor = 0.0f;
|
public static float studdedArmourLimitFactor = 0.0f;
|
||||||
public float chainArmourLimitFactor = -0.15f;
|
public static float chainArmourLimitFactor = -0.15f;
|
||||||
public float plateArmourLimitFactor = -0.3f;
|
public static float plateArmourLimitFactor = -0.3f;
|
||||||
public float drakeArmourLimitFactor = -0.3f;
|
public static float drakeArmourLimitFactor = -0.3f;
|
||||||
public float dragonscaleArmourLimitFactor = -0.3f;
|
public static float dragonscaleArmourLimitFactor = -0.3f;
|
||||||
public HashMap<Integer, Float> armourReductionOverride = new HashMap<>();
|
public static HashMap<Integer, Float> armourReductionOverride = new HashMap<>();
|
||||||
// Armour movement
|
// Armour movement
|
||||||
public boolean enableArmourMovementModifications = true;
|
public static boolean enableArmourMovementModifications = true;
|
||||||
public HashMap<String, Float> armourMovement = new HashMap<>();
|
public static HashMap<String, Float> armourMovement = new HashMap<>();
|
||||||
|
|
||||||
// - Shield configuration -- //
|
// - Shield configuration -- //
|
||||||
public boolean enableShieldDamageEnchants = true;
|
public static boolean enableShieldDamageEnchants = true;
|
||||||
public boolean enableShieldSpeedEnchants = true;
|
public static boolean enableShieldSpeedEnchants = true;
|
||||||
|
|
||||||
// -- Weapon configuration -- //
|
// -- Weapon configuration -- //
|
||||||
public float minimumSwingTime = 3.0f;
|
public static float minimumSwingTime = 3.0f;
|
||||||
public boolean raresReduceSwingTime = true;
|
public static boolean raresReduceSwingTime = true;
|
||||||
public float rareSwingSpeedReduction = 0.2f;
|
public static float rareSwingSpeedReduction = 0.2f;
|
||||||
public boolean fixSavedSwingTimer = true;
|
public static boolean fixSavedSwingTimer = true;
|
||||||
public boolean betterDualWield = true; // HIGHLY EXPERIMENTAL
|
public static boolean betterDualWield = true; // HIGHLY EXPERIMENTAL
|
||||||
|
public static boolean enableWeaponMaterialChanges = true;
|
||||||
|
public static boolean enableItemMaterialChanges = true;
|
||||||
// Weapon variable changes
|
// Weapon variable changes
|
||||||
public HashMap<Integer, Float> weaponDamage = new HashMap<>();
|
public static HashMap<Integer, Float> weaponDamage = new HashMap<>();
|
||||||
public HashMap<Integer, Float> weaponSpeed = new HashMap<>();
|
public static HashMap<Integer, Float> weaponSpeed = new HashMap<>();
|
||||||
public HashMap<Integer, Float> weaponCritChance = new HashMap<>();
|
public static HashMap<Integer, Float> weaponCritChance = new HashMap<>();
|
||||||
public HashMap<Integer, Integer> weaponReach = new HashMap<>();
|
public static HashMap<Integer, Integer> weaponReach = new HashMap<>();
|
||||||
public HashMap<Integer, Integer> weaponWeightGroup = new HashMap<>();
|
public static HashMap<Integer, Integer> weaponWeightGroup = new HashMap<>();
|
||||||
public HashMap<Integer, Float> weaponParryPercent = new HashMap<>();
|
public static HashMap<Integer, Float> weaponParryPercent = new HashMap<>();
|
||||||
public HashMap<Integer, Double> weaponSkillPenalty = new HashMap<>();
|
public static HashMap<Integer, Double> weaponSkillPenalty = new HashMap<>();
|
||||||
|
|
||||||
public ArmouryMod(){
|
public static int parseArmourType(String str){
|
||||||
this.logger = Logger.getLogger(this.getClass().getName());
|
if(ArmourTweaks.armourNameToType.containsKey(str.toLowerCase())){
|
||||||
|
return ArmourTweaks.armourNameToType.get(str.toLowerCase());
|
||||||
|
}
|
||||||
|
return Integer.parseInt(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static byte parseWoundType(String str){
|
||||||
|
if(WoundAssist.woundNameToType.containsKey(str.toLowerCase())){
|
||||||
|
return WoundAssist.woundNameToType.get(str.toLowerCase());
|
||||||
|
}
|
||||||
|
return Byte.parseByte(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static byte parseMaterialType(String str){
|
||||||
|
byte mat = Materials.convertMaterialStringIntoByte(str);
|
||||||
|
if(mat > 0){
|
||||||
|
return mat;
|
||||||
|
}
|
||||||
|
return Byte.parseByte(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configure(Properties properties) {
|
public void configure(Properties properties) {
|
||||||
this.logger.info("Beginning configuration... [Testing]");
|
logger.info("Beginning configuration...");
|
||||||
|
Prop.properties = properties;
|
||||||
|
|
||||||
|
// Initialization sequences
|
||||||
|
MaterialTweaks.initializeMaterialMaps();
|
||||||
|
WoundAssist.initializeWoundMaps();
|
||||||
|
ArmourTweaks.initializeArmourMaps();
|
||||||
|
WeaponTweaks.initializeWeaponMaps();
|
||||||
|
|
||||||
// Base configuration options
|
// Base configuration options
|
||||||
this.bDebug = Boolean.parseBoolean(properties.getProperty("debug", Boolean.toString(this.bDebug)));
|
enableNonPlayerCrits = Prop.getBooleanProperty("enableNonPlayerCrits", enableNonPlayerCrits);
|
||||||
this.enableNonPlayerCrits = Boolean.parseBoolean(properties.getProperty("enableNonPlayerCrits", Boolean.toString(this.enableNonPlayerCrits)));
|
//enableNonPlayerCrits = Boolean.parseBoolean(properties.getProperty("enableNonPlayerCrits", Boolean.toString(enableNonPlayerCrits)));
|
||||||
this.fixArmourLimitBuffBug = Boolean.parseBoolean(properties.getProperty("fixArmourLimitBuffBug", Boolean.toString(this.fixArmourLimitBuffBug)));
|
fixArmourLimitBuffBug = Prop.getBooleanProperty("fixArmourLimitBuffBug", fixArmourLimitBuffBug);
|
||||||
this.fixArmourLimitSpellEffect = Boolean.parseBoolean(properties.getProperty("fixArmourLimitSpellEffect", Boolean.toString(this.fixArmourLimitSpellEffect)));
|
//fixArmourLimitBuffBug = Boolean.parseBoolean(properties.getProperty("fixArmourLimitBuffBug", Boolean.toString(fixArmourLimitBuffBug)));
|
||||||
// Armour configuration
|
fixArmourLimitSpellEffect = Prop.getBooleanProperty("fixArmourLimitSpellEffect", fixArmourLimitSpellEffect);
|
||||||
this.initArmourDefaults(); // Create references for use soon.
|
//fixArmourLimitSpellEffect = Boolean.parseBoolean(properties.getProperty("fixArmourLimitSpellEffect", Boolean.toString(fixArmourLimitSpellEffect)));
|
||||||
this.enableArmourReductionModifications = Boolean.parseBoolean(properties.getProperty("enableArmourReductionModifications", Boolean.toString(this.enableArmourReductionModifications)));
|
enableArmourModifications = Prop.getBooleanProperty("enableArmourReductionModifications", enableArmourModifications);
|
||||||
if(enableArmourReductionModifications){
|
//enableArmourModifications = Boolean.parseBoolean(properties.getProperty("enableArmourModifications", Boolean.toString(enableArmourModifications)));
|
||||||
this.unarmouredReduction = Float.parseFloat(properties.getProperty("unarmouredReduction", Float.toString(this.unarmouredReduction)));
|
ArmourTweaks.unarmouredReduction = Prop.getFloatProperty("unarmouredReduction", ArmourTweaks.unarmouredReduction);
|
||||||
for(String armourType : armourTypes){
|
/*if(enableArmourModifications){
|
||||||
int armourNum = armourTypeReference.get(armourType);
|
ArmourTweaks.configure();
|
||||||
float defaultVal = armourTypeReduction.get(armourNum);
|
}*/
|
||||||
armourTypeReduction.put(armourNum, Float.parseFloat(properties.getProperty(armourType+"Reduction", Float.toString(defaultVal))));
|
//adamantineMaterialMod = Float.parseFloat(properties.getProperty("adamantineMaterialMod", Float.toString(adamantineMaterialMod)));
|
||||||
if(armourTypeReduction.get(armourNum) <= 0f){
|
//glimmersteelMaterialMod = Float.parseFloat(properties.getProperty("glimmersteelMaterialMod", Float.toString(glimmersteelMaterialMod)));
|
||||||
this.logger.warning("[ERROR]: Armour type \""+armourType+"\" not set properly the Armour Reduction configuration in armoury.properties! It will not reduce damage at all until resolved!");
|
//seryllMaterialMod = Float.parseFloat(properties.getProperty("seryllMaterialMod", Float.toString(seryllMaterialMod)));
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.adamantineMaterialMod = Float.parseFloat(properties.getProperty("adamantineMaterialMod", Float.toString(this.adamantineMaterialMod)));
|
|
||||||
this.glimmersteelMaterialMod = Float.parseFloat(properties.getProperty("glimmersteelMaterialMod", Float.toString(this.glimmersteelMaterialMod)));
|
|
||||||
this.seryllMaterialMod = Float.parseFloat(properties.getProperty("seryllMaterialMod", Float.toString(this.seryllMaterialMod)));
|
|
||||||
// Armour limit factors
|
// Armour limit factors
|
||||||
this.enableCustomArmourLimitFactors = Boolean.parseBoolean(properties.getProperty("enableCustomArmourLimitFactors", Boolean.toString(this.enableCustomArmourLimitFactors)));
|
enableCustomArmourLimitFactors = Boolean.parseBoolean(properties.getProperty("enableCustomArmourLimitFactors", Boolean.toString(enableCustomArmourLimitFactors)));
|
||||||
this.clothArmourLimitFactor = Float.parseFloat(properties.getProperty("clothArmourLimitFactor", Float.toString(this.clothArmourLimitFactor)));
|
clothArmourLimitFactor = Float.parseFloat(properties.getProperty("clothArmourLimitFactor", Float.toString(clothArmourLimitFactor)));
|
||||||
this.leatherArmourLimitFactor = Float.parseFloat(properties.getProperty("leatherArmourLimitFactor", Float.toString(this.leatherArmourLimitFactor)));
|
leatherArmourLimitFactor = Float.parseFloat(properties.getProperty("leatherArmourLimitFactor", Float.toString(leatherArmourLimitFactor)));
|
||||||
this.studdedArmourLimitFactor = Float.parseFloat(properties.getProperty("studdedArmourLimitFactor", Float.toString(this.studdedArmourLimitFactor)));
|
studdedArmourLimitFactor = Float.parseFloat(properties.getProperty("studdedArmourLimitFactor", Float.toString(studdedArmourLimitFactor)));
|
||||||
this.chainArmourLimitFactor = Float.parseFloat(properties.getProperty("chainArmourLimitFactor", Float.toString(this.chainArmourLimitFactor)));
|
chainArmourLimitFactor = Float.parseFloat(properties.getProperty("chainArmourLimitFactor", Float.toString(chainArmourLimitFactor)));
|
||||||
this.plateArmourLimitFactor = Float.parseFloat(properties.getProperty("plateArmourLimitFactor", Float.toString(this.plateArmourLimitFactor)));
|
plateArmourLimitFactor = Float.parseFloat(properties.getProperty("plateArmourLimitFactor", Float.toString(plateArmourLimitFactor)));
|
||||||
this.drakeArmourLimitFactor = Float.parseFloat(properties.getProperty("drakeArmourLimitFactor", Float.toString(this.drakeArmourLimitFactor)));
|
drakeArmourLimitFactor = Float.parseFloat(properties.getProperty("drakeArmourLimitFactor", Float.toString(drakeArmourLimitFactor)));
|
||||||
this.dragonscaleArmourLimitFactor = Float.parseFloat(properties.getProperty("dragonscaleArmourLimitFactor", Float.toString(this.dragonscaleArmourLimitFactor)));
|
dragonscaleArmourLimitFactor = Float.parseFloat(properties.getProperty("dragonscaleArmourLimitFactor", Float.toString(dragonscaleArmourLimitFactor)));
|
||||||
// Armour movement modifiers
|
// Armour movement modifiers
|
||||||
this.enableArmourMovementModifications = Boolean.parseBoolean(properties.getProperty("enableArmourMovementModifications", Boolean.toString(this.enableArmourMovementModifications)));
|
enableArmourMovementModifications = Boolean.parseBoolean(properties.getProperty("enableArmourMovementModifications", Boolean.toString(enableArmourMovementModifications)));
|
||||||
// Shield configuration
|
// Shield configuration
|
||||||
this.enableShieldDamageEnchants = Boolean.parseBoolean(properties.getProperty("enableShieldDamageEnchants", Boolean.toString(this.enableShieldDamageEnchants)));
|
enableShieldDamageEnchants = Boolean.parseBoolean(properties.getProperty("enableShieldDamageEnchants", Boolean.toString(enableShieldDamageEnchants)));
|
||||||
// Weapon configuration
|
// Weapon configuration
|
||||||
this.minimumSwingTime = Float.parseFloat(properties.getProperty("minimumSwingTime", Float.toString(this.minimumSwingTime)));
|
minimumSwingTime = Float.parseFloat(properties.getProperty("minimumSwingTime", Float.toString(minimumSwingTime)));
|
||||||
this.raresReduceSwingTime = Boolean.parseBoolean(properties.getProperty("raresReduceSwingTime", Boolean.toString(this.raresReduceSwingTime)));
|
raresReduceSwingTime = Boolean.parseBoolean(properties.getProperty("raresReduceSwingTime", Boolean.toString(raresReduceSwingTime)));
|
||||||
this.rareSwingSpeedReduction = Float.parseFloat(properties.getProperty("rareSwingSpeedReduction", Float.toString(this.rareSwingSpeedReduction)));
|
rareSwingSpeedReduction = Float.parseFloat(properties.getProperty("rareSwingSpeedReduction", Float.toString(rareSwingSpeedReduction)));
|
||||||
this.fixSavedSwingTimer = Boolean.parseBoolean(properties.getProperty("fixSavedSwingTimer", Boolean.toString(this.fixSavedSwingTimer)));
|
fixSavedSwingTimer = Boolean.parseBoolean(properties.getProperty("fixSavedSwingTimer", Boolean.toString(fixSavedSwingTimer)));
|
||||||
this.betterDualWield = Boolean.parseBoolean(properties.getProperty("betterDualWield", Boolean.toString(this.betterDualWield)));
|
betterDualWield = Boolean.parseBoolean(properties.getProperty("betterDualWield", Boolean.toString(betterDualWield)));
|
||||||
|
enableWeaponMaterialChanges = Prop.getBooleanProperty("enableWeaponMaterialChanges", enableWeaponMaterialChanges);
|
||||||
|
enableItemMaterialChanges = Prop.getBooleanProperty("enableItemMaterialChanges", enableItemMaterialChanges);
|
||||||
for (String name : properties.stringPropertyNames()) {
|
for (String name : properties.stringPropertyNames()) {
|
||||||
try {
|
try {
|
||||||
String value = properties.getProperty(name);
|
String value = properties.getProperty(name);
|
||||||
@@ -129,6 +139,8 @@ implements WurmServerMod, Configurable, PreInitable, ItemTemplatesCreatedListene
|
|||||||
case "classname":
|
case "classname":
|
||||||
case "classpath":
|
case "classpath":
|
||||||
case "sharedClassLoader":
|
case "sharedClassLoader":
|
||||||
|
case "depend.import":
|
||||||
|
case "depend.suggests":
|
||||||
break; //ignore
|
break; //ignore
|
||||||
default:
|
default:
|
||||||
if (name.startsWith("armourMovement")) {
|
if (name.startsWith("armourMovement")) {
|
||||||
@@ -137,10 +149,135 @@ implements WurmServerMod, Configurable, PreInitable, ItemTemplatesCreatedListene
|
|||||||
float newVal = Float.parseFloat(split[1]);
|
float newVal = Float.parseFloat(split[1]);
|
||||||
armourMovement.put(armourName, newVal);
|
armourMovement.put(armourName, newVal);
|
||||||
} else if (name.startsWith("armourReductionOverride")) {
|
} else if (name.startsWith("armourReductionOverride")) {
|
||||||
String[] split = value.split(",");
|
String[] split = value.split(",");
|
||||||
int armourId = Integer.parseInt(split[0]);
|
int armourId = Integer.parseInt(split[0]);
|
||||||
float reductionValue = Float.parseFloat(split[1]);
|
float reductionValue = Float.parseFloat(split[1]);
|
||||||
armourReductionOverride.put(armourId, reductionValue);
|
armourReductionOverride.put(armourId, reductionValue);
|
||||||
|
} else if (name.startsWith("armourDamageReduction")) {
|
||||||
|
String[] split = value.split(",");
|
||||||
|
int armourId = parseArmourType(split[0]);
|
||||||
|
float reductionValue = Float.parseFloat(split[1]);
|
||||||
|
ArmourTweaks.addArmourDamageReduction(armourId, reductionValue);
|
||||||
|
} else if (name.startsWith("armourEffectiveness")) {
|
||||||
|
String[] split = value.split(";");
|
||||||
|
int armourType = parseArmourType(split[0]);
|
||||||
|
String[] split2 = split[1].split(",");
|
||||||
|
ArmourTweaks.addArmourEffectiveness(armourType, split2);
|
||||||
|
} else if (name.startsWith("armourGlanceRate")) {
|
||||||
|
String[] split = value.split(";");
|
||||||
|
int armourType = parseArmourType(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(",");
|
||||||
|
byte material = parseMaterialType(split[0]);
|
||||||
|
double mult = Double.parseDouble(split[1]);
|
||||||
|
WeaponTweaks.addMaterialWeaponDamage(material, mult);
|
||||||
|
} else if (name.startsWith("materialWeaponSpeed")) {
|
||||||
|
String[] split = value.split(",");
|
||||||
|
byte material = parseMaterialType(split[0]);
|
||||||
|
float mult = Float.parseFloat(split[1]);
|
||||||
|
WeaponTweaks.addMaterialWeaponSpeed(material, mult);
|
||||||
|
} else if (name.startsWith("materialWeaponParry")) {
|
||||||
|
String[] split = value.split(",");
|
||||||
|
byte material = parseMaterialType(split[0]);
|
||||||
|
float mult = Float.parseFloat(split[1]);
|
||||||
|
WeaponTweaks.addMaterialWeaponParry(material, mult);
|
||||||
|
} else if (name.startsWith("materialWeaponArmourDamage")) {
|
||||||
|
String[] split = value.split(",");
|
||||||
|
byte material = parseMaterialType(split[0]);
|
||||||
|
double mult = Double.parseDouble(split[1]);
|
||||||
|
WeaponTweaks.addMaterialWeaponArmourDamage(material, mult);
|
||||||
|
} else if (name.startsWith("materialDamageModifier")) {
|
||||||
|
String[] split = value.split(",");
|
||||||
|
byte material = parseMaterialType(split[0]);
|
||||||
|
float mult = Float.parseFloat(split[1]);
|
||||||
|
MaterialTweaks.addMaterialDamageModifier(material, mult);
|
||||||
|
} else if (name.startsWith("materialDecayModifier")) {
|
||||||
|
String[] split = value.split(",");
|
||||||
|
byte material = parseMaterialType(split[0]);
|
||||||
|
float mult = Float.parseFloat(split[1]);
|
||||||
|
MaterialTweaks.addMaterialDecayModifier(material, mult);
|
||||||
|
} else if (name.startsWith("materialCreationBonus")) {
|
||||||
|
String[] split = value.split(",");
|
||||||
|
byte material = parseMaterialType(split[0]);
|
||||||
|
float bonus = Float.parseFloat(split[1]);
|
||||||
|
MaterialTweaks.addMaterialCreationBonus(material, bonus);
|
||||||
|
} else if (name.startsWith("materialImproveBonus")) {
|
||||||
|
String[] split = value.split(",");
|
||||||
|
byte material = parseMaterialType(split[0]);
|
||||||
|
float bonus = Float.parseFloat(split[1]);
|
||||||
|
MaterialTweaks.addMaterialImproveBonus(material, bonus);
|
||||||
|
} else if (name.startsWith("materialShatterResistance")) {
|
||||||
|
String[] split = value.split(",");
|
||||||
|
byte material = parseMaterialType(split[0]);
|
||||||
|
float resistance = Float.parseFloat(split[1]);
|
||||||
|
MaterialTweaks.addMaterialShatterResistance(material, resistance);
|
||||||
|
} else if (name.startsWith("materialLockpickBonus")) {
|
||||||
|
String[] split = value.split(",");
|
||||||
|
byte material = parseMaterialType(split[0]);
|
||||||
|
float bonus = Float.parseFloat(split[1]);
|
||||||
|
MaterialTweaks.addMaterialLockpickBonus(material, bonus);
|
||||||
|
} else if (name.startsWith("materialAnchorBonus")) {
|
||||||
|
String[] split = value.split(",");
|
||||||
|
byte material = parseMaterialType(split[0]);
|
||||||
|
float bonus = Float.parseFloat(split[1]);
|
||||||
|
MaterialTweaks.addMaterialAnchorBonus(material, bonus);
|
||||||
|
} else if (name.startsWith("materialPendulumEffect")) {
|
||||||
|
String[] split = value.split(",");
|
||||||
|
byte material = parseMaterialType(split[0]);
|
||||||
|
float bonus = Float.parseFloat(split[1]);
|
||||||
|
MaterialTweaks.addMaterialPendulumEffect(material, bonus);
|
||||||
|
} else if (name.startsWith("materialRepairSpeed")) {
|
||||||
|
String[] split = value.split(",");
|
||||||
|
byte material = parseMaterialType(split[0]);
|
||||||
|
float mult = Float.parseFloat(split[1]);
|
||||||
|
MaterialTweaks.addMaterialRepairSpeed(material, mult);
|
||||||
|
} else if (name.startsWith("materialBashModifier")) {
|
||||||
|
String[] split = value.split(",");
|
||||||
|
byte material = parseMaterialType(split[0]);
|
||||||
|
double mult = Double.parseDouble(split[1]);
|
||||||
|
MaterialTweaks.addMaterialBashModifier(material, mult);
|
||||||
|
} else if (name.startsWith("materialSpellEffectModifier")) {
|
||||||
|
String[] split = value.split(",");
|
||||||
|
byte material = parseMaterialType(split[0]);
|
||||||
|
float mult = Float.parseFloat(split[1]);
|
||||||
|
MaterialTweaks.addMaterialSpellEffectModifier(material, mult);
|
||||||
|
} else if (name.startsWith("materialSpecificSpellEffectModifier")) {
|
||||||
|
String[] split = value.split(";");
|
||||||
|
byte material = parseMaterialType(split[0]);
|
||||||
|
String[] split2 = split[1].split(",");
|
||||||
|
MaterialTweaks.addMaterialSpecificSpellEffectModifier(material, split2);
|
||||||
|
} else if (name.startsWith("materialDifficultyModifier")) {
|
||||||
|
String[] split = value.split(",");
|
||||||
|
byte material = parseMaterialType(split[0]);
|
||||||
|
double mult = Double.parseDouble(split[1]);
|
||||||
|
MaterialTweaks.addMaterialDifficultyModifier(material, mult);
|
||||||
|
} else if (name.startsWith("materialActionSpeedModifier")) {
|
||||||
|
String[] split = value.split(",");
|
||||||
|
byte material = parseMaterialType(split[0]);
|
||||||
|
double mult = Double.parseDouble(split[1]);
|
||||||
|
MaterialTweaks.addMaterialActionSpeedModifier(material, mult);
|
||||||
} else if (name.startsWith("weaponDamage")) {
|
} else if (name.startsWith("weaponDamage")) {
|
||||||
String[] split = value.split(",");
|
String[] split = value.split(",");
|
||||||
int weaponId = Integer.parseInt(split[0]);
|
int weaponId = Integer.parseInt(split[0]);
|
||||||
@@ -177,166 +314,220 @@ 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);
|
logger.warning("Unknown config property: " + name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Debug("Error processing property " + name);
|
logger.severe("Error processing property " + name);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Print values of main.java.armoury.mod configuration
|
// Print values of main.java.armoury.mod configuration
|
||||||
this.logger.info(" -- Mod Configuration -- ");
|
logger.info(" -- Mod Configuration -- ");
|
||||||
this.logger.log(Level.INFO, "enableNonPlayerCrits: " + this.enableNonPlayerCrits);
|
logger.log(Level.INFO, "enableNonPlayerCrits: " + enableNonPlayerCrits);
|
||||||
this.logger.log(Level.INFO, "fixArmourLimitBuffBug: " + this.fixArmourLimitBuffBug);
|
logger.log(Level.INFO, "fixArmourLimitBuffBug: " + fixArmourLimitBuffBug);
|
||||||
this.logger.log(Level.INFO, "fixArmourLimitSpellEffect: " + this.fixArmourLimitSpellEffect);
|
logger.log(Level.INFO, "fixArmourLimitSpellEffect: " + fixArmourLimitSpellEffect);
|
||||||
this.logger.info(" -- Armour Configuration -- ");
|
logger.info(" -- Armour Configuration -- ");
|
||||||
this.logger.log(Level.INFO, "enableArmourReductionModifications: " + this.enableArmourReductionModifications);
|
logger.log(Level.INFO, "enableArmourModifications: " + enableArmourModifications);
|
||||||
if(enableArmourReductionModifications){
|
if(enableArmourModifications){
|
||||||
this.logger.log(Level.INFO, "unarmouredReduction: " + this.unarmouredReduction);
|
logger.log(Level.INFO, "unarmouredReduction: " + ArmourTweaks.unarmouredReduction);
|
||||||
this.logger.info("> Armour Reduction Settings <");
|
logger.info("> Armour Base DR Settings <");
|
||||||
for(String armourType : armourTypeReference.keySet()){
|
for(int armourType : ArmourTweaks.armourDamageReduction.keySet()){
|
||||||
this.logger.info(armourType+" - "+((int)(armourTypeReduction.get(armourTypeReference.get(armourType))*100))+"%");
|
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 = 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 = String.valueOf(woundType);
|
||||||
|
if(WoundAssist.woundTypeToName.containsKey(woundType)){
|
||||||
|
wound = WoundAssist.woundTypeToName.get(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 = 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 = String.valueOf(woundType);
|
||||||
|
if(WoundAssist.woundTypeToName.containsKey(woundType)){
|
||||||
|
wound = WoundAssist.woundTypeToName.get(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) +"%");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.logger.log(Level.INFO, "adamantineMaterialMod: " + this.adamantineMaterialMod);
|
logger.info(" -- Material Configuration -- ");
|
||||||
this.logger.log(Level.INFO, "glimmersteelMaterialMod: " + this.glimmersteelMaterialMod);
|
logger.info("> Armour Material Damage Reduction Settings <");
|
||||||
this.logger.log(Level.INFO, "seryllMaterialMod: " + this.seryllMaterialMod);
|
for(byte material : ArmourTweaks.materialDamageReduction.keySet()){
|
||||||
this.logger.log(Level.INFO, "enableCustomArmourLimitFactors: " + this.enableCustomArmourLimitFactors);
|
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 = String.valueOf(woundType);
|
||||||
|
if(WoundAssist.woundTypeToName.containsKey(woundType)){
|
||||||
|
wound = WoundAssist.woundTypeToName.get(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 = String.valueOf(woundType);
|
||||||
|
if(WoundAssist.woundTypeToName.containsKey(woundType)){
|
||||||
|
wound = WoundAssist.woundTypeToName.get(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 <");
|
||||||
|
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("> Weapon Material Speed Settings <");
|
||||||
|
for(byte material : WeaponTweaks.materialWeaponSpeed.keySet()){
|
||||||
|
logger.info(String.format("Speed modifier for material %s: %.2f%%", MaterialTweaks.getMaterialName(material), WeaponTweaks.materialWeaponSpeed.get(material)*100f));
|
||||||
|
}
|
||||||
|
logger.info("> Weapon Material Parry Settings <");
|
||||||
|
for(byte material : WeaponTweaks.materialWeaponParry.keySet()){
|
||||||
|
logger.info(String.format("Parry modifier for material %s: %.2f%%", MaterialTweaks.getMaterialName(material), WeaponTweaks.materialWeaponParry.get(material)*100f));
|
||||||
|
}
|
||||||
|
logger.info("> Weapon Material Armour Damage Settings <");
|
||||||
|
for(byte material : WeaponTweaks.materialWeaponArmourDamage.keySet()){
|
||||||
|
logger.info(String.format("Armour Damage modifier for material %s: %.2f%%", MaterialTweaks.getMaterialName(material), WeaponTweaks.materialWeaponArmourDamage.get(material)*100f));
|
||||||
|
}
|
||||||
|
logger.info("> Item Material Damage Modifier Settings <");
|
||||||
|
for(byte material : MaterialTweaks.materialDamageModifier.keySet()){
|
||||||
|
logger.info(String.format("Damage modifier for material %s: %.2f%%", MaterialTweaks.getMaterialName(material), MaterialTweaks.materialDamageModifier.get(material)*100f));
|
||||||
|
}
|
||||||
|
logger.info("> Item Material Decay Modifier Settings <");
|
||||||
|
for(byte material : MaterialTweaks.materialDecayModifier.keySet()){
|
||||||
|
logger.info(String.format("Decay modifier for material %s: %.2f%%", MaterialTweaks.getMaterialName(material), MaterialTweaks.materialDecayModifier.get(material)*100f));
|
||||||
|
}
|
||||||
|
logger.info("> Item Material Creation Bonus Settings <");
|
||||||
|
for(byte material : MaterialTweaks.materialCreationBonus.keySet()){
|
||||||
|
logger.info(String.format("Creation bonus for material %s: %.2f%%", MaterialTweaks.getMaterialName(material), MaterialTweaks.materialCreationBonus.get(material)*100f));
|
||||||
|
}
|
||||||
|
logger.info("> Item Material Improve Bonus Settings <");
|
||||||
|
for(byte material : MaterialTweaks.materialImproveBonus.keySet()){
|
||||||
|
logger.info(String.format("Improve bonus for material %s: %.2f%%", MaterialTweaks.getMaterialName(material), MaterialTweaks.materialImproveBonus.get(material)*100f));
|
||||||
|
}
|
||||||
|
logger.info("> Item Material Shatter Resistance Settings <");
|
||||||
|
for(byte material : MaterialTweaks.materialShatterResistance.keySet()){
|
||||||
|
logger.info(String.format("Shatter resistance for material %s: %.2f%%", MaterialTweaks.getMaterialName(material), MaterialTweaks.materialShatterResistance.get(material)*100f));
|
||||||
|
}
|
||||||
|
logger.info("> Item Material Lockpick Bonus Settings <");
|
||||||
|
for(byte material : MaterialTweaks.materialLockpickBonus.keySet()){
|
||||||
|
logger.info(String.format("Lockpick bonus for material %s: %.2f%%", MaterialTweaks.getMaterialName(material), MaterialTweaks.materialLockpickBonus.get(material)*100f));
|
||||||
|
}
|
||||||
|
logger.info("> Item Material Anchor Bonus Settings <");
|
||||||
|
for(byte material : MaterialTweaks.materialAnchorBonus.keySet()){
|
||||||
|
logger.info(String.format("Anchor bonus for material %s: %.2f%%", MaterialTweaks.getMaterialName(material), MaterialTweaks.materialAnchorBonus.get(material)*100f));
|
||||||
|
}
|
||||||
|
logger.info("> Item Material Pendulum Effect Settings <");
|
||||||
|
for(byte material : MaterialTweaks.materialPendulumEffect.keySet()){
|
||||||
|
logger.info(String.format("Pendulum effect for material %s: %.2f%%", MaterialTweaks.getMaterialName(material), MaterialTweaks.materialPendulumEffect.get(material)*100f));
|
||||||
|
}
|
||||||
|
logger.info("> Item Material Repair Speed Settings <");
|
||||||
|
for(byte material : MaterialTweaks.materialRepairSpeed.keySet()){
|
||||||
|
logger.info(String.format("Repair speed for material %s: %.2f%%", MaterialTweaks.getMaterialName(material), MaterialTweaks.materialRepairSpeed.get(material)*100f));
|
||||||
|
}
|
||||||
|
logger.info("> Item Material Bash Modifier Settings <");
|
||||||
|
for(byte material : MaterialTweaks.materialBashModifier.keySet()){
|
||||||
|
logger.info(String.format("Bash modifier for material %s: %.2f%%", MaterialTweaks.getMaterialName(material), MaterialTweaks.materialBashModifier.get(material)*100f));
|
||||||
|
}
|
||||||
|
logger.info("> Item Material Spell Effect Modifier Settings <");
|
||||||
|
for(byte material : MaterialTweaks.materialSpellEffectModifier.keySet()){
|
||||||
|
logger.info(String.format("Spell effect modifier for material %s: %.2f%%", MaterialTweaks.getMaterialName(material), MaterialTweaks.materialSpellEffectModifier.get(material)*100f));
|
||||||
|
}
|
||||||
|
logger.info("> Item Material Specific Spell Effect Modifier Settings <");
|
||||||
|
for(byte material : MaterialTweaks.materialSpecificSpellEffectModifier.keySet()){
|
||||||
|
//String name = materialNameReference.containsKey(material) ? materialNameReference.get(material) : String.valueOf(material);
|
||||||
|
HashMap<Byte, Float> enchantMap = MaterialTweaks.materialSpecificSpellEffectModifier.get(material);
|
||||||
|
for(byte enchant : enchantMap.keySet()){
|
||||||
|
logger.info(String.format("Spell Effect Power for material %s with enchant %s: %.2f%%", MaterialTweaks.getMaterialName(material), enchant, enchantMap.get(enchant)*100f));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
logger.info("> Item Material Difficulty Modifier Settings <");
|
||||||
|
for(byte material : MaterialTweaks.materialDifficultyModifier.keySet()){
|
||||||
|
logger.info(String.format("Difficulty modifier for material %s: %.2f%%", MaterialTweaks.getMaterialName(material), MaterialTweaks.materialDifficultyModifier.get(material)*100f));
|
||||||
|
}
|
||||||
|
logger.info("> Item Material Action Speed Modifier Settings <");
|
||||||
|
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.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){
|
if(enableCustomArmourLimitFactors){
|
||||||
this.logger.log(Level.INFO, "clothArmourLimitFactor: " + this.clothArmourLimitFactor);
|
logger.log(Level.INFO, "clothArmourLimitFactor: " + clothArmourLimitFactor);
|
||||||
this.logger.log(Level.INFO, "leatherArmourLimitFactor: " + this.leatherArmourLimitFactor);
|
logger.log(Level.INFO, "leatherArmourLimitFactor: " + leatherArmourLimitFactor);
|
||||||
this.logger.log(Level.INFO, "studdedArmourLimitFactor: " + this.studdedArmourLimitFactor);
|
logger.log(Level.INFO, "studdedArmourLimitFactor: " + studdedArmourLimitFactor);
|
||||||
this.logger.log(Level.INFO, "chainArmourLimitFactor: " + this.chainArmourLimitFactor);
|
logger.log(Level.INFO, "chainArmourLimitFactor: " + chainArmourLimitFactor);
|
||||||
this.logger.log(Level.INFO, "plateArmourLimitFactor: " + this.plateArmourLimitFactor);
|
logger.log(Level.INFO, "plateArmourLimitFactor: " + plateArmourLimitFactor);
|
||||||
this.logger.log(Level.INFO, "drakeArmourLimitFactor: " + this.drakeArmourLimitFactor);
|
logger.log(Level.INFO, "drakeArmourLimitFactor: " + drakeArmourLimitFactor);
|
||||||
this.logger.log(Level.INFO, "dragonscaleArmourLimitFactor: " + this.dragonscaleArmourLimitFactor);
|
logger.log(Level.INFO, "dragonscaleArmourLimitFactor: " + dragonscaleArmourLimitFactor);
|
||||||
}
|
|
||||||
this.logger.info(" -- Shield Configuration -- ");
|
|
||||||
this.logger.log(Level.INFO, "enableShieldDamageEnchants: " + this.enableShieldDamageEnchants);
|
|
||||||
this.logger.info(" -- Weapon Configuration -- ");
|
|
||||||
this.logger.log(Level.INFO, "minimumSwingTime: " + this.minimumSwingTime);
|
|
||||||
this.logger.log(Level.INFO, "raresReduceSwingTime: " + this.raresReduceSwingTime);
|
|
||||||
this.logger.log(Level.INFO, "rareSwingSpeedReduction: " + this.rareSwingSpeedReduction);
|
|
||||||
this.logger.log(Level.INFO, "fixSavedSwingTimer: " + this.fixSavedSwingTimer);
|
|
||||||
this.logger.log(Level.INFO, "betterDualWield: " + this.betterDualWield);
|
|
||||||
this.Debug("Debugging messages are enabled.");
|
|
||||||
this.logger.info(" -- Configuration complete -- ");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void Debug(String x) {
|
|
||||||
if (this.bDebug) {
|
|
||||||
System.out.println(String.valueOf(this.getClass().getSimpleName()) + ": " + x);
|
|
||||||
System.out.flush();
|
|
||||||
this.logger.log(Level.INFO, x);
|
|
||||||
}
|
}
|
||||||
|
logger.info(" -- Shield Configuration -- ");
|
||||||
|
logger.log(Level.INFO, "enableShieldDamageEnchants: " + enableShieldDamageEnchants);
|
||||||
|
logger.info(" -- Weapon Configuration -- ");
|
||||||
|
logger.log(Level.INFO, "minimumSwingTime: " + minimumSwingTime);
|
||||||
|
logger.log(Level.INFO, "raresReduceSwingTime: " + raresReduceSwingTime);
|
||||||
|
logger.log(Level.INFO, "rareSwingSpeedReduction: " + rareSwingSpeedReduction);
|
||||||
|
logger.log(Level.INFO, "fixSavedSwingTimer: " + fixSavedSwingTimer);
|
||||||
|
logger.log(Level.INFO, "betterDualWield: " + betterDualWield);
|
||||||
|
logger.info(" -- Configuration complete -- ");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preInit(){
|
public void preInit(){
|
||||||
CombatTweaks.preInit(this);
|
CombatTweaks.preInit();
|
||||||
ArmourTweaks.preInit(this);
|
ArmourTweaks.preInit();
|
||||||
ShieldTweaks.preInit(this);
|
ShieldTweaks.preInit();
|
||||||
|
WeaponTweaks.preInit();
|
||||||
|
MaterialTweaks.preInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onItemTemplatesCreated(){
|
public void onItemTemplatesCreated(){
|
||||||
logger.info("Creating armour template lists...");
|
logger.info("Beginning onItemTemplatesCreated...");
|
||||||
createArmourTemplateLists();
|
ArmourTweaks.onItemTemplatesCreated();
|
||||||
ArmourTweaks.onItemTemplatesCreated(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onServerStarted(){
|
public void onServerStarted(){
|
||||||
WeaponTweaks.onServerStarted(this);
|
WeaponTweaks.onServerStarted();
|
||||||
|
for(CreatureTemplate template : CreatureTemplateFactory.getInstance().getTemplates()){
|
||||||
|
if(ArmourTweaks.armourTypeToName.containsKey((int) template.getArmourType())) {
|
||||||
|
logger.info(template.getName() + " - " + ArmourTweaks.armourTypeToName.get((int) template.getArmourType()));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashMap<String, Integer> armourNameToItemTemplate = new HashMap<>();
|
|
||||||
|
|
||||||
public ArrayList<Armour> clothArmour = new ArrayList<>();
|
|
||||||
public ArrayList<Armour> leatherArmour = new ArrayList<>();
|
|
||||||
public ArrayList<Armour> studdedArmour = new ArrayList<>();
|
|
||||||
public ArrayList<Armour> chainArmour = new ArrayList<>();
|
|
||||||
public ArrayList<Armour> plateArmour = new ArrayList<>();
|
|
||||||
public ArrayList<Armour> drakeArmour = new ArrayList<>();
|
|
||||||
public ArrayList<Armour> dragonscaleArmour = new ArrayList<>();
|
|
||||||
|
|
||||||
private void addArmour(ArrayList<Armour> typeList, int itemTemplate){
|
|
||||||
ItemTemplate it = ItemTemplateFactory.getInstance().getTemplateOrNull(itemTemplate);
|
|
||||||
if(it != null){
|
|
||||||
armourNameToItemTemplate.put(it.getName(), itemTemplate);
|
|
||||||
}
|
|
||||||
typeList.add(Armour.getArmour(itemTemplate));
|
|
||||||
}
|
|
||||||
|
|
||||||
public 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initArmourDefaults(){
|
|
||||||
armourTypeReference.put("cloth", ArmourTypes.ARMOUR_CLOTH);
|
|
||||||
armourTypeReduction.put(ArmourTypes.ARMOUR_CLOTH, 0.4f);
|
|
||||||
armourTypeReference.put("leather", ArmourTypes.ARMOUR_LEATHER);
|
|
||||||
armourTypeReduction.put(ArmourTypes.ARMOUR_LEATHER, 0.5f);
|
|
||||||
armourTypeReference.put("studded", ArmourTypes.ARMOUR_STUDDED);
|
|
||||||
armourTypeReduction.put(ArmourTypes.ARMOUR_STUDDED, 0.55f);
|
|
||||||
armourTypeReference.put("chain", ArmourTypes.ARMOUR_CHAIN);
|
|
||||||
armourTypeReduction.put(ArmourTypes.ARMOUR_CHAIN, 0.6f);
|
|
||||||
armourTypeReference.put("plate", ArmourTypes.ARMOUR_PLATE);
|
|
||||||
armourTypeReduction.put(ArmourTypes.ARMOUR_PLATE, 0.7f);
|
|
||||||
armourTypeReference.put("drake", ArmourTypes.ARMOUR_LEATHER_DRAGON);
|
|
||||||
armourTypeReduction.put(ArmourTypes.ARMOUR_LEATHER_DRAGON, 0.7f);
|
|
||||||
armourTypeReference.put("dragonscale", ArmourTypes.ARMOUR_SCALE_DRAGON);
|
|
||||||
armourTypeReduction.put(ArmourTypes.ARMOUR_SCALE_DRAGON, 0.75f);
|
|
||||||
armourTypeReference.put("scale", ArmourTypes.ARMOUR_SCALE);
|
|
||||||
armourTypeReduction.put(ArmourTypes.ARMOUR_SCALE, 0.5f);
|
|
||||||
armourTypeReference.put("ring", ArmourTypes.ARMOUR_RING);
|
|
||||||
armourTypeReduction.put(ArmourTypes.ARMOUR_RING, 0.55f);
|
|
||||||
armourTypeReference.put("splint", ArmourTypes.ARMOUR_SPLINT);
|
|
||||||
armourTypeReduction.put(ArmourTypes.ARMOUR_SPLINT, 0.6f);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,14 +39,14 @@ public class CombatTweaks {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void preInit(ArmouryMod mod){
|
public static void preInit(){
|
||||||
try {
|
try {
|
||||||
ClassPool classPool = HookManager.getInstance().getClassPool();
|
ClassPool classPool = HookManager.getInstance().getClassPool();
|
||||||
Class<CombatTweaks> thisClass = CombatTweaks.class;
|
Class<CombatTweaks> thisClass = CombatTweaks.class;
|
||||||
|
|
||||||
// - Allow critical hits on creatures as well as players -
|
// - Allow critical hits on creatures as well as players -
|
||||||
mod.enableNonPlayerCrits = false; // Disabled for now as it's not working.
|
ArmouryMod.enableNonPlayerCrits = false; // Disabled for now as it's not working.
|
||||||
if(mod.enableNonPlayerCrits){
|
if(ArmouryMod.enableNonPlayerCrits){
|
||||||
CtClass ctCombatHandler = classPool.get("com.wurmonline.server.creatures.CombatHandler");
|
CtClass ctCombatHandler = classPool.get("com.wurmonline.server.creatures.CombatHandler");
|
||||||
CtClass[] attackParams1 = {
|
CtClass[] attackParams1 = {
|
||||||
classPool.get("com.wurmonline.server.creatures.Creature"),
|
classPool.get("com.wurmonline.server.creatures.Creature"),
|
||||||
@@ -82,7 +82,7 @@ public class CombatTweaks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// - Fix the Armour Limit being shown in the buff bar at all times -
|
// - Fix the Armour Limit being shown in the buff bar at all times -
|
||||||
if(mod.fixArmourLimitBuffBug){
|
if(ArmouryMod.fixArmourLimitBuffBug){
|
||||||
CtClass ctPlayerInfo = classPool.get("com.wurmonline.server.players.PlayerInfo");
|
CtClass ctPlayerInfo = classPool.get("com.wurmonline.server.players.PlayerInfo");
|
||||||
String replace = ""
|
String replace = ""
|
||||||
+ "communicator.sendRemoveSpellEffect(com.wurmonline.server.creatures.SpellEffectsEnum.ARMOUR_LIMIT_NONE);"
|
+ "communicator.sendRemoveSpellEffect(com.wurmonline.server.creatures.SpellEffectsEnum.ARMOUR_LIMIT_NONE);"
|
||||||
@@ -123,7 +123,7 @@ public class CombatTweaks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// - Make spell effects hud show your armour limit properly - //
|
// - Make spell effects hud show your armour limit properly - //
|
||||||
if(mod.fixArmourLimitSpellEffect){
|
if(ArmouryMod.fixArmourLimitSpellEffect){
|
||||||
ReflectionUtil.setPrivateField(SpellEffectsEnum.ARMOUR_LIMIT_HEAVY, ReflectionUtil.getField(SpellEffectsEnum.ARMOUR_LIMIT_HEAVY.getClass(), "name"), "Armour Penalty");
|
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_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_LIGHT, ReflectionUtil.getField(SpellEffectsEnum.ARMOUR_LIMIT_LIGHT.getClass(), "name"), "Armour Bonus");
|
||||||
@@ -131,16 +131,16 @@ public class CombatTweaks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// - Change the minimum swing timer - //
|
// - Change the minimum swing timer - //
|
||||||
if(mod.minimumSwingTime != 3.0f){
|
if(ArmouryMod.minimumSwingTime != 3.0f){
|
||||||
CtClass ctCombatHandler = classPool.get("com.wurmonline.server.creatures.CombatHandler");
|
CtClass ctCombatHandler = classPool.get("com.wurmonline.server.creatures.CombatHandler");
|
||||||
String strBuilder = "";
|
String strBuilder = "";
|
||||||
if(mod.raresReduceSwingTime){
|
if(ArmouryMod.raresReduceSwingTime){
|
||||||
strBuilder += ""
|
strBuilder += ""
|
||||||
+ "if(weapon.getRarity() > 0){"
|
+ "if(weapon.getRarity() > 0){"
|
||||||
+ " calcspeed -= weapon.getRarity()*"+String.valueOf(mod.rareSwingSpeedReduction)+"f;"
|
+ " calcspeed -= weapon.getRarity()*"+String.valueOf(ArmouryMod.rareSwingSpeedReduction)+"f;"
|
||||||
+ "}";
|
+ "}";
|
||||||
}
|
}
|
||||||
strBuilder += "$_ = $proceed("+String.valueOf(mod.minimumSwingTime)+"f, $2);";
|
strBuilder += "$_ = $proceed("+String.valueOf(ArmouryMod.minimumSwingTime)+"f, $2);";
|
||||||
|
|
||||||
final String stringReplace = strBuilder;
|
final String stringReplace = strBuilder;
|
||||||
CtClass[] params1 = {
|
CtClass[] params1 = {
|
||||||
@@ -173,7 +173,7 @@ public class CombatTweaks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// - Saved swing timer fix -
|
// - Saved swing timer fix -
|
||||||
if(mod.fixSavedSwingTimer){
|
if(ArmouryMod.fixSavedSwingTimer){
|
||||||
CtClass ctCreature = classPool.get("com.wurmonline.server.creatures.Creature");
|
CtClass ctCreature = classPool.get("com.wurmonline.server.creatures.Creature");
|
||||||
String replace = "$_ = $proceed($1, new Float(0f));";
|
String replace = "$_ = $proceed($1, new Float(0f));";
|
||||||
Util.setReason("Fix saved swing timer.");
|
Util.setReason("Fix saved swing timer.");
|
||||||
@@ -190,7 +190,7 @@ public class CombatTweaks {
|
|||||||
|
|
||||||
// - Attempt for a better dual wield system -
|
// - Attempt for a better dual wield system -
|
||||||
// This really doesn't work. I don't get dual wield and why it's so bad.
|
// This really doesn't work. I don't get dual wield and why it's so bad.
|
||||||
if(mod.betterDualWield){
|
if(ArmouryMod.betterDualWield){
|
||||||
CtClass ctCombatHandler = classPool.get("com.wurmonline.server.creatures.CombatHandler");
|
CtClass ctCombatHandler = classPool.get("com.wurmonline.server.creatures.CombatHandler");
|
||||||
CtClass[] params1 = {
|
CtClass[] params1 = {
|
||||||
classPool.get("com.wurmonline.server.creatures.Creature"),
|
classPool.get("com.wurmonline.server.creatures.Creature"),
|
||||||
@@ -201,7 +201,7 @@ public class CombatTweaks {
|
|||||||
};
|
};
|
||||||
String desc = Descriptor.ofMethod(CtClass.booleanType, params1);
|
String desc = Descriptor.ofMethod(CtClass.booleanType, params1);
|
||||||
String replace = "if(this.creature.isPlayer()){"
|
String replace = "if(this.creature.isPlayer()){"
|
||||||
+ " com.wurmonline.server.items.Item weapon = CombatTweaks.handleDualWieldAttack(this, opponent, delta);"
|
+ " com.wurmonline.server.items.Item weapon = "+CombatTweaks.class.getName()+".handleDualWieldAttack(this, opponent, delta);"
|
||||||
+ " if(weapon != null){"
|
+ " if(weapon != null){"
|
||||||
+ " lDead = attack(opponent, weapon, true);"
|
+ " lDead = attack(opponent, weapon, true);"
|
||||||
+ " }"
|
+ " }"
|
||||||
|
|||||||
478
src/main/java/mod/sin/armoury/MaterialTweaks.java
Normal file
478
src/main/java/mod/sin/armoury/MaterialTweaks.java
Normal file
@@ -0,0 +1,478 @@
|
|||||||
|
package mod.sin.armoury;
|
||||||
|
|
||||||
|
import com.wurmonline.server.items.Item;
|
||||||
|
import com.wurmonline.server.items.ItemSpellEffects;
|
||||||
|
import com.wurmonline.server.items.Materials;
|
||||||
|
import com.wurmonline.server.skills.Skill;
|
||||||
|
import com.wurmonline.server.spells.SpellEffect;
|
||||||
|
import com.wurmonline.shared.constants.Enchants;
|
||||||
|
import javassist.ClassPool;
|
||||||
|
import javassist.CtClass;
|
||||||
|
import javassist.NotFoundException;
|
||||||
|
import mod.sin.lib.Util;
|
||||||
|
import org.gotti.wurmunlimited.modloader.classhooks.HookManager;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
public class MaterialTweaks {
|
||||||
|
public static Logger logger = Logger.getLogger(MaterialTweaks.class.getName());
|
||||||
|
|
||||||
|
public static HashMap<Byte, Float> materialDamageModifier = new HashMap<>();
|
||||||
|
public static HashMap<Byte, Float> materialDecayModifier = new HashMap<>();
|
||||||
|
public static HashMap<Byte, Float> materialCreationBonus = new HashMap<>();
|
||||||
|
public static HashMap<Byte, Float> materialImproveBonus = new HashMap<>();
|
||||||
|
public static HashMap<Byte, Float> materialShatterResistance = new HashMap<>();
|
||||||
|
public static HashMap<Byte, Float> materialLockpickBonus = new HashMap<>();
|
||||||
|
public static HashMap<Byte, Float> materialAnchorBonus = new HashMap<>();
|
||||||
|
public static HashMap<Byte, Float> materialPendulumEffect = new HashMap<>();
|
||||||
|
public static HashMap<Byte, Float> materialRepairSpeed = new HashMap<>();
|
||||||
|
public static HashMap<Byte, Double> materialBashModifier = new HashMap<>();
|
||||||
|
public static HashMap<Byte, Float> materialSpellEffectModifier = new HashMap<>();
|
||||||
|
public static HashMap<Byte, HashMap<Byte, Float>> materialSpecificSpellEffectModifier = new HashMap<>();
|
||||||
|
public static HashMap<Byte, Double> materialDifficultyModifier = new HashMap<>();
|
||||||
|
public static HashMap<Byte, Double> materialActionSpeedModifier = new HashMap<>();
|
||||||
|
|
||||||
|
public static float newGetMaterialDamageModifier(Item item){
|
||||||
|
byte material = item.getMaterial();
|
||||||
|
if(materialDamageModifier.containsKey(material)){
|
||||||
|
//logger.info(String.format("Modifying damage by %.2f%% due to material type %s.", materialDamageModifier.get(material)*100d, MaterialTweaks.getMaterialName(material)));
|
||||||
|
return materialDamageModifier.get(material);
|
||||||
|
}
|
||||||
|
return 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float newGetMaterialDecayModifier(Item item){
|
||||||
|
byte material = item.getMaterial();
|
||||||
|
if(materialDecayModifier.containsKey(material)){
|
||||||
|
//logger.info(String.format("Modifying decay by %.2f%% due to material type %s.", materialDecayModifier.get(material)*100d, MaterialTweaks.getMaterialName(material)));
|
||||||
|
return materialDecayModifier.get(material);
|
||||||
|
}
|
||||||
|
return 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float newGetMaterialCreationBonus(byte material){
|
||||||
|
if(materialCreationBonus.containsKey(material)){
|
||||||
|
//logger.info(String.format("Modifying creation bonus by %.2f%% due to material type %s.", materialCreationBonus.get(material)*100d, MaterialTweaks.getMaterialName(material)));
|
||||||
|
return materialCreationBonus.get(material);
|
||||||
|
}
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float newGetMaterialImpBonus(Item item){
|
||||||
|
byte material = item.getMaterial();
|
||||||
|
if(materialImproveBonus.containsKey(material)){
|
||||||
|
//logger.info(String.format("Modifying improve bonus by %.2f%% due to material type %s.", materialImproveBonus.get(material)*100d, MaterialTweaks.getMaterialName(material)));
|
||||||
|
return materialImproveBonus.get(material);
|
||||||
|
}
|
||||||
|
return 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float newGetMaterialShatterMod(byte material){
|
||||||
|
if(materialShatterResistance.containsKey(material)){
|
||||||
|
//logger.info(String.format("Modifying shatter resistance by %.2f%% due to material type %s.", materialShatterResistance.get(material)*100d, MaterialTweaks.getMaterialName(material)));
|
||||||
|
return materialShatterResistance.get(material);
|
||||||
|
}
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float newGetMaterialLockpickBonus(byte material){
|
||||||
|
if(materialLockpickBonus.containsKey(material)){
|
||||||
|
//logger.info(String.format("Modifying lockpick bonus by %.2f%% due to material type %s.", materialLockpickBonus.get(material)*100d, MaterialTweaks.getMaterialName(material)));
|
||||||
|
return materialLockpickBonus.get(material);
|
||||||
|
}
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float newGetMaterialAnchorBonus(byte material){
|
||||||
|
if(materialAnchorBonus.containsKey(material)){
|
||||||
|
//logger.info(String.format("Modifying anchor bonus by %.2f%% due to material type %s.", materialAnchorBonus.get(material)*100d, MaterialTweaks.getMaterialName(material)));
|
||||||
|
return materialAnchorBonus.get(material);
|
||||||
|
}
|
||||||
|
return 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float newGetMaterialPendulumModifier(byte material){
|
||||||
|
if(materialPendulumEffect.containsKey(material)){
|
||||||
|
//logger.info(String.format("Modifying pendulum effect by %.2f%% due to material type %s.", materialPendulumEffect.get(material)*100d, MaterialTweaks.getMaterialName(material)));
|
||||||
|
return materialPendulumEffect.get(material);
|
||||||
|
}
|
||||||
|
return 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float newGetMaterialRepairTimeMod(Item item){
|
||||||
|
byte material = item.getMaterial();
|
||||||
|
if(materialRepairSpeed.containsKey(material)){
|
||||||
|
//logger.info(String.format("Modifying repair speed by %.2f%% due to material type %s.", materialRepairSpeed.get(material)*100d, MaterialTweaks.getMaterialName(material)));
|
||||||
|
return materialRepairSpeed.get(material);
|
||||||
|
}
|
||||||
|
return 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double newGetMaterialBashModifier(byte material){
|
||||||
|
if(materialBashModifier.containsKey(material)){
|
||||||
|
//logger.info(String.format("Modifying bash by %.2f%% due to material type %s.", materialBashModifier.get(material)*100d, MaterialTweaks.getMaterialName(material)));
|
||||||
|
return materialBashModifier.get(material);
|
||||||
|
}
|
||||||
|
return 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float newGetBonusForSpellEffect(Item item, byte aEnchantment){
|
||||||
|
ItemSpellEffects eff = item.getSpellEffects();
|
||||||
|
if (eff != null) {
|
||||||
|
SpellEffect skillgain = eff.getSpellEffect(aEnchantment);
|
||||||
|
if(skillgain != null) {
|
||||||
|
float newPower = skillgain.power;
|
||||||
|
byte material = item.getMaterial();
|
||||||
|
if(materialSpellEffectModifier.containsKey(material)) {
|
||||||
|
newPower *= materialSpellEffectModifier.get(material);
|
||||||
|
//logger.info(String.format("Modifying spell power by %.2f%% due to material type %s. [%s]", materialSpellEffectModifier.get(material) * 100d, MaterialTweaks.getMaterialName(material), newPower));
|
||||||
|
}
|
||||||
|
if(materialSpecificSpellEffectModifier.containsKey(material) && materialSpecificSpellEffectModifier.get(material).containsKey(aEnchantment)) {
|
||||||
|
newPower *= materialSpecificSpellEffectModifier.get(material).get(aEnchantment);
|
||||||
|
//logger.info(String.format("Modifying spell power of enchant %s by %.2f%% due to material type %s. [%s]", aEnchantment, materialSpecificSpellEffectModifier.get(material).get(aEnchantment) * 100d, MaterialTweaks.getMaterialName(material), newPower));
|
||||||
|
}
|
||||||
|
return newPower;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double getNewDifficulty(Skill skill, double diff, Item item) {
|
||||||
|
if(item != null){
|
||||||
|
byte material = item.getMaterial();
|
||||||
|
if(materialDifficultyModifier.containsKey(material)){
|
||||||
|
diff *= materialDifficultyModifier.get(material);
|
||||||
|
//logger.info(String.format("Modifying difficulty by %.2f%% due to material type %s. [%s]", materialDifficultyModifier.get(material) * 100d, MaterialTweaks.getMaterialName(material), diff));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return diff;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double getMaterialSpeedModifier(Item item){
|
||||||
|
if(item != null){
|
||||||
|
byte material = item.getMaterial();
|
||||||
|
if(materialActionSpeedModifier.containsKey(material)){
|
||||||
|
//logger.info(String.format("Modifying action speed by %.2f%% due to material type %s.", materialActionSpeedModifier.get(material) * 100d, MaterialTweaks.getMaterialName(material)));
|
||||||
|
return materialActionSpeedModifier.get(material);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addMaterialDamageModifier(byte material, float mult){
|
||||||
|
materialDamageModifier.put(material, mult);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addMaterialDecayModifier(byte material, float mult){
|
||||||
|
materialDecayModifier.put(material, mult);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addMaterialCreationBonus(byte material, float bonus){
|
||||||
|
materialCreationBonus.put(material, bonus);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addMaterialImproveBonus(byte material, float bonus){
|
||||||
|
materialImproveBonus.put(material, bonus);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addMaterialShatterResistance(byte material, float resistance){
|
||||||
|
materialShatterResistance.put(material, resistance);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addMaterialLockpickBonus(byte material, float bonus){
|
||||||
|
materialLockpickBonus.put(material, bonus);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addMaterialAnchorBonus(byte material, float bonus){
|
||||||
|
materialAnchorBonus.put(material, bonus);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addMaterialPendulumEffect(byte material, float bonus){
|
||||||
|
materialPendulumEffect.put(material, bonus);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addMaterialRepairSpeed(byte material, float mult){
|
||||||
|
materialRepairSpeed.put(material, mult);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addMaterialBashModifier(byte material, double mult){
|
||||||
|
materialBashModifier.put(material, mult);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addMaterialSpellEffectModifier(byte material, float mult){
|
||||||
|
materialSpellEffectModifier.put(material, mult);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addMaterialActionSpeedModifier(byte material, double mult){
|
||||||
|
materialActionSpeedModifier.put(material, mult);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static ArrayList<Byte> getEnchants(String[] split){
|
||||||
|
ArrayList<Byte> enchants = new ArrayList<>();
|
||||||
|
int i = 0;
|
||||||
|
while(i < split.length-1){
|
||||||
|
if(split[i].equalsIgnoreCase("damage")){
|
||||||
|
enchants.add(Enchants.BUFF_BLOODTHIRST);
|
||||||
|
enchants.add(Enchants.BUFF_FLAMING_AURA);
|
||||||
|
enchants.add(Enchants.BUFF_FROSTBRAND);
|
||||||
|
enchants.add(Enchants.BUFF_ROTTING_TOUCH);
|
||||||
|
enchants.add(Enchants.BUFF_VENOM);
|
||||||
|
}else if(split[i].equalsIgnoreCase("skilling")){
|
||||||
|
enchants.add(Enchants.BUFF_BLESSINGDARK);
|
||||||
|
enchants.add(Enchants.BUFF_WIND_OF_AGES);
|
||||||
|
enchants.add(Enchants.BUFF_CIRCLE_CUNNING);
|
||||||
|
enchants.add((byte) 120);
|
||||||
|
}else if(split[i].equalsIgnoreCase("armour")){
|
||||||
|
enchants.add(Enchants.BUFF_SHARED_PAIN);
|
||||||
|
enchants.add(Enchants.BUFF_WEBARMOUR);
|
||||||
|
}else{
|
||||||
|
enchants.add(Byte.parseByte(split[i]));
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return enchants;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addMaterialSpecificSpellEffectModifier(byte material, String[] split){
|
||||||
|
float modifier = Float.parseFloat(split[split.length-1]);
|
||||||
|
ArrayList<Byte> enchants = getEnchants(split);
|
||||||
|
for(byte enchant : enchants) {
|
||||||
|
HashMap<Byte, Float> map;
|
||||||
|
if (materialSpecificSpellEffectModifier.containsKey(material)) {
|
||||||
|
map = materialSpecificSpellEffectModifier.get(material);
|
||||||
|
} else {
|
||||||
|
map = new HashMap<>();
|
||||||
|
}
|
||||||
|
map.put(enchant, modifier);
|
||||||
|
materialSpecificSpellEffectModifier.put(material, map);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addMaterialDifficultyModifier(byte material, double mult){
|
||||||
|
materialDifficultyModifier.put(material, mult);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getMaterialName(byte material){
|
||||||
|
String name = Materials.convertMaterialByteIntoString(material);
|
||||||
|
if(!name.equals("")){
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
return String.valueOf(material);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static void initializeMaterialMaps(){
|
||||||
|
// Material damage taken modifiers
|
||||||
|
materialDamageModifier.put(Materials.MATERIAL_ADAMANTINE, 0.40f);
|
||||||
|
materialDamageModifier.put(Materials.MATERIAL_BRASS, 0.95f);
|
||||||
|
materialDamageModifier.put(Materials.MATERIAL_BRONZE, 0.90f);
|
||||||
|
materialDamageModifier.put(Materials.MATERIAL_COPPER, 1.15f);
|
||||||
|
materialDamageModifier.put(Materials.MATERIAL_GLIMMERSTEEL, 0.60f);
|
||||||
|
materialDamageModifier.put(Materials.MATERIAL_GOLD, 1.20f);
|
||||||
|
materialDamageModifier.put(Materials.MATERIAL_LEAD, 1.30f);
|
||||||
|
materialDamageModifier.put(Materials.MATERIAL_SERYLL, 0.50f);
|
||||||
|
materialDamageModifier.put(Materials.MATERIAL_SILVER, 1.025f);
|
||||||
|
materialDamageModifier.put(Materials.MATERIAL_STEEL, 0.80f);
|
||||||
|
materialDamageModifier.put(Materials.MATERIAL_TIN, 1.20f);
|
||||||
|
materialDamageModifier.put(Materials.MATERIAL_ZINC, 1.25f);
|
||||||
|
|
||||||
|
// Material decay taken modifiers
|
||||||
|
materialDecayModifier.put(Materials.MATERIAL_ADAMANTINE, 0.40f);
|
||||||
|
materialDecayModifier.put(Materials.MATERIAL_BRASS, 0.95f);
|
||||||
|
materialDecayModifier.put(Materials.MATERIAL_BRONZE, 0.85f);
|
||||||
|
materialDecayModifier.put(Materials.MATERIAL_COPPER, 0.95f);
|
||||||
|
materialDecayModifier.put(Materials.MATERIAL_GLIMMERSTEEL, 0.60f);
|
||||||
|
materialDecayModifier.put(Materials.MATERIAL_GOLD, 0.40f);
|
||||||
|
materialDecayModifier.put(Materials.MATERIAL_LEAD, 0.80f);
|
||||||
|
materialDecayModifier.put(Materials.MATERIAL_SERYLL, 0.50f);
|
||||||
|
materialDecayModifier.put(Materials.MATERIAL_SILVER, 0.70f);
|
||||||
|
materialDecayModifier.put(Materials.MATERIAL_STEEL, 0.70f);
|
||||||
|
materialDecayModifier.put(Materials.MATERIAL_TIN, 0.925f);
|
||||||
|
materialDecayModifier.put(Materials.MATERIAL_ZINC, 1.20f);
|
||||||
|
|
||||||
|
// Material creation bonus
|
||||||
|
materialCreationBonus.put(Materials.MATERIAL_BRASS, 0.1f);
|
||||||
|
materialCreationBonus.put(Materials.MATERIAL_BRONZE, 0.05f);
|
||||||
|
materialCreationBonus.put(Materials.MATERIAL_LEAD, 0.05f);
|
||||||
|
materialCreationBonus.put(Materials.MATERIAL_TIN, 0.05f);
|
||||||
|
|
||||||
|
// Material improve bonus
|
||||||
|
materialImproveBonus.put(Materials.MATERIAL_BRASS, 1.025f);
|
||||||
|
materialImproveBonus.put(Materials.MATERIAL_COPPER, 1.05f);
|
||||||
|
materialImproveBonus.put(Materials.MATERIAL_LEAD, 1.10f);
|
||||||
|
materialImproveBonus.put(Materials.MATERIAL_TIN, 1.025f);
|
||||||
|
materialImproveBonus.put(Materials.MATERIAL_ZINC, 1.075f);
|
||||||
|
|
||||||
|
// Material shatter resistance
|
||||||
|
materialShatterResistance.put(Materials.MATERIAL_ADAMANTINE, 0.15f);
|
||||||
|
materialShatterResistance.put(Materials.MATERIAL_GLIMMERSTEEL, 0.25f);
|
||||||
|
materialShatterResistance.put(Materials.MATERIAL_GOLD, 0.20f);
|
||||||
|
materialShatterResistance.put(Materials.MATERIAL_SERYLL, 1.00f);
|
||||||
|
materialShatterResistance.put(Materials.MATERIAL_SILVER, 0.10f);
|
||||||
|
|
||||||
|
// Material lockpick bonus
|
||||||
|
materialLockpickBonus.put(Materials.MATERIAL_ADAMANTINE, 0.05f);
|
||||||
|
materialLockpickBonus.put(Materials.MATERIAL_COPPER, -0.05f);
|
||||||
|
materialLockpickBonus.put(Materials.MATERIAL_GLIMMERSTEEL, 0.05f);
|
||||||
|
materialLockpickBonus.put(Materials.MATERIAL_GOLD, -0.025f);
|
||||||
|
materialLockpickBonus.put(Materials.MATERIAL_LEAD, -0.05f);
|
||||||
|
materialLockpickBonus.put(Materials.MATERIAL_SERYLL, 0.05f);
|
||||||
|
materialLockpickBonus.put(Materials.MATERIAL_SILVER, 0.025f);
|
||||||
|
materialLockpickBonus.put(Materials.MATERIAL_STEEL, 0.05f);
|
||||||
|
materialLockpickBonus.put(Materials.MATERIAL_TIN, -0.025f);
|
||||||
|
materialLockpickBonus.put(Materials.MATERIAL_ZINC, -0.025f);
|
||||||
|
|
||||||
|
// Material anchor bonus
|
||||||
|
materialAnchorBonus.put(Materials.MATERIAL_ADAMANTINE, 1.50f);
|
||||||
|
materialAnchorBonus.put(Materials.MATERIAL_BRASS, 0.90f);
|
||||||
|
materialAnchorBonus.put(Materials.MATERIAL_BRONZE, 0.85f);
|
||||||
|
materialAnchorBonus.put(Materials.MATERIAL_COPPER, 0.95f);
|
||||||
|
materialAnchorBonus.put(Materials.MATERIAL_GLIMMERSTEEL, 1.25f);
|
||||||
|
materialAnchorBonus.put(Materials.MATERIAL_GOLD, 1.70f);
|
||||||
|
materialAnchorBonus.put(Materials.MATERIAL_IRON, 0.85f);
|
||||||
|
materialAnchorBonus.put(Materials.MATERIAL_LEAD, 1.00f);
|
||||||
|
materialAnchorBonus.put(Materials.MATERIAL_SERYLL, 1.25f);
|
||||||
|
materialAnchorBonus.put(Materials.MATERIAL_SILVER, 0.975f);
|
||||||
|
materialAnchorBonus.put(Materials.MATERIAL_STEEL, 0.85f);
|
||||||
|
materialAnchorBonus.put(Materials.MATERIAL_TIN, 0.80f);
|
||||||
|
materialAnchorBonus.put(Materials.MATERIAL_ZINC, 0.75f);
|
||||||
|
|
||||||
|
// Material pendulum effect
|
||||||
|
materialPendulumEffect.put(Materials.MATERIAL_ADAMANTINE, 1.15f);
|
||||||
|
materialPendulumEffect.put(Materials.MATERIAL_BRASS, 1.025f);
|
||||||
|
materialPendulumEffect.put(Materials.MATERIAL_BRONZE, 1.05f);
|
||||||
|
materialPendulumEffect.put(Materials.MATERIAL_COPPER, 0.95f);
|
||||||
|
materialPendulumEffect.put(Materials.MATERIAL_GLIMMERSTEEL, 1.20f);
|
||||||
|
materialPendulumEffect.put(Materials.MATERIAL_GOLD, 1.10f);
|
||||||
|
materialPendulumEffect.put(Materials.MATERIAL_LEAD, 0.90f);
|
||||||
|
materialPendulumEffect.put(Materials.MATERIAL_SERYLL, 1.25f);
|
||||||
|
materialPendulumEffect.put(Materials.MATERIAL_SILVER, 1.05f);
|
||||||
|
materialPendulumEffect.put(Materials.MATERIAL_STEEL, 1.025f);
|
||||||
|
materialPendulumEffect.put(Materials.MATERIAL_TIN, 0.95f);
|
||||||
|
materialPendulumEffect.put(Materials.MATERIAL_ZINC, 0.95f);
|
||||||
|
|
||||||
|
// Material repair speed
|
||||||
|
materialRepairSpeed.put(Materials.MATERIAL_ADAMANTINE, 0.90f);
|
||||||
|
materialRepairSpeed.put(Materials.MATERIAL_BRONZE, 0.975f);
|
||||||
|
materialRepairSpeed.put(Materials.MATERIAL_COPPER, 1.075f);
|
||||||
|
materialRepairSpeed.put(Materials.MATERIAL_GLIMMERSTEEL, 0.95f);
|
||||||
|
materialRepairSpeed.put(Materials.MATERIAL_GOLD, 1.05f);
|
||||||
|
materialRepairSpeed.put(Materials.MATERIAL_LEAD, 1.10f);
|
||||||
|
materialRepairSpeed.put(Materials.MATERIAL_SERYLL, 0.95f);
|
||||||
|
materialRepairSpeed.put(Materials.MATERIAL_STEEL, 0.975f);
|
||||||
|
materialRepairSpeed.put(Materials.MATERIAL_TIN, 1.025f);
|
||||||
|
materialRepairSpeed.put(Materials.MATERIAL_ZINC, 1.05f);
|
||||||
|
|
||||||
|
// Material bash modifier
|
||||||
|
materialBashModifier.put(Materials.MATERIAL_ADAMANTINE, 1.075d);
|
||||||
|
materialBashModifier.put(Materials.MATERIAL_BRASS, 1.05d);
|
||||||
|
materialBashModifier.put(Materials.MATERIAL_BRONZE, 1.025d);
|
||||||
|
materialBashModifier.put(Materials.MATERIAL_COPPER, 0.90d);
|
||||||
|
materialBashModifier.put(Materials.MATERIAL_GLIMMERSTEEL, 1.10d);
|
||||||
|
materialBashModifier.put(Materials.MATERIAL_GOLD, 1.10d);
|
||||||
|
materialBashModifier.put(Materials.MATERIAL_LEAD, 1.20d);
|
||||||
|
materialBashModifier.put(Materials.MATERIAL_SERYLL, 1.075d);
|
||||||
|
materialBashModifier.put(Materials.MATERIAL_SILVER, 1.10d);
|
||||||
|
materialBashModifier.put(Materials.MATERIAL_STEEL, 1.05d);
|
||||||
|
materialBashModifier.put(Materials.MATERIAL_TIN, 0.90d);
|
||||||
|
materialBashModifier.put(Materials.MATERIAL_ZINC, 0.85d);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void preInit(){
|
||||||
|
try {
|
||||||
|
ClassPool classPool = HookManager.getInstance().getClassPool();
|
||||||
|
final Class<MaterialTweaks> thisClass = MaterialTweaks.class;
|
||||||
|
String replace;
|
||||||
|
|
||||||
|
if(ArmouryMod.enableItemMaterialChanges){
|
||||||
|
Util.setReason("Enable material damage taken modifications.");
|
||||||
|
CtClass ctItem = classPool.get("com.wurmonline.server.items.Item");
|
||||||
|
replace = "{"
|
||||||
|
+ " return "+MaterialTweaks.class.getName()+".newGetMaterialDamageModifier($0);"
|
||||||
|
+ "}";
|
||||||
|
Util.setBodyDeclared(thisClass, ctItem, "getMaterialDamageModifier", replace);
|
||||||
|
|
||||||
|
Util.setReason("Enable material decay modifications.");
|
||||||
|
replace = "{"
|
||||||
|
+ " return "+MaterialTweaks.class.getName()+".newGetMaterialDecayModifier($0);"
|
||||||
|
+ "}";
|
||||||
|
Util.setBodyDeclared(thisClass, ctItem, "getMaterialDecayModifier", replace);
|
||||||
|
|
||||||
|
Util.setReason("Enable material creation bonus modifications.");
|
||||||
|
replace = "{"
|
||||||
|
+ " return "+MaterialTweaks.class.getName()+".newGetMaterialCreationBonus($1);"
|
||||||
|
+ "}";
|
||||||
|
Util.setBodyDeclared(thisClass, ctItem, "getMaterialCreationBonus", replace);
|
||||||
|
|
||||||
|
Util.setReason("Enable material improvement bonus modifications.");
|
||||||
|
replace = "{"
|
||||||
|
+ " return "+MaterialTweaks.class.getName()+".newGetMaterialImpBonus($0);"
|
||||||
|
+ "}";
|
||||||
|
Util.setBodyDeclared(thisClass, ctItem, "getMaterialImpBonus", replace);
|
||||||
|
|
||||||
|
Util.setReason("Enable material shatter resistance modifications.");
|
||||||
|
CtClass ctSpell = classPool.get("com.wurmonline.server.spells.Spell");
|
||||||
|
replace = "{"
|
||||||
|
+ " return "+MaterialTweaks.class.getName()+".newGetMaterialShatterMod($1);"
|
||||||
|
+ "}";
|
||||||
|
Util.setBodyDeclared(thisClass, ctSpell, "getMaterialShatterMod", replace);
|
||||||
|
|
||||||
|
Util.setReason("Enable material lockpick bonus modifications.");
|
||||||
|
replace = "{"
|
||||||
|
+ " return "+MaterialTweaks.class.getName()+".newGetMaterialLockpickBonus($1);"
|
||||||
|
+ "}";
|
||||||
|
Util.setBodyDeclared(thisClass, ctItem, "getMaterialLockpickBonus", replace);
|
||||||
|
|
||||||
|
Util.setReason("Enable material anchor bonus modifications.");
|
||||||
|
replace = "{"
|
||||||
|
+ " return "+MaterialTweaks.class.getName()+".newGetMaterialAnchorBonus($1);"
|
||||||
|
+ "}";
|
||||||
|
Util.setBodyDeclared(thisClass, ctItem, "getMaterialAnchorBonus", replace);
|
||||||
|
|
||||||
|
Util.setReason("Enable material pendulum effect modifications.");
|
||||||
|
CtClass ctLocates = classPool.get("com.wurmonline.server.behaviours.Locates");
|
||||||
|
replace = "{"
|
||||||
|
+ " return "+MaterialTweaks.class.getName()+".newGetMaterialPendulumModifier($1);"
|
||||||
|
+ "}";
|
||||||
|
Util.setBodyDeclared(thisClass, ctLocates, "getMaterialPendulumModifier", replace);
|
||||||
|
|
||||||
|
Util.setReason("Enable material repair speed modifications.");
|
||||||
|
replace = "{"
|
||||||
|
+ " return "+MaterialTweaks.class.getName()+".newGetMaterialRepairTimeMod($0);"
|
||||||
|
+ "}";
|
||||||
|
Util.setBodyDeclared(thisClass, ctItem, "getMaterialRepairTimeMod", replace);
|
||||||
|
|
||||||
|
Util.setReason("Enable material bash modifications.");
|
||||||
|
CtClass ctWeapon = classPool.get("com.wurmonline.server.combat.Weapon");
|
||||||
|
replace = "{"
|
||||||
|
+ " return "+MaterialTweaks.class.getName()+".newGetMaterialBashModifier($1);"
|
||||||
|
+ "}";
|
||||||
|
Util.setBodyDeclared(thisClass, ctWeapon, "getMaterialBashModifier", replace);
|
||||||
|
|
||||||
|
Util.setReason("Enable material spell power modifications.");
|
||||||
|
replace = "{"
|
||||||
|
+ " return "+MaterialTweaks.class.getName()+".newGetBonusForSpellEffect($0, $1);"
|
||||||
|
+ "}";
|
||||||
|
Util.setBodyDeclared(thisClass, ctItem, "getBonusForSpellEffect", replace);
|
||||||
|
|
||||||
|
Util.setReason("Enable material skill difficulty modifications.");
|
||||||
|
CtClass ctSkill = classPool.get("com.wurmonline.server.skills.Skill");
|
||||||
|
replace = "$1 = "+MaterialTweaks.class.getName()+".getNewDifficulty(this, $1, $2);";
|
||||||
|
Util.insertBeforeDeclared(thisClass, ctSkill, "checkAdvance", replace);
|
||||||
|
|
||||||
|
Util.setReason("Enable material action speed modifications.");
|
||||||
|
CtClass ctActions = classPool.get("com.wurmonline.server.behaviours.Actions");
|
||||||
|
replace = "$_ = $proceed($$)*"+MaterialTweaks.class.getName()+".getMaterialSpeedModifier(source);";
|
||||||
|
Util.instrumentDeclared(thisClass, ctActions, "getStandardActionTime", "getStaminaModiferFor", replace);
|
||||||
|
Util.instrumentDeclared(thisClass, ctActions, "getQuickActionTime", "getStaminaModiferFor", replace);
|
||||||
|
Util.instrumentDeclared(thisClass, ctActions, "getVariableActionTime", "getStaminaModiferFor", replace);
|
||||||
|
Util.instrumentDeclared(thisClass, ctActions, "getSlowActionTime", "getStaminaModiferFor", replace);
|
||||||
|
Util.instrumentDeclared(thisClass, ctActions, "getPickActionTime", "getStaminaModiferFor", replace);
|
||||||
|
Util.instrumentDeclared(thisClass, ctActions, "getItemCreationTime", "getStaminaModiferFor", replace);
|
||||||
|
}
|
||||||
|
} catch (NotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,6 +18,7 @@ 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)) {
|
if ((shield != null)) {
|
||||||
return (shield.getSpellSpeedBonus() > Server.rand.nextInt(500));
|
return (shield.getSpellSpeedBonus() > Server.rand.nextInt(500));
|
||||||
@@ -50,16 +51,16 @@ public class ShieldTweaks {
|
|||||||
playSound = true;
|
playSound = true;
|
||||||
}
|
}
|
||||||
if(playSound){
|
if(playSound){
|
||||||
SoundPlayer.playSound(attacker.getTemplate().getHitSound(attacker.getSex()), attacker.getTileX(), attacker.getTileY(), true, 0.3f);
|
SoundPlayer.playSound(attacker.getTemplate().getHitSound(attacker.getSex()), attacker.getTileX(), attacker.getTileY(), attacker.isOnSurface(), 0.3f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void preInit(ArmouryMod mod){
|
public static void preInit(){
|
||||||
try {
|
try {
|
||||||
ClassPool classPool = HookManager.getInstance().getClassPool();
|
ClassPool classPool = HookManager.getInstance().getClassPool();
|
||||||
Class<ShieldTweaks> thisClass = ShieldTweaks.class;
|
Class<ShieldTweaks> thisClass = ShieldTweaks.class;
|
||||||
if(mod.enableShieldDamageEnchants){
|
if(ArmouryMod.enableShieldDamageEnchants){
|
||||||
CtClass ctCombatHandler = classPool.get("com.wurmonline.server.creatures.CombatHandler");
|
CtClass ctCombatHandler = classPool.get("com.wurmonline.server.creatures.CombatHandler");
|
||||||
String replace = ShieldTweaks.class.getName()+".doSharedPain(this.creature, defender, defShield);"
|
String replace = ShieldTweaks.class.getName()+".doSharedPain(this.creature, defender, defShield);"
|
||||||
+ "$_ = $proceed($$);";
|
+ "$_ = $proceed($$);";
|
||||||
@@ -75,7 +76,7 @@ public class ShieldTweaks {
|
|||||||
}
|
}
|
||||||
});*/
|
});*/
|
||||||
}
|
}
|
||||||
if(mod.enableShieldSpeedEnchants){
|
if(ArmouryMod.enableShieldSpeedEnchants){
|
||||||
CtClass ctCombatHandler = classPool.get("com.wurmonline.server.creatures.CombatHandler");
|
CtClass ctCombatHandler = classPool.get("com.wurmonline.server.creatures.CombatHandler");
|
||||||
String insert = "if("+ShieldTweaks.class.getName()+".checkShieldSpeed(defender.getShield())){"
|
String insert = "if("+ShieldTweaks.class.getName()+".checkShieldSpeed(defender.getShield())){"
|
||||||
+ " defender.getCombatHandler().usedShieldThisRound--;"
|
+ " defender.getCombatHandler().usedShieldThisRound--;"
|
||||||
|
|||||||
@@ -1,17 +1,96 @@
|
|||||||
package mod.sin.armoury;
|
package mod.sin.armoury;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import com.wurmonline.server.items.Item;
|
||||||
|
import com.wurmonline.server.items.Materials;
|
||||||
|
import javassist.ClassPool;
|
||||||
|
import javassist.CtClass;
|
||||||
|
import javassist.NotFoundException;
|
||||||
|
import mod.sin.lib.Util;
|
||||||
import org.gotti.wurmunlimited.modloader.ReflectionUtil;
|
import org.gotti.wurmunlimited.modloader.ReflectionUtil;
|
||||||
|
|
||||||
import com.wurmonline.server.combat.Weapon;
|
import com.wurmonline.server.combat.Weapon;
|
||||||
import com.wurmonline.server.items.ItemTemplate;
|
import com.wurmonline.server.items.ItemTemplate;
|
||||||
import com.wurmonline.server.items.ItemTemplateFactory;
|
import com.wurmonline.server.items.ItemTemplateFactory;
|
||||||
|
import org.gotti.wurmunlimited.modloader.classhooks.HookManager;
|
||||||
|
|
||||||
public class WeaponTweaks {
|
public class WeaponTweaks {
|
||||||
public static Logger logger = Logger.getLogger(WeaponTweaks.class.getName());
|
public static Logger logger = Logger.getLogger(WeaponTweaks.class.getName());
|
||||||
public static Map<Integer, Weapon> weapons;
|
|
||||||
|
public static Map<Integer, Weapon> weapons; // Mirror of the Weapon class map
|
||||||
|
|
||||||
|
public static HashMap<Byte, Double> materialWeaponDamage = new HashMap<>();
|
||||||
|
public static HashMap<Byte, Float> materialWeaponSpeed = new HashMap<>();
|
||||||
|
public static HashMap<Byte, Float> materialWeaponParry = new HashMap<>();
|
||||||
|
public static HashMap<Byte, Double> materialWeaponArmourDamage = new HashMap<>();
|
||||||
|
|
||||||
|
public static double newGetMaterialDamageBonus(byte material){
|
||||||
|
if(materialWeaponDamage.containsKey(material)){
|
||||||
|
//logger.info(String.format("Modifying damage by %.2f%% due to material type %s.", materialWeaponDamage.get(material)*100d, MaterialTweaks.getMaterialName(material)));
|
||||||
|
return materialWeaponDamage.get(material);
|
||||||
|
}
|
||||||
|
return 1.0d;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float newGetBaseSpeedForWeapon(Item weapon){
|
||||||
|
if (weapon == null || weapon.isBodyPartAttached()) {
|
||||||
|
return 1.0f;
|
||||||
|
}
|
||||||
|
if(weapons.containsKey(weapon.getTemplateId())){
|
||||||
|
Weapon weap = weapons.get(weapon.getTemplateId());
|
||||||
|
try {
|
||||||
|
float speed = ReflectionUtil.getPrivateField(weap, ReflectionUtil.getField(weap.getClass(), "speed"));
|
||||||
|
//logger.info("Base speed: "+speed);
|
||||||
|
byte material = weapon.getMaterial();
|
||||||
|
if(materialWeaponSpeed.containsKey(material)){
|
||||||
|
speed *= materialWeaponSpeed.get(material);
|
||||||
|
//logger.info(String.format("Found material %s, modifying speed by %.2f%%. New speed: %s", MaterialTweaks.getMaterialName(material), materialWeaponSpeed.get(material)*100f, speed));
|
||||||
|
}
|
||||||
|
return speed;
|
||||||
|
} catch (IllegalAccessException | NoSuchFieldException e) {
|
||||||
|
logger.warning("Could not find valid weapon speed for "+weapon.getName()+" ("+weapon.getTemplateId()+")");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
logger.warning("Weapon map does not contain entry for "+weapon.getName()+" ("+weapon.getTemplateId()+")");
|
||||||
|
}
|
||||||
|
return 20.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float newGetMaterialParryBonus(byte material){
|
||||||
|
if(materialWeaponParry.containsKey(material)){
|
||||||
|
//logger.info(String.format("Modifying parry by %.2f%% due to material type %s.", materialWeaponParry.get(material)*100d, MaterialTweaks.getMaterialName(material)));
|
||||||
|
return materialWeaponParry.get(material);
|
||||||
|
}
|
||||||
|
return 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double newGetMaterialArmourDamageBonus(byte material){
|
||||||
|
if(materialWeaponArmourDamage.containsKey(material)){
|
||||||
|
//logger.info(String.format("Modifying armour damage by %.2f%% due to material type %s.", materialWeaponArmourDamage.get(material)*100d, MaterialTweaks.getMaterialName(material)));
|
||||||
|
return materialWeaponArmourDamage.get(material);
|
||||||
|
}
|
||||||
|
return 1.0d;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addMaterialWeaponDamage(byte material, double mult){
|
||||||
|
materialWeaponDamage.put(material, mult);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addMaterialWeaponSpeed(byte material, float mult){
|
||||||
|
materialWeaponSpeed.put(material, mult);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addMaterialWeaponParry(byte material, float mult){
|
||||||
|
materialWeaponParry.put(material, mult);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addMaterialWeaponArmourDamage(byte material, double mult){
|
||||||
|
materialWeaponArmourDamage.put(material, mult);
|
||||||
|
}
|
||||||
|
|
||||||
public static void printWeapons(){
|
public static void printWeapons(){
|
||||||
try{
|
try{
|
||||||
@@ -37,14 +116,14 @@ public class WeaponTweaks {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void editWeaponStats(ArmouryMod mod){
|
public static void editWeaponStats(){
|
||||||
try {
|
try {
|
||||||
Weapon cw;
|
Weapon cw;
|
||||||
ItemTemplate it;
|
ItemTemplate it;
|
||||||
String tweakType;
|
String tweakType;
|
||||||
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 : ArmouryMod.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.");
|
||||||
@@ -56,7 +135,7 @@ public class WeaponTweaks {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
float oldValue = ReflectionUtil.getPrivateField(cw, ReflectionUtil.getField(cw.getClass(), "damage"));
|
float oldValue = ReflectionUtil.getPrivateField(cw, ReflectionUtil.getField(cw.getClass(), "damage"));
|
||||||
float newValue = mod.weaponDamage.get(id);
|
float newValue = ArmouryMod.weaponDamage.get(id);
|
||||||
String diff;
|
String diff;
|
||||||
if(newValue > oldValue){
|
if(newValue > oldValue){
|
||||||
diff = "+"+(newValue-oldValue);
|
diff = "+"+(newValue-oldValue);
|
||||||
@@ -68,7 +147,7 @@ public class WeaponTweaks {
|
|||||||
}
|
}
|
||||||
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 : ArmouryMod.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.");
|
||||||
@@ -80,7 +159,7 @@ public class WeaponTweaks {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
float oldValue = ReflectionUtil.getPrivateField(cw, ReflectionUtil.getField(cw.getClass(), "speed"));
|
float oldValue = ReflectionUtil.getPrivateField(cw, ReflectionUtil.getField(cw.getClass(), "speed"));
|
||||||
float newValue = mod.weaponSpeed.get(id);
|
float newValue = ArmouryMod.weaponSpeed.get(id);
|
||||||
String diff;
|
String diff;
|
||||||
if(newValue > oldValue){
|
if(newValue > oldValue){
|
||||||
diff = "+"+(newValue-oldValue);
|
diff = "+"+(newValue-oldValue);
|
||||||
@@ -92,7 +171,7 @@ public class WeaponTweaks {
|
|||||||
}
|
}
|
||||||
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 : ArmouryMod.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.");
|
||||||
@@ -104,7 +183,7 @@ public class WeaponTweaks {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
float oldValue = ReflectionUtil.getPrivateField(cw, ReflectionUtil.getField(cw.getClass(), "critchance"));
|
float oldValue = ReflectionUtil.getPrivateField(cw, ReflectionUtil.getField(cw.getClass(), "critchance"));
|
||||||
float newValue = mod.weaponCritChance.get(id);
|
float newValue = ArmouryMod.weaponCritChance.get(id);
|
||||||
String diff;
|
String diff;
|
||||||
if(newValue > oldValue){
|
if(newValue > oldValue){
|
||||||
diff = "+"+(newValue-oldValue);
|
diff = "+"+(newValue-oldValue);
|
||||||
@@ -116,7 +195,7 @@ public class WeaponTweaks {
|
|||||||
}
|
}
|
||||||
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 : ArmouryMod.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.");
|
||||||
@@ -128,7 +207,7 @@ public class WeaponTweaks {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
int oldValue = ReflectionUtil.getPrivateField(cw, ReflectionUtil.getField(cw.getClass(), "reach"));
|
int oldValue = ReflectionUtil.getPrivateField(cw, ReflectionUtil.getField(cw.getClass(), "reach"));
|
||||||
int newValue = mod.weaponReach.get(id);
|
int newValue = ArmouryMod.weaponReach.get(id);
|
||||||
String diff;
|
String diff;
|
||||||
if(newValue > oldValue){
|
if(newValue > oldValue){
|
||||||
diff = "+"+(newValue-oldValue);
|
diff = "+"+(newValue-oldValue);
|
||||||
@@ -140,7 +219,7 @@ public class WeaponTweaks {
|
|||||||
}
|
}
|
||||||
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 : ArmouryMod.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.");
|
||||||
@@ -152,7 +231,7 @@ public class WeaponTweaks {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
int oldValue = ReflectionUtil.getPrivateField(cw, ReflectionUtil.getField(cw.getClass(), "weightGroup"));
|
int oldValue = ReflectionUtil.getPrivateField(cw, ReflectionUtil.getField(cw.getClass(), "weightGroup"));
|
||||||
int newValue = mod.weaponWeightGroup.get(id);
|
int newValue = ArmouryMod.weaponWeightGroup.get(id);
|
||||||
String diff;
|
String diff;
|
||||||
if(newValue > oldValue){
|
if(newValue > oldValue){
|
||||||
diff = "+"+(newValue-oldValue);
|
diff = "+"+(newValue-oldValue);
|
||||||
@@ -164,7 +243,7 @@ public class WeaponTweaks {
|
|||||||
}
|
}
|
||||||
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 : ArmouryMod.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.");
|
||||||
@@ -176,7 +255,7 @@ public class WeaponTweaks {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
float oldValue = ReflectionUtil.getPrivateField(cw, ReflectionUtil.getField(cw.getClass(), "parryPercent"));
|
float oldValue = ReflectionUtil.getPrivateField(cw, ReflectionUtil.getField(cw.getClass(), "parryPercent"));
|
||||||
float newValue = mod.weaponParryPercent.get(id);
|
float newValue = ArmouryMod.weaponParryPercent.get(id);
|
||||||
String diff;
|
String diff;
|
||||||
if(newValue > oldValue){
|
if(newValue > oldValue){
|
||||||
diff = "+"+(newValue-oldValue);
|
diff = "+"+(newValue-oldValue);
|
||||||
@@ -188,7 +267,7 @@ public class WeaponTweaks {
|
|||||||
}
|
}
|
||||||
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 : ArmouryMod.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.");
|
||||||
@@ -200,7 +279,7 @@ public class WeaponTweaks {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
double oldValue = ReflectionUtil.getPrivateField(cw, ReflectionUtil.getField(cw.getClass(), "skillPenalty"));
|
double oldValue = ReflectionUtil.getPrivateField(cw, ReflectionUtil.getField(cw.getClass(), "skillPenalty"));
|
||||||
double newValue = mod.weaponSkillPenalty.get(id);
|
double newValue = ArmouryMod.weaponSkillPenalty.get(id);
|
||||||
String diff;
|
String diff;
|
||||||
if(newValue > oldValue){
|
if(newValue > oldValue){
|
||||||
diff = "+"+(newValue-oldValue);
|
diff = "+"+(newValue-oldValue);
|
||||||
@@ -215,14 +294,81 @@ public class WeaponTweaks {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onServerStarted(ArmouryMod mod){
|
public static void initializeWeaponMaps(){
|
||||||
|
// Material weapon damage
|
||||||
|
materialWeaponDamage.put(Materials.MATERIAL_ADAMANTINE, 1.1d);
|
||||||
|
materialWeaponDamage.put(Materials.MATERIAL_BRASS, 0.99d);
|
||||||
|
materialWeaponDamage.put(Materials.MATERIAL_BRONZE, 0.985d);
|
||||||
|
materialWeaponDamage.put(Materials.MATERIAL_COPPER, 0.65d);
|
||||||
|
materialWeaponDamage.put(Materials.MATERIAL_GOLD, 0.975d);
|
||||||
|
materialWeaponDamage.put(Materials.MATERIAL_LEAD, 0.5d);
|
||||||
|
materialWeaponDamage.put(Materials.MATERIAL_SERYLL, 1.05d);
|
||||||
|
materialWeaponDamage.put(Materials.MATERIAL_TIN, 0.925d);
|
||||||
|
materialWeaponDamage.put(Materials.MATERIAL_ZINC, 0.9d);
|
||||||
|
|
||||||
|
// Material weapon speed
|
||||||
|
materialWeaponSpeed.put(Materials.MATERIAL_GLIMMERSTEEL, 0.9f);
|
||||||
|
materialWeaponSpeed.put(Materials.MATERIAL_GOLD, 1.05f);
|
||||||
|
materialWeaponSpeed.put(Materials.MATERIAL_SERYLL, 0.95f);
|
||||||
|
materialWeaponSpeed.put(Materials.MATERIAL_TIN, 0.96f);
|
||||||
|
materialWeaponSpeed.put(Materials.MATERIAL_ZINC, 0.95f);
|
||||||
|
|
||||||
|
// Material weapon parry
|
||||||
|
materialWeaponParry.put(Materials.MATERIAL_SILVER, 1.025f);
|
||||||
|
materialWeaponParry.put(Materials.MATERIAL_TIN, 1.05f);
|
||||||
|
|
||||||
|
// Material weapon armour damage
|
||||||
|
materialWeaponArmourDamage.put(Materials.MATERIAL_BRASS, 1.05d);
|
||||||
|
materialWeaponArmourDamage.put(Materials.MATERIAL_BRONZE, 1.075d);
|
||||||
|
materialWeaponArmourDamage.put(Materials.MATERIAL_GOLD, 1.05d);
|
||||||
|
materialWeaponArmourDamage.put(Materials.MATERIAL_STEEL, 1.025d);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void preInit(){
|
||||||
|
try {
|
||||||
|
ClassPool classPool = HookManager.getInstance().getClassPool();
|
||||||
|
final Class<WeaponTweaks> thisClass = WeaponTweaks.class;
|
||||||
|
String replace;
|
||||||
|
|
||||||
|
if(ArmouryMod.enableWeaponMaterialChanges){
|
||||||
|
Util.setReason("Enable weapon material damage modifications.");
|
||||||
|
CtClass ctWeapon = classPool.get("com.wurmonline.server.combat.Weapon");
|
||||||
|
replace = "{"
|
||||||
|
+ " return "+WeaponTweaks.class.getName()+".newGetMaterialDamageBonus($1);"
|
||||||
|
+ "}";
|
||||||
|
Util.setBodyDeclared(thisClass, ctWeapon, "getMaterialDamageBonus", replace);
|
||||||
|
|
||||||
|
Util.setReason("Enable weapon material speed modifications.");
|
||||||
|
replace = "{"
|
||||||
|
+ " return "+WeaponTweaks.class.getName()+".newGetBaseSpeedForWeapon($1);"
|
||||||
|
+ "}";
|
||||||
|
Util.setBodyDeclared(thisClass, ctWeapon, "getBaseSpeedForWeapon", replace);
|
||||||
|
|
||||||
|
Util.setReason("Enable weapon material parry modifications.");
|
||||||
|
replace = "{"
|
||||||
|
+ " return "+WeaponTweaks.class.getName()+".newGetMaterialParryBonus($1);"
|
||||||
|
+ "}";
|
||||||
|
Util.setBodyDeclared(thisClass, ctWeapon, "getMaterialParryBonus", replace);
|
||||||
|
|
||||||
|
Util.setReason("Enable weapon material armour damage modifications.");
|
||||||
|
replace = "{"
|
||||||
|
+ " return "+WeaponTweaks.class.getName()+".newGetMaterialArmourDamageBonus($1);"
|
||||||
|
+ "}";
|
||||||
|
Util.setBodyDeclared(thisClass, ctWeapon, "getMaterialArmourDamageBonus", replace);
|
||||||
|
}
|
||||||
|
} catch (NotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void onServerStarted(){
|
||||||
try {
|
try {
|
||||||
logger.info("Beginning WeaponTweaks initialization...");
|
logger.info("Beginning WeaponTweaks initialization...");
|
||||||
weapons = ReflectionUtil.getPrivateField(Weapon.class, ReflectionUtil.getField(Weapon.class, "weapons"));
|
weapons = ReflectionUtil.getPrivateField(Weapon.class, ReflectionUtil.getField(Weapon.class, "weapons"));
|
||||||
|
|
||||||
//printWeapons(); // For debugging/information purposes
|
//printWeapons(); // For debugging/information purposes
|
||||||
|
|
||||||
editWeaponStats(mod);
|
editWeaponStats();
|
||||||
|
|
||||||
//printWeapons(); // For debugging/information purposes
|
//printWeapons(); // For debugging/information purposes
|
||||||
|
|
||||||
|
|||||||
28
src/main/java/mod/sin/armoury/WoundAssist.java
Normal file
28
src/main/java/mod/sin/armoury/WoundAssist.java
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
package mod.sin.armoury;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
public class WoundAssist {
|
||||||
|
public static Logger logger = Logger.getLogger(WoundAssist.class.getName());
|
||||||
|
|
||||||
|
public static HashMap<String, Byte> woundNameToType = new HashMap<>();
|
||||||
|
public static HashMap<Byte, String> woundTypeToName = new HashMap<>();
|
||||||
|
|
||||||
|
public static void initializeWoundMaps(){
|
||||||
|
woundNameToType.put("crush", (byte) 0);
|
||||||
|
woundNameToType.put("slash", (byte) 1);
|
||||||
|
woundNameToType.put("pierce", (byte) 2);
|
||||||
|
woundNameToType.put("bite", (byte) 3);
|
||||||
|
woundNameToType.put("burn", (byte) 4);
|
||||||
|
woundNameToType.put("poison", (byte) 5);
|
||||||
|
woundNameToType.put("infection", (byte) 6);
|
||||||
|
woundNameToType.put("water", (byte) 7);
|
||||||
|
woundNameToType.put("cold", (byte) 8);
|
||||||
|
woundNameToType.put("internal", (byte) 9);
|
||||||
|
woundNameToType.put("acid", (byte) 10);
|
||||||
|
for(String name : woundNameToType.keySet()){
|
||||||
|
woundTypeToName.put(woundNameToType.get(name), name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user