Пример #1
0
 /**
  * @param activeChar
  * @param player
  */
 private void gatherCharacterInfo(L2PcInstance activeChar, L2PcInstance player, String filename) {
   String ip = "N/A";
   String account = "N/A";
   try {
     String clientInfo = player.getClient().toString();
     account =
         clientInfo.substring(clientInfo.indexOf("Account: ") + 9, clientInfo.indexOf(" - IP: "));
     ip = clientInfo.substring(clientInfo.indexOf(" - IP: ") + 7, clientInfo.lastIndexOf("]"));
   } catch (Exception e) {
   }
   NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
   adminReply.setFile("data/html/admin/" + filename);
   adminReply.replace("%name%", player.getName());
   adminReply.replace("%level%", String.valueOf(player.getLevel()));
   adminReply.replace(
       "%clan%", String.valueOf(ClanTable.getInstance().getClan(player.getClanId())));
   adminReply.replace("%xp%", String.valueOf(player.getExp()));
   adminReply.replace("%sp%", String.valueOf(player.getSp()));
   adminReply.replace("%class%", player.getTemplate().className);
   adminReply.replace("%ordinal%", String.valueOf(player.getClassId().ordinal()));
   adminReply.replace("%classid%", String.valueOf(player.getClassId()));
   adminReply.replace("%x%", String.valueOf(player.getX()));
   adminReply.replace("%y%", String.valueOf(player.getY()));
   adminReply.replace("%z%", String.valueOf(player.getZ()));
   adminReply.replace("%currenthp%", String.valueOf((int) player.getCurrentHp()));
   adminReply.replace("%maxhp%", String.valueOf(player.getMaxHp()));
   adminReply.replace("%karma%", String.valueOf(player.getKarma()));
   adminReply.replace("%currentmp%", String.valueOf((int) player.getCurrentMp()));
   adminReply.replace("%maxmp%", String.valueOf(player.getMaxMp()));
   adminReply.replace("%pvpflag%", String.valueOf(player.getPvpFlag()));
   adminReply.replace("%currentcp%", String.valueOf((int) player.getCurrentCp()));
   adminReply.replace("%maxcp%", String.valueOf(player.getMaxCp()));
   adminReply.replace("%pvpkills%", String.valueOf(player.getPvpKills()));
   adminReply.replace("%pkkills%", String.valueOf(player.getPkKills()));
   adminReply.replace("%currentload%", String.valueOf(player.getCurrentLoad()));
   adminReply.replace("%maxload%", String.valueOf(player.getMaxLoad()));
   adminReply.replace(
       "%percent%",
       String.valueOf(
           Util.roundTo(
               ((float) player.getCurrentLoad() / (float) player.getMaxLoad()) * 100, 2)));
   adminReply.replace("%patk%", String.valueOf(player.getPAtk(null)));
   adminReply.replace("%matk%", String.valueOf(player.getMAtk(null, null)));
   adminReply.replace("%pdef%", String.valueOf(player.getPDef(null)));
   adminReply.replace("%mdef%", String.valueOf(player.getMDef(null, null)));
   adminReply.replace("%accuracy%", String.valueOf(player.getAccuracy()));
   adminReply.replace("%evasion%", String.valueOf(player.getEvasionRate(null)));
   adminReply.replace("%critical%", String.valueOf(player.getCriticalHit(null, null)));
   adminReply.replace("%runspeed%", String.valueOf(player.getRunSpeed()));
   adminReply.replace("%patkspd%", String.valueOf(player.getPAtkSpd()));
   adminReply.replace("%matkspd%", String.valueOf(player.getMAtkSpd()));
   adminReply.replace("%access%", String.valueOf(player.getAccessLevel().getLevel()));
   adminReply.replace("%account%", account);
   adminReply.replace("%ip%", ip);
   activeChar.sendPacket(adminReply);
 }
Пример #2
0
  /**
   * Increase the number of kills.<br>
   * In case actual counter reaches the number generated to reach next stage, than rank up the CW.
   */
  public void increaseKills() {
    if (_player != null && _player.isOnline()) {
      _nbKills++;
      _hungryTime = _durationLost * 60;

      _player.setPkKills(_player.getPkKills() + 1);
      _player.sendPacket(new UserInfo(_player));

      // If current number of kills is >= to the given number, than rankUp the weapon.
      if (_nbKills >= _numberBeforeNextStage) {
        // Reset the number of kills to 0.
        _nbKills = 0;

        // Setup the new random number.
        _numberBeforeNextStage =
            Rnd.get((int) Math.round(_stageKills * 0.5), (int) Math.round(_stageKills * 1.5));

        // Rank up the CW.
        rankUp();
      }
    }
  }
Пример #3
0
  public void activate(L2PcInstance player, ItemInstance item) {
    // if the player is mounted, attempt to unmount first and pick it if successful.
    if (player.isMounted() && !player.dismount()) {
      player.sendPacket(
          SystemMessage.getSystemMessage(SystemMessageId.FAILED_TO_PICKUP_S1)
              .addItemName(item.getItemId()));
      item.setDestroyProtected(true);
      player.dropItem("InvDrop", item, null, true);
      return;
    }

    _isActivated = true;

    // Hold player data.
    _player = player;
    _playerId = _player.getObjectId();
    _playerKarma = _player.getKarma();
    _playerPkKills = _player.getPkKills();

    _item = item;

    // Generate a random number for next stage.
    _numberBeforeNextStage =
        Rnd.get((int) Math.round(_stageKills * 0.5), (int) Math.round(_stageKills * 1.5));

    // Renew hungry time.
    _hungryTime = _durationLost * 60;

    // Activate the daily timer.
    _dailyTimerTask =
        ThreadPoolManager.getInstance()
            .scheduleGeneralAtFixedRate(new DailyTimerTask(), 60000L, 60000L);

    // Cancel the "1h dropped CW" timer.
    cancelDropTimerTask();

    insertData();

    // Change player stats
    _player.setCursedWeaponEquippedId(_itemId);
    _player.setKarma(9999999);
    _player.setPkKills(0);

    if (_player.isInParty()) _player.getParty().removePartyMember(_player, MessageType.Expelled);

    // Disable active toggles
    for (L2Effect effect : _player.getAllEffects()) {
      if (effect.getSkill().isToggle()) effect.exit();
    }

    // Add CW skills
    giveDemonicSkills();

    // Equip the weapon
    _player.useEquippableItem(_item, true);

    // Fully heal player
    _player.setCurrentHpMp(_player.getMaxHp(), _player.getMaxMp());
    _player.setCurrentCp(_player.getMaxCp());

    // Refresh player stats
    _player.broadcastUserInfo();

    // _player.broadcastPacket(new SocialAction(_player, 17));
    Broadcast.toAllOnlinePlayers(
        SystemMessage.getSystemMessage(
                SystemMessageId.THE_OWNER_OF_S2_HAS_APPEARED_IN_THE_S1_REGION)
            .addZoneName(_player.getX(), _player.getY(), _player.getZ())
            .addItemName(_item.getItemId()));
  }