Ejemplo n.º 1
0
  public void restore() {
    _contacts.clear();

    try (Connection con = ConnectionFactory.getInstance().getConnection();
        PreparedStatement ps = con.prepareStatement(QUERY_LOAD)) {
      ps.setInt(1, activeChar.getObjectId());
      try (ResultSet rs = ps.executeQuery()) {
        int contactId;
        String contactName;
        while (rs.next()) {
          contactId = rs.getInt(1);
          contactName = CharNameTable.getInstance().getNameById(contactId);
          if ((contactName == null)
              || contactName.equals(activeChar.getName())
              || (contactId == activeChar.getObjectId())) {
            continue;
          }

          _contacts.add(contactName);
        }
      }
    } catch (Exception e) {
      _log.log(
          Level.WARNING,
          "Error found in " + activeChar.getName() + "'s ContactsList: " + e.getMessage(),
          e);
    }
  }
Ejemplo n.º 2
0
 /** Save the current player condition: hp, mp, cp, location */
 public void savePlayerConditions() {
   if (_partyDuel) {
     for (L2PcInstance player : _playerA.getParty().getMembers()) {
       _playerConditions.put(player.getObjectId(), new PlayerCondition(player, _partyDuel));
     }
     for (L2PcInstance player : _playerB.getParty().getMembers()) {
       _playerConditions.put(player.getObjectId(), new PlayerCondition(player, _partyDuel));
     }
   } else {
     _playerConditions.put(_playerA.getObjectId(), new PlayerCondition(_playerA, _partyDuel));
     _playerConditions.put(_playerB.getObjectId(), new PlayerCondition(_playerB, _partyDuel));
   }
 }
Ejemplo n.º 3
0
  /** Playback the bow animation for all looser */
  public void playKneelAnimation() {
    L2PcInstance looser = getLooser();

    if (looser == null) {
      return;
    }

    if (_partyDuel && (looser.getParty() != null)) {
      for (L2PcInstance temp : looser.getParty().getMembers()) {
        temp.broadcastPacket(new SocialAction(temp.getObjectId(), 7));
      }
    } else {
      looser.broadcastPacket(new SocialAction(looser.getObjectId(), 7));
    }
  }
Ejemplo n.º 4
0
  public void createCouple(L2PcInstance player1, L2PcInstance player2) {
    if ((player1 != null) && (player2 != null)) {
      if ((player1.getPartnerId() == 0) && (player2.getPartnerId() == 0)) {
        int player1id = player1.getObjectId();
        int player2id = player2.getObjectId();

        Couple couple = new Couple(player1, player2);
        getCouples().add(couple);
        player1.setPartnerId(player2id);
        player2.setPartnerId(player1id);
        player1.setCoupleId(couple.getId());
        player2.setCoupleId(couple.getId());
      }
    }
  }
