Esempio n. 1
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);
  }
Esempio n. 2
0
 public void updateClansReputation(L2Clan owner, boolean removePoints) {
   if (owner != null) {
     if (removePoints) {
       owner.takeReputationScore(Config.LOOSE_FORT_POINTS, true);
     } else {
       owner.addReputationScore(Config.TAKE_FORT_POINTS, true);
     }
   }
 }
  @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;
  }