com.aionemu.gameserver.model.gameobjects.Item

Here are the examples of the java api com.aionemu.gameserver.model.gameobjects.Item taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

986 Examples 7

19 Source : TemporaryTradeTimeTask.java
with GNU General Public License v3.0
from MobiusDevelopment

public boolean hasItem(Item item) {
    readLock();
    try {
        return items.containsKey(item);
    } finally {
        readUnlock();
    }
}

19 Source : ItemUpgradeService.java
with GNU General Public License v3.0
from MobiusDevelopment

public static boolean decreaseMaterial(Player player, Item baseItem, int resulreplacedemId) {
    final FastMap<Integer, UpgradeResulreplacedem> resulreplacedemMap = DataManager.ITEM_UPGRADE_DATA.getResulreplacedemMap(baseItem.gereplacedemId());
    final UpgradeResulreplacedem resulreplacedem = resulreplacedemMap.get(resulreplacedemId);
    if (resulreplacedem.getNeed_kinah() == null) {
        for (SubMaterialItem item : resulreplacedem.getUpgrade_materials().getSubMaterialItem()) {
            if (!player.getInventory().decreaseByItemId(item.getId(), item.getCount())) {
                AuditLogger.info(player, "try item upgrade without sub material");
                return false;
            }
        }
    } else {
        player.getInventory().decreaseKinah(-resulreplacedem.getNeed_kinah().getCount());
    }
    if (resulreplacedem.getNeed_abyss_point() != null) {
        AbyssPointsService.setAp(player, -resulreplacedem.getNeed_abyss_point().getCount());
    }
    /*
		 * if (resulreplacedem.getNeed_kinah() != null) { player.getInventory().decreaseKinah(-resulreplacedem.getNeed_kinah().getCount()); }
		 */
    player.getInventory().decreaseByObjectId(baseItem.getObjectId(), 1);
    return true;
}

19 Source : ItemSplitService.java
with GNU General Public License v3.0
from MobiusDevelopment

/**
 * Merge 2 stacks with simple validation
 * @param sourceStorage
 * @param destStorage
 * @param sourceItem
 * @param targereplacedem
 * @param count
 */
public static void mergeStacks(IStorage sourceStorage, IStorage destStorage, Item sourceItem, Item targereplacedem, long count) {
    if (sourceItem.gereplacedemCount() >= count) {
        final long freeCount = targereplacedem.getFreeCount();
        count = count > freeCount ? freeCount : count;
        final long leftCount = destStorage.increaseItemCount(targereplacedem, count, sourceStorage.getStorageType() == destStorage.getStorageType() ? ItemUpdateType.INC_ITEM_MERGE : ItemUpdateType.INC_ITEM_COLLECT);
        sourceStorage.decreaseItemCount(sourceItem, count - leftCount, sourceStorage.getStorageType() == destStorage.getStorageType() ? ItemUpdateType.DEC_ITEM_SPLIT : ItemUpdateType.DEC_ITEM_SPLIT_MOVE);
    }
}

19 Source : ItemService.java
with GNU General Public License v3.0
from MobiusDevelopment

private static void enchant(Player player, int enchant, Item item) {
    if (isUpgradable(item)) {
        if (item.getEnchantLevel() == enchant) {
            return;
        }
        if (enchant > 25) {
            enchant = 25;
        }
        if (enchant < 0) {
            enchant = 0;
        }
        item.setEnchantLevel(enchant);
        if (item.isEquipped()) {
            player.getGameStats().updateStatsVisually();
        }
        ItemPacketService.updateItemAfterInfoChange(player, item);
    }
}

19 Source : ItemService.java
with GNU General Public License v3.0
from MobiusDevelopment

public static long addItem(Player player, Item sourceItem, ItemUpdatePredicate predicate) {
    return addItem(player, sourceItem.gereplacedemId(), sourceItem.gereplacedemCount(), sourceItem, predicate, 0);
}

19 Source : ItemService.java
with GNU General Public License v3.0
from MobiusDevelopment

/**
 * Add new item based on all sourceItem values
 * @param player
 * @param sourceItem
 * @return
 */
public static long addItem(Player player, Item sourceItem) {
    return addItem(player, sourceItem.gereplacedemId(), sourceItem.gereplacedemCount(), sourceItem, DEFAULT_UPDATE_PREDICATE, 0);
}

19 Source : ItemService.java
with GNU General Public License v3.0
from MobiusDevelopment

public static long addItem(Player player, int itemId, long count, Item sourceItem) {
    return addItem(player, itemId, count, sourceItem, DEFAULT_UPDATE_PREDICATE, 0);
}

19 Source : ItemChargeService.java
with GNU General Public License v3.0
from MobiusDevelopment

private static long calculatePrice(Collection<Item> items) {
    long result = 0;
    for (Item item : items) {
        result += getPayAmountForService(item, item.getChargeLevelMax());
    }
    return result;
}

19 Source : ItemChargeService.java
with GNU General Public License v3.0
from MobiusDevelopment

private static int getNextChargeLevel(Item item) {
    final int charge = item.getChargePoints();
    if (charge < ChargeInfo.LEVEL1) {
        return 1;
    }
    if (charge < ChargeInfo.LEVEL2) {
        return 2;
    }
    throw new IllegalArgumentException("Invalid charge level " + charge);
}

