@Override
  public String onKill(NpcInstance npc, QuestState qs) {
    final Player player = qs.getPlayer();

    if (player.getParty() == null) {
      qs.setCond(5);
    } else {
      for (Player member : player.getParty().getPartyMembers()) {
        final QuestState stats = member.getQuestState(Q00480_AnotherLegacyOfCrumaTower.class);

        if ((stats == null) || (stats.getCond() != 4)) {
          continue;
        }

        stats.setCond(5);
      }
    }

    qs.getPlayer()
        .getReflection()
        .addSpawnWithoutRespawn(
            MARTES_NPC,
            Location.findPointToStay(qs.getPlayer(), 50, 100),
            qs.getPlayer().getGeoIndex());
    return null;
  }
  @Override
  public String onTalk(NpcInstance npc, QuestState qs) {
    if (qs.isCompleted()) {
      return "completed";
    }
    String htmltext = "noquest";
    final int cond = qs.getCond();
    final Player player = qs.getPlayer();

    if (cond == 0) {
      if (player.getLevel() < 90) {
        htmltext = "33293-02.htm";
        qs.exitCurrentQuest(true);
      } else {
        htmltext = "33293-01.htm";
      }
    } else if (cond == 1) {
      htmltext = "33293-07.htm";
    } else if ((cond == 2) || (qs.getQuestItemsCount(ShilensMark) >= 1)) {
      htmltext = "33293-08.htm";
      qs.addExpAndSp(833065000, 368800464);
      qs.giveItems(IstinasBracelet, 1);
      qs.giveItems(EnchantScrollArmor, 10);
      qs.setState(COMPLETED);
      qs.playSound(SOUND_FINISH);
      qs.exitCurrentQuest(false);
    }

    return htmltext;
  }
示例#3
0
 /** Method clearMe. */
 private void clearMe() {
   HandysBlockCheckerManager.getInstance().clearPaticipantQueueByArenaId(_arena);
   for (Player player : _holder.getAllPlayers()) {
     if (player == null) {
       continue;
     }
     player.removeListener(_listener);
   }
   _holder.clearPlayers();
   _blueTeamPoints.clear();
   _redTeamPoints.clear();
   HandysBlockCheckerManager.getInstance().setArenaFree(_arena);
   for (SimpleSpawner spawn : _spawns) {
     spawn.deleteAll();
   }
   _spawns.clear();
   for (ItemInstance item : _drops) {
     if (item == null) {
       continue;
     }
     if (!item.isVisible() || (item.getOwnerId() != 0)) {
       continue;
     }
     item.deleteMe();
   }
   _drops.clear();
 }
  /**
   * Method dropAttackable.
   *
   * @param attackable NpcInstance
   * @param killer Player
   */
  public void dropAttackable(NpcInstance attackable, Player killer) {
    if (killer.isInOlympiadMode()
        || killer.isCursedWeaponEquipped()
        || (_cursedWeapons.length == 0)
        || (killer.getReflection() != ReflectionManager.DEFAULT)) {
      return;
    }

    synchronized (_cursedWeapons) {
      CursedWeapon[] cursedWeapons = new CursedWeapon[0];

      for (CursedWeapon cw : _cursedWeapons) {
        if (cw.isActive()) {
          continue;
        }

        cursedWeapons = ArrayUtils.add(cursedWeapons, cw);
      }

      if (cursedWeapons.length > 0) {
        CursedWeapon cw = cursedWeapons[Rnd.get(cursedWeapons.length)];

        if (Rnd.get(100000000) <= cw.getDropRate()) {
          cw.create(attackable, killer);
        }
      }
    }
  }
示例#5
0
  /**
   * Method isAttackable.
   *
   * @param attacker Creature
   * @return boolean
   */
  @Override
  public boolean isAttackable(Creature attacker) {
    if ((attacker == null) || isOpen()) {
      return false;
    }

    SiegeEvent<?, ?> siegeEvent = getEvent(SiegeEvent.class);

    switch (getDoorType()) {
      case WALL:
        if (!attacker.isSummon()
            || (siegeEvent == null)
            || !siegeEvent.containsSiegeSummon((SummonInstance) attacker)) {
          return false;
        }
        break;

      case DOOR:
        Player player = attacker.getPlayer();

        if (player == null) {
          return false;
        }

        if (siegeEvent != null) {
          if (siegeEvent.getSiegeClan(SiegeEvent.DEFENDERS, player.getClan()) != null) {
            return false;
          }
        }
        break;
    }

    return !isInvul();
  }
