Advertisement
GOODPower

Untitled

Jul 2nd, 2014
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5.18 KB | None | 0 0
  1. package quests;
  2.  
  3. import l2p.commons.util.Rnd;
  4. import l2p.gameserver.model.instances.NpcInstance;
  5. import l2p.gameserver.model.quest.Quest;
  6. import l2p.gameserver.model.quest.QuestState;
  7. import l2p.gameserver.scripts.ScriptFile;
  8.  
  9. public class _246_PossessorOfaPreciousSoul3 extends Quest implements ScriptFile
  10. {
  11.     private static final int CARADINES_LETTER_2_PART = 7678;
  12.     private static final int RING_OF_GODDESS_WATERBINDER = 7591;
  13.     private static final int NECKLACE_OF_GODDESS_EVERGREEN = 7592;
  14.     private static final int STAFF_OF_GODDESS_RAIN_SONG = 7593;
  15.     private static final int CARADINES_LETTER = 7679;
  16.     private static final int RELIC_BOX = 7594;
  17.  
  18.     @Override
  19.     public void onLoad()
  20.     {
  21.     }
  22.  
  23.     @Override
  24.     public void onReload()
  25.     {
  26.     }
  27.  
  28.     @Override
  29.     public void onShutdown()
  30.     {
  31.     }
  32.  
  33.     public _246_PossessorOfaPreciousSoul3()
  34.     {
  35.         super(true);
  36.  
  37.         addStartNpc(31740);
  38.  
  39.         addTalkId(31741);
  40.         addTalkId(30721);
  41.  
  42.         addKillId(21541);
  43.         addKillId(21544);
  44.         addKillId(25325);
  45.  
  46.         addQuestItem(RING_OF_GODDESS_WATERBINDER, NECKLACE_OF_GODDESS_EVERGREEN, STAFF_OF_GODDESS_RAIN_SONG);
  47.     }
  48.  
  49.     @Override
  50.     public String onEvent(String event, QuestState st, NpcInstance npc)
  51.     {
  52.         String htmltext = event;
  53.         if(event.equals("caradine_q0246_0104.htm"))
  54.         {
  55.             st.setCond(1);
  56.             st.takeItems(CARADINES_LETTER_2_PART, 1);
  57.             st.setState(STARTED);
  58.             st.playSound(SOUND_ACCEPT);
  59.         }
  60.         else if(event.equals("ossian_q0246_0201.htm"))
  61.         {
  62.             st.setCond(2);
  63.             st.playSound(SOUND_MIDDLE);
  64.         }
  65.         else if(event.equals("ossian_q0246_0301.htm"))
  66.         {
  67.             st.setCond(4);
  68.             st.playSound(SOUND_MIDDLE);
  69.         }
  70.         else if(event.equals("ossian_q0246_0401.htm"))
  71.         {
  72.             st.takeItems(RING_OF_GODDESS_WATERBINDER, 1);
  73.             st.takeItems(NECKLACE_OF_GODDESS_EVERGREEN, 1);
  74.             st.takeItems(STAFF_OF_GODDESS_RAIN_SONG, 1);
  75.             st.setCond(6);
  76.             st.giveItems(RELIC_BOX, 1);
  77.             st.playSound(SOUND_MIDDLE);
  78.         }
  79.         else if(event.equals("magister_ladd_q0246_0501.htm"))
  80.         {
  81.             st.takeItems(RELIC_BOX, 1);
  82.             st.giveItems(CARADINES_LETTER, 1);
  83.             st.addExpAndSp(719843, 0);
  84.             st.unset("cond");
  85.             st.exitCurrentQuest(false);
  86.         }
  87.         return htmltext;
  88.     }
  89.  
  90.     @Override
  91.     public String onTalk(NpcInstance npc, QuestState st)
  92.     {
  93.         if(!st.getPlayer().isSubClassActive())
  94.             return "Subclass only!";
  95.  
  96.         String htmltext = "noquest";
  97.         int npcId = npc.getNpcId();
  98.         int cond = st.getCond();
  99.         if(npcId == 31740)
  100.         {
  101.             if(cond == 0)
  102.             {
  103.                 QuestState previous = st.getPlayer().getQuestState(_242_PossessorOfaPreciousSoul2.class);
  104.                 if(previous != null && previous.getState() == COMPLETED && st.getPlayer().getLevel() >= 65)
  105.                     htmltext = "caradine_q0246_0101.htm";
  106.                 else
  107.                 {
  108.                     htmltext = "caradine_q0246_0102.htm";
  109.                     st.exitCurrentQuest(true);
  110.                 }
  111.             }
  112.             else if(cond == 1)
  113.                 htmltext = "caradine_q0246_0105.htm";
  114.         }
  115.         else if(npcId == 31741)
  116.         {
  117.             if(cond == 1)
  118.                 htmltext = "ossian_q0246_0101.htm";
  119.             else if((cond == 2 || cond == 3) && (st.getQuestItemsCount(RING_OF_GODDESS_WATERBINDER) < 1 || st.getQuestItemsCount(NECKLACE_OF_GODDESS_EVERGREEN) < 1))
  120.                 htmltext = "ossian_q0246_0203.htm";
  121.             else if(cond == 3 && st.getQuestItemsCount(RING_OF_GODDESS_WATERBINDER) == 1 && st.getQuestItemsCount(NECKLACE_OF_GODDESS_EVERGREEN) == 1)
  122.                 htmltext = "ossian_q0246_0202.htm";
  123.             else if(cond == 4)
  124.                 htmltext = "ossian_q0246_0301.htm";
  125.             else if((cond == 4 || cond == 5) && st.getQuestItemsCount(STAFF_OF_GODDESS_RAIN_SONG) < 1)
  126.                 htmltext = "ossian_q0246_0402.htm";
  127.             else if(cond == 5 && st.getQuestItemsCount(RING_OF_GODDESS_WATERBINDER) == 1 && st.getQuestItemsCount(NECKLACE_OF_GODDESS_EVERGREEN) == 1 && st.getQuestItemsCount(STAFF_OF_GODDESS_RAIN_SONG) == 1)
  128.                 htmltext = "ossian_q0246_0303.htm";
  129.             else if(cond == 6)
  130.                 htmltext = "ossian_q0246_0403.htm";
  131.         }
  132.         else if(npcId == 30721)
  133.             if(cond == 6 && st.getQuestItemsCount(RELIC_BOX) == 1)
  134.                 htmltext = "magister_ladd_q0246_0401.htm";
  135.         return htmltext;
  136.     }
  137.  
  138.     @Override
  139.     public String onKill(NpcInstance npc, QuestState st)
  140.     {
  141.         if(!st.getPlayer().isSubClassActive())
  142.             return null;
  143.  
  144.         int npcId = npc.getNpcId();
  145.         int cond = st.getCond();
  146.         if(cond == 2)
  147.         {
  148.             if(Rnd.chance(30))
  149.                 if(npcId == 21541 && st.getQuestItemsCount(RING_OF_GODDESS_WATERBINDER) == 0)
  150.                 {
  151.                     st.giveItems(RING_OF_GODDESS_WATERBINDER, 1);
  152.                     if(st.getQuestItemsCount(RING_OF_GODDESS_WATERBINDER) == 1 && st.getQuestItemsCount(NECKLACE_OF_GODDESS_EVERGREEN) == 1)
  153.                     {
  154.                         st.setCond(3);
  155.                         st.playSound(SOUND_MIDDLE);
  156.                     }
  157.                     else
  158.                         st.playSound(SOUND_ITEMGET);
  159.                 }
  160.                 else if(npcId == 21544 && st.getQuestItemsCount(NECKLACE_OF_GODDESS_EVERGREEN) == 0)
  161.                 {
  162.                     st.giveItems(NECKLACE_OF_GODDESS_EVERGREEN, 1);
  163.                     if(st.getQuestItemsCount(RING_OF_GODDESS_WATERBINDER) == 1 && st.getQuestItemsCount(NECKLACE_OF_GODDESS_EVERGREEN) == 1)
  164.                     {
  165.                         st.setCond(3);
  166.                         st.playSound(SOUND_MIDDLE);
  167.                     }
  168.                     else
  169.                         st.playSound(SOUND_ITEMGET);
  170.                 }
  171.         }
  172.         else if(cond == 4)
  173.             if(npcId == 25325 && st.getQuestItemsCount(STAFF_OF_GODDESS_RAIN_SONG) == 0)
  174.             {
  175.                 st.giveItems(STAFF_OF_GODDESS_RAIN_SONG, 1);
  176.                 st.setCond(5);
  177.                 st.playSound(SOUND_MIDDLE);
  178.             }
  179.         return null;
  180.     }
  181. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement