コード例 #1
0
 public List<DropEntry> retrieveDropChances(int monsterid) {
   if (drops.containsKey(monsterid)) {
     return drops.get(monsterid);
   }
   List<DropEntry> ret = new LinkedList<DropEntry>();
   if (monsterid > 9300183 && monsterid < 9300216) {
     for (int i = 2022359; i < 2022367; i++) {
       ret.add(new DropEntry(i, 10));
     }
     drops.put(monsterid, ret);
     return ret;
   } else if (monsterid > 9300215 && monsterid < 9300269) {
     for (int i = 2022430; i < 2022434; i++) {
       ret.add(new DropEntry(i, 3));
     }
     drops.put(monsterid, ret);
     return ret;
   }
   try {
     Connection con = DatabaseConnection.getConnection();
     PreparedStatement ps =
         con.prepareStatement(
             "SELECT itemid, chance, monsterid, questid FROM monsterdrops WHERE monsterid = ?");
     ps.setInt(1, monsterid);
     ResultSet rs = ps.executeQuery();
     MapleMonster theMonster = null;
     while (rs.next()) {
       int rowmonsterid = rs.getInt("monsterid");
       int chance = rs.getInt("chance");
       int questid = rs.getInt("questid");
       if (rowmonsterid != monsterid && rowmonsterid != 0) {
         if (theMonster == null) {
           theMonster = MapleLifeFactory.getMonster(monsterid);
         }
         chance += theMonster.getLevel() * rowmonsterid;
       }
       ret.add(new DropEntry(rs.getInt("itemid"), chance, questid));
     }
     rs.close();
     ps.close();
     con.close();
   } catch (Exception e) {
     log.error("Error retrieving drop", e);
   }
   drops.put(monsterid, ret);
   return ret;
 }
