|
|
|
@ -31,6 +31,7 @@ import engine.objects.PlayerCharacter;
@@ -31,6 +31,7 @@ import engine.objects.PlayerCharacter;
|
|
|
|
|
import engine.powers.effectmodifiers.*; |
|
|
|
|
import engine.server.MBServerStatics; |
|
|
|
|
import engine.util.Hasher; |
|
|
|
|
import engine.wpak.data.ConditionEntry; |
|
|
|
|
import engine.wpak.data.EffectEntry; |
|
|
|
|
import engine.wpak.data.EffectModifier; |
|
|
|
|
import org.pmw.tinylog.Logger; |
|
|
|
@ -39,6 +40,7 @@ import java.sql.Connection;
@@ -39,6 +40,7 @@ import java.sql.Connection;
|
|
|
|
|
import java.sql.PreparedStatement; |
|
|
|
|
import java.sql.ResultSet; |
|
|
|
|
import java.sql.SQLException; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.HashMap; |
|
|
|
|
import java.util.HashSet; |
|
|
|
|
import java.util.concurrent.ConcurrentHashMap; |
|
|
|
@ -48,34 +50,34 @@ public class EffectsBase {
@@ -48,34 +50,34 @@ public class EffectsBase {
|
|
|
|
|
public static HashMap<String, HashSet<AbstractEffectModifier>> modifiersMap = new HashMap<>(); |
|
|
|
|
public static HashMap<Integer, HashSet<mbEnums.DamageType>> EffectDamageTypes = new HashMap<>(); |
|
|
|
|
private static ConcurrentHashMap<String, String> itemEffectsByName = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW); |
|
|
|
|
private static int NewID = 3000; |
|
|
|
|
private int UUID; |
|
|
|
|
private String IDString; |
|
|
|
|
// private String name;
|
|
|
|
|
private int token; |
|
|
|
|
private float amount; |
|
|
|
|
private float amountRamp; |
|
|
|
|
public static int NewID = 3000; |
|
|
|
|
public int UUID; |
|
|
|
|
public String IDString; |
|
|
|
|
// public String name;
|
|
|
|
|
public int token; |
|
|
|
|
public float amount; |
|
|
|
|
public float amountRamp; |
|
|
|
|
// flags
|
|
|
|
|
private boolean isItemEffect; |
|
|
|
|
private boolean isSpireEffect; |
|
|
|
|
private boolean ignoreNoMod; |
|
|
|
|
private boolean dontSave; |
|
|
|
|
private boolean cancelOnAttack = false; |
|
|
|
|
private boolean cancelOnAttackSwing = false; |
|
|
|
|
private boolean cancelOnCast = false; |
|
|
|
|
private boolean cancelOnCastSpell = false; |
|
|
|
|
private boolean cancelOnEquipChange = false; |
|
|
|
|
private boolean cancelOnLogout = false; |
|
|
|
|
private boolean cancelOnMove = false; |
|
|
|
|
private boolean cancelOnNewCharm = false; |
|
|
|
|
private boolean cancelOnSit = false; |
|
|
|
|
private boolean cancelOnTakeDamage = false; |
|
|
|
|
private boolean cancelOnTerritoryClaim = false; |
|
|
|
|
private boolean cancelOnUnEquip = false; |
|
|
|
|
private boolean useRampAdd; |
|
|
|
|
private boolean isPrefix = false; //used by items
|
|
|
|
|
private boolean isSuffix = false; //used by items
|
|
|
|
|
private String name = ""; |
|
|
|
|
public boolean isItemEffect; |
|
|
|
|
public boolean isSpireEffect; |
|
|
|
|
public boolean ignoreNoMod; |
|
|
|
|
public boolean dontSave; |
|
|
|
|
public boolean cancelOnAttack = false; |
|
|
|
|
public boolean cancelOnAttackSwing = false; |
|
|
|
|
public boolean cancelOnCast = false; |
|
|
|
|
public boolean cancelOnCastSpell = false; |
|
|
|
|
public boolean cancelOnEquipChange = false; |
|
|
|
|
public boolean cancelOnLogout = false; |
|
|
|
|
public boolean cancelOnMove = false; |
|
|
|
|
public boolean cancelOnNewCharm = false; |
|
|
|
|
public boolean cancelOnSit = false; |
|
|
|
|
public boolean cancelOnTakeDamage = false; |
|
|
|
|
public boolean cancelOnTerritoryClaim = false; |
|
|
|
|
public boolean cancelOnUnEquip = false; |
|
|
|
|
public boolean useRampAdd; |
|
|
|
|
public boolean isPrefix = false; //used by items
|
|
|
|
|
public boolean isSuffix = false; //used by items
|
|
|
|
|
public String name = ""; |
|
|
|
|
public float value = 0; |
|
|
|
|
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); |
|
|
|
@ -127,12 +129,108 @@ public class EffectsBase {
@@ -127,12 +129,108 @@ public class EffectsBase {
|
|
|
|
|
this.effectSources.add(EffectSourceType.GetEffectSourceType(source)); |
|
|
|
|
|
|
|
|
|
//load fail conditions
|
|
|
|
|
for(String condition : entry.conditions.keySet()) |
|
|
|
|
this.effectFailCondition.add(PowerFailCondition.valueOf(condition)); |
|
|
|
|
for(ConditionEntry condition : entry.conditions){ |
|
|
|
|
PowerFailCondition failCondition = PowerFailCondition.valueOf(condition.condition); |
|
|
|
|
this.effectFailCondition.add(failCondition); |
|
|
|
|
loadFailConditions(failCondition,this,condition); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//TODO load damage types and slopes from conditions
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static void loadFailConditions(PowerFailCondition failCondition, EffectsBase eb, ConditionEntry entry){ |
|
|
|
|
|
|
|
|
|
if (failCondition == null || eb == null) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
switch (failCondition) { |
|
|
|
|
|
|
|
|
|
case TakeDamage: |
|
|
|
|
|
|
|
|
|
// dont go any further.
|
|
|
|
|
|
|
|
|
|
if (eb == null) |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
eb.cancelOnTakeDamage = true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
eb.amount = entry.arg; |
|
|
|
|
eb.amountRamp = (float)entry.curveType.getValue(); |
|
|
|
|
eb.useRampAdd = (float)entry.curveType.getValue() != 0; |
|
|
|
|
|
|
|
|
|
ArrayList<String> damageTypes = new ArrayList<>(); |
|
|
|
|
String damageType1 = ""; |
|
|
|
|
String damageType2 = ""; |
|
|
|
|
String damageType3 = ""; |
|
|
|
|
for(mbEnums.DamageType dt : entry.damageTypes){ |
|
|
|
|
damageTypes.add(dt.name()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (damageType1.isEmpty() && damageType2.isEmpty() && damageType3.isEmpty()) |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
if(damageTypes.get(0) != null) |
|
|
|
|
damageType1 = damageTypes.get(0); |
|
|
|
|
|
|
|
|
|
if(damageTypes.get(1) != null) |
|
|
|
|
damageType1 = damageTypes.get(1); |
|
|
|
|
|
|
|
|
|
if(damageTypes.get(2) != null) |
|
|
|
|
damageType1 = damageTypes.get(2); |
|
|
|
|
|
|
|
|
|
if (!EffectsBase.EffectDamageTypes.containsKey(eb.getToken())) |
|
|
|
|
EffectsBase.EffectDamageTypes.put(eb.getToken(), new HashSet<>()); |
|
|
|
|
|
|
|
|
|
mbEnums.DamageType dt = mbEnums.DamageType.getDamageType(damageType1); |
|
|
|
|
if (dt != null) |
|
|
|
|
EffectsBase.EffectDamageTypes.get(eb.token).add(dt); |
|
|
|
|
|
|
|
|
|
dt = mbEnums.DamageType.getDamageType(damageType2); |
|
|
|
|
if (dt != null) |
|
|
|
|
EffectsBase.EffectDamageTypes.get(eb.token).add(dt); |
|
|
|
|
dt = mbEnums.DamageType.getDamageType(damageType3); |
|
|
|
|
if (dt != null) |
|
|
|
|
EffectsBase.EffectDamageTypes.get(eb.token).add(dt); |
|
|
|
|
break; |
|
|
|
|
case Attack: |
|
|
|
|
eb.cancelOnAttack = true; |
|
|
|
|
break; |
|
|
|
|
case AttackSwing: |
|
|
|
|
eb.cancelOnAttackSwing = true; |
|
|
|
|
break; |
|
|
|
|
case Cast: |
|
|
|
|
eb.cancelOnCast = true; |
|
|
|
|
break; |
|
|
|
|
case CastSpell: |
|
|
|
|
eb.cancelOnCastSpell = true; |
|
|
|
|
break; |
|
|
|
|
case EquipChange: |
|
|
|
|
eb.cancelOnEquipChange = true; |
|
|
|
|
break; |
|
|
|
|
case Logout: |
|
|
|
|
eb.cancelOnLogout = true; |
|
|
|
|
break; |
|
|
|
|
case Move: |
|
|
|
|
eb.cancelOnMove = true; |
|
|
|
|
break; |
|
|
|
|
case NewCharm: |
|
|
|
|
eb.cancelOnNewCharm = true; |
|
|
|
|
break; |
|
|
|
|
case Sit: |
|
|
|
|
eb.cancelOnSit = true; |
|
|
|
|
break; |
|
|
|
|
case TerritoryClaim: |
|
|
|
|
eb.cancelOnTerritoryClaim = true; |
|
|
|
|
break; |
|
|
|
|
case UnEquip: |
|
|
|
|
eb.cancelOnUnEquip = true; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public EffectsBase(EffectsBase copyEffect, int newToken, String IDString) { |
|
|
|
|
|
|
|
|
|
UUID = NewID++; |
|
|
|
@ -215,7 +313,7 @@ public class EffectsBase {
@@ -215,7 +313,7 @@ public class EffectsBase {
|
|
|
|
|
// getFailConditions();
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static void getFailConditions(HashMap<String, EffectsBase> effects) { |
|
|
|
|
public static void loadFailConditions(HashMap<String, EffectsBase> effects) { |
|
|
|
|
|
|
|
|
|
try (Connection connection = DbManager.getConnection(); |
|
|
|
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_power_failcondition WHERE powerOrEffect = 'Effect';")) { |
|
|
|
|