Package quests

Source Code of quests._191_VainConclusion

/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package quests;

import lineage2.gameserver.model.Player;
import lineage2.gameserver.model.instances.NpcInstance;
import lineage2.gameserver.model.quest.Quest;
import lineage2.gameserver.model.quest.QuestState;
import lineage2.gameserver.scripts.ScriptFile;

public class _191_VainConclusion extends Quest implements ScriptFile
{
  private static final int Kusto = 30512;
  private static final int Lorain = 30673;
  private static final int Dorothy = 30970;
  private static final int Shegfield = 30068;
  private static final int Metal = 10371;
 
  @Override
  public void onLoad()
  {
  }
 
  @Override
  public void onReload()
  {
  }
 
  @Override
  public void onShutdown()
  {
  }
 
  public _191_VainConclusion()
  {
    super(false);
    addTalkId(Kusto, Dorothy, Lorain, Shegfield);
    addFirstTalkId(Dorothy);
    addQuestItem(Metal);
  }
 
  @Override
  public String onEvent(String event, QuestState st, NpcInstance npc)
  {
    String htmltext = event;
    if (event.equalsIgnoreCase("30970-03.htm"))
    {
      st.playSound(SOUND_ACCEPT);
      st.setCond(1);
      st.giveItems(Metal, 1);
    }
    else if (event.equalsIgnoreCase("30673-02.htm"))
    {
      st.playSound(SOUND_MIDDLE);
      st.setCond(2);
      st.takeItems(Metal, -1);
    }
    else if (event.equalsIgnoreCase("30068-03.htm"))
    {
      st.setCond(3);
      st.playSound(SOUND_MIDDLE);
    }
    else if (event.equalsIgnoreCase("30512-02.htm"))
    {
      st.giveItems(ADENA_ID, 134292);
      st.exitCurrentQuest(false);
      st.playSound(SOUND_FINISH);
    }
    return htmltext;
  }
 
  @Override
  public String onTalk(NpcInstance npc, QuestState st)
  {
    String htmltext = "noquest";
    int npcId = npc.getNpcId();
    int cond = st.getCond();
    if (st.getState() == STARTED)
    {
      if (npcId == Dorothy)
      {
        if (cond == 0)
        {
          if (st.getPlayer().getLevel() < 42)
          {
            htmltext = "30970-00.htm";
          }
          else
          {
            htmltext = "30970-01.htm";
          }
        }
        else if (cond == 1)
        {
          htmltext = "30970-04.htm";
        }
      }
      else if (npcId == Lorain)
      {
        if (cond == 1)
        {
          htmltext = "30673-01.htm";
        }
        else if (cond == 2)
        {
          htmltext = "30673-03.htm";
        }
        else if (cond == 3)
        {
          htmltext = "30673-04.htm";
          st.setCond(4);
          st.playSound(SOUND_MIDDLE);
        }
        else if (cond == 4)
        {
          htmltext = "30673-05.htm";
        }
      }
      else if (npcId == Shegfield)
      {
        if (cond == 2)
        {
          htmltext = "30068-01.htm";
        }
        else if (cond == 3)
        {
          htmltext = "30068-04.htm";
        }
      }
      else if (npcId == Kusto)
      {
        if (cond == 4)
        {
          htmltext = "30512-01.htm";
        }
      }
    }
    return htmltext;
  }
 
  @Override
  public String onFirstTalk(NpcInstance npc, Player player)
  {
    QuestState qs = player.getQuestState(_188_SealRemoval.class);
    if ((qs != null) && qs.isCompleted() && (player.getQuestState(getClass()) == null))
    {
      newQuestState(player, STARTED);
    }
    return "";
  }
}
TOP

Related Classes of quests._191_VainConclusion

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.