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;
}
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);
}
}
}
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);
}
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);
}
}
}
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;
}
Aggregations