Skip to content
Snippets Groups Projects
Commit 503ef2b9 authored by malyelfik's avatar malyelfik
Browse files

BETA: Updating quest '''I Must Be a Genius (463)'''

parent 4a88ed7b
No related branches found
No related tags found
No related merge requests found
Showing
with 178 additions and 122 deletions
<html><body>Collector Gutenhagen:<br> <html><body>Collector Gutenhagen:<br>
You did it! I never doubted you. Yes, I prepared something for you. Here, this is a device unlike any other. Activating this device will give you a boost of energy and raise your intelligence. Sometimes it malfunctions... but, uhm... There won't be any problems, so trust me!<br> You did it! I never doubted you. Yes, I prepared something for you. Here, this is a device unlike any other. Activating this device will give you a boost of energy and raise your intelligence. Sometimes it malfunctions... but, uhm... There won't be any problems, so trust me!<br>
<a action="bypass -h Quest Q00463_IMustBeaGenius 32069-07.htm">Operate the device</a> <a action="bypass -h Quest Q00463_IMustBeaGenius reward">Operate the device</a>
</body></html> </body></html>
\ No newline at end of file
<html><body>Collector Gutenhagen:<br>
Huh? You're smart but also full of doubt, aren't you? I can't believe that you have not operated my device yet. Don't you trust me?! Or do you doubt my device?! I will give you one more chance!<br>
<a action="bypass -h Quest Q00463_IMustBeaGenius reward">Operate the device.</a>
</body></html>
\ No newline at end of file
<html><body>Collector Gutenhagen:<br> <html><body>Collector Gutenhagen:<br>
......Hm, hmm!!!<br> Oh, there you are, ready for more? Well I'm still analyzing the data you've brought.<br>
Well, well, well. This is strange... I haven't seen this before, no effects... Did I give you the wrong thing? It's not likely...<br> (This quest can be completed only once a day. This quest resets everyday at 6:30 am.)
Would you collect the logs again tomorrow? I'm sure everything will be working fine tomorrow.<br>
I think...
</body></html> </body></html>
\ No newline at end of file
<html><body>Collector Gutenhagen:<br>
Oh, there you are, ready for more? Well I'm still analyzing the data you've brought.<br>
(This quest can be completed only once a day. This quest resets everyday at 6:30 am.)
</body></html>
\ No newline at end of file
<html><body>Collector Gutenhagen:<br>
......Hm, hmm!!!<br>
Well, well, well. This is strange... I haven't seen this before, no effects... Did I give you the wrong thing? It's not likely...<br>
Would you collect the logs again tomorrow? I'm sure everything will be working fine tomorrow.<br>
I think...
</body></html>
\ No newline at end of file
<html><body>Collector Gutenhagen:<br>
Well, all's well that ends well! I'm surprised to see such a stable result. At this rate, I may be able to get a higher sale price.<br>
Hmm, hmm. By the way - why not come back tomorrow? I always welcome fresh mea- uhm, adventurers like you.
</body></html>
\ No newline at end of file
<html><body>Collector Gutenhagen:<br>
Yee-HAW!! Success!!<br>
All those times I took a hammer to this thing, and it finally works!! We must do it again someday!!
</body></html>
\ No newline at end of file
<html><body>Collector Gutenhagen:<br>
This is hard to believe!! You are the first to have this happen!! Don't you surge with wisdom? Aren't you teeming with uncontrollable energy?<br>
The result is amazing... Come back any day, I'll be ready.
</body></html>
\ No newline at end of file
...@@ -14,6 +14,9 @@ ...@@ -14,6 +14,9 @@
*/ */
package quests.Q00463_IMustBeaGenius; package quests.Q00463_IMustBeaGenius;
import java.util.HashMap;
import java.util.Map;
import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.quest.Quest; import com.l2jserver.gameserver.model.quest.Quest;
...@@ -23,85 +26,96 @@ import com.l2jserver.gameserver.model.quest.State; ...@@ -23,85 +26,96 @@ import com.l2jserver.gameserver.model.quest.State;
import com.l2jserver.gameserver.network.NpcStringId; import com.l2jserver.gameserver.network.NpcStringId;
import com.l2jserver.gameserver.network.clientpackets.Say2; import com.l2jserver.gameserver.network.clientpackets.Say2;
import com.l2jserver.gameserver.network.serverpackets.NpcSay; import com.l2jserver.gameserver.network.serverpackets.NpcSay;
import com.l2jserver.gameserver.util.Util;
/** /**
* I Must Be a Genius (463)<br> * I Must Be a Genius (463)<br>
* @author Gnacik * @author Gnacik, malyelfik
* @version 2010-08-19 Based on Freya PTS * @version 2010-08-19 Based on Freya PTS
*/ */
public class Q00463_IMustBeaGenius extends Quest public class Q00463_IMustBeaGenius extends Quest
{ {
private static final int _gutenhagen = 32069; // NPC
private static final int _corpse_log = 15510; private static final int GUTENHAGEN = 32069;
private static final int _collection = 15511;
private static final int[] _mobs = // Items
private static final int CORPSE_LOG = 15510;
private static final int COLLECTION = 15511;
// Mobs
private static final Map<Integer, DropInfo> MOBS = new HashMap<>();
static
{ {
22801, MOBS.put(22801, new DropInfo(5, 0));
22802, MOBS.put(22802, new DropInfo(5, 0));
22804, MOBS.put(22803, new DropInfo(5, 0));
22805, MOBS.put(22804, new DropInfo(-2, 1));
22807, MOBS.put(22805, new DropInfo(-2, 1));
22808, MOBS.put(22806, new DropInfo(-2, 1));
22809, MOBS.put(22807, new DropInfo(-1, -1));
22810, MOBS.put(22809, new DropInfo(2, 2));
22811, MOBS.put(22810, new DropInfo(-3, 3));
22812 MOBS.put(22811, new DropInfo(3, -1));
MOBS.put(22812, new DropInfo(1, -1));
}
// Reward @formatter:off
private static final int[][] REWARD =
{
// exp, sp, html
{198725, 15892, 8},
{278216, 22249, 8},
{317961, 25427, 8},
{357706, 28606, 9},
{397451, 31784, 9},
{596176, 47677, 9},
{715411, 57212, 10},
{794901, 63569, 10},
{914137, 73104, 10},
{1192352, 95353, 11}
}; };
// Misc @formatter:on
private static final int MIN_LEVEL = 70;
@Override @Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{ {
String htmltext = event;
final QuestState st = player.getQuestState(getName()); final QuestState st = player.getQuestState(getName());
if (st == null) if (st == null)
{ {
return htmltext; return null;
} }
if (npc.getNpcId() == _gutenhagen) String htmltext = event;
switch (event)
{ {
if (event.equalsIgnoreCase("32069-03.htm")) case "32069-03.htm":
{ st.startQuest();
st.playSound("ItemSound.quest_accept"); int number = getRandom(51) + 550;
st.setState(State.STARTED); st.set("number", String.valueOf(number));
st.set("cond", "1"); st.set("chance", String.valueOf(getRandom(4)));
// Generate random daily number for player htmltext = getHtm(player.getHtmlPrefix(), event).replace("%num%", String.valueOf(number));
int _number = getRandom(500, 600); break;
st.set("number", String.valueOf(_number)); case "32069-05.htm":
// Set drop for mobs htmltext = getHtm(player.getHtmlPrefix(), event).replace("%num%", st.get("number"));
for (int _mob : _mobs) break;
{ case "reward":
int _rand = getRandom(-2, 4); if (st.isCond(2))
if (_rand == 0)
{
_rand = 5;
}
st.set(String.valueOf(_mob), String.valueOf(_rand));
}
// One with higher chance
st.set(String.valueOf(_mobs[getRandom(_mobs.length)]), String.valueOf(getRandom(1, 100)));
htmltext = getHtm(st.getPlayer().getHtmlPrefix(), "32069-03.htm");
htmltext = htmltext.replace("%num%", String.valueOf(_number));
}
else if (event.equalsIgnoreCase("32069-05.htm"))
{
htmltext = getHtm(st.getPlayer().getHtmlPrefix(), "32069-05.htm");
htmltext = htmltext.replace("%num%", st.get("number"));
}
else if (event.equalsIgnoreCase("32069-07.htm"))
{
st.addExpAndSp(317961, 25427);
st.unset("cond");
st.unset("number");
for (int _mob : _mobs)
{ {
st.unset(String.valueOf(_mob)); int rnd = getRandom(REWARD.length);
String str = (REWARD[rnd][2] < 10) ? "0" + REWARD[rnd][2] : String.valueOf(REWARD[rnd][2]);
st.addExpAndSp(REWARD[rnd][0], REWARD[rnd][1]);
st.exitQuest(QuestType.DAILY, true);
htmltext = "32069-" + str + ".html";
} }
st.takeItems(_collection, -1); break;
st.playSound("ItemSound.quest_finish"); case "32069-02.htm":
st.exitQuest(QuestType.DAILY); break;
} default:
htmltext = null;
break;
} }
return htmltext; return htmltext;
} }
...@@ -110,41 +124,43 @@ public class Q00463_IMustBeaGenius extends Quest ...@@ -110,41 +124,43 @@ public class Q00463_IMustBeaGenius extends Quest
public String onTalk(L2Npc npc, L2PcInstance player) public String onTalk(L2Npc npc, L2PcInstance player)
{ {
String htmltext = getNoQuestMsg(player); String htmltext = getNoQuestMsg(player);
QuestState st = player.getQuestState(getName()); final QuestState st = player.getQuestState(getName());
if (st == null) if (st == null)
{ {
return htmltext; return htmltext;
} }
if (npc.getNpcId() == _gutenhagen) switch (st.getState())
{ {
switch (st.getState()) case State.COMPLETED:
{ if (!st.isNowAvailable())
case State.CREATED: {
htmltext = (player.getLevel() >= 70) ? "32069-01.htm" : "32069-00.htm"; htmltext = "32069-07.htm";
break;
case State.STARTED:
if (st.getInt("cond") == 1)
{
htmltext = "32069-04.htm";
}
else if (st.getInt("cond") == 2)
{
htmltext = "32069-06.htm";
}
break; break;
case State.COMPLETED: }
if (st.isNowAvailable()) st.setState(State.CREATED);
case State.CREATED:
htmltext = (player.getLevel() >= MIN_LEVEL) ? "32069-01.htm" : "32069-00.htm";
break;
case State.STARTED:
if (st.isCond(1))
{
htmltext = "32069-04.html";
}
else
{
if (st.getInt("var") == 1)
{ {
st.setState(State.CREATED); htmltext = "32069-06a.html";
htmltext = (player.getLevel() >= 70) ? "32069-01.htm" : "32069-00.htm";
} }
else else
{ {
htmltext = "32069-08.htm"; st.takeItems(COLLECTION, -1);
st.set("var", "1");
htmltext = "32069-06.html";
} }
break; }
} break;
} }
return htmltext; return htmltext;
} }
...@@ -155,59 +171,83 @@ public class Q00463_IMustBeaGenius extends Quest ...@@ -155,59 +171,83 @@ public class Q00463_IMustBeaGenius extends Quest
final QuestState st = player.getQuestState(getName()); final QuestState st = player.getQuestState(getName());
if (st == null) if (st == null)
{ {
return null; return super.onKill(npc, player, isPet);
} }
if (st.isStarted() && (st.getInt("cond") == 1) && Util.contains(_mobs, npc.getNpcId())) if (st.isCond(1))
{ {
int _day_number = st.getInt("number"); boolean msg = false;
int _number = st.getInt(String.valueOf(npc.getNpcId())); int number = MOBS.get(npc.getNpcId()).getCount();
if (_number > 0) if (MOBS.get(npc.getNpcId()).getSpecialChance() == st.getInt("chance"))
{ {
st.giveItems(_corpse_log, _number); number = getRandom(100) + 1;
st.playSound("ItemSound.quest_itemget");
NpcSay ns = new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getNpcId(), NpcStringId.ATT_ATTACK_S1_RO_ROGUE_S2);
ns.addStringParameter(player.getName());
ns.addStringParameter(String.valueOf(_number));
npc.broadcastPacket(ns);
} }
else if ((_number < 0) && ((st.getQuestItemsCount(_corpse_log) + _number) > 0))
if (number > 0)
{ {
st.takeItems(_corpse_log, Math.abs(_number)); st.giveItems(CORPSE_LOG, number);
st.playSound("ItemSound.quest_itemget"); msg = true;
NpcSay ns = new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getNpcId(), NpcStringId.ATT_ATTACK_S1_RO_ROGUE_S2);
ns.addStringParameter(player.getName());
ns.addStringParameter(String.valueOf(_number));
npc.broadcastPacket(ns);
} }
else if ((number < 0) && ((st.getQuestItemsCount(CORPSE_LOG) + number) > 0))
if (st.getQuestItemsCount(_corpse_log) == _day_number)
{ {
st.takeItems(_corpse_log, -1); st.takeItems(CORPSE_LOG, Math.abs(number));
st.giveItems(_collection, 1); msg = true;
st.set("cond", "2");
} }
if (msg)
{
final NpcSay ns = new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getNpcId(), NpcStringId.ATT_ATTACK_S1_RO_ROGUE_S2);
ns.addStringParameter(player.getName());
ns.addStringParameter(String.valueOf(number));
npc.broadcastPacket(ns);
st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
if (st.getQuestItemsCount(CORPSE_LOG) == st.getInt("number"))
{
st.takeItems(CORPSE_LOG, -1);
st.giveItems(COLLECTION, 1);
st.setCond(2, true);
}
}
} }
return null; return super.onKill(npc, player, isPet);
} }
public Q00463_IMustBeaGenius(int questId, String name, String descr) public Q00463_IMustBeaGenius(int questId, String name, String descr)
{ {
super(questId, name, descr); super(questId, name, descr);
addStartNpc(GUTENHAGEN);
addTalkId(GUTENHAGEN);
addKillId(MOBS.keySet());
addStartNpc(_gutenhagen); registerQuestItems(COLLECTION, CORPSE_LOG);
addTalkId(_gutenhagen);
addKillId(_mobs);
} }
public static void main(String[] args) public static void main(String[] args)
{ {
new Q00463_IMustBeaGenius(463, Q00463_IMustBeaGenius.class.getSimpleName(), "I Must Be a Genius"); new Q00463_IMustBeaGenius(463, Q00463_IMustBeaGenius.class.getSimpleName(), "I Must Be a Genius");
} }
}
private static class DropInfo
{
private final int _count;
private final int _chance;
public DropInfo(int count, int chance)
{
_count = count;
_chance = chance;
}
public int getSpecialChance()
{
return _chance;
}
public int getCount()
{
return _count;
}
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment