Пример #1
0
  @Override
  public void onBypassFeedback(Player player, String command) {
    if (!canBypassCheck(player, this)) {
      return;
    }

    if (command.startsWith("start1")) {
      // тут пропускам т.к. это первый этаж, и перемещение на него == вход в инстанс
    } else if (command.startsWith("start2")) {

      for (Player party : GameObjectsStorage.getAllPlayersForIterate()) {
        party.unsetVar("Altar1");
        party.setVar("Altar2", "true", -1);
        party.teleToLocation(FLOOR2, player.getReflection());
      }
    } else if (command.startsWith("start3")) {
      for (Player party : GameObjectsStorage.getAllPlayersForIterate()) {
        party.unsetVar("Altar2");
        party.setVar("Altar3", "true", -1);
        party.teleToLocation(FLOOR3, player.getReflection());
      }

    } else if (command.startsWith("exit")) {
      for (Player party : GameObjectsStorage.getAllPlayersForIterate()) {
        party.unsetVar("Altar3");
        party.teleToLocation(OFF, 0);
      }
    } else {
      super.onBypassFeedback(player, command);
    }
  }
  public void onStopEvent(FightBattleEvent event) {
    Player player = _player;
    if (player == null) return;

    if (_returnLoc == null) // игрока не портнуло на стадион
    return;

    player.removeEvent(event);

    if (player.isDead()) {
      player.setCurrentHp(player.getMaxHp(), true);
      player.broadcastPacket(new Revive(player));
      // player.broadcastStatusUpdate();
    } else player.setCurrentHp(player.getMaxHp(), false);

    player.setCurrentCp(player.getMaxCp());
    player.setCurrentMp(player.getMaxMp());

    // Возвращаем клановые скиллы если репутация положительная.
    if (player.getClan() != null && player.getClan().getReputationScore() >= 0)
      player.getClan().enableSkills(player);

    // Add Hero Skills
    player.activateHeroSkills(true);

    // Обновляем скилл лист, после добавления скилов
    player.sendPacket(new SkillList(player));

    player.setStablePoint(null);
    player.teleToLocation(_returnLoc, ReflectionManager.DEFAULT);
  }
Пример #3
0
  @Override
  public void onBypassFeedback(Player player, String command) {
    if (!canBypassCheck(player, this)) {
      return;
    }

    if (command.equalsIgnoreCase("start")) {
      Reflection r = player.getActiveReflection();
      if (r != null) {
        if (player.canReenterInstance(VullockInstance)) {
          player.teleToLocation(r.getTeleportLoc(), r);
        }
      } else if (player.canEnterInstance(VullockInstance)) {
        ReflectionUtils.enterReflection(player, new AltarShilen(), VullockInstance);
      }
    } else {
      super.onBypassFeedback(player, command);
    }
  }