コード例 #2
0
ファイル: MobSkill.java プロジェクト: abcSup/EightyThree
 public void applyEffect(MapleCharacter player, MapleMonster monster, boolean skill) {
   MapleDisease disease = null;
   Map<MonsterStatus, Integer> stats = new ArrayMap<MonsterStatus, Integer>();
   List<Integer> reflection = new LinkedList<Integer>();
   switch (skillId) {
     case 100:
     case 110:
     case 150:
       stats.put(MonsterStatus.WEAPON_ATTACK_UP, Integer.valueOf(x));
       break;
     case 101:
     case 111:
     case 151:
       stats.put(MonsterStatus.MAGIC_ATTACK_UP, Integer.valueOf(x));
       break;
     case 102:
     case 112:
     case 152:
       stats.put(MonsterStatus.WEAPON_DEFENSE_UP, Integer.valueOf(x));
       break;
     case 103:
     case 113:
     case 153:
       stats.put(MonsterStatus.MAGIC_DEFENSE_UP, Integer.valueOf(x));
       break;
     case 114:
       if (lt != null && rb != null && skill) {
         List<MapleMapObject> objects = getObjectsInRange(monster, MapleMapObjectType.MONSTER);
         final int hps = (getX() / 1000) * (int) (950 + 1050 * Math.random());
         for (MapleMapObject mons : objects) {
           ((MapleMonster) mons).heal(hps, getY());
         }
       } else {
         monster.heal(getX(), getY());
       }
       break;
     case 120:
       disease = MapleDisease.SEAL;
       break;
     case 121:
       disease = MapleDisease.DARKNESS;
       break;
     case 122:
       disease = MapleDisease.WEAKEN;
       break;
     case 123:
       disease = MapleDisease.STUN;
       break;
     case 124:
       disease = MapleDisease.CURSE;
       break;
     case 125:
       disease = MapleDisease.POISON;
       break;
     case 126: // Slow
       disease = MapleDisease.SLOW;
       break;
     case 127:
       if (lt != null && rb != null && skill) {
         for (MapleCharacter character : getPlayersInRange(monster, player)) {
           character.dispel();
         }
       } else {
         player.dispel();
       }
       break;
     case 128: // Seduce
       disease = MapleDisease.SEDUCE;
       break;
     case 129: // Banish
       if (lt != null && rb != null && skill) {
         for (MapleCharacter chr : getPlayersInRange(monster, player)) {
           chr.changeMapBanish(
               monster.getBanish().getMap(),
               monster.getBanish().getPortal(),
               monster.getBanish().getMsg());
         }
       } else {
         player.changeMapBanish(
             monster.getBanish().getMap(),
             monster.getBanish().getPortal(),
             monster.getBanish().getMsg());
       }
       break;
     case 131: // Mist
       monster
           .getMap()
           .spawnMist(
               new MapleMist(calculateBoundingBox(monster.getPosition(), true), monster, this),
               x * 10,
               false,
               false);
       break;
     case 132:
       disease = MapleDisease.CONFUSE;
       break;
     case 133: // zombify
       break;
     case 140:
       if (makeChanceResult() && !monster.isBuffed(MonsterStatus.MAGIC_IMMUNITY)) {
         stats.put(MonsterStatus.WEAPON_IMMUNITY, Integer.valueOf(x));
       }
       break;
     case 141:
       if (makeChanceResult() && !monster.isBuffed(MonsterStatus.WEAPON_IMMUNITY)) {
         stats.put(MonsterStatus.MAGIC_IMMUNITY, Integer.valueOf(x));
       }
       break;
     case 143: // Weapon Reflect
       stats.put(MonsterStatus.WEAPON_REFLECT, Integer.valueOf(x));
       stats.put(MonsterStatus.WEAPON_IMMUNITY, Integer.valueOf(x));
       reflection.add(x);
       break;
     case 144: // Magic Reflect
       stats.put(MonsterStatus.MAGIC_REFLECT, Integer.valueOf(x));
       stats.put(MonsterStatus.MAGIC_IMMUNITY, Integer.valueOf(x));
       reflection.add(x);
       break;
     case 145: // Weapon / Magic reflect
       stats.put(MonsterStatus.WEAPON_REFLECT, Integer.valueOf(x));
       stats.put(MonsterStatus.WEAPON_IMMUNITY, Integer.valueOf(x));
       stats.put(MonsterStatus.MAGIC_REFLECT, Integer.valueOf(x));
       stats.put(MonsterStatus.MAGIC_IMMUNITY, Integer.valueOf(x));
       reflection.add(x);
       break;
     case 154: // accuracy up
     case 155: // avoid up
     case 156: // speed up
       break;
     case 200:
       if (monster.getMap().getSpawnedMonstersOnMap() < 80) {
         for (Integer mobId : getSummons()) {
           MapleMonster toSpawn = MapleLifeFactory.getMonster(mobId);
           toSpawn.setPosition(monster.getPosition());
           int ypos, xpos;
           xpos = (int) monster.getPosition().getX();
           ypos = (int) monster.getPosition().getY();
           switch (mobId) {
             case 8500003: // Pap bomb high
               toSpawn.setFh((int) Math.ceil(Math.random() * 19.0));
               ypos = -590;
               break;
             case 8500004: // Pap bomb
               xpos = (int) (monster.getPosition().getX() + Randomizer.nextInt(1000) - 500);
               if (ypos != -590) {
                 ypos = (int) monster.getPosition().getY();
               }
               break;
             case 8510100: // Pianus bomb
               if (Math.ceil(Math.random() * 5) == 1) {
                 ypos = 78;
                 xpos = (int) Randomizer.nextInt(5) + (Randomizer.nextInt(2) == 1 ? 180 : 0);
               } else {
                 xpos = (int) (monster.getPosition().getX() + Randomizer.nextInt(1000) - 500);
               }
               break;
           }
           switch (monster.getMap().getId()) {
             case 220080001: // Pap map
               if (xpos < -890) {
                 xpos = (int) (Math.ceil(Math.random() * 150) - 890);
               } else if (xpos > 230) {
                 xpos = (int) (230 - Math.ceil(Math.random() * 150));
               }
               break;
             case 230040420: // Pianus map
               if (xpos < -239) {
                 xpos = (int) (Math.ceil(Math.random() * 150) - 239);
               } else if (xpos > 371) {
                 xpos = (int) (371 - Math.ceil(Math.random() * 150));
               }
               break;
           }
           toSpawn.setPosition(new Point(xpos, ypos));
           monster
               .getMap()
               .spawnMonsterWithEffect(toSpawn, getSpawnEffect(), toSpawn.getPosition());
         }
       }
       break;
   }
   if (stats.size() > 0) {
     if (lt != null && rb != null && skill) {
       for (MapleMapObject mons : getObjectsInRange(monster, MapleMapObjectType.MONSTER)) {
         ((MapleMonster) mons)
             .applyMonsterBuff(stats, getX(), getSkillId(), getDuration(), this, reflection);
       }
     } else {
       monster.applyMonsterBuff(stats, getX(), getSkillId(), getDuration(), this, reflection);
     }
   }
   if (disease != null) {
     if (lt != null && rb != null && skill) {
       int i = 0;
       for (MapleCharacter character : getPlayersInRange(monster, player)) {
         if (!character.isActiveBuffedValue(2321005)) {
           if (disease.equals(MapleDisease.SEDUCE)) {
             if (i < 10) {
               character.giveDebuff(MapleDisease.SEDUCE, this);
               i++;
             }
           } else {
             character.giveDebuff(disease, this);
           }
         }
       }
     } else {
       player.giveDebuff(disease, this);
     }
   }
   monster.usedSkill(skillId, skillLevel, cooltime);
   monster.setMp(monster.getMp() - getMpCon());
 }