示例#6
0
 /** Method runImpl. */
 @Override
 protected void runImpl() {
   Player activeChar = getClient().getActiveChar();
   Creature target = activeChar;
   if (activeChar == null) {
     return;
   }
   if (activeChar.getObjectId() != _objectId) {
     for (Summon summon : activeChar.getSummonList()) {
       if (summon.getObjectId() == _objectId) {
         target = summon;
         break;
       }
     }
     if (target == null) {
       return;
     }
   }
   for (Effect e : target.getEffectList().getAllEffects()) {
     if ((e.getDisplayId() == _id) && (e.getDisplayLevel() == _level)) {
       if (!e.isOffensive()
           && !e.getSkill().isMusic()
           && e.getSkill().isSelfDispellable()
           && (e.getSkill().getSkillType() != SkillType.TRANSFORMATION)
           && (e.getTemplate().getEffectType() != EffectType.Hourglass)) {
         e.exit();
       } else {
         return;
       }
     }
   }
 }
 /** Method runImpl. */
 @Override
 protected final void runImpl() {
   final Player activeChar = getClient().getActiveChar();
   if (activeChar == null) {
     return;
   }
   ItemInstance adena = activeChar.getInventory().getItemByItemId(57);
   if ((_bid < 0) || (_bid > adena.getCount())) {
     return;
   }
   final ItemAuctionInstance instance =
       ItemAuctionManager.getInstance().getManagerInstance(_instanceId);
   NpcInstance broker = activeChar.getLastNpc();
   if ((broker == null)
       || (broker.getNpcId() != _instanceId)
       || (activeChar.getDistance(broker.getX(), broker.getY()) > Creature.INTERACTION_DISTANCE)) {
     return;
   }
   if (instance != null) {
     final ItemAuction auction = instance.getCurrentAuction();
     if (auction != null) {
       auction.registerBid(activeChar, _bid);
     }
   }
 }
示例#8
0
  public void onTransferOnlyRemoveSkills(Player player, int toFinalClass, int baseKeepSkills) {
    boolean delete = false;

    if (Config.ALT_DELETE_AWAKEN_SKILL_FROM_DB) {
      delete = true;
    }

    List<Integer> allSkillsId = SkillAcquireHolder.getInstance().getAllClassSkillId();
    List<Integer> skillsToMantain =
        SkillAcquireHolder.getInstance().getMaintainSkillOnAwake(baseKeepSkills, toFinalClass);

    for (Skill skl : player.getAllSkills()) {
      if (allSkillsId.contains(skl.getId())) {
        player.removeSkill(skl, delete);
      }
    }

    for (int skillId : skillsToMantain) {
      int skillLv = SkillTable.getInstance().getBaseLevel(skillId);
      Skill newSkill = SkillTable.getInstance().getInfo(skillId, skillLv);
      player.addSkill(newSkill, true);
    }

    for (int alterSkill : ALTER_SKILLS.get(toFinalClass)) {
      int skillLv = SkillTable.getInstance().getBaseLevel(alterSkill);
      Skill newSkillAlter = SkillTable.getInstance().getInfo(alterSkill, skillLv);
      player.addSkill(newSkillAlter, true);
    }

    player.sendSkillList();
  }
示例#9
0
 /** Method broadcastStatusUpdate. */
 @Override
 public void broadcastStatusUpdate() {
   for (Player player : World.getAroundPlayers(this)) {
     if (player != null) {
       player.sendPacket(new StaticObject(this, player));
     }
   }
 }
 /** Method runImpl. */
 @Override
 protected void runImpl() {
   Player player = getClient().getActiveChar();
   if ((player == null) || !Config.EX_NEW_PETITION_SYSTEM) {
     return;
   }
   player.sendPacket(new ExResponseShowStepOne(player));
 }
示例#11
0
  /**
   * Method SendReqToStartQuest.
   *
   * @param player Player
   */
  public void SendReqToStartQuest(Player player) {
    if (player.getClassId().level() < 3) {
      return;
    }

    int newClass = _CA.get(player.getClassId().getId());
    player.sendPacket(new ExCallToChangeClass(newClass, false));
  }
示例#12
0
 /**
  * Method onBypassFeedback.
  *
  * @param npc NpcInstance
  * @param player Player
  * @param command String
  * @see lineage2.gameserver.handlers.IBypassHandler#onBypassFeedback(NpcInstance, Player, String)
  */
 @Override
 public void onBypassFeedback(NpcInstance npc, Player player, String command) {
   if (player.isInParty()
       && player.getParty().isInReflection()
       && (player.getParty().getReflection() instanceof DelusionChamber)) {
     ((DelusionChamber) player.getParty().getReflection()).manualExitChamber(player, npc);
   }
 }
示例#13
0
 /**
  * Method roll.
  *
  * @param player Player
  * @param mod double
  * @return List<RewardItem>
  */
 public List<RewardItem> roll(Player player, double mod) {
   double rate;
   if (_item.isAdena()) {
     rate = (Config.RATE_DROP_ADENA + player.getVitalityBonus()) * player.getRateAdena();
   } else {
     rate = (Config.RATE_DROP_ITEMS + player.getVitalityBonus()) * (player.getRateItems());
   }
   return roll(rate * mod);
 }
