當前位置: 首頁>>代碼示例>>Java>>正文


Java LittleEndianAccessor.readInt方法代碼示例

本文整理匯總了Java中tools.data.LittleEndianAccessor.readInt方法的典型用法代碼示例。如果您正苦於以下問題:Java LittleEndianAccessor.readInt方法的具體用法?Java LittleEndianAccessor.readInt怎麽用?Java LittleEndianAccessor.readInt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在tools.data.LittleEndianAccessor的用法示例。


在下文中一共展示了LittleEndianAccessor.readInt方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: OpenQuickMove

import tools.data.LittleEndianAccessor; //導入方法依賴的package包/類
public static void OpenQuickMove(final LittleEndianAccessor slea, final MapleClient c) {
    final int npcid = slea.readInt();
    if (c.getPlayer().hasBlockedInventory() || c.getPlayer().isInBlockedMap() || c.getPlayer().getLevel() < 10) {
        return;
    }
    for (QuickMove qm : QuickMove.values()) {
        if (qm.getMap() != c.getPlayer().getMapId()) {
            List<QuickMove.QuickMoveNPC> qmn = new LinkedList();
            int npcs = qm.getNPCFlag();
            for (QuickMove.QuickMoveNPC npc : QuickMove.QuickMoveNPC.values()) {
                if ((npcs & npc.getValue()) != 0 && npc.getId() == npcid) {
                    NPCScriptManager.getInstance().start(c, npcid, null);
                    break;
                }
            }
        }
    }
}
 
開發者ID:ergothvs,項目名稱:Lucid2.0,代碼行數:19,代碼來源:NPCHandler.java

示例2: HypnotizeDmg

import tools.data.LittleEndianAccessor; //導入方法依賴的package包/類
public static final void HypnotizeDmg(LittleEndianAccessor slea, MapleCharacter chr) {
    MapleMonster mob_from = chr.getMap().getMonsterByOid(slea.readInt());
    slea.skip(4);
    int to = slea.readInt();
    slea.skip(1);
    int damage = slea.readInt();

    MapleMonster mob_to = chr.getMap().getMonsterByOid(to);

    if ((mob_from != null) && (mob_to != null) && (mob_to.getStats().isFriendly())) {
        if (damage > 30000) {
            return;
        }
        mob_to.damage(chr, damage, true);
        checkShammos(chr, mob_to, chr.getMap());
    }
}
 
開發者ID:ergothvs,項目名稱:Lucid2.0,代碼行數:18,代碼來源:MobHandler.java

示例3: UpdatePlayerInformation

import tools.data.LittleEndianAccessor; //導入方法依賴的package包/類
public static void UpdatePlayerInformation(final LittleEndianAccessor slea, final MapleClient c) {
    byte mode = slea.readByte(); //01 open ui 03 save info
    if (mode == 1) {
        if (c.getPlayer().getQuestStatus(GameConstants.PLAYER_INFORMATION) > 0) {
            try {
                String[] info = c.getPlayer().getQuest(MapleQuest.getInstance(GameConstants.PLAYER_INFORMATION)).getCustomData().split(";");
                c.getSession().write(CWvsContext.loadInformation((byte) 2, Integer.parseInt(info[0]), Integer.parseInt(info[1]), Integer.parseInt(info[2]), Integer.parseInt(info[3]), true));
            } catch (NumberFormatException ex) {
                c.getSession().write(CWvsContext.loadInformation((byte) 4, 0, 0, 0, 0, false));
                System.out.println("Failed to update account information: " + ex);
            }
        }
        c.getSession().write(CWvsContext.enableActions());
        return;
    }
    if (mode != 3) {
        System.out.println("new account information mode found: " + mode);
        c.getSession().write(CWvsContext.enableActions());
        return;
    }
    int country = slea.readInt();
    int birthday = slea.readInt();
    int favoriteAction = slea.readInt(); //kind of mask
    int favoriteLocation = slea.readInt(); //kind of mask
    c.getPlayer().getQuestNAdd(MapleQuest.getInstance(GameConstants.PLAYER_INFORMATION)).setCustomData("location=" + country + ";birthday=" + birthday + ";favoriteaction=" + favoriteAction + ";favoritelocation=" + favoriteLocation);
}
 
開發者ID:ergothvs,項目名稱:Lucid2.0,代碼行數:27,代碼來源:PlayersHandler.java

示例4: UseAlienSocket

import tools.data.LittleEndianAccessor; //導入方法依賴的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

