コード例 #1
0
  @Override
  public void onStart(BuffInfo info) {
    L2Character target = info.getEffected();
    if ((target == null) || target.isDead() || target.isDoor()) {
      return;
    }

    double amount = 0;
    double power = _power;
    boolean full = (power == 100.0);

    amount = full ? target.getMaxMp() : (target.getMaxMp() * power) / 100.0;
    // Prevents overheal and negative amount
    amount = Math.max(Math.min(amount, target.getMaxRecoverableMp() - target.getCurrentMp()), 0);
    if (amount != 0) {
      target.setCurrentMp(amount + target.getCurrentMp());
    }
    SystemMessage sm;
    if (info.getEffector().getObjectId() != target.getObjectId()) {
      sm = SystemMessage.getSystemMessage(SystemMessageId.S2_MP_RESTORED_BY_C1);
      sm.addCharName(info.getEffector());
    } else {
      sm = SystemMessage.getSystemMessage(SystemMessageId.S1_MP_RESTORED);
    }
    sm.addInt((int) amount);
    target.sendPacket(sm);
  }
コード例 #2
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;
  }
コード例 #3
0
  @Override
  public boolean doDie(L2Character killer) {
    if (!super.doDie(killer)) {
      return false;
    }

    final L2PcInstance player = killer.getActingPlayer();
    if (player != null) {
      broadcastPacket(
          SystemMessage.getSystemMessage(SystemMessageId.CONGRATULATIONS_YOUR_RAID_WAS_SUCCESSFUL));
      if (player.getParty() != null) {
        for (L2PcInstance member : player.getParty().getMembers()) {
          member.setRaidPoints(member.getRaidPoints() + ((getLevel() / 2) + Rnd.get(-5, 5)));
          if (member.isNoble()) {
            Hero.getInstance().setRBkilled(member.getObjectId(), getId());
          }
        }
      } else {
        player.setRaidPoints(player.getRaidPoints() + ((getLevel() / 2) + Rnd.get(-5, 5)));
        if (player.isNoble()) {
          Hero.getInstance().setRBkilled(player.getObjectId(), getId());
        }
      }
    }

    RaidBossSpawnManager.getInstance().updateStatus(this, true);
    return true;
  }
コード例 #4
0
ファイル: L2ContactList.java プロジェクト: ailian8415/l2mx
  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);
    }
  }
コード例 #5
0
ファイル: Hero.java プロジェクト: LucusAngel/L2J_Server_BETA
  /**
   * 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);
  }
コード例 #6
0
  /** @see com.l2jserver.gameserver.model.L2Effect#onActionTime() */
  @Override
  public boolean onActionTime() {
    if (getCount() == getTotalCount() - 1) return true; // do nothing first time
    int mpConsume = getSkill().getMpConsume();

    L2PcInstance caster = (L2PcInstance) getEffector();

    for (L2Character cha :
        _actor.getKnownList().getKnownCharactersInRadius(getSkill().getSkillRadius())) {
      if (cha == null) continue;

      if (cha instanceof L2Playable) {
        if (caster.canAttackCharacter(cha)) {
          L2PcInstance owner = null;
          if (cha instanceof L2Summon) owner = ((L2Summon) cha).getOwner();
          else owner = (L2PcInstance) cha;

          if (owner != null && owner.getPet() != null) {
            if (mpConsume > getEffector().getCurrentMp()) {
              getEffector()
                  .sendPacket(
                      SystemMessage.getSystemMessage(SystemMessageId.SKILL_REMOVED_DUE_LACK_MP));
              return false;
            } else getEffector().reduceCurrentMp(mpConsume);

            owner.getPet().unSummon(owner);
            owner.getAI().notifyEvent(CtrlEvent.EVT_ATTACKED, getEffector());
          }
        }
      }
    }
    return true;
  }
コード例 #7
0
  public void setReenterTime(InstanceWorld world) {
    if (world instanceof DPFWorld) {
      // Reenter time should be cleared every Wed and Sat at 6:30 AM, so we set next suitable
      Calendar reenter;
      Calendar now = Calendar.getInstance();
      Calendar reenterPointWed = (Calendar) now.clone();
      reenterPointWed.set(Calendar.AM_PM, Calendar.AM);
      reenterPointWed.set(Calendar.MINUTE, RESET_MIN);
      reenterPointWed.set(Calendar.HOUR_OF_DAY, RESET_HOUR);
      reenterPointWed.set(Calendar.DAY_OF_WEEK, Calendar.WEDNESDAY);
      Calendar reenterPointSat = (Calendar) reenterPointWed.clone();
      reenterPointSat.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY);

      if (now.after(reenterPointSat)) {
        reenterPointWed.add(Calendar.WEEK_OF_MONTH, 1);
        reenter = (Calendar) reenterPointWed.clone();
      } else {
        reenter = (Calendar) reenterPointSat.clone();
      }

      SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.INSTANT_ZONE_S1_RESTRICTED);
      sm.addInstanceName(world.getTemplateId());
      // set instance reenter time for all allowed players
      for (int objectId : world.getAllowed()) {
        L2PcInstance player = L2World.getInstance().getPlayer(objectId);
        if ((player != null) && player.isOnline()) {
          InstanceManager.getInstance()
              .setInstanceTime(objectId, world.getTemplateId(), reenter.getTimeInMillis());
          player.sendPacket(sm);
        }
      }
    }
  }
