Здравствуйте. Сегодня ковыряюсь в исходах и хочу добиться желаемого, а точней:
Хочу сделать баф, который стакает до 5 бафов.
В итоге что-то я намудрил:
Ошибка указывает сюда: ? 4 : 3 : 2 : 1 : 0);
Что тут надо написать? куда копать? почему не ставится такой приоритет? где нехватает кода?
Хочу сделать баф, который стакает до 5 бафов.
В итоге что-то я намудрил:
Код:
protected void attachEffect(Node n, Object template)
{
NamedNodeMap attrs = n.getAttributes();
StatsSet set = new StatsSet();
set.set("name", attrs.getNamedItem("name").getNodeValue());
set.set("object", template);
if (attrs.getNamedItem("count") != null)
set.set("count", parseNumber(attrs.getNamedItem("count").getNodeValue()).intValue());
if (attrs.getNamedItem("time") != null)
set.set("time", parseNumber(attrs.getNamedItem("time").getNodeValue()).intValue());
set.set("value", attrs.getNamedItem("val") != null ? parseNumber(attrs.getNamedItem("val").getNodeValue()).doubleValue() : 0.);
set.set("abnormal", AbnormalEffect.NULL);
set.set("abnormal2", AbnormalEffect.NULL);
set.set("abnormal3", AbnormalEffect.NULL);
if (attrs.getNamedItem("abnormal") != null)
{
AbnormalEffect ae = AbnormalEffect.getByName(attrs.getNamedItem("abnormal").getNodeValue());
if (ae.isSpecial())
set.set("abnormal2", ae);
if (ae.isEvent())
set.set("abnormal3", ae);
else
set.set("abnormal", ae);
}
if (attrs.getNamedItem("stackType") != null)
set.set("stackType", attrs.getNamedItem("stackType").getNodeValue());
if (attrs.getNamedItem("stackType2") != null)
set.set("stackType2", attrs.getNamedItem("stackType2").getNodeValue());
if (attrs.getNamedItem("stackType2") != null)
set.set("stackType3", attrs.getNamedItem("stackType3").getNodeValue());
if (attrs.getNamedItem("stackType4") != null)
set.set("stackType2", attrs.getNamedItem("stackType4").getNodeValue());
if (attrs.getNamedItem("stackType5") != null)
set.set("stackType2", attrs.getNamedItem("stackType5").getNodeValue());
if (attrs.getNamedItem("stackOrder") != null)
set.set("stackOrder", parseNumber(attrs.getNamedItem("stackOrder").getNodeValue()).intValue());
if (attrs.getNamedItem("applyOnCaster") != null)
set.set("applyOnCaster", Boolean.valueOf(attrs.getNamedItem("applyOnCaster").getNodeValue()));
if (attrs.getNamedItem("applyOnSummon") != null)
set.set("applyOnSummon", Boolean.valueOf(attrs.getNamedItem("applyOnSummon").getNodeValue()));
if (attrs.getNamedItem("displayId") != null)
set.set("displayId", parseNumber(attrs.getNamedItem("displayId").getNodeValue()).intValue());
if (attrs.getNamedItem("displayLevel") != null)
set.set("displayLevel", parseNumber(attrs.getNamedItem("displayLevel").getNodeValue()).intValue());
if (attrs.getNamedItem("chance") != null)
set.set("chance", parseNumber(attrs.getNamedItem("chance").getNodeValue()).intValue());
if (attrs.getNamedItem("cancelOnAction") != null)
set.set("cancelOnAction", Boolean.valueOf(attrs.getNamedItem("cancelOnAction").getNodeValue()));
if (attrs.getNamedItem("isOffensive") != null)
set.set("isOffensive", Boolean.valueOf(attrs.getNamedItem("isOffensive").getNodeValue()));
if (attrs.getNamedItem("isReflectable") != null)
set.set("isReflectable", Boolean.valueOf(attrs.getNamedItem("isReflectable").getNodeValue()));
EffectTemplate lt = new EffectTemplate(set);
parseTemplate(n, lt);
for (Node n1 = n.getFirstChild(); n1 != null; n1 = n1.getNextSibling())
{
if ("triggers".equalsIgnoreCase(n1.getNodeName()))
parseTrigger(n1, lt);
}
if (template instanceof Skill)
((Skill) template).attach(lt);
}
Код:
public EffectTemplate getTemplate()
{
return _template;
}
public String getStackType()
{
return getTemplate()._stackType;
}
public String getStackType2()
{
return getTemplate()._stackType2;
}
public String getStackType3()
{
return getTemplate()._stackType3;
}
public String getStackType4()
{
return getTemplate()._stackType4;
}
public String getStackType5()
{
return getTemplate()._stackType5;
}
public boolean checkStackType(String param)
{
return getStackType().equalsIgnoreCase(param) || getStackType2().equalsIgnoreCase(param) || getStackType3().equalsIgnoreCase(param) || getStackType4().equalsIgnoreCase(param) || getStackType5().equalsIgnoreCase(param);
}
public boolean checkStackType(Effect param)
{
return checkStackType(param.getStackType()) || checkStackType(param.getStackType2()) || checkStackType(param.getStackType3()) || checkStackType(param.getStackType4()) || checkStackType(param.getStackType5());
}
public int getStackOrder()
{
return getTemplate()._stackOrder;
}
Код:
public static boolean checkStackType(EffectTemplate ef1, EffectTemplate ef2)
{
if (!ef1._stackType.equals(EffectTemplate.NO_STACK) && ef1._stackType.equalsIgnoreCase(ef2._stackType))
{
return true;
}
if (!ef1._stackType.equals(EffectTemplate.NO_STACK) && ef1._stackType.equalsIgnoreCase(ef2._stackType2))
{
return true;
}
if (!ef1._stackType.equals(EffectTemplate.NO_STACK) && ef1._stackType.equalsIgnoreCase(ef2._stackType3))
{
return true;
}
if (!ef1._stackType.equals(EffectTemplate.NO_STACK) && ef1._stackType.equalsIgnoreCase(ef2._stackType4))
{
return true;
}
if (!ef1._stackType.equals(EffectTemplate.NO_STACK) && ef1._stackType.equalsIgnoreCase(ef2._stackType5))
{
return true;
}
if (!ef1._stackType2.equals(EffectTemplate.NO_STACK) && ef1._stackType2.equalsIgnoreCase(ef2._stackType))
{
return true;
}
if (!ef1._stackType2.equals(EffectTemplate.NO_STACK) && ef1._stackType2.equalsIgnoreCase(ef2._stackType2))
{
return true;
}
if (!ef1._stackType2.equals(EffectTemplate.NO_STACK) && ef1._stackType2.equalsIgnoreCase(ef2._stackType3))
{
return true;
}
if (!ef1._stackType2.equals(EffectTemplate.NO_STACK) && ef1._stackType2.equalsIgnoreCase(ef2._stackType4))
{
return true;
}
if (!ef1._stackType2.equals(EffectTemplate.NO_STACK) && ef1._stackType2.equalsIgnoreCase(ef2._stackType5))
{
return true;
}
if (!ef1._stackType3.equals(EffectTemplate.NO_STACK) && ef1._stackType3.equalsIgnoreCase(ef2._stackType))
{
return true;
}
if (!ef1._stackType3.equals(EffectTemplate.NO_STACK) && ef1._stackType3.equalsIgnoreCase(ef2._stackType2))
{
return true;
}
if (!ef1._stackType3.equals(EffectTemplate.NO_STACK) && ef1._stackType3.equalsIgnoreCase(ef2._stackType3))
{
return true;
}
if (!ef1._stackType3.equals(EffectTemplate.NO_STACK) && ef1._stackType3.equalsIgnoreCase(ef2._stackType4))
{
return true;
}
if (!ef1._stackType3.equals(EffectTemplate.NO_STACK) && ef1._stackType3.equalsIgnoreCase(ef2._stackType5))
{
return true;
}
if (!ef1._stackType4.equals(EffectTemplate.NO_STACK) && ef1._stackType4.equalsIgnoreCase(ef2._stackType))
{
return true;
}
if (!ef1._stackType4.equals(EffectTemplate.NO_STACK) && ef1._stackType4.equalsIgnoreCase(ef2._stackType2))
{
return true;
}
if (!ef1._stackType4.equals(EffectTemplate.NO_STACK) && ef1._stackType4.equalsIgnoreCase(ef2._stackType3))
{
return true;
}
if (!ef1._stackType4.equals(EffectTemplate.NO_STACK) && ef1._stackType4.equalsIgnoreCase(ef2._stackType4))
{
return true;
}
if (!ef1._stackType4.equals(EffectTemplate.NO_STACK) && ef1._stackType4.equalsIgnoreCase(ef2._stackType5))
{
return true;
}
if (!ef1._stackType5.equals(EffectTemplate.NO_STACK) && ef1._stackType5.equalsIgnoreCase(ef2._stackType))
{
return true;
}
if (!ef1._stackType5.equals(EffectTemplate.NO_STACK) && ef1._stackType5.equalsIgnoreCase(ef2._stackType2))
{
return true;
}
if (!ef1._stackType5.equals(EffectTemplate.NO_STACK) && ef1._stackType5.equalsIgnoreCase(ef2._stackType3))
{
return true;
}
if (!ef1._stackType5.equals(EffectTemplate.NO_STACK) && ef1._stackType5.equalsIgnoreCase(ef2._stackType4))
{
return true;
}
if (!ef1._stackType5.equals(EffectTemplate.NO_STACK) && ef1._stackType5.equalsIgnoreCase(ef2._stackType5))
{
return true;
}
return false;
}
Код:
public EffectTemplate(StatsSet set)
{
_value = set.getDouble("value");
_count = set.getInteger("count", 1) < 0 ? Integer.MAX_VALUE : set.getInteger("count", 1);
_period = Math.min(Integer.MAX_VALUE, 1000 * (set.getInteger("time", 1) < 0 ? Integer.MAX_VALUE : set.getInteger("time", 1)));
_abnormalEffect = set.getEnum("abnormal", AbnormalEffect.class);
_abnormalEffect2 = set.getEnum("abnormal2", AbnormalEffect.class);
_abnormalEffect3 = set.getEnum("abnormal3", AbnormalEffect.class);
_stackType = set.getString("stackType", NO_STACK);
_stackType2 = set.getString("stackType2", NO_STACK);
_stackType3 = set.getString("stackType3", NO_STACK);
_stackType4 = set.getString("stackType4", NO_STACK);
_stackType5 = set.getString("stackType5", NO_STACK);
_stackOrder = set.getInteger("stackOrder", _stackType.equals(NO_STACK) && _stackType2.equals(NO_STACK) && _stackType3.equals(NO_STACK) && _stackType4.equals(NO_STACK) && _stackType5.equals(NO_STACK) ? 4 : 3 : 2 : 1 : 0);
_applyOnCaster = set.getBool("applyOnCaster", false);
_applyOnSummon = set.getBool("applyOnSummon", true);
_cancelOnAction = set.getBool("cancelOnAction", false);
_isReflectable = set.getBool("isReflectable", true);
_isSaveable = set.isSet("isSaveable") ? set.getBool("isSaveable") : null;
_isCancelable = set.isSet("isCancelable") ? set.getBool("isCancelable") : null;
_isOffensive = set.isSet("isOffensive") ? set.getBool("isOffensive") : null;
_displayId = set.getInteger("displayId", 0);
_displayLevel = set.getInteger("displayLevel", 0);
_effectType = set.getEnum("name", EffectType.class);
_chance = set.getInteger("chance", Integer.MAX_VALUE);
_paramSet = set;
}
Код:
compile:
[javac] Compiling 2076 source files to C:\Users\server\Desktop\server\source\Trunk\Build\Core Build\bin
[javac] C:\Users\server\Desktop\server\source\Trunk\java\l2f\gameserver\skills\effects\EffectTemplate.java:70: error: ')' expected
[javac] _stackOrder = set.getInteger("stackOrder", _stackType.equals(NO_STACK) && _stackType2.equals(NO_STACK) && _stackType3.equals(NO_STACK) && _stackType4.equals(NO_STACK) && _stackType5.equals(NO_STACK) ? 4 : 3 : 2 : 1 : 0);
[javac] ^
[javac] C:\Users\server\Desktop\server\source\Trunk\java\l2f\gameserver\skills\effects\EffectTemplate.java:70: error: not a statement
[javac] _stackOrder = set.getInteger("stackOrder", _stackType.equals(NO_STACK) && _stackType2.equals(NO_STACK) && _stackType3.equals(NO_STACK) && _stackType4.equals(NO_STACK) && _stackType5.equals(NO_STACK) ? 4 : 3 : 2 : 1 : 0);
[javac] ^
[javac] C:\Users\server\Desktop\server\source\Trunk\java\l2f\gameserver\skills\effects\EffectTemplate.java:70: error: ';' expected
[javac] _stackOrder = set.getInteger("stackOrder", _stackType.equals(NO_STACK) && _stackType2.equals(NO_STACK) && _stackType3.equals(NO_STACK) && _stackType4.equals(NO_STACK) && _stackType5.equals(NO_STACK) ? 4 : 3 : 2 : 1 : 0);
[javac] ^
[javac] 3 errors
Что тут надо написать? куда копать? почему не ставится такой приоритет? где нехватает кода?
Последнее редактирование: