Sync with L2JServer Feb 3rd 2015.

This commit is contained in:
mobius
2015-02-03 21:11:57 +00:00
parent 9cf1a6d6e5
commit fe25f74122
169 changed files with 3379 additions and 5414 deletions

View File

@@ -2,9 +2,8 @@
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>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest AvantGarde 32323-02.html">Ask about transformation.</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest AvantGarde LearnTransformationSkill">Learn transformation.</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest AvantGarde BuyTransformationItems">Purchase items related to transformation.</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest AvantGarde 32323-05a.html">Learn about subclass certification.</Button>
<Button ALIGN=LEFT ICON="QUEST" action="bypass -h npc_%objectId%_Quest">Quest.</Button>
<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 npc_%objectId%_Quest">Quest.</a>
</body></html>

View File

@@ -22,25 +22,17 @@ import java.util.List;
import ai.npc.AbstractNpcAI;
import com.l2jserver.Config;
import com.l2jserver.gameserver.data.xml.impl.MultisellData;
import com.l2jserver.gameserver.data.xml.impl.SkillTreesData;
import com.l2jserver.gameserver.datatables.SkillData;
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.Skill;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.clientpackets.RequestAcquireSkill;
import com.l2jserver.gameserver.network.serverpackets.ExAcquirableSkillListByClass;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
import com.l2jserver.gameserver.util.Util;
import custom.Validators.SubClassSkills;
/**
* Avant-Garde AI.<br>
@@ -52,21 +44,6 @@ public final 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()
{
@@ -80,18 +57,9 @@ public final class AvantGarde extends AbstractNpcAI
@Override
public String onAcquireSkill(L2Npc npc, L2PcInstance player, Skill skill, AcquireSkillType type)
{
switch (type)
if (type.equals(AcquireSkillType.TRANSFORM))
{
case TRANSFORM:
{
showTransformSkillList(player);
break;
}
case SUBCLASS:
{
showSubClassSkillList(player);
break;
}
showTransformSkillList(player);
}
return null;
}
@@ -107,7 +75,6 @@ public final class AvantGarde extends AbstractNpcAI
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":
@@ -139,153 +106,6 @@ public final class AvantGarde extends AbstractNpcAI
}
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.class.getSimpleName());
if (st == null)
{
st = QuestManager.getInstance().getQuest(SubClassSkills.class.getSimpleName()).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 Skill sk = SkillData.getInstance().getSkill(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;
}
@@ -302,24 +122,6 @@ public final class AvantGarde extends AbstractNpcAI
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);
if (subClassSkills.isEmpty())
{
player.sendPacket(SystemMessageId.THERE_ARE_NO_OTHER_SKILLS_TO_LEARN);
}
else
{
player.sendPacket(new ExAcquirableSkillListByClass(subClassSkills, AcquireSkillType.TRANSFORM));
}
}
/**
* This displays Transformation Skill List to the player.
* @param player the active character.