Jump to content
  • 0

Question

Posted

Hello Cheaters :)

 

I have one problem with the following quest. Once you start this quest you have to collect 4 different questitems. The error occurs when getting one specific quest item (RITRON_FRUIT) first. so if you kill the dire wolves forst to get all of their questitems (4 pieces actually - RITRON_FRUIT) the quest jumps forward and you cannot get all the other remaining questitems in order to complete this quest. the quest gets stuck and you wont be able to complete it.

 

on the other hand if you collect all other items first and the one of the dire wolf at last....everything is fine.

 

can someone help me to solve this problem. i cant see the error ^^

/*
 * Copyright (C) 2004-2014 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.Q00380_BringOutTheFlavorOfIngredients;

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

import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.holders.ItemChanceHolder;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.model.quest.QuestState;
import com.l2jserver.gameserver.model.quest.State;

/**
 * Bring Out the Flavor of Ingredients! (380)
 * @author Pandragon
 */
public final class Q00380_BringOutTheFlavorOfIngredients extends Quest
{
	// NPC
	private static final int ROLLAND = 30069;
	// Items
	private static final int ANTIDOTE = 1831;
	private static final int RITRON_FRUIT = 5895;
	private static final int MOON_FLOWER = 5896;
	private static final int LEECH_FLUIDS = 5897;
	// Monsters
	private static final Map<Integer, ItemChanceHolder> MONSTER_CHANCES = new HashMap<>();
	{
		MONSTER_CHANCES.put(20205, new ItemChanceHolder(RITRON_FRUIT, 0.1, 4)); // Dire Wolf
		MONSTER_CHANCES.put(20206, new ItemChanceHolder(MOON_FLOWER, 0.5, 20)); // Kadif Werewolf
		MONSTER_CHANCES.put(20225, new ItemChanceHolder(LEECH_FLUIDS, 0.5, 10)); // Giant Mist Leech
	}
	// Rewards
	private static final int RITRON_RECIPE = 5959;
	private static final int RITRON_DESSERT = 5960;
	// Misc
	private static final int MIN_LVL = 24;
	
	public Q00380_BringOutTheFlavorOfIngredients()
	{
		super(380, Q00380_BringOutTheFlavorOfIngredients.class.getSimpleName(), "Bring Out the Flavor of Ingredients!");
		addStartNpc(ROLLAND);
		addTalkId(ROLLAND);
		addKillId(MONSTER_CHANCES.keySet());
		registerQuestItems(RITRON_FRUIT, MOON_FLOWER, LEECH_FLUIDS);
	}
	
	@Override
	public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
	{
		final QuestState qs = getQuestState(player, false);
		String htmltext = null;
		if (qs != null)
		{
			switch (event)
			{
				case "30069-03.htm":
				case "30069-04.htm":
				case "30069-06.html":
				{
					htmltext = event;
					break;
				}
				case "30069-05.htm":
				{
					if (qs.isCreated())
					{
						qs.startQuest();
						htmltext = event;
					}
					break;
				}
				case "30069-13.html":
				{
					if (qs.isCond(9))
					{
						rewardItems(player, RITRON_RECIPE, 1);
						qs.exitQuest(true, true);
						htmltext = event;
					}
					break;
				}
			}
		}
		return htmltext;
	}
	