コード例 #8
0
  public static void showFishSkillList(L2PcInstance player) {
    final List<L2SkillLearn> skills =
        SkillTreesData.getInstance().getAvailableFishingSkills(player);
    final AcquireSkillList asl = new AcquireSkillList(AcquireSkillType.FISHING);

    int count = 0;

    for (L2SkillLearn s : skills) {
      final Skill sk = SkillData.getInstance().getSkill(s.getSkillId(), s.getSkillLevel());

      if (sk == null) {
        continue;
      }
      count++;
      asl.addSkill(s.getSkillId(), s.getSkillLevel(), s.getSkillLevel(), s.getLevelUpSp(), 1);
    }

    if (count == 0) {
      final int minlLevel =
          SkillTreesData.getInstance()
              .getMinLevelForNewSkill(player, SkillTreesData.getInstance().getFishingSkillTree());
      if (minlLevel > 0) {
        SystemMessage sm =
            SystemMessage.getSystemMessage(SystemMessageId.DO_NOT_HAVE_FURTHER_SKILLS_TO_LEARN_S1);
        sm.addInt(minlLevel);
        player.sendPacket(sm);
      } else {
        player.sendPacket(SystemMessageId.NO_MORE_SKILLS_TO_LEARN);
      }
    } else {
      player.sendPacket(asl);
    }
  }
コード例 #9
0
  @Override
  public void onStart(BuffInfo info) {
    L2Character target = info.getEffected();
    L2Character activeChar = info.getEffector();
    Skill skill = info.getSkill();

    if (activeChar.isAlikeDead()) {
      return;
    }

    if (((skill.getFlyRadius() > 0) || (skill.getFlyType() != null))
        && activeChar.isMovementDisabled()) {
      final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED);
      sm.addSkillName(skill);
      activeChar.sendPacket(sm);
      return;
    }

    if (target.isPlayer() && target.getActingPlayer().isFakeDeath()) {
      target.stopFakeDeath(true);
    }

    int damage = 0;
    boolean ss = skill.isPhysical() && activeChar.isChargedShot(ShotType.SOULSHOTS);
    final byte shld = Formulas.calcShldUse(activeChar, target, skill);
    // Physical damage critical rate is only affected by STR.
    boolean crit = false;
    if (skill.getBaseCritRate() > 0) {
      crit = Formulas.calcCrit(activeChar, target, skill);
    }

    damage = (int) Formulas.calcPhysDam(activeChar, target, skill, shld, false, ss);

    if ((skill.getMaxSoulConsumeCount() > 0) && activeChar.isPlayer()) {
      // Souls Formula (each soul increase +4%)
      int chargedSouls =
          (activeChar.getActingPlayer().getChargedSouls() <= skill.getMaxSoulConsumeCount())
              ? activeChar.getActingPlayer().getChargedSouls()
              : skill.getMaxSoulConsumeCount();
      damage *= 1 + (chargedSouls * 0.04);
    }
    if (crit) {
      damage *= 2;
    }

    if (damage > 0) {
      activeChar.sendDamageMessage(target, damage, false, crit, false);
      target.reduceCurrentHp(damage, activeChar, skill);
      target.notifyDamageReceived(damage, activeChar, skill, crit, false);

      // Check if damage should be reflected
      Formulas.calcDamageReflected(activeChar, target, skill, crit);
    } else {
      activeChar.sendPacket(SystemMessageId.ATTACK_FAILED);
    }

    if (skill.isSuicideAttack()) {
      activeChar.doDie(activeChar);
    }
  }
コード例 #10
0
ファイル: Sow.java プロジェクト: L2JServer-PVP/L2JDatapack
  /**
   * @see
   *     com.l2jserver.gameserver.handler.ISkillHandler#useSkill(com.l2jserver.gameserver.model.actor.L2Character,
   *     com.l2jserver.gameserver.model.L2Skill, com.l2jserver.gameserver.model.L2Object[])
   */
  public void useSkill(L2Character activeChar, L2Skill skill, L2Object[] targets) {
    if (!(activeChar instanceof L2PcInstance)) return;

    final L2Object[] targetList = skill.getTargetList(activeChar);
    if (targetList == null || targetList.length == 0) return;

    if (Config.DEBUG) _log.info("Casting sow");

    L2MonsterInstance target;

    for (L2Object tgt : targetList) {
      if (!(tgt instanceof L2MonsterInstance)) continue;

      target = (L2MonsterInstance) tgt;
      if (target.isDead()
          || target.isSeeded()
          || target.getSeederId() != activeChar.getObjectId()) {
        activeChar.sendPacket(ActionFailed.STATIC_PACKET);
        continue;
      }

      final int seedId = target.getSeedType();
      if (seedId == 0) {
        activeChar.sendPacket(ActionFailed.STATIC_PACKET);
        continue;
      }

      // Consuming used seed
      if (!activeChar.destroyItemByItemId("Consume", seedId, 1, target, false)) {
        activeChar.sendPacket(ActionFailed.STATIC_PACKET);
        return;
      }

      SystemMessage sm;
      if (calcSuccess(activeChar, target, seedId)) {
        activeChar.sendPacket(new PlaySound("Itemsound.quest_itemget"));
        target.setSeeded((L2PcInstance) activeChar);
        sm = SystemMessage.getSystemMessage(SystemMessageId.THE_SEED_WAS_SUCCESSFULLY_SOWN);
      } else sm = SystemMessage.getSystemMessage(SystemMessageId.THE_SEED_WAS_NOT_SOWN);

      if (activeChar.getParty() == null) activeChar.sendPacket(sm);
      else activeChar.getParty().broadcastToPartyMembers(sm);

      // TODO: Mob should not aggro on player, this way doesn't work really nice
      target.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
    }
  }