Ejemplo n.º 5
0
  @Override
  public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) {
    if (getQuestState(attacker, false) != null) {
      switch (npc.getScriptValue()) {
        case 0:
          {
            switch (npc.getId()) {
              case lIZARDMAN_WARRIOR:
                {
                  npc.broadcastPacket(
                      new NpcSay(npc, ChatType.NPC_GENERAL, NpcStringId.THE_SACRED_FLAME_IS_OURS));
                  break;
                }
              case LIZARDMAN_SCOUT:
                {
                  npc.broadcastPacket(
                      new NpcSay(npc, ChatType.NPC_GENERAL, NpcStringId.THE_SACRED_FLAME_IS_OURS));
                  break;
                }
              case LIZARDMAN_SOLDIER:
                {
                  npc.broadcastPacket(
                      new NpcSay(npc, ChatType.NPC_GENERAL, NpcStringId.THE_SACRED_FLAME_IS_OURS));
                  break;
                }
              case TAMIL:
                {
                  npc.broadcastPacket(
                      new NpcSay(npc, ChatType.NPC_GENERAL, NpcStringId.AS_YOU_WISH_MASTER));
                  break;
                }
            }

            npc.setScriptValue(1);
            npc.getVariables().set("firstAttacker", attacker.getObjectId());
            break;
          }
        case 1:
          {
            if (npc.getVariables().getInt("firstAttacker") != attacker.getObjectId()) {
              npc.setScriptValue(2);
            }
            break;
          }
      }
    }
    return super.onAttack(npc, attacker, damage, isSummon);
  }
  private final synchronized void enterInstance(L2PcInstance player) {
    // check for existing instances for this player
    InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
    if (world != null) {
      if (world.templateId != INSTANCE_ID) {
        player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER);
        return;
      }
      Instance inst = InstanceManager.getInstance().getInstance(world.instanceId);
      if (inst != null) {
        teleportPlayer(player, TELEPORT, world.instanceId);
      }
      return;
    }
    // New instance
    final int instanceId =
        InstanceManager.getInstance().createDynamicInstance("PailakaSongOfIceAndFire.xml");

    world = new InstanceWorld();
    world.instanceId = instanceId;
    world.templateId = INSTANCE_ID;
    InstanceManager.getInstance().addWorld(world);

    world.allowed.add(player.getObjectId());
    teleportPlayer(player, TELEPORT, instanceId);
  }
  @Override
  protected final void writeImpl() {
    writeC(0xde);
    writeD(_seller.getObjectId());
    writeD((int) _seller.getAdena());
    writeD(_isDwarven ? 0x00 : 0x01);

    if (_recipes == null) {
      writeD(0);
    } else {
      writeD(_recipes.length); // number of items in recipe book

      for (int i = 0; i < _recipes.length; i++) {
        L2RecipeList temp = _recipes[i];
        writeD(temp.getId());
        writeD(i + 1);
      }
    }

    if (_seller.getCreateList() == null) {
      writeD(0);
    } else {
      L2ManufactureList list = _seller.getCreateList();
      writeD(list.size());

      for (L2ManufactureItem item : list.getList()) {
        writeD(item.getRecipeId());
        writeD(0x00);
        writeQ(item.getCost());
      }
    }
  }
Ejemplo n.º 8
0
  public void remove(String name) {
    int contactId = CharNameTable.getInstance().getIdByName(name);

    if (!_contacts.contains(name)) {
      activeChar.sendPacket(SystemMessageId.NAME_NOT_REGISTERED_ON_CONTACT_LIST);
      return;
    } else if (contactId < 1) {
      // TODO: Message?
      return;
    }

    _contacts.remove(name);

    try (Connection con = ConnectionFactory.getInstance().getConnection();
        PreparedStatement ps = con.prepareStatement(QUERY_REMOVE)) {
      ps.setInt(1, activeChar.getObjectId());
      ps.setInt(2, contactId);
      ps.execute();

      SystemMessage sm =
          SystemMessage.getSystemMessage(SystemMessageId.S1_SUCCESFULLY_DELETED_FROM_CONTACT_LIST);
      sm.addString(name);
      activeChar.sendPacket(sm);
    } catch (Exception e) {
      _log.log(
          Level.WARNING,
          "Error found in " + activeChar.getName() + "'s ContactsList: " + e.getMessage(),
          e);
    }
  }
Ejemplo n.º 9
0
  /**
   * This function is called whenever a player leaves a party
   *
   * @param player the player quitting.
   */
  public void onRemoveFromParty(L2PcInstance player) {
    // if it isn't a party duel ignore this
    if (!_partyDuel) {
      return;
    }

    // this player is leaving his party during party duel
    // if he's either playerA or playerB cancel the duel and port the players back
    if ((player == _playerA) || (player == _playerB)) {
      for (PlayerCondition cond : _playerConditions.values()) {
        cond.teleportBack();
        cond.getPlayer().setIsInDuel(0);
      }

      _playerA = null;
      _playerB = null;
    } else
    // teleport the player back & delete his PlayerCondition record
    {
      final PlayerCondition cond = _playerConditions.get(player.getObjectId());
      if (cond != null) {
        cond.teleportBack();
        _playerConditions.remove(cond);
      }
      player.setIsInDuel(0);
    }
  }
 @Override
 public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) {
   if (firstEntrance) {
     spawnNPC((DNPWorld) world);
     world.addAllowed(player.getObjectId());
   }
   teleportPlayer(player, ENTER, world.getInstanceId());
 }
Ejemplo n.º 11
0
  /** Handle chat type 'all' */
  @Override
  public void handleChat(int type, L2PcInstance activeChar, String params, String text) {
    boolean vcd_used = false;
    if (text.startsWith(".")) {
      StringTokenizer st = new StringTokenizer(text);
      IVoicedCommandHandler vch;
      String command = "";

      if (st.countTokens() > 1) {
        command = st.nextToken().substring(1);
        params = text.substring(command.length() + 2);
        vch = VoicedCommandHandler.getInstance().getHandler(command);
      } else {
        command = text.substring(1);
        if (Config.DEBUG) {
          _log.info("Command: " + command);
        }
        vch = VoicedCommandHandler.getInstance().getHandler(command);
      }
      if (vch != null) {
        vch.useVoicedCommand(command, activeChar, params);
        vcd_used = true;
      } else {
        if (Config.DEBUG) {
          _log.warning("No handler registered for bypass '" + command + "'");
        }
        vcd_used = false;
      }
    }
    if (!vcd_used) {
      if (activeChar.isChatBanned() && Util.contains(Config.BAN_CHAT_CHANNELS, type)) {
        activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED);
        return;
      }

      /**
       * Match the character "." literally (Exactly 1 time) Match any character that is NOT a .
       * character. Between one and unlimited times as possible, giving back as needed (greedy)
       */
      if (text.matches("\\.{1}[^\\.]+")) {
        activeChar.sendPacket(SystemMessageId.INCORRECT_SYNTAX);
      } else {
        CreatureSay cs =
            new CreatureSay(
                activeChar.getObjectId(), type, activeChar.getAppearance().getVisibleName(), text);
        Collection<L2PcInstance> plrs = activeChar.getKnownList().getKnownPlayers().values();
        for (L2PcInstance player : plrs) {
          if ((player != null)
              && activeChar.isInsideRadius(player, 1250, false, true)
              && !BlockList.isBlocked(player, activeChar)) {
            player.sendPacket(cs);
          }
        }

        activeChar.sendPacket(cs);
      }
    }
  }
Ejemplo n.º 12
0
  private boolean checkTeleport(L2PcInstance player) {
    final L2Party party = player.getParty();

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

    if (!party.isLeader(player)) {
      player.sendPacket(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER);
      return false;
    }

    for (L2PcInstance partyMember : party.getMembers()) {
      if (partyMember.getLevel() < 78) {
        final SystemMessage sm =
            SystemMessage.getSystemMessage(SystemMessageId.C1_LEVEL_REQUIREMENT_NOT_SUFFICIENT);
        sm.addPcName(partyMember);
        party.broadcastPacket(sm);
        return false;
      }

      if (!Util.checkIfInRange(500, player, partyMember, true)) {
        final SystemMessage sm =
            SystemMessage.getSystemMessage(
                SystemMessageId.C1_IS_IN_LOCATION_THAT_CANNOT_BE_ENTERED);
        sm.addPcName(partyMember);
        party.broadcastPacket(sm);
        return false;
      }

      if (InstanceManager.getInstance().getPlayerWorld(player) != null) {
        final SystemMessage sm =
            SystemMessage.getSystemMessage(
                SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER);
        sm.addPcName(partyMember);
        party.broadcastPacket(sm);
        return false;
      }

      Long reentertime =
          InstanceManager.getInstance().getInstanceTime(partyMember.getObjectId(), TEMPLATE_ID);
      if (System.currentTimeMillis() < reentertime) {
        SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_REENTER_YET);
        sm.addPcName(partyMember);
        party.broadcastPacket(sm);
        return false;
      }

      if (partyMember.getInventory().getInventoryItemCount(SEAL_BREAKER_5, -1, false) < 1) {
        SystemMessage sm =
            SystemMessage.getSystemMessage(SystemMessageId.C1_QUEST_REQUIREMENT_NOT_SUFFICIENT);
        sm.addPcName(partyMember);
        party.broadcastPacket(sm);
        return false;
      }
    }
    return true;
  }
