コード例 #1
0
 private static int[] getCrystal(final int itemid, final int level) {
   int[] all = new int[2];
   all[0] = -1;
   if (level >= 31 && level <= 50) {
     all[0] = 4260000;
   } else if (level >= 51 && level <= 60) {
     all[0] = 4260001;
   } else if (level >= 61 && level <= 70) {
     all[0] = 4260002;
   } else if (level >= 71 && level <= 80) {
     all[0] = 4260003;
   } else if (level >= 81 && level <= 90) {
     all[0] = 4260004;
   } else if (level >= 91 && level <= 100) {
     all[0] = 4260005;
   } else if (level >= 101 && level <= 110) {
     all[0] = 4260006;
   } else if (level >= 111 && level <= 120) {
     all[0] = 4260007;
   } else if (level >= 121 && level <= 200) {
     all[0] = 4260008;
   } else {
     throw new RuntimeException("Invalid Item Maker type" + level);
   }
   if (GameConstants.isWeapon(itemid) || GameConstants.isOverall(itemid)) {
     all[1] = Randomizer.rand(5, 11);
   } else {
     all[1] = Randomizer.rand(3, 7);
   }
   return all;
 }
コード例 #2
0
ファイル: PlayerCommand.java プロジェクト: jerbe/Acernis-v144
 @Override
 public int execute(MapleClient c, String[] splitted) {
   c.getPlayer()
       .setExp(
           c.getPlayer().getExp() - GameConstants.getExpNeededForLevel(c.getPlayer().getLevel())
                   >= 0
               ? GameConstants.getExpNeededForLevel(c.getPlayer().getLevel())
               : 0);
   return 1;
 }
コード例 #3
0
ファイル: CashShop.java プロジェクト: jerbe/Acernis-v144
 public Item toItem(CashItem cItem, int uniqueid, String gift) {
   if (uniqueid <= 0) {
     uniqueid = MapleInventoryIdentifier.getInstance();
   }
   long period = cItem.getExpire();
   if ((period <= 0
           && GameConstants.getInventoryType(cItem.getItemId()) != MapleInventoryType.EQUIP)
       || GameConstants.isPet(cItem.getItemId())) {
     period = GameConstants.GMS ? 90 : 45;
   }
   if (cItem.getItemId() >= 5000100 && cItem.getItemId() < 5000200) { // permanent pet
     period = 20000; // permanent time millis
   }
   Item ret;
   if (GameConstants.getInventoryType(cItem.getItemId()) == MapleInventoryType.EQUIP) {
     Equip eq =
         (Equip)
             MapleItemInformationProvider.getInstance().getEquipById(cItem.getItemId(), uniqueid);
     if (period > 0) {
       eq.setExpiration(
           (long) (System.currentTimeMillis() + (long) (period * 24 * 60 * 60 * 1000)));
     }
     eq.setGMLog("Cash Shop: " + cItem.getSN() + " on " + FileoutputUtil.CurrentReadable_Date());
     eq.setGiftFrom(gift);
     if (GameConstants.isEffectRing(cItem.getItemId()) && uniqueid > 0) {
       MapleRing ring = MapleRing.loadFromDb(uniqueid);
       if (ring != null) {
         eq.setRing(ring);
       }
     }
     ret = eq.copy();
   } else {
     Item item =
         new Item(cItem.getItemId(), (byte) 0, (short) cItem.getQuantity(), (byte) 0, uniqueid);
     if (period > 0) {
       item.setExpiration(
           (long) (System.currentTimeMillis() + (long) (period * 24 * 60 * 60 * 1000)));
     }
     item.setGMLog("Cash Shop: " + cItem.getSN() + " on " + FileoutputUtil.CurrentReadable_Date());
     item.setGiftFrom(gift);
     if (GameConstants.isPet(cItem.getItemId())) {
       final MaplePet pet = MaplePet.createPet(cItem.getItemId(), uniqueid);
       if (pet != null) {
         item.setPet(pet);
       }
     }
     ret = item.copy();
   }
   return ret;
 }
コード例 #4
0
ファイル: PlayerCommand.java プロジェクト: jerbe/mapleLemon
    @Override
    public int execute(MapleClient c, String[] splitted) {
      if (splitted.length < 2) {
        c.getPlayer().dropMessage(6, splitted[0] + " <数量> <道具名稱>");
        return 0;
      }
      final String itemName = StringUtil.joinStringFrom(splitted, 2);
      final short quantity = (short) CommandProcessorUtil.getOptionalIntArg(splitted, 1, 1);
      int itemId = 0;
      for (Pair<Integer, String> item : MapleItemInformationProvider.getInstance().getAllItems2()) {
        if (item.getRight().toLowerCase().equals(itemName.toLowerCase())) {
          itemId = item.getLeft();
          break;
        }
      }
      MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
      if (!ii.itemExists(itemId)) {
        c.getPlayer().dropMessage(5, itemName + "不存在");
      } else {
        Item toDrop;
        if (GameConstants.getInventoryType(itemId) == MapleInventoryType.EQUIP) {

          toDrop = ii.getEquipById(itemId);
        } else {
          toDrop = new client.inventory.Item(itemId, (byte) 0, quantity, (byte) 0);
        }
        toDrop.setGMLog(c.getPlayer().getName() + " 使用 " + splitted[0] + " 命令制作");
        toDrop.setOwner(c.getPlayer().getName());
        c.getPlayer()
            .getMap()
            .spawnItemDrop(
                c.getPlayer(), c.getPlayer(), toDrop, c.getPlayer().getPosition(), true, true);
      }
      return 1;
    }
コード例 #5
0
 private static final boolean check(MapleCharacter chr, MerchItemPackage pack) {
   if (chr.getMeso() + pack.getMesos() < 0L) {
     return false;
   }
   byte eq = 0;
   byte use = 0;
   byte setup = 0;
   byte etc = 0;
   byte cash = 0;
   for (Item item : pack.getItems()) {
     MapleInventoryType invtype = GameConstants.getInventoryType(item.getItemId());
     if (invtype == MapleInventoryType.EQUIP) {
       eq = (byte) (eq + 1);
     } else if (invtype == MapleInventoryType.USE) {
       use = (byte) (use + 1);
     } else if (invtype == MapleInventoryType.SETUP) {
       setup = (byte) (setup + 1);
     } else if (invtype == MapleInventoryType.ETC) {
       etc = (byte) (etc + 1);
     } else if (invtype == MapleInventoryType.CASH) {
       cash = (byte) (cash + 1);
     }
   }
   if ((chr.getInventory(MapleInventoryType.EQUIP).getNumFreeSlot() < eq)
       || (chr.getInventory(MapleInventoryType.USE).getNumFreeSlot() < use)
       || (chr.getInventory(MapleInventoryType.SETUP).getNumFreeSlot() < setup)
       || (chr.getInventory(MapleInventoryType.ETC).getNumFreeSlot() < etc)
       || (chr.getInventory(MapleInventoryType.CASH).getNumFreeSlot() < cash)) {
     return false;
   }
   return true;
 }
コード例 #6
0
ファイル: PlayerCommand.java プロジェクト: jerbe/mapleLemon
 @Override
 public int execute(MapleClient c, String[] splitted) {
   if (splitted.length < 2) {
     c.getPlayer().dropMessage(6, splitted[0] + " <道具ID> (数量:默认1)");
     return 0;
   }
   final int itemId = Integer.parseInt(splitted[1]);
   final short quantity = (short) CommandProcessorUtil.getOptionalIntArg(splitted, 2, 1);
   MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
   if (!ii.itemExists(itemId)) {
     c.getPlayer().dropMessage(5, itemId + "不存在");
   } else {
     Item toDrop;
     if (GameConstants.getInventoryType(itemId) == MapleInventoryType.EQUIP) {
       toDrop = ii.randomizeStats((Equip) ii.getEquipById(itemId));
     } else {
       toDrop = new client.inventory.Item(itemId, (byte) 0, quantity, (byte) 0);
     }
     toDrop.setGMLog(c.getPlayer().getName() + " 使用 " + splitted[0] + " 命令制作");
     // toDrop.setOwner(c.getPlayer().getName());
     c.getPlayer()
         .getMap()
         .spawnItemDrop(
             c.getPlayer(), c.getPlayer(), toDrop, c.getPlayer().getPosition(), true, true);
   }
   return 1;
 }
コード例 #7
0
ファイル: MTSCart.java プロジェクト: juniarz/IndexMs
  public void save() throws SQLException {
    List<Pair<Item, MapleInventoryType>> itemsWithType =
        new ArrayList<Pair<Item, MapleInventoryType>>();

    for (Item item : getInventory()) {
      itemsWithType.add(
          new Pair<Item, MapleInventoryType>(
              item, GameConstants.getInventoryType(item.getItemId())));
    }

    ItemLoader.MTS_TRANSFER.saveItems(itemsWithType, characterId);
    final Connection con = DatabaseConnection.getConnection();
    PreparedStatement ps = con.prepareStatement("DELETE FROM mts_cart WHERE characterid = ?");
    ps.setInt(1, characterId);
    ps.execute();
    ps.close();
    ps = con.prepareStatement("INSERT INTO mts_cart VALUES(DEFAULT, ?, ?)");
    ps.setInt(1, characterId);
    for (int i : cart) {
      ps.setInt(2, i);
      ps.executeUpdate();
    }
    if (owedNX > 0) {
      ps.setInt(2, -owedNX);
      ps.executeUpdate();
    }
    ps.close();
    // notYetSold shouldnt be saved here
  }
