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


Java InventoryPacket类代码示例

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


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

示例1: checkZeroWeapon

import tools.packet.CWvsContext.InventoryPacket; //导入依赖的package包/类
public void checkZeroWeapon() {
    if (level < 100) {
        return;
    }
    int lazuli = getInventory(MapleInventoryType.EQUIPPED).getItem((short) -11).getItemId();
    int lapis = getInventory(MapleInventoryType.EQUIPPED).getItem((short) -10).getItemId();
    if (lazuli == getZeroWeapon(false) && lapis == getZeroWeapon(true)) {
        return;
    }
    MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
    for (int i = 0; i < 2; i++) {
        int itemId = i == 0 ? getZeroWeapon(false) : getZeroWeapon(true);
        Equip equip = (Equip) ii.getEquipById(itemId);
        equip.setPosition((short) (i == 0 ? -11 : -10));
        equip.setQuantity((short) 1);
        equip.setGMLog("Zero Weapon Advance");
        forceReAddItem_NoUpdate(equip, MapleInventoryType.EQUIPPED);
        client.getSession().write(InventoryPacket.updateEquippedItem(this, equip, (short) (i == 0 ? -11 : -10)));
    }
    equipChanged();
}
 
开发者ID:ergothvs,项目名称:Lucid2.0,代码行数:22,代码来源:MapleCharacter.java

示例2: femaleMihile

import tools.packet.CWvsContext.InventoryPacket; //导入依赖的package包/类
public void femaleMihile() {
    setGender((byte) 1);
    setFace(21158); //Elegant Lady face sounds nice
    setHair(34773); //Aria hair fits there most
    final MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
    Equip equip;
    int[][] items = new int[][]{{1051355, -5}, {1072833, -6}};
    for (int[] item : items) {
        equip = (Equip) ii.getEquipById(item[0]);
        equip.setPosition((short) item[1]);
        equip.setQuantity((short) 1);
        equip.setGMLog("Female Mihile");
        forceReAddItem_NoUpdate(equip, MapleInventoryType.EQUIPPED);
        client.getSession().write(InventoryPacket.updateEquippedItem(this, equip, (short) item[1]));
    }
    updateSingleStat(MapleStat.FACE, this.face);
    updateSingleStat(MapleStat.HAIR, this.hair);
    equipChanged();
}
 
开发者ID:ergothvs,项目名称:Lucid2.0,代码行数:20,代码来源:MapleCharacter.java

示例3: UseAlienSocket

import tools.packet.CWvsContext.InventoryPacket; //导入依赖的package包/类
public static final void UseAlienSocket(final LittleEndianAccessor slea, final MapleClient c) {
	slea.skip(4); // update tick
    c.getPlayer().setScrolledPosition((short) 0);
    final Item alienSocket = c.getPlayer().getInventory(MapleInventoryType.USE).getItem((byte) slea.readShort());
    final int alienSocketId = slea.readInt();
    final Item toMount = c.getPlayer().getInventory(MapleInventoryType.EQUIP).getItem((byte) slea.readShort());
    if (alienSocket == null || alienSocketId != alienSocket.getItemId() || toMount == null || c.getPlayer().hasBlockedInventory()) {
        c.getSession().write(InventoryPacket.getInventoryFull());
        return;
    }
    // Can only use once-> 2nd and 3rd must use NPC.
    final Equip eqq = (Equip) toMount;
    if (eqq.getSocketState() != 0) { // Used before
        c.getPlayer().dropMessage(1, "This item already has a socket.");
    } else {
        c.getSession().write(CSPacket.useAlienSocket(false));
        eqq.setSocketByNmb(0, 0); // First socket, GMS removed the other 2
        MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.USE, alienSocket.getPosition(), (short) 1, false);
        c.getPlayer().forceReAddItem(toMount, MapleInventoryType.EQUIP);
    }
    c.getSession().write(CSPacket.useAlienSocket(true));
    //c.getPlayer().fakeRelog();
    //c.getPlayer().dropMessage(1, "Added 1 socket successfully to " + toMount);
}
 
