本文整理汇总了Java中tools.data.LittleEndianAccessor类的典型用法代码示例。如果您正苦于以下问题:Java LittleEndianAccessor类的具体用法?Java LittleEndianAccessor怎么用?Java LittleEndianAccessor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LittleEndianAccessor类属于tools.data包,在下文中一共展示了LittleEndianAccessor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleKeyBindingChanges
import tools.data.LittleEndianAccessor; //导入依赖的package包/类
private static void handleKeyBindingChanges(MapleClient c, LittleEndianAccessor lea){
lea.skip(4);
int changes = lea.readInt();
for (int i = 0; i < changes; i++) {
int key = lea.readInt();
byte type = lea.readByte();
int action = lea.readInt();
// if (type != 1 || action < 1000 || GameConstants.isLinkedAttackSkill(action) || action % 10000 < 1000){
// continue;
// }
Skill skill = SkillFactory.getSkill(action);
if (type == 1 && skill != null && !skill.isFourthJob() && !skill.isBeginnerSkill() && skill.isInvisible() && c.getPlayer().getSkillLevel(skill) <= 0) {
continue;
}
c.getPlayer().changeKeybinding(key, type, action);
}
try {
c.getPlayer().getKeyLayout().saveKeys(c.getPlayer().getId());
} catch (SQLException e) {
e.printStackTrace();
}
}
示例2: 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());
}
}
示例3: LeaveCS
import tools.data.LittleEndianAccessor; //导入依赖的package包/类
public static void LeaveCS(final LittleEndianAccessor slea, final MapleClient c, final MapleCharacter chr) {
CashShopServer.getPlayerStorage().deregisterPlayer(chr);
c.updateLoginState(MapleClient.LOGIN_SERVER_TRANSITION, c.getSessionIPAddress());
try {
World.ChannelChange_Data(new CharacterTransfer(chr), chr.getId(), c.getChannel());
c.getSession().write(CField.getChannelChange(c, Integer.parseInt(ChannelServer.getInstance(c.getChannel()).getIP().split(":")[1])));
} finally {
final String s = c.getSessionIPAddress();
LoginServer.addIPAuth(s.substring(s.indexOf('/') + 1, s.length()));
chr.saveToDB(false, true);
c.setPlayer(null);
c.setReceiving(false);
}
}
示例4: DressUpTime
import tools.data.LittleEndianAccessor; //导入依赖的package包/类
public static void DressUpTime(LittleEndianAccessor slea, final MapleClient c) {
byte type = slea.readByte();
// System.out.println("abtype " + type);
if (type == 1) {
// PlayerHandler.AngelicChange(slea, c, chr);
if (GameConstants.isAngelicBuster(c.getPlayer().getJob())) {
c.getSession().write(JobPacket.AngelicPacket.DressUpTime(type));
c.getSession().write(JobPacket.AngelicPacket.updateDress(5010094, c.getPlayer()));
// }
} else {
c.getSession().write(CWvsContext.enableActions());
// return;
}
}
}
示例5: CancelMech
import tools.data.LittleEndianAccessor; //导入依赖的package包/类
public static void CancelMech(LittleEndianAccessor slea, MapleCharacter chr) {
if (chr == null) {
return;
}
int sourceid = slea.readInt();
if ((sourceid % 10000 < 1000) && (SkillFactory.getSkill(sourceid) == null)) {
sourceid += 1000;
}
Skill skill = SkillFactory.getSkill(sourceid);
if (skill == null) {
return;
}
if (skill.isChargeSkill()) {
chr.setKeyDownSkill_Time(0L);
chr.getMap().broadcastMessage(chr, CField.skillCancel(chr, sourceid), false);
} else {
chr.cancelEffect(skill.getEffect(slea.readByte()), false, -1L);
}
}
示例6: updateRedLeafHigh
import tools.data.LittleEndianAccessor; //导入依赖的package包/类
public static void updateRedLeafHigh(LittleEndianAccessor slea, MapleClient c) { //not finished yet
//TODO: load and set red leaf high in sql
slea.readInt(); //questid or something
slea.readInt(); //joe joe quest
int joejoe = slea.readInt();
slea.readInt(); //hermoninny quest
int hermoninny = slea.readInt();
slea.readInt(); //little dragon quest
int littledragon = slea.readInt();
slea.readInt(); //ika quest
int ika = slea.readInt();
if (joejoe + hermoninny + littledragon + ika != c.getPlayer().getFriendShipToAdd()) {
c.getSession().write(CWvsContext.enableActions());
return;
}
c.getPlayer().setFriendShipPoints(joejoe, hermoninny, littledragon, ika);
}
示例7: LeavePVP
import tools.data.LittleEndianAccessor; //导入依赖的package包/类
public static void LeavePVP(final LittleEndianAccessor slea, final MapleClient c) {
if (c.getPlayer() == null || c.getPlayer().getMap() == null || !c.getPlayer().inPVP()) {
c.getSession().write(CField.pvpBlocked(6));
c.getSession().write(CWvsContext.enableActions());
return;
}
int x = Integer.parseInt(c.getPlayer().getEventInstance().getProperty(String.valueOf(c.getPlayer().getId())));
final int lv = Integer.parseInt(c.getPlayer().getEventInstance().getProperty("lvl"));
if (lv < 2 && c.getPlayer().getLevel() >= 120) { //gladiator, level 120+
x /= 2;
}
c.getPlayer().setTotalBattleExp(c.getPlayer().getTotalBattleExp() + ((x / 10) * 3 / 2));
c.getPlayer().setBattlePoints(c.getPlayer().getBattlePoints() + ((x / 10) * 3 / 2)); //PVP 1.5 EVENT!
c.getPlayer().cancelAllBuffs();
c.getPlayer().changeRemoval();
c.getPlayer().dispelDebuffs();
c.getPlayer().clearAllCooldowns();
slea.skip(4); // update tick
c.getSession().write(CWvsContext.clearMidMsg());
c.getPlayer().changeMap(c.getChannelServer().getMapFactory().getMap(960000000));
c.getPlayer().getStat().recalcLocalStats(c.getPlayer());
c.getPlayer().getStat().heal(c.getPlayer());
}
示例8: 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();
}
示例9: 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();
}
示例10: handle
import tools.data.LittleEndianAccessor; //导入依赖的package包/类
@PacketHandler(opcode = RecvPacketOpcode.USE_INNER_PORTAL)
public static void handle(MapleClient c, LittleEndianAccessor lea) {
lea.skip(1);
if (c.getPlayer() == null || c.getPlayer().getMap() == null) {
return;
}
String portalName = lea.readMapleAsciiString();
MaplePortal portal = c.getPlayer().getMap().getPortal(portalName);
if (portal == null) {
return;
}
//That "22500" should not be hard coded in this manner
if (portal.getPosition().distanceSq(c.getPlayer().getTruePosition()) > 22500.0D && !c.getPlayer().isGM()) {
return;
}
int toX = lea.readShort();
int toY = lea.readShort();
//Are there not suppose to be checks here? Can players not just PE any x and y value they want?
c.getPlayer().getMap().movePlayer(c.getPlayer(), new Point(toX, toY));
c.getPlayer().checkFollow();
}
示例11: UseCatchItem
import tools.data.LittleEndianAccessor; //导入依赖的package包/类
public static void UseCatchItem(final LittleEndianAccessor slea, final MapleClient c, final MapleCharacter chr) {
slea.skip(4); // update tick
c.getPlayer().setScrolledPosition((short) 0);
final byte slot = (byte) slea.readShort();
final int itemid = slea.readInt();
final MapleMonster mob = chr.getMap().getMonsterByOid(slea.readInt());
final Item toUse = chr.getInventory(MapleInventoryType.USE).getItem(slot);
final MapleMap map = chr.getMap();
if (toUse != null && toUse.getQuantity() > 0 && toUse.getItemId() == itemid && mob != null && !chr.hasBlockedInventory() && itemid / 10000 == 227 && MapleItemInformationProvider.getInstance().getCardMobId(itemid) == mob.getId()) {
if (!MapleItemInformationProvider.getInstance().isMobHP(itemid) || mob.getHp() <= mob.getMobMaxHp() / 2) {
map.broadcastMessage(MobPacket.catchMonster(mob.getObjectId(), itemid, (byte) 1));
map.killMonster(mob, chr, true, false, (byte) 1);
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.USE, slot, (short) 1, false, false);
if (MapleItemInformationProvider.getInstance().getCreateId(itemid) > 0) {
MapleInventoryManipulator.addById(c, MapleItemInformationProvider.getInstance().getCreateId(itemid), (short) 1, "Catch item " + itemid + " on " + FileoutputUtil.CurrentReadable_Date());
}
} else {
map.broadcastMessage(MobPacket.catchMonster(mob.getObjectId(), itemid, (byte) 0));
c.getSession().write(CWvsContext.catchMob(mob.getId(), itemid, (byte) 0));
}
}
c.getSession().write(CWvsContext.enableActions());
}
示例12: OwlMinerva
import tools.data.LittleEndianAccessor; //导入依赖的package包/类
public static final void OwlMinerva(final LittleEndianAccessor slea, final MapleClient c) {
final byte slot = (byte) slea.readShort();
final int itemid = slea.readInt();
final Item toUse = c.getPlayer().getInventory(MapleInventoryType.USE).getItem(slot);
if (toUse != null && toUse.getQuantity() > 0 && toUse.getItemId() == itemid && itemid == 2310000 && !c.getPlayer().hasBlockedInventory()) {
final int itemSearch = slea.readInt();
final List<HiredMerchant> hms = c.getChannelServer().searchMerchant(itemSearch);
if (hms.size() > 0) {
c.getSession().write(CWvsContext.getOwlSearched(itemSearch, hms));
MapleInventoryManipulator.removeById(c, MapleInventoryType.USE, itemid, 1, true, false);
} else {
c.getPlayer().dropMessage(1, "Unable to find the item.");
}
}
c.getSession().write(CWvsContext.enableActions());
}
示例13: handle
import tools.data.LittleEndianAccessor; //导入依赖的package包/类
@PacketHandler(opcode = RecvPacketOpcode.BLACK_CUBE_RESULT)
public static void handle(MapleClient c, LittleEndianAccessor lea){
MapleCharacter chr = c.getPlayer();
if (chr == null){
c.getSession().write(CWvsContext.enableActions());
return;
}
lea.skip(4); // update tick
short choice = lea.readShort();
long uniqueId = lea.readLong(); // currently not used, may be implemented in the future.
boolean choseOld = choice == 7; // old choice = 7, new choice = 6
if(choseOld){
Equip equip = chr.getLastBlackCubedItem();
if (equip == null){
//should not happen under normal circumstances
c.getSession().write(CWvsContext.enableActions());
return;
}
equip.setPotential(equip.getOldPotential());
MapleInventoryType mit = equip.getPosition() < 0 ? MapleInventoryType.EQUIPPED : MapleInventoryType.EQUIP;
chr.forceReAddItem(equip, mit);
}
c.getSession().write(CWvsContext.enableActions());
chr.setLastBlackCubedItem(null); // to indicate user has finished cubing
}
示例14: Movement3
import tools.data.LittleEndianAccessor; //导入依赖的package包/类
public Movement3(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);
if (command == 21 || command == 22)
fhFootStart = lea.readShort();
bMoveAction = lea.readByte();
tElapse = lea.readShort();
bForcedStop = lea.readByte();
}
示例15: handle
import tools.data.LittleEndianAccessor; //导入依赖的package包/类
@PacketHandler(opcode = RecvPacketOpcode.CHANGE_CHANNEL)
public static void handle(MapleClient c, LittleEndianAccessor lea){
MapleCharacter chr = c.getPlayer();
int toChannel = lea.readByte() + 1;
if (chr == null || chr.hasBlockedInventory() || chr.getEventInstance() != null || chr.getMap() == null || chr.isInBlockedMap() || FieldLimitType.ChannelSwitch.check(chr.getMap().getFieldLimit()) || c.getChannel() == toChannel) {
c.getSession().write(CWvsContext.enableActions());
return;
}
if (World.getPendingCharacterSize() >= 10 || !World.isChannelAvailable(toChannel, chr.getWorld())) {
chr.dropMessage(1, "We could not change your channel at this moment. Please try again soon.");
c.getSession().write(CWvsContext.enableActions());
return;
}
int tick = lea.readInt();
chr.changeChannel(toChannel);
}