Removed Ability skills packets.

This commit is contained in:
MobiusDev 2018-03-06 08:44:06 +00:00
parent f466057eec
commit 37c2bf3d14
20 changed files with 6 additions and 904 deletions

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../data/xsd/AbilityPoints.xsd">
<points from="1" to="4" costs="200000000" />
<points from="5" to="8" costs="400000000" />
<points from="9" to="12" costs="600000000" />
<points from="13" to="16" costs="800000000" />
</list>

View File

@ -24,7 +24,6 @@ import java.util.logging.Logger;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.gameserver.cache.HtmCache; import com.l2jmobius.gameserver.cache.HtmCache;
import com.l2jmobius.gameserver.data.sql.impl.CrestTable; import com.l2jmobius.gameserver.data.sql.impl.CrestTable;
import com.l2jmobius.gameserver.data.xml.impl.AbilityPointsData;
import com.l2jmobius.gameserver.data.xml.impl.AdminData; import com.l2jmobius.gameserver.data.xml.impl.AdminData;
import com.l2jmobius.gameserver.data.xml.impl.AppearanceItemData; import com.l2jmobius.gameserver.data.xml.impl.AppearanceItemData;
import com.l2jmobius.gameserver.data.xml.impl.ArmorSetsData; import com.l2jmobius.gameserver.data.xml.impl.ArmorSetsData;
@ -270,12 +269,6 @@ public class AdminReload implements IAdminCommandHandler
AdminData.getInstance().broadcastMessageToGMs(activeChar.getName() + ": Reloaded Prime Shop data."); AdminData.getInstance().broadcastMessageToGMs(activeChar.getName() + ": Reloaded Prime Shop data.");
break; break;
} }
case "ability":
{
AbilityPointsData.getInstance().load();
AdminData.getInstance().broadcastMessageToGMs(activeChar.getName() + ": Reloaded ability points data.");
break;
}
case "appearance": case "appearance":
{ {
AppearanceItemData.getInstance().load(); AppearanceItemData.getInstance().load();

View File

@ -29,7 +29,6 @@ import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.AcquireSkillList; import com.l2jmobius.gameserver.network.serverpackets.AcquireSkillList;
import com.l2jmobius.gameserver.network.serverpackets.ExSubjobInfo; import com.l2jmobius.gameserver.network.serverpackets.ExSubjobInfo;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
import com.l2jmobius.gameserver.network.serverpackets.ability.ExAcquireAPSkillList;
/** /**
* @author Sdw * @author Sdw
@ -81,7 +80,6 @@ public class ClassChange extends AbstractEffect
player.broadcastUserInfo(); player.broadcastUserInfo();
player.sendPacket(new AcquireSkillList(player)); player.sendPacket(new AcquireSkillList(player));
player.sendPacket(new ExSubjobInfo(player, SubclassInfoType.CLASS_CHANGED)); player.sendPacket(new ExSubjobInfo(player, SubclassInfoType.CLASS_CHANGED));
player.sendPacket(new ExAcquireAPSkillList(player));
}, 1000); }, 1000);
} }
} }

View File

@ -24,7 +24,6 @@ import java.util.logging.Logger;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.gameserver.cache.HtmCache; import com.l2jmobius.gameserver.cache.HtmCache;
import com.l2jmobius.gameserver.data.sql.impl.CrestTable; import com.l2jmobius.gameserver.data.sql.impl.CrestTable;
import com.l2jmobius.gameserver.data.xml.impl.AbilityPointsData;
import com.l2jmobius.gameserver.data.xml.impl.AdminData; import com.l2jmobius.gameserver.data.xml.impl.AdminData;
import com.l2jmobius.gameserver.data.xml.impl.AppearanceItemData; import com.l2jmobius.gameserver.data.xml.impl.AppearanceItemData;
import com.l2jmobius.gameserver.data.xml.impl.ArmorSetsData; import com.l2jmobius.gameserver.data.xml.impl.ArmorSetsData;
@ -220,11 +219,6 @@ public class Reload implements ITelnetCommand
ItemCrystallizationData.getInstance().load(); ItemCrystallizationData.getInstance().load();
return AdminData.getInstance().broadcastMessageToGMs("Telnet Admin: Reloaded item crystalization data."); return AdminData.getInstance().broadcastMessageToGMs("Telnet Admin: Reloaded item crystalization data.");
} }
case "ability":
{
AbilityPointsData.getInstance().load();
return AdminData.getInstance().broadcastMessageToGMs("Telnet Admin: Reloaded ability points data.");
}
case "appearance": case "appearance":
{ {
AppearanceItemData.getInstance().load(); AppearanceItemData.getInstance().load();

View File

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="list">
<xs:complexType>
<xs:sequence>
<xs:element name="points" maxOccurs="unbounded" minOccurs="1">
<xs:complexType>
<xs:attribute type="xs:positiveInteger" name="from" use="required" />
<xs:attribute type="xs:positiveInteger" name="to" use="required" />
<xs:attribute type="xs:long" name="costs" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

View File

@ -38,7 +38,6 @@ import com.l2jmobius.gameserver.data.sql.impl.CharSummonTable;
import com.l2jmobius.gameserver.data.sql.impl.ClanTable; import com.l2jmobius.gameserver.data.sql.impl.ClanTable;
import com.l2jmobius.gameserver.data.sql.impl.CrestTable; import com.l2jmobius.gameserver.data.sql.impl.CrestTable;
import com.l2jmobius.gameserver.data.sql.impl.OfflineTradersTable; import com.l2jmobius.gameserver.data.sql.impl.OfflineTradersTable;
import com.l2jmobius.gameserver.data.xml.impl.AbilityPointsData;
import com.l2jmobius.gameserver.data.xml.impl.ActionData; import com.l2jmobius.gameserver.data.xml.impl.ActionData;
import com.l2jmobius.gameserver.data.xml.impl.AdminData; import com.l2jmobius.gameserver.data.xml.impl.AdminData;
import com.l2jmobius.gameserver.data.xml.impl.AlchemyData; import com.l2jmobius.gameserver.data.xml.impl.AlchemyData;
@ -205,7 +204,6 @@ public class GameServer
ActionData.getInstance(); ActionData.getInstance();
CategoryData.getInstance(); CategoryData.getInstance();
SecondaryAuthData.getInstance(); SecondaryAuthData.getInstance();
AbilityPointsData.getInstance();
CombinationItemsData.getInstance(); CombinationItemsData.getInstance();
SayuneData.getInstance(); SayuneData.getInstance();
ClanRewardData.getInstance(); ClanRewardData.getInstance();

View File

@ -1,113 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.data.xml.impl;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.model.holders.RangeAbilityPointsHolder;
/**
* @author UnAfraid
*/
public final class AbilityPointsData implements IGameXmlReader
{
private static final Logger LOGGER = Logger.getLogger(AbilityPointsData.class.getName());
private final List<RangeAbilityPointsHolder> _points = new ArrayList<>();
protected AbilityPointsData()
{
load();
}
@Override
public synchronized void load()
{
_points.clear();
parseDatapackFile("config/AbilityPoints.xml");
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _points.size() + " range fees.");
}
@Override
public void parseDocument(Document doc, File f)
{
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
{
if ("list".equalsIgnoreCase(n.getNodeName()))
{
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
{
if ("points".equalsIgnoreCase(d.getNodeName()))
{
final NamedNodeMap attrs = d.getAttributes();
final int from = parseInteger(attrs, "from");
final int to = parseInteger(attrs, "to");
final int costs = parseInteger(attrs, "costs");
_points.add(new RangeAbilityPointsHolder(from, to, costs));
}
}
}
}
}
public RangeAbilityPointsHolder getHolder(int points)
{
for (RangeAbilityPointsHolder holder : _points)
{
if ((holder.getMin() <= points) && (holder.getMax() >= points))
{
return holder;
}
}
return null;
}
public long getPrice(int points)
{
points++; // for next point
final RangeAbilityPointsHolder holder = getHolder(points);
if (holder == null)
{
final RangeAbilityPointsHolder prevHolder = getHolder(points - 1);
if (prevHolder != null)
{
return prevHolder.getSP();
}
// No data found
return points >= 13 ? 1_000_000_000 : points >= 9 ? 750_000_000 : points >= 5 ? 500_000_000 : 250_000_000;
}
return holder.getSP();
}
public static AbilityPointsData getInstance()
{
return SingletonHolder._instance;
}
private static class SingletonHolder
{
protected static final AbilityPointsData _instance = new AbilityPointsData();
}
}

View File

@ -330,7 +330,6 @@ import com.l2jmobius.gameserver.network.serverpackets.TradeOtherDone;
import com.l2jmobius.gameserver.network.serverpackets.TradeStart; import com.l2jmobius.gameserver.network.serverpackets.TradeStart;
import com.l2jmobius.gameserver.network.serverpackets.UserInfo; import com.l2jmobius.gameserver.network.serverpackets.UserInfo;
import com.l2jmobius.gameserver.network.serverpackets.ValidateLocation; import com.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
import com.l2jmobius.gameserver.network.serverpackets.ability.ExAcquireAPSkillList;
import com.l2jmobius.gameserver.network.serverpackets.commission.ExResponseCommissionInfo; import com.l2jmobius.gameserver.network.serverpackets.commission.ExResponseCommissionInfo;
import com.l2jmobius.gameserver.network.serverpackets.friend.L2FriendStatus; import com.l2jmobius.gameserver.network.serverpackets.friend.L2FriendStatus;
import com.l2jmobius.gameserver.taskmanager.AttackStanceTaskManager; import com.l2jmobius.gameserver.taskmanager.AttackStanceTaskManager;
@ -9374,10 +9373,6 @@ public final class L2PcInstance extends L2Playable
} }
_noble = val; _noble = val;
sendSkillList(); sendSkillList();
if (val && (getLevel() >= 99))
{
sendPacket(new ExAcquireAPSkillList(this));
}
} }
public void setLvlJoinedAcademy(int lvl) public void setLvlJoinedAcademy(int lvl)

