From ca45dfa9f783e043e8d7bb8af7bb0483b7ffa3dd Mon Sep 17 00:00:00 2001 From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com> Date: Fri, 1 Dec 2017 05:04:39 +0000 Subject: [PATCH] Updated Olympiad buffer. Adapted from: L2jUnity free files. --- .../others/OlyBuffer/OlyBuffer-afterBuff.html | 22 ------ .../ai/others/OlyBuffer/OlyBuffer-index.html | 23 ------ .../ai/others/OlyBuffer/OlyBuffer-noMore.html | 10 --- .../ai/others/OlyBuffer/OlyBuffer.java | 78 +++++++++++-------- .../others/OlyBuffer/olympiad_master001.htm | 21 +++++ .../others/OlyBuffer/olympiad_master003.htm | 10 +++ .../others/OlyBuffer/OlyBuffer-afterBuff.html | 22 ------ .../ai/others/OlyBuffer/OlyBuffer-index.html | 23 ------ .../ai/others/OlyBuffer/OlyBuffer-noMore.html | 10 --- .../ai/others/OlyBuffer/OlyBuffer.java | 78 +++++++++++-------- .../others/OlyBuffer/olympiad_master001.htm | 21 +++++ .../others/OlyBuffer/olympiad_master003.htm | 10 +++ .../others/OlyBuffer/OlyBuffer-afterBuff.html | 22 ------ .../ai/others/OlyBuffer/OlyBuffer-index.html | 23 ------ .../ai/others/OlyBuffer/OlyBuffer-noMore.html | 10 --- .../ai/others/OlyBuffer/OlyBuffer.java | 78 +++++++++++-------- .../others/OlyBuffer/olympiad_master001.htm | 21 +++++ .../others/OlyBuffer/olympiad_master003.htm | 10 +++ .../others/OlyBuffer/OlyBuffer-afterBuff.html | 22 ------ .../ai/others/OlyBuffer/OlyBuffer-index.html | 23 ------ .../ai/others/OlyBuffer/OlyBuffer-noMore.html | 10 --- .../ai/others/OlyBuffer/OlyBuffer.java | 78 +++++++++++-------- .../others/OlyBuffer/olympiad_master001.htm | 21 +++++ .../others/OlyBuffer/olympiad_master003.htm | 10 +++ 24 files changed, 300 insertions(+), 356 deletions(-) delete mode 100644 L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-afterBuff.html delete mode 100644 L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-index.html delete mode 100644 L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-noMore.html create mode 100644 L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/others/OlyBuffer/olympiad_master001.htm create mode 100644 L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/others/OlyBuffer/olympiad_master003.htm delete mode 100644 L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-afterBuff.html delete mode 100644 L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-index.html delete mode 100644 L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-noMore.html create mode 100644 L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/others/OlyBuffer/olympiad_master001.htm create mode 100644 L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/others/OlyBuffer/olympiad_master003.htm delete mode 100644 L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-afterBuff.html delete mode 100644 L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-index.html delete mode 100644 L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-noMore.html create mode 100644 L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/OlyBuffer/olympiad_master001.htm create mode 100644 L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/OlyBuffer/olympiad_master003.htm delete mode 100644 L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-afterBuff.html delete mode 100644 L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-index.html delete mode 100644 L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-noMore.html create mode 100644 L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/others/OlyBuffer/olympiad_master001.htm create mode 100644 L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/others/OlyBuffer/olympiad_master003.htm diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-afterBuff.html b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-afterBuff.html deleted file mode 100644 index 62d1700053..0000000000 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-afterBuff.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - -
Please choose buff skills from below.
- (Harmony buffs are not stackable.)

-
- - - - - - - - - -
-
- \ No newline at end of file diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-index.html b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-index.html deleted file mode 100644 index 8e3b99fe41..0000000000 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-index.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - -
I wish all participants luck and success.
Please choose 5 buffs from the following.

