Пример #1
0
  public static final void CharlistRequest(LittleEndianAccessor slea, MapleClient c) {
    if (!c.isLoggedIn()) {
      c.getSession().close(true);
      return;
    }
    if (GameConstants.GMS) {
      slea.readByte();
    }
    int server = slea.readByte();
    int channel = slea.readByte() + 1;
    if ((!World.isChannelAvailable(channel)) || (server != 0)) {
      c.getSession().write(LoginPacket.getLoginFailed(10));
      return;
    }

    List chars = c.loadCharacters(server);
    if ((chars != null) && (ChannelServer.getInstance(channel) != null)) {
      c.setWorld(server);
      c.setChannel(channel);

      c.getSession()
          .write(LoginPacket.getCharList(c.getSecondPassword(), chars, c.getCharacterSlots()));
    } else {
      c.getSession().close(true);
    }
  }
Пример #2
0
  public static final void CharlistRequest(final LittleEndianAccessor slea, final MapleClient c) {
    if (!c.isLoggedIn()) {
      c.getSession().close();
      return;
    }
    if (GameConstants.GMS) {
      slea.readByte(); // 2?
    }
    final int server = slea.readByte();
    final int channel = slea.readByte() + 1;
    if (!World.isChannelAvailable(channel) || server != 0) { // TODOO: MULTI WORLDS
      c.getSession().write(LoginPacket.getLoginFailed(10)); // cannot process so many
      return;
    }

    // System.out.println("Client " + c.getSession().getRemoteAddress().toString().split(":")[0] + "
    // is connecting to server " + server + " channel " + channel + "");

    final List<MapleCharacter> chars = c.loadCharacters(server);
    if (chars != null && ChannelServer.getInstance(channel) != null) {
      c.setWorld(server);
      c.setChannel(channel);
      c.getSession().write(LoginPacket.getSecondAuthSuccess(c));
      c.getSession()
          .write(LoginPacket.getCharList(c.getSecondPassword(), chars, c.getCharacterSlots()));
    } else {
      c.getSession().close();
    }
  }
Пример #3
0
  public static void CreateChar(LittleEndianAccessor slea, MapleClient c) {
    String name = slea.readMapleAsciiString();
    slea.skip(4);
    final JobType jobType =
        JobType.getByType(
            slea
                .readInt()); // BIGBANG: 0 = Resistance, 1 = Adventurer, 2 = Cygnus, 3 = Aran, 4 =
                             // Evan, 5 = Mercedes
    final short subCategory = slea.readShort(); // whether dual blade = 1 or adventurer = 0
    final byte gender = slea.readByte();
    byte skinColor = slea.readByte(); // 01
    int hairColor = 0;
    slea.skip(1);
    boolean mercedes = (jobType == JobType.Mercedes);
    boolean demon = (jobType == JobType.Demon);
    boolean adventurer = (jobType == JobType.Adventurer);
    int face = slea.readInt();
    int hair = slea.readInt();

    final int demonMark = demon ? slea.readInt() : 0;
    int top = slea.readInt();
    int bottom = (mercedes || demon || adventurer) ? 0 : slea.readInt();
    int shoes = slea.readInt();
    int weapon = slea.readInt();
    int shield = demon ? slea.readInt() : (mercedes ? 1352000 : 0);

    MapleCharacter newchar = MapleCharacter.getDefault(c);
    newchar.setWorld((byte) c.getWorld());
    newchar.setFace(face);
    newchar.setHair(hair + hairColor);
    newchar.setGender(gender);
    newchar.setName(name);
    newchar.setSkinColor(skinColor);
    newchar.setDemonMarking(demonMark);
    newchar.setSubcategory(subCategory);

    MapleInventory equip = newchar.getInventory(MapleInventoryType.EQUIPPED);
    Item eq_top = MapleItemInformationProvider.getInstance().getEquipById(top);
    eq_top.setPosition((byte) -5);
    equip.addFromDB(eq_top);
    Item eq_bottom = MapleItemInformationProvider.getInstance().getEquipById(bottom);
    eq_bottom.setPosition((byte) -6);
    Item eq_shoes = MapleItemInformationProvider.getInstance().getEquipById(shoes);
    eq_shoes.setPosition((byte) -7);
    equip.addFromDB(eq_shoes);
    Item eq_weapon = MapleItemInformationProvider.getInstance().getEquipById(weapon);
    eq_weapon.setPosition((byte) -11);
    equip.addFromDB(eq_weapon);

    if (MapleCharacterUtil.canCreateChar(name, false)
        && !LoginInformationProvider.getInstance().isForbiddenName(name)) {
      MapleCharacter.saveNewCharToDB(newchar, (short) 0);
      c.getSession().write(LoginPacket.addNewCharEntry(newchar, true));
      c.createdChar(newchar.getId());
    } else {
      c.getSession().write(LoginPacket.addNewCharEntry(newchar, false));
    }
    newchar = null;
  }
Пример #4
0
  public static final void DeleteChar(LittleEndianAccessor slea, MapleClient c) {
    String Secondpw_Client = GameConstants.GMS ? slea.readMapleAsciiString() : null;
    if (Secondpw_Client == null) {
      if (slea.readByte() > 0) {
        Secondpw_Client = slea.readMapleAsciiString();
      }
      slea.readMapleAsciiString();
    }

    int Character_ID = slea.readInt();

    if ((!c.login_Auth(Character_ID)) || (!c.isLoggedIn()) || (loginFailCount(c))) {
      c.getSession().close(true);
      return;
    }
    byte state = 0;

    if (c.getSecondPassword() != null) {
      if (Secondpw_Client == null) {
        c.getSession().close(true);
        return;
      }
      if (!c.CheckSecondPassword(Secondpw_Client)) {
        state = 20;
      }
    }

    if (state == 0) {
      state = (byte) c.deleteCharacter(Character_ID);
    }
    c.getSession().write(LoginPacket.deleteCharResponse(Character_ID, state));
  }