コード例 #11
0
ファイル: L2ContactList.java プロジェクト: ailian8415/l2mx
  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;
  }
コード例 #12
0
  private static final boolean checkAndChangeClass(L2PcInstance player, int val) {
    final ClassId currentClassId = player.getClassId();
    if (getMinLevel(currentClassId.level()) > player.getLevel() && !Config.ALLOW_ENTIRE_TREE)
      return false;

    if (!validateClassId(currentClassId, val)) return false;

    int newJobLevel = currentClassId.level() + 1;

    // Weight/Inventory check
    if (!Config.CLASS_MASTER_SETTINGS.getRewardItems(newJobLevel).isEmpty()
        && !player.isInventoryUnder80(false)) {
      player.sendPacket(
          SystemMessage.getSystemMessage(SystemMessageId.INVENTORY_LESS_THAN_80_PERCENT));
      return false;
    }

    // check if player have all required items for class transfer
    for (int _itemId : Config.CLASS_MASTER_SETTINGS.getRequireItems(newJobLevel).keys()) {
      int _count = Config.CLASS_MASTER_SETTINGS.getRequireItems(newJobLevel).get(_itemId);
      if (player.getInventory().getInventoryItemCount(_itemId, -1) < _count) {
        player.sendPacket(SystemMessageId.NOT_ENOUGH_ITEMS);
        return false;
      }
    }

    // get all required items for class transfer
    for (int _itemId : Config.CLASS_MASTER_SETTINGS.getRequireItems(newJobLevel).keys()) {
      int _count = Config.CLASS_MASTER_SETTINGS.getRequireItems(newJobLevel).get(_itemId);
      if (!player.destroyItemByItemId("ClassMaster", _itemId, _count, player, true)) return false;
    }

    // reward player with items
    for (int _itemId : Config.CLASS_MASTER_SETTINGS.getRewardItems(newJobLevel).keys()) {
      int _count = Config.CLASS_MASTER_SETTINGS.getRewardItems(newJobLevel).get(_itemId);
      player.addItem("ClassMaster", _itemId, _count, player, true);
    }

    player.setClassId(val);

    if (player.isSubClassActive())
      player.getSubClasses().get(player.getClassIndex()).setClassId(player.getActiveClass());
    else player.setBaseClass(player.getActiveClass());

    Quest q = QuestManager.getInstance().getQuest("SkillTransfer");
    if (q != null) q.startQuestTimer("givePormanders", 1, null, player);

    player.broadcastUserInfo();

    if (Config.CLASS_MASTER_SETTINGS.isAllowed(player.getClassId().level() + 1)
        && Config.ALTERNATE_CLASS_MASTER
        && ((player.getClassId().level() == 1 && player.getLevel() >= 40)
            || (player.getClassId().level() == 2 && player.getLevel() >= 76)))
      showQuestionMark(player);

    return true;
  }
コード例 #13
0
ファイル: ClanGate.java プロジェクト: Stmol/L2J_DataPack
 @Override
 public void onStart(BuffInfo info) {
   if (info.getEffected().isPlayer()) {
     final L2Clan clan = info.getEffected().getActingPlayer().getClan();
     if (clan != null) {
       SystemMessage msg =
           SystemMessage.getSystemMessage(SystemMessageId.COURT_MAGICIAN_CREATED_PORTAL);
       clan.broadcastToOtherOnlineMembers(msg, info.getEffected().getActingPlayer());
     }
   }
 }
コード例 #14
0
ファイル: PetStat.java プロジェクト: 3mRe/L2Java
  public boolean addExpAndSp(long addToExp, long addToSp) {
    if (getActiveChar().isUncontrollable() || !addExp(addToExp)) {
      return false;
    }

    SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOUR_PET_GAINED_S1_XP);
    sm.addLong(addToExp);
    getActiveChar().updateAndBroadcastStatus(1);
    getActiveChar().sendPacket(sm);
    return true;
  }
コード例 #15
0
ファイル: OlympiadStat.java プロジェクト: Stmol/L2J_DataPack
  @Override
  public boolean useUserCommand(int id, L2PcInstance activeChar) {
    if (id != COMMAND_IDS[0]) {
      return false;
    }

    int nobleObjId = activeChar.getObjectId();
    final L2Object target = activeChar.getTarget();
    if (target != null) {
      if (target.isPlayer() && target.getActingPlayer().isNoble()) {
        nobleObjId = target.getObjectId();
      } else {
        activeChar.sendPacket(SystemMessageId.NOBLESSE_ONLY);
        return false;
      }
    } else if (!activeChar.isNoble()) {
      activeChar.sendPacket(SystemMessageId.NOBLESSE_ONLY);
      return false;
    }

    final SystemMessage sm =
        SystemMessage.getSystemMessage(
            SystemMessageId
                .THE_CURRENT_RECORD_FOR_THIS_OLYMPIAD_SESSION_IS_S1_MATCHES_S2_WINS_S3_DEFEATS_YOU_HAVE_EARNED_S4_OLYMPIAD_POINTS);
    sm.addInt(Olympiad.getInstance().getCompetitionDone(nobleObjId));
    sm.addInt(Olympiad.getInstance().getCompetitionWon(nobleObjId));
    sm.addInt(Olympiad.getInstance().getCompetitionLost(nobleObjId));
    sm.addInt(Olympiad.getInstance().getNoblePoints(nobleObjId));
    activeChar.sendPacket(sm);

    final SystemMessage sm2 =
        SystemMessage.getSystemMessage(
            SystemMessageId
                .YOU_HAVE_S1_MATCHES_REMAINING_THAT_YOU_CAN_PARTECIPATE_IN_THIS_WEEK_S2_CLASSED_S3_NON_CLASSED_S4_TEAM);
    sm2.addInt(Olympiad.getInstance().getRemainingWeeklyMatches(nobleObjId));
    sm2.addInt(Olympiad.getInstance().getRemainingWeeklyMatchesClassed(nobleObjId));
    sm2.addInt(Olympiad.getInstance().getRemainingWeeklyMatchesNonClassed(nobleObjId));
    sm2.addInt(Olympiad.getInstance().getRemainingWeeklyMatchesTeam(nobleObjId));
    activeChar.sendPacket(sm2);
    return true;
  }
コード例 #16
0
ファイル: Duel.java プロジェクト: 3mRe/L2Java
  /**
   * Do the countdown and send message to players if necessary
   *
   * @return current count
   */
  public int countdown() {
    _countdown--;

    if (_countdown > 3) {
      return _countdown;
    }

    // Broadcast countdown to duelists
    SystemMessage sm = null;
    if (_countdown > 0) {
      sm = SystemMessage.getSystemMessage(SystemMessageId.THE_DUEL_WILL_BEGIN_IN_S1_SECOND_S);
      sm.addInt(_countdown);
    } else {
      sm = SystemMessage.getSystemMessage(SystemMessageId.LET_THE_DUEL_BEGIN);
    }

    broadcastToTeam1(sm);
    broadcastToTeam2(sm);

    return _countdown;
  }
コード例 #17
0
 @Override
 public void run() {
   if (_player != null) {
     if (_player.isOnline()) {
       final long hours = TimeUnit.MILLISECONDS.toHours(_player.getUptime());
       _player.sendPacket(
           SystemMessage.getSystemMessage(
                   SystemMessageId.YOU_HAVE_PLAYED_FOR_S1_HOUR_S_PLEASE_TAKE_A_BREAK)
               .addLong(hours));
     } else {
       _player.stopWarnUserTakeBreak();
     }
   }
 }
コード例 #18
0
ファイル: ClanTrader.java プロジェクト: GT-Games/Lineage-II
  private String giveReputation(
      L2Npc npc, L2PcInstance player, int count, int itemId, int itemCount) {
    if (getQuestItemsCount(player, itemId) >= itemCount) {
      takeItems(player, itemId, itemCount);
      player.getClan().addReputationScore(count, true);

      final SystemMessage sm =
          SystemMessage.getSystemMessage(
              SystemMessageId.YOUR_CLAN_HAS_ADDED_S1_POINT_S_TO_ITS_CLAN_REPUTATION);
      sm.addInt(count);
      player.sendPacket(sm);
      return npc.getId() + "-04.html";
    }
    return npc.getId() + "-03.html";
  }
コード例 #19
0
ファイル: MultisellData.java プロジェクト: ailian8415/l2mx
 public static final boolean takeSpecialIngredient(int id, long amount, L2PcInstance player) {
   switch (id) {
     case CLAN_REPUTATION:
       player.getClan().takeReputationScore((int) amount, true);
       SystemMessage smsg =
           SystemMessage.getSystemMessage(SystemMessageId.S1_DEDUCTED_FROM_CLAN_REP);
       smsg.addLong(amount);
       player.sendPacket(smsg);
       return true;
     case FAME:
       player.setFame(player.getFame() - (int) amount);
       player.sendPacket(new UserInfo(player));
       player.sendPacket(new ExBrExtraUserInfo(player));
       return true;
   }
   return false;
 }
コード例 #20
0
 @Override
 public void reduceCurrentHp(double damage, L2Character attacker, L2Skill skill) {
   super.reduceCurrentHp(damage, attacker, skill);
   if (canTalk()) {
     if ((getCastle() != null && getCastle().getSiege().getIsInProgress())
         || (getFort() != null && getFort().getSiege().getIsInProgress())
         || (getConquerableHall() != null && getConquerableHall().isInSiege())) {
       if (_clan != null) {
         // send warning to owners of headquarters that theirs base is under attack
         _clan.broadcastToOnlineMembers(
             SystemMessage.getSystemMessage(SystemMessageId.BASE_UNDER_ATTACK));
         setCanTalk(false);
         ThreadPoolManager.getInstance().scheduleGeneral(new ScheduleTalkTask(), 20000);
       }
     }
   }
 }
コード例 #21
0
  /**
   * Handle chat type 'partymatchroom'
   *
   * @see net.sf.l2j.gameserver.handler.IChatHandler#handleChat(int,
   *     net.sf.l2j.gameserver.model.actor.instance.L2PcInstance, java.lang.String)
   */
  public void handleChat(int type, L2PcInstance activeChar, String target, String text) {
    if (activeChar.isInPartyMatchRoom()) {
      PartyMatchRoom _room = PartyMatchRoomList.getInstance().getPlayerRoom(activeChar);
      if (_room != null) {
        if (activeChar.isChatBanned() && Util.contains(Config.BAN_CHAT_CHANNELS, type)) {
          activeChar.sendPacket(
              SystemMessage.getSystemMessage(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED));
          return;
        }

        CreatureSay cs =
            new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
        for (L2PcInstance _member : _room.getPartyMembers()) {
          _member.sendPacket(cs);
        }
      }
    }
  }
コード例 #22
0
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    String htmltext = getNoQuestMsg(player);
    final QuestState st = getQuestState(player, true);
    if (st == null) {
      return htmltext;
    }

    L2Clan clan = player.getClan();
    switch (st.getState()) {
      case State.CREATED:
        htmltext =
            ((clan == null) || !player.isClanLeader() || (clan.getLevel() < 5))
                ? "31331-0.htm"
                : "31331-1.htm";
        break;
      case State.STARTED:
        if ((clan == null) || !player.isClanLeader()) {
          st.exitQuest(true);
          return "31331-8.html";
        }

        if (!st.hasQuestItems(TYRANNOSAURUS_CLAW)) {
          htmltext = "31331-4.html";
        } else {
          int count = (int) st.getQuestItemsCount(TYRANNOSAURUS_CLAW);
          int reward = (count < 10) ? (30 * count) : (59 + (30 * count));
          st.playSound(QuestSound.ITEMSOUND_QUEST_FANFARE_1);
          st.takeItems(TYRANNOSAURUS_CLAW, -1);
          clan.addReputationScore(reward, true);
          player.sendPacket(
              SystemMessage.getSystemMessage(
                      SystemMessageId
                          .YOU_HAVE_SUCCESSFULLY_COMPLETED_A_CLAN_QUEST_S1_POINT_S_HAVE_BEEN_ADDED_TO_YOUR_CLAN_REPUTATION)
                  .addInt(reward));
          clan.broadcastToOnlineMembers(new PledgeShowInfoUpdate(clan));
          htmltext = "31331-7.html";
        }
        break;
      default:
        break;
    }
    return htmltext;
  }
コード例 #23
0
  @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);
    }
  }
コード例 #24
0
ファイル: Duel.java プロジェクト: 3mRe/L2Java
  public Duel(L2PcInstance playerA, L2PcInstance playerB, int partyDuel, int duelId) {
    _duelId = duelId;
    _playerA = playerA;
    _playerB = playerB;
    _partyDuel = partyDuel == 1 ? true : false;

    _duelEndTime = Calendar.getInstance();
    _duelEndTime.add(Calendar.SECOND, _partyDuel ? PARTY_DUEL_DURATION : PLAYER_DUEL_DURATION);

    setFinished(false);

    if (_partyDuel) {
      // inform players that they will be ported shortly
      SystemMessage sm =
          SystemMessage.getSystemMessage(
              SystemMessageId
                  .IN_A_MOMENT_YOU_WILL_BE_TRANSPORTED_TO_THE_SITE_WHERE_THE_DUEL_WILL_TAKE_PLACE);
      broadcastToTeam1(sm);
      broadcastToTeam2(sm);
    }
    // Schedule duel start
    ThreadPoolManager.getInstance().scheduleGeneral(new ScheduleStartDuelTask(this), 3000);
  }
コード例 #25
0
ファイル: AbstractInstance.java プロジェクト: 3mRe/L2Java
  /**
   * Sets reenter time for every player in the instance.
   *
   * @param world the instance
   * @param time the time in milliseconds
   */
  protected void setReenterTime(InstanceWorld world, long time) {
    for (int objectId : world.getAllowed()) {
      InstanceManager.getInstance().setInstanceTime(objectId, world.getTemplateId(), time);
      final L2PcInstance player = L2World.getInstance().getPlayer(objectId);
      if ((player != null) && player.isOnline()) {
        player.sendPacket(
            SystemMessage.getSystemMessage(
                    SystemMessageId
                        .INSTANT_ZONE_S1_S_ENTRY_HAS_BEEN_RESTRICTED_YOU_CAN_CHECK_THE_NEXT_POSSIBLE_ENTRY_TIME_BY_USING_THE_COMMAND_INSTANCEZONE)
                .addString(
                    InstanceManager.getInstance().getInstance(world.getInstanceId()).getName()));
      }
    }

    if (Config.DEBUG_INSTANCES) {
      _log.info(
          "Time restrictions has been set for player in instance ID: "
              + world.getInstanceId()
              + " ("
              + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(time)
              + ")");
    }
  }