-
- - - - - - - - - -
-
- \ No newline at end of file diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-noMore.html b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-noMore.html deleted file mode 100644 index 5235f044bd..0000000000 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-noMore.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - -
All buffs have been provided.
May you achieve victory.
- \ No newline at end of file diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer.java index 9c80460ec5..bac5d18377 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer.java @@ -16,11 +16,11 @@ */ package ai.others.OlyBuffer; -import com.l2jmobius.commons.util.CommonUtil; -import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.model.actor.L2Npc; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.model.holders.SkillHolder; import com.l2jmobius.gameserver.model.skills.Skill; +import com.l2jmobius.gameserver.model.skills.SkillCaster; import ai.AbstractNpcAI; @@ -33,17 +33,17 @@ public final class OlyBuffer extends AbstractNpcAI // NPC private static final int OLYMPIAD_BUFFER = 36402; // Skills - private static final int[] ALLOWED_BUFFS = + private static final SkillHolder KNIGHT = new SkillHolder(14744, 1); // Olympiad - Knight's Harmony + private static final SkillHolder WARRIOR = new SkillHolder(14745, 1); // Olympiad - Warrior's Harmony + private static final SkillHolder WIZARD = new SkillHolder(14746, 1); // Olympiad - Wizard's Harmony + private static final SkillHolder[] BUFFS = { - 14738, // Olympiad - Horn Melody - 14739, // Olympiad - Drum Melody - 14740, // Olympiad - Pipe Organ Melody - 14741, // Olympiad - Guitar Melody - 14742, // Olympiad - Harp Melody - 14743, // Olympiad - Lute Melody - 14744, // Olympiad - Knight's Harmony - 14745, // Olympiad - Warrior's Harmony - 14746, // Olympiad - Wizard's Harmony + new SkillHolder(14738, 1), // Olympiad - Horn Melody + new SkillHolder(14739, 1), // Olympiad - Drum Melody + new SkillHolder(14740, 1), // Olympiad - Pipe Organ Melody + new SkillHolder(14741, 1), // Olympiad - Guitar Melody + new SkillHolder(14742, 1), // Olympiad - Harp Melody + new SkillHolder(14743, 1), // Olympiad - Lute Melody }; private OlyBuffer() @@ -57,9 +57,10 @@ public final class OlyBuffer extends AbstractNpcAI public String onFirstTalk(L2Npc npc, L2PcInstance player) { String htmltext = null; - if (npc.getScriptValue() < 5) + + if (npc.isScriptValue(0)) { - htmltext = "OlyBuffer-index.html"; + htmltext = "olympiad_master001.htm"; } return htmltext; } @@ -68,33 +69,42 @@ public final class OlyBuffer extends AbstractNpcAI public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - if (event.startsWith("giveBuff;") && (npc.getScriptValue() < 5)) + + switch (event) { - final int buffId = Integer.parseInt(event.replace("giveBuff;", "")); - if (CommonUtil.contains(ALLOWED_BUFFS, buffId)) + case "guardian": { - final Skill buff = SkillData.getInstance().getSkill(buffId, 1); - if (buff != null) - { - npc.setScriptValue(npc.getScriptValue() + 1); - addSkillCastDesire(npc, player, buff, 23); - htmltext = "OlyBuffer-afterBuff.html"; - } - - if (npc.getScriptValue() >= 5) - { - htmltext = "OlyBuffer-noMore.html"; - startQuestTimer("DELETE_ME", 5000, npc, null); - } + htmltext = applyBuffs(npc, player, KNIGHT.getSkill()); + break; + } + case "berserker": + { + htmltext = applyBuffs(npc, player, WARRIOR.getSkill()); + break; + } + case "magician": + { + htmltext = applyBuffs(npc, player, WIZARD.getSkill()); + break; } } - else if (event.equals("DELETE_ME") && (npc != null)) - { - npc.deleteMe(); - } + npc.setScriptValue(1); + htmltext = "olympiad_master003.htm"; + getTimers().addTimer("DELETE_ME", 5000, evnt -> npc.deleteMe()); + return htmltext; } + private String applyBuffs(L2Npc npc, L2PcInstance player, Skill skill) + { + for (SkillHolder holder : BUFFS) + { + SkillCaster.triggerCast(npc, player, holder.getSkill()); + } + SkillCaster.triggerCast(npc, player, skill); + return null; + } + public static void main(String[] args) { new OlyBuffer(); diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/others/OlyBuffer/olympiad_master001.htm b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/others/OlyBuffer/olympiad_master001.htm new file mode 100644 index 0000000000..a268a425ed --- /dev/null +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/others/OlyBuffer/olympiad_master001.htm @@ -0,0 +1,21 @@ + + + + + + + + + + + +
I wish luck to all participants.
Select one of the following Supplemental Magic Sets.
+
+
+
+ + + +
+
+ \ No newline at end of file diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/others/OlyBuffer/olympiad_master003.htm b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/others/OlyBuffer/olympiad_master003.htm new file mode 100644 index 0000000000..32219b14c5 --- /dev/null +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/others/OlyBuffer/olympiad_master003.htm @@ -0,0 +1,10 @@ + + + + + + + + +
We gave you the selected Supplemental Magic Set.
I wish luck to all warriors.
+ \ No newline at end of file diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-afterBuff.html b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-afterBuff.html deleted file mode 100644 index 62d1700053..0000000000 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-afterBuff.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - -
Please choose buff skills from below.
- (Harmony buffs are not stackable.)

