本文整理匯總了Java中tools.data.LittleEndianAccessor.skip方法的典型用法代碼示例。如果您正苦於以下問題:Java LittleEndianAccessor.skip方法的具體用法?Java LittleEndianAccessor.skip怎麽用?Java LittleEndianAccessor.skip使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類tools.data.LittleEndianAccessor
的用法示例。
在下文中一共展示了LittleEndianAccessor.skip方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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());
}
}
示例2: TouchFamiliar
import tools.data.LittleEndianAccessor; //導入方法依賴的package包/類
public static final void TouchFamiliar(LittleEndianAccessor slea, MapleClient c, MapleCharacter chr) {
if (chr.getSummonedFamiliar() == null) {
return;
}
slea.skip(6);
byte unk = slea.readByte();
MapleMonster target = chr.getMap().getMonsterByOid(slea.readInt());
if (target == null) {
return;
}
int type = slea.readInt();
slea.skip(4);
int damage = slea.readInt();
int maxDamage = chr.getSummonedFamiliar().getOriginalStats().getPhysicalAttack() * 5;
if (damage < maxDamage) {
damage = maxDamage;
}
if ((!target.getStats().isFriendly())) {
chr.getMap().broadcastMessage(chr, CField.touchFamiliar(chr.getId(), unk, target.getObjectId(), type, 600, damage), chr.getTruePosition());
target.damage(chr, damage, true);
chr.getSummonedFamiliar().addFatigue(chr);
}
}
示例3: 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);
}
}
示例4: Report
import tools.data.LittleEndianAccessor; //導入方法依賴的package包/類
public static void Report(final LittleEndianAccessor slea, final MapleClient c) {
//0 = success 1 = unable to locate 2 = once a day 3 = you've been reported 4+ = unknown reason
MapleCharacter other;
slea.skip(1); // id
other = c.getPlayer().getMap().getCharacterByName(slea.readMapleAsciiString());
//then,byte(?) and string(reason)
if (other == null || other.isIntern()) {
c.getSession().write(CWvsContext.report(4));
return;
}
final MapleQuestStatus stat = c.getPlayer().getQuestNAdd(MapleQuest.getInstance(GameConstants.REPORT_QUEST));
if (stat.getCustomData() == null) {
stat.setCustomData("0");
}
final long currentTime = System.currentTimeMillis();
final long theTime = Long.parseLong(stat.getCustomData());
if (theTime + 7200000 > currentTime && !c.getPlayer().isIntern()) {
c.getSession().write(CWvsContext.enableActions());
c.getPlayer().dropMessage(5, "You may only report every 2 hours.");
} else {
stat.setCustomData(String.valueOf(currentTime));
c.getSession().write(CWvsContext.report(2));
}
}
示例5: 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
}
示例6: 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());
}
}
示例7: Pet_AutoPotion
import tools.data.LittleEndianAccessor; //導入方法依賴的package包/類
public static final void Pet_AutoPotion(final LittleEndianAccessor slea, final MapleClient c, final MapleCharacter chr) {
slea.skip(9);
slea.skip(4); // update tick
final short slot = slea.readShort();
if (chr == null || !chr.isAlive() || chr.getMapId() == 749040100 || chr.getMap() == null || chr.hasDisease(MapleDisease.POTION)) {
return;
}
final Item toUse = chr.getInventory(MapleInventoryType.USE).getItem(slot);
if (toUse == null || toUse.getQuantity() < 1 || toUse.getItemId() != slea.readInt()) {
c.getSession().write(CWvsContext.enableActions());
return;
}
final long time = System.currentTimeMillis();
if (chr.getNextConsume() > time) {
chr.dropMessage(5, "You may not use this item yet.");
c.getSession().write(CWvsContext.enableActions());
return;
}
if (!FieldLimitType.PotionUse.check(chr.getMap().getFieldLimit())) { //cwk quick hack
if (MapleItemInformationProvider.getInstance().getItemEffect(toUse.getItemId()).applyTo(chr)) {
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.USE, slot, (short) 1, false);
if (chr.getMap().getConsumeItemCoolTime() > 0) {
chr.setNextConsume(time + (chr.getMap().getConsumeItemCoolTime() * 1000));
}
}
} else {
c.getSession().write(CWvsContext.enableActions());
}
}
示例8: MoveAndroid
import tools.data.LittleEndianAccessor; //導入方法依賴的package包/類
public static void MoveAndroid(LittleEndianAccessor slea, MapleClient c, MapleCharacter chr) {// MIXTAMAL6
slea.skip(12);// MIXTAMAL6
final List<LifeMovementFragment> res = MovementParse.parseMovement(slea, 3);// MIXTAMAL6
if ((res != null) && (chr != null) && (!res.isEmpty()) && (chr.getMap() != null)
&& (chr.getAndroid() != null)) {
Point pos = new Point(chr.getAndroid().getPos());
chr.getAndroid().updatePosition(res);
chr.getMap().broadcastMessage(chr, CField.moveAndroid(chr.getId(), pos, res), false);
}
}
示例9: 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());
}
示例10: FriendlyDamage
import tools.data.LittleEndianAccessor; //導入方法依賴的package包/類
public static final void FriendlyDamage(LittleEndianAccessor slea, MapleCharacter chr) {
MapleMap map = chr.getMap();
if (map == null) {
return;
}
MapleMonster mobfrom = map.getMonsterByOid(slea.readInt());
slea.skip(4);
MapleMonster mobto = map.getMonsterByOid(slea.readInt());
if ((mobfrom != null) && (mobto != null) && (mobto.getStats().isFriendly())) {
int damage = mobto.getStats().getLevel() * Randomizer.nextInt(mobto.getStats().getLevel()) / 2;
mobto.damage(chr, damage, true);
checkShammos(chr, mobto, map);
}
}
示例11: MoveDragon
import tools.data.LittleEndianAccessor; //導入方法依賴的package包/類
public static final void MoveDragon(final LittleEndianAccessor slea, final MapleCharacter chr) {//MIXTAMAL6 +Mally
slea.skip(12);//New in v14X+
final List<LifeMovementFragment> res = MovementParse.parseMovement(slea, 5);
if (chr != null && chr.getDragon() != null && res.size() > 0) {
final Point pos = chr.getDragon().getPosition();
MovementParse.updatePosition(res, chr.getDragon(), 0);
if (!chr.isHidden()) {
chr.getMap().broadcastMessage(chr, CField.moveDragon(chr.getDragon(), pos, res), chr.getTruePosition());
}
WeakReference<MapleCharacter>[] clones = chr.getClones();
for (int i = 0; i < clones.length; i++) {
if (clones[i].get() != null) {
final MapleMap map = chr.getMap();
final MapleCharacter clone = clones[i].get();
CloneTimer.getInstance().schedule(new Runnable() {
@Override
public void run() {
try {
if (clone.getMap() == map && clone.getDragon() != null) {
final Point startPos = clone.getDragon().getPosition();
MovementParse.updatePosition(res, clone.getDragon(), 0);
if (!clone.isHidden()) {
map.broadcastMessage(clone, CField.moveDragon(clone.getDragon(), startPos, res), clone.getTruePosition());
}
}
} catch (Exception e) {
//very rarely swallowed
}
}
}, 500 * i + 500);
}
}
}
}
示例12: MoveBag
import tools.data.LittleEndianAccessor; //導入方法依賴的package包/類
public static final void MoveBag(final LittleEndianAccessor slea, final MapleClient c) {
if (c.getPlayer().hasBlockedInventory()) { //hack
return;
}
c.getPlayer().setScrolledPosition((short) 0);
slea.skip(4); // update tick
final boolean srcFirst = slea.readInt() > 0;
short dst = (short) slea.readInt(); //01 00
if (slea.readByte() != 4) { //must be etc
c.getSession().write(CWvsContext.enableActions());
return;
}
short src = slea.readShort(); //00 00
MapleInventoryManipulator.move(c, MapleInventoryType.ETC, srcFirst ? dst : src, srcFirst ? src : dst);
}
示例13: ItemSort
import tools.data.LittleEndianAccessor; //導入方法依賴的package包/類
public static final void ItemSort(final LittleEndianAccessor slea, final MapleClient c) {
slea.skip(4); // update tick
c.getPlayer().setScrolledPosition((short) 0);
final MapleInventoryType pInvType = MapleInventoryType.getByType(slea.readByte());
if (pInvType == MapleInventoryType.UNDEFINED || c.getPlayer().hasBlockedInventory()) {
c.getSession().write(CWvsContext.enableActions());
return;
}
final MapleInventory pInv = c.getPlayer().getInventory(pInvType); //Mode should correspond with MapleInventoryType
boolean sorted = false;
while (!sorted) {
final byte freeSlot = (byte) pInv.getNextFreeSlot();
if (freeSlot != -1) {
byte itemSlot = -1;
for (byte i = (byte) (freeSlot + 1); i <= pInv.getSlotLimit(); i++) {
if (pInv.getItem(i) != null) {
itemSlot = i;
break;
}
}
if (itemSlot > 0) {
MapleInventoryManipulator.move(c, pInvType, itemSlot, freeSlot);
} else {
sorted = true;
}
} else {
sorted = true;
}
}
c.getSession().write(CWvsContext.finishedSort(pInvType.getType()));
c.getSession().write(CWvsContext.enableActions());
}
示例14: UseItem
import tools.data.LittleEndianAccessor; //導入方法依賴的package包/類
public static final void UseItem(final LittleEndianAccessor slea, final MapleClient c, final MapleCharacter chr) {
if (chr == null || !chr.isAlive() || chr.getMapId() == 749040100 || chr.getMap() == null || chr.hasDisease(MapleDisease.POTION) || chr.hasBlockedInventory() || chr.inPVP()) {
c.getSession().write(CWvsContext.enableActions());
return;
}
final long time = System.currentTimeMillis();
if (chr.getNextConsume() > time) {
chr.dropMessage(5, "You may not use this item yet.");
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;
}
switch(toUse.getItemId()) {
case 2290285:
System.out.println("Return 1");
}
if (!FieldLimitType.PotionUse.check(chr.getMap().getFieldLimit())) { //cwk quick hack
if (MapleItemInformationProvider.getInstance().getItemEffect(toUse.getItemId()).applyTo(chr)) {
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.USE, slot, (short) 1, false);
if (chr.getMap().getConsumeItemCoolTime() > 0) {
chr.setNextConsume(time + (chr.getMap().getConsumeItemCoolTime() * 1000));
}
}
} else {
c.getSession().write(CWvsContext.enableActions());
}
}
示例15: 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;
}