コード例 #26
0
ファイル: L2SkillDrain.java プロジェクト: 54k/L2J_Server
  @Override
  public void useSkill(L2Character activeChar, L2Object[] targets) {
    if (activeChar.isAlikeDead()) {
      return;
    }

    boolean ss = useSoulShot() && activeChar.isChargedShot(ShotType.SOULSHOTS);
    boolean sps = useSpiritShot() && activeChar.isChargedShot(ShotType.SPIRITSHOTS);
    boolean bss = useSpiritShot() && activeChar.isChargedShot(ShotType.BLESSED_SPIRITSHOTS);

    for (L2Character target : (L2Character[]) targets) {
      if (target.isAlikeDead() && (getTargetType() != L2TargetType.CORPSE_MOB)) {
        continue;
      }

      if ((activeChar != target) && target.isInvul()) {
        continue; // No effect on invulnerable chars unless they cast it themselves.
      }

      boolean mcrit = Formulas.calcMCrit(activeChar.getMCriticalHit(target, this));
      byte shld = Formulas.calcShldUse(activeChar, target, this);
      int damage =
          isStaticDamage()
              ? (int) getPower()
              : (int) Formulas.calcMagicDam(activeChar, target, this, shld, sps, bss, mcrit);

      int _drain = 0;
      int _cp = (int) target.getCurrentCp();
      int _hp = (int) target.getCurrentHp();

      if (_cp > 0) {
        if (damage < _cp) {
          _drain = 0;
        } else {
          _drain = damage - _cp;
        }
      } else if (damage > _hp) {
        _drain = _hp;
      } else {
        _drain = damage;
      }

      double hpAdd = _absorbAbs + (_absorbPart * _drain);
      double hp =
          ((activeChar.getCurrentHp() + hpAdd) > activeChar.getMaxHp()
              ? activeChar.getMaxHp()
              : (activeChar.getCurrentHp() + hpAdd));

      activeChar.setCurrentHp(hp);

      StatusUpdate suhp = new StatusUpdate(activeChar);
      suhp.addAttribute(StatusUpdate.CUR_HP, (int) hp);
      activeChar.sendPacket(suhp);

      // Check to see if we should damage the target
      if ((damage > 0) && (!target.isDead() || (getTargetType() != L2TargetType.CORPSE_MOB))) {
        // Manage attack or cast break of the target (calculating rate, sending message...)
        if (!target.isRaid() && Formulas.calcAtkBreak(target, damage)) {
          target.breakAttack();
          target.breakCast();
        }

        activeChar.sendDamageMessage(target, damage, mcrit, false, false);

        if (Config.LOG_GAME_DAMAGE
            && activeChar.isPlayable()
            && (damage > Config.LOG_GAME_DAMAGE_THRESHOLD)) {
          LogRecord record = new LogRecord(Level.INFO, "");
          record.setParameters(
              new Object[] {activeChar, " did damage ", damage, this, " to ", target});
          record.setLoggerName("mdam");
          _logDamage.log(record);
        }

        if (hasEffects() && (getTargetType() != L2TargetType.CORPSE_MOB)) {
          // ignoring vengance-like reflections
          if ((Formulas.calcSkillReflect(target, this) & Formulas.SKILL_REFLECT_SUCCEED) > 0) {
            activeChar.stopSkillEffects(getId());
            getEffects(target, activeChar);
            SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT);
            sm.addSkillName(getId());
            activeChar.sendPacket(sm);
          } else {
            // activate attacked effects, if any
            target.stopSkillEffects(getId());
            if (Formulas.calcSkillSuccess(activeChar, target, this, shld, ss, sps, bss)) {
              getEffects(activeChar, target);
            } else {
              SystemMessage sm =
                  SystemMessage.getSystemMessage(SystemMessageId.C1_RESISTED_YOUR_S2);
              sm.addCharName(target);
              sm.addSkillName(this);
              activeChar.sendPacket(sm);
            }
          }
        }

        target.reduceCurrentHp(damage, activeChar, this);
      }

      // Check to see if we should do the decay right after the cast
      if (target.isDead() && (getTargetType() == L2TargetType.CORPSE_MOB) && target.isNpc()) {
        ((L2Npc) target).endDecayTask();
      }
    }
    // effect self :]
    L2Effect effect = activeChar.getFirstEffect(getId());
    if ((effect != null) && effect.isSelfEffect()) {
      // Replace old effect with new one.
      effect.exit();
    }
    // cast self effect if any
    getEffectsSelf(activeChar);
    // Consume shot
    activeChar.setChargedShot(bss ? ShotType.BLESSED_SPIRITSHOTS : ShotType.SPIRITSHOTS, false);
  }
コード例 #27
0
  @Override
  public boolean useUserCommand(int id, L2PcInstance activeChar) {
    if ((id != COMMAND_IDS[0]) && (id != COMMAND_IDS[1]) && (id != COMMAND_IDS[2])) {
      return false;
    }

    final L2Clan clan = activeChar.getClan();
    if (clan == null) {
      activeChar.sendPacket(SystemMessageId.NOT_JOINED_IN_ANY_CLAN);
      return false;
    }

    try (Connection con = L2DatabaseFactory.getInstance().getConnection()) {
      String query;
      // Attack List
      if (id == 88) {
        activeChar.sendPacket(SystemMessageId.CLANS_YOU_DECLARED_WAR_ON);
        query = ATTACK_LIST;
      }
      // Under Attack List
      else if (id == 89) {
        activeChar.sendPacket(SystemMessageId.CLANS_THAT_HAVE_DECLARED_WAR_ON_YOU);
        query = UNDER_ATTACK_LIST;
      }
      // War List
      else {
        activeChar.sendPacket(SystemMessageId.WAR_LIST);
        query = WAR_LIST;
      }

      try (PreparedStatement ps = con.prepareStatement(query)) {
        ps.setInt(1, clan.getId());
        ps.setInt(2, clan.getId());

        SystemMessage sm;
        try (ResultSet rs = ps.executeQuery()) {
          String clanName;
          int ally_id;
          while (rs.next()) {
            clanName = rs.getString("clan_name");
            ally_id = rs.getInt("ally_id");
            if (ally_id > 0) {
              // Target With Ally
              sm = SystemMessage.getSystemMessage(SystemMessageId.S1_S2_ALLIANCE);
              sm.addString(clanName);
              sm.addString(rs.getString("ally_name"));
            } else {
              // Target Without Ally
              sm = SystemMessage.getSystemMessage(SystemMessageId.S1_NO_ALLI_EXISTS);
              sm.addString(clanName);
            }
            activeChar.sendPacket(sm);
          }
        }
      }
      activeChar.sendPacket(SystemMessageId.FRIEND_LIST_FOOTER);
    } catch (Exception e) {
      _log.log(Level.WARNING, "", e);
    }
    return true;
  }