Ejemplo n.º 13
0
  /**
   * Claims the hero status for the given player.
   *
   * @param player the player to become hero
   */
  public void claimHero(L2PcInstance player) {
    _heroes.get(player.getObjectId()).set(CLAIMED, true);

    final L2Clan clan = player.getClan();
    if ((clan != null) && (clan.getLevel() >= 5)) {
      clan.addReputationScore(Config.HERO_POINTS, true);
      final SystemMessage sm =
          SystemMessage.getSystemMessage(
              SystemMessageId.CLAN_MEMBER_C1_BECAME_HERO_AND_GAINED_S2_REPUTATION_POINTS);
      sm.addString(CharNameTable.getInstance().getNameById(player.getObjectId()));
      sm.addInt(Config.HERO_POINTS);
      clan.broadcastToOnlineMembers(sm);
    }

    player.setHero(true);
    player.broadcastPacket(new SocialAction(player.getObjectId(), 20016)); // Hero Animation
    player.sendPacket(new UserInfo(player));
    player.sendPacket(new ExBrExtraUserInfo(player));
    player.broadcastUserInfo();
    // Set Gained hero and reload data
    setHeroGained(player.getObjectId());
    loadFights(player.getObjectId());
    loadDiary(player.getObjectId());
    _heroMessage.put(player.getObjectId(), "");

    updateHeroes(false);
  }
Ejemplo n.º 14
0
  private void remove(L2PcInstance activeChar, L2PcInstance playerInstance) {
    if (!TvTEvent.removeParticipant(playerInstance.getObjectId())) {
      activeChar.sendMessage("Player is not part of the event!");
      return;
    }

    new TvTEventTeleporter(
        playerInstance, Config.TVT_EVENT_PARTICIPATION_NPC_COORDINATES, true, true);
  }
Ejemplo n.º 15
0
  private void add(L2PcInstance activeChar, L2PcInstance playerInstance) {
    if (TvTEvent.isPlayerParticipant(playerInstance.getObjectId())) {
      activeChar.sendMessage("Player already participated in the event!");
      return;
    }

    if (!TvTEvent.addParticipant(playerInstance)) {
      activeChar.sendMessage("Player instance could not be added, it seems to be null!");
      return;
    }

    if (TvTEvent.isStarted()) {
      new TvTEventTeleporter(
          playerInstance,
          TvTEvent.getParticipantTeamCoordinates(playerInstance.getObjectId()),
          true,
          false);
    }
  }
Ejemplo n.º 16
0
  @Override
  protected final void handleDisconnect(L2PcInstance player) {
    Participant par;
    for (int i = _teamOneSize; --i >= 0; ) {
      par = _teamOne[i];
      if (par.getObjectId() == player.getObjectId()) {
        par.setDisconnected(true);
        return;
      }
    }

    for (int i = _teamTwoSize; --i >= 0; ) {
      par = _teamTwo[i];
      if (par.getObjectId() == player.getObjectId()) {
        par.setDisconnected(true);
        return;
      }
    }
  }
 @Override
 protected final void writeImpl() {
   writeC(0xfe);
   writeH(0x6e);
   writeD(_activeChar.getObjectId());
   writeD(_shipObjId);
   writeD(x);
   writeD(y);
   writeD(z);
   writeD(h);
 }
Ejemplo n.º 18
0
  @Override
  protected void runImpl() {
    final L2PcInstance player = getClient().getActiveChar();
    if (player == null) return;

    final TradeList trade = player.getActiveTradeList();
    if (trade == null) {
      _log.warning(
          "Character: "
              + player.getName()
              + " requested item:"
              + _objectId
              + " add without active tradelist:"
              + _tradeId);
      return;
    }

    final L2PcInstance partner = trade.getPartner();
    if (partner == null
        || L2World.getInstance().getPlayer(partner.getObjectId()) == null
        || partner.getActiveTradeList() == null) {
      // Trade partner not found, cancel trade
      if (partner != null)
        _log.warning(
            "Character:" + player.getName() + " requested invalid trade object: " + _objectId);
      SystemMessage msg = new SystemMessage(SystemMessageId.TARGET_IS_NOT_FOUND_IN_THE_GAME);
      player.sendPacket(msg);
      player.cancelActiveTrade();
      return;
    }

    if (trade.isConfirmed() || partner.getActiveTradeList().isConfirmed()) {
      player.sendPacket(
          new SystemMessage(SystemMessageId.CANNOT_ADJUST_ITEMS_AFTER_TRADE_CONFIRMED));
      return;
    }

    if (!player.getAccessLevel().allowTransaction()) {
      player.sendMessage("Transactions are disable for your Access Level");
      player.cancelActiveTrade();
      return;
    }

    if (!player.validateItemManipulation(_objectId, "trade")) {
      player.sendPacket(new SystemMessage(SystemMessageId.NOTHING_HAPPENED));
      return;
    }

    final TradeList.TradeItem item = trade.addItem(_objectId, _count);
    if (item != null) {
      player.sendPacket(new TradeOwnAdd(item));
      trade.getPartner().sendPacket(new TradeOtherAdd(item));
    }
  }