View File

@ -44,7 +44,6 @@ import com.l2jmobius.gameserver.network.serverpackets.PledgeShowMemberListUpdate
import com.l2jmobius.gameserver.network.serverpackets.SocialAction; import com.l2jmobius.gameserver.network.serverpackets.SocialAction;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
import com.l2jmobius.gameserver.network.serverpackets.UserInfo; import com.l2jmobius.gameserver.network.serverpackets.UserInfo;
import com.l2jmobius.gameserver.network.serverpackets.ability.ExAcquireAPSkillList;
import com.l2jmobius.gameserver.network.serverpackets.dailymission.ExOneDayReceiveRewardList; import com.l2jmobius.gameserver.network.serverpackets.dailymission.ExOneDayReceiveRewardList;
import com.l2jmobius.gameserver.network.serverpackets.friend.L2FriendStatus; import com.l2jmobius.gameserver.network.serverpackets.friend.L2FriendStatus;
import com.l2jmobius.gameserver.util.Util; import com.l2jmobius.gameserver.util.Util;
@ -289,10 +288,6 @@ public class PcStat extends PlayableStat
// Send acquirable skill list // Send acquirable skill list
getActiveChar().sendPacket(new AcquireSkillList(getActiveChar())); getActiveChar().sendPacket(new AcquireSkillList(getActiveChar()));
getActiveChar().sendPacket(new ExVoteSystemInfo(getActiveChar())); getActiveChar().sendPacket(new ExVoteSystemInfo(getActiveChar()));
if ((getLevel() >= 99) && getActiveChar().isNoble())
{
getActiveChar().sendPacket(new ExAcquireAPSkillList(getActiveChar()));
}
getActiveChar().sendPacket(new ExOneDayReceiveRewardList(getActiveChar())); getActiveChar().sendPacket(new ExOneDayReceiveRewardList(getActiveChar()));
return levelIncreased; return levelIncreased;
} }