コード例 #8
0
ファイル: CashShop.java プロジェクト: jerbe/Acernis-v144
  public void save() throws SQLException {
    List<Pair<Item, MapleInventoryType>> itemsWithType = new ArrayList<>();

    for (Item item : inventory) {
      itemsWithType.add(new Pair<>(item, GameConstants.getInventoryType(item.getItemId())));
    }

    factory.saveItems(itemsWithType, accountId);
  }
コード例 #9
0
  public static void displayMerch(MapleClient c) {
    int conv = c.getPlayer().getConversation();
    boolean merch = World.hasMerchant(c.getPlayer().getAccountID(), c.getPlayer().getId());
    MerchItemPackage pack;
    if (merch) {
      c.getPlayer().dropMessage(1, "Please close the existing store and try again.");
      c.getPlayer().setConversation(0);
    } else if (c.getChannelServer().isShutdown()) {
      c.getPlayer().dropMessage(1, "The world is going to shut down.");
      c.getPlayer().setConversation(0);
    } else if (conv == 3) {
      pack = loadItemFrom_Database(c.getPlayer().getAccountID());

      if (pack == null) {
        c.getPlayer().dropMessage(1, "You do not have any item(s) with Fredrick.");
        c.getPlayer().setConversation(0);
      } else if (pack.getItems().size() <= 0) {
        if (!check(c.getPlayer(), pack)) {
          c.getSession().write(PlayerShopPacket.merchItem_Message(33));
          return;
        }
        if (deletePackage(
            c.getPlayer().getAccountID(), pack.getPackageid(), c.getPlayer().getId())) {
          c.getPlayer().fakeRelog();
          c.getPlayer().gainMeso(pack.getMesos(), false);
          c.getSession().write(PlayerShopPacket.merchItem_Message(29));
          c.getPlayer().dropMessage(1, "You have retrieved your mesos.");
        } else {
          c.getPlayer().dropMessage(1, "An unknown error occured.");
        }
        c.getPlayer().setConversation(0);
      } else {
        c.getSession().write(PlayerShopPacket.merchItemStore_ItemData(pack));
        MapleInventoryManipulator.checkSpace(c, conv, conv, null);
        for (Item item : pack.getItems()) {
          if (c.getPlayer()
              .getInventory(GameConstants.getInventoryType(item.getItemId()))
              .isFull()) {
            c.removeClickedNPC();
            c.getPlayer().dropMessage(1, "Your inventory is full (Please relog)");
            break;
          }
          MapleInventoryManipulator.addFromDrop(c, item, true);
          deletePackage(c.getPlayer().getAccountID(), pack.getPackageid(), c.getPlayer().getId());

          c.removeClickedNPC();
        }
        c.getPlayer().dropMessage(1, "Items have been returned to you, please relog.");
      }
    }

    c.getSession().write(CWvsContext.enableActions());
  }
コード例 #10
0
ファイル: MTSCart.java プロジェクト: juniarz/IndexMs
 public void refreshCurrentView(final int newTab, final int newType) {
   currentViewingItems.clear();
   if (newTab == 1) {
     currentViewingItems = MTSStorage.getInstance().getBuyNow(newType);
   } else if (newTab == 4) {
     for (int i : cart) {
       if (newType == 0 || (GameConstants.getInventoryType(i).getType() == newType)) {
         currentViewingItems.add(i);
       }
     }
   }
 }
コード例 #11
0
  @Override
  public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
    final MapleCharacter chr = c.getPlayer();

    if ((slea.available() > 8L) && (chr != null)) {
      slea.skip(4);
      int numChanges = slea.readInt();

      for (int i = 0; i < numChanges; i++) {
        int key = slea.readInt();
        byte type = slea.readByte();
        int action = slea.readInt();
        if ((type == 1) && (action >= 1000)) {
          Skill skil = SkillFactory.getSkill(action);
          if ((skil != null)
              && (((!skil.isFourthJob())
                      && (!skil.isBeginnerSkill())
                      && (skil.isInvisible())
                      && (chr.getSkillLevel(skil) <= 0))
                  || (GameConstants.isLinkedAttackSkill(action))
                  || (action % 10000 < 1000))) {
            continue;
          }
        }
        chr.changeKeybinding(key, type, action);
      }
    } else if (chr != null) {
      int type = slea.readInt();
      int data = slea.readInt();
      switch (type) {
        case 1:
          if (data <= 0) {
            chr.getQuestRemove(MapleQuest.getInstance(GameConstants.HP_ITEM));
          } else {
            chr.getQuestNAdd(MapleQuest.getInstance(GameConstants.HP_ITEM))
                .setCustomData(String.valueOf(data));
          }
          break;
        case 2:
          if (data <= 0) {
            chr.getQuestRemove(MapleQuest.getInstance(GameConstants.MP_ITEM));
          } else {
            chr.getQuestNAdd(MapleQuest.getInstance(GameConstants.MP_ITEM))
                .setCustomData(String.valueOf(data));
          }
          break;
      }
    }
  }
