diff --git a/trunk/dist/game/data/scripts/quests/Q00500_BrothersBoundInChains/30981-01.htm b/trunk/dist/game/data/scripts/quests/Q00500_BrothersBoundInChains/30981-01.htm new file mode 100644 index 0000000000..a68bc98e76 --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00500_BrothersBoundInChains/30981-01.htm @@ -0,0 +1,18 @@ + + +Dark Judge: +

+I may look like this now, but I was once an angel of light. +But the light was put to sleep, and darkness filled the lands... +we fought, all of us angels, but it was a losing battle. +Then, when I was growing weary, the god of chaos beckoned. +"Chaos is the ultimate peace and silence," he whispered, and I did not have the strength to resist him. +
+
+But I ended up regretting my decision in the end. +So I made another deal with the god of chaos; I would bring him enough +"sins" to cancel out my own. So here's my offer to you: I will buy your sin. +After all, penitence is the only path to light. Will you accept? + + + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00500_BrothersBoundInChains/30981-02.htm b/trunk/dist/game/data/scripts/quests/Q00500_BrothersBoundInChains/30981-02.htm new file mode 100644 index 0000000000..d5df6cbae7 --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00500_BrothersBoundInChains/30981-02.htm @@ -0,0 +1,10 @@ + + +Dark Judge: +

+Do you wish to return to the light? +Then you, too, must bring back enough sens to cancel out your own. +To that end, you need tangible evidence for your penitence. + + + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00500_BrothersBoundInChains/30981-03.htm b/trunk/dist/game/data/scripts/quests/Q00500_BrothersBoundInChains/30981-03.htm new file mode 100644 index 0000000000..7ea3e4df6b --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00500_BrothersBoundInChains/30981-03.htm @@ -0,0 +1,8 @@ + + +Dark Judge: +

+The evidence is called Crumbs of Penitence, and you can get them through Sin Eater summoned with Penitent's Menacles. I can make Penitent's Manacles for you if you bring 200 Gemstones (B-Grade) from the village merchant. + + + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00500_BrothersBoundInChains/30981-04.htm b/trunk/dist/game/data/scripts/quests/Q00500_BrothersBoundInChains/30981-04.htm new file mode 100644 index 0000000000..129f025876 --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00500_BrothersBoundInChains/30981-04.htm @@ -0,0 +1,8 @@ + + +Dark Judge: +

+I will give you Penitent's Manacles so that you can summon the Sin Eater. Summoning the Sin Eater begins the Hour of Penitence, during which you can obtain Crumbs of Penitence by defeating as many monsters as possible. Bring me 10 Crumbs of Penitence, and I will free you of your sin. + + + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00500_BrothersBoundInChains/30981-05.html b/trunk/dist/game/data/scripts/quests/Q00500_BrothersBoundInChains/30981-05.html new file mode 100644 index 0000000000..19792bedd5 --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00500_BrothersBoundInChains/30981-05.html @@ -0,0 +1,7 @@ + + +Dark Judge: +

+It seems you don't have enough Gemstone (B-Grade). You can get them from a village grocer. Remember, you need 200 of them. + + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00500_BrothersBoundInChains/30981-06.htm b/trunk/dist/game/data/scripts/quests/Q00500_BrothersBoundInChains/30981-06.htm new file mode 100644 index 0000000000..7d8a93c803 --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00500_BrothersBoundInChains/30981-06.htm @@ -0,0 +1,7 @@ + + +Dark Judge: +

+Do not tarry; bring me 10 Crumbs of Penitence so that I can free you from your sin. But remember, bringing more than 10 will do no good, for not all sins can be cleared in one day. + + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00500_BrothersBoundInChains/30981-07.html b/trunk/dist/game/data/scripts/quests/Q00500_BrothersBoundInChains/30981-07.html new file mode 100644 index 0000000000..dbbc06f602 --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00500_BrothersBoundInChains/30981-07.html @@ -0,0 +1,7 @@ + + +Dark Judge: +