View File

@ -25,12 +25,6 @@ import com.l2jmobius.commons.network.IConnectionState;
import com.l2jmobius.commons.network.IIncomingPacket; import com.l2jmobius.commons.network.IIncomingPacket;
import com.l2jmobius.commons.network.IIncomingPackets; import com.l2jmobius.commons.network.IIncomingPackets;
import com.l2jmobius.gameserver.network.clientpackets.*; import com.l2jmobius.gameserver.network.clientpackets.*;
import com.l2jmobius.gameserver.network.clientpackets.ability.RequestAbilityList;
import com.l2jmobius.gameserver.network.clientpackets.ability.RequestAbilityWndClose;
import com.l2jmobius.gameserver.network.clientpackets.ability.RequestAbilityWndOpen;
import com.l2jmobius.gameserver.network.clientpackets.ability.RequestAcquireAbilityList;
import com.l2jmobius.gameserver.network.clientpackets.ability.RequestChangeAbilityPoint;
import com.l2jmobius.gameserver.network.clientpackets.ability.RequestResetAbilityPoint;
import com.l2jmobius.gameserver.network.clientpackets.adenadistribution.RequestDivideAdena; import com.l2jmobius.gameserver.network.clientpackets.adenadistribution.RequestDivideAdena;
import com.l2jmobius.gameserver.network.clientpackets.adenadistribution.RequestDivideAdenaCancel; import com.l2jmobius.gameserver.network.clientpackets.adenadistribution.RequestDivideAdenaCancel;
import com.l2jmobius.gameserver.network.clientpackets.adenadistribution.RequestDivideAdenaStart; import com.l2jmobius.gameserver.network.clientpackets.adenadistribution.RequestDivideAdenaStart;
@ -327,13 +321,13 @@ public enum ExIncomingPackets implements IIncomingPackets<L2GameClient>
REQUEST_DIVIDE_ADENA_START(0xE6, RequestDivideAdenaStart::new, ConnectionState.IN_GAME), REQUEST_DIVIDE_ADENA_START(0xE6, RequestDivideAdenaStart::new, ConnectionState.IN_GAME),
REQUEST_DIVIDE_ADENA_CANCEL(0xE7, RequestDivideAdenaCancel::new, ConnectionState.IN_GAME), REQUEST_DIVIDE_ADENA_CANCEL(0xE7, RequestDivideAdenaCancel::new, ConnectionState.IN_GAME),
REQUEST_DIVIDE_ADENA(0xE8, RequestDivideAdena::new, ConnectionState.IN_GAME), REQUEST_DIVIDE_ADENA(0xE8, RequestDivideAdena::new, ConnectionState.IN_GAME),
REQUEST_ACQUIRE_ABILITY_LIST(0xE9, RequestAcquireAbilityList::new, ConnectionState.IN_GAME), REQUEST_ACQUIRE_ABILITY_LIST(0xE9, null, ConnectionState.IN_GAME),
REQUEST_ABILITY_LIST(0xEA, RequestAbilityList::new, ConnectionState.IN_GAME), REQUEST_ABILITY_LIST(0xEA, null, ConnectionState.IN_GAME),
REQUEST_RESET_ABILITY_POINT(0xEB, RequestResetAbilityPoint::new, ConnectionState.IN_GAME), REQUEST_RESET_ABILITY_POINT(0xEB, null, ConnectionState.IN_GAME),
REQUEST_CHANGE_ABILITY_POINT(0xEC, RequestChangeAbilityPoint::new, ConnectionState.IN_GAME), REQUEST_CHANGE_ABILITY_POINT(0xEC, null, ConnectionState.IN_GAME),
REQUEST_STOP_MOVE(0xED, RequestStopMove::new, ConnectionState.IN_GAME), REQUEST_STOP_MOVE(0xED, RequestStopMove::new, ConnectionState.IN_GAME),
REQUEST_ABILITY_WND_OPEN(0xEE, RequestAbilityWndOpen::new, ConnectionState.IN_GAME), REQUEST_ABILITY_WND_OPEN(0xEE, null, ConnectionState.IN_GAME),
REQUEST_ABILITY_WND_CLOSE(0xEF, RequestAbilityWndClose::new, ConnectionState.IN_GAME), REQUEST_ABILITY_WND_CLOSE(0xEF, null, ConnectionState.IN_GAME),
EX_PC_CAFE_REQUEST_OPEN_WINDOW_WITHOUT_NPC(0xF0, ExPCCafeRequestOpenWindowWithoutNPC::new, ConnectionState.IN_GAME), EX_PC_CAFE_REQUEST_OPEN_WINDOW_WITHOUT_NPC(0xF0, ExPCCafeRequestOpenWindowWithoutNPC::new, ConnectionState.IN_GAME),
REQUEST_LUCKY_GAME_START_INFO(0xF1, RequestLuckyGameStartInfo::new, ConnectionState.IN_GAME), REQUEST_LUCKY_GAME_START_INFO(0xF1, RequestLuckyGameStartInfo::new, ConnectionState.IN_GAME),
REQUEST_LUCKY_GAME_PLAY(0xF2, RequestLuckyGamePlay::new, ConnectionState.IN_GAME), REQUEST_LUCKY_GAME_PLAY(0xF2, RequestLuckyGamePlay::new, ConnectionState.IN_GAME),

