当前位置: 首页>>代码示例>>Java>>正文


Java MapleMount类代码示例

本文整理汇总了Java中client.inventory.MapleMount的典型用法代码示例。如果您正苦于以下问题:Java MapleMount类的具体用法?Java MapleMount怎么用?Java MapleMount使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MapleMount类属于client.inventory包,在下文中一共展示了MapleMount类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: UseMountFood

import client.inventory.MapleMount; //导入依赖的package包/类
public static final void UseMountFood(final LittleEndianAccessor slea, final MapleClient c, final MapleCharacter chr) {
	slea.skip(4); // update tick
    final byte slot = (byte) slea.readShort();
    final int itemid = slea.readInt(); //2260000 usually
    final Item toUse = chr.getInventory(MapleInventoryType.USE).getItem(slot);
    final MapleMount mount = chr.getMount();

    if (itemid / 10000 == 226 && toUse != null && toUse.getQuantity() > 0 && toUse.getItemId() == itemid && mount != null && !c.getPlayer().hasBlockedInventory()) {
        final int fatigue = mount.getFatigue();

        boolean levelup = false;
        mount.setFatigue((byte) -30);

        if (fatigue > 0) {
            mount.increaseExp();
            final int level = mount.getLevel();
            if (level < 30 && mount.getExp() >= GameConstants.getMountExpNeededForLevel(level + 1)) {
                mount.setLevel((byte) (level + 1));
                levelup = true;
            }
        }
        chr.getMap().broadcastMessage(CWvsContext.updateMount(chr, levelup));
        MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.USE, slot, (short) 1, false);
    }
    c.getSession().write(CWvsContext.enableActions());
}
 
开发者ID:Maxcloud,项目名称:Mushy,代码行数:27,代码来源:InventoryHandler.java

示例2: UseMountFood

import client.inventory.MapleMount; //导入依赖的package包/类
public static void UseMountFood(SeekableLittleEndianAccessor slea, MapleClient c, MapleCharacter chr) {
    byte slot = (byte) slea.readShort();
    int itemid = slea.readInt();
    Item toUse = chr.getInventory(MapleInventoryType.USE).getItem((short) slot);
    MapleMount mount = chr.getMount();
    if ((itemid / 10000 == 226) && (toUse != null) && (toUse.getQuantity() > 0) && (toUse.getItemId() == itemid) && (mount != null) && (!c.getPlayer().hasBlockedInventory())) {
        int fatigue = mount.getFatigue();
        boolean levelup = false;
        mount.setFatigue((byte) -30);
        if (fatigue > 0) {
            mount.increaseExp();
            int level = mount.getLevel();
            if ((level < 30) && (mount.getExp() >= GameConstants.getMountExpNeededForLevel(level + 1))) {
                mount.setLevel((byte) (level + 1));
                levelup = true;
            }
        }
        chr.getMap().broadcastMessage(MaplePacketCreator.updateMount(chr, levelup));
        MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.USE, (short) slot, (byte) 1, false);
    }
    c.getSession().write(MaplePacketCreator.enableActions());
}
 
开发者ID:icelemon1314,项目名称:mapleLemon,代码行数:23,代码来源:InventoryHandler.java

示例3: UseMountFood

import client.inventory.MapleMount; //导入依赖的package包/类
public static final void UseMountFood(final LittleEndianAccessor slea, final MapleClient c, final MapleCharacter chr) {
    c.getPlayer().updateTick(slea.readInt());
    final byte slot = (byte) slea.readShort();
    final int itemid = slea.readInt(); //2260000 usually
    final Item toUse = chr.getInventory(MapleInventoryType.USE).getItem(slot);
    final MapleMount mount = chr.getMount();

    if (itemid / 10000 == 226 && toUse != null && toUse.getQuantity() > 0 && toUse.getItemId() == itemid && mount != null && !c.getPlayer().hasBlockedInventory()) {
        final int fatigue = mount.getFatigue();

        boolean levelup = false;
        mount.setFatigue((byte) -30);

        if (fatigue > 0) {
            mount.increaseExp();
            final int level = mount.getLevel();
            if (level < 30 && mount.getExp() >= GameConstants.getMountExpNeededForLevel(level + 1)) {
                mount.setLevel((byte) (level + 1));
                levelup = true;
            }
        }
        chr.getMap().broadcastMessage(CWvsContext.updateMount(chr, levelup));
        MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.USE, slot, (short) 1, false);
    }
    c.getSession().write(CWvsContext.enableActions());
}
 
开发者ID:skorch37,项目名称:Asteria,代码行数:27,代码来源:InventoryHandler.java

示例4: getMount

import client.inventory.MapleMount; //导入依赖的package包/类
public MapleMount getMount() {
    return mount;
}
 
开发者ID:Maxcloud,项目名称:Mushy,代码行数:4,代码来源:MapleCharacter.java

示例5: getMount

import client.inventory.MapleMount; //导入依赖的package包/类
public MapleMount getMount() {
    return this.mount;
}
 
开发者ID:icelemon1314,项目名称:mapleLemon,代码行数:4,代码来源:MapleCharacter.java


注:本文中的client.inventory.MapleMount类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。