Кидайте код под
PHP код:
[src=java] .. [/src]
Добавлено через 12 минут
А нафига вам Switch в коде?
if (Rnd.get(10) == 5)
{
L2ItemInstance Weapon = activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
int MaxEnchant = Config.ENCHANT_WEAPON_MAX;
boolean ActiveWeapon = activeChar.getActiveWeaponInstance() != null;
boolean MaxEnchantAllowed = activeChar.getActiveWeaponInstance().getEnchantLevel() < MaxEnchant;
boolean isNotRoDWeapon = activeChar.getActiveWeaponInstance().getItem().getItemType() != L2WeaponType.ROD;
boolean isInInvetory = Weapon.getLocation() == L2ItemInstance.ItemLocation.INVENTORY;
boolean isParedol = Weapon.getLocation() == L2ItemInstance.ItemLocation.PAPERDOLL;
boolean itsMyWeapon = Weapon.getOwnerId() == activeChar.getObjectId();
int GoldBarID = 3470;
int GoldBarCount = 4;
if(ActiveWeapon && MaxEnchantAllowed && isNotRoDWeapon && isInInvetory && isParedol && itsMyWeapon)
{
activeChar.destroyItem("EnchantGb", GoldBarID, GoldBarCount, null, false);
Weapon.setEnchantLevel(Weapon.getEnchantLevel() + 1);
Weapon.updateDatabase();
activeChar.sendPacket(new EnchantResult(Weapon.getEnchantLevel()));
activeChar.sendPacket(new ItemList(activeChar, false));
activeChar.sendPacket(new InventoryUpdate());
activeChar.sendPacket(new StatusUpdate(activeChar));
activeChar.broadcastUserInfo();
SystemMessage sm = SystemMessage.sendString(GoldBarCount + "gold bars destroyed");
sm = SystemMessage.sendString("You have successfully enchant your " + Weapon.getItemName() + " to " + "+" + Weapon.getEnchantLevel());
activeChar.sendPacket(sm);
}
else
activeChar.sendMessage("Be careful there are some rules you must follow:You must have 4 gold bars, your weapon must be smaller than " + Config.ENCHANT_WEAPON_MAX + ", you must wear your weapon, you can't enchant rod weapons");
}
else
activeChar.sendMessage("Nothing happened try again");
Code: Java