legendary of tales evento 7 raid ayudaaa

Iniciado por spirit16, Oct 23, 2025, 03:08 PM

Tema anterior - Siguiente tema

spirit16

hola buenas tardes me gustaria saber si alguien me puede ayudar con esto el evento me anda muy bien pero cuando voy a sacar a los raid al portal salen 5 clases y las dos ultimas
private static final int SPIKE_SLASHER = 25723;
   private static final int MUSCLE_BOMBER = 25724;

salen pero rraras veces demora mucho y quisiera que salgan aleatorios todos este es mi codigo en java quien me puede ayudar

/*
 * 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.Q254_LegendaryTales;

import l2.brick.gameserver.model.actor.L2Npc;
import l2.brick.gameserver.model.actor.instance.L2PcInstance;
import l2.brick.gameserver.model.quest.Quest;
import l2.brick.gameserver.model.quest.QuestState;
import l2.brick.gameserver.model.quest.State;
import l2.brick.gameserver.util.Util;

public class Q254_LegendaryTales extends Quest
{
   private static final String QUEST_NAME = "Q254_LegendaryTales";
   // NPC
   private static final int GILMORE = 30754;
   // Items
   private static final int LARGE_DRAGON_SKULL = 17249;
   // Mobs
   private static final int EMERALD_HORN = 25718;
   private static final int DUST_RIDER = 25719;
   private static final int BLEEDING_FLY = 25720;
   private static final int BLACKDAGGER_WING = 25721;
   private static final int SHADOW_SUMMONER = 25722;
   private static final int SPIKE_SLASHER = 25723;
   private static final int MUSCLE_BOMBER = 25724;

   private static final int[] BOSS = {25718, 25719, 25720, 25721, 25722, 25723, 25724};

   private static final int[] REWARDS = {0, 13457, 13458, 13459, 13460, 13461, 13462, 13463, 13464, 13465, 13466, 13467};

   @Override
   public String onAdvEvent (String event, L2Npc npc, L2PcInstance player)
   {
      String htmltext = event;
      QuestState st = player.getQuestState(QUEST_NAME);

      if (st == null)
         return htmltext;

      if (npc.getNpcId() == GILMORE)
      {
         if (event.equalsIgnoreCase("accept"))
         {
            st.setState(State.STARTED);
            st.set("cond", "1");
            st.playSound("ItemSound.quest_accept");
            htmltext = "30754-7.htm";
         }
         
         else if (event.equalsIgnoreCase("emerald"))
         {
            if (st.getInt("emerald") != 1)
               htmltext = "30754-16.html";
            else
               htmltext = "30754-22.html";
         }
         else if (event.equalsIgnoreCase("dust"))
         {
            if (st.getInt("dust") != 1)
               htmltext = "30754-17.html";
            else
               htmltext = "30754-23.html";
         }
         else if (event.equalsIgnoreCase("bleeding"))
         {
            if (st.getInt("bleeding") != 1)
               htmltext = "30754-18.html";
            else
               htmltext = "30754-24.html";
         }
         else if (event.equalsIgnoreCase("daggerwyrm"))
         {
            if (st.getInt("blackdagger") != 1)
               htmltext = "30754-19.html";
            else
               htmltext = "30754-25.html";
         }
         else if (event.equalsIgnoreCase("shadowsummoner"))
         {
            if (st.getInt("shadow") != 1)
               htmltext = "30754-16.html";
            else
               htmltext = "30754-26.html";
         }
         else if (event.equalsIgnoreCase("spikeslasher"))
         {
            if (st.getInt("spike") != 1)
               htmltext = "30754-17.html";
            else
               htmltext = "30754-27.html";
         }
         else if (event.equalsIgnoreCase("muclebomber"))
         {
            if (st.getInt("muscle") != 1)
               htmltext = "30754-18.html";
            else
               htmltext = "30754-28.html";
         }
         
         else if (Util.isDigit(event))
         {
            final int reward_id = Integer.parseInt(event);
            if (reward_id > 0)
            {
               if (st.getQuestItemsCount(LARGE_DRAGON_SKULL) == 7)
               {
                  int REWARD = REWARDS[reward_id];
                  
                  st.takeItems(LARGE_DRAGON_SKULL, -1);
                  st.giveItems(REWARD, 1);
                  htmltext = "30754-13.html";
                  st.playSound("ItemSound.quest_finish");
                  st.unset("emerald");
                  st.unset("dust");
                  st.unset("bleeding");
                  st.unset("blackdagger");
                  st.unset("shadow");
                  st.unset("spike");
                  st.unset("muscle");
                  st.exitQuest(false);
               }
               else
                  htmltext = "30754-12.htm";
            }
         }
      }
      return htmltext;
   }
   
   @Override
   public String onTalk(L2Npc npc, L2PcInstance player)
   {
      String htmltext = getNoQuestMsg(player);
      QuestState st = player.getQuestState(QUEST_NAME);
      if (st == null)
         return htmltext;

      if (npc.getNpcId() == GILMORE)
      {
         switch (st.getState())
         {
            case State.CREATED:
            {
               if (player.getLevel() < 80)
                  htmltext = "30754-3.html";
               else
                  htmltext = "30754-1.htm";
               break;
            }
            case State.STARTED:
            {
               if (st.getInt("cond") == 1 && (st.getInt("emerald") != 1 || st.getInt("dust") != 1 || st.getInt("bleeding") != 1 || st.getInt("blackdagger") != 1 || st.getInt("shadow") != 1 || st.getInt("spike") != 1 || st.getInt("muscle") != 1))
                  htmltext = "30754-9.htm";
               else if (st.getInt("cond") == 2 && st.getInt("emerald") == 1 && st.getInt("dust") == 1 && st.getInt("bleeding") == 1 && st.getInt("blackdagger") == 1 && st.getInt("shadow") == 1 && st.getInt("spike") == 1 && st.getInt("muscle") == 1)
                  htmltext = "30754-10.html";
               break;
            }
            case State.COMPLETED:
            {
               htmltext = "30754-2.html";
               break;
            }
         }
      }
      return htmltext;
   }

   @Override
   public String onKill(L2Npc npc, L2PcInstance player, boolean isPet)
   {
      QuestState st = player.getQuestState(QUEST_NAME);
      
      if (Util.contains(BOSS, npc.getNpcId()) && st != null)
      {
         if (player.isInParty())
         {
            for(L2PcInstance memb : player.getParty().getPartyMembers())
               rewardPlayer(npc, memb);
         }
         else
            rewardPlayer(npc, player);
      }
      return super.onKill(npc, player, isPet);
   }
   
   private void rewardPlayer(L2Npc npc, L2PcInstance player)
   {
      QuestState st = player.getQuestState(QUEST_NAME);
      int rb = npc.getNpcId();
      if (st != null && st.getState() == State.STARTED && player.isInsideRadius(npc, 2000, false, false))
      {
         if (rb == EMERALD_HORN && st.getInt("emerald") != 1)
         {
            st.giveItems(LARGE_DRAGON_SKULL, 1);
            st.set("emerald", "1");
         }
         else if (rb == DUST_RIDER && st.getInt("dust") != 1)
         {
            st.giveItems(LARGE_DRAGON_SKULL, 1);
            st.set("dust", "1");
         }
         else if (rb == BLEEDING_FLY && st.getInt("bleeding") != 1)
         {
            st.giveItems(LARGE_DRAGON_SKULL, 1);
            st.set("bleeding", "1");
         }
         else if (rb == BLACKDAGGER_WING && st.getInt("blackdagger") != 1)
         {
            st.giveItems(LARGE_DRAGON_SKULL, 1);
            st.set("blackdagger", "1");
         }
         else if (rb == SHADOW_SUMMONER && st.getInt("shadow") != 1)
         {
            st.giveItems(LARGE_DRAGON_SKULL, 1);
            st.set("shadow", "1");
         }
         else if (rb == SPIKE_SLASHER && st.getInt("spike") != 1)
         {
            st.giveItems(LARGE_DRAGON_SKULL, 1);
            st.set("spike", "1");
         }
         else if (rb == MUSCLE_BOMBER && st.getInt("muscle") != 1)
         {
            st.giveItems(LARGE_DRAGON_SKULL, 1);
            st.set("muscle", "1");
         }
         
         if (st.getInt("emerald") == 1 && st.getInt("dust") == 1 && st.getInt("bleeding") == 1 && st.getInt("blackdagger") == 1 && st.getInt("shadow") == 1 && st.getInt("spike") == 1 && st.getInt("muscle") == 1)
         {
            st.set("cond", "2");
            st.playSound("ItemSound.quest_middle");
         }
      }
   }
   
   public Q254_LegendaryTales(int questId, String name, String descr)
   {
      super(questId, name, descr);
      
      questItemIds = new int[] { LARGE_DRAGON_SKULL };
      
      addStartNpc(GILMORE);
      addTalkId(GILMORE);

      for(int mob : BOSS)
         addKillId(mob);
   }

   public static void main(String[] args)
   {
      new Q254_LegendaryTales(254, QUEST_NAME, "Legendary Tales");
   }
}

Swarlog

Crónica? Versión? Por favor, especifica para poder ayudarte ;)

De todos modos, aqui te dejo la quest funcionando y retail:

/*
 * Copyright (C) 2004-2015 L2J DataPack
 * 
 * This file is part of L2J DataPack.
 * 
 * L2J DataPack 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.
 * 
 * L2J DataPack 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.Q00254_LegendaryTales;

import com.l2jserver.gameserver.enums.QuestSound;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.model.quest.QuestState;
import com.l2jserver.gameserver.model.quest.State;

/**
 * Legendary Tales (254)
 * @author nonom
 */