19 Source : ItemChargeService.java
with GNU General Public License v3.0
from MobiusDevelopment

private static boolean verifyRecomendRank(Player player, Item item) {
    final int rank = player.getAbyssRank().getRank().getId();
    if (!item.getImprovement().verifyRecomendRank(rank)) {
        return false;
    }
    return true;
}

19 Source : ItemChargeService.java
with GNU General Public License v3.0
from MobiusDevelopment

public static boolean processPayment(Player player, Item item, int level) {
    return processPayment(player, item.getImprovement().getChargeWay(), getPayAmountForService(item, level));
}

19 Source : ItemChargeService.java
with GNU General Public License v3.0
from MobiusDevelopment

public static void chargeItems(Player player, Collection<Item> items, int level) {
    for (Item item : items) {
        chargeItem(player, item, level);
    }
}

19 Source : ItemChargeService.java
with GNU General Public License v3.0
from MobiusDevelopment

public static long getPayAmountForService(Item item, int chargeLevel) {
    final Improvement improvement = item.getImprovement();
    if (improvement == null) {
        return 0;
    }
    final int price1 = improvement.getPrice1();
    final int price2 = improvement.getPrice2();
    final double firstLevel = price1 / 2;
    final double updateLevel = Math.round(firstLevel + ((price2 - price1) / 2d));
    double money = 0;
    switch(chargeLevel) {
        case 1:
            {
                money = firstLevel;
                break;
            }
        case 2:
            {
                switch(getNextChargeLevel(item)) {
                    case 1:
                        {
                            money = (firstLevel + updateLevel);
                            break;
                        }
                    case 2:
                        {
                            money = updateLevel;
                            break;
                        }
                }
                break;
            }
    }
    return (long) money;
}

19 Source : EnchantService.java
with GNU General Public License v3.0
from MobiusDevelopment

public static int BreakKinah(Item item) {
    return 20000;
}

19 Source : EnchantService.java
with GNU General Public License v3.0
from MobiusDevelopment

/**
 * Archdaeva's Remodeled Danuar Destroy Enchant: NEVER!!!
 * @param targereplacedem
 * @return
 */
public static boolean isArchdaevaRemodeledDanuar(Item targereplacedem) {
    switch(targereplacedem.gereplacedemId()) {
        case 110101990:
        case 110101991:
        case 110301966:
        case 110301967:
        case 110551314:
        case 110551315:
        case 110551316:
        case 110601754:
        case 110601755:
        case 111101784:
        case 111101785:
        case 111301905:
        case 111301906:
        case 111501874:
        case 111501875:
        case 111501876:
        case 111601718:
        case 111601719:
        case 112101729:
        case 112101730:
        case 112301842:
        case 112301843:
        case 112501810:
        case 112501811:
        case 112501812:
        case 112601699:
        case 112601700:
        case 113101795:
        case 113101796:
        case 113301936:
        case 113301937:
        case 113501893:
        case 113501894:
        case 113501895:
        case 113601701:
        case 113601702:
        case 114101829:
        case 114101830:
        case 114301973:
        case 114301974:
        case 114501901:
        case 114501902:
        case 114501903:
        case 114601707:
        case 114601708:
        case 115001961:
        case 115001962:
        case 101701506:
        case 101701505:
        case 100901525:
        case 101501510:
        case 101501511:
        case 101901245:
        case 101901246:
        case 102101183:
        case 102101184:
        case 100201670:
        case 100901524:
        case 100601566:
        case 101301408:
        case 102001369:
        case 102001368:
        case 100501447:
        case 101301409:
        case 100601565:
        case 100101490:
        case 100101489:
        case 100501448:
        case 100201671:
        case 101801340:
        case 101801341:
        case 100002007:
        case 100002008:
            {
                return true;
            }
    }
    return false;
}

19 Source : EnchantService.java
with GNU General Public License v3.0
from MobiusDevelopment

public static int EnchantLevel(Item item) {
    if (item.gereplacedemTemplate().isWeapon() || (item.gereplacedemTemplate().getArmorType() == ArmorType.SHIELD)) {
        if (((item.getEnchantLevel() >= item.gereplacedemTemplate().getMaxEnchantLevel()) && (item.getEnchantLevel() < 20)) || (item.gereplacedemTemplate().getMaxEnchantLevel() == 0)) {
            return 1;
        } else if (item.getEnchantLevel() >= 20) {
            return 4;
        } else {
            return 0;
        }
    } else if (item.gereplacedemTemplate().getArmorType() == ArmorType.PLUME) {
        if ((item.getAuthorize() >= 5) && (item.getAuthorize() < 10)) {
            return 8;
        } else if (item.getAuthorize() >= 10) {
            return 16;
        } else {
            return 0;
        }
    }
    return 0;
}

19 Source : QuestHandler.java
with GNU General Public License v3.0
from MobiusDevelopment

public boolean useQuesreplacedem(QuestEnv env, Item item, int step, int nextStep, boolean reward) {
    return useQuesreplacedem(env, item, step, nextStep, reward, 0, 0, 0);
}

19 Source : QuestHandler.java
with GNU General Public License v3.0
from MobiusDevelopment

public boolean useQuesreplacedem(QuestEnv env, Item item, int step, int nextStep, boolean reward, int addItemId, int addItemCount) {
    return useQuesreplacedem(env, item, step, nextStep, reward, addItemId, addItemCount, 0);
}

19 Source : QuestHandler.java
with GNU General Public License v3.0
from MobiusDevelopment

public boolean useQuesreplacedem(QuestEnv env, Item item, int step, int nextStep, boolean reward, int addItemId, int addItemCount, int movieId) {
    return useQuesreplacedem(env, item, step, nextStep, reward, addItemId, addItemCount, movieId, 0);
}

19 Source : QuestHandler.java
with GNU General Public License v3.0
from MobiusDevelopment

public boolean useQuesreplacedem(QuestEnv env, Item item, int step, int nextStep, boolean reward, int movieId) {
    return useQuesreplacedem(env, item, step, nextStep, reward, 0, 0, movieId);
}

19 Source : ManaStoneInfoBlobEntry.java
with GNU General Public License v3.0
from MobiusDevelopment

private void writeAmplification(ByteBuffer buf) {
    final Item item = ownerItem;
    writeC(buf, item.isAmplified() ? 1 : 0);
    writeD(buf, item.getAmplificationSkill());
}

19 Source : ItemInfoBlob.java
with GNU General Public License v3.0
from MobiusDevelopment

public static ItemBlobEntry newBlobEntry(ItemBlobType type, Player player, Item item) {
    if (type == ItemBlobType.STAT_BONUSES) {
        throw new UnsupportedOperationException();
    }
    final ItemBlobEntry ent = type.newBlobEntry();
    ent.setOwner(player, item, null);
    return ent;
}

19 Source : ExchangeItem.java
with GNU General Public License v3.0
from MobiusDevelopment

/**
 * @author ATracer
 */
public clreplaced ExchangeItem {

    private final int itemObjId;

    private long itemCount;

    private final int itemDesc;

    private Item item;

    /**
     * Used when exchange item != original item
     * @param itemObjId
     * @param itemCount
     * @param item
     */
    public ExchangeItem(int itemObjId, long itemCount, Item item) {
        this.itemObjId = itemObjId;
        this.itemCount = itemCount;
        this.item = item;
        itemDesc = item.gereplacedemTemplate().getNameId();
    }

    /**
     * @param item the item to set
     */
    public void sereplacedem(Item item) {
        this.item = item;
    }

    /**
     * @param countToAdd
     */
    public void addCount(long countToAdd) {
        itemCount += countToAdd;
        item.sereplacedemCount(itemCount);
    }

    /**
     * @return the newItem
     */
    public Item gereplacedem() {
        return item;
    }

    /**
     * @return the itemObjId
     */
    public int gereplacedemObjId() {
        return itemObjId;
    }

    /**
     * @return the itemCount
     */
    public long gereplacedemCount() {
        return itemCount;
    }

    /**
     * @return the itemDesc
     */
    public int gereplacedemDesc() {
        return itemDesc;
    }
}

19 Source : ExchangeItem.java
with GNU General Public License v3.0
from MobiusDevelopment

/**
 * @param item the item to set
 */
public void sereplacedem(Item item) {
    this.item = item;
}

19 Source : Exchange.java
with GNU General Public License v3.0
from MobiusDevelopment

/**
 * @param item
 */
public void addItemToUpdate(Item item) {
    itemsToUpdate.add(item);
}

19 Source : EnchantItemAction.java
with GNU General Public License v3.0
from MobiusDevelopment

@Override
public void act(Player player, Item parenreplacedem, Item targereplacedem) {
    act(player, parenreplacedem, targereplacedem, null, 1);
}

19 Source : ItemEquipmentListener.java
with GNU General Public License v3.0
from MobiusDevelopment

public static void addIdianBonusStats(Item item, List<StatFunction> modifiers, CreatureGameStats<?> cgs) {
    cgs.addEffect(item, modifiers);
}

19 Source : ItemEquipmentListener.java
with GNU General Public License v3.0
from MobiusDevelopment

/**
 * @param player
 * @param item
 */
private static void addGodstoneEffect(Player player, Item item) {
    if (item.getGodStone() != null) {
        item.getGodStone().onEquip(player);
    }
}

19 Source : ItemEquipmentListener.java
with GNU General Public License v3.0
from MobiusDevelopment

/**
 * @param player
 * @param item
 */
private static void removeGodstoneEffect(Player player, Item item) {
    if (item.getGodStone() != null) {
        item.getGodStone().onUnEquip(player);
    }
}

19 Source : ItemEquipmentListener.java
with GNU General Public License v3.0
from MobiusDevelopment

/**
 * All modifiers of stones will be applied to character
 * @param item
 * @param itemStones
 * @param cgs
 */
private static void addStonesStats(Item item, Set<? extends ManaStone> itemStones, CreatureGameStats<?> cgs) {
    if ((itemStones == null) || (itemStones.size() == 0)) {
        return;
    }
    for (ManaStone stone : itemStones) {
        addStoneStats(item, stone, cgs);
    }
}

19 Source : ItemEquipmentListener.java
with GNU General Public License v3.0
from MobiusDevelopment

public static void removeIdianBonusStats(Item item, CreatureGameStats<?> cgs) {
    cgs.endEffect(item);
}

