From 93b28888fbc691e799ccd62e02f4303aec200350 Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Tue, 9 Apr 2019 20:46:02 +0000 Subject: [PATCH] Fixed Monk of Chaos skill removal. --- .../MonkOfChaos/MonkOfChaos.java | 26 ++++++++----------- .../data/xml/impl/SkillTreesData.java | 12 +++++++++ .../MonkOfChaos/MonkOfChaos.java | 26 ++++++++----------- .../data/xml/impl/SkillTreesData.java | 12 +++++++++ .../MonkOfChaos/MonkOfChaos.java | 26 ++++++++----------- .../data/xml/impl/SkillTreesData.java | 12 +++++++++ .../MonkOfChaos/MonkOfChaos.java | 26 ++++++++----------- .../data/xml/impl/SkillTreesData.java | 12 +++++++++ .../MonkOfChaos/MonkOfChaos.java | 26 ++++++++----------- .../data/xml/impl/SkillTreesData.java | 12 +++++++++ .../MonkOfChaos/MonkOfChaos.java | 26 ++++++++----------- .../data/xml/impl/SkillTreesData.java | 12 +++++++++ .../MonkOfChaos/MonkOfChaos.java | 26 ++++++++----------- .../data/xml/impl/SkillTreesData.java | 12 +++++++++ 14 files changed, 161 insertions(+), 105 deletions(-) diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/MonkOfChaos/MonkOfChaos.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/MonkOfChaos/MonkOfChaos.java index 3096420220..0eb240f203 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/MonkOfChaos/MonkOfChaos.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/MonkOfChaos/MonkOfChaos.java @@ -34,12 +34,13 @@ import ai.AbstractNpcAI; /** * Monk of Chaos AI. * @author Sdw + * @author Mobius */ public final class MonkOfChaos extends AbstractNpcAI { private static final int MONK_OF_CHAOS = 33880; private static final int MIN_LEVEL = 85; - private static final long CANCEL_FEE = 100000000; + private static final int CANCEL_FEE = 100000000; private static final int CHAOS_POMANDER = 37374; private static final int CHAOS_POMANDER_DUALCLASS = 37375; private static final String[] REVELATION_VAR_NAMES = @@ -91,7 +92,6 @@ public final class MonkOfChaos extends AbstractNpcAI if (player.isDualClassActive()) { final List skills = SkillTreesData.getInstance().getAvailableRevelationSkills(player, SubclassType.DUALCLASS); - if (skills.size() > 0) { player.sendPacket(new ExAcquirableSkillListByClass(skills, AcquireSkillType.REVELATION_DUALCLASS)); @@ -104,7 +104,6 @@ public final class MonkOfChaos extends AbstractNpcAI else { final List skills = SkillTreesData.getInstance().getAvailableRevelationSkills(player, SubclassType.BASECLASS); - if (skills.size() > 0) { player.sendPacket(new ExAcquirableSkillListByClass(skills, AcquireSkillType.REVELATION)); @@ -124,11 +123,8 @@ public final class MonkOfChaos extends AbstractNpcAI break; } - int count = 0; - final String[] varNames = player.isDualClassActive() ? DUALCLASS_REVELATION_VAR_NAMES : REVELATION_VAR_NAMES; - final int chaosPomander = player.isDualClassActive() ? CHAOS_POMANDER_DUALCLASS : CHAOS_POMANDER; - + int count = 0; for (String varName : varNames) { if (player.getVariables().getInt(varName, 0) > 0) @@ -136,7 +132,6 @@ public final class MonkOfChaos extends AbstractNpcAI count++; } } - if ((player.getLevel() < MIN_LEVEL) || !player.isInCategory(CategoryType.SIXTH_CLASS_GROUP) || (count == 0)) { htmltext = "no-cancel.html"; @@ -148,17 +143,18 @@ public final class MonkOfChaos extends AbstractNpcAI htmltext = "no-adena.html"; break; } + takeItems(player, 57, CANCEL_FEE); + for (SkillLearn skill : SkillTreesData.getInstance().getAllRevelationSkills(player, player.isDualClassActive() ? SubclassType.DUALCLASS : SubclassType.BASECLASS)) + { + player.removeSkill(skill.getSkillId()); + } for (String varName : varNames) { - final int skillId = player.getVariables().getInt(varName, 0); - if (skillId > 0) - { - player.removeSkill(skillId); - player.getVariables().remove(varName); - } + player.getVariables().remove(varName); } - giveItems(player, chaosPomander, count); + + giveItems(player, player.isDualClassActive() ? CHAOS_POMANDER_DUALCLASS : CHAOS_POMANDER, count); htmltext = "canceled.html"; break; } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java index 780e0a1d1c..dca1e0b4d6 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java @@ -877,6 +877,18 @@ public final class SkillTreesData implements IXmlReader return result; } + /** + * Gets the complete revelation skill list. + * @param player the player requesting the revelation skills + * @param type the player current subclass type + * @return all the available revelation skills for a given {@code player} + */ + public Collection getAllRevelationSkills(PlayerInstance player, SubclassType type) + { + final Map revelationSkills = _revelationSkillTree.get(type); + return revelationSkills == null ? Collections.emptyList() : revelationSkills.values(); + } + /** * Gets the available alchemy skills, restricted to Ertheia * @param player the player requesting the alchemy skills diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/MonkOfChaos/MonkOfChaos.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/MonkOfChaos/MonkOfChaos.java index 3096420220..0eb240f203 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/MonkOfChaos/MonkOfChaos.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/MonkOfChaos/MonkOfChaos.java @@ -34,12 +34,13 @@ import ai.AbstractNpcAI; /** * Monk of Chaos AI. * @author Sdw + * @author Mobius */ public final class MonkOfChaos extends AbstractNpcAI { private static final int MONK_OF_CHAOS = 33880; private static final int MIN_LEVEL = 85; - private static final long CANCEL_FEE = 100000000; + private static final int CANCEL_FEE = 100000000; private static final int CHAOS_POMANDER = 37374; private static final int CHAOS_POMANDER_DUALCLASS = 37375; private static final String[] REVELATION_VAR_NAMES = @@ -91,7 +92,6 @@ public final class MonkOfChaos extends AbstractNpcAI if (player.isDualClassActive()) { final List skills = SkillTreesData.getInstance().getAvailableRevelationSkills(player, SubclassType.DUALCLASS); - if (skills.size() > 0) { player.sendPacket(new ExAcquirableSkillListByClass(skills, AcquireSkillType.REVELATION_DUALCLASS)); @@ -104,7 +104,6 @@ public final class MonkOfChaos extends AbstractNpcAI else { final List skills = SkillTreesData.getInstance().getAvailableRevelationSkills(player, SubclassType.BASECLASS); - if (skills.size() > 0) { player.sendPacket(new ExAcquirableSkillListByClass(skills, AcquireSkillType.REVELATION)); @@ -124,11 +123,8 @@ public final class MonkOfChaos extends AbstractNpcAI break; } - int count = 0; - final String[] varNames = player.isDualClassActive() ? DUALCLASS_REVELATION_VAR_NAMES : REVELATION_VAR_NAMES; - final int chaosPomander = player.isDualClassActive() ? CHAOS_POMANDER_DUALCLASS : CHAOS_POMANDER; - + int count = 0; for (String varName : varNames) { if (player.getVariables().getInt(varName, 0) > 0) @@ -136,7 +132,6 @@ public final class MonkOfChaos extends AbstractNpcAI count++; } } - if ((player.getLevel() < MIN_LEVEL) || !player.isInCategory(CategoryType.SIXTH_CLASS_GROUP) || (count == 0)) { htmltext = "no-cancel.html"; @@ -148,17 +143,18 @@ public final class MonkOfChaos extends AbstractNpcAI htmltext = "no-adena.html"; break; } + takeItems(player, 57, CANCEL_FEE); + for (SkillLearn skill : SkillTreesData.getInstance().getAllRevelationSkills(player, player.isDualClassActive() ? SubclassType.DUALCLASS : SubclassType.BASECLASS)) + { + player.removeSkill(skill.getSkillId()); + } for (String varName : varNames) { - final int skillId = player.getVariables().getInt(varName, 0); - if (skillId > 0) - { - player.removeSkill(skillId); - player.getVariables().remove(varName); - } + player.getVariables().remove(varName); } - giveItems(player, chaosPomander, count); + + giveItems(player, player.isDualClassActive() ? CHAOS_POMANDER_DUALCLASS : CHAOS_POMANDER, count); htmltext = "canceled.html"; break; } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java index 780e0a1d1c..dca1e0b4d6 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java @@ -877,6 +877,18 @@ public final class SkillTreesData implements IXmlReader return result; } + /** + * Gets the complete revelation skill list. + * @param player the player requesting the revelation skills + * @param type the player current subclass type + * @return all the available revelation skills for a given {@code player} + */ + public Collection getAllRevelationSkills(PlayerInstance player, SubclassType type) + { + final Map revelationSkills = _revelationSkillTree.get(type); + return revelationSkills == null ? Collections.emptyList() : revelationSkills.values(); + } + /** * Gets the available alchemy skills, restricted to Ertheia * @param player the player requesting the alchemy skills diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/MonkOfChaos/MonkOfChaos.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/MonkOfChaos/MonkOfChaos.java index 3096420220..0eb240f203 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/MonkOfChaos/MonkOfChaos.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/MonkOfChaos/MonkOfChaos.java @@ -34,12 +34,13 @@ import ai.AbstractNpcAI; /** * Monk of Chaos AI. * @author Sdw + * @author Mobius */ public final class MonkOfChaos extends AbstractNpcAI { private static final int MONK_OF_CHAOS = 33880; private static final int MIN_LEVEL = 85; - private static final long CANCEL_FEE = 100000000; + private static final int CANCEL_FEE = 100000000; private static final int CHAOS_POMANDER = 37374; private static final int CHAOS_POMANDER_DUALCLASS = 37375; private static final String[] REVELATION_VAR_NAMES = @@ -91,7 +92,6 @@ public final class MonkOfChaos extends AbstractNpcAI if (player.isDualClassActive()) { final List skills = SkillTreesData.getInstance().getAvailableRevelationSkills(player, SubclassType.DUALCLASS); - if (skills.size() > 0) { player.sendPacket(new ExAcquirableSkillListByClass(skills, AcquireSkillType.REVELATION_DUALCLASS)); @@ -104,7 +104,6 @@ public final class MonkOfChaos extends AbstractNpcAI else { final List skills = SkillTreesData.getInstance().getAvailableRevelationSkills(player, SubclassType.BASECLASS); - if (skills.size() > 0) { player.sendPacket(new ExAcquirableSkillListByClass(skills, AcquireSkillType.REVELATION)); @@ -124,11 +123,8 @@ public final class MonkOfChaos extends AbstractNpcAI break; } - int count = 0; - final String[] varNames = player.isDualClassActive() ? DUALCLASS_REVELATION_VAR_NAMES : REVELATION_VAR_NAMES; - final int chaosPomander = player.isDualClassActive() ? CHAOS_POMANDER_DUALCLASS : CHAOS_POMANDER; - + int count = 0; for (String varName : varNames) { if (player.getVariables().getInt(varName, 0) > 0) @@ -136,7 +132,6 @@ public final class MonkOfChaos extends AbstractNpcAI count++; } } - if ((player.getLevel() < MIN_LEVEL) || !player.isInCategory(CategoryType.SIXTH_CLASS_GROUP) || (count == 0)) { htmltext = "no-cancel.html"; @@ -148,17 +143,18 @@ public final class MonkOfChaos extends AbstractNpcAI htmltext = "no-adena.html"; break; } + takeItems(player, 57, CANCEL_FEE); + for (SkillLearn skill : SkillTreesData.getInstance().getAllRevelationSkills(player, player.isDualClassActive() ? SubclassType.DUALCLASS : SubclassType.BASECLASS)) + { + player.removeSkill(skill.getSkillId()); + } for (String varName : varNames) { - final int skillId = player.getVariables().getInt(varName, 0); - if (skillId > 0) - { - player.removeSkill(skillId); - player.getVariables().remove(varName); - } + player.getVariables().remove(varName); } - giveItems(player, chaosPomander, count); + + giveItems(player, player.isDualClassActive() ? CHAOS_POMANDER_DUALCLASS : CHAOS_POMANDER, count); htmltext = "canceled.html"; break; } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java index 780e0a1d1c..dca1e0b4d6 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java @@ -877,6 +877,18 @@ public final class SkillTreesData implements IXmlReader return result; } + /** + * Gets the complete revelation skill list. + * @param player the player requesting the revelation skills + * @param type the player current subclass type + * @return all the available revelation skills for a given {@code player} + */ + public Collection getAllRevelationSkills(PlayerInstance player, SubclassType type) + { + final Map revelationSkills = _revelationSkillTree.get(type); + return revelationSkills == null ? Collections.emptyList() : revelationSkills.values(); + } + /** * Gets the available alchemy skills, restricted to Ertheia * @param player the player requesting the alchemy skills diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/areas/TalkingIsland/MonkOfChaos/MonkOfChaos.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/areas/TalkingIsland/MonkOfChaos/MonkOfChaos.java index 3096420220..0eb240f203 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/areas/TalkingIsland/MonkOfChaos/MonkOfChaos.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/areas/TalkingIsland/MonkOfChaos/MonkOfChaos.java @@ -34,12 +34,13 @@ import ai.AbstractNpcAI; /** * Monk of Chaos AI. * @author Sdw + * @author Mobius */ public final class MonkOfChaos extends AbstractNpcAI { private static final int MONK_OF_CHAOS = 33880; private static final int MIN_LEVEL = 85; - private static final long CANCEL_FEE = 100000000; + private static final int CANCEL_FEE = 100000000; private static final int CHAOS_POMANDER = 37374; private static final int CHAOS_POMANDER_DUALCLASS = 37375; private static final String[] REVELATION_VAR_NAMES = @@ -91,7 +92,6 @@ public final class MonkOfChaos extends AbstractNpcAI if (player.isDualClassActive()) { final List skills = SkillTreesData.getInstance().getAvailableRevelationSkills(player, SubclassType.DUALCLASS); - if (skills.size() > 0) { player.sendPacket(new ExAcquirableSkillListByClass(skills, AcquireSkillType.REVELATION_DUALCLASS)); @@ -104,7 +104,6 @@ public final class MonkOfChaos extends AbstractNpcAI else { final List skills = SkillTreesData.getInstance().getAvailableRevelationSkills(player, SubclassType.BASECLASS); - if (skills.size() > 0) { player.sendPacket(new ExAcquirableSkillListByClass(skills, AcquireSkillType.REVELATION)); @@ -124,11 +123,8 @@ public final class MonkOfChaos extends AbstractNpcAI break; } - int count = 0; - final String[] varNames = player.isDualClassActive() ? DUALCLASS_REVELATION_VAR_NAMES : REVELATION_VAR_NAMES; - final int chaosPomander = player.isDualClassActive() ? CHAOS_POMANDER_DUALCLASS : CHAOS_POMANDER; - + int count = 0; for (String varName : varNames) { if (player.getVariables().getInt(varName, 0) > 0) @@ -136,7 +132,6 @@ public final class MonkOfChaos extends AbstractNpcAI count++; } } - if ((player.getLevel() < MIN_LEVEL) || !player.isInCategory(CategoryType.SIXTH_CLASS_GROUP) || (count == 0)) { htmltext = "no-cancel.html"; @@ -148,17 +143,18 @@ public final class MonkOfChaos extends AbstractNpcAI htmltext = "no-adena.html"; break; } + takeItems(player, 57, CANCEL_FEE); + for (SkillLearn skill : SkillTreesData.getInstance().getAllRevelationSkills(player, player.isDualClassActive() ? SubclassType.DUALCLASS : SubclassType.BASECLASS)) + { + player.removeSkill(skill.getSkillId()); + } for (String varName : varNames) { - final int skillId = player.getVariables().getInt(varName, 0); - if (skillId > 0) - { - player.removeSkill(skillId); - player.getVariables().remove(varName); - } + player.getVariables().remove(varName); } - giveItems(player, chaosPomander, count); + + giveItems(player, player.isDualClassActive() ? CHAOS_POMANDER_DUALCLASS : CHAOS_POMANDER, count); htmltext = "canceled.html"; break; } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java index 780e0a1d1c..dca1e0b4d6 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java @@ -877,6 +877,18 @@ public final class SkillTreesData implements IXmlReader return result; } + /** + * Gets the complete revelation skill list. + * @param player the player requesting the revelation skills + * @param type the player current subclass type + * @return all the available revelation skills for a given {@code player} + */ + public Collection getAllRevelationSkills(PlayerInstance player, SubclassType type) + { + final Map revelationSkills = _revelationSkillTree.get(type); + return revelationSkills == null ? Collections.emptyList() : revelationSkills.values(); + } + /** * Gets the available alchemy skills, restricted to Ertheia * @param player the player requesting the alchemy skills diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/areas/TalkingIsland/MonkOfChaos/MonkOfChaos.java b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/areas/TalkingIsland/MonkOfChaos/MonkOfChaos.java index 3096420220..0eb240f203 100644 --- a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/areas/TalkingIsland/MonkOfChaos/MonkOfChaos.java +++ b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/areas/TalkingIsland/MonkOfChaos/MonkOfChaos.java @@ -34,12 +34,13 @@ import ai.AbstractNpcAI; /** * Monk of Chaos AI. * @author Sdw + * @author Mobius */ public final class MonkOfChaos extends AbstractNpcAI { private static final int MONK_OF_CHAOS = 33880; private static final int MIN_LEVEL = 85; - private static final long CANCEL_FEE = 100000000; + private static final int CANCEL_FEE = 100000000; private static final int CHAOS_POMANDER = 37374; private static final int CHAOS_POMANDER_DUALCLASS = 37375; private static final String[] REVELATION_VAR_NAMES = @@ -91,7 +92,6 @@ public final class MonkOfChaos extends AbstractNpcAI if (player.isDualClassActive()) { final List skills = SkillTreesData.getInstance().getAvailableRevelationSkills(player, SubclassType.DUALCLASS); - if (skills.size() > 0) { player.sendPacket(new ExAcquirableSkillListByClass(skills, AcquireSkillType.REVELATION_DUALCLASS)); @@ -104,7 +104,6 @@ public final class MonkOfChaos extends AbstractNpcAI else { final List skills = SkillTreesData.getInstance().getAvailableRevelationSkills(player, SubclassType.BASECLASS); - if (skills.size() > 0) { player.sendPacket(new ExAcquirableSkillListByClass(skills, AcquireSkillType.REVELATION)); @@ -124,11 +123,8 @@ public final class MonkOfChaos extends AbstractNpcAI break; } - int count = 0; - final String[] varNames = player.isDualClassActive() ? DUALCLASS_REVELATION_VAR_NAMES : REVELATION_VAR_NAMES; - final int chaosPomander = player.isDualClassActive() ? CHAOS_POMANDER_DUALCLASS : CHAOS_POMANDER; - + int count = 0; for (String varName : varNames) { if (player.getVariables().getInt(varName, 0) > 0) @@ -136,7 +132,6 @@ public final class MonkOfChaos extends AbstractNpcAI count++; } } - if ((player.getLevel() < MIN_LEVEL) || !player.isInCategory(CategoryType.SIXTH_CLASS_GROUP) || (count == 0)) { htmltext = "no-cancel.html"; @@ -148,17 +143,18 @@ public final class MonkOfChaos extends AbstractNpcAI htmltext = "no-adena.html"; break; } + takeItems(player, 57, CANCEL_FEE); + for (SkillLearn skill : SkillTreesData.getInstance().getAllRevelationSkills(player, player.isDualClassActive() ? SubclassType.DUALCLASS : SubclassType.BASECLASS)) + { + player.removeSkill(skill.getSkillId()); + } for (String varName : varNames) { - final int skillId = player.getVariables().getInt(varName, 0); - if (skillId > 0) - { - player.removeSkill(skillId); - player.getVariables().remove(varName); - } + player.getVariables().remove(varName); } - giveItems(player, chaosPomander, count); + + giveItems(player, player.isDualClassActive() ? CHAOS_POMANDER_DUALCLASS : CHAOS_POMANDER, count); htmltext = "canceled.html"; break; } diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java index 780e0a1d1c..dca1e0b4d6 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java @@ -877,6 +877,18 @@ public final class SkillTreesData implements IXmlReader return result; } + /** + * Gets the complete revelation skill list. + * @param player the player requesting the revelation skills + * @param type the player current subclass type + * @return all the available revelation skills for a given {@code player} + */ + public Collection getAllRevelationSkills(PlayerInstance player, SubclassType type) + { + final Map revelationSkills = _revelationSkillTree.get(type); + return revelationSkills == null ? Collections.emptyList() : revelationSkills.values(); + } + /** * Gets the available alchemy skills, restricted to Ertheia * @param player the player requesting the alchemy skills diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/areas/TalkingIsland/MonkOfChaos/MonkOfChaos.java b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/areas/TalkingIsland/MonkOfChaos/MonkOfChaos.java index 3096420220..0eb240f203 100644 --- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/areas/TalkingIsland/MonkOfChaos/MonkOfChaos.java +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/areas/TalkingIsland/MonkOfChaos/MonkOfChaos.java @@ -34,12 +34,13 @@ import ai.AbstractNpcAI; /** * Monk of Chaos AI. * @author Sdw + * @author Mobius */ public final class MonkOfChaos extends AbstractNpcAI { private static final int MONK_OF_CHAOS = 33880; private static final int MIN_LEVEL = 85; - private static final long CANCEL_FEE = 100000000; + private static final int CANCEL_FEE = 100000000; private static final int CHAOS_POMANDER = 37374; private static final int CHAOS_POMANDER_DUALCLASS = 37375; private static final String[] REVELATION_VAR_NAMES = @@ -91,7 +92,6 @@ public final class MonkOfChaos extends AbstractNpcAI if (player.isDualClassActive()) { final List skills = SkillTreesData.getInstance().getAvailableRevelationSkills(player, SubclassType.DUALCLASS); - if (skills.size() > 0) { player.sendPacket(new ExAcquirableSkillListByClass(skills, AcquireSkillType.REVELATION_DUALCLASS)); @@ -104,7 +104,6 @@ public final class MonkOfChaos extends AbstractNpcAI else { final List skills = SkillTreesData.getInstance().getAvailableRevelationSkills(player, SubclassType.BASECLASS); - if (skills.size() > 0) { player.sendPacket(new ExAcquirableSkillListByClass(skills, AcquireSkillType.REVELATION)); @@ -124,11 +123,8 @@ public final class MonkOfChaos extends AbstractNpcAI break; } - int count = 0; - final String[] varNames = player.isDualClassActive() ? DUALCLASS_REVELATION_VAR_NAMES : REVELATION_VAR_NAMES; - final int chaosPomander = player.isDualClassActive() ? CHAOS_POMANDER_DUALCLASS : CHAOS_POMANDER; - + int count = 0; for (String varName : varNames) { if (player.getVariables().getInt(varName, 0) > 0) @@ -136,7 +132,6 @@ public final class MonkOfChaos extends AbstractNpcAI count++; } } - if ((player.getLevel() < MIN_LEVEL) || !player.isInCategory(CategoryType.SIXTH_CLASS_GROUP) || (count == 0)) { htmltext = "no-cancel.html"; @@ -148,17 +143,18 @@ public final class MonkOfChaos extends AbstractNpcAI htmltext = "no-adena.html"; break; } + takeItems(player, 57, CANCEL_FEE); + for (SkillLearn skill : SkillTreesData.getInstance().getAllRevelationSkills(player, player.isDualClassActive() ? SubclassType.DUALCLASS : SubclassType.BASECLASS)) + { + player.removeSkill(skill.getSkillId()); + } for (String varName : varNames) { - final int skillId = player.getVariables().getInt(varName, 0); - if (skillId > 0) - { - player.removeSkill(skillId); - player.getVariables().remove(varName); - } + player.getVariables().remove(varName); } - giveItems(player, chaosPomander, count); + + giveItems(player, player.isDualClassActive() ? CHAOS_POMANDER_DUALCLASS : CHAOS_POMANDER, count); htmltext = "canceled.html"; break; } diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java index 780e0a1d1c..dca1e0b4d6 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java @@ -877,6 +877,18 @@ public final class SkillTreesData implements IXmlReader return result; } + /** + * Gets the complete revelation skill list. + * @param player the player requesting the revelation skills + * @param type the player current subclass type + * @return all the available revelation skills for a given {@code player} + */ + public Collection getAllRevelationSkills(PlayerInstance player, SubclassType type) + { + final Map revelationSkills = _revelationSkillTree.get(type); + return revelationSkills == null ? Collections.emptyList() : revelationSkills.values(); + } + /** * Gets the available alchemy skills, restricted to Ertheia * @param player the player requesting the alchemy skills diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/areas/TalkingIsland/MonkOfChaos/MonkOfChaos.java b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/areas/TalkingIsland/MonkOfChaos/MonkOfChaos.java index 3096420220..0eb240f203 100644 --- a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/areas/TalkingIsland/MonkOfChaos/MonkOfChaos.java +++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/areas/TalkingIsland/MonkOfChaos/MonkOfChaos.java @@ -34,12 +34,13 @@ import ai.AbstractNpcAI; /** * Monk of Chaos AI. * @author Sdw + * @author Mobius */ public final class MonkOfChaos extends AbstractNpcAI { private static final int MONK_OF_CHAOS = 33880; private static final int MIN_LEVEL = 85; - private static final long CANCEL_FEE = 100000000; + private static final int CANCEL_FEE = 100000000; private static final int CHAOS_POMANDER = 37374; private static final int CHAOS_POMANDER_DUALCLASS = 37375; private static final String[] REVELATION_VAR_NAMES = @@ -91,7 +92,6 @@ public final class MonkOfChaos extends AbstractNpcAI if (player.isDualClassActive()) { final List skills = SkillTreesData.getInstance().getAvailableRevelationSkills(player, SubclassType.DUALCLASS); - if (skills.size() > 0) { player.sendPacket(new ExAcquirableSkillListByClass(skills, AcquireSkillType.REVELATION_DUALCLASS)); @@ -104,7 +104,6 @@ public final class MonkOfChaos extends AbstractNpcAI else { final List skills = SkillTreesData.getInstance().getAvailableRevelationSkills(player, SubclassType.BASECLASS); - if (skills.size() > 0) { player.sendPacket(new ExAcquirableSkillListByClass(skills, AcquireSkillType.REVELATION)); @@ -124,11 +123,8 @@ public final class MonkOfChaos extends AbstractNpcAI break; } - int count = 0; - final String[] varNames = player.isDualClassActive() ? DUALCLASS_REVELATION_VAR_NAMES : REVELATION_VAR_NAMES; - final int chaosPomander = player.isDualClassActive() ? CHAOS_POMANDER_DUALCLASS : CHAOS_POMANDER; - + int count = 0; for (String varName : varNames) { if (player.getVariables().getInt(varName, 0) > 0) @@ -136,7 +132,6 @@ public final class MonkOfChaos extends AbstractNpcAI count++; } } - if ((player.getLevel() < MIN_LEVEL) || !player.isInCategory(CategoryType.SIXTH_CLASS_GROUP) || (count == 0)) { htmltext = "no-cancel.html"; @@ -148,17 +143,18 @@ public final class MonkOfChaos extends AbstractNpcAI htmltext = "no-adena.html"; break; } + takeItems(player, 57, CANCEL_FEE); + for (SkillLearn skill : SkillTreesData.getInstance().getAllRevelationSkills(player, player.isDualClassActive() ? SubclassType.DUALCLASS : SubclassType.BASECLASS)) + { + player.removeSkill(skill.getSkillId()); + } for (String varName : varNames) { - final int skillId = player.getVariables().getInt(varName, 0); - if (skillId > 0) - { - player.removeSkill(skillId); - player.getVariables().remove(varName); - } + player.getVariables().remove(varName); } - giveItems(player, chaosPomander, count); + + giveItems(player, player.isDualClassActive() ? CHAOS_POMANDER_DUALCLASS : CHAOS_POMANDER, count); htmltext = "canceled.html"; break; } diff --git a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java index ae1318ef3d..92efcc6f48 100644 --- a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java +++ b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java @@ -879,6 +879,18 @@ public final class SkillTreesData implements IXmlReader return result; } + /** + * Gets the complete revelation skill list. + * @param player the player requesting the revelation skills + * @param type the player current subclass type + * @return all the available revelation skills for a given {@code player} + */ + public Collection getAllRevelationSkills(PlayerInstance player, SubclassType type) + { + final Map revelationSkills = _revelationSkillTree.get(type); + return revelationSkills == null ? Collections.emptyList() : revelationSkills.values(); + } + /** * Gets the available alchemy skills, restricted to Ertheia * @param player the player requesting the alchemy skills