Hardin (Agent of Chaos) AI.

This commit is contained in:
MobiusDev 2017-09-12 00:43:55 +00:00
parent 27cd80949b
commit c28ccf89c8
18 changed files with 558 additions and 27 deletions

View File

@ -1,5 +1,8 @@
<html><body>Hardin:<br>
You're already obtained all the powers.<br>
You don't even have any Chaos Essence for any class. You'll have to go back.<br>
(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.<br>
Chaos host does not want to bother the world chaos. But darkness is encroaching on much of this world.<br>
So I wish you to have the same strength of light as darkness. Want to take the Chaos?<br>
Connect the two forces in you - perhaps.<br>
If you want, I can help you with this.<br>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest Hardin list">Ask about how to obtain the forces of Chaos</Button>
</body></html>

View File

@ -0,0 +1,6 @@
<html><body>Hardin:<br>
You are weak in spirit.<br>
You do not get spiritual strength.<br>
Leave.<br>
(Third class can be modified using the rebirth of the Statue of Giant. Splinter Chaos can be used after applying <font color="af9878">Chaos Essences</font>.)
</body></html>

View File

@ -0,0 +1,5 @@
<html><body>Hardin:<br>
You've already got all the power.<br>
Besides there is no essence, that would fit your class, so go away.<br>
(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.)
</body></html>

View File

@ -0,0 +1,3 @@
<html><body>Hardin:<br>
You can not get my strength, if you have <font color="LEVEL">pets or summons</font>. Come when you are ready.
</body></html>

View File

@ -0,0 +1,31 @@
<html>
<body scroll="no">
<!-- Edge Decoration Table -->
<table border="0" cellpadding="0" cellspacing="0" width="292" height="358" background="L2UI_CH3.refinewnd_back_Pattern">
<tr>
<td valign="top" align="center">
<!-- Class Mark -->
<table border="0" cellpadding="0" cellspacing="0">
</table>
<!-- text -->
<table width="260" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="100" align="center">
<br>
<br>
<br>
<br>
I'll give you the primordial force.<br1>
Select the desired effect.<br>
</td>
</tr>
<tr>
<td align="center">%CLASS_LIST%</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- //Edge Decoration -->
</body>
</html>

View File

@ -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("<button value=\"");
classes.append(ClassListData.getInstance().getClass(c.ordinal()).getClassName());
classes.append("\" action=\"bypass -h Quest Hardin try_");
classes.append(String.valueOf(c.getId()));
classes.append("\" width=\"200\" height=\"31\" back=\"L2UI_CT1.HtmlWnd_DF_Awake_Down\" fore=\"L2UI_CT1.HtmlWnd_DF_Awake\"><br1>");
}
classes.append("<br><br><br><br><br>"); // 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)

View File