Пример #5
0
  public static final void DeleteChar(final LittleEndianAccessor slea, final MapleClient c) {
    String Secondpw_Client = GameConstants.GMS ? slea.readMapleAsciiString() : null;
    if (Secondpw_Client == null) {
      if (slea.readByte() > 0) { // Specific if user have second password or not
        Secondpw_Client = slea.readMapleAsciiString();
      }
      slea.readMapleAsciiString();
    }

    final int Character_ID = slea.readInt();

    if (!c.login_Auth(Character_ID) || !c.isLoggedIn() || loginFailCount(c)) {
      c.getSession().close();
      return; // Attempting to delete other character
    }
    byte state = 0;

    if (c.getSecondPassword() != null) { // On the server, there's a second password
      if (Secondpw_Client == null) { // Client's hacking
        c.getSession().close();
        return;
      } else {
        if (!c.CheckSecondPassword(Secondpw_Client)) { // Wrong Password
          state = 20;
        }
      }
    }

    if (state == 0) {
      state = (byte) c.deleteCharacter(Character_ID);
    }
    c.getSession().write(LoginPacket.deleteCharResponse(Character_ID, state));
  }
Пример #6
0
  public static final void DamageSummon(final LittleEndianAccessor slea, final MapleCharacter chr) {
    final int unkByte = slea.readByte();
    final int damage = slea.readInt();
    final int monsterIdFrom = slea.readInt();
    //       slea.readByte(); // stance

    final Iterator<MapleSummon> iter = chr.getSummonsReadLock().iterator();
    MapleSummon summon;
    boolean remove = false;
    try {
      while (iter.hasNext()) {
        summon = iter.next();
        if (summon.isPuppet()
            && summon.getOwnerId() == chr.getId()
            && damage > 0) { // We can only have one puppet(AFAIK O.O) so this check is safe.
          summon.addHP((short) -damage);
          if (summon.getHP() <= 0) {
            remove = true;
          }
          chr.getMap()
              .broadcastMessage(
                  chr,
                  SummonPacket.damageSummon(
                      chr.getId(), summon.getSkill(), damage, unkByte, monsterIdFrom),
                  summon.getTruePosition());
          break;
        }
      }
    } finally {
      chr.unlockSummonsReadLock();
    }
    if (remove) {
      chr.cancelEffectFromBuffStat(MapleBuffStat.PUPPET);
    }
  }
 public static final void MerchantItemStore(LittleEndianAccessor slea, MapleClient c) {
   if (c.getPlayer() == null) {
     return;
   }
   byte operation = slea.readByte();
   if ((operation == 27) || (operation == 28)) {
     requestItems(c, operation == 27);
   } else if (operation == 30) {
     c.getPlayer().setConversation(0);
   }
 }
Пример #8
0
  public static final void Character_WithoutSecondPassword(
      final LittleEndianAccessor slea,
      final MapleClient c,
      final boolean haspic,
      final boolean view) {
    slea.readByte(); // 1?
    slea.readByte(); // 1?
    final int charId = slea.readInt();
    if (view) {
      c.setChannel(1);
      c.setWorld(slea.readInt());
    }
    final String currentpw = c.getSecondPassword();
    if (!c.isLoggedIn()
        || loginFailCount(c)
        || (currentpw != null && (!currentpw.equals("") || haspic))
        || !c.login_Auth(charId)
        || ChannelServer.getInstance(c.getChannel()) == null
        || c.getWorld() != 0) { // TODOO: MULTI WORLDS
      c.getSession().close();
      return;
    }
    c.updateMacs(slea.readMapleAsciiString());
    slea.readMapleAsciiString();
    if (slea.available() != 0) {
      final String setpassword = slea.readMapleAsciiString();

      if (setpassword.length() >= 6 && setpassword.length() <= 16) {
        c.setSecondPassword(setpassword);
        c.updateSecondPassword();
      } else {
        c.getSession().write(LoginPacket.secondPwError((byte) 0x14));
        return;
      }
    } else if (GameConstants.GMS && haspic) {
      return;
    }
    if (c.getIdleTask() != null) {
      c.getIdleTask().cancel(true);
    }
    final String s = c.getSessionIPAddress();
    LoginServer.putLoginAuth(
        charId, s.substring(s.indexOf('/') + 1, s.length()), c.getTempIP(), c.getChannel());
    c.updateLoginState(MapleClient.LOGIN_SERVER_TRANSITION, s);
    c.getSession()
        .write(
            CField.getServerIP(
                c,
                Integer.parseInt(ChannelServer.getInstance(c.getChannel()).getIP().split(":")[1]),
                charId));
  }
Пример #9
0
 /*
  * Ex.
  * 0A 00 31 30 32 30 33 30 34 30 35 30 to mapleasciistring
  */
 public static void main(String[] args) {
   String packet = "0A 00 31 30 40 30 32 30 33 30 34 30 35 30";
   byte[] bytes = getByteArrayFromHexString(packet);
   final LittleEndianAccessor slea =
       new LittleEndianAccessor(new ByteArrayByteStream((byte[]) bytes));
   byte next;
   short next_short;
   int next_int;
   long next_long;
   for (int length = 0; length < bytes.length; length++) {
     if (slea.readInt() % 100 < 10 && slea.available() >= 4) {
       System.out.println(slea.readLastInt());
     } else {
       slea.unReadInt();
       System.out.println(slea.readByte());
     }
   }
   // System.out.println(slea.readMapleAsciiString());
 }