	@Override
	public String onTalk(L2Npc npc, L2PcInstance talker)
	{
		final QuestState qs = getQuestState(talker, true);
		String htmltext = getNoQuestMsg(talker);
		switch (qs.getState())
		{
			case State.CREATED:
			{
				htmltext = (talker.getLevel() >= MIN_LVL) ? "30069-02.htm" : "30069-01.htm";
				break;
			}
			case State.STARTED:
			{
				switch (qs.getCond())
				{
					case 1:
					case 2:
					case 3:
					case 4:
					{
						if ((getQuestItemsCount(talker, ANTIDOTE) >= 2) && (getQuestItemsCount(talker, RITRON_FRUIT) >= 4) && (getQuestItemsCount(talker, MOON_FLOWER) >= 20) && (getQuestItemsCount(talker, LEECH_FLUIDS) >= 10))
						{
							takeItems(talker, ANTIDOTE, 2);
							takeItems(talker, -1, RITRON_FRUIT, MOON_FLOWER, LEECH_FLUIDS);
							qs.setCond(5, true);
							htmltext = "30069-08.html";
						}
						else
						{
							htmltext = "30069-07.html";
						}
						break;
					}
					case 5:
					{
						qs.setCond(6, true);
						htmltext = "30069-09.html";
						break;
					}
					case 6:
					{
						qs.setCond(7, true);
						htmltext = "30069-10.html";
						break;
					}
					case 7:
					{
						qs.setCond(8, true);
						htmltext = "30069-11.html";
						break;
					}
					case 8:
					{
						rewardItems(talker, RITRON_DESSERT, 1);
						if (getRandom(100) < 56)
						{
							htmltext = "30069-15.html";
							qs.exitQuest(true, true);
						}
						else
						{
							qs.setCond(9, true);
							htmltext = "30069-12.html";
						}
						break;
					}
					case 9:
					{
						htmltext = "30069-12.html";
						break;
					}
				}
				break;
			}
			case State.COMPLETED:
			{
				htmltext = getAlreadyCompletedMsg(talker);
				break;
			}
		}
		return htmltext;
	}
	
	@Override
	public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
	{
		final QuestState qs = getRandomPartyMemberState(killer, -1, 3, npc);
		if ((qs != null) && (qs.getCond() < 4))
		{
			final ItemChanceHolder item = MONSTER_CHANCES.get(npc.getId());
			if (giveItemRandomly(qs.getPlayer(), npc, item.getId(), 1, item.getCount(), item.getChance(), true))
			{
				qs.setCond(qs.getCond() + 1, true);
			}
		}
		return super.onKill(npc, killer, isSummon);
	}
}

12 answers to this question

Recommended Posts

  • 0
Posted

cos im a person that dont likes to leech here are two quest fixes for other quests (latest version of lj2 h5 server)

 

- Brigands Sweep: Wrong HTML entries replaced with the correct ones so that the quest npc now has his texts

- Into the Dark Elven Forest: Wrong Quest End HTML Pointer removed and replaced with the correct one. You can complete this quest now.

 

Download

  • 0
Posted

It's not an error it's coded like that. onKill section.

            if (giveItemRandomly(qs.getPlayer(), npc, item.getId(), 1, item.getCount(), item.getChance(), true))
            {
                qs.setCond(qs.getCond() + 1, true);
            }

I don't have quest states, so I can't help you, but I guess the author wrote it as if you're cond 1, you jump cond 2, then cond 3. After cond 3 it stops to gives you, so if cond 4 is supposed to be ok, do a < 5 instead of < 4.

  • 0
Posted (edited)

But he can see how it's done / coded, and use some parts, at least in the place his code is broken  :P

Edited by SweeTs
  • 0
Posted (edited)

It's not an error it's coded like that. onKill section.

            if (giveItemRandomly(qs.getPlayer(), npc, item.getId(), 1, item.getCount(), item.getChance(), true))
            {
                qs.setCond(qs.getCond() + 1, true);
            }

I don't have quest states, so I can't help you, but I guess the author wrote it as if you're cond 1, you jump cond 2, then cond 3. After cond 3 it stops to gives you, so if cond 4 is supposed to be ok, do a < 5 instead of < 4.

Thanks for the hint. This fixed it:

public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
	{
		final QuestState qs = getRandomPartyMemberState(killer, -1, 3, npc);
		if ((qs != null) && (qs.getCond() < 4))
		{
			final ItemChanceHolder item = MONSTER_CHANCES.get(npc.getId());
			if (giveItemRandomly(qs.getPlayer(), npc, item.getId(), 1, item.getCount(), item.getChance(), true))
			{
				qs.setCond(1, true);
				
				if ((getQuestItemsCount(killer, ANTIDOTE) >= 2) && (getQuestItemsCount(killer, RITRON_FRUIT) >= 4) && (getQuestItemsCount(killer, MOON_FLOWER) >= 20) && (getQuestItemsCount(killer, LEECH_FLUIDS) >= 10))
				{
					qs.setCond(qs.getCond() + 1, true);
				}
			}
		}
		return super.onKill(npc, killer, isSummon);
	}

