22.06.2010, 22:38
|
#3
|
Герой
Регистрация: 25.02.2010
Адрес: квартира
Сообщений: 360
Отблагодарили 56 раз(а)
Рейтинг мнений:
|
Re: ошибки в компиляции
Ой, точно . Да и мне хотя бы понять что такого надо поправить, чтобы данная ошибка исчезла. И я уже с другими справлюсь думаю.
Свернуть ↑
PHP код:
package nnt.gameserver.templates;
import java.util.List;
import nnt.gameserver.model.L2Character;
import nnt.gameserver.model.L2Skill;
import nnt.gameserver.model.L2Summon;
import nnt.gameserver.model.base.Grade;
import nnt.gameserver.model.instances.L2ItemInstance.ItemClass;
import nnt.gameserver.serverpackets.SystemMessage;
import nnt.gameserver.skills.Env;
import nnt.gameserver.skills.conditions.Condition;
import nnt.gameserver.skills.funcs.FuncTemplate;
import nnt.gameserver.tables.SkillTable;
import nnt.gameserver.templates.L2EtcItem.EtcItemType;
import nnt.gameserver.templates.L2Weapon.WeaponType;
import javolution.util.FastList;
/**
* This class contains all informations concerning the item (weapon, armor, etc).<BR>
* Mother class of :
* <LI>L2Armor</LI>
* <LI>L2EtcItem</LI>
* <LI>L2Weapon</LI>
*/
public abstract class L2Item
{
/**
* Pc Cafe Bang Points item id. Используется на корейских серверах, но английский клиент в состоянии
* поддерживать даный функционал.
*/
public static final short ITEM_ID_PC_BANG_POINTS = -100;
/**
* Item ID для клановой репутации
*/
public static final short ITEM_ID_CLAN_REPUTATION_SCORE = -200;
public static final short ITEM_ID_PLAYER_FAME = -300;
public static final int TYPE1_WEAPON_RING_EARRING_NECKLACE = 0;
public static final int TYPE1_SHIELD_ARMOR = 1;
public static final int TYPE1_ITEM_QUESTITEM_ADENA = 4;
public static final byte TYPE2_WEAPON = 0;
public static final byte TYPE2_SHIELD_ARMOR = 1;
public static final byte TYPE2_ACCESSORY = 2;
public static final byte TYPE2_QUEST = 3;
public static final byte TYPE2_MONEY = 4;
public static final byte TYPE2_OTHER = 5;
public static final byte TYPE2_PET_WOLF = 6;
public static final byte TYPE2_PET_HATCHLING = 7;
public static final byte TYPE2_PET_STRIDER = 8;
public static final byte TYPE2_NODROP = 9;
public static final byte TYPE2_PET_GWOLF = 10;
public static final byte TYPE2_TALISMAN = 11;
public static final byte TYPE2_PET_BABY = 12;
public static final byte TYPE2_PENDANT = 13;
public static final int SLOT_NONE = 0x00000;
public static final int SLOT_UNDERWEAR = 0x00001;
public static final int SLOT_CLOAK = 0x0003; //TODO:????
public static final int SLOT_R_EAR = 0x00002;
public static final int SLOT_L_EAR = 0x00004;
public static final int SLOT_NECK = 0x00008;
public static final int SLOT_R_FINGER = 0x00010;
public static final int SLOT_L_FINGER = 0x00020;
public static final int SLOT_BELT = 0x10000000;
public static final int SLOT_HEAD = 0x00040;
public static final int SLOT_R_HAND = 0x00080;
public static final int SLOT_L_HAND = 0x00100;
public static final int SLOT_GLOVES = 0x00200;
public static final int SLOT_CHEST = 0x00400;
public static final int SLOT_LEGS = 0x00800;
public static final int SLOT_FEET = 0x01000;
public static final int SLOT_BACK = 0x02000;
public static final int SLOT_LR_HAND = 0x04000;
public static final int SLOT_FULL_ARMOR = 0x08000;
public static final int SLOT_HAIR = 0x10000;
public static final int SLOT_FORMAL_WEAR = 0x20000;
public static final int SLOT_DHAIR = 0x40000;
public static final int SLOT_HAIRALL = 0x80000;
public static final int SLOT_R_BRACELET = 0x100000;
public static final int SLOT_L_BRACELET = 0x200000;
public static final int SLOT_DECO = 0x400000;
public static final int SLOT_WOLF = -100;
public static final int SLOT_HATCHLING = -101;
public static final int SLOT_STRIDER = -102;
public static final int SLOT_BABYPET = -103;
public static final int SLOT_GWOLF = -104;
public static final int SLOT_PENDANT = -105;
public static final byte MATERIAL_STEEL = 0x00;
public static final byte MATERIAL_FINE_STEEL = 0x01;
public static final byte MATERIAL_BLOOD_STEEL = 0x02;
public static final byte MATERIAL_BRONZE = 0x03;
public static final byte MATERIAL_SILVER = 0x04;
public static final byte MATERIAL_GOLD = 0x05;
public static final byte MATERIAL_MITHRIL = 0x06;
public static final byte MATERIAL_ORIHARUKON = 0x07;
public static final byte MATERIAL_PAPER = 0x08;
public static final byte MATERIAL_WOOD = 0x09;
public static final byte MATERIAL_CLOTH = 0x0a;
public static final byte MATERIAL_LEATHER = 0x0b;
public static final byte MATERIAL_BONE = 0x0c;
public static final byte MATERIAL_HORN = 0x0d;
public static final byte MATERIAL_DAMASCUS = 0x0e;
public static final byte MATERIAL_ADAMANTAITE = 0x0f;
public static final byte MATERIAL_CHRYSOLITE = 0x10;
public static final byte MATERIAL_CRYSTAL = 0x11;
public static final byte MATERIAL_LIQUID = 0x12;
public static final byte MATERIAL_SCALE_OF_DRAGON = 0x13;
public static final byte MATERIAL_DYESTUFF = 0x14;
public static final byte MATERIAL_COBWEB = 0x15;
public static final byte MATERIAL_SEED = 0x16;
public static final byte MATERIAL_FISH = 0x17;
public static final byte CRYSTAL_NONE = 0x00;
public static final byte CRYSTAL_D = 0x01;
public static final byte CRYSTAL_C = 0x02;
public static final byte CRYSTAL_B = 0x03;
public static final byte CRYSTAL_A = 0x04;
public static final byte CRYSTAL_S = 0x05;
public static final byte CRYSTAL_S80 = 0x06;
public static final byte CRYSTAL_S84 = 0x07;
public static final byte ATTRIBUTE_NONE = -2;
public static final byte ATTRIBUTE_FIRE = 0;
public static final byte ATTRIBUTE_WATER = 1;
public static final byte ATTRIBUTE_WIND = 2;
public static final byte ATTRIBUTE_EARTH = 3;
public static final byte ATTRIBUTE_HOLY = 4;
public static final byte ATTRIBUTE_DARK = 5;
private final short _itemId;
private final ItemClass _class;
protected final String _name;
protected final String _icon;
private final int _type1; // needed for item list (inventory)
private final int _type2; // different lists for armor, weapon, etc
private final int _weight;
protected final byte _crystalType; // default to none-grade
private final int _durability;
private final boolean _temporal;
private final int _bodyPart;
private final int _referencePrice;
private final short _crystalCount;
public static final int FLAG_NO_DROP = 2;
public static final int FLAG_NO_SELL = 4;
public static final int FLAG_NO_TRADE = 8;
public static final int FLAG_NO_DESTROY = 16;
public static final int FLAG_NO_CRYSTALLIZE = 32;
public static final int FLAG_NO_STACK = 64;
public static final int FLAG_HAVE_MORE_THEN_ONE_SKILL = 1024;
private int templateFlags = 0;
protected L2Skill _skillOnAction;
protected boolean _offensive;
protected byte _chance;
protected boolean _skillOnCritNotCast;
private L2Skill[] _skills;
protected List<Condition> _preConditions = new FastList<Condition>();
public final Enum<?> type;
protected FuncTemplate[] _funcTemplates;
/**
* Constructor of the L2Item that fill class variables.<BR><BR>
* <U><I>Variables filled :</I></U><BR>
* <LI>type</LI>
* <LI>_itemId</LI>
* <LI>_name</LI>
* <LI>_type1 & _type2</LI>
* <LI>_weight</LI>
* <LI>_crystallizable</LI>
* <LI>_stackable</LI>
* <LI>_materialType & _crystalType & _crystlaCount</LI>
* <LI>_durability</LI>
* <LI>_bodypart</LI>
* <LI>_referencePrice</LI>
* <LI>_sellable</LI>
* @param type : Enum designating the type of the item
* @param set : StatsSet corresponding to a set of couples (key,value) for description of the item
*/
protected L2Item(final Enum<?> type, final StatsSet set)
{
this.type = type;
_itemId = set.getShort("item_id");
_class = ItemClass.valueOf(set.getString("class"));
_name = set.getString("name");
_icon = set.getString("icon");
_type1 = set.getInteger("type1"); // needed for item list (inventory)
_type2 = set.getInteger("type2"); // different lists for armor, weapon, etc
_weight = set.getInteger("weight");
_crystalType = (byte) set.getInteger("crystal_type", CRYSTAL_NONE); // default to none-grade
_durability = set.getInteger("durability", -1);
_temporal = set.getBool("temporal", false);
_bodyPart = set.getInteger("bodypart");
_referencePrice = set.getInteger("price");
_crystalCount = set.getShort("crystal_count", (short) 0);
//Bits Flags By FlareDrakon кто полезет порву,два дня курил,экономия памяти 2^31 на каждый булеан
if(!set.getBool("dropable", true))
templateFlags = templateFlags | FLAG_NO_DROP;
if(!set.getBool("sellable", true))
templateFlags = templateFlags | FLAG_NO_SELL;
if(!set.getBool("tradeable", true))
templateFlags = templateFlags | FLAG_NO_TRADE;
if(!set.getBool("destroyable", true))
templateFlags = templateFlags | FLAG_NO_DESTROY;
if(!set.getBool("crystallizable"))
templateFlags = templateFlags | FLAG_NO_CRYSTALLIZE;
if(!set.getBool("stackable", false))
templateFlags = templateFlags | FLAG_NO_STACK;
final String[] skills = set.getString("skills").split(";");
if(skills != null)
{
if(skills.length > 1)
{
if(set.getBool("haveMoreThanOneSkill", false))
templateFlags = templateFlags | FLAG_HAVE_MORE_THEN_ONE_SKILL;
}
for(final String skillInfo : skills)
{
final String[] skill = skillInfo.split("-");
if(skill != null && skill.length == 2)
{
final int skillId = Integer.parseInt(skill[0]);
final int skillLvl = Integer.parseInt(skill[1]);
if(skillId > 0 && skillLvl > 0)
{
final L2Skill itemSkill = SkillTable.getInstance().getInfo(skillId, skillLvl);
if(itemSkill != null)
attachSkill(itemSkill);
}
}
}
}
//all polearms can multi attack off like sunc
if(getItemType() == WeaponType.POLE)
attachSkill(SkillTable.getInstance().getInfo(3599, 1));
}
/**
* Returns the itemType.
* @return Enum
*/
public Enum<?> getItemType()
{
return type;
}
/**
* Returns the durability of th item
* @return int
*/
public final int getDurability()
{
return _durability;
}
public final boolean isTemporal()
{
return _temporal;
}
/**
* Returns the ID of the item
* @return int
*/
public final int getItemId()
{
return _itemId;
}
public abstract int getItemMask();
/**
* Returns the type 2 of the item
* @return int
*/
public final int getType2()
{
return _type2;
}
/**
* Returns the weight of the item
* @return int
*/
public final int getWeight()
{
return _weight;
}
/**
* Returns if the item is crystallizable
* @return boolean
*/
public final boolean isCrystallizable()
{
return ((templateFlags & FLAG_NO_CRYSTALLIZE) != FLAG_NO_CRYSTALLIZE) && !isStackable() && !(getCrystalType() == L2Item.CRYSTAL_NONE) && !(getCrystalCount() <= 0);
}
/**
* Return the type of crystal if item is crystallizable
* @return int
*/
public final byte getCrystalType()
{
return _crystalType;
}
/**
* Returns the grade of the item.<BR><BR>
* <U><I>Concept :</I></U><BR>
* In fact, this fucntion returns the type of crystal of the item.
* @return int
*/
public final int getItemGrade()
{
return getCrystalType();
}
/**
* returns grade from enum object.
*
* @return Grade
*/
public final Grade getItemEnumGrade()
{
switch(getCrystalType())
{
case 0:
return Grade.NG;
case 1:
return Grade.D;
case 2:
return Grade.C;
case 3:
return Grade.B;
case 4:
return Grade.A;
case 5:
return Grade.S;
case 6:
return Grade.S80;
case 7:
return Grade.S82;
case 8:
return Grade.S84;
}
return Grade.NG;
}
/**
* Returns the quantity of crystals for crystallization
* @return int
*/
public final int getCrystalCount()
{
return _crystalCount;
}
/**
* Returns the name of the item
* @return String
*/
public final String getName()
{
return _name;
}
/**
* Returns the icon of the item
* @return String
*/
public final String getIcon()
{
return _icon;
}
/**
* Return the part of the body used with the item.
* @return int
*/
public final int getBodyPart()
{
return _bodyPart;
}
/**
* Returns the type 1 of the item
* @return int
*/
public final int getType1()
{
return _type1;
}
/**
* Returns if the item is stackable
* @return boolean
*/
public final boolean isStackable()
{
return (templateFlags & FLAG_NO_STACK) != FLAG_NO_STACK;
}
/**
* Returns the price of reference of the item
* @return int
*/
public final int getReferencePrice()
{
return _referencePrice;
}
/**
* Returns if the item can be sold
* @return boolean
*/
public final boolean isSellable()
{
return (templateFlags & FLAG_NO_SELL) != FLAG_NO_SELL;
}
public boolean isTradeable()
{
return (templateFlags & FLAG_NO_TRADE) != FLAG_NO_TRADE;
}
public boolean isDestroyable()
{
return (templateFlags & FLAG_NO_DESTROY) != FLAG_NO_DESTROY;
}
public boolean isDropable()
{
return (templateFlags & FLAG_NO_DROP) != FLAG_NO_DROP;
}
public boolean isHaveMoreThenOneSkill()
{
return (templateFlags & FLAG_HAVE_MORE_THEN_ONE_SKILL) == FLAG_HAVE_MORE_THEN_ONE_SKILL;
}
public boolean isForPet()
{
return _type2 == TYPE2_PET_HATCHLING || _type2 == TYPE2_PET_WOLF || _type2 == TYPE2_PET_STRIDER || _type2 == TYPE2_PET_GWOLF || _type2 == TYPE2_PET_BABY;
}
public void attachSkillOnAction(final L2Skill skill, final byte chance, final boolean onCritNotCast)
{
_skillOnAction = skill;
_offensive = skill.getTemplate().isOffensive();
_chance = chance;
_skillOnCritNotCast = onCritNotCast;
}
/**
* Add the FuncTemplate f to the list of functions used with the item
* @param f : FuncTemplate to add
*/
public void attachFunction(final FuncTemplate f)
{
if(_funcTemplates == null)
_funcTemplates = new FuncTemplate[] { f };
else
{
final int len = _funcTemplates.length;
final FuncTemplate[] tmp = new FuncTemplate[len + 1];
System.arraycopy(_funcTemplates, 0, tmp, 0, len);
tmp[len] = f;
_funcTemplates = tmp;
}
}
public FuncTemplate[] getAttachedFuncs()
{
return _funcTemplates;
}
public final void attach(Condition c)
{
if(!_preConditions.contains(c))
_preConditions.add(c);
}
/**
* Add the L2Skill skill to the list of skills generated by the item
* @param skill : L2Skill
*/
public void attachSkill(final L2Skill skill)
{
if(_skills == null)
_skills = new L2Skill[] { skill };
else
{
final int len = _skills.length;
final L2Skill[] tmp = new L2Skill[len + 1];
System.arraycopy(_skills, 0, tmp, 0, len);
tmp[len] = skill;
_skills = tmp;
}
}
public L2Skill[] getAttachedSkills()
{
return _skills;
}
public L2Skill getFirstSkill()
{
if(_skills != null && _skills.length > 0)
return _skills[0];
return null;
}
/**
* Returns the name of the item
* @return String
*/
@Override
public String toString()
{
return _name;
}
/**
* Определяет призрачный предмет или нет
* @return true, если предмет призрачный
*/
public boolean isShadowItem()
{
return _durability > 0 && !isTemporal();
}
/**
* Определяет стандартный (простой) предмет или нет
* @return true, если предмет простой
*/
public boolean isStandartItem()
{
return _durability == -2 && !isTemporal();
}
/**
* Определяет запечатаный предмет или нет
*
* @return true, если предмет простой
*/
public boolean isSealed()
{
return _durability == -3 && !isTemporal();
}
/**
* Определяет Masterwork предмет или нет
*
* @return true, если предмет простой
*/
public boolean isMasterwork()
{
return _durability == -4 && !isTemporal();
}
/**
* Определяет PvP предмет или нет
*
* @return true, если предмет простой
*/
public boolean isPvP()
{
return _durability == -5 && !isTemporal();
}
/**
* Определяет Event предмет или нет
*
* @return true, если предмет простой
*/
public boolean isEvent()
{
return _durability == -6 && !isTemporal();
}
public boolean isAltSeed()
{
return _name.contains("Alternative");
}
public ItemClass getItemClass()
{
return _class;
}
/**
* Является ли вещь аденой или камнем печати
*/
public boolean isAdena()
{
return _itemId == 57 || _itemId == 6360 || _itemId == 6361 || _itemId == 6362;
}
public boolean isEquipment()
{
return _type1 != TYPE1_ITEM_QUESTITEM_ADENA;
}
public boolean isKeyMatherial()
{
return _class == ItemClass.PIECES;
}
public boolean isSpellBook()
{
return _class == ItemClass.SPELLBOOKS;
}
public boolean isRaidAccessory()
{
return ((this._itemId == 6661) || (this._itemId == 6659) || (this._itemId == 6656) || (this._itemId == 6660) || (this._itemId == 6662) || (this._itemId == 6658) || (this._itemId == 8191) || (this._itemId == 6657));
}
/**
* Магическая броня для петов
*/
public boolean isPendant()
{
return _type2 == TYPE2_PENDANT;
}
public boolean isArrow()
{
return type == EtcItemType.ARROW;
}
public boolean isHerb()
{
return type == EtcItemType.HERB;
}
public boolean checkCondition(L2Character activeChar)
{
//if(activeChar.isGM() && !Config.GM_ITEM_RESTRICTION)
//return true;
Env env = new Env();
env.character = activeChar;
for(Condition preCondition : _preConditions)
{
if(preCondition == null)
return true;
if(!preCondition.test(env))
{
if(activeChar.isSummon || activeChar.isPet)
{
((L2Summon) activeChar).getOwner().sendPacket(new SystemMessage(SystemMessage.PETS_CANNOT_USE_THIS_ITEM));
return false;
}
else if(activeChar.isPlayer)
{
String msg = preCondition.getMessage();
int msgId = preCondition.getMessageId();
if(msg != null)
{
activeChar.getPlayer().sendMessage(msg);
}
else if(msgId !=0)
{
SystemMessage sm = new SystemMessage(msgId);
if(preCondition.isAddName())
sm.addItemName(_itemId);
activeChar.getPlayer().sendPacket(sm);
}
}
return false;
}
}
return true;
}
}
Свернуть ↑Развернуть ↓
__________________
Если помог, ткни плюсеГ, это же так просто
Последний раз редактировалось Ultimate; 22.06.2010 в 23:17.
|
|
|