-
- - - - - - - - - -
-
- \ No newline at end of file diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-index.html b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-index.html deleted file mode 100644 index 8e3b99fe41..0000000000 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-index.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - -
I wish all participants luck and success.
Please choose 5 buffs from the following.

-
- - - - - - - - - -
-
- \ No newline at end of file diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-noMore.html b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-noMore.html deleted file mode 100644 index 5235f044bd..0000000000 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-noMore.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - -
All buffs have been provided.
May you achieve victory.
- \ No newline at end of file diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer.java index 9c80460ec5..bac5d18377 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer.java @@ -16,11 +16,11 @@ */ package ai.others.OlyBuffer; -import com.l2jmobius.commons.util.CommonUtil; -import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.model.actor.L2Npc; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.model.holders.SkillHolder; import com.l2jmobius.gameserver.model.skills.Skill; +import com.l2jmobius.gameserver.model.skills.SkillCaster; import ai.AbstractNpcAI; @@ -33,17 +33,17 @@ public final class OlyBuffer extends AbstractNpcAI // NPC private static final int OLYMPIAD_BUFFER = 36402; // Skills - private static final int[] ALLOWED_BUFFS = + private static final SkillHolder KNIGHT = new SkillHolder(14744, 1); // Olympiad - Knight's Harmony + private static final SkillHolder WARRIOR = new SkillHolder(14745, 1); // Olympiad - Warrior's Harmony + private static final SkillHolder WIZARD = new SkillHolder(14746, 1); // Olympiad - Wizard's Harmony + private static final SkillHolder[] BUFFS = { - 14738, // Olympiad - Horn Melody - 14739, // Olympiad - Drum Melody - 14740, // Olympiad - Pipe Organ Melody - 14741, // Olympiad - Guitar Melody - 14742, // Olympiad - Harp Melody - 14743, // Olympiad - Lute Melody - 14744, // Olympiad - Knight's Harmony - 14745, // Olympiad - Warrior's Harmony - 14746, // Olympiad - Wizard's Harmony + new SkillHolder(14738, 1), // Olympiad - Horn Melody + new SkillHolder(14739, 1), // Olympiad - Drum Melody + new SkillHolder(14740, 1), // Olympiad - Pipe Organ Melody + new SkillHolder(14741, 1), // Olympiad - Guitar Melody + new SkillHolder(14742, 1), // Olympiad - Harp Melody + new SkillHolder(14743, 1), // Olympiad - Lute Melody }; private OlyBuffer() @@ -57,9 +57,10 @@ public final class OlyBuffer extends AbstractNpcAI public String onFirstTalk(L2Npc npc, L2PcInstance player) { String htmltext = null; - if (npc.getScriptValue() < 5) + + if (npc.isScriptValue(0)) { - htmltext = "OlyBuffer-index.html"; + htmltext = "olympiad_master001.htm"; } return htmltext; } @@ -68,33 +69,42 @@ public final class OlyBuffer extends AbstractNpcAI public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - if (event.startsWith("giveBuff;") && (npc.getScriptValue() < 5)) + + switch (event) { - final int buffId = Integer.parseInt(event.replace("giveBuff;", "")); - if (CommonUtil.contains(ALLOWED_BUFFS, buffId)) + case "guardian": { - final Skill buff = SkillData.getInstance().getSkill(buffId, 1); - if (buff != null) - { - npc.setScriptValue(npc.getScriptValue() + 1); - addSkillCastDesire(npc, player, buff, 23); - htmltext = "OlyBuffer-afterBuff.html"; - } - - if (npc.getScriptValue() >= 5) - { - htmltext = "OlyBuffer-noMore.html"; - startQuestTimer("DELETE_ME", 5000, npc, null); - } + htmltext = applyBuffs(npc, player, KNIGHT.getSkill()); + break; + } + case "berserker": + { + htmltext = applyBuffs(npc, player, WARRIOR.getSkill()); + break; + } + case "magician": + { + htmltext = applyBuffs(npc, player, WIZARD.getSkill()); + break; } } - else if (event.equals("DELETE_ME") && (npc != null)) - { - npc.deleteMe(); - } + npc.setScriptValue(1); + htmltext = "olympiad_master003.htm"; + getTimers().addTimer("DELETE_ME", 5000, evnt -> npc.deleteMe()); + return htmltext; } + private String applyBuffs(L2Npc npc, L2PcInstance player, Skill skill) + { + for (SkillHolder holder : BUFFS) + { + SkillCaster.triggerCast(npc, player, holder.getSkill()); + } + SkillCaster.triggerCast(npc, player, skill); + return null; + } + public static void main(String[] args) { new OlyBuffer(); diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/others/OlyBuffer/olympiad_master001.htm b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/others/OlyBuffer/olympiad_master001.htm new file mode 100644 index 0000000000..a268a425ed --- /dev/null +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/others/OlyBuffer/olympiad_master001.htm @@ -0,0 +1,21 @@ + + + + + + + + + + + +
I wish luck to all participants.
Select one of the following Supplemental Magic Sets.
+
+
+
+ + + +
+
+ \ No newline at end of file diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/others/OlyBuffer/olympiad_master003.htm b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/others/OlyBuffer/olympiad_master003.htm new file mode 100644 index 0000000000..32219b14c5 --- /dev/null +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/others/OlyBuffer/olympiad_master003.htm @@ -0,0 +1,10 @@ + + + + + + + + +
We gave you the selected Supplemental Magic Set.
I wish luck to all warriors.
+ \ No newline at end of file diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-afterBuff.html b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-afterBuff.html deleted file mode 100644 index 62d1700053..0000000000 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-afterBuff.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - -
Please choose buff skills from below.
- (Harmony buffs are not stackable.)

