本文整理汇总了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;
}
}
}
}
}
示例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());
}
}
示例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);
}
示例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);
}
示例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;
// }
}
示例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);
}
}
示例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));
}
示例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));
//}
}
示例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);
}
}
示例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());
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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));
}