CancelChairHandler.java
上传用户:gwt600
上传日期:2021-06-03
资源大小:704k
文件大小:2k
源码类别:

游戏

开发平台:

Java

  1. package net.sf.odinms.net.channel.handler;
  2. import net.sf.odinms.client.MapleClient;
  3. import net.sf.odinms.net.AbstractMaplePacketHandler;
  4. import net.sf.odinms.server.maps.FakeCharacter;
  5. import net.sf.odinms.tools.MaplePacketCreator;
  6. import net.sf.odinms.tools.data.input.SeekableLittleEndianAccessor;
  7. public class CancelChairHandler extends AbstractMaplePacketHandler {
  8.     public CancelChairHandler() {
  9.     }
  10.     public void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
  11.         c.getPlayer().resetAfkTime();
  12.         int id = slea.readShort();
  13.         if (id == -1) { // Cancel Chair
  14.             c.getPlayer().setChair(0);
  15.             c.getSession().write(MaplePacketCreator.cancelChair());
  16.             c.getPlayer().getMap().broadcastMessage(c.getPlayer(), MaplePacketCreator.showChair(c.getPlayer().getId(), 0), false);
  17.             if (c.getPlayer().hasFakeChar()) {
  18.                 for (FakeCharacter ch : c.getPlayer().getFakeChars()) {
  19.                     ch.getFakeChar().setChair(0);
  20.                     ch.getFakeChar().getMap().broadcastMessage(ch.getFakeChar(), MaplePacketCreator.showChair(ch.getFakeChar().getId(), 0), false);
  21.                 }
  22.             }
  23.         } else { // Use In-Map Chair
  24.             c.getPlayer().setChair(id);
  25.             c.getSession().write(MaplePacketCreator.cancelChair(id));
  26.             if (c.getPlayer().hasFakeChar()) {
  27.                 for (FakeCharacter ch : c.getPlayer().getFakeChars()) {
  28.                     ch.getFakeChar().setChair(id);
  29.                 }
  30.             }
  31.         }
  32.     }
  33. }