示例#14
0
  /**
   * Method SendReqToAwaking.
   *
   * @param player Player
   */
  public void SendReqToAwaking(Player player) {
    if (player.getClassId().level() < 3) {
      return;
    }

    int newClass = _CA.get(player.getClassId().getId());
    player.sendPacket(new ExChangeToAwakenedClass(newClass));
    return;
  }
示例#15
0
 /**
  * Method addRewardItemWithMessage.
  *
  * @param id int
  * @param count long
  * @param player Player
  */
 private void addRewardItemWithMessage(int id, long count, Player player) {
   player
       .getInventory()
       .addItem(id, (long) (count * Config.ALT_RATE_COINS_REWARD_BLOCK_CHECKER));
   player.sendPacket(
       new SystemMessage(SystemMessage.YOU_HAVE_OBTAINED_S2_S1)
           .addItemName(id)
           .addNumber(count));
 }
  /** Method runImpl. */
  @Override
  protected void runImpl() {
    Player player = getClient().getActiveChar();

    if ((player == null) || !Config.EX_JAPAN_MINIGAME) {
      return;
    }

    player.sendPacket(new ExBR_MiniGameLoadScores(player));
  }
示例#17
0
  /**
   * Method onTimeElapsed.
   *
   * @param task ExecutedTask
   */
  @Override
  public void onTimeElapsed(ExecutedTask task) {
    _log.info("Recommendation Global Task: launched.");

    for (Player player : GameObjectsStorage.getAllPlayersForIterate()) {
      player.restartRecom();
    }

    _log.info("Recommendation Global Task: completed.");
  }
  /** Method runImpl. */
  @Override
  protected void runImpl() {
    Player player = getClient().getActiveChar();

    if (player == null) {
      return;
    }

    player.sendPacket(new ExListMpccWaiting(player, _listId, _locationId, _allLevels));
  }
  /** Method runImpl. */
  @Override
  protected void runImpl() {
    Player player = getClient().getActiveChar();

    if (player == null) {
      return;
    }

    player.sendPacket(new FriendList(player));
  }
示例#20
0
 /**
  * Method getRecoBonus.
  *
  * @param activeChar Player
  * @return int
  */
 public static int getRecoBonus(Player activeChar) {
   if ((activeChar != null) && activeChar.isOnline()) {
     if (activeChar.getRecomHave() == 0) {
       return 0;
     }
     int _lvl = (int) Math.ceil(activeChar.getLevel() / 10);
     int _exp = (int) Math.ceil((Math.min(100, activeChar.getRecomHave()) - 1) / 10);
     return _recoBonus[_lvl][_exp];
   }
   return 0;
 }
 /** Method runImpl. */
 @Override
 public void runImpl() {
   Functions.npcShout(
       CastleMassTeleporterInstance.this,
       NpcString.THE_DEFENDERS_OF_S1_CASTLE_WILL_BE_TELEPORTED_TO_THE_INNER_CASTLE,
       "#" + getCastle().getNpcStringName().getId());
   for (Player p : World.getAroundPlayers(CastleMassTeleporterInstance.this, 200, 50)) {
     p.teleToLocation(Location.findPointToStay(_teleportLoc, 10, 100, p.getGeoIndex()));
   }
   _teleportTask = null;
 }
 /** Method runImpl. */
 @Override
 protected void runImpl() {
   Player player = getClient().getActiveChar();
   if (player == null) {
     return;
   }
   Quest q = QuestManager.getQuest(255);
   if (q != null) {
     player.processQuestEvent(q.getName(), _bypass, null);
   }
 }
示例#23
0
 /** Method getProtectionBlessing. */
 public void getProtectionBlessing() {
   Player player = getSelf();
   NpcInstance npc = getNpc();
   if (player.getKarma() > 0) {
     return;
   }
   if ((player.getLevel() > 39) || player.getClassId().isOfLevel(ClassLevel.Second)) {
     show("default/newbie_blessing_no.htm", player, npc);
     return;
   }
   npc.doCast(SkillTable.getInstance().getInfo(5182, 1), player, true);
 }
 /** Method runImpl. */
 @Override
 protected void runImpl() {
   Player player = getClient().getActiveChar();
   if (player == null) {
     return;
   }
   Castle castle = ResidenceHolder.getInstance().getResidence(Castle.class, _unitId);
   if ((castle == null) || (castle.getOwner() == null)) {
     return;
   }
   player.sendPacket(new CastleSiegeDefenderList(castle));
 }