示例5: handle

import tools.data.LittleEndianAccessor; //導入方法依賴的package包/類
@PacketHandler(opcode = RecvPacketOpcode.USE_UPGRADE_SCROLL)
    public static void handle(MapleClient c, LittleEndianAccessor lea){
        MapleCharacter chr = c.getPlayer();
        if(chr == null){
            c.getSession().write(CWvsContext.enableActions());
            return;
        }
        int tick = lea.readInt(); // unused for now
        short src = lea.readShort();
        short dst = lea.readShort();
        short ws = lea.readShort();
//        boolean whiteScroll = false;
        boolean legendarySpirit = lea.readByte() == 1; // does this even exist anymore? Probably not.

        // old inventory handler seemed to do stuff just fine, so we'll simply transfer it to that.
        InventoryHandler.UseUpgradeScroll(src, dst, ws, c, chr, 0, legendarySpirit);

//        MapleInventoryType mit = dst < 0 ? MapleInventoryType.EQUIPPED : MapleInventoryType.EQUIP;
//
//        Item item = chr.getInventory(MapleInventoryType.USE).getItem(src);
//        if (item == null) {
//            item = chr.getInventory(MapleInventoryType.CASH).getItem(src); //just in case
//        }
//        Equip equip;
//        equip = (Equip) chr.getInventory(mit).getItem(dst);
//        if (item == null || equip == null) {
//            c.getSession().write(CWvsContext.InventoryPacket.getInventoryFull());
//            c.getSession().write(CWvsContext.enableActions());
//            return;
//        }
//        if ((ws & 2) == 2) {
//            whiteScroll = true;
//        }


    }
 
開發者ID:ergothvs,項目名稱:Lucid2.0,代碼行數:37,代碼來源:UseUpgradeScrollHandler.java

示例6: handle

import tools.data.LittleEndianAccessor; //導入方法依賴的package包/類
@PacketHandler(opcode = RecvPacketOpcode.QUICK_MOVE_REQUEST)
public static void handle(MapleClient c, LittleEndianAccessor lea){
    int npcid = lea.readInt();
    MapleNPC npc = MapleLifeFactory.getNPC(npcid);

    if (NPCScriptManager.getInstance().hasScript(c, npc.getId(), null)) { //I want it to come before shop
        NPCScriptManager.getInstance().start(c, npc.getId(), null);
    } else if (npc.hasShop()) {
        c.getPlayer().setConversation(1);
        npc.sendShop(c);
    } else {
        NPCScriptManager.getInstance().start(c, npc.getId(), null);
    }
}
 
開發者ID:ergothvs,項目名稱:Lucid2.0,代碼行數:15,代碼來源:QuickMoveRequestHandler.java

示例7: EnterAzwanEvent

import tools.data.LittleEndianAccessor; //導入方法依賴的package包/類
public static void EnterAzwanEvent(final LittleEndianAccessor slea, final MapleClient c) {
    if (c.getPlayer() == null || c.getPlayer().getMap() == null) {
        c.getSession().write(CField.pvpBlocked(1));
        c.getSession().write(CWvsContext.enableActions());
        return;
    }
    int mapid = slea.readInt();
    c.getPlayer().changeMap(c.getChannelServer().getMapFactory().getMap(mapid));
}
 
開發者ID:ergothvs,項目名稱:Lucid2.0,代碼行數:10,代碼來源:PlayersHandler.java

示例8: CraftMake

import tools.data.LittleEndianAccessor; //導入方法依賴的package包/類
public static final void CraftMake(final LittleEndianAccessor slea, final MapleClient c, final MapleCharacter chr) {
    if (chr.getMapId() != 910001000 && chr.getMap().getExtractorSize() <= 0) {
        return; //ardent mill
    }
    final int something = slea.readInt(); //no clue what it is, but its between 288 and 305..
    //if (something >= 280 && something <= 310) {
    int time = slea.readInt();
    if (time > 6000 || time < 3000) {
        time = 4000;
    }
    chr.getMap().broadcastMessage(CField.craftMake(chr.getId(), something, time));
    //}
}
 
開發者ID:ergothvs,項目名稱:Lucid2.0,代碼行數:14,代碼來源:ItemMakerHandler.java

示例9: ChangeHaku