开发者ID:ergothvs,项目名称:Lucid2.0,代码行数:25,代码来源:InventoryHandler.java

示例4: UseCube

import tools.packet.CWvsContext.InventoryPacket; //导入依赖的package包/类
public static void UseCube(LittleEndianAccessor slea, MapleClient c) {
    //[47 80 12 04] [0B 00] [03 00]
	slea.skip(4); // update tick
    final Item item = c.getPlayer().getInventory(MapleInventoryType.EQUIP).getItem(slea.readShort());
    final Item toUse = c.getPlayer().getInventory(MapleInventoryType.USE).getItem(slea.readShort());
    MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
    if (toUse.getItemId() / 10000 != 271 || item == null || toUse == null
            || c.getPlayer().getInventory(MapleInventoryType.USE).getNumFreeSlot() < 1
            || ii.getEquipStats(toUse.getItemId()).containsKey("success")) {
        c.getPlayer().getMap().broadcastMessage(CField.showPotentialReset(c.getPlayer().getId(), false, item.getItemId()));
        c.getSession().write(CField.enchantResult(0));
        return;
    }
    final Equip eq = (Equip) item;
    if (eq.getState() >= 17 && eq.getState() <= 20) {
        eq.renewPotential_OLD(0, 0, 0, false);
        c.getPlayer().getMap().broadcastMessage(CField.showPotentialReset(c.getPlayer().getId(), true, item.getItemId()));
        c.getSession().write(InventoryPacket.scrolledItem(toUse, MapleInventoryType.EQUIP, item, false, true, false));
        c.getPlayer().forceReAddItem_NoUpdate(item, MapleInventoryType.EQUIP);
        MapleInventoryManipulator.addById(c, 2430112, (short) 1, "Cube" + " on " + FileoutputUtil.CurrentReadable_Date());
        c.getSession().write(CField.enchantResult(1));
        c.getSession().write(CWvsContext.enableActions());
    } else {
        c.getPlayer().dropMessage(5, "This item's Potential cannot be reset.");
    }
}
 
开发者ID:ergothvs,项目名称:Lucid2.0,代码行数:27,代码来源:InventoryHandler.java

示例5: addbyItem

import tools.packet.CWvsContext.InventoryPacket; //导入依赖的package包/类
public static short addbyItem(final MapleClient c, final Item item, final boolean fromcs) {
    final MapleInventoryType type = GameConstants.getInventoryType(item.getItemId());
    final short newSlot = c.getPlayer().getInventory(type).addItem(item);
    if (newSlot == -1) {
        if (!fromcs) {
            c.getSession().write(InventoryPacket.getInventoryFull());
            c.getSession().write(InventoryPacket.getShowInventoryFull());
        }
        return newSlot;
    }
    if (GameConstants.isHarvesting(item.getItemId())) {
        c.getPlayer().getStat().handleProfessionTool(c.getPlayer());
    }
    c.getSession().write(InventoryPacket.addInventorySlot(type, item));
    c.getPlayer().havePartyQuest(item.getItemId());
    return newSlot;
}
 
开发者ID:ergothvs,项目名称:Lucid2.0,代码行数:18,代码来源:MapleInventoryManipulator.java

示例6: removeFromSlot

import tools.packet.CWvsContext.InventoryPacket; //导入依赖的package包/类
public static boolean removeFromSlot(final MapleClient c, final MapleInventoryType type, final short slot, short quantity, final boolean fromDrop, final boolean consume) {
    if (c.getPlayer() == null || c.getPlayer().getInventory(type) == null) {
        return false;
    }
    final Item item = c.getPlayer().getInventory(type).getItem(slot);
    if (item != null) {
        final boolean allowZero = consume && GameConstants.isRechargable(item.getItemId());
        c.getPlayer().getInventory(type).removeItem(slot, quantity, allowZero);
        if (GameConstants.isHarvesting(item.getItemId())) {
            c.getPlayer().getStat().handleProfessionTool(c.getPlayer());
        }

        if (item.getQuantity() == 0 && !allowZero) {
            c.getSession().write(InventoryPacket.clearInventoryItem(type, item.getPosition(), fromDrop));
        } else {
            c.getSession().write(InventoryPacket.updateInventorySlot(type, (Item) item, fromDrop));
        }
        return true;
    }
    return false;
}
 
