Jump to content
  • 0

Q511_olympiadStarter


Question

Posted

Hi EveryOne.

I tried to rewrite Quest 551_OlympiadStarter from l2rebellion  to L2jserver.

I need help from users because i have some misunderstanding.

The Problem is that i cant remake  st.setState(2); st.setState(3); st.setState(1);

 

Sorry Maby its wrong dissision.

 

L2Rebellion Quest Script

package l2r.scripts.quests;

import l2r.extensions.scripts.ScriptFile;
import l2r.gameserver.model.L2Player;
import l2r.gameserver.model.L2SubClass;
import l2r.gameserver.model.entity.olympiad.Olympiad;
import l2r.gameserver.model.instances.L2NpcInstance;
import l2r.gameserver.model.quest.Quest;
import l2r.gameserver.model.quest.QuestState;

public class _551_OlympiadStarter extends Quest
  implements ScriptFile
{
  private static final int _npc = 31688;
  private static final int _olymp3 = 17238;
  private static final int _olymp5 = 17239;
  private static final int _olymp10 = 17240;
  private static final int _olympChest = 17169;

  public _551_OlympiadStarter()
  {
    super(false);
    addStartNpc(31688);
    addTalkId(new int[] { 31688 });
    addQuestItem(new int[] { 17169 });
    addQuestItem(new int[] { 17240 });
    addQuestItem(new int[] { 17239 });
    addQuestItem(new int[] { 17238 });
  }

  public String onEvent(String paramString, QuestState paramQuestState, L2NpcInstance paramL2NpcInstance)
  {
    L2Player localL2Player = paramQuestState.getPlayer();
    int i = paramQuestState.getCond();
    String str = paramString;
    if (paramQuestState == null)
      return str;
    if (paramL2NpcInstance.getNpcId() == 31688)
    {
      if (i == 1)
        if (paramString.equals("31688-03.htm"))
        {
          paramQuestState.setState(2);
          paramQuestState.setCond(Olympiad.getCompetitionDone(localL2Player.getObjectId()));
          paramQuestState.setCond(1);
          paramQuestState.playSound(SOUND_ACCEPT);
        }
        else if (paramString.equals("exchange"))
        {
          if ((paramQuestState.getQuestItemsCount(17238) >= 1L) || (paramQuestState.getQuestItemsCount(17239) >= 1L) || (paramQuestState.getQuestItemsCount(17240) >= 1L))
          {
            if ((i == 2) && (paramQuestState.getQuestItemsCount(17238) >= 1L))
            {
              paramQuestState.giveItems(17169, 1L);
              paramQuestState.takeItems(17238, 1L);
              paramQuestState.playSound(SOUND_ITEMGET);
            }
            if ((i == 3) && (paramQuestState.getQuestItemsCount(17239) >= 1L))
            {
              paramQuestState.giveItems(17169, 2L);
              paramQuestState.takeItems(17239, 1L);
              paramQuestState.playSound(SOUND_ITEMGET);
            }
            if ((i == 4) && (paramQuestState.getQuestItemsCount(17240) >= 1L))
            {
              paramQuestState.giveItems(17169, 4L);
              paramQuestState.takeItems(17240, 1L);
              paramQuestState.playSound(SOUND_ITEMGET);
              paramQuestState.setState(3);
              paramQuestState.playSound(SOUND_FINISH);
              paramQuestState.exitCurrentQuest(false);
            }
            return "31688-06.htm";
          }
          return "31688-07.htm";
        }
      return "31688-05.htm";
    }
    return str;
  }

  public String onTalk(L2NpcInstance paramL2NpcInstance, QuestState paramQuestState)
  {
    L2Player localL2Player = paramQuestState.getPlayer();
    String str = "noquest";
    if (paramQuestState == null)
      return str;
    if (Olympiad._inCompPeriod)
    {
      if ((localL2Player.getLevel() >= 75) && (localL2Player.getActiveClass().isBase()) && (localL2Player.isNoble()))
      {
        if (paramQuestState.getState() == 3)
          return "31688-01.htm";
        return "31688-00.htm";
      }
      return "31688-02.htm";
    }
    return "31688-08.htm";
  }

}

 

L2jServer Quest Script

import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.base.SubClass;
import com.l2jserver.gameserver.model.olympiad.Olympiad;
import com.l2jserver.gameserver.model.actor.instance.L2NpcInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.model.quest.QuestState;

