예제 #1
0
 public void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
   slea.readInt(); // i don't know :)
   int meso = slea.readInt();
   if (meso < 10 || meso > 50000) {
     AutobanManager.getInstance().addPoints(c, 1000, 0, "Dropping " + meso + " mesos");
     return;
   }
   if (meso <= c.getPlayer().getMeso()) {
     c.getPlayer().gainMeso(-meso, true, true);
     c.getPlayer()
         .getMap()
         .spawnMesoDrop(
             meso, meso, c.getPlayer().getPosition(), c.getPlayer(), c.getPlayer(), false);
   }
 }
예제 #2
0
  @Override
  public void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
    int oid = slea.readInt();
    Point startPos = StreamUtil.readShortPoint(slea);
    List<LifeMovementFragment> res = parseMovement(slea);

    MapleCharacter player = c.getPlayer();
    Collection<MapleSummon> summons = player.getSummons().values();
    MapleSummon summon = null;
    for (MapleSummon sum : summons) {
      if (sum.getObjectId() == oid) {
        summon = sum;
      }
    }
    if (summon != null) {
      updatePosition(res, summon, 0);
      // player = ((MapleCharacter) c.getPlayer().getMap().getMapObject(30000));
      player
          .getMap()
          .broadcastMessage(
              player,
              MaplePacketCreator.moveSummon(player.getId(), oid, startPos, res),
              summon.getPosition());
    }
  }
  @Override
  public void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
    if (!MapleGuild.ENABLE_BBS) {
      c.getSession()
          .write(
              MaplePacketCreator.serverNotice(
                  1, "Your server administrator has currently disabled Guild BBS."));
      return;
    }

    if (c.getPlayer().getGuildId() <= 0) {
      return; // expelled while viewing bbs or hax
    }
    byte mode = slea.readByte();
    int localthreadid = 0;

    switch (mode) {
      case 0:
        // start a new post
        boolean bEdit = slea.readByte() == 1 ? true : false;
        if (bEdit) {
          localthreadid = slea.readInt();
        }
        boolean bNotice = slea.readByte() == 1 ? true : false;
        String title = correctLength(slea.readMapleAsciiString(), 25);
        String text = correctLength(slea.readMapleAsciiString(), 600);
        int icon = slea.readInt();
        if (icon >= 0x64 && icon <= 0x6a) {
          if (!c.getPlayer().haveItem(5290000 + icon - 0x64, 1, false, true)) {
            return; // hax, using an nx icon that s/he doesn't have
          }
        } else if (!(icon >= 0 && icon <= 2)) {
          return; // hax, using an invalid icon
        }
        if (!bEdit) {
          newBBSThread(c, title, text, icon, bNotice);
        } else {
          editBBSThread(c, title, text, icon, localthreadid);
        }
        break;
      case 1:
        // delete a thread
        localthreadid = slea.readInt();
        deleteBBSThread(c, localthreadid);
        break;
      case 2:
        int start = slea.readInt();
        // list threads
        listBBSThreads(c, start * 10);
        break;
      case 3: // list thread + reply, followed by id (int)
        localthreadid = slea.readInt();
        displayThread(c, localthreadid);
        break;
      case 4: // reply
        localthreadid = slea.readInt();
        text = correctLength(slea.readMapleAsciiString(), 25);
        newBBSReply(c, localthreadid, text);
        break;
      case 5: // delete reply
        localthreadid = slea.readInt(); // we don't use this
        int replyid = slea.readInt();
        deleteBBSReply(c, replyid);
        break;
      default:
        log.warn("Unhandled BBS mode: " + mode);
    }
  }