View File

@ -98,7 +98,6 @@ import com.l2jmobius.gameserver.network.serverpackets.ShortCutInit;
import com.l2jmobius.gameserver.network.serverpackets.SkillCoolTime; import com.l2jmobius.gameserver.network.serverpackets.SkillCoolTime;
import com.l2jmobius.gameserver.network.serverpackets.SkillList; import com.l2jmobius.gameserver.network.serverpackets.SkillList;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
import com.l2jmobius.gameserver.network.serverpackets.ability.ExAcquireAPSkillList;
import com.l2jmobius.gameserver.network.serverpackets.attendance.ExVipAttendanceItemList; import com.l2jmobius.gameserver.network.serverpackets.attendance.ExVipAttendanceItemList;
import com.l2jmobius.gameserver.network.serverpackets.dailymission.ExOneDayReceiveRewardList; import com.l2jmobius.gameserver.network.serverpackets.dailymission.ExOneDayReceiveRewardList;
import com.l2jmobius.gameserver.network.serverpackets.friend.L2FriendList; import com.l2jmobius.gameserver.network.serverpackets.friend.L2FriendList;
@ -635,7 +634,6 @@ public class EnterWorld implements IClientIncomingPacket
activeChar.sendPacket(new ExBeautyItemList(activeChar)); activeChar.sendPacket(new ExBeautyItemList(activeChar));
} }
activeChar.sendPacket(new ExAcquireAPSkillList(activeChar));
if (Config.ENABLE_WORLD_CHAT) if (Config.ENABLE_WORLD_CHAT)
{ {
activeChar.sendPacket(new ExWorldChatCnt(activeChar)); activeChar.sendPacket(new ExWorldChatCnt(activeChar));

View File

@ -1,59 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.network.clientpackets.ability;
import com.l2jmobius.commons.network.PacketReader;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.L2GameClient;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import com.l2jmobius.gameserver.network.serverpackets.ability.ExAcquireAPSkillList;
/**
* @author UnAfraid
*/
public class RequestAbilityList implements IClientIncomingPacket
{
@Override
public boolean read(L2GameClient client, PacketReader packet)
{
return true;
}
@Override
public void run(L2GameClient client)
{
final L2PcInstance activeChar = client.getActiveChar();
if (activeChar == null)
{
return;
}
if (activeChar.isSubClassActive() && !activeChar.isDualClassActive())
{
return;
}
if ((activeChar.getLevel() < 99) || !activeChar.isNoble())
{
activeChar.sendPacket(SystemMessageId.ABILITIES_CAN_BE_USED_BY_NOBLESSE_EXALTED_LV_99_OR_ABOVE);
return;
}
activeChar.sendPacket(new ExAcquireAPSkillList(activeChar));
}
}

View File

@ -1,56 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.network.clientpackets.ability;
import com.l2jmobius.commons.network.PacketReader;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.L2GameClient;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import com.l2jmobius.gameserver.network.serverpackets.ability.ExAcquireAPSkillList;
import com.l2jmobius.gameserver.network.serverpackets.ability.ExCloseAPListWnd;
/**
* @author UnAfraid
*/
public class RequestAbilityWndClose implements IClientIncomingPacket
{
@Override
public boolean read(L2GameClient client, PacketReader packet)
{
return true;
}
@Override
public void run(L2GameClient client)
{
final L2PcInstance activeChar = client.getActiveChar();
if (activeChar == null)
{
return;
}
if ((activeChar.getLevel() < 99) || !activeChar.isNoble())
{
activeChar.sendPacket(SystemMessageId.ABILITIES_CAN_BE_USED_BY_NOBLESSE_EXALTED_LV_99_OR_ABOVE);
return;
}
activeChar.sendPacket(ExCloseAPListWnd.STATIC_PACKET);
activeChar.sendPacket(new ExAcquireAPSkillList(activeChar));
}
}

View File

@ -1,56 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.network.clientpackets.ability;
import com.l2jmobius.commons.network.PacketReader;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.L2GameClient;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import com.l2jmobius.gameserver.network.serverpackets.ability.ExAcquireAPSkillList;
import com.l2jmobius.gameserver.network.serverpackets.ability.ExShowAPListWnd;
/**
* @author Sdw
*/
public class RequestAbilityWndOpen implements IClientIncomingPacket
{
@Override
public boolean read(L2GameClient client, PacketReader packet)
{
return true;
}
@Override
public void run(L2GameClient client)
{
final L2PcInstance activeChar = client.getActiveChar();
if (activeChar == null)
{
return;
}
if ((activeChar.getLevel() < 99) || !activeChar.isNoble())
{
activeChar.sendPacket(SystemMessageId.ABILITIES_CAN_BE_USED_BY_NOBLESSE_EXALTED_LV_99_OR_ABOVE);
return;
}
activeChar.sendPacket(ExShowAPListWnd.STATIC_PACKET);
activeChar.sendPacket(new ExAcquireAPSkillList(activeChar));
}
}

View File

@ -1,190 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.network.clientpackets.ability;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import com.l2jmobius.commons.network.PacketReader;
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
import com.l2jmobius.gameserver.model.L2SkillLearn;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.ceremonyofchaos.CeremonyOfChaosEvent;
import com.l2jmobius.gameserver.model.holders.SkillHolder;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.network.L2GameClient;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import com.l2jmobius.gameserver.network.serverpackets.ActionFailed;
import com.l2jmobius.gameserver.network.serverpackets.ability.ExAcquireAPSkillList;
/**
* @author UnAfraid
*/
public class RequestAcquireAbilityList implements IClientIncomingPacket
{
private static final int TREE_SIZE = 3;
private final Map<Integer, SkillHolder> _skills = new LinkedHashMap<>();
@Override
public boolean read(L2GameClient client, PacketReader packet)
{
packet.readD(); // Total size
for (int i = 0; i < TREE_SIZE; i++)
{
final int size = packet.readD();
for (int j = 0; j < size; j++)
{
final SkillHolder holder = new SkillHolder(packet.readD(), packet.readD());
if (holder.getSkillLevel() < 1)
{
_log.warning("Player " + client + " is trying to learn skill " + holder + " by sending packet with level 0!");
return false;
}
if (_skills.putIfAbsent(holder.getSkillId(), holder) != null)
{
_log.warning("Player " + client + " is trying to send two times one skill " + holder + " to learn!");
return false;
}
}
}
return true;
}
@Override
public void run(L2GameClient client)
{
final L2PcInstance activeChar = client.getActiveChar();
if (activeChar == null)
{
return;
}
if (activeChar.isSubClassActive() && !activeChar.isDualClassActive())
{
return;
}
if ((activeChar.getAbilityPoints() == 0) || (activeChar.getAbilityPoints() == activeChar.getAbilityPointsUsed()))
{
_log.warning("Player " + activeChar + " is trying to learn ability without ability points!");
return;
}
if ((activeChar.getLevel() < 99) || !activeChar.isNoble())
{
activeChar.sendPacket(SystemMessageId.ABILITIES_CAN_BE_USED_BY_NOBLESSE_EXALTED_LV_99_OR_ABOVE);
return;
}
else if (activeChar.isInOlympiadMode() || activeChar.isOnEvent(CeremonyOfChaosEvent.class))
{
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_USE_OR_RESET_ABILITY_POINTS_WHILE_PARTICIPATING_IN_THE_OLYMPIAD_OR_CEREMONY_OF_CHAOS);
return;
}
else if (activeChar.isOnEvent()) // custom event message
{
activeChar.sendMessage("You cannot use or reset Ability Points while participating in an event.");
return;
}
final int[] pointsSpent = new int[TREE_SIZE];
Arrays.fill(pointsSpent, 0);
final List<L2SkillLearn> skillsToLearn = new ArrayList<>(_skills.size());
for (SkillHolder holder : _skills.values())
{
final L2SkillLearn learn = SkillTreesData.getInstance().getAbilitySkill(holder.getSkillId(), holder.getSkillLevel());
if (learn == null)
{
_log.warning("SkillLearn " + holder.getSkillId() + " (" + holder.getSkillLevel() + ") not found!");
client.sendPacket(ActionFailed.STATIC_PACKET);
break;
}
final Skill skill = holder.getSkill();
if (skill == null)
{
_log.warning("Skill " + holder.getSkillId() + " (" + holder.getSkillLevel() + ") not found!");
client.sendPacket(ActionFailed.STATIC_PACKET);
break;
}
if (activeChar.getSkillLevel(skill.getId()) > 0)
{
pointsSpent[learn.getTreeId() - 1] += skill.getLevel();
}
skillsToLearn.add(learn);
}
// Sort the skills by their tree id -> row -> column
skillsToLearn.sort(Comparator.comparingInt(L2SkillLearn::getTreeId).thenComparing(L2SkillLearn::getRow).thenComparing(L2SkillLearn::getColumn));
for (L2SkillLearn learn : skillsToLearn)
{
final Skill skill = SkillData.getInstance().getSkill(learn.getSkillId(), learn.getSkillLevel());
final int points;
final int knownLevel = activeChar.getSkillLevel(skill.getId());
if (knownLevel == -1) // player didn't knew it at all!
{
points = learn.getSkillLevel();
}
else
{
points = learn.getSkillLevel() - knownLevel;
}
// Case 1: Learning skill without having X points spent on the specific tree
if (learn.getPointsRequired() > pointsSpent[learn.getTreeId() - 1])
{
_log.warning("Player " + activeChar + " is trying to learn " + skill + " without enough ability points spent!");
client.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
// Case 2: Learning skill without having its parent
for (SkillHolder required : learn.getPreReqSkills())
{
if (activeChar.getSkillLevel(required.getSkillId()) < required.getSkillLevel())
{
_log.warning("Player " + activeChar + " is trying to learn " + skill + " without having prerequsite skill: " + required.getSkill() + "!");
client.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
}
// Case 3 Learning a skill without having enough points
if ((activeChar.getAbilityPoints() - activeChar.getAbilityPointsUsed()) < points)
{
_log.warning("Player " + activeChar + " is trying to learn ability without ability points!");
client.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
pointsSpent[learn.getTreeId() - 1] += points;
activeChar.addSkill(skill, true);
activeChar.setAbilityPointsUsed(activeChar.getAbilityPointsUsed() + points);
}
activeChar.sendPacket(new ExAcquireAPSkillList(activeChar));
}
}

View File

@ -1,98 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.network.clientpackets.ability;
import com.l2jmobius.Config;
import com.l2jmobius.commons.network.PacketReader;
import com.l2jmobius.gameserver.data.xml.impl.AbilityPointsData;
import com.l2jmobius.gameserver.enums.UserInfoType;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.ceremonyofchaos.CeremonyOfChaosEvent;
import com.l2jmobius.gameserver.network.L2GameClient;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
import com.l2jmobius.gameserver.network.serverpackets.UserInfo;
import com.l2jmobius.gameserver.network.serverpackets.ability.ExAcquireAPSkillList;
/**
* @author UnAfraid
*/
public class RequestChangeAbilityPoint implements IClientIncomingPacket
{
@Override
public boolean read(L2GameClient client, PacketReader packet)
{
return true;
}
@Override
public void run(L2GameClient client)
{
final L2PcInstance activeChar = client.getActiveChar();
if (activeChar == null)
{
return;
}
if (activeChar.isSubClassActive() && !activeChar.isDualClassActive())
{
return;
}
if ((activeChar.getLevel() < 99) || !activeChar.isNoble())
{
activeChar.sendPacket(SystemMessageId.ABILITIES_CAN_BE_USED_BY_NOBLESSE_EXALTED_LV_99_OR_ABOVE);
return;
}
if (activeChar.getAbilityPoints() >= Config.ABILITY_MAX_POINTS)
{
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_ACQUIRE_ANY_MORE_ABILITY_POINTS);
return;
}
if (activeChar.isInOlympiadMode() || activeChar.isOnEvent(CeremonyOfChaosEvent.class))
{
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_USE_OR_RESET_ABILITY_POINTS_WHILE_PARTICIPATING_IN_THE_OLYMPIAD_OR_CEREMONY_OF_CHAOS);
return;
}
else if (activeChar.isOnEvent()) // custom event message
{
activeChar.sendMessage("You cannot use or reset Ability Points while participating in an event.");
return;
}
final long spRequired = AbilityPointsData.getInstance().getPrice(activeChar.getAbilityPoints());
if (spRequired > activeChar.getSp())
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_NEED_S1_SP_TO_CONVERT_TO1_ABILITY_POINT);
sm.addLong(spRequired);
activeChar.sendPacket(sm);
return;
}
if (activeChar.getStat().removeSp(spRequired))
{
activeChar.setAbilityPoints(activeChar.getAbilityPoints() + 1);
final UserInfo info = new UserInfo(activeChar, false);
info.addComponentType(UserInfoType.SLOTS, UserInfoType.CURRENT_HPMPCP_EXP_SP);
activeChar.sendPacket(info);
activeChar.sendPacket(new ExAcquireAPSkillList(activeChar));
}
}
}

View File

@ -1,106 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.network.clientpackets.ability;
import com.l2jmobius.Config;
import com.l2jmobius.commons.network.PacketReader;
import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
import com.l2jmobius.gameserver.enums.PrivateStoreType;
import com.l2jmobius.gameserver.model.L2SkillLearn;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.ceremonyofchaos.CeremonyOfChaosEvent;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.network.L2GameClient;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import com.l2jmobius.gameserver.network.serverpackets.ability.ExAcquireAPSkillList;
/**
* @author UnAfraid
*/
public class RequestResetAbilityPoint implements IClientIncomingPacket
{
@Override
public boolean read(L2GameClient client, PacketReader packet)
{
return true;
}
@Override
public void run(L2GameClient client)
{
final L2PcInstance activeChar = client.getActiveChar();
if (activeChar == null)
{
return;
}
if (activeChar.isSubClassActive() && !activeChar.isDualClassActive())
{
return;
}
if ((activeChar.getPrivateStoreType() != PrivateStoreType.NONE) || (activeChar.getActiveRequester() != null))
{
return;
}
else if ((activeChar.getLevel() < 99) || !activeChar.isNoble())
{
client.sendPacket(SystemMessageId.ABILITIES_CAN_BE_USED_BY_NOBLESSE_EXALTED_LV_99_OR_ABOVE);
return;
}
else if (activeChar.isInOlympiadMode() || activeChar.isOnEvent(CeremonyOfChaosEvent.class))
{
client.sendPacket(SystemMessageId.YOU_CANNOT_USE_OR_RESET_ABILITY_POINTS_WHILE_PARTICIPATING_IN_THE_OLYMPIAD_OR_CEREMONY_OF_CHAOS);
return;
}
else if (activeChar.isOnEvent()) // custom event message
{
activeChar.sendMessage("You cannot use or reset Ability Points while participating in an event.");
return;
}
else if (activeChar.getAbilityPoints() == 0)
{
activeChar.sendMessage("You don't have ability points to reset!");
return;
}
else if (activeChar.getAbilityPointsUsed() == 0)
{
activeChar.sendMessage("You haven't used your ability points yet!");
return;
}
else if (activeChar.getAdena() < Config.ABILITY_POINTS_RESET_ADENA)
{
client.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_ADENA);
return;
}
if (activeChar.reduceAdena("AbilityPointsReset", Config.ABILITY_POINTS_RESET_ADENA, activeChar, true))
{
for (L2SkillLearn sk : SkillTreesData.getInstance().getAbilitySkillTree().values())
{
final Skill skill = activeChar.getKnownSkill(sk.getSkillId());
if (skill != null)
{
activeChar.removeSkill(skill);
}
}
activeChar.setAbilityPointsUsed(0);
client.sendPacket(new ExAcquireAPSkillList(activeChar));
}
}
}

