actual freya branch
This commit is contained in:
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills;
|
||||
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
/**
|
||||
* @author DrHouse
|
||||
*/
|
||||
public enum AbnormalEffect
|
||||
{
|
||||
NULL("null", 0x0),
|
||||
BLEEDING("bleed", 0x000001),
|
||||
POISON("poison", 0x000002),
|
||||
REDCIRCLE("redcircle", 0x000004),
|
||||
ICE("ice", 0x000008),
|
||||
WIND("wind", 0x000010),
|
||||
FEAR("fear", 0x000020),
|
||||
STUN("stun", 0x000040),
|
||||
SLEEP("sleep", 0x000080),
|
||||
MUTED("mute", 0x000100),
|
||||
ROOT("root", 0x000200),
|
||||
HOLD_1("hold1", 0x000400),
|
||||
HOLD_2("hold2", 0x000800),
|
||||
UNKNOWN_13("unknown13", 0x001000),
|
||||
BIG_HEAD("bighead", 0x002000),
|
||||
FLAME("flame", 0x004000),
|
||||
UNKNOWN_16("unknown16", 0x008000),
|
||||
GROW("grow", 0x010000),
|
||||
FLOATING_ROOT("floatroot", 0x020000),
|
||||
DANCE_STUNNED("dancestun", 0x040000),
|
||||
FIREROOT_STUN("firerootstun", 0x080000),
|
||||
STEALTH("stealth", 0x100000),
|
||||
IMPRISIONING_1("imprison1", 0x200000),
|
||||
IMPRISIONING_2("imprison2", 0x400000),
|
||||
MAGIC_CIRCLE("magiccircle", 0x800000),
|
||||
ICE2("ice2", 0x1000000),
|
||||
EARTHQUAKE("earthquake", 0x2000000),
|
||||
UNKNOWN_27("unknown27", 0x4000000),
|
||||
INVULNERABLE("invulnerable", 0x8000000),
|
||||
VITALITY("vitality", 0x10000000),
|
||||
REAL_TARGET("realtarget", 0x20000000),
|
||||
DEATH_MARK("deathmark", 0x40000000),
|
||||
SKULL_FEAR("skull_fear", 0x80000000),
|
||||
// CONFUSED("confused", 0x0020),
|
||||
|
||||
// special effects
|
||||
S_INVINCIBLE("invincible", 0x000001),
|
||||
S_AIR_STUN("airstun", 0x000002),
|
||||
S_AIR_ROOT("airroot", 0x000004),
|
||||
S_BAGUETTE_SWORD("baguettesword", 0x000008),
|
||||
S_YELLOW_AFFRO("yellowafro", 0x000010),
|
||||
S_PINK_AFFRO("pinkafro", 0x000020),
|
||||
S_BLACK_AFFRO("blackafro", 0x000040),
|
||||
S_UNKNOWN8("unknown8", 0x000080),
|
||||
S_STIGMA_SHILIEN("stigmashilien", 0x000100),
|
||||
S_STAKATOROOT("stakatoroot", 0x000200),
|
||||
S_FREEZING("freezing", 0x000400),
|
||||
S_VESPER("vesper", 0x000800),
|
||||
|
||||
// event effects
|
||||
E_AFRO_1("afrobaguette1", 0x000001),
|
||||
E_AFRO_2("afrobaguette2", 0x000002),
|
||||
E_AFRO_3("afrobaguette3", 0x000004),
|
||||
E_EVASWRATH("evaswrath", 0x000008),
|
||||
E_HEADPHONE("headphone", 0x000010),
|
||||
E_VESPER_1("vesper1", 0x000020),
|
||||
E_VESPER_2("vesper2", 0x000040),
|
||||
E_VESPER_3("vesper3", 0x000080);
|
||||
|
||||
private final int _mask;
|
||||
private final String _name;
|
||||
|
||||
private AbnormalEffect(String name, int mask)
|
||||
{
|
||||
_name = name;
|
||||
_mask = mask;
|
||||
}
|
||||
|
||||
public final int getMask()
|
||||
{
|
||||
return _mask;
|
||||
}
|
||||
|
||||
public final String getName()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
public static AbnormalEffect getByName(String name)
|
||||
{
|
||||
for (AbnormalEffect eff : AbnormalEffect.values())
|
||||
{
|
||||
if (eff.getName().equals(name))
|
||||
{
|
||||
return eff;
|
||||
}
|
||||
}
|
||||
|
||||
throw new NoSuchElementException("AbnormalEffect not found for name: '" + name + "'.\n Please check " + AbnormalEffect.class.getCanonicalName());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,242 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
|
||||
/**
|
||||
* @author DS
|
||||
*/
|
||||
public enum BaseStats
|
||||
{
|
||||
STR(new STR()),
|
||||
INT(new INT()),
|
||||
DEX(new DEX()),
|
||||
WIT(new WIT()),
|
||||
CON(new CON()),
|
||||
MEN(new MEN()),
|
||||
NULL(new NULL());
|
||||
|
||||
protected static final Logger _log = Logger.getLogger(BaseStats.class.getName());
|
||||
|
||||
public static final int MAX_STAT_VALUE = 100;
|
||||
|
||||
protected static final double[] STRbonus = new double[MAX_STAT_VALUE];
|
||||
protected static final double[] INTbonus = new double[MAX_STAT_VALUE];
|
||||
protected static final double[] DEXbonus = new double[MAX_STAT_VALUE];
|
||||
protected static final double[] WITbonus = new double[MAX_STAT_VALUE];
|
||||
protected static final double[] CONbonus = new double[MAX_STAT_VALUE];
|
||||
protected static final double[] MENbonus = new double[MAX_STAT_VALUE];
|
||||
|
||||
private final BaseStat _stat;
|
||||
|
||||
public final String getValue()
|
||||
{
|
||||
return _stat.getClass().getSimpleName();
|
||||
}
|
||||
|
||||
private BaseStats(BaseStat s)
|
||||
{
|
||||
_stat = s;
|
||||
}
|
||||
|
||||
public final double calcBonus(L2Character actor)
|
||||
{
|
||||
if (actor != null)
|
||||
{
|
||||
return _stat.calcBonus(actor);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static final BaseStats valueOfXml(String name)
|
||||
{
|
||||
name = name.intern();
|
||||
for (BaseStats s : values())
|
||||
{
|
||||
if (s.getValue().equalsIgnoreCase(name))
|
||||
{
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
throw new NoSuchElementException("Unknown name '" + name + "' for enum BaseStats");
|
||||
}
|
||||
|
||||
private interface BaseStat
|
||||
{
|
||||
public double calcBonus(L2Character actor);
|
||||
}
|
||||
|
||||
protected static final class STR implements BaseStat
|
||||
{
|
||||
@Override
|
||||
public final double calcBonus(L2Character actor)
|
||||
{
|
||||
return STRbonus[actor.getSTR()];
|
||||
}
|
||||
}
|
||||
|
||||
protected static final class INT implements BaseStat
|
||||
{
|
||||
@Override
|
||||
public final double calcBonus(L2Character actor)
|
||||
{
|
||||
return INTbonus[actor.getINT()];
|
||||
}
|
||||
}
|
||||
|
||||
protected static final class DEX implements BaseStat
|
||||
{
|
||||
@Override
|
||||
public final double calcBonus(L2Character actor)
|
||||
{
|
||||
return DEXbonus[actor.getDEX()];
|
||||
}
|
||||
}
|
||||
|
||||
protected static final class WIT implements BaseStat
|
||||
{
|
||||
@Override
|
||||
public final double calcBonus(L2Character actor)
|
||||
{
|
||||
return WITbonus[actor.getWIT()];
|
||||
}
|
||||
}
|
||||
|
||||
protected static final class CON implements BaseStat
|
||||
{
|
||||
@Override
|
||||
public final double calcBonus(L2Character actor)
|
||||
{
|
||||
return CONbonus[actor.getCON()];
|
||||
}
|
||||
}
|
||||
|
||||
protected static final class MEN implements BaseStat
|
||||
{
|
||||
@Override
|
||||
public final double calcBonus(L2Character actor)
|
||||
{
|
||||
return MENbonus[actor.getMEN()];
|
||||
}
|
||||
}
|
||||
|
||||
protected static final class NULL implements BaseStat
|
||||
{
|
||||
@Override
|
||||
public final double calcBonus(L2Character actor)
|
||||
{
|
||||
return 1f;
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
{
|
||||
final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
factory.setValidating(false);
|
||||
factory.setIgnoringComments(true);
|
||||
final File file = new File(Config.DATAPACK_ROOT, "data/stats/statBonus.xml");
|
||||
|
||||
if (file.exists())
|
||||
{
|
||||
try
|
||||
{
|
||||
Document doc = factory.newDocumentBuilder().parse(file);
|
||||
String statName;
|
||||
int val;
|
||||
double bonus;
|
||||
NamedNodeMap attrs;
|
||||
for (Node list = doc.getFirstChild(); list != null; list = list.getNextSibling())
|
||||
{
|
||||
if ("list".equalsIgnoreCase(list.getNodeName()))
|
||||
{
|
||||
for (Node stat = list.getFirstChild(); stat != null; stat = stat.getNextSibling())
|
||||
{
|
||||
statName = stat.getNodeName();
|
||||
for (Node value = stat.getFirstChild(); value != null; value = value.getNextSibling())
|
||||
{
|
||||
if ("stat".equalsIgnoreCase(value.getNodeName()))
|
||||
{
|
||||
attrs = value.getAttributes();
|
||||
try
|
||||
{
|
||||
val = Integer.parseInt(attrs.getNamedItem("value").getNodeValue());
|
||||
bonus = Double.parseDouble(attrs.getNamedItem("bonus").getNodeValue());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.severe("[BaseStats] Invalid stats value: " + value.getNodeValue() + ", skipping");
|
||||
continue;
|
||||
}
|
||||
|
||||
if ("STR".equalsIgnoreCase(statName))
|
||||
{
|
||||
STRbonus[val] = bonus;
|
||||
}
|
||||
else if ("INT".equalsIgnoreCase(statName))
|
||||
{
|
||||
INTbonus[val] = bonus;
|
||||
}
|
||||
else if ("DEX".equalsIgnoreCase(statName))
|
||||
{
|
||||
DEXbonus[val] = bonus;
|
||||
}
|
||||
else if ("WIT".equalsIgnoreCase(statName))
|
||||
{
|
||||
WITbonus[val] = bonus;
|
||||
}
|
||||
else if ("CON".equalsIgnoreCase(statName))
|
||||
{
|
||||
CONbonus[val] = bonus;
|
||||
}
|
||||
else if ("MEN".equalsIgnoreCase(statName))
|
||||
{
|
||||
MENbonus[val] = bonus;
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.severe("[BaseStats] Invalid stats name: " + statName + ", skipping");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.WARNING, "[BaseStats] Could not parse file: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Error("[BaseStats] File not found: " + file.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,209 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills;
|
||||
|
||||
import javolution.util.FastList;
|
||||
|
||||
import com.l2jserver.gameserver.skills.funcs.Func;
|
||||
|
||||
/**
|
||||
* A calculator is created to manage and dynamically calculate the effect of a character property (ex : MAX_HP, REGENERATE_HP_RATE...). In fact, each calculator is a table of Func object in which each Func represents a mathematic function : <BR>
|
||||
* <BR>
|
||||
* FuncAtkAccuracy -> Math.sqrt(_player.getDEX())*6+_player.getLevel()<BR>
|
||||
* <BR>
|
||||
* When the calc method of a calculator is launched, each mathematic function is called according to its priority <B>_order</B>. Indeed, Func with lowest priority order is executed first and Funcs with the same order are executed in unspecified order. The result of the calculation is stored in the
|
||||
* value property of an Env class instance.<BR>
|
||||
* <BR>
|
||||
* Method addFunc and removeFunc permit to add and remove a Func object from a Calculator.<BR>
|
||||
* <BR>
|
||||
*/
|
||||
|
||||
public final class Calculator
|
||||
{
|
||||
/** Empty Func table definition */
|
||||
private static final Func[] _emptyFuncs = new Func[0];
|
||||
|
||||
/** Table of Func object */
|
||||
private Func[] _functions;
|
||||
|
||||
/**
|
||||
* Constructor of Calculator (Init value : emptyFuncs).<BR>
|
||||
* <BR>
|
||||
*/
|
||||
public Calculator()
|
||||
{
|
||||
_functions = _emptyFuncs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor of Calculator (Init value : Calculator c).<BR>
|
||||
* <BR>
|
||||
*/
|
||||
public Calculator(Calculator c)
|
||||
{
|
||||
_functions = c._functions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if 2 calculators are equals.<BR>
|
||||
* <BR>
|
||||
*/
|
||||
public static boolean equalsCals(Calculator c1, Calculator c2)
|
||||
{
|
||||
if (c1 == c2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((c1 == null) || (c2 == null))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Func[] funcs1 = c1._functions;
|
||||
Func[] funcs2 = c2._functions;
|
||||
|
||||
if (funcs1 == funcs2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (funcs1.length != funcs2.length)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (funcs1.length == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
for (int i = 0; i < funcs1.length; i++)
|
||||
{
|
||||
if (funcs1[i] != funcs2[i])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the number of Funcs in the Calculator.<BR>
|
||||
* <BR>
|
||||
*/
|
||||
public int size()
|
||||
{
|
||||
return _functions.length;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a Func to the Calculator.<BR>
|
||||
* <BR>
|
||||
*/
|
||||
public synchronized void addFunc(Func f)
|
||||
{
|
||||
Func[] funcs = _functions;
|
||||
Func[] tmp = new Func[funcs.length + 1];
|
||||
|
||||
final int order = f.order;
|
||||
int i;
|
||||
|
||||
for (i = 0; (i < funcs.length) && (order >= funcs[i].order); i++)
|
||||
{
|
||||
tmp[i] = funcs[i];
|
||||
}
|
||||
|
||||
tmp[i] = f;
|
||||
|
||||
for (; i < funcs.length; i++)
|
||||
{
|
||||
tmp[i + 1] = funcs[i];
|
||||
}
|
||||
|
||||
_functions = tmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a Func from the Calculator.<BR>
|
||||
* <BR>
|
||||
*/
|
||||
public synchronized void removeFunc(Func f)
|
||||
{
|
||||
Func[] funcs = _functions;
|
||||
Func[] tmp = new Func[funcs.length - 1];
|
||||
|
||||
int i;
|
||||
|
||||
for (i = 0; (i < funcs.length) && (f != funcs[i]); i++)
|
||||
{
|
||||
tmp[i] = funcs[i];
|
||||
}
|
||||
|
||||
if (i == funcs.length)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (i++; i < funcs.length; i++)
|
||||
{
|
||||
tmp[i - 1] = funcs[i];
|
||||
}
|
||||
|
||||
if (tmp.length == 0)
|
||||
{
|
||||
_functions = _emptyFuncs;
|
||||
}
|
||||
else
|
||||
{
|
||||
_functions = tmp;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove each Func with the specified owner of the Calculator.<BR>
|
||||
* <BR>
|
||||
*/
|
||||
public synchronized FastList<Stats> removeOwner(Object owner)
|
||||
{
|
||||
FastList<Stats> modifiedStats = new FastList<>();
|
||||
|
||||
for (Func func : _functions)
|
||||
{
|
||||
if (func.funcOwner == owner)
|
||||
{
|
||||
modifiedStats.add(func.stat);
|
||||
removeFunc(func);
|
||||
}
|
||||
}
|
||||
return modifiedStats;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Run each Func of the Calculator.<BR>
|
||||
* <BR>
|
||||
*/
|
||||
public void calc(Env env)
|
||||
{
|
||||
for (Func func : _functions)
|
||||
{
|
||||
func.calc(env);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,183 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import javolution.util.FastList;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import com.l2jserver.gameserver.Item;
|
||||
import com.l2jserver.gameserver.skills.conditions.Condition;
|
||||
import com.l2jserver.gameserver.templates.StatsSet;
|
||||
import com.l2jserver.gameserver.templates.item.L2Item;
|
||||
|
||||
/**
|
||||
* @author mkizub, JIV
|
||||
*/
|
||||
final class DocumentItem extends DocumentBase
|
||||
{
|
||||
private Item _currentItem = null;
|
||||
private final List<L2Item> _itemsInFile = new FastList<>();
|
||||
|
||||
/**
|
||||
* @param f
|
||||
*/
|
||||
public DocumentItem(File file)
|
||||
{
|
||||
super(file);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected StatsSet getStatsSet()
|
||||
{
|
||||
return _currentItem.set;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTableValue(String name)
|
||||
{
|
||||
return _tables.get(name)[_currentItem.currentLevel];
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTableValue(String name, int idx)
|
||||
{
|
||||
return _tables.get(name)[idx - 1];
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void parseDocument(Document doc)
|
||||
{
|
||||
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
|
||||
{
|
||||
if ("list".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
|
||||
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
|
||||
{
|
||||
if ("item".equalsIgnoreCase(d.getNodeName()))
|
||||
{
|
||||
try
|
||||
{
|
||||
_currentItem = new Item();
|
||||
parseItem(d);
|
||||
_itemsInFile.add(_currentItem.item);
|
||||
resetTable();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.WARNING, "Cannot create item " + _currentItem.id, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void parseItem(Node n) throws InvocationTargetException
|
||||
{
|
||||
int itemId = Integer.parseInt(n.getAttributes().getNamedItem("id").getNodeValue());
|
||||
String className = n.getAttributes().getNamedItem("type").getNodeValue();
|
||||
String itemName = n.getAttributes().getNamedItem("name").getNodeValue();
|
||||
|
||||
_currentItem.id = itemId;
|
||||
_currentItem.name = itemName;
|
||||
_currentItem.type = className;
|
||||
_currentItem.set = new StatsSet();
|
||||
_currentItem.set.set("item_id", itemId);
|
||||
_currentItem.set.set("name", itemName);
|
||||
|
||||
Node first = n.getFirstChild();
|
||||
for (n = first; n != null; n = n.getNextSibling())
|
||||
{
|
||||
if ("table".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
if (_currentItem.item != null)
|
||||
{
|
||||
throw new IllegalStateException("Item created but table node found! Item " + itemId);
|
||||
}
|
||||
parseTable(n);
|
||||
}
|
||||
else if ("set".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
if (_currentItem.item != null)
|
||||
{
|
||||
throw new IllegalStateException("Item created but set node found! Item " + itemId);
|
||||
}
|
||||
parseBeanSet(n, _currentItem.set, 1);
|
||||
}
|
||||
else if ("for".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
makeItem();
|
||||
parseTemplate(n, _currentItem.item);
|
||||
}
|
||||
else if ("cond".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
makeItem();
|
||||
Condition condition = parseCondition(n.getFirstChild(), _currentItem.item);
|
||||
Node msg = n.getAttributes().getNamedItem("msg");
|
||||
Node msgId = n.getAttributes().getNamedItem("msgId");
|
||||
if ((condition != null) && (msg != null))
|
||||
{
|
||||
condition.setMessage(msg.getNodeValue());
|
||||
}
|
||||
else if ((condition != null) && (msgId != null))
|
||||
{
|
||||
condition.setMessageId(Integer.decode(getValue(msgId.getNodeValue(), null)));
|
||||
Node addName = n.getAttributes().getNamedItem("addName");
|
||||
if ((addName != null) && (Integer.decode(getValue(msgId.getNodeValue(), null)) > 0))
|
||||
{
|
||||
condition.addName();
|
||||
}
|
||||
}
|
||||
_currentItem.item.attach(condition);
|
||||
}
|
||||
}
|
||||
// bah! in this point item doesn't have to be still created
|
||||
makeItem();
|
||||
}
|
||||
|
||||
private void makeItem() throws InvocationTargetException
|
||||
{
|
||||
if (_currentItem.item != null)
|
||||
{
|
||||
return; // item is already created
|
||||
}
|
||||
try
|
||||
{
|
||||
Constructor<?> c = Class.forName("com.l2jserver.gameserver.templates.item.L2" + _currentItem.type).getConstructor(StatsSet.class);
|
||||
_currentItem.item = (L2Item) c.newInstance(_currentItem.set);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new InvocationTargetException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public List<L2Item> getItemList()
|
||||
{
|
||||
return _itemsInFile;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,995 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import javolution.util.FastList;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import com.l2jserver.gameserver.datatables.EnchantGroupsTable;
|
||||
import com.l2jserver.gameserver.model.L2Skill;
|
||||
import com.l2jserver.gameserver.skills.conditions.Condition;
|
||||
import com.l2jserver.gameserver.templates.StatsSet;
|
||||
import com.l2jserver.gameserver.templates.skills.L2SkillType;
|
||||
|
||||
/**
|
||||
* @author mkizub
|
||||
*/
|
||||
class DocumentSkill extends DocumentBase
|
||||
{
|
||||
public static class Skill
|
||||
{
|
||||
public int id;
|
||||
public String name;
|
||||
public StatsSet[] sets;
|
||||
public StatsSet[] enchsets1;
|
||||
public StatsSet[] enchsets2;
|
||||
public StatsSet[] enchsets3;
|
||||
public StatsSet[] enchsets4;
|
||||
public StatsSet[] enchsets5;
|
||||
public StatsSet[] enchsets6;
|
||||
public StatsSet[] enchsets7;
|
||||
public StatsSet[] enchsets8;
|
||||
public int currentLevel;
|
||||
public List<L2Skill> skills = new FastList<>();
|
||||
public List<L2Skill> currentSkills = new FastList<>();
|
||||
}
|
||||
|
||||
private Skill _currentSkill;
|
||||
private final List<L2Skill> _skillsInFile = new FastList<>();
|
||||
|
||||
DocumentSkill(File file)
|
||||
{
|
||||
super(file);
|
||||
}
|
||||
|
||||
private void setCurrentSkill(Skill skill)
|
||||
{
|
||||
_currentSkill = skill;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected StatsSet getStatsSet()
|
||||
{
|
||||
return _currentSkill.sets[_currentSkill.currentLevel];
|
||||
}
|
||||
|
||||
protected List<L2Skill> getSkills()
|
||||
{
|
||||
return _skillsInFile;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTableValue(String name)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _tables.get(name)[_currentSkill.currentLevel];
|
||||
}
|
||||
catch (RuntimeException e)
|
||||
{
|
||||
_log.log(Level.SEVERE, "Error in table: " + name + " of Skill Id " + _currentSkill.id, e);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTableValue(String name, int idx)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _tables.get(name)[idx - 1];
|
||||
}
|
||||
catch (RuntimeException e)
|
||||
{
|
||||
_log.log(Level.SEVERE, "wrong level count in skill Id " + _currentSkill.id + " name: " + name + " index : " + idx, e);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void parseDocument(Document doc)
|
||||
{
|
||||
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
|
||||
{
|
||||
if ("list".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
|
||||
{
|
||||
if ("skill".equalsIgnoreCase(d.getNodeName()))
|
||||
{
|
||||
setCurrentSkill(new Skill());
|
||||
parseSkill(d);
|
||||
_skillsInFile.addAll(_currentSkill.skills);
|
||||
resetTable();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ("skill".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
setCurrentSkill(new Skill());
|
||||
parseSkill(n);
|
||||
_skillsInFile.addAll(_currentSkill.skills);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void parseSkill(Node n)
|
||||
{
|
||||
NamedNodeMap attrs = n.getAttributes();
|
||||
int enchantLevels1 = 0;
|
||||
int enchantLevels2 = 0;
|
||||
int enchantLevels3 = 0;
|
||||
int enchantLevels4 = 0;
|
||||
int enchantLevels5 = 0;
|
||||
int enchantLevels6 = 0;
|
||||
int enchantLevels7 = 0;
|
||||
int enchantLevels8 = 0;
|
||||
int skillId = Integer.parseInt(attrs.getNamedItem("id").getNodeValue());
|
||||
String skillName = attrs.getNamedItem("name").getNodeValue();
|
||||
String levels = attrs.getNamedItem("levels").getNodeValue();
|
||||
int lastLvl = Integer.parseInt(levels);
|
||||
if (attrs.getNamedItem("enchantGroup1") != null)
|
||||
{
|
||||
enchantLevels1 = EnchantGroupsTable.getInstance().addNewRouteForSkill(skillId, lastLvl, 1, Integer.parseInt(attrs.getNamedItem("enchantGroup1").getNodeValue()));
|
||||
}
|
||||
if (attrs.getNamedItem("enchantGroup2") != null)
|
||||
{
|
||||
enchantLevels2 = EnchantGroupsTable.getInstance().addNewRouteForSkill(skillId, lastLvl, 2, Integer.parseInt(attrs.getNamedItem("enchantGroup2").getNodeValue()));
|
||||
}
|
||||
if (attrs.getNamedItem("enchantGroup3") != null)
|
||||
{
|
||||
enchantLevels3 = EnchantGroupsTable.getInstance().addNewRouteForSkill(skillId, lastLvl, 3, Integer.parseInt(attrs.getNamedItem("enchantGroup3").getNodeValue()));
|
||||
}
|
||||
if (attrs.getNamedItem("enchantGroup4") != null)
|
||||
{
|
||||
enchantLevels4 = EnchantGroupsTable.getInstance().addNewRouteForSkill(skillId, lastLvl, 4, Integer.parseInt(attrs.getNamedItem("enchantGroup4").getNodeValue()));
|
||||
}
|
||||
if (attrs.getNamedItem("enchantGroup5") != null)
|
||||
{
|
||||
enchantLevels5 = EnchantGroupsTable.getInstance().addNewRouteForSkill(skillId, lastLvl, 5, Integer.parseInt(attrs.getNamedItem("enchantGroup5").getNodeValue()));
|
||||
}
|
||||
if (attrs.getNamedItem("enchantGroup6") != null)
|
||||
{
|
||||
enchantLevels6 = EnchantGroupsTable.getInstance().addNewRouteForSkill(skillId, lastLvl, 6, Integer.parseInt(attrs.getNamedItem("enchantGroup6").getNodeValue()));
|
||||
}
|
||||
if (attrs.getNamedItem("enchantGroup7") != null)
|
||||
{
|
||||
enchantLevels7 = EnchantGroupsTable.getInstance().addNewRouteForSkill(skillId, lastLvl, 7, Integer.parseInt(attrs.getNamedItem("enchantGroup7").getNodeValue()));
|
||||
}
|
||||
if (attrs.getNamedItem("enchantGroup8") != null)
|
||||
{
|
||||
enchantLevels8 = EnchantGroupsTable.getInstance().addNewRouteForSkill(skillId, lastLvl, 8, Integer.parseInt(attrs.getNamedItem("enchantGroup8").getNodeValue()));
|
||||
}
|
||||
|
||||
_currentSkill.id = skillId;
|
||||
_currentSkill.name = skillName;
|
||||
_currentSkill.sets = new StatsSet[lastLvl];
|
||||
_currentSkill.enchsets1 = new StatsSet[enchantLevels1];
|
||||
_currentSkill.enchsets2 = new StatsSet[enchantLevels2];
|
||||
_currentSkill.enchsets3 = new StatsSet[enchantLevels3];
|
||||
_currentSkill.enchsets4 = new StatsSet[enchantLevels4];
|
||||
_currentSkill.enchsets5 = new StatsSet[enchantLevels5];
|
||||
_currentSkill.enchsets6 = new StatsSet[enchantLevels6];
|
||||
_currentSkill.enchsets7 = new StatsSet[enchantLevels7];
|
||||
_currentSkill.enchsets8 = new StatsSet[enchantLevels8];
|
||||
|
||||
for (int i = 0; i < lastLvl; i++)
|
||||
{
|
||||
_currentSkill.sets[i] = new StatsSet();
|
||||
_currentSkill.sets[i].set("skill_id", _currentSkill.id);
|
||||
_currentSkill.sets[i].set("level", i + 1);
|
||||
_currentSkill.sets[i].set("name", _currentSkill.name);
|
||||
}
|
||||
|
||||
if (_currentSkill.sets.length != lastLvl)
|
||||
{
|
||||
throw new RuntimeException("Skill id=" + skillId + " number of levels missmatch, " + lastLvl + " levels expected");
|
||||
}
|
||||
|
||||
Node first = n.getFirstChild();
|
||||
for (n = first; n != null; n = n.getNextSibling())
|
||||
{
|
||||
if ("table".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
parseTable(n);
|
||||
}
|
||||
}
|
||||
for (int i = 1; i <= lastLvl; i++)
|
||||
{
|
||||
for (n = first; n != null; n = n.getNextSibling())
|
||||
{
|
||||
if ("set".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
// Extractable item skills by Zoey76
|
||||
if ("capsuled_items_skill".equalsIgnoreCase(n.getAttributes().getNamedItem("name").getNodeValue()))
|
||||
{
|
||||
setExtractableSkillData(_currentSkill.sets[i - 1], getTableValue("#extractableItems", i));
|
||||
}
|
||||
else
|
||||
{
|
||||
parseBeanSet(n, _currentSkill.sets[i - 1], i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < enchantLevels1; i++)
|
||||
{
|
||||
_currentSkill.enchsets1[i] = new StatsSet();
|
||||
_currentSkill.enchsets1[i].set("skill_id", _currentSkill.id);
|
||||
// currentSkill.enchsets1[i] = currentSkill.sets[currentSkill.sets.length-1];
|
||||
_currentSkill.enchsets1[i].set("level", i + 101);
|
||||
_currentSkill.enchsets1[i].set("name", _currentSkill.name);
|
||||
// currentSkill.enchsets1[i].set("skillType", "NOTDONE");
|
||||
|
||||
for (n = first; n != null; n = n.getNextSibling())
|
||||
{
|
||||
if ("set".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
parseBeanSet(n, _currentSkill.enchsets1[i], _currentSkill.sets.length);
|
||||
}
|
||||
}
|
||||
|
||||
for (n = first; n != null; n = n.getNextSibling())
|
||||
{
|
||||
if ("enchant1".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
parseBeanSet(n, _currentSkill.enchsets1[i], i + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_currentSkill.enchsets1.length != enchantLevels1)
|
||||
{
|
||||
throw new RuntimeException("Skill id=" + skillId + " number of levels missmatch, " + enchantLevels1 + " levels expected");
|
||||
}
|
||||
|
||||
for (int i = 0; i < enchantLevels2; i++)
|
||||
{
|
||||
_currentSkill.enchsets2[i] = new StatsSet();
|
||||
// currentSkill.enchsets2[i] = currentSkill.sets[currentSkill.sets.length-1];
|
||||
_currentSkill.enchsets2[i].set("skill_id", _currentSkill.id);
|
||||
_currentSkill.enchsets2[i].set("level", i + 201);
|
||||
_currentSkill.enchsets2[i].set("name", _currentSkill.name);
|
||||
// currentSkill.enchsets2[i].set("skillType", "NOTDONE");
|
||||
|
||||
for (n = first; n != null; n = n.getNextSibling())
|
||||
{
|
||||
if ("set".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
parseBeanSet(n, _currentSkill.enchsets2[i], _currentSkill.sets.length);
|
||||
}
|
||||
}
|
||||
|
||||
for (n = first; n != null; n = n.getNextSibling())
|
||||
{
|
||||
if ("enchant2".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
parseBeanSet(n, _currentSkill.enchsets2[i], i + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_currentSkill.enchsets2.length != enchantLevels2)
|
||||
{
|
||||
throw new RuntimeException("Skill id=" + skillId + " number of levels missmatch, " + enchantLevels2 + " levels expected");
|
||||
}
|
||||
|
||||
for (int i = 0; i < enchantLevels3; i++)
|
||||
{
|
||||
_currentSkill.enchsets3[i] = new StatsSet();
|
||||
_currentSkill.enchsets3[i].set("skill_id", _currentSkill.id);
|
||||
_currentSkill.enchsets3[i].set("level", i + 301);
|
||||
_currentSkill.enchsets3[i].set("name", _currentSkill.name);
|
||||
|
||||
for (n = first; n != null; n = n.getNextSibling())
|
||||
{
|
||||
if ("set".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
parseBeanSet(n, _currentSkill.enchsets3[i], _currentSkill.sets.length);
|
||||
}
|
||||
}
|
||||
|
||||
for (n = first; n != null; n = n.getNextSibling())
|
||||
{
|
||||
if ("enchant3".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
parseBeanSet(n, _currentSkill.enchsets3[i], i + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_currentSkill.enchsets3.length != enchantLevels3)
|
||||
{
|
||||
throw new RuntimeException("Skill id=" + skillId + " number of levels missmatch, " + enchantLevels3 + " levels expected");
|
||||
}
|
||||
|
||||
for (int i = 0; i < enchantLevels4; i++)
|
||||
{
|
||||
_currentSkill.enchsets4[i] = new StatsSet();
|
||||
_currentSkill.enchsets4[i].set("skill_id", _currentSkill.id);
|
||||
_currentSkill.enchsets4[i].set("level", i + 401);
|
||||
_currentSkill.enchsets4[i].set("name", _currentSkill.name);
|
||||
|
||||
for (n = first; n != null; n = n.getNextSibling())
|
||||
{
|
||||
if ("set".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
parseBeanSet(n, _currentSkill.enchsets4[i], _currentSkill.sets.length);
|
||||
}
|
||||
}
|
||||
|
||||
for (n = first; n != null; n = n.getNextSibling())
|
||||
{
|
||||
if ("enchant4".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
parseBeanSet(n, _currentSkill.enchsets4[i], i + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_currentSkill.enchsets4.length != enchantLevels4)
|
||||
{
|
||||
throw new RuntimeException("Skill id=" + skillId + " number of levels missmatch, " + enchantLevels4 + " levels expected");
|
||||
}
|
||||
|
||||
for (int i = 0; i < enchantLevels5; i++)
|
||||
{
|
||||
_currentSkill.enchsets5[i] = new StatsSet();
|
||||
_currentSkill.enchsets5[i].set("skill_id", _currentSkill.id);
|
||||
_currentSkill.enchsets5[i].set("level", i + 501);
|
||||
_currentSkill.enchsets5[i].set("name", _currentSkill.name);
|
||||
|
||||
for (n = first; n != null; n = n.getNextSibling())
|
||||
{
|
||||
if ("set".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
parseBeanSet(n, _currentSkill.enchsets5[i], _currentSkill.sets.length);
|
||||
}
|
||||
}
|
||||
|
||||
for (n = first; n != null; n = n.getNextSibling())
|
||||
{
|
||||
if ("enchant5".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
parseBeanSet(n, _currentSkill.enchsets5[i], i + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_currentSkill.enchsets5.length != enchantLevels5)
|
||||
{
|
||||
throw new RuntimeException("Skill id=" + skillId + " number of levels missmatch, " + enchantLevels5 + " levels expected");
|
||||
}
|
||||
|
||||
for (int i = 0; i < enchantLevels6; i++)
|
||||
{
|
||||
_currentSkill.enchsets6[i] = new StatsSet();
|
||||
_currentSkill.enchsets6[i].set("skill_id", _currentSkill.id);
|
||||
_currentSkill.enchsets6[i].set("level", i + 601);
|
||||
_currentSkill.enchsets6[i].set("name", _currentSkill.name);
|
||||
|
||||
for (n = first; n != null; n = n.getNextSibling())
|
||||
{
|
||||
if ("set".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
parseBeanSet(n, _currentSkill.enchsets6[i], _currentSkill.sets.length);
|
||||
}
|
||||
}
|
||||
|
||||
for (n = first; n != null; n = n.getNextSibling())
|
||||
{
|
||||
if ("enchant6".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
parseBeanSet(n, _currentSkill.enchsets6[i], i + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_currentSkill.enchsets6.length != enchantLevels6)
|
||||
{
|
||||
throw new RuntimeException("Skill id=" + skillId + " number of levels missmatch, " + enchantLevels6 + " levels expected");
|
||||
}
|
||||
|
||||
for (int i = 0; i < enchantLevels7; i++)
|
||||
{
|
||||
_currentSkill.enchsets7[i] = new StatsSet();
|
||||
_currentSkill.enchsets7[i].set("skill_id", _currentSkill.id);
|
||||
_currentSkill.enchsets7[i].set("level", i + 701);
|
||||
_currentSkill.enchsets7[i].set("name", _currentSkill.name);
|
||||
|
||||
for (n = first; n != null; n = n.getNextSibling())
|
||||
{
|
||||
if ("set".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
parseBeanSet(n, _currentSkill.enchsets7[i], _currentSkill.sets.length);
|
||||
}
|
||||
}
|
||||
|
||||
for (n = first; n != null; n = n.getNextSibling())
|
||||
{
|
||||
if ("enchant7".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
parseBeanSet(n, _currentSkill.enchsets7[i], i + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_currentSkill.enchsets7.length != enchantLevels7)
|
||||
{
|
||||
throw new RuntimeException("Skill id=" + skillId + " number of levels missmatch, " + enchantLevels7 + " levels expected");
|
||||
}
|
||||
|
||||
for (int i = 0; i < enchantLevels8; i++)
|
||||
{
|
||||
_currentSkill.enchsets8[i] = new StatsSet();
|
||||
_currentSkill.enchsets8[i].set("skill_id", _currentSkill.id);
|
||||
_currentSkill.enchsets8[i].set("level", i + 801);
|
||||
_currentSkill.enchsets8[i].set("name", _currentSkill.name);
|
||||
|
||||
for (n = first; n != null; n = n.getNextSibling())
|
||||
{
|
||||
if ("set".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
parseBeanSet(n, _currentSkill.enchsets8[i], _currentSkill.sets.length);
|
||||
}
|
||||
}
|
||||
|
||||
for (n = first; n != null; n = n.getNextSibling())
|
||||
{
|
||||
if ("enchant8".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
parseBeanSet(n, _currentSkill.enchsets8[i], i + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_currentSkill.enchsets8.length != enchantLevels8)
|
||||
{
|
||||
throw new RuntimeException("Skill id=" + skillId + " number of levels missmatch, " + enchantLevels8 + " levels expected");
|
||||
}
|
||||
|
||||
makeSkills();
|
||||
for (int i = 0; i < lastLvl; i++)
|
||||
{
|
||||
_currentSkill.currentLevel = i;
|
||||
for (n = first; n != null; n = n.getNextSibling())
|
||||
{
|
||||
if ("cond".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
|
||||
Node msg = n.getAttributes().getNamedItem("msg");
|
||||
Node msgId = n.getAttributes().getNamedItem("msgId");
|
||||
if ((condition != null) && (msg != null))
|
||||
{
|
||||
condition.setMessage(msg.getNodeValue());
|
||||
}
|
||||
else if ((condition != null) && (msgId != null))
|
||||
{
|
||||
condition.setMessageId(Integer.decode(getValue(msgId.getNodeValue(), null)));
|
||||
Node addName = n.getAttributes().getNamedItem("addName");
|
||||
if ((addName != null) && (Integer.decode(getValue(msgId.getNodeValue(), null)) > 0))
|
||||
{
|
||||
condition.addName();
|
||||
}
|
||||
}
|
||||
_currentSkill.currentSkills.get(i).attach(condition, false);
|
||||
}
|
||||
else if ("for".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
parseTemplate(n, _currentSkill.currentSkills.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = lastLvl; i < (lastLvl + enchantLevels1); i++)
|
||||
{
|
||||
_currentSkill.currentLevel = i - lastLvl;
|
||||
boolean foundCond = false, foundFor = false;
|
||||
for (n = first; n != null; n = n.getNextSibling())
|
||||
{
|
||||
if ("enchant1cond".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
foundCond = true;
|
||||
Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
|
||||
Node msg = n.getAttributes().getNamedItem("msg");
|
||||
if ((condition != null) && (msg != null))
|
||||
{
|
||||
condition.setMessage(msg.getNodeValue());
|
||||
}
|
||||
_currentSkill.currentSkills.get(i).attach(condition, false);
|
||||
}
|
||||
else if ("enchant1for".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
foundFor = true;
|
||||
parseTemplate(n, _currentSkill.currentSkills.get(i));
|
||||
}
|
||||
}
|
||||
// If none found, the enchanted skill will take effects from maxLvL of norm skill
|
||||
if (!foundCond || !foundFor)
|
||||
{
|
||||
_currentSkill.currentLevel = lastLvl - 1;
|
||||
for (n = first; n != null; n = n.getNextSibling())
|
||||
{
|
||||
if (!foundCond && "cond".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
|
||||
Node msg = n.getAttributes().getNamedItem("msg");
|
||||
if ((condition != null) && (msg != null))
|
||||
{
|
||||
condition.setMessage(msg.getNodeValue());
|
||||
}
|
||||
_currentSkill.currentSkills.get(i).attach(condition, false);
|
||||
}
|
||||
else if (!foundFor && "for".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
parseTemplate(n, _currentSkill.currentSkills.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = lastLvl + enchantLevels1; i < (lastLvl + enchantLevels1 + enchantLevels2); i++)
|
||||
{
|
||||
boolean foundCond = false, foundFor = false;
|
||||
_currentSkill.currentLevel = i - lastLvl - enchantLevels1;
|
||||
for (n = first; n != null; n = n.getNextSibling())
|
||||
{
|
||||
if ("enchant2cond".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
foundCond = true;
|
||||
Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
|
||||
Node msg = n.getAttributes().getNamedItem("msg");
|
||||
if ((condition != null) && (msg != null))
|
||||
{
|
||||
condition.setMessage(msg.getNodeValue());
|
||||
}
|
||||
_currentSkill.currentSkills.get(i).attach(condition, false);
|
||||
}
|
||||
else if ("enchant2for".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
foundFor = true;
|
||||
parseTemplate(n, _currentSkill.currentSkills.get(i));
|
||||
}
|
||||
}
|
||||
// If none found, the enchanted skill will take effects from maxLvL of norm skill
|
||||
if (!foundCond || !foundFor)
|
||||
{
|
||||
_currentSkill.currentLevel = lastLvl - 1;
|
||||
for (n = first; n != null; n = n.getNextSibling())
|
||||
{
|
||||
if (!foundCond && "cond".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
|
||||
Node msg = n.getAttributes().getNamedItem("msg");
|
||||
if ((condition != null) && (msg != null))
|
||||
{
|
||||
condition.setMessage(msg.getNodeValue());
|
||||
}
|
||||
_currentSkill.currentSkills.get(i).attach(condition, false);
|
||||
}
|
||||
else if (!foundFor && "for".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
parseTemplate(n, _currentSkill.currentSkills.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = lastLvl + enchantLevels1 + enchantLevels2; i < (lastLvl + enchantLevels1 + enchantLevels2 + enchantLevels3); i++)
|
||||
{
|
||||
boolean foundCond = false, foundFor = false;
|
||||
_currentSkill.currentLevel = i - lastLvl - enchantLevels1 - enchantLevels2;
|
||||
for (n = first; n != null; n = n.getNextSibling())
|
||||
{
|
||||
if ("enchant3cond".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
foundCond = true;
|
||||
Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
|
||||
Node msg = n.getAttributes().getNamedItem("msg");
|
||||
if ((condition != null) && (msg != null))
|
||||
{
|
||||
condition.setMessage(msg.getNodeValue());
|
||||
}
|
||||
_currentSkill.currentSkills.get(i).attach(condition, false);
|
||||
}
|
||||
else if ("enchant3for".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
foundFor = true;
|
||||
parseTemplate(n, _currentSkill.currentSkills.get(i));
|
||||
}
|
||||
}
|
||||
// If none found, the enchanted skill will take effects from maxLvL of norm skill
|
||||
if (!foundCond || !foundFor)
|
||||
{
|
||||
_currentSkill.currentLevel = lastLvl - 1;
|
||||
for (n = first; n != null; n = n.getNextSibling())
|
||||
{
|
||||
if (!foundCond && "cond".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
|
||||
Node msg = n.getAttributes().getNamedItem("msg");
|
||||
if ((condition != null) && (msg != null))
|
||||
{
|
||||
condition.setMessage(msg.getNodeValue());
|
||||
}
|
||||
_currentSkill.currentSkills.get(i).attach(condition, false);
|
||||
}
|
||||
else if (!foundFor && "for".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
parseTemplate(n, _currentSkill.currentSkills.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = lastLvl + enchantLevels1 + enchantLevels2 + enchantLevels3; i < (lastLvl + enchantLevels1 + enchantLevels2 + enchantLevels3 + enchantLevels4); i++)
|
||||
{
|
||||
boolean foundCond = false, foundFor = false;
|
||||
_currentSkill.currentLevel = i - lastLvl - enchantLevels1 - enchantLevels2 - enchantLevels3;
|
||||
for (n = first; n != null; n = n.getNextSibling())
|
||||
{
|
||||
if ("enchant4cond".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
foundCond = true;
|
||||
Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
|
||||
Node msg = n.getAttributes().getNamedItem("msg");
|
||||
if ((condition != null) && (msg != null))
|
||||
{
|
||||
condition.setMessage(msg.getNodeValue());
|
||||
}
|
||||
_currentSkill.currentSkills.get(i).attach(condition, false);
|
||||
}
|
||||
else if ("enchant4for".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
foundFor = true;
|
||||
parseTemplate(n, _currentSkill.currentSkills.get(i));
|
||||
}
|
||||
}
|
||||
// If none found, the enchanted skill will take effects from maxLvL of norm skill
|
||||
if (!foundCond || !foundFor)
|
||||
{
|
||||
_currentSkill.currentLevel = lastLvl - 1;
|
||||
for (n = first; n != null; n = n.getNextSibling())
|
||||
{
|
||||
if (!foundCond && "cond".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
|
||||
Node msg = n.getAttributes().getNamedItem("msg");
|
||||
if ((condition != null) && (msg != null))
|
||||
{
|
||||
condition.setMessage(msg.getNodeValue());
|
||||
}
|
||||
_currentSkill.currentSkills.get(i).attach(condition, false);
|
||||
}
|
||||
else if (!foundFor && "for".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
parseTemplate(n, _currentSkill.currentSkills.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = lastLvl + enchantLevels1 + enchantLevels2 + enchantLevels3 + enchantLevels4; i < (lastLvl + enchantLevels1 + enchantLevels2 + enchantLevels3 + enchantLevels4 + enchantLevels5); i++)
|
||||
{
|
||||
boolean foundCond = false, foundFor = false;
|
||||
_currentSkill.currentLevel = i - lastLvl - enchantLevels1 - enchantLevels2 - enchantLevels3 - enchantLevels4;
|
||||
for (n = first; n != null; n = n.getNextSibling())
|
||||
{
|
||||
if ("enchant5cond".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
foundCond = true;
|
||||
Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
|
||||
Node msg = n.getAttributes().getNamedItem("msg");
|
||||
if ((condition != null) && (msg != null))
|
||||
{
|
||||
condition.setMessage(msg.getNodeValue());
|
||||
}
|
||||
_currentSkill.currentSkills.get(i).attach(condition, false);
|
||||
}
|
||||
else if ("enchant5for".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
foundFor = true;
|
||||
parseTemplate(n, _currentSkill.currentSkills.get(i));
|
||||
}
|
||||
}
|
||||
// If none found, the enchanted skill will take effects from maxLvL of norm skill
|
||||
if (!foundCond || !foundFor)
|
||||
{
|
||||
_currentSkill.currentLevel = lastLvl - 1;
|
||||
for (n = first; n != null; n = n.getNextSibling())
|
||||
{
|
||||
if (!foundCond && "cond".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
|
||||
Node msg = n.getAttributes().getNamedItem("msg");
|
||||
if ((condition != null) && (msg != null))
|
||||
{
|
||||
condition.setMessage(msg.getNodeValue());
|
||||
}
|
||||
_currentSkill.currentSkills.get(i).attach(condition, false);
|
||||
}
|
||||
else if (!foundFor && "for".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
parseTemplate(n, _currentSkill.currentSkills.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = lastLvl + enchantLevels1 + enchantLevels2 + enchantLevels3 + enchantLevels4 + enchantLevels5; i < (lastLvl + enchantLevels1 + enchantLevels2 + enchantLevels3 + enchantLevels4 + enchantLevels5 + enchantLevels6); i++)
|
||||
{
|
||||
boolean foundCond = false, foundFor = false;
|
||||
_currentSkill.currentLevel = i - lastLvl - enchantLevels1 - enchantLevels2 - enchantLevels3 - enchantLevels4 - enchantLevels5;
|
||||
for (n = first; n != null; n = n.getNextSibling())
|
||||
{
|
||||
if ("enchant6cond".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
foundCond = true;
|
||||
Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
|
||||
Node msg = n.getAttributes().getNamedItem("msg");
|
||||
if ((condition != null) && (msg != null))
|
||||
{
|
||||
condition.setMessage(msg.getNodeValue());
|
||||
}
|
||||
_currentSkill.currentSkills.get(i).attach(condition, false);
|
||||
}
|
||||
else if ("enchant6for".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
foundFor = true;
|
||||
parseTemplate(n, _currentSkill.currentSkills.get(i));
|
||||
}
|
||||
}
|
||||
// If none found, the enchanted skill will take effects from maxLvL of norm skill
|
||||
if (!foundCond || !foundFor)
|
||||
{
|
||||
_currentSkill.currentLevel = lastLvl - 1;
|
||||
for (n = first; n != null; n = n.getNextSibling())
|
||||
{
|
||||
if (!foundCond && "cond".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
|
||||
Node msg = n.getAttributes().getNamedItem("msg");
|
||||
if ((condition != null) && (msg != null))
|
||||
{
|
||||
condition.setMessage(msg.getNodeValue());
|
||||
}
|
||||
_currentSkill.currentSkills.get(i).attach(condition, false);
|
||||
}
|
||||
else if (!foundFor && "for".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
parseTemplate(n, _currentSkill.currentSkills.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = lastLvl + enchantLevels1 + enchantLevels2 + enchantLevels3 + enchantLevels4 + enchantLevels5 + enchantLevels6; i < (lastLvl + enchantLevels1 + enchantLevels2 + enchantLevels3 + enchantLevels4 + enchantLevels5 + enchantLevels6 + enchantLevels7); i++)
|
||||
{
|
||||
boolean foundCond = false, foundFor = false;
|
||||
_currentSkill.currentLevel = i - lastLvl - enchantLevels1 - enchantLevels2 - enchantLevels3 - enchantLevels4 - enchantLevels5 - enchantLevels6;
|
||||
for (n = first; n != null; n = n.getNextSibling())
|
||||
{
|
||||
if ("enchant7cond".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
foundCond = true;
|
||||
Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
|
||||
Node msg = n.getAttributes().getNamedItem("msg");
|
||||
if ((condition != null) && (msg != null))
|
||||
{
|
||||
condition.setMessage(msg.getNodeValue());
|
||||
}
|
||||
_currentSkill.currentSkills.get(i).attach(condition, false);
|
||||
}
|
||||
else if ("enchant7for".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
foundFor = true;
|
||||
parseTemplate(n, _currentSkill.currentSkills.get(i));
|
||||
}
|
||||
}
|
||||
// If none found, the enchanted skill will take effects from maxLvL of norm skill
|
||||
if (!foundCond || !foundFor)
|
||||
{
|
||||
_currentSkill.currentLevel = lastLvl - 1;
|
||||
for (n = first; n != null; n = n.getNextSibling())
|
||||
{
|
||||
if (!foundCond && "cond".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
|
||||
Node msg = n.getAttributes().getNamedItem("msg");
|
||||
if ((condition != null) && (msg != null))
|
||||
{
|
||||
condition.setMessage(msg.getNodeValue());
|
||||
}
|
||||
_currentSkill.currentSkills.get(i).attach(condition, false);
|
||||
}
|
||||
else if (!foundFor && "for".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
parseTemplate(n, _currentSkill.currentSkills.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = lastLvl + enchantLevels1 + enchantLevels2 + enchantLevels3 + enchantLevels4 + enchantLevels5 + enchantLevels6 + enchantLevels7; i < (lastLvl + enchantLevels1 + enchantLevels2 + enchantLevels3 + enchantLevels4 + enchantLevels5 + enchantLevels6 + enchantLevels7 + enchantLevels8); i++)
|
||||
{
|
||||
boolean foundCond = false, foundFor = false;
|
||||
_currentSkill.currentLevel = i - lastLvl - enchantLevels1 - enchantLevels2 - enchantLevels3 - enchantLevels4 - enchantLevels5 - enchantLevels6 - enchantLevels7;
|
||||
for (n = first; n != null; n = n.getNextSibling())
|
||||
{
|
||||
if ("enchant8cond".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
foundCond = true;
|
||||
Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
|
||||
Node msg = n.getAttributes().getNamedItem("msg");
|
||||
if ((condition != null) && (msg != null))
|
||||
{
|
||||
condition.setMessage(msg.getNodeValue());
|
||||
}
|
||||
_currentSkill.currentSkills.get(i).attach(condition, false);
|
||||
}
|
||||
else if ("enchant8for".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
foundFor = true;
|
||||
parseTemplate(n, _currentSkill.currentSkills.get(i));
|
||||
}
|
||||
}
|
||||
// If none found, the enchanted skill will take effects from maxLvL of norm skill
|
||||
if (!foundCond || !foundFor)
|
||||
{
|
||||
_currentSkill.currentLevel = lastLvl - 1;
|
||||
for (n = first; n != null; n = n.getNextSibling())
|
||||
{
|
||||
if (!foundCond && "cond".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
|
||||
Node msg = n.getAttributes().getNamedItem("msg");
|
||||
if ((condition != null) && (msg != null))
|
||||
{
|
||||
condition.setMessage(msg.getNodeValue());
|
||||
}
|
||||
_currentSkill.currentSkills.get(i).attach(condition, false);
|
||||
}
|
||||
else if (!foundFor && "for".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
parseTemplate(n, _currentSkill.currentSkills.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
_currentSkill.skills.addAll(_currentSkill.currentSkills);
|
||||
}
|
||||
|
||||
private void makeSkills()
|
||||
{
|
||||
int count = 0;
|
||||
_currentSkill.currentSkills = new FastList<>(_currentSkill.sets.length + _currentSkill.enchsets1.length + _currentSkill.enchsets2.length + _currentSkill.enchsets3.length + _currentSkill.enchsets4.length + _currentSkill.enchsets5.length + _currentSkill.enchsets6.length + _currentSkill.enchsets7.length + _currentSkill.enchsets8.length);
|
||||
|
||||
for (int i = 0; i < _currentSkill.sets.length; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
_currentSkill.currentSkills.add(i, _currentSkill.sets[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.sets[i]));
|
||||
count++;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.SEVERE, "Skill id=" + _currentSkill.sets[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.sets[i]).getDisplayId() + "level" + _currentSkill.sets[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.sets[i]).getLevel(), e);
|
||||
}
|
||||
}
|
||||
int _count = count;
|
||||
for (int i = 0; i < _currentSkill.enchsets1.length; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
_currentSkill.currentSkills.add(_count + i, _currentSkill.enchsets1[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.enchsets1[i]));
|
||||
count++;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.SEVERE, "Skill id=" + _currentSkill.enchsets1[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.enchsets1[i]).getDisplayId() + " level=" + _currentSkill.enchsets1[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.enchsets1[i]).getLevel(), e);
|
||||
}
|
||||
}
|
||||
_count = count;
|
||||
for (int i = 0; i < _currentSkill.enchsets2.length; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
_currentSkill.currentSkills.add(_count + i, _currentSkill.enchsets2[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.enchsets2[i]));
|
||||
count++;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.SEVERE, "Skill id=" + _currentSkill.enchsets2[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.enchsets2[i]).getDisplayId() + " level=" + _currentSkill.enchsets2[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.enchsets2[i]).getLevel(), e);
|
||||
}
|
||||
}
|
||||
_count = count;
|
||||
for (int i = 0; i < _currentSkill.enchsets3.length; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
_currentSkill.currentSkills.add(_count + i, _currentSkill.enchsets3[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.enchsets3[i]));
|
||||
count++;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.SEVERE, "Skill id=" + _currentSkill.enchsets3[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.enchsets3[i]).getDisplayId() + " level=" + _currentSkill.enchsets3[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.enchsets3[i]).getLevel(), e);
|
||||
}
|
||||
}
|
||||
_count = count;
|
||||
for (int i = 0; i < _currentSkill.enchsets4.length; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
_currentSkill.currentSkills.add(_count + i, _currentSkill.enchsets4[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.enchsets4[i]));
|
||||
count++;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.SEVERE, "Skill id=" + _currentSkill.enchsets4[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.enchsets4[i]).getDisplayId() + " level=" + _currentSkill.enchsets4[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.enchsets4[i]).getLevel(), e);
|
||||
}
|
||||
}
|
||||
_count = count;
|
||||
for (int i = 0; i < _currentSkill.enchsets5.length; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
_currentSkill.currentSkills.add(_count + i, _currentSkill.enchsets5[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.enchsets5[i]));
|
||||
count++;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.SEVERE, "Skill id=" + _currentSkill.enchsets5[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.enchsets5[i]).getDisplayId() + " level=" + _currentSkill.enchsets5[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.enchsets5[i]).getLevel(), e);
|
||||
}
|
||||
}
|
||||
_count = count;
|
||||
for (int i = 0; i < _currentSkill.enchsets6.length; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
_currentSkill.currentSkills.add(_count + i, _currentSkill.enchsets6[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.enchsets6[i]));
|
||||
count++;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.SEVERE, "Skill id=" + _currentSkill.enchsets6[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.enchsets6[i]).getDisplayId() + " level=" + _currentSkill.enchsets6[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.enchsets6[i]).getLevel(), e);
|
||||
}
|
||||
}
|
||||
_count = count;
|
||||
for (int i = 0; i < _currentSkill.enchsets7.length; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
_currentSkill.currentSkills.add(_count + i, _currentSkill.enchsets7[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.enchsets7[i]));
|
||||
count++;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.SEVERE, "Skill id=" + _currentSkill.enchsets7[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.enchsets7[i]).getDisplayId() + " level=" + _currentSkill.enchsets7[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.enchsets7[i]).getLevel(), e);
|
||||
}
|
||||
}
|
||||
_count = count;
|
||||
for (int i = 0; i < _currentSkill.enchsets8.length; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
_currentSkill.currentSkills.add(_count + i, _currentSkill.enchsets8[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.enchsets8[i]));
|
||||
count++;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.SEVERE, "Skill id=" + _currentSkill.enchsets8[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.enchsets8[i]).getDisplayId() + " level=" + _currentSkill.enchsets8[i].getEnum("skillType", L2SkillType.class).makeSkill(_currentSkill.enchsets8[i]).getLevel(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills;
|
||||
|
||||
import com.l2jserver.gameserver.model.L2Effect;
|
||||
import com.l2jserver.gameserver.model.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.model.L2Skill;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2CubicInstance;
|
||||
|
||||
/**
|
||||
* An Env object is just a class to pass parameters to a calculator such as L2PcInstance, L2ItemInstance, Initial value.
|
||||
*/
|
||||
|
||||
public final class Env
|
||||
{
|
||||
|
||||
public L2Character player;
|
||||
public L2CubicInstance cubic;
|
||||
public L2Character target;
|
||||
public L2ItemInstance item;
|
||||
public L2Skill skill;
|
||||
public L2Effect effect;
|
||||
public double value;
|
||||
public double baseValue;
|
||||
public boolean skillMastery = false;
|
||||
public byte shld = 0;
|
||||
public boolean ss = false;
|
||||
public boolean sps = false;
|
||||
public boolean bss = false;
|
||||
|
||||
public Env()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Env(byte shd, boolean s, boolean ps, boolean bs)
|
||||
{
|
||||
shld = shd;
|
||||
ss = s;
|
||||
sps = ps;
|
||||
bss = bs;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills;
|
||||
|
||||
import com.l2jserver.gameserver.datatables.SkillTable;
|
||||
import com.l2jserver.gameserver.model.L2Skill;
|
||||
|
||||
/**
|
||||
* @author BiggBoss Simple class for storing skill id/level
|
||||
*/
|
||||
public final class SkillHolder
|
||||
{
|
||||
private final int _skillId;
|
||||
private final int _skillLvl;
|
||||
|
||||
public SkillHolder(int skillId, int skillLvl)
|
||||
{
|
||||
_skillId = skillId;
|
||||
_skillLvl = skillLvl;
|
||||
}
|
||||
|
||||
public SkillHolder(L2Skill skill)
|
||||
{
|
||||
_skillId = skill.getId();
|
||||
_skillLvl = skill.getLevel();
|
||||
}
|
||||
|
||||
public final int getSkillId()
|
||||
{
|
||||
return _skillId;
|
||||
}
|
||||
|
||||
public final int getSkillLvl()
|
||||
{
|
||||
return _skillLvl;
|
||||
}
|
||||
|
||||
public final L2Skill getSkill()
|
||||
{
|
||||
return SkillTable.getInstance().getInfo(_skillId, _skillLvl);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills;
|
||||
|
||||
import gnu.trove.TIntObjectHashMap;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javolution.util.FastList;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.datatables.SkillTable;
|
||||
import com.l2jserver.gameserver.model.L2Skill;
|
||||
import com.l2jserver.gameserver.templates.item.L2Item;
|
||||
|
||||
/**
|
||||
* @author mkizub
|
||||
*/
|
||||
public class SkillsEngine
|
||||
{
|
||||
|
||||
protected static final Logger _log = Logger.getLogger(SkillsEngine.class.getName());
|
||||
|
||||
private final List<File> _itemFiles = new FastList<>();
|
||||
private final List<File> _skillFiles = new FastList<>();
|
||||
|
||||
public static SkillsEngine getInstance()
|
||||
{
|
||||
return SingletonHolder._instance;
|
||||
}
|
||||
|
||||
private SkillsEngine()
|
||||
{
|
||||
hashFiles("data/stats/items", _itemFiles);
|
||||
hashFiles("data/stats/skills", _skillFiles);
|
||||
}
|
||||
|
||||
private void hashFiles(String dirname, List<File> hash)
|
||||
{
|
||||
File dir = new File(Config.DATAPACK_ROOT, dirname);
|
||||
if (!dir.exists())
|
||||
{
|
||||
_log.warning("Dir " + dir.getAbsolutePath() + " not exists");
|
||||
return;
|
||||
}
|
||||
File[] files = dir.listFiles();
|
||||
for (File f : files)
|
||||
{
|
||||
if (f.getName().endsWith(".xml") && !f.getName().startsWith("custom"))
|
||||
{
|
||||
hash.add(f);
|
||||
}
|
||||
}
|
||||
File customfile = new File(Config.DATAPACK_ROOT, dirname + "/custom.xml");
|
||||
if (customfile.exists())
|
||||
{
|
||||
hash.add(customfile);
|
||||
}
|
||||
}
|
||||
|
||||
public List<L2Skill> loadSkills(File file)
|
||||
{
|
||||
if (file == null)
|
||||
{
|
||||
_log.warning("Skill file not found.");
|
||||
return null;
|
||||
}
|
||||
DocumentSkill doc = new DocumentSkill(file);
|
||||
doc.parse();
|
||||
return doc.getSkills();
|
||||
}
|
||||
|
||||
public void loadAllSkills(final TIntObjectHashMap<L2Skill> allSkills)
|
||||
{
|
||||
int count = 0;
|
||||
for (File file : _skillFiles)
|
||||
{
|
||||
List<L2Skill> s = loadSkills(file);
|
||||
if (s == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
for (L2Skill skill : s)
|
||||
{
|
||||
allSkills.put(SkillTable.getSkillHashCode(skill), skill);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
_log.info("SkillsEngine: Loaded " + count + " Skill templates from XML files.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Return created items
|
||||
* @return List of {@link L2Item}
|
||||
*/
|
||||
public List<L2Item> loadItems()
|
||||
{
|
||||
List<L2Item> list = new FastList<>();
|
||||
for (File f : _itemFiles)
|
||||
{
|
||||
DocumentItem document = new DocumentItem(f);
|
||||
document.parse();
|
||||
list.addAll(document.getItemList());
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/*
|
||||
* public List<L2Weapon> loadWeapons(Map<Integer, Item> weaponData) { List<L2Weapon> list = new FastList<L2Weapon>(); for (L2Item item : loadData(weaponData, _weaponFiles)) { list.add((L2Weapon) item); } return list; } public List<L2EtcItem> loadItems(Map<Integer, Item> itemData) {
|
||||
* List<L2EtcItem> list = new FastList<L2EtcItem>(); List<Integer> xmlItem = new FastList<Integer>(); for (L2Item item : loadData(itemData, _etcitemFiles)) { list.add((L2EtcItem) item); xmlItem.add(item.getItemId()); } for (Item item : itemData.values()) { if (!xmlItem.contains(item.id))
|
||||
* list.add(new L2EtcItem((L2EtcItemType) item.type, item.set)); } return list; } public List<L2Item> loadData(Map<Integer, ? extends Item> itemData, List<File> files) { List<L2Item> list = new FastList<L2Item>(); for (File f : files) { DocumentItem document = new DocumentItem(itemData, f);
|
||||
* document.parse(); list.addAll(document.getItemList()); } return list; }
|
||||
*/
|
||||
|
||||
@SuppressWarnings("synthetic-access")
|
||||
private static class SingletonHolder
|
||||
{
|
||||
protected static final SkillsEngine _instance = new SkillsEngine();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,276 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills;
|
||||
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
/**
|
||||
* Enum of basic stats.
|
||||
* @author mkizub
|
||||
*/
|
||||
public enum Stats
|
||||
{
|
||||
// Base stats, for each in Calculator a slot is allocated
|
||||
|
||||
// HP & MP
|
||||
MAX_HP("maxHp"),
|
||||
MAX_MP("maxMp"),
|
||||
MAX_CP("maxCp"),
|
||||
REGENERATE_HP_RATE("regHp"),
|
||||
REGENERATE_CP_RATE("regCp"),
|
||||
REGENERATE_MP_RATE("regMp"),
|
||||
RECHARGE_MP_RATE("gainMp"),
|
||||
HEAL_EFFECTIVNESS("gainHp"),
|
||||
HEAL_PROFICIENCY("giveHp"),
|
||||
HEAL_STATIC_BONUS("bonusHp"),
|
||||
LIMIT_HP("limitHp"), // non-displayed hp limit
|
||||
|
||||
// ATTACK & DEFENCE
|
||||
POWER_DEFENCE("pDef"),
|
||||
MAGIC_DEFENCE("mDef"),
|
||||
POWER_ATTACK("pAtk"),
|
||||
MAGIC_ATTACK("mAtk"),
|
||||
PHYSICAL_SKILL_POWER("physicalSkillPower"),
|
||||
POWER_ATTACK_SPEED("pAtkSpd"),
|
||||
MAGIC_ATTACK_SPEED("mAtkSpd"), // how fast a magic spell is casted (including animation)
|
||||
ATK_REUSE("atkReuse"), // make bows hit simple hits way slower and will not affect skills
|
||||
P_REUSE("pReuse"),
|
||||
MAGIC_REUSE_RATE("mReuse"), // how fast a magic spell becomes ready to reuse
|
||||
SHIELD_DEFENCE("sDef"),
|
||||
CRITICAL_DAMAGE("cAtk"),
|
||||
CRITICAL_DAMAGE_ADD("cAtkAdd"), // this is another type for special critical damage mods - vicious stance, crit power and crit damage SA
|
||||
// it was totally bad since now...
|
||||
MAGIC_CRIT_DMG("mCritPower"),
|
||||
|
||||
// PVP BONUS
|
||||
PVP_PHYSICAL_DMG("pvpPhysDmg"),
|
||||
PVP_MAGICAL_DMG("pvpMagicalDmg"),
|
||||
PVP_PHYS_SKILL_DMG("pvpPhysSkillsDmg"),
|
||||
PVP_PHYSICAL_DEF("pvpPhysDef"),
|
||||
PVP_MAGICAL_DEF("pvpMagicalDef"),
|
||||
PVP_PHYS_SKILL_DEF("pvpPhysSkillsDef"),
|
||||
|
||||
// PVE BONUS
|
||||
PVE_PHYSICAL_DMG("pvePhysDmg"),
|
||||
PVE_PHYS_SKILL_DMG("pvePhysSkillsDmg"),
|
||||
PVE_BOW_DMG("pveBowDmg"),
|
||||
PVE_BOW_SKILL_DMG("pveBowSkillsDmg"),
|
||||
PVE_MAGICAL_DMG("pveMagicalDmg"),
|
||||
|
||||
// ATTACK & DEFENCE RATES
|
||||
EVASION_RATE("rEvas"),
|
||||
P_SKILL_EVASION("pSkillEvas"),
|
||||
CRIT_DAMAGE_EVASION("critDamEvas"),
|
||||
SHIELD_RATE("rShld"),
|
||||
CRITICAL_RATE("rCrit"),
|
||||
BLOW_RATE("blowRate"),
|
||||
LETHAL_RATE("lethalRate"),
|
||||
MCRITICAL_RATE("mCritRate"),
|
||||
EXPSP_RATE("rExp"),
|
||||
ATTACK_CANCEL("cancel"),
|
||||
MAGIC_FAILURE_RATE("magicFailureRate"),
|
||||
|
||||
// ACCURACY & RANGE
|
||||
ACCURACY_COMBAT("accCombat"),
|
||||
POWER_ATTACK_RANGE("pAtkRange"),
|
||||
MAGIC_ATTACK_RANGE("mAtkRange"),
|
||||
POWER_ATTACK_ANGLE("pAtkAngle"),
|
||||
ATTACK_COUNT_MAX("atkCountMax"),
|
||||
// Run speed, walk & escape speed are calculated proportionally, magic speed is a buff
|
||||
RUN_SPEED("runSpd"),
|
||||
WALK_SPEED("walkSpd"),
|
||||
|
||||
// BASIC STATS
|
||||
STAT_STR("STR"),
|
||||
STAT_CON("CON"),
|
||||
STAT_DEX("DEX"),
|
||||
STAT_INT("INT"),
|
||||
STAT_WIT("WIT"),
|
||||
STAT_MEN("MEN"),
|
||||
|
||||
// Special stats, share one slot in Calculator
|
||||
|
||||
// VARIOUS
|
||||
BREATH("breath"),
|
||||
FALL("fall"),
|
||||
AGGRESSION("aggression"), // locks a mob on tank caster
|
||||
BLEED("bleed"), // by daggers, like poison
|
||||
POISON("poison"), // by magic, hp dmg over time
|
||||
STUN("stun"), // disable move/ATTACK for a period of time
|
||||
ROOT("root"), // disable movement, but not ATTACK
|
||||
MOVEMENT("movement"), // slowdown movement, debuff
|
||||
CONFUSION("confusion"), // mob changes target, opposite to aggression/hate
|
||||
SLEEP("sleep"), // sleep (don't move/ATTACK) until attacked
|
||||
VALAKAS("valakas"),
|
||||
|
||||
// VULNERABILITIES
|
||||
AGGRESSION_VULN("aggressionVuln"),
|
||||
BLEED_VULN("bleedVuln"),
|
||||
POISON_VULN("poisonVuln"),
|
||||
STUN_VULN("stunVuln"),
|
||||
PARALYZE_VULN("paralyzeVuln"),
|
||||
ROOT_VULN("rootVuln"),
|
||||
SLEEP_VULN("sleepVuln"),
|
||||
DAMAGE_ZONE_VULN("damageZoneVuln"),
|
||||
MOVEMENT_VULN("movementVuln"),
|
||||
CANCEL_VULN("cancelVuln"), // Resistance for cancel type skills
|
||||
DERANGEMENT_VULN("derangementVuln"),
|
||||
DEBUFF_VULN("debuffVuln"),
|
||||
BUFF_VULN("buffVuln"),
|
||||
CRIT_VULN("critVuln"), // Resistence to Crit DMG in percent.
|
||||
CRIT_ADD_VULN("critAddVuln"), // Resistence to Crit DMG in value (ex: +100 will be 100 more crit dmg, NOT 100% more).
|
||||
MAGIC_DAMAGE_VULN("magicDamVul"),
|
||||
|
||||
// RESISTANCES
|
||||
FIRE_RES("fireRes"),
|
||||
WIND_RES("windRes"),
|
||||
WATER_RES("waterRes"),
|
||||
EARTH_RES("earthRes"),
|
||||
HOLY_RES("holyRes"),
|
||||
DARK_RES("darkRes"),
|
||||
VALAKAS_RES("valakasRes"),
|
||||
MAGIC_SUCCESS_RES("magicSuccRes"),
|
||||
// BUFF_IMMUNITY("buffImmunity"), //TODO: Implement me
|
||||
DEBUFF_IMMUNITY("debuffImmunity"),
|
||||
|
||||
// ELEMENT POWER
|
||||
FIRE_POWER("firePower"),
|
||||
WATER_POWER("waterPower"),
|
||||
WIND_POWER("windPower"),
|
||||
EARTH_POWER("earthPower"),
|
||||
HOLY_POWER("holyPower"),
|
||||
DARK_POWER("darkPower"),
|
||||
|
||||
// PROFICIENCY
|
||||
AGGRESSION_PROF("aggressionProf"),
|
||||
BLEED_PROF("bleedProf"),
|
||||
POISON_PROF("poisonProf"),
|
||||
STUN_PROF("stunProf"),
|
||||
PARALYZE_PROF("paralyzeProf"),
|
||||
ROOT_PROF("rootProf"),
|
||||
SLEEP_PROF("sleepProf"),
|
||||
PROF("movementProf"),
|
||||
CANCEL_PROF("cancelProf"),
|
||||
DERANGEMENT_PROF("derangementProf"),
|
||||
DEBUFF_PROF("debuffProf"),
|
||||
CRIT_PROF("critProf"),
|
||||
|
||||
// WEAPONS VULNERABILITIES
|
||||
NONE_WPN_VULN("noneWpnVuln"), // Shields!!!
|
||||
SWORD_WPN_VULN("swordWpnVuln"),
|
||||
BLUNT_WPN_VULN("bluntWpnVuln"),
|
||||
DAGGER_WPN_VULN("daggerWpnVuln"),
|
||||
BOW_WPN_VULN("bowWpnVuln"),
|
||||
CROSSBOW_WPN_VULN("crossbowWpnVuln"),
|
||||
POLE_WPN_VULN("poleWpnVuln"),
|
||||
ETC_WPN_VULN("etcWpnVuln"),
|
||||
FIST_WPN_VULN("fistWpnVuln"),
|
||||
DUAL_WPN_VULN("dualWpnVuln"),
|
||||
DUALFIST_WPN_VULN("dualFistWpnVuln"),
|
||||
BIGSWORD_WPN_VULN("bigSwordWpnVuln"),
|
||||
BIGBLUNT_WPN_VULN("bigBluntWpnVuln"),
|
||||
DUALDAGGER_WPN_VULN("dualDaggerWpnVuln"),
|
||||
RAPIER_WPN_VULN("rapierWpnVuln"),
|
||||
ANCIENT_WPN_VULN("ancientWpnVuln"),
|
||||
PET_WPN_VULN("petWpnVuln"),
|
||||
|
||||
REFLECT_DAMAGE_PERCENT("reflectDam"),
|
||||
REFLECT_SKILL_MAGIC("reflectSkillMagic"),
|
||||
REFLECT_SKILL_PHYSIC("reflectSkillPhysic"),
|
||||
VENGEANCE_SKILL_MAGIC_DAMAGE("vengeanceMdam"),
|
||||
VENGEANCE_SKILL_PHYSICAL_DAMAGE("vengeancePdam"),
|
||||
ABSORB_DAMAGE_PERCENT("absorbDam"),
|
||||
TRANSFER_DAMAGE_PERCENT("transDam"),
|
||||
ABSORB_MANA_DAMAGE_PERCENT("absorbDamMana"),
|
||||
|
||||
MAX_LOAD("maxLoad"),
|
||||
WEIGHT_LIMIT("weightLimit"),
|
||||
|
||||
PATK_PLANTS("pAtk-plants"),
|
||||
PATK_INSECTS("pAtk-insects"),
|
||||
PATK_ANIMALS("pAtk-animals"),
|
||||
PATK_MONSTERS("pAtk-monsters"),
|
||||
PATK_DRAGONS("pAtk-dragons"),
|
||||
PATK_GIANTS("pAtk-giants"),
|
||||
PATK_MCREATURES("pAtk-magicCreature"),
|
||||
|
||||
PDEF_PLANTS("pDef-plants"),
|
||||
PDEF_INSECTS("pDef-insects"),
|
||||
PDEF_ANIMALS("pDef-animals"),
|
||||
PDEF_MONSTERS("pDef-monsters"),
|
||||
PDEF_DRAGONS("pDef-dragons"),
|
||||
PDEF_GIANTS("pDef-giants"),
|
||||
PDEF_MCREATURES("pDef-magicCreature"),
|
||||
|
||||
// ExSkill
|
||||
INV_LIM("inventoryLimit"),
|
||||
WH_LIM("whLimit"),
|
||||
FREIGHT_LIM("FreightLimit"),
|
||||
P_SELL_LIM("PrivateSellLimit"),
|
||||
P_BUY_LIM("PrivateBuyLimit"),
|
||||
REC_D_LIM("DwarfRecipeLimit"),
|
||||
REC_C_LIM("CommonRecipeLimit"),
|
||||
|
||||
// C4 Stats
|
||||
PHYSICAL_MP_CONSUME_RATE("PhysicalMpConsumeRate"),
|
||||
MAGICAL_MP_CONSUME_RATE("MagicalMpConsumeRate"),
|
||||
DANCE_MP_CONSUME_RATE("DanceMpConsumeRate"),
|
||||
BOW_MP_CONSUME_RATE("BowMpConsumeRate"),
|
||||
HP_CONSUME_RATE("HpConsumeRate"),
|
||||
MP_CONSUME("MpConsume"),
|
||||
SOULSHOT_COUNT("soulShotCount"),
|
||||
|
||||
// T1 stats
|
||||
transformId("transformId"),
|
||||
TALISMAN_SLOTS("talisman"),
|
||||
CLOAK_SLOT("cloak"),
|
||||
|
||||
// Shield Stats
|
||||
SHIELD_DEFENCE_ANGLE("shieldDefAngle"),
|
||||
|
||||
// Skill mastery
|
||||
SKILL_MASTERY("skillMastery"),
|
||||
|
||||
// Vitality
|
||||
VITALITY_CONSUME_RATE("vitalityConsumeRate");
|
||||
|
||||
public static final int NUM_STATS = values().length;
|
||||
|
||||
private String _value;
|
||||
|
||||
public String getValue()
|
||||
{
|
||||
return _value;
|
||||
}
|
||||
|
||||
private Stats(String s)
|
||||
{
|
||||
_value = s;
|
||||
}
|
||||
|
||||
public static Stats valueOfXml(String name)
|
||||
{
|
||||
name = name.intern();
|
||||
for (Stats s : values())
|
||||
{
|
||||
if (s.getValue().equals(name))
|
||||
{
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
throw new NoSuchElementException("Unknown name '" + name + "' for enum BaseStats");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class Condition.
|
||||
* @author mkizub
|
||||
*/
|
||||
public abstract class Condition implements ConditionListener
|
||||
{
|
||||
private ConditionListener _listener;
|
||||
private String _msg;
|
||||
private int _msgId;
|
||||
private boolean _addName = false;
|
||||
private boolean _result;
|
||||
|
||||
/**
|
||||
* Sets the message.
|
||||
* @param msg the new message
|
||||
*/
|
||||
public final void setMessage(String msg)
|
||||
{
|
||||
_msg = msg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the message.
|
||||
* @return the message
|
||||
*/
|
||||
public final String getMessage()
|
||||
{
|
||||
return _msg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the message id.
|
||||
* @param msgId the new message id
|
||||
*/
|
||||
public final void setMessageId(int msgId)
|
||||
{
|
||||
_msgId = msgId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the message id.
|
||||
* @return the message id
|
||||
*/
|
||||
public final int getMessageId()
|
||||
{
|
||||
return _msgId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the name.
|
||||
*/
|
||||
public final void addName()
|
||||
{
|
||||
_addName = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is adds the name.
|
||||
* @return true, if is adds the name
|
||||
*/
|
||||
public final boolean isAddName()
|
||||
{
|
||||
return _addName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the listener.
|
||||
* @param listener the new listener
|
||||
*/
|
||||
void setListener(ConditionListener listener)
|
||||
{
|
||||
_listener = listener;
|
||||
notifyChanged();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the listener.
|
||||
* @return the listener
|
||||
*/
|
||||
final ConditionListener getListener()
|
||||
{
|
||||
return _listener;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test.
|
||||
* @param env the env
|
||||
* @return true, if successful
|
||||
*/
|
||||
public final boolean test(Env env)
|
||||
{
|
||||
boolean res = testImpl(env);
|
||||
if ((_listener != null) && (res != _result))
|
||||
{
|
||||
_result = res;
|
||||
notifyChanged();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test impl.
|
||||
* @param env the env
|
||||
* @return true, if successful
|
||||
*/
|
||||
abstract boolean testImpl(Env env);
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.ConditionListener#notifyChanged()
|
||||
*/
|
||||
@Override
|
||||
public void notifyChanged()
|
||||
{
|
||||
if (_listener != null)
|
||||
{
|
||||
_listener.notifyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
import com.l2jserver.gameserver.templates.item.L2Weapon;
|
||||
|
||||
/**
|
||||
* The Class ConditionChangeWeapon.
|
||||
* @author nBd
|
||||
*/
|
||||
public class ConditionChangeWeapon extends Condition
|
||||
{
|
||||
private final boolean _required;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition change weapon.
|
||||
* @param required the required
|
||||
*/
|
||||
public ConditionChangeWeapon(boolean required)
|
||||
{
|
||||
_required = required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test impl.
|
||||
* @param env the env
|
||||
* @return true, if successful
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
boolean testImpl(Env env)
|
||||
{
|
||||
if (!(env.player instanceof L2PcInstance))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_required)
|
||||
{
|
||||
L2Weapon weaponItem = env.player.getActiveWeaponItem();
|
||||
|
||||
if (weaponItem == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (weaponItem.getChangeWeaponId() == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (((L2PcInstance) env.player).isEnchanting())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.model.L2Effect;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
import com.l2jserver.gameserver.skills.effects.EffectFusion;
|
||||
|
||||
/**
|
||||
* The Class ConditionForceBuff.
|
||||
* @author kombat, Forsaiken
|
||||
*/
|
||||
|
||||
public final class ConditionForceBuff extends Condition
|
||||
{
|
||||
private static final short BATTLE_FORCE = 5104;
|
||||
private static final short SPELL_FORCE = 5105;
|
||||
|
||||
private final byte[] _forces;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition force buff.
|
||||
* @param forces the forces
|
||||
*/
|
||||
public ConditionForceBuff(byte[] forces)
|
||||
{
|
||||
_forces = forces;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test impl.
|
||||
* @param env the env
|
||||
* @return true, if successful
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
if (_forces[0] > 0)
|
||||
{
|
||||
L2Effect force = env.player.getFirstEffect(BATTLE_FORCE);
|
||||
if ((force == null) || (((EffectFusion) force)._effect < _forces[0]))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (_forces[1] > 0)
|
||||
{
|
||||
L2Effect force = env.player.getFirstEffect(SPELL_FORCE);
|
||||
if ((force == null) || (((EffectFusion) force)._effect < _forces[1]))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
import com.l2jserver.util.Rnd;
|
||||
|
||||
/**
|
||||
* The Class ConditionGameChance.
|
||||
* @author Advi
|
||||
*/
|
||||
public class ConditionGameChance extends Condition
|
||||
{
|
||||
private final int _chance;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition game chance.
|
||||
* @param chance the chance
|
||||
*/
|
||||
public ConditionGameChance(int chance)
|
||||
{
|
||||
_chance = chance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test impl.
|
||||
* @param env the env
|
||||
* @return true, if successful
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
return Rnd.get(100) < _chance;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.GameTimeController;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionGameTime.
|
||||
* @author mkizub
|
||||
*/
|
||||
public class ConditionGameTime extends Condition
|
||||
{
|
||||
|
||||
/**
|
||||
* The Enum CheckGameTime.
|
||||
*/
|
||||
public enum CheckGameTime
|
||||
{
|
||||
NIGHT
|
||||
}
|
||||
|
||||
private final CheckGameTime _check;
|
||||
private final boolean _required;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition game time.
|
||||
* @param check the check
|
||||
* @param required the required
|
||||
*/
|
||||
public ConditionGameTime(CheckGameTime check, boolean required)
|
||||
{
|
||||
_check = check;
|
||||
_required = required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test impl.
|
||||
* @param env the env
|
||||
* @return true, if successful
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
switch (_check)
|
||||
{
|
||||
case NIGHT:
|
||||
return GameTimeController.getInstance().isNowNight() == _required;
|
||||
}
|
||||
return !_required;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionInventory.
|
||||
* @author mkizub
|
||||
*/
|
||||
public abstract class ConditionInventory extends Condition
|
||||
{
|
||||
|
||||
protected final int _slot;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition inventory.
|
||||
* @param slot the slot
|
||||
*/
|
||||
public ConditionInventory(int slot)
|
||||
{
|
||||
_slot = slot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test impl.
|
||||
* @param env the env
|
||||
* @return true, if successful
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public abstract boolean testImpl(Env env);
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionItemId.
|
||||
* @author mkizub
|
||||
*/
|
||||
public final class ConditionItemId extends Condition
|
||||
{
|
||||
|
||||
private final int _itemId;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition item id.
|
||||
* @param itemId the item id
|
||||
*/
|
||||
public ConditionItemId(int itemId)
|
||||
{
|
||||
_itemId = itemId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test impl.
|
||||
* @param env the env
|
||||
* @return true, if successful
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
if (env.item == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return env.item.getItemId() == _itemId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
/**
|
||||
* The listener interface for receiving condition events. The class that is interested in processing a condition event implements this interface, and the object created with that class is registered with a component using the component's <code>addConditionListener<code> method. When
|
||||
* the condition event occurs, that object's appropriate
|
||||
* method is invoked.
|
||||
* @author mkizub
|
||||
*/
|
||||
public interface ConditionListener
|
||||
{
|
||||
|
||||
/**
|
||||
* Notify changed.
|
||||
*/
|
||||
public void notifyChanged();
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionLogicAnd.
|
||||
* @author mkizub
|
||||
*/
|
||||
public class ConditionLogicAnd extends Condition
|
||||
{
|
||||
|
||||
private static Condition[] _emptyConditions = new Condition[0];
|
||||
public Condition[] conditions = _emptyConditions;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition logic and.
|
||||
*/
|
||||
public ConditionLogicAnd()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the.
|
||||
* @param condition the condition
|
||||
*/
|
||||
public void add(Condition condition)
|
||||
{
|
||||
if (condition == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (getListener() != null)
|
||||
{
|
||||
condition.setListener(this);
|
||||
}
|
||||
final int len = conditions.length;
|
||||
final Condition[] tmp = new Condition[len + 1];
|
||||
System.arraycopy(conditions, 0, tmp, 0, len);
|
||||
tmp[len] = condition;
|
||||
conditions = tmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the listener.
|
||||
* @param listener the new listener
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#setListener(com.l2jserver.gameserver.skills.conditions.ConditionListener)
|
||||
*/
|
||||
@Override
|
||||
void setListener(ConditionListener listener)
|
||||
{
|
||||
if (listener != null)
|
||||
{
|
||||
for (Condition c : conditions)
|
||||
{
|
||||
c.setListener(this);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Condition c : conditions)
|
||||
{
|
||||
c.setListener(null);
|
||||
}
|
||||
}
|
||||
super.setListener(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test impl.
|
||||
* @param env the env
|
||||
* @return true, if successful
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
for (Condition c : conditions)
|
||||
{
|
||||
if (!c.test(env))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionLogicNot.
|
||||
* @author mkizub
|
||||
*/
|
||||
public class ConditionLogicNot extends Condition
|
||||
{
|
||||
|
||||
private final Condition _condition;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition logic not.
|
||||
* @param condition the condition
|
||||
*/
|
||||
public ConditionLogicNot(Condition condition)
|
||||
{
|
||||
_condition = condition;
|
||||
if (getListener() != null)
|
||||
{
|
||||
_condition.setListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the listener.
|
||||
* @param listener the new listener
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#setListener(com.l2jserver.gameserver.skills.conditions.ConditionListener)
|
||||
*/
|
||||
@Override
|
||||
void setListener(ConditionListener listener)
|
||||
{
|
||||
if (listener != null)
|
||||
{
|
||||
_condition.setListener(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
_condition.setListener(null);
|
||||
}
|
||||
super.setListener(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test impl.
|
||||
* @param env the env
|
||||
* @return true, if successful
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
return !_condition.test(env);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionLogicOr.
|
||||
* @author mkizub
|
||||
*/
|
||||
public class ConditionLogicOr extends Condition
|
||||
{
|
||||
|
||||
private static Condition[] _emptyConditions = new Condition[0];
|
||||
public Condition[] conditions = _emptyConditions;
|
||||
|
||||
/**
|
||||
* Adds the.
|
||||
* @param condition the condition
|
||||
*/
|
||||
public void add(Condition condition)
|
||||
{
|
||||
if (condition == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (getListener() != null)
|
||||
{
|
||||
condition.setListener(this);
|
||||
}
|
||||
final int len = conditions.length;
|
||||
final Condition[] tmp = new Condition[len + 1];
|
||||
System.arraycopy(conditions, 0, tmp, 0, len);
|
||||
tmp[len] = condition;
|
||||
conditions = tmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the listener.
|
||||
* @param listener the new listener
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#setListener(com.l2jserver.gameserver.skills.conditions.ConditionListener)
|
||||
*/
|
||||
@Override
|
||||
void setListener(ConditionListener listener)
|
||||
{
|
||||
if (listener != null)
|
||||
{
|
||||
for (Condition c : conditions)
|
||||
{
|
||||
c.setListener(this);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Condition c : conditions)
|
||||
{
|
||||
c.setListener(null);
|
||||
}
|
||||
}
|
||||
super.setListener(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test impl.
|
||||
* @param env the env
|
||||
* @return true, if successful
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
for (Condition c : conditions)
|
||||
{
|
||||
if (c.test(env))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionMinDistance.
|
||||
* @author Didldak
|
||||
*/
|
||||
public class ConditionMinDistance extends Condition
|
||||
{
|
||||
private final int _sqDistance;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition min distance.
|
||||
* @param sqDistance the sq distance
|
||||
*/
|
||||
public ConditionMinDistance(int sqDistance)
|
||||
{
|
||||
_sqDistance = sqDistance;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
if (env.target == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return env.player.getDistanceSq(env.target) >= _sqDistance;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.datatables.PetDataTable;
|
||||
import com.l2jserver.gameserver.model.actor.L2Summon;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PetInstance;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
import com.l2jserver.gameserver.templates.item.L2Item;
|
||||
|
||||
/**
|
||||
* @author JIV
|
||||
*/
|
||||
public class ConditionPetType extends Condition
|
||||
{
|
||||
private final int petType;
|
||||
|
||||
public ConditionPetType(int petType)
|
||||
{
|
||||
this.petType = petType;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
boolean testImpl(Env env)
|
||||
{
|
||||
if (!(env.player instanceof L2PetInstance))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* if ((petType & L2Item.ANY_PET) == L2Item.ANY_PET) return true;
|
||||
*/
|
||||
|
||||
int npcid = ((L2Summon) env.player).getNpcId();
|
||||
|
||||
if (PetDataTable.isHatchling(npcid) && ((petType & L2Item.HATCHLING) == L2Item.HATCHLING))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (PetDataTable.isWolf(npcid) && ((petType & L2Item.WOLF) == L2Item.WOLF))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (PetDataTable.isEvolvedWolf(npcid) && ((petType & L2Item.GROWN_WOLF) == L2Item.GROWN_WOLF))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (PetDataTable.isStrider(npcid) && ((petType & L2Item.STRIDER) == L2Item.STRIDER))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (PetDataTable.isBaby(npcid) && ((petType & L2Item.BABY) == L2Item.BABY))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (PetDataTable.isImprovedBaby(npcid) && ((petType & L2Item.IMPROVED_BABY) == L2Item.IMPROVED_BABY))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.model.L2Effect;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerActiveEffectId.
|
||||
*/
|
||||
public class ConditionPlayerActiveEffectId extends Condition
|
||||
{
|
||||
|
||||
private final int _effectId;
|
||||
private final int _effectLvl;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player active effect id.
|
||||
* @param effectId the effect id
|
||||
*/
|
||||
public ConditionPlayerActiveEffectId(int effectId)
|
||||
{
|
||||
_effectId = effectId;
|
||||
_effectLvl = -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player active effect id.
|
||||
* @param effectId the effect id
|
||||
* @param effectLevel the effect level
|
||||
*/
|
||||
public ConditionPlayerActiveEffectId(int effectId, int effectLevel)
|
||||
{
|
||||
_effectId = effectId;
|
||||
_effectLvl = effectLevel;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
final L2Effect e = env.player.getFirstEffect(_effectId);
|
||||
if ((e != null) && ((_effectLvl == -1) || (_effectLvl <= e.getSkill().getLevel())))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.model.L2Skill;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerActiveSkillId.
|
||||
* @author DrHouse
|
||||
*/
|
||||
public class ConditionPlayerActiveSkillId extends Condition
|
||||
{
|
||||
private final int _skillId;
|
||||
private final int _skillLevel;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player active skill id.
|
||||
* @param skillId the skill id
|
||||
*/
|
||||
public ConditionPlayerActiveSkillId(int skillId)
|
||||
{
|
||||
_skillId = skillId;
|
||||
_skillLevel = -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player active skill id.
|
||||
* @param skillId the skill id
|
||||
* @param skillLevel the skill level
|
||||
*/
|
||||
public ConditionPlayerActiveSkillId(int skillId, int skillLevel)
|
||||
{
|
||||
_skillId = skillId;
|
||||
_skillLevel = skillLevel;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
for (L2Skill sk : env.player.getAllSkills())
|
||||
{
|
||||
if (sk != null)
|
||||
{
|
||||
if (sk.getId() == _skillId)
|
||||
{
|
||||
if ((_skillLevel == -1) || (_skillLevel <= sk.getLevel()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerAgathionId.
|
||||
*/
|
||||
public class ConditionPlayerAgathionId extends Condition
|
||||
{
|
||||
private final int _agathionId;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player agathion id.
|
||||
* @param agathionId the agathion id
|
||||
*/
|
||||
public ConditionPlayerAgathionId(int agathionId)
|
||||
{
|
||||
_agathionId = agathionId;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
return ((L2PcInstance) env.player).getAgathionId() == _agathionId;
|
||||
}
|
||||
}
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerBaseStats.
|
||||
* @author mkizub
|
||||
*/
|
||||
public class ConditionPlayerBaseStats extends Condition
|
||||
{
|
||||
|
||||
private final BaseStat _stat;
|
||||
private final int _value;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player base stats.
|
||||
* @param player the player
|
||||
* @param stat the stat
|
||||
* @param value the value
|
||||
*/
|
||||
public ConditionPlayerBaseStats(L2Character player, BaseStat stat, int value)
|
||||
{
|
||||
super();
|
||||
_stat = stat;
|
||||
_value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test impl.
|
||||
* @param env the env
|
||||
* @return true, if successful
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
if (!(env.player instanceof L2PcInstance))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
L2PcInstance player = (L2PcInstance) env.player;
|
||||
switch (_stat)
|
||||
{
|
||||
case Int:
|
||||
return player.getINT() >= _value;
|
||||
case Str:
|
||||
return player.getSTR() >= _value;
|
||||
case Con:
|
||||
return player.getCON() >= _value;
|
||||
case Dex:
|
||||
return player.getDEX() >= _value;
|
||||
case Men:
|
||||
return player.getMEN() >= _value;
|
||||
case Wit:
|
||||
return player.getWIT() >= _value;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
enum BaseStat
|
||||
{
|
||||
Int,
|
||||
Str,
|
||||
Con,
|
||||
Dex,
|
||||
Men,
|
||||
Wit
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerCharges.
|
||||
*/
|
||||
public class ConditionPlayerCharges extends Condition
|
||||
{
|
||||
|
||||
private final int _charges;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player charges.
|
||||
* @param charges the charges
|
||||
*/
|
||||
public ConditionPlayerCharges(int charges)
|
||||
{
|
||||
_charges = charges;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
return ((L2PcInstance) env.player).getCharges() >= _charges;
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerClassIdRestriction.
|
||||
*/
|
||||
public class ConditionPlayerClassIdRestriction extends Condition
|
||||
{
|
||||
private final ArrayList<Integer> _classIds;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player class id restriction.
|
||||
* @param classId the class id
|
||||
*/
|
||||
public ConditionPlayerClassIdRestriction(ArrayList<Integer> classId)
|
||||
{
|
||||
_classIds = classId;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
if (!(env.player instanceof L2PcInstance))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return (_classIds.contains(((L2PcInstance) env.player).getClassId().getId()));
|
||||
}
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerCloakStatus.
|
||||
*/
|
||||
public class ConditionPlayerCloakStatus extends Condition
|
||||
{
|
||||
private final int _val;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player cloak status.
|
||||
* @param val the val
|
||||
*/
|
||||
public ConditionPlayerCloakStatus(int val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
if (!(env.player instanceof L2PcInstance))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return ((L2PcInstance) env.player).getInventory().getCloakStatus() >= _val;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerCp.
|
||||
*/
|
||||
public class ConditionPlayerCp extends Condition
|
||||
{
|
||||
|
||||
private final int _cp;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player cp.
|
||||
* @param cp the cp
|
||||
*/
|
||||
public ConditionPlayerCp(int cp)
|
||||
{
|
||||
_cp = cp;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
return ((env.player.getCurrentCp() * 100) / env.player.getMaxCp()) >= _cp;
|
||||
}
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerFlyMounted.
|
||||
* @author kerberos
|
||||
*/
|
||||
public class ConditionPlayerFlyMounted extends Condition
|
||||
{
|
||||
|
||||
private final boolean _val;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player fly mounted.
|
||||
* @param val the val
|
||||
*/
|
||||
public ConditionPlayerFlyMounted(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
return (env.player instanceof L2PcInstance) ? ((L2PcInstance) env.player).isFlyingMounted() == _val : true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerGrade.
|
||||
* @author Gigiikun
|
||||
*/
|
||||
public final class ConditionPlayerGrade extends Condition
|
||||
{
|
||||
protected static final Logger _log = Logger.getLogger(ConditionPlayerGrade.class.getName());
|
||||
// conditional values
|
||||
public final static int COND_NO_GRADE = 0x0001;
|
||||
public final static int COND_D_GRADE = 0x0002;
|
||||
public final static int COND_C_GRADE = 0x0004;
|
||||
public final static int COND_B_GRADE = 0x0008;
|
||||
public final static int COND_A_GRADE = 0x0010;
|
||||
public final static int COND_S_GRADE = 0x0020;
|
||||
public final static int COND_S80_GRADE = 0x0040;
|
||||
public final static int COND_S84_GRADE = 0x0080;
|
||||
|
||||
private final int _value;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player grade.
|
||||
* @param value the value
|
||||
*/
|
||||
public ConditionPlayerGrade(int value)
|
||||
{
|
||||
_value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
if (env.player instanceof L2PcInstance)
|
||||
{
|
||||
final byte expIndex = (byte) ((L2PcInstance) env.player).getExpertiseLevel();
|
||||
|
||||
return _value == expIndex;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.model.L2Clan;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerHasCastle.
|
||||
* @author MrPoke
|
||||
*/
|
||||
public final class ConditionPlayerHasCastle extends Condition
|
||||
{
|
||||
|
||||
private final int _castle;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player has castle.
|
||||
* @param castle the castle
|
||||
*/
|
||||
public ConditionPlayerHasCastle(int castle)
|
||||
{
|
||||
_castle = castle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test impl.
|
||||
* @param env the env
|
||||
* @return true, if successful
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
if (!(env.player instanceof L2PcInstance))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
L2Clan clan = ((L2PcInstance) env.player).getClan();
|
||||
if (clan == null)
|
||||
{
|
||||
return _castle == 0;
|
||||
}
|
||||
|
||||
// Any castle
|
||||
if (_castle == -1)
|
||||
{
|
||||
return clan.getHasCastle() > 0;
|
||||
}
|
||||
|
||||
return clan.getHasCastle() == _castle;
|
||||
}
|
||||
}
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.l2jserver.gameserver.model.L2Clan;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerHasClanHall.
|
||||
* @author MrPoke
|
||||
*/
|
||||
public final class ConditionPlayerHasClanHall extends Condition
|
||||
{
|
||||
private final ArrayList<Integer> _clanHall;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player has clan hall.
|
||||
* @param clanHall the clan hall
|
||||
*/
|
||||
public ConditionPlayerHasClanHall(ArrayList<Integer> clanHall)
|
||||
{
|
||||
_clanHall = clanHall;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test impl.
|
||||
* @param env the env
|
||||
* @return true, if successful
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
if (!(env.player instanceof L2PcInstance))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
L2Clan clan = ((L2PcInstance) env.player).getClan();
|
||||
if (clan == null)
|
||||
{
|
||||
return ((_clanHall.size() == 1) && (_clanHall.get(0) == 0));
|
||||
}
|
||||
|
||||
// All Clan Hall
|
||||
if ((_clanHall.size() == 1) && (_clanHall.get(0) == -1))
|
||||
{
|
||||
return clan.getHasHideout() > 0;
|
||||
}
|
||||
|
||||
return _clanHall.contains(clan.getHasHideout());
|
||||
}
|
||||
}
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.model.L2Clan;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerHasFort.
|
||||
* @author MrPoke
|
||||
*/
|
||||
public final class ConditionPlayerHasFort extends Condition
|
||||
{
|
||||
|
||||
private final int _fort;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player has fort.
|
||||
* @param fort the fort
|
||||
*/
|
||||
public ConditionPlayerHasFort(int fort)
|
||||
{
|
||||
_fort = fort;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test impl.
|
||||
* @param env the env
|
||||
* @return true, if successful
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
if (!(env.player instanceof L2PcInstance))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
L2Clan clan = ((L2PcInstance) env.player).getClan();
|
||||
if (clan == null)
|
||||
{
|
||||
return _fort == 0;
|
||||
}
|
||||
|
||||
// Any fortress
|
||||
if (_fort == -1)
|
||||
{
|
||||
return clan.getHasFort() > 0;
|
||||
}
|
||||
|
||||
return clan.getHasFort() == _fort;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.l2jserver.gameserver.model.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PetInstance;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerHasPet.
|
||||
*/
|
||||
public class ConditionPlayerHasPet extends Condition
|
||||
{
|
||||
private final ArrayList<Integer> _controlItemIds;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player has pet.
|
||||
* @param itemIds the item ids
|
||||
*/
|
||||
public ConditionPlayerHasPet(ArrayList<Integer> itemIds)
|
||||
{
|
||||
if ((itemIds.size() == 1) && (itemIds.get(0) == 0))
|
||||
{
|
||||
_controlItemIds = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
_controlItemIds = itemIds;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
if (!(env.player instanceof L2PcInstance))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(env.player.getPet() instanceof L2PetInstance))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_controlItemIds == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
final L2ItemInstance controlItem = ((L2PetInstance) env.player.getPet()).getControlItem();
|
||||
if (controlItem == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return _controlItemIds.contains(controlItem.getItemId());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerHp.
|
||||
* @author mr
|
||||
*/
|
||||
public class ConditionPlayerHp extends Condition
|
||||
{
|
||||
private final int _hp;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player hp.
|
||||
* @param hp the hp
|
||||
*/
|
||||
public ConditionPlayerHp(int hp)
|
||||
{
|
||||
_hp = hp;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
return ((env.player.getCurrentHp() * 100) / env.player.getMaxVisibleHp()) <= _hp;
|
||||
}
|
||||
}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.l2jserver.gameserver.instancemanager.InstanceManager;
|
||||
import com.l2jserver.gameserver.instancemanager.InstanceManager.InstanceWorld;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerInstanceId.
|
||||
*/
|
||||
public class ConditionPlayerInstanceId extends Condition
|
||||
{
|
||||
private final ArrayList<Integer> _instanceIds;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player instance id.
|
||||
* @param instanceIds the instance ids
|
||||
*/
|
||||
public ConditionPlayerInstanceId(ArrayList<Integer> instanceIds)
|
||||
{
|
||||
_instanceIds = instanceIds;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
if (!(env.player instanceof L2PcInstance))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final int instanceId = env.player.getInstanceId();
|
||||
if (instanceId <= 0)
|
||||
{
|
||||
return false; // player not in instance
|
||||
}
|
||||
|
||||
final InstanceWorld world = InstanceManager.getInstance().getPlayerWorld((L2PcInstance) env.player);
|
||||
if ((world == null) || (world.instanceId != instanceId))
|
||||
{
|
||||
return false; // player in the different instance
|
||||
}
|
||||
|
||||
return _instanceIds.contains(world.templateId);
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerInvSize.
|
||||
* @author Kerberos
|
||||
*/
|
||||
public class ConditionPlayerInvSize extends Condition
|
||||
{
|
||||
|
||||
private final int _size;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player inv size.
|
||||
* @param size the size
|
||||
*/
|
||||
public ConditionPlayerInvSize(int size)
|
||||
{
|
||||
_size = size;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
if (env.player instanceof L2PcInstance)
|
||||
{
|
||||
return ((L2PcInstance) env.player).getInventory().getSize(false) <= (((L2PcInstance) env.player).getInventoryLimit() - _size);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerIsClanLeader.
|
||||
*/
|
||||
public class ConditionPlayerIsClanLeader extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player is clan leader.
|
||||
* @param val the val
|
||||
*/
|
||||
public ConditionPlayerIsClanLeader(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
if (!(env.player instanceof L2PcInstance))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return (((L2PcInstance) env.player).isClanLeader() == _val);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerIsHero.
|
||||
*/
|
||||
public class ConditionPlayerIsHero extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player is hero.
|
||||
* @param val the val
|
||||
*/
|
||||
public ConditionPlayerIsHero(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
if (!(env.player instanceof L2PcInstance))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return (((L2PcInstance) env.player).isHero() == _val);
|
||||
}
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerLandingZone.
|
||||
* @author kerberos
|
||||
*/
|
||||
public class ConditionPlayerLandingZone extends Condition
|
||||
{
|
||||
|
||||
private final boolean _val;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player landing zone.
|
||||
* @param val the val
|
||||
*/
|
||||
public ConditionPlayerLandingZone(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
return env.player.isInsideZone(L2Character.ZONE_LANDING) == _val;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerLevel.
|
||||
* @author mkizub
|
||||
*/
|
||||
public class ConditionPlayerLevel extends Condition
|
||||
{
|
||||
private final int _level;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player level.
|
||||
* @param level the level
|
||||
*/
|
||||
public ConditionPlayerLevel(int level)
|
||||
{
|
||||
_level = level;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
return env.player.getLevel() >= _level;
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* @author Zoey76
|
||||
*/
|
||||
public class ConditionPlayerLevelRange extends Condition
|
||||
{
|
||||
private final int[] _levels;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player levels range.
|
||||
* @param the {@code levels} range.
|
||||
*/
|
||||
public ConditionPlayerLevelRange(int[] levels)
|
||||
{
|
||||
_levels = levels;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
return ((env.player.getLevel() >= _levels[0]) && (env.player.getLevel() <= _levels[1]));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerMp.
|
||||
*/
|
||||
public class ConditionPlayerMp extends Condition
|
||||
{
|
||||
|
||||
private final int _mp;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player mp.
|
||||
* @param mp the mp
|
||||
*/
|
||||
public ConditionPlayerMp(int mp)
|
||||
{
|
||||
_mp = mp;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
return ((env.player.getCurrentMp() * 100) / env.player.getMaxMp()) <= _mp;
|
||||
}
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerPkCount.
|
||||
*/
|
||||
public class ConditionPlayerPkCount extends Condition
|
||||
{
|
||||
public final int _pk;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player pk count.
|
||||
* @param pk the pk
|
||||
*/
|
||||
public ConditionPlayerPkCount(int pk)
|
||||
{
|
||||
_pk = pk;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
if (!(env.player instanceof L2PcInstance))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return ((L2PcInstance) env.player).getPkKills() <= _pk;
|
||||
}
|
||||
}
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerPledgeClass.
|
||||
* @author MrPoke
|
||||
*/
|
||||
public final class ConditionPlayerPledgeClass extends Condition
|
||||
{
|
||||
|
||||
private final int _pledgeClass;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player pledge class.
|
||||
* @param pledgeClass the pledge class
|
||||
*/
|
||||
public ConditionPlayerPledgeClass(int pledgeClass)
|
||||
{
|
||||
_pledgeClass = pledgeClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test impl.
|
||||
* @param env the env
|
||||
* @return true, if successful
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
if (!(env.player instanceof L2PcInstance))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (((L2PcInstance) env.player).getClan() == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_pledgeClass == -1)
|
||||
{
|
||||
return ((L2PcInstance) env.player).isClanLeader();
|
||||
}
|
||||
|
||||
return (((L2PcInstance) env.player).getPledgeClass() >= _pledgeClass);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.base.Race;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
import com.l2jserver.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerRace.
|
||||
* @author mkizub, Zoey76
|
||||
*/
|
||||
public class ConditionPlayerRace extends Condition
|
||||
{
|
||||
private final Race[] _races;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player race.
|
||||
* @param races the list containing the allowed races.
|
||||
*/
|
||||
public ConditionPlayerRace(Race[] races)
|
||||
{
|
||||
_races = races;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
if (!(env.player instanceof L2PcInstance))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return Util.contains(_races, env.player.getActingPlayer().getRace());
|
||||
}
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.actor.L2Npc;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class ConditionPlayerRangeFromNpc extends Condition
|
||||
{
|
||||
private final int _npcId;
|
||||
private final int _radius;
|
||||
|
||||
public ConditionPlayerRangeFromNpc(int npcId, int radius)
|
||||
{
|
||||
_npcId = npcId;
|
||||
_radius = radius;
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean testImpl(Env env)
|
||||
{
|
||||
if ((_npcId == 0) || (_radius == 0))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (L2Character target : env.player.getKnownList().getKnownCharactersInRadius(_radius))
|
||||
{
|
||||
if (target instanceof L2Npc)
|
||||
{
|
||||
if (((L2Npc) target).getNpcId() == _npcId)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerServitorNpcId.
|
||||
*/
|
||||
public class ConditionPlayerServitorNpcId extends Condition
|
||||
{
|
||||
private final ArrayList<Integer> _npcIds;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player servitor npc id.
|
||||
* @param npcIds the npc ids
|
||||
*/
|
||||
public ConditionPlayerServitorNpcId(ArrayList<Integer> npcIds)
|
||||
{
|
||||
if ((npcIds.size() == 1) && (npcIds.get(0) == 0))
|
||||
{
|
||||
_npcIds = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
_npcIds = npcIds;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
if (!(env.player instanceof L2PcInstance))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((env.player.getPet() == null))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return (_npcIds == null) || _npcIds.contains(env.player.getPet().getNpcId());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerSex.
|
||||
*/
|
||||
public class ConditionPlayerSex extends Condition
|
||||
{
|
||||
// male 0 fmale 1
|
||||
private final int _sex;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player sex.
|
||||
* @param sex the sex
|
||||
*/
|
||||
public ConditionPlayerSex(int sex)
|
||||
{
|
||||
_sex = sex;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
return (((L2PcInstance) env.player).getAppearance().getSex() ? 1 : 0) == _sex;
|
||||
}
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerSiegeSide.
|
||||
*/
|
||||
public class ConditionPlayerSiegeSide extends Condition
|
||||
{
|
||||
|
||||
private final int _siegeSide;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player siege side.
|
||||
* @param side the side
|
||||
*/
|
||||
public ConditionPlayerSiegeSide(int side)
|
||||
{
|
||||
_siegeSide = side;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
return ((L2PcInstance) env.player).getSiegeSide() == _siegeSide;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerSouls.
|
||||
*/
|
||||
public class ConditionPlayerSouls extends Condition
|
||||
{
|
||||
|
||||
private final int _souls;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player souls.
|
||||
* @param souls the souls
|
||||
*/
|
||||
public ConditionPlayerSouls(int souls)
|
||||
{
|
||||
_souls = souls;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
return ((L2PcInstance) env.player).getSouls() >= _souls;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.base.PlayerState;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerState.
|
||||
* @author mkizub
|
||||
*/
|
||||
public class ConditionPlayerState extends Condition
|
||||
{
|
||||
private final PlayerState _check;
|
||||
private final boolean _required;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player state.
|
||||
* @param check the player state to be verified.
|
||||
* @param required the required value.
|
||||
*/
|
||||
public ConditionPlayerState(PlayerState check, boolean required)
|
||||
{
|
||||
_check = check;
|
||||
_required = required;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
final L2Character character = env.player;
|
||||
L2PcInstance player = null;
|
||||
switch (_check)
|
||||
{
|
||||
case RESTING:
|
||||
player = character.getActingPlayer();
|
||||
if (player != null)
|
||||
{
|
||||
return (player.isSitting() == _required);
|
||||
}
|
||||
return !_required;
|
||||
case MOVING:
|
||||
return character.isMoving() == _required;
|
||||
case RUNNING:
|
||||
return character.isRunning() == _required;
|
||||
case STANDING:
|
||||
player = character.getActingPlayer();
|
||||
if (player != null)
|
||||
{
|
||||
return (_required != (player.isSitting() || player.isMoving()));
|
||||
}
|
||||
return (_required != character.isMoving());
|
||||
case FLYING:
|
||||
return (character.isFlying() == _required);
|
||||
case BEHIND:
|
||||
return (character.isBehindTarget() == _required);
|
||||
case FRONT:
|
||||
return (character.isInFrontOfTarget() == _required);
|
||||
case CHAOTIC:
|
||||
player = character.getActingPlayer();
|
||||
if (player != null)
|
||||
{
|
||||
return ((player.getKarma() > 0) == _required);
|
||||
}
|
||||
return !_required;
|
||||
case OLYMPIAD:
|
||||
player = character.getActingPlayer();
|
||||
if (player != null)
|
||||
{
|
||||
return (player.isInOlympiadMode() == _required);
|
||||
}
|
||||
return !_required;
|
||||
}
|
||||
return !_required;
|
||||
}
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerSubclass.
|
||||
*/
|
||||
public class ConditionPlayerSubclass extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player subclass.
|
||||
* @param val the val
|
||||
*/
|
||||
public ConditionPlayerSubclass(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
return (env.player instanceof L2PcInstance) ? ((L2PcInstance) env.player).isSubClassActive() == _val : true;
|
||||
}
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.entity.TvTEvent;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerTvTEvent.
|
||||
*/
|
||||
public class ConditionPlayerTvTEvent extends Condition
|
||||
{
|
||||
private final boolean _val;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player tv t event.
|
||||
* @param val the val
|
||||
*/
|
||||
public ConditionPlayerTvTEvent(boolean val)
|
||||
{
|
||||
_val = val;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
final L2PcInstance player = env.player.getActingPlayer();
|
||||
if ((player == null) || !TvTEvent.isStarted())
|
||||
{
|
||||
return !_val;
|
||||
}
|
||||
|
||||
return (TvTEvent.isPlayerParticipant(player.getObjectId()) == _val);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
import com.l2jserver.gameserver.skills.Stats;
|
||||
|
||||
/**
|
||||
* The Class ConditionPlayerWeight.
|
||||
* @author Kerberos
|
||||
*/
|
||||
public class ConditionPlayerWeight extends Condition
|
||||
{
|
||||
|
||||
private final int _weight;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player weight.
|
||||
* @param weight the weight
|
||||
*/
|
||||
public ConditionPlayerWeight(int weight)
|
||||
{
|
||||
_weight = weight;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
if (env.player instanceof L2PcInstance)
|
||||
{
|
||||
if (((L2PcInstance) env.player).getMaxLoad() > 0)
|
||||
{
|
||||
int weightproc = (((L2PcInstance) env.player).getCurrentLoad() * 100) / ((L2PcInstance) env.player).getMaxLoad();
|
||||
weightproc *= (int) ((L2PcInstance) env.player).calcStat(Stats.WEIGHT_LIMIT, 1, env.player, null);
|
||||
return (weightproc < _weight) || ((L2PcInstance) env.player).getDietMode();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.instancemanager.CastleManager;
|
||||
import com.l2jserver.gameserver.instancemanager.FortManager;
|
||||
import com.l2jserver.gameserver.instancemanager.TerritoryWarManager;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.entity.Castle;
|
||||
import com.l2jserver.gameserver.model.entity.Fort;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionSiegeZone.
|
||||
* @author Gigiikun
|
||||
*/
|
||||
|
||||
public final class ConditionSiegeZone extends Condition
|
||||
{
|
||||
// conditional values
|
||||
public final static int COND_NOT_ZONE = 0x0001;
|
||||
public final static int COND_CAST_ATTACK = 0x0002;
|
||||
public final static int COND_CAST_DEFEND = 0x0004;
|
||||
public final static int COND_CAST_NEUTRAL = 0x0008;
|
||||
public final static int COND_FORT_ATTACK = 0x0010;
|
||||
public final static int COND_FORT_DEFEND = 0x0020;
|
||||
public final static int COND_FORT_NEUTRAL = 0x0040;
|
||||
public final static int COND_TW_CHANNEL = 0x0080;
|
||||
public final static int COND_TW_PROGRESS = 0x0100;
|
||||
|
||||
private final int _value;
|
||||
private final boolean _self;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition siege zone.
|
||||
* @param value the value
|
||||
* @param self the self
|
||||
*/
|
||||
|
||||
public ConditionSiegeZone(int value, boolean self)
|
||||
{
|
||||
_value = value;
|
||||
_self = self;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
L2Character target = _self ? env.player : env.target;
|
||||
Castle castle = CastleManager.getInstance().getCastle(target);
|
||||
Fort fort = FortManager.getInstance().getFort(target);
|
||||
|
||||
if (((_value & COND_TW_PROGRESS) != 0) && !TerritoryWarManager.getInstance().isTWInProgress())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (((_value & COND_TW_CHANNEL) != 0) && !TerritoryWarManager.getInstance().isTWChannelOpen())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if ((castle == null) && (fort == null))
|
||||
{
|
||||
if ((_value & COND_NOT_ZONE) != 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (castle != null)
|
||||
{
|
||||
return checkIfOk(target, castle, _value);
|
||||
}
|
||||
return checkIfOk(target, fort, _value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if ok.
|
||||
* @param activeChar the active char
|
||||
* @param castle the castle
|
||||
* @param value the value
|
||||
* @return true, if successful
|
||||
*/
|
||||
public static boolean checkIfOk(L2Character activeChar, Castle castle, int value)
|
||||
{
|
||||
if ((activeChar == null) || !(activeChar instanceof L2PcInstance))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
L2PcInstance player = (L2PcInstance) activeChar;
|
||||
|
||||
if (((castle == null) || (castle.getCastleId() <= 0)))
|
||||
{
|
||||
if ((value & COND_NOT_ZONE) != 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (!castle.getZone().isActive())
|
||||
{
|
||||
if ((value & COND_NOT_ZONE) != 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (((value & COND_CAST_ATTACK) != 0) && player.isRegisteredOnThisSiegeField(castle.getCastleId()) && (player.getSiegeState() == 1))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (((value & COND_CAST_DEFEND) != 0) && player.isRegisteredOnThisSiegeField(castle.getCastleId()) && (player.getSiegeState() == 2))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (((value & COND_CAST_NEUTRAL) != 0) && (player.getSiegeState() == 0))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if ok.
|
||||
* @param activeChar the active char
|
||||
* @param fort the fort
|
||||
* @param value the value
|
||||
* @return true, if successful
|
||||
*/
|
||||
public static boolean checkIfOk(L2Character activeChar, Fort fort, int value)
|
||||
{
|
||||
if ((activeChar == null) || !(activeChar instanceof L2PcInstance))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
L2PcInstance player = (L2PcInstance) activeChar;
|
||||
|
||||
if (((fort == null) || (fort.getFortId() <= 0)))
|
||||
{
|
||||
if ((value & COND_NOT_ZONE) != 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (!fort.getZone().isActive())
|
||||
{
|
||||
if ((value & COND_NOT_ZONE) != 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (((value & COND_FORT_ATTACK) != 0) && player.isRegisteredOnThisSiegeField(fort.getFortId()) && (player.getSiegeState() == 1))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (((value & COND_FORT_DEFEND) != 0) && player.isRegisteredOnThisSiegeField(fort.getFortId()) && (player.getSiegeState() == 2))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (((value & COND_FORT_NEUTRAL) != 0) && (player.getSiegeState() == 0))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
import com.l2jserver.gameserver.skills.Stats;
|
||||
|
||||
/**
|
||||
* The Class ConditionSkillStats.
|
||||
* @author mkizub
|
||||
*/
|
||||
public class ConditionSkillStats extends Condition
|
||||
{
|
||||
|
||||
private final Stats _stat;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition skill stats.
|
||||
* @param stat the stat
|
||||
*/
|
||||
public ConditionSkillStats(Stats stat)
|
||||
{
|
||||
super();
|
||||
_stat = stat;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
if (env.skill == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return env.skill.getStat() == _stat;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.model.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.itemcontainer.Inventory;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionSlotItemId.
|
||||
* @author mkizub
|
||||
*/
|
||||
public final class ConditionSlotItemId extends ConditionInventory
|
||||
{
|
||||
|
||||
private final int _itemId;
|
||||
private final int _enchantLevel;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition slot item id.
|
||||
* @param slot the slot
|
||||
* @param itemId the item id
|
||||
* @param enchantLevel the enchant level
|
||||
*/
|
||||
public ConditionSlotItemId(int slot, int itemId, int enchantLevel)
|
||||
{
|
||||
super(slot);
|
||||
_itemId = itemId;
|
||||
_enchantLevel = enchantLevel;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.ConditionInventory#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
if (!(env.player instanceof L2PcInstance))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
Inventory inv = ((L2PcInstance) env.player).getInventory();
|
||||
L2ItemInstance item = inv.getPaperdollItem(_slot);
|
||||
if (item == null)
|
||||
{
|
||||
return _itemId == 0;
|
||||
}
|
||||
return (item.getItemId() == _itemId) && (item.getEnchantLevel() >= _enchantLevel);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.model.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.itemcontainer.Inventory;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionSlotItemType.
|
||||
* @author mkizub
|
||||
*/
|
||||
public final class ConditionSlotItemType extends ConditionInventory
|
||||
{
|
||||
|
||||
private final int _mask;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition slot item type.
|
||||
* @param slot the slot
|
||||
* @param mask the mask
|
||||
*/
|
||||
public ConditionSlotItemType(int slot, int mask)
|
||||
{
|
||||
super(slot);
|
||||
_mask = mask;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.ConditionInventory#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
if (!(env.player instanceof L2PcInstance))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
Inventory inv = ((L2PcInstance) env.player).getInventory();
|
||||
L2ItemInstance item = inv.getPaperdollItem(_slot);
|
||||
if (item == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return (item.getItem().getItemMask() & _mask) != 0;
|
||||
}
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionTargetAbnormal.
|
||||
* @author janiii
|
||||
*/
|
||||
public class ConditionTargetAbnormal extends Condition
|
||||
{
|
||||
private final int _abnormalId;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition target abnormal.
|
||||
* @param abnormalId the abnormal id
|
||||
*/
|
||||
public ConditionTargetAbnormal(int abnormalId)
|
||||
{
|
||||
_abnormalId = abnormalId;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
boolean testImpl(Env env)
|
||||
{
|
||||
return (env.target.getAbnormalEffect() & _abnormalId) != 0;
|
||||
}
|
||||
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.model.L2Effect;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionTargetActiveEffectId.
|
||||
*/
|
||||
public class ConditionTargetActiveEffectId extends Condition
|
||||
{
|
||||
|
||||
private final int _effectId;
|
||||
private final int _effectLvl;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition target active effect id.
|
||||
* @param effectId the effect id
|
||||
*/
|
||||
public ConditionTargetActiveEffectId(int effectId)
|
||||
{
|
||||
_effectId = effectId;
|
||||
_effectLvl = -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new condition target active effect id.
|
||||
* @param effectId the effect id
|
||||
* @param effectLevel the effect level
|
||||
*/
|
||||
public ConditionTargetActiveEffectId(int effectId, int effectLevel)
|
||||
{
|
||||
_effectId = effectId;
|
||||
_effectLvl = effectLevel;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
final L2Effect e = env.target.getFirstEffect(_effectId);
|
||||
if ((e != null) && ((_effectLvl == -1) || (_effectLvl <= e.getSkill().getLevel())))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.model.L2Skill;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionTargetActiveSkillId.
|
||||
*/
|
||||
public class ConditionTargetActiveSkillId extends Condition
|
||||
{
|
||||
|
||||
private final int _skillId;
|
||||
private final int _skillLevel;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition target active skill id.
|
||||
* @param skillId the skill id
|
||||
*/
|
||||
public ConditionTargetActiveSkillId(int skillId)
|
||||
{
|
||||
_skillId = skillId;
|
||||
_skillLevel = -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new condition target active skill id.
|
||||
* @param skillId the skill id
|
||||
* @param skillLevel the skill level
|
||||
*/
|
||||
public ConditionTargetActiveSkillId(int skillId, int skillLevel)
|
||||
{
|
||||
_skillId = skillId;
|
||||
_skillLevel = skillLevel;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
for (L2Skill sk : env.target.getAllSkills())
|
||||
{
|
||||
if (sk != null)
|
||||
{
|
||||
if (sk.getId() == _skillId)
|
||||
{
|
||||
if ((_skillLevel == -1) || (_skillLevel <= sk.getLevel()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2MonsterInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionTargetAggro.
|
||||
* @author mkizub
|
||||
*/
|
||||
public class ConditionTargetAggro extends Condition
|
||||
{
|
||||
|
||||
private final boolean _isAggro;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition target aggro.
|
||||
* @param isAggro the is aggro
|
||||
*/
|
||||
public ConditionTargetAggro(boolean isAggro)
|
||||
{
|
||||
_isAggro = isAggro;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
L2Character target = env.target;
|
||||
if (target instanceof L2MonsterInstance)
|
||||
{
|
||||
return ((L2MonsterInstance) target).isAggressive() == _isAggro;
|
||||
}
|
||||
if (target instanceof L2PcInstance)
|
||||
{
|
||||
return ((L2PcInstance) target).getKarma() > 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.model.itemcontainer.Inventory;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
import com.l2jserver.gameserver.templates.item.L2Armor;
|
||||
import com.l2jserver.gameserver.templates.item.L2Item;
|
||||
|
||||
/**
|
||||
* The Class ConditionTargetBodyPart.
|
||||
* @author mkizub
|
||||
*/
|
||||
public class ConditionTargetBodyPart extends Condition
|
||||
{
|
||||
|
||||
private final L2Armor _armor;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition target body part.
|
||||
* @param armor the armor
|
||||
*/
|
||||
public ConditionTargetBodyPart(L2Armor armor)
|
||||
{
|
||||
_armor = armor;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
// target is attacker
|
||||
if (env.target == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
int bodypart = env.target.getAttackingBodyPart();
|
||||
int armor_part = _armor.getBodyPart();
|
||||
switch (bodypart)
|
||||
{
|
||||
case Inventory.PAPERDOLL_CHEST:
|
||||
return (armor_part & (L2Item.SLOT_CHEST | L2Item.SLOT_FULL_ARMOR | L2Item.SLOT_UNDERWEAR)) != 0;
|
||||
case Inventory.PAPERDOLL_LEGS:
|
||||
return (armor_part & (L2Item.SLOT_LEGS | L2Item.SLOT_FULL_ARMOR)) != 0;
|
||||
case Inventory.PAPERDOLL_HEAD:
|
||||
return (armor_part & L2Item.SLOT_HEAD) != 0;
|
||||
case Inventory.PAPERDOLL_FEET:
|
||||
return (armor_part & L2Item.SLOT_FEET) != 0;
|
||||
case Inventory.PAPERDOLL_GLOVES:
|
||||
return (armor_part & L2Item.SLOT_GLOVES) != 0;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionTargetClassIdRestriction.
|
||||
*/
|
||||
public class ConditionTargetClassIdRestriction extends Condition
|
||||
{
|
||||
private final ArrayList<Integer> _classIds;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition target class id restriction.
|
||||
* @param classId the class id
|
||||
*/
|
||||
public ConditionTargetClassIdRestriction(ArrayList<Integer> classId)
|
||||
{
|
||||
_classIds = classId;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
if (!(env.target instanceof L2PcInstance))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return (_classIds.contains(((L2PcInstance) env.target).getClassId().getId()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionTargetLevel.
|
||||
* @author mkizub
|
||||
*/
|
||||
public class ConditionTargetLevel extends Condition
|
||||
{
|
||||
|
||||
private final int _level;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition target level.
|
||||
* @param level the level
|
||||
*/
|
||||
public ConditionTargetLevel(int level)
|
||||
{
|
||||
_level = level;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
if (env.target == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return env.target.getLevel() >= _level;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionTargetNone.
|
||||
* @author mkizub
|
||||
*/
|
||||
public class ConditionTargetNone extends Condition
|
||||
{
|
||||
|
||||
/**
|
||||
* Instantiates a new condition target none.
|
||||
*/
|
||||
public ConditionTargetNone()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
return (env.target == null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.L2Npc;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionTargetNpcId.
|
||||
*/
|
||||
public class ConditionTargetNpcId extends Condition
|
||||
{
|
||||
private final ArrayList<Integer> _npcIds;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition target npc id.
|
||||
* @param npcIds the npc ids
|
||||
*/
|
||||
public ConditionTargetNpcId(ArrayList<Integer> npcIds)
|
||||
{
|
||||
_npcIds = npcIds;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
if (env.target instanceof L2Npc)
|
||||
{
|
||||
return _npcIds.contains(((L2Npc) env.target).getNpcId());
|
||||
}
|
||||
|
||||
if (env.target instanceof L2DoorInstance)
|
||||
{
|
||||
return _npcIds.contains(((L2DoorInstance) env.target).getDoorId());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.model.L2Object.InstanceType;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionTargetNpcType.
|
||||
*/
|
||||
public class ConditionTargetNpcType extends Condition
|
||||
{
|
||||
|
||||
private final InstanceType[] _npcType;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition target npc type.
|
||||
* @param type the type
|
||||
*/
|
||||
public ConditionTargetNpcType(InstanceType[] type)
|
||||
{
|
||||
_npcType = type;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
if (env.target == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return env.target.getInstanceType().isTypes(_npcType);
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.L2Playable;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* @author DS
|
||||
*/
|
||||
public class ConditionTargetPlayable extends Condition
|
||||
{
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
return (env.target instanceof L2Playable);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.base.Race;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
import com.l2jserver.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* The Class ConditionTargetRace.
|
||||
* @author mkizub, Zoey76
|
||||
*/
|
||||
public class ConditionTargetRace extends Condition
|
||||
{
|
||||
private final Race[] _races;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition target race.
|
||||
* @param races the list containing the allowed races.
|
||||
*/
|
||||
public ConditionTargetRace(Race[] races)
|
||||
{
|
||||
_races = races;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
if (!(env.target instanceof L2PcInstance))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return Util.contains(_races, env.target.getActingPlayer().getRace());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.L2Npc;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionTargetRaceId.
|
||||
* @author nBd
|
||||
*/
|
||||
|
||||
public class ConditionTargetRaceId extends Condition
|
||||
{
|
||||
private final ArrayList<Integer> _raceIds;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition target race id.
|
||||
* @param raceId the race id
|
||||
*/
|
||||
public ConditionTargetRaceId(ArrayList<Integer> raceId)
|
||||
{
|
||||
_raceIds = raceId;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
if (!(env.target instanceof L2Npc))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return (_raceIds.contains(((L2Npc) env.target).getTemplate().getRace().ordinal() + 1));
|
||||
}
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
import com.l2jserver.gameserver.templates.item.L2Weapon;
|
||||
|
||||
/**
|
||||
* The Class ConditionTargetUsesWeaponKind.
|
||||
* @author mkizub
|
||||
*/
|
||||
public class ConditionTargetUsesWeaponKind extends Condition
|
||||
{
|
||||
|
||||
private final int _weaponMask;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition target uses weapon kind.
|
||||
* @param weaponMask the weapon mask
|
||||
*/
|
||||
public ConditionTargetUsesWeaponKind(int weaponMask)
|
||||
{
|
||||
_weaponMask = weaponMask;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
|
||||
if (env.target == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
L2Weapon item = env.target.getActiveWeaponItem();
|
||||
|
||||
if (item == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return (item.getItemType().mask() & _weaponMask) != 0;
|
||||
}
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.model.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.itemcontainer.Inventory;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
import com.l2jserver.gameserver.templates.item.L2ArmorType;
|
||||
import com.l2jserver.gameserver.templates.item.L2Item;
|
||||
|
||||
/**
|
||||
* The Class ConditionUsingItemType.
|
||||
* @author mkizub
|
||||
*/
|
||||
public final class ConditionUsingItemType extends Condition
|
||||
{
|
||||
private final boolean _armor;
|
||||
private final int _mask;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition using item type.
|
||||
* @param mask the mask
|
||||
*/
|
||||
public ConditionUsingItemType(int mask)
|
||||
{
|
||||
_mask = mask;
|
||||
_armor = (_mask & (L2ArmorType.MAGIC.mask() | L2ArmorType.LIGHT.mask() | L2ArmorType.HEAVY.mask())) != 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
if (!(env.player instanceof L2PcInstance))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
Inventory inv = ((L2PcInstance) env.player).getInventory();
|
||||
|
||||
// If ConditionUsingItemType is one between Light, Heavy or Magic
|
||||
if (_armor)
|
||||
{
|
||||
// Get the itemMask of the weared chest (if exists)
|
||||
L2ItemInstance chest = inv.getPaperdollItem(Inventory.PAPERDOLL_CHEST);
|
||||
if (chest == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
int chestMask = chest.getItem().getItemMask();
|
||||
|
||||
// If chest armor is different from the condition one return false
|
||||
if ((_mask & chestMask) == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// So from here, chest armor matches conditions
|
||||
|
||||
int chestBodyPart = chest.getItem().getBodyPart();
|
||||
// return True if chest armor is a Full Armor
|
||||
if (chestBodyPart == L2Item.SLOT_FULL_ARMOR)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
L2ItemInstance legs = inv.getPaperdollItem(Inventory.PAPERDOLL_LEGS);
|
||||
if (legs == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
int legMask = legs.getItem().getItemMask();
|
||||
// return true if legs armor matches too
|
||||
return (_mask & legMask) != 0;
|
||||
}
|
||||
return (_mask & inv.getWearedMask()) != 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionUsingSkill.
|
||||
* @author mkizub
|
||||
*/
|
||||
public final class ConditionUsingSkill extends Condition
|
||||
{
|
||||
private final int _skillId;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition using skill.
|
||||
* @param skillId the skill id
|
||||
*/
|
||||
public ConditionUsingSkill(int skillId)
|
||||
{
|
||||
_skillId = skillId;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
if (env.skill == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return env.skill.getId() == _skillId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.conditions;
|
||||
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
|
||||
/**
|
||||
* The Class ConditionWithSkill.
|
||||
* @author Steuf
|
||||
*/
|
||||
public class ConditionWithSkill extends Condition
|
||||
{
|
||||
private final boolean _skill;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition with skill.
|
||||
* @param skill the skill
|
||||
*/
|
||||
public ConditionWithSkill(boolean skill)
|
||||
{
|
||||
_skill = skill;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.skills.conditions.Condition#testImpl(com.l2jserver.gameserver.skills.Env)
|
||||
*/
|
||||
@Override
|
||||
public boolean testImpl(Env env)
|
||||
{
|
||||
if (!_skill && (env.skill != null))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.effects;
|
||||
|
||||
import com.l2jserver.gameserver.model.L2Effect;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
|
||||
import com.l2jserver.gameserver.templates.skills.L2EffectType;
|
||||
|
||||
public class EffectAbortCast extends L2Effect
|
||||
{
|
||||
public EffectAbortCast(Env env, EffectTemplate template)
|
||||
{
|
||||
super(env, template);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
|
||||
*/
|
||||
@Override
|
||||
public L2EffectType getEffectType()
|
||||
{
|
||||
return L2EffectType.ABORT_CAST;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
|
||||
*/
|
||||
@Override
|
||||
public boolean onStart()
|
||||
{
|
||||
if ((getEffected() == null) || (getEffected() == getEffector()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (getEffected().isRaid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
getEffected().breakCast();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
|
||||
*/
|
||||
@Override
|
||||
public boolean onActionTime()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.effects;
|
||||
|
||||
import com.l2jserver.gameserver.ai.CtrlIntention;
|
||||
import com.l2jserver.gameserver.model.CharEffectList;
|
||||
import com.l2jserver.gameserver.model.L2Effect;
|
||||
import com.l2jserver.gameserver.model.actor.L2Summon;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
|
||||
import com.l2jserver.gameserver.templates.skills.L2EffectType;
|
||||
|
||||
/**
|
||||
* @author decad
|
||||
*/
|
||||
public class EffectBetray extends L2Effect
|
||||
{
|
||||
public EffectBetray(Env env, EffectTemplate template)
|
||||
{
|
||||
super(env, template);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
|
||||
*/
|
||||
@Override
|
||||
public L2EffectType getEffectType()
|
||||
{
|
||||
return L2EffectType.BETRAY;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
|
||||
*/
|
||||
@Override
|
||||
public boolean onStart()
|
||||
{
|
||||
if ((getEffector() instanceof L2PcInstance) && (getEffected() instanceof L2Summon))
|
||||
{
|
||||
L2PcInstance targetOwner = getEffected().getActingPlayer();
|
||||
getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, targetOwner);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#onExit()
|
||||
*/
|
||||
@Override
|
||||
public void onExit()
|
||||
{
|
||||
getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
|
||||
*/
|
||||
@Override
|
||||
public boolean onActionTime()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#getEffectFlags()
|
||||
*/
|
||||
@Override
|
||||
public int getEffectFlags()
|
||||
{
|
||||
return CharEffectList.EFFECT_FLAG_BETRAYED;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.effects;
|
||||
|
||||
import com.l2jserver.gameserver.model.L2Effect;
|
||||
import com.l2jserver.gameserver.skills.AbnormalEffect;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
|
||||
import com.l2jserver.gameserver.templates.skills.L2EffectType;
|
||||
|
||||
/**
|
||||
* @author LBaldi
|
||||
*/
|
||||
public class EffectBigHead extends L2Effect
|
||||
{
|
||||
public EffectBigHead(Env env, EffectTemplate template)
|
||||
{
|
||||
super(env, template);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
|
||||
*/
|
||||
@Override
|
||||
public L2EffectType getEffectType()
|
||||
{
|
||||
return L2EffectType.BUFF;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
|
||||
*/
|
||||
@Override
|
||||
public boolean onStart()
|
||||
{
|
||||
getEffected().startAbnormalEffect(AbnormalEffect.BIG_HEAD);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#onExit()
|
||||
*/
|
||||
@Override
|
||||
public void onExit()
|
||||
{
|
||||
getEffected().stopAbnormalEffect(AbnormalEffect.BIG_HEAD);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
|
||||
*/
|
||||
@Override
|
||||
public boolean onActionTime()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.effects;
|
||||
|
||||
import com.l2jserver.gameserver.model.CharEffectList;
|
||||
import com.l2jserver.gameserver.model.L2Effect;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
|
||||
import com.l2jserver.gameserver.templates.skills.L2EffectType;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class EffectBlockResurrection extends L2Effect
|
||||
{
|
||||
public EffectBlockResurrection(Env env, EffectTemplate template)
|
||||
{
|
||||
super(env, template);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
|
||||
*/
|
||||
@Override
|
||||
public L2EffectType getEffectType()
|
||||
{
|
||||
return L2EffectType.BLOCK_RESURRECTION;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
|
||||
*/
|
||||
@Override
|
||||
public boolean onActionTime()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEffectFlags()
|
||||
{
|
||||
return CharEffectList.EFFECT_FLAG_BLOCK_RESURRECTION;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.effects;
|
||||
|
||||
import com.l2jserver.gameserver.model.L2Effect;
|
||||
import com.l2jserver.gameserver.model.actor.L2Npc;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2NpcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2SiegeSummonInstance;
|
||||
import com.l2jserver.gameserver.network.serverpackets.StartRotation;
|
||||
import com.l2jserver.gameserver.network.serverpackets.StopRotation;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
|
||||
import com.l2jserver.gameserver.templates.skills.L2EffectType;
|
||||
|
||||
/**
|
||||
* @author decad Implementation of the Bluff Effect
|
||||
*/
|
||||
public class EffectBluff extends L2Effect
|
||||
{
|
||||
public EffectBluff(Env env, EffectTemplate template)
|
||||
{
|
||||
super(env, template);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
|
||||
*/
|
||||
@Override
|
||||
public L2EffectType getEffectType()
|
||||
{
|
||||
return L2EffectType.BLUFF; // test for bluff effect
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
|
||||
*/
|
||||
@Override
|
||||
public boolean onStart()
|
||||
{
|
||||
if (getEffected() instanceof L2NpcInstance)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((getEffected() instanceof L2Npc) && (((L2Npc) getEffected()).getNpcId() == 35062))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (getEffected() instanceof L2SiegeSummonInstance)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
getEffected().broadcastPacket(new StartRotation(getEffected().getObjectId(), getEffected().getHeading(), 1, 65535));
|
||||
getEffected().broadcastPacket(new StopRotation(getEffected().getObjectId(), getEffector().getHeading(), 65535));
|
||||
getEffected().setHeading(getEffector().getHeading());
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
|
||||
*/
|
||||
@Override
|
||||
public boolean onActionTime()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.effects;
|
||||
|
||||
import com.l2jserver.gameserver.model.L2Effect;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
|
||||
import com.l2jserver.gameserver.templates.skills.L2EffectType;
|
||||
|
||||
/**
|
||||
* @author mkizub
|
||||
*/
|
||||
public class EffectBuff extends L2Effect
|
||||
{
|
||||
public EffectBuff(Env env, EffectTemplate template)
|
||||
{
|
||||
super(env, template);
|
||||
}
|
||||
|
||||
// Special constructor to steal this effect
|
||||
public EffectBuff(Env env, L2Effect effect)
|
||||
{
|
||||
super(env, effect);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#effectCanBeStolen()
|
||||
*/
|
||||
@Override
|
||||
protected boolean effectCanBeStolen()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public L2EffectType getEffectType()
|
||||
{
|
||||
return L2EffectType.BUFF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActionTime()
|
||||
{
|
||||
// just stop this effect
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,244 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.effects;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.model.L2Effect;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
import com.l2jserver.gameserver.skills.Formulas;
|
||||
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
|
||||
import com.l2jserver.gameserver.templates.skills.L2EffectType;
|
||||
import com.l2jserver.util.Rnd;
|
||||
import com.l2jserver.util.StringUtil;
|
||||
|
||||
/**
|
||||
* @author DS
|
||||
*/
|
||||
public class EffectCancel extends L2Effect
|
||||
{
|
||||
protected static final Logger _log = Logger.getLogger(EffectCancel.class.getName());
|
||||
|
||||
public EffectCancel(Env env, EffectTemplate template)
|
||||
{
|
||||
super(env, template);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
|
||||
*/
|
||||
@Override
|
||||
public L2EffectType getEffectType()
|
||||
{
|
||||
return L2EffectType.CANCEL;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
|
||||
*/
|
||||
@Override
|
||||
public boolean onStart()
|
||||
{
|
||||
return cancel(getEffector(), getEffected(), this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
|
||||
*/
|
||||
@Override
|
||||
public boolean onActionTime()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean cancel(L2Character caster, L2Character target, L2Effect effect)
|
||||
{
|
||||
if (!(target instanceof L2PcInstance) || target.isDead())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final int cancelLvl = effect.getSkill().getMagicLevel();
|
||||
int count = effect.getSkill().getMaxNegatedEffects();
|
||||
|
||||
double rate = effect.getEffectPower();
|
||||
final double vulnModifier = Formulas.calcSkillTypeVulnerability(0, target, effect.getSkillType());
|
||||
final double profModifier = Formulas.calcSkillTypeProficiency(0, caster, target, effect.getSkillType());
|
||||
double res = vulnModifier + profModifier;
|
||||
double resMod = 1;
|
||||
if (res != 0)
|
||||
{
|
||||
if (res < 0)
|
||||
{
|
||||
resMod = 1 - (0.075 * res);
|
||||
resMod = 1 / resMod;
|
||||
}
|
||||
else
|
||||
{
|
||||
resMod = 1 + (0.02 * res);
|
||||
}
|
||||
|
||||
rate *= resMod;
|
||||
}
|
||||
|
||||
if (caster.isDebug())
|
||||
{
|
||||
final StringBuilder stat = new StringBuilder(100);
|
||||
StringUtil.append(stat, effect.getSkill().getName(), " power:", String.valueOf((int) effect.getEffectPower()), " lvl:", String.valueOf(cancelLvl), " res:", String.format("%1.2f", resMod), "(", String.format("%1.2f", profModifier), "/", String.format("%1.2f", vulnModifier), ") total:", String.valueOf(rate));
|
||||
final String result = stat.toString();
|
||||
if (caster.isDebug())
|
||||
{
|
||||
caster.sendDebugMessage(result);
|
||||
}
|
||||
if (Config.DEVELOPER)
|
||||
{
|
||||
_log.info(result);
|
||||
}
|
||||
}
|
||||
|
||||
final L2Effect[] effects = target.getAllEffects();
|
||||
|
||||
if (effect.getSkill().getNegateAbnormals() != null) // Cancel for abnormals
|
||||
{
|
||||
for (L2Effect eff : effects)
|
||||
{
|
||||
if (eff == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for (String negateAbnormalType : effect.getSkill().getNegateAbnormals().keySet())
|
||||
{
|
||||
if (negateAbnormalType.equalsIgnoreCase(eff.getAbnormalType()) && (effect.getSkill().getNegateAbnormals().get(negateAbnormalType) >= eff.getAbnormalLvl()))
|
||||
{
|
||||
if (calcCancelSuccess(eff, cancelLvl, (int) rate))
|
||||
{
|
||||
eff.exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
L2Effect eff;
|
||||
int lastCanceledSkillId = 0;
|
||||
|
||||
for (int i = effects.length; --i >= 0;)
|
||||
{
|
||||
eff = effects[i];
|
||||
if (eff == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!eff.canBeStolen())
|
||||
{
|
||||
effects[i] = null;
|
||||
continue;
|
||||
}
|
||||
|
||||
// first pass - dances/songs only
|
||||
if (!eff.getSkill().isDance())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (eff.getSkill().getId() == lastCanceledSkillId)
|
||||
{
|
||||
eff.exit(); // this skill already canceled
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!calcCancelSuccess(eff, cancelLvl, (int) rate))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
lastCanceledSkillId = eff.getSkill().getId();
|
||||
|
||||
eff.exit();
|
||||
count--;
|
||||
|
||||
if (count == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (count != 0)
|
||||
{
|
||||
lastCanceledSkillId = 0;
|
||||
for (int i = effects.length; --i >= 0;)
|
||||
{
|
||||
eff = effects[i];
|
||||
if (eff == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// second pass - all except dances/songs
|
||||
if (eff.getSkill().isDance())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (eff.getSkill().getId() == lastCanceledSkillId)
|
||||
{
|
||||
eff.exit(); // this skill already canceled
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!calcCancelSuccess(eff, cancelLvl, (int) rate))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
lastCanceledSkillId = eff.getSkill().getId();
|
||||
eff.exit();
|
||||
count--;
|
||||
|
||||
if (count == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean calcCancelSuccess(L2Effect effect, int cancelLvl, int baseRate)
|
||||
{
|
||||
int rate = 2 * (cancelLvl - effect.getSkill().getMagicLevel());
|
||||
rate += effect.getAbnormalTime() / 120;
|
||||
rate += baseRate;
|
||||
|
||||
if (rate < 25)
|
||||
{
|
||||
rate = 25;
|
||||
}
|
||||
else if (rate > 75)
|
||||
{
|
||||
rate = 75;
|
||||
}
|
||||
|
||||
return Rnd.get(100) < rate;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.effects;
|
||||
|
||||
import com.l2jserver.gameserver.model.L2Effect;
|
||||
import com.l2jserver.gameserver.model.L2Skill;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
import com.l2jserver.gameserver.skills.Formulas;
|
||||
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
|
||||
import com.l2jserver.gameserver.templates.skills.L2EffectType;
|
||||
import com.l2jserver.gameserver.templates.skills.L2SkillType;
|
||||
import com.l2jserver.util.Rnd;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class EffectCancelDebuff extends L2Effect
|
||||
{
|
||||
public EffectCancelDebuff(Env env, EffectTemplate template)
|
||||
{
|
||||
super(env, template);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
|
||||
*/
|
||||
@Override
|
||||
public L2EffectType getEffectType()
|
||||
{
|
||||
return L2EffectType.CANCEL_DEBUFF;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
|
||||
*/
|
||||
@Override
|
||||
public boolean onStart()
|
||||
{
|
||||
return cancel(getEffector(), getEffected(), getSkill(), getEffectTemplate().effectType);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
|
||||
*/
|
||||
@Override
|
||||
public boolean onActionTime()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean cancel(L2Character caster, L2Character target, L2Skill skill, L2SkillType effectType)
|
||||
{
|
||||
if (!(target instanceof L2PcInstance) || target.isDead())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final int cancelLvl = skill.getMagicLevel();
|
||||
int count = skill.getMaxNegatedEffects();
|
||||
double baseRate = Formulas.calcSkillTypeProficiency(skill.getPower(), caster, target, effectType);
|
||||
baseRate += Formulas.calcSkillTypeVulnerability(baseRate, caster, effectType);
|
||||
|
||||
L2Effect effect;
|
||||
int lastCanceledSkillId = 0;
|
||||
final L2Effect[] effects = target.getAllEffects();
|
||||
for (int i = effects.length; --i >= 0;)
|
||||
{
|
||||
effect = effects[i];
|
||||
if (effect == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!effect.getSkill().isDebuff() || !effect.getSkill().canBeDispeled())
|
||||
{
|
||||
effects[i] = null;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (effect.getSkill().getId() == lastCanceledSkillId)
|
||||
{
|
||||
effect.exit(); // this skill already canceled
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!calcCancelSuccess(effect, cancelLvl, (int) baseRate))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
lastCanceledSkillId = effect.getSkill().getId();
|
||||
effect.exit();
|
||||
count--;
|
||||
|
||||
if (count == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (count != 0)
|
||||
{
|
||||
lastCanceledSkillId = 0;
|
||||
for (int i = effects.length; --i >= 0;)
|
||||
{
|
||||
effect = effects[i];
|
||||
if (effect == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!effect.getSkill().isDebuff() || !effect.getSkill().canBeDispeled())
|
||||
{
|
||||
effects[i] = null;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (effect.getSkill().getId() == lastCanceledSkillId)
|
||||
{
|
||||
effect.exit(); // this skill already canceled
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!calcCancelSuccess(effect, cancelLvl, (int) baseRate))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
lastCanceledSkillId = effect.getSkill().getId();
|
||||
effect.exit();
|
||||
count--;
|
||||
|
||||
if (count == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean calcCancelSuccess(L2Effect effect, int cancelLvl, int baseRate)
|
||||
{
|
||||
int rate = 2 * (cancelLvl - effect.getSkill().getMagicLevel());
|
||||
rate += (effect.getAbnormalTime() - effect.getTime()) / 1200;
|
||||
rate += baseRate;
|
||||
|
||||
if (rate < 25)
|
||||
{
|
||||
rate = 25;
|
||||
}
|
||||
else if (rate > 75)
|
||||
{
|
||||
rate = 75;
|
||||
}
|
||||
|
||||
return Rnd.get(100) < rate;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.effects;
|
||||
|
||||
import com.l2jserver.gameserver.ai.CtrlIntention;
|
||||
import com.l2jserver.gameserver.model.CharEffectList;
|
||||
import com.l2jserver.gameserver.model.L2Effect;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
|
||||
import com.l2jserver.gameserver.templates.skills.L2EffectType;
|
||||
import com.l2jserver.gameserver.templates.skills.L2SkillType;
|
||||
|
||||
public class EffectChameleonRest extends L2Effect
|
||||
{
|
||||
public EffectChameleonRest(Env env, EffectTemplate template)
|
||||
{
|
||||
super(env, template);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
|
||||
*/
|
||||
@Override
|
||||
public L2EffectType getEffectType()
|
||||
{
|
||||
return L2EffectType.RELAXING;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
|
||||
*/
|
||||
@Override
|
||||
public boolean onStart()
|
||||
{
|
||||
if (getEffected() instanceof L2PcInstance)
|
||||
{
|
||||
((L2PcInstance) getEffected()).sitDown(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_REST);
|
||||
}
|
||||
return super.onStart();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#onExit()
|
||||
*/
|
||||
@Override
|
||||
public void onExit()
|
||||
{
|
||||
super.onExit();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
|
||||
*/
|
||||
@Override
|
||||
public boolean onActionTime()
|
||||
{
|
||||
if (getEffected().isDead())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Only cont skills shouldn't end
|
||||
if (getSkill().getSkillType() != L2SkillType.CONT)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (getEffected() instanceof L2PcInstance)
|
||||
{
|
||||
if (!((L2PcInstance) getEffected()).isSitting())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
double manaDam = calc();
|
||||
|
||||
if (manaDam > getEffected().getCurrentMp())
|
||||
{
|
||||
getEffected().sendPacket(SystemMessage.getSystemMessage(SystemMessageId.SKILL_REMOVED_DUE_LACK_MP));
|
||||
return false;
|
||||
}
|
||||
|
||||
getEffected().reduceCurrentMp(manaDam);
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#getEffectFlags()
|
||||
*/
|
||||
@Override
|
||||
public int getEffectFlags()
|
||||
{
|
||||
return (CharEffectList.EFFECT_FLAG_SILENT_MOVE | CharEffectList.EFFECT_FLAG_RELAXING);
|
||||
}
|
||||
}
|
||||
+111
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.effects;
|
||||
|
||||
import com.l2jserver.gameserver.model.ChanceCondition;
|
||||
import com.l2jserver.gameserver.model.IChanceSkillTrigger;
|
||||
import com.l2jserver.gameserver.model.L2Effect;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
|
||||
import com.l2jserver.gameserver.templates.skills.L2EffectType;
|
||||
|
||||
public class EffectChanceSkillTrigger extends L2Effect implements IChanceSkillTrigger
|
||||
{
|
||||
private final int _triggeredId;
|
||||
private final int _triggeredLevel;
|
||||
private final ChanceCondition _chanceCondition;
|
||||
|
||||
public EffectChanceSkillTrigger(Env env, EffectTemplate template)
|
||||
{
|
||||
super(env, template);
|
||||
|
||||
_triggeredId = template.triggeredId;
|
||||
_triggeredLevel = template.triggeredLevel;
|
||||
_chanceCondition = template.chanceCondition;
|
||||
}
|
||||
|
||||
// Special constructor to steal this effect
|
||||
public EffectChanceSkillTrigger(Env env, L2Effect effect)
|
||||
{
|
||||
super(env, effect);
|
||||
|
||||
_triggeredId = effect.getEffectTemplate().triggeredId;
|
||||
_triggeredLevel = effect.getEffectTemplate().triggeredLevel;
|
||||
_chanceCondition = effect.getEffectTemplate().chanceCondition;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean effectCanBeStolen()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public L2EffectType getEffectType()
|
||||
{
|
||||
return L2EffectType.CHANCE_SKILL_TRIGGER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onStart()
|
||||
{
|
||||
getEffected().addChanceTrigger(this);
|
||||
getEffected().onStartChanceEffect(getSkill().getElement());
|
||||
return super.onStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActionTime()
|
||||
{
|
||||
getEffected().onActionTimeChanceEffect(getSkill().getElement());
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExit()
|
||||
{
|
||||
// trigger only if effect in use and successfully ticked to the end
|
||||
if (getInUse() && (getCount() == 0))
|
||||
{
|
||||
getEffected().onExitChanceEffect(getSkill().getElement());
|
||||
}
|
||||
getEffected().removeChanceEffect(this);
|
||||
super.onExit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTriggeredChanceId()
|
||||
{
|
||||
return _triggeredId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTriggeredChanceLevel()
|
||||
{
|
||||
return _triggeredLevel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean triggersChanceSkill()
|
||||
{
|
||||
return _triggeredId > 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChanceCondition getTriggeredChanceCondition()
|
||||
{
|
||||
return _chanceCondition;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.effects;
|
||||
|
||||
import com.l2jserver.gameserver.model.CharEffectList;
|
||||
import com.l2jserver.gameserver.model.L2Effect;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.serverpackets.EtcStatusUpdate;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
|
||||
import com.l2jserver.gameserver.templates.skills.L2EffectType;
|
||||
|
||||
/**
|
||||
* @author nBd
|
||||
*/
|
||||
public class EffectCharmOfCourage extends L2Effect
|
||||
{
|
||||
public EffectCharmOfCourage(Env env, EffectTemplate template)
|
||||
{
|
||||
super(env, template);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
|
||||
*/
|
||||
@Override
|
||||
public L2EffectType getEffectType()
|
||||
{
|
||||
return L2EffectType.CHARMOFCOURAGE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
|
||||
*/
|
||||
@Override
|
||||
public boolean onStart()
|
||||
{
|
||||
if (getEffected() instanceof L2PcInstance)
|
||||
{
|
||||
getEffected().broadcastPacket(new EtcStatusUpdate((L2PcInstance) getEffected()));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#onExit()
|
||||
*/
|
||||
@Override
|
||||
public void onExit()
|
||||
{
|
||||
if (getEffected() instanceof L2PcInstance)
|
||||
{
|
||||
getEffected().broadcastPacket(new EtcStatusUpdate((L2PcInstance) getEffected()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
|
||||
*/
|
||||
@Override
|
||||
public boolean onActionTime()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#getEffectFlags()
|
||||
*/
|
||||
@Override
|
||||
public int getEffectFlags()
|
||||
{
|
||||
return CharEffectList.EFFECT_FLAG_CHARM_OF_COURAGE;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.effects;
|
||||
|
||||
import com.l2jserver.gameserver.model.CharEffectList;
|
||||
import com.l2jserver.gameserver.model.L2Effect;
|
||||
import com.l2jserver.gameserver.model.actor.L2Playable;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
|
||||
import com.l2jserver.gameserver.templates.skills.L2EffectType;
|
||||
|
||||
/**
|
||||
* @author kerberos_20
|
||||
*/
|
||||
public class EffectCharmOfLuck extends L2Effect
|
||||
{
|
||||
public EffectCharmOfLuck(Env env, EffectTemplate template)
|
||||
{
|
||||
super(env, template);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
|
||||
*/
|
||||
@Override
|
||||
public L2EffectType getEffectType()
|
||||
{
|
||||
return L2EffectType.CHARM_OF_LUCK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
|
||||
*/
|
||||
@Override
|
||||
public boolean onStart()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#onExit()
|
||||
*/
|
||||
@Override
|
||||
public void onExit()
|
||||
{
|
||||
((L2Playable) getEffected()).stopCharmOfLuck(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
|
||||
*/
|
||||
@Override
|
||||
public boolean onActionTime()
|
||||
{
|
||||
// just stop this effect
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#getEffectFlags()
|
||||
*/
|
||||
@Override
|
||||
public int getEffectFlags()
|
||||
{
|
||||
return CharEffectList.EFFECT_FLAG_CHARM_OF_LUCK;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.effects;
|
||||
|
||||
import com.l2jserver.gameserver.model.L2Clan;
|
||||
import com.l2jserver.gameserver.model.L2Effect;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
||||
import com.l2jserver.gameserver.skills.AbnormalEffect;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
|
||||
import com.l2jserver.gameserver.templates.skills.L2EffectType;
|
||||
|
||||
/**
|
||||
* @author ZaKaX (Ghost @ L2D)
|
||||
*/
|
||||
public class EffectClanGate extends L2Effect
|
||||
{
|
||||
public EffectClanGate(Env env, EffectTemplate template)
|
||||
{
|
||||
super(env, template);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
|
||||
*/
|
||||
@Override
|
||||
public boolean onStart()
|
||||
{
|
||||
getEffected().startAbnormalEffect(AbnormalEffect.MAGIC_CIRCLE);
|
||||
if (getEffected() instanceof L2PcInstance)
|
||||
{
|
||||
L2Clan clan = ((L2PcInstance) getEffected()).getClan();
|
||||
if (clan != null)
|
||||
{
|
||||
SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.COURT_MAGICIAN_CREATED_PORTAL);
|
||||
clan.broadcastToOtherOnlineMembers(msg, ((L2PcInstance) getEffected()));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
|
||||
*/
|
||||
@Override
|
||||
public boolean onActionTime()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#onExit()
|
||||
*/
|
||||
@Override
|
||||
public void onExit()
|
||||
{
|
||||
getEffected().stopAbnormalEffect(AbnormalEffect.MAGIC_CIRCLE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
|
||||
*/
|
||||
@Override
|
||||
public L2EffectType getEffectType()
|
||||
{
|
||||
return L2EffectType.CLAN_GATE;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.effects;
|
||||
|
||||
import com.l2jserver.gameserver.model.L2Effect;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
|
||||
import com.l2jserver.gameserver.templates.skills.L2EffectType;
|
||||
|
||||
public class EffectCombatPointHeal extends L2Effect
|
||||
{
|
||||
public EffectCombatPointHeal(Env env, EffectTemplate template)
|
||||
{
|
||||
super(env, template);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
|
||||
*/
|
||||
@Override
|
||||
public L2EffectType getEffectType()
|
||||
{
|
||||
return L2EffectType.COMBAT_POINT_HEAL;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
|
||||
*/
|
||||
@Override
|
||||
public boolean onActionTime()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onStart()
|
||||
{
|
||||
L2Character target = getEffected();
|
||||
if (target.isInvul())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
double cp = calc();
|
||||
|
||||
if ((target.getCurrentCp() + cp) > target.getMaxCp())
|
||||
{
|
||||
cp = target.getMaxCp() - target.getCurrentCp();
|
||||
}
|
||||
target.setCurrentCp(cp + target.getCurrentCp());
|
||||
|
||||
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CP_WILL_BE_RESTORED);
|
||||
sm.addNumber((int) cp);
|
||||
target.sendPacket(sm);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.effects;
|
||||
|
||||
import com.l2jserver.gameserver.model.L2Effect;
|
||||
import com.l2jserver.gameserver.network.serverpackets.StatusUpdate;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
|
||||
import com.l2jserver.gameserver.templates.skills.L2EffectType;
|
||||
|
||||
public class EffectCombatPointHealOverTime extends L2Effect
|
||||
{
|
||||
public EffectCombatPointHealOverTime(Env env, EffectTemplate template)
|
||||
{
|
||||
super(env, template);
|
||||
}
|
||||
|
||||
// Special constructor to steal this effect
|
||||
public EffectCombatPointHealOverTime(Env env, L2Effect effect)
|
||||
{
|
||||
super(env, effect);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#effectCanBeStolen()
|
||||
*/
|
||||
@Override
|
||||
protected boolean effectCanBeStolen()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
|
||||
*/
|
||||
@Override
|
||||
public L2EffectType getEffectType()
|
||||
{
|
||||
return L2EffectType.COMBAT_POINT_HEAL_OVER_TIME;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
|
||||
*/
|
||||
@Override
|
||||
public boolean onActionTime()
|
||||
{
|
||||
if (getEffected().isDead())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
double cp = getEffected().getCurrentCp();
|
||||
double maxcp = getEffected().getMaxCp();
|
||||
cp += calc();
|
||||
if (cp > maxcp)
|
||||
{
|
||||
cp = maxcp;
|
||||
}
|
||||
|
||||
getEffected().setCurrentCp(cp);
|
||||
StatusUpdate sump = new StatusUpdate(getEffected());
|
||||
sump.addAttribute(StatusUpdate.CUR_CP, (int) cp);
|
||||
getEffected().sendPacket(sump);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.effects;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import javolution.util.FastList;
|
||||
|
||||
import com.l2jserver.gameserver.ai.CtrlIntention;
|
||||
import com.l2jserver.gameserver.model.CharEffectList;
|
||||
import com.l2jserver.gameserver.model.L2Effect;
|
||||
import com.l2jserver.gameserver.model.L2Object;
|
||||
import com.l2jserver.gameserver.model.actor.L2Attackable;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
|
||||
import com.l2jserver.gameserver.templates.skills.L2EffectType;
|
||||
import com.l2jserver.util.Rnd;
|
||||
|
||||
/**
|
||||
* @author littlecrow Implementation of the Confusion Effect
|
||||
*/
|
||||
public class EffectConfuseMob extends L2Effect
|
||||
{
|
||||
public EffectConfuseMob(Env env, EffectTemplate template)
|
||||
{
|
||||
super(env, template);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
|
||||
*/
|
||||
@Override
|
||||
public L2EffectType getEffectType()
|
||||
{
|
||||
return L2EffectType.CONFUSE_MOB_ONLY;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
|
||||
*/
|
||||
@Override
|
||||
public boolean onStart()
|
||||
{
|
||||
getEffected().startConfused();
|
||||
onActionTime();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#onExit()
|
||||
*/
|
||||
@Override
|
||||
public void onExit()
|
||||
{
|
||||
getEffected().stopConfused(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
|
||||
*/
|
||||
@Override
|
||||
public boolean onActionTime()
|
||||
{
|
||||
List<L2Character> targetList = new FastList<>();
|
||||
|
||||
// Getting the possible targets
|
||||
|
||||
Collection<L2Object> objs = getEffected().getKnownList().getKnownObjects().values();
|
||||
// synchronized (getEffected().getKnownList().getKnownObjects())
|
||||
{
|
||||
for (L2Object obj : objs)
|
||||
{
|
||||
if ((obj instanceof L2Attackable) && (obj != getEffected()))
|
||||
{
|
||||
targetList.add((L2Character) obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
// if there is no target, exit function
|
||||
if (targetList.isEmpty())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Choosing randomly a new target
|
||||
int nextTargetIdx = Rnd.nextInt(targetList.size());
|
||||
L2Object target = targetList.get(nextTargetIdx);
|
||||
|
||||
// Attacking the target
|
||||
getEffected().setTarget(target);
|
||||
getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#getEffectFlags()
|
||||
*/
|
||||
@Override
|
||||
public int getEffectFlags()
|
||||
{
|
||||
return CharEffectList.EFFECT_FLAG_CONFUSED;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.effects;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import javolution.util.FastList;
|
||||
|
||||
import com.l2jserver.gameserver.ai.CtrlIntention;
|
||||
import com.l2jserver.gameserver.model.CharEffectList;
|
||||
import com.l2jserver.gameserver.model.L2Effect;
|
||||
import com.l2jserver.gameserver.model.L2Object;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
|
||||
import com.l2jserver.gameserver.templates.skills.L2EffectType;
|
||||
import com.l2jserver.util.Rnd;
|
||||
|
||||
/**
|
||||
* @author littlecrow Implementation of the Confusion Effect
|
||||
*/
|
||||
public class EffectConfusion extends L2Effect
|
||||
{
|
||||
|
||||
public EffectConfusion(Env env, EffectTemplate template)
|
||||
{
|
||||
super(env, template);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
|
||||
*/
|
||||
@Override
|
||||
public L2EffectType getEffectType()
|
||||
{
|
||||
return L2EffectType.CONFUSION;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#onStart()
|
||||
*/
|
||||
@Override
|
||||
public boolean onStart()
|
||||
{
|
||||
getEffected().startConfused();
|
||||
onActionTime();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#onExit()
|
||||
*/
|
||||
@Override
|
||||
public void onExit()
|
||||
{
|
||||
getEffected().stopConfused(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
|
||||
*/
|
||||
@Override
|
||||
public boolean onActionTime()
|
||||
{
|
||||
List<L2Character> targetList = new FastList<>();
|
||||
|
||||
// Getting the possible targets
|
||||
|
||||
Collection<L2Object> objs = getEffected().getKnownList().getKnownObjects().values();
|
||||
// synchronized (getEffected().getKnownList().getKnownObjects())
|
||||
{
|
||||
for (L2Object obj : objs)
|
||||
{
|
||||
if ((obj instanceof L2Character) && (obj != getEffected()))
|
||||
{
|
||||
targetList.add((L2Character) obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
// if there is no target, exit function
|
||||
if (targetList.isEmpty())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Choosing randomly a new target
|
||||
int nextTargetIdx = Rnd.nextInt(targetList.size());
|
||||
L2Object target = targetList.get(nextTargetIdx);
|
||||
|
||||
// Attacking the target
|
||||
getEffected().setTarget(target);
|
||||
getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#getEffectFlags()
|
||||
*/
|
||||
@Override
|
||||
public int getEffectFlags()
|
||||
{
|
||||
return CharEffectList.EFFECT_FLAG_CONFUSED;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.l2jserver.gameserver.skills.effects;
|
||||
|
||||
import com.l2jserver.gameserver.model.L2Effect;
|
||||
import com.l2jserver.gameserver.network.serverpackets.StatusUpdate;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
|
||||
import com.l2jserver.gameserver.templates.skills.L2EffectType;
|
||||
|
||||
/**
|
||||
* @author Zoey76
|
||||
*/
|
||||
public class EffectCpDamPercent extends L2Effect
|
||||
{
|
||||
public EffectCpDamPercent(Env env, EffectTemplate template)
|
||||
{
|
||||
super(env, template);
|
||||
}
|
||||
|
||||
@Override
|
||||
public L2EffectType getEffectType()
|
||||
{
|
||||
return L2EffectType.CPDAMPERCENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActionTime()
|
||||
{
|
||||
if (getEffected().isDead())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
double cp = (getEffected().getCurrentCp() * (100 - getEffectPower())) / 100;
|
||||
getEffected().setCurrentCp(cp);
|
||||
|
||||
StatusUpdate sucp = new StatusUpdate(getEffected());
|
||||
sucp.addAttribute(StatusUpdate.CUR_CP, (int) cp);
|
||||
getEffected().sendPacket(sucp);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.effects;
|
||||
|
||||
import com.l2jserver.gameserver.model.L2Effect;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
|
||||
import com.l2jserver.gameserver.templates.skills.L2EffectType;
|
||||
|
||||
public class EffectDamOverTime extends L2Effect
|
||||
{
|
||||
public EffectDamOverTime(Env env, EffectTemplate template)
|
||||
{
|
||||
super(env, template);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
|
||||
*/
|
||||
@Override
|
||||
public L2EffectType getEffectType()
|
||||
{
|
||||
return L2EffectType.DMG_OVER_TIME;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
|
||||
*/
|
||||
@Override
|
||||
public boolean onActionTime()
|
||||
{
|
||||
if (getEffected().isDead())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
double damage = calc();
|
||||
if (damage >= (getEffected().getCurrentHp() - 1))
|
||||
{
|
||||
if (getSkill().isToggle())
|
||||
{
|
||||
getEffected().sendPacket(SystemMessage.getSystemMessage(SystemMessageId.SKILL_REMOVED_DUE_LACK_HP));
|
||||
return false;
|
||||
}
|
||||
|
||||
// For DOT skills that will not kill effected player.
|
||||
if (!getSkill().killByDOT())
|
||||
{
|
||||
// Fix for players dying by DOTs if HP < 1 since reduceCurrentHP method will kill them
|
||||
if (getEffected().getCurrentHp() <= 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
damage = getEffected().getCurrentHp() - 1;
|
||||
}
|
||||
}
|
||||
getEffected().reduceCurrentHpByDOT(damage, getEffector(), getSkill());
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.skills.effects;
|
||||
|
||||
import com.l2jserver.gameserver.model.L2Effect;
|
||||
import com.l2jserver.gameserver.skills.Env;
|
||||
import com.l2jserver.gameserver.templates.effects.EffectTemplate;
|
||||
import com.l2jserver.gameserver.templates.skills.L2EffectType;
|
||||
|
||||
public class EffectDebuff extends L2Effect
|
||||
{
|
||||
public EffectDebuff(Env env, EffectTemplate template)
|
||||
{
|
||||
super(env, template);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
|
||||
*/
|
||||
@Override
|
||||
public L2EffectType getEffectType()
|
||||
{
|
||||
return L2EffectType.DEBUFF;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
|
||||
*/
|
||||
@Override
|
||||
public boolean onActionTime()
|
||||
{
|
||||
// just stop this effect
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user