Пример #4
0
  @Override
  public void useSkill(final Creature activeChar, List<Creature> targets) {
    for (final Creature target : targets)
      if (target != null) {
        final Player pcTarget = target.getPlayer();
        if (pcTarget == null) continue;
        if (!pcTarget.getPlayerAccess().UseTeleport) continue;
        if (pcTarget.getActiveWeaponFlagAttachment() != null) {
          activeChar.sendPacket(SystemMsg.YOU_CANNOT_TELEPORT_WHILE_IN_POSSESSION_OF_A_WARD);
          continue;
        }
        if (pcTarget.isInOlympiadMode()) {
          activeChar.sendPacket(
              SystemMsg
                  .YOU_CANNOT_SUMMON_PLAYERS_WHO_ARE_CURRENTLY_PARTICIPATING_IN_THE_GRAND_OLYMPIAD);
          return;
        }
        if (pcTarget.isInObserverMode()) {
          activeChar.sendPacket(
              new SystemMessagePacket(SystemMsg.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS)
                  .addSkillName(getId(), getLevel()));
          return;
        }

        for (GlobalEvent e : pcTarget.getEvents()) {
          if (!e.canUseTeleport(pcTarget)) {
            activeChar.sendPacket(
                new SystemMessagePacket(SystemMsg.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS)
                    .addSkillName(getId(), getLevel()));
            return;
          }
        }

        if (pcTarget.isInDuel() || pcTarget.getTeam() != TeamType.NONE) {
          activeChar.sendMessage(new CustomMessage("common.RecallInDuel", (Player) activeChar));
          return;
        }
        if (_isItemHandler) {
          // TODO: переделать SOE по TownId на SOE по Loc_id
          if (_itemConsumeId[0] == 7127) // hardin's academy
          {
            pcTarget.teleToLocation(105918, 109759, -3207, 0);
            return;
          }
          if (_itemConsumeId[0] == 7130) // ivory
          {
            pcTarget.teleToLocation(85475, 16087, -3672, 0);
            return;
          }
          if (_itemConsumeId[0] == 7618) {
            pcTarget.teleToLocation(149864, -81062, -5618, 0);
            return;
          }
          if (_itemConsumeId[0] == 7619) {
            pcTarget.teleToLocation(108275, -53785, -2524, 0);
            return;
          }
        }
        if (_loc != null) {
          pcTarget.teleToLocation(_loc, 0);
          return;
        }
        // FIXME [G1ta0] перенести координаты в скиллы
        switch (_townId)
        // To town by Id
        {
          case 1: // Talking Island
            pcTarget.teleToLocation(-114558, 253605, -1536, 0);
            return;
          case 2: // Elven Village
            pcTarget.teleToLocation(45576, 49412, -2950, 0);
            return;
          case 3: // Dark Elven Village
            pcTarget.teleToLocation(12501, 16768, -4500, 0);
            return;
          case 4: // Orc Village
            pcTarget.teleToLocation(-44884, -115063, -80, 0);
            return;
          case 5: // Dwarven Village
            pcTarget.teleToLocation(115790, -179146, -890, 0);
            return;
          case 6: // Town of Gludio
            pcTarget.teleToLocation(-14279, 124446, -3000, 0);
            return;
          case 7: // Gludin Village
            pcTarget.teleToLocation(-82909, 150357, -3000, 0);
            return;
          case 8: // Town of Dion
            pcTarget.teleToLocation(19025, 145245, -3107, 0);
            return;
          case 9: // Town of Giran
            pcTarget.teleToLocation(82272, 147801, -3350, 0);
            return;
          case 10: // Town of Oren
            pcTarget.teleToLocation(82323, 55466, -1480, 0);
            return;
          case 11: // Town of Aden
            pcTarget.teleToLocation(144526, 24661, -2100, 0);
            return;
          case 12: // Hunters Village
            pcTarget.teleToLocation(117189, 78952, -2210, 0);
            return;
          case 13: // Heine
            pcTarget.teleToLocation(110768, 219824, -3624, 0);
            return;
          case 14: // Rune Township
            pcTarget.teleToLocation(43536, -50416, -800, 0);
            return;
          case 15: // Town of Goddard
            pcTarget.teleToLocation(148288, -58304, -2979, 0);
            return;
          case 16: // Town of Schuttgart
            pcTarget.teleToLocation(87776, -140384, -1536, 0);
            return;
          case 17: // Kamael Village
            pcTarget.teleToLocation(-117081, 44171, 507, 0);
            return;
          case 18: // Primeval Isle
            pcTarget.teleToLocation(10568, -24600, -3648, 0);
            return;
          case 19: // Floran Village
            pcTarget.teleToLocation(17144, 170156, -3502, 0);
            return;
          case 20: // Hellbound
            pcTarget.teleToLocation(-16434, 208803, -3664, 0);
            return;
          case 21: // Keucereus Alliance Base
            pcTarget.teleToLocation(-184200, 243080, 1568, 0);
            return;
          case 22: // Steel Citadel
            pcTarget.teleToLocation(8976, 252416, -1928, 0);
            return;
          case 23: // Town of Arcan
            pcTarget.teleToLocation(207559, 86429, -1000, 0);
            return;
          case 24: // Vernon Village
            pcTarget.teleToLocation(-80403, 247853, -3496, 0);
            return;
          case 25: // Gludin Church
            pcTarget.teleToLocation(-79592, 150824, -3066, 0);
            return;
          case 26: // Windy Hill
            pcTarget.teleToLocation(-93649, 89763, -3208, 0);
            return;
          case 27: // Orc Barrack
            pcTarget.teleToLocation(-85672, 106664, -3577, 0);
            return;
          case 28: // Town of Dion - front of Sylvain
            pcTarget.teleToLocation(16376, 142296, -2718, 0);
            return;
          case 29: // Cruma Tower - front of Lorain
            pcTarget.teleToLocation(16520, 113384, -3605, 0);
            return;
          case 30: // Cruma Tower - front of Rombel
            pcTarget.teleToLocation(17776, 114851, -11704, 0);
            return;
          case 31: // Town of Oren - front of Hollint
            pcTarget.teleToLocation(83633, 53064, -1456, 0);
            return;
          case 32: // Sea of Spore - front of Andy
            pcTarget.teleToLocation(64328, 26803, -3768, 0);
            return;
          case 33: // Town of Aden - front of Orven
            pcTarget.teleToLocation(147446, 22761, -1984, 0);
            return;
          case 34: // Forsaken Plains - front of Novain
            pcTarget.teleToLocation(174470, 40112, -4144, 0);
            return;
          case 35: // Scroll of Escape: Fields of Massacre
            pcTarget.teleToLocation(183543, -14974, -2768, 0);
            return;
          case 36: // Scroll of Escape: Town of Rune
            pcTarget.teleToLocation(174470, 40112, -4144, 0);
            return;
          case 37: // Scroll of Escape: Swamp of Screams
            pcTarget.teleToLocation(174470, 40112, -4144, 0);
            return;
          case 38: // Scroll of Escape: Town of Goddard
            pcTarget.teleToLocation(174470, 40112, -4144, 0);
            return;
          case 39: // Scroll of Escape: Wall of Argos
            pcTarget.teleToLocation(174470, 40112, -4144, 0);
            return;
          case 40: // croll of Escape: Town of Giran
            pcTarget.teleToLocation(174470, 40112, -4144, 0);
            return;
          case 41: // Scroll of Escape: Dragon Valley
            pcTarget.teleToLocation(174470, 40112, -4144, 0);
            return;
        }
        if (_castle) // To castle
        {
          pcTarget.teleToCastle();
          return;
        }
        if (_clanhall) // to clanhall
        {
          pcTarget.teleToClanhall();
          return;
        }
        if (_fortress) // To fortress
        {
          pcTarget.teleToFortress();
          return;
        }

        pcTarget.teleToClosestTown();
      }

    if (isSSPossible()) activeChar.unChargeShots(isMagic());

    super.useSkill(activeChar, targets);
  }
  @Override
  public String onEvent(String event, QuestState st, NpcInstance npc) {
    Player player = st.getPlayer();
    if (player == null) return null;

    String htmltext = event;

    System.out.println("quest event " + event.toString());

    int classId = player.getClassId().getId();
    if (event.startsWith("UC")) {
      if (checkStartCondition(player)) {
        Quest q = QuestManager.getQuest(10779);
        player.processQuestEvent(q.getName(), "start_quest", null);
      }

      htmltext = "";
    }

    if (event.equalsIgnoreCase("start_quest") || event.equalsIgnoreCase("start_quest_7s")) {
      st.setCond(1);
      st.setState(STARTED);
      alertLetterReceived(st);
      st.showQuestHTML(st.getQuest(), "queen_letter.htm");

      htmltext = "";
    }

    if (event.equalsIgnoreCase("start_quest_delay")) {
      st.startQuestTimer("start_quest_7s", 7000);
      // only start quest after 7s to avoid crash on enterworld
      htmltext = "";
    }

    if (event.equalsIgnoreCase("Quest _10779_LetterFromTheQueen_SeaOfSpores to_oren")) {
      // System.out.println("in Quest _10779_LetterFromTheQueen_SeaOfSpores to_dion");
      if (st.getCond() == 1) {
        if (getItemCountById(player, SOE_OREN) > 0) {
          st.takeItems(SOE_OREN, 1);
          player.teleToLocation(83633, 53064, -1456);
          player.sendPacket(TutorialCloseHtmlPacket.STATIC);
        } else {
          player.sendMessage("Không tìm thấy Scroll of Escape: Town of Oren");
        }
      }
      htmltext = "";
    }
    // System.out.println("out " + event);
    if (event.equalsIgnoreCase("Quest _10779_LetterFromTheQueen_SeaOfSpores close_window")) {
      // System.out.println("in Quest _10779_LetterFromTheQueen_SeaOfSpores close_window");
      player.sendPacket(TutorialCloseHtmlPacket.STATIC);
      htmltext = "";
    }

    // Question mark clicked
    if (event.startsWith("QM")) {
      int MarkId = Integer.valueOf(event.substring(2));
      // System.out.println("Mark id " + MarkId);
      if (MarkId == 10779) {
        if (player.getRace() == Race.ERTHEIA) st.showQuestHTML(st.getQuest(), "queen_letter.htm");
        htmltext = "";
      }
    }

    if (event.equalsIgnoreCase("30191-3.htm")) {
      st.giveItems(SOE_SEA_OF_SPORES, 1);
      st.setCond(2);

      htmltext = "30191-3.htm";
    }

    if (event.equalsIgnoreCase("33845-2.htm")) {
      st.giveItems(STEEL_DOOR_COIN, 37, true);
      st.giveItems(SCROLL_EWB, 3, true);
      st.addExpAndSp(635250, 152);
      st.setState(COMPLETED);
      st.exitCurrentQuest(false);
      st.playSound(SOUND_FINISH);
      st.getPlayer()
          .sendPacket(
              new ExShowScreenMessage(
                  NEXT_LETTER_STRING,
                  7000,
                  ExShowScreenMessage.ScreenMessageAlign.TOP_CENTER,
                  true));

      htmltext = "33845-2.htm";
    }

    if (htmltext.isEmpty()) return null;
    else return htmltext;
  }