public class Q00254_LegendaryTales extends Quest
{
	// NPC
	private static final int GILMORE = 30754;
	
	// Monsters
	public enum Bosses
	{
		EMERALD_HORN(25718),
		DUST_RIDER(25719),
		BLEEDING_FLY(25720),
		BLACK_DAGGER(25721),
		SHADOW_SUMMONER(25722),
		SPIKE_SLASHER(25723),
		MUSCLE_BOMBER(25724);
		
		private final int _bossId;
		private final int _mask;
		
		private Bosses(int bossId)
		{
			_bossId = bossId;
			_mask = 1 << ordinal();
		}
		
		public int getId()
		{
			return _bossId;
		}
		
		public int getMask()
		{
			return _mask;
		}
		
		public static Bosses valueOf(int npcId)
		{
			for (Bosses val : values())
			{
				if (val.getId() == npcId)
				{
					return val;
				}
			}
			return null;
		}
	}
	
	// @formatter:off
	private static final int[] MONSTERS =
	{
		Bosses.EMERALD_HORN.getId(), Bosses.DUST_RIDER.getId(), Bosses.BLEEDING_FLY.getId(), 
		Bosses.BLACK_DAGGER.getId(), Bosses.SHADOW_SUMMONER.getId(), Bosses.SPIKE_SLASHER.getId(), 
		Bosses.MUSCLE_BOMBER.getId()
	};
	// @formatter:on
	
