|
|
@ -28,29 +28,24 @@ import engine.objects.AbstractCharacter; |
|
|
|
import engine.objects.AbstractWorldObject; |
|
|
|
import engine.objects.AbstractWorldObject; |
|
|
|
import engine.objects.Effect; |
|
|
|
import engine.objects.Effect; |
|
|
|
import engine.objects.PlayerCharacter; |
|
|
|
import engine.objects.PlayerCharacter; |
|
|
|
import engine.powers.effectmodifiers.AbstractEffectModifier; |
|
|
|
import engine.powers.effectmodifiers.*; |
|
|
|
import engine.server.MBServerStatics; |
|
|
|
import engine.server.MBServerStatics; |
|
|
|
import engine.util.Hasher; |
|
|
|
import engine.util.Hasher; |
|
|
|
import engine.wpak.data.EffectEntry; |
|
|
|
import engine.wpak.data.EffectEntry; |
|
|
|
|
|
|
|
import engine.wpak.data.EffectModifier; |
|
|
|
import org.pmw.tinylog.Logger; |
|
|
|
import org.pmw.tinylog.Logger; |
|
|
|
|
|
|
|
|
|
|
|
import java.sql.Connection; |
|
|
|
import java.sql.Connection; |
|
|
|
import java.sql.PreparedStatement; |
|
|
|
import java.sql.PreparedStatement; |
|
|
|
import java.sql.ResultSet; |
|
|
|
import java.sql.ResultSet; |
|
|
|
import java.sql.SQLException; |
|
|
|
import java.sql.SQLException; |
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.HashSet; |
|
|
|
import java.util.HashSet; |
|
|
|
import java.util.concurrent.ConcurrentHashMap; |
|
|
|
import java.util.concurrent.ConcurrentHashMap; |
|
|
|
|
|
|
|
|
|
|
|
public class EffectsBase { |
|
|
|
public class EffectsBase { |
|
|
|
|
|
|
|
|
|
|
|
public static HashMap<Integer, HashSet<EffectSourceType>> effectSourceTypeMap = new HashMap<>(); |
|
|
|
|
|
|
|
public static HashMap<String, HashSet<AbstractEffectModifier>> modifiersMap = new HashMap<>(); |
|
|
|
public static HashMap<String, HashSet<AbstractEffectModifier>> modifiersMap = new HashMap<>(); |
|
|
|
public static HashMap<String, HashMap<String, ArrayList<String>>> OldEffectsMap = new HashMap<>(); |
|
|
|
|
|
|
|
public static HashMap<String, HashMap<String, ArrayList<String>>> NewEffectsMap = new HashMap<>(); |
|
|
|
|
|
|
|
public static HashMap<String, HashMap<String, ArrayList<String>>> ChangedEffectsMap = new HashMap<>(); |
|
|
|
|
|
|
|
public static HashMap<String, HashSet<PowerFailCondition>> EffectFailConditions = new HashMap<>(); |
|
|
|
|
|
|
|
public static HashMap<Integer, HashSet<mbEnums.DamageType>> EffectDamageTypes = new HashMap<>(); |
|
|
|
public static HashMap<Integer, HashSet<mbEnums.DamageType>> EffectDamageTypes = new HashMap<>(); |
|
|
|
public static HashSet<AbstractEffectModifier> DefaultModifiers = new HashSet<>(); |
|
|
|
public static HashSet<AbstractEffectModifier> DefaultModifiers = new HashSet<>(); |
|
|
|
private static ConcurrentHashMap<String, String> itemEffectsByName = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW); |
|
|
|
private static ConcurrentHashMap<String, String> itemEffectsByName = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW); |
|
|
@ -82,10 +77,16 @@ public class EffectsBase { |
|
|
|
private boolean isPrefix = false; //used by items
|
|
|
|
private boolean isPrefix = false; //used by items
|
|
|
|
private boolean isSuffix = false; //used by items
|
|
|
|
private boolean isSuffix = false; //used by items
|
|
|
|
private String name = ""; |
|
|
|
private String name = ""; |
|
|
|
private float value = 0; |
|
|
|
public float value = 0; |
|
|
|
private ConcurrentHashMap<mbEnums.ResourceType, Integer> resourceCosts = new ConcurrentHashMap<>(); |
|
|
|
private ConcurrentHashMap<mbEnums.ResourceType, Integer> resourceCosts = new ConcurrentHashMap<>(); |
|
|
|
private ConcurrentHashMap<String, Boolean> sourceTypes = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW); |
|
|
|
private ConcurrentHashMap<String, Boolean> sourceTypes = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//loaded values from parser
|
|
|
|
|
|
|
|
public HashSet<EffectSourceType> effectSources = new HashSet<>(); |
|
|
|
|
|
|
|
public HashSet<EffectModifier> effectModifiers = new HashSet<>(); |
|
|
|
|
|
|
|
public HashSet<PowerFailCondition> effectFailCondition = new HashSet<>(); |
|
|
|
|
|
|
|
public HashSet<mbEnums.DamageType> effectDamageType = new HashSet<>(); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* No Table ID Constructor |
|
|
|
* No Table ID Constructor |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -118,6 +119,19 @@ public class EffectsBase { |
|
|
|
this.isPrefix = true; |
|
|
|
this.isPrefix = true; |
|
|
|
else if (this.IDString.startsWith("SUF-")) |
|
|
|
else if (this.IDString.startsWith("SUF-")) |
|
|
|
this.isSuffix = true; |
|
|
|
this.isSuffix = true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//load effect modifiers
|
|
|
|
|
|
|
|
this.effectModifiers = new HashSet<>(entry.mods); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//load sources
|
|
|
|
|
|
|
|
for(String source : entry.sources) |
|
|
|
|
|
|
|
this.effectSources.add(EffectSourceType.GetEffectSourceType(source)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//load fail conditions
|
|
|
|
|
|
|
|
for(String condition : entry.conditions.keySet()) |
|
|
|
|
|
|
|
this.effectFailCondition.add(PowerFailCondition.valueOf(condition)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//TODO load damage types and slopes from conditions
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public EffectsBase(EffectsBase copyEffect, int newToken, String IDString) { |
|
|
|
public EffectsBase(EffectsBase copyEffect, int newToken, String IDString) { |
|
|
@ -223,11 +237,7 @@ public class EffectsBase { |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (EffectsBase.EffectFailConditions.get(IDString) == null) { |
|
|
|
|
|
|
|
EffectsBase.EffectFailConditions.put(IDString, new HashSet<>()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EffectsBase.EffectFailConditions.get(IDString).add(failCondition); |
|
|
|
|
|
|
|
EffectsBase eb = effects.get(IDString); |
|
|
|
EffectsBase eb = effects.get(IDString); |
|
|
|
|
|
|
|
|
|
|
|
switch (failCondition) { |
|
|
|
switch (failCondition) { |
|
|
@ -359,10 +369,6 @@ public class EffectsBase { |
|
|
|
this.token = token; |
|
|
|
this.token = token; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public ConcurrentHashMap<String, Boolean> getSourceTypes() { |
|
|
|
|
|
|
|
return this.sourceTypes; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public HashSet<AbstractEffectModifier> getModifiers() { |
|
|
|
public HashSet<AbstractEffectModifier> getModifiers() { |
|
|
|
|
|
|
|
|
|
|
|
if (EffectsBase.modifiersMap.containsKey(this.IDString) == false) |
|
|
|
if (EffectsBase.modifiersMap.containsKey(this.IDString) == false) |
|
|
@ -371,22 +377,6 @@ public class EffectsBase { |
|
|
|
return EffectsBase.modifiersMap.get(this.IDString); |
|
|
|
return EffectsBase.modifiersMap.get(this.IDString); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public boolean isItemEffect() { |
|
|
|
|
|
|
|
return this.isItemEffect; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean isSpireEffect() { |
|
|
|
|
|
|
|
return this.isSpireEffect; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean ignoreMod() { |
|
|
|
|
|
|
|
return this.ignoreNoMod; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean dontSave() { |
|
|
|
|
|
|
|
return this.dontSave; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean isPrefix() { |
|
|
|
public boolean isPrefix() { |
|
|
|
return this.isPrefix; |
|
|
|
return this.isPrefix; |
|
|
|
} |
|
|
|
} |
|
|
@ -668,13 +658,6 @@ public class EffectsBase { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public boolean containsSource(EffectSourceType sourceType) { |
|
|
|
|
|
|
|
if (EffectsBase.effectSourceTypeMap.containsKey(this.token) == false) |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
return EffectsBase.effectSourceTypeMap.get(this.token).contains(sourceType); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean cancelOnAttack() { |
|
|
|
public boolean cancelOnAttack() { |
|
|
|
return this.cancelOnAttack; |
|
|
|
return this.cancelOnAttack; |
|
|
|
} |
|
|
|
} |
|
|
@ -742,12 +725,4 @@ public class EffectsBase { |
|
|
|
this.name = name; |
|
|
|
this.name = name; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public float getValue() { |
|
|
|
|
|
|
|
return value; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setValue(float Value) { |
|
|
|
|
|
|
|
this.value = Value; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|