+It seems ou don't have enough Crumbs of Penitence yet. Did you forget how to obtain them ? Equip the Penitent's Manacles I have given you, summon Sin Eater, and defeat as many monsters as you can during the Hour of Penitence. You need 10 Crumbs of Penitence obtained from the battle. + + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00500_BrothersBoundInChains/30981-08.html b/trunk/dist/game/data/scripts/quests/Q00500_BrothersBoundInChains/30981-08.html new file mode 100644 index 0000000000..d66f25096a --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00500_BrothersBoundInChains/30981-08.html @@ -0,0 +1,8 @@ + + +Dark Judge: +
+What did you learn while gathering Crumbs of Penitence? Committing sin is easy, but reversing it is much less so. Never forget that every choice has consequence. Now, give me what you have gathered, and the Penitent's Manacles. I will clear away your sin. + + + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00500_BrothersBoundInChains/30981-09.html b/trunk/dist/game/data/scripts/quests/Q00500_BrothersBoundInChains/30981-09.html new file mode 100644 index 0000000000..c1d56c4ff2 --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00500_BrothersBoundInChains/30981-09.html @@ -0,0 +1 @@ +Dark Judge:
Now, your sins are forgiven. But not all sins can be forgiven in a day; there is only so much I can forgive today.
Never forget the regret and suffering you went through for your mistakes. \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00500_BrothersBoundInChains/30981-nopk.htm b/trunk/dist/game/data/scripts/quests/Q00500_BrothersBoundInChains/30981-nopk.htm new file mode 100644 index 0000000000..dc1297bc03 --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00500_BrothersBoundInChains/30981-nopk.htm @@ -0,0 +1,12 @@ + + +Black Judge: +

+Everyone commits sin, whether great or small. And when the sin becomes great, +you move away from the light until you become darkness. Sin is close to your nature, +and can only be eliminated when your soul is string. Come again sometime, +and I will help you step closer to the light. +