Ejemplo n.º 19
0
  // @formatter:off
  @RegisterEvent(EventType.ON_NPC_MANOR_BYPASS)
  @RegisterType(ListenerRegisterType.NPC)
  @Id({35100, 35142, 35184, 35226, 35274, 35316, 35363, 35509, 35555})
  // @formatter:on
  public final void onNpcManorBypass(OnNpcManorBypass evt) {
    final L2PcInstance player = evt.getActiveChar();
    final L2Npc npc = evt.getTarget();
    if (isOwner(player, npc)) {
      final CastleManorManager manor = CastleManorManager.getInstance();
      if (manor.isUnderMaintenance()) {
        player.sendPacket(SystemMessageId.THE_MANOR_SYSTEM_IS_CURRENTLY_UNDER_MAINTENANCE);
        return;
      }

      final int castleId =
          (evt.getManorId() == -1) ? npc.getCastle().getResidenceId() : evt.getManorId();
      switch (evt.getRequest()) {
        case 3: // Seed info
          player.sendPacket(new ExShowSeedInfo(castleId, evt.isNextPeriod(), true));
          break;
        case 4: // Crop info
          player.sendPacket(new ExShowCropInfo(castleId, evt.isNextPeriod(), true));
          break;
        case 5: // Basic info
          player.sendPacket(new ExShowManorDefaultInfo(true));
          break;
        case 7: // Seed settings
          if (manor.isManorApproved()) {
            player.sendPacket(SystemMessageId.A_MANOR_CANNOT_BE_SET_UP_BETWEEN_4_30_AM_AND_8_PM);
            return;
          }
          player.sendPacket(new ExShowSeedSetting(castleId));
          break;
        case 8: // Crop settings
          if (manor.isManorApproved()) {
            player.sendPacket(SystemMessageId.A_MANOR_CANNOT_BE_SET_UP_BETWEEN_4_30_AM_AND_8_PM);
            return;
          }
          player.sendPacket(new ExShowCropSetting(castleId));
          break;
        default:
          _log.warning(
              getClass().getSimpleName()
                  + ": Player "
                  + player.getName()
                  + " ("
                  + player.getObjectId()
                  + ") send unknown request id "
                  + evt.getRequest()
                  + "!");
      }
    }
  }
  @Override
  protected void runImpl() {
    final L2PcInstance activeChar = getClient().getActiveChar();

    if ((activeChar == null) || (activeChar.getClan() != null)) {
      return;
    }

    final L2Clan clan = ClanTable.getInstance().getClan(_clanId);

    if (clan == null) {
      return;
    }

    final PledgeApplicantInfo info =
        new PledgeApplicantInfo(
            activeChar.getObjectId(),
            activeChar.getName(),
            activeChar.getLevel(),
            _karma,
            _clanId,
            _message);

    if (ClanEntryManager.getInstance().addPlayerApplicationToClan(_clanId, info)) {
      activeChar.sendPacket(new ExPledgeRecruitApplyInfo(ClanEntryStatus.WAITING));

      final L2PcInstance clanLeader = L2World.getInstance().getPlayer(clan.getLeaderId());

      if (clanLeader != null) {
        clanLeader.sendPacket(ExPledgeWaitingListAlarm.STATIC_PACKET);
      }
    } else {
      final SystemMessage sm =
          SystemMessage.getSystemMessage(
              SystemMessageId
                  .YOU_MAY_APPLY_FOR_ENTRY_AFTER_S1_MINUTE_S_DUE_TO_CANCELLING_YOUR_APPLICATION);
      sm.addLong(ClanEntryManager.getInstance().getPlayerLockTime(activeChar.getObjectId()));
      activeChar.sendPacket(sm);
    }
  }
