Merged with released L2J-Unity files.
This commit is contained in:
@@ -1,248 +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;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
|
||||
public class ClientStats
|
||||
{
|
||||
public int processedPackets = 0;
|
||||
public int droppedPackets = 0;
|
||||
public int unknownPackets = 0;
|
||||
public int totalQueueSize = 0;
|
||||
public int maxQueueSize = 0;
|
||||
public int totalBursts = 0;
|
||||
public int maxBurstSize = 0;
|
||||
public int shortFloods = 0;
|
||||
public int longFloods = 0;
|
||||
public int totalQueueOverflows = 0;
|
||||
public int totalUnderflowExceptions = 0;
|
||||
|
||||
private final int[] _packetsInSecond;
|
||||
private long _packetCountStartTick = 0;
|
||||
private int _head;
|
||||
private int _totalCount = 0;
|
||||
|
||||
private int _floodsInMin = 0;
|
||||
private long _floodStartTick = 0;
|
||||
private int _unknownPacketsInMin = 0;
|
||||
private long _unknownPacketStartTick = 0;
|
||||
private int _overflowsInMin = 0;
|
||||
private long _overflowStartTick = 0;
|
||||
private int _underflowReadsInMin = 0;
|
||||
private long _underflowReadStartTick = 0;
|
||||
|
||||
private volatile boolean _floodDetected = false;
|
||||
private volatile boolean _queueOverflowDetected = false;
|
||||
|
||||
private final int BUFFER_SIZE;
|
||||
|
||||
public ClientStats()
|
||||
{
|
||||
BUFFER_SIZE = Config.CLIENT_PACKET_QUEUE_MEASURE_INTERVAL;
|
||||
_packetsInSecond = new int[BUFFER_SIZE];
|
||||
_head = BUFFER_SIZE - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if incoming packet need to be dropped
|
||||
*/
|
||||
protected final boolean dropPacket()
|
||||
{
|
||||
final boolean result = _floodDetected || _queueOverflowDetected;
|
||||
if (result)
|
||||
{
|
||||
droppedPackets++;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Later during flood returns true (and send ActionFailed) once per second.
|
||||
* @param queueSize
|
||||
* @return true if flood detected first and ActionFailed packet need to be sent.
|
||||
*/
|
||||
protected final boolean countPacket(int queueSize)
|
||||
{
|
||||
processedPackets++;
|
||||
totalQueueSize += queueSize;
|
||||
if (maxQueueSize < queueSize)
|
||||
{
|
||||
maxQueueSize = queueSize;
|
||||
}
|
||||
if (_queueOverflowDetected && (queueSize < 2))
|
||||
{
|
||||
_queueOverflowDetected = false;
|
||||
}
|
||||
|
||||
return countPacket();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Counts unknown packets and return true if threshold is reached.
|
||||
*/
|
||||
protected final boolean countUnknownPacket()
|
||||
{
|
||||
unknownPackets++;
|
||||
|
||||
final long tick = System.currentTimeMillis();
|
||||
if ((tick - _unknownPacketStartTick) > 60000)
|
||||
{
|
||||
_unknownPacketStartTick = tick;
|
||||
_unknownPacketsInMin = 1;
|
||||
return false;
|
||||
}
|
||||
|
||||
_unknownPacketsInMin++;
|
||||
return _unknownPacketsInMin > Config.CLIENT_PACKET_QUEUE_MAX_UNKNOWN_PER_MIN;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param count - current number of processed packets in burst
|
||||
* @return burst length and return true if execution of the queue need to be aborted.
|
||||
*/
|
||||
protected final boolean countBurst(int count)
|
||||
{
|
||||
if (count > maxBurstSize)
|
||||
{
|
||||
maxBurstSize = count;
|
||||
}
|
||||
|
||||
if (count < Config.CLIENT_PACKET_QUEUE_MAX_BURST_SIZE)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
totalBursts++;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Counts queue overflows and return true if threshold is reached.
|
||||
*/
|
||||
protected final boolean countQueueOverflow()
|
||||
{
|
||||
_queueOverflowDetected = true;
|
||||
totalQueueOverflows++;
|
||||
|
||||
final long tick = System.currentTimeMillis();
|
||||
if ((tick - _overflowStartTick) > 60000)
|
||||
{
|
||||
_overflowStartTick = tick;
|
||||
_overflowsInMin = 1;
|
||||
return false;
|
||||
}
|
||||
|
||||
_overflowsInMin++;
|
||||
return _overflowsInMin > Config.CLIENT_PACKET_QUEUE_MAX_OVERFLOWS_PER_MIN;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Counts underflow exceptions and return true if threshold is reached.
|
||||
*/
|
||||
protected final boolean countUnderflowException()
|
||||
{
|
||||
totalUnderflowExceptions++;
|
||||
|
||||
final long tick = System.currentTimeMillis();
|
||||
if ((tick - _underflowReadStartTick) > 60000)
|
||||
{
|
||||
_underflowReadStartTick = tick;
|
||||
_underflowReadsInMin = 1;
|
||||
return false;
|
||||
}
|
||||
|
||||
_underflowReadsInMin++;
|
||||
return _underflowReadsInMin > Config.CLIENT_PACKET_QUEUE_MAX_UNDERFLOWS_PER_MIN;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if maximum number of floods per minute is reached.
|
||||
*/
|
||||
protected final boolean countFloods()
|
||||
{
|
||||
return _floodsInMin > Config.CLIENT_PACKET_QUEUE_MAX_FLOODS_PER_MIN;
|
||||
}
|
||||
|
||||
private final boolean longFloodDetected()
|
||||
{
|
||||
return (_totalCount / BUFFER_SIZE) > Config.CLIENT_PACKET_QUEUE_MAX_AVERAGE_PACKETS_PER_SECOND;
|
||||
}
|
||||
|
||||
/**
|
||||
* Later during flood returns true (and send ActionFailed) once per second.
|
||||
* @return true if flood detected first and ActionFailed packet need to be sent.
|
||||
*/
|
||||
private final synchronized boolean countPacket()
|
||||
{
|
||||
_totalCount++;
|
||||
final long tick = System.currentTimeMillis();
|
||||
if ((tick - _packetCountStartTick) > 1000)
|
||||
{
|
||||
_packetCountStartTick = tick;
|
||||
|
||||
// clear flag if no more flooding during last seconds
|
||||
if (_floodDetected && !longFloodDetected() && (_packetsInSecond[_head] < (Config.CLIENT_PACKET_QUEUE_MAX_PACKETS_PER_SECOND / 2)))
|
||||
{
|
||||
_floodDetected = false;
|
||||
}
|
||||
|
||||
// wrap head of the buffer around the tail
|
||||
if (_head <= 0)
|
||||
{
|
||||
_head = BUFFER_SIZE;
|
||||
}
|
||||
_head--;
|
||||
|
||||
_totalCount -= _packetsInSecond[_head];
|
||||
_packetsInSecond[_head] = 1;
|
||||
return _floodDetected;
|
||||
}
|
||||
|
||||
final int count = ++_packetsInSecond[_head];
|
||||
if (!_floodDetected)
|
||||
{
|
||||
if (count > Config.CLIENT_PACKET_QUEUE_MAX_PACKETS_PER_SECOND)
|
||||
{
|
||||
shortFloods++;
|
||||
}
|
||||
else if (longFloodDetected())
|
||||
{
|
||||
longFloods++;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
_floodDetected = true;
|
||||
if ((tick - _floodStartTick) > 60000)
|
||||
{
|
||||
_floodStartTick = tick;
|
||||
_floodsInMin = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
_floodsInMin++;
|
||||
}
|
||||
|
||||
return true; // Return true only in the beginning of the flood
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
public @interface ClientString
|
||||
{
|
||||
int id();
|
||||
|
||||
String message();
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
public @interface ClientString
|
||||
{
|
||||
int id();
|
||||
|
||||
String message();
|
||||
}
|
||||
|
||||
@@ -1,111 +1,150 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.l2jmobius.gameserver.datatables.ItemTable;
|
||||
import com.l2jmobius.gameserver.model.Elementals;
|
||||
import com.l2jmobius.gameserver.model.StatsSet;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.TutorialShowHtml;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class Debug
|
||||
{
|
||||
public static void sendSkillDebug(L2Character attacker, L2Character target, Skill skill, StatsSet set)
|
||||
{
|
||||
if (!attacker.isPlayer())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
for (Entry<String, Object> entry : set.getSet().entrySet())
|
||||
{
|
||||
sb.append("<tr><td>" + entry.getKey() + "</td><td><font color=\"LEVEL\">" + entry.getValue() + "</font></td></tr>");
|
||||
}
|
||||
|
||||
final NpcHtmlMessage msg = new NpcHtmlMessage();
|
||||
msg.setFile(attacker.getActingPlayer().getHtmlPrefix(), "html/admin/skilldebug.htm");
|
||||
msg.replace("%patk%", target.getPAtk(target));
|
||||
msg.replace("%matk%", target.getMAtk(target, skill));
|
||||
msg.replace("%pdef%", target.getPDef(target));
|
||||
msg.replace("%mdef%", target.getMDef(target, skill));
|
||||
msg.replace("%acc%", target.getAccuracy());
|
||||
msg.replace("%evas%", target.getEvasionRate(target));
|
||||
msg.replace("%crit%", target.getCriticalHit(target, skill));
|
||||
msg.replace("%speed%", target.getRunSpeed());
|
||||
msg.replace("%pAtkSpd%", target.getPAtkSpd());
|
||||
msg.replace("%mAtkSpd%", target.getMAtkSpd());
|
||||
msg.replace("%str%", target.getSTR());
|
||||
msg.replace("%dex%", target.getDEX());
|
||||
msg.replace("%con%", target.getCON());
|
||||
msg.replace("%int%", target.getINT());
|
||||
msg.replace("%wit%", target.getWIT());
|
||||
msg.replace("%men%", target.getMEN());
|
||||
msg.replace("%atkElemType%", Elementals.getElementName(target.getAttackElement()));
|
||||
msg.replace("%atkElemVal%", target.getAttackElementValue(target.getAttackElement()));
|
||||
msg.replace("%fireDef%", target.getDefenseElementValue((byte) 0));
|
||||
msg.replace("%waterDef%", target.getDefenseElementValue((byte) 1));
|
||||
msg.replace("%windDef%", target.getDefenseElementValue((byte) 2));
|
||||
msg.replace("%earthDef%", target.getDefenseElementValue((byte) 3));
|
||||
msg.replace("%holyDef%", target.getDefenseElementValue((byte) 4));
|
||||
msg.replace("%darkDef%", target.getDefenseElementValue((byte) 5));
|
||||
msg.replace("%skill%", skill.toString());
|
||||
msg.replace("%details%", sb.toString());
|
||||
attacker.sendPacket(new TutorialShowHtml(msg.getHtml()));
|
||||
}
|
||||
|
||||
public static void sendItemDebug(L2PcInstance player, L2ItemInstance item, StatsSet set)
|
||||
{
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
for (Entry<String, Object> entry : set.getSet().entrySet())
|
||||
{
|
||||
sb.append("<tr><td>" + entry.getKey() + "</td><td><font color=\"LEVEL\">" + entry.getValue() + "</font></td></tr>");
|
||||
}
|
||||
|
||||
final NpcHtmlMessage msg = new NpcHtmlMessage();
|
||||
msg.setFile(player.getHtmlPrefix(), "html/admin/itemdebug.htm");
|
||||
msg.replace("%itemName%", item.getName());
|
||||
msg.replace("%itemSlot%", getBodyPart(item.getItem().getBodyPart()));
|
||||
msg.replace("%itemType%", item.isArmor() ? "Armor" : item.isWeapon() ? "Weapon" : "Etc");
|
||||
msg.replace("%enchantLevel%", item.getEnchantLevel());
|
||||
msg.replace("%isMagicWeapon%", item.getItem().isMagicWeapon());
|
||||
msg.replace("%item%", item.toString());
|
||||
msg.replace("%details%", sb.toString());
|
||||
player.sendPacket(new TutorialShowHtml(msg.getHtml()));
|
||||
}
|
||||
|
||||
private static String getBodyPart(int bodyPart)
|
||||
{
|
||||
for (Entry<String, Integer> entry : ItemTable.SLOTS.entrySet())
|
||||
{
|
||||
if ((entry.getValue() & bodyPart) == bodyPart)
|
||||
{
|
||||
return entry.getKey();
|
||||
}
|
||||
}
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.l2jmobius.gameserver.datatables.ItemTable;
|
||||
import com.l2jmobius.gameserver.enums.AttributeType;
|
||||
import com.l2jmobius.gameserver.model.StatsSet;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.stats.Stats;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.TutorialShowHtml;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class Debug
|
||||
{
|
||||
public static void sendStatsDebug(L2Character creature, Stats stat, StatsSet set)
|
||||
{
|
||||
if (!creature.isPlayer())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
final L2ItemInstance weapon = creature.getActiveWeaponInstance();
|
||||
for (Entry<String, Object> entry : set.getSet().entrySet())
|
||||
{
|
||||
sb.append("<tr><td>" + entry.getKey() + "</td><td><font color=\"LEVEL\">" + parseValue(entry.getValue()) + "</font></td></tr>");
|
||||
}
|
||||
|
||||
final NpcHtmlMessage msg = new NpcHtmlMessage();
|
||||
msg.setFile(creature.getActingPlayer().getHtmlPrefix(), "data/html/admin/statsdebug.htm");
|
||||
msg.replace("%stat%", String.valueOf(stat));
|
||||
msg.replace("%mulValue%", Util.formatDouble(creature.getStat().getMul(stat), "#.##"));
|
||||
msg.replace("%addValue%", creature.getStat().getAdd(stat));
|
||||
msg.replace("%templateValue%", Util.formatDouble(creature.getTemplate().getBaseValue(stat, 0), "#.##"));
|
||||
if (weapon != null)
|
||||
{
|
||||
msg.replace("%weaponBaseValue%", Util.formatDouble(weapon.getItem().getStats(stat, 0), "#.##"));
|
||||
}
|
||||
msg.replace("%details%", sb.toString());
|
||||
creature.sendPacket(new TutorialShowHtml(msg.getHtml()));
|
||||
}
|
||||
|
||||
public static void sendSkillDebug(L2Character attacker, L2Character target, Skill skill, StatsSet set)
|
||||
{
|
||||
if (!attacker.isPlayer())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
for (Entry<String, Object> entry : set.getSet().entrySet())
|
||||
{
|
||||
sb.append("<tr><td>" + entry.getKey() + "</td><td><font color=\"LEVEL\">" + parseValue(entry.getValue()) + "</font></td></tr>");
|
||||
}
|
||||
|
||||
final NpcHtmlMessage msg = new NpcHtmlMessage();
|
||||
msg.setFile(attacker.getActingPlayer().getHtmlPrefix(), "data/html/admin/skilldebug.htm");
|
||||
msg.replace("%patk%", target.getPAtk());
|
||||
msg.replace("%matk%", target.getMAtk());
|
||||
msg.replace("%pdef%", target.getPDef());
|
||||
msg.replace("%mdef%", target.getMDef());
|
||||
msg.replace("%acc%", target.getAccuracy());
|
||||
msg.replace("%evas%", target.getEvasionRate());
|
||||
msg.replace("%crit%", target.getCriticalHit());
|
||||
msg.replace("%speed%", target.getRunSpeed());
|
||||
msg.replace("%pAtkSpd%", target.getPAtkSpd());
|
||||
msg.replace("%mAtkSpd%", target.getMAtkSpd());
|
||||
msg.replace("%str%", target.getSTR());
|
||||
msg.replace("%dex%", target.getDEX());
|
||||
msg.replace("%con%", target.getCON());
|
||||
msg.replace("%int%", target.getINT());
|
||||
msg.replace("%wit%", target.getWIT());
|
||||
msg.replace("%men%", target.getMEN());
|
||||
msg.replace("%atkElemType%", target.getAttackElement().name());
|
||||
msg.replace("%atkElemVal%", target.getAttackElementValue(target.getAttackElement()));
|
||||
msg.replace("%fireDef%", target.getDefenseElementValue(AttributeType.FIRE));
|
||||
msg.replace("%waterDef%", target.getDefenseElementValue(AttributeType.WATER));
|
||||
msg.replace("%windDef%", target.getDefenseElementValue(AttributeType.WIND));
|
||||
msg.replace("%earthDef%", target.getDefenseElementValue(AttributeType.EARTH));
|
||||
msg.replace("%holyDef%", target.getDefenseElementValue(AttributeType.HOLY));
|
||||
msg.replace("%darkDef%", target.getDefenseElementValue(AttributeType.DARK));
|
||||
msg.replace("%skill%", String.valueOf(skill));
|
||||
msg.replace("%details%", sb.toString());
|
||||
attacker.sendPacket(new TutorialShowHtml(msg.getHtml()));
|
||||
}
|
||||
|
||||
public static void sendItemDebug(L2PcInstance player, L2ItemInstance item, StatsSet set)
|
||||
{
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
for (Entry<String, Object> entry : set.getSet().entrySet())
|
||||
{
|
||||
sb.append("<tr><td>" + entry.getKey() + "</td><td><font color=\"LEVEL\">" + parseValue(entry.getValue()) + "</font></td></tr>");
|
||||
}
|
||||
|
||||
final NpcHtmlMessage msg = new NpcHtmlMessage();
|
||||
msg.setFile(player.getHtmlPrefix(), "data/html/admin/itemdebug.htm");
|
||||
msg.replace("%itemName%", item.getName());
|
||||
msg.replace("%itemSlot%", getBodyPart(item.getItem().getBodyPart()));
|
||||
msg.replace("%itemType%", item.isArmor() ? "Armor" : item.isWeapon() ? "Weapon" : "Etc");
|
||||
msg.replace("%enchantLevel%", item.getEnchantLevel());
|
||||
msg.replace("%isMagicWeapon%", item.getItem().isMagicWeapon());
|
||||
msg.replace("%item%", item.toString());
|
||||
msg.replace("%details%", sb.toString());
|
||||
player.sendPacket(new TutorialShowHtml(msg.getHtml()));
|
||||
}
|
||||
|
||||
private static String parseValue(Object value)
|
||||
{
|
||||
if (value instanceof Double)
|
||||
{
|
||||
return Util.formatDouble((double) value, "#.##");
|
||||
}
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
private static String getBodyPart(int bodyPart)
|
||||
{
|
||||
for (Entry<String, Integer> entry : ItemTable._slots.entrySet())
|
||||
{
|
||||
if ((entry.getValue() & bodyPart) == bodyPart)
|
||||
{
|
||||
return entry.getKey();
|
||||
}
|
||||
}
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
|
||||
import io.netty.channel.nio.NioEventLoopGroup;
|
||||
|
||||
/**
|
||||
* @author Nos
|
||||
*/
|
||||
public class EventLoopGroupManager
|
||||
{
|
||||
private final NioEventLoopGroup _bossGroup = new NioEventLoopGroup(1);
|
||||
private final NioEventLoopGroup _workerGroup = new NioEventLoopGroup(Config.IO_PACKET_THREAD_CORE_SIZE);
|
||||
|
||||
public NioEventLoopGroup getBossGroup()
|
||||
{
|
||||
return _bossGroup;
|
||||
}
|
||||
|
||||
public NioEventLoopGroup getWorkerGroup()
|
||||
{
|
||||
return _workerGroup;
|
||||
}
|
||||
|
||||
public void shutdown()
|
||||
{
|
||||
_bossGroup.shutdownGracefully();
|
||||
_workerGroup.shutdownGracefully();
|
||||
}
|
||||
|
||||
public static EventLoopGroupManager getInstance()
|
||||
{
|
||||
return SingletonHolder._instance;
|
||||
}
|
||||
|
||||
private static class SingletonHolder
|
||||
{
|
||||
protected static final EventLoopGroupManager _instance = new EventLoopGroupManager();
|
||||
}
|
||||
}
|
||||
@@ -1,90 +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;
|
||||
|
||||
/**
|
||||
* @author KenM
|
||||
*/
|
||||
public class GameCrypt
|
||||
{
|
||||
private final byte[] _inKey = new byte[16];
|
||||
private final byte[] _outKey = new byte[16];
|
||||
private boolean _isEnabled;
|
||||
|
||||
public void setKey(byte[] key)
|
||||
{
|
||||
System.arraycopy(key, 0, _inKey, 0, 16);
|
||||
System.arraycopy(key, 0, _outKey, 0, 16);
|
||||
}
|
||||
|
||||
public void decrypt(byte[] raw, int offset, int size)
|
||||
{
|
||||
if (!_isEnabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int temp = 0;
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
final int temp2 = raw[offset + i] & 0xFF;
|
||||
raw[offset + i] = (byte) (temp2 ^ _inKey[i & 15] ^ temp);
|
||||
temp = temp2;
|
||||
}
|
||||
|
||||
int old = _inKey[8] & 0xff;
|
||||
old |= (_inKey[9] << 8) & 0xff00;
|
||||
old |= (_inKey[10] << 0x10) & 0xff0000;
|
||||
old |= (_inKey[11] << 0x18) & 0xff000000;
|
||||
|
||||
old += size;
|
||||
|
||||
_inKey[8] = (byte) (old & 0xff);
|
||||
_inKey[9] = (byte) ((old >> 0x08) & 0xff);
|
||||
_inKey[10] = (byte) ((old >> 0x10) & 0xff);
|
||||
_inKey[11] = (byte) ((old >> 0x18) & 0xff);
|
||||
}
|
||||
|
||||
public void encrypt(byte[] raw, int offset, int size)
|
||||
{
|
||||
if (!_isEnabled)
|
||||
{
|
||||
_isEnabled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
int temp = 0;
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
final int temp2 = raw[offset + i] & 0xFF;
|
||||
temp = temp2 ^ _outKey[i & 15] ^ temp;
|
||||
raw[offset + i] = (byte) temp;
|
||||
}
|
||||
|
||||
int old = _outKey[8] & 0xff;
|
||||
old |= (_outKey[9] << 8) & 0xff00;
|
||||
old |= (_outKey[10] << 0x10) & 0xff0000;
|
||||
old |= (_outKey[11] << 0x18) & 0xff000000;
|
||||
|
||||
old += size;
|
||||
|
||||
_outKey[8] = (byte) (old & 0xff);
|
||||
_outKey[9] = (byte) ((old >> 0x08) & 0xff);
|
||||
_outKey[10] = (byte) ((old >> 0x10) & 0xff);
|
||||
_outKey[11] = (byte) ((old >> 0x18) & 0xff);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+69
-67
@@ -1,67 +1,69 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.util.Rnd;
|
||||
|
||||
/**
|
||||
* Blowfish keygen for GameServer client connections.
|
||||
* @author KenM
|
||||
*/
|
||||
public class BlowFishKeygen
|
||||
{
|
||||
private static final int CRYPT_KEYS_SIZE = 20;
|
||||
private static final byte[][] CRYPT_KEYS = new byte[CRYPT_KEYS_SIZE][16];
|
||||
static
|
||||
{
|
||||
// init the GS encryption keys on class load
|
||||
|
||||
for (int i = 0; i < CRYPT_KEYS_SIZE; i++)
|
||||
{
|
||||
// randomize the 8 first bytes
|
||||
for (int j = 0; j < CRYPT_KEYS[i].length; j++)
|
||||
{
|
||||
CRYPT_KEYS[i][j] = (byte) Rnd.get(255);
|
||||
}
|
||||
|
||||
// the last 8 bytes are static
|
||||
CRYPT_KEYS[i][8] = (byte) 0xc8;
|
||||
CRYPT_KEYS[i][9] = (byte) 0x27;
|
||||
CRYPT_KEYS[i][10] = (byte) 0x93;
|
||||
CRYPT_KEYS[i][11] = (byte) 0x01;
|
||||
CRYPT_KEYS[i][12] = (byte) 0xa1;
|
||||
CRYPT_KEYS[i][13] = (byte) 0x6c;
|
||||
CRYPT_KEYS[i][14] = (byte) 0x31;
|
||||
CRYPT_KEYS[i][15] = (byte) 0x97;
|
||||
}
|
||||
}
|
||||
|
||||
// block instantiation
|
||||
private BlowFishKeygen()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a key from this keygen pool, the logical ownership is retained by this keygen.<BR>
|
||||
* Thus when getting a key with interests other then read-only a copy must be performed.<BR>
|
||||
* @return A key from this keygen pool.
|
||||
*/
|
||||
public static byte[] getRandomKey()
|
||||
{
|
||||
return CRYPT_KEYS[Rnd.get(CRYPT_KEYS_SIZE)];
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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.client;
|
||||
|
||||
import com.l2jmobius.commons.util.Rnd;
|
||||
|
||||
/**
|
||||
* Blowfish keygen for GameServer client connections.
|
||||
* @author KenM
|
||||
*/
|
||||
public class BlowFishKeygen
|
||||
{
|
||||
private static final int CRYPT_KEYS_SIZE = 20;
|
||||
private static final byte[][] CRYPT_KEYS = new byte[CRYPT_KEYS_SIZE][16];
|
||||
|
||||
static
|
||||
{
|
||||
// init the GS encryption keys on class load
|
||||
|
||||
for (int i = 0; i < CRYPT_KEYS_SIZE; i++)
|
||||
{
|
||||
// randomize the 8 first bytes
|
||||
for (int j = 0; j < CRYPT_KEYS[i].length; j++)
|
||||
{
|
||||
CRYPT_KEYS[i][j] = (byte) Rnd.get(255);
|
||||
}
|
||||
|
||||
// the last 8 bytes are static
|
||||
CRYPT_KEYS[i][8] = (byte) 0xc8;
|
||||
CRYPT_KEYS[i][9] = (byte) 0x27;
|
||||
CRYPT_KEYS[i][10] = (byte) 0x93;
|
||||
CRYPT_KEYS[i][11] = (byte) 0x01;
|
||||
CRYPT_KEYS[i][12] = (byte) 0xa1;
|
||||
CRYPT_KEYS[i][13] = (byte) 0x6c;
|
||||
CRYPT_KEYS[i][14] = (byte) 0x31;
|
||||
CRYPT_KEYS[i][15] = (byte) 0x97;
|
||||
}
|
||||
}
|
||||
|
||||
// block instantiation
|
||||
private BlowFishKeygen()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a key from this keygen pool, the logical ownership is retained by this keygen.<BR>
|
||||
* Thus when getting a key with interests other then read-only a copy must be performed.<BR>
|
||||
* @return A key from this keygen pool.
|
||||
*/
|
||||
public static byte[] getRandomKey()
|
||||
{
|
||||
return CRYPT_KEYS[Rnd.get(CRYPT_KEYS_SIZE)];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* 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.client;
|
||||
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
import com.l2jmobius.commons.network.codecs.CryptCodec;
|
||||
import com.l2jmobius.commons.network.codecs.LengthFieldBasedFrameEncoder;
|
||||
import com.l2jmobius.commons.network.codecs.PacketDecoder;
|
||||
import com.l2jmobius.commons.network.codecs.PacketEncoder;
|
||||
|
||||
import io.netty.channel.ChannelInitializer;
|
||||
import io.netty.channel.socket.SocketChannel;
|
||||
import io.netty.handler.codec.LengthFieldBasedFrameDecoder;
|
||||
|
||||
/**
|
||||
* @author Nos
|
||||
*/
|
||||
public class ClientInitializer extends ChannelInitializer<SocketChannel>
|
||||
{
|
||||
private static final LengthFieldBasedFrameEncoder LENGTH_ENCODER = new LengthFieldBasedFrameEncoder();
|
||||
private static final PacketEncoder PACKET_ENCODER = new PacketEncoder(ByteOrder.LITTLE_ENDIAN, 0x8000 - 2);
|
||||
|
||||
@Override
|
||||
protected void initChannel(SocketChannel ch)
|
||||
{
|
||||
final L2GameClient client = new L2GameClient();
|
||||
ch.pipeline().addLast("length-decoder", new LengthFieldBasedFrameDecoder(ByteOrder.LITTLE_ENDIAN, 0x8000 - 2, 0, 2, -2, 2, false));
|
||||
ch.pipeline().addLast("length-encoder", LENGTH_ENCODER);
|
||||
ch.pipeline().addLast("crypt-codec", new CryptCodec(client.getCrypt()));
|
||||
// ch.pipeline().addLast(new LoggingHandler(LogLevel.INFO));
|
||||
ch.pipeline().addLast("packet-decoder", new PacketDecoder<>(ByteOrder.LITTLE_ENDIAN, IncomingPackets.PACKET_ARRAY, client));
|
||||
ch.pipeline().addLast("packet-encoder", PACKET_ENCODER);
|
||||
ch.pipeline().addLast(client);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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.client;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.network.NetworkManager;
|
||||
import com.l2jmobius.gameserver.network.EventLoopGroupManager;
|
||||
|
||||
/**
|
||||
* @author Nos
|
||||
*/
|
||||
public class ClientNetworkManager extends NetworkManager
|
||||
{
|
||||
protected ClientNetworkManager()
|
||||
{
|
||||
super(EventLoopGroupManager.getInstance().getBossGroup(), EventLoopGroupManager.getInstance().getWorkerGroup(), new ClientInitializer(), Config.GAMESERVER_HOSTNAME, Config.PORT_GAME);
|
||||
}
|
||||
|
||||
public static ClientNetworkManager getInstance()
|
||||
{
|
||||
return SingletonHolder._instance;
|
||||
}
|
||||
|
||||
private static class SingletonHolder
|
||||
{
|
||||
protected static final ClientNetworkManager _instance = new ClientNetworkManager();
|
||||
}
|
||||
}
|
||||
+10
-17
@@ -14,25 +14,18 @@
|
||||
* 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;
|
||||
package com.l2jmobius.gameserver.network.client;
|
||||
|
||||
import com.l2jmobius.commons.network.IConnectionState;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @author Nos
|
||||
*/
|
||||
public class PledgeReceiveUpdatePower extends L2GameServerPacket
|
||||
public enum ConnectionState implements IConnectionState
|
||||
{
|
||||
private final int _level;
|
||||
|
||||
public PledgeReceiveUpdatePower(int level)
|
||||
{
|
||||
_level = level;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void writeImpl()
|
||||
{
|
||||
writeC(0xFE);
|
||||
writeH(0x43);
|
||||
writeD(_level);
|
||||
}
|
||||
CONNECTED,
|
||||
DISCONNECTED,
|
||||
CLOSING,
|
||||
AUTHENTICATED,
|
||||
IN_GAME
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
* 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.client;
|
||||
|
||||
import com.l2jmobius.commons.network.ICrypt;
|
||||
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||
import com.l2jmobius.gameserver.model.events.impl.server.OnPacketReceived;
|
||||
import com.l2jmobius.gameserver.model.events.impl.server.OnPacketSent;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
/**
|
||||
* @author UnAfraid, Nos
|
||||
*/
|
||||
public class Crypt implements ICrypt
|
||||
{
|
||||
private final L2GameClient _client;
|
||||
private final byte[] _inKey = new byte[16];
|
||||
private final byte[] _outKey = new byte[16];
|
||||
private boolean _isEnabled;
|
||||
|
||||
public Crypt(L2GameClient client)
|
||||
{
|
||||
_client = client;
|
||||
}
|
||||
|
||||
public void setKey(byte[] key)
|
||||
{
|
||||
System.arraycopy(key, 0, _inKey, 0, 16);
|
||||
System.arraycopy(key, 0, _outKey, 0, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encrypt(ByteBuf buf)
|
||||
{
|
||||
if (!_isEnabled)
|
||||
{
|
||||
_isEnabled = true;
|
||||
onPacketSent(buf);
|
||||
return;
|
||||
}
|
||||
|
||||
onPacketSent(buf);
|
||||
|
||||
int a = 0;
|
||||
while (buf.isReadable())
|
||||
{
|
||||
final int b = buf.readByte() & 0xFF;
|
||||
a = b ^ _outKey[(buf.readerIndex() - 1) & 15] ^ a;
|
||||
buf.setByte(buf.readerIndex() - 1, a);
|
||||
}
|
||||
|
||||
shiftKey(_outKey, buf.writerIndex());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decrypt(ByteBuf buf)
|
||||
{
|
||||
if (!_isEnabled)
|
||||
{
|
||||
onPacketReceive(buf);
|
||||
return;
|
||||
}
|
||||
|
||||
int a = 0;
|
||||
while (buf.isReadable())
|
||||
{
|
||||
final int b = buf.readByte() & 0xFF;
|
||||
buf.setByte(buf.readerIndex() - 1, b ^ _inKey[(buf.readerIndex() - 1) & 15] ^ a);
|
||||
a = b;
|
||||
}
|
||||
|
||||
shiftKey(_inKey, buf.writerIndex());
|
||||
|
||||
onPacketReceive(buf);
|
||||
}
|
||||
|
||||
private void onPacketSent(ByteBuf buf)
|
||||
{
|
||||
final byte[] data = new byte[buf.writerIndex()];
|
||||
buf.getBytes(0, data);
|
||||
EventDispatcher.getInstance().notifyEvent(new OnPacketSent(_client, data));
|
||||
}
|
||||
|
||||
private void onPacketReceive(ByteBuf buf)
|
||||
{
|
||||
final byte[] data = new byte[buf.writerIndex()];
|
||||
buf.getBytes(0, data);
|
||||
EventDispatcher.getInstance().notifyEvent(new OnPacketReceived(_client, data));
|
||||
}
|
||||
|
||||
private void shiftKey(byte[] key, int size)
|
||||
{
|
||||
int old = key[8] & 0xff;
|
||||
old |= (key[9] << 8) & 0xff00;
|
||||
old |= (key[10] << 0x10) & 0xff0000;
|
||||
old |= (key[11] << 0x18) & 0xff000000;
|
||||
|
||||
old += size;
|
||||
|
||||
key[8] = (byte) (old & 0xff);
|
||||
key[9] = (byte) ((old >> 0x08) & 0xff);
|
||||
key[10] = (byte) ((old >> 0x10) & 0xff);
|
||||
key[11] = (byte) ((old >> 0x18) & 0xff);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,406 @@
|
||||
/*
|
||||
* 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.client;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import com.l2jmobius.commons.network.IConnectionState;
|
||||
import com.l2jmobius.commons.network.IIncomingPacket;
|
||||
import com.l2jmobius.commons.network.IIncomingPackets;
|
||||
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.RequestDivideAdenaCancel;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.adenadistribution.RequestDivideAdenaStart;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.alchemy.RequestAlchemyConversion;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.alchemy.RequestAlchemyTryMixCube;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.appearance.RequestExCancelShape_Shifting_Item;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.appearance.RequestExTryToPutShapeShiftingEnchantSupportItem;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.appearance.RequestExTryToPutShapeShiftingTargetItem;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.appearance.RequestShapeShiftingItem;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.awakening.RequestCallToChangeClass;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.ceremonyofchaos.RequestCancelCuriousHouse;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.ceremonyofchaos.RequestCuriousHouseHtml;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.ceremonyofchaos.RequestJoinCuriousHouse;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.commission.RequestCommissionBuyInfo;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.commission.RequestCommissionBuyItem;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.commission.RequestCommissionCancel;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.commission.RequestCommissionDelete;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.commission.RequestCommissionInfo;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.commission.RequestCommissionList;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.commission.RequestCommissionRegister;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.commission.RequestCommissionRegisteredItem;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.commission.RequestCommissionRegistrableItemList;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.compound.RequestNewEnchantClose;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.compound.RequestNewEnchantPushOne;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.compound.RequestNewEnchantPushTwo;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.compound.RequestNewEnchantRemoveOne;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.compound.RequestNewEnchantRemoveTwo;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.compound.RequestNewEnchantTry;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.crystalization.RequestCrystallizeEstimate;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.crystalization.RequestCrystallizeItemCancel;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.ensoul.RequestItemEnsoul;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.friend.RequestFriendDetailInfo;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.mentoring.ConfirmMenteeAdd;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.mentoring.RequestMenteeAdd;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.mentoring.RequestMenteeWaitingList;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.mentoring.RequestMentorCancel;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.mentoring.RequestMentorList;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.onedayreward.RequestOneDayRewardReceive;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.onedayreward.RequestTodoList;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.pledgebonus.RequestPledgeBonusOpen;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.pledgebonus.RequestPledgeBonusReward;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.pledgebonus.RequestPledgeBonusRewardList;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.primeshop.RequestBRBuyProduct;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.primeshop.RequestBRGamePoint;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.primeshop.RequestBRProductInfo;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.primeshop.RequestBRProductList;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.primeshop.RequestBRRecentProductList;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.sayune.RequestFlyMove;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.sayune.RequestFlyMoveStart;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.shuttle.CannotMoveAnymoreInShuttle;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.shuttle.MoveToLocationInShuttle;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.shuttle.RequestShuttleGetOff;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.shuttle.RequestShuttleGetOn;
|
||||
|
||||
/**
|
||||
* @author Sdw
|
||||
*/
|
||||
public enum ExIncomingPackets implements IIncomingPackets<L2GameClient>
|
||||
{
|
||||
REQUEST_GOTO_LOBBY(0x33, RequestGotoLobby::new, ConnectionState.AUTHENTICATED),
|
||||
REQUEST_EX_2ND_PASSWORD_CHECK(0xA6, RequestEx2ndPasswordCheck::new, ConnectionState.AUTHENTICATED),
|
||||
REQUEST_EX_2ND_PASSWORD_VERIFY(0xA7, RequestEx2ndPasswordVerify::new, ConnectionState.AUTHENTICATED),
|
||||
REQUEST_EX_2ND_PASSWORD_REQ(0xA8, RequestEx2ndPasswordReq::new, ConnectionState.AUTHENTICATED),
|
||||
REQUEST_CHARACTER_NAME_CREATABLE(0xA9, RequestCharacterNameCreatable::new, ConnectionState.AUTHENTICATED),
|
||||
REQUEST_MANOR_LIST(0x01, RequestManorList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PROCEDURE_CROP_LIST(0x02, RequestProcureCropList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_SET_SEED(0x03, RequestSetSeed::new, ConnectionState.IN_GAME),
|
||||
REQUEST_SET_CROP(0x04, RequestSetCrop::new, ConnectionState.IN_GAME),
|
||||
REQUEST_WRITE_HERO_WORDS(0x05, RequestWriteHeroWords::new, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_ASK_JOIN_MPCC(0x06, RequestExAskJoinMPCC::new, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_ACCEPT_JOIN_MPCC(0x07, RequestExAcceptJoinMPCC::new, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_OUST_FROM_MPCC(0x08, RequestExOustFromMPCC::new, ConnectionState.IN_GAME),
|
||||
REQUEST_OUST_FROM_PARTY_ROOM(0x09, RequestOustFromPartyRoom::new, ConnectionState.IN_GAME),
|
||||
REQUEST_DISMISS_PARTY_ROOM(0x0A, RequestDismissPartyRoom::new, ConnectionState.IN_GAME),
|
||||
REQUEST_WITHDRAW_PARTY_ROOM(0x0B, RequestWithdrawPartyRoom::new, ConnectionState.IN_GAME),
|
||||
REQUEST_CHANGE_PARTY_LEADER(0x0C, RequestChangePartyLeader::new, ConnectionState.IN_GAME),
|
||||
REQUEST_AUTO_SOULSHOT(0x0D, RequestAutoSoulShot::new, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_ENCHANT_SKILL_INFO(0x0E, RequestExEnchantSkillInfo::new, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_ENCHANT_SKILL(0x0F, RequestExEnchantSkill::new, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_PLEDGE_CREST_LARGE(0x10, RequestExPledgeCrestLarge::new, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_SET_PLEDGE_CREST_LARGE(0x11, RequestExSetPledgeCrestLarge::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_SET_ACADEMY_MASTER(0x12, RequestPledgeSetAcademyMaster::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_POWER_GRADE_LIST(0x13, RequestPledgePowerGradeList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_MEMBER_POWER_INFO(0x14, RequestPledgeMemberPowerInfo::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_SET_MEMBER_POWER_GRADE(0x15, RequestPledgeSetMemberPowerGrade::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_MEMBER_INFO(0x16, RequestPledgeMemberInfo::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_WAR_LIST(0x17, RequestPledgeWarList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_FISH_RANKING(0x18, RequestExFishRanking::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PCCAFE_COUPON_USE(0x19, RequestPCCafeCouponUse::new, ConnectionState.IN_GAME),
|
||||
REQUEST_SERVER_LOGIN(0x1A, null, ConnectionState.IN_GAME),
|
||||
REQUEST_DUEL_START(0x1B, RequestDuelStart::new, ConnectionState.IN_GAME),
|
||||
REQUEST_DUAL_ANSWER_START(0x1C, RequestDuelAnswerStart::new, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_SET_TUTORIAL(0x1D, null, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_RQ_ITEM_LINK(0x1E, RequestExRqItemLink::new, ConnectionState.IN_GAME),
|
||||
CANNOT_MOVE_ANYMORE_AIR_SHIP(0x1F, null, ConnectionState.IN_GAME),
|
||||
MOVE_TO_LOCATION_IN_AIR_SHIP(0x20, MoveToLocationInAirShip::new, ConnectionState.IN_GAME),
|
||||
REQUEST_KEY_MAPPING(0x21, RequestKeyMapping::new, ConnectionState.IN_GAME),
|
||||
REQUEST_SAVE_KEY_MAPPING(0x22, RequestSaveKeyMapping::new, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_REMOVE_ITEM_ATTRIBUTE(0x23, RequestExRemoveItemAttribute::new, ConnectionState.IN_GAME),
|
||||
REQUEST_SAVE_INVENTORY_ORDER(0x24, RequestSaveInventoryOrder::new, ConnectionState.IN_GAME),
|
||||
REQUEST_EXIT_PARTY_MATCHING_WAITING_ROOM(0x25, RequestExitPartyMatchingWaitingRoom::new, ConnectionState.IN_GAME),
|
||||
REQUEST_CONFIRM_TARGET_ITEM(0x26, RequestConfirmTargetItem::new, ConnectionState.IN_GAME),
|
||||
REQUEST_CONFIRM_REFINER_ITEM(0x27, RequestConfirmRefinerItem::new, ConnectionState.IN_GAME),
|
||||
REQUEST_CONFIRM_GEMSTONE(0x28, RequestConfirmGemStone::new, ConnectionState.IN_GAME),
|
||||
REQUEST_OLYMPIAD_OBSERVER_END(0x29, RequestOlympiadObserverEnd::new, ConnectionState.IN_GAME),
|
||||
REQUEST_CURSED_WEAPON_LIST(0x2A, RequestCursedWeaponList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_CURSED_WEAPON_LOCATION(0x2B, RequestCursedWeaponLocation::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_REORGANIZE_MEMBER(0x2C, RequestPledgeReorganizeMember::new, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_MPCC_SHOW_PARTY_MEMBERS_INFO(0x2D, RequestExMPCCShowPartyMembersInfo::new, ConnectionState.IN_GAME),
|
||||
REQUEST_OLYMPIAD_MATCH_LIST(0x2E, RequestOlympiadMatchList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_ASK_JOIN_PARTY_ROOM(0x2F, RequestAskJoinPartyRoom::new, ConnectionState.IN_GAME),
|
||||
ANSWER_JOIN_PARTY_ROOM(0x30, AnswerJoinPartyRoom::new, ConnectionState.IN_GAME),
|
||||
REQUEST_LIST_PARTY_MATCHING_WAITING_ROOM(0x31, RequestListPartyMatchingWaitingRoom::new, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_ENCHANT_ITEM_ATTRIBUTE(0x32, RequestExEnchantItemAttribute::new, ConnectionState.IN_GAME),
|
||||
MOVE_TO_LOCATION_AIR_SHIP(0x35, MoveToLocationAirShip::new, ConnectionState.IN_GAME),
|
||||
REQUEST_BID_ITEM_AUCTION(0x36, RequestBidItemAuction::new, ConnectionState.IN_GAME),
|
||||
REQUEST_INFO_ITEM_AUCTION(0x37, RequestInfoItemAuction::new, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_CHANGE_NAME(0x38, RequestExChangeName::new, ConnectionState.IN_GAME),
|
||||
REQUEST_ALL_CASTLE_INFO(0x39, RequestAllCastleInfo::new, ConnectionState.IN_GAME),
|
||||
REQUEST_ALL_FORTRESS_INFO(0x3A, RequestAllFortressInfo::new, ConnectionState.IN_GAME),
|
||||
REQUEST_ALL_AGIT_INGO(0x3B, RequestAllAgitInfo::new, ConnectionState.IN_GAME),
|
||||
REQUEST_FORTRESS_SIEGE_INFO(0x3C, RequestFortressSiegeInfo::new, ConnectionState.IN_GAME),
|
||||
REQUEST_GET_BOSS_RECORD(0x3D, RequestGetBossRecord::new, ConnectionState.IN_GAME),
|
||||
REQUEST_REFINE(0x3E, RequestRefine::new, ConnectionState.IN_GAME),
|
||||
REQUEST_CONFIRM_CANCEL_ITEM(0x3F, RequestConfirmCancelItem::new, ConnectionState.IN_GAME),
|
||||
REQUEST_REFINE_CANCEL(0x40, RequestRefineCancel::new, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_MAGIC_SKILL_USE_GROUND(0x41, RequestExMagicSkillUseGround::new, ConnectionState.IN_GAME),
|
||||
REQUEST_DUEL_SURRENDER(0x42, RequestDuelSurrender::new, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_ENCHANT_SKILL_INFO_DETAIL(0x43, RequestExEnchantSkillInfoDetail::new, ConnectionState.IN_GAME),
|
||||
REQUEST_FORTRESS_MAP_INFO(0x45, RequestFortressMapInfo::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PVP_MATCH_RECORD(0x46, RequestPVPMatchRecord::new, ConnectionState.IN_GAME),
|
||||
SET_PRIVATE_STORE_WHOLE_MSG(0x47, SetPrivateStoreWholeMsg::new, ConnectionState.IN_GAME),
|
||||
REQUEST_DISPEL(0x48, RequestDispel::new, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_TRY_TO_PUT_ENCHANT_TARGET_ITEM(0x49, RequestExTryToPutEnchantTargetItem::new, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_TRY_TO_PUT_ENCHANT_SUPPORT_ITEM(0x4A, RequestExTryToPutEnchantSupportItem::new, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_CANCEL_ENCHANT_ITEM(0x4B, RequestExCancelEnchantItem::new, ConnectionState.IN_GAME),
|
||||
REQUEST_CHANGE_NICKNAME_COLOR(0x4C, RequestChangeNicknameColor::new, ConnectionState.IN_GAME),
|
||||
REQUEST_RESET_NICKNAME(0x4D, RequestResetNickname::new, ConnectionState.IN_GAME),
|
||||
EX_BOOKMARK_PACKET(0x4E, ExBookmarkPacket::new, ConnectionState.IN_GAME),
|
||||
REQUEST_WITHDRAW_PREMIUM_ITEM(0x4F, RequestWithDrawPremiumItem::new, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_JUMP(0x50, null, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_START_SHOW_CRATAE_CUBE_RANK(0x51, null, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_STOP_SHOW_CRATAE_CUBE_RANK(0x52, null, ConnectionState.IN_GAME),
|
||||
NOTIFY_START_MINI_GAME(0x53, null, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_JOIN_DOMINION_WAR(0x54, null, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_DOMINION_INFO(0x55, null, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_CLEFT_ENTER(0x56, null, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_CUBE_GAME_CHANGE_TEAM(0x57, RequestExCubeGameChangeTeam::new, ConnectionState.IN_GAME),
|
||||
END_SCENE_PLAYER(0x58, EndScenePlayer::new, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_CUBE_GAME_READY_ANSWER(0x59, RequestExCubeGameReadyAnswer::new, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_LIST_MPCC_WAITING(0x5A, RequestExListMpccWaiting::new, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_MANAGE_MPCC_ROOM(0x5B, RequestExManageMpccRoom::new, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_JOIN_MPCC_ROOM(0x5C, RequestExJoinMpccRoom::new, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_OUST_FROM_MPCC_ROOM(0x5D, RequestExOustFromMpccRoom::new, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_DISMISS_MPCC_ROOM(0x5E, RequestExDismissMpccRoom::new, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_WITHDRAW_MPCC_ROOM(0x5F, RequestExWithdrawMpccRoom::new, ConnectionState.IN_GAME),
|
||||
REQUEST_SEED_PHASE(0x60, RequestSeedPhase::new, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_MPCC_PARTYMASTER_LIST(0x61, RequestExMpccPartymasterList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_POST_ITEM_LIST(0x62, RequestPostItemList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_SEND_POST(0x63, RequestSendPost::new, ConnectionState.IN_GAME),
|
||||
REQUEST_RECEIVED_POST_LIST(0x64, RequestReceivedPostList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_DELETE_RECEIVED_POST(0x65, RequestDeleteReceivedPost::new, ConnectionState.IN_GAME),
|
||||
REQUEST_RECEIVED_POST(0x66, RequestReceivedPost::new, ConnectionState.IN_GAME),
|
||||
REQUEST_POST_ATTACHMENT(0x67, RequestPostAttachment::new, ConnectionState.IN_GAME),
|
||||
REQUEST_REJECT_POST_ATTACHMENT(0x68, RequestRejectPostAttachment::new, ConnectionState.IN_GAME),
|
||||
REQUEST_SENT_POST_LIST(0x69, RequestSentPostList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_DELETE_SENT_POST(0x6A, RequestDeleteSentPost::new, ConnectionState.IN_GAME),
|
||||
REQUEST_SENT_POST(0x6B, RequestSentPost::new, ConnectionState.IN_GAME),
|
||||
REQUEST_CANCEL_POST_ATTACHMENT(0x6C, RequestCancelPostAttachment::new, ConnectionState.IN_GAME),
|
||||
REQUEST_SHOW_NEW_USER_PETITION(0x6D, null, ConnectionState.IN_GAME),
|
||||
REQUEST_SHOW_STEP_TWO(0x6E, null, ConnectionState.IN_GAME),
|
||||
REQUEST_SHOW_STEP_THREE(0x6F, null, ConnectionState.IN_GAME),
|
||||
EX_CONNECT_TO_RAID_SERVER(0x70, null, ConnectionState.IN_GAME),
|
||||
EX_RETURN_FROM_RAID_SERVER(0x71, null, ConnectionState.IN_GAME),
|
||||
REQUEST_REFUND_ITEM(0x72, RequestRefundItem::new, ConnectionState.IN_GAME),
|
||||
REQUEST_BUI_SELL_UI_CLOSE(0x73, RequestBuySellUIClose::new, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_EVENT_MATCH_OBSERVER_END(0x74, null, ConnectionState.IN_GAME),
|
||||
REQUEST_PARTY_LOOT_MODIFICATION(0x75, RequestPartyLootModification::new, ConnectionState.IN_GAME),
|
||||
ANSWER_PARTY_LOOT_MODIFICATION(0x76, AnswerPartyLootModification::new, ConnectionState.IN_GAME),
|
||||
ANSWER_COUPLE_ACTION(0x77, AnswerCoupleAction::new, ConnectionState.IN_GAME),
|
||||
BR_EVENT_RANKER_LIST(0x78, BrEventRankerList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_ASK_MEMBER_SHIP(0x79, null, ConnectionState.IN_GAME),
|
||||
REQUEST_ADD_EXPAND_QUEST_ALARM(0x7A, RequestAddExpandQuestAlarm::new, ConnectionState.IN_GAME),
|
||||
REQUEST_VOTE_NEW(0x7B, RequestVoteNew::new, ConnectionState.IN_GAME),
|
||||
REQUEST_SHUTTLE_GET_ON(0x7C, RequestShuttleGetOn::new, ConnectionState.IN_GAME),
|
||||
REQUEST_SHUTTLE_GET_OFF(0x7D, RequestShuttleGetOff::new, ConnectionState.IN_GAME),
|
||||
MOVE_TO_LOCATION_IN_SHUTTLE(0x7E, MoveToLocationInShuttle::new, ConnectionState.IN_GAME),
|
||||
CANNOT_MORE_ANYMORE_IN_SHUTTLE(0x7F, CannotMoveAnymoreInShuttle::new, ConnectionState.IN_GAME),
|
||||
REQUEST_AGIT_ACTION(0x80, null, ConnectionState.IN_GAME), // TODO: Implement / HANDLE SWITCH
|
||||
REQUEST_EX_ADD_CONTACT_TO_CONTACT_LIST(0x81, RequestExAddContactToContactList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_DELETE_CONTACT_FROM_CONTACT_LIST(0x82, RequestExDeleteContactFromContactList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_SHOW_CONTACT_LIST(0x83, RequestExShowContactList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_FRIEND_LIST_EXTENDED(0x84, RequestExFriendListExtended::new, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_OLYMPIAD_MATCH_LIST_REFRESH(0x85, RequestExOlympiadMatchListRefresh::new, ConnectionState.IN_GAME),
|
||||
REQUEST_BR_GAME_POINT(0x86, RequestBRGamePoint::new, ConnectionState.IN_GAME),
|
||||
REQUEST_BR_PRODUCT_LIST(0x87, RequestBRProductList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_BR_PRODUCT_INFO(0x88, RequestBRProductInfo::new, ConnectionState.IN_GAME),
|
||||
REQUEST_BR_BUI_PRODUCT(0x89, RequestBRBuyProduct::new, ConnectionState.IN_GAME),
|
||||
REQUEST_BR_RECENT_PRODUCT_LIST(0x8A, RequestBRRecentProductList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_BR_MINI_GAME_LOAD_SCORES(0x8B, null, ConnectionState.IN_GAME),
|
||||
REQUEST_BR_MINI_GAME_INSERT_SCORE(0x8C, null, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_BR_LECTURE_MARK(0x8D, null, ConnectionState.IN_GAME),
|
||||
REQUEST_CRYSTALLIZE_ESTIMATE(0x8E, RequestCrystallizeEstimate::new, ConnectionState.IN_GAME),
|
||||
REQUEST_CRYSTALLIZE_ITEM_CANCEL(0x8F, RequestCrystallizeItemCancel::new, ConnectionState.IN_GAME),
|
||||
REQUEST_SCENE_EX_ESCAPE_SCENE(0x90, RequestExEscapeScene::new, ConnectionState.IN_GAME),
|
||||
REQUEST_FLY_MOVE(0x91, RequestFlyMove::new, ConnectionState.IN_GAME),
|
||||
REQUEST_SURRENDER_PLEDGE_WAR_EX(0x92, null, ConnectionState.IN_GAME),
|
||||
REQUEST_DYNAMIC_QUEST_ACTION(0x93, null, ConnectionState.IN_GAME), // TODO: Implement / HANDLE SWITCH
|
||||
REQUEST_FRIEND_DETAIL_INFO(0x94, RequestFriendDetailInfo::new, ConnectionState.IN_GAME),
|
||||
REQUEST_UPDATE_FRIEND_MEMO(0x95, null, ConnectionState.IN_GAME),
|
||||
REQUEST_UPDATE_BLOCK_MEMO(0x96, null, ConnectionState.IN_GAME),
|
||||
REQUEST_INZONE_PARTY_INFO_HISTORY(0x97, null, ConnectionState.IN_GAME),
|
||||
REQUEST_COMMISSION_REGISTRABLE_ITEM_LIST(0x98, RequestCommissionRegistrableItemList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_COMMISSION_INFO(0x99, RequestCommissionInfo::new, ConnectionState.IN_GAME),
|
||||
REQUEST_COMMISSION_REGISTER(0x9A, RequestCommissionRegister::new, ConnectionState.IN_GAME),
|
||||
REQUEST_COMMISSION_CANCEL(0x9B, RequestCommissionCancel::new, ConnectionState.IN_GAME),
|
||||
REQUEST_COMMISSION_DELETE(0x9C, RequestCommissionDelete::new, ConnectionState.IN_GAME),
|
||||
REQUEST_COMMISSION_LIST(0x9D, RequestCommissionList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_COMMISSION_BUY_INFO(0x9E, RequestCommissionBuyInfo::new, ConnectionState.IN_GAME),
|
||||
REQUEST_COMMISSION_BUY_ITEM(0x9F, RequestCommissionBuyItem::new, ConnectionState.IN_GAME),
|
||||
REQUEST_COMMISSION_REGISTERED_ITEM(0xA0, RequestCommissionRegisteredItem::new, ConnectionState.IN_GAME),
|
||||
REQUEST_CALL_TO_CHANGE_CLASS(0xA1, RequestCallToChangeClass::new, ConnectionState.IN_GAME),
|
||||
REQUEST_CHANGE_TO_AWAKENED_CLASS(0xA2, RequestChangeToAwakenedClass::new, ConnectionState.IN_GAME),
|
||||
REQUEST_WORLD_STATISTICS(0xA3, null, ConnectionState.IN_GAME),
|
||||
REQUEST_USER_STATISTICS(0xA4, null, ConnectionState.IN_GAME),
|
||||
REQUEST_24HZ_SESSION_ID(0xA5, null, ConnectionState.IN_GAME),
|
||||
REQUEST_GOODS_INVENTORY_INFO(0xAA, null, ConnectionState.IN_GAME),
|
||||
REQUEST_GOODS_INVENTORY_ITEM(0xAB, null, ConnectionState.IN_GAME),
|
||||
REQUEST_FIRST_PLAY_START(0xAC, null, ConnectionState.IN_GAME),
|
||||
REQUEST_FLY_MOVE_START(0xAD, RequestFlyMoveStart::new, ConnectionState.IN_GAME),
|
||||
REQUEST_HARDWARE_INFO(0xAE, null, ConnectionState.IN_GAME),
|
||||
SEND_CHANGE_ATTRIBUTE_TARGET_ITEM(0xB0, null, ConnectionState.IN_GAME),
|
||||
REQUEST_CHANGE_ATTRIBUTE_ITEM(0xB1, null, ConnectionState.IN_GAME),
|
||||
REQUEST_CHANGE_ATTRIBUTE_CANCEL(0xB2, null, ConnectionState.IN_GAME),
|
||||
REQUEST_BR_PRESENT_BUY_PRODUCT(0xB3, null, ConnectionState.IN_GAME),
|
||||
CONFIRM_MENTEE_ADD(0xB4, ConfirmMenteeAdd::new, ConnectionState.IN_GAME),
|
||||
REQUEST_MENTOR_CANCEL(0xB5, RequestMentorCancel::new, ConnectionState.IN_GAME),
|
||||
REQUEST_MENTOR_LIST(0xB6, RequestMentorList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_MENTEE_ADD(0xB7, RequestMenteeAdd::new, ConnectionState.IN_GAME),
|
||||
REQUEST_MENTEE_WAITING_LIST(0xB8, RequestMenteeWaitingList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_CLAN_ASK_JOIN_BY_NAME(0xB9, null, ConnectionState.IN_GAME),
|
||||
REQUEST_IN_ZONE_WAITING_TIME(0xBA, RequestInzoneWaitingTime::new, ConnectionState.IN_GAME),
|
||||
REQUEST_JOIN_CURIOUS_HOUSE(0xBB, RequestJoinCuriousHouse::new, ConnectionState.IN_GAME),
|
||||
REQUEST_CANCEL_CURIOUS_HOUSE(0xBC, RequestCancelCuriousHouse::new, ConnectionState.IN_GAME),
|
||||
REQUEST_LEAVE_CURIOUS_HOUSE(0xBD, null, ConnectionState.IN_GAME),
|
||||
REQUEST_OBSERVING_LIST_CURIOUS_HOUSE(0xBE, null, ConnectionState.IN_GAME),
|
||||
REQUEST_OBSERVING_CURIOUS_HOUSE(0xBF, null, ConnectionState.IN_GAME),
|
||||
REQUEST_LEAVE_OBSERVING_CURIOUS_HOUSE(0xC0, null, ConnectionState.IN_GAME),
|
||||
REQUEST_CURIOUS_HOUSE_HTML(0xC1, RequestCuriousHouseHtml::new, ConnectionState.IN_GAME),
|
||||
REQUEST_CURIOUS_HOUSE_RECORD(0xC2, null, ConnectionState.IN_GAME),
|
||||
EX_SYSSTRING(0xC3, null, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_TRY_TO_ÜT_SHAPE_SHIFTING_TARGET_ITEM(0xC4, RequestExTryToPutShapeShiftingTargetItem::new, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_TRY_TO_PUT_SHAPE_SHIFTING_ENCHANT_SUPPORT_ITEM(0xC5, RequestExTryToPutShapeShiftingEnchantSupportItem::new, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_CANCEL_SHAPE_SHIFTING_ITEM(0xC6, RequestExCancelShape_Shifting_Item::new, ConnectionState.IN_GAME),
|
||||
REQUEST_SHAPE_SHIFTING_ITEM(0xC7, RequestShapeShiftingItem::new, ConnectionState.IN_GAME),
|
||||
NC_GUARD_SEND_DATA_TO_SERVER(0xC8, null, ConnectionState.IN_GAME),
|
||||
REQUEST_EVENT_KALIE_TOKEN(0xC9, null, ConnectionState.IN_GAME),
|
||||
REQUEST_SHOW_BEAUTY_LIST(0xCA, RequestShowBeautyList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_REGIST_BEAUTY(0xCB, RequestRegistBeauty::new, ConnectionState.IN_GAME),
|
||||
REQUEST_SHOW_RESET_SHOP_LIST(0xCD, RequestShowResetShopList::new, ConnectionState.IN_GAME),
|
||||
NET_PING(0xCE, null, ConnectionState.IN_GAME),
|
||||
REQUEST_BR_ADD_BASKET_PRODUCT_INFO(0xCF, null, ConnectionState.IN_GAME),
|
||||
REQUEST_BR_DELETE_BASKET_PRODUCT_INFO(0xD0, null, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_EVENT_CAMPAIGN_INFO(0xD2, null, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_RECRUIT_INFO(0xD3, RequestPledgeRecruitInfo::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_RECRUIT_BOARD_SEARCH(0xD4, RequestPledgeRecruitBoardSearch::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_RECRUIT_BOARD_ACCESS(0xD5, RequestPledgeRecruitBoardAccess::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_RECRUIT_BOARD_DETAIL(0xD6, RequestPledgeRecruitBoardDetail::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_WAITING_APPLY(0xD7, RequestPledgeWaitingApply::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_WAITING_APPLIED(0xD8, RequestPledgeWaitingApplied::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_WAITING_LIST(0xD9, RequestPledgeWaitingList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_WAITING_USER(0xDA, RequestPledgeWaitingUser::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_WAITING_USER_ACCEPT(0xDB, RequestPledgeWaitingUserAccept::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_DRAFT_LIST_SEARCH(0xDC, RequestPledgeDraftListSearch::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_DRAFT_LIST_APPLY(0xDD, RequestPledgeDraftListApply::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_RECRUIT_APPLY_INFO(0xDE, RequestPledgeRecruitApplyInfo::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_JOIN_SYS(0xDF, null, ConnectionState.IN_GAME),
|
||||
RESPONSE_PETITION_ALARM(0xE0, null, ConnectionState.IN_GAME),
|
||||
NOTIFY_EXIT_BEAUTY_SHOP(0xE1, NotifyExitBeautyShop::new, ConnectionState.IN_GAME),
|
||||
REQUEST_REGISTER_XMAS_WISH_CARD(0xE2, null, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_ADD_ENCHANT_SCROLL_ITEM(0xE3, RequestExAddEnchantScrollItem::new, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_REMOVE_ENCHANT_SUPPORT_ITEM(0xE4, RequestExRemoveEnchantSupportItem::new, ConnectionState.IN_GAME),
|
||||
REQUEST_CARD_REWARD(0xE5, null, 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(0xE8, RequestDivideAdena::new, ConnectionState.IN_GAME),
|
||||
REQUEST_ACQUIRE_ABILITY_LIST(0xE9, RequestAcquireAbilityList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_ABILITY_LIST(0xEA, RequestAbilityList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_RESET_ABILITY_POINT(0xEB, RequestResetAbilityPoint::new, ConnectionState.IN_GAME),
|
||||
REQUEST_CHANGE_ABILITY_POINT(0xEC, RequestChangeAbilityPoint::new, ConnectionState.IN_GAME),
|
||||
REQUEST_STOP_MOVE(0xED, null, ConnectionState.IN_GAME),
|
||||
REQUEST_ABILITY_WND_OPEN(0xEE, RequestAbilityWndOpen::new, ConnectionState.IN_GAME),
|
||||
REQUEST_ABILITY_WND_CLOSE(0xEF, RequestAbilityWndClose::new, ConnectionState.IN_GAME),
|
||||
EX_PC_CAFE_REQUEST_OPEN_WINDOW_WITHOUT_NPC(0xF0, null, ConnectionState.IN_GAME),
|
||||
REQUEST_LUCKY_GAME_PLAY(0xF2, null, ConnectionState.IN_GAME),
|
||||
NOTIFY_TRAINING_ROOM_END(0xF3, null, ConnectionState.IN_GAME),
|
||||
REQUEST_NEW_ENCHANT_PUSH_ONE(0xF4, RequestNewEnchantPushOne::new, ConnectionState.IN_GAME),
|
||||
REQUEST_NEW_ENCHANT_REMOVE_ONE(0xF5, RequestNewEnchantRemoveOne::new, ConnectionState.IN_GAME),
|
||||
REQUEST_NEW_ENCHANT_PUSH_TWO(0xF6, RequestNewEnchantPushTwo::new, ConnectionState.IN_GAME),
|
||||
REQUEST_NEW_ENCHANT_REMOVE_TWO(0xF7, RequestNewEnchantRemoveTwo::new, ConnectionState.IN_GAME),
|
||||
REQUEST_NEW_ENCHANT_CLOSE(0xF8, RequestNewEnchantClose::new, ConnectionState.IN_GAME),
|
||||
REQUEST_NEW_ENCHANT_TRY(0xF9, RequestNewEnchantTry::new, ConnectionState.IN_GAME),
|
||||
EX_SEND_SELECTED_QUEST_ZONE_ID(0xFE, ExSendSelectedQuestZoneID::new, ConnectionState.IN_GAME),
|
||||
REQUEST_ALCHEMY_SKILL_LIST(0xFF, RequestAlchemySkillList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_ALCHEMY_TRY_MIX_CUBE(0x100, RequestAlchemyTryMixCube::new, ConnectionState.IN_GAME),
|
||||
REQUEST_ALCHEMY_CONVERSION(0x101, RequestAlchemyConversion::new, ConnectionState.IN_GAME),
|
||||
SEND_EXECUTED_UI_EVENTS_COUNT(0x102, null, ConnectionState.IN_GAME),
|
||||
EX_SEND_CLIENT_INI(0x103, null, ConnectionState.IN_GAME),
|
||||
REQUEST_EX_AUTO_FISH(0x104, ExRequestAutoFish::new, ConnectionState.IN_GAME),
|
||||
REQUEST_VIP_ATTENDANCE_ITEM_LIST(0x105, null, ConnectionState.IN_GAME),
|
||||
REQUEST_VIP_ATTENDANCE_CHECK(0x106, null, ConnectionState.IN_GAME),
|
||||
REQUEST_ITEM_ENSOUL(0x107, RequestItemEnsoul::new, ConnectionState.IN_GAME),
|
||||
REQUEST_VIP_PRODUCT_LIST(0x108, null, ConnectionState.IN_GAME),
|
||||
REQUEST_VIP_LUCKY_GAME_INFO(0x109, null, ConnectionState.IN_GAME),
|
||||
REQUEST_VIP_LUCKY_GAME_ITEM_LIST(0x10A, null, ConnectionState.IN_GAME),
|
||||
REQUEST_VIP_LUCKY_GAME_BONUS(0x10B, null, ConnectionState.IN_GAME),
|
||||
EXREQUEST_VIPINFO(0x10C, null, ConnectionState.IN_GAME),
|
||||
REQUEST_CAPTCHA_ANSWER(0x10D, null, ConnectionState.IN_GAME),
|
||||
REQUEST_REFRESH_CAPTCHA_IMAGE(0x10E, null, ConnectionState.IN_GAME),
|
||||
REQUEST_TODO_LIST(0x10F, RequestTodoList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_TODO_LIST_HTML(0x110, null, ConnectionState.IN_GAME),
|
||||
REQUEST_ONE_DAY_REWARD_RECEIVE(0x111, RequestOneDayRewardReceive::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_BONUS_OPEN(0x112, RequestPledgeBonusOpen::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_BONUS_REWARD_LIST(0x113, RequestPledgeBonusRewardList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_BONUS_REWARD(0x114, RequestPledgeBonusReward::new, ConnectionState.IN_GAME),
|
||||
REQUEST_SSO_AUTHN_TOKEN(0x115, null, ConnectionState.IN_GAME);
|
||||
|
||||
public static final ExIncomingPackets[] PACKET_ARRAY;
|
||||
|
||||
static
|
||||
{
|
||||
final short maxPacketId = (short) Arrays.stream(values()).mapToInt(IIncomingPackets::getPacketId).max().orElse(0);
|
||||
PACKET_ARRAY = new ExIncomingPackets[maxPacketId + 1];
|
||||
for (ExIncomingPackets incomingPacket : values())
|
||||
{
|
||||
PACKET_ARRAY[incomingPacket.getPacketId()] = incomingPacket;
|
||||
}
|
||||
}
|
||||
|
||||
private int _packetId;
|
||||
private Supplier<IIncomingPacket<L2GameClient>> _incomingPacketFactory;
|
||||
private Set<IConnectionState> _connectionStates;
|
||||
|
||||
ExIncomingPackets(int packetId, Supplier<IIncomingPacket<L2GameClient>> incomingPacketFactory, IConnectionState... connectionStates)
|
||||
{
|
||||
// packetId is an unsigned short
|
||||
if (packetId > 0xFFFF)
|
||||
{
|
||||
throw new IllegalArgumentException("packetId must not be bigger than 0xFFFF");
|
||||
}
|
||||
_packetId = packetId;
|
||||
_incomingPacketFactory = incomingPacketFactory != null ? incomingPacketFactory : () -> null;
|
||||
_connectionStates = new HashSet<>(Arrays.asList(connectionStates));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPacketId()
|
||||
{
|
||||
return _packetId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIncomingPacket<L2GameClient> newIncomingPacket()
|
||||
{
|
||||
return _incomingPacketFactory.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<IConnectionState> getConnectionStates()
|
||||
{
|
||||
return _connectionStates;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,255 @@
|
||||
/*
|
||||
* 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.client;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import com.l2jmobius.commons.network.IConnectionState;
|
||||
import com.l2jmobius.commons.network.IIncomingPacket;
|
||||
import com.l2jmobius.commons.network.IIncomingPackets;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.*;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.friend.RequestAnswerFriendInvite;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.friend.RequestFriendDel;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.friend.RequestFriendList;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.friend.RequestSendFriendMsg;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public enum IncomingPackets implements IIncomingPackets<L2GameClient>
|
||||
{
|
||||
LOGOUT(0x00, Logout::new, ConnectionState.AUTHENTICATED, ConnectionState.IN_GAME),
|
||||
ATTACK(0x01, Attack::new, ConnectionState.IN_GAME),
|
||||
REQUEST_START_PLEDGE_WAR(0x03, RequestStartPledgeWar::new, ConnectionState.IN_GAME),
|
||||
REQUEST_REPLY_START_PLEDGE(0x04, RequestReplyStartPledgeWar::new, ConnectionState.IN_GAME),
|
||||
REQUEST_STOP_PLEDGE_WAR(0x05, RequestStopPledgeWar::new, ConnectionState.IN_GAME),
|
||||
REQUEST_REPLY_STOP_PLEDGE_WAR(0x06, RequestReplyStopPledgeWar::new, ConnectionState.IN_GAME),
|
||||
REQUEST_SURRENDER_PLEDGE_WAR(0x07, RequestSurrenderPledgeWar::new, ConnectionState.IN_GAME),
|
||||
REQUEST_REPLY_SURRENDER_PLEDGE_WAR(0x08, RequestReplySurrenderPledgeWar::new, ConnectionState.IN_GAME),
|
||||
REQUEST_SET_PLEDGE_CREST(0x09, RequestSetPledgeCrest::new, ConnectionState.IN_GAME),
|
||||
REQUEST_GIVE_NICK_NAME(0x0B, RequestGiveNickName::new, ConnectionState.IN_GAME),
|
||||
CHARACTER_CREATE(0x0C, CharacterCreate::new, ConnectionState.AUTHENTICATED),
|
||||
CHARACTER_DELETE(0x0D, CharacterDelete::new, ConnectionState.AUTHENTICATED),
|
||||
PROTOCOL_VERSION(0x0E, ProtocolVersion::new, ConnectionState.CONNECTED),
|
||||
MOVE_BACKWARD_TO_LOCATION(0x0F, MoveBackwardToLocation::new, ConnectionState.IN_GAME),
|
||||
ENTER_WORLD(0x11, EnterWorld::new, ConnectionState.IN_GAME),
|
||||
CHARACTER_SELECT(0x12, CharacterSelect::new, ConnectionState.AUTHENTICATED),
|
||||
NEW_CHARACTER(0x13, NewCharacter::new, ConnectionState.AUTHENTICATED),
|
||||
REQUEST_ITEM_LIST(0x14, RequestItemList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_UN_EQUIP_ITEM(0x16, RequestUnEquipItem::new, ConnectionState.IN_GAME),
|
||||
REQUEST_DROP_ITEM(0x17, RequestDropItem::new, ConnectionState.IN_GAME),
|
||||
USE_ITEM(0x19, UseItem::new, ConnectionState.IN_GAME),
|
||||
TRADE_REQUEST(0x1A, TradeRequest::new, ConnectionState.IN_GAME),
|
||||
ADD_TRADE_ITEM(0x1B, AddTradeItem::new, ConnectionState.IN_GAME),
|
||||
TRADE_DONE(0x1C, TradeDone::new, ConnectionState.IN_GAME),
|
||||
ACTION(0x1F, Action::new, ConnectionState.IN_GAME),
|
||||
REQUEST_LINK_HTML(0x22, RequestLinkHtml::new, ConnectionState.IN_GAME),
|
||||
REQUEST_BYPASS_TO_SERVER(0x23, RequestBypassToServer::new, ConnectionState.IN_GAME),
|
||||
REQUEST_BBS_WRITE(0x24, RequestBBSwrite::new, ConnectionState.IN_GAME),
|
||||
REQUEST_JOIN_PLEDGE(0x26, RequestJoinPledge::new, ConnectionState.IN_GAME),
|
||||
REQUEST_ANSWER_JOIN_PLEDGE(0x27, RequestAnswerJoinPledge::new, ConnectionState.IN_GAME),
|
||||
REQUEST_WITHDRAWAL_PLEDGE(0x28, RequestWithdrawalPledge::new, ConnectionState.IN_GAME),
|
||||
REQUEST_OUST_PLEDGE_MEMBER(0x29, RequestOustPledgeMember::new, ConnectionState.IN_GAME),
|
||||
AUTH_LOGIN(0x2B, AuthLogin::new, ConnectionState.CONNECTED),
|
||||
REQUEST_GET_ITEM_FROM_PET(0x2C, RequestGetItemFromPet::new, ConnectionState.IN_GAME),
|
||||
REQUEST_ALLY_INFO(0x2E, RequestAllyInfo::new, ConnectionState.IN_GAME),
|
||||
REQUEST_CRYSTALLIZE_ITEM(0x2F, RequestCrystallizeItem::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PRIVATE_STORE_MANAGE_SELL(0x30, RequestPrivateStoreManageSell::new, ConnectionState.IN_GAME),
|
||||
SET_PRIVATE_STORE_LIST_SELL(0x31, SetPrivateStoreListSell::new, ConnectionState.IN_GAME),
|
||||
ATTACK_REQUEST(0x32, AttackRequest::new, ConnectionState.IN_GAME),
|
||||
REQUEST_TELEPORT(0x33, null, ConnectionState.IN_GAME),
|
||||
SOCIAL_ACTION(0x34, null, ConnectionState.IN_GAME),
|
||||
CHANGE_MOVE_TYPE(0x35, null, ConnectionState.IN_GAME),
|
||||
CHANGE_WAIT_TYPE(0x36, null, ConnectionState.IN_GAME),
|
||||
REQUEST_SELL_ITEM(0x37, RequestSellItem::new, ConnectionState.IN_GAME),
|
||||
REQUEST_MAGIC_SKILL_LIST(0x38, RequestMagicSkillList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_MAGIC_SKILL_USE(0x39, RequestMagicSkillUse::new, ConnectionState.IN_GAME),
|
||||
APPEARING(0x3A, Appearing::new, ConnectionState.IN_GAME),
|
||||
SEND_WARE_HOUSE_DEPOSIT_LIST(0x3B, SendWareHouseDepositList::new, ConnectionState.IN_GAME),
|
||||
SEND_WARE_HOUSE_WITH_DRAW_LIST(0x3C, SendWareHouseWithDrawList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_SHORT_CUT_REG(0x3D, RequestShortCutReg::new, ConnectionState.IN_GAME),
|
||||
REQUEST_SHORT_CUT_DEL(0x3F, RequestShortCutDel::new, ConnectionState.IN_GAME),
|
||||
REQUEST_BUY_ITEM(0x40, RequestBuyItem::new, ConnectionState.IN_GAME),
|
||||
REQUEST_JOIN_PARTY(0x42, RequestJoinParty::new, ConnectionState.IN_GAME),
|
||||
REQUEST_ANSWER_JOIN_PARTY(0x43, RequestAnswerJoinParty::new, ConnectionState.IN_GAME),
|
||||
REQUEST_WITH_DRAWAL_PARTY(0x44, RequestWithDrawalParty::new, ConnectionState.IN_GAME),
|
||||
REQUEST_OUST_PARTY_MEMBER(0x45, RequestOustPartyMember::new, ConnectionState.IN_GAME),
|
||||
CANNOT_MOVE_ANYMORE(0x47, CannotMoveAnymore::new, ConnectionState.IN_GAME),
|
||||
REQUEST_TARGET_CANCELD(0x48, RequestTargetCanceld::new, ConnectionState.IN_GAME),
|
||||
SAY2(0x49, Say2::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_MEMBER_LIST(0x4D, RequestPledgeMemberList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_MAGIC_LIST(0x4F, null, ConnectionState.IN_GAME),
|
||||
REQUEST_SKILL_LIST(0x50, RequestSkillList::new, ConnectionState.IN_GAME),
|
||||
MOVE_WITH_DELTA(0x52, MoveWithDelta::new, ConnectionState.IN_GAME),
|
||||
REQUEST_GET_ON_VEHICLE(0x53, RequestGetOnVehicle::new, ConnectionState.IN_GAME),
|
||||
REQUEST_GET_OFF_VEHICLE(0x54, RequestGetOffVehicle::new, ConnectionState.IN_GAME),
|
||||
ANSWER_TRADE_REQUEST(0x55, AnswerTradeRequest::new, ConnectionState.IN_GAME),
|
||||
REQUEST_ACTION_USE(0x56, RequestActionUse::new, ConnectionState.IN_GAME),
|
||||
REQUEST_RESTART(0x57, RequestRestart::new, ConnectionState.IN_GAME),
|
||||
VALIDATE_POSITION(0x59, ValidatePosition::new, ConnectionState.IN_GAME),
|
||||
START_ROTATING(0x5B, StartRotating::new, ConnectionState.IN_GAME),
|
||||
FINISH_ROTATING(0x5C, FinishRotating::new, ConnectionState.IN_GAME),
|
||||
REQUEST_SHOW_BOARD(0x5E, RequestShowBoard::new, ConnectionState.IN_GAME),
|
||||
REQUEST_ENCHANT_ITEM(0x5F, RequestEnchantItem::new, ConnectionState.IN_GAME),
|
||||
REQUEST_DESTROY_ITEM(0x60, RequestDestroyItem::new, ConnectionState.IN_GAME),
|
||||
REQUEST_QUEST_LIST(0x62, RequestQuestList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_QUEST_ABORT(0x63, RequestQuestAbort::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_INFO(0x65, RequestPledgeInfo::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_EXTENDED_INFO(0x66, RequestPledgeExtendedInfo::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_CREST(0x67, RequestPledgeCrest::new, ConnectionState.IN_GAME),
|
||||
REQUEST_SEND_FRIEND_MSG(0x6B, RequestSendFriendMsg::new, ConnectionState.IN_GAME),
|
||||
REQUEST_SHOW_MINI_MAP(0x6C, RequestShowMiniMap::new, ConnectionState.IN_GAME),
|
||||
REQUEST_RECORD_INFO(0x6E, RequestRecordInfo::new, ConnectionState.IN_GAME),
|
||||
REQUEST_HENNA_EQUIP(0x6F, RequestHennaEquip::new, ConnectionState.IN_GAME),
|
||||
REQUEST_HENNA_REMOVE_LIST(0x70, RequestHennaRemoveList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_HENNA_ITEM_REMOVE_INFO(0x71, RequestHennaItemRemoveInfo::new, ConnectionState.IN_GAME),
|
||||
REQUEST_HENNA_REMOVE(0x72, RequestHennaRemove::new, ConnectionState.IN_GAME),
|
||||
REQUEST_ACQUIRE_SKILL_INFO(0x73, RequestAcquireSkillInfo::new, ConnectionState.IN_GAME),
|
||||
SEND_BYPASS_BUILD_CMD(0x74, SendBypassBuildCmd::new, ConnectionState.IN_GAME),
|
||||
REQUEST_MOVE_TO_LOCATION_IN_VEHICLE(0x75, RequestMoveToLocationInVehicle::new, ConnectionState.IN_GAME),
|
||||
CANNOT_MOVE_ANYMORE_IN_VEHICLE(0x76, CannotMoveAnymoreInVehicle::new, ConnectionState.IN_GAME),
|
||||
REQUEST_FRIEND_INVITE(0x77, RequestFriendInvite::new, ConnectionState.IN_GAME),
|
||||
REQUEST_ANSWER_FRIEND_INVITE(0x78, RequestAnswerFriendInvite::new, ConnectionState.IN_GAME),
|
||||
REQUEST_FRIEND_LIST(0x79, RequestFriendList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_FRIEND_DEL(0x7A, RequestFriendDel::new, ConnectionState.IN_GAME),
|
||||
CHARACTER_RESTORE(0x7B, CharacterRestore::new, ConnectionState.AUTHENTICATED),
|
||||
REQUEST_ACQUIRE_SKILL(0x7C, RequestAcquireSkill::new, ConnectionState.IN_GAME),
|
||||
REQUEST_RESTART_POINT(0x7D, RequestRestartPoint::new, ConnectionState.IN_GAME),
|
||||
REQUEST_GM_COMMAND(0x7E, RequestGMCommand::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PARTY_MATCH_CONFIG(0x7F, RequestPartyMatchConfig::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PARTY_MATCH_LIST(0x80, RequestPartyMatchList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PARTY_MATCH_DETAIL(0x81, RequestPartyMatchDetail::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PRIVATE_STORE_BUY(0x83, RequestPrivateStoreBuy::new, ConnectionState.IN_GAME),
|
||||
REQUEST_TUTORIAL_LINK_HTML(0x85, RequestTutorialLinkHtml::new, ConnectionState.IN_GAME),
|
||||
REQUEST_TUTORIAL_PASS_CMD_TO_SERVER(0x86, RequestTutorialPassCmdToServer::new, ConnectionState.IN_GAME),
|
||||
REQUEST_TUTORIAL_QUESTION_MARK(0x87, RequestTutorialQuestionMark::new, ConnectionState.IN_GAME),
|
||||
REQUEST_TUTORIAL_CLIENT_EVENT(0x88, RequestTutorialClientEvent::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PETITION(0x89, RequestPetition::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PETITION_CANCEL(0x8A, RequestPetitionCancel::new, ConnectionState.IN_GAME),
|
||||
REQUEST_GM_LIST(0x8B, RequestGmList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_JOIN_ALLY(0x8C, RequestJoinAlly::new, ConnectionState.IN_GAME),
|
||||
REQUEST_ANSWER_JOIN_ALLY(0x8D, RequestAnswerJoinAlly::new, ConnectionState.IN_GAME),
|
||||
ALLY_LEAVE(0x8E, AllyLeave::new, ConnectionState.IN_GAME),
|
||||
ALLY_DISMISS(0x8F, AllyDismiss::new, ConnectionState.IN_GAME),
|
||||
REQUEST_DISMISS_ALLY(0x90, RequestDismissAlly::new, ConnectionState.IN_GAME),
|
||||
REQUEST_SET_ALLY_CREST(0x91, RequestSetAllyCrest::new, ConnectionState.IN_GAME),
|
||||
REQUEST_ALLY_CREST(0x92, RequestAllyCrest::new, ConnectionState.IN_GAME),
|
||||
REQUEST_CHANGE_PET_NAME(0x93, RequestChangePetName::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PET_USE_ITEM(0x94, RequestPetUseItem::new, ConnectionState.IN_GAME),
|
||||
REQUEST_GIVE_ITEM_TO_PET(0x95, RequestGiveItemToPet::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PRIVATE_STORE_QUIT_SELL(0x96, RequestPrivateStoreQuitSell::new, ConnectionState.IN_GAME),
|
||||
SET_PRIVATE_STORE_MSG_SELL(0x97, SetPrivateStoreMsgSell::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PET_GET_ITEM(0x98, RequestPetGetItem::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PRIVATE_STORE_MANAGE_BUY(0x99, RequestPrivateStoreManageBuy::new, ConnectionState.IN_GAME),
|
||||
SET_PRIVATE_STORE_LIST_BUY(0x9A, SetPrivateStoreListBuy::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PRIVATE_STORE_QUIT_BUY(0x9C, RequestPrivateStoreQuitBuy::new, ConnectionState.IN_GAME),
|
||||
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
||||
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
||||
REQUEST_SKILL_COOL_TIME(0xA6, null, ConnectionState.IN_GAME),
|
||||
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
||||
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
||||
REQUEST_SIEGE_INFO(0xAA, RequestSiegeInfo::new, ConnectionState.IN_GAME),
|
||||
REQUEST_SIEGE_ATTACKER_LIST(0xAB, RequestSiegeAttackerList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_SIEGE_DEFENDER_LIST(0xAC, RequestSiegeDefenderList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_JOIN_SIEGE(0xAD, RequestJoinSiege::new, ConnectionState.IN_GAME),
|
||||
REQUEST_CONFIRM_SIEGE_WAITING_LIST(0xAE, RequestConfirmSiegeWaitingList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_SET_CASTLE_SIEGE_TIME(0xAF, RequestSetCastleSiegeTime::new, ConnectionState.IN_GAME),
|
||||
MULTI_SELL_CHOOSE(0xB0, MultiSellChoose::new, ConnectionState.IN_GAME),
|
||||
NET_PING(0xB1, null, ConnectionState.IN_GAME),
|
||||
REQUEST_REMAIN_TIME(0xB2, null, ConnectionState.IN_GAME),
|
||||
BYPASS_USER_CMD(0xB3, BypassUserCmd::new, ConnectionState.IN_GAME),
|
||||
SNOOP_QUIT(0xB4, SnoopQuit::new, ConnectionState.IN_GAME),
|
||||
REQUEST_RECIPE_BOOK_OPEN(0xB5, RequestRecipeBookOpen::new, ConnectionState.IN_GAME),
|
||||
REQUEST_RECIPE_BOOK_DESTROY(0xB6, RequestRecipeBookDestroy::new, ConnectionState.IN_GAME),
|
||||
REQUEST_RECIPE_ITEM_MAKE_INFO(0xB7, RequestRecipeItemMakeInfo::new, ConnectionState.IN_GAME),
|
||||
REQUEST_RECIPE_ITEM_MAKE_SELF(0xB8, RequestRecipeItemMakeSelf::new, ConnectionState.IN_GAME),
|
||||
REQUEST_RECIPE_SHOP_MANAGE_LIST(0xB9, null, ConnectionState.IN_GAME),
|
||||
REQUEST_RECIPE_SHOP_MESSAGE_SET(0xBA, RequestRecipeShopMessageSet::new, ConnectionState.IN_GAME),
|
||||
REQUEST_RECIPE_SHOP_LIST_SET(0xBB, RequestRecipeShopListSet::new, ConnectionState.IN_GAME),
|
||||
REQUEST_RECIPE_SHOP_MANAGE_QUIT(0xBC, RequestRecipeShopManageQuit::new, ConnectionState.IN_GAME),
|
||||
REQUEST_RECIPE_SHOP_MANAGE_CANCEL(0xBD, null, ConnectionState.IN_GAME),
|
||||
REQUEST_RECIPE_SHOP_MAKE_INFO(0xBE, RequestRecipeShopMakeInfo::new, ConnectionState.IN_GAME),
|
||||
REQUEST_RECIPE_SHOP_MAKE_ITEM(0xBF, RequestRecipeShopMakeItem::new, ConnectionState.IN_GAME),
|
||||
REQUEST_RECIPE_SHOP_MANAGE_PREV(0xC0, RequestRecipeShopManagePrev::new, ConnectionState.IN_GAME),
|
||||
OBSERVER_RETURN(0xC1, ObserverReturn::new, ConnectionState.IN_GAME),
|
||||
REQUEST_EVALUATE(0xC2, null, ConnectionState.IN_GAME),
|
||||
REQUEST_HENNA_ITEM_LIST(0xC3, RequestHennaItemList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_HENNA_ITEM_INFO(0xC4, RequestHennaItemInfo::new, ConnectionState.IN_GAME),
|
||||
REQUEST_BUY_SEED(0xC5, RequestBuySeed::new, ConnectionState.IN_GAME),
|
||||
DLG_ANSWER(0xC6, DlgAnswer::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PREVIEW_ITEM(0xC7, RequestPreviewItem::new, ConnectionState.IN_GAME),
|
||||
REQUEST_SSQ_STATUS(0xC8, null, ConnectionState.IN_GAME),
|
||||
REQUEST_PETITION_FEEDBACK(0xC9, RequestPetitionFeedback::new, ConnectionState.IN_GAME),
|
||||
GAME_GUARD_REPLY(0xCB, GameGuardReply::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_POWER(0xCC, RequestPledgePower::new, ConnectionState.IN_GAME),
|
||||
REQUEST_MAKE_MACRO(0xCD, RequestMakeMacro::new, ConnectionState.IN_GAME),
|
||||
REQUEST_DELETE_MACRO(0xCE, RequestDeleteMacro::new, ConnectionState.IN_GAME),
|
||||
REQUEST_BUY_PROCURE(0xCF, null, ConnectionState.IN_GAME),
|
||||
EX_PACKET(0xD0, ExPacket::new, ConnectionState.values()); // This packet has its own connection state checking so we allow all of them
|
||||
|
||||
public static final IncomingPackets[] PACKET_ARRAY;
|
||||
|
||||
static
|
||||
{
|
||||
final short maxPacketId = (short) Arrays.stream(values()).mapToInt(IIncomingPackets::getPacketId).max().orElse(0);
|
||||
PACKET_ARRAY = new IncomingPackets[maxPacketId + 1];
|
||||
for (IncomingPackets incomingPacket : values())
|
||||
{
|
||||
PACKET_ARRAY[incomingPacket.getPacketId()] = incomingPacket;
|
||||
}
|
||||
}
|
||||
|
||||
private short _packetId;
|
||||
private Supplier<IIncomingPacket<L2GameClient>> _incomingPacketFactory;
|
||||
private Set<IConnectionState> _connectionStates;
|
||||
|
||||
IncomingPackets(int packetId, Supplier<IIncomingPacket<L2GameClient>> incomingPacketFactory, IConnectionState... connectionStates)
|
||||
{
|
||||
// packetId is an unsigned byte
|
||||
if (packetId > 0xFF)
|
||||
{
|
||||
throw new IllegalArgumentException("packetId must not be bigger than 0xFF");
|
||||
}
|
||||
|
||||
_packetId = (short) packetId;
|
||||
_incomingPacketFactory = incomingPacketFactory != null ? incomingPacketFactory : () -> null;
|
||||
_connectionStates = new HashSet<>(Arrays.asList(connectionStates));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPacketId()
|
||||
{
|
||||
return _packetId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIncomingPacket<L2GameClient> newIncomingPacket()
|
||||
{
|
||||
return _incomingPacketFactory.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<IConnectionState> getConnectionStates()
|
||||
{
|
||||
return _connectionStates;
|
||||
}
|
||||
}
|
||||
+944
-1190
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,730 @@
|
||||
/*
|
||||
* 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.client;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketWriter;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public enum OutgoingPackets
|
||||
{
|
||||
// Packets
|
||||
DIE(0x00),
|
||||
REVIVE(0x01),
|
||||
ATTACK_OUT_OF_RANGE(0x02),
|
||||
ATTACKIN_COOL_TIME(0x03),
|
||||
ATTACK_DEAD_TARGET(0x04),
|
||||
SPAWN_ITEM(0x05),
|
||||
SELL_LIST(0x06),
|
||||
BUY_LIST(0x07),
|
||||
DELETE_OBJECT(0x08),
|
||||
CHARACTER_SELECTION_INFO(0x09),
|
||||
LOGIN_FAIL(0x0A),
|
||||
CHARACTER_SELECTED(0x0B),
|
||||
NPC_INFO(0x0C),
|
||||
NEW_CHARACTER_SUCCESS(0x0D),
|
||||
NEW_CHARACTER_FAIL(0x0E),
|
||||
CHARACTER_CREATE_SUCCESS(0x0F),
|
||||
CHARACTER_CREATE_FAIL(0x10),
|
||||
ITEM_LIST(0x11),
|
||||
SUN_RISE(0x12),
|
||||
SUN_SET(0x13),
|
||||
TRADE_START(0x14),
|
||||
TRADE_START_OK(0x15),
|
||||
DROP_ITEM(0x16),
|
||||
GET_ITEM(0x17),
|
||||
STATUS_UPDATE(0x18),
|
||||
NPC_HTML_MESSAGE(0x19),
|
||||
TRADE_OWN_ADD(0x1A),
|
||||
TRADE_OTHER_ADD(0x1B),
|
||||
TRADE_DONE(0x1C),
|
||||
CHARACTER_DELETE_SUCCESS(0x1D),
|
||||
CHARACTER_DELETE_FAIL(0x1E),
|
||||
ACTION_FAIL(0x1F),
|
||||
SEVER_CLOSE(0x20),
|
||||
INVENTORY_UPDATE(0x21),
|
||||
TELEPORT_TO_LOCATION(0x22),
|
||||
TARGET_SELECTED(0x23),
|
||||
TARGET_UNSELECTED(0x24),
|
||||
AUTO_ATTACK_START(0x25),
|
||||
AUTO_ATTACK_STOP(0x26),
|
||||
SOCIAL_ACTION(0x27),
|
||||
CHANGE_MOVE_TYPE(0x28),
|
||||
CHANGE_WAIT_TYPE(0x29),
|
||||
MANAGE_PLEDGE_POWER(0x2A),
|
||||
CREATE_PLEDGE(0x2B),
|
||||
ASK_JOIN_PLEDGE(0x2C),
|
||||
JOIN_PLEDGE(0x2D),
|
||||
VERSION_CHECK(0x2E),
|
||||
MOVE_TO_LOCATION(0x2F),
|
||||
NPC_SAY(0x30),
|
||||
CHAR_INFO(0x31),
|
||||
USER_INFO(0x32),
|
||||
ATTACK(0x33),
|
||||
WITHDRAWAL_PLEDGE(0x34),
|
||||
OUST_PLEDGE_MEMBER(0x35),
|
||||
SET_OUST_PLEDGE_MEMBER(0x36),
|
||||
DISMISS_PLEDGE(0x37),
|
||||
SET_DISMISS_PLEDGE(0x38),
|
||||
ASK_JOIN_PARTY(0x39),
|
||||
JOIN_PARTY(0x3A),
|
||||
WITHDRAWAL_PARTY(0x3B),
|
||||
OUST_PARTY_MEMBER(0x3C),
|
||||
SET_OUST_PARTY_MEMBER(0x3D),
|
||||
DISMISS_PARTY(0x3E),
|
||||
SET_DISMISS_PARTY(0x3F),
|
||||
MAGIC_AND_SKILL_LIST(0x40),
|
||||
WAREHOUSE_DEPOSIT_LIST(0x41),
|
||||
WAREHOUSE_WITHDRAW_LIST(0x42),
|
||||
WAREHOUSE_DONE(0x43),
|
||||
SHORT_CUT_REGISTER(0x44),
|
||||
SHORT_CUT_INIT(0x45),
|
||||
SHORT_CUT_DELETE(0x46),
|
||||
STOP_MOVE(0x47),
|
||||
MAGIC_SKILL_USE(0x48),
|
||||
MAGIC_SKILL_CANCELED(0x49),
|
||||
SAY2(0x4A),
|
||||
NPC_INFO_ABNORMAL_VISUAL_EFFECT(0x4B),
|
||||
DOOR_INFO(0x4C),
|
||||
DOOR_STATUS_UPDATE(0x4D),
|
||||
PARTY_SMALL_WINDOW_ALL(0x4E),
|
||||
PARTY_SMALL_WINDOW_ADD(0x4F),
|
||||
PARTY_SMALL_WINDOW_DELETE_ALL(0x50),
|
||||
PARTY_SMALL_WINDOW_DELETE(0x51),
|
||||
PARTY_SMALL_WINDOW_UPDATE(0x52),
|
||||
TRADE_PRESS_OWN_OK(0x53),
|
||||
MAGIC_SKILL_LAUNCHED(0x54),
|
||||
FRIEND_ADD_REQUEST_RESULT(0x55),
|
||||
FRIEND_ADD(0x56),
|
||||
FRIEND_REMOVE(0x57),
|
||||
FRIEND_LIST(0x58),
|
||||
FRIEND_STATUS(0x59),
|
||||
PLEDGE_SHOW_MEMBER_LIST_ALL(0x5A),
|
||||
PLEDGE_SHOW_MEMBER_LIST_UPDATE(0x5B),
|
||||
PLEDGE_SHOW_MEMBER_LIST_ADD(0x5C),
|
||||
PLEDGE_SHOW_MEMBER_LIST_DELETE(0x5D),
|
||||
MAGIC_LIST(0x5E),
|
||||
SKILL_LIST(0x5F),
|
||||
VEHICLE_INFO(0x60),
|
||||
FINISH_ROTATING(0x61),
|
||||
SYSTEM_MESSAGE(0x62),
|
||||
START_PLEDGE_WAR(0x63),
|
||||
REPLY_START_PLEDGE_WAR(0x64),
|
||||
STOP_PLEDGE_WAR(0x65),
|
||||
REPLY_STOP_PLEDGE_WAR(0x66),
|
||||
SURRENDER_PLEDGE_WAR(0x67),
|
||||
REPLY_SURRENDER_PLEDGE_WAR(0x68),
|
||||
SET_PLEDGE_CREST(0x69),
|
||||
PLEDGE_CREST(0x6A),
|
||||
SETUP_GAUGE(0x6B),
|
||||
VEHICLE_DEPARTURE(0x6C),
|
||||
VEHICLE_CHECK_LOCATION(0x6D),
|
||||
GET_ON_VEHICLE(0x6E),
|
||||
GET_OFF_VEHICLE(0x6F),
|
||||
TRADE_REQUEST(0x70),
|
||||
RESTART_RESPONSE(0x71),
|
||||
MOVE_TO_PAWN(0x72),
|
||||
SSQ_INFO(0x73),
|
||||
GAME_GUARD_QUERY(0x74),
|
||||
L2_FRIEND_LIST(0x75),
|
||||
L2_FRIEND(0x76),
|
||||
L2_FRIEND_STATUS(0x77),
|
||||
L2_FRIEND_SAY(0x78),
|
||||
VALIDATE_LOCATION(0x79),
|
||||
START_ROTATING(0x7A),
|
||||
SHOW_BOARD(0x7B),
|
||||
CHOOSE_INVENTORY_ITEM(0x7C),
|
||||
DUMMY(0x7D),
|
||||
MOVE_TO_LOCATION_IN_VEHICLE(0x7E),
|
||||
STOP_MOVE_IN_VEHICLE(0x7F),
|
||||
VALIDATE_LOCATION_IN_VEHICLE(0x80),
|
||||
TRADE_UPDATE(0x81),
|
||||
TRADE_PRESS_OTHER_OK(0x82),
|
||||
FRIEND_ADD_REQUEST(0x83),
|
||||
LOG_OUT_OK(0x84),
|
||||
ABNORMAL_STATUS_UPDATE(0x85),
|
||||
QUEST_LIST(0x86),
|
||||
ENCHANT_RESULT(0x87),
|
||||
PLEDGE_SHOW_MEMBER_LIST_DELETE_ALL(0x88),
|
||||
PLEDGE_INFO(0x89),
|
||||
PLEDGE_EXTENDED_INFO(0x8A),
|
||||
SUMMON_INFO(0x8B),
|
||||
RIDE(0x8C),
|
||||
DUMMY2(0x8D),
|
||||
PLEDGE_SHOW_INFO_UPDATE(0x8E),
|
||||
CLIENT_ACTION(0x8F),
|
||||
ACQUIRE_SKILL_LIST(0x90),
|
||||
ACQUIRE_SKILL_INFO(0x91),
|
||||
SERVER_OBJECT_INFO(0x92),
|
||||
GM_HIDE(0x93),
|
||||
ACQUIRE_SKILL_DONE(0x94),
|
||||
GM_VIEW_CHARACTER_INFO(0x95),
|
||||
GM_VIEW_PLEDGE_INFO(0x96),
|
||||
GM_VIEW_SKILL_INFO(0x97),
|
||||
GM_VIEW_MAGIC_INFO(0x98),
|
||||
GM_VIEW_QUEST_INFO(0x99),
|
||||
GM_VIEW_ITEM_LIST(0x9A),
|
||||
GM_VIEW_WAREHOUSE_WITHDRAW_LIST(0x9B),
|
||||
LIST_PARTY_WATING(0x9C),
|
||||
PARTY_ROOM_INFO(0x9D),
|
||||
PLAY_SOUND(0x9E),
|
||||
STATIC_OBJECT(0x9F),
|
||||
PRIVATE_STORE_MANAGE_LIST(0xA0),
|
||||
PRIVATE_STORE_LIST(0xA1),
|
||||
PRIVATE_STORE_MSG(0xA2),
|
||||
SHOW_MINIMAP(0xA3),
|
||||
REVIVE_REQUEST(0xA4),
|
||||
ABNORMAL_VISUAL_EFFECT(0xA5),
|
||||
TUTORIAL_SHOW_HTML(0xA6),
|
||||
TUTORIAL_SHOW_QUESTION_MARK(0xA7),
|
||||
TUTORIAL_ENABLE_CLIENT_EVENT(0xA8),
|
||||
TUTORIAL_CLOSE_HTML(0xA9),
|
||||
SHOW_RADAR(0xAA),
|
||||
WITHDRAW_ALLIANCE(0xAB),
|
||||
OUST_ALLIANCE_MEMBER_PLEDGE(0xAC),
|
||||
DISMISS_ALLIANCE(0xAD),
|
||||
SET_ALLIANCE_CREST(0xAE),
|
||||
ALLIANCE_CREST(0xAF),
|
||||
SERVER_CLOSE_SOCKET(0xB0),
|
||||
PET_STATUS_SHOW(0xB1),
|
||||
PET_INFO(0xB2),
|
||||
PET_ITEM_LIST(0xB3),
|
||||
PET_INVENTORY_UPDATE(0xB4),
|
||||
ALLIANCE_INFO(0xB5),
|
||||
PET_STATUS_UPDATE(0xB6),
|
||||
PET_DELETE(0xB7),
|
||||
DELETE_RADAR(0xB8),
|
||||
MY_TARGET_SELECTED(0xB9),
|
||||
PARTY_MEMBER_POSITION(0xBA),
|
||||
ASK_JOIN_ALLIANCE(0xBB),
|
||||
JOIN_ALLIANCE(0xBC),
|
||||
PRIVATE_STORE_BUY_MANAGE_LIST(0xBD),
|
||||
PRIVATE_STORE_BUY_LIST(0xBE),
|
||||
PRIVATE_STORE_BUY_MSG(0xBF),
|
||||
VEHICLE_START(0xC0),
|
||||
NPC_INFO_STATE(0xC1),
|
||||
START_ALLIANCE_WAR(0xC2),
|
||||
REPLY_START_ALLIANCE_WAR(0xC3),
|
||||
STOP_ALLIANCE_WAR(0xC4),
|
||||
REPLY_STOP_ALLIANCE_WAR(0xC5),
|
||||
SURRENDER_ALLIANCE_WAR(0xC6),
|
||||
SKILL_COOL_TIME(0xC7),
|
||||
PACKAGE_TO_LIST(0xC8),
|
||||
CASTLE_SIEGE_INFO(0xC9),
|
||||
CASTLE_SIEGE_ATTACKER_LIST(0xCA),
|
||||
CASTLE_SIEGE_DEFENDER_LIST(0xCB),
|
||||
NICK_NAME_CHANGED(0xCC),
|
||||
PLEDGE_STATUS_CHANGED(0xCD),
|
||||
RELATION_CHANGED(0xCE),
|
||||
EVENT_TRIGGER(0xCF),
|
||||
MULTI_SELL_LIST(0xD0),
|
||||
SET_SUMMON_REMAIN_TIME(0xD1),
|
||||
PACKAGE_SENDABLE_LIST(0xD2),
|
||||
EARTHQUAKE(0xD3),
|
||||
FLY_TO_LOCATION(0xD4),
|
||||
BLOCK_LIST(0xD5),
|
||||
SPECIAL_CAMERA(0xD6),
|
||||
NORMAL_CAMERA(0xD7),
|
||||
SKILL_REMAIN_SEC(0xD8),
|
||||
NET_PING(0xD9),
|
||||
DICE(0xDA),
|
||||
SNOOP(0xDB),
|
||||
RECIPE_BOOK_ITEM_LIST(0xDC),
|
||||
RECIPE_ITEM_MAKE_INFO(0xDD),
|
||||
RECIPE_SHOP_MANAGE_LIST(0xDE),
|
||||
RECIPE_SHOP_SELL_LIST(0xDF),
|
||||
RECIPE_SHOP_ITEM_INFO(0xE0),
|
||||
RECIPE_SHOP_MSG(0xE1),
|
||||
SHOW_CALC(0xE2),
|
||||
MON_RACE_INFO(0xE3),
|
||||
HENNA_ITEM_INFO(0xE4),
|
||||
HENNA_INFO(0xE5),
|
||||
HENNA_UNEQUIP_LIST(0xE6),
|
||||
HENNA_UNEQUIP_INFO(0xE7),
|
||||
MACRO_LIST(0xE8),
|
||||
BUY_LIST_SEED(0xE9),
|
||||
SHOW_TOWN_MAP(0xEA),
|
||||
OBSERVER_START(0xEB),
|
||||
OBSERVER_END(0xEC),
|
||||
CHAIR_SIT(0xED),
|
||||
HENNA_EQUIP_LIST(0xEE),
|
||||
SELL_LIST_PROCURE(0xEF),
|
||||
GMHENNA_INFO(0xF0),
|
||||
RADAR_CONTROL(0xF1),
|
||||
CLIENT_SET_TIME(0xF2),
|
||||
CONFIRM_DLG(0xF3),
|
||||
PARTY_SPELLED(0xF4),
|
||||
SHOP_PREVIEW_LIST(0xF5),
|
||||
SHOP_PREVIEW_INFO(0xF6),
|
||||
CAMERA_MODE(0xF7),
|
||||
SHOW_XMAS_SEAL(0xF8),
|
||||
ETC_STATUS_UPDATE(0xF9),
|
||||
SHORT_BUFF_STATUS_UPDATE(0xFA),
|
||||
SSQ_STATUS(0xFB),
|
||||
PETITION_VOTE(0xFC),
|
||||
AGIT_DECO_INFO(0xFD),
|
||||
DUMMY3(0xFE),
|
||||
// ExPackets
|
||||
EX_DUMMY(0xFE, 0x00),
|
||||
EX_REGEN_MAX(0xFE, 0x01),
|
||||
EX_EVENT_MATCH_USER_INFO(0xFE, 0x02),
|
||||
EX_COLOSSEUM_FENCE_INFO(0xFE, 0x03),
|
||||
EX_EVENT_MATCH_SPELLED_INFO(0xFE, 0x04),
|
||||
EX_EVENT_MATCH_FIRECRACKER(0xFE, 0x05),
|
||||
EX_EVENT_MATCH_TEAM_UNLOCKED(0xFE, 0x06),
|
||||
EX_EVENT_MATCH_GMTEST(0xFE, 0x07),
|
||||
EX_PARTY_ROOM_MEMBER(0xFE, 0x08),
|
||||
EX_CLOSE_PARTY_ROOM(0xFE, 0x09),
|
||||
EX_MANAGE_PARTY_ROOM_MEMBER(0xFE, 0x0A),
|
||||
EX_EVENT_MATCH_LOCK_RESULT(0xFE, 0x0B),
|
||||
EX_AUTO_SOUL_SHOT(0xFE, 0x0C),
|
||||
EX_EVENT_MATCH_LIST(0xFE, 0x0D),
|
||||
EX_EVENT_MATCH_OBSERVER(0xFE, 0x0E),
|
||||
EX_EVENT_MATCH_MESSAGE(0xFE, 0x0F),
|
||||
EX_EVENT_MATCH_SCORE(0xFE, 0x10),
|
||||
EX_SERVER_PRIMITIVE(0xFE, 0x11),
|
||||
EX_OPEN_MPCC(0xFE, 0x12),
|
||||
EX_CLOSE_MPCC(0xFE, 0x13),
|
||||
EX_SHOW_CASTLE_INFO(0xFE, 0x14),
|
||||
EX_SHOW_FORTRESS_INFO(0xFE, 0x15),
|
||||
EX_SHOW_AGIT_INFO(0xFE, 0x16),
|
||||
EX_SHOW_FORTRESS_SIEGE_INFO(0xFE, 0x17),
|
||||
EX_PARTY_PET_WINDOW_ADD(0xFE, 0x18),
|
||||
EX_PARTY_PET_WINDOW_UPDATE(0xFE, 0x19),
|
||||
EX_ASK_JOIN_MPCC(0xFE, 0x1A),
|
||||
EX_PLEDGE_EMBLEM(0xFE, 0x1B),
|
||||
EX_EVENT_MATCH_TEAM_INFO(0xFE, 0x1C),
|
||||
EX_EVENT_MATCH_CREATE(0xFE, 0x1D),
|
||||
EX_FISHING_START(0xFE, 0x1E),
|
||||
EX_FISHING_END(0xFE, 0x1F),
|
||||
EX_SHOW_QUEST_INFO(0xFE, 0x20),
|
||||
EX_SHOW_QUEST_MARK(0xFE, 0x21),
|
||||
EX_SEND_MANOR_LIST(0xFE, 0x22),
|
||||
EX_SHOW_SEED_INFO(0xFE, 0x23),
|
||||
EX_SHOW_CROP_INFO(0xFE, 0x24),
|
||||
EX_SHOW_MANOR_DEFAULT_INFO(0xFE, 0x25),
|
||||
EX_SHOW_SEED_SETTING(0xFE, 0x26),
|
||||
EX_FISHING_START_COMBAT(0xFE, 0x27),
|
||||
EX_FISHING_HP_REGEN(0xFE, 0x28),
|
||||
EX_ENCHANT_SKILL_LIST(0xFE, 0x29),
|
||||
EX_ENCHANT_SKILL_INFO(0xFE, 0x2A),
|
||||
EX_SHOW_CROP_SETTING(0xFE, 0x2B),
|
||||
EX_SHOW_SELL_CROP_LIST(0xFE, 0x2C),
|
||||
EX_OLYMPIAD_MATCH_END(0xFE, 0x2D),
|
||||
EX_MAIL_ARRIVED(0xFE, 0x2E),
|
||||
EX_STORAGE_MAX_COUNT(0xFE, 0x2F),
|
||||
EX_EVENT_MATCH_MANAGE(0xFE, 0x30),
|
||||
EX_MULTI_PARTY_COMMAND_CHANNEL_INFO(0xFE, 0x31),
|
||||
EX_PCCAFE_POINT_INFO(0xFE, 0x32),
|
||||
EX_SET_COMPASS_ZONE_CODE(0xFE, 0x33),
|
||||
EX_GET_BOSS_RECORD(0xFE, 0x34),
|
||||
EX_ASK_JOIN_PARTY_ROOM(0xFE, 0x35),
|
||||
EX_LIST_PARTY_MATCHING_WAITING_ROOM(0xFE, 0x36),
|
||||
EX_SET_MPCC_ROUTING(0xFE, 0x37),
|
||||
EX_SHOW_ADVENTURER_GUIDE_BOOK(0xFE, 0x38),
|
||||
EX_SHOW_SCREEN_MESSAGE(0xFE, 0x39),
|
||||
PLEDGE_SKILL_LIST(0xFE, 0x3A),
|
||||
PLEDGE_SKILL_LIST_ADD(0xFE, 0x3B),
|
||||
PLEDGE_SKILL_LIST_REMOVE(0xFE, 0x3C),
|
||||
PLEDGE_POWER_GRADE_LIST(0xFE, 0x3D),
|
||||
PLEDGE_RECEIVE_POWER_INFO(0xFE, 0x3E),
|
||||
PLEDGE_RECEIVE_MEMBER_INFO(0xFE, 0x3F),
|
||||
PLEDGE_RECEIVE_WAR_LIST(0xFE, 0x40),
|
||||
PLEDGE_RECEIVE_SUB_PLEDGE_CREATED(0xFE, 0x41),
|
||||
EX_RED_SKY(0xFE, 0x42),
|
||||
PLEDGE_RECEIVE_UPDATE_POWER(0xFE, 0x43),
|
||||
FLY_SELF_DESTINATION(0xFE, 0x44),
|
||||
SHOW_PCCAFE_COUPON_SHOW_UI(0xFE, 0x45),
|
||||
EX_SEARCH_ORC(0xFE, 0x46),
|
||||
EX_CURSED_WEAPON_LIST(0xFE, 0x47),
|
||||
EX_CURSED_WEAPON_LOCATION(0xFE, 0x48),
|
||||
EX_RESTART_CLIENT(0xFE, 0x49),
|
||||
EX_REQUEST_HACK_SHIELD(0xFE, 0x4A),
|
||||
EX_USE_SHARED_GROUP_ITEM(0xFE, 0x4B),
|
||||
EX_MPCCSHOW_PARTY_MEMBER_INFO(0xFE, 0x4C),
|
||||
EX_DUEL_ASK_START(0xFE, 0x4D),
|
||||
EX_DUEL_READY(0xFE, 0x4E),
|
||||
EX_DUEL_START(0xFE, 0x4F),
|
||||
EX_DUEL_END(0xFE, 0x50),
|
||||
EX_DUEL_UPDATE_USER_INFO(0xFE, 0x51),
|
||||
EX_SHOW_VARIATION_MAKE_WINDOW(0xFE, 0x52),
|
||||
EX_SHOW_VARIATION_CANCEL_WINDOW(0xFE, 0x53),
|
||||
EX_PUT_ITEM_RESULT_FOR_VARIATION_MAKE(0xFE, 0x54),
|
||||
EX_PUT_INTENSIVE_RESULT_FOR_VARIATION_MAKE(0xFE, 0x55),
|
||||
EX_PUT_COMMISSION_RESULT_FOR_VARIATION_MAKE(0xFE, 0x56),
|
||||
EX_VARIATION_RESULT(0xFE, 0x57),
|
||||
EX_PUT_ITEM_RESULT_FOR_VARIATION_CANCEL(0xFE, 0x58),
|
||||
EX_VARIATION_CANCEL_RESULT(0xFE, 0x59),
|
||||
EX_DUEL_ENEMY_RELATION(0xFE, 0x5A),
|
||||
EX_PLAY_ANIMATION(0xFE, 0x5B),
|
||||
EX_MPCCPARTY_INFO_UPDATE(0xFE, 0x5C),
|
||||
EX_PLAY_SCENE(0xFE, 0x5D),
|
||||
EX_SPAWN_EMITTER(0xFE, 0x5E),
|
||||
EX_ENCHANT_SKILL_INFO_DETAIL(0xFE, 0x5F),
|
||||
EX_BASIC_ACTION_LIST(0xFE, 0x60),
|
||||
EX_AIR_SHIP_INFO(0xFE, 0x61),
|
||||
EX_ATTRIBUTE_ENCHANT_RESULT(0xFE, 0x62),
|
||||
EX_CHOOSE_INVENTORY_ATTRIBUTE_ITEM(0xFE, 0x63),
|
||||
EX_GET_ON_AIR_SHIP(0xFE, 0x64),
|
||||
EX_GET_OFF_AIR_SHIP(0xFE, 0x65),
|
||||
EX_MOVE_TO_LOCATION_AIR_SHIP(0xFE, 0x66),
|
||||
EX_STOP_MOVE_AIR_SHIP(0xFE, 0x67),
|
||||
EX_SHOW_TRACE(0xFE, 0x68),
|
||||
EX_ITEM_AUCTION_INFO(0xFE, 0x69),
|
||||
EX_NEED_TO_CHANGE_NAME(0xFE, 0x6A),
|
||||
EX_PARTY_PET_WINDOW_DELETE(0xFE, 0x6B),
|
||||
EX_TUTORIAL_LIST(0xFE, 0x6C),
|
||||
EX_RP_ITEM_LINK(0xFE, 0x6D),
|
||||
EX_MOVE_TO_LOCATION_IN_AIR_SHIP(0xFE, 0x6E),
|
||||
EX_STOP_MOVE_IN_AIR_SHIP(0xFE, 0x6F),
|
||||
EX_VALIDATE_LOCATION_IN_AIR_SHIP(0xFE, 0x70),
|
||||
EX_UI_SETTING(0xFE, 0x71),
|
||||
EX_MOVE_TO_TARGET_IN_AIR_SHIP(0xFE, 0x72),
|
||||
EX_ATTACK_IN_AIR_SHIP(0xFE, 0x73),
|
||||
EX_MAGIC_SKILL_USE_IN_AIR_SHIP(0xFE, 0x74),
|
||||
EX_SHOW_BASE_ATTRIBUTE_CANCEL_WINDOW(0xFE, 0x75),
|
||||
EX_BASE_ATTRIBUTE_CANCEL_RESULT(0xFE, 0x76),
|
||||
EX_SUB_PLEDGET_SKILL_ADD(0xFE, 0x77),
|
||||
EX_RESPONSE_FREE_SERVER(0xFE, 0x78),
|
||||
EX_SHOW_PROCURE_CROP_DETAIL(0xFE, 0x79),
|
||||
EX_HERO_LIST(0xFE, 0x7A),
|
||||
EX_OLYMPIAD_USER_INFO(0xFE, 0x7B),
|
||||
EX_OLYMPIAD_SPELLED_INFO(0xFE, 0x7C),
|
||||
EX_OLYMPIAD_MODE(0xFE, 0x7D),
|
||||
EX_SHOW_FORTRESS_MAP_INFO(0xFE, 0x7E),
|
||||
EX_PVP_MATCH_RECORD(0xFE, 0x7F),
|
||||
EX_PVP_MATCH_USER_DIE(0xFE, 0x80),
|
||||
EX_PRIVATE_STORE_WHOLE_MSG(0xFE, 0x81),
|
||||
EX_PUT_ENCHANT_TARGET_ITEM_RESULT(0xFE, 0x82),
|
||||
EX_PUT_ENCHANT_SUPPORT_ITEM_RESULT(0xFE, 0x83),
|
||||
EX_CHANGE_NICKNAME_NCOLOR(0xFE, 0x84),
|
||||
EX_GET_BOOK_MARK_INFO(0xFE, 0x85),
|
||||
EX_NOTIFY_PREMIUM_ITEM(0xFE, 0x86),
|
||||
EX_GET_PREMIUM_ITEM_LIST(0xFE, 0x87),
|
||||
EX_PERIODIC_ITEM_LIST(0xFE, 0x88),
|
||||
EX_JUMP_TO_LOCATION(0xFE, 0x89),
|
||||
EX_PVP_MATCH_CCRECORD(0xFE, 0x8A),
|
||||
EX_PVP_MATCH_CCMY_RECORD(0xFE, 0x8B),
|
||||
EX_PVP_MATCH_CCRETIRE(0xFE, 0x8C),
|
||||
EX_SHOW_TERRITORY(0xFE, 0x8D),
|
||||
EX_NPC_QUEST_HTML_MESSAGE(0xFE, 0x8E),
|
||||
EX_SEND_UIEVENT(0xFE, 0x8F),
|
||||
EX_NOTIFY_BIRTH_DAY(0xFE, 0x90),
|
||||
EX_SHOW_DOMINION_REGISTRY(0xFE, 0x91),
|
||||
EX_REPLY_REGISTER_DOMINION(0xFE, 0x92),
|
||||
EX_REPLY_DOMINION_INFO(0xFE, 0x93),
|
||||
EX_SHOW_OWNTHING_POS(0xFE, 0x94),
|
||||
EX_CLEFT_LIST(0xFE, 0x95),
|
||||
EX_CLEFT_STATE(0xFE, 0x96),
|
||||
EX_DOMINION_CHANNEL_SET(0xFE, 0x97),
|
||||
EX_BLOCK_UP_SET_LIST(0xFE, 0x98),
|
||||
EX_BLOCK_UP_SET_STATE(0xFE, 0x99),
|
||||
EX_START_SCENE_PLAYER(0xFE, 0x9A),
|
||||
EX_AIR_SHIP_TELEPORT_LIST(0xFE, 0x9B),
|
||||
EX_MPCC_ROOM_INFO(0xFE, 0x9C),
|
||||
EX_LIST_MPCC_WAITING(0xFE, 0x9D),
|
||||
EX_DISSMISS_MPCC_ROOM(0xFE, 0x9E),
|
||||
EX_MANAGE_MPCC_ROOM_MEMBER(0xFE, 0x9F),
|
||||
EX_MPCC_ROOM_MEMBER(0xFE, 0xA0),
|
||||
EX_VITALITY_POINT_INFO(0xFE, 0xA1),
|
||||
EX_SHOW_SEED_MAP_INFO(0xFE, 0xA2),
|
||||
EX_MPCC_PARTYMASTER_LIST(0xFE, 0xA3),
|
||||
EX_DOMINION_WAR_START(0xFE, 0xA4),
|
||||
EX_DOMINION_WAR_END(0xFE, 0xA5),
|
||||
EX_SHOW_LINES(0xFE, 0xA6),
|
||||
EX_PARTY_MEMBER_RENAMED(0xFE, 0xA7),
|
||||
EX_ENCHANT_SKILL_RESULT(0xFE, 0xA8),
|
||||
EX_REFUND_LIST(0xFE, 0xA9),
|
||||
EX_NOTICE_POST_ARRIVED(0xFE, 0xAA),
|
||||
EX_SHOW_RECEIVED_POST_LIST(0xFE, 0xAB),
|
||||
EX_REPLY_RECEIVED_POST(0xFE, 0xAC),
|
||||
EX_SHOW_SENT_POST_LIST(0xFE, 0xAD),
|
||||
EX_REPLY_SENT_POST(0xFE, 0xAE),
|
||||
EX_RESPONSE_SHOW_STEP_ONE(0xFE, 0xAF),
|
||||
EX_RESPONSE_SHOW_STEP_TWO(0xFE, 0xB0),
|
||||
EX_RESPONSE_SHOW_CONTENTS(0xFE, 0xB1),
|
||||
EX_SHOW_PETITION_HTML(0xFE, 0xB2),
|
||||
EX_REPLY_POST_ITEM_LIST(0xFE, 0xB3),
|
||||
EX_CHANGE_POST_STATE(0xFE, 0xB4),
|
||||
EX_REPLY_WRITE_POST(0xFE, 0xB5),
|
||||
EX_INITIALIZE_SEED(0xFE, 0xB6),
|
||||
EX_RAID_RESERVE_RESULT(0xFE, 0xB7),
|
||||
EX_BUY_SELL_LIST(0xFE, 0xB8),
|
||||
EX_CLOSE_RAID_SOCKET(0xFE, 0xB9),
|
||||
EX_PRIVATE_MARKET_LIST(0xFE, 0xBA),
|
||||
EX_RAID_CHARACTER_SELECTED(0xFE, 0xBB),
|
||||
EX_ASK_COUPLE_ACTION(0xFE, 0xBC),
|
||||
EX_BR_BROADCAST_EVENT_STATE(0xFE, 0xBD),
|
||||
EX_BR_LOAD_EVENT_TOP_RANKERS(0xFE, 0xBE),
|
||||
EX_CHANGE_NPC_STATE(0xFE, 0xBF),
|
||||
EX_ASK_MODIFY_PARTY_LOOTING(0xFE, 0xC0),
|
||||
EX_SET_PARTY_LOOTING(0xFE, 0xC1),
|
||||
EX_ROTATION(0xFE, 0xC2),
|
||||
EX_CHANGE_CLIENT_EFFECT_INFO(0xFE, 0xC3),
|
||||
EX_MEMBERSHIP_INFO(0xFE, 0xC4),
|
||||
EX_REPLY_HAND_OVER_PARTY_MASTER(0xFE, 0xC5),
|
||||
EX_QUEST_NPC_LOG_LIST(0xFE, 0xC6),
|
||||
EX_QUEST_ITEM_LIST(0xFE, 0xC7),
|
||||
EX_GM_VIEW_QUEST_ITEM_LIST(0xFE, 0xC8),
|
||||
EX_RESTART_RESPONSE(0xFE, 0xC9),
|
||||
EX_VOTE_SYSTEM_INFO(0xFE, 0xCA),
|
||||
EX_SHUTTLE_INFO(0xFE, 0xCB),
|
||||
EX_SUTTLE_GET_ON(0xFE, 0xCC),
|
||||
EX_SUTTLE_GET_OFF(0xFE, 0xCD),
|
||||
EX_SUTTLE_MOVE(0xFE, 0xCE),
|
||||
EX_MOVE_TO_LOCATION_IN_SUTTLE(0xFE, 0xCF),
|
||||
EX_STOP_MOVE_IN_SHUTTLE(0xFE, 0xD0),
|
||||
EX_VALIDATE_LOCATION_IN_SHUTTLE(0xFE, 0xD1),
|
||||
EX_AGIT_AUCTION_CMD(0xFE, 0xD2),
|
||||
EX_CONFIRM_ADDING_POST_FRIEND(0xFE, 0xD3),
|
||||
EX_RECEIVE_SHOW_POST_FRIEND(0xFE, 0xD4),
|
||||
EX_RECEIVE_OLYMPIAD(0xFE, 0xD5),
|
||||
EX_BR_GAME_POINT(0xFE, 0xD6),
|
||||
EX_BR_PRODUCT_LIST(0xFE, 0xD7),
|
||||
EX_BR_PRODUCT_INFO(0xFE, 0xD8),
|
||||
EX_BR_BUY_PRODUCT(0xFE, 0xD9),
|
||||
EX_BR_PREMIUM_STATE(0xFE, 0xDA),
|
||||
EX_BR_EXTRA_USER_INFO(0xFE, 0xDB),
|
||||
EX_BR_BUFF_EVENT_STATE(0xFE, 0xDC),
|
||||
EX_BR_RECENT_PRODUCT_LIST(0xFE, 0xDD),
|
||||
EX_BR_MINIGAME_LOAD_SCORES(0xFE, 0xDE),
|
||||
EX_BR_AGATHION_ENERGY_INFO(0xFE, 0xDF),
|
||||
EX_SHOW_CHANNELING_EFFECT(0xFE, 0xE0),
|
||||
EX_GET_CRYSTALIZING_ESTIMATION(0xFE, 0xE1),
|
||||
EX_GET_CRYSTALIZING_FAIL(0xFE, 0xE2),
|
||||
EX_NAVIT_ADVENT_POINT_INFO(0xFE, 0xE3),
|
||||
EX_NAVIT_ADVENT_EFFECT(0xFE, 0xE4),
|
||||
EX_NAVIT_ADVENT_TIME_CHANGE(0xFE, 0xE5),
|
||||
EX_ABNORMAL_STATUS_UPDATE_FROM_TARGET(0xFE, 0xE6),
|
||||
EX_STOP_SCENE_PLAYER(0xFE, 0xE7),
|
||||
EX_FLY_MOVE(0xFE, 0xE8),
|
||||
EX_DYNAMIC_QUEST(0xFE, 0xE9),
|
||||
EX_SUBJOB_INFO(0xFE, 0xEA),
|
||||
EX_CHANGE_MPCOST(0xFE, 0xEB),
|
||||
EX_FRIEND_DETAIL_INFO(0xFE, 0xEC),
|
||||
EX_BLOCK_ADD_RESULT(0xFE, 0xED),
|
||||
EX_BLOCK_REMOVE_RESULT(0xFE, 0xEE),
|
||||
EX_BLOCK_DEFAIL_INFO(0xFE, 0xEF),
|
||||
EX_LOAD_INZONE_PARTY_HISTORY(0xFE, 0xF0),
|
||||
EX_FRIEND_NOTIFY_NAME_CHANGE(0xFE, 0xF1),
|
||||
EX_SHOW_COMMISSION(0xFE, 0xF2),
|
||||
EX_RESPONSE_COMMISSION_ITEM_LIST(0xFE, 0xF3),
|
||||
EX_RESPONSE_COMMISSION_INFO(0xFE, 0xF4),
|
||||
EX_RESPONSE_COMMISSION_REGISTER(0xFE, 0xF5),
|
||||
EX_RESPONSE_COMMISSION_DELETE(0xFE, 0xF6),
|
||||
EX_RESPONSE_COMMISSION_LIST(0xFE, 0xF7),
|
||||
EX_RESPONSE_COMMISSION_BUY_INFO(0xFE, 0xF8),
|
||||
EX_RESPONSE_COMMISSION_BUY_ITEM(0xFE, 0xF9),
|
||||
EX_ACQUIRABLE_SKILL_LIST_BY_CLASS(0xFE, 0xFA),
|
||||
EX_MAGIC_ATTACK_INFO(0xFE, 0xFB),
|
||||
EX_ACQUIRE_SKILL_INFO(0xFE, 0xFC),
|
||||
EX_NEW_SKILL_TO_LEARN_BY_LEVEL_UP(0xFE, 0xFD),
|
||||
EX_CALL_TO_CHANGE_CLASS(0xFE, 0xFE),
|
||||
EX_CHANGE_TO_AWAKENED_CLASS(0xFE, 0xFF),
|
||||
EX_TACTICAL_SIGN(0xFE, 0x100),
|
||||
EX_LOAD_STAT_WORLD_RANK(0xFE, 0x101),
|
||||
EX_LOAD_STAT_USER(0xFE, 0x102),
|
||||
EX_LOAD_STAT_HOT_LINK(0xFE, 0x103),
|
||||
EX_GET_WEB_SESSION_ID(0xFE, 0x104),
|
||||
EX_2ND_PASSWORD_CHECK(0xFE, 0x105),
|
||||
EX_2ND_PASSWORD_VERIFY(0xFE, 0x106),
|
||||
EX_2ND_PASSWORD_ACK(0xFE, 0x107),
|
||||
EX_FLY_MOVE_BROADCAST(0xFE, 0x108),
|
||||
EX_SHOW_USM(0xFE, 0x109),
|
||||
EX_SHOW_STAT_PAGE(0xFE, 0x10A),
|
||||
EX_IS_CHAR_NAME_CREATABLE(0xFE, 0x10B),
|
||||
EX_GOODS_INVENTORY_CHANGED_NOTI(0xFE, 0x10C),
|
||||
EX_GOODS_INVENTORY_INFO(0xFE, 0x10D),
|
||||
EX_GOODS_INVENTORY_RESULT(0xFE, 0x10E),
|
||||
EX_ALTER_SKILL_REQUEST(0xFE, 0x10F),
|
||||
EX_NOTIFY_FLY_MOVE_START(0xFE, 0x110),
|
||||
EX_DUMMY2(0xFE, 0x111),
|
||||
EX_CLOSE_COMMISSION(0xFE, 0x112),
|
||||
EX_CHANGE_ATTRIBUTE_ITEM_LIST(0xFE, 0x113),
|
||||
EX_CHANGE_ATTRIBUTE_INFO(0xFE, 0x114),
|
||||
EX_CHANGE_ATTRIBUTE_OK(0xFE, 0x115),
|
||||
EX_CHANGE_ATTRIBUTE_FAIL(0xFE, 0x116),
|
||||
EX_LIGHTING_CANDLE_EVENT(0xFE, 0x117),
|
||||
EX_VITALITY_EFFECT_INFO(0xFE, 0x118),
|
||||
EX_LOGIN_VITALITY_EFFECT_INFO(0xFE, 0x119),
|
||||
EX_BR_PRESENT_BUY_PRODUCT(0xFE, 0x11A),
|
||||
EX_MENTOR_LIST(0xFE, 0x11B),
|
||||
EX_MENTOR_ADD(0xFE, 0x11C),
|
||||
LIST_MENTEE_WAITING(0xFE, 0x11D),
|
||||
EX_INZONE_WAITING_INFO(0xFE, 0x11E),
|
||||
EX_CURIOUS_HOUSE_STATE(0xFE, 0x11F),
|
||||
EX_CURIOUS_HOUSE_ENTER(0xFE, 0x120),
|
||||
EX_CURIOUS_HOUSE_LEAVE(0xFE, 0x121),
|
||||
EX_CURIOUS_HOUSE_MEMBER_LIST(0xFE, 0x122),
|
||||
EX_CURIOUS_HOUSE_MEMBER_UPDATE(0xFE, 0x123),
|
||||
EX_CURIOUS_HOUSE_REMAIN_TIME(0xFE, 0x124),
|
||||
EX_CURIOUS_HOUSE_RESULT(0xFE, 0x125),
|
||||
EX_CURIOUS_HOUSE_OBSERVE_LIST(0xFE, 0x126),
|
||||
EX_CURIOUS_HOUSE_OBSERVE_MODE(0xFE, 0x127),
|
||||
EX_SYSSTRING(0xFE, 0x128),
|
||||
EX_CHOOSE_SHAPE_SHIFTING_ITEM(0xFE, 0x129),
|
||||
EX_PUT_SHAPE_SHIFTING_TARGET_ITEM_RESULT(0xFE, 0x12A),
|
||||
EX_PUT_SHAPE_SHIFTING_EXTRACTION_ITEM_RESULT(0xFE, 0x12B),
|
||||
EX_SHAPE_SHIFTING_RESULT(0xFE, 0x12C),
|
||||
EX_CASTLE_STATE(0xFE, 0x12D),
|
||||
EX_NCGUARD_RECEIVE_DATA_FROM_SERVER(0xFE, 0x12E),
|
||||
EX_KALIE_EVENT(0xFE, 0x12F),
|
||||
EX_KALIE_EVENT_JACKPOT_USER(0xFE, 0x130),
|
||||
EX_ABNORMAL_VISUAL_EFFECT_INFO(0xFE, 0x131),
|
||||
EX_NPC_INFO_SPEED(0xFE, 0x132),
|
||||
EX_SET_PLEDGE_EMBLEM_ACK(0xFE, 0x133),
|
||||
EX_SHOW_BEAUTY_MENU(0xFE, 0x134),
|
||||
EX_RESPONSE_BEAUTY_LIST(0xFE, 0x135),
|
||||
EX_RESPONSE_BEAUTY_REGIST_RESET(0xFE, 0x136),
|
||||
EX_RESPONSE_RESET_LIST(0xFE, 0x137),
|
||||
EX_SHUFFLE_SEED_AND_PUBLIC_KEY(0xFE, 0x138),
|
||||
EX_CHECK_SPEED_HACK(0xFE, 0x139),
|
||||
EX_BR_NEW_ICON_CASH_BTN_WND(0xFE, 0x13A),
|
||||
EX_EVENT_CAMPAIGN_INFO(0xFE, 0x13B),
|
||||
EX_UN_READ_MAIL_COUNT(0xFE, 0x13C),
|
||||
EX_PLEDGE_COUNT(0xFE, 0x13D),
|
||||
EX_ADENA_INVEN_COUNT(0xFE, 0x13E),
|
||||
EX_PLEDGE_RECRUIT_INFO(0xFE, 0x13F),
|
||||
EX_PLEDGE_RECRUIT_APPLY_INFO(0xFE, 0x140),
|
||||
EX_PLEDGE_RECRUIT_BOARD_SEARCH(0xFE, 0x141),
|
||||
EX_PLEDGE_RECRUIT_BOARD_DETAIL(0xFE, 0x142),
|
||||
EX_PLEDGE_WAITING_LIST_APPLIED(0xFE, 0x143),
|
||||
EX_PLEDGE_WAITING_LIST(0xFE, 0x144),
|
||||
EX_PLEDGE_WAITING_USER(0xFE, 0x145),
|
||||
EX_PLEDGE_DRAFT_LIST_SEARCH(0xFE, 0x146),
|
||||
EX_PLEDGE_WAITING_LIST_ALARM(0xFE, 0x147),
|
||||
EX_VALIDATE_ACTIVE_CHARACTER(0xFE, 0x148),
|
||||
EX_CLOSE_COMMISSION_REGISTER(0xFE, 0x149),
|
||||
EX_TELEPORT_TO_LOCATION_ACTIVATE(0xFE, 0x14A),
|
||||
EX_NOTIFY_WEB_PETITION_REPLY_ALARM(0xFE, 0x14B),
|
||||
EX_EVENT_SHOW_XMAS_WISH_CARD(0xFE, 0x14C),
|
||||
EX_INVITATION_EVENT_UI_SETTING(0xFE, 0x14D),
|
||||
EX_INVITATION_EVENT_INK_ENERGY(0xFE, 0x14E),
|
||||
EX_CHECK_ABUSING(0xFE, 0x14F),
|
||||
EX_GMVITALITY_EFFECT_INFO(0xFE, 0x150),
|
||||
EX_PATH_TO_AWAKENING_ALARM(0xFE, 0x151),
|
||||
EX_PUT_ENCHANT_SCROLL_ITEM_RESULT(0xFE, 0x152),
|
||||
EX_REMOVE_ENCHANT_SUPPORT_ITEM_RESULT(0xFE, 0x153),
|
||||
EX_SHOW_CARD_REWARD_LIST(0xFE, 0x154),
|
||||
EX_GM_VIEW_CHARACTER_INFO(0xFE, 0x155),
|
||||
EX_USER_INFO_EQUIP_SLOT(0xFE, 0x156),
|
||||
EX_USER_INFO_CUBIC(0xFE, 0x157),
|
||||
EX_USER_INFO_ABNORMAL_VISUAL_EFFECT(0xFE, 0x158),
|
||||
EX_USER_INFO_FISHING(0xFE, 0x159),
|
||||
EX_PARTY_SPELLED_INFO_UPDATE(0xFE, 0x15A),
|
||||
EX_DIVIDE_ADENA_START(0xFE, 0x15B),
|
||||
EX_DIVIDE_ADENA_CANCEL(0xFE, 0x15C),
|
||||
EX_DIVIDE_ADENA_DONE(0xFE, 0x15D),
|
||||
EX_PET_INFO(0xFE, 0x15E),
|
||||
EX_ACQUIRE_AP_SKILL_LIST(0xFE, 0x15F),
|
||||
EX_START_LUCKY_GAME(0xFE, 0x160),
|
||||
EX_BETTING_LUCKY_GAME_RESULT(0xFE, 0x161),
|
||||
EX_TRAINING_ZONE_ADMISSION(0xFE, 0x162),
|
||||
EX_TRAINING_ZONE_LEAVING(0xFE, 0x163),
|
||||
EX_PERIODIC_HENNA(0xFE, 0x164),
|
||||
EX_SHOW_AP_LIST_WND(0xFE, 0x165),
|
||||
EX_USER_INFO_INVEN_WEIGHT(0xFE, 0x166),
|
||||
EX_CLOSE_AP_LIST_WND(0xFE, 0x167),
|
||||
EX_ENCHANT_ONE_OK(0xFE, 0x168),
|
||||
EX_ENCHANT_ONE_FAIL(0xFE, 0x169),
|
||||
EX_ENCHANT_ONE_REMOVE_OK(0xFE, 0x16A),
|
||||
EX_ENCHANT_ONE_REMOVE_FAIL(0xFE, 0x16B),
|
||||
EX_ENCHANT_TWO_OK(0xFE, 0x16C),
|
||||
EX_ENCHANT_TWO_FAIL(0xFE, 0x16D),
|
||||
EX_ENCHANT_TWO_REMOVE_OK(0xFE, 0x16E),
|
||||
EX_ENCHANT_TWO_REMOVE_FAIL(0xFE, 0x16F),
|
||||
EX_ENCHANT_SUCESS(0xFE, 0x170),
|
||||
EX_ENCHANT_FAIL(0xFE, 0x171),
|
||||
EX_ACCOUNT_ATTENDANCE_INFO(0xFE, 0x172),
|
||||
EX_WORLD_CHAT_CNT(0xFE, 0x173),
|
||||
EX_ALCHEMY_SKILL_LIST(0xFE, 0x174),
|
||||
EX_TRY_MIX_CUBE(0xFE, 0x175),
|
||||
EX_ALCHEMY_CONVERSION(0xFE, 0x176),
|
||||
EX_BEAUTY_ITEM_LIST(0xFE, 0x177),
|
||||
EX_RECEIVE_CLIENT_INI(0xFE, 0x178),
|
||||
EX_AUTO_FISH_AVAILABLE(0xFE, 0x179),
|
||||
EX_CHANNEL_CHAT_ENTER_WORLD(0xFE, 0x17A),
|
||||
EX_CHANNEL_CHAT_PLEGE_INFO(0xFE, 0x17B),
|
||||
EX_VIP_ATTENDANCE_ITEM_LIST(0xFE, 0x17C),
|
||||
EX_CONFIRM_VIP_ATTENDANCE_CHECK(0xFE, 0x17D),
|
||||
EX_SHOW_ENSOUL_WINDOW(0xFE, 0x17E),
|
||||
EX_ENSOUL_RESULT(0xFE, 0x17F),
|
||||
RECIVE_VIP_PRODUCT_LIST(0xFE, 0x180),
|
||||
RECIVE_VIP_LUCKY_GAME_INFO(0xFE, 0x181),
|
||||
RECIVE_VIP_LUCKY_GAME_ITEM_LIST(0xFE, 0x182),
|
||||
RECIVE_VIP_LUCKY_GAME_RESULT(0xFE, 0x183),
|
||||
RECIVE_VIP_INFO(0xFE, 0x184),
|
||||
RECIVE_VIP_INFO_REMAIN_TIME(0xFE, 0x185),
|
||||
RECEIVE_VIP_BOT_CAPTCHA_IMAGE(0xFE, 0x186),
|
||||
RECEIVE_VIP_BOT_CAPTCHA_ANSWER_RESULT(0xFE, 0x187),
|
||||
EX_ONE_DAY_RECEIVE_REWARD_LIST(0xFE, 0x188),
|
||||
EX_CONNECTED_TIME_AND_GETTABLE_REWARD(0xFE, 0x189),
|
||||
EX_TODO_LIST_RECOMMAND(0xFE, 0x18A),
|
||||
EX_TODO_LIST_INZONE(0xFE, 0x18B),
|
||||
EX_TODO_LIST_HTML(0xFE, 0x18C),
|
||||
EX_PLEDGE_BONUS_OPEN(0xFE, 0x18D),
|
||||
EX_PLEDGE_BONUS_LIST(0xFE, 0x18E),
|
||||
EX_PLEDGE_BONUS_MARK_RESET(0xFE, 0x18F),
|
||||
EX_PLEDGE_BONUS_UPDATE(0xFE, 0x190),
|
||||
EX_SSO_AUTH_TOKEN(0xFE, 0x191);
|
||||
|
||||
private final int _id1;
|
||||
private final int _id2;
|
||||
|
||||
OutgoingPackets(int id1)
|
||||
{
|
||||
this(id1, -1);
|
||||
}
|
||||
|
||||
OutgoingPackets(int id1, int id2)
|
||||
{
|
||||
_id1 = id1;
|
||||
_id2 = id2;
|
||||
}
|
||||
|
||||
public int getId1()
|
||||
{
|
||||
return _id1;
|
||||
}
|
||||
|
||||
public int getId2()
|
||||
{
|
||||
return _id2;
|
||||
}
|
||||
|
||||
public void writeId(PacketWriter packet)
|
||||
{
|
||||
packet.writeC(_id1);
|
||||
if (_id2 > 0)
|
||||
{
|
||||
packet.writeH(_id2);
|
||||
}
|
||||
}
|
||||
|
||||
public static OutgoingPackets getPacket(int id1, int id2)
|
||||
{
|
||||
for (OutgoingPackets packet : values())
|
||||
{
|
||||
if ((packet.getId1() == id1) && (packet.getId2() == id2))
|
||||
{
|
||||
return packet;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+514
-635
File diff suppressed because it is too large
Load Diff
@@ -1,184 +1,165 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.enums.DuelState;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.PcCondOverride;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jmobius.gameserver.model.skills.AbnormalType;
|
||||
import com.l2jmobius.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
public final class Action extends L2GameClientPacket
|
||||
{
|
||||
private static final String __C__1F_ACTION = "[C] 1F Action";
|
||||
|
||||
private int _objectId;
|
||||
private int _originX;
|
||||
private int _originY;
|
||||
private int _originZ;
|
||||
private int _actionId;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_objectId = readD(); // Target object Identifier
|
||||
_originX = readD();
|
||||
_originY = readD();
|
||||
_originZ = readD();
|
||||
_actionId = readC(); // Action identifier : 0-Simple click, 1-Shift click
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
_log.info(getType() + ": " + (_actionId == 0 ? "Simple-click" : "Shift-click") + " Target object ID: " + _objectId + " orignX: " + _originX + " orignY: " + _originY + " orignZ: " + _originZ);
|
||||
}
|
||||
|
||||
// Get the current L2PcInstance of the player
|
||||
final L2PcInstance activeChar = getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeChar.inObserverMode())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.OBSERVERS_CANNOT_PARTICIPATE);
|
||||
sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
final BuffInfo info = activeChar.getEffectList().getBuffInfoByAbnormalType(AbnormalType.BOT_PENALTY);
|
||||
if (info != null)
|
||||
{
|
||||
for (AbstractEffect effect : info.getEffects())
|
||||
{
|
||||
if (!effect.checkCondition(-4))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_HAVE_BEEN_REPORTED_AS_AN_ILLEGAL_PROGRAM_USER_SO_YOUR_ACTIONS_HAVE_BEEN_RESTRICTED);
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final L2Object obj;
|
||||
if (activeChar.getTargetId() == _objectId)
|
||||
{
|
||||
obj = activeChar.getTarget();
|
||||
}
|
||||
else if (activeChar.isInAirShip() && (activeChar.getAirShip().getHelmObjectId() == _objectId))
|
||||
{
|
||||
obj = activeChar.getAirShip();
|
||||
}
|
||||
else
|
||||
{
|
||||
obj = L2World.getInstance().findObject(_objectId);
|
||||
}
|
||||
|
||||
// If object requested does not exist, add warn msg into logs
|
||||
if (obj == null)
|
||||
{
|
||||
// pressing e.g. pickup many times quickly would get you here
|
||||
sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
if (obj.isPlayable() && (obj.getActingPlayer().getDuelState() == DuelState.DEAD))
|
||||
{
|
||||
sendPacket(ActionFailed.STATIC_PACKET);
|
||||
activeChar.getActingPlayer().sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_OTHER_PARTY_IS_FROZEN_PLEASE_WAIT_A_MOMENT));
|
||||
return;
|
||||
}
|
||||
if (!obj.isTargetable() && !activeChar.canOverrideCond(PcCondOverride.TARGET_ALL))
|
||||
{
|
||||
sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
// Players can't interact with objects in the other instances, except from multiverse
|
||||
if ((obj.getInstanceId() != activeChar.getInstanceId()) && (activeChar.getInstanceId() != -1))
|
||||
{
|
||||
sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
// Only GMs can directly interact with invisible characters
|
||||
if (!obj.isVisibleFor(activeChar))
|
||||
{
|
||||
sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the target is valid, if the player haven't a shop or isn't the requester of a transaction (ex : FriendInvite, JoinAlly, JoinParty...)
|
||||
if (activeChar.getActiveRequester() != null)
|
||||
{
|
||||
// Actions prohibited when in trade
|
||||
sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (_actionId)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
obj.onAction(activeChar);
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
if (!activeChar.isGM() && (!obj.isNpc() || !Config.ALT_GAME_VIEWNPC))
|
||||
{
|
||||
obj.onAction(activeChar, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
obj.onActionShift(activeChar);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
// Invalid action detected (probably client cheating), log this
|
||||
_log.warning(getType() + ": Character: " + activeChar.getName() + " requested invalid action: " + _actionId);
|
||||
sendPacket(ActionFailed.STATIC_PACKET);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean triggersOnActionRequest()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return __C__1F_ACTION;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.PcCondOverride;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jmobius.gameserver.model.skills.AbnormalType;
|
||||
import com.l2jmobius.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
|
||||
public final class Action implements IClientIncomingPacket
|
||||
{
|
||||
private int _objectId;
|
||||
private int _originX;
|
||||
private int _originY;
|
||||
private int _originZ;
|
||||
private int _actionId;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_objectId = packet.readD(); // Target object Identifier
|
||||
_originX = packet.readD();
|
||||
_originY = packet.readD();
|
||||
_originZ = packet.readD();
|
||||
_actionId = packet.readC(); // Action identifier : 0-Simple click, 1-Shift click
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
_log.info(getClass().getSimpleName() + ": " + (_actionId == 0 ? "Simple-click" : "Shift-click") + " Target object ID: " + _objectId + " orignX: " + _originX + " orignY: " + _originY + " orignZ: " + _originZ);
|
||||
}
|
||||
|
||||
// Get the current L2PcInstance of the player
|
||||
final L2PcInstance activeChar = client.getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeChar.inObserverMode())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.OBSERVERS_CANNOT_PARTICIPATE);
|
||||
client.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
final BuffInfo info = activeChar.getEffectList().getBuffInfoByAbnormalType(AbnormalType.BOT_PENALTY);
|
||||
if (info != null)
|
||||
{
|
||||
for (AbstractEffect effect : info.getEffects())
|
||||
{
|
||||
if (!effect.checkCondition(-4))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_HAVE_BEEN_REPORTED_AS_AN_ILLEGAL_PROGRAM_USER_SO_YOUR_ACTIONS_HAVE_BEEN_RESTRICTED);
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final L2Object obj;
|
||||
if (activeChar.getTargetId() == _objectId)
|
||||
{
|
||||
obj = activeChar.getTarget();
|
||||
}
|
||||
else if (activeChar.isInAirShip() && (activeChar.getAirShip().getHelmObjectId() == _objectId))
|
||||
{
|
||||
obj = activeChar.getAirShip();
|
||||
}
|
||||
else
|
||||
{
|
||||
obj = L2World.getInstance().findObject(_objectId);
|
||||
}
|
||||
|
||||
// If object requested does not exist, add warn msg into logs
|
||||
if (obj == null)
|
||||
{
|
||||
// pressing e.g. pickup many times quickly would get you here
|
||||
client.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((!obj.isTargetable() || activeChar.isTargetingDisabled()) && !activeChar.canOverrideCond(PcCondOverride.TARGET_ALL))
|
||||
{
|
||||
client.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
// Players can't interact with objects in the other instances
|
||||
if (obj.getInstanceWorld() != activeChar.getInstanceWorld())
|
||||
{
|
||||
client.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
// Only GMs can directly interact with invisible characters
|
||||
if (!obj.isVisibleFor(activeChar))
|
||||
{
|
||||
client.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the target is valid, if the player haven't a shop or isn't the requester of a transaction (ex : FriendInvite, JoinAlly, JoinParty...)
|
||||
if (activeChar.getActiveRequester() != null)
|
||||
{
|
||||
// Actions prohibited when in trade
|
||||
client.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (_actionId)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
obj.onAction(activeChar);
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
if (!activeChar.isGM() && !(obj.isNpc() && Config.ALT_GAME_VIEWNPC))
|
||||
{
|
||||
obj.onAction(activeChar, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
obj.onActionShift(activeChar);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
// Invalid action detected (probably client cheating), log this
|
||||
_log.warning(getClass().getSimpleName() + ": Character: " + activeChar.getName() + " requested invalid action: " + _actionId);
|
||||
client.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,110 +1,105 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.TradeItem;
|
||||
import com.l2jmobius.gameserver.model.TradeList;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.TradeOtherAdd;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.TradeOwnAdd;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.TradeUpdate;
|
||||
|
||||
/**
|
||||
* This class ...
|
||||
* @version $Revision: 1.5.2.2.2.5 $ $Date: 2005/03/27 15:29:29 $
|
||||
*/
|
||||
public final class AddTradeItem extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__1B_ADDTRADEITEM = "[C] 1B AddTradeItem";
|
||||
|
||||
private int _tradeId;
|
||||
private int _objectId;
|
||||
private long _count;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_tradeId = readD();
|
||||
_objectId = readD();
|
||||
_count = readQ();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance player = getClient().getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final TradeList trade = player.getActiveTradeList();
|
||||
if (trade == null)
|
||||
{
|
||||
_log.warning("Character: " + player.getName() + " requested item:" + _objectId + " add without active tradelist:" + _tradeId);
|
||||
return;
|
||||
}
|
||||
|
||||
final L2PcInstance partner = trade.getPartner();
|
||||
if ((partner == null) || (L2World.getInstance().getPlayer(partner.getObjectId()) == null) || (partner.getActiveTradeList() == null))
|
||||
{
|
||||
// Trade partner not found, cancel trade
|
||||
if (partner != null)
|
||||
{
|
||||
_log.warning("Character:" + player.getName() + " requested invalid trade object: " + _objectId);
|
||||
}
|
||||
player.sendPacket(SystemMessageId.THAT_PLAYER_IS_NOT_ONLINE);
|
||||
player.cancelActiveTrade();
|
||||
return;
|
||||
}
|
||||
|
||||
if (trade.isConfirmed() || partner.getActiveTradeList().isConfirmed())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_MAY_NO_LONGER_ADJUST_ITEMS_IN_THE_TRADE_BECAUSE_THE_TRADE_HAS_BEEN_CONFIRMED);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!player.getAccessLevel().allowTransaction())
|
||||
{
|
||||
player.sendMessage("Transactions are disabled for your Access Level.");
|
||||
player.cancelActiveTrade();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!player.validateItemManipulation(_objectId, "trade"))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.NOTHING_HAPPENED);
|
||||
return;
|
||||
}
|
||||
|
||||
final TradeItem item = trade.addItem(_objectId, _count);
|
||||
if (item != null)
|
||||
{
|
||||
player.sendPacket(new TradeOwnAdd(item));
|
||||
player.sendPacket(new TradeUpdate(player, item));
|
||||
partner.sendPacket(new TradeOtherAdd(item));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__1B_ADDTRADEITEM;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.TradeItem;
|
||||
import com.l2jmobius.gameserver.model.TradeList;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.TradeOtherAdd;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.TradeOwnAdd;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.TradeUpdate;
|
||||
|
||||
/**
|
||||
* This class ...
|
||||
* @version $Revision: 1.5.2.2.2.5 $ $Date: 2005/03/27 15:29:29 $
|
||||
*/
|
||||
public final class AddTradeItem implements IClientIncomingPacket
|
||||
{
|
||||
private int _tradeId;
|
||||
private int _objectId;
|
||||
private long _count;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_tradeId = packet.readD();
|
||||
_objectId = packet.readD();
|
||||
_count = packet.readQ();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final L2PcInstance player = client.getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final TradeList trade = player.getActiveTradeList();
|
||||
if (trade == null)
|
||||
{
|
||||
_log.warning("Character: " + player.getName() + " requested item:" + _objectId + " add without active tradelist:" + _tradeId);
|
||||
return;
|
||||
}
|
||||
|
||||
final L2PcInstance partner = trade.getPartner();
|
||||
if ((partner == null) || (L2World.getInstance().getPlayer(partner.getObjectId()) == null) || (partner.getActiveTradeList() == null))
|
||||
{
|
||||
// Trade partner not found, cancel trade
|
||||
if (partner != null)
|
||||
{
|
||||
_log.warning("Character:" + player.getName() + " requested invalid trade object: " + _objectId);
|
||||
}
|
||||
player.sendPacket(SystemMessageId.THAT_PLAYER_IS_NOT_ONLINE);
|
||||
player.cancelActiveTrade();
|
||||
return;
|
||||
}
|
||||
|
||||
if (trade.isConfirmed() || partner.getActiveTradeList().isConfirmed())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_MAY_NO_LONGER_ADJUST_ITEMS_IN_THE_TRADE_BECAUSE_THE_TRADE_HAS_BEEN_CONFIRMED);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!player.getAccessLevel().allowTransaction())
|
||||
{
|
||||
player.sendMessage("Transactions are disabled for your Access Level.");
|
||||
player.cancelActiveTrade();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!player.validateItemManipulation(_objectId, "trade"))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.NOTHING_HAPPENED);
|
||||
return;
|
||||
}
|
||||
|
||||
final TradeItem item = trade.addItem(_objectId, _count);
|
||||
if (item != null)
|
||||
{
|
||||
player.sendPacket(new TradeOwnAdd(item));
|
||||
player.sendPacket(new TradeUpdate(player, item));
|
||||
partner.sendPacket(new TradeOtherAdd(item));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,100 +1,96 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.data.sql.impl.ClanTable;
|
||||
import com.l2jmobius.gameserver.model.L2Clan;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
public final class AllyDismiss extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__8F_ALLYDISMISS = "[C] 8F AllyDismiss";
|
||||
|
||||
private String _clanName;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_clanName = readS();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
if (_clanName == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
final L2PcInstance player = getClient().getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (player.getClan() == null)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_ARE_NOT_A_CLAN_MEMBER_AND_CANNOT_PERFORM_THIS_ACTION);
|
||||
return;
|
||||
}
|
||||
final L2Clan leaderClan = player.getClan();
|
||||
if (leaderClan.getAllyId() == 0)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_ARE_NOT_CURRENTLY_ALLIED_WITH_ANY_CLANS);
|
||||
return;
|
||||
}
|
||||
if (!player.isClanLeader() || (leaderClan.getId() != leaderClan.getAllyId()))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.THIS_FEATURE_IS_ONLY_AVAILABLE_TO_ALLIANCE_LEADERS);
|
||||
return;
|
||||
}
|
||||
final L2Clan clan = ClanTable.getInstance().getClanByName(_clanName);
|
||||
if (clan == null)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.THAT_CLAN_DOES_NOT_EXIST);
|
||||
return;
|
||||
}
|
||||
if (clan.getId() == leaderClan.getId())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.ALLIANCE_LEADERS_CANNOT_WITHDRAW);
|
||||
return;
|
||||
}
|
||||
if (clan.getAllyId() != leaderClan.getAllyId())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.DIFFERENT_ALLIANCE);
|
||||
return;
|
||||
}
|
||||
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
leaderClan.setAllyPenaltyExpiryTime(currentTime + (Config.ALT_ACCEPT_CLAN_DAYS_WHEN_DISMISSED * 86400000L), L2Clan.PENALTY_TYPE_DISMISS_CLAN); // 24*60*60*1000 = 86400000
|
||||
leaderClan.updateClanInDB();
|
||||
|
||||
clan.setAllyId(0);
|
||||
clan.setAllyName(null);
|
||||
clan.changeAllyCrest(0, true);
|
||||
clan.setAllyPenaltyExpiryTime(currentTime + (Config.ALT_ALLY_JOIN_DAYS_WHEN_DISMISSED * 86400000L), L2Clan.PENALTY_TYPE_CLAN_DISMISSED); // 24*60*60*1000 = 86400000
|
||||
clan.updateClanInDB();
|
||||
|
||||
player.sendPacket(SystemMessageId.YOU_HAVE_SUCCEEDED_IN_EXPELLING_THE_CLAN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__8F_ALLYDISMISS;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.data.sql.impl.ClanTable;
|
||||
import com.l2jmobius.gameserver.model.L2Clan;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
|
||||
public final class AllyDismiss implements IClientIncomingPacket
|
||||
{
|
||||
private String _clanName;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_clanName = packet.readS();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
if (_clanName == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2PcInstance player = client.getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (player.getClan() == null)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_ARE_NOT_A_CLAN_MEMBER_AND_CANNOT_PERFORM_THIS_ACTION);
|
||||
return;
|
||||
}
|
||||
final L2Clan leaderClan = player.getClan();
|
||||
if (leaderClan.getAllyId() == 0)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_ARE_NOT_CURRENTLY_ALLIED_WITH_ANY_CLANS);
|
||||
return;
|
||||
}
|
||||
if (!player.isClanLeader() || (leaderClan.getId() != leaderClan.getAllyId()))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.THIS_FEATURE_IS_ONLY_AVAILABLE_TO_ALLIANCE_LEADERS);
|
||||
return;
|
||||
}
|
||||
final L2Clan clan = ClanTable.getInstance().getClanByName(_clanName);
|
||||
if (clan == null)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.THAT_CLAN_DOES_NOT_EXIST);
|
||||
return;
|
||||
}
|
||||
if (clan.getId() == leaderClan.getId())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.ALLIANCE_LEADERS_CANNOT_WITHDRAW);
|
||||
return;
|
||||
}
|
||||
if (clan.getAllyId() != leaderClan.getAllyId())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.DIFFERENT_ALLIANCE);
|
||||
return;
|
||||
}
|
||||
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
leaderClan.setAllyPenaltyExpiryTime(currentTime + (Config.ALT_ACCEPT_CLAN_DAYS_WHEN_DISMISSED * 86400000L), L2Clan.PENALTY_TYPE_DISMISS_CLAN); // 24*60*60*1000 = 86400000
|
||||
leaderClan.updateClanInDB();
|
||||
|
||||
clan.setAllyId(0);
|
||||
clan.setAllyName(null);
|
||||
clan.changeAllyCrest(0, true);
|
||||
clan.setAllyPenaltyExpiryTime(currentTime + (Config.ALT_ALLY_JOIN_DAYS_WHEN_DISMISSED * 86400000L), L2Clan.PENALTY_TYPE_CLAN_DISMISSED); // 24*60*60*1000 = 86400000
|
||||
clan.updateClanInDB();
|
||||
|
||||
player.sendPacket(SystemMessageId.YOU_HAVE_SUCCEEDED_IN_EXPELLING_THE_CLAN);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,78 +1,74 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.model.L2Clan;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
public final class AllyLeave extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__8E_ALLYLEAVE = "[C] 8E AllyLeave";
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance player = getClient().getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (player.getClan() == null)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_ARE_NOT_A_CLAN_MEMBER_AND_CANNOT_PERFORM_THIS_ACTION);
|
||||
return;
|
||||
}
|
||||
if (!player.isClanLeader())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.ONLY_THE_CLAN_LEADER_MAY_APPLY_FOR_WITHDRAWAL_FROM_THE_ALLIANCE);
|
||||
return;
|
||||
}
|
||||
final L2Clan clan = player.getClan();
|
||||
if (clan.getAllyId() == 0)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_ARE_NOT_CURRENTLY_ALLIED_WITH_ANY_CLANS);
|
||||
return;
|
||||
}
|
||||
if (clan.getId() == clan.getAllyId())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.ALLIANCE_LEADERS_CANNOT_WITHDRAW);
|
||||
return;
|
||||
}
|
||||
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
clan.setAllyId(0);
|
||||
clan.setAllyName(null);
|
||||
clan.changeAllyCrest(0, true);
|
||||
clan.setAllyPenaltyExpiryTime(currentTime + (Config.ALT_ALLY_JOIN_DAYS_WHEN_LEAVED * 86400000L), L2Clan.PENALTY_TYPE_CLAN_LEAVED); // 24*60*60*1000 = 86400000
|
||||
clan.updateClanInDB();
|
||||
|
||||
player.sendPacket(SystemMessageId.YOU_HAVE_WITHDRAWN_FROM_THE_ALLIANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__8E_ALLYLEAVE;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.model.L2Clan;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
|
||||
public final class AllyLeave implements IClientIncomingPacket
|
||||
{
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final L2PcInstance player = client.getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.getClan() == null)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_ARE_NOT_A_CLAN_MEMBER_AND_CANNOT_PERFORM_THIS_ACTION);
|
||||
return;
|
||||
}
|
||||
if (!player.isClanLeader())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.ONLY_THE_CLAN_LEADER_MAY_APPLY_FOR_WITHDRAWAL_FROM_THE_ALLIANCE);
|
||||
return;
|
||||
}
|
||||
final L2Clan clan = player.getClan();
|
||||
if (clan.getAllyId() == 0)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_ARE_NOT_CURRENTLY_ALLIED_WITH_ANY_CLANS);
|
||||
return;
|
||||
}
|
||||
if (clan.getId() == clan.getAllyId())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.ALLIANCE_LEADERS_CANNOT_WITHDRAW);
|
||||
return;
|
||||
}
|
||||
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
clan.setAllyId(0);
|
||||
clan.setAllyName(null);
|
||||
clan.changeAllyCrest(0, true);
|
||||
clan.setAllyPenaltyExpiryTime(currentTime + (Config.ALT_ALLY_JOIN_DAYS_WHEN_LEAVED * 86400000L), L2Clan.PENALTY_TYPE_CLAN_LEAVED); // 24*60*60*1000 = 86400000
|
||||
clan.updateClanInDB();
|
||||
|
||||
player.sendPacket(SystemMessageId.YOU_HAVE_WITHDRAWN_FROM_THE_ALLIANCE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,95 +1,90 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExRotation;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SocialAction;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* @author JIV
|
||||
*/
|
||||
public class AnswerCoupleAction extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_7A_ANSWERCOUPLEACTION = "[C] D0:7A AnswerCoupleAction";
|
||||
|
||||
private int _charObjId;
|
||||
private int _actionId;
|
||||
private int _answer;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_actionId = readD();
|
||||
_answer = readD();
|
||||
_charObjId = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getActiveChar();
|
||||
final L2PcInstance target = L2World.getInstance().getPlayer(_charObjId);
|
||||
if ((activeChar == null) || (target == null))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ((target.getMultiSocialTarget() != activeChar.getObjectId()) || (target.getMultiSociaAction() != _actionId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (_answer == 0) // cancel
|
||||
{
|
||||
target.sendPacket(SystemMessageId.THE_COUPLE_ACTION_WAS_DENIED);
|
||||
}
|
||||
else if (_answer == 1) // approve
|
||||
{
|
||||
final int distance = (int) activeChar.calculateDistance(target, false, false);
|
||||
if ((distance > 125) || (distance < 15) || (activeChar.getObjectId() == target.getObjectId()))
|
||||
{
|
||||
sendPacket(SystemMessageId.THE_REQUEST_CANNOT_BE_COMPLETED_BECAUSE_THE_TARGET_DOES_NOT_MEET_LOCATION_REQUIREMENTS);
|
||||
target.sendPacket(SystemMessageId.THE_REQUEST_CANNOT_BE_COMPLETED_BECAUSE_THE_TARGET_DOES_NOT_MEET_LOCATION_REQUIREMENTS);
|
||||
return;
|
||||
}
|
||||
int heading = Util.calculateHeadingFrom(activeChar, target);
|
||||
activeChar.broadcastPacket(new ExRotation(activeChar.getObjectId(), heading));
|
||||
activeChar.setHeading(heading);
|
||||
heading = Util.calculateHeadingFrom(target, activeChar);
|
||||
target.setHeading(heading);
|
||||
target.broadcastPacket(new ExRotation(target.getObjectId(), heading));
|
||||
activeChar.broadcastPacket(new SocialAction(activeChar.getObjectId(), _actionId));
|
||||
target.broadcastPacket(new SocialAction(_charObjId, _actionId));
|
||||
}
|
||||
else if (_answer == -1) // refused
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_SET_TO_REFUSE_COUPLE_ACTIONS_AND_CANNOT_BE_REQUESTED_FOR_A_COUPLE_ACTION);
|
||||
sm.addPcName(activeChar);
|
||||
target.sendPacket(sm);
|
||||
}
|
||||
target.setMultiSocialAction(0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_7A_ANSWERCOUPLEACTION;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExRotation;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SocialAction;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* @author JIV
|
||||
*/
|
||||
public class AnswerCoupleAction implements IClientIncomingPacket
|
||||
{
|
||||
private int _charObjId;
|
||||
private int _actionId;
|
||||
private int _answer;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_actionId = packet.readD();
|
||||
_answer = packet.readD();
|
||||
_charObjId = packet.readD();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final L2PcInstance activeChar = client.getActiveChar();
|
||||
final L2PcInstance target = L2World.getInstance().getPlayer(_charObjId);
|
||||
if ((activeChar == null) || (target == null))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ((target.getMultiSocialTarget() != activeChar.getObjectId()) || (target.getMultiSociaAction() != _actionId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (_answer == 0) // cancel
|
||||
{
|
||||
target.sendPacket(SystemMessageId.THE_COUPLE_ACTION_WAS_DENIED);
|
||||
}
|
||||
else if (_answer == 1) // approve
|
||||
{
|
||||
final int distance = (int) activeChar.calculateDistance(target, false, false);
|
||||
if ((distance > 125) || (distance < 15) || (activeChar.getObjectId() == target.getObjectId()))
|
||||
{
|
||||
client.sendPacket(SystemMessageId.THE_REQUEST_CANNOT_BE_COMPLETED_BECAUSE_THE_TARGET_DOES_NOT_MEET_LOCATION_REQUIREMENTS);
|
||||
target.sendPacket(SystemMessageId.THE_REQUEST_CANNOT_BE_COMPLETED_BECAUSE_THE_TARGET_DOES_NOT_MEET_LOCATION_REQUIREMENTS);
|
||||
return;
|
||||
}
|
||||
int heading = Util.calculateHeadingFrom(activeChar, target);
|
||||
activeChar.broadcastPacket(new ExRotation(activeChar.getObjectId(), heading));
|
||||
activeChar.setHeading(heading);
|
||||
heading = Util.calculateHeadingFrom(target, activeChar);
|
||||
target.setHeading(heading);
|
||||
target.broadcastPacket(new ExRotation(target.getObjectId(), heading));
|
||||
activeChar.broadcastPacket(new SocialAction(activeChar.getObjectId(), _actionId));
|
||||
target.broadcastPacket(new SocialAction(_charObjId, _actionId));
|
||||
}
|
||||
else if (_answer == -1) // refused
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_SET_TO_REFUSE_COUPLE_ACTIONS_AND_CANNOT_BE_REQUESTED_FOR_A_COUPLE_ACTION);
|
||||
sm.addPcName(activeChar);
|
||||
target.sendPacket(sm);
|
||||
}
|
||||
target.setMultiSocialAction(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
+76
-126
@@ -1,126 +1,76 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.PartyMatchRoom;
|
||||
import com.l2jmobius.gameserver.model.PartyMatchRoomList;
|
||||
import com.l2jmobius.gameserver.model.PartyMatchWaitingList;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExManagePartyRoomMember;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExPartyRoomMember;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.PartyMatchDetail;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
* Format: (ch) d
|
||||
* @author -Wooden-, Tryskell
|
||||
*/
|
||||
public final class AnswerJoinPartyRoom extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_30_ANSWERJOINPARTYROOM = "[C] D0:30 AnswerJoinPartyRoom";
|
||||
private int _answer; // 1 or 0
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_answer = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance player = getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2PcInstance partner = player.getActiveRequester();
|
||||
// Partner hasn't been found, cancel the invitation
|
||||
if ((partner == null) || (L2World.getInstance().getPlayer(partner.getObjectId()) == null))
|
||||
{
|
||||
// Partner hasn't been found, cancel the invitation
|
||||
player.sendPacket(SystemMessageId.THAT_PLAYER_IS_NOT_ONLINE);
|
||||
player.setActiveRequester(null);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Config.FACTION_SYSTEM_ENABLED && ((player.isEvil() && partner.isGood()) || (player.isGood() && partner.isEvil())))
|
||||
{
|
||||
player.sendMessage("You cannot party with different team members.");
|
||||
player.setActiveRequester(null);
|
||||
return;
|
||||
}
|
||||
|
||||
// If answer is positive, join the requester's PartyRoom.
|
||||
if ((_answer == 1) && !partner.isRequestExpired())
|
||||
{
|
||||
final PartyMatchRoom room = PartyMatchRoomList.getInstance().getRoom(partner.getPartyRoom());
|
||||
if (room == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ((player.getLevel() >= room.getMinLvl()) && (player.getLevel() <= room.getMaxLvl()))
|
||||
{
|
||||
// Remove from waiting list
|
||||
PartyMatchWaitingList.getInstance().removePlayer(player);
|
||||
|
||||
player.setPartyRoom(partner.getPartyRoom());
|
||||
|
||||
player.sendPacket(new PartyMatchDetail(player, room));
|
||||
player.sendPacket(new ExPartyRoomMember(player, room, 0));
|
||||
|
||||
for (L2PcInstance member : room.getPartyMembers())
|
||||
{
|
||||
if (member == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
member.sendPacket(new ExManagePartyRoomMember(player, room, 0));
|
||||
member.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_ENTERED_THE_PARTY_ROOM).addPcName(player));
|
||||
}
|
||||
room.addMember(player);
|
||||
|
||||
// Info Broadcast
|
||||
player.broadcastUserInfo();
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_DO_NOT_MEET_THE_REQUIREMENTS_TO_ENTER_THAT_PARTY_ROOM);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
partner.sendPacket(SystemMessageId.THE_RECIPIENT_OF_YOUR_INVITATION_DID_NOT_ACCEPT_THE_PARTY_MATCHING_INVITATION);
|
||||
}
|
||||
|
||||
// reset transaction timers
|
||||
player.setActiveRequester(null);
|
||||
partner.onTransactionResponse();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_30_ANSWERJOINPARTYROOM;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.matching.MatchingRoom;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
|
||||
/**
|
||||
* Format: (ch) d
|
||||
* @author -Wooden-, Tryskell
|
||||
*/
|
||||
public final class AnswerJoinPartyRoom implements IClientIncomingPacket
|
||||
{
|
||||
private boolean _answer;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_answer = packet.readD() == 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final L2PcInstance player = client.getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2PcInstance partner = player.getActiveRequester();
|
||||
if (partner == null)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.THAT_PLAYER_IS_NOT_ONLINE);
|
||||
player.setActiveRequester(null);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_answer && !partner.isRequestExpired())
|
||||
{
|
||||
final MatchingRoom room = partner.getMatchingRoom();
|
||||
if (room == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
room.addMember(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
partner.sendPacket(SystemMessageId.THE_RECIPIENT_OF_YOUR_INVITATION_DID_NOT_ACCEPT_THE_PARTY_MATCHING_INVITATION);
|
||||
}
|
||||
|
||||
// reset transaction timers
|
||||
player.setActiveRequester(null);
|
||||
partner.onTransactionResponse();
|
||||
}
|
||||
}
|
||||
|
||||
+53
-57
@@ -1,57 +1,53 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.gameserver.model.L2Party;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
|
||||
/**
|
||||
* @author JIV
|
||||
*/
|
||||
public class AnswerPartyLootModification extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_79_ANSWERPARTYLOOTMODIFICATION = "[C] D0:79 AnswerPartyLootModification";
|
||||
|
||||
public int _answer;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_answer = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
final L2Party party = activeChar.getParty();
|
||||
if (party != null)
|
||||
{
|
||||
party.answerLootChangeRequest(activeChar, _answer == 1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_79_ANSWERPARTYLOOTMODIFICATION;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.model.L2Party;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
|
||||
/**
|
||||
* @author JIV
|
||||
*/
|
||||
public class AnswerPartyLootModification implements IClientIncomingPacket
|
||||
{
|
||||
public int _answer;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_answer = packet.readD();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final L2PcInstance activeChar = client.getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2Party party = activeChar.getParty();
|
||||
if (party != null)
|
||||
{
|
||||
party.answerLootChangeRequest(activeChar, _answer == 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,98 +1,92 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.TradeDone;
|
||||
|
||||
/**
|
||||
* This class ...
|
||||
* @version $Revision: 1.5.4.2 $ $Date: 2005/03/27 15:29:30 $
|
||||
*/
|
||||
public final class AnswerTradeRequest extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__55_ANSWERTRADEREQUEST = "[C] 55 AnswerTradeRequest";
|
||||
|
||||
private int _response;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_response = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance player = getClient().getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!player.getAccessLevel().allowTransaction())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_ARE_NOT_AUTHORIZED_TO_DO_THAT);
|
||||
sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
final L2PcInstance partner = player.getActiveRequester();
|
||||
if ((partner == null) || (L2World.getInstance().getPlayer(partner.getObjectId()) == null))
|
||||
{
|
||||
// Trade partner not found, cancel trade
|
||||
player.sendPacket(new TradeDone(0));
|
||||
player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THAT_PLAYER_IS_NOT_ONLINE));
|
||||
player.setActiveRequester(null);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Config.FACTION_SYSTEM_ENABLED && ((player.isEvil() && partner.isGood()) || (player.isGood() && partner.isEvil())))
|
||||
{
|
||||
player.sendPacket(new TradeDone(0));
|
||||
player.sendMessage("You cannot trade with different team members.");
|
||||
player.setActiveRequester(null);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((_response == 1) && !partner.isRequestExpired())
|
||||
{
|
||||
player.startTrade(partner);
|
||||
}
|
||||
else
|
||||
{
|
||||
final SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_DENIED_YOUR_REQUEST_TO_TRADE);
|
||||
msg.addString(player.getName());
|
||||
partner.sendPacket(msg);
|
||||
}
|
||||
|
||||
// Clears requesting status
|
||||
player.setActiveRequester(null);
|
||||
partner.onTransactionResponse();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__55_ANSWERTRADEREQUEST;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.TradeDone;
|
||||
|
||||
/**
|
||||
* This class ...
|
||||
* @version $Revision: 1.5.4.2 $ $Date: 2005/03/27 15:29:30 $
|
||||
*/
|
||||
public final class AnswerTradeRequest implements IClientIncomingPacket
|
||||
{
|
||||
private int _response;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_response = packet.readD();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final L2PcInstance player = client.getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!player.getAccessLevel().allowTransaction())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_ARE_NOT_AUTHORIZED_TO_DO_THAT);
|
||||
client.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
final L2PcInstance partner = player.getActiveRequester();
|
||||
if (partner == null)
|
||||
{
|
||||
// Trade partner not found, cancel trade
|
||||
player.sendPacket(new TradeDone(0));
|
||||
player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THAT_PLAYER_IS_NOT_ONLINE));
|
||||
player.setActiveRequester(null);
|
||||
return;
|
||||
}
|
||||
else if (L2World.getInstance().getPlayer(partner.getObjectId()) == null)
|
||||
{
|
||||
// Trade partner not found, cancel trade
|
||||
player.sendPacket(new TradeDone(0));
|
||||
player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THAT_PLAYER_IS_NOT_ONLINE));
|
||||
player.setActiveRequester(null);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((_response == 1) && !partner.isRequestExpired())
|
||||
{
|
||||
player.startTrade(partner);
|
||||
}
|
||||
else
|
||||
{
|
||||
final SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_DENIED_YOUR_REQUEST_TO_TRADE);
|
||||
msg.addString(player.getName());
|
||||
partner.sendPacket(msg);
|
||||
}
|
||||
|
||||
// Clears requesting status
|
||||
player.setActiveRequester(null);
|
||||
partner.onTransactionResponse();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,67 +1,56 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.UserInfo;
|
||||
|
||||
/**
|
||||
* Appearing Packet Handler
|
||||
* <p>
|
||||
* <p>
|
||||
* 0000: 30
|
||||
* <p>
|
||||
* <p>
|
||||
* @version $Revision: 1.3.4.4 $ $Date: 2005/03/29 23:15:33 $
|
||||
*/
|
||||
public final class Appearing extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__3A_APPEARING = "[C] 3A Appearing";
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (activeChar.isTeleporting())
|
||||
{
|
||||
activeChar.onTeleported();
|
||||
}
|
||||
|
||||
sendPacket(new UserInfo(activeChar));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__3A_APPEARING;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean triggersOnActionRequest()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.UserInfo;
|
||||
|
||||
/**
|
||||
* Appearing Packet Handler
|
||||
* <p>
|
||||
* <p>
|
||||
* 0000: 30
|
||||
* <p>
|
||||
* <p>
|
||||
* @version $Revision: 1.3.4.4 $ $Date: 2005/03/29 23:15:33 $
|
||||
*/
|
||||
public final class Appearing 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.isTeleporting())
|
||||
{
|
||||
activeChar.onTeleported();
|
||||
}
|
||||
|
||||
client.sendPacket(new UserInfo(activeChar));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,136 +1,140 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.gameserver.enums.PrivateStoreType;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.PcCondOverride;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jmobius.gameserver.model.skills.AbnormalType;
|
||||
import com.l2jmobius.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
|
||||
/**
|
||||
* TODO: This class is a copy of AttackRequest, we should get proper structure for both.
|
||||
*/
|
||||
public final class Attack extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__01_ATTACK = "[C] 01 Attack";
|
||||
|
||||
// cddddc
|
||||
private int _objectId;
|
||||
@SuppressWarnings("unused")
|
||||
private int _originX;
|
||||
@SuppressWarnings("unused")
|
||||
private int _originY;
|
||||
@SuppressWarnings("unused")
|
||||
private int _originZ;
|
||||
@SuppressWarnings("unused")
|
||||
private int _attackId;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_objectId = readD();
|
||||
_originX = readD();
|
||||
_originY = readD();
|
||||
_originZ = readD();
|
||||
_attackId = readC(); // 0 for simple click 1 for shift-click
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Avoid Attacks in Boat.
|
||||
if (activeChar.isPlayable() && activeChar.isInBoat())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.THIS_IS_NOT_ALLOWED_WHILE_RIDING_A_FERRY_OR_BOAT);
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
final BuffInfo info = activeChar.getEffectList().getBuffInfoByAbnormalType(AbnormalType.BOT_PENALTY);
|
||||
if (info != null)
|
||||
{
|
||||
for (AbstractEffect effect : info.getEffects())
|
||||
{
|
||||
if (!effect.checkCondition(-1))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_HAVE_BEEN_REPORTED_AS_AN_ILLEGAL_PROGRAM_USER_SO_YOUR_ACTIONS_HAVE_BEEN_RESTRICTED);
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// avoid using expensive operations if not needed
|
||||
final L2Object target = activeChar.getTargetId() == _objectId ? activeChar.getTarget() : L2World.getInstance().findObject(_objectId);
|
||||
if (target == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!target.isTargetable() && !activeChar.canOverrideCond(PcCondOverride.TARGET_ALL))
|
||||
{
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
// Players can't attack objects in the other instances
|
||||
// except from multiverse
|
||||
if ((target.getInstanceId() != activeChar.getInstanceId()) && (activeChar.getInstanceId() != -1))
|
||||
{
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
// Only GMs can directly attack invisible characters
|
||||
if (!target.isVisibleFor(activeChar))
|
||||
{
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeChar.getTarget() != target)
|
||||
{
|
||||
target.onAction(activeChar);
|
||||
}
|
||||
else if ((target.getObjectId() != activeChar.getObjectId()) && (activeChar.getPrivateStoreType() == PrivateStoreType.NONE) && (activeChar.getActiveRequester() == null))
|
||||
{
|
||||
target.onForcedAttack(activeChar);
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__01_ATTACK;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.enums.PrivateStoreType;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.PcCondOverride;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jmobius.gameserver.model.skills.AbnormalType;
|
||||
import com.l2jmobius.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
|
||||
/**
|
||||
* TODO: This class is a copy of AttackRequest, we should get proper structure for both.
|
||||
*/
|
||||
public final class Attack implements IClientIncomingPacket
|
||||
{
|
||||
// cddddc
|
||||
private int _objectId;
|
||||
@SuppressWarnings("unused")
|
||||
private int _originX;
|
||||
@SuppressWarnings("unused")
|
||||
private int _originY;
|
||||
@SuppressWarnings("unused")
|
||||
private int _originZ;
|
||||
@SuppressWarnings("unused")
|
||||
private int _attackId;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_objectId = packet.readD();
|
||||
_originX = packet.readD();
|
||||
_originY = packet.readD();
|
||||
_originZ = packet.readD();
|
||||
_attackId = packet.readC(); // 0 for simple click 1 for shift-click
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final L2PcInstance activeChar = client.getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Avoid Attacks in Boat.
|
||||
if (activeChar.isPlayable() && activeChar.isInBoat())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.THIS_IS_NOT_ALLOWED_WHILE_RIDING_A_FERRY_OR_BOAT);
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
final BuffInfo info = activeChar.getEffectList().getBuffInfoByAbnormalType(AbnormalType.BOT_PENALTY);
|
||||
if (info != null)
|
||||
{
|
||||
for (AbstractEffect effect : info.getEffects())
|
||||
{
|
||||
if (!effect.checkCondition(-1))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_HAVE_BEEN_REPORTED_AS_AN_ILLEGAL_PROGRAM_USER_SO_YOUR_ACTIONS_HAVE_BEEN_RESTRICTED);
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// avoid using expensive operations if not needed
|
||||
final L2Object target;
|
||||
if (activeChar.getTargetId() == _objectId)
|
||||
{
|
||||
target = activeChar.getTarget();
|
||||
}
|
||||
else
|
||||
{
|
||||
target = L2World.getInstance().findObject(_objectId);
|
||||
}
|
||||
|
||||
if (target == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ((!target.isTargetable() || activeChar.isTargetingDisabled()) && !activeChar.canOverrideCond(PcCondOverride.TARGET_ALL))
|
||||
{
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
// Players can't attack objects in the other instances
|
||||
else if (target.getInstanceWorld() != activeChar.getInstanceWorld())
|
||||
{
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
// Only GMs can directly attack invisible characters
|
||||
else if (!target.isVisibleFor(activeChar))
|
||||
{
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeChar.getTarget() != target)
|
||||
{
|
||||
target.onAction(activeChar);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((target.getObjectId() != activeChar.getObjectId()) && (activeChar.getPrivateStoreType() == PrivateStoreType.NONE) && (activeChar.getActiveRequester() == null))
|
||||
{
|
||||
target.onForcedAttack(activeChar);
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,126 +1,129 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.gameserver.enums.PrivateStoreType;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.PcCondOverride;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jmobius.gameserver.model.skills.AbnormalType;
|
||||
import com.l2jmobius.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
|
||||
public final class AttackRequest extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__32_ATTACKREQUEST = "[C] 32 AttackRequest";
|
||||
|
||||
// cddddc
|
||||
private int _objectId;
|
||||
@SuppressWarnings("unused")
|
||||
private int _originX;
|
||||
@SuppressWarnings("unused")
|
||||
private int _originY;
|
||||
@SuppressWarnings("unused")
|
||||
private int _originZ;
|
||||
@SuppressWarnings("unused")
|
||||
private int _attackId;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_objectId = readD();
|
||||
_originX = readD();
|
||||
_originY = readD();
|
||||
_originZ = readD();
|
||||
_attackId = readC(); // 0 for simple click 1 for shift-click
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final BuffInfo info = activeChar.getEffectList().getBuffInfoByAbnormalType(AbnormalType.BOT_PENALTY);
|
||||
if (info != null)
|
||||
{
|
||||
for (AbstractEffect effect : info.getEffects())
|
||||
{
|
||||
if (!effect.checkCondition(-1))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_HAVE_BEEN_REPORTED_AS_AN_ILLEGAL_PROGRAM_USER_SO_YOUR_ACTIONS_HAVE_BEEN_RESTRICTED);
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// avoid using expensive operations if not needed
|
||||
final L2Object target = activeChar.getTargetId() == _objectId ? activeChar.getTarget() : L2World.getInstance().findObject(_objectId);
|
||||
if (target == null)
|
||||
{
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
else if (!target.isTargetable() && !activeChar.canOverrideCond(PcCondOverride.TARGET_ALL))
|
||||
{
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
// Players can't attack objects in the other instances
|
||||
// except from multiverse
|
||||
if ((target.getInstanceId() != activeChar.getInstanceId()) && (activeChar.getInstanceId() != -1))
|
||||
{
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
// Only GMs can directly attack invisible characters
|
||||
if (!target.isVisibleFor(activeChar))
|
||||
{
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeChar.getTarget() != target)
|
||||
{
|
||||
target.onAction(activeChar);
|
||||
}
|
||||
else if ((target.getObjectId() != activeChar.getObjectId()) && (activeChar.getPrivateStoreType() == PrivateStoreType.NONE) && (activeChar.getActiveRequester() == null))
|
||||
{
|
||||
target.onForcedAttack(activeChar);
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__32_ATTACKREQUEST;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.enums.PrivateStoreType;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.PcCondOverride;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||
import com.l2jmobius.gameserver.model.skills.AbnormalType;
|
||||
import com.l2jmobius.gameserver.model.skills.BuffInfo;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
|
||||
public final class AttackRequest implements IClientIncomingPacket
|
||||
{
|
||||
// cddddc
|
||||
private int _objectId;
|
||||
@SuppressWarnings("unused")
|
||||
private int _originX;
|
||||
@SuppressWarnings("unused")
|
||||
private int _originY;
|
||||
@SuppressWarnings("unused")
|
||||
private int _originZ;
|
||||
@SuppressWarnings("unused")
|
||||
private int _attackId;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_objectId = packet.readD();
|
||||
_originX = packet.readD();
|
||||
_originY = packet.readD();
|
||||
_originZ = packet.readD();
|
||||
_attackId = packet.readC(); // 0 for simple click 1 for shift-click
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final L2PcInstance activeChar = client.getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final BuffInfo info = activeChar.getEffectList().getBuffInfoByAbnormalType(AbnormalType.BOT_PENALTY);
|
||||
if (info != null)
|
||||
{
|
||||
for (AbstractEffect effect : info.getEffects())
|
||||
{
|
||||
if (!effect.checkCondition(-1))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_HAVE_BEEN_REPORTED_AS_AN_ILLEGAL_PROGRAM_USER_SO_YOUR_ACTIONS_HAVE_BEEN_RESTRICTED);
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// avoid using expensive operations if not needed
|
||||
final L2Object target;
|
||||
if (activeChar.getTargetId() == _objectId)
|
||||
{
|
||||
target = activeChar.getTarget();
|
||||
}
|
||||
else
|
||||
{
|
||||
target = L2World.getInstance().findObject(_objectId);
|
||||
}
|
||||
|
||||
if (target == null)
|
||||
{
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
else if ((!target.isTargetable() || activeChar.isTargetingDisabled()) && !activeChar.canOverrideCond(PcCondOverride.TARGET_ALL))
|
||||
{
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
// Players can't attack objects in the other instances
|
||||
else if (target.getInstanceWorld() != activeChar.getInstanceWorld())
|
||||
{
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
// Only GMs can directly attack invisible characters
|
||||
else if (!target.isVisibleFor(activeChar))
|
||||
{
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeChar.getTarget() != target)
|
||||
{
|
||||
target.onAction(activeChar);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((target.getObjectId() != activeChar.getObjectId()) && (activeChar.getPrivateStoreType() == PrivateStoreType.NONE) && (activeChar.getActiveRequester() == null))
|
||||
{
|
||||
target.onForcedAttack(activeChar);
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,90 +1,84 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.LoginServerThread;
|
||||
import com.l2jmobius.gameserver.LoginServerThread.SessionKey;
|
||||
import com.l2jmobius.gameserver.network.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.L2GameServerPacket;
|
||||
|
||||
/**
|
||||
* This class ...
|
||||
* @version $Revision: 1.9.2.3.2.4 $ $Date: 2005/03/27 15:29:30 $
|
||||
*/
|
||||
public final class AuthLogin extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__2B_AUTHLOGIN = "[C] 2B AuthLogin";
|
||||
|
||||
// loginName + keys must match what the loginserver used.
|
||||
private String _loginName;
|
||||
/*
|
||||
* private final long _key1; private final long _key2; private final long _key3; private final long _key4;
|
||||
*/
|
||||
private int _playKey1;
|
||||
private int _playKey2;
|
||||
private int _loginKey1;
|
||||
private int _loginKey2;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_loginName = readS().toLowerCase();
|
||||
_playKey2 = readD();
|
||||
_playKey1 = readD();
|
||||
_loginKey1 = readD();
|
||||
_loginKey2 = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2GameClient client = getClient();
|
||||
if (_loginName.isEmpty() || !client.isProtocolOk())
|
||||
{
|
||||
client.close((L2GameServerPacket) null);
|
||||
return;
|
||||
}
|
||||
final SessionKey key = new SessionKey(_loginKey1, _loginKey2, _playKey1, _playKey2);
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
_log.info("user:" + _loginName);
|
||||
_log.info("key:" + key);
|
||||
}
|
||||
|
||||
// avoid potential exploits
|
||||
if (client.getAccountName() == null)
|
||||
{
|
||||
// Preventing duplicate login in case client login server socket was disconnected or this packet was not sent yet
|
||||
if (LoginServerThread.getInstance().addGameServerLogin(_loginName, client))
|
||||
{
|
||||
client.setAccountName(_loginName);
|
||||
LoginServerThread.getInstance().addWaitingClientAndSendRequest(_loginName, client, key);
|
||||
}
|
||||
else
|
||||
{
|
||||
client.close((L2GameServerPacket) null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__2B_AUTHLOGIN;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.LoginServerThread;
|
||||
import com.l2jmobius.gameserver.LoginServerThread.SessionKey;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
|
||||
/**
|
||||
* This class ...
|
||||
* @version $Revision: 1.9.2.3.2.4 $ $Date: 2005/03/27 15:29:30 $
|
||||
*/
|
||||
public final class AuthLogin implements IClientIncomingPacket
|
||||
{
|
||||
|
||||
// loginName + keys must match what the loginserver used.
|
||||
private String _loginName;
|
||||
/*
|
||||
* private final long _key1; private final long _key2; private final long _key3; private final long _key4;
|
||||
*/
|
||||
private int _playKey1;
|
||||
private int _playKey2;
|
||||
private int _loginKey1;
|
||||
private int _loginKey2;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_loginName = packet.readS().toLowerCase();
|
||||
_playKey2 = packet.readD();
|
||||
_playKey1 = packet.readD();
|
||||
_loginKey1 = packet.readD();
|
||||
_loginKey2 = packet.readD();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
if (_loginName.isEmpty() || !client.isProtocolOk())
|
||||
{
|
||||
client.close(null);
|
||||
return;
|
||||
}
|
||||
|
||||
final SessionKey key = new SessionKey(_loginKey1, _loginKey2, _playKey1, _playKey2);
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
_log.info("user:" + _loginName);
|
||||
_log.info("key:" + key);
|
||||
}
|
||||
|
||||
// avoid potential exploits
|
||||
if (client.getAccountName() == null)
|
||||
{
|
||||
// Preventing duplicate login in case client login server socket was disconnected or this packet was not sent yet
|
||||
if (LoginServerThread.getInstance().addGameServerLogin(_loginName, client))
|
||||
{
|
||||
client.setAccountName(_loginName);
|
||||
LoginServerThread.getInstance().addWaitingClientAndSendRequest(_loginName, client, key);
|
||||
}
|
||||
else
|
||||
{
|
||||
client.close(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,53 +1,51 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExBrLoadEventTopRankers;
|
||||
|
||||
/**
|
||||
* Halloween rank list client packet. Format: (ch)ddd
|
||||
*/
|
||||
public class BrEventRankerList extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_7B_BREVENTRANKERLIST = "[C] D0:7B BrEventRankerList";
|
||||
|
||||
private int _eventId;
|
||||
private int _day;
|
||||
@SuppressWarnings("unused")
|
||||
private int _ranking;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_eventId = readD();
|
||||
_day = readD(); // 0 - current, 1 - previous
|
||||
_ranking = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
// TODO count, bestScore, myScore
|
||||
getClient().sendPacket(new ExBrLoadEventTopRankers(_eventId, _day, 0, 0, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_7B_BREVENTRANKERLIST;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExBrLoadEventTopRankers;
|
||||
|
||||
/**
|
||||
* Halloween rank list client packet. Format: (ch)ddd
|
||||
*/
|
||||
public class BrEventRankerList implements IClientIncomingPacket
|
||||
{
|
||||
private int _eventId;
|
||||
private int _day;
|
||||
@SuppressWarnings("unused")
|
||||
private int _ranking;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_eventId = packet.readD();
|
||||
_day = packet.readD(); // 0 - current, 1 - previous
|
||||
_ranking = packet.readD();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
// TODO count, bestScore, myScore
|
||||
final int count = 0;
|
||||
final int bestScore = 0;
|
||||
final int myScore = 0;
|
||||
client.sendPacket(new ExBrLoadEventTopRankers(_eventId, _day, count, bestScore, myScore));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,68 +1,62 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.gameserver.handler.IUserCommandHandler;
|
||||
import com.l2jmobius.gameserver.handler.UserCommandHandler;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
|
||||
/**
|
||||
* This class ...
|
||||
* @version $Revision: 1.1.2.1.2.2 $ $Date: 2005/03/27 15:29:30 $
|
||||
*/
|
||||
public class BypassUserCmd extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__B3_BYPASSUSERCMD = "[C] B3 BypassUserCmd";
|
||||
|
||||
private int _command;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_command = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance player = getClient().getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final IUserCommandHandler handler = UserCommandHandler.getInstance().getHandler(_command);
|
||||
|
||||
if (handler == null)
|
||||
{
|
||||
if (player.isGM())
|
||||
{
|
||||
player.sendMessage("User commandID " + _command + " not implemented yet.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
handler.useUserCommand(_command, getClient().getActiveChar());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__B3_BYPASSUSERCMD;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.handler.IUserCommandHandler;
|
||||
import com.l2jmobius.gameserver.handler.UserCommandHandler;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
|
||||
/**
|
||||
* This class ...
|
||||
* @version $Revision: 1.1.2.1.2.2 $ $Date: 2005/03/27 15:29:30 $
|
||||
*/
|
||||
public class BypassUserCmd implements IClientIncomingPacket
|
||||
{
|
||||
private int _command;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_command = packet.readD();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final L2PcInstance player = client.getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final IUserCommandHandler handler = UserCommandHandler.getInstance().getHandler(_command);
|
||||
if (handler == null)
|
||||
{
|
||||
if (player.isGM())
|
||||
{
|
||||
player.sendMessage("User commandID " + _command + " not implemented yet.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
handler.useUserCommand(_command, client.getActiveChar());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,87 +1,82 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.ai.CtrlEvent;
|
||||
import com.l2jmobius.gameserver.model.Location;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
|
||||
/**
|
||||
* This class ...
|
||||
* @version $Revision: 1.1.2.1.2.4 $ $Date: 2005/03/27 15:29:30 $
|
||||
*/
|
||||
public final class CannotMoveAnymore extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__47_STOPMOVE = "[C] 47 CannotMoveAnymore";
|
||||
|
||||
private int _x;
|
||||
private int _y;
|
||||
private int _z;
|
||||
private int _heading;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_x = readD();
|
||||
_y = readD();
|
||||
_z = readD();
|
||||
_heading = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance player = getClient().getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
_log.fine("client: x:" + _x + " y:" + _y + " z:" + _z + " server x:" + player.getX() + " y:" + player.getY() + " z:" + player.getZ());
|
||||
}
|
||||
if (player.getAI() != null)
|
||||
{
|
||||
player.getAI().notifyEvent(CtrlEvent.EVT_ARRIVED_BLOCKED, new Location(_x, _y, _z, _heading));
|
||||
}
|
||||
/*
|
||||
* if (player.getParty() != null) { player.getParty().broadcastToPartyMembers(player, new PartyMemberPosition(player)); }
|
||||
*/
|
||||
|
||||
// player.stopMove();
|
||||
//
|
||||
// if (Config.DEBUG)
|
||||
// _log.fine("client: x:"+_x+" y:"+_y+" z:"+_z+
|
||||
// " server x:"+player.getX()+" y:"+player.getZ()+" z:"+player.getZ());
|
||||
// StopMove smwl = new StopMove(player);
|
||||
// getClient().getActiveChar().sendPacket(smwl);
|
||||
// getClient().getActiveChar().broadcastPacket(smwl);
|
||||
//
|
||||
// StopRotation sr = new StopRotation(getClient().getActiveChar(),
|
||||
// _heading);
|
||||
// getClient().getActiveChar().sendPacket(sr);
|
||||
// getClient().getActiveChar().broadcastPacket(sr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__47_STOPMOVE;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.ai.CtrlEvent;
|
||||
import com.l2jmobius.gameserver.model.Location;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
|
||||
/**
|
||||
* This class ...
|
||||
* @version $Revision: 1.1.2.1.2.4 $ $Date: 2005/03/27 15:29:30 $
|
||||
*/
|
||||
public final class CannotMoveAnymore implements IClientIncomingPacket
|
||||
{
|
||||
private int _x;
|
||||
private int _y;
|
||||
private int _z;
|
||||
private int _heading;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_x = packet.readD();
|
||||
_y = packet.readD();
|
||||
_z = packet.readD();
|
||||
_heading = packet.readD();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final L2PcInstance player = client.getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
_log.finer("client: x:" + _x + " y:" + _y + " z:" + _z + " server x:" + player.getX() + " y:" + player.getY() + " z:" + player.getZ());
|
||||
}
|
||||
if (player.getAI() != null)
|
||||
{
|
||||
player.getAI().notifyEvent(CtrlEvent.EVT_ARRIVED_BLOCKED, new Location(_x, _y, _z, _heading));
|
||||
}
|
||||
/*
|
||||
* if (player.getParty() != null) { player.getParty().broadcastToPartyMembers(player, new PartyMemberPosition(player)); }
|
||||
*/
|
||||
|
||||
// player.stopMove();
|
||||
//
|
||||
// if (Config.DEBUG)
|
||||
// LOGGER.finer("client: x:"+_x+" y:"+_y+" z:"+_z+
|
||||
// " server x:"+player.getX()+" y:"+player.getZ()+" z:"+player.getZ());
|
||||
// StopMove smwl = new StopMove(player);
|
||||
// client.getActiveChar().sendPacket(smwl);
|
||||
// client.getActiveChar().broadcastPacket(smwl);
|
||||
//
|
||||
// StopRotation sr = new StopRotation(client.getActiveChar(),
|
||||
// _heading);
|
||||
// client.getActiveChar().sendPacket(sr);
|
||||
// client.getActiveChar().broadcastPacket(sr);
|
||||
}
|
||||
}
|
||||
|
||||
+66
-64
@@ -1,64 +1,66 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.gameserver.model.Location;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.StopMoveInVehicle;
|
||||
|
||||
/**
|
||||
* @author Maktakien
|
||||
*/
|
||||
public final class CannotMoveAnymoreInVehicle extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__76_CANNOTMOVEANYMOREINVEHICLE = "[C] 76 CannotMoveAnymoreInVehicle";
|
||||
|
||||
private int _x;
|
||||
private int _y;
|
||||
private int _z;
|
||||
private int _heading;
|
||||
private int _boatId;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_boatId = readD();
|
||||
_x = readD();
|
||||
_y = readD();
|
||||
_z = readD();
|
||||
_heading = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance player = getClient().getActiveChar();
|
||||
if ((player == null) || !player.isInBoat() || (player.getBoat().getObjectId() != _boatId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
player.setInVehiclePosition(new Location(_x, _y, _z));
|
||||
player.setHeading(_heading);
|
||||
player.broadcastPacket(new StopMoveInVehicle(player, _boatId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__76_CANNOTMOVEANYMOREINVEHICLE;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.model.Location;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.StopMoveInVehicle;
|
||||
|
||||
/**
|
||||
* @author Maktakien
|
||||
*/
|
||||
public final class CannotMoveAnymoreInVehicle implements IClientIncomingPacket
|
||||
{
|
||||
private int _x;
|
||||
private int _y;
|
||||
private int _z;
|
||||
private int _heading;
|
||||
private int _boatId;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_boatId = packet.readD();
|
||||
_x = packet.readD();
|
||||
_y = packet.readD();
|
||||
_z = packet.readD();
|
||||
_heading = packet.readD();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final L2PcInstance player = client.getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (player.isInBoat())
|
||||
{
|
||||
if (player.getBoat().getObjectId() == _boatId)
|
||||
{
|
||||
player.setInVehiclePosition(new Location(_x, _y, _z));
|
||||
player.setHeading(_heading);
|
||||
final StopMoveInVehicle msg = new StopMoveInVehicle(player, _boatId);
|
||||
player.broadcastPacket(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,387 +1,379 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.LogRecord;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.data.sql.impl.CharNameTable;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.InitialEquipmentData;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.InitialShortcutData;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.PlayerTemplateData;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
|
||||
import com.l2jmobius.gameserver.datatables.SkillData;
|
||||
import com.l2jmobius.gameserver.model.L2SkillLearn;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.Location;
|
||||
import com.l2jmobius.gameserver.model.actor.appearance.PcAppearance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.stat.PcStat;
|
||||
import com.l2jmobius.gameserver.model.actor.templates.L2PcTemplate;
|
||||
import com.l2jmobius.gameserver.model.base.ClassId;
|
||||
import com.l2jmobius.gameserver.model.events.Containers;
|
||||
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerCreate;
|
||||
import com.l2jmobius.gameserver.model.items.PcItemTemplate;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.network.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.CharCreateFail;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.CharCreateOk;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.CharSelectionInfo;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class CharacterCreate extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__0C_CHARACTERCREATE = "[C] 0C CharacterCreate";
|
||||
protected static final Logger _logAccounting = Logger.getLogger("accounting");
|
||||
|
||||
// cSdddddddddddd
|
||||
private String _name;
|
||||
private int _race;
|
||||
private byte _sex;
|
||||
private int _classId;
|
||||
private int _int;
|
||||
private int _str;
|
||||
private int _con;
|
||||
private int _men;
|
||||
private int _dex;
|
||||
private int _wit;
|
||||
private byte _hairStyle;
|
||||
private byte _hairColor;
|
||||
private byte _face;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_name = readS();
|
||||
_race = readD();
|
||||
_sex = (byte) readD();
|
||||
_classId = readD();
|
||||
_int = readD();
|
||||
_str = readD();
|
||||
_con = readD();
|
||||
_men = readD();
|
||||
_dex = readD();
|
||||
_wit = readD();
|
||||
_hairStyle = (byte) readD();
|
||||
_hairColor = (byte) readD();
|
||||
_face = (byte) readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
// Last Verified: May 30, 2009 - Gracia Final - Players are able to create characters with names consisting of as little as 1,2,3 letter/number combinations.
|
||||
if ((_name.length() < 1) || (_name.length() > 16))
|
||||
{
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
_log.fine("Character Creation Failure: Character name " + _name + " is invalid. Message generated: Your title cannot exceed 16 characters in length. Please try again.");
|
||||
}
|
||||
|
||||
sendPacket(new CharCreateFail(CharCreateFail.REASON_16_ENG_CHARS));
|
||||
return;
|
||||
}
|
||||
|
||||
if (Config.FORBIDDEN_NAMES.length > 1)
|
||||
{
|
||||
for (String st : Config.FORBIDDEN_NAMES)
|
||||
{
|
||||
if (_name.toLowerCase().contains(st.toLowerCase()))
|
||||
{
|
||||
sendPacket(new CharCreateFail(CharCreateFail.REASON_INCORRECT_NAME));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Last Verified: May 30, 2009 - Gracia Final
|
||||
if (!Util.isAlphaNumeric(_name) || !isValidName(_name))
|
||||
{
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
_log.fine("Character Creation Failure: Character name " + _name + " is invalid. Message generated: Incorrect name. Please try again.");
|
||||
}
|
||||
|
||||
sendPacket(new CharCreateFail(CharCreateFail.REASON_INCORRECT_NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
if ((_face > 2) || (_face < 0))
|
||||
{
|
||||
_log.warning("Character Creation Failure: Character face " + _face + " is invalid. Possible client hack. " + getClient());
|
||||
|
||||
sendPacket(new CharCreateFail(CharCreateFail.REASON_CREATION_FAILED));
|
||||
return;
|
||||
}
|
||||
|
||||
if ((_hairStyle < 0) || ((_sex == 0) && (_hairStyle > 4)) || ((_sex != 0) && (_hairStyle > 6)))
|
||||
{
|
||||
_log.warning("Character Creation Failure: Character hair style " + _hairStyle + " is invalid. Possible client hack. " + getClient());
|
||||
|
||||
sendPacket(new CharCreateFail(CharCreateFail.REASON_CREATION_FAILED));
|
||||
return;
|
||||
}
|
||||
|
||||
if ((_hairColor > 3) || (_hairColor < 0))
|
||||
{
|
||||
_log.warning("Character Creation Failure: Character hair color " + _hairColor + " is invalid. Possible client hack. " + getClient());
|
||||
|
||||
sendPacket(new CharCreateFail(CharCreateFail.REASON_CREATION_FAILED));
|
||||
return;
|
||||
}
|
||||
|
||||
L2PcInstance newChar = null;
|
||||
L2PcTemplate template = null;
|
||||
|
||||
/*
|
||||
* DrHouse: Since checks for duplicate names are done using SQL, lock must be held until data is written to DB as well.
|
||||
*/
|
||||
synchronized (CharNameTable.getInstance())
|
||||
{
|
||||
if ((CharNameTable.getInstance().getAccountCharacterCount(getClient().getAccountName()) >= Config.MAX_CHARACTERS_NUMBER_PER_ACCOUNT) && (Config.MAX_CHARACTERS_NUMBER_PER_ACCOUNT != 0))
|
||||
{
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
_log.fine("Max number of characters reached. Creation failed.");
|
||||
}
|
||||
|
||||
sendPacket(new CharCreateFail(CharCreateFail.REASON_TOO_MANY_CHARACTERS));
|
||||
return;
|
||||
}
|
||||
if (CharNameTable.getInstance().doesCharNameExist(_name))
|
||||
{
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
_log.fine("Character Creation Failure: Message generated: You cannot create another character. Please delete the existing character and try again.");
|
||||
}
|
||||
|
||||
sendPacket(new CharCreateFail(CharCreateFail.REASON_NAME_ALREADY_EXISTS));
|
||||
return;
|
||||
}
|
||||
|
||||
template = PlayerTemplateData.getInstance().getTemplate(_classId);
|
||||
if ((template == null) || (ClassId.getClassId(_classId).level() > 0))
|
||||
{
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
_log.fine("Character Creation Failure: " + _name + " classId: " + _classId + " Template: " + template + " Message generated: Your character creation has failed.");
|
||||
}
|
||||
|
||||
sendPacket(new CharCreateFail(CharCreateFail.REASON_CREATION_FAILED));
|
||||
return;
|
||||
}
|
||||
|
||||
// Custom Feature: Disallow a race to be created.
|
||||
// Example: Humans can not be created if AllowHuman = False in Custom.properties
|
||||
switch (template.getRace())
|
||||
{
|
||||
case HUMAN:
|
||||
{
|
||||
if (!Config.ALLOW_HUMAN)
|
||||
{
|
||||
sendPacket(new CharCreateFail(CharCreateFail.REASON_CREATION_FAILED));
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ELF:
|
||||
{
|
||||
if (!Config.ALLOW_ELF)
|
||||
{
|
||||
sendPacket(new CharCreateFail(CharCreateFail.REASON_CREATION_FAILED));
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DARK_ELF:
|
||||
{
|
||||
if (!Config.ALLOW_DARKELF)
|
||||
{
|
||||
sendPacket(new CharCreateFail(CharCreateFail.REASON_CREATION_FAILED));
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ORC:
|
||||
{
|
||||
if (!Config.ALLOW_ORC)
|
||||
{
|
||||
sendPacket(new CharCreateFail(CharCreateFail.REASON_CREATION_FAILED));
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DWARF:
|
||||
{
|
||||
if (!Config.ALLOW_DWARF)
|
||||
{
|
||||
sendPacket(new CharCreateFail(CharCreateFail.REASON_CREATION_FAILED));
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case KAMAEL:
|
||||
{
|
||||
if (!Config.ALLOW_KAMAEL)
|
||||
{
|
||||
sendPacket(new CharCreateFail(CharCreateFail.REASON_CREATION_FAILED));
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ERTHEIA:
|
||||
{
|
||||
if (!Config.ALLOW_ERTHEIA)
|
||||
{
|
||||
sendPacket(new CharCreateFail(CharCreateFail.REASON_CREATION_FAILED));
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
newChar = L2PcInstance.create(template, getClient().getAccountName(), _name, new PcAppearance(_face, _hairColor, _hairStyle, _sex != 0));
|
||||
}
|
||||
|
||||
// HP and MP are at maximum and CP is zero by default.
|
||||
newChar.setCurrentHp(newChar.getMaxHp());
|
||||
newChar.setCurrentMp(newChar.getMaxMp());
|
||||
// newChar.setMaxLoad(template.getBaseLoad());
|
||||
|
||||
sendPacket(new CharCreateOk());
|
||||
|
||||
initNewChar(getClient(), newChar);
|
||||
|
||||
final LogRecord record = new LogRecord(Level.INFO, "Created new character");
|
||||
record.setParameters(new Object[]
|
||||
{
|
||||
newChar,
|
||||
getClient()
|
||||
});
|
||||
_logAccounting.log(record);
|
||||
}
|
||||
|
||||
private static boolean isValidName(String text)
|
||||
{
|
||||
return Config.CHARNAME_TEMPLATE_PATTERN.matcher(text).matches();
|
||||
}
|
||||
|
||||
private void initNewChar(L2GameClient client, L2PcInstance newChar)
|
||||
{
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
_log.fine("Character init start");
|
||||
}
|
||||
|
||||
L2World.getInstance().storeObject(newChar);
|
||||
|
||||
if (Config.STARTING_ADENA > 0)
|
||||
{
|
||||
newChar.addAdena("Init", Config.STARTING_ADENA, null, false);
|
||||
}
|
||||
|
||||
final L2PcTemplate template = newChar.getTemplate();
|
||||
|
||||
if (Config.CUSTOM_STARTING_LOC)
|
||||
{
|
||||
final Location createLoc = new Location(Config.CUSTOM_STARTING_LOC_X, Config.CUSTOM_STARTING_LOC_Y, Config.CUSTOM_STARTING_LOC_Z);
|
||||
newChar.setXYZInvisible(createLoc.getX(), createLoc.getY(), createLoc.getZ());
|
||||
}
|
||||
else if (Config.FACTION_SYSTEM_ENABLED)
|
||||
{
|
||||
newChar.setXYZInvisible(Config.FACTION_STARTING_LOCATION.getX(), Config.FACTION_STARTING_LOCATION.getY(), Config.FACTION_STARTING_LOCATION.getZ());
|
||||
}
|
||||
else
|
||||
{
|
||||
final Location createLoc = template.getCreationPoint();
|
||||
newChar.setXYZInvisible(createLoc.getX(), createLoc.getY(), createLoc.getZ());
|
||||
}
|
||||
newChar.setTitle("");
|
||||
|
||||
if (Config.ENABLE_VITALITY)
|
||||
{
|
||||
newChar.setVitalityPoints(Math.min(Config.STARTING_VITALITY_POINTS, PcStat.MAX_VITALITY_POINTS), true);
|
||||
}
|
||||
if (Config.STARTING_LEVEL > 1)
|
||||
{
|
||||
newChar.getStat().addLevel((byte) (Config.STARTING_LEVEL - 1));
|
||||
}
|
||||
if (Config.STARTING_SP > 0)
|
||||
{
|
||||
newChar.getStat().addSp(Config.STARTING_SP);
|
||||
}
|
||||
|
||||
final List<PcItemTemplate> initialItems = InitialEquipmentData.getInstance().getEquipmentList(newChar.getClassId());
|
||||
if (initialItems != null)
|
||||
{
|
||||
for (PcItemTemplate ie : initialItems)
|
||||
{
|
||||
final L2ItemInstance item = newChar.getInventory().addItem("Init", ie.getId(), ie.getCount(), newChar, null);
|
||||
if (item == null)
|
||||
{
|
||||
_log.warning("Could not create item during char creation: itemId " + ie.getId() + ", amount " + ie.getCount() + ".");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (item.isEquipable() && ie.isEquipped())
|
||||
{
|
||||
newChar.getInventory().equipItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (L2SkillLearn skill : SkillTreesData.getInstance().getAvailableSkills(newChar, newChar.getClassId(), false, true))
|
||||
{
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
_log.fine("Adding starter skill:" + skill.getSkillId() + " / " + skill.getSkillLevel());
|
||||
}
|
||||
|
||||
newChar.addSkill(SkillData.getInstance().getSkill(skill.getSkillId(), skill.getSkillLevel()), true);
|
||||
}
|
||||
|
||||
// Register all shortcuts for actions, skills and items for this new character.
|
||||
InitialShortcutData.getInstance().registerAllShortcuts(newChar);
|
||||
|
||||
EventDispatcher.getInstance().notifyEvent(new OnPlayerCreate(newChar, newChar.getObjectId(), newChar.getName(), client), Containers.Players());
|
||||
|
||||
newChar.setOnlineStatus(true, false);
|
||||
if (Config.SHOW_GOD_VIDEO_INTRO)
|
||||
{
|
||||
newChar.getVariables().set("intro_god_video", true);
|
||||
}
|
||||
newChar.deleteMe();
|
||||
|
||||
final CharSelectionInfo cl = new CharSelectionInfo(client.getAccountName(), client.getSessionId().playOkID1);
|
||||
client.setCharSelection(cl.getCharInfo());
|
||||
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
_log.fine("Character init end");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__0C_CHARACTERCREATE;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.data.sql.impl.CharNameTable;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.InitialEquipmentData;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.InitialShortcutData;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.PlayerTemplateData;
|
||||
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.L2World;
|
||||
import com.l2jmobius.gameserver.model.Location;
|
||||
import com.l2jmobius.gameserver.model.actor.appearance.PcAppearance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.stat.PcStat;
|
||||
import com.l2jmobius.gameserver.model.actor.templates.L2PcTemplate;
|
||||
import com.l2jmobius.gameserver.model.base.ClassId;
|
||||
import com.l2jmobius.gameserver.model.events.Containers;
|
||||
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerCreate;
|
||||
import com.l2jmobius.gameserver.model.items.PcItemTemplate;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.CharCreateFail;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.CharCreateOk;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.CharSelectionInfo;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class CharacterCreate implements IClientIncomingPacket
|
||||
{
|
||||
protected static final Logger _logAccounting = Logger.getLogger("accounting");
|
||||
|
||||
// cSdddddddddddd
|
||||
private String _name;
|
||||
private int _race;
|
||||
private byte _sex;
|
||||
private int _classId;
|
||||
private int _int;
|
||||
private int _str;
|
||||
private int _con;
|
||||
private int _men;
|
||||
private int _dex;
|
||||
private int _wit;
|
||||
private byte _hairStyle;
|
||||
private byte _hairColor;
|
||||
private byte _face;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_name = packet.readS();
|
||||
_race = packet.readD();
|
||||
_sex = (byte) packet.readD();
|
||||
_classId = packet.readD();
|
||||
_int = packet.readD();
|
||||
_str = packet.readD();
|
||||
_con = packet.readD();
|
||||
_men = packet.readD();
|
||||
_dex = packet.readD();
|
||||
_wit = packet.readD();
|
||||
_hairStyle = (byte) packet.readD();
|
||||
_hairColor = (byte) packet.readD();
|
||||
_face = (byte) packet.readD();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
// Last Verified: May 30, 2009 - Gracia Final - Players are able to create characters with names consisting of as little as 1,2,3 letter/number combinations.
|
||||
if ((_name.length() < 1) || (_name.length() > 16))
|
||||
{
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
_log.finer("Character Creation Failure: Character name " + _name + " is invalid. Message generated: Your title cannot exceed 16 characters in length. Please try again.");
|
||||
}
|
||||
|
||||
client.sendPacket(new CharCreateFail(CharCreateFail.REASON_16_ENG_CHARS));
|
||||
return;
|
||||
}
|
||||
|
||||
if (Config.FORBIDDEN_NAMES.length > 1)
|
||||
{
|
||||
for (String st : Config.FORBIDDEN_NAMES)
|
||||
{
|
||||
if (_name.toLowerCase().contains(st.toLowerCase()))
|
||||
{
|
||||
client.sendPacket(new CharCreateFail(CharCreateFail.REASON_INCORRECT_NAME));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Last Verified: May 30, 2009 - Gracia Final
|
||||
if (!Util.isAlphaNumeric(_name) || !isValidName(_name))
|
||||
{
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
_log.finer("Character Creation Failure: Character name " + _name + " is invalid. Message generated: Incorrect name. Please try again.");
|
||||
}
|
||||
|
||||
client.sendPacket(new CharCreateFail(CharCreateFail.REASON_INCORRECT_NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
if ((_face > 2) || (_face < 0))
|
||||
{
|
||||
_log.warning("Character Creation Failure: Character face " + _face + " is invalid. Possible client hack. " + client);
|
||||
|
||||
client.sendPacket(new CharCreateFail(CharCreateFail.REASON_CREATION_FAILED));
|
||||
return;
|
||||
}
|
||||
|
||||
if ((_hairStyle < 0) || ((_sex == 0) && (_hairStyle > 4)) || ((_sex != 0) && (_hairStyle > 6)))
|
||||
{
|
||||
_log.warning("Character Creation Failure: Character hair style " + _hairStyle + " is invalid. Possible client hack. " + client);
|
||||
|
||||
client.sendPacket(new CharCreateFail(CharCreateFail.REASON_CREATION_FAILED));
|
||||
return;
|
||||
}
|
||||
|
||||
if ((_hairColor > 3) || (_hairColor < 0))
|
||||
{
|
||||
_log.warning("Character Creation Failure: Character hair color " + _hairColor + " is invalid. Possible client hack. " + client);
|
||||
|
||||
client.sendPacket(new CharCreateFail(CharCreateFail.REASON_CREATION_FAILED));
|
||||
return;
|
||||
}
|
||||
|
||||
L2PcInstance newChar = null;
|
||||
L2PcTemplate template = null;
|
||||
|
||||
/*
|
||||
* DrHouse: Since checks for duplicate names are done using SQL, lock must be held until data is written to DB as well.
|
||||
*/
|
||||
synchronized (CharNameTable.getInstance())
|
||||
{
|
||||
if ((CharNameTable.getInstance().getAccountCharacterCount(client.getAccountName()) >= Config.MAX_CHARACTERS_NUMBER_PER_ACCOUNT) && (Config.MAX_CHARACTERS_NUMBER_PER_ACCOUNT != 0))
|
||||
{
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
_log.finer("Max number of characters reached. Creation failed.");
|
||||
}
|
||||
|
||||
client.sendPacket(new CharCreateFail(CharCreateFail.REASON_TOO_MANY_CHARACTERS));
|
||||
return;
|
||||
}
|
||||
else if (CharNameTable.getInstance().doesCharNameExist(_name))
|
||||
{
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
_log.finer("Character Creation Failure: Message generated: You cannot create another character. Please delete the existing character and try again.");
|
||||
}
|
||||
|
||||
client.sendPacket(new CharCreateFail(CharCreateFail.REASON_NAME_ALREADY_EXISTS));
|
||||
return;
|
||||
}
|
||||
|
||||
template = PlayerTemplateData.getInstance().getTemplate(_classId);
|
||||
if ((template == null) || (ClassId.getClassId(_classId).level() > 0))
|
||||
{
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
_log.finer("Character Creation Failure: " + _name + " classId: " + _classId + " Template: " + template + " Message generated: Your character creation has failed.");
|
||||
}
|
||||
|
||||
client.sendPacket(new CharCreateFail(CharCreateFail.REASON_CREATION_FAILED));
|
||||
return;
|
||||
}
|
||||
|
||||
// Custom Feature: Disallow a race to be created.
|
||||
// Example: Humans can not be created if AllowHuman = False in Custom.properties
|
||||
switch (template.getRace())
|
||||
{
|
||||
case HUMAN:
|
||||
{
|
||||
if (!Config.ALLOW_HUMAN)
|
||||
{
|
||||
client.sendPacket(new CharCreateFail(CharCreateFail.REASON_CREATION_FAILED));
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ELF:
|
||||
{
|
||||
if (!Config.ALLOW_ELF)
|
||||
{
|
||||
client.sendPacket(new CharCreateFail(CharCreateFail.REASON_CREATION_FAILED));
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DARK_ELF:
|
||||
{
|
||||
if (!Config.ALLOW_DARKELF)
|
||||
{
|
||||
client.sendPacket(new CharCreateFail(CharCreateFail.REASON_CREATION_FAILED));
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ORC:
|
||||
{
|
||||
if (!Config.ALLOW_ORC)
|
||||
{
|
||||
client.sendPacket(new CharCreateFail(CharCreateFail.REASON_CREATION_FAILED));
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DWARF:
|
||||
{
|
||||
if (!Config.ALLOW_DWARF)
|
||||
{
|
||||
client.sendPacket(new CharCreateFail(CharCreateFail.REASON_CREATION_FAILED));
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case KAMAEL:
|
||||
{
|
||||
if (!Config.ALLOW_KAMAEL)
|
||||
{
|
||||
client.sendPacket(new CharCreateFail(CharCreateFail.REASON_CREATION_FAILED));
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ERTHEIA:
|
||||
{
|
||||
if (!Config.ALLOW_ERTHEIA)
|
||||
{
|
||||
client.sendPacket(new CharCreateFail(CharCreateFail.REASON_CREATION_FAILED));
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
newChar = L2PcInstance.create(template, client.getAccountName(), _name, new PcAppearance(_face, _hairColor, _hairStyle, _sex != 0));
|
||||
}
|
||||
|
||||
// HP and MP are at maximum and CP is zero by default.
|
||||
newChar.setCurrentHp(newChar.getMaxHp());
|
||||
newChar.setCurrentMp(newChar.getMaxMp());
|
||||
// newChar.setMaxLoad(template.getBaseLoad());
|
||||
|
||||
client.sendPacket(CharCreateOk.STATIC_PACKET);
|
||||
|
||||
initNewChar(client, newChar);
|
||||
|
||||
_logAccounting.info("Created new character, " + newChar + ", " + client);
|
||||
}
|
||||
|
||||
private static boolean isValidName(String text)
|
||||
{
|
||||
return Config.CHARNAME_TEMPLATE_PATTERN.matcher(text).matches();
|
||||
}
|
||||
|
||||
private void initNewChar(L2GameClient client, L2PcInstance newChar)
|
||||
{
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
_log.finer("Character init start");
|
||||
}
|
||||
|
||||
L2World.getInstance().storeObject(newChar);
|
||||
|
||||
if (Config.STARTING_ADENA > 0)
|
||||
{
|
||||
newChar.addAdena("Init", Config.STARTING_ADENA, null, false);
|
||||
}
|
||||
|
||||
final L2PcTemplate template = newChar.getTemplate();
|
||||
|
||||
if (Config.CUSTOM_STARTING_LOC)
|
||||
{
|
||||
final Location createLoc = new Location(Config.CUSTOM_STARTING_LOC_X, Config.CUSTOM_STARTING_LOC_Y, Config.CUSTOM_STARTING_LOC_Z);
|
||||
newChar.setXYZInvisible(createLoc.getX(), createLoc.getY(), createLoc.getZ());
|
||||
}
|
||||
else if (Config.FACTION_SYSTEM_ENABLED)
|
||||
{
|
||||
newChar.setXYZInvisible(Config.FACTION_STARTING_LOCATION.getX(), Config.FACTION_STARTING_LOCATION.getY(), Config.FACTION_STARTING_LOCATION.getZ());
|
||||
}
|
||||
else
|
||||
{
|
||||
final Location createLoc = template.getCreationPoint();
|
||||
newChar.setXYZInvisible(createLoc.getX(), createLoc.getY(), createLoc.getZ());
|
||||
}
|
||||
newChar.setTitle("");
|
||||
|
||||
if (Config.ENABLE_VITALITY)
|
||||
{
|
||||
newChar.setVitalityPoints(Math.min(Config.STARTING_VITALITY_POINTS, PcStat.MAX_VITALITY_POINTS), true);
|
||||
}
|
||||
if (Config.STARTING_LEVEL > 1)
|
||||
{
|
||||
newChar.getStat().addLevel((byte) (Config.STARTING_LEVEL - 1));
|
||||
}
|
||||
if (Config.STARTING_SP > 0)
|
||||
{
|
||||
newChar.getStat().addSp(Config.STARTING_SP);
|
||||
}
|
||||
|
||||
final List<PcItemTemplate> initialItems = InitialEquipmentData.getInstance().getEquipmentList(newChar.getClassId());
|
||||
if (initialItems != null)
|
||||
{
|
||||
for (PcItemTemplate ie : initialItems)
|
||||
{
|
||||
final L2ItemInstance item = newChar.getInventory().addItem("Init", ie.getId(), ie.getCount(), newChar, null);
|
||||
if (item == null)
|
||||
{
|
||||
_log.warning("Could not create item during char creation: itemId " + ie.getId() + ", amount " + ie.getCount() + ".");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (item.isEquipable() && ie.isEquipped())
|
||||
{
|
||||
newChar.getInventory().equipItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (L2SkillLearn skill : SkillTreesData.getInstance().getRaceSkillTree(newChar.getRace()))
|
||||
{
|
||||
newChar.addSkill(SkillData.getInstance().getSkill(skill.getSkillId(), skill.getSkillLevel()), true);
|
||||
}
|
||||
|
||||
for (L2SkillLearn skill : SkillTreesData.getInstance().getAvailableSkills(newChar, newChar.getClassId(), false, true))
|
||||
{
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
_log.finer("Adding starter skill:" + skill.getSkillId() + " / " + skill.getSkillLevel());
|
||||
}
|
||||
|
||||
newChar.addSkill(SkillData.getInstance().getSkill(skill.getSkillId(), skill.getSkillLevel()), true);
|
||||
}
|
||||
|
||||
// Register all shortcuts for actions, skills and items for this new character.
|
||||
InitialShortcutData.getInstance().registerAllShortcuts(newChar);
|
||||
|
||||
EventDispatcher.getInstance().notifyEvent(new OnPlayerCreate(newChar, newChar.getObjectId(), newChar.getName(), client), Containers.Players());
|
||||
|
||||
newChar.setOnlineStatus(true, false);
|
||||
if (Config.SHOW_GOD_VIDEO_INTRO)
|
||||
{
|
||||
newChar.getVariables().set("intro_god_video", true);
|
||||
}
|
||||
newChar.deleteMe();
|
||||
|
||||
final CharSelectionInfo cl = new CharSelectionInfo(client.getAccountName(), client.getSessionId().playOkID1);
|
||||
client.setCharSelection(cl.getCharInfo());
|
||||
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
_log.finer("Character init end");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,104 +1,87 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.model.CharSelectInfoPackage;
|
||||
import com.l2jmobius.gameserver.model.events.Containers;
|
||||
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerDelete;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.CharDeleteFail;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.CharDeleteSuccess;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.CharSelectionInfo;
|
||||
|
||||
/**
|
||||
* This class ...
|
||||
* @version $Revision: 1.8.2.1.2.3 $ $Date: 2005/03/27 15:29:30 $
|
||||
*/
|
||||
public final class CharacterDelete extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__0C_CHARACTERDELETE = "[C] 0D CharacterDelete";
|
||||
|
||||
// cd
|
||||
private int _charSlot;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_charSlot = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
// if (!getClient().getFloodProtectors().getCharacterSelect().tryPerformAction("CharacterDelete"))
|
||||
// {
|
||||
// sendPacket(new CharDeleteFail(CharDeleteFail.REASON_DELETION_FAILED));
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
_log.fine("deleting slot:" + _charSlot);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
switch (getClient().markToDeleteChar(_charSlot))
|
||||
{
|
||||
default:
|
||||
case -1: // Error
|
||||
{
|
||||
break;
|
||||
}
|
||||
case 0: // Success!
|
||||
{
|
||||
sendPacket(new CharDeleteSuccess());
|
||||
final CharSelectInfoPackage charInfo = getClient().getCharSelection(_charSlot);
|
||||
EventDispatcher.getInstance().notifyEvent(new OnPlayerDelete(charInfo.getObjectId(), charInfo.getName(), getClient()), Containers.Players());
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
sendPacket(new CharDeleteFail(CharDeleteFail.REASON_YOU_MAY_NOT_DELETE_CLAN_MEMBER));
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
sendPacket(new CharDeleteFail(CharDeleteFail.REASON_CLAN_LEADERS_MAY_NOT_BE_DELETED));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.SEVERE, "Error:", e);
|
||||
}
|
||||
|
||||
final CharSelectionInfo cl = new CharSelectionInfo(getClient().getAccountName(), getClient().getSessionId().playOkID1);
|
||||
sendPacket(cl);
|
||||
getClient().setCharSelection(cl.getCharInfo());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__0C_CHARACTERDELETE;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.enums.CharacterDeleteFailType;
|
||||
import com.l2jmobius.gameserver.model.CharSelectInfoPackage;
|
||||
import com.l2jmobius.gameserver.model.events.Containers;
|
||||
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerDelete;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.CharDeleteFail;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.CharDeleteSuccess;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.CharSelectionInfo;
|
||||
|
||||
/**
|
||||
* This class ...
|
||||
* @version $Revision: 1.8.2.1.2.3 $ $Date: 2005/03/27 15:29:30 $
|
||||
*/
|
||||
public final class CharacterDelete implements IClientIncomingPacket
|
||||
{
|
||||
// cd
|
||||
private int _charSlot;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_charSlot = packet.readD();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
// if (!client.getFloodProtectors().getCharacterSelect().tryPerformAction("CharacterDelete"))
|
||||
// {
|
||||
// client.sendPacket(new CharDeleteFail(CharacterDeleteFailType.UNKNOWN));
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
_log.finer("deleting slot:" + _charSlot);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
final CharacterDeleteFailType failType = client.markToDeleteChar(_charSlot);
|
||||
switch (failType)
|
||||
{
|
||||
case NONE:// Success!
|
||||
client.sendPacket(new CharDeleteSuccess());
|
||||
final CharSelectInfoPackage charInfo = client.getCharSelection(_charSlot);
|
||||
EventDispatcher.getInstance().notifyEvent(new OnPlayerDelete(charInfo.getObjectId(), charInfo.getName(), client), Containers.Players());
|
||||
break;
|
||||
default:
|
||||
client.sendPacket(new CharDeleteFail(failType));
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.SEVERE, "Error:", e);
|
||||
}
|
||||
|
||||
final CharSelectionInfo cl = new CharSelectionInfo(client.getAccountName(), client.getSessionId().playOkID1, 0);
|
||||
client.sendPacket(cl);
|
||||
client.setCharSelection(cl.getCharInfo());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,62 +1,57 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.gameserver.model.CharSelectInfoPackage;
|
||||
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerRestore;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.CharSelectionInfo;
|
||||
|
||||
/**
|
||||
* This class ...
|
||||
* @version $Revision: 1.4.2.1.2.2 $ $Date: 2005/03/27 15:29:29 $
|
||||
*/
|
||||
public final class CharacterRestore extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__7B_CHARACTERRESTORE = "[C] 7B CharacterRestore";
|
||||
|
||||
// cd
|
||||
private int _charSlot;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_charSlot = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
if (!getClient().getFloodProtectors().getCharacterSelect().tryPerformAction("CharacterRestore"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
getClient().markRestoredChar(_charSlot);
|
||||
final CharSelectionInfo cl = new CharSelectionInfo(getClient().getAccountName(), getClient().getSessionId().playOkID1);
|
||||
sendPacket(cl);
|
||||
getClient().setCharSelection(cl.getCharInfo());
|
||||
final CharSelectInfoPackage charInfo = getClient().getCharSelection(_charSlot);
|
||||
EventDispatcher.getInstance().notifyEvent(new OnPlayerRestore(charInfo.getObjectId(), charInfo.getName(), getClient()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__7B_CHARACTERRESTORE;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.model.CharSelectInfoPackage;
|
||||
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerRestore;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.CharSelectionInfo;
|
||||
|
||||
/**
|
||||
* This class ...
|
||||
* @version $Revision: 1.4.2.1.2.2 $ $Date: 2005/03/27 15:29:29 $
|
||||
*/
|
||||
public final class CharacterRestore implements IClientIncomingPacket
|
||||
{
|
||||
// cd
|
||||
private int _charSlot;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_charSlot = packet.readD();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
if (!client.getFloodProtectors().getCharacterSelect().tryPerformAction("CharacterRestore"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
client.markRestoredChar(_charSlot);
|
||||
final CharSelectionInfo cl = new CharSelectionInfo(client.getAccountName(), client.getSessionId().playOkID1, 0);
|
||||
client.sendPacket(cl);
|
||||
client.setCharSelection(cl.getCharInfo());
|
||||
final CharSelectInfoPackage charInfo = client.getCharSelection(_charSlot);
|
||||
EventDispatcher.getInstance().notifyEvent(new OnPlayerRestore(charInfo.getObjectId(), charInfo.getName(), client));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,194 +1,186 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.LogRecord;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.data.sql.impl.CharNameTable;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.SecondaryAuthData;
|
||||
import com.l2jmobius.gameserver.instancemanager.AntiFeedManager;
|
||||
import com.l2jmobius.gameserver.instancemanager.PunishmentManager;
|
||||
import com.l2jmobius.gameserver.model.CharSelectInfoPackage;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.events.Containers;
|
||||
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSelect;
|
||||
import com.l2jmobius.gameserver.model.events.returns.TerminateReturn;
|
||||
import com.l2jmobius.gameserver.model.punishment.PunishmentAffect;
|
||||
import com.l2jmobius.gameserver.model.punishment.PunishmentType;
|
||||
import com.l2jmobius.gameserver.network.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.L2GameClient.GameClientState;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.CharSelected;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ServerClose;
|
||||
|
||||
/**
|
||||
* This class ...
|
||||
* @version $Revision: 1.5.2.1.2.5 $ $Date: 2005/03/27 15:29:30 $
|
||||
*/
|
||||
public class CharacterSelect extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__12_CHARACTERSELECT = "[C] 12 CharacterSelect";
|
||||
protected static final Logger _logAccounting = Logger.getLogger("accounting");
|
||||
|
||||
// cd
|
||||
private int _charSlot;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private int _unk1; // new in C4
|
||||
@SuppressWarnings("unused")
|
||||
private int _unk2; // new in C4
|
||||
@SuppressWarnings("unused")
|
||||
private int _unk3; // new in C4
|
||||
@SuppressWarnings("unused")
|
||||
private int _unk4; // new in C4
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_charSlot = readD();
|
||||
_unk1 = readH();
|
||||
_unk2 = readD();
|
||||
_unk3 = readD();
|
||||
_unk4 = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2GameClient client = getClient();
|
||||
if (!client.getFloodProtectors().getCharacterSelect().tryPerformAction("CharacterSelect"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (SecondaryAuthData.getInstance().isEnabled() && !client.getSecondaryAuth().isAuthed())
|
||||
{
|
||||
client.getSecondaryAuth().openDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
// We should always be able to acquire the lock
|
||||
// But if we can't lock then nothing should be done (i.e. repeated packet)
|
||||
if (!client.getActiveCharLock().tryLock())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// should always be null
|
||||
// but if not then this is repeated packet and nothing should be done here
|
||||
if (client.getActiveChar() == null)
|
||||
{
|
||||
final CharSelectInfoPackage info = client.getCharSelection(_charSlot);
|
||||
if (info == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Banned?
|
||||
if (PunishmentManager.getInstance().hasPunishment(info.getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.BAN) || PunishmentManager.getInstance().hasPunishment(client.getAccountName(), PunishmentAffect.ACCOUNT, PunishmentType.BAN) || PunishmentManager.getInstance().hasPunishment(client.getConnectionAddress().getHostAddress(), PunishmentAffect.IP, PunishmentType.BAN) || (info.getAccessLevel() < 0))
|
||||
{
|
||||
client.close(ServerClose.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((Config.L2JMOD_DUALBOX_CHECK_MAX_PLAYERS_PER_IP > 0) && !AntiFeedManager.getInstance().tryAddClient(AntiFeedManager.GAME_ID, client, Config.L2JMOD_DUALBOX_CHECK_MAX_PLAYERS_PER_IP))
|
||||
{
|
||||
final NpcHtmlMessage msg = new NpcHtmlMessage();
|
||||
msg.setFile(info.getHtmlPrefix(), "html/mods/IPRestriction.htm");
|
||||
msg.replace("%max%", String.valueOf(AntiFeedManager.getInstance().getLimit(client, Config.L2JMOD_DUALBOX_CHECK_MAX_PLAYERS_PER_IP)));
|
||||
client.sendPacket(msg);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Config.FACTION_SYSTEM_ENABLED && Config.FACTION_BALANCE_ONLINE_PLAYERS)
|
||||
{
|
||||
if (info.isGood() && (L2World.getInstance().getAllGoodPlayersCount() >= (L2World.getInstance().getAllEvilPlayersCount() + Config.FACTION_BALANCE_PLAYER_EXCEED_LIMIT)))
|
||||
{
|
||||
final NpcHtmlMessage msg = new NpcHtmlMessage();
|
||||
msg.setFile(info.getHtmlPrefix(), "html/mods/Faction/ExceededOnlineLimit.htm");
|
||||
msg.replace("%more%", Config.FACTION_GOOD_TEAM_NAME);
|
||||
msg.replace("%less%", Config.FACTION_EVIL_TEAM_NAME);
|
||||
client.sendPacket(msg);
|
||||
return;
|
||||
}
|
||||
if (info.isEvil() && (L2World.getInstance().getAllEvilPlayersCount() >= (L2World.getInstance().getAllGoodPlayersCount() + Config.FACTION_BALANCE_PLAYER_EXCEED_LIMIT)))
|
||||
{
|
||||
final NpcHtmlMessage msg = new NpcHtmlMessage();
|
||||
msg.setFile(info.getHtmlPrefix(), "html/mods/Faction/ExceededOnlineLimit.htm");
|
||||
msg.replace("%more%", Config.FACTION_EVIL_TEAM_NAME);
|
||||
msg.replace("%less%", Config.FACTION_GOOD_TEAM_NAME);
|
||||
client.sendPacket(msg);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// The L2PcInstance must be created here, so that it can be attached to the L2GameClient
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
_log.fine("selected slot:" + _charSlot);
|
||||
}
|
||||
|
||||
// load up character from disk
|
||||
final L2PcInstance cha = client.loadCharFromDisk(_charSlot);
|
||||
if (cha == null)
|
||||
{
|
||||
return; // handled in L2GameClient
|
||||
}
|
||||
L2World.getInstance().addPlayerToWorld(cha);
|
||||
CharNameTable.getInstance().addName(cha);
|
||||
|
||||
cha.setClient(client);
|
||||
client.setActiveChar(cha);
|
||||
cha.setOnlineStatus(true, true);
|
||||
|
||||
final TerminateReturn terminate = EventDispatcher.getInstance().notifyEvent(new OnPlayerSelect(cha, cha.getObjectId(), cha.getName(), getClient()), Containers.Players(), TerminateReturn.class);
|
||||
if ((terminate != null) && terminate.terminate())
|
||||
{
|
||||
cha.deleteMe();
|
||||
return;
|
||||
}
|
||||
|
||||
client.setState(GameClientState.IN_GAME);
|
||||
sendPacket(new CharSelected(cha, client.getSessionId().playOkID1));
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
client.getActiveCharLock().unlock();
|
||||
}
|
||||
|
||||
final LogRecord record = new LogRecord(Level.INFO, "Logged in");
|
||||
record.setParameters(new Object[]
|
||||
{
|
||||
client
|
||||
});
|
||||
_logAccounting.log(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__12_CHARACTERSELECT;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.data.sql.impl.CharNameTable;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.SecondaryAuthData;
|
||||
import com.l2jmobius.gameserver.instancemanager.AntiFeedManager;
|
||||
import com.l2jmobius.gameserver.instancemanager.PunishmentManager;
|
||||
import com.l2jmobius.gameserver.model.CharSelectInfoPackage;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.events.Containers;
|
||||
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSelect;
|
||||
import com.l2jmobius.gameserver.model.events.returns.TerminateReturn;
|
||||
import com.l2jmobius.gameserver.model.punishment.PunishmentAffect;
|
||||
import com.l2jmobius.gameserver.model.punishment.PunishmentType;
|
||||
import com.l2jmobius.gameserver.network.client.ConnectionState;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.CharSelected;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ServerClose;
|
||||
|
||||
/**
|
||||
* This class ...
|
||||
* @version $Revision: 1.5.2.1.2.5 $ $Date: 2005/03/27 15:29:30 $
|
||||
*/
|
||||
public class CharacterSelect implements IClientIncomingPacket
|
||||
{
|
||||
protected static final Logger _logAccounting = Logger.getLogger("accounting");
|
||||
|
||||
// cd
|
||||
private int _charSlot;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private int _unk1; // new in C4
|
||||
@SuppressWarnings("unused")
|
||||
private int _unk2; // new in C4
|
||||
@SuppressWarnings("unused")
|
||||
private int _unk3; // new in C4
|
||||
@SuppressWarnings("unused")
|
||||
private int _unk4; // new in C4
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_charSlot = packet.readD();
|
||||
_unk1 = packet.readH();
|
||||
_unk2 = packet.readD();
|
||||
_unk3 = packet.readD();
|
||||
_unk4 = packet.readD();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
if (!client.getFloodProtectors().getCharacterSelect().tryPerformAction("CharacterSelect"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (SecondaryAuthData.getInstance().isEnabled() && !client.getSecondaryAuth().isAuthed())
|
||||
{
|
||||
client.getSecondaryAuth().openDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
// We should always be able to acquire the lock
|
||||
// But if we can't lock then nothing should be done (i.e. repeated packet)
|
||||
if (client.getActiveCharLock().tryLock())
|
||||
{
|
||||
try
|
||||
{
|
||||
// should always be null
|
||||
// but if not then this is repeated packet and nothing should be done here
|
||||
if (client.getActiveChar() == null)
|
||||
{
|
||||
final CharSelectInfoPackage info = client.getCharSelection(_charSlot);
|
||||
if (info == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Banned?
|
||||
if (PunishmentManager.getInstance().hasPunishment(info.getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.BAN) || PunishmentManager.getInstance().hasPunishment(client.getAccountName(), PunishmentAffect.ACCOUNT, PunishmentType.BAN) || PunishmentManager.getInstance().hasPunishment(client.getConnectionAddress().getHostAddress(), PunishmentAffect.IP, PunishmentType.BAN))
|
||||
{
|
||||
client.close(ServerClose.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
// Selected character is banned (compatibility with previous versions).
|
||||
if (info.getAccessLevel() < 0)
|
||||
{
|
||||
client.close(ServerClose.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((Config.L2JMOD_DUALBOX_CHECK_MAX_PLAYERS_PER_IP > 0) && !AntiFeedManager.getInstance().tryAddClient(AntiFeedManager.GAME_ID, client, Config.L2JMOD_DUALBOX_CHECK_MAX_PLAYERS_PER_IP))
|
||||
{
|
||||
final NpcHtmlMessage msg = new NpcHtmlMessage();
|
||||
msg.setFile(info.getHtmlPrefix(), "data/html/mods/IPRestriction.htm");
|
||||
msg.replace("%max%", String.valueOf(AntiFeedManager.getInstance().getLimit(client, Config.L2JMOD_DUALBOX_CHECK_MAX_PLAYERS_PER_IP)));
|
||||
client.sendPacket(msg);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Config.FACTION_SYSTEM_ENABLED && Config.FACTION_BALANCE_ONLINE_PLAYERS)
|
||||
{
|
||||
if (info.isGood() && (L2World.getInstance().getAllGoodPlayers().size() >= (L2World.getInstance().getAllEvilPlayers().size() + Config.FACTION_BALANCE_PLAYER_EXCEED_LIMIT)))
|
||||
{
|
||||
final NpcHtmlMessage msg = new NpcHtmlMessage();
|
||||
msg.setFile(info.getHtmlPrefix(), "data/html/mods/Faction/ExceededOnlineLimit.htm");
|
||||
msg.replace("%more%", Config.FACTION_GOOD_TEAM_NAME);
|
||||
msg.replace("%less%", Config.FACTION_EVIL_TEAM_NAME);
|
||||
client.sendPacket(msg);
|
||||
return;
|
||||
}
|
||||
if (info.isEvil() && (L2World.getInstance().getAllEvilPlayers().size() >= (L2World.getInstance().getAllGoodPlayers().size() + Config.FACTION_BALANCE_PLAYER_EXCEED_LIMIT)))
|
||||
{
|
||||
final NpcHtmlMessage msg = new NpcHtmlMessage();
|
||||
msg.setFile(info.getHtmlPrefix(), "data/html/mods/Faction/ExceededOnlineLimit.htm");
|
||||
msg.replace("%more%", Config.FACTION_EVIL_TEAM_NAME);
|
||||
msg.replace("%less%", Config.FACTION_GOOD_TEAM_NAME);
|
||||
client.sendPacket(msg);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// The L2PcInstance must be created here, so that it can be attached to the L2GameClient
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
_log.finer("selected slot:" + _charSlot);
|
||||
}
|
||||
|
||||
// load up character from disk
|
||||
final L2PcInstance cha = client.loadCharFromDisk(_charSlot);
|
||||
if (cha == null)
|
||||
{
|
||||
return; // handled in L2GameClient
|
||||
}
|
||||
|
||||
CharNameTable.getInstance().addName(cha);
|
||||
|
||||
cha.setClient(client);
|
||||
client.setActiveChar(cha);
|
||||
cha.setOnlineStatus(true, true);
|
||||
|
||||
final TerminateReturn terminate = EventDispatcher.getInstance().notifyEvent(new OnPlayerSelect(cha, cha.getObjectId(), cha.getName(), client), Containers.Players(), TerminateReturn.class);
|
||||
if ((terminate != null) && terminate.terminate())
|
||||
{
|
||||
cha.deleteMe();
|
||||
return;
|
||||
}
|
||||
|
||||
client.setConnectionState(ConnectionState.IN_GAME);
|
||||
client.sendPacket(new CharSelected(cha, client.getSessionId().playOkID1));
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
client.getActiveCharLock().unlock();
|
||||
}
|
||||
|
||||
_logAccounting.info("Logged in, " + client);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,128 +1,119 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.AdminData;
|
||||
import com.l2jmobius.gameserver.enums.PlayerAction;
|
||||
import com.l2jmobius.gameserver.handler.AdminCommandHandler;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerDlgAnswer;
|
||||
import com.l2jmobius.gameserver.model.events.returns.TerminateReturn;
|
||||
import com.l2jmobius.gameserver.model.holders.DoorRequestHolder;
|
||||
import com.l2jmobius.gameserver.model.holders.SummonRequestHolder;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.util.GMAudit;
|
||||
|
||||
/**
|
||||
* @author Dezmond_snz
|
||||
*/
|
||||
public final class DlgAnswer extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__C6_DLGANSWER = "[C] C6 DlgAnswer";
|
||||
private int _messageId;
|
||||
private int _answer;
|
||||
private int _requesterId;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_messageId = readD();
|
||||
_answer = readD();
|
||||
_requesterId = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final TerminateReturn term = EventDispatcher.getInstance().notifyEvent(new OnPlayerDlgAnswer(activeChar, _messageId, _answer, _requesterId), activeChar, TerminateReturn.class);
|
||||
if ((term != null) && term.terminate())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_messageId == SystemMessageId.S13.getId())
|
||||
{
|
||||
if (activeChar.removeAction(PlayerAction.USER_ENGAGE))
|
||||
{
|
||||
if (Config.L2JMOD_ALLOW_WEDDING)
|
||||
{
|
||||
activeChar.engageAnswer(_answer);
|
||||
}
|
||||
}
|
||||
else if (activeChar.removeAction(PlayerAction.ADMIN_COMMAND))
|
||||
{
|
||||
final String cmd = activeChar.getAdminConfirmCmd();
|
||||
activeChar.setAdminConfirmCmd(null);
|
||||
if (_answer == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
final String command = cmd.split(" ")[0];
|
||||
if (AdminData.getInstance().hasAccess(command, activeChar.getAccessLevel()))
|
||||
{
|
||||
if (Config.GMAUDIT)
|
||||
{
|
||||
GMAudit.auditGMAction(activeChar.getName() + " [" + activeChar.getObjectId() + "]", cmd, activeChar.getTarget() != null ? activeChar.getTarget().getName() : "no-target");
|
||||
}
|
||||
AdminCommandHandler.getInstance().getHandler(command).useAdminCommand(cmd, activeChar);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((_messageId == SystemMessageId.C1_IS_ATTEMPTING_TO_DO_A_RESURRECTION_THAT_RESTORES_S2_S3_XP_ACCEPT.getId()) || (_messageId == SystemMessageId.YOUR_CHARM_OF_COURAGE_IS_TRYING_TO_RESURRECT_YOU_WOULD_YOU_LIKE_TO_RESURRECT_NOW.getId()))
|
||||
{
|
||||
activeChar.reviveAnswer(_answer);
|
||||
}
|
||||
else if (_messageId == SystemMessageId.C1_WISHES_TO_SUMMON_YOU_FROM_S2_DO_YOU_ACCEPT.getId())
|
||||
{
|
||||
final SummonRequestHolder holder = activeChar.removeScript(SummonRequestHolder.class);
|
||||
if ((_answer == 1) && (holder != null) && (holder.getTarget().getObjectId() == _requesterId))
|
||||
{
|
||||
activeChar.teleToLocation(holder.getTarget().getLocation(), true);
|
||||
}
|
||||
}
|
||||
else if (_messageId == SystemMessageId.WOULD_YOU_LIKE_TO_OPEN_THE_GATE.getId())
|
||||
{
|
||||
final DoorRequestHolder holder = activeChar.removeScript(DoorRequestHolder.class);
|
||||
if ((holder != null) && (holder.getDoor() == activeChar.getTarget()) && (_answer == 1))
|
||||
{
|
||||
holder.getDoor().openMe();
|
||||
}
|
||||
}
|
||||
else if (_messageId == SystemMessageId.WOULD_YOU_LIKE_TO_CLOSE_THE_GATE.getId())
|
||||
{
|
||||
final DoorRequestHolder holder = activeChar.removeScript(DoorRequestHolder.class);
|
||||
if ((holder != null) && (holder.getDoor() == activeChar.getTarget()) && (_answer == 1))
|
||||
{
|
||||
holder.getDoor().closeMe();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__C6_DLGANSWER;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.AdminData;
|
||||
import com.l2jmobius.gameserver.enums.PlayerAction;
|
||||
import com.l2jmobius.gameserver.handler.AdminCommandHandler;
|
||||
import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerDlgAnswer;
|
||||
import com.l2jmobius.gameserver.model.events.returns.TerminateReturn;
|
||||
import com.l2jmobius.gameserver.model.holders.DoorRequestHolder;
|
||||
import com.l2jmobius.gameserver.model.holders.SummonRequestHolder;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.util.GMAudit;
|
||||
|
||||
/**
|
||||
* @author Dezmond_snz
|
||||
*/
|
||||
public final class DlgAnswer implements IClientIncomingPacket
|
||||
{
|
||||
private int _messageId;
|
||||
private int _answer;
|
||||
private int _requesterId;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_messageId = packet.readD();
|
||||
_answer = packet.readD();
|
||||
_requesterId = packet.readD();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final L2PcInstance activeChar = client.getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final TerminateReturn term = EventDispatcher.getInstance().notifyEvent(new OnPlayerDlgAnswer(activeChar, _messageId, _answer, _requesterId), activeChar, TerminateReturn.class);
|
||||
if ((term != null) && term.terminate())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_messageId == SystemMessageId.S13.getId())
|
||||
{
|
||||
if (activeChar.removeAction(PlayerAction.ADMIN_COMMAND))
|
||||
{
|
||||
final String cmd = activeChar.getAdminConfirmCmd();
|
||||
activeChar.setAdminConfirmCmd(null);
|
||||
if (_answer == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
final String command = cmd.split(" ")[0];
|
||||
final IAdminCommandHandler ach = AdminCommandHandler.getInstance().getHandler(command);
|
||||
if (AdminData.getInstance().hasAccess(command, activeChar.getAccessLevel()))
|
||||
{
|
||||
if (Config.GMAUDIT)
|
||||
{
|
||||
GMAudit.auditGMAction(activeChar.getName() + " [" + activeChar.getObjectId() + "]", cmd, (activeChar.getTarget() != null ? activeChar.getTarget().getName() : "no-target"));
|
||||
}
|
||||
ach.useAdminCommand(cmd, activeChar);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((_messageId == SystemMessageId.C1_IS_ATTEMPTING_TO_DO_A_RESURRECTION_THAT_RESTORES_S2_S3_XP_ACCEPT.getId()) || (_messageId == SystemMessageId.YOUR_CHARM_OF_COURAGE_IS_TRYING_TO_RESURRECT_YOU_WOULD_YOU_LIKE_TO_RESURRECT_NOW.getId()))
|
||||
{
|
||||
activeChar.reviveAnswer(_answer);
|
||||
}
|
||||
else if (_messageId == SystemMessageId.C1_WISHES_TO_SUMMON_YOU_FROM_S2_DO_YOU_ACCEPT.getId())
|
||||
{
|
||||
final SummonRequestHolder holder = activeChar.removeScript(SummonRequestHolder.class);
|
||||
if ((_answer == 1) && (holder != null) && (holder.getTarget().getObjectId() == _requesterId))
|
||||
{
|
||||
activeChar.teleToLocation(holder.getTarget().getLocation(), true);
|
||||
}
|
||||
}
|
||||
else if (_messageId == SystemMessageId.WOULD_YOU_LIKE_TO_OPEN_THE_GATE.getId())
|
||||
{
|
||||
final DoorRequestHolder holder = activeChar.removeScript(DoorRequestHolder.class);
|
||||
if ((holder != null) && (holder.getDoor() == activeChar.getTarget()) && (_answer == 1))
|
||||
{
|
||||
holder.getDoor().openMe();
|
||||
}
|
||||
}
|
||||
else if (_messageId == SystemMessageId.WOULD_YOU_LIKE_TO_CLOSE_THE_GATE.getId())
|
||||
{
|
||||
final DoorRequestHolder holder = activeChar.removeScript(DoorRequestHolder.class);
|
||||
if ((holder != null) && (holder.getDoor() == activeChar.getTarget()) && (_answer == 1))
|
||||
{
|
||||
holder.getDoor().closeMe();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,39 +1,38 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* @author zabbix Lets drink to code!
|
||||
*/
|
||||
public final class DummyPacket extends L2GameClientPacket
|
||||
{
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runImpl()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return "DummyPacket";
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
|
||||
/**
|
||||
* @author zabbix Lets drink to code!
|
||||
*/
|
||||
public final class DummyPacket implements IClientIncomingPacket
|
||||
{
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,61 +1,55 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
|
||||
/**
|
||||
* @author JIV
|
||||
*/
|
||||
public final class EndScenePlayer extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_5B_ENDSCENEPLAYER = "[C] D0:5B EndScenePlayer";
|
||||
|
||||
private int _movieId;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_movieId = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if ((activeChar == null) || (_movieId == 0))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (activeChar.getMovieId() != _movieId)
|
||||
{
|
||||
_log.warning("Player " + getClient() + " sent EndScenePlayer with wrong movie id: " + _movieId);
|
||||
return;
|
||||
}
|
||||
activeChar.setMovieId(0);
|
||||
activeChar.setIsTeleporting(true, false); // avoid to get player removed from L2World
|
||||
activeChar.decayMe();
|
||||
activeChar.spawnMe(activeChar.getX(), activeChar.getY(), activeChar.getZ());
|
||||
activeChar.setIsTeleporting(false, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_5B_ENDSCENEPLAYER;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.holders.MovieHolder;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
|
||||
/**
|
||||
* @author JIV
|
||||
*/
|
||||
public final class EndScenePlayer implements IClientIncomingPacket
|
||||
{
|
||||
private int _movieId;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_movieId = packet.readD();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final L2PcInstance activeChar = client.getActiveChar();
|
||||
if ((activeChar == null) || (_movieId == 0))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final MovieHolder holder = activeChar.getMovieHolder();
|
||||
if ((holder == null) || (holder.getMovie().getClientId() != _movieId))
|
||||
{
|
||||
_log.warning("Player " + client + " sent EndScenePlayer with wrong movie id: " + _movieId);
|
||||
return;
|
||||
}
|
||||
activeChar.stopMovie();
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.IIncomingPacket;
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
|
||||
/**
|
||||
* @author Sdw
|
||||
*/
|
||||
public class ExBookmarkPacket implements IClientIncomingPacket
|
||||
{
|
||||
private IIncomingPacket<L2GameClient> _exBookmarkPacket;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
final int subId = packet.readD();
|
||||
|
||||
switch (subId)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
_exBookmarkPacket = new RequestBookMarkSlotInfo();
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
_exBookmarkPacket = new RequestSaveBookMarkSlot();
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
_exBookmarkPacket = new RequestModifyBookMarkSlot();
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
_exBookmarkPacket = new RequestDeleteBookMarkSlot();
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
_exBookmarkPacket = new RequestTeleportBookMark();
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
_exBookmarkPacket = new RequestChangeBookMarkSlot();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return (_exBookmarkPacket != null) && _exBookmarkPacket.read(client, packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client) throws Exception
|
||||
{
|
||||
_exBookmarkPacket.run(client);
|
||||
}
|
||||
}
|
||||
@@ -1,55 +1,51 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* Format: (c) dddd d: dx d: dy d: dz d: AirShip id ??
|
||||
* @author -Wooden-
|
||||
*/
|
||||
public class ExGetOnAirShip extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_36_EXGETONAIRSHIP = "[C] D0:36 ExGetOnAirShip";
|
||||
|
||||
private int _x;
|
||||
private int _y;
|
||||
private int _z;
|
||||
private int _shipId;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_x = readD();
|
||||
_y = readD();
|
||||
_z = readD();
|
||||
_shipId = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
_log.info("[T1:ExGetOnAirShip] x: " + _x);
|
||||
_log.info("[T1:ExGetOnAirShip] y: " + _y);
|
||||
_log.info("[T1:ExGetOnAirShip] z: " + _z);
|
||||
_log.info("[T1:ExGetOnAirShip] ship ID: " + _shipId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_36_EXGETONAIRSHIP;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
|
||||
/**
|
||||
* Format: (c) dddd d: dx d: dy d: dz d: AirShip id ??
|
||||
* @author -Wooden-
|
||||
*/
|
||||
public class ExGetOnAirShip implements IClientIncomingPacket
|
||||
{
|
||||
private int _x;
|
||||
private int _y;
|
||||
private int _z;
|
||||
private int _shipId;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_x = packet.readD();
|
||||
_y = packet.readD();
|
||||
_z = packet.readD();
|
||||
_shipId = packet.readD();
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
_log.info("[T1:ExGetOnAirShip] x: " + _x);
|
||||
_log.info("[T1:ExGetOnAirShip] y: " + _y);
|
||||
_log.info("[T1:ExGetOnAirShip] z: " + _z);
|
||||
_log.info("[T1:ExGetOnAirShip] ship ID: " + _shipId);
|
||||
}
|
||||
}
|
||||
|
||||
+16
-24
@@ -16,37 +16,29 @@
|
||||
*/
|
||||
package com.l2jmobius.gameserver.network.clientpackets;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
|
||||
public class ExPCCafeRequestOpenWindowWithoutNPC extends L2GameClientPacket
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ExPCCafeRequestOpenWindowWithoutNPC implements IClientIncomingPacket
|
||||
{
|
||||
@Override
|
||||
protected void readImpl()
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final L2PcInstance _activeChar = getClient().getActiveChar();
|
||||
if ((_activeChar != null) && Config.PC_BANG_ENABLED)
|
||||
{
|
||||
getHtmlPage(_activeChar);
|
||||
}
|
||||
}
|
||||
|
||||
public void getHtmlPage(L2PcInstance player)
|
||||
{
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage();
|
||||
html.setFile(player.getHtmlPrefix(), "html/pccafe.htm");
|
||||
player.sendPacket(html);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return getClass().getName();
|
||||
// final L2PcInstance activeChar = client.getActiveChar();
|
||||
// if ((activeChar != null) && Config.PC_BANG_ENABLED)
|
||||
// {
|
||||
// final NpcHtmlMessage html = new NpcHtmlMessage();
|
||||
// html.setFile(activeChar.getHtmlPrefix(), "data/html/pccafe.htm");
|
||||
// activeChar.sendPacket(html);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.IIncomingPacket;
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.network.client.ExIncomingPackets;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
|
||||
/**
|
||||
* @author Nos
|
||||
*/
|
||||
public class ExPacket implements IClientIncomingPacket
|
||||
{
|
||||
// private static final Logger LOGGER = Logger.getLogger(ExPacket.class.getName());
|
||||
|
||||
private ExIncomingPackets _exIncomingPacket;
|
||||
private IIncomingPacket<L2GameClient> _exPacket;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
final int exPacketId = packet.readH() & 0xFFFF;
|
||||
if ((exPacketId < 0) || (exPacketId >= ExIncomingPackets.PACKET_ARRAY.length))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
_exIncomingPacket = ExIncomingPackets.PACKET_ARRAY[exPacketId];
|
||||
if (_exIncomingPacket == null)
|
||||
{
|
||||
// LOGGER.finer(getClass().getSimpleName() + ": Unknown packet: " + Integer.toHexString(exPacketId));
|
||||
return false;
|
||||
}
|
||||
|
||||
_exPacket = _exIncomingPacket.newIncomingPacket();
|
||||
return (_exPacket != null) && _exPacket.read(client, packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client) throws Exception
|
||||
{
|
||||
if (!_exIncomingPacket.getConnectionStates().contains(client.getConnectionState()))
|
||||
{
|
||||
// LOGGER.finer(_exIncomingPacket + ": Connection at invalid state: " + client.getConnectionState() + " Required State: " + _exIncomingPacket.getConnectionStates());
|
||||
return;
|
||||
}
|
||||
_exPacket.run(client);
|
||||
}
|
||||
}
|
||||
+55
-55
@@ -1,55 +1,55 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.gameserver.instancemanager.JumpManager;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
|
||||
/**
|
||||
* Format: (ch)d
|
||||
* @author mrTJO
|
||||
*/
|
||||
public final class RequestFlyMove extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_94_REQUESTFLYMOVE = "[C] D0:94 RequestFlyMove";
|
||||
int _nextPoint;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_nextPoint = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
JumpManager.getInstance().NextJump(activeChar, _nextPoint);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_94_REQUESTFLYMOVE;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
|
||||
/**
|
||||
* @author St3eT
|
||||
*/
|
||||
public final class ExRequestAutoFish implements IClientIncomingPacket
|
||||
{
|
||||
private boolean _start;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_start = packet.readC() != 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final L2PcInstance activeChar = client.getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_start)
|
||||
{
|
||||
activeChar.getFishing().startFishing();
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.getFishing().stopFishing();
|
||||
}
|
||||
}
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
|
||||
/**
|
||||
* @author St3eT
|
||||
*/
|
||||
public final class ExSendSelectedQuestZoneID implements IClientIncomingPacket
|
||||
{
|
||||
private int _questZoneId;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_questZoneId = packet.readD();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final L2PcInstance activeChar = client.getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
activeChar.setQuestZoneId(_questZoneId);
|
||||
}
|
||||
}
|
||||
@@ -1,69 +1,64 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.StopRotation;
|
||||
|
||||
/**
|
||||
* This class ...
|
||||
* @version $Revision: 1.1.4.3 $ $Date: 2005/03/27 15:29:30 $
|
||||
*/
|
||||
public final class FinishRotating extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__5C_FINISHROTATING = "[C] 5C FinishRotating";
|
||||
|
||||
private int _degree;
|
||||
@SuppressWarnings("unused")
|
||||
private int _unknown;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_degree = readD();
|
||||
_unknown = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
StopRotation sr;
|
||||
if (activeChar.isInAirShip() && activeChar.getAirShip().isCaptain(activeChar))
|
||||
{
|
||||
activeChar.getAirShip().setHeading(_degree);
|
||||
sr = new StopRotation(activeChar.getAirShip().getObjectId(), _degree, 0);
|
||||
activeChar.getAirShip().broadcastPacket(sr);
|
||||
}
|
||||
else
|
||||
{
|
||||
sr = new StopRotation(activeChar.getObjectId(), _degree, 0);
|
||||
activeChar.broadcastPacket(sr);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__5C_FINISHROTATING;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.StopRotation;
|
||||
|
||||
/**
|
||||
* This class ...
|
||||
* @version $Revision: 1.1.4.3 $ $Date: 2005/03/27 15:29:30 $
|
||||
*/
|
||||
public final class FinishRotating implements IClientIncomingPacket
|
||||
{
|
||||
private int _degree;
|
||||
@SuppressWarnings("unused")
|
||||
private int _unknown;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_degree = packet.readD();
|
||||
_unknown = packet.readD();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final L2PcInstance activeChar = client.getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
StopRotation sr;
|
||||
if (activeChar.isInAirShip() && activeChar.getAirShip().isCaptain(activeChar))
|
||||
{
|
||||
activeChar.getAirShip().setHeading(_degree);
|
||||
sr = new StopRotation(activeChar.getAirShip().getObjectId(), _degree, 0);
|
||||
activeChar.getAirShip().broadcastPacket(sr);
|
||||
}
|
||||
else
|
||||
{
|
||||
sr = new StopRotation(activeChar.getObjectId(), _degree, 0);
|
||||
activeChar.broadcastPacket(sr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,96 +1,85 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Arrays;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.l2jmobius.gameserver.network.L2GameClient;
|
||||
|
||||
/**
|
||||
* Format: c dddd
|
||||
* @author KenM
|
||||
*/
|
||||
public class GameGuardReply extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__CB_GAMEGUARDREPLY = "[C] CB GameGuardReply";
|
||||
|
||||
private static final byte[] VALID =
|
||||
{
|
||||
(byte) 0x88,
|
||||
0x40,
|
||||
0x1c,
|
||||
(byte) 0xa7,
|
||||
(byte) 0x83,
|
||||
0x42,
|
||||
(byte) 0xe9,
|
||||
0x15,
|
||||
(byte) 0xde,
|
||||
(byte) 0xc3,
|
||||
0x68,
|
||||
(byte) 0xf6,
|
||||
0x2d,
|
||||
0x23,
|
||||
(byte) 0xf1,
|
||||
0x3f,
|
||||
(byte) 0xee,
|
||||
0x68,
|
||||
0x5b,
|
||||
(byte) 0xc5,
|
||||
};
|
||||
|
||||
private final byte[] _reply = new byte[8];
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
readB(_reply, 0, 4);
|
||||
readD();
|
||||
readB(_reply, 4, 4);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2GameClient client = getClient();
|
||||
try
|
||||
{
|
||||
if (Arrays.equals(MessageDigest.getInstance("SHA").digest(_reply), VALID))
|
||||
{
|
||||
client.setGameGuardOk(true);
|
||||
}
|
||||
}
|
||||
catch (NoSuchAlgorithmException e)
|
||||
{
|
||||
_log.log(Level.WARNING, "", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__CB_GAMEGUARDREPLY;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean triggersOnActionRequest()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Arrays;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
|
||||
/**
|
||||
* Format: c dddd
|
||||
* @author KenM
|
||||
*/
|
||||
public class GameGuardReply implements IClientIncomingPacket
|
||||
{
|
||||
private static final byte[] VALID =
|
||||
{
|
||||
(byte) 0x88,
|
||||
0x40,
|
||||
0x1c,
|
||||
(byte) 0xa7,
|
||||
(byte) 0x83,
|
||||
0x42,
|
||||
(byte) 0xe9,
|
||||
0x15,
|
||||
(byte) 0xde,
|
||||
(byte) 0xc3,
|
||||
0x68,
|
||||
(byte) 0xf6,
|
||||
0x2d,
|
||||
0x23,
|
||||
(byte) 0xf1,
|
||||
0x3f,
|
||||
(byte) 0xee,
|
||||
0x68,
|
||||
0x5b,
|
||||
(byte) 0xc5,
|
||||
};
|
||||
|
||||
private final byte[] _reply = new byte[8];
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
packet.readB(_reply, 0, 4);
|
||||
packet.readD();
|
||||
packet.readB(_reply, 4, 4);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
try
|
||||
{
|
||||
final MessageDigest md = MessageDigest.getInstance("SHA");
|
||||
final byte[] result = md.digest(_reply);
|
||||
if (Arrays.equals(result, VALID))
|
||||
{
|
||||
client.setGameGuardOk(true);
|
||||
}
|
||||
}
|
||||
catch (NoSuchAlgorithmException e)
|
||||
{
|
||||
_log.log(Level.WARNING, "", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+31
-38
@@ -1,38 +1,31 @@
|
||||
/*
|
||||
* 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.dailymission;
|
||||
|
||||
import com.l2jmobius.gameserver.network.serverpackets.L2GameServerPacket;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ExTodoListRecommend extends L2GameServerPacket
|
||||
{
|
||||
public ExTodoListRecommend()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeImpl()
|
||||
{
|
||||
writeC(0xFE);
|
||||
writeH(0x18A);
|
||||
writeH(0x00); // Loop size.
|
||||
// TODO: Add loop.
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.commons.network.IIncomingPacket;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
|
||||
/**
|
||||
* Packets received by the game server from clients
|
||||
* @author KenM
|
||||
*/
|
||||
public interface IClientIncomingPacket extends IIncomingPacket<L2GameClient>
|
||||
{
|
||||
Logger _log = Logger.getLogger(IClientIncomingPacket.class.getName());
|
||||
}
|
||||
@@ -1,148 +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;
|
||||
|
||||
import java.nio.BufferUnderflowException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.mmocore.ReceivablePacket;
|
||||
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.serverpackets.ActionFailed;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.L2GameServerPacket;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
* Packets received by the game server from clients
|
||||
* @author KenM
|
||||
*/
|
||||
public abstract class L2GameClientPacket extends ReceivablePacket<L2GameClient>
|
||||
{
|
||||
protected static final Logger _log = Logger.getLogger(L2GameClientPacket.class.getName());
|
||||
|
||||
@Override
|
||||
public boolean read()
|
||||
{
|
||||
try
|
||||
{
|
||||
readImpl();
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.SEVERE, "Client: " + getClient().toString() + " - Failed reading: " + getType() + " ; " + e.getMessage(), e);
|
||||
|
||||
if (e instanceof BufferUnderflowException)
|
||||
{
|
||||
getClient().onBufferUnderflow();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected abstract void readImpl();
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
try
|
||||
{
|
||||
runImpl();
|
||||
|
||||
/*
|
||||
* Removes onspawn protection - player has faster computer than average Since GE: True for all packets except RequestItemList and UseItem (in case the item is a Scroll of Escape (736)
|
||||
*/
|
||||
if (triggersOnActionRequest())
|
||||
{
|
||||
final L2PcInstance actor = getClient().getActiveChar();
|
||||
if ((actor != null) && (actor.isSpawnProtected() || actor.isInvul()))
|
||||
{
|
||||
actor.onActionRequest();
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
_log.info("Spawn protection for player " + actor.getName() + " removed by packet: " + getType());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
_log.log(Level.SEVERE, "Client: " + getClient().toString() + " - Failed running: " + getType() + " ; " + t.getMessage(), t);
|
||||
// in case of EnterWorld error kick player from game
|
||||
if (this instanceof EnterWorld)
|
||||
{
|
||||
getClient().closeNow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void runImpl();
|
||||
|
||||
/**
|
||||
* Sends a game server packet to the client.
|
||||
* @param gsp the game server packet
|
||||
*/
|
||||
protected final void sendPacket(L2GameServerPacket gsp)
|
||||
{
|
||||
getClient().sendPacket(gsp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a system message to the client.
|
||||
* @param id the system message Id
|
||||
*/
|
||||
public void sendPacket(SystemMessageId id)
|
||||
{
|
||||
sendPacket(SystemMessage.getSystemMessage(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return A String with this packet name for debugging purposes
|
||||
*/
|
||||
public String getType()
|
||||
{
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Overridden with true value on some packets that should disable spawn protection (RequestItemList and UseItem only)
|
||||
* @return
|
||||
*/
|
||||
protected boolean triggersOnActionRequest()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the active player if exist, otherwise null.
|
||||
*/
|
||||
protected final L2PcInstance getActiveChar()
|
||||
{
|
||||
return getClient().getActiveChar();
|
||||
}
|
||||
|
||||
protected final void sendActionFailed()
|
||||
{
|
||||
if (getClient() != null)
|
||||
{
|
||||
getClient().sendPacket(ActionFailed.STATIC_PACKET);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,104 +1,90 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.LogRecord;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.entity.L2Event;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
import com.l2jmobius.gameserver.taskmanager.AttackStanceTaskManager;
|
||||
|
||||
/**
|
||||
* This class ...
|
||||
* @version $Revision: 1.9.4.3 $ $Date: 2005/03/27 15:29:30 $
|
||||
*/
|
||||
public final class Logout extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__00_LOGOUT = "[C] 00 Logout";
|
||||
protected static final Logger _logAccounting = Logger.getLogger("accounting");
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance player = getClient().getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.hasItemRequest())
|
||||
{
|
||||
player.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.isLocked())
|
||||
{
|
||||
_log.warning("Player " + player.getName() + " tried to logout during class change.");
|
||||
player.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't allow leaving if player is fighting
|
||||
if (AttackStanceTaskManager.getInstance().hasAttackStanceTask(player))
|
||||
{
|
||||
if (player.isGM() && Config.GM_RESTART_FIGHTING)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_EXIT_THE_GAME_WHILE_IN_COMBAT);
|
||||
player.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
if (L2Event.isParticipant(player))
|
||||
{
|
||||
player.sendMessage("A superior power doesn't allow you to leave the event.");
|
||||
player.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove player from Boss Zone
|
||||
player.removeFromBossZone();
|
||||
|
||||
final LogRecord record = new LogRecord(Level.INFO, "Disconnected");
|
||||
record.setParameters(new Object[]
|
||||
{
|
||||
getClient()
|
||||
});
|
||||
_logAccounting.log(record);
|
||||
|
||||
player.logout();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__00_LOGOUT;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.entity.L2Event;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
import com.l2jmobius.gameserver.taskmanager.AttackStanceTaskManager;
|
||||
|
||||
/**
|
||||
* This class ...
|
||||
* @version $Revision: 1.9.4.3 $ $Date: 2005/03/27 15:29:30 $
|
||||
*/
|
||||
public final class Logout implements IClientIncomingPacket
|
||||
{
|
||||
protected static final Logger _logAccounting = Logger.getLogger("accounting");
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final L2PcInstance player = client.getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.hasItemRequest())
|
||||
{
|
||||
player.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.isLocked())
|
||||
{
|
||||
_log.warning("Player " + player.getName() + " tried to logout during class change.");
|
||||
player.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't allow leaving if player is fighting
|
||||
if (AttackStanceTaskManager.getInstance().hasAttackStanceTask(player))
|
||||
{
|
||||
if (player.isGM() && Config.GM_RESTART_FIGHTING)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_EXIT_THE_GAME_WHILE_IN_COMBAT);
|
||||
player.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
if (L2Event.isParticipant(player))
|
||||
{
|
||||
player.sendMessage("A superior power doesn't allow you to leave the event.");
|
||||
player.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
_logAccounting.info("Disconnected, " + client);
|
||||
|
||||
player.logout();
|
||||
}
|
||||
}
|
||||
|
||||
+163
-152
@@ -1,152 +1,163 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import java.nio.BufferUnderflowException;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import com.l2jmobius.gameserver.instancemanager.JumpManager;
|
||||
import com.l2jmobius.gameserver.instancemanager.JumpManager.JumpWay;
|
||||
import com.l2jmobius.gameserver.model.Location;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExFlyMove;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.StopMove;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* This class ...
|
||||
* @version $Revision: 1.11.2.4.2.4 $ $Date: 2005/03/27 15:29:30 $
|
||||
*/
|
||||
public class MoveBackwardToLocation extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__0F_MOVEBACKWARDTOLOC = "[C] 0F MoveBackwardToLoc";
|
||||
|
||||
// cdddddd
|
||||
private int _targetX;
|
||||
private int _targetY;
|
||||
private int _targetZ;
|
||||
private int _originX;
|
||||
private int _originY;
|
||||
private int _originZ;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private int _moveMovement;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_targetX = readD();
|
||||
_targetY = readD();
|
||||
_targetZ = readD();
|
||||
_originX = readD();
|
||||
_originY = readD();
|
||||
_originZ = readD();
|
||||
try
|
||||
{
|
||||
_moveMovement = readD(); // is 0 if cursor keys are used 1 if mouse is used
|
||||
}
|
||||
catch (BufferUnderflowException e)
|
||||
{
|
||||
if (Config.L2WALKER_PROTECTION)
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
Util.handleIllegalPlayerAction(activeChar, "Player " + activeChar.getName() + " is trying to use L2Walker and got kicked.", Config.DEFAULT_PUNISH);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ((Config.PLAYER_MOVEMENT_BLOCK_TIME > 0) && !activeChar.isGM() && (activeChar.getNotMoveUntil() > System.currentTimeMillis()))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_MOVE_WHILE_SPEAKING_TO_AN_NPC_ONE_MOMENT_PLEASE);
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((_targetX == _originX) && (_targetY == _originY) && (_targetZ == _originZ))
|
||||
{
|
||||
activeChar.sendPacket(new StopMove(activeChar));
|
||||
return;
|
||||
}
|
||||
|
||||
// Correcting targetZ from floor level to head level (?)
|
||||
// Client is giving floor level as targetZ but that floor level doesn't
|
||||
// match our current geodata and teleport coords as good as head level!
|
||||
// L2J uses floor, not head level as char coordinates. This is some
|
||||
// sort of incompatibility fix.
|
||||
// Validate position packets sends head level.
|
||||
_targetZ += activeChar.getTemplate().getCollisionHeight();
|
||||
|
||||
if (activeChar.getTeleMode() > 0)
|
||||
{
|
||||
// Sayune
|
||||
if ((activeChar.getTeleMode() == 3) || (activeChar.getTeleMode() == 4))
|
||||
{
|
||||
if (activeChar.getTeleMode() == 3)
|
||||
{
|
||||
activeChar.setTeleMode(0);
|
||||
}
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
activeChar.stopMove(null, false);
|
||||
activeChar.abortAttack();
|
||||
activeChar.abortCast();
|
||||
activeChar.setTarget(null);
|
||||
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
|
||||
final JumpWay jw = JumpManager.getInstance().new JumpWay();
|
||||
jw.add(JumpManager.getInstance().new JumpNode(_targetX, _targetY, _targetZ, -1));
|
||||
activeChar.sendPacket(new ExFlyMove(activeChar.getObjectId(), -1, jw));
|
||||
activeChar.setXYZ(_targetX, _targetY, _targetZ);
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeChar.getTeleMode() == 1)
|
||||
{
|
||||
activeChar.setTeleMode(0);
|
||||
}
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
activeChar.teleToLocation(new Location(_targetX, _targetY, _targetZ));
|
||||
return;
|
||||
}
|
||||
|
||||
final double dx = _targetX - activeChar.getX();
|
||||
final double dy = _targetY - activeChar.getY();
|
||||
// Can't move if character is confused, or trying to move a huge distance
|
||||
if (activeChar.isOutOfControl() || (((dx * dx) + (dy * dy)) > 98010000)) // 9900*9900
|
||||
{
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(_targetX, _targetY, _targetZ));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__0F_MOVEBACKWARDTOLOC;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import com.l2jmobius.gameserver.enums.AdminTeleportType;
|
||||
import com.l2jmobius.gameserver.enums.SayuneType;
|
||||
import com.l2jmobius.gameserver.model.Location;
|
||||
import com.l2jmobius.gameserver.model.SayuneEntry;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMoveRequest;
|
||||
import com.l2jmobius.gameserver.model.events.returns.TerminateReturn;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.FlyToLocation;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.FlyToLocation.FlyType;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.MagicSkillLaunched;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.MagicSkillUse;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.StopMove;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.sayune.ExFlyMove;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.sayune.ExFlyMoveBroadcast;
|
||||
import com.l2jmobius.gameserver.util.Broadcast;
|
||||
|
||||
/**
|
||||
* This class ...
|
||||
* @version $Revision: 1.11.2.4.2.4 $ $Date: 2005/03/27 15:29:30 $
|
||||
*/
|
||||
public class MoveBackwardToLocation implements IClientIncomingPacket
|
||||
{
|
||||
// cdddddd
|
||||
private int _targetX;
|
||||
private int _targetY;
|
||||
private int _targetZ;
|
||||
private int _originX;
|
||||
private int _originY;
|
||||
private int _originZ;
|
||||
private int _moveMovement;
|
||||
|
||||
// For geodata
|
||||
private int _curX;
|
||||
private int _curY;
|
||||
@SuppressWarnings("unused")
|
||||
private int _curZ;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_targetX = packet.readD();
|
||||
_targetY = packet.readD();
|
||||
_targetZ = packet.readD();
|
||||
_originX = packet.readD();
|
||||
_originY = packet.readD();
|
||||
_originZ = packet.readD();
|
||||
_moveMovement = packet.readD(); // is 0 if cursor keys are used 1 if mouse is used
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final L2PcInstance activeChar = client.getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ((Config.PLAYER_MOVEMENT_BLOCK_TIME > 0) && !activeChar.isGM() && (activeChar.getNotMoveUntil() > System.currentTimeMillis()))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_MOVE_WHILE_SPEAKING_TO_AN_NPC_ONE_MOMENT_PLEASE);
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((_targetX == _originX) && (_targetY == _originY) && (_targetZ == _originZ))
|
||||
{
|
||||
activeChar.sendPacket(new StopMove(activeChar));
|
||||
return;
|
||||
}
|
||||
|
||||
// Correcting targetZ from floor level to head level (?)
|
||||
// Client is giving floor level as targetZ but that floor level doesn't
|
||||
// match our current geodata and teleport coords as good as head level!
|
||||
// L2J uses floor, not head level as char coordinates. This is some
|
||||
// sort of incompatibility fix.
|
||||
// Validate position packets sends head level.
|
||||
_targetZ += activeChar.getTemplate().getCollisionHeight();
|
||||
|
||||
if (_moveMovement == 1)
|
||||
{
|
||||
final TerminateReturn terminate = EventDispatcher.getInstance().notifyEvent(new OnPlayerMoveRequest(activeChar, new Location(_targetX, _targetY, _targetZ)), activeChar, TerminateReturn.class);
|
||||
if ((terminate != null) && terminate.terminate())
|
||||
{
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
_curX = activeChar.getX();
|
||||
_curY = activeChar.getY();
|
||||
_curZ = activeChar.getZ();
|
||||
|
||||
switch (activeChar.getTeleMode())
|
||||
{
|
||||
case DEMONIC:
|
||||
{
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
activeChar.teleToLocation(new Location(_targetX, _targetY, _targetZ));
|
||||
activeChar.setTeleMode(AdminTeleportType.NORMAL);
|
||||
break;
|
||||
}
|
||||
case SAYUNE:
|
||||
{
|
||||
activeChar.sendPacket(new ExFlyMove(activeChar, SayuneType.ONE_WAY_LOC, -1, Arrays.asList(new SayuneEntry(false, -1, _targetX, _targetY, _targetZ))));
|
||||
activeChar.setXYZ(_targetX, _targetY, _targetZ);
|
||||
Broadcast.toKnownPlayers(activeChar, new ExFlyMoveBroadcast(activeChar, SayuneType.ONE_WAY_LOC, -1, new Location(_targetX, _targetY, _targetZ)));
|
||||
activeChar.setTeleMode(AdminTeleportType.NORMAL);
|
||||
break;
|
||||
}
|
||||
case CHARGE:
|
||||
{
|
||||
activeChar.setXYZ(_targetX, _targetY, _targetZ);
|
||||
Broadcast.toSelfAndKnownPlayers(activeChar, new MagicSkillUse(activeChar, 30012, 10, 500, 0));
|
||||
Broadcast.toSelfAndKnownPlayers(activeChar, new FlyToLocation(activeChar, _targetX, _targetY, _targetZ, FlyType.CHARGE));
|
||||
Broadcast.toSelfAndKnownPlayers(activeChar, new MagicSkillLaunched(activeChar, 30012, 10));
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
final double dx = _targetX - _curX;
|
||||
final double dy = _targetY - _curY;
|
||||
// Can't move if character is confused, or trying to move a huge distance
|
||||
if (activeChar.isControlBlocked() || (((dx * dx) + (dy * dy)) > 98010000)) // 9900*9900
|
||||
{
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(_targetX, _targetY, _targetZ));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+143
-153
@@ -1,153 +1,143 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import com.l2jmobius.gameserver.instancemanager.AirShipManager;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.Location;
|
||||
import com.l2jmobius.gameserver.model.VehiclePathPoint;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2AirShipInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
public class MoveToLocationAirShip extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_38_MOVETOLOCATIONAIRSHIP = "[C] D0:38 MoveToLocationAirShip";
|
||||
|
||||
public static final int MIN_Z = -895;
|
||||
public static final int MAX_Z = 6105;
|
||||
public static final int STEP = 300;
|
||||
|
||||
private int _command;
|
||||
private int _param1;
|
||||
private int _param2 = 0;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_command = readD();
|
||||
_param1 = readD();
|
||||
if (_buf.remaining() > 0)
|
||||
{
|
||||
_param2 = readD();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if ((activeChar == null) || !activeChar.isInAirShip())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2AirShipInstance ship = activeChar.getAirShip();
|
||||
if (!ship.isCaptain(activeChar))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int z = ship.getZ();
|
||||
|
||||
switch (_command)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
if (!ship.canBeControlled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (_param1 < L2World.GRACIA_MAX_X)
|
||||
{
|
||||
ship.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(_param1, _param2, z));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
if (!ship.canBeControlled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
ship.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
if (!ship.canBeControlled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (z < L2World.GRACIA_MAX_Z)
|
||||
{
|
||||
z = Math.min(z + STEP, L2World.GRACIA_MAX_Z);
|
||||
ship.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(ship.getX(), ship.getY(), z));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
if (!ship.canBeControlled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (z > L2World.GRACIA_MIN_Z)
|
||||
{
|
||||
z = Math.max(z - STEP, L2World.GRACIA_MIN_Z);
|
||||
ship.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(ship.getX(), ship.getY(), z));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
if (!ship.isInDock() || ship.isMoving())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final VehiclePathPoint[] dst = AirShipManager.getInstance().getTeleportDestination(ship.getDockId(), _param1);
|
||||
if (dst == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Consume fuel, if needed
|
||||
final int fuelConsumption = AirShipManager.getInstance().getFuelConsumption(ship.getDockId(), _param1);
|
||||
if (fuelConsumption > 0)
|
||||
{
|
||||
if (fuelConsumption > ship.getFuel())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOUR_AIRSHIP_CANNOT_TELEPORT_BECAUSE_DUE_TO_LOW_FUEL);
|
||||
return;
|
||||
}
|
||||
ship.setFuel(ship.getFuel() - fuelConsumption);
|
||||
}
|
||||
|
||||
ship.executePath(dst);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_38_MOVETOLOCATIONAIRSHIP;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import com.l2jmobius.gameserver.instancemanager.AirShipManager;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.Location;
|
||||
import com.l2jmobius.gameserver.model.VehiclePathPoint;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2AirShipInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
|
||||
public class MoveToLocationAirShip implements IClientIncomingPacket
|
||||
{
|
||||
public static final int MIN_Z = -895;
|
||||
public static final int MAX_Z = 6105;
|
||||
public static final int STEP = 300;
|
||||
|
||||
private int _command;
|
||||
private int _param1;
|
||||
private int _param2 = 0;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_command = packet.readD();
|
||||
_param1 = packet.readD();
|
||||
if (packet.getReadableBytes() > 0)
|
||||
{
|
||||
_param2 = packet.readD();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final L2PcInstance activeChar = client.getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!activeChar.isInAirShip())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2AirShipInstance ship = activeChar.getAirShip();
|
||||
if (!ship.isCaptain(activeChar))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int z = ship.getZ();
|
||||
|
||||
switch (_command)
|
||||
{
|
||||
case 0:
|
||||
if (!ship.canBeControlled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (_param1 < L2World.GRACIA_MAX_X)
|
||||
{
|
||||
ship.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(_param1, _param2, z));
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (!ship.canBeControlled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
ship.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
|
||||
break;
|
||||
case 2:
|
||||
if (!ship.canBeControlled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (z < L2World.GRACIA_MAX_Z)
|
||||
{
|
||||
z = Math.min(z + STEP, L2World.GRACIA_MAX_Z);
|
||||
ship.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(ship.getX(), ship.getY(), z));
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (!ship.canBeControlled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (z > L2World.GRACIA_MIN_Z)
|
||||
{
|
||||
z = Math.max(z - STEP, L2World.GRACIA_MIN_Z);
|
||||
ship.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(ship.getX(), ship.getY(), z));
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if (!ship.isInDock() || ship.isMoving())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final VehiclePathPoint[] dst = AirShipManager.getInstance().getTeleportDestination(ship.getDockId(), _param1);
|
||||
if (dst == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Consume fuel, if needed
|
||||
final int fuelConsumption = AirShipManager.getInstance().getFuelConsumption(ship.getDockId(), _param1);
|
||||
if (fuelConsumption > 0)
|
||||
{
|
||||
if (fuelConsumption > ship.getFuel())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOUR_AIRSHIP_CANNOT_TELEPORT_BECAUSE_DUE_TO_LOW_FUEL);
|
||||
return;
|
||||
}
|
||||
ship.setFuel(ship.getFuel() - fuelConsumption);
|
||||
}
|
||||
|
||||
ship.executePath(dst);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+99
-104
@@ -1,104 +1,99 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.gameserver.model.Location;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2AirShipInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.type.WeaponType;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExMoveToLocationInAirShip;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.StopMoveInVehicle;
|
||||
|
||||
/**
|
||||
* format: ddddddd X:%d Y:%d Z:%d OriginX:%d OriginY:%d OriginZ:%d
|
||||
* @author GodKratos
|
||||
*/
|
||||
public class MoveToLocationInAirShip extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_20_MOVETOLOCATIONINAIRSHIP = "[C] D0:20 MoveToLocationInAirShip";
|
||||
|
||||
private int _shipId;
|
||||
private int _targetX;
|
||||
private int _targetY;
|
||||
private int _targetZ;
|
||||
private int _originX;
|
||||
private int _originY;
|
||||
private int _originZ;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_shipId = readD();
|
||||
_targetX = readD();
|
||||
_targetY = readD();
|
||||
_targetZ = readD();
|
||||
_originX = readD();
|
||||
_originY = readD();
|
||||
_originZ = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ((_targetX == _originX) && (_targetY == _originY) && (_targetZ == _originZ))
|
||||
{
|
||||
activeChar.sendPacket(new StopMoveInVehicle(activeChar, _shipId));
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeChar.isAttackingNow() && (activeChar.getActiveWeaponItem() != null) && (activeChar.getActiveWeaponItem().getItemType() == WeaponType.BOW))
|
||||
{
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeChar.isSitting() || activeChar.isMovementDisabled())
|
||||
{
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!activeChar.isInAirShip())
|
||||
{
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
final L2AirShipInstance airShip = activeChar.getAirShip();
|
||||
if (airShip.getObjectId() != _shipId)
|
||||
{
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
activeChar.setInVehiclePosition(new Location(_targetX, _targetY, _targetZ));
|
||||
activeChar.broadcastPacket(new ExMoveToLocationInAirShip(activeChar));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_20_MOVETOLOCATIONINAIRSHIP;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.model.Location;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2AirShipInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.type.WeaponType;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExMoveToLocationInAirShip;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.StopMoveInVehicle;
|
||||
|
||||
/**
|
||||
* format: ddddddd X:%d Y:%d Z:%d OriginX:%d OriginY:%d OriginZ:%d
|
||||
* @author GodKratos
|
||||
*/
|
||||
public class MoveToLocationInAirShip implements IClientIncomingPacket
|
||||
{
|
||||
private int _shipId;
|
||||
private int _targetX;
|
||||
private int _targetY;
|
||||
private int _targetZ;
|
||||
private int _originX;
|
||||
private int _originY;
|
||||
private int _originZ;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_shipId = packet.readD();
|
||||
_targetX = packet.readD();
|
||||
_targetY = packet.readD();
|
||||
_targetZ = packet.readD();
|
||||
_originX = packet.readD();
|
||||
_originY = packet.readD();
|
||||
_originZ = packet.readD();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final L2PcInstance activeChar = client.getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ((_targetX == _originX) && (_targetY == _originY) && (_targetZ == _originZ))
|
||||
{
|
||||
activeChar.sendPacket(new StopMoveInVehicle(activeChar, _shipId));
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeChar.isAttackingNow() && (activeChar.getActiveWeaponItem() != null) && (activeChar.getActiveWeaponItem().getItemType() == WeaponType.BOW))
|
||||
{
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeChar.isSitting() || activeChar.isMovementDisabled())
|
||||
{
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!activeChar.isInAirShip())
|
||||
{
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
final L2AirShipInstance airShip = activeChar.getAirShip();
|
||||
if (airShip.getObjectId() != _shipId)
|
||||
{
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
activeChar.setInVehiclePosition(new Location(_targetX, _targetY, _targetZ));
|
||||
activeChar.broadcastPacket(new ExMoveToLocationInAirShip(activeChar));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,53 +1,49 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* Format: (c) ddd d: dx d: dy d: dz
|
||||
* @author -Wooden-
|
||||
*/
|
||||
public class MoveWithDelta extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__52_MOVEWITHDELTA = "[C] 52 MoveWithDelta";
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private int _dx;
|
||||
@SuppressWarnings("unused")
|
||||
private int _dy;
|
||||
@SuppressWarnings("unused")
|
||||
private int _dz;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_dx = readD();
|
||||
_dy = readD();
|
||||
_dz = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
// TODO this
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__52_MOVEWITHDELTA;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
|
||||
/**
|
||||
* Format: (c) ddd d: dx d: dy d: dz
|
||||
* @author -Wooden-
|
||||
*/
|
||||
public class MoveWithDelta implements IClientIncomingPacket
|
||||
{
|
||||
@SuppressWarnings("unused")
|
||||
private int _dx;
|
||||
@SuppressWarnings("unused")
|
||||
private int _dy;
|
||||
@SuppressWarnings("unused")
|
||||
private int _dz;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_dx = packet.readD();
|
||||
_dy = packet.readD();
|
||||
_dz = packet.readD();
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
// TODO this
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,485 +1,508 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import static com.l2jmobius.gameserver.model.actor.L2Npc.INTERACTION_DISTANCE;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.MultisellData;
|
||||
import com.l2jmobius.gameserver.model.Elementals;
|
||||
import com.l2jmobius.gameserver.model.L2Augmentation;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.itemcontainer.PcInventory;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.multisell.Entry;
|
||||
import com.l2jmobius.gameserver.model.multisell.Ingredient;
|
||||
import com.l2jmobius.gameserver.model.multisell.PreparedListContainer;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.ensoul.SoulCrystalOption;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExUserInfoInvenWeight;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ItemList;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import com.l2jmobius.util.Rnd;
|
||||
|
||||
/**
|
||||
* The Class MultiSellChoose.
|
||||
*/
|
||||
public class MultiSellChoose extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__B0_MULTISELLCHOOSE = "[C] B0 MultiSellChoose";
|
||||
|
||||
private int _listId;
|
||||
private int _entryId;
|
||||
private long _amount;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_listId = readD();
|
||||
_entryId = readD();
|
||||
_amount = readQ();
|
||||
// _unk1 = readH();
|
||||
// _unk2 = readD();
|
||||
// _unk3 = readD();
|
||||
// _unk4 = readH(); // elemental attributes
|
||||
// _unk5 = readH(); // elemental attributes
|
||||
// _unk6 = readH(); // elemental attributes
|
||||
// _unk7 = readH(); // elemental attributes
|
||||
// _unk8 = readH(); // elemental attributes
|
||||
// _unk9 = readH(); // elemental attributes
|
||||
// _unk10 = readH(); // elemental attributes
|
||||
// _unk11 = readH(); // elemental attributes
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runImpl()
|
||||
{
|
||||
final L2PcInstance player = getClient().getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!getClient().getFloodProtectors().getMultiSell().tryPerformAction("multisell choose"))
|
||||
{
|
||||
player.setMultiSell(null);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((_amount < 1) || (_amount > 5000))
|
||||
{
|
||||
player.setMultiSell(null);
|
||||
return;
|
||||
}
|
||||
|
||||
final PreparedListContainer list = player.getMultiSell();
|
||||
if ((list == null) || (list.getListId() != _listId))
|
||||
{
|
||||
player.setMultiSell(null);
|
||||
return;
|
||||
}
|
||||
|
||||
final L2Npc npc = player.getLastFolkNPC();
|
||||
if (!list.isNpcAllowed(-1) && (((npc != null) && !list.isNpcAllowed(npc.getId())) || ((npc == null) && list.isNpcOnly())))
|
||||
{
|
||||
player.setMultiSell(null);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!player.isGM() && (npc != null) && !list.isNpcAllowed(-1) && (!player.isInsideRadius(npc, INTERACTION_DISTANCE, true, false) || (player.getInstanceId() != npc.getInstanceId())))
|
||||
{
|
||||
player.setMultiSell(null);
|
||||
return;
|
||||
}
|
||||
|
||||
for (Entry entry : list.getEntries())
|
||||
{
|
||||
if (entry.getEntryId() == _entryId)
|
||||
{
|
||||
if (!entry.isStackable() && (_amount > 1))
|
||||
{
|
||||
_log.severe("Character: " + player.getName() + " is trying to set amount > 1 on non-stackable multisell, id:" + _listId + ":" + _entryId);
|
||||
player.setMultiSell(null);
|
||||
return;
|
||||
}
|
||||
|
||||
final PcInventory inv = player.getInventory();
|
||||
|
||||
int slots = 0;
|
||||
int weight = 0;
|
||||
for (Ingredient e : entry.getProducts())
|
||||
{
|
||||
if (e.getItemId() < 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!e.isStackable())
|
||||
{
|
||||
slots += e.getItemCount() * _amount;
|
||||
}
|
||||
else if (player.getInventory().getItemByItemId(e.getItemId()) == null)
|
||||
{
|
||||
slots++;
|
||||
}
|
||||
weight += e.getItemCount() * _amount * e.getWeight();
|
||||
}
|
||||
|
||||
if (!inv.validateWeight(weight))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_HAVE_EXCEEDED_THE_WEIGHT_LIMIT);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!inv.validateCapacity(slots))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOUR_INVENTORY_IS_FULL);
|
||||
return;
|
||||
}
|
||||
|
||||
final ArrayList<Ingredient> ingredientsList = new ArrayList<>(entry.getIngredients().size());
|
||||
// Generate a list of distinct ingredients and counts in order to check if the correct item-counts are possessed by the player
|
||||
boolean newIng;
|
||||
for (Ingredient e : entry.getIngredients())
|
||||
{
|
||||
newIng = true;
|
||||
// at this point, the template has already been modified so that enchantments are properly included
|
||||
// whenever they need to be applied. Uniqueness of items is thus judged by item id AND enchantment level
|
||||
for (int i = ingredientsList.size(); --i >= 0;)
|
||||
{
|
||||
final Ingredient ex = ingredientsList.get(i);
|
||||
// if the item was already added in the list, merely increment the count
|
||||
// this happens if 1 list entry has the same ingredient twice (example 2 swords = 1 dual)
|
||||
if ((ex.getItemId() == e.getItemId()) && (ex.getEnchantLevel() == e.getEnchantLevel()))
|
||||
{
|
||||
if ((ex.getItemCount() + e.getItemCount()) > Integer.MAX_VALUE)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_HAVE_EXCEEDED_THE_QUANTITY_THAT_CAN_BE_INPUTTED);
|
||||
return;
|
||||
}
|
||||
// two same ingredients, merge into one and replace old
|
||||
final Ingredient ing = ex.getCopy();
|
||||
ing.setItemCount(ex.getItemCount() + e.getItemCount());
|
||||
ingredientsList.set(i, ing);
|
||||
newIng = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (newIng)
|
||||
{
|
||||
// if it's a new ingredient, just store its info directly (item id, count, enchantment)
|
||||
ingredientsList.add(e);
|
||||
}
|
||||
}
|
||||
|
||||
// now check if the player has sufficient items in the inventory to cover the ingredient expenses
|
||||
for (Ingredient e : ingredientsList)
|
||||
{
|
||||
if ((e.getItemCount() * _amount) > Integer.MAX_VALUE)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_HAVE_EXCEEDED_THE_QUANTITY_THAT_CAN_BE_INPUTTED);
|
||||
return;
|
||||
}
|
||||
if (e.getItemId() < 0)
|
||||
{
|
||||
if (!MultisellData.hasSpecialIngredient(e.getItemId(), e.getItemCount() * _amount, player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// if this is not a list that maintains enchantment, check the count of all items that have the given id.
|
||||
// otherwise, check only the count of items with exactly the needed enchantment level
|
||||
final long required = (Config.ALT_BLACKSMITH_USE_RECIPES || !e.getMaintainIngredient()) ? (e.getItemCount() * _amount) : e.getItemCount();
|
||||
if (inv.getInventoryItemCount(e.getItemId(), (list.getMaintainEnchantment() || (e.getEnchantLevel() > 0)) ? e.getEnchantLevel() : -1, false) < required)
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_NEED_S2_S1_S);
|
||||
sm.addItemName(e.getTemplate());
|
||||
sm.addLong(required);
|
||||
player.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final List<L2Augmentation> augmentation = new ArrayList<>();
|
||||
Elementals[] elemental = null;
|
||||
SoulCrystalOption[] commonSoulCrystalOptions = null;
|
||||
SoulCrystalOption specialSoulCrystalOption = null;
|
||||
|
||||
/** All ok, remove items and add final product */
|
||||
|
||||
for (Ingredient e : entry.getIngredients())
|
||||
{
|
||||
if (e.getItemId() < 0)
|
||||
{
|
||||
if (!MultisellData.takeSpecialIngredient(e.getItemId(), e.getItemCount() * _amount, player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
L2ItemInstance itemToTake = inv.getItemByItemId(e.getItemId()); // initialize and initial guess for the item to take.
|
||||
if (itemToTake == null)
|
||||
{ // this is a cheat, transaction will be aborted and if any items already taken will not be returned back to inventory!
|
||||
_log.severe("Character: " + player.getName() + " is trying to cheat in multisell, id:" + _listId + ":" + _entryId);
|
||||
player.setMultiSell(null);
|
||||
return;
|
||||
}
|
||||
|
||||
// if (itemToTake.isEquipped())
|
||||
// {
|
||||
// this is a cheat, transaction will be aborted and if any items already taken will not be returned back to inventory!
|
||||
// _log.severe("Character: " + player.getName() + " is trying to cheat in multisell, exchanging equipped item, merchatnt id:" + merchant.getNpcId());
|
||||
// player.setMultiSell(null);
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (Config.ALT_BLACKSMITH_USE_RECIPES || !e.getMaintainIngredient())
|
||||
{
|
||||
// if it's a stackable item, just reduce the amount from the first (only) instance that is found in the inventory
|
||||
if (itemToTake.isStackable())
|
||||
{
|
||||
if (!player.destroyItem("Multisell", itemToTake.getObjectId(), e.getItemCount() * _amount, player.getTarget(), true))
|
||||
{
|
||||
player.setMultiSell(null);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// a) if enchantment is maintained, then get a list of items that exactly match this enchantment
|
||||
else if (list.getMaintainEnchantment() || (e.getEnchantLevel() > 0))
|
||||
{
|
||||
// loop through this list and remove (one by one) each item until the required amount is taken.
|
||||
final L2ItemInstance[] inventoryContents = inv.getAllItemsByItemId(e.getItemId(), e.getEnchantLevel(), false);
|
||||
for (int i = 0; i < (e.getItemCount() * _amount); i++)
|
||||
{
|
||||
if (inventoryContents[i].isAugmented())
|
||||
{
|
||||
augmentation.add(inventoryContents[i].getAugmentation());
|
||||
}
|
||||
if (inventoryContents[i].getElementals() != null)
|
||||
{
|
||||
elemental = inventoryContents[i].getElementals();
|
||||
}
|
||||
if (!player.destroyItem("Multisell", inventoryContents[i].getObjectId(), 1, player.getTarget(), true))
|
||||
{
|
||||
player.setMultiSell(null);
|
||||
return;
|
||||
}
|
||||
if (inventoryContents[i].getCommonSoulCrystalOptions() != null)
|
||||
{
|
||||
commonSoulCrystalOptions = inventoryContents[i].getCommonSoulCrystalOptions();
|
||||
}
|
||||
if (inventoryContents[i].getSpecialSoulCrystalOption() != null)
|
||||
{
|
||||
specialSoulCrystalOption = inventoryContents[i].getSpecialSoulCrystalOption();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
// b) enchantment is not maintained. Get the instances with the LOWEST enchantment level
|
||||
{
|
||||
// NOTE: There are 2 ways to achieve the above goal.
|
||||
// 1) Get all items that have the correct itemId, loop through them until the lowest enchantment
|
||||
// level is found. Repeat all this for the next item until proper count of items is reached.
|
||||
// 2) Get all items that have the correct itemId, sort them once based on enchantment level,
|
||||
// and get the range of items that is necessary.
|
||||
// Method 1 is faster for a small number of items to be exchanged.
|
||||
// Method 2 is faster for large amounts.
|
||||
//
|
||||
// EXPLANATION:
|
||||
// Worst case scenario for algorithm 1 will make it run in a number of cycles given by:
|
||||
// m*(2n-m+1)/2 where m is the number of items to be exchanged and n is the total
|
||||
// number of inventory items that have a matching id.
|
||||
// With algorithm 2 (sort), sorting takes n*log(n) time and the choice is done in a single cycle
|
||||
// for case b (just grab the m first items) or in linear time for case a (find the beginning of items
|
||||
// with correct enchantment, index x, and take all items from x to x+m).
|
||||
// Basically, whenever m > log(n) we have: m*(2n-m+1)/2 = (2nm-m*m+m)/2 >
|
||||
// (2nlogn-logn*logn+logn)/2 = nlog(n) - log(n*n) + log(n) = nlog(n) + log(n/n*n) =
|
||||
// nlog(n) + log(1/n) = nlog(n) - log(n) = (n-1)log(n)
|
||||
// So for m < log(n) then m*(2n-m+1)/2 > (n-1)log(n) and m*(2n-m+1)/2 > nlog(n)
|
||||
//
|
||||
// IDEALLY:
|
||||
// In order to best optimize the performance, choose which algorithm to run, based on whether 2^m > n
|
||||
// if ( (2<<(e.getItemCount()// _amount)) < inventoryContents.length )
|
||||
// // do Algorithm 1, no sorting
|
||||
// else
|
||||
// // do Algorithm 2, sorting
|
||||
//
|
||||
// CURRENT IMPLEMENTATION:
|
||||
// In general, it is going to be very rare for a person to do a massive exchange of non-stackable items
|
||||
// For this reason, we assume that algorithm 1 will always suffice and we keep things simple.
|
||||
// If, in the future, it becomes necessary that we optimize, the above discussion should make it clear
|
||||
// what optimization exactly is necessary (based on the comments under "IDEALLY").
|
||||
//
|
||||
|
||||
// choice 1. Small number of items exchanged. No sorting.
|
||||
for (int i = 1; i <= (e.getItemCount() * _amount); i++)
|
||||
{
|
||||
final L2ItemInstance[] inventoryContents = inv.getAllItemsByItemId(e.getItemId(), false);
|
||||
|
||||
itemToTake = inventoryContents[0];
|
||||
// get item with the LOWEST enchantment level from the inventory...
|
||||
// +0 is lowest by default...
|
||||
if (itemToTake.getEnchantLevel() > 0)
|
||||
{
|
||||
for (L2ItemInstance item : inventoryContents)
|
||||
{
|
||||
if ((item.getEnchantLevel() < itemToTake.getEnchantLevel()) && (item.getEnchantLevel() >= e.getEnchantLevel()))
|
||||
{
|
||||
itemToTake = item;
|
||||
// nothing will have enchantment less than 0. If a zero-enchanted
|
||||
// item is found, just take it
|
||||
if (itemToTake.getEnchantLevel() == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!player.destroyItem("Multisell", itemToTake.getObjectId(), 1, player.getTarget(), true))
|
||||
{
|
||||
player.setMultiSell(null);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final double itemRandom = 100 * Rnd.nextDouble();
|
||||
float cumulativeChance = 0;
|
||||
|
||||
boolean matched = false;
|
||||
// Generate the appropriate items
|
||||
for (Ingredient e : entry.getProducts())
|
||||
{
|
||||
if (list.isNewMultisell())
|
||||
{
|
||||
// Skip first entry.
|
||||
if (e.getChance() < 1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Calculate chance
|
||||
matched = itemRandom < (cumulativeChance += e.getChance());
|
||||
if (!matched)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (e.getItemId() < 0)
|
||||
{
|
||||
MultisellData.giveSpecialProduct(e.getItemId(), e.getItemCount() * _amount, player);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (e.isStackable())
|
||||
{
|
||||
inv.addItem("Multisell", e.getItemId(), e.getItemCount() * _amount, player, player.getTarget());
|
||||
}
|
||||
else
|
||||
{
|
||||
L2ItemInstance product = null;
|
||||
for (int i = 0; i < (e.getItemCount() * _amount); i++)
|
||||
{
|
||||
product = inv.addItem("Multisell", e.getItemId(), 1, player, player.getTarget());
|
||||
if ((product != null) && (list.getMaintainEnchantment() || (e.getEnchantLevel() > 0)))
|
||||
{
|
||||
if (i < augmentation.size())
|
||||
{
|
||||
product.setAugmentation(new L2Augmentation(augmentation.get(i).getAugmentationId()));
|
||||
}
|
||||
if (elemental != null)
|
||||
{
|
||||
for (Elementals elm : elemental)
|
||||
{
|
||||
product.setElementAttr(elm.getElement(), elm.getValue());
|
||||
}
|
||||
}
|
||||
if (commonSoulCrystalOptions != null)
|
||||
{
|
||||
product.setCommonSoulCrystalOptions(commonSoulCrystalOptions);
|
||||
}
|
||||
if (specialSoulCrystalOption != null)
|
||||
{
|
||||
product.setSpecialSoulCrystalOption(specialSoulCrystalOption);
|
||||
}
|
||||
product.setEnchantLevel(e.getEnchantLevel());
|
||||
product.updateDatabase();
|
||||
}
|
||||
}
|
||||
}
|
||||
// msg part
|
||||
SystemMessage sm;
|
||||
|
||||
if ((e.getItemCount() * _amount) > 1)
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_EARNED_S2_S1_S);
|
||||
sm.addItemName(e.getItemId());
|
||||
sm.addLong(e.getItemCount() * _amount);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (list.getMaintainEnchantment() && (e.getEnchantLevel() > 0))
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.ACQUIRED_S1_S2);
|
||||
sm.addLong(e.getEnchantLevel());
|
||||
}
|
||||
else
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_EARNED_S1);
|
||||
}
|
||||
sm.addItemName(e.getItemId());
|
||||
}
|
||||
player.sendPacket(sm);
|
||||
}
|
||||
|
||||
if (matched)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
player.sendPacket(new ItemList(player, false));
|
||||
player.sendPacket(new ExUserInfoInvenWeight(player));
|
||||
|
||||
// finally, give the tax to the castle...
|
||||
if ((npc != null) && (entry.getTaxAmount() > 0))
|
||||
{
|
||||
npc.getCastle().addToTreasury(entry.getTaxAmount() * _amount);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__B0_MULTISELLCHOOSE;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.commons.util.Rnd;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.MultisellData;
|
||||
import com.l2jmobius.gameserver.model.L2Augmentation;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.ensoul.EnsoulOption;
|
||||
import com.l2jmobius.gameserver.model.itemcontainer.PcInventory;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.multisell.Entry;
|
||||
import com.l2jmobius.gameserver.model.multisell.Ingredient;
|
||||
import com.l2jmobius.gameserver.model.multisell.ItemInfo;
|
||||
import com.l2jmobius.gameserver.model.multisell.PreparedListContainer;
|
||||
import com.l2jmobius.gameserver.model.variables.ItemVariables;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
* The Class MultiSellChoose.
|
||||
*/
|
||||
public class MultiSellChoose implements IClientIncomingPacket
|
||||
{
|
||||
private int _listId;
|
||||
private int _entryId;
|
||||
private long _amount;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_listId = packet.readD();
|
||||
_entryId = packet.readD();
|
||||
_amount = packet.readQ();
|
||||
// _unk1 = packet.readH();
|
||||
// _unk2 = packet.readD();
|
||||
// _unk3 = packet.readD();
|
||||
// _unk4 = packet.readH(); // elemental attributes
|
||||
// _unk5 = packet.readH(); // elemental attributes
|
||||
// _unk6 = packet.readH(); // elemental attributes
|
||||
// _unk7 = packet.readH(); // elemental attributes
|
||||
// _unk8 = packet.readH(); // elemental attributes
|
||||
// _unk9 = packet.readH(); // elemental attributes
|
||||
// _unk10 = packet.readH(); // elemental attributes
|
||||
// _unk11 = packet.readH(); // elemental attributes
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final L2PcInstance player = client.getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!client.getFloodProtectors().getMultiSell().tryPerformAction("multisell choose"))
|
||||
{
|
||||
player.setMultiSell(null);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((_amount < 1) || (_amount > 5000))
|
||||
{
|
||||
player.setMultiSell(null);
|
||||
return;
|
||||
}
|
||||
|
||||
final PreparedListContainer list = player.getMultiSell();
|
||||
if ((list == null) || (list.getListId() != _listId))
|
||||
{
|
||||
player.setMultiSell(null);
|
||||
return;
|
||||
}
|
||||
|
||||
final L2Npc npc = player.getLastFolkNPC();
|
||||
if (!isAllowedToUse(player, npc, list))
|
||||
{
|
||||
player.setMultiSell(null);
|
||||
return;
|
||||
}
|
||||
|
||||
for (Entry entry : list.getEntries())
|
||||
{
|
||||
if (entry.getEntryId() == _entryId)
|
||||
{
|
||||
if (!entry.isStackable() && (_amount > 1))
|
||||
{
|
||||
_log.severe("Character: " + player.getName() + " is trying to set amount > 1 on non-stackable multisell, id:" + _listId + ":" + _entryId);
|
||||
player.setMultiSell(null);
|
||||
return;
|
||||
}
|
||||
|
||||
final PcInventory inv = player.getInventory();
|
||||
|
||||
int slots = 0;
|
||||
int weight = 0;
|
||||
for (Ingredient e : entry.getProducts())
|
||||
{
|
||||
if (e.getItemId() < 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!e.isStackable())
|
||||
{
|
||||
slots += e.getItemCount() * _amount;
|
||||
}
|
||||
else if (player.getInventory().getItemByItemId(e.getItemId()) == null)
|
||||
{
|
||||
slots++;
|
||||
}
|
||||
weight += e.getItemCount() * _amount * e.getWeight();
|
||||
}
|
||||
|
||||
if (!inv.validateWeight(weight))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_HAVE_EXCEEDED_THE_WEIGHT_LIMIT);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!inv.validateCapacity(slots))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOUR_INVENTORY_IS_FULL);
|
||||
return;
|
||||
}
|
||||
|
||||
final ArrayList<Ingredient> ingredientsList = new ArrayList<>(entry.getIngredients().size());
|
||||
// Generate a list of distinct ingredients and counts in order to check if the correct item-counts
|
||||
// are possessed by the player
|
||||
boolean newIng;
|
||||
for (Ingredient e : entry.getIngredients())
|
||||
{
|
||||
newIng = true;
|
||||
// at this point, the template has already been modified so that enchantments are properly included
|
||||
// whenever they need to be applied. Uniqueness of items is thus judged by item id AND enchantment level
|
||||
for (int i = ingredientsList.size(); --i >= 0;)
|
||||
{
|
||||
final Ingredient ex = ingredientsList.get(i);
|
||||
// if the item was already added in the list, merely increment the count
|
||||
// this happens if 1 list entry has the same ingredient twice (example 2 swords = 1 dual)
|
||||
if ((ex.getItemId() == e.getItemId()) && (ex.getEnchantLevel() == e.getEnchantLevel()))
|
||||
{
|
||||
if ((ex.getItemCount() + e.getItemCount()) > Integer.MAX_VALUE)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_HAVE_EXCEEDED_THE_QUANTITY_THAT_CAN_BE_INPUTTED);
|
||||
return;
|
||||
}
|
||||
// two same ingredients, merge into one and replace old
|
||||
final Ingredient ing = ex.getCopy();
|
||||
ing.setItemCount(ex.getItemCount() + e.getItemCount());
|
||||
ingredientsList.set(i, ing);
|
||||
newIng = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (newIng)
|
||||
{
|
||||
// if it's a new ingredient, just store its info directly (item id, count, enchantment)
|
||||
ingredientsList.add(e);
|
||||
}
|
||||
}
|
||||
|
||||
// now check if the player has sufficient items in the inventory to cover the ingredients' expences
|
||||
for (Ingredient e : ingredientsList)
|
||||
{
|
||||
if ((e.getItemCount() * _amount) > Integer.MAX_VALUE)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_HAVE_EXCEEDED_THE_QUANTITY_THAT_CAN_BE_INPUTTED);
|
||||
return;
|
||||
}
|
||||
if (e.getItemId() < 0)
|
||||
{
|
||||
if (!MultisellData.hasSpecialIngredient(e.getItemId(), e.getItemCount() * _amount, player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// if this is not a list that maintains enchantment, check the count of all items that have the given id.
|
||||
// otherwise, check only the count of items with exactly the needed enchantment level
|
||||
final long required = ((Config.ALT_BLACKSMITH_USE_RECIPES || !e.getMaintainIngredient()) ? (e.getItemCount() * _amount) : e.getItemCount());
|
||||
if (inv.getInventoryItemCount(e.getItemId(), list.getMaintainEnchantment() ? e.getEnchantLevel() : -1, false) < required)
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_NEED_S2_S1_S);
|
||||
sm.addItemName(e.getTemplate());
|
||||
sm.addLong(required);
|
||||
player.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final Map<Integer, ItemInfo> originalInfos = new LinkedHashMap<>();
|
||||
/** All ok, remove items and add final product */
|
||||
|
||||
for (Ingredient e : entry.getIngredients())
|
||||
{
|
||||
if (e.getItemId() < 0)
|
||||
{
|
||||
if (!MultisellData.takeSpecialIngredient(e.getItemId(), e.getItemCount() * _amount, player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
L2ItemInstance itemToTake = inv.getItemByItemId(e.getItemId()); // initialize and initial guess for the item to take.
|
||||
if (itemToTake == null)
|
||||
{ // this is a cheat, transaction will be aborted and if any items already taken will not be returned back to inventory!
|
||||
_log.severe("Character: " + player.getName() + " is trying to cheat in multisell, id:" + _listId + ":" + _entryId);
|
||||
player.setMultiSell(null);
|
||||
return;
|
||||
}
|
||||
|
||||
// if (itemToTake.isEquipped())
|
||||
// {
|
||||
// this is a cheat, transaction will be aborted and if any items already taken will not be returned back to inventory!
|
||||
// LOGGER.severe("Character: " + player.getName() + " is trying to cheat in multisell, exchanging equipped item, merchatnt id:" + merchant.getNpcId());
|
||||
// player.setMultiSell(null);
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (Config.ALT_BLACKSMITH_USE_RECIPES || !e.getMaintainIngredient())
|
||||
{
|
||||
// if it's a stackable item, just reduce the amount from the first (only) instance that is found in the inventory
|
||||
if (itemToTake.isStackable())
|
||||
{
|
||||
if (!player.destroyItem("Multisell", itemToTake.getObjectId(), (e.getItemCount() * _amount), player.getTarget(), true))
|
||||
{
|
||||
player.setMultiSell(null);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// for non-stackable items, one of two scenaria are possible:
|
||||
// a) list maintains enchantment: get the instances that exactly match the requested enchantment level
|
||||
// b) list does not maintain enchantment: get the instances with the LOWEST enchantment level
|
||||
|
||||
// a) if enchantment is maintained, then get a list of items that exactly match this enchantment
|
||||
if (list.getMaintainEnchantment())
|
||||
{
|
||||
// loop through this list and remove (one by one) each item until the required amount is taken.
|
||||
final L2ItemInstance[] inventoryContents = inv.getAllItemsByItemId(e.getItemId(), e.getEnchantLevel(), false).toArray(new L2ItemInstance[0]);
|
||||
for (int i = 0; i < (e.getItemCount() * _amount); i++)
|
||||
{
|
||||
originalInfos.put(i, new ItemInfo(inventoryContents[i]));
|
||||
if (!player.destroyItem("Multisell", inventoryContents[i].getObjectId(), 1, player.getTarget(), true))
|
||||
{
|
||||
player.setMultiSell(null);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
// b) enchantment is not maintained. Get the instances with the LOWEST enchantment level
|
||||
{
|
||||
// NOTE: There are 2 ways to achieve the above goal.
|
||||
// 1) Get all items that have the correct itemId, loop through them until the lowest enchantment
|
||||
// level is found. Repeat all this for the next item until proper count of items is reached.
|
||||
// 2) Get all items that have the correct itemId, sort them once based on enchantment level,
|
||||
// and get the range of items that is necessary.
|
||||
// Method 1 is faster for a small number of items to be exchanged.
|
||||
// Method 2 is faster for large amounts.
|
||||
//
|
||||
// EXPLANATION:
|
||||
// Worst case scenario for algorithm 1 will make it run in a number of cycles given by:
|
||||
// m*(2n-m+1)/2 where m is the number of items to be exchanged and n is the total
|
||||
// number of inventory items that have a matching id.
|
||||
// With algorithm 2 (sort), sorting takes n*log(n) time and the choice is done in a single cycle
|
||||
// for case b (just grab the m first items) or in linear time for case a (find the beginning of items
|
||||
// with correct enchantment, index x, and take all items from x to x+m).
|
||||
// Basically, whenever m > log(n) we have: m*(2n-m+1)/2 = (2nm-m*m+m)/2 >
|
||||
// (2nlogn-logn*logn+logn)/2 = nlog(n) - log(n*n) + log(n) = nlog(n) + log(n/n*n) =
|
||||
// nlog(n) + log(1/n) = nlog(n) - log(n) = (n-1)log(n)
|
||||
// So for m < log(n) then m*(2n-m+1)/2 > (n-1)log(n) and m*(2n-m+1)/2 > nlog(n)
|
||||
//
|
||||
// IDEALLY:
|
||||
// In order to best optimize the performance, choose which algorithm to run, based on whether 2^m > n
|
||||
// if ( (2<<(e.getItemCount()// _amount)) < inventoryContents.length )
|
||||
// // do Algorithm 1, no sorting
|
||||
// else
|
||||
// // do Algorithm 2, sorting
|
||||
//
|
||||
// CURRENT IMPLEMENTATION:
|
||||
// In general, it is going to be very rare for a person to do a massive exchange of non-stackable items
|
||||
// For this reason, we assume that algorithm 1 will always suffice and we keep things simple.
|
||||
// If, in the future, it becomes necessary that we optimize, the above discussion should make it clear
|
||||
// what optimization exactly is necessary (based on the comments under "IDEALLY").
|
||||
//
|
||||
|
||||
// choice 1. Small number of items exchanged. No sorting.
|
||||
for (int i = 1; i <= (e.getItemCount() * _amount); i++)
|
||||
{
|
||||
final Collection<L2ItemInstance> inventoryContents = inv.getAllItemsByItemId(e.getItemId(), false);
|
||||
|
||||
itemToTake = inventoryContents.iterator().next();
|
||||
// get item with the LOWEST enchantment level from the inventory...
|
||||
// +0 is lowest by default...
|
||||
if (itemToTake.getEnchantLevel() > 0)
|
||||
{
|
||||
for (L2ItemInstance item : inventoryContents)
|
||||
{
|
||||
if (item.getEnchantLevel() < itemToTake.getEnchantLevel())
|
||||
{
|
||||
itemToTake = item;
|
||||
// nothing will have enchantment less than 0. If a zero-enchanted
|
||||
// item is found, just take it
|
||||
if (itemToTake.getEnchantLevel() == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!player.destroyItem("Multisell", itemToTake.getObjectId(), 1, player.getTarget(), true))
|
||||
{
|
||||
player.setMultiSell(null);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final double itemRandom = 100 * Rnd.nextDouble();
|
||||
float cumulativeChance = 0;
|
||||
|
||||
boolean matched = false;
|
||||
// Generate the appropriate items
|
||||
for (Ingredient e : entry.getProducts())
|
||||
{
|
||||
if (list.isNewMultisell())
|
||||
{
|
||||
// Skip first entry.
|
||||
if (e.getChance() < 1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Calculate chance
|
||||
matched = (itemRandom < (cumulativeChance += e.getChance()));
|
||||
if (!matched)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (e.getItemId() < 0)
|
||||
{
|
||||
MultisellData.giveSpecialProduct(e.getItemId(), e.getItemCount() * _amount, player);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (e.isStackable())
|
||||
{
|
||||
inv.addItem("Multisell", e.getItemId(), e.getItemCount() * _amount, player, player.getTarget());
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < (e.getItemCount() * _amount); i++)
|
||||
{
|
||||
final L2ItemInstance product = inv.addItem("Multisell", e.getItemId(), 1, player, player.getTarget());
|
||||
if ((product != null) && list.getMaintainEnchantment())
|
||||
{
|
||||
final ItemInfo info = originalInfos.get(i);
|
||||
if (info.getAugmentId() > 0)
|
||||
{
|
||||
product.setAugmentation(new L2Augmentation(info.getAugmentId()));
|
||||
}
|
||||
if (info.getElementals().length > 0)
|
||||
{
|
||||
Arrays.stream(info.getElementals()).filter(Objects::nonNull).forEach(product::setAttribute);
|
||||
}
|
||||
if (info.getVisualId() > 0)
|
||||
{
|
||||
product.setVisualId(info.getVisualId());
|
||||
if (info.getVisualStoneId() > 0)
|
||||
{
|
||||
product.getVariables().set(ItemVariables.VISUAL_APPEARANCE_STONE_ID, info.getVisualStoneId());
|
||||
}
|
||||
if (info.getVisualIdLifeTime() > 0)
|
||||
{
|
||||
product.getVariables().set(ItemVariables.VISUAL_APPEARANCE_LIFE_TIME, info.getVisualIdLifeTime());
|
||||
product.scheduleVisualLifeTime();
|
||||
}
|
||||
}
|
||||
if (!info.getSpecialAbilities().isEmpty())
|
||||
{
|
||||
int position = 0;
|
||||
for (EnsoulOption option : info.getSpecialAbilities())
|
||||
{
|
||||
product.addSpecialAbility(option, position++, 1, true);
|
||||
}
|
||||
}
|
||||
if (!info.getAdditionalSpecialAbilities().isEmpty())
|
||||
{
|
||||
int position = 0;
|
||||
for (EnsoulOption option : info.getAdditionalSpecialAbilities())
|
||||
{
|
||||
product.addSpecialAbility(option, position++, 2, true);
|
||||
}
|
||||
}
|
||||
product.setEnchantLevel(e.getEnchantLevel());
|
||||
product.updateDatabase();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final SystemMessage sm;
|
||||
if ((e.getItemCount() * _amount) > 1)
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_EARNED_S2_S1_S);
|
||||
sm.addItemName(e.getItemId());
|
||||
sm.addLong(e.getItemCount() * _amount);
|
||||
player.sendPacket(sm);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (list.getMaintainEnchantment() && (e.getEnchantLevel() > 0))
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.ACQUIRED_S1_S2);
|
||||
sm.addLong(e.getEnchantLevel());
|
||||
sm.addItemName(e.getItemId());
|
||||
}
|
||||
else
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_EARNED_S1);
|
||||
sm.addItemName(e.getItemId());
|
||||
}
|
||||
player.sendPacket(sm);
|
||||
}
|
||||
}
|
||||
|
||||
if (matched)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
player.sendItemList(false);
|
||||
|
||||
// finally, give the tax to the castle...
|
||||
if ((npc != null) && (entry.getTaxAmount() > 0))
|
||||
{
|
||||
npc.getCastle().addToTreasury(entry.getTaxAmount() * _amount);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param player
|
||||
* @param npc
|
||||
* @param list
|
||||
* @return {@code true} if player can buy stuff from the multisell, {@code false} otherwise.
|
||||
*/
|
||||
private boolean isAllowedToUse(L2PcInstance player, L2Npc npc, PreparedListContainer list)
|
||||
{
|
||||
if (npc != null)
|
||||
{
|
||||
if (!list.isNpcAllowed(npc.getId()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (list.isNpcOnly() && ((npc.getInstanceWorld() != player.getInstanceWorld()) || !player.isInsideRadius(npc, L2Npc.INTERACTION_DISTANCE, true, false)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (list.isNpcOnly())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,66 +1,55 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.PlayerTemplateData;
|
||||
import com.l2jmobius.gameserver.model.base.ClassId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.NewCharacterSuccess;
|
||||
|
||||
/**
|
||||
* @author Zoey76
|
||||
*/
|
||||
public final class NewCharacter extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__13_NEWCHARACTER = "[C] 13 NewCharacter";
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
_log.fine(_C__13_NEWCHARACTER);
|
||||
}
|
||||
|
||||
final NewCharacterSuccess ct = new NewCharacterSuccess();
|
||||
ct.addChar(PlayerTemplateData.getInstance().getTemplate(ClassId.FIGHTER)); // Human Figther
|
||||
ct.addChar(PlayerTemplateData.getInstance().getTemplate(ClassId.MAGE)); // Human Mystic
|
||||
ct.addChar(PlayerTemplateData.getInstance().getTemplate(ClassId.ELVEN_FIGHTER)); // Elven Fighter
|
||||
ct.addChar(PlayerTemplateData.getInstance().getTemplate(ClassId.ELVEN_MAGE)); // Elven Mystic
|
||||
ct.addChar(PlayerTemplateData.getInstance().getTemplate(ClassId.DARK_FIGHTER)); // Dark Fighter
|
||||
ct.addChar(PlayerTemplateData.getInstance().getTemplate(ClassId.DARK_MAGE)); // Dark Mystic
|
||||
ct.addChar(PlayerTemplateData.getInstance().getTemplate(ClassId.ORC_FIGHTER)); // Orc Fighter
|
||||
ct.addChar(PlayerTemplateData.getInstance().getTemplate(ClassId.ORC_MAGE)); // Orc Mystic
|
||||
ct.addChar(PlayerTemplateData.getInstance().getTemplate(ClassId.DWARVEN_FIGHTER)); // Dwarf Fighter
|
||||
ct.addChar(PlayerTemplateData.getInstance().getTemplate(ClassId.MALE_SOLDIER)); // Male Kamael Soldier
|
||||
ct.addChar(PlayerTemplateData.getInstance().getTemplate(ClassId.FEMALE_SOLDIER)); // Female Kamael Soldier
|
||||
ct.addChar(PlayerTemplateData.getInstance().getTemplate(ClassId.ERTHEIA_FIGHTER)); // Ertheia Fighter
|
||||
ct.addChar(PlayerTemplateData.getInstance().getTemplate(ClassId.ERTHEIA_WIZARD)); // Ertheia Wizard
|
||||
sendPacket(ct);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__13_NEWCHARACTER;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.PlayerTemplateData;
|
||||
import com.l2jmobius.gameserver.model.base.ClassId;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.NewCharacterSuccess;
|
||||
|
||||
/**
|
||||
* @author Zoey76
|
||||
*/
|
||||
public final class NewCharacter implements IClientIncomingPacket
|
||||
{
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final NewCharacterSuccess ct = new NewCharacterSuccess();
|
||||
ct.addChar(PlayerTemplateData.getInstance().getTemplate(ClassId.FIGHTER)); // Human Figther
|
||||
ct.addChar(PlayerTemplateData.getInstance().getTemplate(ClassId.MAGE)); // Human Mystic
|
||||
ct.addChar(PlayerTemplateData.getInstance().getTemplate(ClassId.ELVEN_FIGHTER)); // Elven Fighter
|
||||
ct.addChar(PlayerTemplateData.getInstance().getTemplate(ClassId.ELVEN_MAGE)); // Elven Mystic
|
||||
ct.addChar(PlayerTemplateData.getInstance().getTemplate(ClassId.DARK_FIGHTER)); // Dark Fighter
|
||||
ct.addChar(PlayerTemplateData.getInstance().getTemplate(ClassId.DARK_MAGE)); // Dark Mystic
|
||||
ct.addChar(PlayerTemplateData.getInstance().getTemplate(ClassId.ORC_FIGHTER)); // Orc Fighter
|
||||
ct.addChar(PlayerTemplateData.getInstance().getTemplate(ClassId.ORC_MAGE)); // Orc Mystic
|
||||
ct.addChar(PlayerTemplateData.getInstance().getTemplate(ClassId.DWARVEN_FIGHTER)); // Dwarf Fighter
|
||||
ct.addChar(PlayerTemplateData.getInstance().getTemplate(ClassId.MALE_SOLDIER)); // Male Kamael Soldier
|
||||
ct.addChar(PlayerTemplateData.getInstance().getTemplate(ClassId.FEMALE_SOLDIER)); // Female Kamael Soldier
|
||||
ct.addChar(PlayerTemplateData.getInstance().getTemplate(ClassId.ERTHEIA_FIGHTER)); // Ertheia Fighter
|
||||
ct.addChar(PlayerTemplateData.getInstance().getTemplate(ClassId.ERTHEIA_WIZARD)); // Ertheia Wizard
|
||||
client.sendPacket(ct);
|
||||
}
|
||||
}
|
||||
|
||||
+49
-54
@@ -1,54 +1,49 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.gameserver.enums.UserInfoType;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.UserInfo;
|
||||
|
||||
/**
|
||||
* @author Sdw
|
||||
*/
|
||||
public class NotifyExitBeautyShop extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_E1_NOTIFYEXITBEAUTYSHOP = "[C] D0:E1 NotifyExitBeautyShop";
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final UserInfo userInfo = new UserInfo(activeChar, false);
|
||||
userInfo.addComponentType(UserInfoType.APPAREANCE);
|
||||
sendPacket(userInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_E1_NOTIFYEXITBEAUTYSHOP;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.enums.UserInfoType;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.UserInfo;
|
||||
|
||||
/**
|
||||
* @author Sdw
|
||||
*/
|
||||
public class NotifyExitBeautyShop 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;
|
||||
}
|
||||
|
||||
final UserInfo userInfo = new UserInfo(activeChar, false);
|
||||
userInfo.addComponentType(UserInfoType.APPAREANCE);
|
||||
client.sendPacket(userInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,54 +1,50 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
|
||||
/**
|
||||
* This class ...
|
||||
* @version $Revision: 1.7.4.4 $ $Date: 2005/03/27 18:46:19 $
|
||||
*/
|
||||
public final class ObserverReturn extends L2GameClientPacket
|
||||
{
|
||||
private static final String __C__C1_OBSERVERRETURN = "[C] C1 ObserverReturn";
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (activeChar.inObserverMode())
|
||||
{
|
||||
activeChar.leaveObserverMode();
|
||||
// activeChar.teleToLocation(activeChar.getObsX(), activeChar.getObsY(), activeChar.getObsZ());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return __C__C1_OBSERVERRETURN;
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
|
||||
/**
|
||||
* This class ...
|
||||
* @version $Revision: 1.7.4.4 $ $Date: 2005/03/27 18:46:19 $
|
||||
*/
|
||||
public final class ObserverReturn 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.inObserverMode())
|
||||
{
|
||||
activeChar.leaveObserverMode();
|
||||
// activeChar.teleToLocation(activeChar.getObsX(), activeChar.getObsY(), activeChar.getObsZ());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,88 +1,64 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.LogRecord;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.KeyPacket;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.L2GameServerPacket;
|
||||
|
||||
/**
|
||||
* This class ...
|
||||
* @version $Revision: 1.5.2.8.2.8 $ $Date: 2005/04/02 10:43:04 $
|
||||
*/
|
||||
public final class ProtocolVersion extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__0E_PROTOCOLVERSION = "[C] 0E ProtocolVersion";
|
||||
private static final Logger _logAccounting = Logger.getLogger("accounting");
|
||||
|
||||
private int _version;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_version = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
// this packet is never encrypted
|
||||
if (_version == -2)
|
||||
{
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
_log.info("Ping received");
|
||||
}
|
||||
// this is just a ping attempt from the new C2 client
|
||||
getClient().close((L2GameServerPacket) null);
|
||||
}
|
||||
else if (!Config.PROTOCOL_LIST.contains(_version))
|
||||
{
|
||||
final LogRecord record = new LogRecord(Level.WARNING, "Wrong protocol");
|
||||
record.setParameters(new Object[]
|
||||
{
|
||||
_version,
|
||||
getClient()
|
||||
});
|
||||
_logAccounting.log(record);
|
||||
final KeyPacket pk = new KeyPacket(getClient().enableCrypt(), 0);
|
||||
getClient().setProtocolOk(false);
|
||||
getClient().close(pk);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
_log.fine("Client Protocol Revision is ok: " + _version);
|
||||
}
|
||||
|
||||
final KeyPacket pk = new KeyPacket(getClient().enableCrypt(), 1);
|
||||
getClient().sendPacket(pk);
|
||||
getClient().setProtocolOk(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__0E_PROTOCOLVERSION;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.KeyPacket;
|
||||
|
||||
/**
|
||||
* This class ...
|
||||
* @version $Revision: 1.5.2.8.2.8 $ $Date: 2005/04/02 10:43:04 $
|
||||
*/
|
||||
public final class ProtocolVersion implements IClientIncomingPacket
|
||||
{
|
||||
private static final Logger _logAccounting = Logger.getLogger("accounting");
|
||||
|
||||
private int _version;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_version = packet.readD();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
// this packet is never encrypted
|
||||
if (_version == -2)
|
||||
{
|
||||
// this is just a ping attempt from the new C2 client
|
||||
client.close(null);
|
||||
}
|
||||
else if (!Config.PROTOCOL_LIST.contains(_version))
|
||||
{
|
||||
_logAccounting.warning("Wrong protocol version " + _version + ", " + client);
|
||||
client.setProtocolOk(false);
|
||||
client.close(new KeyPacket(client.enableCrypt(), 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
client.sendPacket(new KeyPacket(client.enableCrypt(), 1));
|
||||
client.setProtocolOk(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-118
@@ -1,118 +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;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
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.holders.SkillHolder;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExAcquireAPSkillList;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class RequestAcquireAbilityList extends L2GameClientPacket
|
||||
{
|
||||
private final List<SkillHolder> _skills = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
readD(); // Total size
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
final int size = readD();
|
||||
for (int j = 0; j < size; j++)
|
||||
{
|
||||
_skills.add(new SkillHolder(readD(), readD()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ((activeChar.getAbilityPoints() == 0) || (activeChar.getAbilityPoints() == activeChar.getAbilityPointsUsed()))
|
||||
{
|
||||
_log.warning(getClass().getSimpleName() + ": 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;
|
||||
}
|
||||
|
||||
for (SkillHolder holder : _skills)
|
||||
{
|
||||
final L2SkillLearn learn = SkillTreesData.getInstance().getAbilitySkill(holder.getSkillId(), holder.getSkillLvl());
|
||||
if (learn == null)
|
||||
{
|
||||
_log.warning(getClass().getSimpleName() + ": SkillLearn " + holder.getSkillId() + "(" + holder.getSkillLvl() + ") not found!");
|
||||
sendActionFailed();
|
||||
break;
|
||||
}
|
||||
|
||||
final Skill skill = holder.getSkill();
|
||||
if (skill == null)
|
||||
{
|
||||
_log.warning(getClass().getSimpleName() + ": SkillLearn " + holder.getSkillId() + "(" + holder.getSkillLvl() + ") not found!");
|
||||
sendActionFailed();
|
||||
break;
|
||||
}
|
||||
final int points;
|
||||
final int knownLevel = activeChar.getSkillLevel(holder.getSkillId());
|
||||
if (knownLevel == -1) // player didn't knew it at all!
|
||||
{
|
||||
points = holder.getSkillLvl();
|
||||
}
|
||||
else
|
||||
{
|
||||
points = holder.getSkillLvl() - knownLevel;
|
||||
}
|
||||
|
||||
if ((activeChar.getAbilityPoints() - activeChar.getAbilityPointsUsed()) < points)
|
||||
{
|
||||
_log.warning(getClass().getSimpleName() + ": Player " + activeChar + " is trying to learn ability without ability points!");
|
||||
sendActionFailed();
|
||||
return;
|
||||
}
|
||||
|
||||
activeChar.addSkill(skill, true);
|
||||
activeChar.setAbilityPointsUsed(activeChar.getAbilityPointsUsed() + points);
|
||||
}
|
||||
activeChar.sendPacket(new ExAcquireAPSkillList(activeChar));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
}
|
||||
+766
-753
File diff suppressed because it is too large
Load Diff
+172
-177
@@ -1,177 +1,172 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
|
||||
import com.l2jmobius.gameserver.datatables.SkillData;
|
||||
import com.l2jmobius.gameserver.enums.CategoryType;
|
||||
import com.l2jmobius.gameserver.enums.Race;
|
||||
import com.l2jmobius.gameserver.model.ClanPrivilege;
|
||||
import com.l2jmobius.gameserver.model.L2SkillLearn;
|
||||
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.AcquireSkillType;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.AcquireSkillInfo;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExAcquireSkillInfo;
|
||||
|
||||
/**
|
||||
* Request Acquire Skill Info client packet implementation.
|
||||
* @author Zoey76
|
||||
*/
|
||||
public final class RequestAcquireSkillInfo extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__73_REQUESTACQUIRESKILLINFO = "[C] 73 RequestAcquireSkillInfo";
|
||||
|
||||
private int _id;
|
||||
private int _level;
|
||||
private AcquireSkillType _skillType;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_id = readD();
|
||||
_level = readD();
|
||||
_skillType = AcquireSkillType.getAcquireSkillType(readD());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
if ((_id <= 0) || (_level <= 0))
|
||||
{
|
||||
_log.warning(RequestAcquireSkillInfo.class.getSimpleName() + ": Invalid Id: " + _id + " or level: " + _level + "!");
|
||||
return;
|
||||
}
|
||||
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2Npc trainer = activeChar.getLastFolkNPC();
|
||||
if (!(trainer instanceof L2NpcInstance) && (_skillType != AcquireSkillType.CLASS))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ((_skillType != AcquireSkillType.CLASS) && !trainer.canInteract(activeChar) && !activeChar.isGM())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final Skill skill = SkillData.getInstance().getSkill(_id, _level);
|
||||
if (skill == null)
|
||||
{
|
||||
_log.warning(RequestAcquireSkillInfo.class.getSimpleName() + ": Skill Id: " + _id + " level: " + _level + " is undefined. " + RequestAcquireSkillInfo.class.getName() + " failed.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Hack check. Doesn't apply to all Skill Types
|
||||
final int prevSkillLevel = activeChar.getSkillLevel(_id);
|
||||
if ((prevSkillLevel > 0) && (_skillType != AcquireSkillType.TRANSFER) && (_skillType != AcquireSkillType.SUBPLEDGE))
|
||||
{
|
||||
if (prevSkillLevel == _level)
|
||||
{
|
||||
_log.warning(RequestAcquireSkillInfo.class.getSimpleName() + ": Player " + activeChar.getName() + " is trequesting info for a skill that already knows, Id: " + _id + " level: " + _level + "!");
|
||||
}
|
||||
else if (prevSkillLevel != (_level - 1))
|
||||
{
|
||||
_log.warning(RequestAcquireSkillInfo.class.getSimpleName() + ": Player " + activeChar.getName() + " is requesting info for skill Id: " + _id + " level " + _level + " without knowing it's previous level!");
|
||||
}
|
||||
}
|
||||
|
||||
final L2SkillLearn s = SkillTreesData.getInstance().getSkillLearn(_skillType, _id, _level, activeChar);
|
||||
if (s == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (_skillType)
|
||||
{
|
||||
case TRANSFORM:
|
||||
case FISHING:
|
||||
case SUBCLASS:
|
||||
case COLLECT:
|
||||
case TRANSFER:
|
||||
case DUALCLASS:
|
||||
{
|
||||
sendPacket(new AcquireSkillInfo(_skillType, s));
|
||||
break;
|
||||
}
|
||||
case CLASS:
|
||||
{
|
||||
final int customSp = s.getCalculatedLevelUpSp(activeChar.getClassId(), activeChar.getLearningClass());
|
||||
sendPacket(new ExAcquireSkillInfo(activeChar, s, customSp));
|
||||
break;
|
||||
}
|
||||
case PLEDGE:
|
||||
{
|
||||
if (!activeChar.isClanLeader())
|
||||
{
|
||||
return;
|
||||
}
|
||||
sendPacket(new AcquireSkillInfo(_skillType, s));
|
||||
break;
|
||||
}
|
||||
case SUBPLEDGE:
|
||||
{
|
||||
if (!activeChar.isClanLeader() || !activeChar.hasClanPrivilege(ClanPrivilege.CL_TROOPS_FAME))
|
||||
{
|
||||
return;
|
||||
}
|
||||
sendPacket(new AcquireSkillInfo(_skillType, s));
|
||||
break;
|
||||
}
|
||||
case ALCHEMY:
|
||||
{
|
||||
if (activeChar.getRace() != Race.ERTHEIA)
|
||||
{
|
||||
return;
|
||||
}
|
||||
sendPacket(new AcquireSkillInfo(_skillType, s));
|
||||
break;
|
||||
}
|
||||
case REVELATION:
|
||||
{
|
||||
if ((activeChar.getLevel() < 85) || !activeChar.isInCategory(CategoryType.AWAKEN_GROUP))
|
||||
{
|
||||
return;
|
||||
}
|
||||
sendPacket(new AcquireSkillInfo(_skillType, s));
|
||||
break;
|
||||
}
|
||||
case REVELATION_DUALCLASS:
|
||||
{
|
||||
if (!activeChar.isSubClassActive() || !activeChar.isDualClassActive())
|
||||
{
|
||||
return;
|
||||
}
|
||||
sendPacket(new AcquireSkillInfo(_skillType, s));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__73_REQUESTACQUIRESKILLINFO;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
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.enums.CategoryType;
|
||||
import com.l2jmobius.gameserver.enums.Race;
|
||||
import com.l2jmobius.gameserver.model.ClanPrivilege;
|
||||
import com.l2jmobius.gameserver.model.L2SkillLearn;
|
||||
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.AcquireSkillType;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.AcquireSkillInfo;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExAcquireSkillInfo;
|
||||
|
||||
/**
|
||||
* Request Acquire Skill Info client packet implementation.
|
||||
* @author Zoey76
|
||||
*/
|
||||
public final class RequestAcquireSkillInfo implements IClientIncomingPacket
|
||||
{
|
||||
private int _id;
|
||||
private int _level;
|
||||
private AcquireSkillType _skillType;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_id = packet.readD();
|
||||
_level = packet.readD();
|
||||
_skillType = AcquireSkillType.getAcquireSkillType(packet.readD());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
if ((_id <= 0) || (_level <= 0))
|
||||
{
|
||||
_log.warning(RequestAcquireSkillInfo.class.getSimpleName() + ": Invalid Id: " + _id + " or level: " + _level + "!");
|
||||
return;
|
||||
}
|
||||
|
||||
final L2PcInstance activeChar = client.getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2Npc trainer = activeChar.getLastFolkNPC();
|
||||
if (!(trainer instanceof L2NpcInstance) && (_skillType != AcquireSkillType.CLASS))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ((_skillType != AcquireSkillType.CLASS) && !trainer.canInteract(activeChar) && !activeChar.isGM())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final Skill skill = SkillData.getInstance().getSkill(_id, _level);
|
||||
if (skill == null)
|
||||
{
|
||||
_log.warning("Skill Id: " + _id + " level: " + _level + " is undefined. " + RequestAcquireSkillInfo.class.getName() + " failed.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Hack check. Doesn't apply to all Skill Types
|
||||
final int prevSkillLevel = activeChar.getSkillLevel(_id);
|
||||
if ((prevSkillLevel > 0) && !((_skillType == AcquireSkillType.TRANSFER) || (_skillType == AcquireSkillType.SUBPLEDGE)))
|
||||
{
|
||||
if (prevSkillLevel == _level)
|
||||
{
|
||||
_log.warning(RequestAcquireSkillInfo.class.getSimpleName() + ": Player " + activeChar.getName() + " is trequesting info for a skill that already knows, Id: " + _id + " level: " + _level + "!");
|
||||
}
|
||||
else if (prevSkillLevel != (_level - 1))
|
||||
{
|
||||
_log.warning(RequestAcquireSkillInfo.class.getSimpleName() + ": Player " + activeChar.getName() + " is requesting info for skill Id: " + _id + " level " + _level + " without knowing it's previous level!");
|
||||
}
|
||||
}
|
||||
|
||||
final L2SkillLearn s = SkillTreesData.getInstance().getSkillLearn(_skillType, _id, _level, activeChar);
|
||||
if (s == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (_skillType)
|
||||
{
|
||||
case TRANSFORM:
|
||||
case FISHING:
|
||||
case SUBCLASS:
|
||||
case COLLECT:
|
||||
case TRANSFER:
|
||||
case DUALCLASS:
|
||||
{
|
||||
client.sendPacket(new AcquireSkillInfo(_skillType, s));
|
||||
break;
|
||||
}
|
||||
case CLASS:
|
||||
{
|
||||
final int customSp = s.getCalculatedLevelUpSp(activeChar.getClassId(), activeChar.getLearningClass());
|
||||
client.sendPacket(new ExAcquireSkillInfo(activeChar, s, customSp));
|
||||
break;
|
||||
}
|
||||
case PLEDGE:
|
||||
{
|
||||
if (!activeChar.isClanLeader())
|
||||
{
|
||||
return;
|
||||
}
|
||||
client.sendPacket(new AcquireSkillInfo(_skillType, s));
|
||||
break;
|
||||
}
|
||||
case SUBPLEDGE:
|
||||
{
|
||||
if (!activeChar.isClanLeader() || !activeChar.hasClanPrivilege(ClanPrivilege.CL_TROOPS_FAME))
|
||||
{
|
||||
return;
|
||||
}
|
||||
client.sendPacket(new AcquireSkillInfo(_skillType, s));
|
||||
break;
|
||||
}
|
||||
case ALCHEMY:
|
||||
{
|
||||
if (activeChar.getRace() != Race.ERTHEIA)
|
||||
{
|
||||
return;
|
||||
}
|
||||
client.sendPacket(new AcquireSkillInfo(_skillType, s));
|
||||
break;
|
||||
}
|
||||
case REVELATION:
|
||||
{
|
||||
if ((activeChar.getLevel() < 85) || !activeChar.isInCategory(CategoryType.AWAKEN_GROUP))
|
||||
{
|
||||
return;
|
||||
}
|
||||
client.sendPacket(new AcquireSkillInfo(_skillType, s));
|
||||
break;
|
||||
}
|
||||
case REVELATION_DUALCLASS:
|
||||
{
|
||||
if (!activeChar.isSubClassActive() || !activeChar.isDualClassActive())
|
||||
{
|
||||
return;
|
||||
}
|
||||
client.sendPacket(new AcquireSkillInfo(_skillType, s));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+147
-1849
File diff suppressed because it is too large
Load Diff
+54
-60
@@ -1,60 +1,54 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.gameserver.instancemanager.QuestManager;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.quest.Quest;
|
||||
|
||||
/**
|
||||
* @author Sdw
|
||||
*/
|
||||
public class RequestAddExpandQuestAlarm extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_7A_REQUESTADDEXPANDQUESTALARM = "[C] D0;7A RequestAddExpandQuestAlarm";
|
||||
|
||||
private int _questId;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_questId = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final Quest quest = QuestManager.getInstance().getQuest(_questId);
|
||||
|
||||
if (quest != null)
|
||||
{
|
||||
quest.sendNpcLogList(activeChar);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_7A_REQUESTADDEXPANDQUESTALARM;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.instancemanager.QuestManager;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.quest.Quest;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
|
||||
/**
|
||||
* @author Sdw
|
||||
*/
|
||||
public class RequestAddExpandQuestAlarm implements IClientIncomingPacket
|
||||
{
|
||||
private int _questId;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_questId = packet.readD();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final L2PcInstance activeChar = client.getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final Quest quest = QuestManager.getInstance().getQuest(_questId);
|
||||
if (quest != null)
|
||||
{
|
||||
quest.sendNpcLogList(activeChar);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+46
-51
@@ -1,51 +1,46 @@
|
||||
/*
|
||||
* 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.alchemy;
|
||||
|
||||
import com.l2jmobius.gameserver.enums.Race;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.alchemy.ExAlchemySkillList;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class RequestAlchemySkillList extends L2GameClientPacket
|
||||
{
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
// Nothing to read
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getActiveChar();
|
||||
if ((activeChar == null) || (activeChar.getRace() != Race.ERTHEIA))
|
||||
{
|
||||
return;
|
||||
}
|
||||
activeChar.sendPacket(new ExAlchemySkillList(activeChar));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.enums.Race;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExAlchemySkillList;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class RequestAlchemySkillList 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) || (activeChar.getRace() != Race.ERTHEIA))
|
||||
{
|
||||
return;
|
||||
}
|
||||
client.sendPacket(new ExAlchemySkillList(activeChar));
|
||||
}
|
||||
}
|
||||
@@ -1,49 +1,39 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.gameserver.network.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExShowAgitInfo;
|
||||
|
||||
/**
|
||||
* @author KenM
|
||||
*/
|
||||
public class RequestAllAgitInfo extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_3E_REQUESTALLAGITINFO = "[C] D0:3E RequestAllAgitInfo";
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2GameClient client = getClient();
|
||||
if (client != null)
|
||||
{
|
||||
client.sendPacket(new ExShowAgitInfo());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_3E_REQUESTALLAGITINFO;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExShowAgitInfo;
|
||||
|
||||
/**
|
||||
* @author KenM
|
||||
*/
|
||||
public class RequestAllAgitInfo implements IClientIncomingPacket
|
||||
{
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
client.sendPacket(ExShowAgitInfo.STATIC_PACKET);
|
||||
}
|
||||
}
|
||||
|
||||
+39
-56
@@ -1,56 +1,39 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.gameserver.network.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExShowCastleInfo;
|
||||
|
||||
/**
|
||||
* @author KenM
|
||||
*/
|
||||
public class RequestAllCastleInfo extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_3C_REQUESTALLCASTLEINFO = "[C] D0:3C RequestAllCastleInfo";
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
// trigger
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2GameClient client = getClient();
|
||||
if (client != null)
|
||||
{
|
||||
client.sendPacket(new ExShowCastleInfo());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean triggersOnActionRequest()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_3C_REQUESTALLCASTLEINFO;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExShowCastleInfo;
|
||||
|
||||
/**
|
||||
* @author KenM
|
||||
*/
|
||||
public class RequestAllCastleInfo implements IClientIncomingPacket
|
||||
{
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
client.sendPacket(ExShowCastleInfo.STATIC_PACKET);
|
||||
}
|
||||
}
|
||||
|
||||
+39
-56
@@ -1,56 +1,39 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.gameserver.network.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExShowFortressInfo;
|
||||
|
||||
/**
|
||||
* @author KenM
|
||||
*/
|
||||
public class RequestAllFortressInfo extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_3D_REQUESTALLFORTRESSINFO = "[C] D0:3D RequestAllFortressInfo";
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
// trigger packet
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2GameClient client = getClient();
|
||||
if (client != null)
|
||||
{
|
||||
client.sendPacket(ExShowFortressInfo.STATIC_PACKET);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean triggersOnActionRequest()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_3D_REQUESTALLFORTRESSINFO;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExShowFortressInfo;
|
||||
|
||||
/**
|
||||
* @author KenM
|
||||
*/
|
||||
public class RequestAllFortressInfo implements IClientIncomingPacket
|
||||
{
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
client.sendPacket(ExShowFortressInfo.STATIC_PACKET);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,67 +1,45 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.AllyCrest;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public final class RequestAllyCrest extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__92_REQUESTALLYCREST = "[C] 92 RequestAllyCrest";
|
||||
|
||||
private int _crestId;
|
||||
private int _allyId;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_crestId = readD();
|
||||
_allyId = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
if (_crestId == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if ((activeChar.getAllyId() > 0) && (activeChar.getAllyId() == _allyId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
sendPacket(new AllyCrest(_crestId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__92_REQUESTALLYCREST;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean triggersOnActionRequest()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.AllyCrest;
|
||||
|
||||
/**
|
||||
* This class ...
|
||||
* @version $Revision: 1.3.4.4 $ $Date: 2005/03/27 15:29:30 $
|
||||
*/
|
||||
public final class RequestAllyCrest implements IClientIncomingPacket
|
||||
{
|
||||
private int _crestId;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_crestId = packet.readD();
|
||||
packet.readD(); // Ally ID
|
||||
packet.readD(); // Server ID
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
client.sendPacket(new AllyCrest(_crestId));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,115 +1,110 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.gameserver.model.ClanInfo;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.AllianceInfo;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
* This class ...
|
||||
* @version $Revision: 1479 $ $Date: 2005-11-09 00:47:42 +0100 (mer., 09 nov. 2005) $
|
||||
*/
|
||||
public final class RequestAllyInfo extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__2E_REQUESTALLYINFO = "[C] 2E RequestAllyInfo";
|
||||
|
||||
@Override
|
||||
public void readImpl()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SystemMessage sm;
|
||||
final int allianceId = activeChar.getAllyId();
|
||||
if (allianceId > 0)
|
||||
{
|
||||
final AllianceInfo ai = new AllianceInfo(allianceId);
|
||||
activeChar.sendPacket(ai);
|
||||
|
||||
// send for player
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.ALLIANCE_INFORMATION);
|
||||
activeChar.sendPacket(sm);
|
||||
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.ALLIANCE_NAME_S1);
|
||||
sm.addString(ai.getName());
|
||||
activeChar.sendPacket(sm);
|
||||
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.ALLIANCE_LEADER_S2_OF_S1);
|
||||
sm.addString(ai.getLeaderC());
|
||||
sm.addString(ai.getLeaderP());
|
||||
activeChar.sendPacket(sm);
|
||||
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.CONNECTION_S1_TOTAL_S2);
|
||||
sm.addInt(ai.getOnline());
|
||||
sm.addInt(ai.getTotal());
|
||||
activeChar.sendPacket(sm);
|
||||
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.AFFILIATED_CLANS_TOTAL_S1_CLAN_S);
|
||||
sm.addInt(ai.getAllies().length);
|
||||
activeChar.sendPacket(sm);
|
||||
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.CLAN_INFORMATION);
|
||||
for (ClanInfo aci : ai.getAllies())
|
||||
{
|
||||
activeChar.sendPacket(sm);
|
||||
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.CLAN_NAME_S1);
|
||||
sm.addString(aci.getClan().getName());
|
||||
activeChar.sendPacket(sm);
|
||||
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.CLAN_LEADER_S1);
|
||||
sm.addString(aci.getClan().getLeaderName());
|
||||
activeChar.sendPacket(sm);
|
||||
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.CLAN_LEVEL_S1);
|
||||
sm.addInt(aci.getClan().getLevel());
|
||||
activeChar.sendPacket(sm);
|
||||
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.CONNECTION_S1_TOTAL_S2);
|
||||
sm.addInt(aci.getOnline());
|
||||
sm.addInt(aci.getTotal());
|
||||
activeChar.sendPacket(sm);
|
||||
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.EMPTY4);
|
||||
}
|
||||
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.EMPTY5);
|
||||
activeChar.sendPacket(sm);
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_ARE_NOT_CURRENTLY_ALLIED_WITH_ANY_CLANS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__2E_REQUESTALLYINFO;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.model.ClanInfo;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.AllianceInfo;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
* This class ...
|
||||
* @version $Revision: 1479 $ $Date: 2005-11-09 00:47:42 +0100 (mer., 09 nov. 2005) $
|
||||
*/
|
||||
public final class RequestAllyInfo 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;
|
||||
}
|
||||
|
||||
SystemMessage sm;
|
||||
final int allianceId = activeChar.getAllyId();
|
||||
if (allianceId > 0)
|
||||
{
|
||||
final AllianceInfo ai = new AllianceInfo(allianceId);
|
||||
client.sendPacket(ai);
|
||||
|
||||
// send for player
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.ALLIANCE_INFORMATION);
|
||||
client.sendPacket(sm);
|
||||
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.ALLIANCE_NAME_S1);
|
||||
sm.addString(ai.getName());
|
||||
client.sendPacket(sm);
|
||||
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.ALLIANCE_LEADER_S2_OF_S1);
|
||||
sm.addString(ai.getLeaderC());
|
||||
sm.addString(ai.getLeaderP());
|
||||
client.sendPacket(sm);
|
||||
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.CONNECTION_S1_TOTAL_S2);
|
||||
sm.addInt(ai.getOnline());
|
||||
sm.addInt(ai.getTotal());
|
||||
client.sendPacket(sm);
|
||||
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.AFFILIATED_CLANS_TOTAL_S1_CLAN_S);
|
||||
sm.addInt(ai.getAllies().length);
|
||||
client.sendPacket(sm);
|
||||
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.CLAN_INFORMATION);
|
||||
for (ClanInfo aci : ai.getAllies())
|
||||
{
|
||||
client.sendPacket(sm);
|
||||
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.CLAN_NAME_S1);
|
||||
sm.addString(aci.getClan().getName());
|
||||
client.sendPacket(sm);
|
||||
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.CLAN_LEADER_S1);
|
||||
sm.addString(aci.getClan().getLeaderName());
|
||||
client.sendPacket(sm);
|
||||
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.CLAN_LEVEL_S1);
|
||||
sm.addInt(aci.getClan().getLevel());
|
||||
client.sendPacket(sm);
|
||||
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.CONNECTION_S1_TOTAL_S2);
|
||||
sm.addInt(aci.getOnline());
|
||||
sm.addInt(aci.getTotal());
|
||||
client.sendPacket(sm);
|
||||
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.EMPTY4);
|
||||
}
|
||||
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.EMPTY5);
|
||||
client.sendPacket(sm);
|
||||
}
|
||||
else
|
||||
{
|
||||
client.sendPacket(SystemMessageId.YOU_ARE_NOT_CURRENTLY_ALLIED_WITH_ANY_CLANS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+81
-86
@@ -1,86 +1,81 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.gameserver.model.L2Clan;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
public final class RequestAnswerJoinAlly extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__8D_REQUESTANSWERJOINALLY = "[C] 8D RequestAnswerJoinAlly";
|
||||
|
||||
private int _response;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_response = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2PcInstance requestor = activeChar.getRequest().getPartner();
|
||||
if (requestor == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_response == 0)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.NO_RESPONSE_YOUR_ENTRANCE_TO_THE_ALLIANCE_HAS_BEEN_CANCELLED);
|
||||
requestor.sendPacket(SystemMessageId.NO_RESPONSE_INVITATION_TO_JOIN_AN_ALLIANCE_HAS_BEEN_CANCELLED);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(requestor.getRequest().getRequestPacket() instanceof RequestJoinAlly))
|
||||
{
|
||||
return; // hax
|
||||
}
|
||||
|
||||
final L2Clan clan = requestor.getClan();
|
||||
// we must double check this cause of hack
|
||||
if (clan.checkAllyJoinCondition(requestor, activeChar))
|
||||
{
|
||||
// TODO: Need correct message id
|
||||
requestor.sendPacket(SystemMessageId.THAT_PERSON_HAS_BEEN_SUCCESSFULLY_ADDED_TO_YOUR_FRIEND_LIST);
|
||||
activeChar.sendPacket(SystemMessageId.YOU_HAVE_ACCEPTED_THE_ALLIANCE);
|
||||
|
||||
activeChar.getClan().setAllyId(clan.getAllyId());
|
||||
activeChar.getClan().setAllyName(clan.getAllyName());
|
||||
activeChar.getClan().setAllyPenaltyExpiryTime(0, 0);
|
||||
activeChar.getClan().changeAllyCrest(clan.getAllyCrestId(), true);
|
||||
activeChar.getClan().updateClanInDB();
|
||||
}
|
||||
}
|
||||
|
||||
activeChar.getRequest().onRequestResponse();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__8D_REQUESTANSWERJOINALLY;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.model.L2Clan;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
|
||||
public final class RequestAnswerJoinAlly implements IClientIncomingPacket
|
||||
{
|
||||
private int _response;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_response = packet.readD();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final L2PcInstance activeChar = client.getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2PcInstance requestor = activeChar.getRequest().getPartner();
|
||||
if (requestor == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_response == 0)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.NO_RESPONSE_YOUR_ENTRANCE_TO_THE_ALLIANCE_HAS_BEEN_CANCELLED);
|
||||
requestor.sendPacket(SystemMessageId.NO_RESPONSE_INVITATION_TO_JOIN_AN_ALLIANCE_HAS_BEEN_CANCELLED);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(requestor.getRequest().getRequestPacket() instanceof RequestJoinAlly))
|
||||
{
|
||||
return; // hax
|
||||
}
|
||||
|
||||
final L2Clan clan = requestor.getClan();
|
||||
// we must double check this cause of hack
|
||||
if (clan.checkAllyJoinCondition(requestor, activeChar))
|
||||
{
|
||||
// TODO: Need correct message id
|
||||
requestor.sendPacket(SystemMessageId.THAT_PERSON_HAS_BEEN_SUCCESSFULLY_ADDED_TO_YOUR_FRIEND_LIST);
|
||||
activeChar.sendPacket(SystemMessageId.YOU_HAVE_ACCEPTED_THE_ALLIANCE);
|
||||
|
||||
activeChar.getClan().setAllyId(clan.getAllyId());
|
||||
activeChar.getClan().setAllyName(clan.getAllyName());
|
||||
activeChar.getClan().setAllyPenaltyExpiryTime(0, 0);
|
||||
activeChar.getClan().changeAllyCrest(clan.getAllyCrestId(), true);
|
||||
activeChar.getClan().updateClanInDB();
|
||||
}
|
||||
}
|
||||
|
||||
activeChar.getRequest().onRequestResponse();
|
||||
}
|
||||
}
|
||||
|
||||
+120
-156
@@ -1,156 +1,120 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.gameserver.model.L2Party;
|
||||
import com.l2jmobius.gameserver.model.PartyMatchRoom;
|
||||
import com.l2jmobius.gameserver.model.PartyMatchRoomList;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.request.PartyRequest;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExManagePartyRoomMember;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.JoinParty;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
public final class RequestAnswerJoinParty extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__43_REQUESTANSWERPARTY = "[C] 43 RequestAnswerJoinParty";
|
||||
|
||||
private int _response;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_response = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance player = getClient().getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final PartyRequest request = player.getRequest(PartyRequest.class);
|
||||
if ((request == null) || request.isProcessing())
|
||||
{
|
||||
return;
|
||||
}
|
||||
request.setProcessing(true);
|
||||
final L2PcInstance requestor = request.getActiveChar();
|
||||
if (requestor == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
final L2Party party = requestor.getParty();
|
||||
|
||||
requestor.sendPacket(new JoinParty(_response));
|
||||
|
||||
switch (_response)
|
||||
{
|
||||
case -1: // Party disable by player client config
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_SET_TO_REFUSE_PARTY_REQUESTS_AND_CANNOT_RECEIVE_A_PARTY_REQUEST);
|
||||
sm.addPcName(player);
|
||||
requestor.sendPacket(sm);
|
||||
break;
|
||||
}
|
||||
case 0: // Party cancel by player
|
||||
{
|
||||
// requestor.sendPacket(SystemMessageId.THE_PLAYER_DECLINED_TO_JOIN_YOUR_PARTY); FIXME: Done in client?
|
||||
break;
|
||||
}
|
||||
case 1: // Party accept by player
|
||||
{
|
||||
if (requestor.isInParty())
|
||||
{
|
||||
if (requestor.getParty().getMemberCount() >= 7)
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_PARTY_IS_FULL);
|
||||
player.sendPacket(sm);
|
||||
requestor.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
requestor.setParty(new L2Party(requestor, requestor.getPartyDistributionType()));
|
||||
}
|
||||
player.joinParty(requestor.getParty());
|
||||
if (requestor.isInPartyMatchRoom() && player.isInPartyMatchRoom())
|
||||
{
|
||||
final PartyMatchRoomList list = PartyMatchRoomList.getInstance();
|
||||
if ((list != null) && (list.getPlayerRoomId(requestor) == list.getPlayerRoomId(player)))
|
||||
{
|
||||
final PartyMatchRoom room = list.getPlayerRoom(requestor);
|
||||
if (room != null)
|
||||
{
|
||||
final ExManagePartyRoomMember packet = new ExManagePartyRoomMember(player, room, 1);
|
||||
for (L2PcInstance member : room.getPartyMembers())
|
||||
{
|
||||
if (member != null)
|
||||
{
|
||||
member.sendPacket(packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (requestor.isInPartyMatchRoom() && !player.isInPartyMatchRoom())
|
||||
{
|
||||
final PartyMatchRoomList list = PartyMatchRoomList.getInstance();
|
||||
if (list != null)
|
||||
{
|
||||
final PartyMatchRoom room = list.getPlayerRoom(requestor);
|
||||
if (room != null)
|
||||
{
|
||||
room.addMember(player);
|
||||
final ExManagePartyRoomMember packet = new ExManagePartyRoomMember(player, room, 1);
|
||||
for (L2PcInstance member : room.getPartyMembers())
|
||||
{
|
||||
if (member != null)
|
||||
{
|
||||
member.sendPacket(packet);
|
||||
}
|
||||
}
|
||||
player.setPartyRoom(room.getId());
|
||||
// player.setPartyMatching(1);
|
||||
player.broadcastUserInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (party != null)
|
||||
{
|
||||
party.setPendingInvitation(false); // if party is null, there is no need of decreasing
|
||||
}
|
||||
|
||||
request.setProcessing(false);
|
||||
player.removeRequest(request.getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__43_REQUESTANSWERPARTY;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.model.L2Party;
|
||||
import com.l2jmobius.gameserver.model.L2Party.MessageType;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.request.PartyRequest;
|
||||
import com.l2jmobius.gameserver.model.matching.MatchingRoom;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.JoinParty;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
public final class RequestAnswerJoinParty implements IClientIncomingPacket
|
||||
{
|
||||
private int _response;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_response = packet.readD();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final L2PcInstance player = client.getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final PartyRequest request = player.getRequest(PartyRequest.class);
|
||||
if ((request == null) || request.isProcessing() || !player.removeRequest(request.getClass()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
request.setProcessing(true);
|
||||
|
||||
final L2PcInstance requestor = request.getActiveChar();
|
||||
if (requestor == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2Party party = request.getParty();
|
||||
final L2Party requestorParty = requestor.getParty();
|
||||
if ((requestorParty != null) && (requestorParty != party))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
requestor.sendPacket(new JoinParty(_response));
|
||||
|
||||
if (_response == 1)
|
||||
{
|
||||
if (party.getMemberCount() >= Config.ALT_PARTY_MAX_MEMBERS)
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_PARTY_IS_FULL);
|
||||
player.sendPacket(sm);
|
||||
requestor.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
// Assign the party to the leader upon accept of his partner
|
||||
if (requestorParty == null)
|
||||
{
|
||||
requestor.setParty(party);
|
||||
}
|
||||
|
||||
player.joinParty(party);
|
||||
|
||||
final MatchingRoom requestorRoom = requestor.getMatchingRoom();
|
||||
|
||||
if (requestorRoom != null)
|
||||
{
|
||||
requestorRoom.addMember(player);
|
||||
}
|
||||
}
|
||||
else if (_response == -1)
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_SET_TO_REFUSE_PARTY_REQUESTS_AND_CANNOT_RECEIVE_A_PARTY_REQUEST);
|
||||
sm.addPcName(player);
|
||||
requestor.sendPacket(sm);
|
||||
|
||||
if (party.getMemberCount() == 1)
|
||||
{
|
||||
party.removePartyMember(requestor, MessageType.NONE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (party.getMemberCount() == 1)
|
||||
{
|
||||
party.removePartyMember(requestor, MessageType.NONE);
|
||||
}
|
||||
}
|
||||
|
||||
party.setPendingInvitation(false);
|
||||
request.setProcessing(false);
|
||||
}
|
||||
}
|
||||
|
||||
+128
-133
@@ -1,133 +1,128 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||
import com.l2jmobius.gameserver.instancemanager.FortManager;
|
||||
import com.l2jmobius.gameserver.model.L2Clan;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExPledgeCount;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.JoinPledge;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.PledgeShowInfoUpdate;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.PledgeShowMemberListAdd;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.PledgeShowMemberListAll;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
* This class ...
|
||||
* @version $Revision: 1.4.2.1.2.3 $ $Date: 2005/03/27 15:29:30 $
|
||||
*/
|
||||
public final class RequestAnswerJoinPledge extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__27_REQUESTANSWERJOINPLEDGE = "[C] 27 RequestAnswerJoinPledge";
|
||||
|
||||
private int _answer;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_answer = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2PcInstance requestor = activeChar.getRequest().getPartner();
|
||||
if (requestor == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_answer == 0)
|
||||
{
|
||||
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_DIDN_T_RESPOND_TO_S1_S_INVITATION_JOINING_HAS_BEEN_CANCELLED);
|
||||
sm.addString(requestor.getName());
|
||||
activeChar.sendPacket(sm);
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_DID_NOT_RESPOND_INVITATION_TO_THE_CLAN_HAS_BEEN_CANCELLED);
|
||||
sm.addString(activeChar.getName());
|
||||
requestor.sendPacket(sm);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(requestor.getRequest().getRequestPacket() instanceof RequestJoinPledge))
|
||||
{
|
||||
return; // hax
|
||||
}
|
||||
|
||||
final RequestJoinPledge requestPacket = (RequestJoinPledge) requestor.getRequest().getRequestPacket();
|
||||
final L2Clan clan = requestor.getClan();
|
||||
// we must double check this cause during response time conditions can be changed, i.e. another player could join clan
|
||||
if (clan.checkClanJoinCondition(requestor, activeChar, requestPacket.getPledgeType()))
|
||||
{
|
||||
activeChar.sendPacket(new JoinPledge(requestor.getClanId()));
|
||||
|
||||
activeChar.setPledgeType(requestPacket.getPledgeType());
|
||||
if (requestPacket.getPledgeType() == L2Clan.SUBUNIT_ACADEMY)
|
||||
{
|
||||
activeChar.setPowerGrade(9); // Academy
|
||||
activeChar.setLvlJoinedAcademy(activeChar.getLevel());
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.setPowerGrade(5); // new member starts at 5, not confirmed
|
||||
}
|
||||
|
||||
clan.addClanMember(activeChar);
|
||||
activeChar.setClanPrivileges(activeChar.getClan().getRankPrivs(activeChar.getPowerGrade()));
|
||||
activeChar.sendPacket(SystemMessageId.ENTERED_THE_CLAN);
|
||||
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_HAS_JOINED_THE_CLAN);
|
||||
sm.addString(activeChar.getName());
|
||||
clan.broadcastToOnlineMembers(sm);
|
||||
|
||||
if (clan.getCastleId() > 0)
|
||||
{
|
||||
CastleManager.getInstance().getCastleByOwner(clan).giveResidentialSkills(activeChar);
|
||||
}
|
||||
if (clan.getFortId() > 0)
|
||||
{
|
||||
FortManager.getInstance().getFortByOwner(clan).giveResidentialSkills(activeChar);
|
||||
}
|
||||
activeChar.sendSkillList();
|
||||
|
||||
clan.broadcastToOtherOnlineMembers(new PledgeShowMemberListAdd(activeChar), activeChar);
|
||||
clan.broadcastToOnlineMembers(new PledgeShowInfoUpdate(clan));
|
||||
clan.broadcastToOnlineMembers(new ExPledgeCount(clan));
|
||||
|
||||
// this activates the clan tab on the new member
|
||||
activeChar.sendPacket(new PledgeShowMemberListAll(clan));
|
||||
activeChar.setClanJoinExpiryTime(0);
|
||||
activeChar.broadcastUserInfo();
|
||||
}
|
||||
}
|
||||
|
||||
activeChar.getRequest().onRequestResponse();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__27_REQUESTANSWERJOINPLEDGE;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||
import com.l2jmobius.gameserver.instancemanager.FortManager;
|
||||
import com.l2jmobius.gameserver.model.L2Clan;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExPledgeCount;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.JoinPledge;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.PledgeShowInfoUpdate;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.PledgeShowMemberListAdd;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.PledgeShowMemberListAll;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
* This class ...
|
||||
* @version $Revision: 1.4.2.1.2.3 $ $Date: 2005/03/27 15:29:30 $
|
||||
*/
|
||||
public final class RequestAnswerJoinPledge implements IClientIncomingPacket
|
||||
{
|
||||
private int _answer;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_answer = packet.readD();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final L2PcInstance activeChar = client.getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2PcInstance requestor = activeChar.getRequest().getPartner();
|
||||
if (requestor == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_answer == 0)
|
||||
{
|
||||
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_DIDN_T_RESPOND_TO_S1_S_INVITATION_JOINING_HAS_BEEN_CANCELLED);
|
||||
sm.addString(requestor.getName());
|
||||
activeChar.sendPacket(sm);
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_DID_NOT_RESPOND_INVITATION_TO_THE_CLAN_HAS_BEEN_CANCELLED);
|
||||
sm.addString(activeChar.getName());
|
||||
requestor.sendPacket(sm);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(requestor.getRequest().getRequestPacket() instanceof RequestJoinPledge))
|
||||
{
|
||||
return; // hax
|
||||
}
|
||||
|
||||
final RequestJoinPledge requestPacket = (RequestJoinPledge) requestor.getRequest().getRequestPacket();
|
||||
final L2Clan clan = requestor.getClan();
|
||||
// we must double check this cause during response time conditions can be changed, i.e. another player could join clan
|
||||
if (clan.checkClanJoinCondition(requestor, activeChar, requestPacket.getPledgeType()))
|
||||
{
|
||||
activeChar.sendPacket(new JoinPledge(requestor.getClanId()));
|
||||
|
||||
activeChar.setPledgeType(requestPacket.getPledgeType());
|
||||
if (requestPacket.getPledgeType() == L2Clan.SUBUNIT_ACADEMY)
|
||||
{
|
||||
activeChar.setPowerGrade(9); // adademy
|
||||
activeChar.setLvlJoinedAcademy(activeChar.getLevel());
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.setPowerGrade(5); // new member starts at 5, not confirmed
|
||||
}
|
||||
|
||||
clan.addClanMember(activeChar);
|
||||
activeChar.setClanPrivileges(activeChar.getClan().getRankPrivs(activeChar.getPowerGrade()));
|
||||
activeChar.sendPacket(SystemMessageId.ENTERED_THE_CLAN);
|
||||
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_HAS_JOINED_THE_CLAN);
|
||||
sm.addString(activeChar.getName());
|
||||
clan.broadcastToOnlineMembers(sm);
|
||||
|
||||
if (clan.getCastleId() > 0)
|
||||
{
|
||||
CastleManager.getInstance().getCastleByOwner(clan).giveResidentialSkills(activeChar);
|
||||
}
|
||||
if (clan.getFortId() > 0)
|
||||
{
|
||||
FortManager.getInstance().getFortByOwner(clan).giveResidentialSkills(activeChar);
|
||||
}
|
||||
activeChar.sendSkillList();
|
||||
|
||||
clan.broadcastToOtherOnlineMembers(new PledgeShowMemberListAdd(activeChar), activeChar);
|
||||
clan.broadcastToOnlineMembers(new PledgeShowInfoUpdate(clan));
|
||||
clan.broadcastToOnlineMembers(new ExPledgeCount(clan));
|
||||
|
||||
// this activates the clan tab on the new member
|
||||
PledgeShowMemberListAll.sendAllTo(activeChar);
|
||||
activeChar.setClanJoinExpiryTime(0);
|
||||
activeChar.broadcastUserInfo();
|
||||
}
|
||||
}
|
||||
|
||||
activeChar.getRequest().onRequestResponse();
|
||||
}
|
||||
}
|
||||
|
||||
+70
-73
@@ -1,73 +1,70 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExAskJoinPartyRoom;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
* Format: (ch) S
|
||||
* @author -Wooden-, Tryskell
|
||||
*/
|
||||
public class RequestAskJoinPartyRoom extends L2GameClientPacket
|
||||
{
|
||||
private String _name;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_name = readS();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance player = getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Send PartyRoom invite request (with activeChar) name to the target
|
||||
final L2PcInstance target = L2World.getInstance().getPlayer(_name);
|
||||
if (target != null)
|
||||
{
|
||||
if (!target.isProcessingRequest())
|
||||
{
|
||||
player.onTransactionRequest(target);
|
||||
target.sendPacket(new ExAskJoinPartyRoom(player));
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_IS_ON_ANOTHER_TASK_PLEASE_TRY_AGAIN_LATER).addPcName(target));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendPacket(SystemMessageId.THAT_PLAYER_IS_NOT_ONLINE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return "[C] D0:14 RequestAskJoinPartyRoom";
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExAskJoinPartyRoom;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
* Format: (ch) S
|
||||
* @author -Wooden-, Tryskell
|
||||
*/
|
||||
public class RequestAskJoinPartyRoom implements IClientIncomingPacket
|
||||
{
|
||||
private String _name;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_name = packet.readS();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final L2PcInstance player = client.getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Send PartyRoom invite request (with activeChar) name to the target
|
||||
final L2PcInstance target = L2World.getInstance().getPlayer(_name);
|
||||
if (target != null)
|
||||
{
|
||||
if (!target.isProcessingRequest())
|
||||
{
|
||||
player.onTransactionRequest(target);
|
||||
target.sendPacket(new ExAskJoinPartyRoom(player));
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_IS_ON_ANOTHER_TASK_PLEASE_TRY_AGAIN_LATER).addPcName(target));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendPacket(SystemMessageId.THAT_PLAYER_IS_NOT_ONLINE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+204
-239
@@ -1,239 +1,204 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.gameserver.enums.PrivateStoreType;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Summon;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.items.type.ActionType;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExAutoSoulShot;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
* @author Unknown, UnAfraid
|
||||
*/
|
||||
public final class RequestAutoSoulShot extends L2GameClientPacket
|
||||
{
|
||||
// format cd
|
||||
private int _itemId;
|
||||
private int _type; // 1 = on : 0 = off;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_itemId = readD();
|
||||
_type = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if ((activeChar == null) || (activeChar.getPrivateStoreType() != PrivateStoreType.NONE) || (activeChar.getActiveRequester() != null) || activeChar.isDead())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2ItemInstance item = activeChar.getInventory().getItemByItemId(_itemId);
|
||||
if (item == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_type == 1)
|
||||
{
|
||||
if (!activeChar.getInventory().canManipulateWithItemId(item.getId()))
|
||||
{
|
||||
activeChar.sendMessage("Cannot use this item.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (isSummonShot(item.getItem()))
|
||||
{
|
||||
if (activeChar.hasSummon())
|
||||
{
|
||||
final boolean isSoulshot = item.getEtcItem().getDefaultAction() == ActionType.SUMMON_SOULSHOT;
|
||||
final boolean isSpiritshot = item.getEtcItem().getDefaultAction() == ActionType.SUMMON_SPIRITSHOT;
|
||||
if (isSoulshot)
|
||||
{
|
||||
int soulshotCount = 0;
|
||||
final L2Summon pet = activeChar.getPet();
|
||||
if (pet != null)
|
||||
{
|
||||
soulshotCount += pet.getSoulShotsPerHit();
|
||||
}
|
||||
for (L2Summon servitor : activeChar.getServitors().values())
|
||||
{
|
||||
soulshotCount += servitor.getSoulShotsPerHit();
|
||||
}
|
||||
if (soulshotCount > item.getCount())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_DON_T_HAVE_ENOUGH_SOULSHOTS_NEEDED_FOR_A_PET_SERVITOR);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (isSpiritshot)
|
||||
{
|
||||
int spiritshotCount = 0;
|
||||
final L2Summon pet = activeChar.getPet();
|
||||
if (pet != null)
|
||||
{
|
||||
spiritshotCount += pet.getSpiritShotsPerHit();
|
||||
}
|
||||
for (L2Summon servitor : activeChar.getServitors().values())
|
||||
{
|
||||
spiritshotCount += servitor.getSpiritShotsPerHit();
|
||||
}
|
||||
if (spiritshotCount > item.getCount())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_DON_T_HAVE_ENOUGH_SOULSHOTS_NEEDED_FOR_A_PET_SERVITOR);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Activate shots
|
||||
activeChar.addAutoSoulShot(_itemId);
|
||||
activeChar.sendPacket(new ExAutoSoulShot(_itemId, 1, isSoulshot ? 2 : 3));
|
||||
|
||||
// Send message
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_AUTOMATIC_USE_OF_S1_HAS_BEEN_ACTIVATED);
|
||||
sm.addItemName(item);
|
||||
activeChar.sendPacket(sm);
|
||||
|
||||
// Recharge summon's shots
|
||||
final L2Summon pet = activeChar.getPet();
|
||||
if (pet != null)
|
||||
{
|
||||
pet.rechargeShots(isSoulshot, isSpiritshot);
|
||||
}
|
||||
activeChar.getServitors().values().forEach(s ->
|
||||
{
|
||||
s.rechargeShots(isSoulshot, isSpiritshot);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_A_SERVITOR_OR_PET_AND_THEREFORE_CANNOT_USE_THE_AUTOMATIC_USE_FUNCTION);
|
||||
}
|
||||
}
|
||||
else if (isPlayerShot(item.getItem()))
|
||||
{
|
||||
final boolean isSoulshot = (item.getEtcItem().getDefaultAction() == ActionType.SOULSHOT) || (item.getEtcItem().getDefaultAction() == ActionType.FISHINGSHOT);
|
||||
final boolean isSpiritshot = item.getEtcItem().getDefaultAction() == ActionType.SPIRITSHOT;
|
||||
if ((activeChar.getActiveWeaponItem() == activeChar.getFistsWeaponItem()) || (item.getItem().getCrystalType() != activeChar.getActiveWeaponItem().getCrystalTypePlus()))
|
||||
{
|
||||
activeChar.sendPacket(isSoulshot ? SystemMessageId.THE_SOULSHOT_YOU_ARE_ATTEMPTING_TO_USE_DOES_NOT_MATCH_THE_GRADE_OF_YOUR_EQUIPPED_WEAPON : SystemMessageId.YOUR_SPIRITSHOT_DOES_NOT_MATCH_THE_WEAPON_S_GRADE);
|
||||
return;
|
||||
}
|
||||
|
||||
// Activate shots
|
||||
activeChar.addAutoSoulShot(_itemId);
|
||||
activeChar.sendPacket(new ExAutoSoulShot(_itemId, 1, isSoulshot ? 0 : 1));
|
||||
|
||||
// Send message
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_AUTOMATIC_USE_OF_S1_HAS_BEEN_ACTIVATED);
|
||||
sm.addItemName(item);
|
||||
activeChar.sendPacket(sm);
|
||||
|
||||
// Recharge player's shots
|
||||
activeChar.rechargeShots(isSoulshot, isSpiritshot);
|
||||
}
|
||||
}
|
||||
else if (_type == 0)
|
||||
{
|
||||
// Cancel auto shots
|
||||
activeChar.removeAutoSoulShot(_itemId);
|
||||
switch (item.getEtcItem().getDefaultAction())
|
||||
{
|
||||
case SOULSHOT:
|
||||
case FISHINGSHOT:
|
||||
{
|
||||
activeChar.sendPacket(new ExAutoSoulShot(_itemId, 0, 0));
|
||||
break;
|
||||
}
|
||||
case SPIRITSHOT:
|
||||
{
|
||||
activeChar.sendPacket(new ExAutoSoulShot(_itemId, 0, 1));
|
||||
break;
|
||||
}
|
||||
case SUMMON_SOULSHOT:
|
||||
{
|
||||
activeChar.sendPacket(new ExAutoSoulShot(_itemId, 0, 2));
|
||||
break;
|
||||
}
|
||||
case SUMMON_SPIRITSHOT:
|
||||
{
|
||||
activeChar.sendPacket(new ExAutoSoulShot(_itemId, 0, 3));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Send message
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_AUTOMATIC_USE_OF_S1_HAS_BEEN_DEACTIVATED);
|
||||
sm.addItemName(item);
|
||||
activeChar.sendPacket(sm);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean triggersOnActionRequest()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isPlayerShot(L2Item item)
|
||||
{
|
||||
switch (item.getDefaultAction())
|
||||
{
|
||||
case SPIRITSHOT:
|
||||
case SOULSHOT:
|
||||
case FISHINGSHOT:
|
||||
{
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isSummonShot(L2Item item)
|
||||
{
|
||||
switch (item.getDefaultAction())
|
||||
{
|
||||
case SUMMON_SPIRITSHOT:
|
||||
case SUMMON_SOULSHOT:
|
||||
{
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.enums.PrivateStoreType;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Summon;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.items.type.ActionType;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExAutoSoulShot;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
* @author Unknown, UnAfraid
|
||||
*/
|
||||
public final class RequestAutoSoulShot implements IClientIncomingPacket
|
||||
{
|
||||
private int _itemId;
|
||||
private boolean _enable;
|
||||
private int _type;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_itemId = packet.readD();
|
||||
_enable = packet.readD() == 1;
|
||||
_type = packet.readD();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final L2PcInstance activeChar = client.getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ((activeChar.getPrivateStoreType() == PrivateStoreType.NONE) && (activeChar.getActiveRequester() == null) && !activeChar.isDead())
|
||||
{
|
||||
final L2ItemInstance item = activeChar.getInventory().getItemByItemId(_itemId);
|
||||
if (item == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_enable)
|
||||
{
|
||||
if (!activeChar.getInventory().canManipulateWithItemId(item.getId()))
|
||||
{
|
||||
activeChar.sendMessage("Cannot use this item.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (isSummonShot(item.getItem()))
|
||||
{
|
||||
if (activeChar.hasSummon())
|
||||
{
|
||||
final boolean isSoulshot = item.getEtcItem().getDefaultAction() == ActionType.SUMMON_SOULSHOT;
|
||||
final boolean isSpiritshot = item.getEtcItem().getDefaultAction() == ActionType.SUMMON_SPIRITSHOT;
|
||||
if (isSoulshot)
|
||||
{
|
||||
int soulshotCount = 0;
|
||||
final L2Summon pet = activeChar.getPet();
|
||||
if (pet != null)
|
||||
{
|
||||
soulshotCount += pet.getSoulShotsPerHit();
|
||||
}
|
||||
for (L2Summon servitor : activeChar.getServitors().values())
|
||||
{
|
||||
soulshotCount += servitor.getSoulShotsPerHit();
|
||||
}
|
||||
if (soulshotCount > item.getCount())
|
||||
{
|
||||
client.sendPacket(SystemMessageId.YOU_DON_T_HAVE_ENOUGH_SOULSHOTS_NEEDED_FOR_A_PET_SERVITOR);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (isSpiritshot)
|
||||
{
|
||||
int spiritshotCount = 0;
|
||||
final L2Summon pet = activeChar.getPet();
|
||||
if (pet != null)
|
||||
{
|
||||
spiritshotCount += pet.getSpiritShotsPerHit();
|
||||
}
|
||||
for (L2Summon servitor : activeChar.getServitors().values())
|
||||
{
|
||||
spiritshotCount += servitor.getSpiritShotsPerHit();
|
||||
}
|
||||
if (spiritshotCount > item.getCount())
|
||||
{
|
||||
client.sendPacket(SystemMessageId.YOU_DON_T_HAVE_ENOUGH_SOULSHOTS_NEEDED_FOR_A_PET_SERVITOR);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Activate shots
|
||||
activeChar.addAutoSoulShot(_itemId);
|
||||
client.sendPacket(new ExAutoSoulShot(_itemId, _enable, _type));
|
||||
|
||||
// Send message
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_AUTOMATIC_USE_OF_S1_HAS_BEEN_ACTIVATED);
|
||||
sm.addItemName(item);
|
||||
client.sendPacket(sm);
|
||||
|
||||
// Recharge summon's shots
|
||||
final L2Summon pet = activeChar.getPet();
|
||||
if (pet != null)
|
||||
{
|
||||
pet.rechargeShots(isSoulshot, isSpiritshot, false);
|
||||
}
|
||||
activeChar.getServitors().values().forEach(s ->
|
||||
{
|
||||
s.rechargeShots(isSoulshot, isSpiritshot, false);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
client.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_A_SERVITOR_OR_PET_AND_THEREFORE_CANNOT_USE_THE_AUTOMATIC_USE_FUNCTION);
|
||||
}
|
||||
}
|
||||
else if (isPlayerShot(item.getItem()))
|
||||
{
|
||||
final boolean isSoulshot = item.getEtcItem().getDefaultAction() == ActionType.SOULSHOT;
|
||||
final boolean isSpiritshot = item.getEtcItem().getDefaultAction() == ActionType.SPIRITSHOT;
|
||||
final boolean isFishingshot = item.getEtcItem().getDefaultAction() == ActionType.FISHINGSHOT;
|
||||
if ((activeChar.getActiveWeaponItem() == activeChar.getFistsWeaponItem()) || (item.getItem().getCrystalType() != activeChar.getActiveWeaponItem().getCrystalTypePlus()))
|
||||
{
|
||||
client.sendPacket(isSoulshot ? SystemMessageId.THE_SOULSHOT_YOU_ARE_ATTEMPTING_TO_USE_DOES_NOT_MATCH_THE_GRADE_OF_YOUR_EQUIPPED_WEAPON : SystemMessageId.YOUR_SPIRITSHOT_DOES_NOT_MATCH_THE_WEAPON_S_GRADE);
|
||||
return;
|
||||
}
|
||||
|
||||
// Activate shots
|
||||
activeChar.addAutoSoulShot(_itemId);
|
||||
client.sendPacket(new ExAutoSoulShot(_itemId, _enable, _type));
|
||||
|
||||
// Send message
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_AUTOMATIC_USE_OF_S1_HAS_BEEN_ACTIVATED);
|
||||
sm.addItemName(item);
|
||||
client.sendPacket(sm);
|
||||
|
||||
// Recharge player's shots
|
||||
activeChar.rechargeShots(isSoulshot, isSpiritshot, isFishingshot);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Cancel auto shots
|
||||
activeChar.removeAutoSoulShot(_itemId);
|
||||
client.sendPacket(new ExAutoSoulShot(_itemId, _enable, _type));
|
||||
|
||||
// Send message
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_AUTOMATIC_USE_OF_S1_HAS_BEEN_DEACTIVATED);
|
||||
sm.addItemName(item);
|
||||
client.sendPacket(sm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isPlayerShot(L2Item item)
|
||||
{
|
||||
switch (item.getDefaultAction())
|
||||
{
|
||||
case SPIRITSHOT:
|
||||
case SOULSHOT:
|
||||
case FISHINGSHOT:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isSummonShot(L2Item item)
|
||||
{
|
||||
switch (item.getDefaultAction())
|
||||
{
|
||||
case SUMMON_SPIRITSHOT:
|
||||
case SUMMON_SOULSHOT:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,57 +1,53 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.gameserver.handler.CommunityBoardHandler;
|
||||
|
||||
/**
|
||||
* RequestBBSwrite client packet implementation.
|
||||
* @author -Wooden-, Zoey76
|
||||
*/
|
||||
public final class RequestBBSwrite extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__24_REQUESTBBSWRITE = "[C] 24 RequestBBSwrite";
|
||||
private String _url;
|
||||
private String _arg1;
|
||||
private String _arg2;
|
||||
private String _arg3;
|
||||
private String _arg4;
|
||||
private String _arg5;
|
||||
|
||||
@Override
|
||||
protected final void readImpl()
|
||||
{
|
||||
_url = readS();
|
||||
_arg1 = readS();
|
||||
_arg2 = readS();
|
||||
_arg3 = readS();
|
||||
_arg4 = readS();
|
||||
_arg5 = readS();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void runImpl()
|
||||
{
|
||||
CommunityBoardHandler.getInstance().handleWriteCommand(getActiveChar(), _url, _arg1, _arg2, _arg3, _arg4, _arg5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String getType()
|
||||
{
|
||||
return _C__24_REQUESTBBSWRITE;
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.handler.CommunityBoardHandler;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
|
||||
/**
|
||||
* RequestBBSwrite client packet implementation.
|
||||
* @author -Wooden-, Zoey76
|
||||
*/
|
||||
public final class RequestBBSwrite implements IClientIncomingPacket
|
||||
{
|
||||
private String _url;
|
||||
private String _arg1;
|
||||
private String _arg2;
|
||||
private String _arg3;
|
||||
private String _arg4;
|
||||
private String _arg5;
|
||||
|
||||
@Override
|
||||
public final boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_url = packet.readS();
|
||||
_arg1 = packet.readS();
|
||||
_arg2 = packet.readS();
|
||||
_arg3 = packet.readS();
|
||||
_arg4 = packet.readS();
|
||||
_arg5 = packet.readS();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void run(L2GameClient client)
|
||||
{
|
||||
CommunityBoardHandler.getInstance().handleWriteCommand(client.getActiveChar(), _url, _arg1, _arg2, _arg3, _arg4, _arg5);
|
||||
}
|
||||
}
|
||||
+73
-78
@@ -1,79 +1,74 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.gameserver.instancemanager.ItemAuctionManager;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.itemauction.ItemAuction;
|
||||
import com.l2jmobius.gameserver.model.itemauction.ItemAuctionInstance;
|
||||
import com.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
|
||||
/**
|
||||
* @author Forsaiken
|
||||
*/
|
||||
public final class RequestBidItemAuction extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_39_REQUESTBIDITEMAUCTION = "[C] D0:39 RequestBidItemAuction";
|
||||
|
||||
private int _instanceId;
|
||||
private long _bid;
|
||||
|
||||
@Override
|
||||
protected final void readImpl()
|
||||
{
|
||||
_instanceId = super.readD();
|
||||
_bid = super.readQ();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = super.getClient().getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// can't use auction fp here
|
||||
if (!getClient().getFloodProtectors().getTransaction().tryPerformAction("auction"))
|
||||
{
|
||||
activeChar.sendMessage("You are bidding too fast.");
|
||||
return;
|
||||
}
|
||||
|
||||
if ((_bid < 0) || (_bid > Inventory.MAX_ADENA))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final ItemAuctionInstance instance = ItemAuctionManager.getInstance().getManagerInstance(_instanceId);
|
||||
if (instance != null)
|
||||
{
|
||||
final ItemAuction auction = instance.getCurrentAuction();
|
||||
if (auction != null)
|
||||
{
|
||||
auction.registerBid(activeChar, _bid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String getType()
|
||||
{
|
||||
return _C__D0_39_REQUESTBIDITEMAUCTION;
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.instancemanager.ItemAuctionManager;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.itemauction.ItemAuction;
|
||||
import com.l2jmobius.gameserver.model.itemauction.ItemAuctionInstance;
|
||||
import com.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
|
||||
/**
|
||||
* @author Forsaiken
|
||||
*/
|
||||
public final class RequestBidItemAuction implements IClientIncomingPacket
|
||||
{
|
||||
private int _instanceId;
|
||||
private long _bid;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_instanceId = packet.readD();
|
||||
_bid = packet.readQ();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final L2PcInstance activeChar = client.getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// can't use auction fp here
|
||||
if (!client.getFloodProtectors().getTransaction().tryPerformAction("auction"))
|
||||
{
|
||||
activeChar.sendMessage("You are bidding too fast.");
|
||||
return;
|
||||
}
|
||||
|
||||
if ((_bid < 0) || (_bid > Inventory.MAX_ADENA))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final ItemAuctionInstance instance = ItemAuctionManager.getInstance().getManagerInstance(_instanceId);
|
||||
if (instance != null)
|
||||
{
|
||||
final ItemAuction auction = instance.getCurrentAuction();
|
||||
if (auction != null)
|
||||
{
|
||||
auction.registerBid(activeChar, _bid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,126 +1,108 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.gameserver.data.sql.impl.CharNameTable;
|
||||
import com.l2jmobius.gameserver.model.BlockList;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.friend.BlockListPacket;
|
||||
|
||||
public final class RequestBlock extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__A9_REQUESTBLOCK = "[C] A9 RequestBlock";
|
||||
|
||||
private static final int BLOCK = 0;
|
||||
private static final int UNBLOCK = 1;
|
||||
private static final int BLOCKLIST = 2;
|
||||
private static final int ALLBLOCK = 3;
|
||||
private static final int ALLUNBLOCK = 4;
|
||||
|
||||
private String _name;
|
||||
private Integer _type;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_type = readD(); // 0x00 - block, 0x01 - unblock, 0x03 - allblock, 0x04 - allunblock
|
||||
|
||||
if ((_type == BLOCK) || (_type == UNBLOCK))
|
||||
{
|
||||
_name = readS();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
final int targetId = CharNameTable.getInstance().getIdByName(_name);
|
||||
final int targetAL = CharNameTable.getInstance().getAccessLevelById(targetId);
|
||||
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (_type)
|
||||
{
|
||||
case BLOCK:
|
||||
case UNBLOCK:
|
||||
{
|
||||
// can't use block/unblock for locating invisible characters
|
||||
if (targetId <= 0)
|
||||
{
|
||||
// Incorrect player name.
|
||||
activeChar.sendPacket(SystemMessageId.YOU_HAVE_FAILED_TO_REGISTER_THE_USER_TO_YOUR_IGNORE_LIST);
|
||||
return;
|
||||
}
|
||||
|
||||
if (targetAL > 0)
|
||||
{
|
||||
// Cannot block a GM character.
|
||||
activeChar.sendPacket(SystemMessageId.YOU_MAY_NOT_IMPOSE_A_BLOCK_ON_A_GM);
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeChar.getObjectId() == targetId)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_type == BLOCK)
|
||||
{
|
||||
BlockList.addToBlockList(activeChar, targetId);
|
||||
}
|
||||
else
|
||||
{
|
||||
BlockList.removeFromBlockList(activeChar, targetId);
|
||||
}
|
||||
activeChar.sendPacket(new BlockListPacket(activeChar));
|
||||
break;
|
||||
}
|
||||
case BLOCKLIST:
|
||||
{
|
||||
BlockList.sendListToOwner(activeChar);
|
||||
break;
|
||||
}
|
||||
case ALLBLOCK:
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.MESSAGE_REFUSAL_MODE);
|
||||
BlockList.setBlockAll(activeChar, true);
|
||||
break;
|
||||
}
|
||||
case ALLUNBLOCK:
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.MESSAGE_ACCEPTANCE_MODE);
|
||||
BlockList.setBlockAll(activeChar, false);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
_log.info("Unknown 0xA9 block type: " + _type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__A9_REQUESTBLOCK;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.data.sql.impl.CharNameTable;
|
||||
import com.l2jmobius.gameserver.model.BlockList;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
|
||||
public final class RequestBlock implements IClientIncomingPacket
|
||||
{
|
||||
private static final int BLOCK = 0;
|
||||
private static final int UNBLOCK = 1;
|
||||
private static final int BLOCKLIST = 2;
|
||||
private static final int ALLBLOCK = 3;
|
||||
private static final int ALLUNBLOCK = 4;
|
||||
|
||||
private String _name;
|
||||
private Integer _type;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_type = packet.readD(); // 0x00 - block, 0x01 - unblock, 0x03 - allblock, 0x04 - allunblock
|
||||
if ((_type == BLOCK) || (_type == UNBLOCK))
|
||||
{
|
||||
_name = packet.readS();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final L2PcInstance activeChar = client.getActiveChar();
|
||||
final int targetId = CharNameTable.getInstance().getIdByName(_name);
|
||||
final int targetAL = CharNameTable.getInstance().getAccessLevelById(targetId);
|
||||
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (_type)
|
||||
{
|
||||
case BLOCK:
|
||||
case UNBLOCK:
|
||||
// can't use block/unblock for locating invisible characters
|
||||
if (targetId <= 0)
|
||||
{
|
||||
// Incorrect player name.
|
||||
activeChar.sendPacket(SystemMessageId.YOU_HAVE_FAILED_TO_REGISTER_THE_USER_TO_YOUR_IGNORE_LIST);
|
||||
return;
|
||||
}
|
||||
|
||||
if (targetAL > 0)
|
||||
{
|
||||
// Cannot block a GM character.
|
||||
activeChar.sendPacket(SystemMessageId.YOU_MAY_NOT_IMPOSE_A_BLOCK_ON_A_GM);
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeChar.getObjectId() == targetId)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_type == BLOCK)
|
||||
{
|
||||
BlockList.addToBlockList(activeChar, targetId);
|
||||
}
|
||||
else
|
||||
{
|
||||
BlockList.removeFromBlockList(activeChar, targetId);
|
||||
}
|
||||
break;
|
||||
case BLOCKLIST:
|
||||
BlockList.sendListToOwner(activeChar);
|
||||
break;
|
||||
case ALLBLOCK:
|
||||
activeChar.sendPacket(SystemMessageId.MESSAGE_REFUSAL_MODE);
|
||||
BlockList.setBlockAll(activeChar, true);
|
||||
break;
|
||||
case ALLUNBLOCK:
|
||||
activeChar.sendPacket(SystemMessageId.MESSAGE_ACCEPTANCE_MODE);
|
||||
BlockList.setBlockAll(activeChar, false);
|
||||
break;
|
||||
default:
|
||||
_log.info("Unknown 0xA9 block type: " + _type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+44
-47
@@ -1,47 +1,44 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExGetBookMarkInfoPacket;
|
||||
|
||||
/**
|
||||
* @author ShanSoft Packets Structure: chddd
|
||||
*/
|
||||
public final class RequestBookMarkSlotInfo extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_51_00_REQUESTBOOKMARKSLOTINFO = "[C] D0:51:00 RequestBookMarkSlotInfo";
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
// There is nothing to read.
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance player = getClient().getActiveChar();
|
||||
player.sendPacket(new ExGetBookMarkInfoPacket(player));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_51_00_REQUESTBOOKMARKSLOTINFO;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExGetBookMarkInfoPacket;
|
||||
|
||||
/**
|
||||
* @author ShanSoft Packets Structure: chddd
|
||||
*/
|
||||
public final class RequestBookMarkSlotInfo implements IClientIncomingPacket
|
||||
{
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final L2PcInstance player = client.getActiveChar();
|
||||
if (player != null)
|
||||
{
|
||||
player.sendPacket(new ExGetBookMarkInfoPacket(player));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,281 +1,279 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import static com.l2jmobius.gameserver.model.actor.L2Npc.INTERACTION_DISTANCE;
|
||||
import static com.l2jmobius.gameserver.model.itemcontainer.Inventory.MAX_ADENA;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.BuyListData;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2MerchantInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.buylist.L2BuyList;
|
||||
import com.l2jmobius.gameserver.model.buylist.Product;
|
||||
import com.l2jmobius.gameserver.model.holders.ItemHolder;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExBuySellList;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExUserInfoInvenWeight;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
public final class RequestBuyItem extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__40_REQUESTBUYITEM = "[C] 40 RequestBuyItem";
|
||||
|
||||
private static final int BATCH_LENGTH = 12;
|
||||
private static final int CUSTOM_CB_SELL_LIST = 423;
|
||||
|
||||
private int _listId;
|
||||
private List<ItemHolder> _items = null;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_listId = readD();
|
||||
final int size = readD();
|
||||
if ((size <= 0) || (size > Config.MAX_ITEM_IN_PACKET) || ((size * BATCH_LENGTH) != _buf.remaining()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_items = new ArrayList<>(size);
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
final int itemId = readD();
|
||||
final long count = readQ();
|
||||
if ((itemId < 1) || (count < 1))
|
||||
{
|
||||
_items = null;
|
||||
return;
|
||||
}
|
||||
_items.add(new ItemHolder(itemId, count));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance player = getClient().getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!getClient().getFloodProtectors().getTransaction().tryPerformAction("buy"))
|
||||
{
|
||||
player.sendMessage("You are buying too fast.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (_items == null)
|
||||
{
|
||||
sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
// Alt game - Karma punishment
|
||||
if (!Config.ALT_GAME_KARMA_PLAYER_CAN_SHOP && (player.getReputation() < 0))
|
||||
{
|
||||
sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
final L2Object target = player.getTarget();
|
||||
L2Character merchant = null;
|
||||
if (!player.isGM() && (_listId != CUSTOM_CB_SELL_LIST))
|
||||
{
|
||||
if (!(target instanceof L2MerchantInstance) || !player.isInsideRadius(target, INTERACTION_DISTANCE, true, false) || (player.getInstanceId() != target.getInstanceId()))
|
||||
{
|
||||
sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
merchant = (L2Character) target;
|
||||
}
|
||||
|
||||
double castleTaxRate = 0;
|
||||
double baseTaxRate = 0;
|
||||
|
||||
if ((merchant == null) && !player.isGM() && (_listId != CUSTOM_CB_SELL_LIST))
|
||||
{
|
||||
sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
final L2BuyList buyList = BuyListData.getInstance().getBuyList(_listId);
|
||||
if (buyList == null)
|
||||
{
|
||||
Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " sent a false BuyList list_id " + _listId, Config.DEFAULT_PUNISH);
|
||||
return;
|
||||
}
|
||||
|
||||
if (merchant != null)
|
||||
{
|
||||
if (!buyList.isNpcAllowed(merchant.getId()))
|
||||
{
|
||||
sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
if (merchant instanceof L2MerchantInstance)
|
||||
{
|
||||
castleTaxRate = ((L2MerchantInstance) merchant).getMpc().getCastleTaxRate();
|
||||
baseTaxRate = ((L2MerchantInstance) merchant).getMpc().getBaseTaxRate();
|
||||
}
|
||||
else
|
||||
{
|
||||
baseTaxRate = 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
long subTotal = 0;
|
||||
|
||||
// Check for buylist validity and calculates summary values
|
||||
long slots = 0;
|
||||
long weight = 0;
|
||||
for (ItemHolder i : _items)
|
||||
{
|
||||
long price = -1;
|
||||
|
||||
final Product product = buyList.getProductByItemId(i.getId());
|
||||
if (product == null)
|
||||
{
|
||||
Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " sent a false BuyList list_id " + _listId + " and item_id " + i.getId(), Config.DEFAULT_PUNISH);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!product.getItem().isStackable() && (i.getCount() > 1))
|
||||
{
|
||||
Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " tried to purchase invalid quantity of items at the same time.", Config.DEFAULT_PUNISH);
|
||||
sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_EXCEEDED_THE_QUANTITY_THAT_CAN_BE_INPUTTED));
|
||||
return;
|
||||
}
|
||||
|
||||
price = product.getPrice();
|
||||
if ((product.getItemId() >= 3960) && (product.getItemId() <= 4026))
|
||||
{
|
||||
price *= Config.RATE_SIEGE_GUARDS_PRICE;
|
||||
}
|
||||
|
||||
if (price < 0)
|
||||
{
|
||||
_log.warning("ERROR, no price found .. wrong buylist ??");
|
||||
sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((price == 0) && !player.isGM() && Config.ONLY_GM_ITEMS_FREE)
|
||||
{
|
||||
player.sendMessage("Ohh Cheat dont work? You have a problem now!");
|
||||
Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " tried buy item for 0 adena.", Config.DEFAULT_PUNISH);
|
||||
return;
|
||||
}
|
||||
|
||||
// trying to buy more then available
|
||||
if (product.hasLimitedStock() && (i.getCount() > product.getCount()))
|
||||
{
|
||||
sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((MAX_ADENA / i.getCount()) < price)
|
||||
{
|
||||
Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " tried to purchase over " + MAX_ADENA + " adena worth of goods.", Config.DEFAULT_PUNISH);
|
||||
return;
|
||||
}
|
||||
// first calculate price per item with tax, then multiply by count
|
||||
price = (long) (price * (1 + castleTaxRate + baseTaxRate));
|
||||
subTotal += i.getCount() * price;
|
||||
if (subTotal > MAX_ADENA)
|
||||
{
|
||||
Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " tried to purchase over " + MAX_ADENA + " adena worth of goods.", Config.DEFAULT_PUNISH);
|
||||
return;
|
||||
}
|
||||
|
||||
weight += i.getCount() * product.getItem().getWeight();
|
||||
if (player.getInventory().getItemByItemId(product.getItemId()) == null)
|
||||
{
|
||||
slots++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!player.isGM() && ((weight > Integer.MAX_VALUE) || (weight < 0) || !player.getInventory().validateWeight((int) weight)))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_HAVE_EXCEEDED_THE_WEIGHT_LIMIT);
|
||||
sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!player.isGM() && ((slots > Integer.MAX_VALUE) || (slots < 0) || !player.getInventory().validateCapacity((int) slots)))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOUR_INVENTORY_IS_FULL);
|
||||
sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
// Charge buyer and add tax to castle treasury if not owned by npc clan
|
||||
if ((subTotal < 0) || !player.reduceAdena("Buy", subTotal, player.getLastFolkNPC(), false))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_ADENA);
|
||||
sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
// Proceed the purchase
|
||||
for (ItemHolder i : _items)
|
||||
{
|
||||
final Product product = buyList.getProductByItemId(i.getId());
|
||||
if (product == null)
|
||||
{
|
||||
Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " sent a false BuyList list_id " + _listId + " and item_id " + i.getId(), Config.DEFAULT_PUNISH);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (product.hasLimitedStock())
|
||||
{
|
||||
if (product.decreaseCount(i.getCount()))
|
||||
{
|
||||
player.getInventory().addItem("Buy", i.getId(), i.getCount(), player, merchant);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.getInventory().addItem("Buy", i.getId(), i.getCount(), player, merchant);
|
||||
}
|
||||
}
|
||||
|
||||
// add to castle treasury
|
||||
if (merchant instanceof L2MerchantInstance)
|
||||
{
|
||||
((L2MerchantInstance) merchant).getCastle().addToTreasury((long) (subTotal * castleTaxRate));
|
||||
}
|
||||
|
||||
player.sendPacket(new ExUserInfoInvenWeight(player));
|
||||
player.sendPacket(new ExBuySellList(player, true));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__40_REQUESTBUYITEM;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import static com.l2jmobius.gameserver.model.actor.L2Npc.INTERACTION_DISTANCE;
|
||||
import static com.l2jmobius.gameserver.model.itemcontainer.Inventory.MAX_ADENA;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.BuyListData;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2MerchantInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.buylist.L2BuyList;
|
||||
import com.l2jmobius.gameserver.model.buylist.Product;
|
||||
import com.l2jmobius.gameserver.model.holders.ItemHolder;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExBuySellList;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExUserInfoInvenWeight;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
public final class RequestBuyItem implements IClientIncomingPacket
|
||||
{
|
||||
private static final int BATCH_LENGTH = 12;
|
||||
private static final int CUSTOM_CB_SELL_LIST = 423;
|
||||
|
||||
private int _listId;
|
||||
private List<ItemHolder> _items = null;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_listId = packet.readD();
|
||||
final int size = packet.readD();
|
||||
if ((size <= 0) || (size > Config.MAX_ITEM_IN_PACKET) || ((size * BATCH_LENGTH) != packet.getReadableBytes()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
_items = new ArrayList<>(size);
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
final int itemId = packet.readD();
|
||||
final long count = packet.readQ();
|
||||
if ((itemId < 1) || (count < 1))
|
||||
{
|
||||
_items = null;
|
||||
return false;
|
||||
}
|
||||
_items.add(new ItemHolder(itemId, count));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final L2PcInstance player = client.getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!client.getFloodProtectors().getTransaction().tryPerformAction("buy"))
|
||||
{
|
||||
player.sendMessage("You are buying too fast.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (_items == null)
|
||||
{
|
||||
client.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
// Alt game - Karma punishment
|
||||
if (!Config.ALT_GAME_KARMA_PLAYER_CAN_SHOP && (player.getReputation() < 0))
|
||||
{
|
||||
client.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
final L2Object target = player.getTarget();
|
||||
L2Character merchant = null;
|
||||
if (!player.isGM() && (_listId != CUSTOM_CB_SELL_LIST))
|
||||
{
|
||||
if (!(target instanceof L2MerchantInstance) || (!player.isInsideRadius(target, INTERACTION_DISTANCE, true, false)) || (player.getInstanceWorld() != target.getInstanceWorld()))
|
||||
{
|
||||
client.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
merchant = (L2Character) target;
|
||||
}
|
||||
|
||||
double castleTaxRate = 0;
|
||||
double baseTaxRate = 0;
|
||||
|
||||
if ((merchant == null) && !player.isGM() && (_listId != CUSTOM_CB_SELL_LIST))
|
||||
{
|
||||
client.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
final L2BuyList buyList = BuyListData.getInstance().getBuyList(_listId);
|
||||
if (buyList == null)
|
||||
{
|
||||
Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " sent a false BuyList list_id " + _listId, Config.DEFAULT_PUNISH);
|
||||
return;
|
||||
}
|
||||
|
||||
if (merchant != null)
|
||||
{
|
||||
if (!buyList.isNpcAllowed(merchant.getId()))
|
||||
{
|
||||
client.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
if (merchant instanceof L2MerchantInstance)
|
||||
{
|
||||
castleTaxRate = ((L2MerchantInstance) merchant).getMpc().getCastleTaxRate();
|
||||
baseTaxRate = ((L2MerchantInstance) merchant).getMpc().getBaseTaxRate();
|
||||
}
|
||||
else
|
||||
{
|
||||
baseTaxRate = 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
long subTotal = 0;
|
||||
|
||||
// Check for buylist validity and calculates summary values
|
||||
long slots = 0;
|
||||
long weight = 0;
|
||||
for (ItemHolder i : _items)
|
||||
{
|
||||
long price = -1;
|
||||
|
||||
final Product product = buyList.getProductByItemId(i.getId());
|
||||
if (product == null)
|
||||
{
|
||||
Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " sent a false BuyList list_id " + _listId + " and item_id " + i.getId(), Config.DEFAULT_PUNISH);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!product.getItem().isStackable() && (i.getCount() > 1))
|
||||
{
|
||||
Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " tried to purchase invalid quantity of items at the same time.", Config.DEFAULT_PUNISH);
|
||||
client.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_EXCEEDED_THE_QUANTITY_THAT_CAN_BE_INPUTTED));
|
||||
return;
|
||||
}
|
||||
|
||||
price = product.getPrice();
|
||||
if ((product.getItemId() >= 3960) && (product.getItemId() <= 4026))
|
||||
{
|
||||
price *= Config.RATE_SIEGE_GUARDS_PRICE;
|
||||
}
|
||||
|
||||
if (price < 0)
|
||||
{
|
||||
_log.warning("ERROR, no price found .. wrong buylist ??");
|
||||
client.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((price == 0) && !player.isGM() && Config.ONLY_GM_ITEMS_FREE)
|
||||
{
|
||||
player.sendMessage("Ohh Cheat dont work? You have a problem now!");
|
||||
Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " tried buy item for 0 adena.", Config.DEFAULT_PUNISH);
|
||||
return;
|
||||
}
|
||||
|
||||
if (product.hasLimitedStock())
|
||||
{
|
||||
// trying to buy more then available
|
||||
if (i.getCount() > product.getCount())
|
||||
{
|
||||
client.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ((MAX_ADENA / i.getCount()) < price)
|
||||
{
|
||||
Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " tried to purchase over " + MAX_ADENA + " adena worth of goods.", Config.DEFAULT_PUNISH);
|
||||
return;
|
||||
}
|
||||
// first calculate price per item with tax, then multiply by count
|
||||
price = (long) (price * (1 + castleTaxRate + baseTaxRate));
|
||||
subTotal += i.getCount() * price;
|
||||
if (subTotal > MAX_ADENA)
|
||||
{
|
||||
Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " tried to purchase over " + MAX_ADENA + " adena worth of goods.", Config.DEFAULT_PUNISH);
|
||||
return;
|
||||
}
|
||||
|
||||
weight += i.getCount() * product.getItem().getWeight();
|
||||
if (player.getInventory().getItemByItemId(product.getItemId()) == null)
|
||||
{
|
||||
slots++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!player.isGM() && ((weight > Integer.MAX_VALUE) || (weight < 0) || !player.getInventory().validateWeight((int) weight)))
|
||||
{
|
||||
client.sendPacket(SystemMessageId.YOU_HAVE_EXCEEDED_THE_WEIGHT_LIMIT);
|
||||
client.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!player.isGM() && ((slots > Integer.MAX_VALUE) || (slots < 0) || !player.getInventory().validateCapacity((int) slots)))
|
||||
{
|
||||
client.sendPacket(SystemMessageId.YOUR_INVENTORY_IS_FULL);
|
||||
client.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
// Charge buyer and add tax to castle treasury if not owned by npc clan
|
||||
if ((subTotal < 0) || !player.reduceAdena("Buy", subTotal, player.getLastFolkNPC(), false))
|
||||
{
|
||||
client.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_ADENA);
|
||||
client.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
// Proceed the purchase
|
||||
for (ItemHolder i : _items)
|
||||
{
|
||||
final Product product = buyList.getProductByItemId(i.getId());
|
||||
if (product == null)
|
||||
{
|
||||
Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " sent a false BuyList list_id " + _listId + " and item_id " + i.getId(), Config.DEFAULT_PUNISH);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (product.hasLimitedStock())
|
||||
{
|
||||
if (product.decreaseCount(i.getCount()))
|
||||
{
|
||||
player.getInventory().addItem("Buy", i.getId(), i.getCount(), player, merchant);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.getInventory().addItem("Buy", i.getId(), i.getCount(), player, merchant);
|
||||
}
|
||||
}
|
||||
|
||||
// add to castle treasury
|
||||
if (merchant instanceof L2MerchantInstance)
|
||||
{
|
||||
((L2MerchantInstance) merchant).getCastle().addToTreasury((long) (subTotal * castleTaxRate));
|
||||
}
|
||||
|
||||
client.sendPacket(new ExUserInfoInvenWeight(player));
|
||||
client.sendPacket(new ExBuySellList(player, true));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,208 +1,206 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import static com.l2jmobius.gameserver.model.itemcontainer.Inventory.MAX_ADENA;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.datatables.ItemTable;
|
||||
import com.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||
import com.l2jmobius.gameserver.instancemanager.CastleManorManager;
|
||||
import com.l2jmobius.gameserver.model.SeedProduction;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2MerchantInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.entity.Castle;
|
||||
import com.l2jmobius.gameserver.model.holders.ItemHolder;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* @author l3x
|
||||
*/
|
||||
public class RequestBuySeed extends L2GameClientPacket
|
||||
{
|
||||
private static final int BATCH_LENGTH = 12; // length of the one item
|
||||
private int _manorId;
|
||||
private List<ItemHolder> _items = null;
|
||||
|
||||
@Override
|
||||
protected final void readImpl()
|
||||
{
|
||||
_manorId = readD();
|
||||
final int count = readD();
|
||||
if ((count <= 0) || (count > Config.MAX_ITEM_IN_PACKET) || ((count * BATCH_LENGTH) != _buf.remaining()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_items = new ArrayList<>(count);
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
final int itemId = readD();
|
||||
final long cnt = readQ();
|
||||
if ((cnt < 1) || (itemId < 1))
|
||||
{
|
||||
_items = null;
|
||||
return;
|
||||
}
|
||||
_items.add(new ItemHolder(itemId, cnt));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void runImpl()
|
||||
{
|
||||
final L2PcInstance player = getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if (!getClient().getFloodProtectors().getManor().tryPerformAction("BuySeed"))
|
||||
{
|
||||
player.sendMessage("You are buying seeds too fast!");
|
||||
return;
|
||||
}
|
||||
else if (_items == null)
|
||||
{
|
||||
sendActionFailed();
|
||||
return;
|
||||
}
|
||||
|
||||
final CastleManorManager manor = CastleManorManager.getInstance();
|
||||
if (manor.isUnderMaintenance())
|
||||
{
|
||||
sendActionFailed();
|
||||
return;
|
||||
}
|
||||
|
||||
final Castle castle = CastleManager.getInstance().getCastleById(_manorId);
|
||||
if (castle == null)
|
||||
{
|
||||
sendActionFailed();
|
||||
return;
|
||||
}
|
||||
|
||||
final L2Npc manager = player.getLastFolkNPC();
|
||||
if (!(manager instanceof L2MerchantInstance) || !manager.canInteract(player) || (manager.getTemplate().getParameters().getInt("manor_id", -1) != _manorId))
|
||||
{
|
||||
sendActionFailed();
|
||||
return;
|
||||
}
|
||||
|
||||
long totalPrice = 0;
|
||||
int slots = 0;
|
||||
int totalWeight = 0;
|
||||
|
||||
final Map<Integer, SeedProduction> _productInfo = new HashMap<>();
|
||||
for (ItemHolder ih : _items)
|
||||
{
|
||||
final SeedProduction sp = manor.getSeedProduct(_manorId, ih.getId(), false);
|
||||
if ((sp == null) || (sp.getPrice() <= 0) || (sp.getAmount() < ih.getCount()) || ((MAX_ADENA / ih.getCount()) < sp.getPrice()))
|
||||
{
|
||||
sendActionFailed();
|
||||
return;
|
||||
}
|
||||
|
||||
// Calculate price
|
||||
totalPrice += sp.getPrice() * ih.getCount();
|
||||
if (totalPrice > MAX_ADENA)
|
||||
{
|
||||
Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " tried to purchase over " + MAX_ADENA + " adena worth of goods.", Config.DEFAULT_PUNISH);
|
||||
sendActionFailed();
|
||||
return;
|
||||
}
|
||||
|
||||
// Calculate weight
|
||||
final L2Item template = ItemTable.getInstance().getTemplate(ih.getId());
|
||||
totalWeight += ih.getCount() * template.getWeight();
|
||||
|
||||
// Calculate slots
|
||||
if (!template.isStackable())
|
||||
{
|
||||
slots += ih.getCount();
|
||||
}
|
||||
else if (player.getInventory().getItemByItemId(ih.getId()) == null)
|
||||
{
|
||||
slots++;
|
||||
}
|
||||
_productInfo.put(ih.getId(), sp);
|
||||
}
|
||||
|
||||
if (!player.getInventory().validateWeight(totalWeight))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_HAVE_EXCEEDED_THE_WEIGHT_LIMIT);
|
||||
return;
|
||||
}
|
||||
else if (!player.getInventory().validateCapacity(slots))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOUR_INVENTORY_IS_FULL);
|
||||
return;
|
||||
}
|
||||
else if ((totalPrice < 0) || (player.getAdena() < totalPrice))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_ADENA);
|
||||
return;
|
||||
}
|
||||
|
||||
// Proceed the purchase
|
||||
for (ItemHolder i : _items)
|
||||
{
|
||||
final SeedProduction sp = _productInfo.get(i.getId());
|
||||
final long price = sp.getPrice() * i.getCount();
|
||||
|
||||
// Take Adena and decrease seed amount
|
||||
if (!sp.decreaseAmount(i.getCount()) || !player.reduceAdena("Buy", price, player, false))
|
||||
{
|
||||
// failed buy, reduce total price
|
||||
totalPrice -= price;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Add item to player's inventory
|
||||
player.addItem("Buy", i.getId(), i.getCount(), manager, true);
|
||||
}
|
||||
|
||||
// Adding to treasury for Manor Castle
|
||||
if (totalPrice > 0)
|
||||
{
|
||||
castle.addToTreasuryNoTax(totalPrice);
|
||||
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_ADENA_DISAPPEARED);
|
||||
sm.addLong(totalPrice);
|
||||
player.sendPacket(sm);
|
||||
|
||||
if (Config.ALT_MANOR_SAVE_ALL_ACTIONS)
|
||||
{
|
||||
manor.updateCurrentProduction(_manorId, _productInfo.values());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return "[C] C5 RequestBuySeed";
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import static com.l2jmobius.gameserver.model.itemcontainer.Inventory.MAX_ADENA;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.datatables.ItemTable;
|
||||
import com.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||
import com.l2jmobius.gameserver.instancemanager.CastleManorManager;
|
||||
import com.l2jmobius.gameserver.model.SeedProduction;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2MerchantInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.entity.Castle;
|
||||
import com.l2jmobius.gameserver.model.holders.ItemHolder;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* @author l3x
|
||||
*/
|
||||
public class RequestBuySeed implements IClientIncomingPacket
|
||||
{
|
||||
private static final int BATCH_LENGTH = 12; // length of the one item
|
||||
private int _manorId;
|
||||
private List<ItemHolder> _items = null;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_manorId = packet.readD();
|
||||
final int count = packet.readD();
|
||||
if ((count <= 0) || (count > Config.MAX_ITEM_IN_PACKET) || ((count * BATCH_LENGTH) != packet.getReadableBytes()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
_items = new ArrayList<>(count);
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
final int itemId = packet.readD();
|
||||
final long cnt = packet.readQ();
|
||||
if ((cnt < 1) || (itemId < 1))
|
||||
{
|
||||
_items = null;
|
||||
return false;
|
||||
}
|
||||
_items.add(new ItemHolder(itemId, cnt));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final L2PcInstance player = client.getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if (!client.getFloodProtectors().getManor().tryPerformAction("BuySeed"))
|
||||
{
|
||||
player.sendMessage("You are buying seeds too fast!");
|
||||
return;
|
||||
}
|
||||
else if (_items == null)
|
||||
{
|
||||
client.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
final CastleManorManager manor = CastleManorManager.getInstance();
|
||||
if (manor.isUnderMaintenance())
|
||||
{
|
||||
client.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
final Castle castle = CastleManager.getInstance().getCastleById(_manorId);
|
||||
if (castle == null)
|
||||
{
|
||||
client.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
final L2Npc manager = player.getLastFolkNPC();
|
||||
if (!(manager instanceof L2MerchantInstance) || !manager.canInteract(player) || (manager.getParameters().getInt("manor_id", -1) != _manorId))
|
||||
{
|
||||
client.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
long totalPrice = 0;
|
||||
int slots = 0;
|
||||
int totalWeight = 0;
|
||||
|
||||
final Map<Integer, SeedProduction> _productInfo = new HashMap<>();
|
||||
for (ItemHolder ih : _items)
|
||||
{
|
||||
final SeedProduction sp = manor.getSeedProduct(_manorId, ih.getId(), false);
|
||||
if ((sp == null) || (sp.getPrice() <= 0) || (sp.getAmount() < ih.getCount()) || ((MAX_ADENA / ih.getCount()) < sp.getPrice()))
|
||||
{
|
||||
client.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
// Calculate price
|
||||
totalPrice += (sp.getPrice() * ih.getCount());
|
||||
if (totalPrice > MAX_ADENA)
|
||||
{
|
||||
Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " tried to purchase over " + MAX_ADENA + " adena worth of goods.", Config.DEFAULT_PUNISH);
|
||||
client.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
// Calculate weight
|
||||
final L2Item template = ItemTable.getInstance().getTemplate(ih.getId());
|
||||
totalWeight += ih.getCount() * template.getWeight();
|
||||
|
||||
// Calculate slots
|
||||
if (!template.isStackable())
|
||||
{
|
||||
slots += ih.getCount();
|
||||
}
|
||||
else if (player.getInventory().getItemByItemId(ih.getId()) == null)
|
||||
{
|
||||
slots++;
|
||||
}
|
||||
_productInfo.put(ih.getId(), sp);
|
||||
}
|
||||
|
||||
if (!player.getInventory().validateWeight(totalWeight))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_HAVE_EXCEEDED_THE_WEIGHT_LIMIT);
|
||||
return;
|
||||
}
|
||||
else if (!player.getInventory().validateCapacity(slots))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOUR_INVENTORY_IS_FULL);
|
||||
return;
|
||||
}
|
||||
else if ((totalPrice < 0) || (player.getAdena() < totalPrice))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_ADENA);
|
||||
return;
|
||||
}
|
||||
|
||||
// Proceed the purchase
|
||||
for (ItemHolder i : _items)
|
||||
{
|
||||
final SeedProduction sp = _productInfo.get(i.getId());
|
||||
final long price = sp.getPrice() * i.getCount();
|
||||
|
||||
// Take Adena and decrease seed amount
|
||||
if (!sp.decreaseAmount(i.getCount()) || !player.reduceAdena("Buy", price, player, false))
|
||||
{
|
||||
// failed buy, reduce total price
|
||||
totalPrice -= price;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Add item to player's inventory
|
||||
player.addItem("Buy", i.getId(), i.getCount(), manager, true);
|
||||
}
|
||||
|
||||
// Adding to treasury for Manor Castle
|
||||
if (totalPrice > 0)
|
||||
{
|
||||
castle.addToTreasuryNoTax(totalPrice);
|
||||
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_ADENA_DISAPPEARED);
|
||||
sm.addLong(totalPrice);
|
||||
player.sendPacket(sm);
|
||||
|
||||
if (Config.ALT_MANOR_SAVE_ALL_ACTIONS)
|
||||
{
|
||||
manor.updateCurrentProduction(_manorId, _productInfo.values());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+41
-48
@@ -1,49 +1,42 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ItemList;
|
||||
|
||||
public class RequestBuySellUIClose extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_76_REQUESTBUYSELLUICLOSE = "[C] D0:76 RequestBuySellUIClose";
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
// trigger
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if ((activeChar == null) || activeChar.isInventoryDisabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
activeChar.sendPacket(new ItemList(activeChar, true));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_76_REQUESTBUYSELLUICLOSE;
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
|
||||
public class RequestBuySellUIClose 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) || activeChar.isInventoryDisabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
activeChar.sendItemList(true);
|
||||
}
|
||||
}
|
||||
+324
-375
@@ -1,375 +1,324 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.AdminData;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.MultisellData;
|
||||
import com.l2jmobius.gameserver.enums.InstanceType;
|
||||
import com.l2jmobius.gameserver.enums.PlayerAction;
|
||||
import com.l2jmobius.gameserver.handler.AdminCommandHandler;
|
||||
import com.l2jmobius.gameserver.handler.BypassHandler;
|
||||
import com.l2jmobius.gameserver.handler.CommunityBoardHandler;
|
||||
import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
|
||||
import com.l2jmobius.gameserver.handler.IBypassHandler;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.entity.Hero;
|
||||
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcManorBypass;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcMenuSelect;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerBypass;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ConfirmDlg;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
import com.l2jmobius.gameserver.util.GMAudit;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* RequestBypassToServer client packet implementation.
|
||||
* @author HorridoJoho
|
||||
*/
|
||||
public final class RequestBypassToServer extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__23_REQUESTBYPASSTOSERVER = "[C] 23 RequestBypassToServer";
|
||||
// FIXME: This is for compatibility, will be changed when bypass functionality got an overhaul by NosBit
|
||||
private static final String[] _possibleNonHtmlCommands =
|
||||
{
|
||||
"_bbs",
|
||||
"bbs",
|
||||
"_mail",
|
||||
"_friend",
|
||||
"_match",
|
||||
"_diary",
|
||||
"_olympiad?command",
|
||||
"menu_select",
|
||||
"manor_menu_select",
|
||||
"pccafe"
|
||||
};
|
||||
|
||||
// S
|
||||
private String _command;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_command = readS();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_command.isEmpty())
|
||||
{
|
||||
_log.warning("Player " + activeChar.getName() + " sent empty bypass!");
|
||||
activeChar.logout();
|
||||
return;
|
||||
}
|
||||
|
||||
boolean requiresBypassValidation = true;
|
||||
for (String possibleNonHtmlCommand : _possibleNonHtmlCommands)
|
||||
{
|
||||
if (_command.startsWith(possibleNonHtmlCommand))
|
||||
{
|
||||
requiresBypassValidation = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int bypassOriginId = 0;
|
||||
if (requiresBypassValidation)
|
||||
{
|
||||
bypassOriginId = activeChar.validateHtmlAction(_command);
|
||||
if (bypassOriginId == -1)
|
||||
{
|
||||
_log.warning("Player " + activeChar.getName() + " sent non cached bypass: '" + _command + "'");
|
||||
return;
|
||||
}
|
||||
|
||||
if ((bypassOriginId > 0) && !Util.isInsideRangeOfObjectId(activeChar, bypassOriginId, L2Npc.INTERACTION_DISTANCE))
|
||||
{
|
||||
// No logging here, this could be a common case where the player has the html still open and run too far away and then clicks a html action
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!getClient().getFloodProtectors().getServerBypass().tryPerformAction(_command))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (_command.startsWith("admin_"))
|
||||
{
|
||||
final String command = _command.split(" ")[0];
|
||||
|
||||
final IAdminCommandHandler ach = AdminCommandHandler.getInstance().getHandler(command);
|
||||
|
||||
if (ach == null)
|
||||
{
|
||||
if (activeChar.isGM())
|
||||
{
|
||||
activeChar.sendMessage("The command " + command.substring(6) + " does not exist!");
|
||||
}
|
||||
_log.warning(activeChar + " requested not registered admin command '" + command + "'");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!AdminData.getInstance().hasAccess(command, activeChar.getAccessLevel()))
|
||||
{
|
||||
activeChar.sendMessage("You don't have the access rights to use this command!");
|
||||
_log.warning("Character " + activeChar.getName() + " tried to use admin command " + command + ", without proper access level!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (AdminData.getInstance().requireConfirm(command))
|
||||
{
|
||||
activeChar.setAdminConfirmCmd(_command);
|
||||
final ConfirmDlg dlg = new ConfirmDlg(SystemMessageId.S13);
|
||||
dlg.addString("Are you sure you want execute command " + _command.substring(6) + " ?");
|
||||
activeChar.addAction(PlayerAction.ADMIN_COMMAND);
|
||||
activeChar.sendPacket(dlg);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Config.GMAUDIT)
|
||||
{
|
||||
GMAudit.auditGMAction(activeChar.getName() + " [" + activeChar.getObjectId() + "]", _command, activeChar.getTarget() != null ? activeChar.getTarget().getName() : "no-target");
|
||||
}
|
||||
|
||||
ach.useAdminCommand(_command, activeChar);
|
||||
}
|
||||
}
|
||||
else if (CommunityBoardHandler.getInstance().isCommunityBoardCommand(_command))
|
||||
{
|
||||
CommunityBoardHandler.getInstance().handleParseCommand(_command, activeChar);
|
||||
}
|
||||
else if (_command.equals("come_here") && activeChar.isGM())
|
||||
{
|
||||
comeHere(activeChar);
|
||||
}
|
||||
else if (_command.startsWith("npc_"))
|
||||
{
|
||||
final int endOfId = _command.indexOf('_', 5);
|
||||
String id;
|
||||
if (endOfId > 0)
|
||||
{
|
||||
id = _command.substring(4, endOfId);
|
||||
}
|
||||
else
|
||||
{
|
||||
id = _command.substring(4);
|
||||
}
|
||||
if (Util.isDigit(id))
|
||||
{
|
||||
final L2Object object = L2World.getInstance().findObject(Integer.parseInt(id));
|
||||
|
||||
if ((object != null) && object.isNpc() && (endOfId > 0) && activeChar.isInsideRadius(object, L2Npc.INTERACTION_DISTANCE, false, false))
|
||||
{
|
||||
((L2Npc) object).onBypassFeedback(activeChar, _command.substring(endOfId + 1));
|
||||
}
|
||||
}
|
||||
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
}
|
||||
else if (_command.startsWith("item_"))
|
||||
{
|
||||
final int endOfId = _command.indexOf('_', 5);
|
||||
String id;
|
||||
if (endOfId > 0)
|
||||
{
|
||||
id = _command.substring(5, endOfId);
|
||||
}
|
||||
else
|
||||
{
|
||||
id = _command.substring(5);
|
||||
}
|
||||
try
|
||||
{
|
||||
final L2ItemInstance item = activeChar.getInventory().getItemByObjectId(Integer.parseInt(id));
|
||||
if ((item != null) && (endOfId > 0))
|
||||
{
|
||||
item.onBypassFeedback(activeChar, _command.substring(endOfId + 1));
|
||||
}
|
||||
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
_log.log(Level.WARNING, "NFE for command [" + _command + "]", nfe);
|
||||
}
|
||||
}
|
||||
else if (_command.startsWith("_match"))
|
||||
{
|
||||
final String params = _command.substring(_command.indexOf("?") + 1);
|
||||
final StringTokenizer st = new StringTokenizer(params, "&");
|
||||
final int heroclass = Integer.parseInt(st.nextToken().split("=")[1]);
|
||||
final int heropage = Integer.parseInt(st.nextToken().split("=")[1]);
|
||||
final int heroid = Hero.getInstance().getHeroByClass(heroclass);
|
||||
if (heroid > 0)
|
||||
{
|
||||
Hero.getInstance().showHeroFights(activeChar, heroclass, heroid, heropage);
|
||||
}
|
||||
}
|
||||
else if (_command.startsWith("_diary"))
|
||||
{
|
||||
final String params = _command.substring(_command.indexOf("?") + 1);
|
||||
final StringTokenizer st = new StringTokenizer(params, "&");
|
||||
final int heroclass = Integer.parseInt(st.nextToken().split("=")[1]);
|
||||
final int heropage = Integer.parseInt(st.nextToken().split("=")[1]);
|
||||
final int heroid = Hero.getInstance().getHeroByClass(heroclass);
|
||||
if (heroid > 0)
|
||||
{
|
||||
Hero.getInstance().showHeroDiary(activeChar, heroclass, heroid, heropage);
|
||||
}
|
||||
}
|
||||
else if (_command.startsWith("_olympiad?command"))
|
||||
{
|
||||
final int arenaId = Integer.parseInt(_command.split("=")[2]);
|
||||
final IBypassHandler handler = BypassHandler.getInstance().getHandler("arenachange");
|
||||
if (handler != null)
|
||||
{
|
||||
handler.useBypass("arenachange " + (arenaId - 1), activeChar, null);
|
||||
}
|
||||
}
|
||||
else if (_command.startsWith("menu_select"))
|
||||
{
|
||||
final L2Npc lastNpc = activeChar.getLastFolkNPC();
|
||||
if ((lastNpc != null) && lastNpc.canInteract(activeChar))
|
||||
{
|
||||
final String[] split = _command.substring(_command.indexOf("?") + 1).split("&");
|
||||
final int ask = Integer.parseInt(split[0].split("=")[1]);
|
||||
final int reply = Integer.parseInt(split[1].split("=")[1]);
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnNpcMenuSelect(activeChar, lastNpc, ask, reply), lastNpc);
|
||||
}
|
||||
}
|
||||
else if (_command.startsWith("manor_menu_select"))
|
||||
{
|
||||
final L2Npc lastNpc = activeChar.getLastFolkNPC();
|
||||
if (Config.ALLOW_MANOR && (lastNpc != null) && lastNpc.canInteract(activeChar))
|
||||
{
|
||||
final String[] split = _command.substring(_command.indexOf("?") + 1).split("&");
|
||||
final int ask = Integer.parseInt(split[0].split("=")[1]);
|
||||
final int state = Integer.parseInt(split[1].split("=")[1]);
|
||||
final boolean time = split[2].split("=")[1].equals("1");
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnNpcManorBypass(activeChar, lastNpc, ask, state, time), lastNpc);
|
||||
}
|
||||
}
|
||||
else if (_command.startsWith("pccafe"))
|
||||
{
|
||||
final L2PcInstance player = getClient().getActiveChar();
|
||||
if ((player == null) || !Config.PC_BANG_ENABLED)
|
||||
{
|
||||
return;
|
||||
}
|
||||
final int multisellId = Integer.parseInt(_command.substring(10).trim());
|
||||
MultisellData.getInstance().separateAndSend(multisellId, activeChar, null, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
final IBypassHandler handler = BypassHandler.getInstance().getHandler(_command);
|
||||
if (handler != null)
|
||||
{
|
||||
if (bypassOriginId > 0)
|
||||
{
|
||||
final L2Object bypassOrigin = activeChar.getKnownList().getKnownObjects().get(bypassOriginId);
|
||||
if ((bypassOrigin != null) && bypassOrigin.isInstanceTypes(InstanceType.L2Character))
|
||||
{
|
||||
handler.useBypass(_command, activeChar, (L2Character) bypassOrigin);
|
||||
}
|
||||
else
|
||||
{
|
||||
handler.useBypass(_command, activeChar, null);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
handler.useBypass(_command, activeChar, null);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.warning(getClient() + " sent not handled RequestBypassToServer: [" + _command + "]");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.WARNING, "Exception processing bypass from player " + activeChar.getName() + ": " + _command, e);
|
||||
|
||||
if (activeChar.isGM())
|
||||
{
|
||||
final StringBuilder sb = new StringBuilder(200);
|
||||
sb.append("<html><body>");
|
||||
sb.append("Bypass error: " + e + "<br1>");
|
||||
sb.append("Bypass command: " + _command + "<br1>");
|
||||
sb.append("StackTrace:<br1>");
|
||||
for (StackTraceElement ste : e.getStackTrace())
|
||||
{
|
||||
sb.append(ste.toString() + "<br1>");
|
||||
}
|
||||
sb.append("</body></html>");
|
||||
// item html
|
||||
final NpcHtmlMessage msg = new NpcHtmlMessage(0, 1, sb.toString());
|
||||
msg.disableValidation();
|
||||
activeChar.sendPacket(msg);
|
||||
}
|
||||
}
|
||||
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerBypass(activeChar, _command), activeChar);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param activeChar
|
||||
*/
|
||||
private static void comeHere(L2PcInstance activeChar)
|
||||
{
|
||||
final L2Object obj = activeChar.getTarget();
|
||||
if (obj == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (obj instanceof L2Npc)
|
||||
{
|
||||
final L2Npc temp = (L2Npc) obj;
|
||||
temp.setTarget(activeChar);
|
||||
temp.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, activeChar.getLocation());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__23_REQUESTBYPASSTOSERVER;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import com.l2jmobius.gameserver.handler.BypassHandler;
|
||||
import com.l2jmobius.gameserver.handler.CommunityBoardHandler;
|
||||
import com.l2jmobius.gameserver.handler.IBypassHandler;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.entity.Hero;
|
||||
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcManorBypass;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.npc.OnNpcMenuSelect;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerBypass;
|
||||
import com.l2jmobius.gameserver.model.events.returns.TerminateReturn;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* RequestBypassToServer client packet implementation.
|
||||
* @author HorridoJoho
|
||||
*/
|
||||
public final class RequestBypassToServer implements IClientIncomingPacket
|
||||
{
|
||||
// FIXME: This is for compatibility, will be changed when bypass functionality got an overhaul by NosBit
|
||||
private static final String[] _possibleNonHtmlCommands =
|
||||
{
|
||||
"_bbs",
|
||||
"bbs",
|
||||
"_mail",
|
||||
"_friend",
|
||||
"_match",
|
||||
"_diary",
|
||||
"_olympiad?command",
|
||||
"menu_select",
|
||||
"manor_menu_select"
|
||||
};
|
||||
|
||||
// S
|
||||
private String _command;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_command = packet.readS();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final L2PcInstance activeChar = client.getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_command.isEmpty())
|
||||
{
|
||||
_log.warning("Player " + activeChar.getName() + " sent empty bypass!");
|
||||
activeChar.logout();
|
||||
return;
|
||||
}
|
||||
|
||||
boolean requiresBypassValidation = true;
|
||||
for (String possibleNonHtmlCommand : _possibleNonHtmlCommands)
|
||||
{
|
||||
if (_command.startsWith(possibleNonHtmlCommand))
|
||||
{
|
||||
requiresBypassValidation = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int bypassOriginId = 0;
|
||||
if (requiresBypassValidation)
|
||||
{
|
||||
bypassOriginId = activeChar.validateHtmlAction(_command);
|
||||
if (bypassOriginId == -1)
|
||||
{
|
||||
_log.warning("Player " + activeChar.getName() + " sent non cached bypass: '" + _command + "'");
|
||||
return;
|
||||
}
|
||||
|
||||
if ((bypassOriginId > 0) && !Util.isInsideRangeOfObjectId(activeChar, bypassOriginId, L2Npc.INTERACTION_DISTANCE))
|
||||
{
|
||||
// No logging here, this could be a common case where the player has the html still open and run too far away and then clicks a html action
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!client.getFloodProtectors().getServerBypass().tryPerformAction(_command))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final TerminateReturn terminateReturn = EventDispatcher.getInstance().notifyEvent(new OnPlayerBypass(activeChar, _command), activeChar, TerminateReturn.class);
|
||||
if ((terminateReturn != null) && terminateReturn.terminate())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (_command.startsWith("admin_"))
|
||||
{
|
||||
activeChar.useAdminCommand(_command);
|
||||
}
|
||||
else if (CommunityBoardHandler.getInstance().isCommunityBoardCommand(_command))
|
||||
{
|
||||
CommunityBoardHandler.getInstance().handleParseCommand(_command, activeChar);
|
||||
}
|
||||
else if (_command.equals("come_here") && activeChar.isGM())
|
||||
{
|
||||
comeHere(activeChar);
|
||||
}
|
||||
else if (_command.startsWith("npc_"))
|
||||
{
|
||||
final int endOfId = _command.indexOf('_', 5);
|
||||
String id;
|
||||
if (endOfId > 0)
|
||||
{
|
||||
id = _command.substring(4, endOfId);
|
||||
}
|
||||
else
|
||||
{
|
||||
id = _command.substring(4);
|
||||
}
|
||||
|
||||
if (Util.isDigit(id))
|
||||
{
|
||||
final L2Object object = L2World.getInstance().findObject(Integer.parseInt(id));
|
||||
|
||||
if ((object != null) && object.isNpc() && (endOfId > 0) && activeChar.isInsideRadius(object, L2Npc.INTERACTION_DISTANCE, false, false))
|
||||
{
|
||||
((L2Npc) object).onBypassFeedback(activeChar, _command.substring(endOfId + 1));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.sendDebugMessage("ObjectId of npc bypass is not digit: " + id);
|
||||
}
|
||||
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
}
|
||||
else if (_command.startsWith("item_"))
|
||||
{
|
||||
final int endOfId = _command.indexOf('_', 5);
|
||||
String id;
|
||||
if (endOfId > 0)
|
||||
{
|
||||
id = _command.substring(5, endOfId);
|
||||
}
|
||||
else
|
||||
{
|
||||
id = _command.substring(5);
|
||||
}
|
||||
try
|
||||
{
|
||||
final L2ItemInstance item = activeChar.getInventory().getItemByObjectId(Integer.parseInt(id));
|
||||
if ((item != null) && (endOfId > 0))
|
||||
{
|
||||
item.onBypassFeedback(activeChar, _command.substring(endOfId + 1));
|
||||
}
|
||||
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
_log.log(Level.WARNING, "NFE for command [" + _command + "]", nfe);
|
||||
}
|
||||
}
|
||||
else if (_command.startsWith("_match"))
|
||||
{
|
||||
final String params = _command.substring(_command.indexOf("?") + 1);
|
||||
final StringTokenizer st = new StringTokenizer(params, "&");
|
||||
final int heroclass = Integer.parseInt(st.nextToken().split("=")[1]);
|
||||
final int heropage = Integer.parseInt(st.nextToken().split("=")[1]);
|
||||
final int heroid = Hero.getInstance().getHeroByClass(heroclass);
|
||||
if (heroid > 0)
|
||||
{
|
||||
Hero.getInstance().showHeroFights(activeChar, heroclass, heroid, heropage);
|
||||
}
|
||||
}
|
||||
else if (_command.startsWith("_diary"))
|
||||
{
|
||||
final String params = _command.substring(_command.indexOf("?") + 1);
|
||||
final StringTokenizer st = new StringTokenizer(params, "&");
|
||||
final int heroclass = Integer.parseInt(st.nextToken().split("=")[1]);
|
||||
final int heropage = Integer.parseInt(st.nextToken().split("=")[1]);
|
||||
final int heroid = Hero.getInstance().getHeroByClass(heroclass);
|
||||
if (heroid > 0)
|
||||
{
|
||||
Hero.getInstance().showHeroDiary(activeChar, heroclass, heroid, heropage);
|
||||
}
|
||||
}
|
||||
else if (_command.startsWith("_olympiad?command"))
|
||||
{
|
||||
final int arenaId = Integer.parseInt(_command.split("=")[2]);
|
||||
final IBypassHandler handler = BypassHandler.getInstance().getHandler("arenachange");
|
||||
if (handler != null)
|
||||
{
|
||||
handler.useBypass("arenachange " + (arenaId - 1), activeChar, null);
|
||||
}
|
||||
}
|
||||
else if (_command.startsWith("menu_select"))
|
||||
{
|
||||
final L2Npc lastNpc = activeChar.getLastFolkNPC();
|
||||
if ((lastNpc != null) && lastNpc.canInteract(activeChar))
|
||||
{
|
||||
final String[] split = _command.substring(_command.indexOf("?") + 1).split("&");
|
||||
final int ask = Integer.parseInt(split[0].split("=")[1]);
|
||||
final int reply = Integer.parseInt(split[1].split("=")[1]);
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnNpcMenuSelect(activeChar, lastNpc, ask, reply), lastNpc);
|
||||
}
|
||||
}
|
||||
else if (_command.startsWith("manor_menu_select"))
|
||||
{
|
||||
final L2Npc lastNpc = activeChar.getLastFolkNPC();
|
||||
if (Config.ALLOW_MANOR && (lastNpc != null) && lastNpc.canInteract(activeChar))
|
||||
{
|
||||
final String[] split = _command.substring(_command.indexOf("?") + 1).split("&");
|
||||
final int ask = Integer.parseInt(split[0].split("=")[1]);
|
||||
final int state = Integer.parseInt(split[1].split("=")[1]);
|
||||
final boolean time = split[2].split("=")[1].equals("1");
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnNpcManorBypass(activeChar, lastNpc, ask, state, time), lastNpc);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
final IBypassHandler handler = BypassHandler.getInstance().getHandler(_command);
|
||||
if (handler != null)
|
||||
{
|
||||
if (bypassOriginId > 0)
|
||||
{
|
||||
final L2Object bypassOrigin = L2World.getInstance().findObject(bypassOriginId);
|
||||
if ((bypassOrigin != null) && bypassOrigin.isCharacter())
|
||||
{
|
||||
handler.useBypass(_command, activeChar, (L2Character) bypassOrigin);
|
||||
}
|
||||
else
|
||||
{
|
||||
handler.useBypass(_command, activeChar, null);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
handler.useBypass(_command, activeChar, null);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.warning(client + " sent not handled RequestBypassToServer: [" + _command + "]");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.WARNING, "Exception processing bypass from player " + activeChar.getName() + ": " + _command, e);
|
||||
|
||||
if (activeChar.isGM())
|
||||
{
|
||||
final StringBuilder sb = new StringBuilder(200);
|
||||
sb.append("<html><body>");
|
||||
sb.append("Bypass error: " + e + "<br1>");
|
||||
sb.append("Bypass command: " + _command + "<br1>");
|
||||
sb.append("StackTrace:<br1>");
|
||||
for (StackTraceElement ste : e.getStackTrace())
|
||||
{
|
||||
sb.append(ste.toString() + "<br1>");
|
||||
}
|
||||
sb.append("</body></html>");
|
||||
// item html
|
||||
final NpcHtmlMessage msg = new NpcHtmlMessage(0, 1, sb.toString());
|
||||
msg.disableValidation();
|
||||
activeChar.sendPacket(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param activeChar
|
||||
*/
|
||||
private static void comeHere(L2PcInstance activeChar)
|
||||
{
|
||||
final L2Object obj = activeChar.getTarget();
|
||||
if (obj == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (obj.isNpc())
|
||||
{
|
||||
final L2Npc temp = (L2Npc) obj;
|
||||
temp.setTarget(activeChar);
|
||||
temp.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, activeChar.getLocation());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+223
-239
@@ -1,239 +1,223 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.enums.ItemLocation;
|
||||
import com.l2jmobius.gameserver.enums.PrivateStoreType;
|
||||
import com.l2jmobius.gameserver.instancemanager.MailManager;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.entity.Message;
|
||||
import com.l2jmobius.gameserver.model.itemcontainer.ItemContainer;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExChangePostState;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExUserInfoInvenWeight;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.InventoryUpdate;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ItemList;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* @author Migi, DS
|
||||
*/
|
||||
public final class RequestCancelPostAttachment extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_6F_REQUESTCANCELPOSTATTACHMENT = "[C] D0:6F RequestCancelPostAttachment";
|
||||
|
||||
private int _msgId;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_msgId = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if ((activeChar == null) || !Config.ALLOW_MAIL || !Config.ALLOW_ATTACHMENTS)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!getClient().getFloodProtectors().getTransaction().tryPerformAction("cancelpost"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final Message msg = MailManager.getInstance().getMessage(_msgId);
|
||||
if (msg == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (msg.getSenderId() != activeChar.getObjectId())
|
||||
{
|
||||
Util.handleIllegalPlayerAction(activeChar, "Player " + activeChar.getName() + " tried to cancel not own post!", Config.DEFAULT_PUNISH);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!activeChar.isInsideZone(ZoneId.PEACE))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_CANCEL_IN_A_NON_PEACE_ZONE_LOCATION);
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeChar.getActiveTradeList() != null)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_CANCEL_DURING_AN_EXCHANGE);
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeChar.hasItemRequest())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_CANCEL_DURING_AN_ITEM_ENHANCEMENT_OR_ATTRIBUTE_ENHANCEMENT);
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeChar.getPrivateStoreType() != PrivateStoreType.NONE)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_CANCEL_BECAUSE_THE_PRIVATE_STORE_OR_WORKSHOP_IS_IN_PROGRESS);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!msg.hasAttachments())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_CANCEL_SENT_MAIL_SINCE_THE_RECIPIENT_RECEIVED_IT);
|
||||
return;
|
||||
}
|
||||
|
||||
final ItemContainer attachments = msg.getAttachments();
|
||||
if ((attachments == null) || (attachments.getSize() == 0))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_CANCEL_SENT_MAIL_SINCE_THE_RECIPIENT_RECEIVED_IT);
|
||||
return;
|
||||
}
|
||||
|
||||
int weight = 0;
|
||||
int slots = 0;
|
||||
|
||||
for (L2ItemInstance item : attachments.getItems())
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (item.getOwnerId() != activeChar.getObjectId())
|
||||
{
|
||||
Util.handleIllegalPlayerAction(activeChar, "Player " + activeChar.getName() + " tried to get not own item from cancelled attachment!", Config.DEFAULT_PUNISH);
|
||||
return;
|
||||
}
|
||||
|
||||
if (item.getItemLocation() != ItemLocation.MAIL)
|
||||
{
|
||||
Util.handleIllegalPlayerAction(activeChar, "Player " + activeChar.getName() + " tried to get items not from mail !", Config.DEFAULT_PUNISH);
|
||||
return;
|
||||
}
|
||||
|
||||
if (item.getLocationSlot() != msg.getId())
|
||||
{
|
||||
Util.handleIllegalPlayerAction(activeChar, "Player " + activeChar.getName() + " tried to get items from different attachment!", Config.DEFAULT_PUNISH);
|
||||
return;
|
||||
}
|
||||
|
||||
weight += item.getCount() * item.getItem().getWeight();
|
||||
if (!item.isStackable())
|
||||
{
|
||||
slots += item.getCount();
|
||||
}
|
||||
else if (activeChar.getInventory().getItemByItemId(item.getId()) == null)
|
||||
{
|
||||
slots++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!activeChar.getInventory().validateCapacity(slots))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_COULD_NOT_CANCEL_RECEIPT_BECAUSE_YOUR_INVENTORY_IS_FULL);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!activeChar.getInventory().validateWeight(weight))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_COULD_NOT_CANCEL_RECEIPT_BECAUSE_YOUR_INVENTORY_IS_FULL);
|
||||
return;
|
||||
}
|
||||
|
||||
// Proceed to the transfer
|
||||
final InventoryUpdate playerIU = Config.FORCE_INVENTORY_UPDATE ? null : new InventoryUpdate();
|
||||
for (L2ItemInstance item : attachments.getItems())
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final long count = item.getCount();
|
||||
final L2ItemInstance newItem = attachments.transferItem(attachments.getName(), item.getObjectId(), count, activeChar.getInventory(), activeChar, null);
|
||||
if (newItem == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (playerIU != null)
|
||||
{
|
||||
if (newItem.getCount() > count)
|
||||
{
|
||||
playerIU.addModifiedItem(newItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
playerIU.addNewItem(newItem);
|
||||
}
|
||||
}
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_ACQUIRED_S2_S1);
|
||||
sm.addItemName(item.getId());
|
||||
sm.addLong(count);
|
||||
activeChar.sendPacket(sm);
|
||||
}
|
||||
|
||||
msg.removeAttachments();
|
||||
|
||||
// Send updated item list to the player
|
||||
if (playerIU != null)
|
||||
{
|
||||
activeChar.sendPacket(playerIU);
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.sendPacket(new ItemList(activeChar, false));
|
||||
}
|
||||
|
||||
// Update current load status on player
|
||||
activeChar.sendPacket(new ExUserInfoInvenWeight(activeChar));
|
||||
|
||||
final L2PcInstance receiver = L2World.getInstance().getPlayer(msg.getReceiverId());
|
||||
if (receiver != null)
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CANCELED_THE_SENT_MAIL);
|
||||
sm.addCharName(activeChar);
|
||||
receiver.sendPacket(sm);
|
||||
receiver.sendPacket(new ExChangePostState(true, _msgId, Message.DELETED));
|
||||
}
|
||||
|
||||
MailManager.getInstance().deleteMessageInDb(_msgId);
|
||||
|
||||
activeChar.sendPacket(new ExChangePostState(false, _msgId, Message.DELETED));
|
||||
activeChar.sendPacket(SystemMessageId.MAIL_SUCCESSFULLY_CANCELLED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_6F_REQUESTCANCELPOSTATTACHMENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean triggersOnActionRequest()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.enums.ItemLocation;
|
||||
import com.l2jmobius.gameserver.enums.PrivateStoreType;
|
||||
import com.l2jmobius.gameserver.instancemanager.MailManager;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.entity.Message;
|
||||
import com.l2jmobius.gameserver.model.itemcontainer.ItemContainer;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExChangePostState;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.InventoryUpdate;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* @author Migi, DS
|
||||
*/
|
||||
public final class RequestCancelPostAttachment implements IClientIncomingPacket
|
||||
{
|
||||
private int _msgId;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_msgId = packet.readD();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final L2PcInstance activeChar = client.getActiveChar();
|
||||
if ((activeChar == null) || !Config.ALLOW_MAIL || !Config.ALLOW_ATTACHMENTS)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!client.getFloodProtectors().getTransaction().tryPerformAction("cancelpost"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final Message msg = MailManager.getInstance().getMessage(_msgId);
|
||||
if (msg == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (msg.getSenderId() != activeChar.getObjectId())
|
||||
{
|
||||
Util.handleIllegalPlayerAction(activeChar, "Player " + activeChar.getName() + " tried to cancel not own post!", Config.DEFAULT_PUNISH);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!activeChar.isInsideZone(ZoneId.PEACE))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_CANCEL_IN_A_NON_PEACE_ZONE_LOCATION);
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeChar.getActiveTradeList() != null)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_CANCEL_DURING_AN_EXCHANGE);
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeChar.hasItemRequest())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_CANCEL_DURING_AN_ITEM_ENHANCEMENT_OR_ATTRIBUTE_ENHANCEMENT);
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeChar.getPrivateStoreType() != PrivateStoreType.NONE)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_CANCEL_BECAUSE_THE_PRIVATE_STORE_OR_WORKSHOP_IS_IN_PROGRESS);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!msg.hasAttachments())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_CANCEL_SENT_MAIL_SINCE_THE_RECIPIENT_RECEIVED_IT);
|
||||
return;
|
||||
}
|
||||
|
||||
final ItemContainer attachments = msg.getAttachments();
|
||||
if ((attachments == null) || (attachments.getSize() == 0))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_CANCEL_SENT_MAIL_SINCE_THE_RECIPIENT_RECEIVED_IT);
|
||||
return;
|
||||
}
|
||||
|
||||
int weight = 0;
|
||||
int slots = 0;
|
||||
|
||||
for (L2ItemInstance item : attachments.getItems())
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (item.getOwnerId() != activeChar.getObjectId())
|
||||
{
|
||||
Util.handleIllegalPlayerAction(activeChar, "Player " + activeChar.getName() + " tried to get not own item from cancelled attachment!", Config.DEFAULT_PUNISH);
|
||||
return;
|
||||
}
|
||||
|
||||
if (item.getItemLocation() != ItemLocation.MAIL)
|
||||
{
|
||||
Util.handleIllegalPlayerAction(activeChar, "Player " + activeChar.getName() + " tried to get items not from mail !", Config.DEFAULT_PUNISH);
|
||||
return;
|
||||
}
|
||||
|
||||
if (item.getLocationSlot() != msg.getId())
|
||||
{
|
||||
Util.handleIllegalPlayerAction(activeChar, "Player " + activeChar.getName() + " tried to get items from different attachment!", Config.DEFAULT_PUNISH);
|
||||
return;
|
||||
}
|
||||
|
||||
weight += item.getCount() * item.getItem().getWeight();
|
||||
if (!item.isStackable())
|
||||
{
|
||||
slots += item.getCount();
|
||||
}
|
||||
else if (activeChar.getInventory().getItemByItemId(item.getId()) == null)
|
||||
{
|
||||
slots++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!activeChar.getInventory().validateCapacity(slots))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_COULD_NOT_CANCEL_RECEIPT_BECAUSE_YOUR_INVENTORY_IS_FULL);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!activeChar.getInventory().validateWeight(weight))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_COULD_NOT_CANCEL_RECEIPT_BECAUSE_YOUR_INVENTORY_IS_FULL);
|
||||
return;
|
||||
}
|
||||
|
||||
// Proceed to the transfer
|
||||
final InventoryUpdate playerIU = Config.FORCE_INVENTORY_UPDATE ? null : new InventoryUpdate();
|
||||
for (L2ItemInstance item : attachments.getItems())
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final long count = item.getCount();
|
||||
final L2ItemInstance newItem = attachments.transferItem(attachments.getName(), item.getObjectId(), count, activeChar.getInventory(), activeChar, null);
|
||||
if (newItem == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (playerIU != null)
|
||||
{
|
||||
if (newItem.getCount() > count)
|
||||
{
|
||||
playerIU.addModifiedItem(newItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
playerIU.addNewItem(newItem);
|
||||
}
|
||||
}
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_ACQUIRED_S2_S1);
|
||||
sm.addItemName(item.getId());
|
||||
sm.addLong(count);
|
||||
activeChar.sendPacket(sm);
|
||||
}
|
||||
|
||||
msg.removeAttachments();
|
||||
|
||||
// Send updated item list to the player
|
||||
if (playerIU != null)
|
||||
{
|
||||
activeChar.sendInventoryUpdate(playerIU);
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.sendItemList(false);
|
||||
}
|
||||
|
||||
final L2PcInstance receiver = L2World.getInstance().getPlayer(msg.getReceiverId());
|
||||
if (receiver != null)
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CANCELED_THE_SENT_MAIL);
|
||||
sm.addCharName(activeChar);
|
||||
receiver.sendPacket(sm);
|
||||
receiver.sendPacket(new ExChangePostState(true, _msgId, Message.DELETED));
|
||||
}
|
||||
|
||||
MailManager.getInstance().deleteMessageInDb(_msgId);
|
||||
|
||||
activeChar.sendPacket(new ExChangePostState(false, _msgId, Message.DELETED));
|
||||
activeChar.sendPacket(SystemMessageId.MAIL_SUCCESSFULLY_CANCELLED);
|
||||
}
|
||||
}
|
||||
|
||||
-53
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.request.EnchantItemAttributeRequest;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
*/
|
||||
public class RequestChangeAttributeCancel extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_B7_SENDCHANGEATTRIBUTETARGETITEM = "[C] D0:B7 RequestChangeAttributeCancel";
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance player = getClient().getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
final EnchantItemAttributeRequest request = player.getRequest(EnchantItemAttributeRequest.class);
|
||||
if (request == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
player.removeRequest(request.getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_B7_SENDCHANGEATTRIBUTETARGETITEM;
|
||||
}
|
||||
}
|
||||
-138
@@ -1,138 +0,0 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.enums.PrivateStoreType;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.request.EnchantItemAttributeRequest;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExChangeAttributeFail;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExChangeAttributeItemList;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExChangeAttributeOk;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExStorageMaxCount;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.InventoryUpdate;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.UserInfo;
|
||||
import com.l2jmobius.util.Rnd;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
*/
|
||||
public class RequestChangeAttributeItem extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_B7_SENDCHANGEATTRIBUTETARGETITEM = "[C] D0:B7 SendChangeAttributeTargetItem";
|
||||
|
||||
private int _attributeOID;
|
||||
private int _itemOID;
|
||||
private int _newAttributeID;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_attributeOID = readD();
|
||||
_itemOID = readD();
|
||||
_newAttributeID = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance player = getClient().getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final EnchantItemAttributeRequest request = player.getRequest(EnchantItemAttributeRequest.class);
|
||||
if (request == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
request.setProcessing(true);
|
||||
|
||||
final L2ItemInstance item = player.getInventory().getItemByObjectId(_itemOID);
|
||||
|
||||
if (player.getPrivateStoreType() != PrivateStoreType.NONE)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_CHANGE_AN_ATTRIBUTE_WHILE_USING_A_PRIVATE_STORE_OR_WORKSHOP);
|
||||
player.removeRequest(request.getClass());
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.getActiveTradeList() != null)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_CHANGE_ATTRIBUTES_WHILE_EXCHANGING);
|
||||
player.removeRequest(request.getClass());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!item.isWeapon() || (_newAttributeID == -1))
|
||||
{
|
||||
player.removeRequest(request.getClass());
|
||||
player.sendPacket(new ExChangeAttributeItemList(player, _attributeOID));
|
||||
return;
|
||||
}
|
||||
|
||||
final L2ItemInstance attribute = player.getInventory().getItemByObjectId(_attributeOID);
|
||||
player.getInventory().destroyItem("ChangingAttribute", _attributeOID, 1, player, null);
|
||||
|
||||
if (Rnd.get(100) < Config.CHANGE_CHANCE_ELEMENT)
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_S_S2_ATTRIBUTE_HAS_SUCCESSFULLY_CHANGED_TO_S3_ATTRIBUTE);
|
||||
sm.addItemName(item);
|
||||
sm.addElemental(item.getAttackElementType());
|
||||
sm.addElemental(_newAttributeID);
|
||||
|
||||
item.changeAttribute((byte) _newAttributeID, item.getAttackElementPower());
|
||||
if (item.isEquipped())
|
||||
{
|
||||
item.updateElementAttrBonus(player);
|
||||
}
|
||||
|
||||
player.sendPacket(sm);
|
||||
player.sendPacket(new ExChangeAttributeOk());
|
||||
player.sendPacket(new UserInfo(player));
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendPacket(new ExChangeAttributeFail());
|
||||
player.sendPacket(SystemMessageId.CHANGING_ATTRIBUTES_HAS_BEEN_FAILED);
|
||||
}
|
||||
|
||||
// send packets
|
||||
player.sendPacket(new ExStorageMaxCount(player));
|
||||
final InventoryUpdate iu = new InventoryUpdate();
|
||||
iu.addModifiedItem(item);
|
||||
if (player.getInventory().getItemByObjectId(_attributeOID) != null)
|
||||
{
|
||||
iu.addModifiedItem(attribute);
|
||||
}
|
||||
else
|
||||
{
|
||||
iu.addRemovedItem(attribute);
|
||||
}
|
||||
player.sendPacket(iu);
|
||||
|
||||
player.removeRequest(request.getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_B7_SENDCHANGEATTRIBUTETARGETITEM;
|
||||
}
|
||||
}
|
||||
+38
-42
@@ -1,42 +1,38 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* @author ShanSoft Packets Structure: chddd
|
||||
*/
|
||||
public final class RequestChangeBookMarkSlot extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_51_05_REQUESCHANGEBOOKMARKSLOT = "[C] D0:51:05 RequestChangeBookMarkSlot";
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
// There is nothing to read.
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_51_05_REQUESCHANGEBOOKMARKSLOT;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
|
||||
/**
|
||||
* @author ShanSoft Packets Structure: chddd
|
||||
*/
|
||||
public final class RequestChangeBookMarkSlot implements IClientIncomingPacket
|
||||
{
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+82
-88
@@ -1,88 +1,82 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
|
||||
/**
|
||||
* @author KenM, Gnacik
|
||||
*/
|
||||
public class RequestChangeNicknameColor extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_4F_REQUESTCHANGENICKNAMECOLOR = "[C] D0:4F RequestChangeNicknameColor";
|
||||
|
||||
private static final int COLORS[] =
|
||||
{
|
||||
0x9393FF, // Pink
|
||||
0x7C49FC, // Rose Pink
|
||||
0x97F8FC, // Lemon Yellow
|
||||
0xFA9AEE, // Lilac
|
||||
0xFF5D93, // Cobalt Violet
|
||||
0x00FCA0, // Mint Green
|
||||
0xA0A601, // Peacock Green
|
||||
0x7898AF, // Yellow Ochre
|
||||
0x486295, // Chocolate
|
||||
0x999999
|
||||
// Silver
|
||||
};
|
||||
|
||||
private int _colorNum, _itemObjectId;
|
||||
private String _title;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_colorNum = readD();
|
||||
_title = readS();
|
||||
_itemObjectId = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ((_colorNum < 0) || (_colorNum >= COLORS.length))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2ItemInstance item = activeChar.getInventory().getItemByObjectId(_itemObjectId);
|
||||
if ((item == null) || (item.getEtcItem() == null) || (item.getEtcItem().getHandlerName() == null) || !item.getEtcItem().getHandlerName().equalsIgnoreCase("NicknameColor"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeChar.destroyItem("Consume", item, 1, null, true))
|
||||
{
|
||||
activeChar.setTitle(_title);
|
||||
activeChar.getAppearance().setTitleColor(COLORS[_colorNum]);
|
||||
activeChar.broadcastUserInfo();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_4F_REQUESTCHANGENICKNAMECOLOR;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
|
||||
/**
|
||||
* @author KenM, Gnacik
|
||||
*/
|
||||
public class RequestChangeNicknameColor implements IClientIncomingPacket
|
||||
{
|
||||
private static final int COLORS[] =
|
||||
{
|
||||
0x9393FF, // Pink
|
||||
0x7C49FC, // Rose Pink
|
||||
0x97F8FC, // Lemon Yellow
|
||||
0xFA9AEE, // Lilac
|
||||
0xFF5D93, // Cobalt Violet
|
||||
0x00FCA0, // Mint Green
|
||||
0xA0A601, // Peacock Green
|
||||
0x7898AF, // Yellow Ochre
|
||||
0x486295, // Chocolate
|
||||
0x999999, // Silver
|
||||
};
|
||||
|
||||
private int _colorNum, _itemObjectId;
|
||||
private String _title;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_colorNum = packet.readD();
|
||||
_title = packet.readS();
|
||||
_itemObjectId = packet.readD();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final L2PcInstance activeChar = client.getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ((_colorNum < 0) || (_colorNum >= COLORS.length))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2ItemInstance item = activeChar.getInventory().getItemByObjectId(_itemObjectId);
|
||||
if ((item == null) || (item.getEtcItem() == null) || (item.getEtcItem().getHandlerName() == null) || !item.getEtcItem().getHandlerName().equalsIgnoreCase("NicknameColor"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeChar.destroyItem("Consume", item, 1, null, true))
|
||||
{
|
||||
activeChar.setTitle(_title);
|
||||
activeChar.getAppearance().setTitleColor(COLORS[_colorNum]);
|
||||
activeChar.broadcastUserInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+53
-58
@@ -1,58 +1,53 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.gameserver.model.L2Party;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
|
||||
/**
|
||||
* This packet is received from client when a party leader requests to change the leadership to another player in his party.
|
||||
*/
|
||||
public final class RequestChangePartyLeader extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_0C_REQUESTCHANGEPARTYLEADER = "[C] D0:0C RequestChangePartyLeader";
|
||||
|
||||
private String _name;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_name = readS();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2Party party = activeChar.getParty();
|
||||
if ((party != null) && party.isLeader(activeChar))
|
||||
{
|
||||
party.changePartyLeader(_name);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_0C_REQUESTCHANGEPARTYLEADER;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.model.L2Party;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
|
||||
/**
|
||||
* This packet is received from client when a party leader requests to change the leadership to another player in his party.
|
||||
*/
|
||||
public final class RequestChangePartyLeader implements IClientIncomingPacket
|
||||
{
|
||||
private String _name;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_name = packet.readS();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final L2PcInstance activeChar = client.getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2Party party = activeChar.getParty();
|
||||
if ((party != null) && party.isLeader(activeChar))
|
||||
{
|
||||
party.changePartyLeader(_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+90
-95
@@ -1,95 +1,90 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.gameserver.data.sql.impl.PetNameTable;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Summon;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
* This class ...
|
||||
* @version $Revision: 1.3.4.4 $ $Date: 2005/04/06 16:13:48 $
|
||||
*/
|
||||
public final class RequestChangePetName extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__93_REQUESTCHANGEPETNAME = "[C] 93 RequestChangePetName";
|
||||
|
||||
private String _name;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_name = readS();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2Summon pet = activeChar.getPet();
|
||||
if (pet == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!pet.isPet())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_A_PET);
|
||||
return;
|
||||
}
|
||||
|
||||
if (pet.getName() != null)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_SET_THE_NAME_OF_THE_PET);
|
||||
return;
|
||||
}
|
||||
|
||||
if (PetNameTable.getInstance().doesPetNameExist(_name, pet.getTemplate().getId()))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.THIS_IS_ALREADY_IN_USE_BY_ANOTHER_PET);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((_name.length() < 3) || (_name.length() > 16))
|
||||
{
|
||||
// activeChar.sendPacket(SystemMessageId.YOUR_PET_S_NAME_CAN_BE_UP_TO_8_CHARACTERS_IN_LENGTH);
|
||||
activeChar.sendMessage("Your pet's name can be up to 16 characters in length.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!PetNameTable.getInstance().isValidPetName(_name))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.AN_INVALID_CHARACTER_IS_INCLUDED_IN_THE_PET_S_NAME);
|
||||
return;
|
||||
}
|
||||
|
||||
pet.setName(_name);
|
||||
pet.updateAndBroadcastStatus(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__93_REQUESTCHANGEPETNAME;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.data.sql.impl.PetNameTable;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Summon;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
|
||||
/**
|
||||
* This class ...
|
||||
* @version $Revision: 1.3.4.4 $ $Date: 2005/04/06 16:13:48 $
|
||||
*/
|
||||
public final class RequestChangePetName implements IClientIncomingPacket
|
||||
{
|
||||
private String _name;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_name = packet.readS();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final L2PcInstance activeChar = client.getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2Summon pet = activeChar.getPet();
|
||||
if (pet == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!pet.isPet())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_A_PET);
|
||||
return;
|
||||
}
|
||||
|
||||
if (pet.getName() != null)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_SET_THE_NAME_OF_THE_PET);
|
||||
return;
|
||||
}
|
||||
|
||||
if (PetNameTable.getInstance().doesPetNameExist(_name, pet.getTemplate().getId()))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.THIS_IS_ALREADY_IN_USE_BY_ANOTHER_PET);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((_name.length() < 3) || (_name.length() > 16))
|
||||
{
|
||||
// activeChar.sendPacket(SystemMessageId.YOUR_PET_S_NAME_CAN_BE_UP_TO_8_CHARACTERS_IN_LENGTH);
|
||||
activeChar.sendMessage("Your pet's name can be up to 16 characters in length.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!PetNameTable.getInstance().isValidPetName(_name))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.AN_INVALID_CHARACTER_IS_INCLUDED_IN_THE_PET_S_NAME);
|
||||
return;
|
||||
}
|
||||
|
||||
pet.setName(_name);
|
||||
pet.updateAndBroadcastStatus(1);
|
||||
}
|
||||
}
|
||||
|
||||
+58
-63
@@ -1,63 +1,58 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerChangeToAwakenedClass;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
|
||||
/**
|
||||
* @author Sdw
|
||||
*/
|
||||
public class RequestChangeToAwakenedClass extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_A1_REQUESTCHANGETOAWAKENEDCLASS = "[C] D0;A2 RequestChangeToAwakenedClass";
|
||||
|
||||
private boolean _change;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_change = readD() == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance player = getClient().getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_change)
|
||||
{
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerChangeToAwakenedClass(player), player);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_A1_REQUESTCHANGETOAWAKENEDCLASS;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerChangeToAwakenedClass;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
|
||||
/**
|
||||
* @author Sdw
|
||||
*/
|
||||
public class RequestChangeToAwakenedClass implements IClientIncomingPacket
|
||||
{
|
||||
private boolean _change;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_change = packet.readD() == 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final L2PcInstance player = client.getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_change)
|
||||
{
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerChangeToAwakenedClass(player), player);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+75
-78
@@ -1,79 +1,76 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.data.sql.impl.CharNameTable;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExIsCharNameCreatable;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class RequestCharacterNameCreatable extends L2GameClientPacket
|
||||
{
|
||||
private String _name;
|
||||
private int result;
|
||||
|
||||
public static int CHARACTER_CREATE_FAILED = 1;
|
||||
public static int NAME_ALREADY_EXISTS = 2;
|
||||
public static int INVALID_LENGTH = 3;
|
||||
public static int INVALID_NAME = 4;
|
||||
public static int CANNOT_CREATE_SERVER = 5;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_name = readS();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final int charId = CharNameTable.getInstance().getIdByName(_name);
|
||||
|
||||
if (!Util.isAlphaNumeric(_name) || !isValidName(_name))
|
||||
{
|
||||
result = INVALID_NAME;
|
||||
}
|
||||
else if (charId > 0)
|
||||
{
|
||||
result = NAME_ALREADY_EXISTS;
|
||||
}
|
||||
else if (_name.length() > 16)
|
||||
{
|
||||
result = INVALID_LENGTH;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = -1;
|
||||
}
|
||||
|
||||
sendPacket(new ExIsCharNameCreatable(result));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return "[C] D0:B0 RequestCharacterNameCreatable";
|
||||
}
|
||||
|
||||
private boolean isValidName(String text)
|
||||
{
|
||||
return Config.CHARNAME_TEMPLATE_PATTERN.matcher(text).matches();
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.data.sql.impl.CharNameTable;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExIsCharNameCreatable;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class RequestCharacterNameCreatable implements IClientIncomingPacket
|
||||
{
|
||||
private String _name;
|
||||
private int result;
|
||||
|
||||
public static int CHARACTER_CREATE_FAILED = 1;
|
||||
public static int NAME_ALREADY_EXISTS = 2;
|
||||
public static int INVALID_LENGTH = 3;
|
||||
public static int INVALID_NAME = 4;
|
||||
public static int CANNOT_CREATE_SERVER = 5;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_name = packet.readS();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final int charId = CharNameTable.getInstance().getIdByName(_name);
|
||||
|
||||
if (!Util.isAlphaNumeric(_name) || !isValidName(_name))
|
||||
{
|
||||
result = INVALID_NAME;
|
||||
}
|
||||
else if (charId > 0)
|
||||
{
|
||||
result = NAME_ALREADY_EXISTS;
|
||||
}
|
||||
else if (_name.length() > 16)
|
||||
{
|
||||
result = INVALID_LENGTH;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = -1;
|
||||
}
|
||||
|
||||
client.sendPacket(new ExIsCharNameCreatable(result));
|
||||
}
|
||||
|
||||
private boolean isValidName(String text)
|
||||
{
|
||||
return Config.CHARNAME_TEMPLATE_PATTERN.matcher(text).matches();
|
||||
}
|
||||
}
|
||||
+131
-182
@@ -1,182 +1,131 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExPutItemResultForVariationCancel;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* Format(ch) d
|
||||
* @author -Wooden-
|
||||
*/
|
||||
public final class RequestConfirmCancelItem extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_42_REQUESTCONFIRMCANCELITEM = "[C] D0:42 RequestConfirmCancelItem";
|
||||
private int _objectId;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_objectId = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
final L2ItemInstance item = activeChar.getInventory().getItemByObjectId(_objectId);
|
||||
if (item == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (item.getOwnerId() != activeChar.getObjectId())
|
||||
{
|
||||
Util.handleIllegalPlayerAction(getClient().getActiveChar(), "Warning!! Character " + getClient().getActiveChar().getName() + " of account " + getClient().getActiveChar().getAccountName() + " tryied to destroy augment on item that doesn't own.", Config.DEFAULT_PUNISH);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!item.isAugmented())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.AUGMENTATION_REMOVAL_CAN_ONLY_BE_DONE_ON_AN_AUGMENTED_ITEM);
|
||||
return;
|
||||
}
|
||||
|
||||
if (item.isPvp() && !Config.ALT_ALLOW_AUGMENT_PVP_ITEMS)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.THIS_IS_NOT_A_SUITABLE_ITEM);
|
||||
return;
|
||||
}
|
||||
|
||||
int price = 0;
|
||||
switch (item.getItem().getCrystalType())
|
||||
{
|
||||
case C:
|
||||
{
|
||||
if (item.getCrystalCount() < 1720)
|
||||
{
|
||||
price = 95000;
|
||||
}
|
||||
else if (item.getCrystalCount() < 2452)
|
||||
{
|
||||
price = 150000;
|
||||
}
|
||||
else
|
||||
{
|
||||
price = 210000;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case B:
|
||||
{
|
||||
if (item.getCrystalCount() < 1746)
|
||||
{
|
||||
price = 240000;
|
||||
}
|
||||
else
|
||||
{
|
||||
price = 270000;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case A:
|
||||
{
|
||||
if (item.getCrystalCount() < 2160)
|
||||
{
|
||||
price = 330000;
|
||||
}
|
||||
else if (item.getCrystalCount() < 2824)
|
||||
{
|
||||
price = 390000;
|
||||
}
|
||||
else
|
||||
{
|
||||
price = 420000;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case S:
|
||||
{
|
||||
if (item.getCrystalCount() <= 2052)
|
||||
{
|
||||
price = 480000;
|
||||
}
|
||||
else
|
||||
{
|
||||
price = 920000;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case S80:
|
||||
case S84:
|
||||
{
|
||||
if (item.getCrystalCount() <= 4965)
|
||||
{
|
||||
price = 920000;
|
||||
}
|
||||
else if (item.getCrystalCount() <= 7050)
|
||||
{
|
||||
price = 2800000;
|
||||
}
|
||||
else if (item.getCrystalCount() <= 8233)
|
||||
{
|
||||
price = 2800000;
|
||||
}
|
||||
else
|
||||
{
|
||||
price = 3200000;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case R:
|
||||
{
|
||||
price = 3492800;
|
||||
break;
|
||||
}
|
||||
case R95:
|
||||
{
|
||||
price = 2943200;
|
||||
break;
|
||||
}
|
||||
case R99:
|
||||
{
|
||||
price = 6485800;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
activeChar.sendPacket(new ExPutItemResultForVariationCancel(item, price));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_42_REQUESTCONFIRMCANCELITEM;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExPutItemResultForVariationCancel;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* Format(ch) d
|
||||
* @author -Wooden-
|
||||
*/
|
||||
public final class RequestConfirmCancelItem implements IClientIncomingPacket
|
||||
{
|
||||
private int _objectId;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_objectId = packet.readD();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final L2PcInstance activeChar = client.getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
final L2ItemInstance item = activeChar.getInventory().getItemByObjectId(_objectId);
|
||||
if (item == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (item.getOwnerId() != activeChar.getObjectId())
|
||||
{
|
||||
Util.handleIllegalPlayerAction(client.getActiveChar(), "Warning!! Character " + client.getActiveChar().getName() + " of account " + client.getActiveChar().getAccountName() + " tryied to destroy augment on item that doesn't own.", Config.DEFAULT_PUNISH);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!item.isAugmented())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.AUGMENTATION_REMOVAL_CAN_ONLY_BE_DONE_ON_AN_AUGMENTED_ITEM);
|
||||
return;
|
||||
}
|
||||
|
||||
if (item.isPvp() && !Config.ALT_ALLOW_AUGMENT_PVP_ITEMS)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.THIS_IS_NOT_A_SUITABLE_ITEM);
|
||||
return;
|
||||
}
|
||||
|
||||
int price = 0;
|
||||
switch (item.getItem().getCrystalType())
|
||||
{
|
||||
case C:
|
||||
if (item.getCrystalCount() < 1720)
|
||||
{
|
||||
price = 95000;
|
||||
}
|
||||
else if (item.getCrystalCount() < 2452)
|
||||
{
|
||||
price = 150000;
|
||||
}
|
||||
else
|
||||
{
|
||||
price = 210000;
|
||||
}
|
||||
break;
|
||||
case B:
|
||||
if (item.getCrystalCount() < 1746)
|
||||
{
|
||||
price = 240000;
|
||||
}
|
||||
else
|
||||
{
|
||||
price = 270000;
|
||||
}
|
||||
break;
|
||||
case A:
|
||||
if (item.getCrystalCount() < 2160)
|
||||
{
|
||||
price = 330000;
|
||||
}
|
||||
else if (item.getCrystalCount() < 2824)
|
||||
{
|
||||
price = 390000;
|
||||
}
|
||||
else
|
||||
{
|
||||
price = 420000;
|
||||
}
|
||||
break;
|
||||
case S:
|
||||
price = 480000;
|
||||
break;
|
||||
case S80:
|
||||
case S84:
|
||||
price = 920000;
|
||||
break;
|
||||
// TODO: S84 TOP price 3.2M
|
||||
// any other item type is not augmentable
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
activeChar.sendPacket(new ExPutItemResultForVariationCancel(item, price));
|
||||
}
|
||||
}
|
||||
|
||||
+93
-97
@@ -1,97 +1,93 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExPutCommissionResultForVariationMake;
|
||||
|
||||
/**
|
||||
* Format:(ch) dddd
|
||||
* @author -Wooden-
|
||||
*/
|
||||
public final class RequestConfirmGemStone extends AbstractRefinePacket
|
||||
{
|
||||
private static final String _C__D0_28_REQUESTCONFIRMGEMSTONE = "[C] D0:28 RequestConfirmGemStone";
|
||||
private int _targetItemObjId;
|
||||
private int _refinerItemObjId;
|
||||
private int _gemstoneItemObjId;
|
||||
private long _gemStoneCount;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_targetItemObjId = readD();
|
||||
_refinerItemObjId = readD();
|
||||
_gemstoneItemObjId = readD();
|
||||
_gemStoneCount = readQ();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
final L2ItemInstance targetItem = activeChar.getInventory().getItemByObjectId(_targetItemObjId);
|
||||
if (targetItem == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
final L2ItemInstance refinerItem = activeChar.getInventory().getItemByObjectId(_refinerItemObjId);
|
||||
if (refinerItem == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
final L2ItemInstance gemStoneItem = activeChar.getInventory().getItemByObjectId(_gemstoneItemObjId);
|
||||
if (gemStoneItem == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure the item is a gemstone
|
||||
if (!isValid(activeChar, targetItem, refinerItem, gemStoneItem))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.THIS_IS_NOT_A_SUITABLE_ITEM);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check for gemstone count
|
||||
final LifeStone ls = getLifeStone(refinerItem.getId());
|
||||
if (ls == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_gemStoneCount != getGemStoneCount(targetItem.getItem().getCrystalType(), ls.getGrade()))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.GEMSTONE_QUANTITY_IS_INCORRECT);
|
||||
return;
|
||||
}
|
||||
|
||||
activeChar.sendPacket(new ExPutCommissionResultForVariationMake(_gemstoneItemObjId, _gemStoneCount, gemStoneItem.getId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_28_REQUESTCONFIRMGEMSTONE;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExPutCommissionResultForVariationMake;
|
||||
|
||||
/**
|
||||
* Format:(ch) dddd
|
||||
* @author -Wooden-
|
||||
*/
|
||||
public final class RequestConfirmGemStone extends AbstractRefinePacket
|
||||
{
|
||||
private int _targetItemObjId;
|
||||
private int _refinerItemObjId;
|
||||
private int _gemstoneItemObjId;
|
||||
private long _gemStoneCount;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_targetItemObjId = packet.readD();
|
||||
_refinerItemObjId = packet.readD();
|
||||
_gemstoneItemObjId = packet.readD();
|
||||
_gemStoneCount = packet.readQ();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final L2PcInstance activeChar = client.getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
final L2ItemInstance targetItem = activeChar.getInventory().getItemByObjectId(_targetItemObjId);
|
||||
if (targetItem == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
final L2ItemInstance refinerItem = activeChar.getInventory().getItemByObjectId(_refinerItemObjId);
|
||||
if (refinerItem == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
final L2ItemInstance gemStoneItem = activeChar.getInventory().getItemByObjectId(_gemstoneItemObjId);
|
||||
if (gemStoneItem == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure the item is a gemstone
|
||||
if (!isValid(activeChar, targetItem, refinerItem, gemStoneItem))
|
||||
{
|
||||
client.sendPacket(SystemMessageId.THIS_IS_NOT_A_SUITABLE_ITEM);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check for gemstone count
|
||||
final LifeStone ls = getLifeStone(refinerItem.getId());
|
||||
if (ls == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_gemStoneCount != getGemStoneCount(targetItem.getItem().getCrystalType(), ls.getGrade()))
|
||||
{
|
||||
client.sendPacket(SystemMessageId.GEMSTONE_QUANTITY_IS_INCORRECT);
|
||||
return;
|
||||
}
|
||||
|
||||
client.sendPacket(new ExPutCommissionResultForVariationMake(_gemstoneItemObjId, _gemStoneCount, gemStoneItem.getId()));
|
||||
}
|
||||
}
|
||||
|
||||
+79
-93
@@ -1,93 +1,79 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.items.type.CrystalType;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExPutIntensiveResultForVariationMake;
|
||||
|
||||
/**
|
||||
* Fromat(ch) dd
|
||||
* @author -Wooden-
|
||||
*/
|
||||
public class RequestConfirmRefinerItem extends AbstractRefinePacket
|
||||
{
|
||||
private static final String _C__D0_27_REQUESTCONFIRMREFINERITEM = "[C] D0:27 RequestConfirmRefinerItem";
|
||||
|
||||
private int _targetItemObjId;
|
||||
private int _refinerItemObjId;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_targetItemObjId = readD();
|
||||
_refinerItemObjId = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2ItemInstance targetItem = activeChar.getInventory().getItemByObjectId(_targetItemObjId);
|
||||
if (targetItem == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2ItemInstance refinerItem = activeChar.getInventory().getItemByObjectId(_refinerItemObjId);
|
||||
if (refinerItem == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isValid(activeChar, targetItem, refinerItem))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.THIS_IS_NOT_A_SUITABLE_ITEM);
|
||||
return;
|
||||
}
|
||||
|
||||
final int refinerItemId = refinerItem.getItem().getId();
|
||||
final CrystalType grade = targetItem.getItem().getCrystalType();
|
||||
final LifeStone ls = getLifeStone(refinerItemId);
|
||||
int gemStoneId = 0;
|
||||
if (getGemStoneId(grade) != null)
|
||||
{
|
||||
for (int id : getGemStoneId(grade))
|
||||
{
|
||||
if (activeChar.getInventory().getAllItemsByItemId(id) != null)
|
||||
{
|
||||
gemStoneId = id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
activeChar.sendPacket(new ExPutIntensiveResultForVariationMake(_refinerItemObjId, refinerItemId, gemStoneId, getGemStoneCount(grade, ls.getGrade())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_27_REQUESTCONFIRMREFINERITEM;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.items.type.CrystalType;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExPutIntensiveResultForVariationMake;
|
||||
|
||||
/**
|
||||
* Fromat(ch) dd
|
||||
* @author -Wooden-
|
||||
*/
|
||||
public class RequestConfirmRefinerItem extends AbstractRefinePacket
|
||||
{
|
||||
private int _targetItemObjId;
|
||||
private int _refinerItemObjId;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_targetItemObjId = packet.readD();
|
||||
_refinerItemObjId = packet.readD();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final L2PcInstance activeChar = client.getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2ItemInstance targetItem = activeChar.getInventory().getItemByObjectId(_targetItemObjId);
|
||||
if (targetItem == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2ItemInstance refinerItem = activeChar.getInventory().getItemByObjectId(_refinerItemObjId);
|
||||
if (refinerItem == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isValid(activeChar, targetItem, refinerItem))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.THIS_IS_NOT_A_SUITABLE_ITEM);
|
||||
return;
|
||||
}
|
||||
|
||||
final int refinerItemId = refinerItem.getItem().getId();
|
||||
final CrystalType grade = targetItem.getItem().getCrystalType();
|
||||
final LifeStone ls = getLifeStone(refinerItemId);
|
||||
final int gemStoneId = getGemStoneId(grade);
|
||||
final int gemStoneCount = getGemStoneCount(grade, ls.getGrade());
|
||||
|
||||
activeChar.sendPacket(new ExPutIntensiveResultForVariationMake(_refinerItemObjId, refinerItemId, gemStoneId, gemStoneCount));
|
||||
}
|
||||
}
|
||||
|
||||
+105
-107
@@ -1,107 +1,105 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.gameserver.data.sql.impl.ClanTable;
|
||||
import com.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||
import com.l2jmobius.gameserver.model.L2Clan;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.entity.Castle;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SiegeDefenderList;
|
||||
|
||||
/**
|
||||
* This class ...
|
||||
* @version $Revision: 1.3.4.2 $ $Date: 2005/03/27 15:29:30 $
|
||||
*/
|
||||
public final class RequestConfirmSiegeWaitingList extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__AE_RequestConfirmSiegeWaitingList = "[C] AE RequestConfirmSiegeWaitingList";
|
||||
|
||||
private int _approved;
|
||||
private int _castleId;
|
||||
private int _clanId;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_castleId = readD();
|
||||
_clanId = readD();
|
||||
_approved = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the player has a clan
|
||||
if (activeChar.getClan() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final Castle castle = CastleManager.getInstance().getCastleById(_castleId);
|
||||
if (castle == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if leader of the clan who owns the castle?
|
||||
if ((castle.getOwnerId() != activeChar.getClanId()) || !activeChar.isClanLeader())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2Clan clan = ClanTable.getInstance().getClan(_clanId);
|
||||
if (clan == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!castle.getSiege().getIsRegistrationOver())
|
||||
{
|
||||
if (_approved == 1)
|
||||
{
|
||||
if (castle.getSiege().checkIsDefenderWaiting(clan))
|
||||
{
|
||||
castle.getSiege().approveSiegeDefenderClan(_clanId);
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (castle.getSiege().checkIsDefenderWaiting(clan) || castle.getSiege().checkIsDefender(clan))
|
||||
{
|
||||
castle.getSiege().removeSiegeClan(_clanId);
|
||||
}
|
||||
}
|
||||
|
||||
// Update the defender list
|
||||
activeChar.sendPacket(new SiegeDefenderList(castle));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__AE_RequestConfirmSiegeWaitingList;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.data.sql.impl.ClanTable;
|
||||
import com.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||
import com.l2jmobius.gameserver.model.L2Clan;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.entity.Castle;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SiegeDefenderList;
|
||||
|
||||
/**
|
||||
* This class ...
|
||||
* @version $Revision: 1.3.4.2 $ $Date: 2005/03/27 15:29:30 $
|
||||
*/
|
||||
public final class RequestConfirmSiegeWaitingList implements IClientIncomingPacket
|
||||
{
|
||||
private int _approved;
|
||||
private int _castleId;
|
||||
private int _clanId;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_castleId = packet.readD();
|
||||
_clanId = packet.readD();
|
||||
_approved = packet.readD();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final L2PcInstance activeChar = client.getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the player has a clan
|
||||
if (activeChar.getClan() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final Castle castle = CastleManager.getInstance().getCastleById(_castleId);
|
||||
if (castle == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if leader of the clan who owns the castle?
|
||||
if ((castle.getOwnerId() != activeChar.getClanId()) || (!activeChar.isClanLeader()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2Clan clan = ClanTable.getInstance().getClan(_clanId);
|
||||
if (clan == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!castle.getSiege().getIsRegistrationOver())
|
||||
{
|
||||
if (_approved == 1)
|
||||
{
|
||||
if (castle.getSiege().checkIsDefenderWaiting(clan))
|
||||
{
|
||||
castle.getSiege().approveSiegeDefenderClan(_clanId);
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((castle.getSiege().checkIsDefenderWaiting(clan)) || (castle.getSiege().checkIsDefender(clan)))
|
||||
{
|
||||
castle.getSiege().removeSiegeClan(_clanId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update the defender list
|
||||
client.sendPacket(new SiegeDefenderList(castle));
|
||||
}
|
||||
}
|
||||
|
||||
+71
-75
@@ -1,75 +1,71 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExPutItemResultForVariationMake;
|
||||
|
||||
/**
|
||||
* Format:(ch) d
|
||||
* @author -Wooden-
|
||||
*/
|
||||
public final class RequestConfirmTargetItem extends AbstractRefinePacket
|
||||
{
|
||||
private static final String _C__D0_26_REQUESTCONFIRMTARGETITEM = "[C] D0:26 RequestConfirmTargetItem";
|
||||
private int _itemObjId;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_itemObjId = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2ItemInstance item = activeChar.getInventory().getItemByObjectId(_itemObjId);
|
||||
if (item == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isValid(activeChar, item))
|
||||
{
|
||||
// Different system message here
|
||||
if (item.isAugmented())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.ONCE_AN_ITEM_IS_AUGMENTED_IT_CANNOT_BE_AUGMENTED_AGAIN);
|
||||
return;
|
||||
}
|
||||
|
||||
activeChar.sendPacket(SystemMessageId.THIS_IS_NOT_A_SUITABLE_ITEM);
|
||||
return;
|
||||
}
|
||||
|
||||
activeChar.sendPacket(new ExPutItemResultForVariationMake(_itemObjId, item.getId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_26_REQUESTCONFIRMTARGETITEM;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.client.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExPutItemResultForVariationMake;
|
||||
|
||||
/**
|
||||
* Format:(ch) d
|
||||
* @author -Wooden-
|
||||
*/
|
||||
public final class RequestConfirmTargetItem extends AbstractRefinePacket
|
||||
{
|
||||
private int _itemObjId;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_itemObjId = packet.readD();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(L2GameClient client)
|
||||
{
|
||||
final L2PcInstance activeChar = client.getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2ItemInstance item = activeChar.getInventory().getItemByObjectId(_itemObjId);
|
||||
if (item == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isValid(activeChar, item))
|
||||
{
|
||||
// Different system message here
|
||||
if (item.isAugmented())
|
||||
{
|
||||
client.sendPacket(SystemMessageId.ONCE_AN_ITEM_IS_AUGMENTED_IT_CANNOT_BE_AUGMENTED_AGAIN);
|
||||
return;
|
||||
}
|
||||
|
||||
client.sendPacket(SystemMessageId.THIS_IS_NOT_A_SUITABLE_ITEM);
|
||||
return;
|
||||
}
|
||||
|
||||
client.sendPacket(new ExPutItemResultForVariationMake(_itemObjId, item.getId()));
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user