Пример #10
0
  public static void CreateChar(final LittleEndianAccessor slea, final MapleClient c) {
    if (!c.isLoggedIn()) {
      c.getSession().close();
      return;
    }
    final String name = slea.readMapleAsciiString();
    final JobType jobType =
        JobType.getByType(
            slea.readInt()); // BIGBANG: 0 = Resistance, 1 = Adventurer, 2 = Cygnus, 3 = Aran, 4 =
    // Evan, 5 = mercedes
    final short db = slea.readShort(); // whether dual blade = 1 or adventurer = 0
    final byte gender = slea.readByte(); // ??idk corresponds with the thing in addCharStats
    byte skinColor = slea.readByte(); // 01
    int hairColor = 0;
    final byte unk2 = slea.readByte(); // 08
    final boolean mercedes = (jobType == JobType.Mercedes);
    final boolean demon = (jobType == JobType.Demon);
    final boolean mihile = (jobType == JobType.Mihile);
    boolean jettPhantom =
        (jobType == LoginInformationProvider.JobType.Jett)
            || (jobType == LoginInformationProvider.JobType.Phantom)
            || (jobType == LoginInformationProvider.JobType.DualBlade);
    final int face = slea.readInt();
    final int hair = slea.readInt();
    if (!mercedes
        && !mihile
        && !demon
        && !jettPhantom) { // mercedes/demon dont need hair color since its already in the hair
      hairColor = slea.readInt();
      skinColor = (byte) slea.readInt();
    }
    final int demonMark = demon ? slea.readInt() : 0;
    final int top = (mihile) ? 0 : slea.readInt();
    final int bottom = (mihile) ? 0 : slea.readInt();
    final int shoes = (mihile) ? 0 : slea.readInt();
    final int weapon =
        jobType == LoginInformationProvider.JobType.Phantom
            ? 1362046
            : mercedes ? 1522038 : (mihile || demon) ? 0 : slea.readInt();
    int shield =
        jobType == LoginInformationProvider.JobType.Phantom
            ? 1352100
            : jobType == LoginInformationProvider.JobType.Mihile
                ? 1098000
                : mercedes ? 1352000 : demon ? slea.readInt() : 0;
    MapleCharacter newchar = MapleCharacter.getDefault(c, jobType);
    newchar.setWorld((byte) c.getWorld());
    newchar.setFace(face);
    newchar.setHair(hair + hairColor);
    newchar.setGender(gender);
    newchar.setName(name);
    newchar.setSkinColor(skinColor);
    newchar.setDemonMarking(demonMark);

    final MapleItemInformationProvider li = MapleItemInformationProvider.getInstance();
    final MapleInventory equip = newchar.getInventory(MapleInventoryType.EQUIPPED);

    Item item = li.getEquipById(top);
    item.setPosition((byte) -5);
    equip.addFromDB(item);

    if (bottom > 0) { // resistance have overall
      item = li.getEquipById(bottom);
      item.setPosition((short) (byte) (jettPhantom ? -9 : -6));
      equip.addFromDB(item);
    }

    item = li.getEquipById(shoes);
    item.setPosition((byte) -7);
    equip.addFromDB(item);

    item = li.getEquipById(weapon);
    item.setPosition((byte) -11);
    equip.addFromDB(item);

    if (shield > 0) {
      item = li.getEquipById(shield);
      item.setPosition((byte) -10);
      equip.addFromDB(item);
    }

    newchar
        .getInventory(MapleInventoryType.USE)
        .addItem(new Item(2000013, (byte) 0, (short) 100, (byte) 0));
    newchar
        .getInventory(MapleInventoryType.USE)
        .addItem(new Item(2000014, (byte) 0, (short) 100, (byte) 0));
    // blue/red pots
    switch (jobType) {
      case Resistance: // Resistance
        newchar
            .getInventory(MapleInventoryType.ETC)
            .addItem(new Item(4161001, (byte) 0, (short) 1, (byte) 0));
        final Map<Skill, SkillEntry> ss = new HashMap<>();
        ss.put(SkillFactory.getSkill(80001152), new SkillEntry((byte) 1, (byte) 1, -1));
        newchar.changeSkillLevel_Skip(ss, false);
        break;
      case Adventurer: // Adventurer
        newchar
            .getInventory(MapleInventoryType.ETC)
            .addItem(new Item(4161001, (byte) 0, (short) 1, (byte) 0));
        final Map<Skill, SkillEntry> ss1 = new HashMap<>();
        ss1.put(SkillFactory.getSkill(80001152), new SkillEntry((byte) 1, (byte) 1, -1));
        newchar.changeSkillLevel_Skip(ss1, false);
        break;
      case Cygnus: // Cygnus
        newchar
            .getInventory(MapleInventoryType.ETC)
            .addItem(new Item(4161047, (byte) 0, (short) 1, (byte) 0));
        newchar.setQuestAdd(MapleQuest.getInstance(20022), (byte) 1, "1");
        newchar.setQuestAdd(MapleQuest.getInstance(20010), (byte) 1, null); // >_>_>_> ugh
        final Map<Skill, SkillEntry> ss2 = new HashMap<>();
        ss2.put(SkillFactory.getSkill(80001152), new SkillEntry((byte) 1, (byte) 1, -1));
        newchar.changeSkillLevel_Skip(ss2, false);
        break;
      case Aran: // Aran
        newchar
            .getInventory(MapleInventoryType.ETC)
            .addItem(new Item(4161048, (byte) 0, (short) 1, (byte) 0));
        final Map<Skill, SkillEntry> ss3 = new HashMap<>();
        ss3.put(SkillFactory.getSkill(80001152), new SkillEntry((byte) 1, (byte) 1, -1));
        newchar.changeSkillLevel_Skip(ss3, false);
        break;
      case Evan: // Evan
        newchar
            .getInventory(MapleInventoryType.ETC)
            .addItem(new Item(4161052, (byte) 0, (short) 1, (byte) 0));
        final Map<Skill, SkillEntry> ss4 = new HashMap<>();
        ss4.put(SkillFactory.getSkill(80001152), new SkillEntry((byte) 1, (byte) 1, -1));
        newchar.changeSkillLevel_Skip(ss4, false);
        break;
      case Mercedes: // Mercedes
        newchar
            .getInventory(MapleInventoryType.ETC)
            .addItem(new Item(4161079, (byte) 0, (short) 1, (byte) 0));
        final Map<Skill, SkillEntry> ss5 = new HashMap<>();
        ss5.put(SkillFactory.getSkill(20021000), new SkillEntry((byte) 0, (byte) 0, -1));
        ss5.put(SkillFactory.getSkill(20021001), new SkillEntry((byte) 0, (byte) 0, -1));
        ss5.put(SkillFactory.getSkill(20020002), new SkillEntry((byte) 0, (byte) 0, -1));
        ss5.put(SkillFactory.getSkill(20020022), new SkillEntry((byte) 1, (byte) 1, -1));
        ss5.put(SkillFactory.getSkill(20020109), new SkillEntry((byte) 1, (byte) 1, -1));
        ss5.put(SkillFactory.getSkill(20021110), new SkillEntry((byte) 1, (byte) 1, -1));
        ss5.put(SkillFactory.getSkill(20020111), new SkillEntry((byte) 1, (byte) 1, -1));
        ss5.put(SkillFactory.getSkill(20020112), new SkillEntry((byte) 1, (byte) 1, -1));
        ss5.put(SkillFactory.getSkill(20021181), new SkillEntry((byte) -1, (byte) 0, -1));
        ss5.put(SkillFactory.getSkill(20021166), new SkillEntry((byte) -1, (byte) 0, -1));
        ss5.put(SkillFactory.getSkill(80001152), new SkillEntry((byte) 1, (byte) 1, -1));
        newchar.changeSkillLevel_Skip(ss5, false);
        break;
      case Demon: // Demon
        newchar
            .getInventory(MapleInventoryType.ETC)
            .addItem(new Item(4161054, (byte) 0, (short) 1, (byte) 0));
        final Map<Skill, SkillEntry> ss6 = new HashMap<>();
        ss6.put(SkillFactory.getSkill(30011000), new SkillEntry((byte) 0, (byte) 0, -1));
        ss6.put(SkillFactory.getSkill(30011001), new SkillEntry((byte) 0, (byte) 0, -1));
        ss6.put(SkillFactory.getSkill(30010002), new SkillEntry((byte) 0, (byte) 0, -1));
        ss6.put(SkillFactory.getSkill(30010185), new SkillEntry((byte) 1, (byte) 1, -1));
        ss6.put(SkillFactory.getSkill(30010112), new SkillEntry((byte) 1, (byte) 1, -1));
        ss6.put(SkillFactory.getSkill(30010111), new SkillEntry((byte) 1, (byte) 1, -1));
        ss6.put(SkillFactory.getSkill(30010110), new SkillEntry((byte) 1, (byte) 1, -1));
        ss6.put(SkillFactory.getSkill(30010022), new SkillEntry((byte) 1, (byte) 1, -1));
        ss6.put(SkillFactory.getSkill(30011109), new SkillEntry((byte) 1, (byte) 1, -1));
        ss6.put(SkillFactory.getSkill(30011170), new SkillEntry((byte) 1, (byte) 1, -1));
        ss6.put(SkillFactory.getSkill(30011169), new SkillEntry((byte) 1, (byte) 1, -1));
        ss6.put(SkillFactory.getSkill(30011168), new SkillEntry((byte) 1, (byte) 1, -1));
        ss6.put(SkillFactory.getSkill(30011167), new SkillEntry((byte) 1, (byte) 1, -1));
        ss6.put(SkillFactory.getSkill(30010166), new SkillEntry((byte) 1, (byte) 1, -1));
        ss6.put(SkillFactory.getSkill(80001152), new SkillEntry((byte) 1, (byte) 1, -1));
        newchar.changeSkillLevel_Skip(ss6, false);
        break;

      case Phantom:
        newchar.setLevel((short) 10);
        newchar.setJob(2400);
        newchar.getStat().maxhp += 294; // Beginner 10 levels
        newchar.getStat().maxmp += 113;
        newchar.getStat().hp += 294; // Beginner 10 levels
        newchar.getStat().mp += 113;
        newchar.getStat().str -= 8;
        newchar.getStat().dex -= 1;
        newchar.getStat().luk += 31;
        newchar.setRemainingAp((short) 23);
        newchar.setRemainingSp(5);
        final Map<Skill, SkillEntry> ss7 = new HashMap<>();
        ss7.put(SkillFactory.getSkill(20031203), new SkillEntry((byte) 1, (byte) 1, -1));
        ss7.put(SkillFactory.getSkill(20030204), new SkillEntry((byte) 1, (byte) 1, -1));
        ss7.put(SkillFactory.getSkill(20031205), new SkillEntry((byte) 1, (byte) 1, -1));
        ss7.put(SkillFactory.getSkill(20030206), new SkillEntry((byte) 1, (byte) 1, -1));
        ss7.put(SkillFactory.getSkill(20031207), new SkillEntry((byte) 1, (byte) 1, -1));
        ss7.put(SkillFactory.getSkill(20031208), new SkillEntry((byte) 1, (byte) 1, -1));
        ss7.put(SkillFactory.getSkill(20031209), new SkillEntry((byte) 1, (byte) 1, -1));
        ss7.put(SkillFactory.getSkill(20031210), new SkillEntry((byte) 1, (byte) 1, -1));
        ss7.put(SkillFactory.getSkill(80001152), new SkillEntry((byte) 1, (byte) 1, -1));
        newchar.changeSkillLevel_Skip(ss7, false);
        break;

      case Jett:
        newchar.setLevel((short) 10);
        newchar.setJob(508);
        newchar.getStat().maxhp += 294; // Beginner 10
        newchar.getStat().maxmp += 113;
        newchar.getStat().hp += 294; // Beginner 10
        newchar.getStat().mp += 113;
        newchar.getStat().str -= 8;
        newchar.getStat().dex += 15;
        newchar.setRemainingAp((short) 38);
        newchar.setRemainingSp(1);
        final Map<Skill, SkillEntry> ss8 = new HashMap<>();
        ss8.put(SkillFactory.getSkill(228), new SkillEntry((byte) 1, (byte) 1, -1));
        ss8.put(SkillFactory.getSkill(80001152), new SkillEntry((byte) 1, (byte) 1, -1));
        // ss8.put(SkillFactory.getSkill(80001151), new SkillEntry((byte) 1, (byte) 1, -1));
        newchar.changeSkillLevel_Skip(ss8, false);
        break;

      case Mihile:
        final Map<Skill, SkillEntry> ss9 = new HashMap<>();
        ss9.put(SkillFactory.getSkill(80001152), new SkillEntry((byte) 1, (byte) 1, -1));
        newchar.changeSkillLevel_Skip(ss9, false);
        break;
    }

    if (MapleCharacterUtil.canCreateChar(name, c.isGm())
        && (!LoginInformationProvider.getInstance().isForbiddenName(name) || c.isGm())
        && (c.isGm() || c.canMakeCharacter(c.getWorld()))) {
      MapleCharacter.saveNewCharToDB(newchar, jobType, db);
      c.getSession().write(LoginPacket.addNewCharEntry(newchar, true));
      c.createdChar(newchar.getId());
    } else {
      c.getSession().write(LoginPacket.addNewCharEntry(newchar, false));
    }
  }