import tools.data.LittleEndianAccessor; //導入方法依賴的package包/類
public static void ChangeHaku(LittleEndianAccessor slea, MapleClient c, MapleCharacter chr) {
	int oid = slea.readInt();
	if (chr.getHaku() != null) {
		chr.getHaku().sendStats();
		chr.getMap().broadcastMessage(chr, CField.spawnHaku_change0(chr.getId()), true);
		chr.getMap().broadcastMessage(chr, CField.spawnHaku_change1(chr.getHaku()), true);
		chr.getMap().broadcastMessage(chr, CField.spawnHaku_bianshen(chr.getId(), oid, chr.getHaku().getStats()),
				true);
	}
}
 
開發者ID:ergothvs,項目名稱:Lucid2.0,代碼行數:11,代碼來源:PlayerHandler.java

示例10: UseBag

import tools.data.LittleEndianAccessor; //導入方法依賴的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

示例11: SwitchBag

import tools.data.LittleEndianAccessor; //導入方法依賴的package包/類
public static final void SwitchBag(final LittleEndianAccessor slea, final MapleClient c) {
    if (c.getPlayer().hasBlockedInventory()) { //hack
        return;
    }
    c.getPlayer().setScrolledPosition((short) 0);
    slea.skip(4);
    final short src = (short) slea.readInt();                                       //01 00
    final short dst = (short) slea.readInt();                                       //00 00
    if (src < 100 || dst < 100) {
        return;
    }
    MapleInventoryManipulator.move(c, MapleInventoryType.ETC, src, dst);
}
 
開發者ID:ergothvs,項目名稱:Lucid2.0,代碼行數:14,代碼來源:InventoryHandler.java

示例12: ClearPot

import tools.data.LittleEndianAccessor; //導入方法依賴的package包/類
public static final void ClearPot(final LittleEndianAccessor slea, final MapleClient c) {
    final int index = slea.readInt() - 1;
    if (index < 0 || index >= c.getPlayer().getImps().length || c.getPlayer().getImps()[index] == null) {
        c.getSession().write(CWvsContext.enableActions());
        return;
    }
    c.getSession().write(CWvsContext.updateImp(c.getPlayer().getImps()[index], ImpFlag.REMOVED.getValue(), index, false));
    c.getPlayer().getImps()[index] = null;
}
 
開發者ID:ergothvs,項目名稱:Lucid2.0,代碼行數:10,代碼來源:ItemMakerHandler.java

示例13: UseRewardItem

import tools.data.LittleEndianAccessor; //導入方法依賴的package包/類
public static boolean UseRewardItem(final LittleEndianAccessor slea, final MapleClient c, final MapleCharacter chr) {
    //System.out.println("[Reward Item] " + slea.toString());
    final byte slot = (byte) slea.readShort();
    final int itemId = slea.readInt();
    final boolean unseal = slea.readByte() > 0;
    return UseRewardItem(slot, itemId, unseal, c, chr);
}
 
開發者ID:ergothvs,項目名稱:Lucid2.0,代碼行數:8,代碼來源:InventoryHandler.java

示例14: parseCloseRangeAttack

import tools.data.LittleEndianAccessor; //導入方法依賴的package包/類
public static AttackInfo parseCloseRangeAttack(LittleEndianAccessor lea, MapleCharacter chr, boolean energy) {
	AttackInfo ai = new AttackInfo();
	lea.skip(1); // bFieldKey
	ai.nMobCount = (int) lea.readByte();
	ai.skillid = lea.readInt();
	byte skillLevel = lea.readByte();

	if (ai.getTargets() == 0) {
		parseNormalAttack(lea, ai, chr);
	} else {
		parseMeleeAttack(lea, ai, chr, energy);
	}
	return ai;
}
 
開發者ID:ergothvs,項目名稱:Lucid2.0,代碼行數:15,代碼來源:DamageParse.java

示例15: MobBomb

import tools.data.LittleEndianAccessor; //導入方法依賴的package包/類
@SuppressWarnings("empty-statement")
public static final void MobBomb(LittleEndianAccessor slea, MapleCharacter chr) {
    MapleMap map = chr.getMap();
    if (map == null) {
        return;
    }
    MapleMonster mobfrom = map.getMonsterByOid(slea.readInt());
    slea.skip(4);
    slea.readInt();

    if ((mobfrom != null) && (mobfrom.getBuff(MonsterStatus.MONSTER_BOMB) != null));
}
 
開發者ID:ergothvs,項目名稱:Lucid2.0,代碼行數:13,代碼來源:MobHandler.java


注:本文中的tools.data.LittleEndianAccessor.readInt方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。