public class Q551_OlympiadStarter extends Quest
{
  private static final String qn = "Q551_OlympiadStarter";
  //Npc
  private static final int OlyManager = 31688;
  //Items
  private static final int _olymp3 = 17238;
  private static final int _olymp5 = 17239;
  private static final int _olymp10 = 17240;
  private static final int _olympChest = 17169;
  
  public String onEvent(String event, QuestState st, L2PcInstance player, L2NpcInstance npc)
  {
    String htmltext = event;
    if (st == null)
        htmltext = getNoQuestMsg(player);
    
        if (npc.getNpcId() == 31688)
        {
            if (event.equals("31688-03.htm"))
            {
                st.setState(2);
                st.set("cond","Olympiad.getCompetitionDone(Player.getObjectId())");
                st.set("cond", "1");
                st.playSound("ItemSound.quest_accept");
            }
            else if (event.equals("exchange"))
            {
                if ((st.getQuestItemsCount(17238) >= 1L) || (st.getQuestItemsCount(17239) >= 1L) || (st.getQuestItemsCount(17240) >= 1L))
                {
                    if ((i == 2) && (st.getQuestItemsCount(17238) >= 1L))
                    {
                        st.giveItems(17169, 1L);
                        st.takeItems(17238, 1L);
                        st.playSound("ItemSound.quest_itemget");
                    }
                    if ((i == 3) && (st.getQuestItemsCount(17239) >= 1L))
                    {
                        st.giveItems(17169, 2L);
                        st.takeItems(17239, 1L);
                        st.playSound("ItemSound.quest_itemget");
                    }
                    if ((i == 4) && (st.getQuestItemsCount(17240) >= 1L))
                    {
                        st.giveItems(17169, 4L);
                        st.takeItems(17240, 1L);
                        st.playSound("ItemSound.quest_itemget");
                        st.setState(3);
                        st.playSound("ItemSound.quest_finish");
                        st.exitQuest(false);
                    }
                    return "31688-06.htm";
                }
                return "31688-07.htm";
            }
                return "31688-05.htm";
            }
    return htmltext;
  }
  public String onTalk(L2NpcInstance npc, L2PcInstance player)
  {
        String htmltext = getNoQuestMsg(player);
        QuestState st = player.getQuestState(qn);
    
        if (st == null)
            return htmltext;        
            
        if (Olympiad._inCompPeriod)
        {
            if ((player.getLevel() >= 75)  && (player.isNoble()))
            {
                if (st.getInt("cond") == 3)
                    htmltext ="31688-01.htm";
                else
                    htmltext ="31688-00.htm";
            }
            else 
                htmltext ="31688-02.htm";            
        }
        else
           htmltext ="31688-08.htm";
    return htmltext; 
  }  
  
  public Q551_OlympiadStarter(int questId, String name, String descr)
  {
    super(questId, name, descr);
    addStartNpc(OlyManager);
    addTalkId(OlyManager);   
    questItemIds = new int[] {_olymp3}; 
    questItemIds = new int[] {_olymp5};    
    questItemIds = new int[] {_olymp10};
    questItemIds = new int[] {_olympChest};
  }  
  
    public static void main(String[] args)
    {
        new Q551_OlympiadStarter(551, qn, "Olympiad Starter");
    }  
}  

 

Html Files

31688-01.htm
____________
<html>
<body>
<font color="FFCC00">Менеджер великой олимпиады:</font><br>
Данное задание выполняется раз в сутки, по таймеру. Каждое утро в 6:30 таймер сбрасывается<br>
<br>
</body>
</html>
____________
31688-02.htm
___________
<html>
<body>
<font color="FFCC00">Менеджер великой олимпиады:</font><br>
Я немогу позволить тебе выполнить это задание!<br>
(Этот квест могут выполнять только персонажи выше 75 уровня основным классом)<br>
<br>
</body>
</html>
___________
31688-03.htm
___________
<html>
<body>
<font color="FFCC00">Менеджер великой олимпиады:</font><br>
Всё что тебе надо сделать - провести на олимпиаде 10 матчей. Мы не смотрим на исход, мы смотрим на твою смелость! Почему бы не подраться за хорошую награду?!<br>
Награда:<br>
Olympiad Match 3 Participation Certificate - за 3 проведенных матча.</br>
Olympiad Match 5 Participation Certificate - за 5 проведенных матчей.</br>
Olympiad Match 10 Participation Certificate- за 10 проведенных матчей.<br>
<a action="bypass -h Quest _551_OlympiadStarter 31688-05.htm">Я согласен.</a><br>
<br>
</body>
</html>
____________
31688-05.htm
____________
<html>
<body>
<font color="FFCC00">Менеджер великой олимпиады:</font><br>
Ты готов доказать свою смелость?<br>
<a action="bypass -h Quest _551_OlympiadStarter exchange">Да</a><br>
<br>
</body>
</html>
____________
31688-06.htm
____________
<html>
<body>
<font color="FFCC00">Менеджер великой олимпиады:</font><br>
Ты отлично справился, вот твоя награда!<br>
<br>
</body>
</html>
___________
31688-07.htm
___________
<html>
<body>
<font color="FFCC00">Менеджер великой олимпиады:</font><br>
Тебе не обмануть меня!<br>
(У вас недостаточно квестовых предметов)
<br>
</body>
</html>
___________
31688-08.htm
___________
<html>
<body>
<font color="FFCC00">Менеджер великой олимпиады:</font><br>
Олимпиада ещё не началась!<br>
<br>
</body>
</html>

