Search in sources :

Example 1 with Item

use of client.inventory.Item in project HeavenMS by ronancpl.

the class MapleCharacter method getMedalText.

public String getMedalText() {
    String medal = "";
    final Item medalItem = getInventory(MapleInventoryType.EQUIPPED).getItem((short) -49);
    if (medalItem != null) {
        medal = "<" + ii.getName(medalItem.getItemId()) + "> ";
    }
    return medal;
}
Also used : MapleMapItem(server.maps.MapleMapItem) Item(client.inventory.Item) MaplePlayerShopItem(server.maps.MaplePlayerShopItem)

Example 2 with Item

use of client.inventory.Item in project HeavenMS by ronancpl.

the class MapleCharacter method increaseEquipExp.

public void increaseEquipExp(int expGain) {
    if (expGain < 0)
        expGain = Integer.MAX_VALUE;
    for (Item item : getInventory(MapleInventoryType.EQUIPPED).list()) {
        Equip nEquip = (Equip) item;
        String itemName = ii.getName(nEquip.getItemId());
        if (itemName == null) {
            continue;
        }
        if ((nEquip.getItemLevel() < ServerConstants.USE_EQUIPMNT_LVLUP) || (itemName.contains("Reverse") && nEquip.getItemLevel() < 4) || (itemName.contains("Timeless") && nEquip.getItemLevel() < 6)) {
            nEquip.gainItemExp(client, expGain);
        }
    }
}
Also used : MapleMapItem(server.maps.MapleMapItem) Item(client.inventory.Item) MaplePlayerShopItem(server.maps.MaplePlayerShopItem) Equip(client.inventory.Equip)

Example 3 with Item

use of client.inventory.Item in project HeavenMS by ronancpl.

the class MapleCharacter method closePlayerShop.

public void closePlayerShop() {
    MaplePlayerShop mps = this.getPlayerShop();
    if (mps == null)
        return;
    if (mps.isOwner(this)) {
        mps.setOpen(false);
        client.getWorldServer().unregisterPlayerShop(mps);
        for (MaplePlayerShopItem mpsi : mps.getItems()) {
            if (mpsi.getBundles() >= 2) {
                Item iItem = mpsi.getItem().copy();
                iItem.setQuantity((short) (mpsi.getBundles() * iItem.getQuantity()));
                MapleInventoryManipulator.addFromDrop(this.getClient(), iItem, false);
            } else if (mpsi.isExist()) {
                MapleInventoryManipulator.addFromDrop(this.getClient(), mpsi.getItem(), true);
            }
        }
        mps.closeShop();
    } else {
        mps.removeVisitor(this);
    }
    this.setPlayerShop(null);
}
Also used : MapleMapItem(server.maps.MapleMapItem) Item(client.inventory.Item) MaplePlayerShopItem(server.maps.MaplePlayerShopItem) MaplePlayerShop(server.maps.MaplePlayerShop) MaplePlayerShopItem(server.maps.MaplePlayerShopItem)

Example 4 with Item

use of client.inventory.Item in project HeavenMS by ronancpl.

the class MapleCharacter method runFullnessSchedule.

public void runFullnessSchedule(int petSlot) {
    MaplePet pet = getPet(petSlot);
    if (pet == null)
        return;
    int newFullness = pet.getFullness() - PetDataFactory.getHunger(pet.getItemId());
    if (newFullness <= 5) {
        pet.setFullness(15);
        pet.saveToDb();
        unequipPet(pet, true);
        dropMessage(6, "Your pet grew hungry! Treat it some pet food to keep it healthy!");
    } else {
        pet.setFullness(newFullness);
        pet.saveToDb();
        Item petz = getInventory(MapleInventoryType.CASH).getItem(pet.getPosition());
        if (petz != null) {
            forceUpdateItem(petz);
        }
    }
}
Also used : MapleMapItem(server.maps.MapleMapItem) Item(client.inventory.Item) MaplePlayerShopItem(server.maps.MaplePlayerShopItem) MaplePet(client.inventory.MaplePet) Point(java.awt.Point)

Example 5 with Item

use of client.inventory.Item in project HeavenMS by ronancpl.

the class MapleCharacter method calculateMaxBaseDamage.

public int calculateMaxBaseDamage(int watk) {
    int maxbasedamage;
    Item weapon_item = getInventory(MapleInventoryType.EQUIPPED).getItem((short) -11);
    if (weapon_item != null) {
        MapleWeaponType weapon = ii.getWeaponType(weapon_item.getItemId());
        int mainstat, secondarystat;
        if (getJob().isA(MapleJob.THIEF) && weapon == MapleWeaponType.DAGGER_OTHER) {
            weapon = MapleWeaponType.DAGGER_THIEVES;
        }
        if (weapon == MapleWeaponType.BOW || weapon == MapleWeaponType.CROSSBOW || weapon == MapleWeaponType.GUN) {
            mainstat = localdex;
            secondarystat = localstr;
        } else if (weapon == MapleWeaponType.CLAW || weapon == MapleWeaponType.DAGGER_THIEVES) {
            mainstat = localluk;
            secondarystat = localdex + localstr;
        } else {
            mainstat = localstr;
            secondarystat = localdex;
        }
        maxbasedamage = (int) (((weapon.getMaxDamageMultiplier() * mainstat + secondarystat) / 100.0) * watk);
    } else {
        if (job.isA(MapleJob.PIRATE) || job.isA(MapleJob.THUNDERBREAKER1)) {
            double weapMulti = 3;
            if (job.getId() % 100 != 0) {
                weapMulti = 4.2;
            }
            int attack = (int) Math.min(Math.floor((2 * getLevel() + 31) / 3), 31);
            maxbasedamage = (int) (localstr * weapMulti + localdex) * attack / 100;
        } else {
            maxbasedamage = 1;
        }
    }
    return maxbasedamage;
}
Also used : MapleMapItem(server.maps.MapleMapItem) Item(client.inventory.Item) MaplePlayerShopItem(server.maps.MaplePlayerShopItem) MapleWeaponType(client.inventory.MapleWeaponType) Point(java.awt.Point)

Aggregations

Item (client.inventory.Item)124 MapleMapItem (server.maps.MapleMapItem)33 Equip (client.inventory.Equip)31 ArrayList (java.util.ArrayList)31 MaplePlayerShopItem (server.maps.MaplePlayerShopItem)31 Point (java.awt.Point)29 SQLException (java.sql.SQLException)25 MapleCharacter (client.MapleCharacter)21 MapleInventoryType (client.inventory.MapleInventoryType)20 PreparedStatement (java.sql.PreparedStatement)20 Connection (java.sql.Connection)19 DatabaseConnection (tools.DatabaseConnection)19 MapleInventory (client.inventory.MapleInventory)18 MapleItemInformationProvider (server.MapleItemInformationProvider)18 ResultSet (java.sql.ResultSet)16 Pair (tools.Pair)15 CashItem (server.CashShop.CashItem)13 SpecialCashItem (server.CashShop.SpecialCashItem)12 MapleShopItem (server.MapleShopItem)12 MaplePacketLittleEndianWriter (tools.data.output.MaplePacketLittleEndianWriter)11