19 Source : ItemEquipmentListener.java
with GNU General Public License v3.0
from MobiusDevelopment

/**
 * Used when socketing of equipped item
 * @param item
 * @param stone
 * @param cgs
 */
public static void addStoneStats(Item item, ManaStone stone, CreatureGameStats<?> cgs) {
    final List<StatFunction> modifiers = stone.getModifiers();
    if (modifiers == null) {
        return;
    }
    cgs.addEffect(stone, modifiers);
}

19 Source : PlayerGameStats.java
with GNU General Public License v3.0
from MobiusDevelopment

@Override
public Stat2 getMAttack() {
    int base;
    final Equipment equipment = owner.getEquipment();
    final Item mainHandWeapon = equipment.getMainHandWeapon();
    if (mainHandWeapon != null) {
        if (!mainHandWeapon.gereplacedemTemplate().getAttackType().isMagical()) {
            return new AdditionStat(StatEnum.MAGICAL_ATTACK, 0, owner);
        }
        base = mainHandWeapon.gereplacedemTemplate().getWeaponStats().getMeanDamage();
    } else {
        base = Rnd.get(16, 20);
    }
    return getStat(StatEnum.MAGICAL_ATTACK, base);
}

19 Source : StatEnchantFunction.java
with GNU General Public License v3.0
from MobiusDevelopment

/**
 * @author ATracer (based on Mr.Poke EnchantModifier)
 */