1 answer to this question

Recommended Posts

  • 0
Posted

setState refers to one of the possible enum states, aka State.CREATED, State.STARTED && State.COMPLETED.

 

Following code is wrong :

questItemIds = new int[] {_olymp3}; 
    questItemIds = new int[] {_olymp5};    
    questItemIds = new int[] {_olymp10};
    questItemIds = new int[] {_olympChest};

, must be written :

questItemIds = new int[] {_olymp3, _olymp5, _olymp10, _olympChest};

 

Finally, if you have only one NPC in that script, the check about npcId are useless. The only use of that check is to differentiate behavior according of the NPC.

 

Exemple : you got 1 NPC to start and speak, and 4 mobs registered on onKill. There's no need for npcId check on onTalk and onAdvEvent, but there's (perhaps, not even sure, if all mobs got same behavior it's pointless) surely a check on npcId.

 

I say that, I say nothing :P.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Posts

    • Faltan demasiados archivos,  y lógicas en clases claves como L2pcInstance, entre otras. si bien muchas cosas están y el flujo es valorable.  Gracias por tu esfuerzo es bastante... pero realmente no esta completo el código, falta que subas todas las modificaciones en clases colaterales... podrías intentar subir un diff de todo el mod  completo de tu pack y bueno ahí si que cada uno adapte... pero faltan muchas cosas, dudo que haya gente que lo haya echo funcionar con esto... 
    • I know people who have fully bypassed and reversed AAC. One day, they might even release the full source code, but for now, they’re still making money off it. I won’t name anyone, but it’s clear that there aren’t any truly solid anticheats for Lineage2. As I’ve said before, kernel level anticheats are the only real solution. Anything that runs as Internal and injects gets flagged, and your account ends up getting kicked or banned. That’s just how most games handle it nowadays. To TL;DR the whole thing cheating will always exist because there are people out there smart enough to bypass any protection and run private cheats. Public cheats are always detected eventually, so I don’t see any point in buying AAC, especially when they claim it blocks adr, which simply isn’t true.
    • 🌐 Website: https://l2adonis.com 📅 GRAND OPENING: July 18, 2025 – 20:00 (UTC+2) 💬 Discord: https://discord.com/invite/tZBj8JxAwx 🚫 No auto-farm • No auto-macro • No pay-to-win • No custom   Some Basic Info's (More detalied info's on website)  EXP/SP: x25  Adena: x15  Drop: x15  Spoil: x15  Seal Stones: x15  Raid Boss Drop: x10  Epic Boss Drop: x1  Manor: x10  Safe Enchant: +4  Max Enchant: +16  Normal Scroll Chance: 50%  Blessed Scroll Chance: 66% (If enchant fail item remain +4)  Buff Slots (30+4 extra with Divine Inspiration)  Dances/Songs Slots 14  Auto-learn skills  ⚔️ Real PvP • Real Progression • Retail-like experience JOIN NOW and relive the real L2 experience!
    • Discord         :  utchiha_market Telegram        : https://t.me/utchiha_market Auto Buy Store  : https://utchihamkt.mysellauth.com/ Not sure if we’re legit? Check Our server — real reviews, real buyers https://discord.gg/uthciha-servicess  | https://campsite.bio/utchihaamkt
    • Looking for a Developer – Lineage II Interlude (Vanganth Files)   I’m seeking a developer to collaborate on a project based on Vanganth Interlude files.   Important: Applicants with a bad attitude, lack of respect, or unwillingness to work will be immediately rejected. Payment: Hourly rate, not per task. Contact: Please reach out to me via PM.
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock