Fixed skill learn after class change.
Thanks Sdw for the pointers.
This commit is contained in:
@@ -32,9 +32,12 @@ import com.l2jmobius.commons.util.IGameXmlReader;
|
||||
import com.l2jmobius.commons.util.Rnd;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.CategoryData;
|
||||
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.datatables.ItemTable;
|
||||
import com.l2jmobius.gameserver.enums.CategoryType;
|
||||
import com.l2jmobius.gameserver.enums.Race;
|
||||
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;
|
||||
@@ -49,7 +52,6 @@ import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPress
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerProfessionChange;
|
||||
import com.l2jmobius.gameserver.model.holders.ItemChanceHolder;
|
||||
import com.l2jmobius.gameserver.model.spawns.SpawnTemplate;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.AcquireSkillList;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.PlaySound;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.TutorialCloseHtml;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.TutorialShowQuestionMark;
|
||||
@@ -409,10 +411,18 @@ public final class ClassMaster extends AbstractNpcAI implements IGameXmlReader
|
||||
{
|
||||
player.setBaseClass(player.getActiveClass());
|
||||
}
|
||||
player.sendPacket(new PlaySound("ItemSound.quest_fanfare_2"));
|
||||
player.broadcastUserInfo();
|
||||
player.sendPacket(new AcquireSkillList(player));
|
||||
if (player.isInCategory(CategoryType.AWAKEN_GROUP))
|
||||
{
|
||||
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); // Save player cause if server crashes before this char is saved, he will lose class and the money payed for class change.
|
||||
player.broadcastUserInfo();
|
||||
player.sendSkillList();
|
||||
player.sendPacket(new PlaySound("ItemSound.quest_fanfare_2"));
|
||||
return "test_server_helper021.html";
|
||||
}
|
||||
break;
|
||||
@@ -779,7 +789,7 @@ public final class ClassMaster extends AbstractNpcAI implements IGameXmlReader
|
||||
{
|
||||
player.setBaseClass(player.getActiveClass());
|
||||
}
|
||||
player.sendPacket(new AcquireSkillList(player));
|
||||
player.sendSkillList();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -32,12 +32,14 @@ import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.data.sql.impl.CharNameTable;
|
||||
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.handler.IAdminCommandHandler;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.L2SkillLearn;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Playable;
|
||||
@@ -50,7 +52,6 @@ import com.l2jmobius.gameserver.model.html.PageResult;
|
||||
import com.l2jmobius.gameserver.model.stats.Stats;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.AcquireSkillList;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExSubjobInfo;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExUserInfoInvenWeight;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExVoteSystemInfo;
|
||||
@@ -411,16 +412,20 @@ public class AdminEditChar implements IAdminCommandHandler
|
||||
}
|
||||
|
||||
final String newclass = ClassListData.getInstance().getClass(player.getClassId()).getClassName();
|
||||
player.storeMe();
|
||||
player.sendMessage("A GM changed your class to " + newclass + ".");
|
||||
player.broadcastUserInfo();
|
||||
if (player.isInCategory(CategoryType.AWAKEN_GROUP))
|
||||
{
|
||||
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));
|
||||
player.sendPacket(new AcquireSkillList(player));
|
||||
player.sendMessage("A GM changed your class to " + newclass + ".");
|
||||
activeChar.sendMessage(player.getName() + " is a " + newclass + ".");
|
||||
}
|
||||
else
|
||||
|
@@ -16,19 +16,11 @@
|
||||
*/
|
||||
package handlers.bypasshandlers;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
|
||||
import com.l2jmobius.gameserver.handler.IBypassHandler;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2NpcInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.base.ClassId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
|
||||
public class SkillList implements IBypassHandler
|
||||
{
|
||||
@@ -44,88 +36,7 @@ public class SkillList implements IBypassHandler
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Config.ALT_GAME_SKILL_LEARN)
|
||||
{
|
||||
try
|
||||
{
|
||||
final String id = command.substring(9).trim();
|
||||
if (id.length() != 0)
|
||||
{
|
||||
L2NpcInstance.showSkillList(activeChar, (L2Npc) target, ClassId.getClassId(Integer.parseInt(id)));
|
||||
}
|
||||
else
|
||||
{
|
||||
boolean own_class = false;
|
||||
|
||||
final List<ClassId> classesToTeach = ((L2NpcInstance) target).getClassesToTeach();
|
||||
for (ClassId cid : classesToTeach)
|
||||
{
|
||||
if (cid.equalsOrChildOf(activeChar.getClassId()))
|
||||
{
|
||||
own_class = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
String text = "<html><body><center>Skill learning:</center><br>";
|
||||
|
||||
if (!own_class)
|
||||
{
|
||||
final String charType = activeChar.getClassId().isMage() ? "fighter" : "mage";
|
||||
text += "Skills of your class are the easiest to learn.<br>Skills of another class of your race are a little harder.<br>Skills for classes of another race are extremely difficult.<br>But the hardest of all to learn are the " + charType + "skills!<br>";
|
||||
}
|
||||
|
||||
// make a list of classes
|
||||
if (!classesToTeach.isEmpty())
|
||||
{
|
||||
int count = 0;
|
||||
ClassId classCheck = activeChar.getClassId();
|
||||
|
||||
while ((count == 0) && (classCheck != null))
|
||||
{
|
||||
for (ClassId cid : classesToTeach)
|
||||
{
|
||||
if (cid.level() > classCheck.level())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (SkillTreesData.getInstance().getAvailableSkills(activeChar, cid, false, false).isEmpty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
text += "<a action=\"bypass -h npc_%objectId%_SkillList " + cid.getId() + "\">Learn " + cid + "'s class Skills</a><br>\n";
|
||||
count++;
|
||||
}
|
||||
classCheck = classCheck.getParent();
|
||||
}
|
||||
classCheck = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
text += "No Skills.<br>";
|
||||
}
|
||||
text += "</body></html>";
|
||||
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(target.getObjectId());
|
||||
html.setHtml(text);
|
||||
html.replace("%objectId%", String.valueOf(target.getObjectId()));
|
||||
activeChar.sendPacket(html);
|
||||
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.WARNING, "Exception in " + getClass().getSimpleName(), e);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
L2NpcInstance.showSkillList(activeChar, (L2Npc) target, activeChar.getClassId());
|
||||
}
|
||||
L2NpcInstance.showSkillList(activeChar, (L2Npc) target, activeChar.getClassId());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -303,7 +303,9 @@ public final class Q10331_StartOfFate extends Quest
|
||||
}
|
||||
player.setBaseClass(newClassId);
|
||||
player.setClassId(newClassId.getId());
|
||||
player.store(false);
|
||||
player.broadcastUserInfo();
|
||||
player.sendSkillList();
|
||||
giveAdena(player, 80000, true);
|
||||
giveItems(player, PROOF_OF_COURAGE, 40);
|
||||
addExpAndSp(player, 200000, 48);
|
||||
|
@@ -212,6 +212,7 @@ public final class Q10360_CertificationOfFate extends Quest
|
||||
player.setBaseClass(newClassId);
|
||||
player.setClassId(newClassId.getId());
|
||||
player.broadcastUserInfo();
|
||||
player.sendSkillList();
|
||||
giveAdena(player, 110000, true);
|
||||
giveItems(player, PROOF_OF_JUSTICE, 40);
|
||||
addExpAndSp(player, 2700000, 648);
|
||||
|
@@ -209,6 +209,7 @@ public final class Q10751_WindsOfFateEncounters extends Quest
|
||||
player.setBaseClass(newClass);
|
||||
player.setClassId(newClass.getId());
|
||||
player.broadcastUserInfo();
|
||||
player.sendSkillList();
|
||||
player.sendPacket(new SocialAction(player.getObjectId(), 23));
|
||||
giveAdena(player, 11000, false);
|
||||
giveItems(player, NAVARI_SUPPORT_BOX_MAGE, 1);
|
||||
@@ -225,6 +226,7 @@ public final class Q10751_WindsOfFateEncounters extends Quest
|
||||
player.setBaseClass(newClass);
|
||||
player.setClassId(newClass.getId());
|
||||
player.broadcastUserInfo();
|
||||
player.sendSkillList();
|
||||
player.sendPacket(new SocialAction(player.getObjectId(), 23));
|
||||
giveAdena(player, 11000, false);
|
||||
giveItems(player, NAVARI_SUPPORT_BOX_FIGHTER, 1);
|
||||
|
@@ -215,6 +215,7 @@ public final class Q10752_WindsOfFateAPromise extends Quest
|
||||
player.setBaseClass(newClass);
|
||||
player.setClassId(newClass.getId());
|
||||
player.broadcastUserInfo();
|
||||
player.sendSkillList();
|
||||
player.sendPacket(new SocialAction(player.getObjectId(), 24));
|
||||
giveAdena(player, 5_000_000, false);
|
||||
giveItems(player, SOUL_SHOT_PACK, 1);
|
||||
@@ -233,6 +234,7 @@ public final class Q10752_WindsOfFateAPromise extends Quest
|
||||
player.setBaseClass(newClass);
|
||||
player.setClassId(newClass.getId());
|
||||
player.broadcastUserInfo();
|
||||
player.sendSkillList();
|
||||
player.sendPacket(new SocialAction(player.getObjectId(), 24));
|
||||
giveAdena(player, 5_000_000, false);
|
||||
giveItems(player, SOUL_SHOT_PACK, 1);
|
||||
|
@@ -321,6 +321,7 @@ public final class Q10753_WindsOfFateChoices extends Quest
|
||||
player.setBaseClass(newClass);
|
||||
player.setClassId(newClass.getId());
|
||||
player.broadcastUserInfo();
|
||||
player.sendSkillList();
|
||||
player.sendPacket(new SocialAction(player.getObjectId(), 24));
|
||||
showOnScreenMsg(player, NpcStringId.CONGRATULATIONS_YOU_WILL_NOW_GRADUATE_FROM_THE_CLAN_ACADEMY_AND_LEAVE_YOUR_CURRENT_CLAN_YOU_CAN_NOW_JOIN_A_CLAN_AS_A_REGULAR_MEMBER_WITHOUT_BEING_SUBJECT_TO_ANY_PENALTIES, ExShowScreenMessage.TOP_CENTER, 10000);
|
||||
giveStoryQuestReward(player, 400);
|
||||
@@ -339,6 +340,7 @@ public final class Q10753_WindsOfFateChoices extends Quest
|
||||
player.setBaseClass(newClass);
|
||||
player.setClassId(newClass.getId());
|
||||
player.broadcastUserInfo();
|
||||
player.sendSkillList();
|
||||
player.sendPacket(new SocialAction(player.getObjectId(), 24));
|
||||
showOnScreenMsg(player, NpcStringId.CONGRATULATIONS_YOU_WILL_NOW_GRADUATE_FROM_THE_CLAN_ACADEMY_AND_LEAVE_YOUR_CURRENT_CLAN_YOU_CAN_NOW_JOIN_A_CLAN_AS_A_REGULAR_MEMBER_WITHOUT_BEING_SUBJECT_TO_ANY_PENALTIES, ExShowScreenMessage.TOP_CENTER, 10000);
|
||||
giveStoryQuestReward(player, 400);
|
||||
|
@@ -238,6 +238,7 @@ public abstract class ThirdClassTransferQuest extends Quest
|
||||
player.setBaseClass(newClassId);
|
||||
player.setClassId(newClassId.getId());
|
||||
player.broadcastUserInfo();
|
||||
player.sendSkillList();
|
||||
giveItems(player, SOUL_SHOT_PACK, 1);
|
||||
giveItems(player, SPIRIT_SHOT_PACK, 1);
|
||||
giveItems(player, STEEL_DOOR_COIN, 87);
|
||||
|
Reference in New Issue
Block a user