Пример #11
0
 public static void MTSOperation(final LittleEndianAccessor slea, final MapleClient c) {
   final MTSCart cart = MTSStorage.getInstance().getCart(c.getPlayer().getId());
   // System.out.println(slea.toString());
   if (slea.available() <= 0) {
     doMTSPackets(cart, c);
     return;
   }
   final byte op = slea.readByte();
   if (op == 2) { // put up for sale
     final byte invType = slea.readByte(); // 1 = equip 2 = everything else
     if (invType != 1 && invType != 2) { // pet?
       c.getSession().write(MTSCSPacket.getMTSFailSell());
       doMTSPackets(cart, c);
       return;
     }
     final int itemid = slea.readInt(); // itemid
     if (slea.readByte() != 0) {
       c.getSession().write(MTSCSPacket.getMTSFailSell());
       doMTSPackets(cart, c);
       return; // we don't like uniqueIDs
     }
     slea.skip(12); // expiration, -1, don't matter
     short stars = 1, quantity = 1;
     byte slot = 0;
     if (invType == 1) {
       slea.skip(32);
     } else {
       stars = slea.readShort(); // the entire quantity of the item
     }
     slea.readMapleAsciiString(); // owner
     // again? =/
     if (invType == 1) {
       slea.skip(50);
       slot = (byte) slea.readInt();
       slea.skip(4); // skip the quantity int, equips are always 1
     } else {
       slea.readShort(); // flag
       if (GameConstants.isThrowingStar(itemid) || GameConstants.isBullet(itemid)) {
         slea.skip(8); // recharge ID thing
       }
       slot = (byte) slea.readInt();
       if (GameConstants.isThrowingStar(itemid) || GameConstants.isBullet(itemid)) {
         quantity =
             stars; // this is due to stars you need to use the entire quantity, not specified
         slea.skip(4); // so just skip the quantity int
       } else {
         quantity = (short) slea.readInt(); // specified quantity
       }
     }
     final int price = slea.readInt();
     final MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
     final MapleInventoryType type = GameConstants.getInventoryType(itemid);
     final Item item = c.getPlayer().getInventory(type).getItem(slot).copy();
     if (ii.isCash(itemid)
         || quantity <= 0
         || item == null
         || item.getQuantity() <= 0
         || item.getItemId() != itemid
         || item.getUniqueId() > 0
         || item.getQuantity() < quantity
         || price < ServerConstants.MIN_MTS
         || c.getPlayer().getMeso() < ServerConstants.MTS_MESO
         || cart.getNotYetSold().size() >= 10
         || ii.isDropRestricted(itemid)
         || ii.isAccountShared(itemid)
         || item.getExpiration() > -1
         || item.getFlag() > 0) {
       c.getSession().write(MTSCSPacket.getMTSFailSell());
       doMTSPackets(cart, c);
       return;
     }
     if (type == MapleInventoryType.EQUIP) {
       final Equip eq = (Equip) item;
       if (eq.getState() > 0 || eq.getEnhance() > 0 || eq.getDurability() > -1) {
         c.getSession().write(MTSCSPacket.getMTSFailSell());
         doMTSPackets(cart, c);
         return;
       }
     }
     if (quantity >= 50 && item.getItemId() == 2340000) {
       c.setMonitored(true); // hack check
     }
     final long expiration = (System.currentTimeMillis() + (7L * 24 * 60 * 60 * 1000));
     item.setQuantity(quantity);
     MTSStorage.getInstance()
         .addToBuyNow(
             cart, item, price, c.getPlayer().getId(), c.getPlayer().getName(), expiration);
     MapleInventoryManipulator.removeFromSlot(c, type, slot, quantity, false);
     c.getPlayer().gainMeso(-ServerConstants.MTS_MESO, false);
     c.getSession().write(MTSCSPacket.getMTSConfirmSell());
   } else if (op == 5) { // change page/tab
     cart.changeInfo(slea.readInt(), slea.readInt(), slea.readInt());
   } else if (op == 6) { // search
     cart.changeInfo(slea.readInt(), slea.readInt(), 0);
     slea.readInt(); // always 0?
     cart.changeCurrentView(
         MTSStorage.getInstance()
             .getSearch(
                 slea.readInt() > 0, slea.readMapleAsciiString(), cart.getType(), cart.getTab()));
   } else if (op == 7) { // cancel sale
     if (!MTSStorage.getInstance().removeFromBuyNow(slea.readInt(), c.getPlayer().getId(), true)) {
       c.getSession().write(MTSCSPacket.getMTSFailCancel());
     } else {
       c.getSession().write(MTSCSPacket.getMTSConfirmCancel());
       sendMTSPackets(cart, c, true);
       return;
     }
   } else if (op == 8) { // transfer item
     final int id = Integer.MAX_VALUE - slea.readInt(); // fake id
     if (id >= cart.getInventory().size()) {
       c.getPlayer().dropMessage(1, "Please try it again later.");
       sendMTSPackets(cart, c, true);
       return;
     }
     final Item item = cart.getInventory().get(id); // by index
     // System.out.println("NumItems: " + cart.getInventory().size() + ", ID: " + id + ",
     // ItemExists?: " + (item != null));
     if (item != null
         && item.getQuantity() > 0
         && MapleInventoryManipulator.checkSpace(
             c, item.getItemId(), item.getQuantity(), item.getOwner())) {
       Item item_ = item.copy();
       short pos = MapleInventoryManipulator.addbyItem(c, item_, true);
       if (pos >= 0) {
         if (item_.getPet() != null) {
           item_.getPet().setInventoryPosition(pos);
           c.getPlayer().addPet(item_.getPet());
         }
         cart.removeFromInventory(item);
         c.getSession()
             .write(
                 MTSCSPacket.getMTSConfirmTransfer(
                     GameConstants.getInventoryType(item_.getItemId()).getType(),
                     pos)); // IF this is actually pos and pos
         sendMTSPackets(cart, c, true);
         return;
       } else {
         // System.out.println("addByItem is less than 0");
         c.getSession().write(MTSCSPacket.getMTSFailBuy());
       }
     } else {
       // System.out.println("CheckSpace return false");
       c.getSession().write(MTSCSPacket.getMTSFailBuy());
     }
   } else if (op == 9) { // add to cart
     final int id = slea.readInt();
     if (MTSStorage.getInstance().checkCart(id, c.getPlayer().getId()) && cart.addToCart(id)) {
       c.getSession().write(MTSCSPacket.addToCartMessage(false, false));
     } else {
       c.getSession().write(MTSCSPacket.addToCartMessage(true, false));
     }
   } else if (op == 10) { // delete from cart
     final int id = slea.readInt();
     if (cart.getCart().contains(id)) {
       cart.removeFromCart(id);
       c.getSession().write(MTSCSPacket.addToCartMessage(false, true));
     } else {
       c.getSession().write(MTSCSPacket.addToCartMessage(true, true));
     }
   } else if (op == 16 || op == 17) { // buyNow, buy from cart
     final MTSItemInfo mts = MTSStorage.getInstance().getSingleItem(slea.readInt());
     if (mts != null && mts.getCharacterId() != c.getPlayer().getId()) {
       if (c.getPlayer().getCSPoints(1) > mts.getRealPrice()) {
         if (MTSStorage.getInstance()
             .removeFromBuyNow(mts.getId(), c.getPlayer().getId(), false)) {
           c.getPlayer().modifyCSPoints(1, -mts.getRealPrice(), false);
           MTSStorage.getInstance().getCart(mts.getCharacterId()).increaseOwedNX(mts.getPrice());
           c.getSession().write(MTSCSPacket.getMTSConfirmBuy());
           sendMTSPackets(cart, c, true);
           return;
         } else {
           c.getSession().write(MTSCSPacket.getMTSFailBuy());
         }
       } else {
         c.getSession().write(MTSCSPacket.getMTSFailBuy());
       }
     } else {
       c.getSession().write(MTSCSPacket.getMTSFailBuy());
     }
   } else if (c.getPlayer().isAdmin()) {
     // System.out.println("New MTS Op " + op + ", \n" + slea.toString());
   }
   doMTSPackets(cart, c);
 }
Пример #12
0
  public static final void ItemMaker(final LittleEndianAccessor slea, final MapleClient c) {
    // System.out.println(slea.toString()); //change?
    final int makerType = slea.readInt();

    switch (makerType) {
      case 1:
        { // Gem
          final int toCreate = slea.readInt();

          if (GameConstants.isGem(toCreate)) {
            final GemCreateEntry gem = ItemMakerFactory.getInstance().getGemInfo(toCreate);
            if (gem == null) {
              return;
            }
            if (!hasSkill(c, gem.getReqSkillLevel())) {
              return; // H4x
            }
            if (c.getPlayer().getMeso() < gem.getCost()) {
              return; // H4x
            }
            final int randGemGiven = getRandomGem(gem.getRandomReward());

            if (c.getPlayer().getInventory(GameConstants.getInventoryType(randGemGiven)).isFull()) {
              return; // We'll do handling for this later
            }
            final int taken = checkRequiredNRemove(c, gem.getReqRecipes());
            if (taken == 0) {
              return; // We'll do handling for this later
            }
            c.getPlayer().gainMeso(-gem.getCost(), false);
            MapleInventoryManipulator.addById(
                c,
                randGemGiven,
                (byte) (taken == randGemGiven ? 9 : 1),
                "Made by Gem "
                    + toCreate
                    + " on "
                    + FileoutputUtil.CurrentReadable_Date()); // Gem is always 1

            c.getSession().write(EffectPacket.ItemMaker_Success());
            c.getPlayer()
                .getMap()
                .broadcastMessage(
                    c.getPlayer(),
                    EffectPacket.ItemMaker_Success_3rdParty(c.getPlayer().getId()),
                    false);
          } else if (GameConstants.isOtherGem(toCreate)) {
            // non-gems that are gems
            // stim and numEnchanter always 0
            final GemCreateEntry gem = ItemMakerFactory.getInstance().getGemInfo(toCreate);
            if (gem == null) {
              return;
            }
            if (!hasSkill(c, gem.getReqSkillLevel())) {
              return; // H4x
            }
            if (c.getPlayer().getMeso() < gem.getCost()) {
              return; // H4x
            }

            if (c.getPlayer().getInventory(GameConstants.getInventoryType(toCreate)).isFull()) {
              return; // We'll do handling for this later
            }
            if (checkRequiredNRemove(c, gem.getReqRecipes()) == 0) {
              return; // We'll do handling for this later
            }
            c.getPlayer().gainMeso(-gem.getCost(), false);
            if (GameConstants.getInventoryType(toCreate) == MapleInventoryType.EQUIP) {
              MapleInventoryManipulator.addbyItem(
                  c, MapleItemInformationProvider.getInstance().getEquipById(toCreate));
            } else {
              MapleInventoryManipulator.addById(
                  c,
                  toCreate,
                  (byte) 1,
                  "Made by Gem "
                      + toCreate
                      + " on "
                      + FileoutputUtil.CurrentReadable_Date()); // Gem is always 1
            }

            c.getSession().write(EffectPacket.ItemMaker_Success());
            c.getPlayer()
                .getMap()
                .broadcastMessage(
                    c.getPlayer(),
                    EffectPacket.ItemMaker_Success_3rdParty(c.getPlayer().getId()),
                    false);
          } else {
            final boolean stimulator = slea.readByte() > 0;
            final int numEnchanter = slea.readInt();

            final ItemMakerCreateEntry create =
                ItemMakerFactory.getInstance().getCreateInfo(toCreate);
            if (create == null) {
              return;
            }
            if (numEnchanter > create.getTUC()) {
              return; // h4x
            }
            if (!hasSkill(c, create.getReqSkillLevel())) {
              return; // H4x
            }
            if (c.getPlayer().getMeso() < create.getCost()) {
              return; // H4x
            }
            if (c.getPlayer().getInventory(GameConstants.getInventoryType(toCreate)).isFull()) {
              return; // We'll do handling for this later
            }
            if (checkRequiredNRemove(c, create.getReqItems()) == 0) {
              return; // We'll do handling for this later
            }
            c.getPlayer().gainMeso(-create.getCost(), false);

            final MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
            final Equip toGive = (Equip) ii.getEquipById(toCreate);

            if (stimulator || numEnchanter > 0) {
              if (c.getPlayer().haveItem(create.getStimulator(), 1, false, true)) {
                ii.randomizeStats_Above(toGive);
                MapleInventoryManipulator.removeById(
                    c, MapleInventoryType.ETC, create.getStimulator(), 1, false, false);
              }
              for (int i = 0; i < numEnchanter; i++) {
                final int enchant = slea.readInt();
                if (c.getPlayer().haveItem(enchant, 1, false, true)) {
                  final Map<String, Integer> stats = ii.getEquipStats(enchant);
                  if (stats != null) {
                    addEnchantStats(stats, toGive);
                    MapleInventoryManipulator.removeById(
                        c, MapleInventoryType.ETC, enchant, 1, false, false);
                  }
                }
              }
            }
            if (!stimulator || Randomizer.nextInt(10) != 0) {
              MapleInventoryManipulator.addbyItem(c, toGive);
              c.getPlayer()
                  .getMap()
                  .broadcastMessage(
                      c.getPlayer(),
                      EffectPacket.ItemMaker_Success_3rdParty(c.getPlayer().getId()),
                      false);
            } else {
              c.getPlayer().dropMessage(5, "The item was overwhelmed by the stimulator.");
            }
            c.getSession().write(EffectPacket.ItemMaker_Success());
          }
          break;
        }
      case 3:
        { // Making Crystals
          final int etc = slea.readInt();
          if (c.getPlayer().haveItem(etc, 100, false, true)) {
            MapleInventoryManipulator.addById(
                c,
                getCreateCrystal(etc),
                (short) 1,
                "Made by Maker " + etc + " on " + FileoutputUtil.CurrentReadable_Date());
            MapleInventoryManipulator.removeById(c, MapleInventoryType.ETC, etc, 100, false, false);

            c.getSession().write(EffectPacket.ItemMaker_Success());
            c.getPlayer()
                .getMap()
                .broadcastMessage(
                    c.getPlayer(),
                    EffectPacket.ItemMaker_Success_3rdParty(c.getPlayer().getId()),
                    false);
          }
          break;
        }
      case 4:
        { // Disassembling EQ.
          final int itemId = slea.readInt();
          c.getPlayer().updateTick(slea.readInt());
          final byte slot = (byte) slea.readInt();

          final Item toUse = c.getPlayer().getInventory(MapleInventoryType.EQUIP).getItem(slot);
          if (toUse == null || toUse.getItemId() != itemId || toUse.getQuantity() < 1) {
            return;
          }
          final MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();

          if (!ii.isDropRestricted(itemId) && !ii.isAccountShared(itemId)) {
            final int[] toGive = getCrystal(itemId, ii.getReqLevel(itemId));
            MapleInventoryManipulator.addById(
                c,
                toGive[0],
                (byte) toGive[1],
                "Made by disassemble " + itemId + " on " + FileoutputUtil.CurrentReadable_Date());
            MapleInventoryManipulator.removeFromSlot(
                c, MapleInventoryType.EQUIP, slot, (byte) 1, false);
          }
          c.getSession().write(EffectPacket.ItemMaker_Success());
          c.getPlayer()
              .getMap()
              .broadcastMessage(
                  c.getPlayer(),
                  EffectPacket.ItemMaker_Success_3rdParty(c.getPlayer().getId()),
                  false);
          break;
        }
    }
  }