Ejemplo n.º 21
0
 @Override
 public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) {
   ((MDWorld) world).toyron =
       (L2QuestGuardInstance)
           addSpawn(TOYRON, TOYRON_SPAWN_LOC, false, 0, false, world.getInstanceId());
   ((MDWorld) world).toyron.setSpawn(null);
   if (firstEntrance) {
     world.addAllowed(player.getObjectId());
     ((MDWorld) world).deskSpawns = spawnGroup("desks", world.getInstanceId());
     ((MDWorld) world).randomDesk = getRandom(3) + 1;
   }
   teleportPlayer(player, START_LOC, world.getInstanceId());
 }
Ejemplo n.º 22
0
  private void enterInstance(L2PcInstance player, String template) {
    InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);

    if (world != null) {
      if (world instanceof DPFWorld) {
        teleportPlayer(player, ENTRY_POINT, world.getInstanceId());
        return;
      }
      player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER);
      return;
    }

    if (!checkTeleport(player)) {
      return;
    }

    world = new DPFWorld();
    world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
    world.setTemplateId(TEMPLATE_ID);
    world.addAllowed(player.getObjectId());
    world.setStatus(0);
    InstanceManager.getInstance().addWorld(world);
    teleportPlayer(player, ENTRY_POINT, world.getInstanceId());

    _log.info(
        "Tower of Infinitum - Demon Prince floor started "
            + template
            + " Instance: "
            + world.getInstanceId()
            + " created by player: "
            + player.getName());

    for (L2PcInstance partyMember : player.getParty().getMembers()) {
      teleportPlayer(partyMember, ENTRY_POINT, world.getInstanceId());
      partyMember.destroyItemByItemId("Quest", SEAL_BREAKER_5, 1, null, true);
      world.addAllowed(partyMember.getObjectId());
    }
  }
Ejemplo n.º 23
0
  /**
   * Try to broadcast SocialAction packet.
   *
   * @param id the social action Id to broadcast
   */
  private void tryBroadcastSocial(int id) {
    final L2PcInstance activeChar = getActiveChar();
    if (activeChar == null) {
      return;
    }
    if (activeChar.isFishing()) {
      sendPacket(SystemMessageId.YOU_CANNOT_DO_THAT_WHILE_FISHING);
      return;
    }

    if (activeChar.canMakeSocialAction()) {
      activeChar.broadcastPacket(new SocialAction(activeChar.getObjectId(), id));
    }
  }
Ejemplo n.º 24
0
  /**
   * UnAfraid: TODO: We should calculate the damage in array separately for each player so we can
   * display it on ExOlympiadMatchResult correctly.
   */
  @Override
  protected final void addDamage(L2PcInstance player, int damage) {
    Participant par;
    for (int i = _teamOneSize; --i >= 0; ) {
      par = _teamOne[i];
      if (par.getObjectId() == player.getObjectId()) {
        if (!par.isDisconnected()) {
          _damageT1 += damage;
        }
        return;
      }
    }

    for (int i = _teamTwoSize; --i >= 0; ) {
      par = _teamTwo[i];
      if (par.getObjectId() == player.getObjectId()) {
        if (!par.isDisconnected()) {
          _damageT2 += damage;
        }
        return;
      }
    }
  }
Ejemplo n.º 25
0
 public void handleCheat(L2PcInstance player, L2Npc npc) {
   showHtmlFile(player, "data/html/seven_signs/rift/Cheater.htm", npc);
   if (!player.isGM()) {
     _log.warning(
         "Player "
             + player.getName()
             + "("
             + player.getObjectId()
             + ") was cheating in dimension rift area!");
     Util.handleIllegalPlayerAction(
         player,
         "Warning!! Character " + player.getName() + " tried to cheat in dimensional rift.",
         Config.DEFAULT_PUNISH);
   }
 }
Ejemplo n.º 26
0
 @Override
 public boolean useAdminCommand(String command, L2PcInstance activeChar) {
   if (command.equals("admin_gm") && activeChar.isGM()) {
     AdminData.getInstance().deleteGm(activeChar);
     activeChar.setAccessLevel(0, true);
     activeChar.sendMessage("You no longer have GM status.");
     _log.info(
         "GM: "
             + activeChar.getName()
             + "("
             + activeChar.getObjectId()
             + ") turned his GM status off");
   }
   return true;
 }