开发者ID:ergothvs,项目名称:Lucid2.0,代码行数:22,代码来源:MapleInventoryManipulator.java

示例7: UseAlienSocket

import tools.packet.CWvsContext.InventoryPacket; //导入依赖的package包/类
public static final void UseAlienSocket(final LittleEndianAccessor slea, final MapleClient c) {
    c.getPlayer().updateTick(slea.readInt());
    c.getPlayer().setScrolledPosition((short) 0);
    final Item alienSocket = c.getPlayer().getInventory(MapleInventoryType.USE).getItem((byte) slea.readShort());
    final int alienSocketId = slea.readInt();
    final Item toMount = c.getPlayer().getInventory(MapleInventoryType.EQUIP).getItem((byte) slea.readShort());
    if (alienSocket == null || alienSocketId != alienSocket.getItemId() || toMount == null || c.getPlayer().hasBlockedInventory()) {
        c.getSession().write(InventoryPacket.getInventoryFull());
        return;
    }
    // Can only use once-> 2nd and 3rd must use NPC.
    final Equip eqq = (Equip) toMount;
    if (eqq.getSocketState() != 0) { // Used before
        c.getPlayer().dropMessage(1, "This item already has a socket.");
    } else {
        c.getSession().write(CSPacket.useAlienSocket(false));
        eqq.setSocket1(0); // First socket, GMS removed the other 2
        MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.USE, alienSocket.getPosition(), (short) 1, false);
        c.getPlayer().forceReAddItem(toMount, MapleInventoryType.EQUIP);
    }
    c.getSession().write(CSPacket.useAlienSocket(true));
    //c.getPlayer().fakeRelog();
    //c.getPlayer().dropMessage(1, "Added 1 socket successfully to " + toMount);
}
 
开发者ID:skorch37,项目名称:Asteria,代码行数:25,代码来源:InventoryHandler.java

示例8: UseCube

import tools.packet.CWvsContext.InventoryPacket; //导入依赖的package包/类
public static void UseCube(LittleEndianAccessor slea, MapleClient c) {
    //[47 80 12 04] [0B 00] [03 00]
    c.getPlayer().updateTick(slea.readInt());
    final Item item = c.getPlayer().getInventory(MapleInventoryType.EQUIP).getItem(slea.readShort());
    final Item toUse = c.getPlayer().getInventory(MapleInventoryType.USE).getItem(slea.readShort());
    MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
    if (toUse.getItemId() / 10000 != 271 || item == null || toUse == null
            || c.getPlayer().getInventory(MapleInventoryType.USE).getNumFreeSlot() < 1
            || ii.getEquipStats(toUse.getItemId()).containsKey("success")) {
        c.getPlayer().getMap().broadcastMessage(CField.showPotentialReset(c.getPlayer().getId(), false, item.getItemId()));
        c.getSession().write(CField.enchantResult(0));
        return;
    }
    final Equip eq = (Equip) item;
    if (eq.getState() >= 17 && eq.getState() <= 20) {
        eq.renewPotential(0, 0, 0, false);
        c.getPlayer().getMap().broadcastMessage(CField.showPotentialReset(c.getPlayer().getId(), true, item.getItemId()));
        c.getSession().write(InventoryPacket.scrolledItem(toUse, MapleInventoryType.EQUIP, item, false, true, false));
        c.getPlayer().forceReAddItem_NoUpdate(item, MapleInventoryType.EQUIP);
        MapleInventoryManipulator.addById(c, 2430112, (short) 1, "Cube" + " on " + FileoutputUtil.CurrentReadable_Date());
        c.getSession().write(CField.enchantResult(1));
        c.getSession().write(CWvsContext.enableActions());
    } else {
        c.getPlayer().dropMessage(5, "This item's Potential cannot be reset.");
    }
}
 
