CancelChairHandler.java
资源名称:src.rar [点击查看]
上传用户:gwt600
上传日期:2021-06-03
资源大小:704k
文件大小:2k
源码类别:
游戏
开发平台:
Java
- package net.sf.odinms.net.channel.handler;
- import net.sf.odinms.client.MapleClient;
- import net.sf.odinms.net.AbstractMaplePacketHandler;
- import net.sf.odinms.server.maps.FakeCharacter;
- import net.sf.odinms.tools.MaplePacketCreator;
- import net.sf.odinms.tools.data.input.SeekableLittleEndianAccessor;
- public class CancelChairHandler extends AbstractMaplePacketHandler {
- public CancelChairHandler() {
- }
- public void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
- c.getPlayer().resetAfkTime();
- int id = slea.readShort();
- if (id == -1) { // Cancel Chair
- c.getPlayer().setChair(0);
- c.getSession().write(MaplePacketCreator.cancelChair());
- c.getPlayer().getMap().broadcastMessage(c.getPlayer(), MaplePacketCreator.showChair(c.getPlayer().getId(), 0), false);
- if (c.getPlayer().hasFakeChar()) {
- for (FakeCharacter ch : c.getPlayer().getFakeChars()) {
- ch.getFakeChar().setChair(0);
- ch.getFakeChar().getMap().broadcastMessage(ch.getFakeChar(), MaplePacketCreator.showChair(ch.getFakeChar().getId(), 0), false);
- }
- }
- } else { // Use In-Map Chair
- c.getPlayer().setChair(id);
- c.getSession().write(MaplePacketCreator.cancelChair(id));
- if (c.getPlayer().hasFakeChar()) {
- for (FakeCharacter ch : c.getPlayer().getFakeChars()) {
- ch.getFakeChar().setChair(id);
- }
- }
- }
- }
- }