+(This quest is available only to main class characters who are level 61 or above, and have a PK count above 0.) + + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00500_BrothersBoundInChains/Q00500_BrothersBoundInChains.java b/trunk/dist/game/data/scripts/quests/Q00500_BrothersBoundInChains/Q00500_BrothersBoundInChains.java new file mode 100644 index 0000000000..1fe09a1926 --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00500_BrothersBoundInChains/Q00500_BrothersBoundInChains.java @@ -0,0 +1,206 @@ +/* + * This file is part of the L2J Mobius project. + * + * 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 . + */ +package quests.Q00500_BrothersBoundInChains; + +import com.l2jmobius.commons.util.Rnd; +import com.l2jmobius.gameserver.enums.QuestType; +import com.l2jmobius.gameserver.model.CharEffectList; +import com.l2jmobius.gameserver.model.actor.L2Npc; +import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.model.events.EventType; +import com.l2jmobius.gameserver.model.events.ListenerRegisterType; +import com.l2jmobius.gameserver.model.events.annotations.RegisterEvent; +import com.l2jmobius.gameserver.model.events.annotations.RegisterType; +import com.l2jmobius.gameserver.model.events.impl.character.npc.OnAttackableKill; +import com.l2jmobius.gameserver.model.quest.Quest; +import com.l2jmobius.gameserver.model.quest.QuestState; +import com.l2jmobius.gameserver.model.quest.State; + +/** + * @author Mathael + * @URL https://l2wiki.com/Brothers_Bound_in_Chains + * @version Infinite Odyssey + */ +public class Q00500_BrothersBoundInChains extends Quest +{ + // NPCs + private static final int DARK_JUDGE = 30981; + // Items + private static final int GEMSTONE_B = 2132; + private static final int PENITENT_MANACLES = 36060; // TODO: check: multiple items with this name + private static final int CRUMBS_OF_PENITENCE = 36077; + private static final int DROP_QI_CHANCE = 1; // in % TODO: check + // Misc + private static final int HOUR_OF_PENITENCE[] = + { + 15325, + 15326, + 15327, + 15328, + 15329 + }; + private static final int MIN_LEVEL = 60; + + public Q00500_BrothersBoundInChains() + { + super(500); + addStartNpc(DARK_JUDGE); + addTalkId(DARK_JUDGE); + registerQuestItems(PENITENT_MANACLES, CRUMBS_OF_PENITENCE); + addCondMinLevel(MIN_LEVEL, "30981-nopk.htm"); + } + + @Override + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) + { + final QuestState qs = getQuestState(player, false); + if (qs == null) + { + return getNoQuestMsg(player); + } + + switch (event) + { + case "30981-02.htm": + case "30981-03.htm": + { + break; + } + case "30981-04.htm": + { + if (takeItems(player, GEMSTONE_B, 200)) + { + giveItems(player, PENITENT_MANACLES, 1); + } + else + { + event = "30981-05.html"; + } + break; + } + case "30981-06.htm": + { + qs.startQuest(); + break; + } + case "30981-09.html": // not retail html. + { + if (takeItems(player, CRUMBS_OF_PENITENCE, 10)) + { + player.setPkKills(Math.max(0, player.getPkKills() - Rnd.get(1, 10))); + qs.exitQuest(QuestType.DAILY, true); + } + else + { + // If player delete QuestItems: Need check how it work on retail. + qs.setCond(1); + event = "30981-07.html"; + } + break; + } + default: + { + event = getNoQuestMsg(player); + } + } + + return event; + } + + @Override + public String onTalk(L2Npc npc, L2PcInstance talker) + { + String htmltext = getNoQuestMsg(talker); + final QuestState qs = getQuestState(talker, true); + + if (qs == null) + { + return htmltext; + } + + switch (qs.getState()) + { + case State.CREATED: + { + htmltext = (talker.getPkKills() > 0) && (talker.getReputation() >= 0) ? "30981-01.htm" : "30981-nopk.htm"; + break; + } + case State.STARTED: + { + switch (qs.getCond()) + { + case 1: + { + htmltext = "30981-07.html"; + break; + } + case 2: + { + htmltext = "30981-08.html"; // not retail html. + break; + } + } + break; + } + case State.COMPLETED: + { + if (qs.isNowAvailable()) + { + qs.setState(State.CREATED); + htmltext = "30981-01.htm"; + } + break; + } + } + + return htmltext; + } + + @RegisterEvent(EventType.ON_ATTACKABLE_KILL) + @RegisterType(ListenerRegisterType.GLOBAL_MONSTERS) + public void onAttackableKill(OnAttackableKill event) + { + final QuestState qs = getQuestState(event.getAttacker(), false); + if (qs == null) + { + return; + } + + // Player can drop more than 10 Crumbs of Penitence but there's no point in getting more than 10 (retail) + boolean isAffectedByHourOfPenitence = false; + final CharEffectList effects = event.getAttacker().getEffectList(); + for (int i = 0; !isAffectedByHourOfPenitence && (i < HOUR_OF_PENITENCE.length); i++) + { + if (effects.isAffectedBySkill(HOUR_OF_PENITENCE[i])) + { + isAffectedByHourOfPenitence = true; + } + } + + if (isAffectedByHourOfPenitence) + { + if (Rnd.get(1, 100) <= DROP_QI_CHANCE) + { + giveItems(event.getAttacker(), CRUMBS_OF_PENITENCE, 1); + if (!qs.isCond(2) && (getQuestItemsCount(event.getAttacker(), CRUMBS_OF_PENITENCE) >= 10)) + { + qs.setCond(2, true); + } + } + } + } +} diff --git a/trunk/dist/game/data/scripts/quests/QuestMasterHandler.java b/trunk/dist/game/data/scripts/quests/QuestMasterHandler.java index 6c71df8a26..47729f77da 100644 --- a/trunk/dist/game/data/scripts/quests/QuestMasterHandler.java +++ b/trunk/dist/game/data/scripts/quests/QuestMasterHandler.java @@ -16,9 +16,6 @@ */ package quests; -import java.util.logging.Level; -import java.util.logging.Logger; - import quests.Q00013_ParcelDelivery.Q00013_ParcelDelivery; import quests.Q00015_SweetWhispers.Q00015_SweetWhispers; import quests.Q00016_TheComingDarkness.Q00016_TheComingDarkness; @@ -131,6 +128,7 @@ import quests.Q00496_IncarnationOfGluttonyKaliosGroup.Q00496_IncarnationOfGlutto import quests.Q00497_IncarnationOfGreedZellakaSolo.Q00497_IncarnationOfGreedZellakaSolo; import quests.Q00498_IncarnationOfJealousyPellineSolo.Q00498_IncarnationOfJealousyPellineSolo; import quests.Q00499_IncarnationOfGluttonyKaliosSolo.Q00499_IncarnationOfGluttonyKaliosSolo; +import quests.Q00500_BrothersBoundInChains.Q00500_BrothersBoundInChains; import quests.Q00501_ProofOfClanAlliance.Q00501_ProofOfClanAlliance; import quests.Q00508_AClansReputation.Q00508_AClansReputation; import quests.Q00509_AClansFame.Q00509_AClansFame; @@ -331,6 +329,9 @@ import quests.Q10813_ForGlory.Q10813_ForGlory; import quests.Q10814_BefittingOfTheStatus.Q10814_BefittingOfTheStatus; import quests.Q10815_StepUp.Q10815_StepUp; +import java.util.logging.Level; +import java.util.logging.Logger; + /** * @author NosBit */ @@ -452,6 +453,7 @@ public class QuestMasterHandler Q00497_IncarnationOfGreedZellakaSolo.class, Q00498_IncarnationOfJealousyPellineSolo.class, Q00499_IncarnationOfGluttonyKaliosSolo.class, + Q00500_BrothersBoundInChains.class, Q00501_ProofOfClanAlliance.class, Q00508_AClansReputation.class, Q00509_AClansFame.class,