コード例 #12
0
 private static int checkRequiredNRemove(
     final MapleClient c, final List<Pair<Integer, Integer>> recipe) {
   int itemid = 0;
   for (final Pair<Integer, Integer> p : recipe) {
     if (!c.getPlayer().haveItem(p.getLeft(), p.getRight(), false, true)) {
       return 0;
     }
   }
   for (final Pair<Integer, Integer> p : recipe) {
     itemid = p.getLeft();
     MapleInventoryManipulator.removeById(
         c, GameConstants.getInventoryType(itemid), itemid, p.getRight(), false, false);
   }
   return itemid;
 }
コード例 #13
0
ファイル: Start.java プロジェクト: eee123666/mapleLemon
  public static void loadData(boolean reload) {
    System.out.println("载入数据(因为数据量大可能比较久而且内存消耗会飙升)");

    System.out.println("加载等级经验数据");
    GameConstants.LoadEXP();

    System.out.println("加载排名信息数据");
    MapleGuildRanking.getInstance().load(reload);

    // System.out.println("加载公会数据并清理不存在公会");
    // MapleGuild.loadAll();

    System.out.println("加载任务数据");
    // 加载任务信息
    MapleLifeFactory.loadQuestCounts(reload);
    // 加载转存到数据库的任务信息
    MapleQuest.initQuests(reload);

    System.out.println("加载爆物数据");
    // 加载爆物数据
    MapleMonsterInformationProvider.getInstance().addExtra();
    // 加载全域爆物数据
    MapleMonsterInformationProvider.getInstance().load();

    System.out.println("加载道具数据");
    // 加载道具信息(从WZ)
    MapleItemInformationProvider.getInstance().runEtc(reload);
    // 加载道具信息(从SQL)
    MapleItemInformationProvider.getInstance().runItems(reload);
    // 加载发型脸型
    MapleItemInformationProvider.getInstance().loadHairFace(reload);

    System.out.println("加载技能数据");
    // 加载技能
    SkillFactory.loadAllSkills(reload);

    MobSkillFactory.getInstance(); // 载入怪物技能

    System.out.println("loadSpeedRuns");
    // ?
    SpeedRunner.loadSpeedRuns(reload);

    System.out.println("加载商城道具数据");
    // 加载商城道具信息
    CashItemFactory.getInstance().initialize(reload);
    System.out.println("数据载入完成!\r\n");
  }
コード例 #14
0
ファイル: CashShop.java プロジェクト: jerbe/Acernis-v144
 public void checkExpire(MapleClient c) {
   List<Item> toberemove = new ArrayList<>();
   for (Item item : inventory) {
     if (item != null
         && !GameConstants.isPet(item.getItemId())
         && item.getExpiration() > 0
         && item.getExpiration() < System.currentTimeMillis()) {
       toberemove.add(item);
     }
   }
   if (toberemove.size() > 0) {
     for (Item item : toberemove) {
       removeFromInventory(item);
       c.getSession().write(CSPacket.cashItemExpired(item.getUniqueId()));
     }
     toberemove.clear();
   }
 }
コード例 #15
0
 public static final void RewardPot(final LittleEndianAccessor slea, final MapleClient c) {
   final int index = slea.readInt() - 1;
   if (index < 0
       || index >= c.getPlayer().getImps().length
       || c.getPlayer().getImps()[index] == null
       || c.getPlayer().getImps()[index].getLevel()
           < (MapleItemInformationProvider.getInstance()
                   .getPot(c.getPlayer().getImps()[index].getItemId())
                   .right
               - 1)) {
     c.getSession().write(CWvsContext.enableActions());
     return;
   }
   final int itemid =
       GameConstants.getRewardPot(
           c.getPlayer().getImps()[index].getItemId(),
           c.getPlayer().getImps()[index].getCloseness());
   if (itemid <= 0 || !MapleInventoryManipulator.checkSpace(c, itemid, (short) 1, "")) {
     c.getPlayer().dropMessage(1, "Please make some space.");
     c.getSession().write(CWvsContext.enableActions());
     return;
   }
   MapleInventoryManipulator.addById(
       c,
       itemid,
       (short) 1,
       "Item Pot from "
           + c.getPlayer().getImps()[index].getItemId()
           + " on "
           + FileoutputUtil.CurrentReadable_Date());
   c.getSession()
       .write(
           CWvsContext.updateImp(
               c.getPlayer().getImps()[index], ImpFlag.REMOVED.getValue(), index, false));
   c.getPlayer().getImps()[index] = null;
 }