@ -1,5 +1,8 @@
<html><body>Hardin:<br>
You're already obtained all the powers.<br>
You don't even have any Chaos Essence for any class. You'll have to go back.<br>
(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.<br>
Chaos host does not want to bother the world chaos. But darkness is encroaching on much of this world.<br>
So I wish you to have the same strength of light as darkness. Want to take the Chaos?<br>
Connect the two forces in you - perhaps.<br>
If you want, I can help you with this.<br>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest Hardin list">Ask about how to obtain the forces of Chaos</Button>
</body></html>

View File

@ -0,0 +1,6 @@
<html><body>Hardin:<br>
You are weak in spirit.<br>
You do not get spiritual strength.<br>
Leave.<br>
(Third class can be modified using the rebirth of the Statue of Giant. Splinter Chaos can be used after applying <font color="af9878">Chaos Essences</font>.)
</body></html>

View File

@ -0,0 +1,5 @@
<html><body>Hardin:<br>
You've already got all the power.<br>
Besides there is no essence, that would fit your class, so go away.<br>
(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.)
</body></html>

View File

@ -0,0 +1,3 @@
<html><body>Hardin:<br>
You can not get my strength, if you have <font color="LEVEL">pets or summons</font>. Come when you are ready.
</body></html>

View File

@ -0,0 +1,31 @@
<html>
<body scroll="no">
<!-- Edge Decoration Table -->
<table border="0" cellpadding="0" cellspacing="0" width="292" height="358" background="L2UI_CH3.refinewnd_back_Pattern">
<tr>
<td valign="top" align="center">
<!-- Class Mark -->
<table border="0" cellpadding="0" cellspacing="0">
</table>
<!-- text -->
<table width="260" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="100" align="center">
<br>
<br>
<br>
<br>
I'll give you the primordial force.<br1>
Select the desired effect.<br>
</td>
</tr>
<tr>
<td align="center">%CLASS_LIST%</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- //Edge Decoration -->
</body>
</html>

View File

@ -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("<button value=\"");
classes.append(ClassListData.getInstance().getClass(c.ordinal()).getClassName());
classes.append("\" action=\"bypass -h Quest Hardin try_");
classes.append(String.valueOf(c.getId()));
classes.append("\" width=\"200\" height=\"31\" back=\"L2UI_CT1.HtmlWnd_DF_Awake_Down\" fore=\"L2UI_CT1.HtmlWnd_DF_Awake\"><br1>");
}
classes.append("<br><br><br><br><br>"); // 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)

View File

@ -1,5 +1,8 @@
<html><body>Hardin:<br>
You're already obtained all the powers.<br>
You don't even have any Chaos Essence for any class. You'll have to go back.<br>
(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.<br>
Chaos host does not want to bother the world chaos. But darkness is encroaching on much of this world.<br>
So I wish you to have the same strength of light as darkness. Want to take the Chaos?<br>
Connect the two forces in you - perhaps.<br>
If you want, I can help you with this.<br>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest Hardin list">Ask about how to obtain the forces of Chaos</Button>
</body></html>

View File

@ -0,0 +1,6 @@
<html><body>Hardin:<br>
You are weak in spirit.<br>
You do not get spiritual strength.<br>
Leave.<br>
(Third class can be modified using the rebirth of the Statue of Giant. Splinter Chaos can be used after applying <font color="af9878">Chaos Essences</font>.)
</body></html>

View File

@ -0,0 +1,5 @@
<html><body>Hardin:<br>
You've already got all the power.<br>
Besides there is no essence, that would fit your class, so go away.<br>
(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.)
</body></html>

View File

@ -0,0 +1,3 @@
<html><body>Hardin:<br>
You can not get my strength, if you have <font color="LEVEL">pets or summons</font>. Come when you are ready.
</body></html>

View File

@ -0,0 +1,31 @@
<html>
<body scroll="no">
<!-- Edge Decoration Table -->
<table border="0" cellpadding="0" cellspacing="0" width="292" height="358" background="L2UI_CH3.refinewnd_back_Pattern">
<tr>
<td valign="top" align="center">
<!-- Class Mark -->
<table border="0" cellpadding="0" cellspacing="0">
</table>
<!-- text -->
<table width="260" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="100" align="center">
<br>
<br>
<br>
<br>
I'll give you the primordial force.<br1>
Select the desired effect.<br>
</td>
</tr>
<tr>
<td align="center">%CLASS_LIST%</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- //Edge Decoration -->
</body>
</html>

View File

@ -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("<button value=\"");
classes.append(ClassListData.getInstance().getClass(c.ordinal()).getClassName());
classes.append("\" action=\"bypass -h Quest Hardin try_");
classes.append(String.valueOf(c.getId()));
classes.append("\" width=\"200\" height=\"31\" back=\"L2UI_CT1.HtmlWnd_DF_Awake_Down\" fore=\"L2UI_CT1.HtmlWnd_DF_Awake\"><br1>");
}
classes.append("<br><br><br><br><br>"); // 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)