Jump to content
  • 0

Quest Disable Active Quest Check


Question

Posted (edited)

Hello anyone know how to make the boxes after boss die to give reward even if u don`t have the quest ?

 

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

import java.util.HashMap;
import java.util.Map;

import net.sf.l2j.gameserver.datatables.ItemTable;
import net.sf.l2j.gameserver.model.actor.L2Npc;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.quest.Quest;
import net.sf.l2j.gameserver.model.quest.QuestState;
import net.sf.l2j.gameserver.network.serverpackets.SocialAction;

public class Q234_FatesWhisper extends Quest
{
	private static final String qn = "Q234_FatesWhisper";
	
	// Items
	private static final int REIRIA_SOUL_ORB = 4666;
	private static final int KERMON_INFERNIUM_SCEPTER = 4667;
	private static final int GOLKONDA_INFERNIUM_SCEPTER = 4668;
	private static final int HALLATE_INFERNIUM_SCEPTER = 4669;
	
	private static final int INFERNIUM_VARNISH = 4672;
	private static final int REORIN_HAMMER = 4670;
	private static final int REORIN_MOLD = 4671;
	
	private static final int PIPETTE_KNIFE = 4665;
	private static final int RED_PIPETTE_KNIFE = 4673;
	
	private static final int CRYSTAL_B = 1460;
	
	// Reward
	private static final int STAR_OF_DESTINY = 5011;
	
	// Chest Spawn
	private static final Map<Integer, Integer> CHEST_SPAWN = new HashMap<>();
	{
		CHEST_SPAWN.put(25035, 31027);
		CHEST_SPAWN.put(25054, 31028);
		CHEST_SPAWN.put(25126, 31029);
		CHEST_SPAWN.put(25220, 31030);
	}
	
	// Weapons
	private static final Map<Integer, String> WEAPONS = new HashMap<>();
	{
		WEAPONS.put(79, "Sword of Damascus");
		WEAPONS.put(97, "Lance");
		WEAPONS.put(171, "Deadman's Glory");
		WEAPONS.put(175, "Art of Battle Axe");
		WEAPONS.put(210, "Staff of Evil Spirits");
		WEAPONS.put(234, "Demon Dagger");
		WEAPONS.put(268, "Bellion Cestus");
		WEAPONS.put(287, "Bow of Peril");
		WEAPONS.put(2626, "Samurai Dual-sword");
		WEAPONS.put(7883, "Guardian Sword");
		WEAPONS.put(7889, "Wizard's Tear");
		WEAPONS.put(7893, "Kaim Vanul's Bones");
		WEAPONS.put(7901, "Star Buster");
	}
	
	public Q234_FatesWhisper()
	{
		super(234, qn, "Fate's Whispers");
		
		setItemsIds(PIPETTE_KNIFE, RED_PIPETTE_KNIFE);
		
		addStartNpc(31002);
		addTalkId(31002, 30182, 30847, 30178, 30833, 31028, 31029, 31030, 31027);
		
		// The 4 bosses which spawn chests
		addKillId(25035, 25054, 25126, 25220);
		
		// Baium
		addAttackId(29020);
	}
	
	@Override
	public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
	{
		String htmltext = event;
		QuestState st = player.getQuestState(qn);
		if (st == null)
			return htmltext;
		
		if (event.equalsIgnoreCase("31002-03.htm"))
		{
			st.setState(STATE_STARTED);
			st.set("cond", "1");
			st.playSound(QuestState.SOUND_ACCEPT);
		}
		else if (event.equalsIgnoreCase("30182-01c.htm"))
		{
			st.playSound(QuestState.SOUND_ITEMGET);
			st.giveItems(INFERNIUM_VARNISH, 1);
		}
		else if (event.equalsIgnoreCase("30178-01a.htm"))
		{
			st.set("cond", "6");
			st.playSound(QuestState.SOUND_MIDDLE);
		}
		else if (event.equalsIgnoreCase("30833-01b.htm"))
		{
			st.set("cond", "7");
			st.playSound(QuestState.SOUND_MIDDLE);
			st.giveItems(PIPETTE_KNIFE, 1);
		}
		else if (event.startsWith("selectBGrade_"))
		{
			if (st.getInt("bypass") == 1)
				return null;
			
			String bGradeId = event.replace("selectBGrade_", "");
			st.set("weaponId", bGradeId);
			htmltext = getHtmlText("31002-13.htm").replace("%weaponname%", WEAPONS.get(st.getInt("weaponId")));
		}
		else if (event.startsWith("confirmWeapon"))
		{
			st.set("bypass", "1");
			htmltext = getHtmlText("31002-14.htm").replace("%weaponname%", WEAPONS.get(st.getInt("weaponId")));
		}
		else if (event.startsWith("selectAGrade_"))
		{
			if (st.getInt("bypass") == 1)
			{
				final int itemId = st.getInt("weaponId");
				if (st.hasQuestItems(itemId))
				{
					int aGradeItemId = Integer.parseInt(event.replace("selectAGrade_", ""));
					
					htmltext = getHtmlText("31002-12.htm").replace("%weaponname%", ItemTable.getInstance().getTemplate(aGradeItemId).getName());
					st.takeItems(itemId, 1);
					st.giveItems(aGradeItemId, 1);
					st.giveItems(STAR_OF_DESTINY, 1);
					player.broadcastPacket(new SocialAction(player, 3));
					st.playSound(QuestState.SOUND_FINISH);
					st.exitQuest(false);
				}
				else
					htmltext = getHtmlText("31002-15.htm").replace("%weaponname%", WEAPONS.get(itemId));
			}
			else
				htmltext = "31002-16.htm";
		}
		
		return htmltext;
	}
	
	@Override
	public String onTalk(L2Npc npc, L2PcInstance player)
	{
		QuestState st = player.getQuestState(qn);
		String htmltext = getNoQuestMsg();
		if (st == null)
			return htmltext;
		
		switch (st.getState())
		{
			case STATE_CREATED:
				htmltext = (player.getLevel() < 75) ? "31002-01.htm" : "31002-02.htm";
				break;
			
			case STATE_STARTED:
				int cond = st.getInt("cond");
				switch (npc.getNpcId())
				{
					case 31002:
						if (cond == 1)
						{
							if (!st.hasQuestItems(REIRIA_SOUL_ORB))
								htmltext = "31002-04b.htm";
							else
							{
								htmltext = "31002-05.htm";
								st.set("cond", "2");
								st.playSound(QuestState.SOUND_MIDDLE);
								st.takeItems(REIRIA_SOUL_ORB, 1);
							}
						}
						else if (cond == 2)
						{
							if (!st.hasQuestItems(KERMON_INFERNIUM_SCEPTER) || !st.hasQuestItems(GOLKONDA_INFERNIUM_SCEPTER) || !st.hasQuestItems(HALLATE_INFERNIUM_SCEPTER))
								htmltext = "31002-05c.htm";
							else
							{
								htmltext = "31002-06.htm";
								st.set("cond", "3");
								st.playSound(QuestState.SOUND_MIDDLE);
								st.takeItems(GOLKONDA_INFERNIUM_SCEPTER, 1);
								st.takeItems(HALLATE_INFERNIUM_SCEPTER, 1);
								st.takeItems(KERMON_INFERNIUM_SCEPTER, 1);
							}
						}
						else if (cond == 3)
						{
							if (!st.hasQuestItems(INFERNIUM_VARNISH))
								htmltext = "31002-06b.htm";
							else
							{
								htmltext = "31002-07.htm";
								st.set("cond", "4");
								st.playSound(QuestState.SOUND_MIDDLE);
								st.takeItems(INFERNIUM_VARNISH, 1);
							}
						}
						else if (cond == 4)
						{
							if (!st.hasQuestItems(REORIN_HAMMER))
								htmltext = "31002-07b.htm";
							else
							{
								htmltext = "31002-08.htm";
								st.set("cond", "5");
								st.playSound(QuestState.SOUND_MIDDLE);
								st.takeItems(REORIN_HAMMER, 1);
							}
						}
						else if (cond > 4 && cond < 8)
							htmltext = "31002-08b.htm";
						else if (cond == 8)
						{
							htmltext = "31002-09.htm";
							st.set("cond", "9");
							st.playSound(QuestState.SOUND_MIDDLE);
							st.takeItems(REORIN_MOLD, 1);
						}
						else if (cond == 9)
						{
							if (st.getQuestItemsCount(CRYSTAL_B) < 984)
								htmltext = "31002-09b.htm";
							else
							{
								htmltext = "31002-BGradeList.htm";
								st.set("cond", "10");
								st.playSound(QuestState.SOUND_MIDDLE);
								st.takeItems(CRYSTAL_B, 984);
							}
						}
						else if (cond == 10)
						{
							// If a weapon is selected
							if (st.getInt("bypass") == 1)
							{
								// If you got it in the inventory
								final int itemId = st.getInt("weaponId");
								htmltext = getHtmlText((st.hasQuestItems(itemId)) ? "31002-AGradeList.htm" : "31002-15.htm").replace("%weaponname%", WEAPONS.get(itemId));
							}
							// B weapon is still not selected
							else
								htmltext = "31002-BGradeList.htm";
						}
						break;
					
					case 30182:
						if (cond == 3)
							htmltext = (!st.hasQuestItems(INFERNIUM_VARNISH)) ? "30182-01.htm" : "30182-02.htm";
						break;
					
					case 30847:
						if (cond == 4 && !st.hasQuestItems(REORIN_HAMMER))
						{
							htmltext = "30847-01.htm";
							st.playSound(QuestState.SOUND_ITEMGET);
							st.giveItems(REORIN_HAMMER, 1);
						}
						else if (cond >= 4 && st.hasQuestItems(REORIN_HAMMER))
							htmltext = "30847-02.htm";
						break;
					
					case 30178:
						if (cond == 5)
							htmltext = "30178-01.htm";
						else if (cond > 5)
							htmltext = "30178-02.htm";
						break;
					
					case 30833:
						if (cond == 6)
							htmltext = "30833-01.htm";
						else if (cond == 7)
						{
							if (st.hasQuestItems(PIPETTE_KNIFE) && !st.hasQuestItems(RED_PIPETTE_KNIFE))
								htmltext = "30833-02.htm";
							else
							{
								htmltext = "30833-03.htm";
								st.set("cond", "8");
								st.playSound(QuestState.SOUND_MIDDLE);
								st.takeItems(RED_PIPETTE_KNIFE, 1);
								st.giveItems(REORIN_MOLD, 1);
							}
						}
						else if (cond > 7)
							htmltext = "30833-04.htm";
						break;
					
					case 31027:
						if (cond == 1 && !st.hasQuestItems(REIRIA_SOUL_ORB))
						{
							htmltext = "31027-01.htm";
							st.playSound(QuestState.SOUND_ITEMGET);
							st.giveItems(REIRIA_SOUL_ORB, 1);
						}
						else
							htmltext = "31027-02.htm";
						break;
					
					case 31028:
					case 31029:
					case 31030:
						final int itemId = npc.getNpcId() - 26361;
						if (cond == 2 && !st.hasQuestItems(itemId))
						{
							htmltext = npc.getNpcId() + "-01.htm";
							st.playSound(QuestState.SOUND_ITEMGET);
							st.giveItems(itemId, 1);
						}
						else
							htmltext = npc.getNpcId() + "-02.htm";
						break;
				}
				break;
			
			case STATE_COMPLETED:
				htmltext = getAlreadyCompletedMsg();
				break;
		}
		
		return htmltext;
	}
	
	@Override
	public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isPet)
	{
		QuestState st = checkPlayerCondition(attacker, npc, "cond", "7");
		if (st == null)
			return null;
		
		if (attacker.getActiveWeaponItem() != null && attacker.getActiveWeaponItem().getItemId() == PIPETTE_KNIFE && !st.hasQuestItems(RED_PIPETTE_KNIFE))
		{
			st.playSound(QuestState.SOUND_ITEMGET);
			st.takeItems(PIPETTE_KNIFE, 1);
			st.giveItems(RED_PIPETTE_KNIFE, 1);
		}
		
		return null;
	}
	
	@Override
	public String onKill(L2Npc npc, L2PcInstance player, boolean isPet)
	{
		addSpawn(CHEST_SPAWN.get(npc.getNpcId()), npc, true, 120000, false);
		
		return null;
	}
	
	public static void main(String[] args)
	{
		new Q234_FatesWhisper();
	}
}
Edited by Bobi

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • Please note:i will provide you with forum address for registration once buyer sends money(my commission) to forum guarantor's payment details. You can register on forum in any day and in any time,which are convenient for you,send code word in private message to forum guarantor(you will receive code word from buyer). If buyer does not purchase your product,you will need to wait private message(answer) from forum guarantor to compare code word. I will invite you in "forum deal". I will add your name,which you registered on forum,in "forum deal". Then you write in "forum deal": "buyer did not purchase product" and add code word(you will have this right according to clause in forum questionnaire). Forum guarantor will refund buyer((in full amount). If buyer purchases your product,buyer notifies forum guarantor and forum guarantor will send money to my payment details.   Sports exercise machines,jacuzzi,building materials,cosmetics,perfumes,shoes,clothing,furniture,bags,televisions,music centers,telephones,laptops,tablet computers,refrigerators,washing machines,microwaves,fans.  
    • Here is a L2JMobius Classic Interlude FULL server. The share includes full server source+datapack, patch, interface and the P110 client. The original build is L2JMobius. However it was bought from a user called "ClassicLude (https://classic-lude.org/)" which is also a huge scammer, selling free Mobius files for $500. I could not believe someone actually bought this, yet here we are.    Unfortunately the admin is a scammer and refused to pay his remaining balance of over $150 to me since he is too busy "working for Bill Gates" and opening the next big mega mall in ChatGPT city therefore not having enough money. The server itself garnered a massive 30 players so I can't really tell you if this is usable. Knowing its backstory and that it is Mobius based i can surmise that it is NOT suitable for serious users. This build is the result of typical AI slop and vibecode "admins" thinking they just "one shotted L2J" because they discovered how to prompt an agent.   I have made the following changes, some of which were regrettably butchered by the admin after he discovered how to download Cursor. Not much more was done due to the absolute displeasure and misery of having to work on a Mobius server.   - Updated files to JDK 22 - Added l2 reborn community board - Added preview system for skins including mounts/agathions - Added AIO npc (buffer/store/teleporter) - Added QuickVar system - Added Ranking system (pvp/pk/online/level and moar) - Added raid boss list on community board - Added drop search+shift click with itemtooltip on community board and npc - Added l2 reborn styled flash windows and window borders and L2UI_CT1 - Added custom donate coin icon in the store swf - Fixed some random bugs like Hot Springs monsters not giving the disease     Links Source+Datapack: https://drive.google.com/file/d/1uMaTzSxKtnLxXC-VoZyHYW_OXq7Oof5L/view?usp=sharing Interface+Compiler+Client tools: https://drive.google.com/file/d/14IJWyYSDOjMycHnJ749H9dRXuv2JeYK3/view?usp=sharing Full Client: https://drive.google.com/file/d/1P7Yd9wI0XcWlLMFDPSdfTZgWhW_9JEii/view?usp=sharing
    • I logged in with this system, maybe its the patch shared by greenhope i don't remember i just downloaded it because i love C3 but no l2j or l2off c3 is good everything is buggy and this one too, also it has no geodata and i don't know if it has geoengine because i didn't see the config for it in the config folder. If someone had the latest l2jvn maybe it could be more stable but i don't think so at least without the source, if someone has it to share it that would be good  https://www.mediafire.com/file/mzodnsyi9qn4ap7/patch+560+for+c3.rar/file
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..