コード例 #16
0
ファイル: CharLoginHandler.java プロジェクト: jerbe/OpenMS
  public static final void CreateUltimate(final LittleEndianAccessor slea, final MapleClient c) {
    if (!c.isLoggedIn()
        || c.getPlayer() == null
        || c.getPlayer().getLevel() < 120
        || c.getPlayer().getMapId() != 130000000
        || c.getPlayer().getQuestStatus(20734) != 0
        || c.getPlayer().getQuestStatus(20616) != 2
        || !GameConstants.isKOC(c.getPlayer().getJob())
        || !c.canMakeCharacter(c.getPlayer().getWorld())) {
      c.getPlayer().dropMessage(1, "You have no character slots.");
      c.getSession().write(CField.createUltimate(0));
      return;
    }
    System.out.println(slea.toString());
    final String name = slea.readMapleAsciiString();
    final int job = slea.readInt(); // job ID

    final int face = slea.readInt();
    final int hair = slea.readInt();

    final int hat = slea.readInt();
    final int top = slea.readInt();
    final int glove = slea.readInt();
    final int shoes = slea.readInt();
    final int weapon = slea.readInt();

    final byte gender = c.getPlayer().getGender();
    JobType jobType = JobType.Adventurer;
    // if (!LoginInformationProvider.getInstance().isEligibleItem(gender, 0, jobType.type, face) ||
    // !LoginInformationProvider.getInstance().isEligibleItem(gender, 1, jobType.type, hair)) {
    //    c.getPlayer().dropMessage(1, "An error occurred.");
    //    c.getSession().write(CField.createUltimate(0));
    //    return;
    // }

    jobType = JobType.UltimateAdventurer;

    MapleCharacter newchar = MapleCharacter.getDefault(c, jobType);
    newchar.setJob(job);
    newchar.setWorld((byte) c.getPlayer().getWorld());
    newchar.setFace(face);
    newchar.setHair(hair);
    newchar.setGender(gender);
    newchar.setName(name);
    newchar.setSkinColor((byte) 3); // troll
    newchar.setLevel((short) 50);
    newchar.getStat().str = (short) 4;
    newchar.getStat().dex = (short) 4;
    newchar.getStat().int_ = (short) 4;
    newchar.getStat().luk = (short) 4;
    newchar.setRemainingAp((short) 254); // 49*5 + 25 - 16
    newchar.setRemainingSp(
        job / 100 == 2 ? 128 : 122); // 2 from job advancements. 120 from leveling. (mages get +6)
    newchar.getStat().maxhp += 150; // Beginner 10 levels
    newchar.getStat().maxmp += 125;
    newchar.getStat().hp += 150; // Beginner 10 levels
    newchar.getStat().mp += 125;
    switch (job) {
      case 110:
      case 120:
      case 130:
        newchar.getStat().maxhp += 600; // Job Advancement
        newchar.getStat().maxhp += 2000; // Levelup 40 times
        newchar.getStat().maxmp += 200;
        newchar.getStat().hp += 600; // Job Advancement
        newchar.getStat().hp += 2000; // Levelup 40 times
        newchar.getStat().mp += 200;
        break;
      case 210:
      case 220:
      case 230:
        newchar.getStat().maxmp += 600;
        newchar.getStat().maxhp += 500; // Levelup 40 times
        newchar.getStat().maxmp += 2000;
        newchar.getStat().mp += 600;
        newchar.getStat().hp += 500; // Levelup 40 times
        newchar.getStat().mp += 2000;
        break;
      case 310:
      case 320:
      case 410:
      case 420:
      case 520:
        newchar.getStat().maxhp += 500;
        newchar.getStat().maxmp += 250;
        newchar.getStat().maxhp += 900; // Levelup 40 times
        newchar.getStat().maxmp += 600;
        newchar.getStat().maxhp += 500;
        newchar.getStat().mp += 250;
        newchar.getStat().hp += 900; // Levelup 40 times
        newchar.getStat().mp += 600;
        break;
      case 510:
        newchar.getStat().maxhp += 500;
        newchar.getStat().maxmp += 250;
        newchar.getStat().maxhp += 450; // Levelup 20 times
        newchar.getStat().maxmp += 300;
        newchar.getStat().maxhp += 800; // Levelup 20 times
        newchar.getStat().maxmp += 400;
        newchar.getStat().hp += 500;
        newchar.getStat().mp += 250;
        newchar.getStat().hp += 450; // Levelup 20 times
        newchar.getStat().mp += 300;
        newchar.getStat().hp += 800; // Levelup 20 times
        newchar.getStat().mp += 400;
        break;
      default:
        return;
    }
    for (int i = 2490; i < 2507; i++) {
      newchar.setQuestAdd(MapleQuest.getInstance(i), (byte) 2, null);
    }
    newchar.setQuestAdd(MapleQuest.getInstance(29947), (byte) 2, null);
    newchar.setQuestAdd(
        MapleQuest.getInstance(GameConstants.ULT_EXPLORER), (byte) 0, c.getPlayer().getName());

    final Map<Skill, SkillEntry> ss = new HashMap<>();
    ss.put(SkillFactory.getSkill(1074 + (job / 100)), new SkillEntry((byte) 5, (byte) 5, -1));
    ss.put(SkillFactory.getSkill(1195 + (job / 100)), new SkillEntry((byte) 5, (byte) 5, -1));
    ss.put(SkillFactory.getSkill(80), new SkillEntry((byte) 1, (byte) 1, -1));
    newchar.changeSkillLevel_Skip(ss, false);
    final MapleItemInformationProvider li = MapleItemInformationProvider.getInstance();

    int[] items =
        new int[] {
          1142257,
          hat,
          top,
          shoes,
          glove,
          weapon,
          hat + 1,
          top + 1,
          shoes + 1,
          glove + 1,
          weapon + 1
        }; // brilliant = fine+1
    for (byte i = 0; i < items.length; i++) {
      Item item = li.getEquipById(items[i]);
      item.setPosition((byte) (i + 1));
      newchar.getInventory(MapleInventoryType.EQUIP).addFromDB(item);
    }
    newchar
        .getInventory(MapleInventoryType.USE)
        .addItem(new Item(2000004, (byte) 0, (short) 100, (byte) 0));
    newchar
        .getInventory(MapleInventoryType.USE)
        .addItem(new Item(2000004, (byte) 0, (short) 100, (byte) 0));
    c.getPlayer().fakeRelog();
    if (MapleCharacterUtil.canCreateChar(name, c.isGm())
        && (!LoginInformationProvider.getInstance().isForbiddenName(name) || c.isGm())) {
      MapleCharacter.saveNewCharToDB(newchar, jobType, (short) 0);
      MapleQuest.getInstance(20734).forceComplete(c.getPlayer(), 1101000);
      c.getSession().write(CField.createUltimate(1));
    } else {
      c.getSession().write(CField.createUltimate(0));
    }
  }
