本文整理汇总了Java中tools.data.LittleEndianAccessor.readShort方法的典型用法代码示例。如果您正苦于以下问题:Java LittleEndianAccessor.readShort方法的具体用法?Java LittleEndianAccessor.readShort怎么用?Java LittleEndianAccessor.readShort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tools.data.LittleEndianAccessor
的用法示例。
在下文中一共展示了LittleEndianAccessor.readShort方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseNormalAttack
import tools.data.LittleEndianAccessor; //导入方法依赖的package包/类
private static void parseNormalAttack(LittleEndianAccessor lea, AttackInfo ai, MapleCharacter chr) {
lea.skip(1); // bAddAttackProc
lea.skip(4); // crc
lea.skip(1);
lea.skip(1);
ai.display = lea.readShort();
lea.skip(4);
lea.skip(1);
ai.speed = lea.readByte();
ai.lastAttackTickCount = lea.readInt();
lea.skip(4);
lea.skip(4); // final attack
lea.skip(2); // slot
lea.skip(2); // csstar
}
示例2: UseExpItem
import tools.data.LittleEndianAccessor; //导入方法依赖的package包/类
public static void UseExpItem(final LittleEndianAccessor slea, final MapleClient c, final MapleCharacter chr) {
if (chr == null || !chr.isAlive() || chr.getMap() == null || chr.hasBlockedInventory() || chr.inPVP()) {
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.USE).getItem(slot);
if (toUse == null || toUse.getQuantity() < 1 || toUse.getItemId() != itemId) {
c.getSession().write(CWvsContext.enableActions());
return;
}
if (!MapleItemInformationProvider.getInstance().getEquipStats(itemId).containsKey("exp")) {
c.getSession().write(CWvsContext.enableActions());
return;
}
MapleItemInformationProvider.getInstance().getEquipStats(itemId).get("exp");
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.USE, slot, (short) 1, false);
}
示例3: Movement6
import tools.data.LittleEndianAccessor; //导入方法依赖的package包/类
public Movement6(LittleEndianAccessor lea, byte command) {
super();
this.command = command;
this.position = new Point(0, 0);
short xv = lea.readShort();
short xy = lea.readShort();
vposition = new Point(xv, xy);
// I'm not sure about this, it' needs testing.
fhFootStart = lea.readShort();
bMoveAction = lea.readByte();
tElapse = lea.readShort();
bForcedStop = lea.readByte();
}
示例4: UseReturnScroll
import tools.data.LittleEndianAccessor; //导入方法依赖的package包/类
public static final void UseReturnScroll(final LittleEndianAccessor slea, final MapleClient c, final MapleCharacter chr) {
if (!chr.isAlive() || chr.getMapId() == 749040100 || chr.hasBlockedInventory() || chr.isInBlockedMap() || chr.inPVP()) {
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.USE).getItem(slot);
if (toUse == null || toUse.getQuantity() < 1 || toUse.getItemId() != itemId) {
c.getSession().write(CWvsContext.enableActions());
return;
}
if (!FieldLimitType.PotionUse.check(chr.getMap().getFieldLimit())) {
if (MapleItemInformationProvider.getInstance().getItemEffect(toUse.getItemId()).applyReturnScroll(chr)) {
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.USE, slot, (short) 1, false);
} else {
c.getSession().write(CWvsContext.enableActions());
}
} else {
c.getSession().write(CWvsContext.enableActions());
}
}
示例5: Movement7
import tools.data.LittleEndianAccessor; //导入方法依赖的package包/类
public Movement7(LittleEndianAccessor lea, byte command) {
super();
this.command = command;
short x = lea.readShort();
short y = lea.readShort();
position = new Point(x, y);
short vx = lea.readShort();
short vy = lea.readShort();
vposition = new Point(vx, vy);
bMoveAction = lea.readByte();
tElapse = lea.readShort();
bForcedStop = lea.readByte();
}
示例6: UseRecipe
import tools.data.LittleEndianAccessor; //导入方法依赖的package包/类
public static final void UseRecipe(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.USE).getItem(slot);
if (toUse == null || toUse.getQuantity() < 1 || toUse.getItemId() != itemId || itemId / 10000 != 251) {
c.getSession().write(CWvsContext.enableActions());
return;
}
if (MapleItemInformationProvider.getInstance().getItemEffect(toUse.getItemId()).applyTo(chr)) {
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.USE, slot, (short) 1, false);
}
}
示例7: handle
import tools.data.LittleEndianAccessor; //导入方法依赖的package包/类
@PacketHandler(opcode = RecvPacketOpcode.USE_CASH_ITEM)
public static void handle(MapleClient c, LittleEndianAccessor lea){
MapleCharacter chr = c.getPlayer();
if(chr == null) {
return;
}
lea.skip(4); //update tick
short src = lea.readShort();
int itemId = lea.readInt();
if(GameConstants.getCashCubeByItemId(itemId) != null) {
handleCashCubes(c, chr, lea, src, itemId);
}else if(ItemConstants.isHyperTeleportRock(itemId)){
InventoryHandler.UseTeleRock(lea, c, itemId);
}
else{
chr.dropMessage(5, "You have used a cash item currently not known by the server.");
chr.dropMessage(5, "Be sure to report this problem. ItemID = " + itemId);
c.getSession().write(CWvsContext.enableActions());
}
}
示例8: handle
import tools.data.LittleEndianAccessor; //导入方法依赖的package包/类
@PacketHandler(opcode = RecvPacketOpcode.CANCEL_CHAIR)
public static void handle(MapleClient c, LittleEndianAccessor lea) {
short id = lea.readShort();
if (c.getPlayer() == null || c.getPlayer().getMap() == null){
c.disconnect(false, false);
return;
}
c.getSession().write(CField.cancelChair(id, c.getPlayer().getId()));
if (id == -1) {
c.getPlayer().cancelFishingTask();
c.getPlayer().setChair(0);
c.getPlayer().getMap().broadcastMessage(c.getPlayer(), CField.showChair(c.getPlayer().getId(), 0), false);
} else {
c.getPlayer().setChair(id);
}
}
示例9: ResetHyper
import tools.data.LittleEndianAccessor; //导入方法依赖的package包/类
public static void ResetHyper(final LittleEndianAccessor slea, final MapleClient c, final MapleCharacter chr) {
slea.skip(4); // update tick
short times = slea.readShort();
if (times < 1 || times > 3) {
times = 3;
}
long price = 10000L * (long) Math.pow(10, times);
if (chr.getMeso() < price) {
chr.dropMessage(1, "You do not have enough mesos for that.");
c.getSession().write(CWvsContext.enableActions());
return;
}
int ssp = 0;
int spp = 0;
int sap = 0;
HashMap<Skill, SkillEntry> sa = new HashMap<>();
for (Skill skil : SkillFactory.getAllSkills()) {
if (skil.isHyper()) {
sa.put(skil, new SkillEntry(0, (byte) 1, -1));
if (skil.getHyper() == 1) {
ssp++;
} else if (skil.getHyper() == 2) {
spp++;
} else if (skil.getHyper() == 3) {
sap++;
}
}
}
chr.gainMeso(-price, false);
chr.changeSkillsLevel(sa, true);
chr.gainHSP(0, ssp);
chr.gainHSP(1, spp);
chr.gainHSP(2, sap);
}
示例10: 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;
// }
}
示例11: Heal
import tools.data.LittleEndianAccessor; //导入方法依赖的package包/类
public static void Heal(LittleEndianAccessor slea, MapleCharacter chr) {
if (chr == null) {
return;
}
slea.skip(4); // update tick
if (slea.available() >= 8L) {
slea.skip(slea.available() >= 12L ? 8 : 4);
}
int healHP = slea.readShort();
int healMP = slea.readShort();
PlayerStats stats = chr.getStat();
if (stats.getHp() <= 0) {
return;
}
long now = System.currentTimeMillis();
if ((healHP != 0) && (chr.canHP(now + 1000L))) {
if (healHP > stats.getHealHP()) {
healHP = (int) stats.getHealHP();
}
chr.addHP(healHP);
}
if ((healMP != 0) && (!GameConstants.isDemonSlayer(chr.getJob())) && (chr.canMP(now + 1000L))) {
if (healMP > stats.getHealMP()) {
healMP = (int) stats.getHealMP();
}
chr.addMP(healMP);
}
}
示例12: HitReactor
import tools.data.LittleEndianAccessor; //导入方法依赖的package包/类
public static void HitReactor(final LittleEndianAccessor slea, final MapleClient c) {
final int oid = slea.readInt();
final int charPos = slea.readInt();
final short stance = slea.readShort();
final MapleReactor reactor = c.getPlayer().getMap().getReactorByOid(oid);
if (reactor == null || !reactor.isAlive()) {
return;
}
reactor.hitReactor(charPos, stance, c);
}
示例13: Movement4
import tools.data.LittleEndianAccessor; //导入方法依赖的package包/类
public Movement4(LittleEndianAccessor lea, byte command) {
super();
this.command = command;
this.position = new Point(0, 0);
bMoveAction = lea.readByte();
tElapse = lea.readShort();
bForcedStop = lea.readByte();
}
示例14: UseExpPotion
import tools.data.LittleEndianAccessor; //导入方法依赖的package包/类
public static void UseExpPotion(final LittleEndianAccessor slea, final MapleClient c, final MapleCharacter chr) {
//slea: [F5 4F D6 2E] [60 00] [F4 06 22 00]
System.err.println("eror");
slea.skip(4); // update tick
final byte slot = (byte) slea.readShort();
int itemid = slea.readInt();
final Item toUse = chr.getInventory(MapleInventoryType.USE).getItem(slot);
if (toUse == null || toUse.getQuantity() < 1
|| toUse.getItemId() != itemid || chr.getLevel() >= 250
|| chr.hasBlockedInventory() || itemid / 10000 != 223) {
c.getSession().write(CWvsContext.enableActions());
return;
}
if (itemid != 2230004) { //for now
c.getSession().write(CWvsContext.enableActions());
return;
}
int level = chr.getLevel();
chr.gainExp(chr.getNeededExp() - chr.getExp(), true, true, false);
boolean first = false;
boolean last = false;
int potionDstLevel = 18;
if (!chr.getInfoQuest(7985).contains("2230004=")) {
first = true;
} else {
if (chr.getInfoQuest(7985).equals("2230004=" + potionDstLevel + "#384")) {
last = true;
}
}
c.getSession().write(CWvsContext.updateExpPotion(last ? 0 : 2, chr.getId(), itemid, first, level, potionDstLevel));
if (first) {
chr.updateInfoQuest(7985, "2230004=" + level + "#384");
}
if (last) {
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.USE, slot, (short) 1, false);
}
c.getSession().write(CWvsContext.enableActions());
}
示例15: TransformPlayer
import tools.data.LittleEndianAccessor; //导入方法依赖的package包/类
public static void TransformPlayer(final LittleEndianAccessor slea, final MapleClient c, final MapleCharacter chr) {
// D9 A4 FD 00
// 11 00
// A0 C0 21 00
// 07 00 64 66 62 64 66 62 64
slea.skip(4); // update tick
final byte slot = (byte) slea.readShort();
final int itemId = slea.readInt();
final String target = slea.readMapleAsciiString();
final Item toUse = c.getPlayer().getInventory(MapleInventoryType.USE).getItem(slot);
if (toUse == null || toUse.getQuantity() < 1 || toUse.getItemId() != itemId) {
c.getSession().write(CWvsContext.enableActions());
return;
}
switch (itemId) {
case 2212000:
final MapleCharacter search_chr = chr.getMap().getCharacterByName(target);
if (search_chr != null) {
MapleItemInformationProvider.getInstance().getItemEffect(2210023).applyTo(search_chr);
search_chr.dropMessage(6, chr.getName() + " has played a prank on you!");
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.USE, slot, (short) 1, false);
}
break;
}
}