public clreplaced StatEnchantFunction extends StatAddFunction {

    private final Item item;

    private final int point;

    public StatEnchantFunction(Item owner, StatEnum stat, int point) {
        this.stat = stat;
        item = owner;
        this.point = point;
    }

    @Override
    public final int getPriority() {
        return 30;
    }

    @Override
    public void apply(Stat2 stat) {
        if (!item.isEquipped()) {
            return;
        }
        int enchantLvl = item.getEnchantLevel();
        if (item.gereplacedemTemplate().isAccessory() || (item.gereplacedemTemplate().getCategory() == ItemCategory.HELMET)) {
            enchantLvl = item.getAuthorize();
        }
        if (enchantLvl == 0) {
            return;
        }
        if (((item.getEquipmentSlot() & ItemSlot.MAIN_OFF_HAND.getSlotIdMask()) != 0) || ((item.getEquipmentSlot() & ItemSlot.SUB_OFF_HAND.getSlotIdMask()) != 0)) {
            return;
        }
        if ((item.gereplacedemTemplate().getArmorType() == ArmorType.PLUME) || (item.gereplacedemTemplate().getArmorType() == ArmorType.BRACELET)) {
            stat.addToBonus(getEnchantAdditionModifier(enchantLvl, stat));
        }
        stat.addToBase(getEnchantAdditionModifier(enchantLvl, stat));
    }

    private int getEnchantAdditionModifier(int enchantLvl, Stat2 stat) {
        if (item.gereplacedemTemplate().isWeapon()) {
            return getWeaponModifiers(enchantLvl);
        }
        if (item.gereplacedemTemplate().isAccessory() && item.gereplacedemTemplate().isPlume() && item.gereplacedemTemplate().isBracelet()) {
            if (point == 0) {
                return getAccessoryModifiers(enchantLvl);
            }
            return point;
        }
        if (item.gereplacedemTemplate().isArmor() || item.gereplacedemTemplate().isPlume() || item.gereplacedemTemplate().isBracelet()) {
            return getArmorModifiers(enchantLvl, stat);
        }
        return 0;
    }

    private int getWeaponModifiers(int enchantLvl) {
        switch(stat) {
            case MAIN_HAND_POWER:
            case OFF_HAND_POWER:
            case PHYSICAL_ATTACK:
                {
                    switch(item.gereplacedemTemplate().getWeaponType()) {
                        case GUN_1H:
                        case SWORD_1H:
                        case DAGGER_1H:
                            {
                                return 2 * enchantLvl;
                            }
                        case BOW:
                        case SWORD_2H:
                        case POLEARM_2H:
                            {
                                return 3 * enchantLvl;
                            }
                        case MACE_1H:
                        case STAFF_2H:
                            {
                                return 3 * enchantLvl;
                            }
                        default:
                            {
                                break;
                            }
                    }
                    return 0;
                }
            case BOOST_MAGICAL_SKILL:
                {
                    switch(item.gereplacedemTemplate().getWeaponType()) {
                        case ORB_2H:
                        case GUN_1H:
                        case HARP_2H:
                        case BOOK_2H:
                        case MACE_1H:
                        case STAFF_2H:
                        case CANNON_2H:
                        case KEYBLADE_2H:
                            {
                                return 20 * enchantLvl;
                            }
                        default:
                            {
                                break;
                            }
                    }
                    return 0;
                }
            case MAGICAL_ATTACK:
                {
                    switch(item.gereplacedemTemplate().getWeaponType()) {
                        case GUN_1H:
                            {
                                return 2 * enchantLvl;
                            }
                        case ORB_2H:
                        case BOOK_2H:
                        case HARP_2H:
                            {
                                return 3 * enchantLvl;
                            }
                        case CANNON_2H:
                        case KEYBLADE_2H:
                            {
                                return 3 * enchantLvl;
                            }
                        default:
                            {
                                break;
                            }
                    }
                    return 0;
                }
            default:
                {
                    return 0;
                }
        }
    }

    private int getAccessoryModifiers(int autorizeLvl) {
        switch(stat) {
            case PVP_ATTACK_RATIO:
            case PVP_ATTACK_RATIO_PHYSICAL:
            case PVP_ATTACK_RATIO_MAGICAL:
                {
                    switch(item.gereplacedemTemplate().getCategory()) {
                        case HELMET:
                        case EARRINGS:
                        case NECKLACE:
                            {
                                return 5 * autorizeLvl;
                            }
                        default:
                            {
                                break;
                            }
                    }
                }
            case PVP_DEFEND_RATIO:
            case PVP_DEFEND_RATIO_PHYSICAL:
            case PVP_DEFEND_RATIO_MAGICAL:
                {
                    switch(item.gereplacedemTemplate().getCategory()) {
                        case RINGS:
                        case BELT:
                            {
                                return 7 * autorizeLvl;
                            }
                        default:
                            {
                                break;
                            }
                    }
                }
            default:
                {
                    break;
                }
        }
        return 0;
    }

    private int getArmorModifiers(int enchantLvl, Stat2 applyStat) {
        final ArmorType armorType = item.gereplacedemTemplate().getArmorType();
        if (armorType == null) {
            return 0;
        }
        // long slot = item.getEquipmentSlot();
        final int equipmentSlot = (int) (item.getEquipmentSlot() & 0xFFFFFFFF);
        switch(item.gereplacedemTemplate().getArmorType()) {
            /**
             * 4.9 Enchant Stats
             */
            case ROBE:
                {
                    switch(equipmentSlot) {
                        case 1 << 5:
                        case 1 << 11:
                        case 1 << 4:
                            {
                                switch(stat) {
                                    case PHYSICAL_ATTACK:
                                        {
                                            return enchantLvl;
                                        }
                                    case BOOST_MAGICAL_SKILL:
                                        {
                                            return 2 * enchantLvl;
                                        }
                                    case PHYSICAL_DEFENSE:
                                        {
                                            return enchantLvl;
                                        }
                                    case MAXHP:
                                        {
                                            return 20 * enchantLvl;
                                        }
                                    case PHYSICAL_CRITICAL_RESIST:
                                        {
                                            return 2 * enchantLvl;
                                        }
                                    case MAGICAL_DEFEND:
                                        {
                                            return 2 * enchantLvl;
                                        }
                                    default:
                                        {
                                            break;
                                        }
                                }
                                return 0;
                            }
                        case 1 << 12:
                            {
                                switch(stat) {
                                    case PHYSICAL_ATTACK:
                                        {
                                            return enchantLvl;
                                        }
                                    case BOOST_MAGICAL_SKILL:
                                        {
                                            return 2 * enchantLvl;
                                        }
                                    case PHYSICAL_DEFENSE:
                                        {
                                            return 2 * enchantLvl;
                                        }
                                    case MAXHP:
                                        {
                                            return 22 * enchantLvl;
                                        }
                                    case PHYSICAL_CRITICAL_RESIST:
                                        {
                                            return 3 * enchantLvl;
                                        }
                                    case MAGICAL_DEFEND:
                                        {
                                            return 2 * enchantLvl;
                                        }
                                    default:
                                        {
                                            break;
                                        }
                                }
                                return 0;
                            }
                        case 1 << 3:
                            {
                                switch(stat) {
                                    case PHYSICAL_ATTACK:
                                        {
                                            return enchantLvl;
                                        }
                                    case BOOST_MAGICAL_SKILL:
                                        {
                                            return 2 * enchantLvl;
                                        }
                                    case PHYSICAL_DEFENSE:
                                        {
                                            return 3 * enchantLvl;
                                        }
                                    case MAXHP:
                                        {
                                            return 24 * enchantLvl;
                                        }
                                    case PHYSICAL_CRITICAL_RESIST:
                                        {
                                            return 4 * enchantLvl;
                                        }
                                    case MAGICAL_DEFEND:
                                        {
                                            return 3 * enchantLvl;
                                        }
                                    default:
                                        {
                                            break;
                                        }
                                }
                                return 0;
                            }
                    }
                    return 0;
                }
            case LEATHER:
                {
                    switch(equipmentSlot) {
                        case 1 << 5:
                        case 1 << 11:
                        case 1 << 4:
                            {
                                switch(stat) {
                                    case PHYSICAL_ATTACK:
                                        {
                                            return enchantLvl;
                                        }
                                    case BOOST_MAGICAL_SKILL:
                                        {
                                            return 2 * enchantLvl;
                                        }
                                    case PHYSICAL_DEFENSE:
                                        {
                                            return 2 * enchantLvl;
                                        }
                                    case MAXHP:
                                        {
                                            return 18 * enchantLvl;
                                        }
                                    case PHYSICAL_CRITICAL_RESIST:
                                        {
                                            return 2 * enchantLvl;
                                        }
                                    case MAGICAL_DEFEND:
                                        {
                                            return 2 * enchantLvl;
                                        }
                                    default:
                                        {
                                            break;
                                        }
                                }
                                return 0;
                            }
                        case 1 << 12:
                            {
                                switch(stat) {
                                    case PHYSICAL_ATTACK:
                                        {
                                            return enchantLvl;
                                        }
                                    case BOOST_MAGICAL_SKILL:
                                        {
                                            return 2 * enchantLvl;
                                        }
                                    case PHYSICAL_DEFENSE:
                                        {
                                            return 3 * enchantLvl;
                                        }
                                    case MAXHP:
                                        {
                                            return 20 * enchantLvl;
                                        }
                                    case PHYSICAL_CRITICAL_RESIST:
                                        {
                                            return 3 * enchantLvl;
                                        }
                                    case MAGICAL_DEFEND:
                                        {
                                            return 2 * enchantLvl;
                                        }
                                    default:
                                        {
                                            break;
                                        }
                                }
                                return 0;
                            }
                        case 1 << 3:
                            {
                                switch(stat) {
                                    case PHYSICAL_ATTACK:
                                        {
                                            return enchantLvl;
                                        }
                                    case BOOST_MAGICAL_SKILL:
                                        {
                                            return 2 * enchantLvl;
                                        }
                                    case PHYSICAL_DEFENSE:
                                        {
                                            return 4 * enchantLvl;
                                        }
                                    case MAXHP:
                                        {
                                            return 22 * enchantLvl;
                                        }
                                    case PHYSICAL_CRITICAL_RESIST:
                                        {
                                            return 4 * enchantLvl;
                                        }
                                    case MAGICAL_DEFEND:
                                        {
                                            return 3 * enchantLvl;
                                        }
                                    default:
                                        {
                                            break;
                                        }
                                }
                                return 0;
                            }
                    }
                    return 0;
                }
            case CHAIN:
                {
                    switch(equipmentSlot) {
                        case 1 << 5:
                        case 1 << 11:
                        case 1 << 4:
                            {
                                switch(stat) {
                                    case PHYSICAL_ATTACK:
                                        {
                                            return enchantLvl;
                                        }
                                    case BOOST_MAGICAL_SKILL:
                                        {
                                            return 2 * enchantLvl;
                                        }
                                    case PHYSICAL_DEFENSE:
                                        {
                                            return 3 * enchantLvl;
                                        }
                                    case MAXHP:
                                        {
                                            return 16 * enchantLvl;
                                        }
                                    case PHYSICAL_CRITICAL_RESIST:
                                        {
                                            return 2 * enchantLvl;
                                        }
                                    case MAGICAL_DEFEND:
                                        {
                                            return 2 * enchantLvl;
                                        }
                                    default:
                                        {
                                            break;
                                        }
                                }
                                return 0;
                            }
                        case 1 << 12:
                            {
                                switch(stat) {
                                    case PHYSICAL_ATTACK:
                                        {
                                            return enchantLvl;
                                        }
                                    case BOOST_MAGICAL_SKILL:
                                        {
                                            return 2 * enchantLvl;
                                        }
                                    case PHYSICAL_DEFENSE:
                                        {
                                            return 4 * enchantLvl;
                                        }
                                    case MAXHP:
                                        {
                                            return 18 * enchantLvl;
                                        }
                                    case PHYSICAL_CRITICAL_RESIST:
                                        {
                                            return 3 * enchantLvl;
                                        }
                                    case MAGICAL_DEFEND:
                                        {
                                            return 2 * enchantLvl;
                                        }
                                    default:
                                        {
                                            break;
                                        }
                                }
                                return 0;
                            }
                        case 1 << 3:
                            {
                                switch(stat) {
                                    case PHYSICAL_ATTACK:
                                        {
                                            return enchantLvl;
                                        }
                                    case BOOST_MAGICAL_SKILL:
                                        {
                                            return 2 * enchantLvl;
                                        }
                                    case PHYSICAL_DEFENSE:
                                        {
                                            return 5 * enchantLvl;
                                        }
                                    case MAXHP:
                                        {
                                            return 20 * enchantLvl;
                                        }
                                    case PHYSICAL_CRITICAL_RESIST:
                                        {
                                            return 4 * enchantLvl;
                                        }
                                    case MAGICAL_DEFEND:
                                        {
                                            return 3 * enchantLvl;
                                        }
                                    default:
                                        {
                                            break;
                                        }
                                }
                                return 0;
                            }
                    }
                    return 0;
                }
            case PLATE:
                {
                    switch(equipmentSlot) {
                        case 1 << 5:
                        case 1 << 11:
                        case 1 << 4:
                            {
                                switch(stat) {
                                    case PHYSICAL_ATTACK:
                                        {
                                            return enchantLvl;
                                        }
                                    case BOOST_MAGICAL_SKILL:
                                        {
                                            return 2 * enchantLvl;
                                        }
                                    case PHYSICAL_DEFENSE:
                                        {
                                            return 4 * enchantLvl;
                                        }
                                    case MAXHP:
                                        {
                                            return 14 * enchantLvl;
                                        }
                                    case PHYSICAL_CRITICAL_RESIST:
                                        {
                                            return 2 * enchantLvl;
                                        }
                                    case MAGICAL_DEFEND:
                                        {
                                            return 2 * enchantLvl;
                                        }
                                    default:
                                        {
                                            break;
                                        }
                                }
                                return 0;
                            }
                        case 1 << 12:
                            {
                                switch(stat) {
                                    case PHYSICAL_ATTACK:
                                        {
                                            return enchantLvl;
                                        }
                                    case BOOST_MAGICAL_SKILL:
                                        {
                                            return 2 * enchantLvl;
                                        }
                                    case PHYSICAL_DEFENSE:
                                        {
                                            return 5 * enchantLvl;
                                        }
                                    case MAXHP:
                                        {
                                            return 16 * enchantLvl;
                                        }
                                    case PHYSICAL_CRITICAL_RESIST:
                                        {
                                            return 3 * enchantLvl;
                                        }
                                    case MAGICAL_DEFEND:
                                        {
                                            return 2 * enchantLvl;
                                        }
                                    default:
                                        {
                                            break;
                                        }
                                }
                                return 0;
                            }
                        case 1 << 3:
                            {
                                switch(stat) {
                                    case PHYSICAL_ATTACK:
                                        {
                                            return enchantLvl;
                                        }
                                    case BOOST_MAGICAL_SKILL:
                                        {
                                            return 2 * enchantLvl;
                                        }
                                    case PHYSICAL_DEFENSE:
                                        {
                                            return 6 * enchantLvl;
                                        }
                                    case MAXHP:
                                        {
                                            return 18 * enchantLvl;
                                        }
                                    case PHYSICAL_CRITICAL_RESIST:
                                        {
                                            return 4 * enchantLvl;
                                        }
                                    case MAGICAL_DEFEND:
                                        {
                                            return 3 * enchantLvl;
                                        }
                                    default:
                                        {
                                            break;
                                        }
                                }
                                return 0;
                            }
                    }
                    return 0;
                }
            case SHIELD:
                {
                    switch(stat) {
                        case DAMAGE_REDUCE:
                            {
                                final float reduceRate = enchantLvl > 10 ? 0.2f : enchantLvl * 0.02f;
                                return Math.round(reduceRate * applyStat.getBase());
                            }
                        case BLOCK:
                            {
                                if (enchantLvl > 10) {
                                    return 30 * (enchantLvl - 10);
                                }
                                return 0;
                            }
                        default:
                            {
                                break;
                            }
                    }
                }
            case PLUME:
                {
                    switch(stat) {
                        case MAXHP:
                            {
                                return 150 * enchantLvl;
                            }
                        case PHYSICAL_ATTACK:
                            {
                                return 4 * enchantLvl;
                            }
                        case BOOST_MAGICAL_SKILL:
                            {
                                return 20 * enchantLvl;
                            }
                        case PHYSICAL_CRITICAL:
                            {
                                return 12 * enchantLvl;
                            }
                        case PHYSICAL_ACCURACY:
                            {
                                return 16 * enchantLvl;
                            }
                        case MAGICAL_ACCURACY:
                            {
                                return 8 * enchantLvl;
                            }
                        case MAGICAL_CRITICAL:
                            {
                                return 8 * enchantLvl;
                            }
                        default:
                            {
                                break;
                            }
                    }
                    return 0;
                }
            /**
             * 5.0 Wings Enchant
             */
            case WING:
                {
                    switch(stat) {
                        case PHYSICAL_ATTACK:
                            {
                                return 1 * enchantLvl;
                            }
                        case BOOST_MAGICAL_SKILL:
                            {
                                return 4 * enchantLvl;
                            }
                        case MAXHP:
                            {
                                return 20 * enchantLvl;
                            }
                        case PHYSICAL_CRITICAL_RESIST:
                            {
                                return 2 * enchantLvl;
                            }
                        case FLY_TIME:
                            {
                                return 10 * enchantLvl;
                            }
                        case MAGICAL_CRITICAL_RESIST:
                            {
                                return 1 * enchantLvl;
                            }
                        default:
                            {
                                break;
                            }
                    }
                    return 0;
                }
            /**
             * 5.1 Bracelet Enchant
             */
            case BRACELET:
                {
                    switch(stat) {
                        case PVP_DEFEND_RATIO_PHYSICAL:
                            {
                                return 3 * enchantLvl;
                            }
                        case PVP_DEFEND_RATIO_MAGICAL:
                            {
                                return 3 * enchantLvl;
                            }
                        default:
                            {
                                break;
                            }
                    }
                    return 0;
                }
            default:
                {
                    break;
                }
        }
        return 0;
    }
}