	// Items
	private static final int LARGE_DRAGON_SKULL = 17249;
	
	// Misc
	private static final int MIN_LEVEL = 80;
	
	public Q00254_LegendaryTales()
	{
		super(254, Q00254_LegendaryTales.class.getSimpleName(), "Legendary Tales");
		addStartNpc(GILMORE);
		addTalkId(GILMORE);
		addKillId(MONSTERS);
		registerQuestItems(LARGE_DRAGON_SKULL);
	}
	
	@Override
	public String onTalk(L2Npc npc, L2PcInstance player)
	{
		String htmltext = getNoQuestMsg(player);
		final QuestState st = getQuestState(player, true);
		if (st == null)
		{
			return htmltext;
		}
		
		switch (st.getState())
		{
			case State.CREATED:
				htmltext = (player.getLevel() < MIN_LEVEL) ? "30754-00.htm" : "30754-01.htm";
				break;
			case State.STARTED:
				long count = getQuestItemsCount(player, LARGE_DRAGON_SKULL);
				if (st.isCond(1))
				{
					htmltext = ((count > 0) ? "30754-14.htm" : "30754-06.html");
				}
				else if (st.isCond(2))
				{
					htmltext = ((count < 7) ? "30754-12.htm" : "30754-07.html");
				}
				break;
			case State.COMPLETED:
				htmltext = "30754-29.html";
				break;
		}
		return htmltext;
	}
	