开发者ID:skorch37,项目名称:Asteria,代码行数:27,代码来源:InventoryHandler.java

示例9: checkEquipDurabilitys

import tools.packet.CWvsContext.InventoryPacket; //导入依赖的package包/类
public boolean checkEquipDurabilitys(final MapleCharacter chr, int gain, boolean aboveZero) {
    if (chr.isClone() || chr.inPVP()) {
        return true;
    }
    List<Equip> all = new ArrayList<>(durabilityHandling);
    for (Equip item : all) {
        if (item != null && ((item.getPosition() >= 0) == aboveZero)) {
            item.setDurability(item.getDurability() + gain);
            if (item.getDurability() < 0) { //shouldnt be less than 0
                item.setDurability(0);
            }
        }
    }
    for (Equip eqq : all) {
        if (eqq != null && eqq.getDurability() == 0 && eqq.getPosition() < 0) { //> 0 went to negative
            if (chr.getInventory(MapleInventoryType.EQUIP).isFull()) {
                chr.getClient().getSession().write(InventoryPacket.getInventoryFull());
                chr.getClient().getSession().write(InventoryPacket.getShowInventoryFull());
                return false;
            }
            durabilityHandling.remove(eqq);
            final short pos = chr.getInventory(MapleInventoryType.EQUIP).getNextFreeSlot();
            MapleInventoryManipulator.unequip(chr.getClient(), eqq.getPosition(), pos);
        } else if (eqq != null) {
            chr.forceReAddItem(eqq.copy(), MapleInventoryType.EQUIPPED);
        }
    }
    return true;
}
 
开发者ID:ergothvs,项目名称:Lucid2.0,代码行数:30,代码来源:PlayerStats.java

示例10: forceReAddItem

import tools.packet.CWvsContext.InventoryPacket; //导入依赖的package包/类
public void forceReAddItem(Item item, MapleInventoryType type) { //used for stuff like durability, item exp/level, probably owner?
        forceReAddItem_NoUpdate(item, type);
        type = MapleInventoryType.EQUIP;
        if (type != MapleInventoryType.UNDEFINED) {
            client.getSession().write(InventoryPacket.addInventorySlot(type, item, false));
//            client.getSession().write(InventoryPacket.updateSpecialItemUse(item, type == MapleInventoryType.EQUIPPED ? (byte) 1 : type.getType(), this));
        }
    }
 
开发者ID:ergothvs,项目名称:Lucid2.0,代码行数:9,代码来源:MapleCharacter.java

示例11: UseNebulite

import tools.packet.CWvsContext.InventoryPacket; //导入依赖的package包/类
public static final void UseNebulite(final LittleEndianAccessor slea, final MapleClient c) {
	slea.skip(4); // update tick
    c.getPlayer().setScrolledPosition((short) 0);
    final Item nebulite = c.getPlayer().getInventory(MapleInventoryType.SETUP).getItem((byte) slea.readShort());
    final int nebuliteId = slea.readInt();
    final Item toMount = c.getPlayer().getInventory(MapleInventoryType.EQUIP).getItem((byte) slea.readShort());
    if (nebulite == null || nebuliteId != nebulite.getItemId() || toMount == null || c.getPlayer().hasBlockedInventory()) {
        c.getSession().write(InventoryPacket.getInventoryFull());
        return;
    }
    final Equip eqq = (Equip) toMount;
    final MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
    boolean success = false;
    if (eqq.getSocketByNmb(0) == 0/* || eqq.getSocket2() == 0 || eqq.getSocket3() == 0*/) { // GMS removed 2nd and 3rd sockets, we can put into npc.
        final StructItemOption pot = ii.getSocketInfo(nebuliteId);
        if (pot != null && GameConstants.optionTypeFits(pot.optionType, eqq.getItemId())) {
            //if (eqq.getSocket1() == 0) { // priority comes first
            eqq.setSocketByNmb(0, pot.opID);
            //}// else if (eqq.getSocket2() == 0) {
            //    eqq.setSocket2(pot.opID);
            //} else if (eqq.getSocket3() == 0) {
            //    eqq.setSocket3(pot.opID);
            //}
            MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.SETUP, nebulite.getPosition(), (short) 1, false);
            c.getPlayer().forceReAddItem(toMount, MapleInventoryType.EQUIP);
            success = true;
        }
    }
    c.getPlayer().getMap().broadcastMessage(CField.showNebuliteEffect(c.getPlayer().getId(), success));
    c.getSession().write(CWvsContext.enableActions());
}
 
开发者ID:ergothvs,项目名称:Lucid2.0,代码行数:32,代码来源:InventoryHandler.java

示例12: UseBag

import tools.packet.CWvsContext.InventoryPacket; //导入依赖的package包/类
public static final void UseBag(final LittleEndianAccessor slea, final MapleClient c, final MapleCharacter chr) {
    if (chr == null || !chr.isAlive() || chr.getMap() == null || chr.hasBlockedInventory()) {
        c.getSession().write(CWvsContext.enableActions());
        return;
    }
    slea.skip(4); // update tick
    final byte slot = (byte) slea.readShort();
    final int itemId = slea.readInt();
    final Item toUse = chr.getInventory(MapleInventoryType.ETC).getItem(slot);

    if (toUse == null || toUse.getQuantity() < 1 || toUse.getItemId() != itemId || itemId / 10000 != 433) {
        c.getSession().write(CWvsContext.enableActions());
        return;
    }
    boolean firstTime = !chr.getExtendedSlots().contains(itemId);
    if (firstTime) {
        chr.getExtendedSlots().add(itemId);
        chr.changedExtended();
        short flag = toUse.getFlag();
        flag |= ItemFlag.LOCK.getValue();
        flag |= ItemFlag.UNTRADABLE.getValue();
        toUse.setFlag(flag);
        c.getSession().write(InventoryPacket.updateSpecialItemUse(toUse, (byte) 4, toUse.getPosition(), true, chr));
    }
    c.getSession().write(CField.openBag(chr.getExtendedSlots().indexOf(itemId), itemId, firstTime));
    c.getSession().write(CWvsContext.enableActions());
}
 
开发者ID:ergothvs,项目名称:Lucid2.0,代码行数:28,代码来源:ItemMakerHandler.java

示例13: UseNebulite

import tools.packet.CWvsContext.InventoryPacket; //导入依赖的package包/类
public static final void UseNebulite(final LittleEndianAccessor slea, final MapleClient c) {
    c.getPlayer().updateTick(slea.readInt());
    c.getPlayer().setScrolledPosition((short) 0);
    final Item nebulite = c.getPlayer().getInventory(MapleInventoryType.SETUP).getItem((byte) slea.readShort());
    final int nebuliteId = slea.readInt();
    final Item toMount = c.getPlayer().getInventory(MapleInventoryType.EQUIP).getItem((byte) slea.readShort());
    if (nebulite == null || nebuliteId != nebulite.getItemId() || toMount == null || c.getPlayer().hasBlockedInventory()) {
        c.getSession().write(InventoryPacket.getInventoryFull());
        return;
    }
    final Equip eqq = (Equip) toMount;
    final MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
    boolean success = false;
    if (eqq.getSocket1() == 0/* || eqq.getSocket2() == 0 || eqq.getSocket3() == 0*/) { // GMS removed 2nd and 3rd sockets, we can put into npc.
        final StructItemOption pot = ii.getSocketInfo(nebuliteId);
        if (pot != null && GameConstants.optionTypeFits(pot.optionType, eqq.getItemId())) {
            //if (eqq.getSocket1() == 0) { // priority comes first
            eqq.setSocket1(pot.opID);
            //}// else if (eqq.getSocket2() == 0) {
            //    eqq.setSocket2(pot.opID);
            //} else if (eqq.getSocket3() == 0) {
            //    eqq.setSocket3(pot.opID);
            //}
            MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.SETUP, nebulite.getPosition(), (short) 1, false);
            c.getPlayer().forceReAddItem(toMount, MapleInventoryType.EQUIP);
            success = true;
        }
    }
    c.getPlayer().getMap().broadcastMessage(CField.showNebuliteEffect(c.getPlayer().getId(), success));
    c.getSession().write(CWvsContext.enableActions());
}
 
