浏览代码

BETA: Implementing Avant-Garde AI.
* Making some method from Quest static.

Zoey76 12 年之前
父节点
当前提交
adb9212e8a
共有 24 个文件被更改,包括 394 次插入35 次删除
  1. 0 6
      L2J_DataPack_BETA/dist/game/data/html/masterTransformation/master_transformation002.htm
  2. 0 5
      L2J_DataPack_BETA/dist/game/data/html/masterTransformation/master_transformation005a.htm
  3. 0 7
      L2J_DataPack_BETA/dist/game/data/html/masterTransformation/master_transformation005no.htm
  4. 1 0
      L2J_DataPack_BETA/dist/game/data/scripts.cfg
  5. 4 4
      L2J_DataPack_BETA/dist/game/data/scripts/ai/group_template/SummonMinions.java
  6. 4 4
      L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/AvantGarde/32323-01.html
  7. 7 0
      L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/AvantGarde/32323-02.html
  8. 1 1
      L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/AvantGarde/32323-02a.html
  9. 1 1
      L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/AvantGarde/32323-02b.html
  10. 4 4
      L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/AvantGarde/32323-02c.html
  11. 0 0
      L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/AvantGarde/32323-03.html
  12. 0 0
      L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/AvantGarde/32323-04.html
  13. 2 2
      L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/AvantGarde/32323-05.html
  14. 5 0
      L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/AvantGarde/32323-05a.html
  15. 7 0
      L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/AvantGarde/32323-05no.html
  16. 0 0
      L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/AvantGarde/32323-06.html
  17. 0 0
      L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/AvantGarde/32323-06no.html
  18. 0 0
      L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/AvantGarde/32323-07.html
  19. 0 0
      L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/AvantGarde/32323-08.html
  20. 0 0
      L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/AvantGarde/32323-08no.html
  21. 0 0
      L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/AvantGarde/32323-09no.html
  22. 0 0
      L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/AvantGarde/32323-10no.html
  23. 357 0
      L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/AvantGarde/AvantGarde.java
  24. 1 1
      L2J_DataPack_BETA/dist/sql/game/npc.sql

+ 0 - 6
L2J_DataPack_BETA/dist/game/data/html/masterTransformation/master_transformation002.htm

@@ -1,6 +0,0 @@
-<html><body>Wizard of Trasformation Avant-Garde:<br>
-What do you wish to know about transformation?<br><br>
-<a action="bypass -h npc_%objectId%_Link masterTransformation/master_transformation002a.htm">"What do I need to know about transformation?"</a><br>
-<a action="bypass -h npc_%objectId%_Link masterTransformation/master_transformation002b.htm">"What do I need to do to transform into another shape?"</a><br>
-<a action="bypass -h npc_%objectId%_Link masterTransformation/master_transformation002c.htm">"What do I need to know before transformation?"</a>
-</body></html>

+ 0 - 5
L2J_DataPack_BETA/dist/game/data/html/masterTransformation/master_transformation005a.htm

@@ -1,5 +0,0 @@
-<html><body>Transformation Wizard Avant-Garde:<br>
-What do you wish to know about subclass certification?<br>
-<a action="bypass -h npc_%objectId%_Link masterTransformation/master_transformation005.htm">Learn skills of the certified subclass.</a><br>
-<a action="bypass -h npc_%objectId%_Link masterTransformation/master_transformation005no.htm">Certification removal.</a>
-</body></html>

+ 0 - 7
L2J_DataPack_BETA/dist/game/data/html/masterTransformation/master_transformation005no.htm

@@ -1,7 +0,0 @@
-<html><body>Transformation Wizard Avant-Garde:<br>
-It is a tremendous endeavor to obtain subclass certification and learn the appropriate skills. Beyond the purely physical effort, the burden on your soul is beyond your imagination... It is almost a suicidal venture.<br>
-However, the process can be undone. There is a special kind of herb that can be used to remove your previously chosen skills. The price of the herb, though, is approximately <font color="LEVEL">10 million Adena</font>... I have the herb here, so I can cancel the certification anytime once you have paid.<br>
-If the certification is canceled, <font color="LEVEL">the current certification status and skills will vanish immediately -- poof!</font> Now then, do you really wish to cancel certification?<br>
-<a action="bypass -h npc_%objectId%_CancelCertification">Cancel certification.</a><br>
-<a action="bypass -h npc_%objectId%_Link masterTransformation/master_transformation006no.htm">Return.</a>
-</body></html>

+ 1 - 0
L2J_DataPack_BETA/dist/game/data/scripts.cfg

@@ -12,6 +12,7 @@ handlers/admincommandhandlers/AdminScan.js
 # AI Section
 
 # Npc
+ai/npc/AvantGarde/AvantGarde.java
 ai/npc/BlackMarketeerOfMammon/BlackMarketeerOfMammon.java
 ai/npc/CastleBlacksmith/CastleBlacksmith.java
 ai/npc/CastleChamberlain/CastleChamberlain.java

+ 4 - 4
L2J_DataPack_BETA/dist/game/data/scripts/ai/group_template/SummonMinions.java

@@ -125,7 +125,7 @@ public class SummonMinions extends AbstractNpcAI
 						{
 							for (int val : MINIONS.get(npcId))
 							{
-								L2Attackable newNpc = (L2Attackable) this.addSpawn(val, (npc.getX() + getRandom(-150, 150)), (npc.getY() + getRandom(-150, 150)), npc.getZ(), 0, false, 0);
+								L2Attackable newNpc = (L2Attackable) addSpawn(val, (npc.getX() + getRandom(-150, 150)), (npc.getY() + getRandom(-150, 150)), npc.getZ(), 0, false, 0);
 								newNpc.setRunning();
 								newNpc.addDamageHate(attacker, 0, 999);
 								newNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, attacker);
@@ -181,7 +181,7 @@ public class SummonMinions extends AbstractNpcAI
 						HasSpawned = 0;
 						for (int val : MINIONS.get(npcId))
 						{
-							L2Attackable newNpc = (L2Attackable) this.addSpawn(val, npc.getX() + getRandom(-150, 150), npc.getY() + getRandom(-150, 150), npc.getZ(), 0, false, 0);
+							L2Attackable newNpc = (L2Attackable) addSpawn(val, npc.getX() + getRandom(-150, 150), npc.getY() + getRandom(-150, 150), npc.getZ(), 0, false, 0);
 							newNpc.setRunning();
 							newNpc.addDamageHate(attacker, 0, 999);
 							newNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, attacker);
@@ -194,7 +194,7 @@ public class SummonMinions extends AbstractNpcAI
 					{
 						for (int val : MINIONS.get(npcId))
 						{
-							L2Attackable newNpc = (L2Attackable) this.addSpawn(val, npc.getX() + getRandom(-150, 150), npc.getY() + getRandom(-150, 150), npc.getZ(), 0, false, 0);
+							L2Attackable newNpc = (L2Attackable) addSpawn(val, npc.getX() + getRandom(-150, 150), npc.getY() + getRandom(-150, 150), npc.getZ(), 0, false, 0);
 							newNpc.setRunning();
 							newNpc.addDamageHate(attacker, 0, 999);
 							newNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, attacker);
@@ -205,7 +205,7 @@ public class SummonMinions extends AbstractNpcAI
 						broadcastNpcSay(npc, Say2.NPC_ALL, ATTACK_LEADER_MSG[getRandom(ATTACK_LEADER_MSG.length)]);
 						for (int val : MINIONS.get(npcId))
 						{
-							this.addSpawn(val, (npc.getX() + getRandom(-100, 100)), (npc.getY() + getRandom(-100, 100)), npc.getZ(), 0, false, 0);
+							addSpawn(val, (npc.getX() + getRandom(-100, 100)), (npc.getY() + getRandom(-100, 100)), npc.getZ(), 0, false, 0);
 						}
 					}
 					break;

+ 4 - 4
L2J_DataPack_BETA/dist/game/data/html/masterTransformation/master_transformation001.htm → L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/AvantGarde/32323-01.html

@@ -2,9 +2,9 @@
 I am Avant-Garde, the Transformation Wizard. I have long wandered through the land and only recently settled here.<br>
 In fact, my young friend, I am not a wizard of the Ivory Tower. You look surprised! Heh. Think of me as a wanderer who acquired a special power quite by chance... My magic, however, requires some very specialized items.<br>
 If you have acquired these unique items from the dark wizard in Hardin's Academy, then perhaps I can help you.<br>
-<a action="bypass -h npc_%objectId%_Link masterTransformation/master_transformation002.htm">Ask about transformation.</a><br>
-<a action="bypass -h npc_%objectId%_LearnTransformationSkill">Learn transformation.</a><br>
-<a action="bypass -h npc_%objectId%_BuyTransformationItems">Purchase items related to transformation.</a><br>
-<a action="bypass -h npc_%objectId%_Link masterTransformation/master_transformation005a.htm">Learn about subclass certification.</a><br>
+<a action="bypass -h Quest AvantGarde 32323-02.html">Ask about transformation.</a><br>
+<a action="bypass -h Quest AvantGarde LearnTransformationSkill">Learn transformation.</a><br>
+<a action="bypass -h Quest AvantGarde BuyTransformationItems">Purchase items related to transformation.</a><br>
+<a action="bypass -h Quest AvantGarde 32323-05a.html">Learn about subclass certification.</a><br>
 <a action="bypass -h npc_%objectId%_Quest">Quest.</a>
 </body></html>

+ 7 - 0
L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/AvantGarde/32323-02.html

@@ -0,0 +1,7 @@
+<html><body>Wizard of Trasformation Avant-Garde:<br>
+What do you wish to know about transformation?<br>
+<br>
+<a action="bypass -h Quest AvantGarde 32323-02a.html">"What do I need to know about transformation?"</a><br>
+<a action="bypass -h Quest AvantGarde 32323-02b.html">"What do I need to do to transform into another shape?"</a><br>
+<a action="bypass -h Quest AvantGarde 32323-02c.html">"What do I need to know before transformation?"</a>
+</body></html>

+ 1 - 1
L2J_DataPack_BETA/dist/game/data/html/masterTransformation/master_transformation002a.htm → L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/AvantGarde/32323-02a.html

@@ -3,5 +3,5 @@ To learn the magic of transformation, you will need to receive special training.
 Find the Wizard of Darkness, who lives at Hardin's Academy. He will open the path to transformation.<br>
 You must have reached at least <font color="LEVEL">level 50 </font> to embark on this path.<br>
 You will also need a special seal. I do not know how you can obtain it, but without it transformation is impossible.<br>
-<a action="bypass -h npc_%objectId%_Link masterTransformation/master_transformation002.htm">Back.</a>
+<a action="bypass -h Quest AvantGarde 32323-02.html">Back.</a>
 </body></html>

+ 1 - 1
L2J_DataPack_BETA/dist/game/data/html/masterTransformation/master_transformation002b.htm → L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/AvantGarde/32323-02b.html

@@ -1,5 +1,5 @@
 <html><body>Transformation Wizard Avant-Garde:<br>
 After you have been guided through the process of transformation by a wizard, you may transform yourself into another shape by bringing a transform sealbook to me.<br>
 Know that it is no easy task to earn one. I have heard, however, that you may find one through the Marketeer of Mammon or the Adventure Guild.<br>
-<a action="bypass -h npc_%objectId%_Link masterTransformation/master_transformation002.htm">Back.</a>
+<a action="bypass -h Quest AvantGarde 32323-02.html">Back.</a>
 </body></html>

+ 4 - 4
L2J_DataPack_BETA/dist/game/data/html/masterTransformation/master_transformation002c.htm → L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/AvantGarde/32323-02c.html

@@ -1,5 +1,5 @@
-<html><body>Transformation Wizard Avant-Garde:<br>
-You must remember that once you have been transformed, you must not go into <font color="LEVEL">deep water</font>. Once you have reverted to your original form, your soul will need time to recover -- you will not be able to transform again for some time. Understand?<br>
-Other than that... Each individual soul contains its own <font color="LEVEL">unique character</font>. If you transform into something that matches that character, you may earn some benefits. Think of it as wearing a suit of clothes that fit you perfectly. Every race has its own respective "figure," so I advise you to do a little research about what kind of transformation would fit you best.<br>
-<a action="bypass -h npc_%objectId%_Link masterTransformation/master_transformation002.htm">Back.</a>
+<html><body>Transformation Wizard Avant-Garde:<br>
+You must remember that once you have been transformed, you must not go into <font color="LEVEL">deep water</font>. Once you have reverted to your original form, your soul will need time to recover -- you will not be able to transform again for some time. Understand?<br>
+Other than that... Each individual soul contains its own <font color="LEVEL">unique character</font>. If you transform into something that matches that character, you may earn some benefits. Think of it as wearing a suit of clothes that fit you perfectly. Every race has its own respective "figure," so I advise you to do a little research about what kind of transformation would fit you best.<br>
+<a action="bypass -h Quest AvantGarde 32323-02.html">Back.</a>
 </body></html>

+ 0 - 0
L2J_DataPack_BETA/dist/game/data/html/masterTransformation/master_transformation003.htm → L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/AvantGarde/32323-03.html


+ 0 - 0
L2J_DataPack_BETA/dist/game/data/html/masterTransformation/master_transformation004.htm → L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/AvantGarde/32323-04.html


+ 2 - 2
L2J_DataPack_BETA/dist/game/data/html/masterTransformation/master_transformation005.htm → L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/AvantGarde/32323-05.html

@@ -5,6 +5,6 @@ If you were certified by your subclass master and have brought the certificate,
 Be warned: this will inflict a serious shock to your soul. You must strengthen it in preparation for this rite.<br>
 In order to learn certified subclass skills, you must first speak to Hardin and obtain the first sealbook. Hardin's Academy is in Dragon Valley.<br>
 Do you wish to proceed?<br>
-<a action="bypass -h npc_%objectId%_LearnSubClassSkill">Learn skills.</a><br>
-<a action="bypass -h npc_%objectId%_Link masterTransformation/master_transformation006.htm">Return.</a>
+<a action="bypass -h Quest AvantGarde LearnSubClassSkill">Learn skills.</a><br>
+<a action="bypass -h Quest AvantGarde 32323-06.html">Return.</a>
 </body></html>

+ 5 - 0
L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/AvantGarde/32323-05a.html

@@ -0,0 +1,5 @@
+<html><body>Transformation Wizard Avant-Garde:<br>
+What do you wish to know about subclass certification?<br>
+<a action="bypass -h Quest AvantGarde 32323-05.html">Learn skills of the certified subclass.</a><br>
+<a action="bypass -h Quest AvantGarde 32323-05no.html">Certification removal.</a>
+</body></html>

+ 7 - 0
L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/AvantGarde/32323-05no.html

@@ -0,0 +1,7 @@
+<html><body>Transformation Wizard Avant-Garde:<br>
+It is a tremendous endeavor to obtain subclass certification and learn the appropriate skills. Beyond the purely physical effort, the burden on your soul is beyond your imagination... It is almost a suicidal venture.<br>
+However, the process can be undone.  There is a special kind of herb that can be used to remove your previously chosen skills. The price of the herb, though, is approximately <font color="LEVEL">10 million Adena</font>... I have the herb here, so I can cancel the certification anytime once you have paid.<br>
+If the certification is canceled, <font color="LEVEL">the current certification status  and skills will vanish immediately -- poof!</font> Now then, do you really wish to cancel certification?<br>
+<a action="bypass -h Quest AvantGarde CancelCertification">Cancel certification.</a><br>
+<a action="bypass -h Quest AvantGarde 32323-06no.html">Return.</a>
+</body></html>

+ 0 - 0
L2J_DataPack_BETA/dist/game/data/html/masterTransformation/master_transformation006.htm → L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/AvantGarde/32323-06.html


+ 0 - 0
L2J_DataPack_BETA/dist/game/data/html/masterTransformation/master_transformation006no.htm → L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/AvantGarde/32323-06no.html


+ 0 - 0
L2J_DataPack_BETA/dist/game/data/html/masterTransformation/master_transformation007.htm → L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/AvantGarde/32323-07.html


+ 0 - 0
L2J_DataPack_BETA/dist/game/data/html/masterTransformation/master_transformation008.htm → L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/AvantGarde/32323-08.html


+ 0 - 0
L2J_DataPack_BETA/dist/game/data/html/masterTransformation/master_transformation008no.htm → L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/AvantGarde/32323-08no.html


+ 0 - 0
L2J_DataPack_BETA/dist/game/data/html/masterTransformation/master_transformation009no.htm → L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/AvantGarde/32323-09no.html


+ 0 - 0
L2J_DataPack_BETA/dist/game/data/html/masterTransformation/master_transformation010no.htm → L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/AvantGarde/32323-10no.html


+ 357 - 0
L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/AvantGarde/AvantGarde.java

@@ -0,0 +1,357 @@
+package ai.npc.AvantGarde;
+
+import java.util.List;
+
+import ai.npc.AbstractNpcAI;
+
+import com.l2jserver.Config;
+import com.l2jserver.gameserver.datatables.MultiSell;
+import com.l2jserver.gameserver.datatables.SkillTable;
+import com.l2jserver.gameserver.datatables.SkillTreesData;
+import com.l2jserver.gameserver.instancemanager.QuestManager;
+import com.l2jserver.gameserver.model.L2SkillLearn;
+import com.l2jserver.gameserver.model.actor.L2Npc;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.base.AcquireSkillType;
+import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
+import com.l2jserver.gameserver.model.quest.QuestState;
+import com.l2jserver.gameserver.model.skills.L2Skill;
+import com.l2jserver.gameserver.network.SystemMessageId;
+import com.l2jserver.gameserver.network.clientpackets.RequestAcquireSkill;
+import com.l2jserver.gameserver.network.serverpackets.AcquireSkillList;
+import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
+import com.l2jserver.gameserver.util.Util;
+
+/**
+ * Avant-Garde AI.<br>
+ * Sub-Class Certification system, skill learning and certification canceling.<br>
+ * Transformation skill learning and transformation scroll sell.
+ * @author Zoey76
+ */
+public class AvantGarde extends AbstractNpcAI
+{
+	// NPC
+	private static final int AVANT_GARDE = 32323;
+	// Items
+	// @formatter:off
+	private static final int[] ITEMS =
+	{
+		10280, 10281, 10282, 10283, 10284, 10285, 10286, 10287, 10288, 10289, 10290, 10291, 10292, 10293, 10294, 10612
+	};
+	// @formatter:on
+	// Misc
+	private static final String[] QUEST_VAR_NAMES =
+	{
+		"EmergentAbility65-",
+		"EmergentAbility70-",
+		"ClassAbility75-",
+		"ClassAbility80-"
+	};
+	
+	public AvantGarde()
+	{
+		super(AvantGarde.class.getSimpleName(), "ai/npc");
+		addStartNpc(AVANT_GARDE);
+		addTalkId(AVANT_GARDE);
+		addFirstTalkId(AVANT_GARDE);
+		addAcquireSkillId(AVANT_GARDE);
+	}
+	
+	@Override
+	public String onAcquireSkill(L2Npc npc, L2PcInstance player, L2Skill skill, AcquireSkillType type)
+	{
+		switch (type)
+		{
+			case TRANSFORM:
+			{
+				showTransformSkillList(player);
+				break;
+			}
+			case SUBCLASS:
+			{
+				showSubClassSkillList(player);
+				break;
+			}
+		}
+		return null;
+	}
+	
+	@Override
+	public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
+	{
+		String htmltext = null;
+		switch (event)
+		{
+			case "32323-02.html":
+			case "32323-02a.html":
+			case "32323-02b.html":
+			case "32323-02c.html":
+			case "32323-05.html":
+			case "32323-05a.html":
+			case "32323-05no.html":
+			case "32323-06.html":
+			case "32323-06no.html":
+			{
+				htmltext = event;
+				break;
+			}
+			case "LearnTransformationSkill":
+			{
+				if (RequestAcquireSkill.canTransform(player))
+				{
+					showTransformSkillList(player);
+				}
+				else
+				{
+					htmltext = "32323-03.html";
+				}
+				break;
+			}
+			case "BuyTransformationItems":
+			{
+				if (RequestAcquireSkill.canTransform(player))
+				{
+					MultiSell.getInstance().separateAndSend(32323001, player, npc, false);
+				}
+				else
+				{
+					htmltext = "32323-04.html";
+				}
+				break;
+			}
+			case "LearnSubClassSkill":
+			{
+				if (!RequestAcquireSkill.canTransform(player))
+				{
+					htmltext = "32323-04.html";
+				}
+				if (player.isSubClassActive())
+				{
+					htmltext = "32323-08.html";
+				}
+				else
+				{
+					boolean hasItems = false;
+					for (int id : ITEMS)
+					{
+						if (player.getInventory().getItemByItemId(id) != null)
+						{
+							hasItems = true;
+							break;
+						}
+					}
+					if (hasItems)
+					{
+						showSubClassSkillList(player);
+					}
+					else
+					{
+						htmltext = "32323-08.html";
+					}
+				}
+				break;
+			}
+			case "CancelCertification":
+			{
+				if (player.getSubClasses().size() == 0)
+				{
+					htmltext = "32323-07.html";
+				}
+				else if (player.isSubClassActive())
+				{
+					htmltext = "32323-08.html";
+				}
+				else if (player.getAdena() < Config.FEE_DELETE_SUBCLASS_SKILLS)
+				{
+					htmltext = "32323-08no.html";
+				}
+				else
+				{
+					QuestState st = player.getQuestState("SubClassSkills");
+					if (st == null)
+					{
+						st = QuestManager.getInstance().getQuest("SubClassSkills").newQuestState(player);
+					}
+					
+					int activeCertifications = 0;
+					for (String varName : QUEST_VAR_NAMES)
+					{
+						for (int i = 1; i <= Config.MAX_SUBCLASS; i++)
+						{
+							String qvar = st.getGlobalQuestVar(varName + i);
+							if (!qvar.isEmpty() && (qvar.endsWith(";") || !qvar.equals("0")))
+							{
+								activeCertifications++;
+							}
+						}
+					}
+					if (activeCertifications == 0)
+					{
+						htmltext = "32323-10no.html";
+					}
+					else
+					{
+						for (String varName : QUEST_VAR_NAMES)
+						{
+							for (int i = 1; i <= Config.MAX_SUBCLASS; i++)
+							{
+								final String qvarName = varName + i;
+								final String qvar = st.getGlobalQuestVar(qvarName);
+								if (qvar.endsWith(";"))
+								{
+									final String skillIdVar = qvar.replace(";", "");
+									if (Util.isDigit(skillIdVar))
+									{
+										int skillId = Integer.parseInt(skillIdVar);
+										final L2Skill sk = SkillTable.getInstance().getInfo(skillId, 1);
+										if (sk != null)
+										{
+											player.removeSkill(sk);
+											st.saveGlobalQuestVar(qvarName, "0");
+										}
+									}
+									else
+									{
+										_log.warning("Invalid Sub-Class Skill Id: " + skillIdVar + " for player " + player.getName() + "!");
+									}
+								}
+								else if (!qvar.isEmpty() && !qvar.equals("0"))
+								{
+									if (Util.isDigit(qvar))
+									{
+										final int itemObjId = Integer.parseInt(qvar);
+										L2ItemInstance itemInstance = player.getInventory().getItemByObjectId(itemObjId);
+										if (itemInstance != null)
+										{
+											player.destroyItem("CancelCertification", itemObjId, 1, player, false);
+										}
+										else
+										{
+											itemInstance = player.getWarehouse().getItemByObjectId(itemObjId);
+											if (itemInstance != null)
+											{
+												_log.warning("Somehow " + player.getName() + " put a certification book into warehouse!");
+												player.getWarehouse().destroyItem("CancelCertification", itemInstance, 1, player, false);
+											}
+											else
+											{
+												_log.warning("Somehow " + player.getName() + " deleted a certification book!");
+											}
+										}
+										st.saveGlobalQuestVar(qvarName, "0");
+									}
+									else
+									{
+										_log.warning("Invalid item object Id: " + qvar + " for player " + player.getName() + "!");
+									}
+								}
+							}
+						}
+						
+						player.reduceAdena("Cleanse", Config.FEE_DELETE_SUBCLASS_SKILLS, npc, true);
+						htmltext = "32323-09no.html";
+						player.sendSkillList();
+					}
+					
+					// Let's consume all certification books, even those not present in database.
+					for (int itemId : ITEMS)
+					{
+						L2ItemInstance item = player.getInventory().getItemByItemId(itemId);
+						if (item != null)
+						{
+							_log.warning(getClass().getName() + ": player " + player + " had 'extra' certification skill books while cancelling sub-class certifications!");
+							player.destroyItem("CancelCertificationExtraBooks", item, npc, false);
+						}
+					}
+				}
+				break;
+			}
+		}
+		return htmltext;
+	}
+	
+	@Override
+	public String onFirstTalk(L2Npc npc, L2PcInstance player)
+	{
+		return "32323-01.html";
+	}
+	
+	@Override
+	public String onTalk(L2Npc npc, L2PcInstance talker)
+	{
+		return "32323-01.html";
+	}
+	
+	/**
+	 * Display the Sub-Class Skill list to the player.
+	 * @param player the player
+	 */
+	public static void showSubClassSkillList(L2PcInstance player)
+	{
+		final List<L2SkillLearn> subClassSkills = SkillTreesData.getInstance().getAvailableSubClassSkills(player);
+		final AcquireSkillList asl = new AcquireSkillList(AcquireSkillType.SUBCLASS);
+		int count = 0;
+		
+		for (L2SkillLearn s : subClassSkills)
+		{
+			if (SkillTable.getInstance().getInfo(s.getSkillId(), s.getSkillLevel()) != null)
+			{
+				count++;
+				asl.addSkill(s.getSkillId(), s.getSkillLevel(), s.getSkillLevel(), 0, 0);
+			}
+		}
+		if (count > 0)
+		{
+			player.sendPacket(asl);
+		}
+		else
+		{
+			player.sendPacket(SystemMessageId.NO_MORE_SKILLS_TO_LEARN);
+		}
+	}
+	
+	/**
+	 * This displays Transformation Skill List to the player.
+	 * @param player the active character.
+	 */
+	public static void showTransformSkillList(L2PcInstance player)
+	{
+		final List<L2SkillLearn> skills = SkillTreesData.getInstance().getAvailableTransformSkills(player);
+		final AcquireSkillList asl = new AcquireSkillList(AcquireSkillType.TRANSFORM);
+		int counts = 0;
+		
+		for (L2SkillLearn s : skills)
+		{
+			if (SkillTable.getInstance().getInfo(s.getSkillId(), s.getSkillLevel()) != null)
+			{
+				counts++;
+				asl.addSkill(s.getSkillId(), s.getSkillLevel(), s.getSkillLevel(), s.getLevelUpSp(), 0);
+			}
+		}
+		
+		if (counts == 0)
+		{
+			final int minlevel = SkillTreesData.getInstance().getMinLevelForNewSkill(player, SkillTreesData.getInstance().getTransformSkillTree());
+			if (minlevel > 0)
+			{
+				// No more skills to learn, come back when you level.
+				final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.DO_NOT_HAVE_FURTHER_SKILLS_TO_LEARN_S1);
+				sm.addNumber(minlevel);
+				player.sendPacket(sm);
+			}
+			else
+			{
+				player.sendPacket(SystemMessageId.NO_MORE_SKILLS_TO_LEARN);
+			}
+		}
+		else
+		{
+			player.sendPacket(asl);
+		}
+	}
+	
+	public static void main(String[] args)
+	{
+		new AvantGarde();
+	}
+}

