Player info related packets with delay locks.
This commit is contained in:
parent
a5f2203a9f
commit
3427bfc71a
@ -41,6 +41,7 @@ import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.concurrent.locks.StampedLock;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -719,7 +720,10 @@ public class PlayerInstance extends Playable
|
||||
private ScheduledFuture<?> _taskRentPet;
|
||||
private ScheduledFuture<?> _taskWater;
|
||||
|
||||
private ScheduledFuture<?> _skillListRefreshTask;
|
||||
/** Packet delay locks */
|
||||
private final StampedLock _skillListPacketLock = new StampedLock();
|
||||
private final StampedLock _userInfoPacketLock = new StampedLock();
|
||||
private final StampedLock _storageMaxPacketLock = new StampedLock();
|
||||
|
||||
/** Last Html Npcs, 0 = last html was not bound to an npc */
|
||||
private final int[] _htmlActionOriginObjectIds = new int[HtmlActionScope.values().length];
|
||||
@ -2250,6 +2254,16 @@ public class PlayerInstance extends Playable
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerEquipItem(this, item), this);
|
||||
}
|
||||
|
||||
public boolean setStorageMaxCountPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _storageMaxPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_storageMaxPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the the PvP Kills of the PlayerInstance (Number of player killed during a PvP).
|
||||
*/
|
||||
@ -4115,6 +4129,16 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
}
|
||||
|
||||
public boolean setUserInfoPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _userInfoPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_userInfoPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a Server->Client packet UserInfo to this PlayerInstance and CharInfo to all PlayerInstance in its _KnownPlayers. <B><U> Concept</U> :</B> Others PlayerInstance in the detection area of the PlayerInstance are identified in <B>_knownPlayers</B>. In order to inform other players of this
|
||||
* PlayerInstance state modifications, server just need to go through _knownPlayers to send Server->Client Packet <B><U> Actions</U> :</B>
|
||||
@ -9539,16 +9563,19 @@ public class PlayerInstance extends Playable
|
||||
return _wantsPeace;
|
||||
}
|
||||
|
||||
public boolean setSkillListPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _skillListPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_skillListPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
public void sendSkillList()
|
||||
{
|
||||
if (_skillListRefreshTask == null)
|
||||
{
|
||||
_skillListRefreshTask = ThreadPool.schedule(() ->
|
||||
{
|
||||
sendSkillList(0);
|
||||
_skillListRefreshTask = null;
|
||||
}, 1000);
|
||||
}
|
||||
sendSkillList(0);
|
||||
}
|
||||
|
||||
public void sendSkillList(int lastLearnedSkillId)
|
||||
@ -9952,8 +9979,15 @@ public class PlayerInstance extends Playable
|
||||
removeSkill(oldSkill, false, true);
|
||||
}
|
||||
|
||||
stopAllEffectsExceptThoseThatLastThroughDeath();
|
||||
stopAllEffects();
|
||||
// stopAllEffectsExceptThoseThatLastThroughDeath();
|
||||
getEffectList().stopEffects(info -> !info.getSkill().isStayAfterDeath(), true, false);
|
||||
|
||||
// stopAllEffects();
|
||||
getEffectList().stopEffects(info -> !info.getSkill().isNecessaryToggle() && !info.getSkill().isIrreplacableBuff(), true, false);
|
||||
|
||||
// Update abnormal visual effects.
|
||||
sendPacket(new ExUserInfoAbnormalVisualEffect(this));
|
||||
|
||||
stopCubics();
|
||||
|
||||
restoreRecipeBook(false);
|
||||
|
@ -20,6 +20,7 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
|
||||
import org.l2jmobius.gameserver.model.SkillLearn;
|
||||
@ -33,19 +34,32 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
*/
|
||||
public class AcquireSkillList implements IClientOutgoingPacket
|
||||
{
|
||||
final PlayerInstance _player;
|
||||
final List<SkillLearn> _learnable;
|
||||
private PlayerInstance _player;
|
||||
private List<SkillLearn> _learnable;
|
||||
|
||||
public AcquireSkillList(PlayerInstance player)
|
||||
{
|
||||
_player = player;
|
||||
_learnable = SkillTreesData.getInstance().getAvailableSkills(player, player.getClassId(), false, false);
|
||||
_learnable.addAll(SkillTreesData.getInstance().getNextAvailableSkills(player, player.getClassId(), false, false));
|
||||
if (player.setSkillListPacketLock(true))
|
||||
{
|
||||
_player = player;
|
||||
_learnable = SkillTreesData.getInstance().getAvailableSkills(player, player.getClassId(), false, false);
|
||||
_learnable.addAll(SkillTreesData.getInstance().getNextAvailableSkills(player, player.getClassId(), false, false));
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setSkillListPacketLock(false);
|
||||
}, 300);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.ACQUIRE_SKILL_LIST.writeId(packet);
|
||||
|
||||
packet.writeH(_learnable.size());
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.Stats;
|
||||
@ -27,34 +28,49 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
*/
|
||||
public class ExStorageMaxCount implements IClientOutgoingPacket
|
||||
{
|
||||
private final int _inventory;
|
||||
private final int _warehouse;
|
||||
private final int _freight;
|
||||
private final int _clan;
|
||||
private final int _privateSell;
|
||||
private final int _privateBuy;
|
||||
private final int _receipeD;
|
||||
private final int _recipe;
|
||||
private final int _inventoryExtraSlots;
|
||||
private final int _inventoryQuestItems;
|
||||
private PlayerInstance _player;
|
||||
private int _inventory;
|
||||
private int _warehouse;
|
||||
private int _freight;
|
||||
private int _clan;
|
||||
private int _privateSell;
|
||||
private int _privateBuy;
|
||||
private int _receipeD;
|
||||
private int _recipe;
|
||||
private int _inventoryExtraSlots;
|
||||
private int _inventoryQuestItems;
|
||||
|
||||
public ExStorageMaxCount(PlayerInstance player)
|
||||
{
|
||||
_inventory = player.getInventoryLimit();
|
||||
_warehouse = player.getWareHouseLimit();
|
||||
_freight = Config.ALT_FREIGHT_SLOTS;
|
||||
_privateSell = player.getPrivateSellStoreLimit();
|
||||
_privateBuy = player.getPrivateBuyStoreLimit();
|
||||
_clan = Config.WAREHOUSE_SLOTS_CLAN;
|
||||
_receipeD = player.getDwarfRecipeLimit();
|
||||
_recipe = player.getCommonRecipeLimit();
|
||||
_inventoryExtraSlots = (int) player.getStat().getValue(Stats.INVENTORY_NORMAL, 0);
|
||||
_inventoryQuestItems = Config.INVENTORY_MAXIMUM_QUEST_ITEMS;
|
||||
if (player.setStorageMaxCountPacketLock(true))
|
||||
{
|
||||
_player = player;
|
||||
_inventory = player.getInventoryLimit();
|
||||
_warehouse = player.getWareHouseLimit();
|
||||
_freight = Config.ALT_FREIGHT_SLOTS;
|
||||
_privateSell = player.getPrivateSellStoreLimit();
|
||||
_privateBuy = player.getPrivateBuyStoreLimit();
|
||||
_clan = Config.WAREHOUSE_SLOTS_CLAN;
|
||||
_receipeD = player.getDwarfRecipeLimit();
|
||||
_recipe = player.getCommonRecipeLimit();
|
||||
_inventoryExtraSlots = (int) player.getStat().getValue(Stats.INVENTORY_NORMAL, 0);
|
||||
_inventoryQuestItems = Config.INVENTORY_MAXIMUM_QUEST_ITEMS;
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setStorageMaxCountPacketLock(false);
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.EX_STORAGE_MAX_COUNT.writeId(packet);
|
||||
|
||||
packet.writeD(_inventory);
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ExperienceData;
|
||||
import org.l2jmobius.gameserver.enums.AttributeType;
|
||||
@ -34,20 +35,20 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
*/
|
||||
public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
{
|
||||
private final PlayerInstance _player;
|
||||
private PlayerInstance _player;
|
||||
|
||||
private final int _relation;
|
||||
private final int _runSpd;
|
||||
private final int _walkSpd;
|
||||
private final int _swimRunSpd;
|
||||
private final int _swimWalkSpd;
|
||||
private int _relation;
|
||||
private int _runSpd;
|
||||
private int _walkSpd;
|
||||
private int _swimRunSpd;
|
||||
private int _swimWalkSpd;
|
||||
private final int _flRunSpd = 0;
|
||||
private final int _flWalkSpd = 0;
|
||||
private final int _flyRunSpd;
|
||||
private final int _flyWalkSpd;
|
||||
private final double _moveMultiplier;
|
||||
private final int _enchantLevel;
|
||||
private final int _armorEnchant;
|
||||
private int _flyRunSpd;
|
||||
private int _flyWalkSpd;
|
||||
private double _moveMultiplier;
|
||||
private int _enchantLevel;
|
||||
private int _armorEnchant;
|
||||
private String _title;
|
||||
|
||||
private final byte[] _masks = new byte[]
|
||||
@ -60,11 +61,6 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
private int _initSize = 5;
|
||||
|
||||
public UserInfo(PlayerInstance player)
|
||||
{
|
||||
this(player, true);
|
||||
}
|
||||
|
||||
public UserInfo(PlayerInstance player, boolean addAll)
|
||||
{
|
||||
_player = player;
|
||||
|
||||
@ -85,9 +81,41 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
_title = "[Invisible]";
|
||||
}
|
||||
|
||||
if (addAll)
|
||||
addComponentType(UserInfoType.values());
|
||||
}
|
||||
|
||||
public UserInfo(PlayerInstance player, boolean addAll)
|
||||
{
|
||||
if (player.setUserInfoPacketLock(true))
|
||||
{
|
||||
addComponentType(UserInfoType.values());
|
||||
_player = player;
|
||||
|
||||
_relation = calculateRelation(player);
|
||||
_moveMultiplier = player.getMovementSpeedMultiplier();
|
||||
_runSpd = (int) Math.round(player.getRunSpeed() / _moveMultiplier);
|
||||
_walkSpd = (int) Math.round(player.getWalkSpeed() / _moveMultiplier);
|
||||
_swimRunSpd = (int) Math.round(player.getSwimRunSpeed() / _moveMultiplier);
|
||||
_swimWalkSpd = (int) Math.round(player.getSwimWalkSpeed() / _moveMultiplier);
|
||||
_flyRunSpd = player.isFlying() ? _runSpd : 0;
|
||||
_flyWalkSpd = player.isFlying() ? _walkSpd : 0;
|
||||
_enchantLevel = player.getInventory().getWeaponEnchant();
|
||||
_armorEnchant = player.getInventory().getArmorMinEnchant();
|
||||
|
||||
_title = player.getTitle();
|
||||
if (player.isGM() && player.isInvisible())
|
||||
{
|
||||
_title = "[Invisible]";
|
||||
}
|
||||
|
||||
if (addAll)
|
||||
{
|
||||
addComponentType(UserInfoType.values());
|
||||
}
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setUserInfoPacketLock(false);
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@ -128,6 +156,11 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.USER_INFO.writeId(packet);
|
||||
|
||||
packet.writeD(_player.getObjectId());
|
||||
|
@ -41,6 +41,7 @@ import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.concurrent.locks.StampedLock;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -721,7 +722,10 @@ public class PlayerInstance extends Playable
|
||||
private ScheduledFuture<?> _taskRentPet;
|
||||
private ScheduledFuture<?> _taskWater;
|
||||
|
||||
private ScheduledFuture<?> _skillListRefreshTask;
|
||||
/** Packet delay locks */
|
||||
private final StampedLock _skillListPacketLock = new StampedLock();
|
||||
private final StampedLock _userInfoPacketLock = new StampedLock();
|
||||
private final StampedLock _storageMaxPacketLock = new StampedLock();
|
||||
|
||||
/** Last Html Npcs, 0 = last html was not bound to an npc */
|
||||
private final int[] _htmlActionOriginObjectIds = new int[HtmlActionScope.values().length];
|
||||
@ -2256,6 +2260,16 @@ public class PlayerInstance extends Playable
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerEquipItem(this, item), this);
|
||||
}
|
||||
|
||||
public boolean setStorageMaxCountPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _storageMaxPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_storageMaxPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the the PvP Kills of the PlayerInstance (Number of player killed during a PvP).
|
||||
*/
|
||||
@ -4121,6 +4135,16 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
}
|
||||
|
||||
public boolean setUserInfoPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _userInfoPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_userInfoPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a Server->Client packet UserInfo to this PlayerInstance and CharInfo to all PlayerInstance in its _KnownPlayers. <B><U> Concept</U> :</B> Others PlayerInstance in the detection area of the PlayerInstance are identified in <B>_knownPlayers</B>. In order to inform other players of this
|
||||
* PlayerInstance state modifications, server just need to go through _knownPlayers to send Server->Client Packet <B><U> Actions</U> :</B>
|
||||
@ -9546,16 +9570,19 @@ public class PlayerInstance extends Playable
|
||||
return _wantsPeace;
|
||||
}
|
||||
|
||||
public boolean setSkillListPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _skillListPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_skillListPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
public void sendSkillList()
|
||||
{
|
||||
if (_skillListRefreshTask == null)
|
||||
{
|
||||
_skillListRefreshTask = ThreadPool.schedule(() ->
|
||||
{
|
||||
sendSkillList(0);
|
||||
_skillListRefreshTask = null;
|
||||
}, 1000);
|
||||
}
|
||||
sendSkillList(0);
|
||||
}
|
||||
|
||||
public void sendSkillList(int lastLearnedSkillId)
|
||||
@ -9959,8 +9986,15 @@ public class PlayerInstance extends Playable
|
||||
removeSkill(oldSkill, false, true);
|
||||
}
|
||||
|
||||
stopAllEffectsExceptThoseThatLastThroughDeath();
|
||||
stopAllEffects();
|
||||
// stopAllEffectsExceptThoseThatLastThroughDeath();
|
||||
getEffectList().stopEffects(info -> !info.getSkill().isStayAfterDeath(), true, false);
|
||||
|
||||
// stopAllEffects();
|
||||
getEffectList().stopEffects(info -> !info.getSkill().isNecessaryToggle() && !info.getSkill().isIrreplacableBuff(), true, false);
|
||||
|
||||
// Update abnormal visual effects.
|
||||
sendPacket(new ExUserInfoAbnormalVisualEffect(this));
|
||||
|
||||
stopCubics();
|
||||
|
||||
restoreRecipeBook(false);
|
||||
|
@ -20,6 +20,7 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
|
||||
import org.l2jmobius.gameserver.model.SkillLearn;
|
||||
@ -33,19 +34,32 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
*/
|
||||
public class AcquireSkillList implements IClientOutgoingPacket
|
||||
{
|
||||
final PlayerInstance _player;
|
||||
final List<SkillLearn> _learnable;
|
||||
private PlayerInstance _player;
|
||||
private List<SkillLearn> _learnable;
|
||||
|
||||
public AcquireSkillList(PlayerInstance player)
|
||||
{
|
||||
_player = player;
|
||||
_learnable = SkillTreesData.getInstance().getAvailableSkills(player, player.getClassId(), false, false);
|
||||
_learnable.addAll(SkillTreesData.getInstance().getNextAvailableSkills(player, player.getClassId(), false, false));
|
||||
if (player.setSkillListPacketLock(true))
|
||||
{
|
||||
_player = player;
|
||||
_learnable = SkillTreesData.getInstance().getAvailableSkills(player, player.getClassId(), false, false);
|
||||
_learnable.addAll(SkillTreesData.getInstance().getNextAvailableSkills(player, player.getClassId(), false, false));
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setSkillListPacketLock(false);
|
||||
}, 300);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.ACQUIRE_SKILL_LIST.writeId(packet);
|
||||
|
||||
packet.writeH(_learnable.size());
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.Stats;
|
||||
@ -27,34 +28,49 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
*/
|
||||
public class ExStorageMaxCount implements IClientOutgoingPacket
|
||||
{
|
||||
private final int _inventory;
|
||||
private final int _warehouse;
|
||||
private final int _freight;
|
||||
private final int _clan;
|
||||
private final int _privateSell;
|
||||
private final int _privateBuy;
|
||||
private final int _receipeD;
|
||||
private final int _recipe;
|
||||
private final int _inventoryExtraSlots;
|
||||
private final int _inventoryQuestItems;
|
||||
private PlayerInstance _player;
|
||||
private int _inventory;
|
||||
private int _warehouse;
|
||||
private int _freight;
|
||||
private int _clan;
|
||||
private int _privateSell;
|
||||
private int _privateBuy;
|
||||
private int _receipeD;
|
||||
private int _recipe;
|
||||
private int _inventoryExtraSlots;
|
||||
private int _inventoryQuestItems;
|
||||
|
||||
public ExStorageMaxCount(PlayerInstance player)
|
||||
{
|
||||
_inventory = player.getInventoryLimit();
|
||||
_warehouse = player.getWareHouseLimit();
|
||||
_freight = Config.ALT_FREIGHT_SLOTS;
|
||||
_privateSell = player.getPrivateSellStoreLimit();
|
||||
_privateBuy = player.getPrivateBuyStoreLimit();
|
||||
_clan = Config.WAREHOUSE_SLOTS_CLAN;
|
||||
_receipeD = player.getDwarfRecipeLimit();
|
||||
_recipe = player.getCommonRecipeLimit();
|
||||
_inventoryExtraSlots = (int) player.getStat().getValue(Stats.INVENTORY_NORMAL, 0);
|
||||
_inventoryQuestItems = Config.INVENTORY_MAXIMUM_QUEST_ITEMS;
|
||||
if (player.setStorageMaxCountPacketLock(true))
|
||||
{
|
||||
_player = player;
|
||||
_inventory = player.getInventoryLimit();
|
||||
_warehouse = player.getWareHouseLimit();
|
||||
_freight = Config.ALT_FREIGHT_SLOTS;
|
||||
_privateSell = player.getPrivateSellStoreLimit();
|
||||
_privateBuy = player.getPrivateBuyStoreLimit();
|
||||
_clan = Config.WAREHOUSE_SLOTS_CLAN;
|
||||
_receipeD = player.getDwarfRecipeLimit();
|
||||
_recipe = player.getCommonRecipeLimit();
|
||||
_inventoryExtraSlots = (int) player.getStat().getValue(Stats.INVENTORY_NORMAL, 0);
|
||||
_inventoryQuestItems = Config.INVENTORY_MAXIMUM_QUEST_ITEMS;
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setStorageMaxCountPacketLock(false);
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.EX_STORAGE_MAX_COUNT.writeId(packet);
|
||||
|
||||
packet.writeD(_inventory);
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ExperienceData;
|
||||
import org.l2jmobius.gameserver.enums.AttributeType;
|
||||
@ -34,20 +35,20 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
*/
|
||||
public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
{
|
||||
private final PlayerInstance _player;
|
||||
private PlayerInstance _player;
|
||||
|
||||
private final int _relation;
|
||||
private final int _runSpd;
|
||||
private final int _walkSpd;
|
||||
private final int _swimRunSpd;
|
||||
private final int _swimWalkSpd;
|
||||
private int _relation;
|
||||
private int _runSpd;
|
||||
private int _walkSpd;
|
||||
private int _swimRunSpd;
|
||||
private int _swimWalkSpd;
|
||||
private final int _flRunSpd = 0;
|
||||
private final int _flWalkSpd = 0;
|
||||
private final int _flyRunSpd;
|
||||
private final int _flyWalkSpd;
|
||||
private final double _moveMultiplier;
|
||||
private final int _enchantLevel;
|
||||
private final int _armorEnchant;
|
||||
private int _flyRunSpd;
|
||||
private int _flyWalkSpd;
|
||||
private double _moveMultiplier;
|
||||
private int _enchantLevel;
|
||||
private int _armorEnchant;
|
||||
private String _title;
|
||||
|
||||
private final byte[] _masks = new byte[]
|
||||
@ -60,11 +61,6 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
private int _initSize = 5;
|
||||
|
||||
public UserInfo(PlayerInstance player)
|
||||
{
|
||||
this(player, true);
|
||||
}
|
||||
|
||||
public UserInfo(PlayerInstance player, boolean addAll)
|
||||
{
|
||||
_player = player;
|
||||
|
||||
@ -85,9 +81,41 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
_title = "[Invisible]";
|
||||
}
|
||||
|
||||
if (addAll)
|
||||
addComponentType(UserInfoType.values());
|
||||
}
|
||||
|
||||
public UserInfo(PlayerInstance player, boolean addAll)
|
||||
{
|
||||
if (player.setUserInfoPacketLock(true))
|
||||
{
|
||||
addComponentType(UserInfoType.values());
|
||||
_player = player;
|
||||
|
||||
_relation = calculateRelation(player);
|
||||
_moveMultiplier = player.getMovementSpeedMultiplier();
|
||||
_runSpd = (int) Math.round(player.getRunSpeed() / _moveMultiplier);
|
||||
_walkSpd = (int) Math.round(player.getWalkSpeed() / _moveMultiplier);
|
||||
_swimRunSpd = (int) Math.round(player.getSwimRunSpeed() / _moveMultiplier);
|
||||
_swimWalkSpd = (int) Math.round(player.getSwimWalkSpeed() / _moveMultiplier);
|
||||
_flyRunSpd = player.isFlying() ? _runSpd : 0;
|
||||
_flyWalkSpd = player.isFlying() ? _walkSpd : 0;
|
||||
_enchantLevel = player.getInventory().getWeaponEnchant();
|
||||
_armorEnchant = player.getInventory().getArmorMinEnchant();
|
||||
|
||||
_title = player.getTitle();
|
||||
if (player.isGM() && player.isInvisible())
|
||||
{
|
||||
_title = "[Invisible]";
|
||||
}
|
||||
|
||||
if (addAll)
|
||||
{
|
||||
addComponentType(UserInfoType.values());
|
||||
}
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setUserInfoPacketLock(false);
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@ -128,6 +156,11 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.USER_INFO.writeId(packet);
|
||||
|
||||
packet.writeD(_player.getObjectId());
|
||||
|
@ -41,6 +41,7 @@ import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.concurrent.locks.StampedLock;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -723,7 +724,10 @@ public class PlayerInstance extends Playable
|
||||
private ScheduledFuture<?> _taskRentPet;
|
||||
private ScheduledFuture<?> _taskWater;
|
||||
|
||||
private ScheduledFuture<?> _skillListRefreshTask;
|
||||
/** Packet delay locks */
|
||||
private final StampedLock _skillListPacketLock = new StampedLock();
|
||||
private final StampedLock _userInfoPacketLock = new StampedLock();
|
||||
private final StampedLock _storageMaxPacketLock = new StampedLock();
|
||||
|
||||
/** Last Html Npcs, 0 = last html was not bound to an npc */
|
||||
private final int[] _htmlActionOriginObjectIds = new int[HtmlActionScope.values().length];
|
||||
@ -2258,6 +2262,16 @@ public class PlayerInstance extends Playable
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerEquipItem(this, item), this);
|
||||
}
|
||||
|
||||
public boolean setStorageMaxCountPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _storageMaxPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_storageMaxPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the the PvP Kills of the PlayerInstance (Number of player killed during a PvP).
|
||||
*/
|
||||
@ -4123,6 +4137,16 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
}
|
||||
|
||||
public boolean setUserInfoPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _userInfoPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_userInfoPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a Server->Client packet UserInfo to this PlayerInstance and CharInfo to all PlayerInstance in its _KnownPlayers. <B><U> Concept</U> :</B> Others PlayerInstance in the detection area of the PlayerInstance are identified in <B>_knownPlayers</B>. In order to inform other players of this
|
||||
* PlayerInstance state modifications, server just need to go through _knownPlayers to send Server->Client Packet <B><U> Actions</U> :</B>
|
||||
@ -9548,16 +9572,19 @@ public class PlayerInstance extends Playable
|
||||
return _wantsPeace;
|
||||
}
|
||||
|
||||
public boolean setSkillListPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _skillListPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_skillListPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
public void sendSkillList()
|
||||
{
|
||||
if (_skillListRefreshTask == null)
|
||||
{
|
||||
_skillListRefreshTask = ThreadPool.schedule(() ->
|
||||
{
|
||||
sendSkillList(0);
|
||||
_skillListRefreshTask = null;
|
||||
}, 1000);
|
||||
}
|
||||
sendSkillList(0);
|
||||
}
|
||||
|
||||
public void sendSkillList(int lastLearnedSkillId)
|
||||
@ -9961,8 +9988,15 @@ public class PlayerInstance extends Playable
|
||||
removeSkill(oldSkill, false, true);
|
||||
}
|
||||
|
||||
stopAllEffectsExceptThoseThatLastThroughDeath();
|
||||
stopAllEffects();
|
||||
// stopAllEffectsExceptThoseThatLastThroughDeath();
|
||||
getEffectList().stopEffects(info -> !info.getSkill().isStayAfterDeath(), true, false);
|
||||
|
||||
// stopAllEffects();
|
||||
getEffectList().stopEffects(info -> !info.getSkill().isNecessaryToggle() && !info.getSkill().isIrreplacableBuff(), true, false);
|
||||
|
||||
// Update abnormal visual effects.
|
||||
sendPacket(new ExUserInfoAbnormalVisualEffect(this));
|
||||
|
||||
stopCubics();
|
||||
|
||||
restoreRecipeBook(false);
|
||||
|
@ -20,6 +20,7 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
|
||||
import org.l2jmobius.gameserver.model.SkillLearn;
|
||||
@ -33,19 +34,32 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
*/
|
||||
public class AcquireSkillList implements IClientOutgoingPacket
|
||||
{
|
||||
final PlayerInstance _player;
|
||||
final List<SkillLearn> _learnable;
|
||||
private PlayerInstance _player;
|
||||
private List<SkillLearn> _learnable;
|
||||
|
||||
public AcquireSkillList(PlayerInstance player)
|
||||
{
|
||||
_player = player;
|
||||
_learnable = SkillTreesData.getInstance().getAvailableSkills(player, player.getClassId(), false, false);
|
||||
_learnable.addAll(SkillTreesData.getInstance().getNextAvailableSkills(player, player.getClassId(), false, false));
|
||||
if (player.setSkillListPacketLock(true))
|
||||
{
|
||||
_player = player;
|
||||
_learnable = SkillTreesData.getInstance().getAvailableSkills(player, player.getClassId(), false, false);
|
||||
_learnable.addAll(SkillTreesData.getInstance().getNextAvailableSkills(player, player.getClassId(), false, false));
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setSkillListPacketLock(false);
|
||||
}, 300);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.ACQUIRE_SKILL_LIST.writeId(packet);
|
||||
|
||||
packet.writeH(_learnable.size());
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.Stats;
|
||||
@ -27,34 +28,49 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
*/
|
||||
public class ExStorageMaxCount implements IClientOutgoingPacket
|
||||
{
|
||||
private final int _inventory;
|
||||
private final int _warehouse;
|
||||
private final int _freight;
|
||||
private final int _clan;
|
||||
private final int _privateSell;
|
||||
private final int _privateBuy;
|
||||
private final int _receipeD;
|
||||
private final int _recipe;
|
||||
private final int _inventoryExtraSlots;
|
||||
private final int _inventoryQuestItems;
|
||||
private PlayerInstance _player;
|
||||
private int _inventory;
|
||||
private int _warehouse;
|
||||
private int _freight;
|
||||
private int _clan;
|
||||
private int _privateSell;
|
||||
private int _privateBuy;
|
||||
private int _receipeD;
|
||||
private int _recipe;
|
||||
private int _inventoryExtraSlots;
|
||||
private int _inventoryQuestItems;
|
||||
|
||||
public ExStorageMaxCount(PlayerInstance player)
|
||||
{
|
||||
_inventory = player.getInventoryLimit();
|
||||
_warehouse = player.getWareHouseLimit();
|
||||
_freight = Config.ALT_FREIGHT_SLOTS;
|
||||
_privateSell = player.getPrivateSellStoreLimit();
|
||||
_privateBuy = player.getPrivateBuyStoreLimit();
|
||||
_clan = Config.WAREHOUSE_SLOTS_CLAN;
|
||||
_receipeD = player.getDwarfRecipeLimit();
|
||||
_recipe = player.getCommonRecipeLimit();
|
||||
_inventoryExtraSlots = (int) player.getStat().getValue(Stats.INVENTORY_NORMAL, 0);
|
||||
_inventoryQuestItems = Config.INVENTORY_MAXIMUM_QUEST_ITEMS;
|
||||
if (player.setStorageMaxCountPacketLock(true))
|
||||
{
|
||||
_player = player;
|
||||
_inventory = player.getInventoryLimit();
|
||||
_warehouse = player.getWareHouseLimit();
|
||||
_freight = Config.ALT_FREIGHT_SLOTS;
|
||||
_privateSell = player.getPrivateSellStoreLimit();
|
||||
_privateBuy = player.getPrivateBuyStoreLimit();
|
||||
_clan = Config.WAREHOUSE_SLOTS_CLAN;
|
||||
_receipeD = player.getDwarfRecipeLimit();
|
||||
_recipe = player.getCommonRecipeLimit();
|
||||
_inventoryExtraSlots = (int) player.getStat().getValue(Stats.INVENTORY_NORMAL, 0);
|
||||
_inventoryQuestItems = Config.INVENTORY_MAXIMUM_QUEST_ITEMS;
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setStorageMaxCountPacketLock(false);
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.EX_STORAGE_MAX_COUNT.writeId(packet);
|
||||
|
||||
packet.writeD(_inventory);
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ExperienceData;
|
||||
import org.l2jmobius.gameserver.enums.AttributeType;
|
||||
@ -34,20 +35,20 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
*/
|
||||
public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
{
|
||||
private final PlayerInstance _player;
|
||||
private PlayerInstance _player;
|
||||
|
||||
private final int _relation;
|
||||
private final int _runSpd;
|
||||
private final int _walkSpd;
|
||||
private final int _swimRunSpd;
|
||||
private final int _swimWalkSpd;
|
||||
private int _relation;
|
||||
private int _runSpd;
|
||||
private int _walkSpd;
|
||||
private int _swimRunSpd;
|
||||
private int _swimWalkSpd;
|
||||
private final int _flRunSpd = 0;
|
||||
private final int _flWalkSpd = 0;
|
||||
private final int _flyRunSpd;
|
||||
private final int _flyWalkSpd;
|
||||
private final double _moveMultiplier;
|
||||
private final int _enchantLevel;
|
||||
private final int _armorEnchant;
|
||||
private int _flyRunSpd;
|
||||
private int _flyWalkSpd;
|
||||
private double _moveMultiplier;
|
||||
private int _enchantLevel;
|
||||
private int _armorEnchant;
|
||||
private String _title;
|
||||
|
||||
private final byte[] _masks = new byte[]
|
||||
@ -60,11 +61,6 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
private int _initSize = 5;
|
||||
|
||||
public UserInfo(PlayerInstance player)
|
||||
{
|
||||
this(player, true);
|
||||
}
|
||||
|
||||
public UserInfo(PlayerInstance player, boolean addAll)
|
||||
{
|
||||
_player = player;
|
||||
|
||||
@ -85,9 +81,41 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
_title = "[Invisible]";
|
||||
}
|
||||
|
||||
if (addAll)
|
||||
addComponentType(UserInfoType.values());
|
||||
}
|
||||
|
||||
public UserInfo(PlayerInstance player, boolean addAll)
|
||||
{
|
||||
if (player.setUserInfoPacketLock(true))
|
||||
{
|
||||
addComponentType(UserInfoType.values());
|
||||
_player = player;
|
||||
|
||||
_relation = calculateRelation(player);
|
||||
_moveMultiplier = player.getMovementSpeedMultiplier();
|
||||
_runSpd = (int) Math.round(player.getRunSpeed() / _moveMultiplier);
|
||||
_walkSpd = (int) Math.round(player.getWalkSpeed() / _moveMultiplier);
|
||||
_swimRunSpd = (int) Math.round(player.getSwimRunSpeed() / _moveMultiplier);
|
||||
_swimWalkSpd = (int) Math.round(player.getSwimWalkSpeed() / _moveMultiplier);
|
||||
_flyRunSpd = player.isFlying() ? _runSpd : 0;
|
||||
_flyWalkSpd = player.isFlying() ? _walkSpd : 0;
|
||||
_enchantLevel = player.getInventory().getWeaponEnchant();
|
||||
_armorEnchant = player.getInventory().getArmorMinEnchant();
|
||||
|
||||
_title = player.getTitle();
|
||||
if (player.isGM() && player.isInvisible())
|
||||
{
|
||||
_title = "[Invisible]";
|
||||
}
|
||||
|
||||
if (addAll)
|
||||
{
|
||||
addComponentType(UserInfoType.values());
|
||||
}
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setUserInfoPacketLock(false);
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@ -128,6 +156,11 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.USER_INFO.writeId(packet);
|
||||
|
||||
packet.writeD(_player.getObjectId());
|
||||
|
@ -40,6 +40,7 @@ import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.concurrent.locks.StampedLock;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -730,7 +731,10 @@ public class PlayerInstance extends Playable
|
||||
private ScheduledFuture<?> _taskRentPet;
|
||||
private ScheduledFuture<?> _taskWater;
|
||||
|
||||
private ScheduledFuture<?> _skillListRefreshTask;
|
||||
/** Packet delay locks */
|
||||
private final StampedLock _skillListPacketLock = new StampedLock();
|
||||
private final StampedLock _userInfoPacketLock = new StampedLock();
|
||||
private final StampedLock _storageMaxPacketLock = new StampedLock();
|
||||
|
||||
/** Last Html Npcs, 0 = last html was not bound to an npc */
|
||||
private final int[] _htmlActionOriginObjectIds = new int[HtmlActionScope.values().length];
|
||||
@ -2265,6 +2269,16 @@ public class PlayerInstance extends Playable
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerEquipItem(this, item), this);
|
||||
}
|
||||
|
||||
public boolean setStorageMaxCountPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _storageMaxPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_storageMaxPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the the PvP Kills of the PlayerInstance (Number of player killed during a PvP).
|
||||
*/
|
||||
@ -4118,6 +4132,16 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
}
|
||||
|
||||
public boolean setUserInfoPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _userInfoPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_userInfoPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a Server->Client packet UserInfo to this PlayerInstance and CharInfo to all PlayerInstance in its _KnownPlayers. <B><U> Concept</U> :</B> Others PlayerInstance in the detection area of the PlayerInstance are identified in <B>_knownPlayers</B>. In order to inform other players of this
|
||||
* PlayerInstance state modifications, server just need to go through _knownPlayers to send Server->Client Packet <B><U> Actions</U> :</B>
|
||||
@ -9539,16 +9563,19 @@ public class PlayerInstance extends Playable
|
||||
return _wantsPeace;
|
||||
}
|
||||
|
||||
public boolean setSkillListPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _skillListPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_skillListPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
public void sendSkillList()
|
||||
{
|
||||
if (_skillListRefreshTask == null)
|
||||
{
|
||||
_skillListRefreshTask = ThreadPool.schedule(() ->
|
||||
{
|
||||
sendSkillList(0);
|
||||
_skillListRefreshTask = null;
|
||||
}, 1000);
|
||||
}
|
||||
sendSkillList(0);
|
||||
}
|
||||
|
||||
public void sendSkillList(int lastLearnedSkillId)
|
||||
@ -9952,8 +9979,15 @@ public class PlayerInstance extends Playable
|
||||
removeSkill(oldSkill, false, true);
|
||||
}
|
||||
|
||||
stopAllEffectsExceptThoseThatLastThroughDeath();
|
||||
stopAllEffects();
|
||||
// stopAllEffectsExceptThoseThatLastThroughDeath();
|
||||
getEffectList().stopEffects(info -> !info.getSkill().isStayAfterDeath(), true, false);
|
||||
|
||||
// stopAllEffects();
|
||||
getEffectList().stopEffects(info -> !info.getSkill().isNecessaryToggle() && !info.getSkill().isIrreplacableBuff(), true, false);
|
||||
|
||||
// Update abnormal visual effects.
|
||||
sendPacket(new ExUserInfoAbnormalVisualEffect(this));
|
||||
|
||||
stopCubics();
|
||||
|
||||
restoreRecipeBook(false);
|
||||
|
@ -20,6 +20,7 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
|
||||
import org.l2jmobius.gameserver.model.SkillLearn;
|
||||
@ -33,19 +34,32 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
*/
|
||||
public class AcquireSkillList implements IClientOutgoingPacket
|
||||
{
|
||||
final PlayerInstance _player;
|
||||
final List<SkillLearn> _learnable;
|
||||
private PlayerInstance _player;
|
||||
private List<SkillLearn> _learnable;
|
||||
|
||||
public AcquireSkillList(PlayerInstance player)
|
||||
{
|
||||
_player = player;
|
||||
_learnable = SkillTreesData.getInstance().getAvailableSkills(player, player.getClassId(), false, false);
|
||||
_learnable.addAll(SkillTreesData.getInstance().getNextAvailableSkills(player, player.getClassId(), false, false));
|
||||
if (player.setSkillListPacketLock(true))
|
||||
{
|
||||
_player = player;
|
||||
_learnable = SkillTreesData.getInstance().getAvailableSkills(player, player.getClassId(), false, false);
|
||||
_learnable.addAll(SkillTreesData.getInstance().getNextAvailableSkills(player, player.getClassId(), false, false));
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setSkillListPacketLock(false);
|
||||
}, 300);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.ACQUIRE_SKILL_LIST.writeId(packet);
|
||||
|
||||
packet.writeH(_learnable.size());
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.Stats;
|
||||
@ -27,34 +28,49 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
*/
|
||||
public class ExStorageMaxCount implements IClientOutgoingPacket
|
||||
{
|
||||
private final int _inventory;
|
||||
private final int _warehouse;
|
||||
private final int _freight;
|
||||
private final int _clan;
|
||||
private final int _privateSell;
|
||||
private final int _privateBuy;
|
||||
private final int _receipeD;
|
||||
private final int _recipe;
|
||||
private final int _inventoryExtraSlots;
|
||||
private final int _inventoryQuestItems;
|
||||
private PlayerInstance _player;
|
||||
private int _inventory;
|
||||
private int _warehouse;
|
||||
private int _freight;
|
||||
private int _clan;
|
||||
private int _privateSell;
|
||||
private int _privateBuy;
|
||||
private int _receipeD;
|
||||
private int _recipe;
|
||||
private int _inventoryExtraSlots;
|
||||
private int _inventoryQuestItems;
|
||||
|
||||
public ExStorageMaxCount(PlayerInstance player)
|
||||
{
|
||||
_inventory = player.getInventoryLimit();
|
||||
_warehouse = player.getWareHouseLimit();
|
||||
_freight = Config.ALT_FREIGHT_SLOTS;
|
||||
_privateSell = player.getPrivateSellStoreLimit();
|
||||
_privateBuy = player.getPrivateBuyStoreLimit();
|
||||
_clan = Config.WAREHOUSE_SLOTS_CLAN;
|
||||
_receipeD = player.getDwarfRecipeLimit();
|
||||
_recipe = player.getCommonRecipeLimit();
|
||||
_inventoryExtraSlots = (int) player.getStat().getValue(Stats.INVENTORY_NORMAL, 0);
|
||||
_inventoryQuestItems = Config.INVENTORY_MAXIMUM_QUEST_ITEMS;
|
||||
if (player.setStorageMaxCountPacketLock(true))
|
||||
{
|
||||
_player = player;
|
||||
_inventory = player.getInventoryLimit();
|
||||
_warehouse = player.getWareHouseLimit();
|
||||
_freight = Config.ALT_FREIGHT_SLOTS;
|
||||
_privateSell = player.getPrivateSellStoreLimit();
|
||||
_privateBuy = player.getPrivateBuyStoreLimit();
|
||||
_clan = Config.WAREHOUSE_SLOTS_CLAN;
|
||||
_receipeD = player.getDwarfRecipeLimit();
|
||||
_recipe = player.getCommonRecipeLimit();
|
||||
_inventoryExtraSlots = (int) player.getStat().getValue(Stats.INVENTORY_NORMAL, 0);
|
||||
_inventoryQuestItems = Config.INVENTORY_MAXIMUM_QUEST_ITEMS;
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setStorageMaxCountPacketLock(false);
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.EX_STORAGE_MAX_COUNT.writeId(packet);
|
||||
|
||||
packet.writeD(_inventory);
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ExperienceData;
|
||||
import org.l2jmobius.gameserver.enums.AttributeType;
|
||||
@ -35,20 +36,20 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
*/
|
||||
public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
{
|
||||
private final PlayerInstance _player;
|
||||
private PlayerInstance _player;
|
||||
|
||||
private final int _relation;
|
||||
private final int _runSpd;
|
||||
private final int _walkSpd;
|
||||
private final int _swimRunSpd;
|
||||
private final int _swimWalkSpd;
|
||||
private int _relation;
|
||||
private int _runSpd;
|
||||
private int _walkSpd;
|
||||
private int _swimRunSpd;
|
||||
private int _swimWalkSpd;
|
||||
private final int _flRunSpd = 0;
|
||||
private final int _flWalkSpd = 0;
|
||||
private final int _flyRunSpd;
|
||||
private final int _flyWalkSpd;
|
||||
private final double _moveMultiplier;
|
||||
private final int _enchantLevel;
|
||||
private final int _armorEnchant;
|
||||
private int _flyRunSpd;
|
||||
private int _flyWalkSpd;
|
||||
private double _moveMultiplier;
|
||||
private int _enchantLevel;
|
||||
private int _armorEnchant;
|
||||
private String _title;
|
||||
|
||||
private final byte[] _masks = new byte[]
|
||||
@ -61,11 +62,6 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
private int _initSize = 5;
|
||||
|
||||
public UserInfo(PlayerInstance player)
|
||||
{
|
||||
this(player, true);
|
||||
}
|
||||
|
||||
public UserInfo(PlayerInstance player, boolean addAll)
|
||||
{
|
||||
_player = player;
|
||||
|
||||
@ -86,9 +82,41 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
_title = "[Invisible]";
|
||||
}
|
||||
|
||||
if (addAll)
|
||||
addComponentType(UserInfoType.values());
|
||||
}
|
||||
|
||||
public UserInfo(PlayerInstance player, boolean addAll)
|
||||
{
|
||||
if (player.setUserInfoPacketLock(true))
|
||||
{
|
||||
addComponentType(UserInfoType.values());
|
||||
_player = player;
|
||||
|
||||
_relation = calculateRelation(player);
|
||||
_moveMultiplier = player.getMovementSpeedMultiplier();
|
||||
_runSpd = (int) Math.round(player.getRunSpeed() / _moveMultiplier);
|
||||
_walkSpd = (int) Math.round(player.getWalkSpeed() / _moveMultiplier);
|
||||
_swimRunSpd = (int) Math.round(player.getSwimRunSpeed() / _moveMultiplier);
|
||||
_swimWalkSpd = (int) Math.round(player.getSwimWalkSpeed() / _moveMultiplier);
|
||||
_flyRunSpd = player.isFlying() ? _runSpd : 0;
|
||||
_flyWalkSpd = player.isFlying() ? _walkSpd : 0;
|
||||
_enchantLevel = player.getInventory().getWeaponEnchant();
|
||||
_armorEnchant = player.getInventory().getArmorMinEnchant();
|
||||
|
||||
_title = player.getTitle();
|
||||
if (player.isGM() && player.isInvisible())
|
||||
{
|
||||
_title = "[Invisible]";
|
||||
}
|
||||
|
||||
if (addAll)
|
||||
{
|
||||
addComponentType(UserInfoType.values());
|
||||
}
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setUserInfoPacketLock(false);
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@ -129,6 +157,11 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.USER_INFO.writeId(packet);
|
||||
|
||||
packet.writeD(_player.getObjectId());
|
||||
|
@ -40,6 +40,7 @@ import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.concurrent.locks.StampedLock;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -726,7 +727,10 @@ public class PlayerInstance extends Playable
|
||||
private ScheduledFuture<?> _taskRentPet;
|
||||
private ScheduledFuture<?> _taskWater;
|
||||
|
||||
private ScheduledFuture<?> _skillListRefreshTask;
|
||||
/** Packet delay locks */
|
||||
private final StampedLock _skillListPacketLock = new StampedLock();
|
||||
private final StampedLock _userInfoPacketLock = new StampedLock();
|
||||
private final StampedLock _storageMaxPacketLock = new StampedLock();
|
||||
|
||||
/** Last Html Npcs, 0 = last html was not bound to an npc */
|
||||
private final int[] _htmlActionOriginObjectIds = new int[HtmlActionScope.values().length];
|
||||
@ -2258,6 +2262,16 @@ public class PlayerInstance extends Playable
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerEquipItem(this, item), this);
|
||||
}
|
||||
|
||||
public boolean setStorageMaxCountPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _storageMaxPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_storageMaxPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the the PvP Kills of the PlayerInstance (Number of player killed during a PvP).
|
||||
*/
|
||||
@ -4096,6 +4110,16 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
}
|
||||
|
||||
public boolean setUserInfoPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _userInfoPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_userInfoPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a Server->Client packet UserInfo to this PlayerInstance and CharInfo to all PlayerInstance in its _KnownPlayers. <B><U> Concept</U> :</B> Others PlayerInstance in the detection area of the PlayerInstance are identified in <B>_knownPlayers</B>. In order to inform other players of this
|
||||
* PlayerInstance state modifications, server just need to go through _knownPlayers to send Server->Client Packet <B><U> Actions</U> :</B>
|
||||
@ -9525,16 +9549,19 @@ public class PlayerInstance extends Playable
|
||||
return _wantsPeace;
|
||||
}
|
||||
|
||||
public boolean setSkillListPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _skillListPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_skillListPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
public void sendSkillList()
|
||||
{
|
||||
if (_skillListRefreshTask == null)
|
||||
{
|
||||
_skillListRefreshTask = ThreadPool.schedule(() ->
|
||||
{
|
||||
sendSkillList(0);
|
||||
_skillListRefreshTask = null;
|
||||
}, 1000);
|
||||
}
|
||||
sendSkillList(0);
|
||||
}
|
||||
|
||||
public void sendSkillList(int lastLearnedSkillId)
|
||||
@ -9938,8 +9965,15 @@ public class PlayerInstance extends Playable
|
||||
removeSkill(oldSkill, false, true);
|
||||
}
|
||||
|
||||
stopAllEffectsExceptThoseThatLastThroughDeath();
|
||||
stopAllEffects();
|
||||
// stopAllEffectsExceptThoseThatLastThroughDeath();
|
||||
getEffectList().stopEffects(info -> !info.getSkill().isStayAfterDeath(), true, false);
|
||||
|
||||
// stopAllEffects();
|
||||
getEffectList().stopEffects(info -> !info.getSkill().isNecessaryToggle() && !info.getSkill().isIrreplacableBuff(), true, false);
|
||||
|
||||
// Update abnormal visual effects.
|
||||
sendPacket(new ExUserInfoAbnormalVisualEffect(this));
|
||||
|
||||
stopCubics();
|
||||
|
||||
restoreRecipeBook(false);
|
||||
|
@ -20,6 +20,7 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
|
||||
import org.l2jmobius.gameserver.model.SkillLearn;
|
||||
@ -33,19 +34,32 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
*/
|
||||
public class AcquireSkillList implements IClientOutgoingPacket
|
||||
{
|
||||
final PlayerInstance _player;
|
||||
final List<SkillLearn> _learnable;
|
||||
private PlayerInstance _player;
|
||||
private List<SkillLearn> _learnable;
|
||||
|
||||
public AcquireSkillList(PlayerInstance player)
|
||||
{
|
||||
_player = player;
|
||||
_learnable = SkillTreesData.getInstance().getAvailableSkills(player, player.getClassId(), false, false);
|
||||
_learnable.addAll(SkillTreesData.getInstance().getNextAvailableSkills(player, player.getClassId(), false, false));
|
||||
if (player.setSkillListPacketLock(true))
|
||||
{
|
||||
_player = player;
|
||||
_learnable = SkillTreesData.getInstance().getAvailableSkills(player, player.getClassId(), false, false);
|
||||
_learnable.addAll(SkillTreesData.getInstance().getNextAvailableSkills(player, player.getClassId(), false, false));
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setSkillListPacketLock(false);
|
||||
}, 300);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.ACQUIRE_SKILL_LIST.writeId(packet);
|
||||
|
||||
packet.writeH(_learnable.size());
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.Stats;
|
||||
@ -27,34 +28,49 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
*/
|
||||
public class ExStorageMaxCount implements IClientOutgoingPacket
|
||||
{
|
||||
private final int _inventory;
|
||||
private final int _warehouse;
|
||||
private final int _freight;
|
||||
private final int _clan;
|
||||
private final int _privateSell;
|
||||
private final int _privateBuy;
|
||||
private final int _receipeD;
|
||||
private final int _recipe;
|
||||
private final int _inventoryExtraSlots;
|
||||
private final int _inventoryQuestItems;
|
||||
private PlayerInstance _player;
|
||||
private int _inventory;
|
||||
private int _warehouse;
|
||||
private int _freight;
|
||||
private int _clan;
|
||||
private int _privateSell;
|
||||
private int _privateBuy;
|
||||
private int _receipeD;
|
||||
private int _recipe;
|
||||
private int _inventoryExtraSlots;
|
||||
private int _inventoryQuestItems;
|
||||
|
||||
public ExStorageMaxCount(PlayerInstance player)
|
||||
{
|
||||
_inventory = player.getInventoryLimit();
|
||||
_warehouse = player.getWareHouseLimit();
|
||||
_freight = Config.ALT_FREIGHT_SLOTS;
|
||||
_privateSell = player.getPrivateSellStoreLimit();
|
||||
_privateBuy = player.getPrivateBuyStoreLimit();
|
||||
_clan = Config.WAREHOUSE_SLOTS_CLAN;
|
||||
_receipeD = player.getDwarfRecipeLimit();
|
||||
_recipe = player.getCommonRecipeLimit();
|
||||
_inventoryExtraSlots = (int) player.getStat().getValue(Stats.INVENTORY_NORMAL, 0);
|
||||
_inventoryQuestItems = Config.INVENTORY_MAXIMUM_QUEST_ITEMS;
|
||||
if (player.setStorageMaxCountPacketLock(true))
|
||||
{
|
||||
_player = player;
|
||||
_inventory = player.getInventoryLimit();
|
||||
_warehouse = player.getWareHouseLimit();
|
||||
_freight = Config.ALT_FREIGHT_SLOTS;
|
||||
_privateSell = player.getPrivateSellStoreLimit();
|
||||
_privateBuy = player.getPrivateBuyStoreLimit();
|
||||
_clan = Config.WAREHOUSE_SLOTS_CLAN;
|
||||
_receipeD = player.getDwarfRecipeLimit();
|
||||
_recipe = player.getCommonRecipeLimit();
|
||||
_inventoryExtraSlots = (int) player.getStat().getValue(Stats.INVENTORY_NORMAL, 0);
|
||||
_inventoryQuestItems = Config.INVENTORY_MAXIMUM_QUEST_ITEMS;
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setStorageMaxCountPacketLock(false);
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.EX_STORAGE_MAX_COUNT.writeId(packet);
|
||||
|
||||
packet.writeD(_inventory);
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ExperienceData;
|
||||
import org.l2jmobius.gameserver.enums.AttributeType;
|
||||
@ -35,20 +36,20 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
*/
|
||||
public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
{
|
||||
private final PlayerInstance _player;
|
||||
private PlayerInstance _player;
|
||||
|
||||
private final int _relation;
|
||||
private final int _runSpd;
|
||||
private final int _walkSpd;
|
||||
private final int _swimRunSpd;
|
||||
private final int _swimWalkSpd;
|
||||
private int _relation;
|
||||
private int _runSpd;
|
||||
private int _walkSpd;
|
||||
private int _swimRunSpd;
|
||||
private int _swimWalkSpd;
|
||||
private final int _flRunSpd = 0;
|
||||
private final int _flWalkSpd = 0;
|
||||
private final int _flyRunSpd;
|
||||
private final int _flyWalkSpd;
|
||||
private final double _moveMultiplier;
|
||||
private final int _enchantLevel;
|
||||
private final int _armorEnchant;
|
||||
private int _flyRunSpd;
|
||||
private int _flyWalkSpd;
|
||||
private double _moveMultiplier;
|
||||
private int _enchantLevel;
|
||||
private int _armorEnchant;
|
||||
private String _title;
|
||||
|
||||
private final byte[] _masks = new byte[]
|
||||
@ -61,11 +62,6 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
private int _initSize = 5;
|
||||
|
||||
public UserInfo(PlayerInstance player)
|
||||
{
|
||||
this(player, true);
|
||||
}
|
||||
|
||||
public UserInfo(PlayerInstance player, boolean addAll)
|
||||
{
|
||||
_player = player;
|
||||
|
||||
@ -86,9 +82,41 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
_title = "[Invisible]";
|
||||
}
|
||||
|
||||
if (addAll)
|
||||
addComponentType(UserInfoType.values());
|
||||
}
|
||||
|
||||
public UserInfo(PlayerInstance player, boolean addAll)
|
||||
{
|
||||
if (player.setUserInfoPacketLock(true))
|
||||
{
|
||||
addComponentType(UserInfoType.values());
|
||||
_player = player;
|
||||
|
||||
_relation = calculateRelation(player);
|
||||
_moveMultiplier = player.getMovementSpeedMultiplier();
|
||||
_runSpd = (int) Math.round(player.getRunSpeed() / _moveMultiplier);
|
||||
_walkSpd = (int) Math.round(player.getWalkSpeed() / _moveMultiplier);
|
||||
_swimRunSpd = (int) Math.round(player.getSwimRunSpeed() / _moveMultiplier);
|
||||
_swimWalkSpd = (int) Math.round(player.getSwimWalkSpeed() / _moveMultiplier);
|
||||
_flyRunSpd = player.isFlying() ? _runSpd : 0;
|
||||
_flyWalkSpd = player.isFlying() ? _walkSpd : 0;
|
||||
_enchantLevel = player.getInventory().getWeaponEnchant();
|
||||
_armorEnchant = player.getInventory().getArmorMinEnchant();
|
||||
|
||||
_title = player.getTitle();
|
||||
if (player.isGM() && player.isInvisible())
|
||||
{
|
||||
_title = "[Invisible]";
|
||||
}
|
||||
|
||||
if (addAll)
|
||||
{
|
||||
addComponentType(UserInfoType.values());
|
||||
}
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setUserInfoPacketLock(false);
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@ -129,6 +157,11 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.USER_INFO.writeId(packet);
|
||||
|
||||
packet.writeD(_player.getObjectId());
|
||||
|
@ -40,6 +40,7 @@ import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.concurrent.locks.StampedLock;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -726,7 +727,10 @@ public class PlayerInstance extends Playable
|
||||
private ScheduledFuture<?> _taskRentPet;
|
||||
private ScheduledFuture<?> _taskWater;
|
||||
|
||||
private ScheduledFuture<?> _skillListRefreshTask;
|
||||
/** Packet delay locks */
|
||||
private final StampedLock _skillListPacketLock = new StampedLock();
|
||||
private final StampedLock _userInfoPacketLock = new StampedLock();
|
||||
private final StampedLock _storageMaxPacketLock = new StampedLock();
|
||||
|
||||
/** Last Html Npcs, 0 = last html was not bound to an npc */
|
||||
private final int[] _htmlActionOriginObjectIds = new int[HtmlActionScope.values().length];
|
||||
@ -2258,6 +2262,16 @@ public class PlayerInstance extends Playable
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerEquipItem(this, item), this);
|
||||
}
|
||||
|
||||
public boolean setStorageMaxCountPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _storageMaxPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_storageMaxPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the the PvP Kills of the PlayerInstance (Number of player killed during a PvP).
|
||||
*/
|
||||
@ -4096,6 +4110,16 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
}
|
||||
|
||||
public boolean setUserInfoPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _userInfoPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_userInfoPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a Server->Client packet UserInfo to this PlayerInstance and CharInfo to all PlayerInstance in its _KnownPlayers. <B><U> Concept</U> :</B> Others PlayerInstance in the detection area of the PlayerInstance are identified in <B>_knownPlayers</B>. In order to inform other players of this
|
||||
* PlayerInstance state modifications, server just need to go through _knownPlayers to send Server->Client Packet <B><U> Actions</U> :</B>
|
||||
@ -9525,16 +9549,19 @@ public class PlayerInstance extends Playable
|
||||
return _wantsPeace;
|
||||
}
|
||||
|
||||
public boolean setSkillListPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _skillListPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_skillListPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
public void sendSkillList()
|
||||
{
|
||||
if (_skillListRefreshTask == null)
|
||||
{
|
||||
_skillListRefreshTask = ThreadPool.schedule(() ->
|
||||
{
|
||||
sendSkillList(0);
|
||||
_skillListRefreshTask = null;
|
||||
}, 1000);
|
||||
}
|
||||
sendSkillList(0);
|
||||
}
|
||||
|
||||
public void sendSkillList(int lastLearnedSkillId)
|
||||
@ -9938,8 +9965,15 @@ public class PlayerInstance extends Playable
|
||||
removeSkill(oldSkill, false, true);
|
||||
}
|
||||
|
||||
stopAllEffectsExceptThoseThatLastThroughDeath();
|
||||
stopAllEffects();
|
||||
// stopAllEffectsExceptThoseThatLastThroughDeath();
|
||||
getEffectList().stopEffects(info -> !info.getSkill().isStayAfterDeath(), true, false);
|
||||
|
||||
// stopAllEffects();
|
||||
getEffectList().stopEffects(info -> !info.getSkill().isNecessaryToggle() && !info.getSkill().isIrreplacableBuff(), true, false);
|
||||
|
||||
// Update abnormal visual effects.
|
||||
sendPacket(new ExUserInfoAbnormalVisualEffect(this));
|
||||
|
||||
stopCubics();
|
||||
|
||||
restoreRecipeBook(false);
|
||||
|
@ -20,6 +20,7 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
|
||||
import org.l2jmobius.gameserver.model.SkillLearn;
|
||||
@ -33,19 +34,32 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
*/
|
||||
public class AcquireSkillList implements IClientOutgoingPacket
|
||||
{
|
||||
final PlayerInstance _player;
|
||||
final List<SkillLearn> _learnable;
|
||||
private PlayerInstance _player;
|
||||
private List<SkillLearn> _learnable;
|
||||
|
||||
public AcquireSkillList(PlayerInstance player)
|
||||
{
|
||||
_player = player;
|
||||
_learnable = SkillTreesData.getInstance().getAvailableSkills(player, player.getClassId(), false, false);
|
||||
_learnable.addAll(SkillTreesData.getInstance().getNextAvailableSkills(player, player.getClassId(), false, false));
|
||||
if (player.setSkillListPacketLock(true))
|
||||
{
|
||||
_player = player;
|
||||
_learnable = SkillTreesData.getInstance().getAvailableSkills(player, player.getClassId(), false, false);
|
||||
_learnable.addAll(SkillTreesData.getInstance().getNextAvailableSkills(player, player.getClassId(), false, false));
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setSkillListPacketLock(false);
|
||||
}, 300);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.ACQUIRE_SKILL_LIST.writeId(packet);
|
||||
|
||||
packet.writeH(_learnable.size());
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.Stats;
|
||||
@ -27,34 +28,49 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
*/
|
||||
public class ExStorageMaxCount implements IClientOutgoingPacket
|
||||
{
|
||||
private final int _inventory;
|
||||
private final int _warehouse;
|
||||
// private final int _freight; // Removed with 152.
|
||||
private final int _clan;
|
||||
private final int _privateSell;
|
||||
private final int _privateBuy;
|
||||
private final int _receipeD;
|
||||
private final int _recipe;
|
||||
private final int _inventoryExtraSlots;
|
||||
private final int _inventoryQuestItems;
|
||||
private PlayerInstance _player;
|
||||
private int _inventory;
|
||||
private int _warehouse;
|
||||
// private int _freight; // Removed with 152.
|
||||
private int _clan;
|
||||
private int _privateSell;
|
||||
private int _privateBuy;
|
||||
private int _receipeD;
|
||||
private int _recipe;
|
||||
private int _inventoryExtraSlots;
|
||||
private int _inventoryQuestItems;
|
||||
|
||||
public ExStorageMaxCount(PlayerInstance player)
|
||||
{
|
||||
_inventory = player.getInventoryLimit();
|
||||
_warehouse = player.getWareHouseLimit();
|
||||
// _freight = Config.ALT_FREIGHT_SLOTS; // Removed with 152.
|
||||
_privateSell = player.getPrivateSellStoreLimit();
|
||||
_privateBuy = player.getPrivateBuyStoreLimit();
|
||||
_clan = Config.WAREHOUSE_SLOTS_CLAN;
|
||||
_receipeD = player.getDwarfRecipeLimit();
|
||||
_recipe = player.getCommonRecipeLimit();
|
||||
_inventoryExtraSlots = (int) player.getStat().getValue(Stats.INVENTORY_NORMAL, 0);
|
||||
_inventoryQuestItems = Config.INVENTORY_MAXIMUM_QUEST_ITEMS;
|
||||
if (player.setStorageMaxCountPacketLock(true))
|
||||
{
|
||||
_player = player;
|
||||
_inventory = player.getInventoryLimit();
|
||||
_warehouse = player.getWareHouseLimit();
|
||||
// _freight = Config.ALT_FREIGHT_SLOTS; // Removed with 152.
|
||||
_privateSell = player.getPrivateSellStoreLimit();
|
||||
_privateBuy = player.getPrivateBuyStoreLimit();
|
||||
_clan = Config.WAREHOUSE_SLOTS_CLAN;
|
||||
_receipeD = player.getDwarfRecipeLimit();
|
||||
_recipe = player.getCommonRecipeLimit();
|
||||
_inventoryExtraSlots = (int) player.getStat().getValue(Stats.INVENTORY_NORMAL, 0);
|
||||
_inventoryQuestItems = Config.INVENTORY_MAXIMUM_QUEST_ITEMS;
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setStorageMaxCountPacketLock(false);
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.EX_STORAGE_MAX_COUNT.writeId(packet);
|
||||
|
||||
packet.writeD(_inventory);
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ExperienceData;
|
||||
import org.l2jmobius.gameserver.enums.AttributeType;
|
||||
@ -35,20 +36,20 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
*/
|
||||
public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
{
|
||||
private final PlayerInstance _player;
|
||||
private PlayerInstance _player;
|
||||
|
||||
private final int _relation;
|
||||
private final int _runSpd;
|
||||
private final int _walkSpd;
|
||||
private final int _swimRunSpd;
|
||||
private final int _swimWalkSpd;
|
||||
private int _relation;
|
||||
private int _runSpd;
|
||||
private int _walkSpd;
|
||||
private int _swimRunSpd;
|
||||
private int _swimWalkSpd;
|
||||
private final int _flRunSpd = 0;
|
||||
private final int _flWalkSpd = 0;
|
||||
private final int _flyRunSpd;
|
||||
private final int _flyWalkSpd;
|
||||
private final double _moveMultiplier;
|
||||
private final int _enchantLevel;
|
||||
private final int _armorEnchant;
|
||||
private int _flyRunSpd;
|
||||
private int _flyWalkSpd;
|
||||
private double _moveMultiplier;
|
||||
private int _enchantLevel;
|
||||
private int _armorEnchant;
|
||||
private String _title;
|
||||
|
||||
private final byte[] _masks = new byte[]
|
||||
@ -61,11 +62,6 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
private int _initSize = 5;
|
||||
|
||||
public UserInfo(PlayerInstance player)
|
||||
{
|
||||
this(player, true);
|
||||
}
|
||||
|
||||
public UserInfo(PlayerInstance player, boolean addAll)
|
||||
{
|
||||
_player = player;
|
||||
|
||||
@ -86,9 +82,41 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
_title = "[Invisible]";
|
||||
}
|
||||
|
||||
if (addAll)
|
||||
addComponentType(UserInfoType.values());
|
||||
}
|
||||
|
||||
public UserInfo(PlayerInstance player, boolean addAll)
|
||||
{
|
||||
if (player.setUserInfoPacketLock(true))
|
||||
{
|
||||
addComponentType(UserInfoType.values());
|
||||
_player = player;
|
||||
|
||||
_relation = calculateRelation(player);
|
||||
_moveMultiplier = player.getMovementSpeedMultiplier();
|
||||
_runSpd = (int) Math.round(player.getRunSpeed() / _moveMultiplier);
|
||||
_walkSpd = (int) Math.round(player.getWalkSpeed() / _moveMultiplier);
|
||||
_swimRunSpd = (int) Math.round(player.getSwimRunSpeed() / _moveMultiplier);
|
||||
_swimWalkSpd = (int) Math.round(player.getSwimWalkSpeed() / _moveMultiplier);
|
||||
_flyRunSpd = player.isFlying() ? _runSpd : 0;
|
||||
_flyWalkSpd = player.isFlying() ? _walkSpd : 0;
|
||||
_enchantLevel = player.getInventory().getWeaponEnchant();
|
||||
_armorEnchant = player.getInventory().getArmorMinEnchant();
|
||||
|
||||
_title = player.getTitle();
|
||||
if (player.isGM() && player.isInvisible())
|
||||
{
|
||||
_title = "[Invisible]";
|
||||
}
|
||||
|
||||
if (addAll)
|
||||
{
|
||||
addComponentType(UserInfoType.values());
|
||||
}
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setUserInfoPacketLock(false);
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@ -129,6 +157,11 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.USER_INFO.writeId(packet);
|
||||
|
||||
packet.writeD(_player.getObjectId());
|
||||
|
@ -40,6 +40,7 @@ import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.concurrent.locks.StampedLock;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -726,7 +727,10 @@ public class PlayerInstance extends Playable
|
||||
private ScheduledFuture<?> _taskRentPet;
|
||||
private ScheduledFuture<?> _taskWater;
|
||||
|
||||
private ScheduledFuture<?> _skillListRefreshTask;
|
||||
/** Packet delay locks */
|
||||
private final StampedLock _skillListPacketLock = new StampedLock();
|
||||
private final StampedLock _userInfoPacketLock = new StampedLock();
|
||||
private final StampedLock _storageMaxPacketLock = new StampedLock();
|
||||
|
||||
/** Last Html Npcs, 0 = last html was not bound to an npc */
|
||||
private final int[] _htmlActionOriginObjectIds = new int[HtmlActionScope.values().length];
|
||||
@ -2258,6 +2262,16 @@ public class PlayerInstance extends Playable
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerEquipItem(this, item), this);
|
||||
}
|
||||
|
||||
public boolean setStorageMaxCountPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _storageMaxPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_storageMaxPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the the PvP Kills of the PlayerInstance (Number of player killed during a PvP).
|
||||
*/
|
||||
@ -4097,6 +4111,16 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
}
|
||||
|
||||
public boolean setUserInfoPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _userInfoPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_userInfoPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a Server->Client packet UserInfo to this PlayerInstance and CharInfo to all PlayerInstance in its _KnownPlayers. <B><U> Concept</U> :</B> Others PlayerInstance in the detection area of the PlayerInstance are identified in <B>_knownPlayers</B>. In order to inform other players of this
|
||||
* PlayerInstance state modifications, server just need to go through _knownPlayers to send Server->Client Packet <B><U> Actions</U> :</B>
|
||||
@ -9526,16 +9550,19 @@ public class PlayerInstance extends Playable
|
||||
return _wantsPeace;
|
||||
}
|
||||
|
||||
public boolean setSkillListPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _skillListPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_skillListPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
public void sendSkillList()
|
||||
{
|
||||
if (_skillListRefreshTask == null)
|
||||
{
|
||||
_skillListRefreshTask = ThreadPool.schedule(() ->
|
||||
{
|
||||
sendSkillList(0);
|
||||
_skillListRefreshTask = null;
|
||||
}, 1000);
|
||||
}
|
||||
sendSkillList(0);
|
||||
}
|
||||
|
||||
public void sendSkillList(int lastLearnedSkillId)
|
||||
@ -9944,8 +9971,15 @@ public class PlayerInstance extends Playable
|
||||
removeSkill(oldSkill, false, true);
|
||||
}
|
||||
|
||||
stopAllEffectsExceptThoseThatLastThroughDeath();
|
||||
stopAllEffects();
|
||||
// stopAllEffectsExceptThoseThatLastThroughDeath();
|
||||
getEffectList().stopEffects(info -> !info.getSkill().isStayAfterDeath(), true, false);
|
||||
|
||||
// stopAllEffects();
|
||||
getEffectList().stopEffects(info -> !info.getSkill().isNecessaryToggle() && !info.getSkill().isIrreplacableBuff(), true, false);
|
||||
|
||||
// Update abnormal visual effects.
|
||||
sendPacket(new ExUserInfoAbnormalVisualEffect(this));
|
||||
|
||||
stopCubics();
|
||||
|
||||
restoreRecipeBook(false);
|
||||
|
@ -20,6 +20,7 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
|
||||
import org.l2jmobius.gameserver.model.SkillLearn;
|
||||
@ -33,19 +34,32 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
*/
|
||||
public class AcquireSkillList implements IClientOutgoingPacket
|
||||
{
|
||||
final PlayerInstance _player;
|
||||
final List<SkillLearn> _learnable;
|
||||
private PlayerInstance _player;
|
||||
private List<SkillLearn> _learnable;
|
||||
|
||||
public AcquireSkillList(PlayerInstance player)
|
||||
{
|
||||
_player = player;
|
||||
_learnable = SkillTreesData.getInstance().getAvailableSkills(player, player.getClassId(), false, true, false);
|
||||
_learnable.addAll(SkillTreesData.getInstance().getNextAvailableSkills(player, player.getClassId(), false, true, false));
|
||||
if (player.setSkillListPacketLock(true))
|
||||
{
|
||||
_player = player;
|
||||
_learnable = SkillTreesData.getInstance().getAvailableSkills(player, player.getClassId(), false, true, false);
|
||||
_learnable.addAll(SkillTreesData.getInstance().getNextAvailableSkills(player, player.getClassId(), false, true, false));
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setSkillListPacketLock(false);
|
||||
}, 300);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.ACQUIRE_SKILL_LIST.writeId(packet);
|
||||
|
||||
packet.writeH(_learnable.size());
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.Stats;
|
||||
@ -27,34 +28,49 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
*/
|
||||
public class ExStorageMaxCount implements IClientOutgoingPacket
|
||||
{
|
||||
private final int _inventory;
|
||||
private final int _warehouse;
|
||||
// private final int _freight; // Removed with 152.
|
||||
private final int _clan;
|
||||
private final int _privateSell;
|
||||
private final int _privateBuy;
|
||||
private final int _receipeD;
|
||||
private final int _recipe;
|
||||
private final int _inventoryExtraSlots;
|
||||
private final int _inventoryQuestItems;
|
||||
private PlayerInstance _player;
|
||||
private int _inventory;
|
||||
private int _warehouse;
|
||||
// private int _freight; // Removed with 152.
|
||||
private int _clan;
|
||||
private int _privateSell;
|
||||
private int _privateBuy;
|
||||
private int _receipeD;
|
||||
private int _recipe;
|
||||
private int _inventoryExtraSlots;
|
||||
private int _inventoryQuestItems;
|
||||
|
||||
public ExStorageMaxCount(PlayerInstance player)
|
||||
{
|
||||
_inventory = player.getInventoryLimit();
|
||||
_warehouse = player.getWareHouseLimit();
|
||||
// _freight = Config.ALT_FREIGHT_SLOTS; // Removed with 152.
|
||||
_privateSell = player.getPrivateSellStoreLimit();
|
||||
_privateBuy = player.getPrivateBuyStoreLimit();
|
||||
_clan = Config.WAREHOUSE_SLOTS_CLAN;
|
||||
_receipeD = player.getDwarfRecipeLimit();
|
||||
_recipe = player.getCommonRecipeLimit();
|
||||
_inventoryExtraSlots = (int) player.getStat().getValue(Stats.INVENTORY_NORMAL, 0);
|
||||
_inventoryQuestItems = Config.INVENTORY_MAXIMUM_QUEST_ITEMS;
|
||||
if (player.setStorageMaxCountPacketLock(true))
|
||||
{
|
||||
_player = player;
|
||||
_inventory = player.getInventoryLimit();
|
||||
_warehouse = player.getWareHouseLimit();
|
||||
// _freight = Config.ALT_FREIGHT_SLOTS; // Removed with 152.
|
||||
_privateSell = player.getPrivateSellStoreLimit();
|
||||
_privateBuy = player.getPrivateBuyStoreLimit();
|
||||
_clan = Config.WAREHOUSE_SLOTS_CLAN;
|
||||
_receipeD = player.getDwarfRecipeLimit();
|
||||
_recipe = player.getCommonRecipeLimit();
|
||||
_inventoryExtraSlots = (int) player.getStat().getValue(Stats.INVENTORY_NORMAL, 0);
|
||||
_inventoryQuestItems = Config.INVENTORY_MAXIMUM_QUEST_ITEMS;
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setStorageMaxCountPacketLock(false);
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.EX_STORAGE_MAX_COUNT.writeId(packet);
|
||||
|
||||
packet.writeD(_inventory);
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ExperienceData;
|
||||
import org.l2jmobius.gameserver.enums.AttributeType;
|
||||
@ -35,20 +36,20 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
*/
|
||||
public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
{
|
||||
private final PlayerInstance _player;
|
||||
private PlayerInstance _player;
|
||||
|
||||
private final int _relation;
|
||||
private final int _runSpd;
|
||||
private final int _walkSpd;
|
||||
private final int _swimRunSpd;
|
||||
private final int _swimWalkSpd;
|
||||
private int _relation;
|
||||
private int _runSpd;
|
||||
private int _walkSpd;
|
||||
private int _swimRunSpd;
|
||||
private int _swimWalkSpd;
|
||||
private final int _flRunSpd = 0;
|
||||
private final int _flWalkSpd = 0;
|
||||
private final int _flyRunSpd;
|
||||
private final int _flyWalkSpd;
|
||||
private final double _moveMultiplier;
|
||||
private final int _enchantLevel;
|
||||
private final int _armorEnchant;
|
||||
private int _flyRunSpd;
|
||||
private int _flyWalkSpd;
|
||||
private double _moveMultiplier;
|
||||
private int _enchantLevel;
|
||||
private int _armorEnchant;
|
||||
private String _title;
|
||||
|
||||
private final byte[] _masks = new byte[]
|
||||
@ -61,11 +62,6 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
private int _initSize = 5;
|
||||
|
||||
public UserInfo(PlayerInstance player)
|
||||
{
|
||||
this(player, true);
|
||||
}
|
||||
|
||||
public UserInfo(PlayerInstance player, boolean addAll)
|
||||
{
|
||||
_player = player;
|
||||
|
||||
@ -86,9 +82,41 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
_title = "[Invisible]";
|
||||
}
|
||||
|
||||
if (addAll)
|
||||
addComponentType(UserInfoType.values());
|
||||
}
|
||||
|
||||
public UserInfo(PlayerInstance player, boolean addAll)
|
||||
{
|
||||
if (player.setUserInfoPacketLock(true))
|
||||
{
|
||||
addComponentType(UserInfoType.values());
|
||||
_player = player;
|
||||
|
||||
_relation = calculateRelation(player);
|
||||
_moveMultiplier = player.getMovementSpeedMultiplier();
|
||||
_runSpd = (int) Math.round(player.getRunSpeed() / _moveMultiplier);
|
||||
_walkSpd = (int) Math.round(player.getWalkSpeed() / _moveMultiplier);
|
||||
_swimRunSpd = (int) Math.round(player.getSwimRunSpeed() / _moveMultiplier);
|
||||
_swimWalkSpd = (int) Math.round(player.getSwimWalkSpeed() / _moveMultiplier);
|
||||
_flyRunSpd = player.isFlying() ? _runSpd : 0;
|
||||
_flyWalkSpd = player.isFlying() ? _walkSpd : 0;
|
||||
_enchantLevel = player.getInventory().getWeaponEnchant();
|
||||
_armorEnchant = player.getInventory().getArmorMinEnchant();
|
||||
|
||||
_title = player.getTitle();
|
||||
if (player.isGM() && player.isInvisible())
|
||||
{
|
||||
_title = "[Invisible]";
|
||||
}
|
||||
|
||||
if (addAll)
|
||||
{
|
||||
addComponentType(UserInfoType.values());
|
||||
}
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setUserInfoPacketLock(false);
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@ -129,6 +157,11 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.USER_INFO.writeId(packet);
|
||||
|
||||
packet.writeD(_player.getObjectId());
|
||||
|
@ -40,6 +40,7 @@ import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.concurrent.locks.StampedLock;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -724,7 +725,10 @@ public class PlayerInstance extends Playable
|
||||
private ScheduledFuture<?> _taskRentPet;
|
||||
private ScheduledFuture<?> _taskWater;
|
||||
|
||||
private ScheduledFuture<?> _skillListRefreshTask;
|
||||
/** Packet delay locks */
|
||||
private final StampedLock _skillListPacketLock = new StampedLock();
|
||||
private final StampedLock _userInfoPacketLock = new StampedLock();
|
||||
private final StampedLock _storageMaxPacketLock = new StampedLock();
|
||||
|
||||
/** Last Html Npcs, 0 = last html was not bound to an npc */
|
||||
private final int[] _htmlActionOriginObjectIds = new int[HtmlActionScope.values().length];
|
||||
@ -2178,6 +2182,16 @@ public class PlayerInstance extends Playable
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerEquipItem(this, item), this);
|
||||
}
|
||||
|
||||
public boolean setStorageMaxCountPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _storageMaxPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_storageMaxPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the the PvP Kills of the PlayerInstance (Number of player killed during a PvP).
|
||||
*/
|
||||
@ -4017,6 +4031,16 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
}
|
||||
|
||||
public boolean setUserInfoPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _userInfoPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_userInfoPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a Server->Client packet UserInfo to this PlayerInstance and CharInfo to all PlayerInstance in its _KnownPlayers. <B><U> Concept</U> :</B> Others PlayerInstance in the detection area of the PlayerInstance are identified in <B>_knownPlayers</B>. In order to inform other players of this
|
||||
* PlayerInstance state modifications, server just need to go through _knownPlayers to send Server->Client Packet <B><U> Actions</U> :</B>
|
||||
@ -9487,16 +9511,19 @@ public class PlayerInstance extends Playable
|
||||
return _wantsPeace;
|
||||
}
|
||||
|
||||
public boolean setSkillListPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _skillListPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_skillListPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
public void sendSkillList()
|
||||
{
|
||||
if (_skillListRefreshTask == null)
|
||||
{
|
||||
_skillListRefreshTask = ThreadPool.schedule(() ->
|
||||
{
|
||||
sendSkillList(0);
|
||||
_skillListRefreshTask = null;
|
||||
}, 1000);
|
||||
}
|
||||
sendSkillList(0);
|
||||
}
|
||||
|
||||
public void sendSkillList(int lastLearnedSkillId)
|
||||
@ -9905,8 +9932,15 @@ public class PlayerInstance extends Playable
|
||||
removeSkill(oldSkill, false, true);
|
||||
}
|
||||
|
||||
stopAllEffectsExceptThoseThatLastThroughDeath();
|
||||
stopAllEffects();
|
||||
// stopAllEffectsExceptThoseThatLastThroughDeath();
|
||||
getEffectList().stopEffects(info -> !info.getSkill().isStayAfterDeath(), true, false);
|
||||
|
||||
// stopAllEffects();
|
||||
getEffectList().stopEffects(info -> !info.getSkill().isNecessaryToggle() && !info.getSkill().isIrreplacableBuff(), true, false);
|
||||
|
||||
// Update abnormal visual effects.
|
||||
sendPacket(new ExUserInfoAbnormalVisualEffect(this));
|
||||
|
||||
stopCubics();
|
||||
|
||||
restoreRecipeBook(false);
|
||||
|
@ -20,6 +20,7 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
|
||||
import org.l2jmobius.gameserver.model.SkillLearn;
|
||||
@ -33,19 +34,32 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
*/
|
||||
public class AcquireSkillList implements IClientOutgoingPacket
|
||||
{
|
||||
final PlayerInstance _player;
|
||||
final List<SkillLearn> _learnable;
|
||||
private PlayerInstance _player;
|
||||
private List<SkillLearn> _learnable;
|
||||
|
||||
public AcquireSkillList(PlayerInstance player)
|
||||
{
|
||||
_player = player;
|
||||
_learnable = SkillTreesData.getInstance().getAvailableSkills(player, player.getClassId(), false, true, false);
|
||||
_learnable.addAll(SkillTreesData.getInstance().getNextAvailableSkills(player, player.getClassId(), false, true, false));
|
||||
if (player.setSkillListPacketLock(true))
|
||||
{
|
||||
_player = player;
|
||||
_learnable = SkillTreesData.getInstance().getAvailableSkills(player, player.getClassId(), false, true, false);
|
||||
_learnable.addAll(SkillTreesData.getInstance().getNextAvailableSkills(player, player.getClassId(), false, true, false));
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setSkillListPacketLock(false);
|
||||
}, 300);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.ACQUIRE_SKILL_LIST.writeId(packet);
|
||||
|
||||
packet.writeH(_learnable.size());
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.Stats;
|
||||
@ -27,34 +28,49 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
*/
|
||||
public class ExStorageMaxCount implements IClientOutgoingPacket
|
||||
{
|
||||
private final int _inventory;
|
||||
private final int _warehouse;
|
||||
// private final int _freight; // Removed with 152.
|
||||
private final int _clan;
|
||||
private final int _privateSell;
|
||||
private final int _privateBuy;
|
||||
private final int _receipeD;
|
||||
private final int _recipe;
|
||||
private final int _inventoryExtraSlots;
|
||||
private final int _inventoryQuestItems;
|
||||
private PlayerInstance _player;
|
||||
private int _inventory;
|
||||
private int _warehouse;
|
||||
// private int _freight; // Removed with 152.
|
||||
private int _clan;
|
||||
private int _privateSell;
|
||||
private int _privateBuy;
|
||||
private int _receipeD;
|
||||
private int _recipe;
|
||||
private int _inventoryExtraSlots;
|
||||
private int _inventoryQuestItems;
|
||||
|
||||
public ExStorageMaxCount(PlayerInstance player)
|
||||
{
|
||||
_inventory = player.getInventoryLimit();
|
||||
_warehouse = player.getWareHouseLimit();
|
||||
// _freight = Config.ALT_FREIGHT_SLOTS; // Removed with 152.
|
||||
_privateSell = player.getPrivateSellStoreLimit();
|
||||
_privateBuy = player.getPrivateBuyStoreLimit();
|
||||
_clan = Config.WAREHOUSE_SLOTS_CLAN;
|
||||
_receipeD = player.getDwarfRecipeLimit();
|
||||
_recipe = player.getCommonRecipeLimit();
|
||||
_inventoryExtraSlots = (int) player.getStat().getValue(Stats.INVENTORY_NORMAL, 0);
|
||||
_inventoryQuestItems = Config.INVENTORY_MAXIMUM_QUEST_ITEMS;
|
||||
if (player.setStorageMaxCountPacketLock(true))
|
||||
{
|
||||
_player = player;
|
||||
_inventory = player.getInventoryLimit();
|
||||
_warehouse = player.getWareHouseLimit();
|
||||
// _freight = Config.ALT_FREIGHT_SLOTS; // Removed with 152.
|
||||
_privateSell = player.getPrivateSellStoreLimit();
|
||||
_privateBuy = player.getPrivateBuyStoreLimit();
|
||||
_clan = Config.WAREHOUSE_SLOTS_CLAN;
|
||||
_receipeD = player.getDwarfRecipeLimit();
|
||||
_recipe = player.getCommonRecipeLimit();
|
||||
_inventoryExtraSlots = (int) player.getStat().getValue(Stats.INVENTORY_NORMAL, 0);
|
||||
_inventoryQuestItems = Config.INVENTORY_MAXIMUM_QUEST_ITEMS;
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setStorageMaxCountPacketLock(false);
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.EX_STORAGE_MAX_COUNT.writeId(packet);
|
||||
|
||||
packet.writeD(_inventory);
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ExperienceData;
|
||||
import org.l2jmobius.gameserver.enums.AttributeType;
|
||||
@ -35,20 +36,20 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
*/
|
||||
public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
{
|
||||
private final PlayerInstance _player;
|
||||
private PlayerInstance _player;
|
||||
|
||||
private final int _relation;
|
||||
private final int _runSpd;
|
||||
private final int _walkSpd;
|
||||
private final int _swimRunSpd;
|
||||
private final int _swimWalkSpd;
|
||||
private int _relation;
|
||||
private int _runSpd;
|
||||
private int _walkSpd;
|
||||
private int _swimRunSpd;
|
||||
private int _swimWalkSpd;
|
||||
private final int _flRunSpd = 0;
|
||||
private final int _flWalkSpd = 0;
|
||||
private final int _flyRunSpd;
|
||||
private final int _flyWalkSpd;
|
||||
private final double _moveMultiplier;
|
||||
private final int _enchantLevel;
|
||||
private final int _armorEnchant;
|
||||
private int _flyRunSpd;
|
||||
private int _flyWalkSpd;
|
||||
private double _moveMultiplier;
|
||||
private int _enchantLevel;
|
||||
private int _armorEnchant;
|
||||
private String _title;
|
||||
|
||||
private final byte[] _masks = new byte[]
|
||||
@ -62,11 +63,6 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
private int _initSize = 5;
|
||||
|
||||
public UserInfo(PlayerInstance player)
|
||||
{
|
||||
this(player, true);
|
||||
}
|
||||
|
||||
public UserInfo(PlayerInstance player, boolean addAll)
|
||||
{
|
||||
_player = player;
|
||||
|
||||
@ -87,9 +83,41 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
_title = "[Invisible]";
|
||||
}
|
||||
|
||||
if (addAll)
|
||||
addComponentType(UserInfoType.values());
|
||||
}
|
||||
|
||||
public UserInfo(PlayerInstance player, boolean addAll)
|
||||
{
|
||||
if (player.setUserInfoPacketLock(true))
|
||||
{
|
||||
addComponentType(UserInfoType.values());
|
||||
_player = player;
|
||||
|
||||
_relation = calculateRelation(player);
|
||||
_moveMultiplier = player.getMovementSpeedMultiplier();
|
||||
_runSpd = (int) Math.round(player.getRunSpeed() / _moveMultiplier);
|
||||
_walkSpd = (int) Math.round(player.getWalkSpeed() / _moveMultiplier);
|
||||
_swimRunSpd = (int) Math.round(player.getSwimRunSpeed() / _moveMultiplier);
|
||||
_swimWalkSpd = (int) Math.round(player.getSwimWalkSpeed() / _moveMultiplier);
|
||||
_flyRunSpd = player.isFlying() ? _runSpd : 0;
|
||||
_flyWalkSpd = player.isFlying() ? _walkSpd : 0;
|
||||
_enchantLevel = player.getInventory().getWeaponEnchant();
|
||||
_armorEnchant = player.getInventory().getArmorMinEnchant();
|
||||
|
||||
_title = player.getTitle();
|
||||
if (player.isGM() && player.isInvisible())
|
||||
{
|
||||
_title = "[Invisible]";
|
||||
}
|
||||
|
||||
if (addAll)
|
||||
{
|
||||
addComponentType(UserInfoType.values());
|
||||
}
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setUserInfoPacketLock(false);
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@ -130,6 +158,11 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.USER_INFO.writeId(packet);
|
||||
|
||||
packet.writeD(_player.getObjectId());
|
||||
|
@ -41,6 +41,7 @@ import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.concurrent.locks.StampedLock;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -717,7 +718,10 @@ public class PlayerInstance extends Playable
|
||||
private ScheduledFuture<?> _taskRentPet;
|
||||
private ScheduledFuture<?> _taskWater;
|
||||
|
||||
private ScheduledFuture<?> _skillListRefreshTask;
|
||||
/** Packet delay locks */
|
||||
private final StampedLock _skillListPacketLock = new StampedLock();
|
||||
private final StampedLock _userInfoPacketLock = new StampedLock();
|
||||
private final StampedLock _storageMaxPacketLock = new StampedLock();
|
||||
|
||||
/** Last Html Npcs, 0 = last html was not bound to an npc */
|
||||
private final int[] _htmlActionOriginObjectIds = new int[HtmlActionScope.values().length];
|
||||
@ -2231,6 +2235,16 @@ public class PlayerInstance extends Playable
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerEquipItem(this, item), this);
|
||||
}
|
||||
|
||||
public boolean setStorageMaxCountPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _storageMaxPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_storageMaxPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the the PvP Kills of the PlayerInstance (Number of player killed during a PvP).
|
||||
*/
|
||||
@ -4090,6 +4104,16 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
}
|
||||
|
||||
public boolean setUserInfoPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _userInfoPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_userInfoPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a Server->Client packet UserInfo to this PlayerInstance and CharInfo to all PlayerInstance in its _KnownPlayers. <B><U> Concept</U> :</B> Others PlayerInstance in the detection area of the PlayerInstance are identified in <B>_knownPlayers</B>. In order to inform other players of this
|
||||
* PlayerInstance state modifications, server just need to go through _knownPlayers to send Server->Client Packet <B><U> Actions</U> :</B>
|
||||
@ -9474,16 +9498,19 @@ public class PlayerInstance extends Playable
|
||||
return _wantsPeace;
|
||||
}
|
||||
|
||||
public boolean setSkillListPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _skillListPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_skillListPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
public void sendSkillList()
|
||||
{
|
||||
if (_skillListRefreshTask == null)
|
||||
{
|
||||
_skillListRefreshTask = ThreadPool.schedule(() ->
|
||||
{
|
||||
sendSkillList(0);
|
||||
_skillListRefreshTask = null;
|
||||
}, 1000);
|
||||
}
|
||||
sendSkillList(0);
|
||||
}
|
||||
|
||||
public void sendSkillList(int lastLearnedSkillId)
|
||||
@ -9887,8 +9914,15 @@ public class PlayerInstance extends Playable
|
||||
removeSkill(oldSkill, false, true);
|
||||
}
|
||||
|
||||
stopAllEffectsExceptThoseThatLastThroughDeath();
|
||||
stopAllEffects();
|
||||
// stopAllEffectsExceptThoseThatLastThroughDeath();
|
||||
getEffectList().stopEffects(info -> !info.getSkill().isStayAfterDeath(), true, false);
|
||||
|
||||
// stopAllEffects();
|
||||
getEffectList().stopEffects(info -> !info.getSkill().isNecessaryToggle() && !info.getSkill().isIrreplacableBuff(), true, false);
|
||||
|
||||
// Update abnormal visual effects.
|
||||
sendPacket(new ExUserInfoAbnormalVisualEffect(this));
|
||||
|
||||
stopCubics();
|
||||
|
||||
restoreRecipeBook(false);
|
||||
|
@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
|
||||
import org.l2jmobius.gameserver.model.SkillLearn;
|
||||
@ -31,19 +32,32 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
*/
|
||||
public class AcquireSkillList implements IClientOutgoingPacket
|
||||
{
|
||||
final PlayerInstance _player;
|
||||
final List<SkillLearn> _learnable;
|
||||
private PlayerInstance _player;
|
||||
private List<SkillLearn> _learnable;
|
||||
|
||||
public AcquireSkillList(PlayerInstance player)
|
||||
{
|
||||
_player = player;
|
||||
_learnable = SkillTreesData.getInstance().getAvailableSkills(player, player.getClassId(), false, false);
|
||||
_learnable.addAll(SkillTreesData.getInstance().getNextAvailableSkills(player, player.getClassId(), false, false));
|
||||
if (player.setSkillListPacketLock(true))
|
||||
{
|
||||
_player = player;
|
||||
_learnable = SkillTreesData.getInstance().getAvailableSkills(player, player.getClassId(), false, false);
|
||||
_learnable.addAll(SkillTreesData.getInstance().getNextAvailableSkills(player, player.getClassId(), false, false));
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setSkillListPacketLock(false);
|
||||
}, 300);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.ACQUIRE_SKILL_LIST.writeId(packet);
|
||||
|
||||
packet.writeH(_learnable.size());
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.Stats;
|
||||
@ -27,34 +28,49 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
*/
|
||||
public class ExStorageMaxCount implements IClientOutgoingPacket
|
||||
{
|
||||
private final int _inventory;
|
||||
private final int _warehouse;
|
||||
private final int _freight;
|
||||
private final int _clan;
|
||||
private final int _privateSell;
|
||||
private final int _privateBuy;
|
||||
private final int _receipeD;
|
||||
private final int _recipe;
|
||||
private final int _inventoryExtraSlots;
|
||||
private final int _inventoryQuestItems;
|
||||
private PlayerInstance _player;
|
||||
private int _inventory;
|
||||
private int _warehouse;
|
||||
private int _freight;
|
||||
private int _clan;
|
||||
private int _privateSell;
|
||||
private int _privateBuy;
|
||||
private int _receipeD;
|
||||
private int _recipe;
|
||||
private int _inventoryExtraSlots;
|
||||
private int _inventoryQuestItems;
|
||||
|
||||
public ExStorageMaxCount(PlayerInstance player)
|
||||
{
|
||||
_inventory = player.getInventoryLimit();
|
||||
_warehouse = player.getWareHouseLimit();
|
||||
_freight = Config.ALT_FREIGHT_SLOTS;
|
||||
_privateSell = player.getPrivateSellStoreLimit();
|
||||
_privateBuy = player.getPrivateBuyStoreLimit();
|
||||
_clan = Config.WAREHOUSE_SLOTS_CLAN;
|
||||
_receipeD = player.getDwarfRecipeLimit();
|
||||
_recipe = player.getCommonRecipeLimit();
|
||||
_inventoryExtraSlots = (int) player.getStat().getValue(Stats.INVENTORY_NORMAL, 0);
|
||||
_inventoryQuestItems = Config.INVENTORY_MAXIMUM_QUEST_ITEMS;
|
||||
if (player.setStorageMaxCountPacketLock(true))
|
||||
{
|
||||
_player = player;
|
||||
_inventory = player.getInventoryLimit();
|
||||
_warehouse = player.getWareHouseLimit();
|
||||
_freight = Config.ALT_FREIGHT_SLOTS;
|
||||
_privateSell = player.getPrivateSellStoreLimit();
|
||||
_privateBuy = player.getPrivateBuyStoreLimit();
|
||||
_clan = Config.WAREHOUSE_SLOTS_CLAN;
|
||||
_receipeD = player.getDwarfRecipeLimit();
|
||||
_recipe = player.getCommonRecipeLimit();
|
||||
_inventoryExtraSlots = (int) player.getStat().getValue(Stats.INVENTORY_NORMAL, 0);
|
||||
_inventoryQuestItems = Config.INVENTORY_MAXIMUM_QUEST_ITEMS;
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setStorageMaxCountPacketLock(false);
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.EX_STORAGE_MAX_COUNT.writeId(packet);
|
||||
|
||||
packet.writeD(_inventory);
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ExperienceData;
|
||||
import org.l2jmobius.gameserver.enums.UserInfoType;
|
||||
@ -28,25 +29,24 @@ import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
|
||||
/**
|
||||
* @author Sdw, UnAfraid, proGenitor <br>
|
||||
* Experimental packet compatible for L2Classic 2.0.
|
||||
* @author Sdw, UnAfraid
|
||||
*/
|
||||
public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
{
|
||||
private final PlayerInstance _player;
|
||||
private PlayerInstance _player;
|
||||
|
||||
private final int _relation;
|
||||
private final int _runSpd;
|
||||
private final int _walkSpd;
|
||||
private final int _swimRunSpd;
|
||||
private final int _swimWalkSpd;
|
||||
private int _relation;
|
||||
private int _runSpd;
|
||||
private int _walkSpd;
|
||||
private int _swimRunSpd;
|
||||
private int _swimWalkSpd;
|
||||
private final int _flRunSpd = 0;
|
||||
private final int _flWalkSpd = 0;
|
||||
private final int _flyRunSpd;
|
||||
private final int _flyWalkSpd;
|
||||
private final double _moveMultiplier;
|
||||
private int _enchantLevel = 0;
|
||||
private int _armorEnchant = 0;
|
||||
private int _flyRunSpd;
|
||||
private int _flyWalkSpd;
|
||||
private double _moveMultiplier;
|
||||
private int _enchantLevel;
|
||||
private int _armorEnchant;
|
||||
private String _title;
|
||||
|
||||
private final byte[] _masks = new byte[]
|
||||
@ -59,11 +59,6 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
private int _initSize = 5;
|
||||
|
||||
public UserInfo(PlayerInstance player)
|
||||
{
|
||||
this(player, true);
|
||||
}
|
||||
|
||||
public UserInfo(PlayerInstance player, boolean addAll)
|
||||
{
|
||||
_player = player;
|
||||
|
||||
@ -84,9 +79,41 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
_title = "[Invisible]";
|
||||
}
|
||||
|
||||
if (addAll)
|
||||
addComponentType(UserInfoType.values());
|
||||
}
|
||||
|
||||
public UserInfo(PlayerInstance player, boolean addAll)
|
||||
{
|
||||
if (player.setUserInfoPacketLock(true))
|
||||
{
|
||||
addComponentType(UserInfoType.values());
|
||||
_player = player;
|
||||
|
||||
_relation = calculateRelation(player);
|
||||
_moveMultiplier = player.getMovementSpeedMultiplier();
|
||||
_runSpd = (int) Math.round(player.getRunSpeed() / _moveMultiplier);
|
||||
_walkSpd = (int) Math.round(player.getWalkSpeed() / _moveMultiplier);
|
||||
_swimRunSpd = (int) Math.round(player.getSwimRunSpeed() / _moveMultiplier);
|
||||
_swimWalkSpd = (int) Math.round(player.getSwimWalkSpeed() / _moveMultiplier);
|
||||
_flyRunSpd = player.isFlying() ? _runSpd : 0;
|
||||
_flyWalkSpd = player.isFlying() ? _walkSpd : 0;
|
||||
_enchantLevel = player.getInventory().getWeaponEnchant();
|
||||
_armorEnchant = player.getInventory().getArmorMinEnchant();
|
||||
|
||||
_title = player.getTitle();
|
||||
if (player.isGM() && player.isInvisible())
|
||||
{
|
||||
_title = "[Invisible]";
|
||||
}
|
||||
|
||||
if (addAll)
|
||||
{
|
||||
addComponentType(UserInfoType.values());
|
||||
}
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setUserInfoPacketLock(false);
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@ -127,6 +154,11 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.USER_INFO.writeId(packet);
|
||||
|
||||
packet.writeD(_player.getObjectId());
|
||||
@ -301,7 +333,7 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
packet.writeH(22);
|
||||
packet.writeC(_player.getPvpFlag());
|
||||
packet.writeD(_player.getReputation()); // Reputation
|
||||
packet.writeC(0x00);
|
||||
packet.writeC(_player.isNoble() ? 1 : 0);
|
||||
packet.writeC(_player.isHero() || (_player.isGM() && Config.GM_HERO_AURA) ? 1 : 0);
|
||||
packet.writeC(_player.getPledgeClass());
|
||||
packet.writeD(_player.getPkKills());
|
||||
|
@ -41,6 +41,7 @@ import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.concurrent.locks.StampedLock;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -718,7 +719,10 @@ public class PlayerInstance extends Playable
|
||||
private ScheduledFuture<?> _taskRentPet;
|
||||
private ScheduledFuture<?> _taskWater;
|
||||
|
||||
private ScheduledFuture<?> _skillListRefreshTask;
|
||||
/** Packet delay locks */
|
||||
private final StampedLock _skillListPacketLock = new StampedLock();
|
||||
private final StampedLock _userInfoPacketLock = new StampedLock();
|
||||
private final StampedLock _storageMaxPacketLock = new StampedLock();
|
||||
|
||||
/** Last Html Npcs, 0 = last html was not bound to an npc */
|
||||
private final int[] _htmlActionOriginObjectIds = new int[HtmlActionScope.values().length];
|
||||
@ -2232,6 +2236,16 @@ public class PlayerInstance extends Playable
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerEquipItem(this, item), this);
|
||||
}
|
||||
|
||||
public boolean setStorageMaxCountPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _storageMaxPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_storageMaxPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the the PvP Kills of the PlayerInstance (Number of player killed during a PvP).
|
||||
*/
|
||||
@ -4091,6 +4105,16 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
}
|
||||
|
||||
public boolean setUserInfoPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _userInfoPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_userInfoPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a Server->Client packet UserInfo to this PlayerInstance and CharInfo to all PlayerInstance in its _KnownPlayers. <B><U> Concept</U> :</B> Others PlayerInstance in the detection area of the PlayerInstance are identified in <B>_knownPlayers</B>. In order to inform other players of this
|
||||
* PlayerInstance state modifications, server just need to go through _knownPlayers to send Server->Client Packet <B><U> Actions</U> :</B>
|
||||
@ -9481,16 +9505,19 @@ public class PlayerInstance extends Playable
|
||||
return _wantsPeace;
|
||||
}
|
||||
|
||||
public boolean setSkillListPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _skillListPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_skillListPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
public void sendSkillList()
|
||||
{
|
||||
if (_skillListRefreshTask == null)
|
||||
{
|
||||
_skillListRefreshTask = ThreadPool.schedule(() ->
|
||||
{
|
||||
sendSkillList(0);
|
||||
_skillListRefreshTask = null;
|
||||
}, 1000);
|
||||
}
|
||||
sendSkillList(0);
|
||||
}
|
||||
|
||||
public void sendSkillList(int lastLearnedSkillId)
|
||||
@ -9894,8 +9921,15 @@ public class PlayerInstance extends Playable
|
||||
removeSkill(oldSkill, false, true);
|
||||
}
|
||||
|
||||
stopAllEffectsExceptThoseThatLastThroughDeath();
|
||||
stopAllEffects();
|
||||
// stopAllEffectsExceptThoseThatLastThroughDeath();
|
||||
getEffectList().stopEffects(info -> !info.getSkill().isStayAfterDeath(), true, false);
|
||||
|
||||
// stopAllEffects();
|
||||
getEffectList().stopEffects(info -> !info.getSkill().isNecessaryToggle() && !info.getSkill().isIrreplacableBuff(), true, false);
|
||||
|
||||
// Update abnormal visual effects.
|
||||
sendPacket(new ExUserInfoAbnormalVisualEffect(this));
|
||||
|
||||
stopCubics();
|
||||
|
||||
restoreRecipeBook(false);
|
||||
|
@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
|
||||
import org.l2jmobius.gameserver.model.SkillLearn;
|
||||
@ -31,19 +32,32 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
*/
|
||||
public class AcquireSkillList implements IClientOutgoingPacket
|
||||
{
|
||||
final PlayerInstance _player;
|
||||
final List<SkillLearn> _learnable;
|
||||
private PlayerInstance _player;
|
||||
private List<SkillLearn> _learnable;
|
||||
|
||||
public AcquireSkillList(PlayerInstance player)
|
||||
{
|
||||
_player = player;
|
||||
_learnable = SkillTreesData.getInstance().getAvailableSkills(player, player.getClassId(), false, false);
|
||||
_learnable.addAll(SkillTreesData.getInstance().getNextAvailableSkills(player, player.getClassId(), false, false));
|
||||
if (player.setSkillListPacketLock(true))
|
||||
{
|
||||
_player = player;
|
||||
_learnable = SkillTreesData.getInstance().getAvailableSkills(player, player.getClassId(), false, false);
|
||||
_learnable.addAll(SkillTreesData.getInstance().getNextAvailableSkills(player, player.getClassId(), false, false));
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setSkillListPacketLock(false);
|
||||
}, 300);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.ACQUIRE_SKILL_LIST.writeId(packet);
|
||||
|
||||
packet.writeH(_learnable.size());
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.Stats;
|
||||
@ -27,34 +28,49 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
*/
|
||||
public class ExStorageMaxCount implements IClientOutgoingPacket
|
||||
{
|
||||
private final int _inventory;
|
||||
private final int _warehouse;
|
||||
private final int _freight;
|
||||
private final int _clan;
|
||||
private final int _privateSell;
|
||||
private final int _privateBuy;
|
||||
private final int _receipeD;
|
||||
private final int _recipe;
|
||||
private final int _inventoryExtraSlots;
|
||||
private final int _inventoryQuestItems;
|
||||
private PlayerInstance _player;
|
||||
private int _inventory;
|
||||
private int _warehouse;
|
||||
private int _freight;
|
||||
private int _clan;
|
||||
private int _privateSell;
|
||||
private int _privateBuy;
|
||||
private int _receipeD;
|
||||
private int _recipe;
|
||||
private int _inventoryExtraSlots;
|
||||
private int _inventoryQuestItems;
|
||||
|
||||
public ExStorageMaxCount(PlayerInstance player)
|
||||
{
|
||||
_inventory = player.getInventoryLimit();
|
||||
_warehouse = player.getWareHouseLimit();
|
||||
_freight = Config.ALT_FREIGHT_SLOTS;
|
||||
_privateSell = player.getPrivateSellStoreLimit();
|
||||
_privateBuy = player.getPrivateBuyStoreLimit();
|
||||
_clan = Config.WAREHOUSE_SLOTS_CLAN;
|
||||
_receipeD = player.getDwarfRecipeLimit();
|
||||
_recipe = player.getCommonRecipeLimit();
|
||||
_inventoryExtraSlots = (int) player.getStat().getValue(Stats.INVENTORY_NORMAL, 0);
|
||||
_inventoryQuestItems = Config.INVENTORY_MAXIMUM_QUEST_ITEMS;
|
||||
if (player.setStorageMaxCountPacketLock(true))
|
||||
{
|
||||
_player = player;
|
||||
_inventory = player.getInventoryLimit();
|
||||
_warehouse = player.getWareHouseLimit();
|
||||
_freight = Config.ALT_FREIGHT_SLOTS;
|
||||
_privateSell = player.getPrivateSellStoreLimit();
|
||||
_privateBuy = player.getPrivateBuyStoreLimit();
|
||||
_clan = Config.WAREHOUSE_SLOTS_CLAN;
|
||||
_receipeD = player.getDwarfRecipeLimit();
|
||||
_recipe = player.getCommonRecipeLimit();
|
||||
_inventoryExtraSlots = (int) player.getStat().getValue(Stats.INVENTORY_NORMAL, 0);
|
||||
_inventoryQuestItems = Config.INVENTORY_MAXIMUM_QUEST_ITEMS;
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setStorageMaxCountPacketLock(false);
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.EX_STORAGE_MAX_COUNT.writeId(packet);
|
||||
|
||||
packet.writeD(_inventory);
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ExperienceData;
|
||||
import org.l2jmobius.gameserver.enums.UserInfoType;
|
||||
@ -29,25 +30,24 @@ import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
|
||||
/**
|
||||
* @author Sdw, UnAfraid, proGenitor <br>
|
||||
* Experimental packet compatible for L2Classic 2.0.
|
||||
* @author Sdw, UnAfraid
|
||||
*/
|
||||
public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
{
|
||||
private final PlayerInstance _player;
|
||||
private PlayerInstance _player;
|
||||
|
||||
private final int _relation;
|
||||
private final int _runSpd;
|
||||
private final int _walkSpd;
|
||||
private final int _swimRunSpd;
|
||||
private final int _swimWalkSpd;
|
||||
private int _relation;
|
||||
private int _runSpd;
|
||||
private int _walkSpd;
|
||||
private int _swimRunSpd;
|
||||
private int _swimWalkSpd;
|
||||
private final int _flRunSpd = 0;
|
||||
private final int _flWalkSpd = 0;
|
||||
private final int _flyRunSpd;
|
||||
private final int _flyWalkSpd;
|
||||
private final double _moveMultiplier;
|
||||
private final int _enchantLevel;
|
||||
private final int _armorEnchant;
|
||||
private int _flyRunSpd;
|
||||
private int _flyWalkSpd;
|
||||
private double _moveMultiplier;
|
||||
private int _enchantLevel;
|
||||
private int _armorEnchant;
|
||||
private String _title;
|
||||
|
||||
private final byte[] _masks = new byte[]
|
||||
@ -60,11 +60,6 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
private int _initSize = 5;
|
||||
|
||||
public UserInfo(PlayerInstance player)
|
||||
{
|
||||
this(player, true);
|
||||
}
|
||||
|
||||
public UserInfo(PlayerInstance player, boolean addAll)
|
||||
{
|
||||
_player = player;
|
||||
|
||||
@ -85,9 +80,41 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
_title = "[Invisible]";
|
||||
}
|
||||
|
||||
if (addAll)
|
||||
addComponentType(UserInfoType.values());
|
||||
}
|
||||
|
||||
public UserInfo(PlayerInstance player, boolean addAll)
|
||||
{
|
||||
if (player.setUserInfoPacketLock(true))
|
||||
{
|
||||
addComponentType(UserInfoType.values());
|
||||
_player = player;
|
||||
|
||||
_relation = calculateRelation(player);
|
||||
_moveMultiplier = player.getMovementSpeedMultiplier();
|
||||
_runSpd = (int) Math.round(player.getRunSpeed() / _moveMultiplier);
|
||||
_walkSpd = (int) Math.round(player.getWalkSpeed() / _moveMultiplier);
|
||||
_swimRunSpd = (int) Math.round(player.getSwimRunSpeed() / _moveMultiplier);
|
||||
_swimWalkSpd = (int) Math.round(player.getSwimWalkSpeed() / _moveMultiplier);
|
||||
_flyRunSpd = player.isFlying() ? _runSpd : 0;
|
||||
_flyWalkSpd = player.isFlying() ? _walkSpd : 0;
|
||||
_enchantLevel = player.getInventory().getWeaponEnchant();
|
||||
_armorEnchant = player.getInventory().getArmorMinEnchant();
|
||||
|
||||
_title = player.getTitle();
|
||||
if (player.isGM() && player.isInvisible())
|
||||
{
|
||||
_title = "[Invisible]";
|
||||
}
|
||||
|
||||
if (addAll)
|
||||
{
|
||||
addComponentType(UserInfoType.values());
|
||||
}
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setUserInfoPacketLock(false);
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@ -128,6 +155,11 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.USER_INFO.writeId(packet);
|
||||
|
||||
packet.writeD(_player.getObjectId());
|
||||
|
@ -41,6 +41,7 @@ import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.concurrent.locks.StampedLock;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -716,7 +717,10 @@ public class PlayerInstance extends Playable
|
||||
private ScheduledFuture<?> _taskRentPet;
|
||||
private ScheduledFuture<?> _taskWater;
|
||||
|
||||
private ScheduledFuture<?> _skillListRefreshTask;
|
||||
/** Packet delay locks */
|
||||
private final StampedLock _skillListPacketLock = new StampedLock();
|
||||
private final StampedLock _userInfoPacketLock = new StampedLock();
|
||||
private final StampedLock _storageMaxPacketLock = new StampedLock();
|
||||
|
||||
/** Last Html Npcs, 0 = last html was not bound to an npc */
|
||||
private final int[] _htmlActionOriginObjectIds = new int[HtmlActionScope.values().length];
|
||||
@ -2230,6 +2234,16 @@ public class PlayerInstance extends Playable
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerEquipItem(this, item), this);
|
||||
}
|
||||
|
||||
public boolean setStorageMaxCountPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _storageMaxPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_storageMaxPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the the PvP Kills of the PlayerInstance (Number of player killed during a PvP).
|
||||
*/
|
||||
@ -4074,6 +4088,16 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
}
|
||||
|
||||
public boolean setUserInfoPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _userInfoPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_userInfoPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a Server->Client packet UserInfo to this PlayerInstance and CharInfo to all PlayerInstance in its _KnownPlayers. <B><U> Concept</U> :</B> Others PlayerInstance in the detection area of the PlayerInstance are identified in <B>_knownPlayers</B>. In order to inform other players of this
|
||||
* PlayerInstance state modifications, server just need to go through _knownPlayers to send Server->Client Packet <B><U> Actions</U> :</B>
|
||||
@ -9466,16 +9490,19 @@ public class PlayerInstance extends Playable
|
||||
return _wantsPeace;
|
||||
}
|
||||
|
||||
public boolean setSkillListPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _skillListPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_skillListPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
public void sendSkillList()
|
||||
{
|
||||
if (_skillListRefreshTask == null)
|
||||
{
|
||||
_skillListRefreshTask = ThreadPool.schedule(() ->
|
||||
{
|
||||
sendSkillList(0);
|
||||
_skillListRefreshTask = null;
|
||||
}, 1000);
|
||||
}
|
||||
sendSkillList(0);
|
||||
}
|
||||
|
||||
public void sendSkillList(int lastLearnedSkillId)
|
||||
@ -9879,8 +9906,15 @@ public class PlayerInstance extends Playable
|
||||
removeSkill(oldSkill, false, true);
|
||||
}
|
||||
|
||||
stopAllEffectsExceptThoseThatLastThroughDeath();
|
||||
stopAllEffects();
|
||||
// stopAllEffectsExceptThoseThatLastThroughDeath();
|
||||
getEffectList().stopEffects(info -> !info.getSkill().isStayAfterDeath(), true, false);
|
||||
|
||||
// stopAllEffects();
|
||||
getEffectList().stopEffects(info -> !info.getSkill().isNecessaryToggle() && !info.getSkill().isIrreplacableBuff(), true, false);
|
||||
|
||||
// Update abnormal visual effects.
|
||||
sendPacket(new ExUserInfoAbnormalVisualEffect(this));
|
||||
|
||||
stopCubics();
|
||||
|
||||
restoreRecipeBook(false);
|
||||
|
@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
|
||||
import org.l2jmobius.gameserver.model.SkillLearn;
|
||||
@ -31,19 +32,32 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
*/
|
||||
public class AcquireSkillList implements IClientOutgoingPacket
|
||||
{
|
||||
final PlayerInstance _player;
|
||||
final List<SkillLearn> _learnable;
|
||||
private PlayerInstance _player;
|
||||
private List<SkillLearn> _learnable;
|
||||
|
||||
public AcquireSkillList(PlayerInstance player)
|
||||
{
|
||||
_player = player;
|
||||
_learnable = SkillTreesData.getInstance().getAvailableSkills(player, player.getClassId(), false, false);
|
||||
_learnable.addAll(SkillTreesData.getInstance().getNextAvailableSkills(player, player.getClassId(), false, false));
|
||||
if (player.setSkillListPacketLock(true))
|
||||
{
|
||||
_player = player;
|
||||
_learnable = SkillTreesData.getInstance().getAvailableSkills(player, player.getClassId(), false, false);
|
||||
_learnable.addAll(SkillTreesData.getInstance().getNextAvailableSkills(player, player.getClassId(), false, false));
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setSkillListPacketLock(false);
|
||||
}, 300);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.ACQUIRE_SKILL_LIST.writeId(packet);
|
||||
|
||||
packet.writeH(_learnable.size());
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.Stats;
|
||||
@ -27,34 +28,49 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
*/
|
||||
public class ExStorageMaxCount implements IClientOutgoingPacket
|
||||
{
|
||||
private final int _inventory;
|
||||
private final int _warehouse;
|
||||
private final int _freight;
|
||||
private final int _clan;
|
||||
private final int _privateSell;
|
||||
private final int _privateBuy;
|
||||
private final int _receipeD;
|
||||
private final int _recipe;
|
||||
private final int _inventoryExtraSlots;
|
||||
private final int _inventoryQuestItems;
|
||||
private PlayerInstance _player;
|
||||
private int _inventory;
|
||||
private int _warehouse;
|
||||
private int _freight;
|
||||
private int _clan;
|
||||
private int _privateSell;
|
||||
private int _privateBuy;
|
||||
private int _receipeD;
|
||||
private int _recipe;
|
||||
private int _inventoryExtraSlots;
|
||||
private int _inventoryQuestItems;
|
||||
|
||||
public ExStorageMaxCount(PlayerInstance player)
|
||||
{
|
||||
_inventory = player.getInventoryLimit();
|
||||
_warehouse = player.getWareHouseLimit();
|
||||
_freight = Config.ALT_FREIGHT_SLOTS;
|
||||
_privateSell = player.getPrivateSellStoreLimit();
|
||||
_privateBuy = player.getPrivateBuyStoreLimit();
|
||||
_clan = Config.WAREHOUSE_SLOTS_CLAN;
|
||||
_receipeD = player.getDwarfRecipeLimit();
|
||||
_recipe = player.getCommonRecipeLimit();
|
||||
_inventoryExtraSlots = (int) player.getStat().getValue(Stats.INVENTORY_NORMAL, 0);
|
||||
_inventoryQuestItems = Config.INVENTORY_MAXIMUM_QUEST_ITEMS;
|
||||
if (player.setStorageMaxCountPacketLock(true))
|
||||
{
|
||||
_player = player;
|
||||
_inventory = player.getInventoryLimit();
|
||||
_warehouse = player.getWareHouseLimit();
|
||||
_freight = Config.ALT_FREIGHT_SLOTS;
|
||||
_privateSell = player.getPrivateSellStoreLimit();
|
||||
_privateBuy = player.getPrivateBuyStoreLimit();
|
||||
_clan = Config.WAREHOUSE_SLOTS_CLAN;
|
||||
_receipeD = player.getDwarfRecipeLimit();
|
||||
_recipe = player.getCommonRecipeLimit();
|
||||
_inventoryExtraSlots = (int) player.getStat().getValue(Stats.INVENTORY_NORMAL, 0);
|
||||
_inventoryQuestItems = Config.INVENTORY_MAXIMUM_QUEST_ITEMS;
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setStorageMaxCountPacketLock(false);
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.EX_STORAGE_MAX_COUNT.writeId(packet);
|
||||
|
||||
packet.writeD(_inventory);
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ExperienceData;
|
||||
import org.l2jmobius.gameserver.enums.UserInfoType;
|
||||
@ -29,25 +30,24 @@ import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
|
||||
/**
|
||||
* @author Sdw, UnAfraid, proGenitor <br>
|
||||
* Experimental packet compatible for L2Classic 2.0.
|
||||
* @author Sdw, UnAfraid
|
||||
*/
|
||||
public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
{
|
||||
private final PlayerInstance _player;
|
||||
private PlayerInstance _player;
|
||||
|
||||
private final int _relation;
|
||||
private final int _runSpd;
|
||||
private final int _walkSpd;
|
||||
private final int _swimRunSpd;
|
||||
private final int _swimWalkSpd;
|
||||
private int _relation;
|
||||
private int _runSpd;
|
||||
private int _walkSpd;
|
||||
private int _swimRunSpd;
|
||||
private int _swimWalkSpd;
|
||||
private final int _flRunSpd = 0;
|
||||
private final int _flWalkSpd = 0;
|
||||
private final int _flyRunSpd;
|
||||
private final int _flyWalkSpd;
|
||||
private final double _moveMultiplier;
|
||||
private final int _enchantLevel;
|
||||
private final int _armorEnchant;
|
||||
private int _flyRunSpd;
|
||||
private int _flyWalkSpd;
|
||||
private double _moveMultiplier;
|
||||
private int _enchantLevel;
|
||||
private int _armorEnchant;
|
||||
private String _title;
|
||||
|
||||
private final byte[] _masks = new byte[]
|
||||
@ -60,11 +60,6 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
private int _initSize = 5;
|
||||
|
||||
public UserInfo(PlayerInstance player)
|
||||
{
|
||||
this(player, true);
|
||||
}
|
||||
|
||||
public UserInfo(PlayerInstance player, boolean addAll)
|
||||
{
|
||||
_player = player;
|
||||
|
||||
@ -85,9 +80,41 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
_title = "[Invisible]";
|
||||
}
|
||||
|
||||
if (addAll)
|
||||
addComponentType(UserInfoType.values());
|
||||
}
|
||||
|
||||
public UserInfo(PlayerInstance player, boolean addAll)
|
||||
{
|
||||
if (player.setUserInfoPacketLock(true))
|
||||
{
|
||||
addComponentType(UserInfoType.values());
|
||||
_player = player;
|
||||
|
||||
_relation = calculateRelation(player);
|
||||
_moveMultiplier = player.getMovementSpeedMultiplier();
|
||||
_runSpd = (int) Math.round(player.getRunSpeed() / _moveMultiplier);
|
||||
_walkSpd = (int) Math.round(player.getWalkSpeed() / _moveMultiplier);
|
||||
_swimRunSpd = (int) Math.round(player.getSwimRunSpeed() / _moveMultiplier);
|
||||
_swimWalkSpd = (int) Math.round(player.getSwimWalkSpeed() / _moveMultiplier);
|
||||
_flyRunSpd = player.isFlying() ? _runSpd : 0;
|
||||
_flyWalkSpd = player.isFlying() ? _walkSpd : 0;
|
||||
_enchantLevel = player.getInventory().getWeaponEnchant();
|
||||
_armorEnchant = player.getInventory().getArmorMinEnchant();
|
||||
|
||||
_title = player.getTitle();
|
||||
if (player.isGM() && player.isInvisible())
|
||||
{
|
||||
_title = "[Invisible]";
|
||||
}
|
||||
|
||||
if (addAll)
|
||||
{
|
||||
addComponentType(UserInfoType.values());
|
||||
}
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setUserInfoPacketLock(false);
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@ -128,6 +155,11 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.USER_INFO.writeId(packet);
|
||||
|
||||
packet.writeD(_player.getObjectId());
|
||||
|
@ -41,6 +41,7 @@ import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.concurrent.locks.StampedLock;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -723,7 +724,10 @@ public class PlayerInstance extends Playable
|
||||
private ScheduledFuture<?> _taskRentPet;
|
||||
private ScheduledFuture<?> _taskWater;
|
||||
|
||||
private ScheduledFuture<?> _skillListRefreshTask;
|
||||
/** Packet delay locks */
|
||||
private final StampedLock _skillListPacketLock = new StampedLock();
|
||||
private final StampedLock _userInfoPacketLock = new StampedLock();
|
||||
private final StampedLock _storageMaxPacketLock = new StampedLock();
|
||||
|
||||
/** Last Html Npcs, 0 = last html was not bound to an npc */
|
||||
private final int[] _htmlActionOriginObjectIds = new int[HtmlActionScope.values().length];
|
||||
@ -2240,6 +2244,16 @@ public class PlayerInstance extends Playable
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerEquipItem(this, item), this);
|
||||
}
|
||||
|
||||
public boolean setStorageMaxCountPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _storageMaxPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_storageMaxPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the the PvP Kills of the PlayerInstance (Number of player killed during a PvP).
|
||||
*/
|
||||
@ -4085,6 +4099,16 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
}
|
||||
|
||||
public boolean setUserInfoPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _userInfoPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_userInfoPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a Server->Client packet UserInfo to this PlayerInstance and CharInfo to all PlayerInstance in its _KnownPlayers. <B><U> Concept</U> :</B> Others PlayerInstance in the detection area of the PlayerInstance are identified in <B>_knownPlayers</B>. In order to inform other players of this
|
||||
* PlayerInstance state modifications, server just need to go through _knownPlayers to send Server->Client Packet <B><U> Actions</U> :</B>
|
||||
@ -9493,16 +9517,19 @@ public class PlayerInstance extends Playable
|
||||
return _wantsPeace;
|
||||
}
|
||||
|
||||
public boolean setSkillListPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _skillListPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_skillListPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
public void sendSkillList()
|
||||
{
|
||||
if (_skillListRefreshTask == null)
|
||||
{
|
||||
_skillListRefreshTask = ThreadPool.schedule(() ->
|
||||
{
|
||||
sendSkillList(0);
|
||||
_skillListRefreshTask = null;
|
||||
}, 1000);
|
||||
}
|
||||
sendSkillList(0);
|
||||
}
|
||||
|
||||
public void sendSkillList(int lastLearnedSkillId)
|
||||
@ -9906,8 +9933,15 @@ public class PlayerInstance extends Playable
|
||||
removeSkill(oldSkill, false, true);
|
||||
}
|
||||
|
||||
stopAllEffectsExceptThoseThatLastThroughDeath();
|
||||
stopAllEffects();
|
||||
// stopAllEffectsExceptThoseThatLastThroughDeath();
|
||||
getEffectList().stopEffects(info -> !info.getSkill().isStayAfterDeath(), true, false);
|
||||
|
||||
// stopAllEffects();
|
||||
getEffectList().stopEffects(info -> !info.getSkill().isNecessaryToggle() && !info.getSkill().isIrreplacableBuff(), true, false);
|
||||
|
||||
// Update abnormal visual effects.
|
||||
sendPacket(new ExUserInfoAbnormalVisualEffect(this));
|
||||
|
||||
stopCubics();
|
||||
|
||||
restoreRecipeBook(false);
|
||||
|
@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
|
||||
import org.l2jmobius.gameserver.model.SkillLearn;
|
||||
@ -31,19 +32,32 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
*/
|
||||
public class AcquireSkillList implements IClientOutgoingPacket
|
||||
{
|
||||
final PlayerInstance _player;
|
||||
final List<SkillLearn> _learnable;
|
||||
private PlayerInstance _player;
|
||||
private List<SkillLearn> _learnable;
|
||||
|
||||
public AcquireSkillList(PlayerInstance player)
|
||||
{
|
||||
_player = player;
|
||||
_learnable = SkillTreesData.getInstance().getAvailableSkills(player, player.getClassId(), false, false);
|
||||
_learnable.addAll(SkillTreesData.getInstance().getNextAvailableSkills(player, player.getClassId(), false, false));
|
||||
if (player.setSkillListPacketLock(true))
|
||||
{
|
||||
_player = player;
|
||||
_learnable = SkillTreesData.getInstance().getAvailableSkills(player, player.getClassId(), false, false);
|
||||
_learnable.addAll(SkillTreesData.getInstance().getNextAvailableSkills(player, player.getClassId(), false, false));
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setSkillListPacketLock(false);
|
||||
}, 300);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.ACQUIRE_SKILL_LIST.writeId(packet);
|
||||
|
||||
packet.writeH(_learnable.size());
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.Stats;
|
||||
@ -27,34 +28,49 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
*/
|
||||
public class ExStorageMaxCount implements IClientOutgoingPacket
|
||||
{
|
||||
private final int _inventory;
|
||||
private final int _warehouse;
|
||||
// private final int _freight; // Removed with 152.
|
||||
private final int _clan;
|
||||
private final int _privateSell;
|
||||
private final int _privateBuy;
|
||||
private final int _receipeD;
|
||||
private final int _recipe;
|
||||
private final int _inventoryExtraSlots;
|
||||
private final int _inventoryQuestItems;
|
||||
private PlayerInstance _player;
|
||||
private int _inventory;
|
||||
private int _warehouse;
|
||||
// private int _freight; // Removed with 152.
|
||||
private int _clan;
|
||||
private int _privateSell;
|
||||
private int _privateBuy;
|
||||
private int _receipeD;
|
||||
private int _recipe;
|
||||
private int _inventoryExtraSlots;
|
||||
private int _inventoryQuestItems;
|
||||
|
||||
public ExStorageMaxCount(PlayerInstance player)
|
||||
{
|
||||
_inventory = player.getInventoryLimit();
|
||||
_warehouse = player.getWareHouseLimit();
|
||||
// _freight = Config.ALT_FREIGHT_SLOTS; // Removed with 152.
|
||||
_privateSell = player.getPrivateSellStoreLimit();
|
||||
_privateBuy = player.getPrivateBuyStoreLimit();
|
||||
_clan = Config.WAREHOUSE_SLOTS_CLAN;
|
||||
_receipeD = player.getDwarfRecipeLimit();
|
||||
_recipe = player.getCommonRecipeLimit();
|
||||
_inventoryExtraSlots = (int) player.getStat().getValue(Stats.INVENTORY_NORMAL, 0);
|
||||
_inventoryQuestItems = Config.INVENTORY_MAXIMUM_QUEST_ITEMS;
|
||||
if (player.setStorageMaxCountPacketLock(true))
|
||||
{
|
||||
_player = player;
|
||||
_inventory = player.getInventoryLimit();
|
||||
_warehouse = player.getWareHouseLimit();
|
||||
// _freight = Config.ALT_FREIGHT_SLOTS; // Removed with 152.
|
||||
_privateSell = player.getPrivateSellStoreLimit();
|
||||
_privateBuy = player.getPrivateBuyStoreLimit();
|
||||
_clan = Config.WAREHOUSE_SLOTS_CLAN;
|
||||
_receipeD = player.getDwarfRecipeLimit();
|
||||
_recipe = player.getCommonRecipeLimit();
|
||||
_inventoryExtraSlots = (int) player.getStat().getValue(Stats.INVENTORY_NORMAL, 0);
|
||||
_inventoryQuestItems = Config.INVENTORY_MAXIMUM_QUEST_ITEMS;
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setStorageMaxCountPacketLock(false);
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.EX_STORAGE_MAX_COUNT.writeId(packet);
|
||||
|
||||
packet.writeD(_inventory);
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ExperienceData;
|
||||
import org.l2jmobius.gameserver.enums.UserInfoType;
|
||||
@ -33,20 +34,20 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
*/
|
||||
public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
{
|
||||
private final PlayerInstance _player;
|
||||
private PlayerInstance _player;
|
||||
|
||||
private final int _relation;
|
||||
private final int _runSpd;
|
||||
private final int _walkSpd;
|
||||
private final int _swimRunSpd;
|
||||
private final int _swimWalkSpd;
|
||||
private int _relation;
|
||||
private int _runSpd;
|
||||
private int _walkSpd;
|
||||
private int _swimRunSpd;
|
||||
private int _swimWalkSpd;
|
||||
private final int _flRunSpd = 0;
|
||||
private final int _flWalkSpd = 0;
|
||||
private final int _flyRunSpd;
|
||||
private final int _flyWalkSpd;
|
||||
private final double _moveMultiplier;
|
||||
private final int _enchantLevel;
|
||||
private final int _armorEnchant;
|
||||
private int _flyRunSpd;
|
||||
private int _flyWalkSpd;
|
||||
private double _moveMultiplier;
|
||||
private int _enchantLevel;
|
||||
private int _armorEnchant;
|
||||
private String _title;
|
||||
|
||||
private final byte[] _masks = new byte[]
|
||||
@ -59,11 +60,6 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
private int _initSize = 5;
|
||||
|
||||
public UserInfo(PlayerInstance player)
|
||||
{
|
||||
this(player, true);
|
||||
}
|
||||
|
||||
public UserInfo(PlayerInstance player, boolean addAll)
|
||||
{
|
||||
_player = player;
|
||||
|
||||
@ -84,9 +80,41 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
_title = "[Invisible]";
|
||||
}
|
||||
|
||||
if (addAll)
|
||||
addComponentType(UserInfoType.values());
|
||||
}
|
||||
|
||||
public UserInfo(PlayerInstance player, boolean addAll)
|
||||
{
|
||||
if (player.setUserInfoPacketLock(true))
|
||||
{
|
||||
addComponentType(UserInfoType.values());
|
||||
_player = player;
|
||||
|
||||
_relation = calculateRelation(player);
|
||||
_moveMultiplier = player.getMovementSpeedMultiplier();
|
||||
_runSpd = (int) Math.round(player.getRunSpeed() / _moveMultiplier);
|
||||
_walkSpd = (int) Math.round(player.getWalkSpeed() / _moveMultiplier);
|
||||
_swimRunSpd = (int) Math.round(player.getSwimRunSpeed() / _moveMultiplier);
|
||||
_swimWalkSpd = (int) Math.round(player.getSwimWalkSpeed() / _moveMultiplier);
|
||||
_flyRunSpd = player.isFlying() ? _runSpd : 0;
|
||||
_flyWalkSpd = player.isFlying() ? _walkSpd : 0;
|
||||
_enchantLevel = player.getInventory().getWeaponEnchant();
|
||||
_armorEnchant = player.getInventory().getArmorMinEnchant();
|
||||
|
||||
_title = player.getTitle();
|
||||
if (player.isGM() && player.isInvisible())
|
||||
{
|
||||
_title = "[Invisible]";
|
||||
}
|
||||
|
||||
if (addAll)
|
||||
{
|
||||
addComponentType(UserInfoType.values());
|
||||
}
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setUserInfoPacketLock(false);
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@ -127,6 +155,11 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.USER_INFO.writeId(packet);
|
||||
|
||||
packet.writeD(_player.getObjectId());
|
||||
|
@ -41,6 +41,7 @@ import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.concurrent.locks.StampedLock;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -723,7 +724,10 @@ public class PlayerInstance extends Playable
|
||||
private ScheduledFuture<?> _taskRentPet;
|
||||
private ScheduledFuture<?> _taskWater;
|
||||
|
||||
private ScheduledFuture<?> _skillListRefreshTask;
|
||||
/** Packet delay locks */
|
||||
private final StampedLock _skillListPacketLock = new StampedLock();
|
||||
private final StampedLock _userInfoPacketLock = new StampedLock();
|
||||
private final StampedLock _storageMaxPacketLock = new StampedLock();
|
||||
|
||||
/** Last Html Npcs, 0 = last html was not bound to an npc */
|
||||
private final int[] _htmlActionOriginObjectIds = new int[HtmlActionScope.values().length];
|
||||
@ -2240,6 +2244,16 @@ public class PlayerInstance extends Playable
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerEquipItem(this, item), this);
|
||||
}
|
||||
|
||||
public boolean setStorageMaxCountPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _storageMaxPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_storageMaxPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the the PvP Kills of the PlayerInstance (Number of player killed during a PvP).
|
||||
*/
|
||||
@ -4085,6 +4099,16 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
}
|
||||
|
||||
public boolean setUserInfoPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _userInfoPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_userInfoPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a Server->Client packet UserInfo to this PlayerInstance and CharInfo to all PlayerInstance in its _KnownPlayers. <B><U> Concept</U> :</B> Others PlayerInstance in the detection area of the PlayerInstance are identified in <B>_knownPlayers</B>. In order to inform other players of this
|
||||
* PlayerInstance state modifications, server just need to go through _knownPlayers to send Server->Client Packet <B><U> Actions</U> :</B>
|
||||
@ -9493,16 +9517,19 @@ public class PlayerInstance extends Playable
|
||||
return _wantsPeace;
|
||||
}
|
||||
|
||||
public boolean setSkillListPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _skillListPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_skillListPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
public void sendSkillList()
|
||||
{
|
||||
if (_skillListRefreshTask == null)
|
||||
{
|
||||
_skillListRefreshTask = ThreadPool.schedule(() ->
|
||||
{
|
||||
sendSkillList(0);
|
||||
_skillListRefreshTask = null;
|
||||
}, 1000);
|
||||
}
|
||||
sendSkillList(0);
|
||||
}
|
||||
|
||||
public void sendSkillList(int lastLearnedSkillId)
|
||||
@ -9906,8 +9933,15 @@ public class PlayerInstance extends Playable
|
||||
removeSkill(oldSkill, false, true);
|
||||
}
|
||||
|
||||
stopAllEffectsExceptThoseThatLastThroughDeath();
|
||||
stopAllEffects();
|
||||
// stopAllEffectsExceptThoseThatLastThroughDeath();
|
||||
getEffectList().stopEffects(info -> !info.getSkill().isStayAfterDeath(), true, false);
|
||||
|
||||
// stopAllEffects();
|
||||
getEffectList().stopEffects(info -> !info.getSkill().isNecessaryToggle() && !info.getSkill().isIrreplacableBuff(), true, false);
|
||||
|
||||
// Update abnormal visual effects.
|
||||
sendPacket(new ExUserInfoAbnormalVisualEffect(this));
|
||||
|
||||
stopCubics();
|
||||
|
||||
restoreRecipeBook(false);
|
||||
|
@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
|
||||
import org.l2jmobius.gameserver.model.SkillLearn;
|
||||
@ -31,19 +32,32 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
*/
|
||||
public class AcquireSkillList implements IClientOutgoingPacket
|
||||
{
|
||||
final PlayerInstance _player;
|
||||
final List<SkillLearn> _learnable;
|
||||
private PlayerInstance _player;
|
||||
private List<SkillLearn> _learnable;
|
||||
|
||||
public AcquireSkillList(PlayerInstance player)
|
||||
{
|
||||
_player = player;
|
||||
_learnable = SkillTreesData.getInstance().getAvailableSkills(player, player.getClassId(), false, false);
|
||||
_learnable.addAll(SkillTreesData.getInstance().getNextAvailableSkills(player, player.getClassId(), false, false));
|
||||
if (player.setSkillListPacketLock(true))
|
||||
{
|
||||
_player = player;
|
||||
_learnable = SkillTreesData.getInstance().getAvailableSkills(player, player.getClassId(), false, false);
|
||||
_learnable.addAll(SkillTreesData.getInstance().getNextAvailableSkills(player, player.getClassId(), false, false));
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setSkillListPacketLock(false);
|
||||
}, 300);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.ACQUIRE_SKILL_LIST.writeId(packet);
|
||||
|
||||
packet.writeH(_learnable.size());
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.Stats;
|
||||
@ -27,34 +28,49 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
*/
|
||||
public class ExStorageMaxCount implements IClientOutgoingPacket
|
||||
{
|
||||
private final int _inventory;
|
||||
private final int _warehouse;
|
||||
// private final int _freight; // Removed with 152.
|
||||
private final int _clan;
|
||||
private final int _privateSell;
|
||||
private final int _privateBuy;
|
||||
private final int _receipeD;
|
||||
private final int _recipe;
|
||||
private final int _inventoryExtraSlots;
|
||||
private final int _inventoryQuestItems;
|
||||
private PlayerInstance _player;
|
||||
private int _inventory;
|
||||
private int _warehouse;
|
||||
// private int _freight; // Removed with 152.
|
||||
private int _clan;
|
||||
private int _privateSell;
|
||||
private int _privateBuy;
|
||||
private int _receipeD;
|
||||
private int _recipe;
|
||||
private int _inventoryExtraSlots;
|
||||
private int _inventoryQuestItems;
|
||||
|
||||
public ExStorageMaxCount(PlayerInstance player)
|
||||
{
|
||||
_inventory = player.getInventoryLimit();
|
||||
_warehouse = player.getWareHouseLimit();
|
||||
// _freight = Config.ALT_FREIGHT_SLOTS; // Removed with 152.
|
||||
_privateSell = player.getPrivateSellStoreLimit();
|
||||
_privateBuy = player.getPrivateBuyStoreLimit();
|
||||
_clan = Config.WAREHOUSE_SLOTS_CLAN;
|
||||
_receipeD = player.getDwarfRecipeLimit();
|
||||
_recipe = player.getCommonRecipeLimit();
|
||||
_inventoryExtraSlots = (int) player.getStat().getValue(Stats.INVENTORY_NORMAL, 0);
|
||||
_inventoryQuestItems = Config.INVENTORY_MAXIMUM_QUEST_ITEMS;
|
||||
if (player.setStorageMaxCountPacketLock(true))
|
||||
{
|
||||
_player = player;
|
||||
_inventory = player.getInventoryLimit();
|
||||
_warehouse = player.getWareHouseLimit();
|
||||
// _freight = Config.ALT_FREIGHT_SLOTS; // Removed with 152.
|
||||
_privateSell = player.getPrivateSellStoreLimit();
|
||||
_privateBuy = player.getPrivateBuyStoreLimit();
|
||||
_clan = Config.WAREHOUSE_SLOTS_CLAN;
|
||||
_receipeD = player.getDwarfRecipeLimit();
|
||||
_recipe = player.getCommonRecipeLimit();
|
||||
_inventoryExtraSlots = (int) player.getStat().getValue(Stats.INVENTORY_NORMAL, 0);
|
||||
_inventoryQuestItems = Config.INVENTORY_MAXIMUM_QUEST_ITEMS;
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setStorageMaxCountPacketLock(false);
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.EX_STORAGE_MAX_COUNT.writeId(packet);
|
||||
|
||||
packet.writeD(_inventory);
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ExperienceData;
|
||||
import org.l2jmobius.gameserver.enums.UserInfoType;
|
||||
@ -33,20 +34,20 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
*/
|
||||
public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
{
|
||||
private final PlayerInstance _player;
|
||||
private PlayerInstance _player;
|
||||
|
||||
private final int _relation;
|
||||
private final int _runSpd;
|
||||
private final int _walkSpd;
|
||||
private final int _swimRunSpd;
|
||||
private final int _swimWalkSpd;
|
||||
private int _relation;
|
||||
private int _runSpd;
|
||||
private int _walkSpd;
|
||||
private int _swimRunSpd;
|
||||
private int _swimWalkSpd;
|
||||
private final int _flRunSpd = 0;
|
||||
private final int _flWalkSpd = 0;
|
||||
private final int _flyRunSpd;
|
||||
private final int _flyWalkSpd;
|
||||
private final double _moveMultiplier;
|
||||
private final int _enchantLevel;
|
||||
private final int _armorEnchant;
|
||||
private int _flyRunSpd;
|
||||
private int _flyWalkSpd;
|
||||
private double _moveMultiplier;
|
||||
private int _enchantLevel;
|
||||
private int _armorEnchant;
|
||||
private String _title;
|
||||
|
||||
private final byte[] _masks = new byte[]
|
||||
@ -59,11 +60,6 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
private int _initSize = 5;
|
||||
|
||||
public UserInfo(PlayerInstance player)
|
||||
{
|
||||
this(player, true);
|
||||
}
|
||||
|
||||
public UserInfo(PlayerInstance player, boolean addAll)
|
||||
{
|
||||
_player = player;
|
||||
|
||||
@ -84,9 +80,41 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
_title = "[Invisible]";
|
||||
}
|
||||
|
||||
if (addAll)
|
||||
addComponentType(UserInfoType.values());
|
||||
}
|
||||
|
||||
public UserInfo(PlayerInstance player, boolean addAll)
|
||||
{
|
||||
if (player.setUserInfoPacketLock(true))
|
||||
{
|
||||
addComponentType(UserInfoType.values());
|
||||
_player = player;
|
||||
|
||||
_relation = calculateRelation(player);
|
||||
_moveMultiplier = player.getMovementSpeedMultiplier();
|
||||
_runSpd = (int) Math.round(player.getRunSpeed() / _moveMultiplier);
|
||||
_walkSpd = (int) Math.round(player.getWalkSpeed() / _moveMultiplier);
|
||||
_swimRunSpd = (int) Math.round(player.getSwimRunSpeed() / _moveMultiplier);
|
||||
_swimWalkSpd = (int) Math.round(player.getSwimWalkSpeed() / _moveMultiplier);
|
||||
_flyRunSpd = player.isFlying() ? _runSpd : 0;
|
||||
_flyWalkSpd = player.isFlying() ? _walkSpd : 0;
|
||||
_enchantLevel = player.getInventory().getWeaponEnchant();
|
||||
_armorEnchant = player.getInventory().getArmorMinEnchant();
|
||||
|
||||
_title = player.getTitle();
|
||||
if (player.isGM() && player.isInvisible())
|
||||
{
|
||||
_title = "[Invisible]";
|
||||
}
|
||||
|
||||
if (addAll)
|
||||
{
|
||||
addComponentType(UserInfoType.values());
|
||||
}
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setUserInfoPacketLock(false);
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@ -127,6 +155,11 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.USER_INFO.writeId(packet);
|
||||
|
||||
packet.writeD(_player.getObjectId());
|
||||
|
@ -41,6 +41,7 @@ import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.concurrent.locks.StampedLock;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -718,7 +719,10 @@ public class PlayerInstance extends Playable
|
||||
private ScheduledFuture<?> _taskRentPet;
|
||||
private ScheduledFuture<?> _taskWater;
|
||||
|
||||
private ScheduledFuture<?> _skillListRefreshTask;
|
||||
/** Packet delay locks */
|
||||
private final StampedLock _skillListPacketLock = new StampedLock();
|
||||
private final StampedLock _userInfoPacketLock = new StampedLock();
|
||||
private final StampedLock _storageMaxPacketLock = new StampedLock();
|
||||
|
||||
/** Last Html Npcs, 0 = last html was not bound to an npc */
|
||||
private final int[] _htmlActionOriginObjectIds = new int[HtmlActionScope.values().length];
|
||||
@ -2143,6 +2147,16 @@ public class PlayerInstance extends Playable
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerEquipItem(this, item), this);
|
||||
}
|
||||
|
||||
public boolean setStorageMaxCountPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _storageMaxPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_storageMaxPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the the PvP Kills of the PlayerInstance (Number of player killed during a PvP).
|
||||
*/
|
||||
@ -3988,6 +4002,16 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
}
|
||||
|
||||
public boolean setUserInfoPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _userInfoPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_userInfoPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a Server->Client packet UserInfo to this PlayerInstance and CharInfo to all PlayerInstance in its _KnownPlayers. <B><U> Concept</U> :</B> Others PlayerInstance in the detection area of the PlayerInstance are identified in <B>_knownPlayers</B>. In order to inform other players of this
|
||||
* PlayerInstance state modifications, server just need to go through _knownPlayers to send Server->Client Packet <B><U> Actions</U> :</B>
|
||||
@ -9393,16 +9417,19 @@ public class PlayerInstance extends Playable
|
||||
return _wantsPeace;
|
||||
}
|
||||
|
||||
public boolean setSkillListPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _skillListPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_skillListPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
public void sendSkillList()
|
||||
{
|
||||
if (_skillListRefreshTask == null)
|
||||
{
|
||||
_skillListRefreshTask = ThreadPool.schedule(() ->
|
||||
{
|
||||
sendSkillList(0);
|
||||
_skillListRefreshTask = null;
|
||||
}, 1000);
|
||||
}
|
||||
sendSkillList(0);
|
||||
}
|
||||
|
||||
public void sendSkillList(int lastLearnedSkillId)
|
||||
@ -9801,8 +9828,15 @@ public class PlayerInstance extends Playable
|
||||
removeSkill(oldSkill, false, true);
|
||||
}
|
||||
|
||||
stopAllEffectsExceptThoseThatLastThroughDeath();
|
||||
stopAllEffects();
|
||||
// stopAllEffectsExceptThoseThatLastThroughDeath();
|
||||
getEffectList().stopEffects(info -> !info.getSkill().isStayAfterDeath(), true, false);
|
||||
|
||||
// stopAllEffects();
|
||||
getEffectList().stopEffects(info -> !info.getSkill().isNecessaryToggle() && !info.getSkill().isIrreplacableBuff(), true, false);
|
||||
|
||||
// Update abnormal visual effects.
|
||||
sendPacket(new ExUserInfoAbnormalVisualEffect(this));
|
||||
|
||||
stopCubics();
|
||||
|
||||
restoreRecipeBook(false);
|
||||
|
@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
|
||||
import org.l2jmobius.gameserver.model.SkillLearn;
|
||||
@ -31,19 +32,32 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
*/
|
||||
public class AcquireSkillList implements IClientOutgoingPacket
|
||||
{
|
||||
final PlayerInstance _player;
|
||||
final List<SkillLearn> _learnable;
|
||||
private PlayerInstance _player;
|
||||
private List<SkillLearn> _learnable;
|
||||
|
||||
public AcquireSkillList(PlayerInstance player)
|
||||
{
|
||||
_player = player;
|
||||
_learnable = SkillTreesData.getInstance().getAvailableSkills(player, player.getClassId(), false, false);
|
||||
_learnable.addAll(SkillTreesData.getInstance().getNextAvailableSkills(player, player.getClassId(), false, false));
|
||||
if (player.setSkillListPacketLock(true))
|
||||
{
|
||||
_player = player;
|
||||
_learnable = SkillTreesData.getInstance().getAvailableSkills(player, player.getClassId(), false, false);
|
||||
_learnable.addAll(SkillTreesData.getInstance().getNextAvailableSkills(player, player.getClassId(), false, false));
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setSkillListPacketLock(false);
|
||||
}, 300);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.ACQUIRE_SKILL_LIST.writeId(packet);
|
||||
|
||||
packet.writeH(_learnable.size());
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.Stats;
|
||||
@ -27,34 +28,49 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
*/
|
||||
public class ExStorageMaxCount implements IClientOutgoingPacket
|
||||
{
|
||||
private final int _inventory;
|
||||
private final int _warehouse;
|
||||
// private final int _freight; // Removed with 152.
|
||||
private final int _clan;
|
||||
private final int _privateSell;
|
||||
private final int _privateBuy;
|
||||
private final int _receipeD;
|
||||
private final int _recipe;
|
||||
private final int _inventoryExtraSlots;
|
||||
private final int _inventoryQuestItems;
|
||||
private PlayerInstance _player;
|
||||
private int _inventory;
|
||||
private int _warehouse;
|
||||
// private int _freight; // Removed with 152.
|
||||
private int _clan;
|
||||
private int _privateSell;
|
||||
private int _privateBuy;
|
||||
private int _receipeD;
|
||||
private int _recipe;
|
||||
private int _inventoryExtraSlots;
|
||||
private int _inventoryQuestItems;
|
||||
|
||||
public ExStorageMaxCount(PlayerInstance player)
|
||||
{
|
||||
_inventory = player.getInventoryLimit();
|
||||
_warehouse = player.getWareHouseLimit();
|
||||
// _freight = Config.ALT_FREIGHT_SLOTS; // Removed with 152.
|
||||
_privateSell = player.getPrivateSellStoreLimit();
|
||||
_privateBuy = player.getPrivateBuyStoreLimit();
|
||||
_clan = Config.WAREHOUSE_SLOTS_CLAN;
|
||||
_receipeD = player.getDwarfRecipeLimit();
|
||||
_recipe = player.getCommonRecipeLimit();
|
||||
_inventoryExtraSlots = (int) player.getStat().getValue(Stats.INVENTORY_NORMAL, 0);
|
||||
_inventoryQuestItems = Config.INVENTORY_MAXIMUM_QUEST_ITEMS;
|
||||
if (player.setStorageMaxCountPacketLock(true))
|
||||
{
|
||||
_player = player;
|
||||
_inventory = player.getInventoryLimit();
|
||||
_warehouse = player.getWareHouseLimit();
|
||||
// _freight = Config.ALT_FREIGHT_SLOTS; // Removed with 152.
|
||||
_privateSell = player.getPrivateSellStoreLimit();
|
||||
_privateBuy = player.getPrivateBuyStoreLimit();
|
||||
_clan = Config.WAREHOUSE_SLOTS_CLAN;
|
||||
_receipeD = player.getDwarfRecipeLimit();
|
||||
_recipe = player.getCommonRecipeLimit();
|
||||
_inventoryExtraSlots = (int) player.getStat().getValue(Stats.INVENTORY_NORMAL, 0);
|
||||
_inventoryQuestItems = Config.INVENTORY_MAXIMUM_QUEST_ITEMS;
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setStorageMaxCountPacketLock(false);
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.EX_STORAGE_MAX_COUNT.writeId(packet);
|
||||
|
||||
packet.writeD(_inventory);
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ExperienceData;
|
||||
import org.l2jmobius.gameserver.enums.UserInfoType;
|
||||
@ -33,20 +34,20 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
*/
|
||||
public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
{
|
||||
private final PlayerInstance _player;
|
||||
private PlayerInstance _player;
|
||||
|
||||
private final int _relation;
|
||||
private final int _runSpd;
|
||||
private final int _walkSpd;
|
||||
private final int _swimRunSpd;
|
||||
private final int _swimWalkSpd;
|
||||
private int _relation;
|
||||
private int _runSpd;
|
||||
private int _walkSpd;
|
||||
private int _swimRunSpd;
|
||||
private int _swimWalkSpd;
|
||||
private final int _flRunSpd = 0;
|
||||
private final int _flWalkSpd = 0;
|
||||
private final int _flyRunSpd;
|
||||
private final int _flyWalkSpd;
|
||||
private final double _moveMultiplier;
|
||||
private final int _enchantLevel;
|
||||
private final int _armorEnchant;
|
||||
private int _flyRunSpd;
|
||||
private int _flyWalkSpd;
|
||||
private double _moveMultiplier;
|
||||
private int _enchantLevel;
|
||||
private int _armorEnchant;
|
||||
private String _title;
|
||||
|
||||
private final byte[] _masks = new byte[]
|
||||
@ -60,11 +61,6 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
private int _initSize = 5;
|
||||
|
||||
public UserInfo(PlayerInstance player)
|
||||
{
|
||||
this(player, true);
|
||||
}
|
||||
|
||||
public UserInfo(PlayerInstance player, boolean addAll)
|
||||
{
|
||||
_player = player;
|
||||
|
||||
@ -85,9 +81,41 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
_title = "[Invisible]";
|
||||
}
|
||||
|
||||
if (addAll)
|
||||
addComponentType(UserInfoType.values());
|
||||
}
|
||||
|
||||
public UserInfo(PlayerInstance player, boolean addAll)
|
||||
{
|
||||
if (player.setUserInfoPacketLock(true))
|
||||
{
|
||||
addComponentType(UserInfoType.values());
|
||||
_player = player;
|
||||
|
||||
_relation = calculateRelation(player);
|
||||
_moveMultiplier = player.getMovementSpeedMultiplier();
|
||||
_runSpd = (int) Math.round(player.getRunSpeed() / _moveMultiplier);
|
||||
_walkSpd = (int) Math.round(player.getWalkSpeed() / _moveMultiplier);
|
||||
_swimRunSpd = (int) Math.round(player.getSwimRunSpeed() / _moveMultiplier);
|
||||
_swimWalkSpd = (int) Math.round(player.getSwimWalkSpeed() / _moveMultiplier);
|
||||
_flyRunSpd = player.isFlying() ? _runSpd : 0;
|
||||
_flyWalkSpd = player.isFlying() ? _walkSpd : 0;
|
||||
_enchantLevel = player.getInventory().getWeaponEnchant();
|
||||
_armorEnchant = player.getInventory().getArmorMinEnchant();
|
||||
|
||||
_title = player.getTitle();
|
||||
if (player.isGM() && player.isInvisible())
|
||||
{
|
||||
_title = "[Invisible]";
|
||||
}
|
||||
|
||||
if (addAll)
|
||||
{
|
||||
addComponentType(UserInfoType.values());
|
||||
}
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setUserInfoPacketLock(false);
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@ -128,6 +156,11 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.USER_INFO.writeId(packet);
|
||||
|
||||
packet.writeD(_player.getObjectId());
|
||||
|
@ -41,6 +41,7 @@ import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.concurrent.locks.StampedLock;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -718,7 +719,10 @@ public class PlayerInstance extends Playable
|
||||
private ScheduledFuture<?> _taskRentPet;
|
||||
private ScheduledFuture<?> _taskWater;
|
||||
|
||||
private ScheduledFuture<?> _skillListRefreshTask;
|
||||
/** Packet delay locks */
|
||||
private final StampedLock _skillListPacketLock = new StampedLock();
|
||||
private final StampedLock _userInfoPacketLock = new StampedLock();
|
||||
private final StampedLock _storageMaxPacketLock = new StampedLock();
|
||||
|
||||
/** Last Html Npcs, 0 = last html was not bound to an npc */
|
||||
private final int[] _htmlActionOriginObjectIds = new int[HtmlActionScope.values().length];
|
||||
@ -2232,6 +2236,16 @@ public class PlayerInstance extends Playable
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerEquipItem(this, item), this);
|
||||
}
|
||||
|
||||
public boolean setStorageMaxCountPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _storageMaxPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_storageMaxPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the the PvP Kills of the PlayerInstance (Number of player killed during a PvP).
|
||||
*/
|
||||
@ -4091,6 +4105,16 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
}
|
||||
|
||||
public boolean setUserInfoPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _userInfoPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_userInfoPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a Server->Client packet UserInfo to this PlayerInstance and CharInfo to all PlayerInstance in its _KnownPlayers. <B><U> Concept</U> :</B> Others PlayerInstance in the detection area of the PlayerInstance are identified in <B>_knownPlayers</B>. In order to inform other players of this
|
||||
* PlayerInstance state modifications, server just need to go through _knownPlayers to send Server->Client Packet <B><U> Actions</U> :</B>
|
||||
@ -9481,16 +9505,19 @@ public class PlayerInstance extends Playable
|
||||
return _wantsPeace;
|
||||
}
|
||||
|
||||
public boolean setSkillListPacketLock(boolean lock)
|
||||
{
|
||||
if (lock)
|
||||
{
|
||||
return _skillListPacketLock.tryWriteLock() != 0;
|
||||
}
|
||||
_skillListPacketLock.tryUnlockWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
public void sendSkillList()
|
||||
{
|
||||
if (_skillListRefreshTask == null)
|
||||
{
|
||||
_skillListRefreshTask = ThreadPool.schedule(() ->
|
||||
{
|
||||
sendSkillList(0);
|
||||
_skillListRefreshTask = null;
|
||||
}, 1000);
|
||||
}
|
||||
sendSkillList(0);
|
||||
}
|
||||
|
||||
public void sendSkillList(int lastLearnedSkillId)
|
||||
@ -9894,8 +9921,15 @@ public class PlayerInstance extends Playable
|
||||
removeSkill(oldSkill, false, true);
|
||||
}
|
||||
|
||||
stopAllEffectsExceptThoseThatLastThroughDeath();
|
||||
stopAllEffects();
|
||||
// stopAllEffectsExceptThoseThatLastThroughDeath();
|
||||
getEffectList().stopEffects(info -> !info.getSkill().isStayAfterDeath(), true, false);
|
||||
|
||||
// stopAllEffects();
|
||||
getEffectList().stopEffects(info -> !info.getSkill().isNecessaryToggle() && !info.getSkill().isIrreplacableBuff(), true, false);
|
||||
|
||||
// Update abnormal visual effects.
|
||||
sendPacket(new ExUserInfoAbnormalVisualEffect(this));
|
||||
|
||||
stopCubics();
|
||||
|
||||
restoreRecipeBook(false);
|
||||
|
@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
|
||||
import org.l2jmobius.gameserver.model.SkillLearn;
|
||||
@ -31,19 +32,32 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
*/
|
||||
public class AcquireSkillList implements IClientOutgoingPacket
|
||||
{
|
||||
final PlayerInstance _player;
|
||||
final List<SkillLearn> _learnable;
|
||||
private PlayerInstance _player;
|
||||
private List<SkillLearn> _learnable;
|
||||
|
||||
public AcquireSkillList(PlayerInstance player)
|
||||
{
|
||||
_player = player;
|
||||
_learnable = SkillTreesData.getInstance().getAvailableSkills(player, player.getClassId(), false, false);
|
||||
_learnable.addAll(SkillTreesData.getInstance().getNextAvailableSkills(player, player.getClassId(), false, false));
|
||||
if (player.setSkillListPacketLock(true))
|
||||
{
|
||||
_player = player;
|
||||
_learnable = SkillTreesData.getInstance().getAvailableSkills(player, player.getClassId(), false, false);
|
||||
_learnable.addAll(SkillTreesData.getInstance().getNextAvailableSkills(player, player.getClassId(), false, false));
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setSkillListPacketLock(false);
|
||||
}, 300);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.ACQUIRE_SKILL_LIST.writeId(packet);
|
||||
|
||||
packet.writeH(_learnable.size());
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.Stats;
|
||||
@ -27,34 +28,49 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
*/
|
||||
public class ExStorageMaxCount implements IClientOutgoingPacket
|
||||
{
|
||||
private final int _inventory;
|
||||
private final int _warehouse;
|
||||
private final int _freight;
|
||||
private final int _clan;
|
||||
private final int _privateSell;
|
||||
private final int _privateBuy;
|
||||
private final int _receipeD;
|
||||
private final int _recipe;
|
||||
private final int _inventoryExtraSlots;
|
||||
private final int _inventoryQuestItems;
|
||||
private PlayerInstance _player;
|
||||
private int _inventory;
|
||||
private int _warehouse;
|
||||
private int _freight;
|
||||
private int _clan;
|
||||
private int _privateSell;
|
||||
private int _privateBuy;
|
||||
private int _receipeD;
|
||||
private int _recipe;
|
||||
private int _inventoryExtraSlots;
|
||||
private int _inventoryQuestItems;
|
||||
|
||||
public ExStorageMaxCount(PlayerInstance player)
|
||||
{
|
||||
_inventory = player.getInventoryLimit();
|
||||
_warehouse = player.getWareHouseLimit();
|
||||
_freight = Config.ALT_FREIGHT_SLOTS;
|
||||
_privateSell = player.getPrivateSellStoreLimit();
|
||||
_privateBuy = player.getPrivateBuyStoreLimit();
|
||||
_clan = Config.WAREHOUSE_SLOTS_CLAN;
|
||||
_receipeD = player.getDwarfRecipeLimit();
|
||||
_recipe = player.getCommonRecipeLimit();
|
||||
_inventoryExtraSlots = (int) player.getStat().getValue(Stats.INVENTORY_NORMAL, 0);
|
||||
_inventoryQuestItems = Config.INVENTORY_MAXIMUM_QUEST_ITEMS;
|
||||
if (player.setStorageMaxCountPacketLock(true))
|
||||
{
|
||||
_player = player;
|
||||
_inventory = player.getInventoryLimit();
|
||||
_warehouse = player.getWareHouseLimit();
|
||||
_freight = Config.ALT_FREIGHT_SLOTS;
|
||||
_privateSell = player.getPrivateSellStoreLimit();
|
||||
_privateBuy = player.getPrivateBuyStoreLimit();
|
||||
_clan = Config.WAREHOUSE_SLOTS_CLAN;
|
||||
_receipeD = player.getDwarfRecipeLimit();
|
||||
_recipe = player.getCommonRecipeLimit();
|
||||
_inventoryExtraSlots = (int) player.getStat().getValue(Stats.INVENTORY_NORMAL, 0);
|
||||
_inventoryQuestItems = Config.INVENTORY_MAXIMUM_QUEST_ITEMS;
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setStorageMaxCountPacketLock(false);
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.EX_STORAGE_MAX_COUNT.writeId(packet);
|
||||
|
||||
packet.writeD(_inventory);
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ExperienceData;
|
||||
import org.l2jmobius.gameserver.enums.UserInfoType;
|
||||
@ -29,25 +30,24 @@ import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
|
||||
/**
|
||||
* @author Sdw, UnAfraid, proGenitor <br>
|
||||
* Experimental packet compatible for L2Classic 2.0.
|
||||
* @author Sdw, UnAfraid
|
||||
*/
|
||||
public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
{
|
||||
private final PlayerInstance _player;
|
||||
private PlayerInstance _player;
|
||||
|
||||
private final int _relation;
|
||||
private final int _runSpd;
|
||||
private final int _walkSpd;
|
||||
private final int _swimRunSpd;
|
||||
private final int _swimWalkSpd;
|
||||
private int _relation;
|
||||
private int _runSpd;
|
||||
private int _walkSpd;
|
||||
private int _swimRunSpd;
|
||||
private int _swimWalkSpd;
|
||||
private final int _flRunSpd = 0;
|
||||
private final int _flWalkSpd = 0;
|
||||
private final int _flyRunSpd;
|
||||
private final int _flyWalkSpd;
|
||||
private final double _moveMultiplier;
|
||||
private final int _enchantLevel;
|
||||
private final int _armorEnchant;
|
||||
private int _flyRunSpd;
|
||||
private int _flyWalkSpd;
|
||||
private double _moveMultiplier;
|
||||
private int _enchantLevel;
|
||||
private int _armorEnchant;
|
||||
private String _title;
|
||||
|
||||
private final byte[] _masks = new byte[]
|
||||
@ -60,11 +60,6 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
private int _initSize = 5;
|
||||
|
||||
public UserInfo(PlayerInstance player)
|
||||
{
|
||||
this(player, true);
|
||||
}
|
||||
|
||||
public UserInfo(PlayerInstance player, boolean addAll)
|
||||
{
|
||||
_player = player;
|
||||
|
||||
@ -85,9 +80,41 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
_title = "[Invisible]";
|
||||
}
|
||||
|
||||
if (addAll)
|
||||
addComponentType(UserInfoType.values());
|
||||
}
|
||||
|
||||
public UserInfo(PlayerInstance player, boolean addAll)
|
||||
{
|
||||
if (player.setUserInfoPacketLock(true))
|
||||
{
|
||||
addComponentType(UserInfoType.values());
|
||||
_player = player;
|
||||
|
||||
_relation = calculateRelation(player);
|
||||
_moveMultiplier = player.getMovementSpeedMultiplier();
|
||||
_runSpd = (int) Math.round(player.getRunSpeed() / _moveMultiplier);
|
||||
_walkSpd = (int) Math.round(player.getWalkSpeed() / _moveMultiplier);
|
||||
_swimRunSpd = (int) Math.round(player.getSwimRunSpeed() / _moveMultiplier);
|
||||
_swimWalkSpd = (int) Math.round(player.getSwimWalkSpeed() / _moveMultiplier);
|
||||
_flyRunSpd = player.isFlying() ? _runSpd : 0;
|
||||
_flyWalkSpd = player.isFlying() ? _walkSpd : 0;
|
||||
_enchantLevel = player.getInventory().getWeaponEnchant();
|
||||
_armorEnchant = player.getInventory().getArmorMinEnchant();
|
||||
|
||||
_title = player.getTitle();
|
||||
if (player.isGM() && player.isInvisible())
|
||||
{
|
||||
_title = "[Invisible]";
|
||||
}
|
||||
|
||||
if (addAll)
|
||||
{
|
||||
addComponentType(UserInfoType.values());
|
||||
}
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
player.setUserInfoPacketLock(false);
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@ -128,6 +155,11 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutgoingPackets.USER_INFO.writeId(packet);
|
||||
|
||||
packet.writeD(_player.getObjectId());
|
||||
|
Loading…
Reference in New Issue
Block a user