View File

@ -1,80 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.network.serverpackets.ability;
import java.util.ArrayList;
import java.util.List;
import com.l2jmobius.Config;
import com.l2jmobius.commons.network.PacketWriter;
import com.l2jmobius.gameserver.data.xml.impl.AbilityPointsData;
import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
import com.l2jmobius.gameserver.model.L2SkillLearn;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.network.OutgoingPackets;
import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author Sdw
*/
public class ExAcquireAPSkillList implements IClientOutgoingPacket
{
private final int _abilityPoints, _usedAbilityPoints;
private final long _price;
private final boolean _enable;
private final List<Skill> _skills = new ArrayList<>();
public ExAcquireAPSkillList(L2PcInstance activeChar)
{
_abilityPoints = activeChar.getAbilityPoints();
_usedAbilityPoints = activeChar.getAbilityPointsUsed();
_price = AbilityPointsData.getInstance().getPrice(_abilityPoints);
for (L2SkillLearn sk : SkillTreesData.getInstance().getAbilitySkillTree().values())
{
final Skill knownSkill = activeChar.getKnownSkill(sk.getSkillId());
if (knownSkill != null)
{
if (knownSkill.getLevel() == sk.getSkillLevel())
{
_skills.add(knownSkill);
}
}
}
_enable = (!activeChar.isSubClassActive() || activeChar.isDualClassActive()) && (activeChar.getLevel() >= 99) && activeChar.isNoble();
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_ACQUIRE_AP_SKILL_LIST.writeId(packet);
packet.writeD(_enable ? 1 : 0);
packet.writeQ(Config.ABILITY_POINTS_RESET_ADENA);
packet.writeQ(_price);
packet.writeD(Config.ABILITY_MAX_POINTS);
packet.writeD(_abilityPoints);
packet.writeD(_usedAbilityPoints);
packet.writeD(_skills.size());
for (Skill skill : _skills)
{
packet.writeD(skill.getId());
packet.writeD(skill.getLevel());
}
return true;
}
}

View File

@ -1,41 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.network.serverpackets.ability;
import com.l2jmobius.commons.network.PacketWriter;
import com.l2jmobius.gameserver.network.OutgoingPackets;
import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author UnAfraid
*/
public class ExCloseAPListWnd implements IClientOutgoingPacket
{
public static ExCloseAPListWnd STATIC_PACKET = new ExCloseAPListWnd();
private ExCloseAPListWnd()
{
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_CLOSE_AP_LIST_WND.writeId(packet);
return true;
}
}

View File

@ -1,41 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.network.serverpackets.ability;
import com.l2jmobius.commons.network.PacketWriter;
import com.l2jmobius.gameserver.network.OutgoingPackets;
import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author Sdw
*/
public class ExShowAPListWnd implements IClientOutgoingPacket
{
public static final ExShowAPListWnd STATIC_PACKET = new ExShowAPListWnd();
private ExShowAPListWnd()
{
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_SHOW_AP_LIST_WND.writeId(packet);
return true;
}
}