コード例 #17
0
ファイル: ThiefBuff.java プロジェクト: jerbe/Acernis-v144
 @Override
 public boolean containsJob(int job) {
   return GameConstants.isAdventurer(job) && job / 100 == 4;
 }
コード例 #18
0
ファイル: MTSOperation.java プロジェクト: jerbe/OpenMS
 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);
 }
コード例 #19
0
ファイル: MapleSummon.java プロジェクト: martolini/judoms
 public final boolean isAngel() {
   return GameConstants.isAngel(skill);
 }
コード例 #20
0
 public static final void FeedPot(final LittleEndianAccessor slea, final MapleClient c) {
   final int itemid = slea.readInt();
   final Item slot =
       c.getPlayer()
           .getInventory(GameConstants.getInventoryType(itemid))
           .getItem((short) slea.readInt());
   if (slot == null || slot.getQuantity() <= 0 || slot.getItemId() != itemid) {
     c.getSession().write(CWvsContext.enableActions());
     return;
   }
   final int level =
       GameConstants.getInventoryType(itemid) == MapleInventoryType.ETC
           ? MapleItemInformationProvider.getInstance().getItemMakeLevel(itemid)
           : MapleItemInformationProvider.getInstance().getReqLevel(itemid);
   if (level <= 0
       || level < (Math.min(120, c.getPlayer().getLevel()) - 50)
       || (GameConstants.getInventoryType(itemid) != MapleInventoryType.ETC
           && GameConstants.getInventoryType(itemid) != MapleInventoryType.EQUIP)) {
     c.getPlayer().dropMessage(1, "The item must be within 50 levels of you.");
     c.getSession().write(CWvsContext.enableActions());
     return;
   }
   final int index = slea.readInt() - 1;
   if (index < 0
       || index >= c.getPlayer().getImps().length
       || c.getPlayer().getImps()[index] == null
       || c.getPlayer().getImps()[index].getLevel()
           >= (MapleItemInformationProvider.getInstance()
                   .getPot(c.getPlayer().getImps()[index].getItemId())
                   .right
               - 1)
       || c.getPlayer().getImps()[index].getState() != 1) {
     c.getSession().write(CWvsContext.enableActions());
     return;
   }
   int mask = ImpFlag.FULLNESS.getValue();
   mask |= ImpFlag.FULLNESS_2.getValue();
   mask |= ImpFlag.UPDATE_TIME.getValue();
   mask |= ImpFlag.AWAKE_TIME.getValue();
   // this is where the magic happens
   c.getPlayer()
       .getImps()[index]
       .setFullness(
           c.getPlayer().getImps()[index].getFullness()
               + (100
                   * (GameConstants.getInventoryType(itemid) == MapleInventoryType.EQUIP
                       ? 2
                       : 1)));
   if (Randomizer.nextBoolean()) {
     mask |= ImpFlag.CLOSENESS.getValue();
     c.getPlayer()
         .getImps()[index]
         .setCloseness(
             c.getPlayer().getImps()[index].getCloseness()
                 + 1
                 + (Randomizer.nextInt(
                     5
                         * (GameConstants.getInventoryType(itemid) == MapleInventoryType.EQUIP
                             ? 2
                             : 1))));
   } else if (Randomizer.nextInt(5) == 0) { // 1/10 chance of sickness
     c.getPlayer().getImps()[index].setState(4); // sick
     mask |= ImpFlag.STATE.getValue();
   }
   if (c.getPlayer().getImps()[index].getFullness() >= 1000) {
     c.getPlayer().getImps()[index].setState(1);
     c.getPlayer().getImps()[index].setFullness(0);
     c.getPlayer().getImps()[index].setLevel(c.getPlayer().getImps()[index].getLevel() + 1);
     mask |= ImpFlag.SUMMONED.getValue();
     if (c.getPlayer().getImps()[index].getLevel()
         >= (MapleItemInformationProvider.getInstance()
                 .getPot(c.getPlayer().getImps()[index].getItemId())
                 .right
             - 1)) {
       c.getPlayer().getImps()[index].setState(5);
     }
   }
   MapleInventoryManipulator.removeFromSlot(
       c, GameConstants.getInventoryType(itemid), slot.getPosition(), (short) 1, false, false);
   c.getSession().write(CWvsContext.updateImp(c.getPlayer().getImps()[index], mask, index, false));
 }