Ejemplo n.º 27
0
 public final void updatePointsInDB(L2PcInstance player, int raidId, int points) {
   try (Connection con = L2DatabaseFactory.getInstance().getConnection();
       PreparedStatement ps =
           con.prepareStatement(
               "REPLACE INTO character_raid_points (`charId`,`boss_id`,`points`) VALUES (?,?,?)")) {
     ps.setInt(1, player.getObjectId());
     ps.setInt(2, raidId);
     ps.setInt(3, points);
     ps.executeUpdate();
   } catch (Exception e) {
     _log.log(
         Level.WARNING,
         getClass().getSimpleName() + ": Couldn't update char raid points for player: " + player,
         e);
   }
 }
  @Override
  protected void runImpl() {
    L2PcInstance activeChar = getClient().getActiveChar();
    if (activeChar == null) {
      return;
    }

    if ((SevenSigns.getInstance().isSealValidationPeriod()
            || SevenSigns.getInstance().isCompResultsPeriod())
        && (_page == 4)) {
      return;
    }

    SSQStatus ssqs = new SSQStatus(activeChar.getObjectId(), _page);
    activeChar.sendPacket(ssqs);
  }
Ejemplo n.º 29
0
  public boolean add(String name) {
    SystemMessage sm;

    int contactId = CharNameTable.getInstance().getIdByName(name);
    if (_contacts.contains(name)) {
      activeChar.sendPacket(SystemMessageId.NAME_ALREADY_EXIST_ON_CONTACT_LIST);
      return false;
    } else if (activeChar.getName().equals(name)) {
      activeChar.sendPacket(SystemMessageId.CANNOT_ADD_YOUR_NAME_ON_CONTACT_LIST);
      return false;
    } else if (_contacts.size() >= 100) {
      activeChar.sendPacket(SystemMessageId.CONTACT_LIST_LIMIT_REACHED);
      return false;
    } else if (contactId < 1) {
      sm = SystemMessage.getSystemMessage(SystemMessageId.NAME_S1_NOT_EXIST_TRY_ANOTHER_NAME);
      sm.addString(name);
      activeChar.sendPacket(sm);
      return false;
    } else {
      for (String contactName : _contacts) {
        if (contactName.equalsIgnoreCase(name)) {
          activeChar.sendPacket(SystemMessageId.NAME_ALREADY_EXIST_ON_CONTACT_LIST);
          return false;
        }
      }
    }

    try (Connection con = ConnectionFactory.getInstance().getConnection();
        PreparedStatement ps = con.prepareStatement(QUERY_ADD)) {
      ps.setInt(1, activeChar.getObjectId());
      ps.setInt(2, contactId);
      ps.execute();

      _contacts.add(name);

      sm = SystemMessage.getSystemMessage(SystemMessageId.S1_SUCCESSFULLY_ADDED_TO_CONTACT_LIST);
      sm.addString(name);
      activeChar.sendPacket(sm);
    } catch (Exception e) {
      _log.log(
          Level.WARNING,
          "Error found in " + activeChar.getName() + "'s ContactsList: " + e.getMessage(),
          e);
    }
    return true;
  }
  @Override
  public String onTalk(L2Npc npc, L2PcInstance talker) {
    final QuestState qs =
        talker.getQuestState(Q00196_SevenSignsSealOfTheEmperor.class.getSimpleName());
    String htmltext = getNoQuestMsg(talker);
    if (qs == null) {
      return htmltext;
    }

    switch (npc.getId()) {
      case PROMISE_OF_MAMMON:
        {
          if (qs.isCond(3) || qs.isCond(4)) {
            enterInstance(talker, new DNPWorld(), "DisciplesNecropolisPast.xml", TEMPLATE_ID);
            return "";
          }
          break;
        }
      case LEON:
        {
          if (qs.getCond() >= 3) {
            takeItems(talker, SACRED_SWORD_OF_EINHASAD, -1);
            InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(talker);
            world.removeAllowed(talker.getObjectId());
            talker.teleToLocation(EXIT, 0);
            htmltext = "32587-01.html";
          }
          break;
        }
      case DISCIPLES_GATEKEEPER:
        {
          if (qs.getCond() >= 3) {
            InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
            if (tmpworld instanceof DNPWorld) {
              DNPWorld world = (DNPWorld) tmpworld;
              openDoor(DISCIPLES_NECROPOLIS_DOOR, world.getInstanceId());
              talker.showQuestMovie(12);
              startQuestTimer("FIGHT", 1000, null, talker);
            }
          }
          break;
        }
    }
    return htmltext;
  }