Merged with released L2J-Unity files.
This commit is contained in:
@ -1,117 +1,78 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items;
|
||||
|
||||
import com.l2jmobius.gameserver.model.StatsSet;
|
||||
import com.l2jmobius.gameserver.model.holders.SkillHolder;
|
||||
import com.l2jmobius.gameserver.model.items.type.ArmorType;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.util.StringUtil;
|
||||
|
||||
/**
|
||||
* This class is dedicated to the management of armors.
|
||||
*/
|
||||
public final class L2Armor extends L2Item
|
||||
{
|
||||
/**
|
||||
* Skill that activates when armor is enchanted +4.
|
||||
*/
|
||||
private SkillHolder _enchant4Skill = null;
|
||||
private ArmorType _type;
|
||||
|
||||
/**
|
||||
* Constructor for Armor.
|
||||
* @param set the StatsSet designating the set of couples (key,value) characterizing the armor.
|
||||
*/
|
||||
public L2Armor(StatsSet set)
|
||||
{
|
||||
super(set);
|
||||
_type = set.getEnum("armor_type", ArmorType.class, ArmorType.NONE);
|
||||
|
||||
final int _bodyPart = getBodyPart();
|
||||
if ((_bodyPart == L2Item.SLOT_NECK) || ((_bodyPart & L2Item.SLOT_L_EAR) != 0) || ((_bodyPart & L2Item.SLOT_L_FINGER) != 0) || ((_bodyPart & L2Item.SLOT_R_BRACELET) != 0) || ((_bodyPart & L2Item.SLOT_L_BRACELET) != 0))
|
||||
{
|
||||
_type1 = L2Item.TYPE1_WEAPON_RING_EARRING_NECKLACE;
|
||||
_type2 = L2Item.TYPE2_ACCESSORY;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((_type == ArmorType.NONE) && (getBodyPart() == L2Item.SLOT_L_HAND))
|
||||
{
|
||||
_type = ArmorType.SHIELD;
|
||||
}
|
||||
_type1 = L2Item.TYPE1_SHIELD_ARMOR;
|
||||
_type2 = L2Item.TYPE2_SHIELD_ARMOR;
|
||||
}
|
||||
|
||||
final String skill = set.getString("enchant4_skill", null);
|
||||
if (skill == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final String[] info = skill.split("-");
|
||||
if ((info == null) || (info.length != 2))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int id = 0;
|
||||
int level = 0;
|
||||
try
|
||||
{
|
||||
id = Integer.parseInt(info[0]);
|
||||
level = Integer.parseInt(info[1]);
|
||||
}
|
||||
catch (Exception nfe)
|
||||
{
|
||||
// Incorrect syntax, don't add new skill
|
||||
_log.info(StringUtil.concat("> Couldnt parse ", skill, " in armor enchant skills! item ", toString()));
|
||||
}
|
||||
if ((id > 0) && (level > 0))
|
||||
{
|
||||
_enchant4Skill = new SkillHolder(id, level);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the type of the armor.
|
||||
*/
|
||||
@Override
|
||||
public ArmorType getItemType()
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the ID of the item after applying the mask.
|
||||
*/
|
||||
@Override
|
||||
public final int getItemMask()
|
||||
{
|
||||
return getItemType().mask();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return skill that player get when has equipped armor +4 or more
|
||||
*/
|
||||
@Override
|
||||
public Skill getEnchant4Skill()
|
||||
{
|
||||
return _enchant4Skill == null ? null : _enchant4Skill.getSkill();
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items;
|
||||
|
||||
import com.l2jmobius.gameserver.model.StatsSet;
|
||||
import com.l2jmobius.gameserver.model.items.type.ArmorType;
|
||||
|
||||
/**
|
||||
* This class is dedicated to the management of armors.
|
||||
*/
|
||||
public final class L2Armor extends L2Item
|
||||
{
|
||||
private ArmorType _type;
|
||||
|
||||
/**
|
||||
* Constructor for Armor.
|
||||
* @param set the StatsSet designating the set of couples (key,value) characterizing the armor.
|
||||
*/
|
||||
public L2Armor(StatsSet set)
|
||||
{
|
||||
super(set);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(StatsSet set)
|
||||
{
|
||||
super.set(set);
|
||||
_type = set.getEnum("armor_type", ArmorType.class, ArmorType.NONE);
|
||||
|
||||
final int _bodyPart = getBodyPart();
|
||||
if ((_bodyPart == L2Item.SLOT_NECK) || ((_bodyPart & L2Item.SLOT_L_EAR) != 0) || ((_bodyPart & L2Item.SLOT_L_FINGER) != 0) || ((_bodyPart & L2Item.SLOT_R_BRACELET) != 0) || ((_bodyPart & L2Item.SLOT_L_BRACELET) != 0))
|
||||
{
|
||||
_type1 = L2Item.TYPE1_WEAPON_RING_EARRING_NECKLACE;
|
||||
_type2 = L2Item.TYPE2_ACCESSORY;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((_type == ArmorType.NONE) && (getBodyPart() == L2Item.SLOT_L_HAND))
|
||||
{
|
||||
_type = ArmorType.SHIELD;
|
||||
}
|
||||
_type1 = L2Item.TYPE1_SHIELD_ARMOR;
|
||||
_type2 = L2Item.TYPE2_SHIELD_ARMOR;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the type of the armor.
|
||||
*/
|
||||
@Override
|
||||
public ArmorType getItemType()
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the ID of the item after applying the mask.
|
||||
*/
|
||||
@Override
|
||||
public final int getItemMask()
|
||||
{
|
||||
return getItemType().mask();
|
||||
}
|
||||
}
|
||||
|
@ -1,208 +1,121 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jmobius.gameserver.model.L2ExtractableProduct;
|
||||
import com.l2jmobius.gameserver.model.StatsSet;
|
||||
import com.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import com.l2jmobius.gameserver.model.items.type.EtcItemType;
|
||||
import com.l2jmobius.util.StringUtil;
|
||||
|
||||
/**
|
||||
* This class is dedicated to the management of EtcItem.
|
||||
*/
|
||||
public final class L2EtcItem extends L2Item
|
||||
{
|
||||
private String _handler;
|
||||
private EtcItemType _type;
|
||||
private final boolean _isBlessed;
|
||||
private final List<L2ExtractableProduct> _extractableItems;
|
||||
private final int _extractableCountMin;
|
||||
private final int _extractableCountMax;
|
||||
private final boolean _isInfinite;
|
||||
|
||||
/**
|
||||
* Constructor for EtcItem.
|
||||
* @param set StatsSet designating the set of couples (key,value) for description of the Etc
|
||||
*/
|
||||
public L2EtcItem(StatsSet set)
|
||||
{
|
||||
super(set);
|
||||
_type = set.getEnum("etcitem_type", EtcItemType.class, EtcItemType.NONE);
|
||||
|
||||
// l2j custom - L2EtcItemType.SHOT
|
||||
switch (getDefaultAction())
|
||||
{
|
||||
case SOULSHOT:
|
||||
case SUMMON_SOULSHOT:
|
||||
case SUMMON_SPIRITSHOT:
|
||||
case SPIRITSHOT:
|
||||
{
|
||||
_type = EtcItemType.SHOT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_type1 = L2Item.TYPE1_ITEM_QUESTITEM_ADENA;
|
||||
_type2 = L2Item.TYPE2_OTHER; // default is other
|
||||
|
||||
if (isQuestItem())
|
||||
{
|
||||
_type2 = L2Item.TYPE2_QUEST;
|
||||
}
|
||||
else if ((getId() == Inventory.ADENA_ID) || (getId() == Inventory.ANCIENT_ADENA_ID))
|
||||
{
|
||||
_type2 = L2Item.TYPE2_MONEY;
|
||||
}
|
||||
|
||||
_handler = set.getString("handler", null); // ! null !
|
||||
_isBlessed = set.getBoolean("blessed", false);
|
||||
|
||||
// Extractable
|
||||
final String capsuled_items = set.getString("capsuled_items", null);
|
||||
if (capsuled_items != null)
|
||||
{
|
||||
final String[] split = capsuled_items.split(";");
|
||||
_extractableItems = new ArrayList<>(split.length);
|
||||
for (String part : split)
|
||||
{
|
||||
if (part.trim().isEmpty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
final String[] data = part.split(",");
|
||||
if ((data.length != 4) && (data.length != 6))
|
||||
{
|
||||
_log.info(StringUtil.concat("> Couldnt parse ", part, " in capsuled_items! item ", toString()));
|
||||
continue;
|
||||
}
|
||||
final int itemId = Integer.parseInt(data[0]);
|
||||
final int min = Integer.parseInt(data[1]);
|
||||
final int max = Integer.parseInt(data[2]);
|
||||
if (max < min)
|
||||
{
|
||||
_log.info(StringUtil.concat("> Max amount < Min amount in ", part, ", item ", toString()));
|
||||
continue;
|
||||
}
|
||||
final double chance = Double.parseDouble(data[3]);
|
||||
int minEnchant = 0;
|
||||
int maxEnchant = 0;
|
||||
if (data.length == 6)
|
||||
{
|
||||
minEnchant = Integer.parseInt(data[4]);
|
||||
maxEnchant = Integer.parseInt(data[5]);
|
||||
if (maxEnchant < minEnchant)
|
||||
{
|
||||
_log.info(StringUtil.concat("> Max enchant < Min enchant in ", part, ", item ", toString()));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
_extractableItems.add(new L2ExtractableProduct(itemId, min, max, chance, minEnchant, maxEnchant));
|
||||
}
|
||||
((ArrayList<?>) _extractableItems).trimToSize();
|
||||
|
||||
// check for handler
|
||||
if (_handler == null)
|
||||
{
|
||||
_log.warning("Item " + this + " define capsuled_items but missing handler.");
|
||||
_handler = "ExtractableItems";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_extractableItems = null;
|
||||
}
|
||||
|
||||
_extractableCountMin = set.getInt("extractableCountMin", 0);
|
||||
_extractableCountMax = set.getInt("extractableCountMax", 0);
|
||||
if (_extractableCountMin > _extractableCountMax)
|
||||
{
|
||||
_log.warning("Item " + this + " extractableCountMin is bigger than extractableCountMax!");
|
||||
}
|
||||
|
||||
_isInfinite = set.getBoolean("is_infinite", false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the type of Etc Item.
|
||||
*/
|
||||
@Override
|
||||
public EtcItemType getItemType()
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the ID of the Etc item after applying the mask.
|
||||
*/
|
||||
@Override
|
||||
public int getItemMask()
|
||||
{
|
||||
return getItemType().mask();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the handler name, null if no handler for item.
|
||||
*/
|
||||
public String getHandlerName()
|
||||
{
|
||||
return _handler;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} if the item is blessed, {@code false} otherwise.
|
||||
*/
|
||||
public final boolean isBlessed()
|
||||
{
|
||||
return _isBlessed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the extractable items list.
|
||||
*/
|
||||
public List<L2ExtractableProduct> getExtractableItems()
|
||||
{
|
||||
return _extractableItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the minimum count of extractable items
|
||||
*/
|
||||
public int getExtractableCountMin()
|
||||
{
|
||||
return _extractableCountMin;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the maximum count of extractable items
|
||||
*/
|
||||
public int getExtractableCountMax()
|
||||
{
|
||||
return _extractableCountMax;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if item is infinite
|
||||
*/
|
||||
public boolean isInfinite()
|
||||
{
|
||||
return _isInfinite;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jmobius.gameserver.model.L2ExtractableProduct;
|
||||
import com.l2jmobius.gameserver.model.StatsSet;
|
||||
import com.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import com.l2jmobius.gameserver.model.items.type.EtcItemType;
|
||||
|
||||
/**
|
||||
* This class is dedicated to the management of EtcItem.
|
||||
*/
|
||||
public final class L2EtcItem extends L2Item
|
||||
{
|
||||
private String _handler;
|
||||
private EtcItemType _type;
|
||||
private List<L2ExtractableProduct> _extractableItems;
|
||||
private boolean _isInfinite;
|
||||
|
||||
/**
|
||||
* Constructor for EtcItem.
|
||||
* @param set StatsSet designating the set of couples (key,value) for description of the Etc
|
||||
*/
|
||||
public L2EtcItem(StatsSet set)
|
||||
{
|
||||
super(set);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(StatsSet set)
|
||||
{
|
||||
super.set(set);
|
||||
_type = set.getEnum("etcitem_type", EtcItemType.class, EtcItemType.NONE);
|
||||
_type1 = L2Item.TYPE1_ITEM_QUESTITEM_ADENA;
|
||||
_type2 = L2Item.TYPE2_OTHER; // default is other
|
||||
|
||||
if (isQuestItem())
|
||||
{
|
||||
_type2 = L2Item.TYPE2_QUEST;
|
||||
}
|
||||
else if ((getId() == Inventory.ADENA_ID) || (getId() == Inventory.ANCIENT_ADENA_ID))
|
||||
{
|
||||
_type2 = L2Item.TYPE2_MONEY;
|
||||
}
|
||||
|
||||
_handler = set.getString("handler", null); // ! null !
|
||||
_isInfinite = set.getBoolean("is_infinite", false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the type of Etc Item.
|
||||
*/
|
||||
@Override
|
||||
public EtcItemType getItemType()
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the ID of the Etc item after applying the mask.
|
||||
*/
|
||||
@Override
|
||||
public int getItemMask()
|
||||
{
|
||||
return getItemType().mask();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the handler name, null if no handler for item.
|
||||
*/
|
||||
public String getHandlerName()
|
||||
{
|
||||
return _handler;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the extractable items list.
|
||||
*/
|
||||
public List<L2ExtractableProduct> getExtractableItems()
|
||||
{
|
||||
return _extractableItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if item is infinite
|
||||
*/
|
||||
public boolean isInfinite()
|
||||
{
|
||||
return _isInfinite;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param extractableProduct
|
||||
*/
|
||||
@Override
|
||||
public void addCapsuledItem(L2ExtractableProduct extractableProduct)
|
||||
{
|
||||
if (_extractableItems == null)
|
||||
{
|
||||
_extractableItems = new ArrayList<>();
|
||||
}
|
||||
_extractableItems.add(extractableProduct);
|
||||
}
|
||||
}
|
||||
|
@ -1,225 +1,155 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jmobius.gameserver.model.StatsSet;
|
||||
import com.l2jmobius.gameserver.model.base.ClassId;
|
||||
import com.l2jmobius.gameserver.model.holders.SkillHolder;
|
||||
|
||||
/**
|
||||
* Class for the Henna object.
|
||||
* @author Zoey76
|
||||
*/
|
||||
public class L2Henna
|
||||
{
|
||||
private final int _dyeId;
|
||||
private final String _dyeName;
|
||||
private final int _dyeItemId;
|
||||
private final int _str;
|
||||
private final int _con;
|
||||
private final int _dex;
|
||||
private final int _int;
|
||||
private final int _men;
|
||||
private final int _wit;
|
||||
private final int _luc;
|
||||
private final int _cha;
|
||||
private final int _wear_fee;
|
||||
private final int _wear_count;
|
||||
private final int _cancel_fee;
|
||||
private final int _cancel_count;
|
||||
private final List<ClassId> _wear_class;
|
||||
private final List<SkillHolder> _skills;
|
||||
|
||||
public L2Henna(StatsSet set)
|
||||
{
|
||||
_dyeId = set.getInt("dyeId");
|
||||
_dyeName = set.getString("dyeName");
|
||||
_dyeItemId = set.getInt("dyeItemId");
|
||||
_str = set.getInt("str", 0);
|
||||
_con = set.getInt("con", 0);
|
||||
_dex = set.getInt("dex", 0);
|
||||
_int = set.getInt("int", 0);
|
||||
_men = set.getInt("men", 0);
|
||||
_wit = set.getInt("wit", 0);
|
||||
_luc = set.getInt("luc", 0);
|
||||
_cha = set.getInt("cha", 0);
|
||||
_wear_fee = set.getInt("wear_fee");
|
||||
_wear_count = set.getInt("wear_count");
|
||||
_cancel_fee = set.getInt("cancel_fee");
|
||||
_cancel_count = set.getInt("cancel_count");
|
||||
_wear_class = new ArrayList<>();
|
||||
_skills = new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the dye Id.
|
||||
*/
|
||||
public int getDyeId()
|
||||
{
|
||||
return _dyeId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the dye server-side name.
|
||||
*/
|
||||
public String getDyeName()
|
||||
{
|
||||
return _dyeName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the item Id, required for this dye.
|
||||
*/
|
||||
public int getDyeItemId()
|
||||
{
|
||||
return _dyeItemId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the STR stat.
|
||||
*/
|
||||
public int getStatSTR()
|
||||
{
|
||||
return _str;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the CON stat.
|
||||
*/
|
||||
public int getStatCON()
|
||||
{
|
||||
return _con;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the DEX stat.
|
||||
*/
|
||||
public int getStatDEX()
|
||||
{
|
||||
return _dex;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the INT stat.
|
||||
*/
|
||||
public int getStatINT()
|
||||
{
|
||||
return _int;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the MEN stat.
|
||||
*/
|
||||
public int getStatMEN()
|
||||
{
|
||||
return _men;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the WIT stat.
|
||||
*/
|
||||
public int getStatWIT()
|
||||
{
|
||||
return _wit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the LUC stat.
|
||||
*/
|
||||
public int getStatLUC()
|
||||
{
|
||||
return _luc;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the CHA stat.
|
||||
*/
|
||||
public int getStatCHA()
|
||||
{
|
||||
return _cha;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the wear fee, cost for adding this dye to the player.
|
||||
*/
|
||||
public int getWearFee()
|
||||
{
|
||||
return _wear_fee;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the wear count, the required count to add this dye to the player.
|
||||
*/
|
||||
public int getWearCount()
|
||||
{
|
||||
return _wear_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the cancel fee, cost for removing this dye from the player.
|
||||
*/
|
||||
public int getCancelFee()
|
||||
{
|
||||
return _cancel_fee;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the cancel count, the retrieved amount of dye items after removing the dye.
|
||||
*/
|
||||
public int getCancelCount()
|
||||
{
|
||||
return _cancel_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the list with the allowed classes to wear this dye.
|
||||
*/
|
||||
public List<ClassId> getAllowedWearClass()
|
||||
{
|
||||
return _wear_class;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param c the class trying to wear this dye.
|
||||
* @return {@code true} if the player is allowed to wear this dye, {@code false} otherwise.
|
||||
*/
|
||||
public boolean isAllowedClass(ClassId c)
|
||||
{
|
||||
return _wear_class.contains(c);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param wearClassIds the list of classes that can wear this dye.
|
||||
*/
|
||||
public void setWearClassIds(List<ClassId> wearClassIds)
|
||||
{
|
||||
_wear_class.addAll(wearClassIds);
|
||||
}
|
||||
|
||||
public List<SkillHolder> getSkills()
|
||||
{
|
||||
return _skills;
|
||||
}
|
||||
|
||||
public void setSkills(List<SkillHolder> skills)
|
||||
{
|
||||
_skills.addAll(skills);
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.l2jmobius.gameserver.model.StatsSet;
|
||||
import com.l2jmobius.gameserver.model.base.ClassId;
|
||||
import com.l2jmobius.gameserver.model.stats.BaseStats;
|
||||
import com.l2jmobius.gameserver.model.stats.Stats;
|
||||
|
||||
/**
|
||||
* Class for the Henna object.
|
||||
* @author Zoey76
|
||||
*/
|
||||
public class L2Henna
|
||||
{
|
||||
private final int _dyeId;
|
||||
private final String _dyeName;
|
||||
private final int _dyeItemId;
|
||||
private final Map<BaseStats, Integer> _baseStats = new HashMap<>();
|
||||
private final int _wear_fee;
|
||||
private final int _wear_count;
|
||||
private final int _cancel_fee;
|
||||
private final int _cancel_count;
|
||||
private final List<ClassId> _wear_class;
|
||||
|
||||
public L2Henna(StatsSet set)
|
||||
{
|
||||
_dyeId = set.getInt("dyeId");
|
||||
_dyeName = set.getString("dyeName");
|
||||
_dyeItemId = set.getInt("dyeItemId");
|
||||
_baseStats.put(BaseStats.STR, set.getInt("str", 0));
|
||||
_baseStats.put(BaseStats.CON, set.getInt("con", 0));
|
||||
_baseStats.put(BaseStats.DEX, set.getInt("dex", 0));
|
||||
_baseStats.put(BaseStats.INT, set.getInt("int", 0));
|
||||
_baseStats.put(BaseStats.MEN, set.getInt("men", 0));
|
||||
_baseStats.put(BaseStats.WIT, set.getInt("wit", 0));
|
||||
_baseStats.put(BaseStats.LUC, set.getInt("luc", 0));
|
||||
_baseStats.put(BaseStats.CHA, set.getInt("cha", 0));
|
||||
_wear_fee = set.getInt("wear_fee");
|
||||
_wear_count = set.getInt("wear_count");
|
||||
_cancel_fee = set.getInt("cancel_fee");
|
||||
_cancel_count = set.getInt("cancel_count");
|
||||
_wear_class = new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the dye Id.
|
||||
*/
|
||||
public int getDyeId()
|
||||
{
|
||||
return _dyeId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the dye server-side name.
|
||||
*/
|
||||
public String getDyeName()
|
||||
{
|
||||
return _dyeName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the item Id, required for this dye.
|
||||
*/
|
||||
public int getDyeItemId()
|
||||
{
|
||||
return _dyeItemId;
|
||||
}
|
||||
|
||||
public int getBaseStats(Stats stat)
|
||||
{
|
||||
return _baseStats.getOrDefault(stat, 0);
|
||||
}
|
||||
|
||||
public Map<BaseStats, Integer> getBaseStats()
|
||||
{
|
||||
return _baseStats;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the wear fee, cost for adding this dye to the player.
|
||||
*/
|
||||
public int getWearFee()
|
||||
{
|
||||
return _wear_fee;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the wear count, the required count to add this dye to the player.
|
||||
*/
|
||||
public int getWearCount()
|
||||
{
|
||||
return _wear_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the cancel fee, cost for removing this dye from the player.
|
||||
*/
|
||||
public int getCancelFee()
|
||||
{
|
||||
return _cancel_fee;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the cancel count, the retrieved amount of dye items after removing the dye.
|
||||
*/
|
||||
public int getCancelCount()
|
||||
{
|
||||
return _cancel_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the list with the allowed classes to wear this dye.
|
||||
*/
|
||||
public List<ClassId> getAllowedWearClass()
|
||||
{
|
||||
return _wear_class;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param c the class trying to wear this dye.
|
||||
* @return {@code true} if the player is allowed to wear this dye, {@code false} otherwise.
|
||||
*/
|
||||
public boolean isAllowedClass(ClassId c)
|
||||
{
|
||||
return _wear_class.contains(c);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param wearClassIds the list of classes that can wear this dye.
|
||||
*/
|
||||
public void setWearClassIds(List<ClassId> wearClassIds)
|
||||
{
|
||||
_wear_class.addAll(wearClassIds);
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,324 +1,315 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items;
|
||||
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.items.type.CrystalType;
|
||||
import com.l2jmobius.gameserver.model.items.type.ItemType;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.ensoul.SoulCrystalOption;
|
||||
|
||||
/**
|
||||
* This class contains L2ItemInstance<BR>
|
||||
* Use to sort L2ItemInstance of :
|
||||
* <ul>
|
||||
* <li>L2Armor</li>
|
||||
* <li>L2EtcItem</li>
|
||||
* <li>L2Weapon</li>
|
||||
* </ul>
|
||||
* @version $Revision: 1.7.2.2.2.5 $ $Date: 2005/04/06 18:25:18 $
|
||||
*/
|
||||
public class L2WarehouseItem
|
||||
{
|
||||
private final L2Item _item;
|
||||
private final int _object;
|
||||
private final long _count;
|
||||
private final int _owner;
|
||||
private final int _locationSlot;
|
||||
private final int _enchant;
|
||||
private final CrystalType _grade;
|
||||
private boolean _isAugmented;
|
||||
private int _augmentationId;
|
||||
private final int _customType1;
|
||||
private final int _customType2;
|
||||
private final int _mana;
|
||||
|
||||
private int _elemAtkType = -2;
|
||||
private int _elemAtkPower = 0;
|
||||
|
||||
private final int[] _elemDefAttr =
|
||||
{
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
|
||||
private final int[] _enchantOptions;
|
||||
|
||||
private final int _time;
|
||||
|
||||
private SoulCrystalOption[] _commonSoulCrystalOptions;
|
||||
private SoulCrystalOption _specialSoulCrystalOption;
|
||||
|
||||
public L2WarehouseItem(L2ItemInstance item)
|
||||
{
|
||||
_item = item.getItem();
|
||||
_object = item.getObjectId();
|
||||
_count = item.getCount();
|
||||
_owner = item.getOwnerId();
|
||||
_locationSlot = item.getLocationSlot();
|
||||
_enchant = item.getEnchantLevel();
|
||||
_customType1 = item.getCustomType1();
|
||||
_customType2 = item.getCustomType2();
|
||||
_grade = item.getItem().getCrystalType();
|
||||
if (item.isAugmented())
|
||||
{
|
||||
_isAugmented = true;
|
||||
_augmentationId = item.getAugmentation().getAugmentationId();
|
||||
}
|
||||
else
|
||||
{
|
||||
_isAugmented = false;
|
||||
}
|
||||
_mana = item.getMana();
|
||||
_time = item.isTimeLimitedItem() ? (int) (item.getRemainingTime() / 1000) : -1;
|
||||
|
||||
_elemAtkType = item.getAttackElementType();
|
||||
_elemAtkPower = item.getAttackElementPower();
|
||||
for (byte i = 0; i < 6; i++)
|
||||
{
|
||||
_elemDefAttr[i] = item.getElementDefAttr(i);
|
||||
}
|
||||
_enchantOptions = item.getEnchantOptions();
|
||||
|
||||
_commonSoulCrystalOptions = item.getCommonSoulCrystalOptions();
|
||||
_specialSoulCrystalOption = item.getSpecialSoulCrystalOption();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the item.
|
||||
*/
|
||||
public L2Item getItem()
|
||||
{
|
||||
return _item;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the unique objectId.
|
||||
*/
|
||||
public final int getObjectId()
|
||||
{
|
||||
return _object;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the owner.
|
||||
*/
|
||||
public final int getOwnerId()
|
||||
{
|
||||
return _owner;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the location slot.
|
||||
*/
|
||||
public final int getLocationSlot()
|
||||
{
|
||||
return _locationSlot;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the count.
|
||||
*/
|
||||
public final long getCount()
|
||||
{
|
||||
return _count;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the first type.
|
||||
*/
|
||||
public final int getType1()
|
||||
{
|
||||
return _item.getType1();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the second type.
|
||||
*/
|
||||
public final int getType2()
|
||||
{
|
||||
return _item.getType2();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the second type.
|
||||
*/
|
||||
public final ItemType getItemType()
|
||||
{
|
||||
return _item.getItemType();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the ItemId.
|
||||
*/
|
||||
public final int getItemId()
|
||||
{
|
||||
return _item.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the part of body used with this item.
|
||||
*/
|
||||
public final int getBodyPart()
|
||||
{
|
||||
return _item.getBodyPart();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the enchant level.
|
||||
*/
|
||||
public final int getEnchantLevel()
|
||||
{
|
||||
return _enchant;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the item grade
|
||||
*/
|
||||
public final CrystalType getItemGrade()
|
||||
{
|
||||
return _grade;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} if the item is a weapon, {@code false} otherwise.
|
||||
*/
|
||||
public final boolean isWeapon()
|
||||
{
|
||||
return _item instanceof L2Weapon;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} if the item is an armor, {@code false} otherwise.
|
||||
*/
|
||||
public final boolean isArmor()
|
||||
{
|
||||
return _item instanceof L2Armor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} if the item is an etc item, {@code false} otherwise.
|
||||
*/
|
||||
public final boolean isEtcItem()
|
||||
{
|
||||
return _item instanceof L2EtcItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name of the item
|
||||
*/
|
||||
public String getItemName()
|
||||
{
|
||||
return _item.getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} if the item is augmented, {@code false} otherwise.
|
||||
*/
|
||||
public boolean isAugmented()
|
||||
{
|
||||
return _isAugmented;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the augmentation If.
|
||||
*/
|
||||
public int getAugmentationId()
|
||||
{
|
||||
return _augmentationId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name of the item
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return _item.getName();
|
||||
}
|
||||
|
||||
public final int getCustomType1()
|
||||
{
|
||||
return _customType1;
|
||||
}
|
||||
|
||||
public final int getCustomType2()
|
||||
{
|
||||
return _customType2;
|
||||
}
|
||||
|
||||
public final int getMana()
|
||||
{
|
||||
return _mana;
|
||||
}
|
||||
|
||||
public int getAttackElementType()
|
||||
{
|
||||
return _elemAtkType;
|
||||
}
|
||||
|
||||
public int getAttackElementPower()
|
||||
{
|
||||
return _elemAtkPower;
|
||||
}
|
||||
|
||||
public int getElementDefAttr(byte i)
|
||||
{
|
||||
return _elemDefAttr[i];
|
||||
}
|
||||
|
||||
public int[] getEnchantOptions()
|
||||
{
|
||||
return _enchantOptions;
|
||||
}
|
||||
|
||||
public int getTime()
|
||||
{
|
||||
return _time;
|
||||
}
|
||||
|
||||
public SoulCrystalOption[] getCommonSoulCrystalOptions()
|
||||
{
|
||||
return _commonSoulCrystalOptions;
|
||||
}
|
||||
|
||||
public void setSoulCrystalOptions(SoulCrystalOption[] options)
|
||||
{
|
||||
_commonSoulCrystalOptions = options;
|
||||
}
|
||||
|
||||
public SoulCrystalOption getSpecialSoulCrystalOption()
|
||||
{
|
||||
return _specialSoulCrystalOption;
|
||||
}
|
||||
|
||||
public void setSpecialSoulCrystalOption(SoulCrystalOption option)
|
||||
{
|
||||
_specialSoulCrystalOption = option;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name of the item
|
||||
*/
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return _item.toString();
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import com.l2jmobius.gameserver.enums.AttributeType;
|
||||
import com.l2jmobius.gameserver.model.ensoul.EnsoulOption;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.items.type.CrystalType;
|
||||
import com.l2jmobius.gameserver.model.items.type.ItemType;
|
||||
|
||||
/**
|
||||
* This class contains L2ItemInstance<BR>
|
||||
* Use to sort L2ItemInstance of :
|
||||
* <ul>
|
||||
* <li>L2Armor</li>
|
||||
* <li>L2EtcItem</li>
|
||||
* <li>L2Weapon</li>
|
||||
* </ul>
|
||||
* @version $Revision: 1.7.2.2.2.5 $ $Date: 2005/04/06 18:25:18 $
|
||||
*/
|
||||
public class L2WarehouseItem
|
||||
{
|
||||
private final L2Item _item;
|
||||
private final int _object;
|
||||
private final long _count;
|
||||
private final int _owner;
|
||||
private final int _locationSlot;
|
||||
private final int _enchant;
|
||||
private final CrystalType _grade;
|
||||
private boolean _isAugmented;
|
||||
private int _augmentationId;
|
||||
private final int _customType1;
|
||||
private final int _customType2;
|
||||
private final int _mana;
|
||||
|
||||
private byte _elemAtkType = -2;
|
||||
private int _elemAtkPower = 0;
|
||||
|
||||
private final int[] _elemDefAttr =
|
||||
{
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
|
||||
private final int[] _enchantOptions;
|
||||
private final Collection<EnsoulOption> _soulCrystalOptions;
|
||||
private final Collection<EnsoulOption> _soulCrystalSpecialOptions;
|
||||
|
||||
private final int _time;
|
||||
|
||||
public L2WarehouseItem(L2ItemInstance item)
|
||||
{
|
||||
_item = item.getItem();
|
||||
_object = item.getObjectId();
|
||||
_count = item.getCount();
|
||||
_owner = item.getOwnerId();
|
||||
_locationSlot = item.getLocationSlot();
|
||||
_enchant = item.getEnchantLevel();
|
||||
_customType1 = item.getCustomType1();
|
||||
_customType2 = item.getCustomType2();
|
||||
_grade = item.getItem().getCrystalType();
|
||||
if (item.isAugmented())
|
||||
{
|
||||
_isAugmented = true;
|
||||
_augmentationId = item.getAugmentation().getId();
|
||||
}
|
||||
else
|
||||
{
|
||||
_isAugmented = false;
|
||||
}
|
||||
_mana = item.getMana();
|
||||
_time = item.isTimeLimitedItem() ? (int) (item.getRemainingTime() / 1000) : -1;
|
||||
|
||||
_elemAtkType = item.getAttackAttributeType().getClientId();
|
||||
_elemAtkPower = item.getAttackAttributePower();
|
||||
for (AttributeType type : AttributeType.ATTRIBUTE_TYPES)
|
||||
{
|
||||
_elemDefAttr[type.getClientId()] = item.getDefenceAttribute(type);
|
||||
}
|
||||
_enchantOptions = item.getEnchantOptions();
|
||||
_soulCrystalOptions = item.getSpecialAbilities();
|
||||
_soulCrystalSpecialOptions = item.getAdditionalSpecialAbilities();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the item.
|
||||
*/
|
||||
public L2Item getItem()
|
||||
{
|
||||
return _item;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the unique objectId.
|
||||
*/
|
||||
public final int getObjectId()
|
||||
{
|
||||
return _object;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the owner.
|
||||
*/
|
||||
public final int getOwnerId()
|
||||
{
|
||||
return _owner;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the location slot.
|
||||
*/
|
||||
public final int getLocationSlot()
|
||||
{
|
||||
return _locationSlot;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the count.
|
||||
*/
|
||||
public final long getCount()
|
||||
{
|
||||
return _count;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the first type.
|
||||
*/
|
||||
public final int getType1()
|
||||
{
|
||||
return _item.getType1();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the second type.
|
||||
*/
|
||||
public final int getType2()
|
||||
{
|
||||
return _item.getType2();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the second type.
|
||||
*/
|
||||
public final ItemType getItemType()
|
||||
{
|
||||
return _item.getItemType();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the ItemId.
|
||||
*/
|
||||
public final int getItemId()
|
||||
{
|
||||
return _item.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the part of body used with this item.
|
||||
*/
|
||||
public final int getBodyPart()
|
||||
{
|
||||
return _item.getBodyPart();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the enchant level.
|
||||
*/
|
||||
public final int getEnchantLevel()
|
||||
{
|
||||
return _enchant;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the item grade
|
||||
*/
|
||||
public final CrystalType getItemGrade()
|
||||
{
|
||||
return _grade;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} if the item is a weapon, {@code false} otherwise.
|
||||
*/
|
||||
public final boolean isWeapon()
|
||||
{
|
||||
return (_item instanceof L2Weapon);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} if the item is an armor, {@code false} otherwise.
|
||||
*/
|
||||
public final boolean isArmor()
|
||||
{
|
||||
return (_item instanceof L2Armor);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} if the item is an etc item, {@code false} otherwise.
|
||||
*/
|
||||
public final boolean isEtcItem()
|
||||
{
|
||||
return (_item instanceof L2EtcItem);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name of the item
|
||||
*/
|
||||
public String getItemName()
|
||||
{
|
||||
return _item.getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} if the item is augmented, {@code false} otherwise.
|
||||
*/
|
||||
public boolean isAugmented()
|
||||
{
|
||||
return _isAugmented;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the augmentation If.
|
||||
*/
|
||||
public int getAugmentationId()
|
||||
{
|
||||
return _augmentationId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name of the item
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return _item.getName();
|
||||
}
|
||||
|
||||
public final int getCustomType1()
|
||||
{
|
||||
return _customType1;
|
||||
}
|
||||
|
||||
public final int getCustomType2()
|
||||
{
|
||||
return _customType2;
|
||||
}
|
||||
|
||||
public final int getMana()
|
||||
{
|
||||
return _mana;
|
||||
}
|
||||
|
||||
public byte getAttackElementType()
|
||||
{
|
||||
return _elemAtkType;
|
||||
}
|
||||
|
||||
public int getAttackElementPower()
|
||||
{
|
||||
return _elemAtkPower;
|
||||
}
|
||||
|
||||
public int getElementDefAttr(byte i)
|
||||
{
|
||||
return _elemDefAttr[i];
|
||||
}
|
||||
|
||||
public int[] getEnchantOptions()
|
||||
{
|
||||
return _enchantOptions;
|
||||
}
|
||||
|
||||
public Collection<EnsoulOption> getSoulCrystalOptions()
|
||||
{
|
||||
return _soulCrystalOptions;
|
||||
}
|
||||
|
||||
public Collection<EnsoulOption> getSoulCrystalSpecialOptions()
|
||||
{
|
||||
return _soulCrystalSpecialOptions;
|
||||
}
|
||||
|
||||
public int getTime()
|
||||
{
|
||||
return _time;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name of the item
|
||||
*/
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return _item.toString();
|
||||
}
|
||||
}
|
||||
|
@ -1,453 +1,307 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import com.l2jmobius.gameserver.model.StatsSet;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.conditions.Condition;
|
||||
import com.l2jmobius.gameserver.model.conditions.ConditionGameChance;
|
||||
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcSkillSee;
|
||||
import com.l2jmobius.gameserver.model.holders.SkillHolder;
|
||||
import com.l2jmobius.gameserver.model.items.type.WeaponType;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.stats.Formulas;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
import com.l2jmobius.util.StringUtil;
|
||||
|
||||
/**
|
||||
* This class is dedicated to the management of weapons.
|
||||
*/
|
||||
public final class L2Weapon extends L2Item
|
||||
{
|
||||
private final WeaponType _type;
|
||||
private final boolean _isMagicWeapon;
|
||||
private final int _rndDam;
|
||||
private final int _soulShotCount;
|
||||
private final int _spiritShotCount;
|
||||
private final int _mpConsume;
|
||||
private final int _baseAttackRange;
|
||||
private final int _baseAttackAngle;
|
||||
/**
|
||||
* Skill that activates when item is enchanted +4 (for duals).
|
||||
*/
|
||||
private SkillHolder _enchant4Skill = null;
|
||||
private final int _changeWeaponId;
|
||||
|
||||
// Attached skills for Special Abilities
|
||||
private SkillHolder _skillsOnMagic;
|
||||
private Condition _skillsOnMagicCondition = null;
|
||||
private SkillHolder _skillsOnCrit;
|
||||
private Condition _skillsOnCritCondition = null;
|
||||
|
||||
private final int _reducedSoulshot;
|
||||
private final int _reducedSoulshotChance;
|
||||
|
||||
private final int _reducedMpConsume;
|
||||
private final int _reducedMpConsumeChance;
|
||||
|
||||
private final boolean _isForceEquip;
|
||||
private final boolean _isAttackWeapon;
|
||||
private final boolean _useWeaponSkillsOnly;
|
||||
|
||||
/**
|
||||
* Constructor for Weapon.
|
||||
* @param set the StatsSet designating the set of couples (key,value) characterizing the weapon.
|
||||
*/
|
||||
public L2Weapon(StatsSet set)
|
||||
{
|
||||
super(set);
|
||||
_type = WeaponType.valueOf(set.getString("weapon_type", "none").toUpperCase());
|
||||
_type1 = L2Item.TYPE1_WEAPON_RING_EARRING_NECKLACE;
|
||||
_type2 = L2Item.TYPE2_WEAPON;
|
||||
_isMagicWeapon = set.getBoolean("is_magic_weapon", false);
|
||||
_soulShotCount = set.getInt("soulshots", 0);
|
||||
_spiritShotCount = set.getInt("spiritshots", 0);
|
||||
_rndDam = set.getInt("random_damage", 0);
|
||||
_mpConsume = set.getInt("mp_consume", 0);
|
||||
_baseAttackRange = set.getInt("attack_range", 40);
|
||||
final String[] damgeRange = set.getString("damage_range", "").split(";"); // 0?;0?;fan sector;base attack angle
|
||||
_baseAttackAngle = (damgeRange.length > 1) && Util.isDigit(damgeRange[3]) ? Integer.parseInt(damgeRange[3]) : 120;
|
||||
|
||||
final String[] reduced_soulshots = set.getString("reduced_soulshot", "").split(",");
|
||||
_reducedSoulshotChance = (reduced_soulshots.length == 2) ? Integer.parseInt(reduced_soulshots[0]) : 0;
|
||||
_reducedSoulshot = (reduced_soulshots.length == 2) ? Integer.parseInt(reduced_soulshots[1]) : 0;
|
||||
|
||||
final String[] reduced_mpconsume = set.getString("reduced_mp_consume", "").split(",");
|
||||
_reducedMpConsumeChance = (reduced_mpconsume.length == 2) ? Integer.parseInt(reduced_mpconsume[0]) : 0;
|
||||
_reducedMpConsume = (reduced_mpconsume.length == 2) ? Integer.parseInt(reduced_mpconsume[1]) : 0;
|
||||
|
||||
String skill = set.getString("enchant4_skill", null);
|
||||
if (skill != null)
|
||||
{
|
||||
final String[] info = skill.split("-");
|
||||
|
||||
if ((info != null) && (info.length == 2))
|
||||
{
|
||||
int id = 0;
|
||||
int level = 0;
|
||||
try
|
||||
{
|
||||
id = Integer.parseInt(info[0]);
|
||||
level = Integer.parseInt(info[1]);
|
||||
}
|
||||
catch (Exception nfe)
|
||||
{
|
||||
// Incorrect syntax, dont add new skill
|
||||
_log.info(StringUtil.concat("> Couldnt parse ", skill, " in weapon enchant skills! item ", toString()));
|
||||
}
|
||||
if ((id > 0) && (level > 0))
|
||||
{
|
||||
_enchant4Skill = new SkillHolder(id, level);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
skill = set.getString("onmagic_skill", null);
|
||||
if (skill != null)
|
||||
{
|
||||
final String[] info = skill.split("-");
|
||||
final int chance = set.getInt("onmagic_chance", 100);
|
||||
if ((info != null) && (info.length == 2))
|
||||
{
|
||||
int id = 0;
|
||||
int level = 0;
|
||||
try
|
||||
{
|
||||
id = Integer.parseInt(info[0]);
|
||||
level = Integer.parseInt(info[1]);
|
||||
}
|
||||
catch (Exception nfe)
|
||||
{
|
||||
// Incorrect syntax, don't add new skill
|
||||
_log.info(StringUtil.concat("> Couldnt parse ", skill, " in weapon onmagic skills! item ", toString()));
|
||||
}
|
||||
if ((id > 0) && (level > 0) && (chance > 0))
|
||||
{
|
||||
_skillsOnMagic = new SkillHolder(id, level);
|
||||
_skillsOnMagicCondition = new ConditionGameChance(chance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
skill = set.getString("oncrit_skill", null);
|
||||
if (skill != null)
|
||||
{
|
||||
final String[] info = skill.split("-");
|
||||
final int chance = set.getInt("oncrit_chance", 100);
|
||||
if ((info != null) && (info.length == 2))
|
||||
{
|
||||
int id = 0;
|
||||
int level = 0;
|
||||
try
|
||||
{
|
||||
id = Integer.parseInt(info[0]);
|
||||
level = Integer.parseInt(info[1]);
|
||||
}
|
||||
catch (Exception nfe)
|
||||
{
|
||||
// Incorrect syntax, don't add new skill
|
||||
_log.info(StringUtil.concat("> Couldnt parse ", skill, " in weapon oncrit skills! item ", toString()));
|
||||
}
|
||||
if ((id > 0) && (level > 0) && (chance > 0))
|
||||
{
|
||||
_skillsOnCrit = new SkillHolder(id, level);
|
||||
_skillsOnCritCondition = new ConditionGameChance(chance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_changeWeaponId = set.getInt("change_weaponId", 0);
|
||||
_isForceEquip = set.getBoolean("isForceEquip", false);
|
||||
_isAttackWeapon = set.getBoolean("isAttackWeapon", true);
|
||||
_useWeaponSkillsOnly = set.getBoolean("useWeaponSkillsOnly", false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the type of Weapon
|
||||
*/
|
||||
@Override
|
||||
public WeaponType getItemType()
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the ID of the Etc item after applying the mask.
|
||||
*/
|
||||
@Override
|
||||
public int getItemMask()
|
||||
{
|
||||
return getItemType().mask();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} if the weapon is magic, {@code false} otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean isMagicWeapon()
|
||||
{
|
||||
return _isMagicWeapon;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the quantity of SoulShot used.
|
||||
*/
|
||||
public int getSoulShotCount()
|
||||
{
|
||||
return _soulShotCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the quantity of SpiritShot used.
|
||||
*/
|
||||
public int getSpiritShotCount()
|
||||
{
|
||||
return _spiritShotCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the reduced quantity of SoultShot used.
|
||||
*/
|
||||
public int getReducedSoulShot()
|
||||
{
|
||||
return _reducedSoulshot;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the chance to use Reduced SoultShot.
|
||||
*/
|
||||
public int getReducedSoulShotChance()
|
||||
{
|
||||
return _reducedSoulshotChance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the random damage inflicted by the weapon.
|
||||
*/
|
||||
public int getRandomDamage()
|
||||
{
|
||||
return _rndDam;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the MP consumption with the weapon.
|
||||
*/
|
||||
public int getMpConsume()
|
||||
{
|
||||
return _mpConsume;
|
||||
}
|
||||
|
||||
public int getBaseAttackRange()
|
||||
{
|
||||
return _baseAttackRange;
|
||||
}
|
||||
|
||||
public int getBaseAttackAngle()
|
||||
{
|
||||
return _baseAttackAngle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the reduced MP consumption with the weapon.
|
||||
*/
|
||||
public int getReducedMpConsume()
|
||||
{
|
||||
return _reducedMpConsume;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the chance to use getReducedMpConsume()
|
||||
*/
|
||||
public int getReducedMpConsumeChance()
|
||||
{
|
||||
return _reducedMpConsumeChance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the skill that player get when has equipped weapon +4 or more (for duals SA).
|
||||
*/
|
||||
@Override
|
||||
public Skill getEnchant4Skill()
|
||||
{
|
||||
return _enchant4Skill == null ? null : _enchant4Skill.getSkill();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the Id in which weapon this weapon can be changed.
|
||||
*/
|
||||
public int getChangeWeaponId()
|
||||
{
|
||||
return _changeWeaponId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} if the weapon is force equip, {@code false} otherwise.
|
||||
*/
|
||||
public boolean isForceEquip()
|
||||
{
|
||||
return _isForceEquip;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} if the weapon is attack weapon, {@code false} otherwise.
|
||||
*/
|
||||
public boolean isAttackWeapon()
|
||||
{
|
||||
return _isAttackWeapon;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} if the weapon is skills only, {@code false} otherwise.
|
||||
*/
|
||||
public boolean useWeaponSkillsOnly()
|
||||
{
|
||||
return _useWeaponSkillsOnly;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param caster the L2Character pointing out the caster
|
||||
* @param target the L2Character pointing out the target
|
||||
*/
|
||||
public void castOnCriticalSkill(L2Character caster, L2Character target)
|
||||
{
|
||||
if (_skillsOnCrit == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final Skill onCritSkill = _skillsOnCrit.getSkill();
|
||||
if ((_skillsOnCritCondition != null) && !_skillsOnCritCondition.test(caster, target, onCritSkill))
|
||||
{
|
||||
// Chance not met
|
||||
return;
|
||||
}
|
||||
|
||||
if (!onCritSkill.checkCondition(caster, target, false))
|
||||
{
|
||||
// Skill condition not met
|
||||
return;
|
||||
}
|
||||
|
||||
onCritSkill.activateSkill(caster, target);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param caster the L2Character pointing out the caster
|
||||
* @param target the L2Character pointing out the target
|
||||
* @param trigger the L2Skill pointing out the skill triggering this action
|
||||
*/
|
||||
public void castOnMagicSkill(L2Character caster, L2Character target, Skill trigger)
|
||||
{
|
||||
if (_skillsOnMagic == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final Skill onMagicSkill = _skillsOnMagic.getSkill();
|
||||
|
||||
// Trigger only if both are good or bad magic.
|
||||
if (trigger.isBad() != onMagicSkill.isBad())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// No Trigger if not Magic Skill
|
||||
if (!trigger.isMagic() && !onMagicSkill.isMagic())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (trigger.isToggle())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (caster.getAI().getCastTarget() != target)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ((_skillsOnMagicCondition != null) && !_skillsOnMagicCondition.test(caster, target, onMagicSkill))
|
||||
{
|
||||
// Chance not met
|
||||
return;
|
||||
}
|
||||
|
||||
if (!onMagicSkill.checkCondition(caster, target, false))
|
||||
{
|
||||
// Skill condition not met
|
||||
return;
|
||||
}
|
||||
|
||||
if (onMagicSkill.isBad() && (Formulas.calcShldUse(caster, target, onMagicSkill) == Formulas.SHIELD_DEFENSE_PERFECT_BLOCK))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Launch the magic skill and calculate its effects
|
||||
// Get the skill handler corresponding to the skill type
|
||||
onMagicSkill.activateSkill(caster, target);
|
||||
|
||||
// notify quests of a skill use
|
||||
if (caster instanceof L2PcInstance)
|
||||
{
|
||||
final L2Character[] targets =
|
||||
{
|
||||
target
|
||||
};
|
||||
|
||||
//@formatter:off
|
||||
caster.getKnownList().getKnownObjects().values().stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(npc -> npc.isNpc())
|
||||
.filter(npc -> Util.checkIfInRange(1000, npc, caster, false))
|
||||
.forEach(npc ->
|
||||
{
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnNpcSkillSee((L2Npc) npc, caster.getActingPlayer(), onMagicSkill, targets, false), npc);
|
||||
});
|
||||
//@formatter:on
|
||||
}
|
||||
if (caster.isPlayer())
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_HAS_BEEN_ACTIVATED);
|
||||
sm.addSkillName(onMagicSkill);
|
||||
caster.sendPacket(sm);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isRange()
|
||||
{
|
||||
return isBow() || isCrossBow();
|
||||
}
|
||||
|
||||
public boolean isBow()
|
||||
{
|
||||
return _type == WeaponType.BOW;
|
||||
}
|
||||
|
||||
public boolean isCrossBow()
|
||||
{
|
||||
return _type == WeaponType.CROSSBOW;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items;
|
||||
|
||||
import com.l2jmobius.commons.util.Rnd;
|
||||
import com.l2jmobius.gameserver.enums.ItemSkillType;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.StatsSet;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcSkillSee;
|
||||
import com.l2jmobius.gameserver.model.items.type.WeaponType;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.stats.Formulas;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* This class is dedicated to the management of weapons.
|
||||
*/
|
||||
public final class L2Weapon extends L2Item
|
||||
{
|
||||
private WeaponType _type;
|
||||
private boolean _isMagicWeapon;
|
||||
private int _soulShotCount;
|
||||
private int _spiritShotCount;
|
||||
private int _mpConsume;
|
||||
private int _baseAttackRange;
|
||||
private int _baseAttackRadius;
|
||||
private int _baseAttackAngle;
|
||||
private int _changeWeaponId;
|
||||
|
||||
private int _reducedSoulshot;
|
||||
private int _reducedSoulshotChance;
|
||||
|
||||
private int _reducedMpConsume;
|
||||
private int _reducedMpConsumeChance;
|
||||
|
||||
private boolean _isForceEquip;
|
||||
private boolean _isAttackWeapon;
|
||||
private boolean _useWeaponSkillsOnly;
|
||||
|
||||
/**
|
||||
* Constructor for Weapon.
|
||||
* @param set the StatsSet designating the set of couples (key,value) characterizing the weapon.
|
||||
*/
|
||||
public L2Weapon(StatsSet set)
|
||||
{
|
||||
super(set);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(StatsSet set)
|
||||
{
|
||||
super.set(set);
|
||||
_type = WeaponType.valueOf(set.getString("weapon_type", "none").toUpperCase());
|
||||
_type1 = L2Item.TYPE1_WEAPON_RING_EARRING_NECKLACE;
|
||||
_type2 = L2Item.TYPE2_WEAPON;
|
||||
_isMagicWeapon = set.getBoolean("is_magic_weapon", false);
|
||||
_soulShotCount = set.getInt("soulshots", 0);
|
||||
_spiritShotCount = set.getInt("spiritshots", 0);
|
||||
_mpConsume = set.getInt("mp_consume", 0);
|
||||
_baseAttackRange = set.getInt("attack_range", 40);
|
||||
final String[] damgeRange = set.getString("damage_range", "").split(";"); // 0?;0?;fan sector;base attack angle
|
||||
if ((damgeRange.length > 1) && Util.isDigit(damgeRange[2]) && Util.isDigit(damgeRange[3]))
|
||||
{
|
||||
_baseAttackRadius = Integer.parseInt(damgeRange[2]);
|
||||
_baseAttackAngle = Integer.parseInt(damgeRange[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
_baseAttackRadius = 40;
|
||||
_baseAttackAngle = 120;
|
||||
}
|
||||
|
||||
final String[] reduced_soulshots = set.getString("reduced_soulshot", "").split(",");
|
||||
_reducedSoulshotChance = (reduced_soulshots.length == 2) ? Integer.parseInt(reduced_soulshots[0]) : 0;
|
||||
_reducedSoulshot = (reduced_soulshots.length == 2) ? Integer.parseInt(reduced_soulshots[1]) : 0;
|
||||
|
||||
final String[] reduced_mpconsume = set.getString("reduced_mp_consume", "").split(",");
|
||||
_reducedMpConsumeChance = (reduced_mpconsume.length == 2) ? Integer.parseInt(reduced_mpconsume[0]) : 0;
|
||||
_reducedMpConsume = (reduced_mpconsume.length == 2) ? Integer.parseInt(reduced_mpconsume[1]) : 0;
|
||||
|
||||
_changeWeaponId = set.getInt("change_weaponId", 0);
|
||||
_isForceEquip = set.getBoolean("isForceEquip", false);
|
||||
_isAttackWeapon = set.getBoolean("isAttackWeapon", true);
|
||||
_useWeaponSkillsOnly = set.getBoolean("useWeaponSkillsOnly", false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the type of Weapon
|
||||
*/
|
||||
@Override
|
||||
public WeaponType getItemType()
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the ID of the Etc item after applying the mask.
|
||||
*/
|
||||
@Override
|
||||
public int getItemMask()
|
||||
{
|
||||
return getItemType().mask();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} if the weapon is magic, {@code false} otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean isMagicWeapon()
|
||||
{
|
||||
return _isMagicWeapon;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the quantity of SoulShot used.
|
||||
*/
|
||||
public int getSoulShotCount()
|
||||
{
|
||||
return _soulShotCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the quantity of SpiritShot used.
|
||||
*/
|
||||
public int getSpiritShotCount()
|
||||
{
|
||||
return _spiritShotCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the reduced quantity of SoultShot used.
|
||||
*/
|
||||
public int getReducedSoulShot()
|
||||
{
|
||||
return _reducedSoulshot;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the chance to use Reduced SoultShot.
|
||||
*/
|
||||
public int getReducedSoulShotChance()
|
||||
{
|
||||
return _reducedSoulshotChance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the MP consumption with the weapon.
|
||||
*/
|
||||
public int getMpConsume()
|
||||
{
|
||||
return _mpConsume;
|
||||
}
|
||||
|
||||
public int getBaseAttackRange()
|
||||
{
|
||||
return _baseAttackRange;
|
||||
}
|
||||
|
||||
public int getBaseAttackRadius()
|
||||
{
|
||||
return _baseAttackRadius;
|
||||
}
|
||||
|
||||
public int getBaseAttackAngle()
|
||||
{
|
||||
return _baseAttackAngle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the reduced MP consumption with the weapon.
|
||||
*/
|
||||
public int getReducedMpConsume()
|
||||
{
|
||||
return _reducedMpConsume;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the chance to use getReducedMpConsume()
|
||||
*/
|
||||
public int getReducedMpConsumeChance()
|
||||
{
|
||||
return _reducedMpConsumeChance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the Id in which weapon this weapon can be changed.
|
||||
*/
|
||||
public int getChangeWeaponId()
|
||||
{
|
||||
return _changeWeaponId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} if the weapon is force equip, {@code false} otherwise.
|
||||
*/
|
||||
public boolean isForceEquip()
|
||||
{
|
||||
return _isForceEquip;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} if the weapon is attack weapon, {@code false} otherwise.
|
||||
*/
|
||||
public boolean isAttackWeapon()
|
||||
{
|
||||
return _isAttackWeapon;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} if the weapon is skills only, {@code false} otherwise.
|
||||
*/
|
||||
public boolean useWeaponSkillsOnly()
|
||||
{
|
||||
return _useWeaponSkillsOnly;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param caster the L2Character pointing out the caster
|
||||
* @param target the L2Character pointing out the target
|
||||
* @param trigger
|
||||
* @param type
|
||||
*/
|
||||
public void applyConditionalSkills(L2Character caster, L2Character target, Skill trigger, ItemSkillType type)
|
||||
{
|
||||
forEachSkill(type, holder ->
|
||||
{
|
||||
final Skill skill = holder.getSkill();
|
||||
if (Rnd.get(100) >= holder.getChance())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (type == ItemSkillType.ON_MAGIC_SKILL)
|
||||
{
|
||||
// Trigger only if both are good or bad magic.
|
||||
if (trigger.isBad() != skill.isBad())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// No Trigger if not Magic Skill or is toggle
|
||||
if (trigger.isMagic() != skill.isMagic())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// No Trigger if skill is toggle
|
||||
if (trigger.isToggle())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (skill.isBad() && (Formulas.calcShldUse(caster, target) == Formulas.SHIELD_DEFENSE_PERFECT_BLOCK))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Skill condition not met
|
||||
if (!skill.checkCondition(caster, target))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
skill.activateSkill(caster, target);
|
||||
|
||||
// TODO: Verify if this applies ONLY to ON_MAGIC_SKILL!
|
||||
if (type == ItemSkillType.ON_MAGIC_SKILL)
|
||||
{
|
||||
// notify quests of a skill use
|
||||
if (caster instanceof L2PcInstance)
|
||||
{
|
||||
L2World.getInstance().forEachVisibleObjectInRange(caster, L2Npc.class, 1000, npc ->
|
||||
{
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnNpcSkillSee(npc, caster.getActingPlayer(), skill, false, target), npc);
|
||||
});
|
||||
}
|
||||
if (caster.isPlayer())
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_HAS_BEEN_ACTIVATED);
|
||||
sm.addSkillName(skill);
|
||||
caster.sendPacket(sm);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,45 +1,45 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items;
|
||||
|
||||
import com.l2jmobius.gameserver.model.StatsSet;
|
||||
import com.l2jmobius.gameserver.model.holders.ItemHolder;
|
||||
|
||||
/**
|
||||
* @author Zoey76
|
||||
*/
|
||||
public final class PcItemTemplate extends ItemHolder
|
||||
{
|
||||
private final boolean _equipped;
|
||||
|
||||
/**
|
||||
* @param set the set containing the values for this object
|
||||
*/
|
||||
public PcItemTemplate(StatsSet set)
|
||||
{
|
||||
super(set.getInt("id"), set.getInt("count"));
|
||||
_equipped = set.getBoolean("equipped", false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} if the items is equipped upon character creation, {@code false} otherwise
|
||||
*/
|
||||
public boolean isEquipped()
|
||||
{
|
||||
return _equipped;
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items;
|
||||
|
||||
import com.l2jmobius.gameserver.model.StatsSet;
|
||||
import com.l2jmobius.gameserver.model.holders.ItemHolder;
|
||||
|
||||
/**
|
||||
* @author Zoey76
|
||||
*/
|
||||
public final class PcItemTemplate extends ItemHolder
|
||||
{
|
||||
private final boolean _equipped;
|
||||
|
||||
/**
|
||||
* @param set the set containing the values for this object
|
||||
*/
|
||||
public PcItemTemplate(StatsSet set)
|
||||
{
|
||||
super(set.getInt("id"), set.getInt("count"));
|
||||
_equipped = set.getBoolean("equipped", false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} if the items is equipped upon character creation, {@code false} otherwise
|
||||
*/
|
||||
public boolean isEquipped()
|
||||
{
|
||||
return _equipped;
|
||||
}
|
||||
}
|
@ -1,27 +1,27 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items.appearance;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public enum AppearanceHandType
|
||||
{
|
||||
NONE,
|
||||
ONE_HANDED,
|
||||
TWO_HANDED,
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items.appearance;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public enum AppearanceHandType
|
||||
{
|
||||
NONE,
|
||||
ONE_HANDED,
|
||||
TWO_HANDED,
|
||||
}
|
||||
|
@ -1,27 +1,27 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items.appearance;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public enum AppearanceMagicType
|
||||
{
|
||||
NONE,
|
||||
MAGICAL,
|
||||
PHYISICAL,
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items.appearance;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public enum AppearanceMagicType
|
||||
{
|
||||
NONE,
|
||||
MAGICAL,
|
||||
PHYISICAL,
|
||||
}
|
||||
|
@ -1,208 +1,220 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items.appearance;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jmobius.gameserver.datatables.ItemTable;
|
||||
import com.l2jmobius.gameserver.enums.Race;
|
||||
import com.l2jmobius.gameserver.model.StatsSet;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.items.type.ArmorType;
|
||||
import com.l2jmobius.gameserver.model.items.type.CrystalType;
|
||||
import com.l2jmobius.gameserver.model.items.type.WeaponType;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class AppearanceStone
|
||||
{
|
||||
private final int _id;
|
||||
private final int _cost;
|
||||
private final int _visualId;
|
||||
private final long _lifeTime;
|
||||
private final AppearanceType _type;
|
||||
private final WeaponType _weaponType;
|
||||
private final ArmorType _armorType;
|
||||
private final AppearanceHandType _handType;
|
||||
private final AppearanceMagicType _magicType;
|
||||
private List<CrystalType> _crystalTypes;
|
||||
private List<AppearanceTargetType> _targetTypes;
|
||||
private List<Integer> _bodyParts;
|
||||
private List<Race> _races;
|
||||
private List<Race> _racesNot;
|
||||
|
||||
public AppearanceStone(StatsSet set)
|
||||
{
|
||||
_id = set.getInt("id");
|
||||
_visualId = set.getInt("visualId", 0);
|
||||
_cost = set.getInt("cost", 0);
|
||||
_lifeTime = set.getDuration("lifeTime", Duration.ofSeconds(0)).toMillis();
|
||||
_type = set.getEnum("type", AppearanceType.class, AppearanceType.NONE);
|
||||
_weaponType = set.getEnum("weaponType", WeaponType.class, WeaponType.NONE);
|
||||
_armorType = set.getEnum("armorType", ArmorType.class, ArmorType.NONE);
|
||||
_handType = set.getEnum("handType", AppearanceHandType.class, AppearanceHandType.NONE);
|
||||
_magicType = set.getEnum("magicType", AppearanceMagicType.class, AppearanceMagicType.NONE);
|
||||
|
||||
final CrystalType crystalType = set.getEnum("crystalType", CrystalType.class, CrystalType.NONE);
|
||||
if (crystalType != CrystalType.NONE)
|
||||
{
|
||||
addCrystalType(crystalType);
|
||||
}
|
||||
final AppearanceTargetType targetType = set.getEnum("targetType", AppearanceTargetType.class, AppearanceTargetType.NONE);
|
||||
if (targetType != AppearanceTargetType.NONE)
|
||||
{
|
||||
addTargetType(targetType);
|
||||
}
|
||||
|
||||
final int bodyPart = ItemTable.SLOTS.get(set.getString("bodyPart", "none"));
|
||||
if (bodyPart != L2Item.SLOT_NONE)
|
||||
{
|
||||
addBodyPart(bodyPart);
|
||||
}
|
||||
|
||||
final Race race = set.getEnum("race", Race.class, Race.NONE);
|
||||
if (race != Race.NONE)
|
||||
{
|
||||
addRace(race);
|
||||
}
|
||||
|
||||
final Race raceNot = set.getEnum("raceNot", Race.class, Race.NONE);
|
||||
if (raceNot != Race.NONE)
|
||||
{
|
||||
addRaceNot(raceNot);
|
||||
}
|
||||
}
|
||||
|
||||
public int getId()
|
||||
{
|
||||
return _id;
|
||||
}
|
||||
|
||||
public int getVisualId()
|
||||
{
|
||||
return _visualId;
|
||||
}
|
||||
|
||||
public int getCost()
|
||||
{
|
||||
return _cost;
|
||||
}
|
||||
|
||||
public long getLifeTime()
|
||||
{
|
||||
return _lifeTime;
|
||||
}
|
||||
|
||||
public AppearanceType getType()
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
|
||||
public WeaponType getWeaponType()
|
||||
{
|
||||
return _weaponType;
|
||||
}
|
||||
|
||||
public ArmorType getArmorType()
|
||||
{
|
||||
return _armorType;
|
||||
}
|
||||
|
||||
public AppearanceHandType getHandType()
|
||||
{
|
||||
return _handType;
|
||||
}
|
||||
|
||||
public AppearanceMagicType getMagicType()
|
||||
{
|
||||
return _magicType;
|
||||
}
|
||||
|
||||
public void addCrystalType(CrystalType type)
|
||||
{
|
||||
if (_crystalTypes == null)
|
||||
{
|
||||
_crystalTypes = new ArrayList<>();
|
||||
}
|
||||
_crystalTypes.add(type);
|
||||
}
|
||||
|
||||
public List<CrystalType> getCrystalTypes()
|
||||
{
|
||||
return _crystalTypes != null ? _crystalTypes : Collections.emptyList();
|
||||
}
|
||||
|
||||
public void addTargetType(AppearanceTargetType type)
|
||||
{
|
||||
if (_targetTypes == null)
|
||||
{
|
||||
_targetTypes = new ArrayList<>();
|
||||
}
|
||||
_targetTypes.add(type);
|
||||
}
|
||||
|
||||
public List<AppearanceTargetType> getTargetTypes()
|
||||
{
|
||||
return _targetTypes != null ? _targetTypes : Collections.emptyList();
|
||||
}
|
||||
|
||||
public void addBodyPart(Integer part)
|
||||
{
|
||||
if (_bodyParts == null)
|
||||
{
|
||||
_bodyParts = new ArrayList<>();
|
||||
}
|
||||
_bodyParts.add(part);
|
||||
}
|
||||
|
||||
public List<Integer> getBodyParts()
|
||||
{
|
||||
return _bodyParts != null ? _bodyParts : Collections.emptyList();
|
||||
}
|
||||
|
||||
public void addRace(Race race)
|
||||
{
|
||||
if (_races == null)
|
||||
{
|
||||
_races = new ArrayList<>();
|
||||
}
|
||||
_races.add(race);
|
||||
}
|
||||
|
||||
public List<Race> getRaces()
|
||||
{
|
||||
return _races != null ? _races : Collections.emptyList();
|
||||
}
|
||||
|
||||
public void addRaceNot(Race race)
|
||||
{
|
||||
if (_racesNot == null)
|
||||
{
|
||||
_racesNot = new ArrayList<>();
|
||||
}
|
||||
_racesNot.add(race);
|
||||
}
|
||||
|
||||
public List<Race> getRacesNot()
|
||||
{
|
||||
return _racesNot != null ? _racesNot : Collections.emptyList();
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items.appearance;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jmobius.gameserver.datatables.ItemTable;
|
||||
import com.l2jmobius.gameserver.enums.Race;
|
||||
import com.l2jmobius.gameserver.model.StatsSet;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.items.type.ArmorType;
|
||||
import com.l2jmobius.gameserver.model.items.type.CrystalType;
|
||||
import com.l2jmobius.gameserver.model.items.type.WeaponType;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class AppearanceStone
|
||||
{
|
||||
private final int _id;
|
||||
private final int _cost;
|
||||
private final int _visualId;
|
||||
private final long _lifeTime;
|
||||
private final AppearanceType _type;
|
||||
private final WeaponType _weaponType;
|
||||
private final ArmorType _armorType;
|
||||
private final AppearanceHandType _handType;
|
||||
private final AppearanceMagicType _magicType;
|
||||
private List<CrystalType> _crystalTypes;
|
||||
private List<AppearanceTargetType> _targetTypes;
|
||||
private List<Integer> _bodyParts;
|
||||
private List<Race> _races;
|
||||
private List<Race> _racesNot;
|
||||
|
||||
public AppearanceStone(StatsSet set)
|
||||
{
|
||||
_id = set.getInt("id");
|
||||
_visualId = set.getInt("visualId", 0);
|
||||
_cost = set.getInt("cost", 0);
|
||||
_lifeTime = set.getDuration("lifeTime", Duration.ofSeconds(0)).toMillis();
|
||||
_type = set.getEnum("type", AppearanceType.class, AppearanceType.NONE);
|
||||
_weaponType = set.getEnum("weaponType", WeaponType.class, WeaponType.NONE);
|
||||
_armorType = set.getEnum("armorType", ArmorType.class, ArmorType.NONE);
|
||||
_handType = set.getEnum("handType", AppearanceHandType.class, AppearanceHandType.NONE);
|
||||
_magicType = set.getEnum("magicType", AppearanceMagicType.class, AppearanceMagicType.NONE);
|
||||
|
||||
// No grade items cannot change appearance, because client doesn't have No-Grade restoration stones.
|
||||
final CrystalType crystalType = set.getEnum("crystalType", CrystalType.class, CrystalType.NONE);
|
||||
if (crystalType == CrystalType.NONE)
|
||||
{
|
||||
for (CrystalType cryType : CrystalType.values())
|
||||
{
|
||||
if ((cryType != CrystalType.NONE) && (cryType != CrystalType.EVENT))
|
||||
{
|
||||
addCrystalType(cryType);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
addCrystalType(crystalType);
|
||||
}
|
||||
|
||||
final AppearanceTargetType targetType = set.getEnum("targetType", AppearanceTargetType.class, AppearanceTargetType.NONE);
|
||||
if (targetType != AppearanceTargetType.NONE)
|
||||
{
|
||||
addTargetType(targetType);
|
||||
}
|
||||
|
||||
final int bodyPart = ItemTable._slots.get(set.getString("bodyPart", "none"));
|
||||
if (bodyPart != L2Item.SLOT_NONE)
|
||||
{
|
||||
addBodyPart(bodyPart);
|
||||
}
|
||||
|
||||
final Race race = set.getEnum("race", Race.class, Race.NONE);
|
||||
if (race != Race.NONE)
|
||||
{
|
||||
addRace(race);
|
||||
}
|
||||
|
||||
final Race raceNot = set.getEnum("raceNot", Race.class, Race.NONE);
|
||||
if (raceNot != Race.NONE)
|
||||
{
|
||||
addRaceNot(raceNot);
|
||||
}
|
||||
}
|
||||
|
||||
public int getId()
|
||||
{
|
||||
return _id;
|
||||
}
|
||||
|
||||
public int getVisualId()
|
||||
{
|
||||
return _visualId;
|
||||
}
|
||||
|
||||
public int getCost()
|
||||
{
|
||||
return _cost;
|
||||
}
|
||||
|
||||
public long getLifeTime()
|
||||
{
|
||||
return _lifeTime;
|
||||
}
|
||||
|
||||
public AppearanceType getType()
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
|
||||
public WeaponType getWeaponType()
|
||||
{
|
||||
return _weaponType;
|
||||
}
|
||||
|
||||
public ArmorType getArmorType()
|
||||
{
|
||||
return _armorType;
|
||||
}
|
||||
|
||||
public AppearanceHandType getHandType()
|
||||
{
|
||||
return _handType;
|
||||
}
|
||||
|
||||
public AppearanceMagicType getMagicType()
|
||||
{
|
||||
return _magicType;
|
||||
}
|
||||
|
||||
public void addCrystalType(CrystalType type)
|
||||
{
|
||||
if (_crystalTypes == null)
|
||||
{
|
||||
_crystalTypes = new ArrayList<>();
|
||||
}
|
||||
_crystalTypes.add(type);
|
||||
}
|
||||
|
||||
public List<CrystalType> getCrystalTypes()
|
||||
{
|
||||
return _crystalTypes != null ? _crystalTypes : Collections.emptyList();
|
||||
}
|
||||
|
||||
public void addTargetType(AppearanceTargetType type)
|
||||
{
|
||||
if (_targetTypes == null)
|
||||
{
|
||||
_targetTypes = new ArrayList<>();
|
||||
}
|
||||
_targetTypes.add(type);
|
||||
}
|
||||
|
||||
public List<AppearanceTargetType> getTargetTypes()
|
||||
{
|
||||
return _targetTypes != null ? _targetTypes : Collections.emptyList();
|
||||
}
|
||||
|
||||
public void addBodyPart(Integer part)
|
||||
{
|
||||
if (_bodyParts == null)
|
||||
{
|
||||
_bodyParts = new ArrayList<>();
|
||||
}
|
||||
_bodyParts.add(part);
|
||||
}
|
||||
|
||||
public List<Integer> getBodyParts()
|
||||
{
|
||||
return _bodyParts != null ? _bodyParts : Collections.emptyList();
|
||||
}
|
||||
|
||||
public void addRace(Race race)
|
||||
{
|
||||
if (_races == null)
|
||||
{
|
||||
_races = new ArrayList<>();
|
||||
}
|
||||
_races.add(race);
|
||||
}
|
||||
|
||||
public List<Race> getRaces()
|
||||
{
|
||||
return _races != null ? _races : Collections.emptyList();
|
||||
}
|
||||
|
||||
public void addRaceNot(Race race)
|
||||
{
|
||||
if (_racesNot == null)
|
||||
{
|
||||
_racesNot = new ArrayList<>();
|
||||
}
|
||||
_racesNot.add(race);
|
||||
}
|
||||
|
||||
public List<Race> getRacesNot()
|
||||
{
|
||||
return _racesNot != null ? _racesNot : Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
@ -1,29 +1,29 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items.appearance;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public enum AppearanceTargetType
|
||||
{
|
||||
NONE,
|
||||
WEAPON,
|
||||
ARMOR,
|
||||
ACCESSORY,
|
||||
ALL
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items.appearance;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public enum AppearanceTargetType
|
||||
{
|
||||
NONE,
|
||||
WEAPON,
|
||||
ARMOR,
|
||||
ACCESSORY,
|
||||
ALL
|
||||
}
|
||||
|
@ -1,29 +1,29 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items.appearance;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public enum AppearanceType
|
||||
{
|
||||
NONE,
|
||||
NORMAL,
|
||||
BLESSED,
|
||||
FIXED,
|
||||
RESTORE;
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items.appearance;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public enum AppearanceType
|
||||
{
|
||||
NONE,
|
||||
NORMAL,
|
||||
BLESSED,
|
||||
FIXED,
|
||||
RESTORE
|
||||
}
|
||||
|
@ -1,210 +1,161 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items.enchant;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.gameserver.datatables.ItemTable;
|
||||
import com.l2jmobius.gameserver.model.StatsSet;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.items.type.CrystalType;
|
||||
import com.l2jmobius.gameserver.model.items.type.EtcItemType;
|
||||
import com.l2jmobius.gameserver.model.items.type.ItemType;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public abstract class AbstractEnchantItem
|
||||
{
|
||||
protected static final Logger _log = Logger.getLogger(AbstractEnchantItem.class.getName());
|
||||
|
||||
private static final ItemType[] ENCHANT_TYPES = new ItemType[]
|
||||
{
|
||||
EtcItemType.ANCIENT_CRYSTAL_ENCHANT_AM,
|
||||
EtcItemType.ANCIENT_CRYSTAL_ENCHANT_WP,
|
||||
EtcItemType.BLESS_SCRL_ENCHANT_AM,
|
||||
EtcItemType.BLESS_SCRL_ENCHANT_WP,
|
||||
EtcItemType.SCRL_ENCHANT_AM,
|
||||
EtcItemType.SCRL_ENCHANT_WP,
|
||||
EtcItemType.SCRL_INC_ENCHANT_PROP_AM,
|
||||
EtcItemType.SCRL_INC_ENCHANT_PROP_WP,
|
||||
EtcItemType.BLESS_SCRL_INC_ENCHANT_PROP_AM,
|
||||
EtcItemType.BLESS_SCRL_INC_ENCHANT_PROP_WP,
|
||||
EtcItemType.GIANT_SCRL_ENCHANT_AM,
|
||||
EtcItemType.GIANT_SCRL_ENCHANT_WP,
|
||||
EtcItemType.GIANT_SCRL_INC_ENCHANT_PROP_AM,
|
||||
EtcItemType.GIANT_SCRL_INC_ENCHANT_PROP_WP,
|
||||
EtcItemType.GIANT_SCRL_BLESS_INC_ENCHANT_PROP_AM,
|
||||
EtcItemType.GIANT_SCRL_BLESS_INC_ENCHANT_PROP_WP,
|
||||
EtcItemType.SCRL_BLESS_INC_ENCHANT_PROP_AM,
|
||||
EtcItemType.SCRL_BLESS_INC_ENCHANT_PROP_WP,
|
||||
EtcItemType.BLESS_DROP_SCRL_INC_ENCHANT_PROP_AM,
|
||||
EtcItemType.BLESS_DROP_SCRL_INC_ENCHANT_PROP_WP,
|
||||
EtcItemType.GIANT2_SCRL_BLESS_INC_ENCHANT_PROP_AM,
|
||||
EtcItemType.GIANT2_SCRL_BLESS_INC_ENCHANT_PROP_WP,
|
||||
EtcItemType.SCRL_ENCHANT_HR
|
||||
};
|
||||
|
||||
private final int _id;
|
||||
private final CrystalType _grade;
|
||||
private final int _minEnchantLevel;
|
||||
private final int _maxEnchantLevel;
|
||||
private final int _maxEnchantLevelFighter;
|
||||
private final int _maxEnchantLevelMagic;
|
||||
private final double _bonusRate;
|
||||
|
||||
public AbstractEnchantItem(StatsSet set)
|
||||
{
|
||||
_id = set.getInt("id");
|
||||
if (getItem() == null)
|
||||
{
|
||||
throw new NullPointerException();
|
||||
}
|
||||
if (!Util.contains(ENCHANT_TYPES, getItem().getItemType()))
|
||||
{
|
||||
throw new IllegalAccessError();
|
||||
}
|
||||
_grade = set.getEnum("targetGrade", CrystalType.class, CrystalType.NONE);
|
||||
_minEnchantLevel = set.getInt("minEnchant", 0);
|
||||
_maxEnchantLevel = set.getInt("maxEnchant", 127);
|
||||
_maxEnchantLevelFighter = set.getInt("maxEnchantFighter", 127);
|
||||
_maxEnchantLevelMagic = set.getInt("maxEnchantMagic", 127);
|
||||
_bonusRate = set.getDouble("bonusRate", 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return id of current item
|
||||
*/
|
||||
public final int getId()
|
||||
{
|
||||
return _id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bonus chance that would be added
|
||||
*/
|
||||
public final double getBonusRate()
|
||||
{
|
||||
return _bonusRate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link L2Item} current item/scroll
|
||||
*/
|
||||
public final L2Item getItem()
|
||||
{
|
||||
return ItemTable.getInstance().getTemplate(_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return grade of the item/scroll.
|
||||
*/
|
||||
public final CrystalType getGrade()
|
||||
{
|
||||
return _grade;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} if scroll is for weapon, {@code false} for armor
|
||||
*/
|
||||
public abstract boolean isWeapon();
|
||||
|
||||
/**
|
||||
* @return the minimum enchant level that this scroll/item can be used with
|
||||
*/
|
||||
public int getMinEnchantLevel()
|
||||
{
|
||||
return _minEnchantLevel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the maximum enchant level that this scroll/item can be used with
|
||||
*/
|
||||
public int getMaxEnchantLevel()
|
||||
{
|
||||
return _maxEnchantLevel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the maximum enchant level that fighter weapon can be enchanted with this scroll
|
||||
*/
|
||||
public int getMaxEnchantLevelFighter()
|
||||
{
|
||||
return _maxEnchantLevelFighter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the maximum enchant level that magic weapon can be enchanted with this scroll
|
||||
*/
|
||||
public int getMaxEnchantLevelMagic()
|
||||
{
|
||||
return _maxEnchantLevelMagic;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param itemToEnchant the item to be enchanted
|
||||
* @param supportItem
|
||||
* @return {@code true} if this support item can be used with the item to be enchanted, {@code false} otherwise
|
||||
*/
|
||||
public boolean isValid(L2ItemInstance itemToEnchant, EnchantSupportItem supportItem)
|
||||
{
|
||||
if (itemToEnchant == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (itemToEnchant.isEnchantable() == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (!isValidItemType(itemToEnchant.getItem().getType2()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if ((_minEnchantLevel != 0) && (itemToEnchant.getEnchantLevel() < _minEnchantLevel))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if ((_maxEnchantLevel != 0) && (itemToEnchant.getEnchantLevel() >= _maxEnchantLevel))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if ((_maxEnchantLevelFighter != 0) && !itemToEnchant.getItem().isMagicWeapon() && (itemToEnchant.getEnchantLevel() >= _maxEnchantLevelFighter))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if ((_maxEnchantLevelMagic != 0) && itemToEnchant.getItem().isMagicWeapon() && (itemToEnchant.getEnchantLevel() >= _maxEnchantLevelMagic))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (_grade != itemToEnchant.getItem().getCrystalTypePlus())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param type2
|
||||
* @return {@code true} if current type2 is valid to be enchanted, {@code false} otherwise
|
||||
*/
|
||||
private final boolean isValidItemType(int type2)
|
||||
{
|
||||
return type2 == L2Item.TYPE2_WEAPON ? isWeapon() : ((type2 == L2Item.TYPE2_SHIELD_ARMOR) || (type2 == L2Item.TYPE2_ACCESSORY)) && !isWeapon();
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items.enchant;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.commons.util.CommonUtil;
|
||||
import com.l2jmobius.gameserver.datatables.ItemTable;
|
||||
import com.l2jmobius.gameserver.model.StatsSet;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.items.type.CrystalType;
|
||||
import com.l2jmobius.gameserver.model.items.type.EtcItemType;
|
||||
import com.l2jmobius.gameserver.model.items.type.ItemType;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public abstract class AbstractEnchantItem
|
||||
{
|
||||
protected static final Logger _log = Logger.getLogger(AbstractEnchantItem.class.getName());
|
||||
|
||||
private static final ItemType[] ENCHANT_TYPES = new ItemType[]
|
||||
{
|
||||
EtcItemType.ENCHT_ATTR_ANCIENT_CRYSTAL_ENCHANT_AM,
|
||||
EtcItemType.ENCHT_ATTR_ANCIENT_CRYSTAL_ENCHANT_WP,
|
||||
EtcItemType.BLESS_ENCHT_AM,
|
||||
EtcItemType.BLESS_ENCHT_WP,
|
||||
EtcItemType.ENCHT_AM,
|
||||
EtcItemType.ENCHT_WP,
|
||||
EtcItemType.ENCHT_ATTR_INC_PROP_ENCHT_AM,
|
||||
EtcItemType.ENCHT_ATTR_INC_PROP_ENCHT_WP,
|
||||
};
|
||||
|
||||
private final int _id;
|
||||
private final CrystalType _grade;
|
||||
private final int _maxEnchantLevel;
|
||||
private final double _bonusRate;
|
||||
|
||||
public AbstractEnchantItem(StatsSet set)
|
||||
{
|
||||
_id = set.getInt("id");
|
||||
if (getItem() == null)
|
||||
{
|
||||
throw new NullPointerException();
|
||||
}
|
||||
else if (!CommonUtil.contains(ENCHANT_TYPES, getItem().getItemType()))
|
||||
{
|
||||
throw new IllegalAccessError();
|
||||
}
|
||||
_grade = set.getEnum("targetGrade", CrystalType.class, CrystalType.NONE);
|
||||
_maxEnchantLevel = set.getInt("maxEnchant", 127);
|
||||
_bonusRate = set.getDouble("bonusRate", 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return id of current item
|
||||
*/
|
||||
public final int getId()
|
||||
{
|
||||
return _id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bonus chance that would be added
|
||||
*/
|
||||
public final double getBonusRate()
|
||||
{
|
||||
return _bonusRate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link L2Item} current item/scroll
|
||||
*/
|
||||
public final L2Item getItem()
|
||||
{
|
||||
return ItemTable.getInstance().getTemplate(_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return grade of the item/scroll.
|
||||
*/
|
||||
public final CrystalType getGrade()
|
||||
{
|
||||
return _grade;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} if scroll is for weapon, {@code false} for armor
|
||||
*/
|
||||
public abstract boolean isWeapon();
|
||||
|
||||
/**
|
||||
* @return the maximum enchant level that this scroll/item can be used with
|
||||
*/
|
||||
public int getMaxEnchantLevel()
|
||||
{
|
||||
return _maxEnchantLevel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param itemToEnchant the item to be enchanted
|
||||
* @param supportItem
|
||||
* @return {@code true} if this support item can be used with the item to be enchanted, {@code false} otherwise
|
||||
*/
|
||||
public boolean isValid(L2ItemInstance itemToEnchant, EnchantSupportItem supportItem)
|
||||
{
|
||||
if (itemToEnchant == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (itemToEnchant.isEnchantable() == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (!isValidItemType(itemToEnchant.getItem().getType2()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if ((_maxEnchantLevel != 0) && (itemToEnchant.getEnchantLevel() >= _maxEnchantLevel))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (_grade != itemToEnchant.getItem().getCrystalTypePlus())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param type2
|
||||
* @return {@code true} if current type2 is valid to be enchanted, {@code false} otherwise
|
||||
*/
|
||||
private boolean isValidItemType(int type2)
|
||||
{
|
||||
if (type2 == L2Item.TYPE2_WEAPON)
|
||||
{
|
||||
return isWeapon();
|
||||
}
|
||||
else if ((type2 == L2Item.TYPE2_SHIELD_ARMOR) || (type2 == L2Item.TYPE2_ACCESSORY))
|
||||
{
|
||||
return !isWeapon();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1,77 +1,77 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items.enchant;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.gameserver.model.holders.RangeChanceHolder;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public final class EnchantItemGroup
|
||||
{
|
||||
private static final Logger _log = Logger.getLogger(EnchantItemGroup.class.getName());
|
||||
private final List<RangeChanceHolder> _chances = new ArrayList<>();
|
||||
private final String _name;
|
||||
|
||||
public EnchantItemGroup(String name)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return name of current enchant item group.
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param holder
|
||||
*/
|
||||
public void addChance(RangeChanceHolder holder)
|
||||
{
|
||||
_chances.add(holder);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param index
|
||||
* @return chance for success rate for current enchant item group.
|
||||
*/
|
||||
public double getChance(int index)
|
||||
{
|
||||
if (!_chances.isEmpty())
|
||||
{
|
||||
for (RangeChanceHolder holder : _chances)
|
||||
{
|
||||
if ((holder.getMin() <= index) && (holder.getMax() >= index))
|
||||
{
|
||||
return holder.getChance();
|
||||
}
|
||||
}
|
||||
_log.log(Level.WARNING, getClass().getSimpleName() + ": Couldn't match proper chance for item group: " + _name, new IllegalStateException());
|
||||
return _chances.get(_chances.size() - 1).getChance();
|
||||
}
|
||||
_log.log(Level.WARNING, getClass().getSimpleName() + ": item group: " + _name + " doesn't have any chances!");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items.enchant;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.gameserver.model.holders.RangeChanceHolder;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public final class EnchantItemGroup
|
||||
{
|
||||
private static final Logger _log = Logger.getLogger(EnchantItemGroup.class.getName());
|
||||
private final List<RangeChanceHolder> _chances = new ArrayList<>();
|
||||
private final String _name;
|
||||
|
||||
public EnchantItemGroup(String name)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return name of current enchant item group.
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param holder
|
||||
*/
|
||||
public void addChance(RangeChanceHolder holder)
|
||||
{
|
||||
_chances.add(holder);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param index
|
||||
* @return chance for success rate for current enchant item group.
|
||||
*/
|
||||
public double getChance(int index)
|
||||
{
|
||||
if (!_chances.isEmpty())
|
||||
{
|
||||
for (RangeChanceHolder holder : _chances)
|
||||
{
|
||||
if ((holder.getMin() <= index) && (holder.getMax() >= index))
|
||||
{
|
||||
return holder.getChance();
|
||||
}
|
||||
}
|
||||
_log.log(Level.WARNING, getClass().getSimpleName() + ": Couldn't match proper chance for item group: " + _name, new IllegalStateException());
|
||||
return _chances.get(_chances.size() - 1).getChance();
|
||||
}
|
||||
_log.warning(getClass().getSimpleName() + ": item group: " + _name + " doesn't have any chances!");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -1,91 +1,91 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items.enchant;
|
||||
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public final class EnchantRateItem
|
||||
{
|
||||
private final String _name;
|
||||
private int _itemId;
|
||||
private int _slot;
|
||||
private Boolean _isMagicWeapon = null;
|
||||
|
||||
public EnchantRateItem(String name)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return name of enchant group.
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds item id verification.
|
||||
* @param id
|
||||
*/
|
||||
public void setItemId(int id)
|
||||
{
|
||||
_itemId = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds body slot verification.
|
||||
* @param slot
|
||||
*/
|
||||
public void addSlot(int slot)
|
||||
{
|
||||
_slot |= slot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds magic weapon verification.
|
||||
* @param magicWeapon
|
||||
*/
|
||||
public void setMagicWeapon(boolean magicWeapon)
|
||||
{
|
||||
_isMagicWeapon = magicWeapon;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param item
|
||||
* @return {@code true} if item can be used with this rate group, {@code false} otherwise.
|
||||
*/
|
||||
public boolean validate(L2Item item)
|
||||
{
|
||||
if ((_itemId != 0) && (_itemId != item.getId()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if ((_slot != 0) && ((item.getBodyPart() & _slot) == 0))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if ((_isMagicWeapon != null) && (item.isMagicWeapon() != _isMagicWeapon))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items.enchant;
|
||||
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public final class EnchantRateItem
|
||||
{
|
||||
private final String _name;
|
||||
private int _itemId;
|
||||
private int _slot;
|
||||
private Boolean _isMagicWeapon = null;
|
||||
|
||||
public EnchantRateItem(String name)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return name of enchant group.
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds item id verification.
|
||||
* @param id
|
||||
*/
|
||||
public void setItemId(int id)
|
||||
{
|
||||
_itemId = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds body slot verification.
|
||||
* @param slot
|
||||
*/
|
||||
public void addSlot(int slot)
|
||||
{
|
||||
_slot |= slot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds magic weapon verification.
|
||||
* @param magicWeapon
|
||||
*/
|
||||
public void setMagicWeapon(boolean magicWeapon)
|
||||
{
|
||||
_isMagicWeapon = magicWeapon;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param item
|
||||
* @return {@code true} if item can be used with this rate group, {@code false} otherwise.
|
||||
*/
|
||||
public boolean validate(L2Item item)
|
||||
{
|
||||
if ((_itemId != 0) && (_itemId != item.getId()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if ((_slot != 0) && ((item.getBodyPart() & _slot) == 0))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if ((_isMagicWeapon != null) && (item.isMagicWeapon() != _isMagicWeapon))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1,27 +1,27 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items.enchant;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public enum EnchantResultType
|
||||
{
|
||||
ERROR,
|
||||
SUCCESS,
|
||||
FAILURE
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items.enchant;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public enum EnchantResultType
|
||||
{
|
||||
ERROR,
|
||||
SUCCESS,
|
||||
FAILURE
|
||||
}
|
||||
|
@ -1,248 +1,205 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items.enchant;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.l2jmobius.gameserver.data.xml.impl.EnchantItemGroupsData;
|
||||
import com.l2jmobius.gameserver.model.StatsSet;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.items.type.EtcItemType;
|
||||
import com.l2jmobius.gameserver.model.items.type.ItemType;
|
||||
import com.l2jmobius.gameserver.network.Debug;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
import com.l2jmobius.util.Rnd;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public final class EnchantScroll extends AbstractEnchantItem
|
||||
{
|
||||
private final boolean _isWeapon;
|
||||
private final boolean _isBlessed;
|
||||
private final boolean _isSafe;
|
||||
private final boolean _isGiant;
|
||||
private final boolean _isHair;
|
||||
private final int _scrollGroupId;
|
||||
private Set<Integer> _items;
|
||||
|
||||
public EnchantScroll(StatsSet set)
|
||||
{
|
||||
super(set);
|
||||
_scrollGroupId = set.getInt("scrollGroupId", 0);
|
||||
|
||||
final ItemType type = getItem().getItemType();
|
||||
_isWeapon = (type == EtcItemType.GIANT_SCRL_ENCHANT_WP) || (type == EtcItemType.ANCIENT_CRYSTAL_ENCHANT_WP) || (type == EtcItemType.BLESS_SCRL_ENCHANT_WP) || (type == EtcItemType.SCRL_ENCHANT_WP);
|
||||
_isBlessed = (type == EtcItemType.BLESS_SCRL_ENCHANT_AM) || (type == EtcItemType.BLESS_SCRL_ENCHANT_WP);
|
||||
_isSafe = (type == EtcItemType.ANCIENT_CRYSTAL_ENCHANT_AM) || (type == EtcItemType.ANCIENT_CRYSTAL_ENCHANT_WP);
|
||||
_isGiant = (type == EtcItemType.GIANT_SCRL_ENCHANT_AM) || (type == EtcItemType.GIANT_SCRL_ENCHANT_WP);
|
||||
_isHair = type == EtcItemType.SCRL_ENCHANT_HR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWeapon()
|
||||
{
|
||||
return _isWeapon;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} for blessed scrolls (enchanted item will remain on failure), {@code false} otherwise
|
||||
*/
|
||||
public boolean isBlessed()
|
||||
{
|
||||
return _isBlessed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} for safe-enchant scrolls (enchant level will remain on failure), {@code false} otherwise
|
||||
*/
|
||||
public boolean isSafe()
|
||||
{
|
||||
return _isSafe;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} for giant scrolls (enchant attempts has a chance of increasing the enchant value between +1 and +3 randomly), {@code false} otherwise
|
||||
*/
|
||||
public boolean isGiant()
|
||||
{
|
||||
return _isGiant;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} for hair enchant scrolls, {@code false} otherwise
|
||||
*/
|
||||
public boolean isHair()
|
||||
{
|
||||
return _isHair;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return id of scroll group that should be used
|
||||
*/
|
||||
public int getScrollGroupId()
|
||||
{
|
||||
return _scrollGroupId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enforces current scroll to use only those items as possible items to enchant
|
||||
* @param itemId
|
||||
*/
|
||||
public void addItem(int itemId)
|
||||
{
|
||||
if (_items == null)
|
||||
{
|
||||
_items = new HashSet<>();
|
||||
}
|
||||
_items.add(itemId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param itemToEnchant the item to be enchanted
|
||||
* @param supportItem the support item used when enchanting (can be null)
|
||||
* @return {@code true} if this scroll can be used with the specified support item and the item to be enchanted, {@code false} otherwise
|
||||
*/
|
||||
@Override
|
||||
public boolean isValid(L2ItemInstance itemToEnchant, EnchantSupportItem supportItem)
|
||||
{
|
||||
if ((_items != null) && !_items.contains(itemToEnchant.getId()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (isHair() && (itemToEnchant.getItem().getBodyPart() != L2Item.SLOT_HAIR) && (itemToEnchant.getItem().getBodyPart() != L2Item.SLOT_HAIR2) && (itemToEnchant.getItem().getBodyPart() != L2Item.SLOT_HAIRALL))
|
||||
{
|
||||
_log.info("bodypart: " + itemToEnchant.getItem().getBodyPart());
|
||||
return false;
|
||||
}
|
||||
else if (supportItem != null)
|
||||
{
|
||||
if (isBlessed() && (supportItem.getItem().getItemType() != EtcItemType.BLESS_SCRL_INC_ENCHANT_PROP_WP) && (supportItem.getItem().getItemType() != EtcItemType.BLESS_SCRL_INC_ENCHANT_PROP_AM) && (supportItem.getItem().getItemType() != EtcItemType.BLESS_DROP_SCRL_INC_ENCHANT_PROP_WP) && (supportItem.getItem().getItemType() != EtcItemType.BLESS_DROP_SCRL_INC_ENCHANT_PROP_AM))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (isGiant() && (supportItem.getItem().getItemType() != EtcItemType.GIANT_SCRL_INC_ENCHANT_PROP_WP) && (supportItem.getItem().getItemType() != EtcItemType.GIANT_SCRL_INC_ENCHANT_PROP_AM) && (supportItem.getItem().getItemType() != EtcItemType.GIANT_SCRL_BLESS_INC_ENCHANT_PROP_WP) && (supportItem.getItem().getItemType() != EtcItemType.GIANT_SCRL_BLESS_INC_ENCHANT_PROP_AM) && (supportItem.getItem().getItemType() != EtcItemType.GIANT2_SCRL_BLESS_INC_ENCHANT_PROP_AM) && (supportItem.getItem().getItemType() != EtcItemType.GIANT2_SCRL_BLESS_INC_ENCHANT_PROP_WP))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (!isBlessed() && !isGiant() && (supportItem.getItem().getItemType() != EtcItemType.SCRL_INC_ENCHANT_PROP_WP) && (supportItem.getItem().getItemType() != EtcItemType.SCRL_INC_ENCHANT_PROP_AM) && (supportItem.getItem().getItemType() != EtcItemType.SCRL_BLESS_INC_ENCHANT_PROP_WP) && (supportItem.getItem().getItemType() != EtcItemType.SCRL_BLESS_INC_ENCHANT_PROP_AM))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (!supportItem.isValid(itemToEnchant, supportItem))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (supportItem.isWeapon() != isWeapon())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return super.isValid(itemToEnchant, supportItem);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param player
|
||||
* @param enchantItem
|
||||
* @return the chance of current scroll's group.
|
||||
*/
|
||||
public double getChance(L2PcInstance player, L2ItemInstance enchantItem)
|
||||
{
|
||||
if (EnchantItemGroupsData.getInstance().getScrollGroup(_scrollGroupId) == null)
|
||||
{
|
||||
_log.log(Level.WARNING, getClass().getSimpleName() + ": Unexistent enchant scroll group specified for enchant scroll: " + getId());
|
||||
return -1;
|
||||
}
|
||||
|
||||
final EnchantItemGroup group = EnchantItemGroupsData.getInstance().getItemGroup(enchantItem.getItem(), _scrollGroupId);
|
||||
if (group == null)
|
||||
{
|
||||
_log.log(Level.WARNING, getClass().getSimpleName() + ": Couldn't find enchant item group for scroll: " + getId() + " requested by: " + player);
|
||||
return -1;
|
||||
}
|
||||
return group.getChance(enchantItem.getEnchantLevel());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param player
|
||||
* @param enchantItem
|
||||
* @param supportItem
|
||||
* @return the total chance for success rate of this scroll
|
||||
*/
|
||||
public EnchantResultType calculateSuccess(L2PcInstance player, L2ItemInstance enchantItem, EnchantSupportItem supportItem)
|
||||
{
|
||||
if (!isValid(enchantItem, supportItem))
|
||||
{
|
||||
return EnchantResultType.ERROR;
|
||||
}
|
||||
|
||||
final double chance = getChance(player, enchantItem);
|
||||
if (chance == -1)
|
||||
{
|
||||
return EnchantResultType.ERROR;
|
||||
}
|
||||
|
||||
final double bonusRate = getBonusRate();
|
||||
final double supportBonusRate = (supportItem != null) ? supportItem.getBonusRate() : 0;
|
||||
final double finalChance = Math.min(chance + bonusRate + supportBonusRate, 100);
|
||||
|
||||
final double random = 100 * Rnd.nextDouble();
|
||||
final boolean success = random < finalChance;
|
||||
|
||||
if (player.isDebug())
|
||||
{
|
||||
final EnchantItemGroup group = EnchantItemGroupsData.getInstance().getItemGroup(enchantItem.getItem(), _scrollGroupId);
|
||||
final StatsSet set = new StatsSet();
|
||||
if (isBlessed())
|
||||
{
|
||||
set.set("isBlessed", isBlessed());
|
||||
}
|
||||
if (isSafe())
|
||||
{
|
||||
set.set("isSafe", isSafe());
|
||||
}
|
||||
if (isGiant())
|
||||
{
|
||||
set.set("isGiant", isGiant());
|
||||
}
|
||||
if (isHair())
|
||||
{
|
||||
set.set("isHair", isHair());
|
||||
}
|
||||
set.set("chance", Util.formatDouble(chance, "#.##"));
|
||||
if (bonusRate > 0)
|
||||
{
|
||||
set.set("bonusRate", Util.formatDouble(bonusRate, "#.##"));
|
||||
}
|
||||
if (supportBonusRate > 0)
|
||||
{
|
||||
set.set("supportBonusRate", Util.formatDouble(supportBonusRate, "#.##"));
|
||||
}
|
||||
set.set("finalChance", Util.formatDouble(finalChance, "#.##"));
|
||||
set.set("random", Util.formatDouble(random, "#.##"));
|
||||
set.set("success", success);
|
||||
set.set("item group", group.getName());
|
||||
set.set("scroll group", _scrollGroupId);
|
||||
Debug.sendItemDebug(player, enchantItem, set);
|
||||
}
|
||||
return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items.enchant;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import com.l2jmobius.commons.util.Rnd;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.EnchantItemGroupsData;
|
||||
import com.l2jmobius.gameserver.model.StatsSet;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.items.type.EtcItemType;
|
||||
import com.l2jmobius.gameserver.model.items.type.ItemType;
|
||||
import com.l2jmobius.gameserver.network.Debug;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public final class EnchantScroll extends AbstractEnchantItem
|
||||
{
|
||||
private final boolean _isWeapon;
|
||||
private final boolean _isBlessed;
|
||||
private final boolean _isSafe;
|
||||
private final int _scrollGroupId;
|
||||
private Set<Integer> _items;
|
||||
|
||||
public EnchantScroll(StatsSet set)
|
||||
{
|
||||
super(set);
|
||||
_scrollGroupId = set.getInt("scrollGroupId", 0);
|
||||
|
||||
final ItemType type = getItem().getItemType();
|
||||
_isWeapon = (type == EtcItemType.ENCHT_ATTR_ANCIENT_CRYSTAL_ENCHANT_WP) || (type == EtcItemType.BLESS_ENCHT_WP) || (type == EtcItemType.ENCHT_WP);
|
||||
_isBlessed = (type == EtcItemType.BLESS_ENCHT_AM) || (type == EtcItemType.BLESS_ENCHT_WP);
|
||||
_isSafe = (type == EtcItemType.ENCHT_ATTR_CRYSTAL_ENCHANT_AM) || (type == EtcItemType.ENCHT_ATTR_CRYSTAL_ENCHANT_WP);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWeapon()
|
||||
{
|
||||
return _isWeapon;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} for blessed scrolls (enchanted item will remain on failure), {@code false} otherwise
|
||||
*/
|
||||
public boolean isBlessed()
|
||||
{
|
||||
return _isBlessed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} for safe-enchant scrolls (enchant level will remain on failure), {@code false} otherwise
|
||||
*/
|
||||
public boolean isSafe()
|
||||
{
|
||||
return _isSafe;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return id of scroll group that should be used
|
||||
*/
|
||||
public int getScrollGroupId()
|
||||
{
|
||||
return _scrollGroupId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enforces current scroll to use only those items as possible items to enchant
|
||||
* @param itemId
|
||||
*/
|
||||
public void addItem(int itemId)
|
||||
{
|
||||
if (_items == null)
|
||||
{
|
||||
_items = new HashSet<>();
|
||||
}
|
||||
_items.add(itemId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param itemToEnchant the item to be enchanted
|
||||
* @param supportItem the support item used when enchanting (can be null)
|
||||
* @return {@code true} if this scroll can be used with the specified support item and the item to be enchanted, {@code false} otherwise
|
||||
*/
|
||||
@Override
|
||||
public boolean isValid(L2ItemInstance itemToEnchant, EnchantSupportItem supportItem)
|
||||
{
|
||||
if ((_items != null) && !_items.contains(itemToEnchant.getId()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if ((supportItem != null))
|
||||
{
|
||||
if (isBlessed())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (!supportItem.isValid(itemToEnchant, supportItem))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (supportItem.isWeapon() != isWeapon())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return super.isValid(itemToEnchant, supportItem);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param player
|
||||
* @param enchantItem
|
||||
* @return the chance of current scroll's group.
|
||||
*/
|
||||
public double getChance(L2PcInstance player, L2ItemInstance enchantItem)
|
||||
{
|
||||
if (EnchantItemGroupsData.getInstance().getScrollGroup(_scrollGroupId) == null)
|
||||
{
|
||||
_log.warning(getClass().getSimpleName() + ": Unexistent enchant scroll group specified for enchant scroll: " + getId());
|
||||
return -1;
|
||||
}
|
||||
|
||||
final EnchantItemGroup group = EnchantItemGroupsData.getInstance().getItemGroup(enchantItem.getItem(), _scrollGroupId);
|
||||
if (group == null)
|
||||
{
|
||||
_log.warning(getClass().getSimpleName() + ": Couldn't find enchant item group for scroll: " + getId() + " requested by: " + player);
|
||||
return -1;
|
||||
}
|
||||
return group.getChance(enchantItem.getEnchantLevel());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param player
|
||||
* @param enchantItem
|
||||
* @param supportItem
|
||||
* @return the total chance for success rate of this scroll
|
||||
*/
|
||||
public EnchantResultType calculateSuccess(L2PcInstance player, L2ItemInstance enchantItem, EnchantSupportItem supportItem)
|
||||
{
|
||||
if (!isValid(enchantItem, supportItem))
|
||||
{
|
||||
return EnchantResultType.ERROR;
|
||||
}
|
||||
|
||||
final double chance = getChance(player, enchantItem);
|
||||
if (chance == -1)
|
||||
{
|
||||
return EnchantResultType.ERROR;
|
||||
}
|
||||
|
||||
final double bonusRate = getBonusRate();
|
||||
final double supportBonusRate = (supportItem != null) ? supportItem.getBonusRate() : 0;
|
||||
final double finalChance = Math.min(chance + bonusRate + supportBonusRate, 100);
|
||||
|
||||
final double random = 100 * Rnd.nextDouble();
|
||||
final boolean success = (random < finalChance);
|
||||
|
||||
if (player.isDebug())
|
||||
{
|
||||
final EnchantItemGroup group = EnchantItemGroupsData.getInstance().getItemGroup(enchantItem.getItem(), _scrollGroupId);
|
||||
final StatsSet set = new StatsSet();
|
||||
if (isBlessed())
|
||||
{
|
||||
set.set("isBlessed", isBlessed());
|
||||
}
|
||||
if (isSafe())
|
||||
{
|
||||
set.set("isSafe", isSafe());
|
||||
}
|
||||
set.set("chance", Util.formatDouble(chance, "#.##"));
|
||||
if (bonusRate > 0)
|
||||
{
|
||||
set.set("bonusRate", Util.formatDouble(bonusRate, "#.##"));
|
||||
}
|
||||
if (supportBonusRate > 0)
|
||||
{
|
||||
set.set("supportBonusRate", Util.formatDouble(supportBonusRate, "#.##"));
|
||||
}
|
||||
set.set("finalChance", Util.formatDouble(finalChance, "#.##"));
|
||||
set.set("random", Util.formatDouble(random, "#.##"));
|
||||
set.set("success", success);
|
||||
set.set("item group", group.getName());
|
||||
set.set("scroll group", _scrollGroupId);
|
||||
Debug.sendItemDebug(player, enchantItem, set);
|
||||
}
|
||||
return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE;
|
||||
}
|
||||
}
|
||||
|
@ -1,82 +1,82 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items.enchant;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public final class EnchantScrollGroup
|
||||
{
|
||||
private final int _id;
|
||||
private List<EnchantRateItem> _rateGroups;
|
||||
|
||||
public EnchantScrollGroup(int id)
|
||||
{
|
||||
_id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return id of current enchant scroll group.
|
||||
*/
|
||||
public int getId()
|
||||
{
|
||||
return _id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds new rate group.
|
||||
* @param group
|
||||
*/
|
||||
public void addRateGroup(EnchantRateItem group)
|
||||
{
|
||||
if (_rateGroups == null)
|
||||
{
|
||||
_rateGroups = new ArrayList<>();
|
||||
}
|
||||
_rateGroups.add(group);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code List} of all enchant rate items, Empty list if none.
|
||||
*/
|
||||
public List<EnchantRateItem> getRateGroups()
|
||||
{
|
||||
return _rateGroups != null ? _rateGroups : Collections.<EnchantRateItem> emptyList();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param item
|
||||
* @return {@link EnchantRateItem}, {@code NULL} in case non of rate items can be used with.
|
||||
*/
|
||||
public EnchantRateItem getRateGroup(L2Item item)
|
||||
{
|
||||
for (EnchantRateItem group : getRateGroups())
|
||||
{
|
||||
if (group.validate(item))
|
||||
{
|
||||
return group;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items.enchant;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public final class EnchantScrollGroup
|
||||
{
|
||||
private final int _id;
|
||||
private List<EnchantRateItem> _rateGroups;
|
||||
|
||||
public EnchantScrollGroup(int id)
|
||||
{
|
||||
_id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return id of current enchant scroll group.
|
||||
*/
|
||||
public int getId()
|
||||
{
|
||||
return _id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds new rate group.
|
||||
* @param group
|
||||
*/
|
||||
public void addRateGroup(EnchantRateItem group)
|
||||
{
|
||||
if (_rateGroups == null)
|
||||
{
|
||||
_rateGroups = new ArrayList<>();
|
||||
}
|
||||
_rateGroups.add(group);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code List} of all enchant rate items, Empty list if none.
|
||||
*/
|
||||
public List<EnchantRateItem> getRateGroups()
|
||||
{
|
||||
return _rateGroups != null ? _rateGroups : Collections.emptyList();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param item
|
||||
* @return {@link EnchantRateItem}, {@code NULL} in case non of rate items can be used with.
|
||||
*/
|
||||
public EnchantRateItem getRateGroup(L2Item item)
|
||||
{
|
||||
for (EnchantRateItem group : getRateGroups())
|
||||
{
|
||||
if (group.validate(item))
|
||||
{
|
||||
return group;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -1,47 +1,40 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items.enchant;
|
||||
|
||||
import com.l2jmobius.gameserver.model.StatsSet;
|
||||
import com.l2jmobius.gameserver.model.items.type.EtcItemType;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public final class EnchantSupportItem extends AbstractEnchantItem
|
||||
{
|
||||
private final boolean _isWeapon;
|
||||
|
||||
public EnchantSupportItem(StatsSet set)
|
||||
{
|
||||
super(set);
|
||||
if ((getItem().getItemType() == EtcItemType.SCRL_INC_ENCHANT_PROP_WP) || (getItem().getItemType() == EtcItemType.BLESS_SCRL_INC_ENCHANT_PROP_WP) || (getItem().getItemType() == EtcItemType.GIANT_SCRL_INC_ENCHANT_PROP_WP) || (getItem().getItemType() == EtcItemType.GIANT_SCRL_BLESS_INC_ENCHANT_PROP_WP) || (getItem().getItemType() == EtcItemType.SCRL_BLESS_INC_ENCHANT_PROP_WP) || (getItem().getItemType() == EtcItemType.BLESS_DROP_SCRL_INC_ENCHANT_PROP_WP) || (getItem().getItemType() == EtcItemType.GIANT2_SCRL_BLESS_INC_ENCHANT_PROP_WP))
|
||||
{
|
||||
_isWeapon = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_isWeapon = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWeapon()
|
||||
{
|
||||
return _isWeapon;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items.enchant;
|
||||
|
||||
import com.l2jmobius.gameserver.model.StatsSet;
|
||||
import com.l2jmobius.gameserver.model.items.type.EtcItemType;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public final class EnchantSupportItem extends AbstractEnchantItem
|
||||
{
|
||||
private final boolean _isWeapon;
|
||||
|
||||
public EnchantSupportItem(StatsSet set)
|
||||
{
|
||||
super(set);
|
||||
_isWeapon = getItem().getItemType() == EtcItemType.ENCHT_ATTR_INC_PROP_ENCHT_WP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWeapon()
|
||||
{
|
||||
return _isWeapon;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items.enchant.attribute;
|
||||
|
||||
import com.l2jmobius.gameserver.enums.AttributeType;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class AttributeHolder
|
||||
{
|
||||
private final AttributeType _type;
|
||||
private int _value;
|
||||
|
||||
public AttributeHolder(AttributeType type, int value)
|
||||
{
|
||||
_type = type;
|
||||
_value = value;
|
||||
}
|
||||
|
||||
public AttributeType getType()
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
|
||||
public int getValue()
|
||||
{
|
||||
return _value;
|
||||
}
|
||||
|
||||
public void setValue(int value)
|
||||
{
|
||||
_value = value;
|
||||
}
|
||||
|
||||
public void incValue(int with)
|
||||
{
|
||||
_value += with;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return _type.name() + " +" + _value;
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,51 +1,53 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items.type;
|
||||
|
||||
/**
|
||||
* Action Type enumerated.
|
||||
* @author nBd
|
||||
*/
|
||||
public enum ActionType
|
||||
{
|
||||
CALC,
|
||||
CALL_SKILL,
|
||||
CAPSULE,
|
||||
CREATE_MPCC,
|
||||
DICE,
|
||||
EQUIP,
|
||||
FISHINGSHOT,
|
||||
HARVEST,
|
||||
HIDE_NAME,
|
||||
KEEP_EXP,
|
||||
NICK_COLOR,
|
||||
NONE,
|
||||
PEEL,
|
||||
RECIPE,
|
||||
SEED,
|
||||
SHOW_ADVENTURER_GUIDE_BOOK,
|
||||
SHOW_HTML,
|
||||
SHOW_SSQ_STATUS,
|
||||
SKILL_MAINTAIN,
|
||||
SKILL_REDUCE,
|
||||
SOULSHOT,
|
||||
SPIRITSHOT,
|
||||
START_QUEST,
|
||||
SUMMON_SOULSHOT,
|
||||
SUMMON_SPIRITSHOT,
|
||||
XMAS_OPEN,
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items.type;
|
||||
|
||||
/**
|
||||
* Action Type enumerated.
|
||||
* @author nBd
|
||||
*/
|
||||
public enum ActionType
|
||||
{
|
||||
CALC,
|
||||
CALL_SKILL,
|
||||
CAPSULE,
|
||||
CREATE_MPCC,
|
||||
DICE,
|
||||
EQUIP,
|
||||
FISHINGSHOT,
|
||||
HARVEST,
|
||||
HIDE_NAME,
|
||||
KEEP_EXP,
|
||||
NICK_COLOR,
|
||||
NONE,
|
||||
PEEL,
|
||||
RECIPE,
|
||||
SEED,
|
||||
SHOW_ADVENTURER_GUIDE_BOOK,
|
||||
SHOW_HTML,
|
||||
SHOW_SSQ_STATUS,
|
||||
SKILL_MAINTAIN,
|
||||
SKILL_REDUCE,
|
||||
SOULSHOT,
|
||||
SPIRITSHOT,
|
||||
START_QUEST,
|
||||
SUMMON_SOULSHOT,
|
||||
SUMMON_SPIRITSHOT,
|
||||
XMAS_OPEN,
|
||||
SKILL_REDUCE_ON_SKILL_SUCCESS,
|
||||
SHOW_TUTORIAL
|
||||
}
|
||||
|
@ -1,51 +1,51 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items.type;
|
||||
|
||||
/**
|
||||
* Armor Type enumerated.
|
||||
*/
|
||||
public enum ArmorType implements ItemType
|
||||
{
|
||||
NONE,
|
||||
LIGHT,
|
||||
HEAVY,
|
||||
MAGIC,
|
||||
SIGIL,
|
||||
|
||||
// L2J CUSTOM
|
||||
SHIELD;
|
||||
|
||||
final int _mask;
|
||||
|
||||
/**
|
||||
* Constructor of the ArmorType.
|
||||
*/
|
||||
private ArmorType()
|
||||
{
|
||||
_mask = 1 << (ordinal() + WeaponType.values().length);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the ID of the ArmorType after applying a mask.
|
||||
*/
|
||||
@Override
|
||||
public int mask()
|
||||
{
|
||||
return _mask;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items.type;
|
||||
|
||||
/**
|
||||
* Armor Type enumerated.
|
||||
*/
|
||||
public enum ArmorType implements ItemType
|
||||
{
|
||||
NONE,
|
||||
LIGHT,
|
||||
HEAVY,
|
||||
MAGIC,
|
||||
SIGIL,
|
||||
|
||||
// L2J CUSTOM
|
||||
SHIELD;
|
||||
|
||||
final int _mask;
|
||||
|
||||
/**
|
||||
* Constructor of the ArmorType.
|
||||
*/
|
||||
ArmorType()
|
||||
{
|
||||
_mask = 1 << (ordinal() + WeaponType.values().length);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the ID of the ArmorType after applying a mask.
|
||||
*/
|
||||
@Override
|
||||
public int mask()
|
||||
{
|
||||
return _mask;
|
||||
}
|
||||
}
|
||||
|
@ -1,88 +1,88 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items.type;
|
||||
|
||||
/**
|
||||
* Crystal Type enumerated.
|
||||
* @author Adry_85
|
||||
*/
|
||||
public enum CrystalType
|
||||
{
|
||||
NONE(0, 0, 0, 0),
|
||||
D(1, 1458, 11, 90),
|
||||
C(2, 1459, 6, 45),
|
||||
B(3, 1460, 11, 67),
|
||||
A(4, 1461, 20, 145),
|
||||
S(5, 1462, 25, 250),
|
||||
S80(6, 1462, 25, 250),
|
||||
S84(7, 1462, 25, 250),
|
||||
R(8, 17371, 30, 500),
|
||||
R95(9, 17371, 30, 500),
|
||||
R99(10, 17371, 30, 500),
|
||||
EVENT(0, 0, 0, 0);
|
||||
|
||||
private final int _id;
|
||||
private final int _crystalId;
|
||||
private final int _crystalEnchantBonusArmor;
|
||||
private final int _crystalEnchantBonusWeapon;
|
||||
|
||||
private CrystalType(int id, int crystalId, int crystalEnchantBonusArmor, int crystalEnchantBonusWeapon)
|
||||
{
|
||||
_id = id;
|
||||
_crystalId = crystalId;
|
||||
_crystalEnchantBonusArmor = crystalEnchantBonusArmor;
|
||||
_crystalEnchantBonusWeapon = crystalEnchantBonusWeapon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the crystal type ID.
|
||||
* @return the crystal type ID
|
||||
*/
|
||||
public int getId()
|
||||
{
|
||||
return _id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the item ID of the crystal.
|
||||
* @return the item ID of the crystal
|
||||
*/
|
||||
public int getCrystalId()
|
||||
{
|
||||
return _crystalId;
|
||||
}
|
||||
|
||||
public int getCrystalEnchantBonusArmor()
|
||||
{
|
||||
return _crystalEnchantBonusArmor;
|
||||
}
|
||||
|
||||
public int getCrystalEnchantBonusWeapon()
|
||||
{
|
||||
return _crystalEnchantBonusWeapon;
|
||||
}
|
||||
|
||||
public boolean isGreater(CrystalType crystalType)
|
||||
{
|
||||
return getId() > crystalType.getId();
|
||||
}
|
||||
|
||||
public boolean isLesser(CrystalType crystalType)
|
||||
{
|
||||
return getId() < crystalType.getId();
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items.type;
|
||||
|
||||
/**
|
||||
* Crystal Type enumerated.
|
||||
* @author Adry_85
|
||||
*/
|
||||
public enum CrystalType
|
||||
{
|
||||
NONE(0, 0, 0, 0),
|
||||
D(1, 1458, 11, 90),
|
||||
C(2, 1459, 6, 45),
|
||||
B(3, 1460, 11, 67),
|
||||
A(4, 1461, 20, 145),
|
||||
S(5, 1462, 25, 250),
|
||||
S80(6, 1462, 25, 250),
|
||||
S84(7, 1462, 25, 250),
|
||||
R(8, 17371, 30, 500),
|
||||
R95(9, 17371, 30, 500),
|
||||
R99(10, 17371, 30, 500),
|
||||
EVENT(11, 0, 0, 0);
|
||||
|
||||
private final int _id;
|
||||
private final int _crystalId;
|
||||
private final int _crystalEnchantBonusArmor;
|
||||
private final int _crystalEnchantBonusWeapon;
|
||||
|
||||
CrystalType(int id, int crystalId, int crystalEnchantBonusArmor, int crystalEnchantBonusWeapon)
|
||||
{
|
||||
_id = id;
|
||||
_crystalId = crystalId;
|
||||
_crystalEnchantBonusArmor = crystalEnchantBonusArmor;
|
||||
_crystalEnchantBonusWeapon = crystalEnchantBonusWeapon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the crystal type ID.
|
||||
* @return the crystal type ID
|
||||
*/
|
||||
public int getId()
|
||||
{
|
||||
return _id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the item ID of the crystal.
|
||||
* @return the item ID of the crystal
|
||||
*/
|
||||
public int getCrystalId()
|
||||
{
|
||||
return _crystalId;
|
||||
}
|
||||
|
||||
public int getCrystalEnchantBonusArmor()
|
||||
{
|
||||
return _crystalEnchantBonusArmor;
|
||||
}
|
||||
|
||||
public int getCrystalEnchantBonusWeapon()
|
||||
{
|
||||
return _crystalEnchantBonusWeapon;
|
||||
}
|
||||
|
||||
public boolean isGreater(CrystalType crystalType)
|
||||
{
|
||||
return getId() > crystalType.getId();
|
||||
}
|
||||
|
||||
public boolean isLesser(CrystalType crystalType)
|
||||
{
|
||||
return getId() < crystalType.getId();
|
||||
}
|
||||
}
|
||||
|
@ -1,83 +1,96 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items.type;
|
||||
|
||||
/**
|
||||
* EtcItem Type enumerated.
|
||||
*/
|
||||
public enum EtcItemType implements ItemType
|
||||
{
|
||||
NONE,
|
||||
ARROW,
|
||||
POTION,
|
||||
SCRL_ENCHANT_WP,
|
||||
SCRL_ENCHANT_AM,
|
||||
SCROLL,
|
||||
RECIPE,
|
||||
MATERIAL,
|
||||
PET_COLLAR,
|
||||
CASTLE_GUARD,
|
||||
LOTTO,
|
||||
RACE_TICKET,
|
||||
DYE,
|
||||
SEED,
|
||||
CROP,
|
||||
MATURECROP,
|
||||
HARVEST,
|
||||
SEED2,
|
||||
TICKET_OF_LORD,
|
||||
LURE,
|
||||
BLESS_SCRL_ENCHANT_WP,
|
||||
BLESS_SCRL_ENCHANT_AM,
|
||||
COUPON,
|
||||
ELIXIR,
|
||||
SCRL_ENCHANT_ATTR,
|
||||
BOLT,
|
||||
SCRL_INC_ENCHANT_PROP_WP,
|
||||
SCRL_INC_ENCHANT_PROP_AM,
|
||||
ANCIENT_CRYSTAL_ENCHANT_WP,
|
||||
ANCIENT_CRYSTAL_ENCHANT_AM,
|
||||
RUNE_SELECT,
|
||||
RUNE,
|
||||
GIANT_SCRL_ENCHANT_WP,
|
||||
GIANT_SCRL_ENCHANT_AM,
|
||||
BLESS_SCRL_INC_ENCHANT_PROP_WP,
|
||||
BLESS_SCRL_INC_ENCHANT_PROP_AM,
|
||||
GIANT_SCRL_INC_ENCHANT_PROP_WP,
|
||||
GIANT_SCRL_INC_ENCHANT_PROP_AM,
|
||||
GIANT_SCRL_BLESS_INC_ENCHANT_PROP_WP,
|
||||
GIANT_SCRL_BLESS_INC_ENCHANT_PROP_AM,
|
||||
SCRL_BLESS_INC_ENCHANT_PROP_WP,
|
||||
SCRL_BLESS_INC_ENCHANT_PROP_AM,
|
||||
BLESS_DROP_SCRL_INC_ENCHANT_PROP_WP,
|
||||
BLESS_DROP_SCRL_INC_ENCHANT_PROP_AM,
|
||||
GIANT2_SCRL_BLESS_INC_ENCHANT_PROP_WP,
|
||||
GIANT2_SCRL_BLESS_INC_ENCHANT_PROP_AM,
|
||||
SCRL_ENCHANT_HR,
|
||||
|
||||
// L2J CUSTOM, BACKWARD COMPATIBILITY
|
||||
SHOT;
|
||||
|
||||
/**
|
||||
* @return the ID of the item after applying the mask.
|
||||
*/
|
||||
@Override
|
||||
public int mask()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items.type;
|
||||
|
||||
/**
|
||||
* EtcItem Type enumerated.
|
||||
*/
|
||||
public enum EtcItemType implements ItemType
|
||||
{
|
||||
NONE,
|
||||
SCROLL,
|
||||
ARROW,
|
||||
POTION,
|
||||
SPELLBOOK,
|
||||
RECIPE,
|
||||
MATERIAL,
|
||||
PET_COLLAR,
|
||||
CASTLE_GUARD,
|
||||
DYE,
|
||||
SEED,
|
||||
SEED2,
|
||||
HARVEST,
|
||||
LOTTO,
|
||||
RACE_TICKET,
|
||||
TICKET_OF_LORD,
|
||||
LURE,
|
||||
CROP,
|
||||
MATURECROP,
|
||||
ENCHT_WP,
|
||||
ENCHT_AM,
|
||||
BLESS_ENCHT_WP,
|
||||
BLESS_ENCHT_AM,
|
||||
COUPON,
|
||||
ELIXIR,
|
||||
ENCHT_ATTR,
|
||||
ENCHT_ATTR_CURSED,
|
||||
BOLT,
|
||||
ENCHT_ATTR_INC_PROP_ENCHT_WP,
|
||||
ENCHT_ATTR_INC_PROP_ENCHT_AM,
|
||||
ENCHT_ATTR_CRYSTAL_ENCHANT_AM,
|
||||
ENCHT_ATTR_CRYSTAL_ENCHANT_WP,
|
||||
ENCHT_ATTR_ANCIENT_CRYSTAL_ENCHANT_AM,
|
||||
ENCHT_ATTR_ANCIENT_CRYSTAL_ENCHANT_WP,
|
||||
ENCHT_ATTR_RUNE,
|
||||
ENCHT_ATTRT_RUNE_SELECT,
|
||||
TELEPORTBOOKMARK,
|
||||
CHANGE_ATTR,
|
||||
SOULSHOT,
|
||||
SHAPE_SHIFTING_WP,
|
||||
BLESS_SHAPE_SHIFTING_WP,
|
||||
// EIT_RESTORE_SHAPE_SHIFTING_WP,
|
||||
SHAPE_SHIFTING_WP_FIXED,
|
||||
SHAPE_SHIFTING_AM,
|
||||
BLESS_SHAPE_SHIFTING_AM,
|
||||
SHAPE_SHIFTING_AM_FIXED,
|
||||
SHAPE_SHIFTING_HAIRACC,
|
||||
BLESS_SHAPE_SHIFTING_HAIRACC,
|
||||
SHAPE_SHIFTING_HAIRACC_FIXED,
|
||||
RESTORE_SHAPE_SHIFTING_WP,
|
||||
RESTORE_SHAPE_SHIFTING_AM,
|
||||
RESTORE_SHAPE_SHIFTING_HAIRACC,
|
||||
RESTORE_SHAPE_SHIFTING_ALLITEM,
|
||||
BLESS_INC_PROP_ENCHT_WP,
|
||||
BLESS_INC_PROP_ENCHT_AM,
|
||||
CARD_EVENT,
|
||||
SHAPE_SHIFTING_ALLITEM_FIXED,
|
||||
MULTI_ENCHT_WP,
|
||||
MULTI_ENCHT_AM,
|
||||
MULTI_INC_PROB_ENCHT_WP,
|
||||
MULTI_INC_PROB_ENCHT_AM,
|
||||
SOUL_CRYSTAL,
|
||||
ENSOUL_STONE;
|
||||
|
||||
/**
|
||||
* @return the ID of the item after applying the mask.
|
||||
*/
|
||||
@Override
|
||||
public int mask()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,26 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items.type;
|
||||
|
||||
/**
|
||||
* Created for allow comparing different item types
|
||||
* @author DS
|
||||
*/
|
||||
public interface ItemType
|
||||
{
|
||||
int mask();
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items.type;
|
||||
|
||||
/**
|
||||
* Created for allow comparing different item types
|
||||
* @author DS
|
||||
*/
|
||||
public interface ItemType
|
||||
{
|
||||
int mask();
|
||||
}
|
@ -1,53 +1,53 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items.type;
|
||||
|
||||
/**
|
||||
* Material Type enumerated.
|
||||
* @author Adry_85
|
||||
*/
|
||||
public enum MaterialType
|
||||
{
|
||||
STEEL,
|
||||
FINE_STEEL,
|
||||
COTTON,
|
||||
BLOOD_STEEL,
|
||||
BRONZE,
|
||||
SILVER,
|
||||
GOLD,
|
||||
MITHRIL,
|
||||
ORIHARUKON,
|
||||
PAPER,
|
||||
WOOD,
|
||||
CLOTH,
|
||||
LEATHER,
|
||||
BONE,
|
||||
HORN,
|
||||
DAMASCUS,
|
||||
ADAMANTAITE,
|
||||
CHRYSOLITE,
|
||||
CRYSTAL,
|
||||
LIQUID,
|
||||
SCALE_OF_DRAGON,
|
||||
DYESTUFF,
|
||||
COBWEB,
|
||||
SEED,
|
||||
FISH,
|
||||
RUNE_XP,
|
||||
RUNE_SP,
|
||||
RUNE_REMOVE_PENALTY;
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items.type;
|
||||
|
||||
/**
|
||||
* Material Type enumerated.
|
||||
* @author Adry_85
|
||||
*/
|
||||
public enum MaterialType
|
||||
{
|
||||
STEEL,
|
||||
FINE_STEEL,
|
||||
COTTON,
|
||||
BLOOD_STEEL,
|
||||
BRONZE,
|
||||
SILVER,
|
||||
GOLD,
|
||||
MITHRIL,
|
||||
ORIHARUKON,
|
||||
PAPER,
|
||||
WOOD,
|
||||
CLOTH,
|
||||
LEATHER,
|
||||
BONE,
|
||||
HORN,
|
||||
DAMASCUS,
|
||||
ADAMANTAITE,
|
||||
CHRYSOLITE,
|
||||
CRYSTAL,
|
||||
LIQUID,
|
||||
SCALE_OF_DRAGON,
|
||||
DYESTUFF,
|
||||
COBWEB,
|
||||
SEED,
|
||||
FISH,
|
||||
RUNE_XP,
|
||||
RUNE_SP,
|
||||
RUNE_REMOVE_PENALTY
|
||||
}
|
||||
|
@ -1,75 +1,91 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items.type;
|
||||
|
||||
import com.l2jmobius.gameserver.model.stats.TraitType;
|
||||
|
||||
/**
|
||||
* Weapon Type enumerated.
|
||||
* @author mkizub
|
||||
*/
|
||||
public enum WeaponType implements ItemType
|
||||
{
|
||||
SWORD(TraitType.SWORD),
|
||||
BLUNT(TraitType.BLUNT),
|
||||
DAGGER(TraitType.DAGGER),
|
||||
BOW(TraitType.BOW),
|
||||
POLE(TraitType.POLE),
|
||||
NONE(TraitType.NONE),
|
||||
DUAL(TraitType.DUAL),
|
||||
ETC(TraitType.ETC),
|
||||
FIST(TraitType.FIST),
|
||||
DUALFIST(TraitType.DUALFIST),
|
||||
FISHINGROD(TraitType.NONE),
|
||||
RAPIER(TraitType.RAPIER),
|
||||
ANCIENTSWORD(TraitType.ANCIENTSWORD),
|
||||
CROSSBOW(TraitType.CROSSBOW),
|
||||
FLAG(TraitType.NONE),
|
||||
OWNTHING(TraitType.NONE),
|
||||
DUALDAGGER(TraitType.DUALDAGGER),
|
||||
DUALBLUNT(TraitType.DUALBLUNT);
|
||||
|
||||
private final int _mask;
|
||||
private final TraitType _traitType;
|
||||
|
||||
/**
|
||||
* Constructor of the L2WeaponType.
|
||||
* @param traitType
|
||||
*/
|
||||
private WeaponType(TraitType traitType)
|
||||
{
|
||||
_mask = 1 << ordinal();
|
||||
_traitType = traitType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the ID of the item after applying the mask.
|
||||
*/
|
||||
@Override
|
||||
public int mask()
|
||||
{
|
||||
return _mask;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return L2TraitType the type of the WeaponType
|
||||
*/
|
||||
public TraitType getTraitType()
|
||||
{
|
||||
return _traitType;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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.l2jmobius.gameserver.model.items.type;
|
||||
|
||||
import com.l2jmobius.gameserver.model.stats.TraitType;
|
||||
|
||||
/**
|
||||
* Weapon Type enumerated.
|
||||
* @author mkizub
|
||||
*/
|
||||
public enum WeaponType implements ItemType
|
||||
{
|
||||
NONE(TraitType.NONE),
|
||||
SWORD(TraitType.SWORD),
|
||||
BLUNT(TraitType.BLUNT),
|
||||
DAGGER(TraitType.DAGGER),
|
||||
POLE(TraitType.POLE),
|
||||
DUALFIST(TraitType.DUALFIST),
|
||||
BOW(TraitType.BOW),
|
||||
ETC(TraitType.ETC),
|
||||
DUAL(TraitType.DUAL),
|
||||
FIST(TraitType.FIST), // 0 items with that type
|
||||
FISHINGROD(TraitType.NONE),
|
||||
RAPIER(TraitType.RAPIER),
|
||||
CROSSBOW(TraitType.CROSSBOW),
|
||||
ANCIENTSWORD(TraitType.ANCIENTSWORD),
|
||||
FLAG(TraitType.NONE), // 0 items with that type
|
||||
DUALDAGGER(TraitType.DUALDAGGER),
|
||||
OWNTHING(TraitType.NONE), // 0 items with that type
|
||||
TWOHANDCROSSBOW(TraitType.TWOHANDCROSSBOW),
|
||||
DUALBLUNT(TraitType.DUALBLUNT);
|
||||
|
||||
private final int _mask;
|
||||
private final TraitType _traitType;
|
||||
|
||||
/**
|
||||
* Constructor of the L2WeaponType.
|
||||
* @param traitType
|
||||
*/
|
||||
WeaponType(TraitType traitType)
|
||||
{
|
||||
_mask = 1 << ordinal();
|
||||
_traitType = traitType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the ID of the item after applying the mask.
|
||||
*/
|
||||
@Override
|
||||
public int mask()
|
||||
{
|
||||
return _mask;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return L2TraitType the type of the WeaponType
|
||||
*/
|
||||
public TraitType getTraitType()
|
||||
{
|
||||
return _traitType;
|
||||
}
|
||||
|
||||
public boolean isRanged()
|
||||
{
|
||||
return (this == BOW) || (this == CROSSBOW) || (this == TWOHANDCROSSBOW);
|
||||
}
|
||||
|
||||
public boolean isCrossbow()
|
||||
{
|
||||
return (this == CROSSBOW) || (this == TWOHANDCROSSBOW);
|
||||
}
|
||||
|
||||
public boolean isDual()
|
||||
{
|
||||
return (this == DUALFIST) || (this == DUAL) || (this == DUALDAGGER) || (this == DUALBLUNT);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user