+ 1 - 1
L2J_DataPack_BETA/dist/sql/game/npc.sql

@@ -8366,7 +8366,7 @@ INSERT INTO `npc` VALUES
 (32320, 32320, "Item Broker", 0, "Adventure Guildsman", 0, "LineageNPC.a_traderC_Mhuman", 8, 23, 70, "male", "L2Npc", 40, 2444.46819, 1345.8, 7.5, 2.7, 40, 43, 30, 21, 20, 20, 0, 0, 688.86373, 295.91597, 470.40463, 216.53847, 253, 4, 333, 0, 0, 0, 50, 120, 0, 1),
 (32321, 32321, "Item Broker", 0, "Adventure Guildsman", 0, "LineageNPC.a_traderC_Mhuman", 8, 23, 70, "male", "L2Npc", 40, 2444.46819, 1345.8, 7.5, 2.7, 40, 43, 30, 21, 20, 20, 0, 0, 688.86373, 295.91597, 470.40463, 216.53847, 253, 4, 333, 0, 0, 0, 50, 120, 0, 1),
 (32322, 32322, "Item Broker", 0, "Adventure Guildsman", 0, "LineageNPC.a_traderC_Mhuman", 8, 23, 70, "male", "L2Npc", 40, 2444.46819, 1345.8, 7.5, 2.7, 40, 43, 30, 21, 20, 20, 0, 0, 688.86373, 295.91597, 470.40463, 216.53847, 253, 4, 333, 0, 0, 0, 50, 120, 0, 1),
