From c28ccf89c807680a63d6230beb4ae1984b1d50d7 Mon Sep 17 00:00:00 2001
From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com>
Date: Tue, 12 Sep 2017 00:43:55 +0000
Subject: [PATCH] Hardin (Agent of Chaos) AI.
---
.../areas/TalkingIsland/Hardin/33870-01.html | 9 +-
.../areas/TalkingIsland/Hardin/33870-no.html | 6 +
.../Hardin/33870-no_already_reawakened.html | 5 +
.../TalkingIsland/Hardin/33870-no_summon.html | 3 +
.../Hardin/33870-reawake_list.html | 31 ++++
.../ai/areas/TalkingIsland/Hardin/Hardin.java | 141 +++++++++++++++++-
.../areas/TalkingIsland/Hardin/33870-01.html | 9 +-
.../areas/TalkingIsland/Hardin/33870-no.html | 6 +
.../Hardin/33870-no_already_reawakened.html | 5 +
.../TalkingIsland/Hardin/33870-no_summon.html | 3 +
.../Hardin/33870-reawake_list.html | 31 ++++
.../ai/areas/TalkingIsland/Hardin/Hardin.java | 141 +++++++++++++++++-
.../areas/TalkingIsland/Hardin/33870-01.html | 9 +-
.../areas/TalkingIsland/Hardin/33870-no.html | 6 +
.../Hardin/33870-no_already_reawakened.html | 5 +
.../TalkingIsland/Hardin/33870-no_summon.html | 3 +
.../Hardin/33870-reawake_list.html | 31 ++++
.../ai/areas/TalkingIsland/Hardin/Hardin.java | 141 +++++++++++++++++-
18 files changed, 558 insertions(+), 27 deletions(-)
create mode 100644 L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-no.html
create mode 100644 L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-no_already_reawakened.html
create mode 100644 L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-no_summon.html
create mode 100644 L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-reawake_list.html
create mode 100644 L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-no.html
create mode 100644 L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-no_already_reawakened.html
create mode 100644 L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-no_summon.html
create mode 100644 L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-reawake_list.html
create mode 100644 L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-no.html
create mode 100644 L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-no_already_reawakened.html
create mode 100644 L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-no_summon.html
create mode 100644 L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-reawake_list.html
diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-01.html b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-01.html
index 1445670a3e..90369101e8 100644
--- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-01.html
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-01.html
@@ -1,5 +1,8 @@
Hardin:
-You're already obtained all the powers.
-You don't even have any Chaos Essence for any class. You'll have to go back.
-(Only characters who have the Chaos Essence appropriate for their class can select the power of Chaos. Only after using all the Chaos Essence for your main class, can you change your dual class.)
+Light and darkness must be in harmony. If the equilibrium is disturbed, chaos comes.
+Chaos host does not want to bother the world chaos. But darkness is encroaching on much of this world.
+So I wish you to have the same strength of light as darkness. Want to take the Chaos?
+Connect the two forces in you - perhaps.
+If you want, I can help you with this.
+Ask about how to obtain the forces of Chaos
\ No newline at end of file
diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-no.html b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-no.html
new file mode 100644
index 0000000000..60d056139c
--- /dev/null
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-no.html
@@ -0,0 +1,6 @@
+Hardin:
+You are weak in spirit.
+You do not get spiritual strength.
+Leave.
+(Third class can be modified using the rebirth of the Statue of Giant. Splinter Chaos can be used after applying Chaos Essences .)
+
\ No newline at end of file
diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-no_already_reawakened.html b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-no_already_reawakened.html
new file mode 100644
index 0000000000..1c6cf359fa
--- /dev/null
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-no_already_reawakened.html
@@ -0,0 +1,5 @@
+Hardin:
+You've already got all the power.
+Besides there is no essence, that would fit your class, so go away.
+(You can only select a suitable class Essence of Chaos. Changing to double class is possible only after the use of all major classes of essences.)
+
\ No newline at end of file
diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-no_summon.html b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-no_summon.html
new file mode 100644
index 0000000000..2b99fc23fa
--- /dev/null
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-no_summon.html
@@ -0,0 +1,3 @@
+Hardin:
+You can not get my strength, if you have pets or summons . Come when you are ready.
+
\ No newline at end of file
diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-reawake_list.html b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-reawake_list.html
new file mode 100644
index 0000000000..573572297c
--- /dev/null
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-reawake_list.html
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ I'll give you the primordial force.
+ Select the desired effect.
+
+
+
+ %CLASS_LIST%
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/Hardin.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/Hardin.java
index 89d2d8dce7..ac2f03125d 100644
--- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/Hardin.java
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/Hardin.java
@@ -16,22 +16,41 @@
*/
package ai.areas.TalkingIsland.Hardin;
+import com.l2jmobius.gameserver.data.xml.impl.ClassListData;
+import com.l2jmobius.gameserver.data.xml.impl.SkillData;
+import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
+import com.l2jmobius.gameserver.enums.CategoryType;
import com.l2jmobius.gameserver.enums.Race;
+import com.l2jmobius.gameserver.enums.SubclassInfoType;
+import com.l2jmobius.gameserver.model.L2SkillLearn;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jmobius.gameserver.model.base.ClassId;
import com.l2jmobius.gameserver.model.quest.QuestState;
+import com.l2jmobius.gameserver.network.serverpackets.ExSubjobInfo;
+import com.l2jmobius.gameserver.network.serverpackets.ExUserInfoInvenWeight;
+import com.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
import ai.AbstractNpcAI;
import quests.Q10472_WindsOfFateEncroachingShadows.Q10472_WindsOfFateEncroachingShadows;
/**
- * Hardin AI.
- * @author malyelfik
+ * Hardin (Agent of Chaos) AI.
+ * @author Mobius
*/
public final class Hardin extends AbstractNpcAI
{
// NPC
private static final int HARDIN = 33870;
+ // Items
+ private static final int CHAOS_ESSENCE = 36949;
+ private static final int CHAOS_ESSENCE_DUAL_CLASS = 37494;
+ private static final int CHAOS_POMANDER = 37374;
+ private static final int CHAOS_POMANDER_DUAL_CLASS = 37375;
+ // Enable changing to other non related classes as well.
+ private static final boolean ENABLE_ALL_RACES = false; // Will change player race as well!
+ private static final boolean ENABLE_ALL_SPECS = false; // Will disable mage/fighter check!
+ private static final boolean ENABLE_DUALCLASS_CHECKS = true; // Will enable above checks for dual class.
private Hardin()
{
@@ -39,16 +58,126 @@ public final class Hardin extends AbstractNpcAI
addFirstTalkId(HARDIN);
}
+ @Override
+ public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
+ {
+ final String htmltext = getHtmlMessage(player);
+ if (htmltext != null)
+ {
+ return htmltext;
+ }
+
+ if (event.equals("list"))
+ {
+ StringBuilder classes = new StringBuilder();
+ for (ClassId c : ClassId.values())
+ {
+ if ((c.level() != 4) || (c.getRace() == Race.ERTHEIA) || (c == player.getClassId()))
+ {
+ continue;
+ }
+ if (!player.isDualClassActive() || (player.isDualClassActive() && ENABLE_DUALCLASS_CHECKS))
+ {
+ if (!ENABLE_ALL_RACES)
+ {
+ if (c.getRace() != player.getClassId().getRace())
+ {
+ continue;
+ }
+ }
+ if (!ENABLE_ALL_SPECS)
+ {
+ if (c.isMage() != player.isMageClass())
+ {
+ continue;
+ }
+ }
+ }
+ classes.append("");
+ }
+ classes.append(" "); // prettify
+ final NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
+ html.setHtml(getHtm(player.getHtmlPrefix(), "33870-reawake_list.html"));
+ html.replace("%CLASS_LIST%", classes.toString());
+ player.sendPacket(html);
+ }
+ else if (event.contains("try"))
+ {
+ // take item
+ takeItems(player, player.isDualClassActive() ? CHAOS_ESSENCE_DUAL_CLASS : CHAOS_ESSENCE, 1);
+ // give item
+ giveItems(player, player.isDualClassActive() ? CHAOS_POMANDER_DUAL_CLASS : CHAOS_POMANDER, 1);
+ // change class
+ player.setClassId(ClassId.getClassId(Integer.parseInt(event.replace("try_", ""))).getId());
+ if (player.isDualClassActive())
+ {
+ player.getSubClasses().get(player.getClassIndex()).setClassId(player.getActiveClass());
+ }
+ else
+ {
+ player.setBaseClass(player.getActiveClass());
+ }
+ // adjustments
+ SkillTreesData.getInstance().cleanSkillUponAwakening(player);
+ for (L2SkillLearn skill : SkillTreesData.getInstance().getRaceSkillTree(player.getRace()))
+ {
+ player.addSkill(SkillData.getInstance().getSkill(skill.getSkillId(), skill.getSkillLevel()), true);
+ }
+ player.store(false);
+ player.broadcastUserInfo();
+ player.sendSkillList();
+ player.sendPacket(new ExSubjobInfo(player, SubclassInfoType.CLASS_CHANGED));
+ player.sendPacket(new ExUserInfoInvenWeight(player));
+ }
+ return null;
+ }
+
@Override
public String onFirstTalk(L2Npc npc, L2PcInstance player)
{
- String htmltext = "33870-01.html"; // Anybody except Ertheia race.
+ final String htmltext = getHtmlMessage(player);
+ return htmltext == null ? "33870-01.html" : htmltext;
+ }
+
+ private String getHtmlMessage(L2PcInstance player)
+ {
if (player.getRace().equals(Race.ERTHEIA))
{
- final QuestState st = player.getQuestState(Q10472_WindsOfFateEncroachingShadows.class.getSimpleName());
- htmltext = ((st != null) && (st.getCond() >= 7) && (st.getCond() <= 17)) ? "33870-03.html" : "33870-02.html";
+ final QuestState qs = player.getQuestState(Q10472_WindsOfFateEncroachingShadows.class.getSimpleName());
+ return ((qs != null) && (qs.getCond() >= 7) && (qs.getCond() <= 17)) ? "33870-03.html" : "33870-02.html";
}
- return htmltext;
+ if (!player.isInCategory(CategoryType.AWAKEN_GROUP))
+ {
+ return "33870-no.html";
+ }
+ if (player.isDualClassActive()) // dual class
+ {
+ if (!hasQuestItems(player, CHAOS_ESSENCE_DUAL_CLASS))
+ {
+ return "33870-no_already_reawakened.html";
+ }
+ }
+ else if (player.isSubClassActive()) // subclass
+ {
+ return "33870-no.html";
+ }
+ else if (!hasQuestItems(player, CHAOS_ESSENCE)) // main class
+ {
+ return "33870-no_already_reawakened.html";
+ }
+ if (player.hasServitors())
+ {
+ return "33870-no_summon.html";
+ }
+ if (player.isInOlympiadMode())
+ {
+ return "33870-no.html";
+ }
+ return null;
}
public static void main(String[] args)
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-01.html b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-01.html
index 1445670a3e..90369101e8 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-01.html
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-01.html
@@ -1,5 +1,8 @@
Hardin:
-You're already obtained all the powers.
-You don't even have any Chaos Essence for any class. You'll have to go back.
-(Only characters who have the Chaos Essence appropriate for their class can select the power of Chaos. Only after using all the Chaos Essence for your main class, can you change your dual class.)
+Light and darkness must be in harmony. If the equilibrium is disturbed, chaos comes.
+Chaos host does not want to bother the world chaos. But darkness is encroaching on much of this world.
+So I wish you to have the same strength of light as darkness. Want to take the Chaos?
+Connect the two forces in you - perhaps.
+If you want, I can help you with this.
+Ask about how to obtain the forces of Chaos
\ No newline at end of file
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-no.html b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-no.html
new file mode 100644
index 0000000000..60d056139c
--- /dev/null
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-no.html
@@ -0,0 +1,6 @@
+Hardin:
+You are weak in spirit.
+You do not get spiritual strength.
+Leave.
+(Third class can be modified using the rebirth of the Statue of Giant. Splinter Chaos can be used after applying Chaos Essences .)
+
\ No newline at end of file
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-no_already_reawakened.html b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-no_already_reawakened.html
new file mode 100644
index 0000000000..1c6cf359fa
--- /dev/null
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-no_already_reawakened.html
@@ -0,0 +1,5 @@
+Hardin:
+You've already got all the power.
+Besides there is no essence, that would fit your class, so go away.
+(You can only select a suitable class Essence of Chaos. Changing to double class is possible only after the use of all major classes of essences.)
+
\ No newline at end of file
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-no_summon.html b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-no_summon.html
new file mode 100644
index 0000000000..2b99fc23fa
--- /dev/null
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-no_summon.html
@@ -0,0 +1,3 @@
+Hardin:
+You can not get my strength, if you have pets or summons . Come when you are ready.
+
\ No newline at end of file
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-reawake_list.html b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-reawake_list.html
new file mode 100644
index 0000000000..573572297c
--- /dev/null
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-reawake_list.html
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ I'll give you the primordial force.
+ Select the desired effect.
+
+
+
+ %CLASS_LIST%
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/Hardin.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/Hardin.java
index 89d2d8dce7..ac2f03125d 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/Hardin.java
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/Hardin.java
@@ -16,22 +16,41 @@
*/
package ai.areas.TalkingIsland.Hardin;
+import com.l2jmobius.gameserver.data.xml.impl.ClassListData;
+import com.l2jmobius.gameserver.data.xml.impl.SkillData;
+import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
+import com.l2jmobius.gameserver.enums.CategoryType;
import com.l2jmobius.gameserver.enums.Race;
+import com.l2jmobius.gameserver.enums.SubclassInfoType;
+import com.l2jmobius.gameserver.model.L2SkillLearn;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jmobius.gameserver.model.base.ClassId;
import com.l2jmobius.gameserver.model.quest.QuestState;
+import com.l2jmobius.gameserver.network.serverpackets.ExSubjobInfo;
+import com.l2jmobius.gameserver.network.serverpackets.ExUserInfoInvenWeight;
+import com.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
import ai.AbstractNpcAI;
import quests.Q10472_WindsOfFateEncroachingShadows.Q10472_WindsOfFateEncroachingShadows;
/**
- * Hardin AI.
- * @author malyelfik
+ * Hardin (Agent of Chaos) AI.
+ * @author Mobius
*/
public final class Hardin extends AbstractNpcAI
{
// NPC
private static final int HARDIN = 33870;
+ // Items
+ private static final int CHAOS_ESSENCE = 36949;
+ private static final int CHAOS_ESSENCE_DUAL_CLASS = 37494;
+ private static final int CHAOS_POMANDER = 37374;
+ private static final int CHAOS_POMANDER_DUAL_CLASS = 37375;
+ // Enable changing to other non related classes as well.
+ private static final boolean ENABLE_ALL_RACES = false; // Will change player race as well!
+ private static final boolean ENABLE_ALL_SPECS = false; // Will disable mage/fighter check!
+ private static final boolean ENABLE_DUALCLASS_CHECKS = true; // Will enable above checks for dual class.
private Hardin()
{
@@ -39,16 +58,126 @@ public final class Hardin extends AbstractNpcAI
addFirstTalkId(HARDIN);
}
+ @Override
+ public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
+ {
+ final String htmltext = getHtmlMessage(player);
+ if (htmltext != null)
+ {
+ return htmltext;
+ }
+
+ if (event.equals("list"))
+ {
+ StringBuilder classes = new StringBuilder();
+ for (ClassId c : ClassId.values())
+ {
+ if ((c.level() != 4) || (c.getRace() == Race.ERTHEIA) || (c == player.getClassId()))
+ {
+ continue;
+ }
+ if (!player.isDualClassActive() || (player.isDualClassActive() && ENABLE_DUALCLASS_CHECKS))
+ {
+ if (!ENABLE_ALL_RACES)
+ {
+ if (c.getRace() != player.getClassId().getRace())
+ {
+ continue;
+ }
+ }
+ if (!ENABLE_ALL_SPECS)
+ {
+ if (c.isMage() != player.isMageClass())
+ {
+ continue;
+ }
+ }
+ }
+ classes.append("");
+ }
+ classes.append(" "); // prettify
+ final NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
+ html.setHtml(getHtm(player.getHtmlPrefix(), "33870-reawake_list.html"));
+ html.replace("%CLASS_LIST%", classes.toString());
+ player.sendPacket(html);
+ }
+ else if (event.contains("try"))
+ {
+ // take item
+ takeItems(player, player.isDualClassActive() ? CHAOS_ESSENCE_DUAL_CLASS : CHAOS_ESSENCE, 1);
+ // give item
+ giveItems(player, player.isDualClassActive() ? CHAOS_POMANDER_DUAL_CLASS : CHAOS_POMANDER, 1);
+ // change class
+ player.setClassId(ClassId.getClassId(Integer.parseInt(event.replace("try_", ""))).getId());
+ if (player.isDualClassActive())
+ {
+ player.getSubClasses().get(player.getClassIndex()).setClassId(player.getActiveClass());
+ }
+ else
+ {
+ player.setBaseClass(player.getActiveClass());
+ }
+ // adjustments
+ SkillTreesData.getInstance().cleanSkillUponAwakening(player);
+ for (L2SkillLearn skill : SkillTreesData.getInstance().getRaceSkillTree(player.getRace()))
+ {
+ player.addSkill(SkillData.getInstance().getSkill(skill.getSkillId(), skill.getSkillLevel()), true);
+ }
+ player.store(false);
+ player.broadcastUserInfo();
+ player.sendSkillList();
+ player.sendPacket(new ExSubjobInfo(player, SubclassInfoType.CLASS_CHANGED));
+ player.sendPacket(new ExUserInfoInvenWeight(player));
+ }
+ return null;
+ }
+
@Override
public String onFirstTalk(L2Npc npc, L2PcInstance player)
{
- String htmltext = "33870-01.html"; // Anybody except Ertheia race.
+ final String htmltext = getHtmlMessage(player);
+ return htmltext == null ? "33870-01.html" : htmltext;
+ }
+
+ private String getHtmlMessage(L2PcInstance player)
+ {
if (player.getRace().equals(Race.ERTHEIA))
{
- final QuestState st = player.getQuestState(Q10472_WindsOfFateEncroachingShadows.class.getSimpleName());
- htmltext = ((st != null) && (st.getCond() >= 7) && (st.getCond() <= 17)) ? "33870-03.html" : "33870-02.html";
+ final QuestState qs = player.getQuestState(Q10472_WindsOfFateEncroachingShadows.class.getSimpleName());
+ return ((qs != null) && (qs.getCond() >= 7) && (qs.getCond() <= 17)) ? "33870-03.html" : "33870-02.html";
}
- return htmltext;
+ if (!player.isInCategory(CategoryType.AWAKEN_GROUP))
+ {
+ return "33870-no.html";
+ }
+ if (player.isDualClassActive()) // dual class
+ {
+ if (!hasQuestItems(player, CHAOS_ESSENCE_DUAL_CLASS))
+ {
+ return "33870-no_already_reawakened.html";
+ }
+ }
+ else if (player.isSubClassActive()) // subclass
+ {
+ return "33870-no.html";
+ }
+ else if (!hasQuestItems(player, CHAOS_ESSENCE)) // main class
+ {
+ return "33870-no_already_reawakened.html";
+ }
+ if (player.hasServitors())
+ {
+ return "33870-no_summon.html";
+ }
+ if (player.isInOlympiadMode())
+ {
+ return "33870-no.html";
+ }
+ return null;
}
public static void main(String[] args)
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-01.html b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-01.html
index 1445670a3e..90369101e8 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-01.html
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-01.html
@@ -1,5 +1,8 @@
Hardin:
-You're already obtained all the powers.
-You don't even have any Chaos Essence for any class. You'll have to go back.
-(Only characters who have the Chaos Essence appropriate for their class can select the power of Chaos. Only after using all the Chaos Essence for your main class, can you change your dual class.)
+Light and darkness must be in harmony. If the equilibrium is disturbed, chaos comes.
+Chaos host does not want to bother the world chaos. But darkness is encroaching on much of this world.
+So I wish you to have the same strength of light as darkness. Want to take the Chaos?
+Connect the two forces in you - perhaps.
+If you want, I can help you with this.
+Ask about how to obtain the forces of Chaos
\ No newline at end of file
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-no.html b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-no.html
new file mode 100644
index 0000000000..60d056139c
--- /dev/null
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-no.html
@@ -0,0 +1,6 @@
+Hardin:
+You are weak in spirit.
+You do not get spiritual strength.
+Leave.
+(Third class can be modified using the rebirth of the Statue of Giant. Splinter Chaos can be used after applying Chaos Essences .)
+
\ No newline at end of file
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-no_already_reawakened.html b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-no_already_reawakened.html
new file mode 100644
index 0000000000..1c6cf359fa
--- /dev/null
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-no_already_reawakened.html
@@ -0,0 +1,5 @@
+Hardin:
+You've already got all the power.
+Besides there is no essence, that would fit your class, so go away.
+(You can only select a suitable class Essence of Chaos. Changing to double class is possible only after the use of all major classes of essences.)
+
\ No newline at end of file
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-no_summon.html b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-no_summon.html
new file mode 100644
index 0000000000..2b99fc23fa
--- /dev/null
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-no_summon.html
@@ -0,0 +1,3 @@
+Hardin:
+You can not get my strength, if you have pets or summons . Come when you are ready.
+
\ No newline at end of file
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-reawake_list.html b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-reawake_list.html
new file mode 100644
index 0000000000..573572297c
--- /dev/null
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/33870-reawake_list.html
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ I'll give you the primordial force.
+ Select the desired effect.
+
+
+
+ %CLASS_LIST%
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/Hardin.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/Hardin.java
index 89d2d8dce7..ac2f03125d 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/Hardin.java
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Hardin/Hardin.java
@@ -16,22 +16,41 @@
*/
package ai.areas.TalkingIsland.Hardin;
+import com.l2jmobius.gameserver.data.xml.impl.ClassListData;
+import com.l2jmobius.gameserver.data.xml.impl.SkillData;
+import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
+import com.l2jmobius.gameserver.enums.CategoryType;
import com.l2jmobius.gameserver.enums.Race;
+import com.l2jmobius.gameserver.enums.SubclassInfoType;
+import com.l2jmobius.gameserver.model.L2SkillLearn;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jmobius.gameserver.model.base.ClassId;
import com.l2jmobius.gameserver.model.quest.QuestState;
+import com.l2jmobius.gameserver.network.serverpackets.ExSubjobInfo;
+import com.l2jmobius.gameserver.network.serverpackets.ExUserInfoInvenWeight;
+import com.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
import ai.AbstractNpcAI;
import quests.Q10472_WindsOfFateEncroachingShadows.Q10472_WindsOfFateEncroachingShadows;
/**
- * Hardin AI.
- * @author malyelfik
+ * Hardin (Agent of Chaos) AI.
+ * @author Mobius
*/
public final class Hardin extends AbstractNpcAI
{
// NPC
private static final int HARDIN = 33870;
+ // Items
+ private static final int CHAOS_ESSENCE = 36949;
+ private static final int CHAOS_ESSENCE_DUAL_CLASS = 37494;
+ private static final int CHAOS_POMANDER = 37374;
+ private static final int CHAOS_POMANDER_DUAL_CLASS = 37375;
+ // Enable changing to other non related classes as well.
+ private static final boolean ENABLE_ALL_RACES = false; // Will change player race as well!
+ private static final boolean ENABLE_ALL_SPECS = false; // Will disable mage/fighter check!
+ private static final boolean ENABLE_DUALCLASS_CHECKS = true; // Will enable above checks for dual class.
private Hardin()
{
@@ -39,16 +58,126 @@ public final class Hardin extends AbstractNpcAI
addFirstTalkId(HARDIN);
}
+ @Override
+ public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
+ {
+ final String htmltext = getHtmlMessage(player);
+ if (htmltext != null)
+ {
+ return htmltext;
+ }
+
+ if (event.equals("list"))
+ {
+ StringBuilder classes = new StringBuilder();
+ for (ClassId c : ClassId.values())
+ {
+ if ((c.level() != 4) || (c.getRace() == Race.ERTHEIA) || (c == player.getClassId()))
+ {
+ continue;
+ }
+ if (!player.isDualClassActive() || (player.isDualClassActive() && ENABLE_DUALCLASS_CHECKS))
+ {
+ if (!ENABLE_ALL_RACES)
+ {
+ if (c.getRace() != player.getClassId().getRace())
+ {
+ continue;
+ }
+ }
+ if (!ENABLE_ALL_SPECS)
+ {
+ if (c.isMage() != player.isMageClass())
+ {
+ continue;
+ }
+ }
+ }
+ classes.append("");
+ }
+ classes.append(" "); // prettify
+ final NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
+ html.setHtml(getHtm(player.getHtmlPrefix(), "33870-reawake_list.html"));
+ html.replace("%CLASS_LIST%", classes.toString());
+ player.sendPacket(html);
+ }
+ else if (event.contains("try"))
+ {
+ // take item
+ takeItems(player, player.isDualClassActive() ? CHAOS_ESSENCE_DUAL_CLASS : CHAOS_ESSENCE, 1);
+ // give item
+ giveItems(player, player.isDualClassActive() ? CHAOS_POMANDER_DUAL_CLASS : CHAOS_POMANDER, 1);
+ // change class
+ player.setClassId(ClassId.getClassId(Integer.parseInt(event.replace("try_", ""))).getId());
+ if (player.isDualClassActive())
+ {
+ player.getSubClasses().get(player.getClassIndex()).setClassId(player.getActiveClass());
+ }
+ else
+ {
+ player.setBaseClass(player.getActiveClass());
+ }
+ // adjustments
+ SkillTreesData.getInstance().cleanSkillUponAwakening(player);
+ for (L2SkillLearn skill : SkillTreesData.getInstance().getRaceSkillTree(player.getRace()))
+ {
+ player.addSkill(SkillData.getInstance().getSkill(skill.getSkillId(), skill.getSkillLevel()), true);
+ }
+ player.store(false);
+ player.broadcastUserInfo();
+ player.sendSkillList();
+ player.sendPacket(new ExSubjobInfo(player, SubclassInfoType.CLASS_CHANGED));
+ player.sendPacket(new ExUserInfoInvenWeight(player));
+ }
+ return null;
+ }
+
@Override
public String onFirstTalk(L2Npc npc, L2PcInstance player)
{
- String htmltext = "33870-01.html"; // Anybody except Ertheia race.
+ final String htmltext = getHtmlMessage(player);
+ return htmltext == null ? "33870-01.html" : htmltext;
+ }
+
+ private String getHtmlMessage(L2PcInstance player)
+ {
if (player.getRace().equals(Race.ERTHEIA))
{
- final QuestState st = player.getQuestState(Q10472_WindsOfFateEncroachingShadows.class.getSimpleName());
- htmltext = ((st != null) && (st.getCond() >= 7) && (st.getCond() <= 17)) ? "33870-03.html" : "33870-02.html";
+ final QuestState qs = player.getQuestState(Q10472_WindsOfFateEncroachingShadows.class.getSimpleName());
+ return ((qs != null) && (qs.getCond() >= 7) && (qs.getCond() <= 17)) ? "33870-03.html" : "33870-02.html";
}
- return htmltext;
+ if (!player.isInCategory(CategoryType.AWAKEN_GROUP))
+ {
+ return "33870-no.html";
+ }
+ if (player.isDualClassActive()) // dual class
+ {
+ if (!hasQuestItems(player, CHAOS_ESSENCE_DUAL_CLASS))
+ {
+ return "33870-no_already_reawakened.html";
+ }
+ }
+ else if (player.isSubClassActive()) // subclass
+ {
+ return "33870-no.html";
+ }
+ else if (!hasQuestItems(player, CHAOS_ESSENCE)) // main class
+ {
+ return "33870-no_already_reawakened.html";
+ }
+ if (player.hasServitors())
+ {
+ return "33870-no_summon.html";
+ }
+ if (player.isInOlympiadMode())
+ {
+ return "33870-no.html";
+ }
+ return null;
}
public static void main(String[] args)