开发者ID:skorch37,项目名称:Asteria,代码行数:32,代码来源:InventoryHandler.java

示例14: UseBag

import tools.packet.CWvsContext.InventoryPacket; //导入依赖的package包/类
public static final void UseBag(final LittleEndianAccessor slea, final MapleClient c, final MapleCharacter chr) {
    if (chr == null || !chr.isAlive() || chr.getMap() == null || chr.hasBlockedInventory()) {
        c.getSession().write(CWvsContext.enableActions());
        return;
    }
    c.getPlayer().updateTick(slea.readInt());
    final byte slot = (byte) slea.readShort();
    final int itemId = slea.readInt();
    final Item toUse = chr.getInventory(MapleInventoryType.ETC).getItem(slot);

    if (toUse == null || toUse.getQuantity() < 1 || toUse.getItemId() != itemId || itemId / 10000 != 433) {
        c.getSession().write(CWvsContext.enableActions());
        return;
    }
    boolean firstTime = !chr.getExtendedSlots().contains(itemId);
    if (firstTime) {
        chr.getExtendedSlots().add(itemId);
        chr.changedExtended();
        short flag = toUse.getFlag();
        flag |= ItemFlag.LOCK.getValue();
        flag |= ItemFlag.UNTRADABLE.getValue();
        toUse.setFlag(flag);
        c.getSession().write(InventoryPacket.updateSpecialItemUse(toUse, (byte) 4, toUse.getPosition(), true, chr));
    }
    c.getSession().write(CField.openBag(chr.getExtendedSlots().indexOf(itemId), itemId, firstTime));
    c.getSession().write(CWvsContext.enableActions());
}
 
开发者ID:skorch37,项目名称:Asteria,代码行数:28,代码来源:ItemMakerHandler.java

示例15: removeFromSlot

import tools.packet.CWvsContext.InventoryPacket; //导入依赖的package包/类
public static boolean removeFromSlot(final MapleClient c, final MapleInventoryType type, final short slot, short quantity, final boolean fromDrop, final boolean consume) { 
        if (c.getPlayer() == null || c.getPlayer().getInventory(type) == null) {
            return false;
        }
        int vermins = c.getPlayer().verifyAccMins(c);
        if (ServerConstants.accountSecurity && !c.hasSameIP(c.getAccountName())) {
            c.getSession().write(CWvsContext.broadcastMsg(-1, 
"You connected from a different IP than last time.\n" +
"For your character's security,\n" +
"transferring items and mesos will be\n" +
"restricted for " + vermins + " min."));
            return false;
        }
        final Item item = c.getPlayer().getInventory(type).getItem(slot);
        if (item != null) {
            final boolean allowZero = consume && GameConstants.isRechargable(item.getItemId());
            c.getPlayer().getInventory(type).removeItem(slot, quantity, allowZero);
            if (GameConstants.isHarvesting(item.getItemId())) {
                c.getPlayer().getStat().handleProfessionTool(c.getPlayer());
            }

            if (item.getQuantity() == 0 && !allowZero) {
                c.getSession().write(InventoryPacket.clearInventoryItem(type, item.getPosition(), fromDrop));
            } else {
                c.getSession().write(InventoryPacket.updateInventorySlot(type, item, fromDrop));
            }
            return true;
        }
        return false;
    }
 
开发者ID:skorch37,项目名称:Asteria,代码行数:31,代码来源:MapleInventoryManipulator.java


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