19 Source : DuplicateStatFunction.java
with GNU General Public License v3.0
from MobiusDevelopment

private List<StatFunction> getFunctions(List<StatFunction> list, Stat2 stat, Item item) {
    final List<StatFunction> functions = new ArrayList<>();
    for (StatFunction func : list) {
        final StatFunctionProxy func2 = new StatFunctionProxy(item, func);
        if ((func.getName() == getName()) && func2.validate(stat, func2)) {
            functions.add(func);
        }
    }
    return functions;
}

19 Source : Storage.java
with GNU General Public License v3.0
from MobiusDevelopment

long decreaseItemCount(Item item, long count, Player actor) {
    return decreaseItemCount(item, count, ItemUpdateType.DEC_ITEM_USE, actor);
}

19 Source : Storage.java
with GNU General Public License v3.0
from MobiusDevelopment

long increaseItemCount(Item item, long count, Player actor) {
    return increaseItemCount(item, count, ItemUpdateType.DEC_ITEM_USE, actor);
}

19 Source : Storage.java
with GNU General Public License v3.0
from MobiusDevelopment

public void clear() {
    for (Item i : itemStorage.gereplacedems()) {
        remove(i);
    }
}

19 Source : ItemStorage.java
with GNU General Public License v3.0
from MobiusDevelopment