Пример #13
0
  public static void SummonAttack(
      final LittleEndianAccessor slea, final MapleClient c, final MapleCharacter chr) {
    if (chr == null || !chr.isAlive() || chr.getMap() == null) {
      return;
    }
    final MapleMap map = chr.getMap();
    final MapleMapObject obj = map.getMapObject(slea.readInt(), MapleMapObjectType.SUMMON);
    if (obj == null || !(obj instanceof MapleSummon)) {
      chr.dropMessage(5, "The summon has disappeared.");
      return;
    }
    final MapleSummon summon = (MapleSummon) obj;
    if (summon.getOwnerId() != chr.getId() || summon.getSkillLevel() <= 0) {
      chr.dropMessage(5, "Error.");
      return;
    }
    final SummonSkillEntry sse = SkillFactory.getSummonData(summon.getSkill());
    if (summon.getSkill() / 1000000 != 35 && summon.getSkill() != 33101008 && sse == null) {
      chr.dropMessage(5, "Error in processing attack.");
      return;
    }
    if (!GameConstants.GMS) {
      slea.skip(8);
    }
    int tick = slea.readInt();
    if (sse != null && sse.delay > 0) {
      chr.updateTick(tick);
      // summon.CheckSummonAttackFrequency(chr, tick);
      // chr.getCheatTracker().checkSummonAttack();
    }
    if (!GameConstants.GMS) {
      slea.skip(8);
    }
    final byte animation = slea.readByte();
    if (!GameConstants.GMS) {
      slea.skip(8);
    }
    final byte numAttacked = slea.readByte();
    if (sse != null && numAttacked > sse.mobCount) {
      chr.dropMessage(5, "Warning: Attacking more monster than summon can do");
      chr.getCheatTracker().registerOffense(CheatingOffense.SUMMON_HACK_MOBS);
      // AutobanManager.getInstance().autoban(c, "Attacking more monster that summon can do (Skillid
      // : "+summon.getSkill()+" Count : " + numAttacked + ", allowed : " + sse.mobCount + ")");
      return;
    }
    slea.skip(summon.getSkill() == 35111002 ? 24 : 12); // some pos stuff
    final List<Pair<Integer, Integer>> allDamage = new ArrayList<Pair<Integer, Integer>>();
    for (int i = 0; i < numAttacked; i++) {
      final MapleMonster mob = map.getMonsterByOid(slea.readInt());

      if (mob == null) {
        continue;
      }
      slea.skip(22); // who knows
      final int damge = slea.readInt();
      allDamage.add(new Pair<Integer, Integer>(mob.getObjectId(), damge));
    }
    // if (!summon.isChangedMap()) {
    map.broadcastMessage(
        chr,
        SummonPacket.summonAttack(
            summon.getOwnerId(), summon.getObjectId(), animation, allDamage, chr.getLevel(), false),
        summon.getTruePosition());
    // }
    final Skill summonSkill = SkillFactory.getSkill(summon.getSkill());
    final MapleStatEffect summonEffect = summonSkill.getEffect(summon.getSkillLevel());
    if (summonEffect == null) {
      chr.dropMessage(5, "Error in attack.");
      return;
    }
    for (Pair<Integer, Integer> attackEntry : allDamage) {
      final int toDamage = attackEntry.right;
      final MapleMonster mob = map.getMonsterByOid(attackEntry.left);
      if (mob == null) {
        continue;
      }
      if (sse != null
          && sse.delay > 0
          && summon.getMovementType() != SummonMovementType.STATIONARY
          && summon.getMovementType() != SummonMovementType.CIRCLE_STATIONARY
          && summon.getMovementType() != SummonMovementType.WALK_STATIONARY
          && chr.getTruePosition().distanceSq(mob.getTruePosition()) > 400000.0) {
        // chr.getCheatTracker().registerOffense(CheatingOffense.ATTACK_FARAWAY_MONSTER_SUMMON);
      }
      if (toDamage > 0 && summonEffect.getMonsterStati().size() > 0) {
        if (summonEffect.makeChanceResult()) {
          for (Map.Entry<MonsterStatus, Integer> z : summonEffect.getMonsterStati().entrySet()) {
            mob.applyStatus(
                chr,
                new MonsterStatusEffect(z.getKey(), z.getValue(), summonSkill.getId(), null, false),
                summonEffect.isPoison(),
                4000,
                true,
                summonEffect);
          }
        }
      }
      if (chr.isGM()
          || toDamage
              < (chr.getStat().getCurrentMaxBaseDamage()
                  * 5.0
                  * (summonEffect.getSelfDestruction()
                      + summonEffect.getDamage()
                      + chr.getStat().getDamageIncrease(summonEffect.getSourceId()))
                  / 100.0)) { // 10 x dmg.. eh
        mob.damage(chr, toDamage, true);
        chr.checkMonsterAggro(mob);
        if (!mob.isAlive()) {
          chr.getClient().getSession().write(MobPacket.killMonster(mob.getObjectId(), 1));
        }
      } else {
        chr.dropMessage(5, "Warning - high damage.");
        // AutobanManager.getInstance().autoban(c, "High Summon Damage (" + toDamage + " to " +
        // attackEntry.right + ")");
        // TODO : Check player's stat for damage checking.
        break;
      }
    }
    if (!summon.isMultiAttack()) {
      chr.getMap().broadcastMessage(SummonPacket.removeSummon(summon, true));
      chr.getMap().removeMapObject(summon);
      chr.removeVisibleMapObject(summon);
      chr.removeSummon(summon);
      if (summon.getSkill() != 35121011) {
        chr.cancelEffectFromBuffStat(MapleBuffStat.SUMMON);
      }
    }
  }
Пример #14
0
 public static final void HandleAlliance(
     final LittleEndianAccessor slea, final MapleClient c, boolean denied) {
   if (c.getPlayer().getGuildId() <= 0) {
     c.getSession().write(CWvsContext.enableActions());
     return;
   }
   final MapleGuild gs = World.Guild.getGuild(c.getPlayer().getGuildId());
   if (gs == null) {
     c.getSession().write(CWvsContext.enableActions());
     return;
   }
   // System.out.println("Unhandled GuildAlliance \n" + slea.toString());
   byte op = slea.readByte();
   if (c.getPlayer().getGuildRank() != 1 && op != 1) { // only updating doesn't need guild leader
     return;
   }
   if (op == 22) {
     denied = true;
   }
   int leaderid = 0;
   if (gs.getAllianceId() > 0) {
     leaderid = World.Alliance.getAllianceLeader(gs.getAllianceId());
   }
   // accept invite, and deny invite don't need allianceid.
   if (op != 4 && !denied) {
     if (gs.getAllianceId() <= 0 || leaderid <= 0) {
       return;
     }
   } else if (leaderid > 0
       || gs.getAllianceId() > 0) { // infact, if they have allianceid it's suspicious
     return;
   }
   if (denied) {
     DenyInvite(c, gs);
     return;
   }
   MapleCharacter chr;
   int inviteid;
   switch (op) {
     case 1: // load... must be in world op
       for (byte[] pack : World.Alliance.getAllianceInfo(gs.getAllianceId(), false)) {
         if (pack != null) {
           c.getSession().write(pack);
         }
       }
       break;
     case 3: // invite
       final int newGuild = World.Guild.getGuildLeader(slea.readMapleAsciiString());
       if (newGuild > 0
           && c.getPlayer().getAllianceRank() == 1
           && leaderid == c.getPlayer().getId()) {
         chr = c.getChannelServer().getPlayerStorage().getCharacterById(newGuild);
         if (chr != null && chr.getGuildId() > 0 && World.Alliance.canInvite(gs.getAllianceId())) {
           chr.getClient()
               .getSession()
               .write(
                   AlliancePacket.sendAllianceInvite(
                       World.Alliance.getAlliance(gs.getAllianceId()).getName(), c.getPlayer()));
           World.Guild.setInvitedId(chr.getGuildId(), gs.getAllianceId());
         } else {
           c.getPlayer()
               .dropMessage(1, "Make sure the leader of the guild is online and in your channel.");
         }
       } else {
         c.getPlayer()
             .dropMessage(
                 1,
                 "That Guild was not found. Please enter the correct Guild Name. (Not the player name)");
       }
       break;
     case 4: // accept invite... guildid that invited(int, a/b check) -> guildname that was
             // invited? but we dont care about that
       inviteid = World.Guild.getInvitedId(c.getPlayer().getGuildId());
       if (inviteid > 0) {
         if (!World.Alliance.addGuildToAlliance(inviteid, c.getPlayer().getGuildId())) {
           c.getPlayer().dropMessage(5, "An error occured when adding guild.");
         }
         World.Guild.setInvitedId(c.getPlayer().getGuildId(), 0);
       }
       break;
     case 2: // leave; nothing
     case 6: // expel, guildid(int) -> allianceid(don't care, a/b check)
       final int gid;
       if (op == 6 && slea.available() >= 4) {
         gid = slea.readInt();
         if (slea.available() >= 4 && gs.getAllianceId() != slea.readInt()) {
           break;
         }
       } else {
         gid = c.getPlayer().getGuildId();
       }
       if (c.getPlayer().getAllianceRank() <= 2
           && (c.getPlayer().getAllianceRank() == 1 || c.getPlayer().getGuildId() == gid)) {
         if (!World.Alliance.removeGuildFromAlliance(
             gs.getAllianceId(), gid, c.getPlayer().getGuildId() != gid)) {
           c.getPlayer().dropMessage(5, "An error occured when removing guild.");
         }
       }
       break;
     case 7: // change leader
       if (c.getPlayer().getAllianceRank() == 1 && leaderid == c.getPlayer().getId()) {
         if (!World.Alliance.changeAllianceLeader(gs.getAllianceId(), slea.readInt())) {
           c.getPlayer().dropMessage(5, "An error occured when changing leader.");
         }
       }
       break;
     case 8: // title update
       if (c.getPlayer().getAllianceRank() == 1 && leaderid == c.getPlayer().getId()) {
         String[] ranks = new String[5];
         for (int i = 0; i < 5; i++) {
           ranks[i] = slea.readMapleAsciiString();
         }
         World.Alliance.updateAllianceRanks(gs.getAllianceId(), ranks);
       }
       break;
     case 9:
       if (c.getPlayer().getAllianceRank() <= 2) {
         if (!World.Alliance.changeAllianceRank(
             gs.getAllianceId(), slea.readInt(), slea.readByte())) {
           c.getPlayer().dropMessage(5, "An error occured when changing rank.");
         }
       }
       break;
     case 10: // notice update
       if (c.getPlayer().getAllianceRank() <= 2) {
         final String notice = slea.readMapleAsciiString();
         if (notice.length() > 100) {
           break;
         }
         World.Alliance.updateAllianceNotice(gs.getAllianceId(), notice);
       }
       break;
     default:
       System.out.println("Unhandled GuildAlliance op: " + op + ", \n" + slea.toString());
       break;
   }
   // c.getSession().write(CWvsContext.enableActions());
 }