-(32323, 32323, "Avant-Garde", 0, "Transformation Wizard", 0, "LineageNPC.a_traderB_FHuman", 8, 24.5, 70, "female", "L2TransformManager", 40, 2444.46819, 1345.8, 7.5, 2.7, 40, 43, 30, 21, 20, 20, 0, 0, 688.86373, 295.91597, 470.40463, 216.53847, 253, 4, 333, 0, 0, 0, 50, 120, 0, 1),
+(32323, 32323, "Avant-Garde", 0, "Transformation Wizard", 0, "LineageNPC.a_traderB_FHuman", 8, 24.5, 70, "female", "L2Npc", 40, 2444.46819, 1345.8, 7.5, 2.7, 40, 43, 30, 21, 20, 20, 0, 0, 688.86373, 295.91597, 470.40463, 216.53847, 253, 4, 333, 0, 0, 0, 50, 120, 0, 1),
 (32324, 32324, "Black Stone Monolith", 0, "", 0, "LineageNpcEV.dark_clouds_stonehenge", 19, 24.5, 70, "male", "L2Npc", 40, 2444.46819, 1345.8, 7.5, 2.7, 40, 43, 30, 21, 20, 20, 0, 0, 688.86373, 295.91597, 470.40463, 216.53847, 253, 4, 333, 0, 0, 0, 1, 120, 0, 1),
 (32325, 32325, "Yin", 0, "Attribute Master", 0, "LineageNPC.a_mageguild_master_FHuman", 8, 23, 70, "female", "L2Npc", 40, 2444.46819, 1345.8, 7.5, 2.7, 40, 43, 30, 21, 20, 20, 0, 0, 688.86373, 295.91597, 470.40463, 216.53847, 253, 4, 333, 0, 0, 0, 50, 120, 0, 1),
 (32326, 32326, "Yang", 0, "Attribute Master", 0, "LineageNPC.a_mageguild_master_MHuman", 8, 24, 70, "male", "L2Npc", 40, 2444.46819, 1345.8, 7.5, 2.7, 40, 43, 30, 21, 20, 20, 0, 0, 688.86373, 295.91597, 470.40463, 216.53847, 253, 4, 333, 0, 0, 0, 50, 120, 0, 1),