コード例 #28
0
ファイル: Fort.java プロジェクト: 3mRe/L2Java
  private void updateOwnerInDB() {
    L2Clan clan = getOwnerClan();
    int clanId = 0;
    if (clan != null) {
      clanId = clan.getId();
      _lastOwnedTime.setTimeInMillis(System.currentTimeMillis());
    } else {
      _lastOwnedTime.setTimeInMillis(0);
    }

    try (Connection con = ConnectionFactory.getInstance().getConnection();
        PreparedStatement ps =
            con.prepareStatement(
                "UPDATE fort SET owner=?,lastOwnedTime=?,state=?,castleId=? WHERE id = ?")) {
      ps.setInt(1, clanId);
      ps.setLong(2, _lastOwnedTime.getTimeInMillis());
      ps.setInt(3, 0);
      ps.setInt(4, 0);
      ps.setInt(5, getResidenceId());
      ps.execute();

      // Announce to clan members
      if (clan != null) {
        clan.setFortId(getResidenceId()); // Set has fort flag for new owner
        SystemMessage sm;
        sm =
            SystemMessage.getSystemMessage(
                SystemMessageId.S1_IS_VICTORIOUS_IN_THE_FORTRESS_BATTLE_OF_S2);
        sm.addString(clan.getName());
        sm.addCastleId(getResidenceId());
        L2World.getInstance().getPlayers().forEach(p -> p.sendPacket(sm));
        clan.broadcastToOnlineMembers(new PledgeShowInfoUpdate(clan));
        clan.broadcastToOnlineMembers(new PlaySound(1, "Siege_Victory", 0, 0, 0, 0, 0));
        if (_FortUpdater[0] != null) {
          _FortUpdater[0].cancel(false);
        }
        if (_FortUpdater[1] != null) {
          _FortUpdater[1].cancel(false);
        }
        _FortUpdater[0] =
            ThreadPoolManager.getInstance()
                .scheduleGeneralAtFixedRate(
                    new FortUpdater(this, clan, 0, UpdaterType.PERIODIC_UPDATE),
                    Config.FS_UPDATE_FRQ * 60000L,
                    Config.FS_UPDATE_FRQ * 60000L); // Schedule owner tasks to start running
        if (Config.FS_MAX_OWN_TIME > 0) {
          _FortUpdater[1] =
              ThreadPoolManager.getInstance()
                  .scheduleGeneralAtFixedRate(
                      new FortUpdater(this, clan, 0, UpdaterType.MAX_OWN_TIME),
                      3600000,
                      3600000); // Schedule owner tasks to remove owener
        }
      } else {
        if (_FortUpdater[0] != null) {
          _FortUpdater[0].cancel(false);
        }
        _FortUpdater[0] = null;
        if (_FortUpdater[1] != null) {
          _FortUpdater[1].cancel(false);
        }
        _FortUpdater[1] = null;
      }
    } catch (Exception e) {
      _log.log(Level.WARNING, "Exception: updateOwnerInDB(L2Clan clan): " + e.getMessage(), e);
    }
  }
コード例 #29
0
ファイル: Fort.java プロジェクト: 3mRe/L2Java
  /**
   * This method will set owner for Fort
   *
   * @param clan
   * @param updateClansReputation
   * @return
   */
  public boolean setOwner(L2Clan clan, boolean updateClansReputation) {
    if (clan == null) {
      _log.warning(getClass().getSimpleName() + ": Updating Fort owner with null clan!!!");
      return false;
    }

    final SystemMessage sm =
        SystemMessage.getSystemMessage(SystemMessageId.THE_FORTRESS_BATTLE_OF_S1_HAS_FINISHED);
    sm.addCastleId(getResidenceId());
    getSiege().announceToPlayer(sm);

    final L2Clan oldowner = getOwnerClan();
    if ((oldowner != null) && (clan != oldowner)) {
      // Remove points from old owner
      updateClansReputation(oldowner, true);
      try {
        L2PcInstance oldleader = oldowner.getLeader().getPlayerInstance();
        if (oldleader != null) {
          if (oldleader.getMountType() == MountType.WYVERN) {
            oldleader.dismount();
          }
        }
      } catch (Exception e) {
        _log.log(Level.WARNING, "Exception in setOwner: " + e.getMessage(), e);
      }
      removeOwner(true);
    }
    setFortState(0, 0); // initialize fort state

    // if clan already have castle, don't store him in fortress
    if (clan.getCastleId() > 0) {
      getSiege()
          .announceToPlayer(
              SystemMessage.getSystemMessage(
                  SystemMessageId.THE_REBEL_ARMY_RECAPTURED_THE_FORTRESS));
      return false;
    }

    // Give points to new owner
    if (updateClansReputation) {
      updateClansReputation(clan, false);
    }

    spawnSpecialEnvoys();
    // if clan have already fortress, remove it
    if (clan.getFortId() > 0) {
      FortManager.getInstance().getFortByOwner(clan).removeOwner(true);
    }

    setSupplyLvL(0);
    setOwnerClan(clan);
    updateOwnerInDB(); // Update in database
    saveFortVariables();

    if (getSiege().isInProgress()) {
      getSiege().endSiege();
    }

    for (L2PcInstance member : clan.getOnlineMembers(0)) {
      giveResidentialSkills(member);
      member.sendSkillList();
    }
    return true;
  }