-
- - - - - - - - - -
-
- \ No newline at end of file diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-index.html b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-index.html deleted file mode 100644 index 8e3b99fe41..0000000000 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-index.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - -
I wish all participants luck and success.
Please choose 5 buffs from the following.

-
- - - - - - - - - -
-
- \ No newline at end of file diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-noMore.html b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-noMore.html deleted file mode 100644 index 5235f044bd..0000000000 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-noMore.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - -
All buffs have been provided.
May you achieve victory.
- \ No newline at end of file diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer.java index 9c80460ec5..bac5d18377 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer.java @@ -16,11 +16,11 @@ */ package ai.others.OlyBuffer; -import com.l2jmobius.commons.util.CommonUtil; -import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.model.actor.L2Npc; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.model.holders.SkillHolder; import com.l2jmobius.gameserver.model.skills.Skill; +import com.l2jmobius.gameserver.model.skills.SkillCaster; import ai.AbstractNpcAI; @@ -33,17 +33,17 @@ public final class OlyBuffer extends AbstractNpcAI // NPC private static final int OLYMPIAD_BUFFER = 36402; // Skills - private static final int[] ALLOWED_BUFFS = + private static final SkillHolder KNIGHT = new SkillHolder(14744, 1); // Olympiad - Knight's Harmony + private static final SkillHolder WARRIOR = new SkillHolder(14745, 1); // Olympiad - Warrior's Harmony + private static final SkillHolder WIZARD = new SkillHolder(14746, 1); // Olympiad - Wizard's Harmony + private static final SkillHolder[] BUFFS = { - 14738, // Olympiad - Horn Melody - 14739, // Olympiad - Drum Melody - 14740, // Olympiad - Pipe Organ Melody - 14741, // Olympiad - Guitar Melody - 14742, // Olympiad - Harp Melody - 14743, // Olympiad - Lute Melody - 14744, // Olympiad - Knight's Harmony - 14745, // Olympiad - Warrior's Harmony - 14746, // Olympiad - Wizard's Harmony + new SkillHolder(14738, 1), // Olympiad - Horn Melody + new SkillHolder(14739, 1), // Olympiad - Drum Melody + new SkillHolder(14740, 1), // Olympiad - Pipe Organ Melody + new SkillHolder(14741, 1), // Olympiad - Guitar Melody + new SkillHolder(14742, 1), // Olympiad - Harp Melody + new SkillHolder(14743, 1), // Olympiad - Lute Melody }; private OlyBuffer() @@ -57,9 +57,10 @@ public final class OlyBuffer extends AbstractNpcAI public String onFirstTalk(L2Npc npc, L2PcInstance player) { String htmltext = null; - if (npc.getScriptValue() < 5) + + if (npc.isScriptValue(0)) { - htmltext = "OlyBuffer-index.html"; + htmltext = "olympiad_master001.htm"; } return htmltext; } @@ -68,33 +69,42 @@ public final class OlyBuffer extends AbstractNpcAI public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - if (event.startsWith("giveBuff;") && (npc.getScriptValue() < 5)) + + switch (event) { - final int buffId = Integer.parseInt(event.replace("giveBuff;", "")); - if (CommonUtil.contains(ALLOWED_BUFFS, buffId)) + case "guardian": { - final Skill buff = SkillData.getInstance().getSkill(buffId, 1); - if (buff != null) - { - npc.setScriptValue(npc.getScriptValue() + 1); - addSkillCastDesire(npc, player, buff, 23); - htmltext = "OlyBuffer-afterBuff.html"; - } - - if (npc.getScriptValue() >= 5) - { - htmltext = "OlyBuffer-noMore.html"; - startQuestTimer("DELETE_ME", 5000, npc, null); - } + htmltext = applyBuffs(npc, player, KNIGHT.getSkill()); + break; + } + case "berserker": + { + htmltext = applyBuffs(npc, player, WARRIOR.getSkill()); + break; + } + case "magician": + { + htmltext = applyBuffs(npc, player, WIZARD.getSkill()); + break; } } - else if (event.equals("DELETE_ME") && (npc != null)) - { - npc.deleteMe(); - } + npc.setScriptValue(1); + htmltext = "olympiad_master003.htm"; + getTimers().addTimer("DELETE_ME", 5000, evnt -> npc.deleteMe()); + return htmltext; } + private String applyBuffs(L2Npc npc, L2PcInstance player, Skill skill) + { + for (SkillHolder holder : BUFFS) + { + SkillCaster.triggerCast(npc, player, holder.getSkill()); + } + SkillCaster.triggerCast(npc, player, skill); + return null; + } + public static void main(String[] args) { new OlyBuffer(); diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/OlyBuffer/olympiad_master001.htm b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/OlyBuffer/olympiad_master001.htm new file mode 100644 index 0000000000..a268a425ed --- /dev/null +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/OlyBuffer/olympiad_master001.htm @@ -0,0 +1,21 @@ + + + + + + + + + + + +
I wish luck to all participants.
Select one of the following Supplemental Magic Sets.
+
+
+
+ + + +
+
+ \ No newline at end of file diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/OlyBuffer/olympiad_master003.htm b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/OlyBuffer/olympiad_master003.htm new file mode 100644 index 0000000000..32219b14c5 --- /dev/null +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/OlyBuffer/olympiad_master003.htm @@ -0,0 +1,10 @@ + + + + + + + + +
We gave you the selected Supplemental Magic Set.
I wish luck to all warriors.
+ \ No newline at end of file diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-afterBuff.html b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-afterBuff.html deleted file mode 100644 index 62d1700053..0000000000 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-afterBuff.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - -
Please choose buff skills from below.
- (Harmony buffs are not stackable.)