コード例 #21
0
 public static final void SubSummon(final LittleEndianAccessor slea, final MapleCharacter chr) {
   final MapleMapObject obj = chr.getMap().getMapObject(slea.readInt(), MapleMapObjectType.SUMMON);
   if (obj == null || !(obj instanceof MapleSummon)) {
     return;
   }
   final MapleSummon sum = (MapleSummon) obj;
   if (sum == null
       || sum.getOwnerId() != chr.getId()
       || sum.getSkillLevel() <= 0
       || !chr.isAlive()) {
     return;
   }
   switch (sum.getSkill()) {
     case 35121009:
       if (!chr.canSummon(2000)) {
         return;
       }
       final int skillId = slea.readInt(); // 35121009?
       if (sum.getSkill() != skillId) {
         return;
       }
       slea.skip(1); // 0E?
       chr.updateTick(slea.readInt());
       for (int i = 0; i < 3; i++) {
         final MapleSummon tosummon =
             new MapleSummon(
                 chr,
                 SkillFactory.getSkill(35121011).getEffect(sum.getSkillLevel()),
                 new Point(sum.getTruePosition().x, sum.getTruePosition().y - 5),
                 SummonMovementType.WALK_STATIONARY);
         chr.getMap().spawnSummon(tosummon);
         chr.addSummon(tosummon);
       }
       break;
     case 35111011: // healing
       if (!chr.canSummon(1000)) {
         return;
       }
       chr.addHP(
           (int)
               (chr.getStat().getCurrentMaxHp()
                   * SkillFactory.getSkill(sum.getSkill()).getEffect(sum.getSkillLevel()).getHp()
                   / 100.0));
       chr.getClient()
           .getSession()
           .write(
               EffectPacket.showOwnBuffEffect(
                   sum.getSkill(), 2, chr.getLevel(), sum.getSkillLevel()));
       chr.getMap()
           .broadcastMessage(
               chr,
               EffectPacket.showBuffeffect(
                   chr.getId(), sum.getSkill(), 2, chr.getLevel(), sum.getSkillLevel()),
               false);
       break;
     case 1321007: // beholder
       Skill bHealing = SkillFactory.getSkill(slea.readInt());
       final int bHealingLvl = chr.getTotalSkillLevel(bHealing);
       if (bHealingLvl <= 0 || bHealing == null) {
         return;
       }
       final MapleStatEffect healEffect = bHealing.getEffect(bHealingLvl);
       if (bHealing.getId() == 1320009) {
         healEffect.applyTo(chr);
       } else if (bHealing.getId() == 1320008) {
         if (!chr.canSummon(healEffect.getX() * 1000)) {
           return;
         }
         chr.addHP(healEffect.getHp());
       }
       chr.getClient()
           .getSession()
           .write(EffectPacket.showOwnBuffEffect(sum.getSkill(), 2, chr.getLevel(), bHealingLvl));
       chr.getMap()
           .broadcastMessage(
               SummonPacket.summonSkill(
                   chr.getId(),
                   sum.getSkill(),
                   bHealing.getId() == 1320008 ? 5 : (Randomizer.nextInt(3) + 6)));
       chr.getMap()
           .broadcastMessage(
               chr,
               EffectPacket.showBuffeffect(
                   chr.getId(), sum.getSkill(), 2, chr.getLevel(), bHealingLvl),
               false);
       break;
   }
   if (GameConstants.isAngel(sum.getSkill())) {
     if (sum.getSkill() % 10000 == 1087) {
       MapleItemInformationProvider.getInstance().getItemEffect(2022747).applyTo(chr);
     } else if (sum.getSkill() % 10000 == 1179) {
       MapleItemInformationProvider.getInstance().getItemEffect(2022823).applyTo(chr);
     } else if (sum.getSkill() % 10000 == 1085) {
       MapleItemInformationProvider.getInstance().getItemEffect(2022746).applyTo(chr);
     }
     chr.getClient().getSession().write(EffectPacket.showOwnBuffEffect(sum.getSkill(), 2, 2, 1));
     chr.getMap()
         .broadcastMessage(
             chr, EffectPacket.showBuffeffect(chr.getId(), sum.getSkill(), 2, 2, 1), false);
   }
 }
コード例 #22
0
ファイル: PlayerCommand.java プロジェクト: jerbe/Acernis-v144
    @Override
    public int execute(MapleClient c, String[] splitted) {
      if (splitted.length < 2) {
        c.getPlayer().dropMessage(5, "Invalid number entered.");
        return 0;
      }
      int change;
      try {
        change = Integer.parseInt(splitted[1]);
      } catch (NumberFormatException nfe) {
        c.getPlayer().dropMessage(5, "Invalid number entered.");
        return 0;
      }
      int hpUsed = 0;
      int mpUsed = 0;
      //   if (stat == MapleStat.MAXHP) {
      //        hpUsed = change;
      //       short job = c.getPlayer().getJob();
      //       change *= GameConstants.getHpApByJob(job);
      //   }
      if (stat == MapleStat.MAXMP) {
        mpUsed = change;
        short job = c.getPlayer().getJob();
        if (GameConstants.isDemonSlayer(job)
            || GameConstants.isAngelicBuster(job)
            || GameConstants.isDemonAvenger(job)) {
          c.getPlayer().dropMessage(5, "You cannot raise MP.");
          return 0;
        }
        change *= GameConstants.getMpApByJob(job);
      }

      if (change <= 0) {
        c.getPlayer().dropMessage(5, "You don't have enough AP Resets that.");
        return 0;
      }
      if (c.getPlayer().getRemainingAp() < change) {
        c.getPlayer().dropMessage(5, "You don't have enough AP for that.");
        return 0;
      }
      if (getStat(c.getPlayer()) + change > statLim
          && stat != MapleStat.MAXHP
          && stat != MapleStat.MAXMP) {
        c.getPlayer().dropMessage(5, "The stat limit is " + statLim + ".");
        return 0;
      }
      if (getStat(c.getPlayer()) + change > hpMpLim
          && (stat == MapleStat.MAXHP || stat == MapleStat.MAXMP)) {
        c.getPlayer().dropMessage(5, "The stat limit is " + hpMpLim + ".");
        return 0;
      }
      setStat(c.getPlayer(), getStat(c.getPlayer()), change);
      c.getPlayer().setRemainingAp((short) (c.getPlayer().getRemainingAp() - change));
      c.getPlayer().setHpApUsed((short) (c.getPlayer().getHpApUsed() + hpUsed));
      c.getPlayer().setHpApUsed((short) (c.getPlayer().getHpApUsed() + mpUsed));
      c.getPlayer().updateSingleStat(MapleStat.AVAILABLEAP, c.getPlayer().getRemainingAp());
      if (stat == MapleStat.MAXHP) {
        c.getPlayer()
            .dropMessage(
                5,
                StringUtil.makeEnumHumanReadable(stat.name())
                    + " has been raised by "
                    + change * 30
                    + ".");
        c.getPlayer().fakeRelog();
      } else
        c.getPlayer()
            .dropMessage(
                5,
                StringUtil.makeEnumHumanReadable(stat.name())
                    + " has been raised by "
                    + change
                    + ".");
      return 1;
    }
コード例 #23
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;
        }
    }
  }
コード例 #24
0
ファイル: AranBuff.java プロジェクト: jerbe/Acernis-v144
 @Override
 public boolean containsJob(int job) {
   return GameConstants.isAran(job);
 }
コード例 #25
0
 public boolean isCustom() {
   return GameConstants.isCustomQuest(quest.getId());
 }