Пример #6
0
  @Override
  public void onBypassFeedback(Player player, String command) {
    if (!canBypassCheck(player, this)) return;

    if (command.startsWith("ExitSoloKama")) {
      Reflection r = getReflection();
      if (r.getReturnLoc() != null)
        player.teleToLocation(r.getReturnLoc(), ReflectionManager.DEFAULT);
      else player.setReflection(ReflectionManager.DEFAULT);
      player.unsetVar("backCoords");
      r.startCollapseTimer(1000);
    } else if (command.startsWith("ListPossible")) {
      if (getNpcId() == 32484
          && Config.ALT_KAMALOKA_NIGHTMARES_PREMIUM_ONLY
          && !player.hasBonus()) {
        showChatWindow(player, "instance/soloKamaloka/32484-no.htm");
        return;
      }
      // FIXME [G1ta0] исправить, когда будет реализованы индивидуальные параметры спавна
      DomainArea domain = MapRegionManager.getInstance().getRegionData(DomainArea.class, this);
      String htmlpath = "instance/soloKamaloka/" + getNpcId();
      if (domain != null)
        switch (domain.getId()) {
          case 1: // Town of Gludio
            htmlpath += "-gludio";
            break;
          case 2: // Town of Dion
            htmlpath += "-dion";
            break;
          case 4: // Town of Oren
            htmlpath += "-oren";
            break;
          case 6: // Heine
            htmlpath += "-heine";
            break;
          case 8: // Rune Township
            htmlpath += "-rune";
            break;
          case 9: // Town of Schuttgart
            htmlpath += "-schuttgart";
            break;
        }
      htmlpath += ".htm";
      showChatWindow(player, htmlpath);
    } else if (command.startsWith("ShowResults")) {
      String htmlpath = "instance/soloKamaloka/" + getNpcId();
      switch (getRewardRank()) {
        case 0:
          htmlpath += "-F";
          break;
        case 1:
          htmlpath += "-D";
          break;
        case 2:
          htmlpath += "-C";
          break;
        case 3:
          htmlpath += "-B";
          break;
        case 4:
          htmlpath += "-A";
          break;
        case 5:
          htmlpath += "-S";
          break;
        case 6:
          if (getReflection().getInstancedZoneId()
              == INSTANCE_75LVL_ID) // G-Grade награда доступна только в соло камалоке 70-80
            // уровней.
            htmlpath += "-G";
          else htmlpath += "-S";
          break;
      }
      htmlpath += ".htm";
      showChatWindow(player, htmlpath);
    } else if (command.startsWith("SoloKamaReward")) {
      if (!_rewarded) {
        int[][] rewards = getRewardList(getRewardRank(), getReflection().getInstancedZone());
        if (rewards != null)
          for (int[] item : rewards)
            if (item != null) {
              int id = item[0];
              int count = item[1];
              if (id > 0 && count > 0) Functions.addItem(player, id, count);
            }

        _rewarded = true;
      }

      showChatWindow(player, 1);
    } else if (command.startsWith("Chat"))
      try {
        int val = Integer.parseInt(command.substring(5));
        showChatWindow(player, val);
      } catch (NumberFormatException nfe) {
        String filename = command.substring(5).trim();
        if (filename.length() == 0) showChatWindow(player, "npcdefault.htm");
        else showChatWindow(player, filename);
      }
    else if (command.startsWith("solo_kamaloka")) {
      int val = Integer.parseInt(command.substring(14));
      Reflection r = player.getActiveReflection();
      if (r != null) {
        if (player.canReenterInstance(val)) player.teleToLocation(r.getTeleportLoc(), r);
      } else if (player.canEnterInstance(val)) {
        ReflectionUtils.enterReflection(player, new KamalokaNightmare(player), val);
      }
    } else super.onBypassFeedback(player, command);
  }
  public void teleportPlayer(FightBattleArenaObject arena) {
    Player player = _player;
    if (player == null) return;

    if (player.isTeleporting()) {
      _player = null;
      return;
    }

    if (player.isInObserverMode()) {
      if (player.getOlympiadObserveGame() != null) player.leaveOlympiadObserverMode(true);
      else player.leaveObserverMode();
    }

    // Un activate clan skills
    if (player.getClan() != null) player.getClan().disableSkills(player);

    // Remove Hero Skills
    player.activateHeroSkills(false);

    // Abort casting if player casting
    if (player.isCastingNow()) player.abortCast(true, true);

    // Abort attack if player attacking
    if (player.isAttackingNow()) player.abortAttack(true, true);

    // Удаляем баффы и чужие кубики
    for (Effect e : player.getEffectList().getEffects()) {
      if (!player.isSpecialEffect(e.getSkill())
          && (e.getEffectType() != EffectType.Cubic
              || player.getSkillLevel(e.getSkill().getId()) <= 0)) e.exit();
    }

    // Remove Servitor's Buffs
    Servitor[] servitors = player.getServitors();
    if (servitors.length > 0) {
      for (Servitor servitor : servitors) {
        if (servitor.isPet()) servitor.unSummon(false);
        else {
          servitor.getEffectList().stopAllEffects();
          servitor.transferOwnerBuffs();
        }
      }
    }

    // unsummon agathion
    if (player.getAgathionId() > 0) player.setAgathion(0);

    // Сброс кулдауна всех скилов, время отката которых меньше 15 минут
    for (TimeStamp sts : player.getSkillReuses()) {
      if (sts == null) continue;

      Skill skill = SkillTable.getInstance().getInfo(sts.getId(), sts.getLevel());
      if (skill == null) continue;

      if (sts.getReuseBasic() <= 15 * 60001L) player.enableSkill(skill);
    }

    // Обновляем скилл лист, после удаления скилов
    player.sendPacket(new SkillList(player));

    // Обновляем куллдаун, после сброса
    player.sendPacket(new SkillCoolTime(player));

    // Проверяем одетые вещи на возможность ношения.
    player.getInventory().validateItems();

    // remove bsps/sps/ss automation
    Set<Integer> activeSoulShots = player.getAutoSoulShot();
    for (int itemId : activeSoulShots) {
      player.removeAutoSoulShot(itemId);
      player.sendPacket(new ExAutoSoulShot(itemId, false));
    }

    // Разряжаем заряженные соул и спирит шоты
    ItemInstance weapon = player.getActiveWeaponInstance();
    if (weapon != null) {
      weapon.setChargedSpiritshot(ItemInstance.CHARGED_NONE);
      weapon.setChargedSoulshot(ItemInstance.CHARGED_NONE);
    }

    player.setCurrentCp(player.getMaxCp());
    player.setCurrentMp(player.getMaxMp());

    if (player.isDead()) {
      player.setCurrentHp(player.getMaxHp(), true);
      player.broadcastPacket(new Revive(player));
      // player.broadcastStatusUpdate();
    } else player.setCurrentHp(player.getMaxHp(), false);

    player.broadcastUserInfo(true);

    DuelEvent duel = player.getEvent(DuelEvent.class);
    if (duel != null) duel.abortDuel(player);

    _returnLoc = player.getStablePoint() == null ? player.getLoc() : player.getStablePoint();

    if (player.isSitting()) player.standUp();

    player.setTarget(null);

    player.leaveParty();

    player.setStablePoint(_returnLoc);

    Location loc =
        arena.getMember1() == this
            ? arena.getInfo().getTeleportLoc1()
            : arena.getInfo().getTeleportLoc2();
    player.teleToLocation(
        Location.findPointToStay(loc, 0, arena.getReflection().getGeoIndex()),
        arena.getReflection());

    setDamage(0.);
    setKilled(false);
  }