-
- - - - - - - - - -
-
- \ No newline at end of file diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-index.html b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-index.html deleted file mode 100644 index 8e3b99fe41..0000000000 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-index.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - -
I wish all participants luck and success.
Please choose 5 buffs from the following.

-
- - - - - - - - - -
-
- \ No newline at end of file diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-noMore.html b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-noMore.html deleted file mode 100644 index 5235f044bd..0000000000 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer-noMore.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - -
All buffs have been provided.
May you achieve victory.
- \ No newline at end of file diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer.java index 9c80460ec5..bac5d18377 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/others/OlyBuffer/OlyBuffer.java @@ -16,11 +16,11 @@ */ package ai.others.OlyBuffer; -import com.l2jmobius.commons.util.CommonUtil; -import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.model.actor.L2Npc; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.model.holders.SkillHolder; import com.l2jmobius.gameserver.model.skills.Skill; +import com.l2jmobius.gameserver.model.skills.SkillCaster; import ai.AbstractNpcAI; @@ -33,17 +33,17 @@ public final class OlyBuffer extends AbstractNpcAI // NPC private static final int OLYMPIAD_BUFFER = 36402; // Skills - private static final int[] ALLOWED_BUFFS = + private static final SkillHolder KNIGHT = new SkillHolder(14744, 1); // Olympiad - Knight's Harmony + private static final SkillHolder WARRIOR = new SkillHolder(14745, 1); // Olympiad - Warrior's Harmony + private static final SkillHolder WIZARD = new SkillHolder(14746, 1); // Olympiad - Wizard's Harmony + private static final SkillHolder[] BUFFS = { - 14738, // Olympiad - Horn Melody - 14739, // Olympiad - Drum Melody - 14740, // Olympiad - Pipe Organ Melody - 14741, // Olympiad - Guitar Melody - 14742, // Olympiad - Harp Melody - 14743, // Olympiad - Lute Melody - 14744, // Olympiad - Knight's Harmony - 14745, // Olympiad - Warrior's Harmony - 14746, // Olympiad - Wizard's Harmony + new SkillHolder(14738, 1), // Olympiad - Horn Melody + new SkillHolder(14739, 1), // Olympiad - Drum Melody + new SkillHolder(14740, 1), // Olympiad - Pipe Organ Melody + new SkillHolder(14741, 1), // Olympiad - Guitar Melody + new SkillHolder(14742, 1), // Olympiad - Harp Melody + new SkillHolder(14743, 1), // Olympiad - Lute Melody }; private OlyBuffer() @@ -57,9 +57,10 @@ public final class OlyBuffer extends AbstractNpcAI public String onFirstTalk(L2Npc npc, L2PcInstance player) { String htmltext = null; - if (npc.getScriptValue() < 5) + + if (npc.isScriptValue(0)) { - htmltext = "OlyBuffer-index.html"; + htmltext = "olympiad_master001.htm"; } return htmltext; } @@ -68,33 +69,42 @@ public final class OlyBuffer extends AbstractNpcAI public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; - if (event.startsWith("giveBuff;") && (npc.getScriptValue() < 5)) + + switch (event) { - final int buffId = Integer.parseInt(event.replace("giveBuff;", "")); - if (CommonUtil.contains(ALLOWED_BUFFS, buffId)) + case "guardian": { - final Skill buff = SkillData.getInstance().getSkill(buffId, 1); - if (buff != null) - { - npc.setScriptValue(npc.getScriptValue() + 1); - addSkillCastDesire(npc, player, buff, 23); - htmltext = "OlyBuffer-afterBuff.html"; - } - - if (npc.getScriptValue() >= 5) - { - htmltext = "OlyBuffer-noMore.html"; - startQuestTimer("DELETE_ME", 5000, npc, null); - } + htmltext = applyBuffs(npc, player, KNIGHT.getSkill()); + break; + } + case "berserker": + { + htmltext = applyBuffs(npc, player, WARRIOR.getSkill()); + break; + } + case "magician": + { + htmltext = applyBuffs(npc, player, WIZARD.getSkill()); + break; } } - else if (event.equals("DELETE_ME") && (npc != null)) - { - npc.deleteMe(); - } + npc.setScriptValue(1); + htmltext = "olympiad_master003.htm"; + getTimers().addTimer("DELETE_ME", 5000, evnt -> npc.deleteMe()); + return htmltext; } + private String applyBuffs(L2Npc npc, L2PcInstance player, Skill skill) + { + for (SkillHolder holder : BUFFS) + { + SkillCaster.triggerCast(npc, player, holder.getSkill()); + } + SkillCaster.triggerCast(npc, player, skill); + return null; + } + public static void main(String[] args) { new OlyBuffer(); diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/others/OlyBuffer/olympiad_master001.htm b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/others/OlyBuffer/olympiad_master001.htm new file mode 100644 index 0000000000..a268a425ed --- /dev/null +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/others/OlyBuffer/olympiad_master001.htm @@ -0,0 +1,21 @@ + + + + + + + + + + + +
I wish luck to all participants.
Select one of the following Supplemental Magic Sets.
+
+
+
+ + + +
+
+ \ No newline at end of file diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/others/OlyBuffer/olympiad_master003.htm b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/others/OlyBuffer/olympiad_master003.htm new file mode 100644 index 0000000000..32219b14c5 --- /dev/null +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/others/OlyBuffer/olympiad_master003.htm @@ -0,0 +1,10 @@ + + + + + + + + +
We gave you the selected Supplemental Magic Set.
I wish luck to all warriors.
+ \ No newline at end of file