Fixed skill learn after class change.
Thanks Sdw for the pointers.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user