示例#25
0
  /**
   * Method giveItems.
   *
   * @param player Player
   * @param previousClassId
   * @param newClassId
   */
  public void giveItems(Player player, Integer previousClassId, Integer newClassId) {
    if (!player.getSubClassList().isDualClassActive()) {
      ItemFunctions.addItem(player, AWAKEN_POWER.get(newClassId), 1, true);
      ItemFunctions.addItem(player, LEGACY_WEAPONS.get(previousClassId), 1, true);
    } else {
      if (previousClassId >= 139) {
        player.getInventory().destroyItemByItemId(CLOAK_DUAL_CLASS.get(previousClassId), 1);
        player.getWarehouse().destroyItemByItemId(CLOAK_DUAL_CLASS.get(previousClassId), 1);
      }

      ItemFunctions.addItem(player, CLOAK_DUAL_CLASS.get(newClassId), 1, true);
    }
  }
示例#26
0
 /**
  * Method useVoicedCommand.
  *
  * @param command String
  * @param player Player
  * @param args String
  * @return boolean * @see
  *     lineage2.gameserver.handler.voicecommands.IVoicedCommandHandler#useVoicedCommand(String,
  *     Player, String)
  */
 @Override
 public boolean useVoicedCommand(String command, Player player, String args) {
   if (!Config.ALT_DEBUG_ENABLED) {
     return false;
   }
   if (player.isDebug()) {
     player.setDebug(false);
     player.sendMessage(new CustomMessage("voicedcommandhandlers.Debug.Disabled", player));
   } else {
     player.setDebug(true);
     player.sendMessage(new CustomMessage("voicedcommandhandlers.Debug.Enabled", player));
   }
   return true;
 }
示例#27
0
 /**
  * Method checkCondition.
  *
  * @return boolean
  */
 @Override
 public boolean checkCondition() {
   Player player = _effected.getPlayer();
   if (player == null) {
     return false;
   }
   if (player.isMounted()) {
     player.sendPacket(
         new SystemMessage(SystemMessage.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS)
             .addSkillName(_skill.getId(), _skill.getLevel()));
     return false;
   }
   return super.checkCondition();
 }
  @Override
  public String onEvent(String event, QuestState qs, NpcInstance npc) {
    final Player player = qs.getPlayer();

    switch (event) {
      case "33155-9.htm":
        SupportMagic.getSupportMagic(npc, player);
        break;

      case "33155-10.htm":
        SupportMagic.getSupportServitorMagic(npc, player);
        break;

      case "advanceCond3":
        if (qs.getCond() != 3) {
          qs.setCond(3);
        }
        return null;

      case "teleportCruma":
        qs.setCond(1);
        qs.setState(STARTED);
        qs.playSound(SOUND_ACCEPT);
        player.teleToLocation(17192, 114173, -3439);
        return null;

      case "33163-8.htm":
        if (qs.getQuestItemsCount(TRESURE_TOOL) == 0) {
          qs.giveItems(TRESURE_TOOL, 30);
          qs.setCond(2);
        } else {
          return "33163-12.htm";
        }
        break;

      case "EnterInstance":
        if (player.getParty() == null) {
          player.sendMessage("You cannot enter without party!"); // pts message?
          return null;
        }
        for (Player member : player.getParty().getPartyMembers()) {
          final QuestState state = member.getQuestState(Q00480_AnotherLegacyOfCrumaTower.class);

          if ((state == null) || (state.getCond() != 3)) {
            // nothing as I've seen everybody can enter this instance
          } else if (state.getCond() == 3) {
            state.setCond(4);
          }
        }
        ReflectionUtils.enterReflection(player, 198);
        return null;

      case "LeaveInstance":
        player.teleToLocation(17192, 114173, -3439, ReflectionManager.DEFAULT);
        return null;
    }

    return event;
  }
  public ExInzoneWaitingInfo(Player player) {
    collapseInstanceTime = new FastMap<>();

    if (player.getActiveReflection() != null) {
      instanceZoneId = player.getActiveReflection().getInstancedZoneId();
    }

    for (int i : player.getInstanceReuses().keySet()) {
      int timeToCollapse = InstantZoneHolder.getInstance().getMinutesToNextEntrance(i, player);

      if (timeToCollapse > 0) {
        collapseInstanceTime.put(i, timeToCollapse * 60);
      }
    }
  }
示例#30
0
  @Override
  public void showChatWindow(Player player, int val, Object... replace) {
    NpcHtmlMessage htmlMessage = new NpcHtmlMessage(getObjectId());
    htmlMessage.setFile("default/33785.htm");
    if (player.getVar("Altar1") != null) {
      htmlMessage.setFile("default/33785-2.htm");
    }
    if (player.getVar("Altar2") != null) {
      htmlMessage.setFile("default/33785-3.htm");
    }
    if (player.getVar("Altar3") != null) {
      htmlMessage.setFile("default/33785-e.htm");
    }

    player.sendPacket(htmlMessage);
  }