public Item getFirsreplacedemById(int itemId) {
    for (Item item : items.values()) {
        if (item.gereplacedemTemplate().getTemplateId() == itemId) {
            return item;
        }
    }
    return null;
}

19 Source : ItemStorage.java
with GNU General Public License v3.0
from MobiusDevelopment

public Item getSpecialItemBySlotId(short slotId) {
    for (Item item : getSpecialCubeItems()) {
        if (item.getEquipmentSlot() == slotId) {
            return item;
        }
    }
    return null;
}

19 Source : ItemStorage.java
with GNU General Public License v3.0
from MobiusDevelopment

public Item gereplacedemBySlotId(short slotId) {
    for (Item item : getCubeItems()) {
        if (item.getEquipmentSlot() == slotId) {
            return item;
        }
    }
    return null;
}

19 Source : Equipment.java
with GNU General Public License v3.0
from MobiusDevelopment

public Item getOffHandWeapon() {
    final Item result = equipment.get(ItemSlot.SUB_HAND.getSlotIdMask());
    if (getMainHandWeapon() == result) {
        return null;
    }
    return result;
}

19 Source : Equipment.java
with GNU General Public License v3.0
from MobiusDevelopment

public boolean isPowerShardEquipped() {
    final Item leftPowershard = equipment.get(ItemSlot.POWER_SHARD_LEFT.getSlotIdMask());
    if (leftPowershard != null) {
        return true;
    }
    final Item rightPowershard = equipment.get(ItemSlot.POWER_SHARD_RIGHT.getSlotIdMask());
    if (rightPowershard != null) {
        return true;
    }
    return false;
}