コード例 #30
0
ファイル: RequestDuelStart.java プロジェクト: 3mRe/L2Java
  @Override
  protected void runImpl() {
    L2PcInstance activeChar = getClient().getActiveChar();
    L2PcInstance targetChar = L2World.getInstance().getPlayer(_player);
    if (activeChar == null) {
      return;
    }
    if (targetChar == null) {
      activeChar.sendPacket(
          SystemMessageId.THERE_IS_NO_OPPONENT_TO_RECEIVE_YOUR_CHALLENGE_FOR_A_DUEL);
      return;
    }
    if (activeChar == targetChar) {
      activeChar.sendPacket(
          SystemMessageId.THERE_IS_NO_OPPONENT_TO_RECEIVE_YOUR_CHALLENGE_FOR_A_DUEL);
      return;
    }

    // Check if duel is possible
    if (!activeChar.canDuel()) {
      activeChar.sendPacket(SystemMessageId.YOU_ARE_UNABLE_TO_REQUEST_A_DUEL_AT_THIS_TIME);
      return;
    } else if (!targetChar.canDuel()) {
      activeChar.sendPacket(targetChar.getNoDuelReason());
      return;
    }
    // Players may not be too far apart
    else if (!activeChar.isInsideRadius(targetChar, 250, false, false)) {
      SystemMessage msg =
          SystemMessage.getSystemMessage(
              SystemMessageId.C1_IS_TOO_FAR_AWAY_TO_RECEIVE_A_DUEL_CHALLENGE);
      msg.addString(targetChar.getName());
      activeChar.sendPacket(msg);
      return;
    } else if (Config.FACTION_SYSTEM_ENABLED
        && ((activeChar.isEvil() && targetChar.isGood())
            || (activeChar.isGood() && targetChar.isEvil()))) {
      activeChar.sendPacket(SystemMessageId.YOU_ARE_UNABLE_TO_REQUEST_A_DUEL_AT_THIS_TIME);
      return;
    }

    // Duel is a party duel
    if (_partyDuel == 1) {
      // Player must be in a party & the party leader
      if (!activeChar.isInParty() || !activeChar.getParty().isLeader(activeChar)) {
        activeChar.sendMessage(
            "You have to be the leader of a party in order to request a party duel.");
        return;
      }
      // Target must be in a party
      else if (!targetChar.isInParty()) {
        activeChar.sendPacket(
            SystemMessageId
                .SINCE_THE_PERSON_YOU_CHALLENGED_IS_NOT_CURRENTLY_IN_A_PARTY_THEY_CANNOT_DUEL_AGAINST_YOUR_PARTY);
        return;
      }
      // Target may not be of the same party
      else if (activeChar.getParty().containsPlayer(targetChar)) {
        activeChar.sendMessage("This player is a member of your own party.");
        return;
      }

      // Check if every player is ready for a duel
      for (L2PcInstance temp : activeChar.getParty().getMembers()) {
        if (!temp.canDuel()) {
          activeChar.sendMessage("Not all the members of your party are ready for a duel.");
          return;
        }
      }
      L2PcInstance partyLeader = null; // snatch party leader of targetChar's party
      for (L2PcInstance temp : targetChar.getParty().getMembers()) {
        if (partyLeader == null) {
          partyLeader = temp;
        }
        if (!temp.canDuel()) {
          activeChar.sendPacket(
              SystemMessageId
                  .THE_OPPOSING_PARTY_IS_CURRENTLY_UNABLE_TO_ACCEPT_A_CHALLENGE_TO_A_DUEL);
          return;
        }
      }

      // Send request to targetChar's party leader
      if (partyLeader != null) {
        if (!partyLeader.isProcessingRequest()) {
          activeChar.onTransactionRequest(partyLeader);
          partyLeader.sendPacket(new ExDuelAskStart(activeChar.getName(), _partyDuel));

          if (Config.DEBUG) {
            _log.fine(activeChar.getName() + " requested a duel with " + partyLeader.getName());
          }

          SystemMessage msg =
              SystemMessage.getSystemMessage(
                  SystemMessageId.C1_S_PARTY_HAS_BEEN_CHALLENGED_TO_A_DUEL);
          msg.addString(partyLeader.getName());
          activeChar.sendPacket(msg);

          msg =
              SystemMessage.getSystemMessage(
                  SystemMessageId.C1_S_PARTY_HAS_CHALLENGED_YOUR_PARTY_TO_A_DUEL);
          msg.addString(activeChar.getName());
          targetChar.sendPacket(msg);
        } else {
          SystemMessage msg =
              SystemMessage.getSystemMessage(
                  SystemMessageId.C1_IS_ON_ANOTHER_TASK_PLEASE_TRY_AGAIN_LATER);
          msg.addString(partyLeader.getName());
          activeChar.sendPacket(msg);
        }
      }
    } else
    // 1vs1 duel
    {
      if (!targetChar.isProcessingRequest()) {
        activeChar.onTransactionRequest(targetChar);
        targetChar.sendPacket(new ExDuelAskStart(activeChar.getName(), _partyDuel));

        if (Config.DEBUG) {
          _log.fine(activeChar.getName() + " requested a duel with " + targetChar.getName());
        }

        SystemMessage msg =
            SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_BEEN_CHALLENGED_TO_A_DUEL);
        msg.addString(targetChar.getName());
        activeChar.sendPacket(msg);

        msg = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_CHALLENGED_YOU_TO_A_DUEL);
        msg.addString(activeChar.getName());
        targetChar.sendPacket(msg);
      } else {
        SystemMessage msg =
            SystemMessage.getSystemMessage(
                SystemMessageId.C1_IS_ON_ANOTHER_TASK_PLEASE_TRY_AGAIN_LATER);
        msg.addString(targetChar.getName());
        activeChar.sendPacket(msg);
      }
    }
  }