Example #1
0
 @Override
 public String onFirstTalk(L2Npc npc, L2PcInstance player) {
   String htmltext = null;
   if (player.isClanLeader() && (player.getClanId() == npc.getCastle().getOwnerId())) {
     if (isInSiege(npc)) {
       htmltext = "CastleSiegeManager.html";
     } else {
       htmltext = "CastleSiegeManager-01.html";
     }
   } else if (isInSiege(npc)) {
     htmltext = "CastleSiegeManager-02.html";
   } else {
     if (npc.getConquerableHall() != null) {
       npc.getConquerableHall().showSiegeInfo(player);
     } else {
       npc.getCastle().getSiege().listRegisterClan(player);
     }
   }
   return htmltext;
 }
 @Override
 public String onTalk(L2Npc npc, L2PcInstance player) {
   final QuestState qs = getQuestState(player, true);
   final QuestState lqs = getLeaderQuestState(player, getName());
   String htmltext = getNoQuestMsg(player);
   if (qs.isCreated() || qs.isCompleted()) {
     if (npc.getId() == SIR_GUSTAV_ATHEBALDT) {
       if (lqs != null) {
         if (player.isClanLeader()) {
           final L2Clan clan = player.getClan();
           if (clan != null) {
             if (clan.getLevel() < 4) {
               htmltext = "30760-01.html";
             } else if (clan.getLevel() >= 5) {
               htmltext = "30760-02.html";
             } else if ((clan.getLevel() == 4) && hasQuestItems(player, SEAL_OF_ASPIRATION)) {
               htmltext = "30760-03.html";
             } else if ((clan.getLevel() == 4) && !hasQuestItems(player, SEAL_OF_ASPIRATION)) {
               htmltext = "30760-04.html";
             }
           }
         } else {
           htmltext = "30760-04t.html";
         }
       }
     }
   } else if (qs.isStarted()) {
     switch (npc.getId()) {
       case SIR_GUSTAV_ATHEBALDT:
         {
           if (lqs != null) {
             if (qs.getMemoState() == 1000) {
               htmltext = "30760-09.html";
             } else if (qs.getMemoState() == 2000) {
               htmltext = "30760-10.html";
             } else if (qs.getMemoState() == 3000) {
               if (!player.isClanLeader()) {
                 htmltext = "30760-11t.html";
               } else {
                 htmltext = "30760-11.html";
               }
             } else if (qs.getMemoState() == 4000) {
               htmltext = "30760-13.html";
             } else if (qs.getMemoState() == 5000) {
               htmltext = "30760-14.html";
             } else if (qs.getMemoState() == 6000) {
               if (!player.isClanLeader()) {
                 htmltext = "30760-15t.html";
               } else {
                 htmltext = "30760-15.html";
               }
             } else if (qs.getMemoState() == 7000) {
               htmltext = "30760-17.html";
             } else if ((qs.getMemoState() >= 8000) && (qs.getMemoState() < 8700)) {
               htmltext = "30760-18.html";
             } else if ((qs.getMemoState() >= 8700)
                 && (qs.getMemoState() < 10000)
                 && player.isClanLeader()) {
               htmltext = "30760-19.html";
             } else if ((qs.getMemoState() == 9000) && !player.isClanLeader()) {
               htmltext = "30760-19t.html";
             } else if (qs.getMemoState() == 10000) {
               if (!player.isClanLeader()) {
                 htmltext = "30760-24t.html";
               } else {
                 htmltext = "30760-24.html";
               }
             }
           }
           break;
         }
       case HEAD_BLACKSMITH_KUSTO:
         {
           if ((lqs != null) && !player.isClanLeader()) {
             htmltext = "30512-01a.html";
           } else if (!hasAtLeastOneQuestItem(player, BROOCH_OF_THE_MAGPIE, BLACK_ANVIL_COIN)) {
             htmltext = "30512-01.html";
           } else if (hasQuestItems(player, BROOCH_OF_THE_MAGPIE)) {
             htmltext = "30512-02.html";
           } else if ((lqs != null)
               && hasQuestItems(player, BLACK_ANVIL_COIN)
               && !hasQuestItems(player, BROOCH_OF_THE_MAGPIE)) {
             htmltext = "30512-04.html";
           }
           break;
         }
       case MARTIEN:
         {
           if (lqs != null) {
             if ((qs.getMemoState() == 1000)) {
               if (!player.isClanLeader()) {
                 htmltext = "30645-01.html";
               } else {
                 htmltext = "30645-02.html";
               }
             } else if ((qs.getMemoState() < 3000) && (qs.getMemoState() >= 2000)) {
               if ((getQuestItemsCount(player, MIST_DRAKES_EGG) < 10)
                   || (getQuestItemsCount(player, BLITZ_WYRM_EGG) < 10)
                   || (getQuestItemsCount(player, THUNDER_WYRM_EGG) < 10)
                   || (getQuestItemsCount(player, DRAKES_EGG) < 10)) {
                 htmltext = "30645-04.html";
               } else {
                 takeItems(player, MIST_DRAKES_EGG, -1);
                 takeItems(player, BLITZ_WYRM_EGG, -1);
                 takeItems(player, DRAKES_EGG, -1);
                 takeItems(player, THUNDER_WYRM_EGG, -1);
                 qs.setMemoState(3000);
                 qs.setCond(3, true);
                 htmltext = "30645-05.html";
               }
             } else if ((qs.getMemoState() == 3000)) {
               htmltext = "30645-07.html";
             } else if ((qs.getMemoState() > 3000)) {
               htmltext = "30645-08.html";
             }
           }
           break;
         }
       case WITCH_ATHREA:
         {
           if (lqs != null) {
             htmltext = "30758-01.html";
           }
           break;
         }
       case WITCH_KALIS:
         {
           if (lqs != null) {
             htmltext = "30759-01.html";
           }
           break;
         }
       case CORPSE_OF_FRITZ:
         {
           if ((qs.getMemoState() < 3000) && (qs.getMemoState() >= 2000)) {
             htmltext = "30761-01.html";
           }
           break;
         }
       case CORPSE_OF_LUTZ:
         {
           if ((qs.getMemoState() < 3000) && (qs.getMemoState() >= 2000)) {
             htmltext = "30762-01.html";
           }
           break;
         }
       case CORPSE_OF_KURTZ:
         {
           if (((qs.getMemoState() < 3000) && (qs.getMemoState() == 2000))
               || (qs.getMemoState() == 2110)
               || (qs.getMemoState() == 2010)
               || (qs.getMemoState() == 2100)) {
             htmltext = "30763-01.html";
           } else if ((qs.getMemoState() == 2001)
               || (qs.getMemoState() == 2111)
               || (qs.getMemoState() == 2011)
               || (qs.getMemoState() == 2101)) {
             htmltext = "30763-03.html";
           }
           break;
         }
       case BALTHAZAR:
         {
           if (lqs != null) {
             if ((qs.getMemoState() == 4000)) {
               if (!player.isClanLeader()) {
                 htmltext = "30764-01.html";
               } else if (!hasQuestItems(player, BLACK_ANVIL_COIN) && player.isClanLeader()) {
                 htmltext = "30764-02.html";
               } else if (hasQuestItems(player, BLACK_ANVIL_COIN)) {
                 htmltext = "30764-04.html";
               }
             } else if ((qs.getMemoState() == 5000)) {
               if (getQuestItemsCount(player, SPITEFUL_SOUL_ENERGY) < 10) {
                 htmltext = "30764-07a.html";
               } else {
                 takeItems(player, SPITEFUL_SOUL_ENERGY, -1);
                 qs.setMemoState(6000);
                 qs.setCond(6, true);
                 htmltext = "30764-08a.html";
               }
             } else if ((qs.getMemoState() >= 6000)) {
               htmltext = "30764-09.html";
             }
           }
           break;
         }
       case IMPERIAL_COFFER:
         {
           if (lqs != null) {
             if ((qs.getMemoState() >= 8500) && (qs.getMemoState() < 8700)) {
               if (getQuestItemsCount(player, IMPERIAL_KEY) >= 6) {
                 if (!player.isClanLeader()) {
                   htmltext = "30765-01.html";
                 } else {
                   htmltext = "30765-03.html";
                 }
               }
             } else if (qs.getMemoState() >= 8700) {
               htmltext = "30765-05.html";
             }
           }
           break;
         }
       case WITCH_CLEO:
         {
           if (lqs != null) {
             if (!player.isClanLeader()) {
               htmltext = "30766-01.html";
             } else if (qs.getMemoState() == 8000) {
               htmltext = "30766-02.html";
             } else if (qs.getMemoState() == 8100) {
               htmltext = "30766-05.html";
             } else if ((qs.getMemoState() > 8100) && (qs.getMemoState() < 10000)) {
               htmltext = "30766-06.html";
             } else if ((qs.getMemoState() == 10000) && player.isClanLeader()) {
               htmltext = "30766-07.html";
             }
           }
           break;
         }
       case SIR_ERIC_RODEMAI:
         {
           if (lqs != null) {
             if (qs.getMemoState() == 7000) {
               if (!player.isClanLeader()) {
                 htmltext = "30868-01.html";
               } else {
                 htmltext = "30868-02.html";
               }
             } else if (qs.getMemoState() == 8000) {
               htmltext = "30868-05.html";
             } else if (qs.getMemoState() == 8100) {
               if (player.isClanLeader()) {
                 qs.setMemoState(8500);
                 qs.setCond(10, true);
                 htmltext = "30868-06.html";
               } else {
                 htmltext = "30868-07.html";
               }
             } else if ((qs.getMemoState() < 8511) && (qs.getMemoState() >= 8500)) {
               htmltext = "30868-08.html";
             } else if (qs.getMemoState() == 8700) {
               htmltext = "30868-09.html";
             } else if (qs.getMemoState() >= 9000) {
               htmltext = "30868-11.html";
             }
             break;
           }
         }
     }
   }
   return htmltext;
 }