19 Source : Equipment.java
with GNU General Public License v3.0
from MobiusDevelopment

public Item getMainHandPowerShard() {
    final Item mainHandPowerShard = equipment.get(ItemSlot.POWER_SHARD_RIGHT.getSlotIdMask());
    return mainHandPowerShard;
}

19 Source : Equipment.java
with GNU General Public License v3.0
from MobiusDevelopment

public Item getEquipedPlume() {
    final Item plume = equipment.get(ItemSlot.PLUME.getSlotIdMask());
    return ((plume != null) && (plume.gereplacedemTemplate().getCategory() == ItemCategory.PLUME)) ? plume : null;
}

19 Source : Equipment.java
with GNU General Public License v3.0
from MobiusDevelopment

/**
 * Checks if dual one-handed weapon is equiped in any slot combination
 * @param slot masks
 * @return
 */
public boolean hasDualWeaponEquipped(ItemSlot slot) {
    final ItemSlot[] slotValues = ItemSlot.getSlotsFor(slot.getSlotIdMask());
    if (slotValues.length == 0) {
        return false;
    }
    for (ItemSlot s : slotValues) {
        final Item weapon = equipment.get(s.getSlotIdMask());
        if ((weapon == null) || weapon.gereplacedemTemplate().isTwoHandWeapon()) {
            continue;
        }
        if (weapon.gereplacedemTemplate().getWeaponType() != null) {
            return true;
        }
    }
    return false;
}

19 Source : Equipment.java
with GNU General Public License v3.0
from MobiusDevelopment

public Item getOffHandPowerShard() {
    final Item offHandPowerShard = equipment.get(ItemSlot.POWER_SHARD_LEFT.getSlotIdMask());
    return offHandPowerShard;
}

19 Source : Equipment.java
with GNU General Public License v3.0
from MobiusDevelopment

/**
 * @param type
 * @return true if player is equipping the requested ArmorType
 */
public boolean isArmorTypeEquipped(ArmorType type) {
    for (Item item : equipment.values()) {
        if ((item == null) || (item.gereplacedemTemplate().getWeaponType() != null)) {
            continue;
        }
        // TODO: Check it! Not sure for dual hand
        if ((item.gereplacedemTemplate().getArmorType() == type) && item.isEquipped() && (item.getEquipmentSlot() != ItemSlot.SUB_OFF_HAND.getSlotIdMask())) {
            return true;
        }
    }
    return false;
}

19 Source : Equipment.java
with GNU General Public License v3.0
from MobiusDevelopment

/**
 * Will look item in equipment item set
 * @param value
 * @return Item
 */
public Item getEquippedItemByObjId(int value) {
    synchronized (equipment) {
        for (Item item : equipment.values()) {
            if (item.getObjectId() == value) {
                return item;
            }
        }
    }
    return null;
}

19 Source : Equipment.java
with GNU General Public License v3.0
from MobiusDevelopment

public Item getEquippedShield() {
    final Item subHandItem = equipment.get(ItemSlot.SUB_HAND.getSlotIdMask());
    return ((subHandItem != null) && (subHandItem.gereplacedemTemplate().getArmorType() == ArmorType.SHIELD)) ? subHandItem : null;
}

See More Examples