Thanks everyone  :))

Edited by snifi
  • 0
Posted

Those are the standard l2j quest scripts. i did not change anything except the last part. else the quest cond will jump when the player gets for example all four Ritron Fruits.

  • 0
  • 0
Posted

Yep. I took a look on that as you mentioned before. The script is way better than the common l2j one - structured, logical and easy to read. :)

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

    • wtf is your website lol ai slop
    • who have this files? or info about cached packets?
    • Hi maxcheaters, i am trying to bring back an old server ( L2Revenge) but with my own ideas, i only liked how it was and made the gameplay based on that just putting my own ideas.   So practicly is a PTS C6 with an extender that i work lately    Exp / SP is x45 adena is x200 and drops x5  so safe is +3 , max is unlimited and rate is 65% for both mage and fighter weapons I created a system that you can get on the levels the gear you need based on farm but for S grade theres a little farm to get some armor Tokens to unseal them. As you remember L2Revenge had olympiad / Tournament gear. So people abused them and had S grades that way just couldnt enchant them. So i made to be wearable only if u are nobless. That way i cancel this "exploit".  The server gives opportunity to solo and clans , epic gear ( epic weapons) or armors can be bought with raid tokens and you can craft them or get them with various ways Regarding Buffs: 24 buff slots no changes asked. Cov/Pony/Cat , siren - renewal - champion out of buffer , if u make the char as main roll u can use them or use the offline buffer system to sell them and get adenas. their time is 20 mins so that way we see again the " 1kk for rene/siren" or rec = song  Regarding armors: they are dropped ( parts ) from 3 only raids , rest lvl 76+ raids drop recipes , so crafting takes place (so if u are solo u can craft them )  there are 3 armors each armor have its purpose: Revenge Armors - Example for light ( its a glass cannon , high damage , less atk speed and less pdef ) - they mostly modify your base stats, so useable on sieges or off tank chars Titanium Armors - A little bit of balanced of all  Epic Armor - Daggers/Enchanters/Healers mostly but u can always combine your build    Regarding weapons: can be dropped from Monastery of Silence monsters or get them from NPC with Raid Tokens its like a 5% better than S grades and the S/A Activates at +4  Regarding retail gear: you need to unseal only S grades for a great amount of armor tokens all weapons on any grade need Soul crystals that are sold for adenas  stage 13 crystals are expensive or dropped from raids Regarding fun: There is a squash event a Fortress vs Fortress pvp event an RB Event at weekends and from Monday - Wednesday Tournament ( Olympiad is closed monday/tuesday/wednesday)  at tournament you can practice 1vs1 like olympiad but pots/ss allowed , gear allowed is only olympiad or tournament , each win of match gives u 5 glits at 100 glits u can be hero till restart Olympiad works the same way regarding gear allowance but works only thursday to friday and you win monthly hero Auction with Raid Tokens is activated Event medals from events can be exchanged for various items i try to make the oldschool with a little bit of new school systems Not planing to open it anytime soon as i still develop and make corrections to extender , looking forward to meet people that actually played this and are hyped to help on testing / development   P.S is c5 into interlude ( theres no akamanah / nor PI aswell , no lifestones) forgot to mention
    • Announcement – L2 Relic Server Opening Soon! We’re excited to share some great news! Our team has been working hard behind the scenes, and we’re nearly ready to launch our brand-new Lineage server this winter. The journey is just about to begin – so prepare yourselves! Gather your friends, sharpen your skills, and get ready to experience an epic adventure. Stay tuned for more details, updates, and the official beta-opening date. This winter, history will be written once again… are you ready?   Developed by https://dailyhost.eu/
  • 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