	@Override
	public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
	{
		String htmltext = getNoQuestMsg(player);
		final QuestState st = getQuestState(player, false);
		
		if (st == null)
		{
			return htmltext;
		}
		
		switch (event)
		{
			case "30754-05.html":
				st.startQuest();
			case "30754-02.html":
			case "30754-03.html":
			case "30754-04.htm":
			case "30754-08.html":
			case "30754-15.html":
			case "30754-20.html":
			case "30754-21.html":
				htmltext = event;
				break;
			case "25718": // Emerald Horn
				htmltext = (checkMask(st, Bosses.EMERALD_HORN) ? "30754-22.html" : "30754-16.html");
				break;
			case "25719": // Dust Rider
				htmltext = (checkMask(st, Bosses.DUST_RIDER) ? "30754-23.html" : "30754-17.html");
				break;
			case "25720": // Bleeding Fly
				htmltext = (checkMask(st, Bosses.BLEEDING_FLY) ? "30754-24.html" : "30754-18.html");
				break;
			case "25721": // Black Dagger Wing
				htmltext = (checkMask(st, Bosses.BLACK_DAGGER) ? "30754-25.html" : "30754-19.html");
				break;
			case "25722": // Shadow Summoner
				htmltext = (checkMask(st, Bosses.SHADOW_SUMMONER) ? "30754-26.html" : "30754-16.html");
				break;
			case "25723": // Spike Slasher
				htmltext = (checkMask(st, Bosses.SPIKE_SLASHER) ? "30754-27.html" : "30754-17.html");
				break;
			case "25724": // Muscle Bomber
				htmltext = (checkMask(st, Bosses.MUSCLE_BOMBER) ? "30754-28.html" : "30754-18.html");
				break;
			case "13467": // Vesper Thrower
			case "13466": // Vesper Singer
			case "13465": // Vesper Caster
			case "13464": // Vesper Retributer
			case "13463": // Vesper Avenger
			case "13457": // Vesper Cutter
			case "13458": // Vesper Slasher
			case "13459": // Vesper Buster
			case "13460": // Vesper Sharper
			case "13461": // Vesper Fighter
			case "13462": // Vesper Stormer
				if (st.isCond(2) && (getQuestItemsCount(player, LARGE_DRAGON_SKULL) >= 7))
				{
					htmltext = "30754-09.html";
					rewardItems(player, Integer.parseInt(event), 1);
					st.exitQuest(false, true);
				}
				break;
		}
		return htmltext;
	}
	
	@Override
	public String onKill(L2Npc npc, L2PcInstance player, boolean isPet)
	{
		if (player.isInParty())
		{
			for (L2PcInstance partyMember : player.getParty().getMembers())
			{
				actionForEachPlayer(partyMember, npc, false);
			}
		}
		else
		{
			actionForEachPlayer(player, npc, false);
		}
		return super.onKill(npc, player, isPet);
	}
	
	@Override
	public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon)
	{
		final QuestState st = player.getQuestState(Q00254_LegendaryTales.class.getSimpleName());
		
		if ((st != null) && st.isCond(1))
		{
			int raids = st.getInt("raids");
			Bosses boss = Bosses.valueOf(npc.getId());
			
			if (!checkMask(st, boss))
			{
				st.set("raids", raids | boss.getMask());
				st.giveItems(LARGE_DRAGON_SKULL, 1);
				
				if (st.getQuestItemsCount(LARGE_DRAGON_SKULL) < 7)
				{
					st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
				}
				else
				{
					st.setCond(2, true);
				}
			}
		}
	}
	
	private static boolean checkMask(QuestState qs, Bosses boss)
	{
		int pos = boss.getMask();
		return ((qs.getInt("raids") & pos) == pos);
	}
}