Prevent flood from container items.
This commit is contained in:
parent
6d1d12f8ec
commit
9ba9ae38af
@ -561,10 +561,9 @@ public class Player extends Playable
|
||||
private final PlayerFreight _freight = new PlayerFreight(this);
|
||||
private PlayerWarehouse _warehouse;
|
||||
private PlayerRefund _refund;
|
||||
|
||||
private PrivateStoreType _privateStoreType = PrivateStoreType.NONE;
|
||||
|
||||
private TradeList _activeTradeList;
|
||||
private boolean _isUsingContainerItem;
|
||||
private ItemContainer _activeWarehouse;
|
||||
private Map<Integer, ManufactureItem> _manufactureItems;
|
||||
private String _storeName = "";
|
||||
@ -5597,6 +5596,16 @@ public class Player extends Playable
|
||||
return _activeWarehouse;
|
||||
}
|
||||
|
||||
public boolean isUsingContainerItem()
|
||||
{
|
||||
return _isUsingContainerItem;
|
||||
}
|
||||
|
||||
public void setUsingContainerItem(boolean value)
|
||||
{
|
||||
_isUsingContainerItem = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Select the TradeList to be used in next activity.
|
||||
* @param tradeList
|
||||
|
@ -51,7 +51,6 @@ import org.l2jmobius.gameserver.util.Util;
|
||||
public class PlayerStat extends PlayableStat
|
||||
{
|
||||
private long _startingXp;
|
||||
/** Player's maximum talisman count. */
|
||||
private final AtomicInteger _talismanSlots = new AtomicInteger();
|
||||
private boolean _cloakSlot = false;
|
||||
private int _vitalityPoints = 0;
|
||||
@ -663,7 +662,7 @@ public class PlayerStat extends PlayableStat
|
||||
@Override
|
||||
public void recalculateStats(boolean broadcast)
|
||||
{
|
||||
if (!getActiveChar().isChangingClass())
|
||||
if (!getActiveChar().isChangingClass() && !getActiveChar().isUsingContainerItem())
|
||||
{
|
||||
super.recalculateStats(broadcast);
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.logging.Level;
|
||||
@ -33,6 +34,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.CommonUtil;
|
||||
import org.l2jmobius.gameserver.cache.PaperdollCache;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
@ -73,6 +75,8 @@ public abstract class Inventory extends ItemContainer
|
||||
{
|
||||
protected static final Logger LOGGER = Logger.getLogger(Inventory.class.getName());
|
||||
|
||||
private ScheduledFuture<?> _containerItemTask;
|
||||
|
||||
public interface PaperdollListener
|
||||
{
|
||||
void notifyEquiped(int slot, Item inst, Inventory inventory);
|
||||
@ -1698,6 +1702,7 @@ public abstract class Inventory extends ItemContainer
|
||||
case ItemTemplate.SLOT_R_BRACELET:
|
||||
{
|
||||
pdollSlot = PAPERDOLL_RBRACELET;
|
||||
containerItemCheck();
|
||||
break;
|
||||
}
|
||||
case ItemTemplate.SLOT_DECO:
|
||||
@ -1713,6 +1718,7 @@ public abstract class Inventory extends ItemContainer
|
||||
case ItemTemplate.SLOT_BROOCH:
|
||||
{
|
||||
pdollSlot = PAPERDOLL_BROOCH;
|
||||
containerItemCheck();
|
||||
break;
|
||||
}
|
||||
case ItemTemplate.SLOT_BROOCH_JEWEL:
|
||||
@ -1738,6 +1744,26 @@ public abstract class Inventory extends ItemContainer
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Avoid flood from container items.
|
||||
*/
|
||||
private void containerItemCheck()
|
||||
{
|
||||
final Creature owner = getOwner();
|
||||
if ((owner != null) && owner.isPlayer() && (_containerItemTask == null))
|
||||
{
|
||||
owner.getActingPlayer().setUsingContainerItem(true);
|
||||
_containerItemTask = ThreadPool.schedule(() ->
|
||||
{
|
||||
owner.getActingPlayer().setUsingContainerItem(false);
|
||||
owner.getStat().recalculateStats(true);
|
||||
owner.updateAbnormalVisualEffects();
|
||||
owner.getActingPlayer().sendSkillList();
|
||||
_containerItemTask = null;
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Equips item and returns list of alterations<br>
|
||||
* <b>If you don't need return value use {@link Inventory#equipItem(Item)} instead</b>
|
||||
|
@ -229,8 +229,8 @@ public class GameClient extends ChannelInboundHandler<GameClient>
|
||||
|
||||
if (_player != null)
|
||||
{
|
||||
// Avoid flood from class change.
|
||||
if (_player.isChangingClass() && ((packet instanceof SkillList) || (packet instanceof AcquireSkillList) || (packet instanceof ExUserInfoAbnormalVisualEffect) || (packet instanceof AbnormalStatusUpdate) || (packet instanceof ExAbnormalStatusUpdateFromTarget)))
|
||||
// Avoid flood from class change or container items.
|
||||
if ((_player.isChangingClass() || _player.isUsingContainerItem()) && ((packet instanceof SkillList) || (packet instanceof AcquireSkillList) || (packet instanceof ExUserInfoAbnormalVisualEffect) || (packet instanceof AbnormalStatusUpdate) || (packet instanceof ExAbnormalStatusUpdateFromTarget)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -563,10 +563,9 @@ public class Player extends Playable
|
||||
private final PlayerFreight _freight = new PlayerFreight(this);
|
||||
private PlayerWarehouse _warehouse;
|
||||
private PlayerRefund _refund;
|
||||
|
||||
private PrivateStoreType _privateStoreType = PrivateStoreType.NONE;
|
||||
|
||||
private TradeList _activeTradeList;
|
||||
private boolean _isUsingContainerItem;
|
||||
private ItemContainer _activeWarehouse;
|
||||
private Map<Integer, ManufactureItem> _manufactureItems;
|
||||
private String _storeName = "";
|
||||
@ -5599,6 +5598,16 @@ public class Player extends Playable
|
||||
return _activeWarehouse;
|
||||
}
|
||||
|
||||
public boolean isUsingContainerItem()
|
||||
{
|
||||
return _isUsingContainerItem;
|
||||
}
|
||||
|
||||
public void setUsingContainerItem(boolean value)
|
||||
{
|
||||
_isUsingContainerItem = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Select the TradeList to be used in next activity.
|
||||
* @param tradeList
|
||||
|
@ -52,7 +52,6 @@ import org.l2jmobius.gameserver.util.Util;
|
||||
public class PlayerStat extends PlayableStat
|
||||
{
|
||||
private long _startingXp;
|
||||
/** Player's maximum talisman count. */
|
||||
private final AtomicInteger _talismanSlots = new AtomicInteger();
|
||||
private boolean _cloakSlot = false;
|
||||
private int _vitalityPoints = 0;
|
||||
@ -665,7 +664,7 @@ public class PlayerStat extends PlayableStat
|
||||
@Override
|
||||
public void recalculateStats(boolean broadcast)
|
||||
{
|
||||
if (!getActiveChar().isChangingClass())
|
||||
if (!getActiveChar().isChangingClass() && !getActiveChar().isUsingContainerItem())
|
||||
{
|
||||
super.recalculateStats(broadcast);
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.logging.Level;
|
||||
@ -33,6 +34,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.CommonUtil;
|
||||
import org.l2jmobius.gameserver.cache.PaperdollCache;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
@ -73,6 +75,8 @@ public abstract class Inventory extends ItemContainer
|
||||
{
|
||||
protected static final Logger LOGGER = Logger.getLogger(Inventory.class.getName());
|
||||
|
||||
private ScheduledFuture<?> _containerItemTask;
|
||||
|
||||
public interface PaperdollListener
|
||||
{
|
||||
void notifyEquiped(int slot, Item inst, Inventory inventory);
|
||||
@ -1704,6 +1708,7 @@ public abstract class Inventory extends ItemContainer
|
||||
case ItemTemplate.SLOT_R_BRACELET:
|
||||
{
|
||||
pdollSlot = PAPERDOLL_RBRACELET;
|
||||
containerItemCheck();
|
||||
break;
|
||||
}
|
||||
case ItemTemplate.SLOT_DECO:
|
||||
@ -1719,6 +1724,7 @@ public abstract class Inventory extends ItemContainer
|
||||
case ItemTemplate.SLOT_BROOCH:
|
||||
{
|
||||
pdollSlot = PAPERDOLL_BROOCH;
|
||||
containerItemCheck();
|
||||
break;
|
||||
}
|
||||
case ItemTemplate.SLOT_BROOCH_JEWEL:
|
||||
@ -1744,6 +1750,26 @@ public abstract class Inventory extends ItemContainer
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Avoid flood from container items.
|
||||
*/
|
||||
private void containerItemCheck()
|
||||
{
|
||||
final Creature owner = getOwner();
|
||||
if ((owner != null) && owner.isPlayer() && (_containerItemTask == null))
|
||||
{
|
||||
owner.getActingPlayer().setUsingContainerItem(true);
|
||||
_containerItemTask = ThreadPool.schedule(() ->
|
||||
{
|
||||
owner.getActingPlayer().setUsingContainerItem(false);
|
||||
owner.getStat().recalculateStats(true);
|
||||
owner.updateAbnormalVisualEffects();
|
||||
owner.getActingPlayer().sendSkillList();
|
||||
_containerItemTask = null;
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Equips item and returns list of alterations<br>
|
||||
* <b>If you don't need return value use {@link Inventory#equipItem(Item)} instead</b>
|
||||
|
@ -229,8 +229,8 @@ public class GameClient extends ChannelInboundHandler<GameClient>
|
||||
|
||||
if (_player != null)
|
||||
{
|
||||
// Avoid flood from class change.
|
||||
if (_player.isChangingClass() && ((packet instanceof SkillList) || (packet instanceof AcquireSkillList) || (packet instanceof ExUserInfoAbnormalVisualEffect) || (packet instanceof AbnormalStatusUpdate) || (packet instanceof ExAbnormalStatusUpdateFromTarget)))
|
||||
// Avoid flood from class change or container items.
|
||||
if ((_player.isChangingClass() || _player.isUsingContainerItem()) && ((packet instanceof SkillList) || (packet instanceof AcquireSkillList) || (packet instanceof ExUserInfoAbnormalVisualEffect) || (packet instanceof AbnormalStatusUpdate) || (packet instanceof ExAbnormalStatusUpdateFromTarget)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -565,10 +565,9 @@ public class Player extends Playable
|
||||
private final PlayerFreight _freight = new PlayerFreight(this);
|
||||
private PlayerWarehouse _warehouse;
|
||||
private PlayerRefund _refund;
|
||||
|
||||
private PrivateStoreType _privateStoreType = PrivateStoreType.NONE;
|
||||
|
||||
private TradeList _activeTradeList;
|
||||
private boolean _isUsingContainerItem;
|
||||
private ItemContainer _activeWarehouse;
|
||||
private Map<Integer, ManufactureItem> _manufactureItems;
|
||||
private String _storeName = "";
|
||||
@ -5601,6 +5600,16 @@ public class Player extends Playable
|
||||
return _activeWarehouse;
|
||||
}
|
||||
|
||||
public boolean isUsingContainerItem()
|
||||
{
|
||||
return _isUsingContainerItem;
|
||||
}
|
||||
|
||||
public void setUsingContainerItem(boolean value)
|
||||
{
|
||||
_isUsingContainerItem = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Select the TradeList to be used in next activity.
|
||||
* @param tradeList
|
||||
|
@ -52,7 +52,6 @@ import org.l2jmobius.gameserver.util.Util;
|
||||
public class PlayerStat extends PlayableStat
|
||||
{
|
||||
private long _startingXp;
|
||||
/** Player's maximum talisman count. */
|
||||
private final AtomicInteger _talismanSlots = new AtomicInteger();
|
||||
private boolean _cloakSlot = false;
|
||||
private int _vitalityPoints = 0;
|
||||
@ -665,7 +664,7 @@ public class PlayerStat extends PlayableStat
|
||||
@Override
|
||||
public void recalculateStats(boolean broadcast)
|
||||
{
|
||||
if (!getActiveChar().isChangingClass())
|
||||
if (!getActiveChar().isChangingClass() && !getActiveChar().isUsingContainerItem())
|
||||
{
|
||||
super.recalculateStats(broadcast);
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.logging.Level;
|
||||
@ -33,6 +34,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.CommonUtil;
|
||||
import org.l2jmobius.gameserver.cache.PaperdollCache;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
@ -73,6 +75,8 @@ public abstract class Inventory extends ItemContainer
|
||||
{
|
||||
protected static final Logger LOGGER = Logger.getLogger(Inventory.class.getName());
|
||||
|
||||
private ScheduledFuture<?> _containerItemTask;
|
||||
|
||||
public interface PaperdollListener
|
||||
{
|
||||
void notifyEquiped(int slot, Item inst, Inventory inventory);
|
||||
@ -1704,6 +1708,7 @@ public abstract class Inventory extends ItemContainer
|
||||
case ItemTemplate.SLOT_R_BRACELET:
|
||||
{
|
||||
pdollSlot = PAPERDOLL_RBRACELET;
|
||||
containerItemCheck();
|
||||
break;
|
||||
}
|
||||
case ItemTemplate.SLOT_DECO:
|
||||
@ -1719,6 +1724,7 @@ public abstract class Inventory extends ItemContainer
|
||||
case ItemTemplate.SLOT_BROOCH:
|
||||
{
|
||||
pdollSlot = PAPERDOLL_BROOCH;
|
||||
containerItemCheck();
|
||||
break;
|
||||
}
|
||||
case ItemTemplate.SLOT_BROOCH_JEWEL:
|
||||
@ -1744,6 +1750,26 @@ public abstract class Inventory extends ItemContainer
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Avoid flood from container items.
|
||||
*/
|
||||
private void containerItemCheck()
|
||||
{
|
||||
final Creature owner = getOwner();
|
||||
if ((owner != null) && owner.isPlayer() && (_containerItemTask == null))
|
||||
{
|
||||
owner.getActingPlayer().setUsingContainerItem(true);
|
||||
_containerItemTask = ThreadPool.schedule(() ->
|
||||
{
|
||||
owner.getActingPlayer().setUsingContainerItem(false);
|
||||
owner.getStat().recalculateStats(true);
|
||||
owner.updateAbnormalVisualEffects();
|
||||
owner.getActingPlayer().sendSkillList();
|
||||
_containerItemTask = null;
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Equips item and returns list of alterations<br>
|
||||
* <b>If you don't need return value use {@link Inventory#equipItem(Item)} instead</b>
|
||||
|
@ -229,8 +229,8 @@ public class GameClient extends ChannelInboundHandler<GameClient>
|
||||
|
||||
if (_player != null)
|
||||
{
|
||||
// Avoid flood from class change.
|
||||
if (_player.isChangingClass() && ((packet instanceof SkillList) || (packet instanceof AcquireSkillList) || (packet instanceof ExUserInfoAbnormalVisualEffect) || (packet instanceof AbnormalStatusUpdate) || (packet instanceof ExAbnormalStatusUpdateFromTarget)))
|
||||
// Avoid flood from class change or container items.
|
||||
if ((_player.isChangingClass() || _player.isUsingContainerItem()) && ((packet instanceof SkillList) || (packet instanceof AcquireSkillList) || (packet instanceof ExUserInfoAbnormalVisualEffect) || (packet instanceof AbnormalStatusUpdate) || (packet instanceof ExAbnormalStatusUpdateFromTarget)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -569,10 +569,9 @@ public class Player extends Playable
|
||||
private final PlayerFreight _freight = new PlayerFreight(this);
|
||||
private PlayerWarehouse _warehouse;
|
||||
private PlayerRefund _refund;
|
||||
|
||||
private PrivateStoreType _privateStoreType = PrivateStoreType.NONE;
|
||||
|
||||
private TradeList _activeTradeList;
|
||||
private boolean _isUsingContainerItem;
|
||||
private ItemContainer _activeWarehouse;
|
||||
private Map<Integer, Long> _manufactureItems;
|
||||
private String _storeName = "";
|
||||
@ -5597,6 +5596,16 @@ public class Player extends Playable
|
||||
return _activeWarehouse;
|
||||
}
|
||||
|
||||
public boolean isUsingContainerItem()
|
||||
{
|
||||
return _isUsingContainerItem;
|
||||
}
|
||||
|
||||
public void setUsingContainerItem(boolean value)
|
||||
{
|
||||
_isUsingContainerItem = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Select the TradeList to be used in next activity.
|
||||
* @param tradeList
|
||||
|
@ -52,7 +52,6 @@ import org.l2jmobius.gameserver.util.Util;
|
||||
public class PlayerStat extends PlayableStat
|
||||
{
|
||||
private long _startingXp;
|
||||
/** Player's maximum talisman count. */
|
||||
private final AtomicInteger _talismanSlots = new AtomicInteger();
|
||||
private boolean _cloakSlot = false;
|
||||
private int _vitalityPoints = 0;
|
||||
@ -664,7 +663,7 @@ public class PlayerStat extends PlayableStat
|
||||
@Override
|
||||
public void recalculateStats(boolean broadcast)
|
||||
{
|
||||
if (!getActiveChar().isChangingClass())
|
||||
if (!getActiveChar().isChangingClass() && !getActiveChar().isUsingContainerItem())
|
||||
{
|
||||
super.recalculateStats(broadcast);
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.logging.Level;
|
||||
@ -33,6 +34,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.CommonUtil;
|
||||
import org.l2jmobius.gameserver.cache.PaperdollCache;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
@ -73,6 +75,8 @@ public abstract class Inventory extends ItemContainer
|
||||
{
|
||||
protected static final Logger LOGGER = Logger.getLogger(Inventory.class.getName());
|
||||
|
||||
private ScheduledFuture<?> _containerItemTask;
|
||||
|
||||
public interface PaperdollListener
|
||||
{
|
||||
void notifyEquiped(int slot, Item inst, Inventory inventory);
|
||||
@ -1704,6 +1708,7 @@ public abstract class Inventory extends ItemContainer
|
||||
case ItemTemplate.SLOT_R_BRACELET:
|
||||
{
|
||||
pdollSlot = PAPERDOLL_RBRACELET;
|
||||
containerItemCheck();
|
||||
break;
|
||||
}
|
||||
case ItemTemplate.SLOT_DECO:
|
||||
@ -1719,6 +1724,7 @@ public abstract class Inventory extends ItemContainer
|
||||
case ItemTemplate.SLOT_BROOCH:
|
||||
{
|
||||
pdollSlot = PAPERDOLL_BROOCH;
|
||||
containerItemCheck();
|
||||
break;
|
||||
}
|
||||
case ItemTemplate.SLOT_BROOCH_JEWEL:
|
||||
@ -1744,6 +1750,26 @@ public abstract class Inventory extends ItemContainer
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Avoid flood from container items.
|
||||
*/
|
||||
private void containerItemCheck()
|
||||
{
|
||||
final Creature owner = getOwner();
|
||||
if ((owner != null) && owner.isPlayer() && (_containerItemTask == null))
|
||||
{
|
||||
owner.getActingPlayer().setUsingContainerItem(true);
|
||||
_containerItemTask = ThreadPool.schedule(() ->
|
||||
{
|
||||
owner.getActingPlayer().setUsingContainerItem(false);
|
||||
owner.getStat().recalculateStats(true);
|
||||
owner.updateAbnormalVisualEffects();
|
||||
owner.getActingPlayer().sendSkillList();
|
||||
_containerItemTask = null;
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Equips item and returns list of alterations<br>
|
||||
* <b>If you don't need return value use {@link Inventory#equipItem(Item)} instead</b>
|
||||
|
@ -229,8 +229,8 @@ public class GameClient extends ChannelInboundHandler<GameClient>
|
||||
|
||||
if (_player != null)
|
||||
{
|
||||
// Avoid flood from class change.
|
||||
if (_player.isChangingClass() && ((packet instanceof SkillList) || (packet instanceof AcquireSkillList) || (packet instanceof ExUserInfoAbnormalVisualEffect) || (packet instanceof AbnormalStatusUpdate) || (packet instanceof ExAbnormalStatusUpdateFromTarget)))
|
||||
// Avoid flood from class change or container items.
|
||||
if ((_player.isChangingClass() || _player.isUsingContainerItem()) && ((packet instanceof SkillList) || (packet instanceof AcquireSkillList) || (packet instanceof ExUserInfoAbnormalVisualEffect) || (packet instanceof AbnormalStatusUpdate) || (packet instanceof ExAbnormalStatusUpdateFromTarget)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -565,10 +565,9 @@ public class Player extends Playable
|
||||
private final PlayerFreight _freight = new PlayerFreight(this);
|
||||
private PlayerWarehouse _warehouse;
|
||||
private PlayerRefund _refund;
|
||||
|
||||
private PrivateStoreType _privateStoreType = PrivateStoreType.NONE;
|
||||
|
||||
private TradeList _activeTradeList;
|
||||
private boolean _isUsingContainerItem;
|
||||
private ItemContainer _activeWarehouse;
|
||||
private Map<Integer, Long> _manufactureItems;
|
||||
private String _storeName = "";
|
||||
@ -5613,6 +5612,16 @@ public class Player extends Playable
|
||||
return _activeWarehouse;
|
||||
}
|
||||
|
||||
public boolean isUsingContainerItem()
|
||||
{
|
||||
return _isUsingContainerItem;
|
||||
}
|
||||
|
||||
public void setUsingContainerItem(boolean value)
|
||||
{
|
||||
_isUsingContainerItem = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Select the TradeList to be used in next activity.
|
||||
* @param tradeList
|
||||
|
@ -51,7 +51,6 @@ import org.l2jmobius.gameserver.util.Util;
|
||||
public class PlayerStat extends PlayableStat
|
||||
{
|
||||
private long _startingXp;
|
||||
/** Player's maximum talisman count. */
|
||||
private final AtomicInteger _talismanSlots = new AtomicInteger();
|
||||
private boolean _cloakSlot = false;
|
||||
private int _vitalityPoints = 0;
|
||||
@ -671,7 +670,7 @@ public class PlayerStat extends PlayableStat
|
||||
@Override
|
||||
public void recalculateStats(boolean broadcast)
|
||||
{
|
||||
if (!getActiveChar().isChangingClass())
|
||||
if (!getActiveChar().isChangingClass() && !getActiveChar().isUsingContainerItem())
|
||||
{
|
||||
super.recalculateStats(broadcast);
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.logging.Level;
|
||||
@ -33,6 +34,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.CommonUtil;
|
||||
import org.l2jmobius.gameserver.cache.PaperdollCache;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
@ -75,6 +77,8 @@ public abstract class Inventory extends ItemContainer
|
||||
{
|
||||
protected static final Logger LOGGER = Logger.getLogger(Inventory.class.getName());
|
||||
|
||||
private ScheduledFuture<?> _containerItemTask;
|
||||
|
||||
public interface PaperdollListener
|
||||
{
|
||||
void notifyEquiped(int slot, Item inst, Inventory inventory);
|
||||
@ -1788,10 +1792,12 @@ public abstract class Inventory extends ItemContainer
|
||||
else if (slot == ItemTemplate.SLOT_L_BRACELET)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_LBRACELET;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_R_BRACELET)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_RBRACELET;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_DECO)
|
||||
{
|
||||
@ -1804,6 +1810,7 @@ public abstract class Inventory extends ItemContainer
|
||||
else if (slot == ItemTemplate.SLOT_BROOCH)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_BROOCH;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_BROOCH_JEWEL)
|
||||
{
|
||||
@ -1830,6 +1837,26 @@ public abstract class Inventory extends ItemContainer
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Avoid flood from container items.
|
||||
*/
|
||||
private void containerItemCheck()
|
||||
{
|
||||
final Creature owner = getOwner();
|
||||
if ((owner != null) && owner.isPlayer() && (_containerItemTask == null))
|
||||
{
|
||||
owner.getActingPlayer().setUsingContainerItem(true);
|
||||
_containerItemTask = ThreadPool.schedule(() ->
|
||||
{
|
||||
owner.getActingPlayer().setUsingContainerItem(false);
|
||||
owner.getStat().recalculateStats(true);
|
||||
owner.updateAbnormalVisualEffects();
|
||||
owner.getActingPlayer().sendSkillList();
|
||||
_containerItemTask = null;
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Equips item and returns list of alterations<br>
|
||||
* <b>If you don't need return value use {@link Inventory#equipItem(Item)} instead</b>
|
||||
|
@ -229,8 +229,8 @@ public class GameClient extends ChannelInboundHandler<GameClient>
|
||||
|
||||
if (_player != null)
|
||||
{
|
||||
// Avoid flood from class change.
|
||||
if (_player.isChangingClass() && ((packet instanceof SkillList) || (packet instanceof AcquireSkillList) || (packet instanceof ExUserInfoAbnormalVisualEffect) || (packet instanceof AbnormalStatusUpdate) || (packet instanceof ExAbnormalStatusUpdateFromTarget)))
|
||||
// Avoid flood from class change or container items.
|
||||
if ((_player.isChangingClass() || _player.isUsingContainerItem()) && ((packet instanceof SkillList) || (packet instanceof AcquireSkillList) || (packet instanceof ExUserInfoAbnormalVisualEffect) || (packet instanceof AbnormalStatusUpdate) || (packet instanceof ExAbnormalStatusUpdateFromTarget)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -565,10 +565,9 @@ public class Player extends Playable
|
||||
private final PlayerFreight _freight = new PlayerFreight(this);
|
||||
private PlayerWarehouse _warehouse;
|
||||
private PlayerRefund _refund;
|
||||
|
||||
private PrivateStoreType _privateStoreType = PrivateStoreType.NONE;
|
||||
|
||||
private TradeList _activeTradeList;
|
||||
private boolean _isUsingContainerItem;
|
||||
private ItemContainer _activeWarehouse;
|
||||
private Map<Integer, Long> _manufactureItems;
|
||||
private String _storeName = "";
|
||||
@ -5613,6 +5612,16 @@ public class Player extends Playable
|
||||
return _activeWarehouse;
|
||||
}
|
||||
|
||||
public boolean isUsingContainerItem()
|
||||
{
|
||||
return _isUsingContainerItem;
|
||||
}
|
||||
|
||||
public void setUsingContainerItem(boolean value)
|
||||
{
|
||||
_isUsingContainerItem = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Select the TradeList to be used in next activity.
|
||||
* @param tradeList
|
||||
|
@ -51,7 +51,6 @@ import org.l2jmobius.gameserver.util.Util;
|
||||
public class PlayerStat extends PlayableStat
|
||||
{
|
||||
private long _startingXp;
|
||||
/** Player's maximum talisman count. */
|
||||
private final AtomicInteger _talismanSlots = new AtomicInteger();
|
||||
private boolean _cloakSlot = false;
|
||||
private int _vitalityPoints = 0;
|
||||
@ -680,7 +679,7 @@ public class PlayerStat extends PlayableStat
|
||||
@Override
|
||||
public void recalculateStats(boolean broadcast)
|
||||
{
|
||||
if (!getActiveChar().isChangingClass())
|
||||
if (!getActiveChar().isChangingClass() && !getActiveChar().isUsingContainerItem())
|
||||
{
|
||||
super.recalculateStats(broadcast);
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.logging.Level;
|
||||
@ -33,6 +34,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.CommonUtil;
|
||||
import org.l2jmobius.gameserver.cache.PaperdollCache;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
@ -75,6 +77,8 @@ public abstract class Inventory extends ItemContainer
|
||||
{
|
||||
protected static final Logger LOGGER = Logger.getLogger(Inventory.class.getName());
|
||||
|
||||
private ScheduledFuture<?> _containerItemTask;
|
||||
|
||||
public interface PaperdollListener
|
||||
{
|
||||
void notifyEquiped(int slot, Item inst, Inventory inventory);
|
||||
@ -1899,10 +1903,12 @@ public abstract class Inventory extends ItemContainer
|
||||
else if (slot == ItemTemplate.SLOT_L_BRACELET)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_LBRACELET;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_R_BRACELET)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_RBRACELET;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_DECO)
|
||||
{
|
||||
@ -1915,6 +1921,7 @@ public abstract class Inventory extends ItemContainer
|
||||
else if (slot == ItemTemplate.SLOT_BROOCH)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_BROOCH;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_BROOCH_JEWEL)
|
||||
{
|
||||
@ -1927,6 +1934,7 @@ public abstract class Inventory extends ItemContainer
|
||||
else if (slot == ItemTemplate.SLOT_ARTIFACT_BOOK)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_ARTIFACT_BOOK;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_ARTIFACT)
|
||||
{
|
||||
@ -1949,6 +1957,26 @@ public abstract class Inventory extends ItemContainer
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Avoid flood from container items.
|
||||
*/
|
||||
private void containerItemCheck()
|
||||
{
|
||||
final Creature owner = getOwner();
|
||||
if ((owner != null) && owner.isPlayer() && (_containerItemTask == null))
|
||||
{
|
||||
owner.getActingPlayer().setUsingContainerItem(true);
|
||||
_containerItemTask = ThreadPool.schedule(() ->
|
||||
{
|
||||
owner.getActingPlayer().setUsingContainerItem(false);
|
||||
owner.getStat().recalculateStats(true);
|
||||
owner.updateAbnormalVisualEffects();
|
||||
owner.getActingPlayer().sendSkillList();
|
||||
_containerItemTask = null;
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Equips item and returns list of alterations<br>
|
||||
* <b>If you don't need return value use {@link Inventory#equipItem(Item)} instead</b>
|
||||
|
@ -229,8 +229,8 @@ public class GameClient extends ChannelInboundHandler<GameClient>
|
||||
|
||||
if (_player != null)
|
||||
{
|
||||
// Avoid flood from class change.
|
||||
if (_player.isChangingClass() && ((packet instanceof SkillList) || (packet instanceof AcquireSkillList) || (packet instanceof ExUserInfoAbnormalVisualEffect) || (packet instanceof AbnormalStatusUpdate) || (packet instanceof ExAbnormalStatusUpdateFromTarget)))
|
||||
// Avoid flood from class change or container items.
|
||||
if ((_player.isChangingClass() || _player.isUsingContainerItem()) && ((packet instanceof SkillList) || (packet instanceof AcquireSkillList) || (packet instanceof ExUserInfoAbnormalVisualEffect) || (packet instanceof AbnormalStatusUpdate) || (packet instanceof ExAbnormalStatusUpdateFromTarget)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -565,10 +565,9 @@ public class Player extends Playable
|
||||
private final PlayerFreight _freight = new PlayerFreight(this);
|
||||
private PlayerWarehouse _warehouse;
|
||||
private PlayerRefund _refund;
|
||||
|
||||
private PrivateStoreType _privateStoreType = PrivateStoreType.NONE;
|
||||
|
||||
private TradeList _activeTradeList;
|
||||
private boolean _isUsingContainerItem;
|
||||
private ItemContainer _activeWarehouse;
|
||||
private Map<Integer, Long> _manufactureItems;
|
||||
private String _storeName = "";
|
||||
@ -5614,6 +5613,16 @@ public class Player extends Playable
|
||||
return _activeWarehouse;
|
||||
}
|
||||
|
||||
public boolean isUsingContainerItem()
|
||||
{
|
||||
return _isUsingContainerItem;
|
||||
}
|
||||
|
||||
public void setUsingContainerItem(boolean value)
|
||||
{
|
||||
_isUsingContainerItem = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Select the TradeList to be used in next activity.
|
||||
* @param tradeList
|
||||
|
@ -51,7 +51,6 @@ import org.l2jmobius.gameserver.util.Util;
|
||||
public class PlayerStat extends PlayableStat
|
||||
{
|
||||
private long _startingXp;
|
||||
/** Player's maximum talisman count. */
|
||||
private final AtomicInteger _talismanSlots = new AtomicInteger();
|
||||
private boolean _cloakSlot = false;
|
||||
private int _vitalityPoints = 0;
|
||||
@ -680,7 +679,7 @@ public class PlayerStat extends PlayableStat
|
||||
@Override
|
||||
public void recalculateStats(boolean broadcast)
|
||||
{
|
||||
if (!getActiveChar().isChangingClass())
|
||||
if (!getActiveChar().isChangingClass() && !getActiveChar().isUsingContainerItem())
|
||||
{
|
||||
super.recalculateStats(broadcast);
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.logging.Level;
|
||||
@ -33,6 +34,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.CommonUtil;
|
||||
import org.l2jmobius.gameserver.cache.PaperdollCache;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
@ -75,6 +77,8 @@ public abstract class Inventory extends ItemContainer
|
||||
{
|
||||
protected static final Logger LOGGER = Logger.getLogger(Inventory.class.getName());
|
||||
|
||||
private ScheduledFuture<?> _containerItemTask;
|
||||
|
||||
public interface PaperdollListener
|
||||
{
|
||||
void notifyEquiped(int slot, Item inst, Inventory inventory);
|
||||
@ -1899,10 +1903,12 @@ public abstract class Inventory extends ItemContainer
|
||||
else if (slot == ItemTemplate.SLOT_L_BRACELET)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_LBRACELET;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_R_BRACELET)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_RBRACELET;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_DECO)
|
||||
{
|
||||
@ -1915,6 +1921,7 @@ public abstract class Inventory extends ItemContainer
|
||||
else if (slot == ItemTemplate.SLOT_BROOCH)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_BROOCH;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_BROOCH_JEWEL)
|
||||
{
|
||||
@ -1927,6 +1934,7 @@ public abstract class Inventory extends ItemContainer
|
||||
else if (slot == ItemTemplate.SLOT_ARTIFACT_BOOK)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_ARTIFACT_BOOK;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_ARTIFACT)
|
||||
{
|
||||
@ -1949,6 +1957,26 @@ public abstract class Inventory extends ItemContainer
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Avoid flood from container items.
|
||||
*/
|
||||
private void containerItemCheck()
|
||||
{
|
||||
final Creature owner = getOwner();
|
||||
if ((owner != null) && owner.isPlayer() && (_containerItemTask == null))
|
||||
{
|
||||
owner.getActingPlayer().setUsingContainerItem(true);
|
||||
_containerItemTask = ThreadPool.schedule(() ->
|
||||
{
|
||||
owner.getActingPlayer().setUsingContainerItem(false);
|
||||
owner.getStat().recalculateStats(true);
|
||||
owner.updateAbnormalVisualEffects();
|
||||
owner.getActingPlayer().sendSkillList();
|
||||
_containerItemTask = null;
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Equips item and returns list of alterations<br>
|
||||
* <b>If you don't need return value use {@link Inventory#equipItem(Item)} instead</b>
|
||||
|
@ -229,8 +229,8 @@ public class GameClient extends ChannelInboundHandler<GameClient>
|
||||
|
||||
if (_player != null)
|
||||
{
|
||||
// Avoid flood from class change.
|
||||
if (_player.isChangingClass() && ((packet instanceof SkillList) || (packet instanceof AcquireSkillList) || (packet instanceof ExUserInfoAbnormalVisualEffect) || (packet instanceof AbnormalStatusUpdate) || (packet instanceof ExAbnormalStatusUpdateFromTarget)))
|
||||
// Avoid flood from class change or container items.
|
||||
if ((_player.isChangingClass() || _player.isUsingContainerItem()) && ((packet instanceof SkillList) || (packet instanceof AcquireSkillList) || (packet instanceof ExUserInfoAbnormalVisualEffect) || (packet instanceof AbnormalStatusUpdate) || (packet instanceof ExAbnormalStatusUpdateFromTarget)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -579,10 +579,9 @@ public class Player extends Playable
|
||||
private final PlayerFreight _freight = new PlayerFreight(this);
|
||||
private PlayerWarehouse _warehouse;
|
||||
private PlayerRefund _refund;
|
||||
|
||||
private PrivateStoreType _privateStoreType = PrivateStoreType.NONE;
|
||||
|
||||
private TradeList _activeTradeList;
|
||||
private boolean _isUsingContainerItem;
|
||||
private ItemContainer _activeWarehouse;
|
||||
private Map<Integer, Long> _manufactureItems;
|
||||
private String _storeName = "";
|
||||
@ -5579,6 +5578,16 @@ public class Player extends Playable
|
||||
return _activeWarehouse;
|
||||
}
|
||||
|
||||
public boolean isUsingContainerItem()
|
||||
{
|
||||
return _isUsingContainerItem;
|
||||
}
|
||||
|
||||
public void setUsingContainerItem(boolean value)
|
||||
{
|
||||
_isUsingContainerItem = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Select the TradeList to be used in next activity.
|
||||
* @param tradeList
|
||||
|
@ -51,7 +51,6 @@ import org.l2jmobius.gameserver.util.Util;
|
||||
public class PlayerStat extends PlayableStat
|
||||
{
|
||||
private long _startingXp;
|
||||
/** Player's maximum talisman count. */
|
||||
private final AtomicInteger _talismanSlots = new AtomicInteger();
|
||||
private boolean _cloakSlot = false;
|
||||
private int _vitalityPoints = 0;
|
||||
@ -678,7 +677,7 @@ public class PlayerStat extends PlayableStat
|
||||
@Override
|
||||
public void recalculateStats(boolean broadcast)
|
||||
{
|
||||
if (!getActiveChar().isChangingClass())
|
||||
if (!getActiveChar().isChangingClass() && !getActiveChar().isUsingContainerItem())
|
||||
{
|
||||
super.recalculateStats(broadcast);
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.logging.Level;
|
||||
@ -33,6 +34,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.CommonUtil;
|
||||
import org.l2jmobius.gameserver.cache.PaperdollCache;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
@ -75,6 +77,8 @@ public abstract class Inventory extends ItemContainer
|
||||
{
|
||||
protected static final Logger LOGGER = Logger.getLogger(Inventory.class.getName());
|
||||
|
||||
private ScheduledFuture<?> _containerItemTask;
|
||||
|
||||
public interface PaperdollListener
|
||||
{
|
||||
void notifyEquiped(int slot, Item inst, Inventory inventory);
|
||||
@ -1889,10 +1893,12 @@ public abstract class Inventory extends ItemContainer
|
||||
else if (slot == ItemTemplate.SLOT_L_BRACELET)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_LBRACELET;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_R_BRACELET)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_RBRACELET;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_DECO)
|
||||
{
|
||||
@ -1905,6 +1911,7 @@ public abstract class Inventory extends ItemContainer
|
||||
else if (slot == ItemTemplate.SLOT_BROOCH)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_BROOCH;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_BROOCH_JEWEL)
|
||||
{
|
||||
@ -1917,6 +1924,7 @@ public abstract class Inventory extends ItemContainer
|
||||
else if (slot == ItemTemplate.SLOT_ARTIFACT_BOOK)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_ARTIFACT_BOOK;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_ARTIFACT)
|
||||
{
|
||||
@ -1934,6 +1942,26 @@ public abstract class Inventory extends ItemContainer
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Avoid flood from container items.
|
||||
*/
|
||||
private void containerItemCheck()
|
||||
{
|
||||
final Creature owner = getOwner();
|
||||
if ((owner != null) && owner.isPlayer() && (_containerItemTask == null))
|
||||
{
|
||||
owner.getActingPlayer().setUsingContainerItem(true);
|
||||
_containerItemTask = ThreadPool.schedule(() ->
|
||||
{
|
||||
owner.getActingPlayer().setUsingContainerItem(false);
|
||||
owner.getStat().recalculateStats(true);
|
||||
owner.updateAbnormalVisualEffects();
|
||||
owner.getActingPlayer().sendSkillList();
|
||||
_containerItemTask = null;
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Equips item and returns list of alterations<br>
|
||||
* <b>If you don't need return value use {@link Inventory#equipItem(Item)} instead</b>
|
||||
|
@ -229,8 +229,8 @@ public class GameClient extends ChannelInboundHandler<GameClient>
|
||||
|
||||
if (_player != null)
|
||||
{
|
||||
// Avoid flood from class change.
|
||||
if (_player.isChangingClass() && ((packet instanceof SkillList) || (packet instanceof AcquireSkillList) || (packet instanceof ExUserInfoAbnormalVisualEffect) || (packet instanceof AbnormalStatusUpdate) || (packet instanceof ExAbnormalStatusUpdateFromTarget)))
|
||||
// Avoid flood from class change or container items.
|
||||
if ((_player.isChangingClass() || _player.isUsingContainerItem()) && ((packet instanceof SkillList) || (packet instanceof AcquireSkillList) || (packet instanceof ExUserInfoAbnormalVisualEffect) || (packet instanceof AbnormalStatusUpdate) || (packet instanceof ExAbnormalStatusUpdateFromTarget)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -582,10 +582,9 @@ public class Player extends Playable
|
||||
private final PlayerFreight _freight = new PlayerFreight(this);
|
||||
private PlayerWarehouse _warehouse;
|
||||
private PlayerRefund _refund;
|
||||
|
||||
private PrivateStoreType _privateStoreType = PrivateStoreType.NONE;
|
||||
|
||||
private TradeList _activeTradeList;
|
||||
private boolean _isUsingContainerItem;
|
||||
private ItemContainer _activeWarehouse;
|
||||
private Map<Integer, Long> _manufactureItems;
|
||||
private String _storeName = "";
|
||||
@ -5623,6 +5622,16 @@ public class Player extends Playable
|
||||
return _activeWarehouse;
|
||||
}
|
||||
|
||||
public boolean isUsingContainerItem()
|
||||
{
|
||||
return _isUsingContainerItem;
|
||||
}
|
||||
|
||||
public void setUsingContainerItem(boolean value)
|
||||
{
|
||||
_isUsingContainerItem = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Select the TradeList to be used in next activity.
|
||||
* @param tradeList
|
||||
|
@ -52,7 +52,6 @@ import org.l2jmobius.gameserver.util.Util;
|
||||
public class PlayerStat extends PlayableStat
|
||||
{
|
||||
private long _startingXp;
|
||||
/** Player's maximum talisman count. */
|
||||
private final AtomicInteger _talismanSlots = new AtomicInteger();
|
||||
private boolean _cloakSlot = false;
|
||||
private int _vitalityPoints = 0;
|
||||
@ -684,7 +683,7 @@ public class PlayerStat extends PlayableStat
|
||||
@Override
|
||||
public void recalculateStats(boolean broadcast)
|
||||
{
|
||||
if (!getActiveChar().isChangingClass())
|
||||
if (!getActiveChar().isChangingClass() && !getActiveChar().isUsingContainerItem())
|
||||
{
|
||||
super.recalculateStats(broadcast);
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.logging.Level;
|
||||
@ -33,6 +34,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.CommonUtil;
|
||||
import org.l2jmobius.gameserver.cache.PaperdollCache;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
@ -74,6 +76,8 @@ public abstract class Inventory extends ItemContainer
|
||||
{
|
||||
protected static final Logger LOGGER = Logger.getLogger(Inventory.class.getName());
|
||||
|
||||
private ScheduledFuture<?> _containerItemTask;
|
||||
|
||||
public interface PaperdollListener
|
||||
{
|
||||
void notifyEquiped(int slot, Item inst, Inventory inventory);
|
||||
@ -1871,10 +1875,12 @@ public abstract class Inventory extends ItemContainer
|
||||
else if (slot == ItemTemplate.SLOT_L_BRACELET)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_LBRACELET;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_R_BRACELET)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_RBRACELET;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_DECO)
|
||||
{
|
||||
@ -1887,6 +1893,7 @@ public abstract class Inventory extends ItemContainer
|
||||
else if (slot == ItemTemplate.SLOT_BROOCH)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_BROOCH;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_BROOCH_JEWEL)
|
||||
{
|
||||
@ -1899,6 +1906,7 @@ public abstract class Inventory extends ItemContainer
|
||||
else if (slot == ItemTemplate.SLOT_ARTIFACT_BOOK)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_ARTIFACT_BOOK;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_ARTIFACT)
|
||||
{
|
||||
@ -1916,6 +1924,26 @@ public abstract class Inventory extends ItemContainer
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Avoid flood from container items.
|
||||
*/
|
||||
private void containerItemCheck()
|
||||
{
|
||||
final Creature owner = getOwner();
|
||||
if ((owner != null) && owner.isPlayer() && (_containerItemTask == null))
|
||||
{
|
||||
owner.getActingPlayer().setUsingContainerItem(true);
|
||||
_containerItemTask = ThreadPool.schedule(() ->
|
||||
{
|
||||
owner.getActingPlayer().setUsingContainerItem(false);
|
||||
owner.getStat().recalculateStats(true);
|
||||
owner.updateAbnormalVisualEffects();
|
||||
owner.getActingPlayer().sendSkillList();
|
||||
_containerItemTask = null;
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Equips item and returns list of alterations<br>
|
||||
* <b>If you don't need return value use {@link Inventory#equipItem(Item)} instead</b>
|
||||
|
@ -229,8 +229,8 @@ public class GameClient extends ChannelInboundHandler<GameClient>
|
||||
|
||||
if (_player != null)
|
||||
{
|
||||
// Avoid flood from class change.
|
||||
if (_player.isChangingClass() && ((packet instanceof SkillList) || (packet instanceof AcquireSkillList) || (packet instanceof ExUserInfoAbnormalVisualEffect) || (packet instanceof AbnormalStatusUpdate) || (packet instanceof ExAbnormalStatusUpdateFromTarget)))
|
||||
// Avoid flood from class change or container items.
|
||||
if ((_player.isChangingClass() || _player.isUsingContainerItem()) && ((packet instanceof SkillList) || (packet instanceof AcquireSkillList) || (packet instanceof ExUserInfoAbnormalVisualEffect) || (packet instanceof AbnormalStatusUpdate) || (packet instanceof ExAbnormalStatusUpdateFromTarget)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -595,10 +595,9 @@ public class Player extends Playable
|
||||
private final PlayerFreight _freight = new PlayerFreight(this);
|
||||
private PlayerWarehouse _warehouse;
|
||||
private PlayerRefund _refund;
|
||||
|
||||
private PrivateStoreType _privateStoreType = PrivateStoreType.NONE;
|
||||
|
||||
private TradeList _activeTradeList;
|
||||
private boolean _isUsingContainerItem;
|
||||
private ItemContainer _activeWarehouse;
|
||||
private Map<Integer, Long> _manufactureItems;
|
||||
private String _storeName = "";
|
||||
@ -5640,6 +5639,16 @@ public class Player extends Playable
|
||||
return _activeWarehouse;
|
||||
}
|
||||
|
||||
public boolean isUsingContainerItem()
|
||||
{
|
||||
return _isUsingContainerItem;
|
||||
}
|
||||
|
||||
public void setUsingContainerItem(boolean value)
|
||||
{
|
||||
_isUsingContainerItem = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Select the TradeList to be used in next activity.
|
||||
* @param tradeList
|
||||
|
@ -52,7 +52,6 @@ import org.l2jmobius.gameserver.util.Util;
|
||||
public class PlayerStat extends PlayableStat
|
||||
{
|
||||
private long _startingXp;
|
||||
/** Player's maximum talisman count. */
|
||||
private final AtomicInteger _talismanSlots = new AtomicInteger();
|
||||
private boolean _cloakSlot = false;
|
||||
private int _vitalityPoints = 0;
|
||||
@ -684,7 +683,7 @@ public class PlayerStat extends PlayableStat
|
||||
@Override
|
||||
public void recalculateStats(boolean broadcast)
|
||||
{
|
||||
if (!getActiveChar().isChangingClass())
|
||||
if (!getActiveChar().isChangingClass() && !getActiveChar().isUsingContainerItem())
|
||||
{
|
||||
super.recalculateStats(broadcast);
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.logging.Level;
|
||||
@ -33,6 +34,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.CommonUtil;
|
||||
import org.l2jmobius.gameserver.cache.PaperdollCache;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
@ -74,6 +76,8 @@ public abstract class Inventory extends ItemContainer
|
||||
{
|
||||
protected static final Logger LOGGER = Logger.getLogger(Inventory.class.getName());
|
||||
|
||||
private ScheduledFuture<?> _containerItemTask;
|
||||
|
||||
public interface PaperdollListener
|
||||
{
|
||||
void notifyEquiped(int slot, Item inst, Inventory inventory);
|
||||
@ -1871,10 +1875,12 @@ public abstract class Inventory extends ItemContainer
|
||||
else if (slot == ItemTemplate.SLOT_L_BRACELET)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_LBRACELET;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_R_BRACELET)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_RBRACELET;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_DECO)
|
||||
{
|
||||
@ -1887,6 +1893,7 @@ public abstract class Inventory extends ItemContainer
|
||||
else if (slot == ItemTemplate.SLOT_BROOCH)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_BROOCH;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_BROOCH_JEWEL)
|
||||
{
|
||||
@ -1899,6 +1906,7 @@ public abstract class Inventory extends ItemContainer
|
||||
else if (slot == ItemTemplate.SLOT_ARTIFACT_BOOK)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_ARTIFACT_BOOK;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_ARTIFACT)
|
||||
{
|
||||
@ -1916,6 +1924,26 @@ public abstract class Inventory extends ItemContainer
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Avoid flood from container items.
|
||||
*/
|
||||
private void containerItemCheck()
|
||||
{
|
||||
final Creature owner = getOwner();
|
||||
if ((owner != null) && owner.isPlayer() && (_containerItemTask == null))
|
||||
{
|
||||
owner.getActingPlayer().setUsingContainerItem(true);
|
||||
_containerItemTask = ThreadPool.schedule(() ->
|
||||
{
|
||||
owner.getActingPlayer().setUsingContainerItem(false);
|
||||
owner.getStat().recalculateStats(true);
|
||||
owner.updateAbnormalVisualEffects();
|
||||
owner.getActingPlayer().sendSkillList();
|
||||
_containerItemTask = null;
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Equips item and returns list of alterations<br>
|
||||
* <b>If you don't need return value use {@link Inventory#equipItem(Item)} instead</b>
|
||||
|
@ -229,8 +229,8 @@ public class GameClient extends ChannelInboundHandler<GameClient>
|
||||
|
||||
if (_player != null)
|
||||
{
|
||||
// Avoid flood from class change.
|
||||
if (_player.isChangingClass() && ((packet instanceof SkillList) || (packet instanceof AcquireSkillList) || (packet instanceof ExUserInfoAbnormalVisualEffect) || (packet instanceof AbnormalStatusUpdate) || (packet instanceof ExAbnormalStatusUpdateFromTarget)))
|
||||
// Avoid flood from class change or container items.
|
||||
if ((_player.isChangingClass() || _player.isUsingContainerItem()) && ((packet instanceof SkillList) || (packet instanceof AcquireSkillList) || (packet instanceof ExUserInfoAbnormalVisualEffect) || (packet instanceof AbnormalStatusUpdate) || (packet instanceof ExAbnormalStatusUpdateFromTarget)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -597,10 +597,9 @@ public class Player extends Playable
|
||||
private final PlayerFreight _freight = new PlayerFreight(this);
|
||||
private PlayerWarehouse _warehouse;
|
||||
private PlayerRefund _refund;
|
||||
|
||||
private PrivateStoreType _privateStoreType = PrivateStoreType.NONE;
|
||||
|
||||
private TradeList _activeTradeList;
|
||||
private boolean _isUsingContainerItem;
|
||||
private ItemContainer _activeWarehouse;
|
||||
private Map<Integer, Long> _manufactureItems;
|
||||
private String _storeName = "";
|
||||
@ -5673,6 +5672,16 @@ public class Player extends Playable
|
||||
return _activeWarehouse;
|
||||
}
|
||||
|
||||
public boolean isUsingContainerItem()
|
||||
{
|
||||
return _isUsingContainerItem;
|
||||
}
|
||||
|
||||
public void setUsingContainerItem(boolean value)
|
||||
{
|
||||
_isUsingContainerItem = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Select the TradeList to be used in next activity.
|
||||
* @param tradeList
|
||||
|
@ -52,7 +52,6 @@ import org.l2jmobius.gameserver.util.Util;
|
||||
public class PlayerStat extends PlayableStat
|
||||
{
|
||||
private long _startingXp;
|
||||
/** Player's maximum talisman count. */
|
||||
private final AtomicInteger _talismanSlots = new AtomicInteger();
|
||||
private boolean _cloakSlot = false;
|
||||
private int _vitalityPoints = 0;
|
||||
@ -684,7 +683,7 @@ public class PlayerStat extends PlayableStat
|
||||
@Override
|
||||
public void recalculateStats(boolean broadcast)
|
||||
{
|
||||
if (!getActiveChar().isChangingClass())
|
||||
if (!getActiveChar().isChangingClass() && !getActiveChar().isUsingContainerItem())
|
||||
{
|
||||
super.recalculateStats(broadcast);
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.logging.Level;
|
||||
@ -33,6 +34,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.CommonUtil;
|
||||
import org.l2jmobius.gameserver.cache.PaperdollCache;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
@ -75,6 +77,8 @@ public abstract class Inventory extends ItemContainer
|
||||
{
|
||||
protected static final Logger LOGGER = Logger.getLogger(Inventory.class.getName());
|
||||
|
||||
private ScheduledFuture<?> _containerItemTask;
|
||||
|
||||
public interface PaperdollListener
|
||||
{
|
||||
void notifyEquiped(int slot, Item inst, Inventory inventory);
|
||||
@ -1882,10 +1886,12 @@ public abstract class Inventory extends ItemContainer
|
||||
else if (slot == ItemTemplate.SLOT_L_BRACELET)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_LBRACELET;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_R_BRACELET)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_RBRACELET;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_DECO)
|
||||
{
|
||||
@ -1898,6 +1904,7 @@ public abstract class Inventory extends ItemContainer
|
||||
else if (slot == ItemTemplate.SLOT_BROOCH)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_BROOCH;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_BROOCH_JEWEL)
|
||||
{
|
||||
@ -1910,6 +1917,7 @@ public abstract class Inventory extends ItemContainer
|
||||
else if (slot == ItemTemplate.SLOT_ARTIFACT_BOOK)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_ARTIFACT_BOOK;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_ARTIFACT)
|
||||
{
|
||||
@ -1927,6 +1935,26 @@ public abstract class Inventory extends ItemContainer
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Avoid flood from container items.
|
||||
*/
|
||||
private void containerItemCheck()
|
||||
{
|
||||
final Creature owner = getOwner();
|
||||
if ((owner != null) && owner.isPlayer() && (_containerItemTask == null))
|
||||
{
|
||||
owner.getActingPlayer().setUsingContainerItem(true);
|
||||
_containerItemTask = ThreadPool.schedule(() ->
|
||||
{
|
||||
owner.getActingPlayer().setUsingContainerItem(false);
|
||||
owner.getStat().recalculateStats(true);
|
||||
owner.updateAbnormalVisualEffects();
|
||||
owner.getActingPlayer().sendSkillList();
|
||||
_containerItemTask = null;
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Equips item and returns list of alterations<br>
|
||||
* <b>If you don't need return value use {@link Inventory#equipItem(Item)} instead</b>
|
||||
|
@ -229,8 +229,8 @@ public class GameClient extends ChannelInboundHandler<GameClient>
|
||||
|
||||
if (_player != null)
|
||||
{
|
||||
// Avoid flood from class change.
|
||||
if (_player.isChangingClass() && ((packet instanceof SkillList) || (packet instanceof AcquireSkillList) || (packet instanceof ExUserInfoAbnormalVisualEffect) || (packet instanceof AbnormalStatusUpdate) || (packet instanceof ExAbnormalStatusUpdateFromTarget)))
|
||||
// Avoid flood from class change or container items.
|
||||
if ((_player.isChangingClass() || _player.isUsingContainerItem()) && ((packet instanceof SkillList) || (packet instanceof AcquireSkillList) || (packet instanceof ExUserInfoAbnormalVisualEffect) || (packet instanceof AbnormalStatusUpdate) || (packet instanceof ExAbnormalStatusUpdateFromTarget)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -563,10 +563,9 @@ public class Player extends Playable
|
||||
private final PlayerFreight _freight = new PlayerFreight(this);
|
||||
private PlayerWarehouse _warehouse;
|
||||
private PlayerRefund _refund;
|
||||
|
||||
private PrivateStoreType _privateStoreType = PrivateStoreType.NONE;
|
||||
|
||||
private TradeList _activeTradeList;
|
||||
private boolean _isUsingContainerItem;
|
||||
private ItemContainer _activeWarehouse;
|
||||
private Map<Integer, ManufactureItem> _manufactureItems;
|
||||
private String _storeName = "";
|
||||
@ -5572,6 +5571,16 @@ public class Player extends Playable
|
||||
return _activeWarehouse;
|
||||
}
|
||||
|
||||
public boolean isUsingContainerItem()
|
||||
{
|
||||
return _isUsingContainerItem;
|
||||
}
|
||||
|
||||
public void setUsingContainerItem(boolean value)
|
||||
{
|
||||
_isUsingContainerItem = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Select the TradeList to be used in next activity.
|
||||
* @param tradeList
|
||||
|
@ -51,7 +51,6 @@ import org.l2jmobius.gameserver.util.Util;
|
||||
public class PlayerStat extends PlayableStat
|
||||
{
|
||||
private long _startingXp;
|
||||
/** Player's maximum talisman count. */
|
||||
private final AtomicInteger _talismanSlots = new AtomicInteger();
|
||||
private boolean _cloakSlot = false;
|
||||
private int _vitalityPoints = 0;
|
||||
@ -660,7 +659,7 @@ public class PlayerStat extends PlayableStat
|
||||
@Override
|
||||
public void recalculateStats(boolean broadcast)
|
||||
{
|
||||
if (!getActiveChar().isChangingClass())
|
||||
if (!getActiveChar().isChangingClass() && !getActiveChar().isUsingContainerItem())
|
||||
{
|
||||
super.recalculateStats(broadcast);
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.logging.Level;
|
||||
@ -33,6 +34,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.CommonUtil;
|
||||
import org.l2jmobius.gameserver.cache.PaperdollCache;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
@ -73,6 +75,8 @@ public abstract class Inventory extends ItemContainer
|
||||
{
|
||||
protected static final Logger LOGGER = Logger.getLogger(Inventory.class.getName());
|
||||
|
||||
private ScheduledFuture<?> _containerItemTask;
|
||||
|
||||
public interface PaperdollListener
|
||||
{
|
||||
void notifyEquiped(int slot, Item inst, Inventory inventory);
|
||||
@ -1706,6 +1710,7 @@ public abstract class Inventory extends ItemContainer
|
||||
case ItemTemplate.SLOT_R_BRACELET:
|
||||
{
|
||||
pdollSlot = PAPERDOLL_RBRACELET;
|
||||
containerItemCheck();
|
||||
break;
|
||||
}
|
||||
case ItemTemplate.SLOT_DECO:
|
||||
@ -1721,6 +1726,7 @@ public abstract class Inventory extends ItemContainer
|
||||
case ItemTemplate.SLOT_BROOCH:
|
||||
{
|
||||
pdollSlot = PAPERDOLL_BROOCH;
|
||||
containerItemCheck();
|
||||
break;
|
||||
}
|
||||
case ItemTemplate.SLOT_BROOCH_JEWEL:
|
||||
@ -1746,6 +1752,26 @@ public abstract class Inventory extends ItemContainer
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Avoid flood from container items.
|
||||
*/
|
||||
private void containerItemCheck()
|
||||
{
|
||||
final Creature owner = getOwner();
|
||||
if ((owner != null) && owner.isPlayer() && (_containerItemTask == null))
|
||||
{
|
||||
owner.getActingPlayer().setUsingContainerItem(true);
|
||||
_containerItemTask = ThreadPool.schedule(() ->
|
||||
{
|
||||
owner.getActingPlayer().setUsingContainerItem(false);
|
||||
owner.getStat().recalculateStats(true);
|
||||
owner.updateAbnormalVisualEffects();
|
||||
owner.getActingPlayer().sendSkillList();
|
||||
_containerItemTask = null;
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Equips item and returns list of alterations<br>
|
||||
* <b>If you don't need return value use {@link Inventory#equipItem(Item)} instead</b>
|
||||
|
@ -229,8 +229,8 @@ public class GameClient extends ChannelInboundHandler<GameClient>
|
||||
|
||||
if (_player != null)
|
||||
{
|
||||
// Avoid flood from class change.
|
||||
if (_player.isChangingClass() && ((packet instanceof SkillList) || (packet instanceof AcquireSkillList) || (packet instanceof ExUserInfoAbnormalVisualEffect) || (packet instanceof AbnormalStatusUpdate) || (packet instanceof ExAbnormalStatusUpdateFromTarget)))
|
||||
// Avoid flood from class change or container items.
|
||||
if ((_player.isChangingClass() || _player.isUsingContainerItem()) && ((packet instanceof SkillList) || (packet instanceof AcquireSkillList) || (packet instanceof ExUserInfoAbnormalVisualEffect) || (packet instanceof AbnormalStatusUpdate) || (packet instanceof ExAbnormalStatusUpdateFromTarget)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -563,10 +563,9 @@ public class Player extends Playable
|
||||
private final PlayerFreight _freight = new PlayerFreight(this);
|
||||
private PlayerWarehouse _warehouse;
|
||||
private PlayerRefund _refund;
|
||||
|
||||
private PrivateStoreType _privateStoreType = PrivateStoreType.NONE;
|
||||
|
||||
private TradeList _activeTradeList;
|
||||
private boolean _isUsingContainerItem;
|
||||
private ItemContainer _activeWarehouse;
|
||||
private Map<Integer, ManufactureItem> _manufactureItems;
|
||||
private String _storeName = "";
|
||||
@ -5572,6 +5571,16 @@ public class Player extends Playable
|
||||
return _activeWarehouse;
|
||||
}
|
||||
|
||||
public boolean isUsingContainerItem()
|
||||
{
|
||||
return _isUsingContainerItem;
|
||||
}
|
||||
|
||||
public void setUsingContainerItem(boolean value)
|
||||
{
|
||||
_isUsingContainerItem = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Select the TradeList to be used in next activity.
|
||||
* @param tradeList
|
||||
|
@ -52,7 +52,6 @@ import org.l2jmobius.gameserver.util.Util;
|
||||
public class PlayerStat extends PlayableStat
|
||||
{
|
||||
private long _startingXp;
|
||||
/** Player's maximum talisman count. */
|
||||
private final AtomicInteger _talismanSlots = new AtomicInteger();
|
||||
private boolean _cloakSlot = false;
|
||||
private int _vitalityPoints = 0;
|
||||
@ -664,7 +663,7 @@ public class PlayerStat extends PlayableStat
|
||||
@Override
|
||||
public void recalculateStats(boolean broadcast)
|
||||
{
|
||||
if (!getActiveChar().isChangingClass())
|
||||
if (!getActiveChar().isChangingClass() && !getActiveChar().isUsingContainerItem())
|
||||
{
|
||||
super.recalculateStats(broadcast);
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.logging.Level;
|
||||
@ -33,6 +34,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.CommonUtil;
|
||||
import org.l2jmobius.gameserver.cache.PaperdollCache;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
@ -73,6 +75,8 @@ public abstract class Inventory extends ItemContainer
|
||||
{
|
||||
protected static final Logger LOGGER = Logger.getLogger(Inventory.class.getName());
|
||||
|
||||
private ScheduledFuture<?> _containerItemTask;
|
||||
|
||||
public interface PaperdollListener
|
||||
{
|
||||
void notifyEquiped(int slot, Item inst, Inventory inventory);
|
||||
@ -1706,6 +1710,7 @@ public abstract class Inventory extends ItemContainer
|
||||
case ItemTemplate.SLOT_R_BRACELET:
|
||||
{
|
||||
pdollSlot = PAPERDOLL_RBRACELET;
|
||||
containerItemCheck();
|
||||
break;
|
||||
}
|
||||
case ItemTemplate.SLOT_DECO:
|
||||
@ -1721,6 +1726,7 @@ public abstract class Inventory extends ItemContainer
|
||||
case ItemTemplate.SLOT_BROOCH:
|
||||
{
|
||||
pdollSlot = PAPERDOLL_BROOCH;
|
||||
containerItemCheck();
|
||||
break;
|
||||
}
|
||||
case ItemTemplate.SLOT_BROOCH_JEWEL:
|
||||
@ -1746,6 +1752,26 @@ public abstract class Inventory extends ItemContainer
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Avoid flood from container items.
|
||||
*/
|
||||
private void containerItemCheck()
|
||||
{
|
||||
final Creature owner = getOwner();
|
||||
if ((owner != null) && owner.isPlayer() && (_containerItemTask == null))
|
||||
{
|
||||
owner.getActingPlayer().setUsingContainerItem(true);
|
||||
_containerItemTask = ThreadPool.schedule(() ->
|
||||
{
|
||||
owner.getActingPlayer().setUsingContainerItem(false);
|
||||
owner.getStat().recalculateStats(true);
|
||||
owner.updateAbnormalVisualEffects();
|
||||
owner.getActingPlayer().sendSkillList();
|
||||
_containerItemTask = null;
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Equips item and returns list of alterations<br>
|
||||
* <b>If you don't need return value use {@link Inventory#equipItem(Item)} instead</b>
|
||||
|
@ -229,8 +229,8 @@ public class GameClient extends ChannelInboundHandler<GameClient>
|
||||
|
||||
if (_player != null)
|
||||
{
|
||||
// Avoid flood from class change.
|
||||
if (_player.isChangingClass() && ((packet instanceof SkillList) || (packet instanceof AcquireSkillList) || (packet instanceof ExUserInfoAbnormalVisualEffect) || (packet instanceof AbnormalStatusUpdate) || (packet instanceof ExAbnormalStatusUpdateFromTarget)))
|
||||
// Avoid flood from class change or container items.
|
||||
if ((_player.isChangingClass() || _player.isUsingContainerItem()) && ((packet instanceof SkillList) || (packet instanceof AcquireSkillList) || (packet instanceof ExUserInfoAbnormalVisualEffect) || (packet instanceof AbnormalStatusUpdate) || (packet instanceof ExAbnormalStatusUpdateFromTarget)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -561,10 +561,9 @@ public class Player extends Playable
|
||||
private final PlayerFreight _freight = new PlayerFreight(this);
|
||||
private PlayerWarehouse _warehouse;
|
||||
private PlayerRefund _refund;
|
||||
|
||||
private PrivateStoreType _privateStoreType = PrivateStoreType.NONE;
|
||||
|
||||
private TradeList _activeTradeList;
|
||||
private boolean _isUsingContainerItem;
|
||||
private ItemContainer _activeWarehouse;
|
||||
private Map<Integer, ManufactureItem> _manufactureItems;
|
||||
private String _storeName = "";
|
||||
@ -5557,6 +5556,16 @@ public class Player extends Playable
|
||||
return _activeWarehouse;
|
||||
}
|
||||
|
||||
public boolean isUsingContainerItem()
|
||||
{
|
||||
return _isUsingContainerItem;
|
||||
}
|
||||
|
||||
public void setUsingContainerItem(boolean value)
|
||||
{
|
||||
_isUsingContainerItem = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Select the TradeList to be used in next activity.
|
||||
* @param tradeList
|
||||
|
@ -52,7 +52,6 @@ import org.l2jmobius.gameserver.util.Util;
|
||||
public class PlayerStat extends PlayableStat
|
||||
{
|
||||
private long _startingXp;
|
||||
/** Player's maximum talisman count. */
|
||||
private final AtomicInteger _talismanSlots = new AtomicInteger();
|
||||
private boolean _cloakSlot = false;
|
||||
private int _vitalityPoints = 0;
|
||||
@ -673,7 +672,7 @@ public class PlayerStat extends PlayableStat
|
||||
@Override
|
||||
public void recalculateStats(boolean broadcast)
|
||||
{
|
||||
if (!getActiveChar().isChangingClass())
|
||||
if (!getActiveChar().isChangingClass() && !getActiveChar().isUsingContainerItem())
|
||||
{
|
||||
super.recalculateStats(broadcast);
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.logging.Level;
|
||||
@ -33,6 +34,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.CommonUtil;
|
||||
import org.l2jmobius.gameserver.cache.PaperdollCache;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
@ -75,6 +77,8 @@ public abstract class Inventory extends ItemContainer
|
||||
{
|
||||
protected static final Logger LOGGER = Logger.getLogger(Inventory.class.getName());
|
||||
|
||||
private ScheduledFuture<?> _containerItemTask;
|
||||
|
||||
public interface PaperdollListener
|
||||
{
|
||||
void notifyEquiped(int slot, Item inst, Inventory inventory);
|
||||
@ -1790,10 +1794,12 @@ public abstract class Inventory extends ItemContainer
|
||||
else if (slot == ItemTemplate.SLOT_L_BRACELET)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_LBRACELET;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_R_BRACELET)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_RBRACELET;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_DECO)
|
||||
{
|
||||
@ -1806,6 +1812,7 @@ public abstract class Inventory extends ItemContainer
|
||||
else if (slot == ItemTemplate.SLOT_BROOCH)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_BROOCH;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_BROOCH_JEWEL)
|
||||
{
|
||||
@ -1835,6 +1842,26 @@ public abstract class Inventory extends ItemContainer
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Avoid flood from container items.
|
||||
*/
|
||||
private void containerItemCheck()
|
||||
{
|
||||
final Creature owner = getOwner();
|
||||
if ((owner != null) && owner.isPlayer() && (_containerItemTask == null))
|
||||
{
|
||||
owner.getActingPlayer().setUsingContainerItem(true);
|
||||
_containerItemTask = ThreadPool.schedule(() ->
|
||||
{
|
||||
owner.getActingPlayer().setUsingContainerItem(false);
|
||||
owner.getStat().recalculateStats(true);
|
||||
owner.updateAbnormalVisualEffects();
|
||||
owner.getActingPlayer().sendSkillList();
|
||||
_containerItemTask = null;
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Equips item and returns list of alterations<br>
|
||||
* <b>If you don't need return value use {@link Inventory#equipItem(Item)} instead</b>
|
||||
|
@ -229,8 +229,8 @@ public class GameClient extends ChannelInboundHandler<GameClient>
|
||||
|
||||
if (_player != null)
|
||||
{
|
||||
// Avoid flood from class change.
|
||||
if (_player.isChangingClass() && ((packet instanceof SkillList) || (packet instanceof AcquireSkillList) || (packet instanceof ExUserInfoAbnormalVisualEffect) || (packet instanceof AbnormalStatusUpdate) || (packet instanceof ExAbnormalStatusUpdateFromTarget)))
|
||||
// Avoid flood from class change or container items.
|
||||
if ((_player.isChangingClass() || _player.isUsingContainerItem()) && ((packet instanceof SkillList) || (packet instanceof AcquireSkillList) || (packet instanceof ExUserInfoAbnormalVisualEffect) || (packet instanceof AbnormalStatusUpdate) || (packet instanceof ExAbnormalStatusUpdateFromTarget)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -569,10 +569,9 @@ public class Player extends Playable
|
||||
private final PlayerFreight _freight = new PlayerFreight(this);
|
||||
private PlayerWarehouse _warehouse;
|
||||
private PlayerRefund _refund;
|
||||
|
||||
private PrivateStoreType _privateStoreType = PrivateStoreType.NONE;
|
||||
|
||||
private TradeList _activeTradeList;
|
||||
private boolean _isUsingContainerItem;
|
||||
private ItemContainer _activeWarehouse;
|
||||
private Map<Integer, ManufactureItem> _manufactureItems;
|
||||
private String _storeName = "";
|
||||
@ -5571,6 +5570,16 @@ public class Player extends Playable
|
||||
return _activeWarehouse;
|
||||
}
|
||||
|
||||
public boolean isUsingContainerItem()
|
||||
{
|
||||
return _isUsingContainerItem;
|
||||
}
|
||||
|
||||
public void setUsingContainerItem(boolean value)
|
||||
{
|
||||
_isUsingContainerItem = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Select the TradeList to be used in next activity.
|
||||
* @param tradeList
|
||||
|
@ -53,7 +53,6 @@ import org.l2jmobius.gameserver.util.Util;
|
||||
public class PlayerStat extends PlayableStat
|
||||
{
|
||||
private long _startingXp;
|
||||
/** Player's maximum talisman count. */
|
||||
private final AtomicInteger _talismanSlots = new AtomicInteger();
|
||||
private boolean _cloakSlot = false;
|
||||
private int _vitalityPoints = 0;
|
||||
@ -708,7 +707,7 @@ public class PlayerStat extends PlayableStat
|
||||
@Override
|
||||
public void recalculateStats(boolean broadcast)
|
||||
{
|
||||
if (!getActiveChar().isChangingClass())
|
||||
if (!getActiveChar().isChangingClass() && !getActiveChar().isUsingContainerItem())
|
||||
{
|
||||
super.recalculateStats(broadcast);
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.logging.Level;
|
||||
@ -33,6 +34,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.CommonUtil;
|
||||
import org.l2jmobius.gameserver.cache.PaperdollCache;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
@ -75,6 +77,8 @@ public abstract class Inventory extends ItemContainer
|
||||
{
|
||||
protected static final Logger LOGGER = Logger.getLogger(Inventory.class.getName());
|
||||
|
||||
private ScheduledFuture<?> _containerItemTask;
|
||||
|
||||
public interface PaperdollListener
|
||||
{
|
||||
void notifyEquiped(int slot, Item inst, Inventory inventory);
|
||||
@ -1901,10 +1905,12 @@ public abstract class Inventory extends ItemContainer
|
||||
else if (slot == ItemTemplate.SLOT_L_BRACELET)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_LBRACELET;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_R_BRACELET)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_RBRACELET;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_DECO)
|
||||
{
|
||||
@ -1917,6 +1923,7 @@ public abstract class Inventory extends ItemContainer
|
||||
else if (slot == ItemTemplate.SLOT_BROOCH)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_BROOCH;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_BROOCH_JEWEL)
|
||||
{
|
||||
@ -1929,6 +1936,7 @@ public abstract class Inventory extends ItemContainer
|
||||
else if (slot == ItemTemplate.SLOT_ARTIFACT_BOOK)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_ARTIFACT_BOOK;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_ARTIFACT)
|
||||
{
|
||||
@ -1951,6 +1959,26 @@ public abstract class Inventory extends ItemContainer
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Avoid flood from container items.
|
||||
*/
|
||||
private void containerItemCheck()
|
||||
{
|
||||
final Creature owner = getOwner();
|
||||
if ((owner != null) && owner.isPlayer() && (_containerItemTask == null))
|
||||
{
|
||||
owner.getActingPlayer().setUsingContainerItem(true);
|
||||
_containerItemTask = ThreadPool.schedule(() ->
|
||||
{
|
||||
owner.getActingPlayer().setUsingContainerItem(false);
|
||||
owner.getStat().recalculateStats(true);
|
||||
owner.updateAbnormalVisualEffects();
|
||||
owner.getActingPlayer().sendSkillList();
|
||||
_containerItemTask = null;
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Equips item and returns list of alterations<br>
|
||||
* <b>If you don't need return value use {@link Inventory#equipItem(Item)} instead</b>
|
||||
|
@ -229,8 +229,8 @@ public class GameClient extends ChannelInboundHandler<GameClient>
|
||||
|
||||
if (_player != null)
|
||||
{
|
||||
// Avoid flood from class change.
|
||||
if (_player.isChangingClass() && ((packet instanceof SkillList) || (packet instanceof AcquireSkillList) || (packet instanceof ExUserInfoAbnormalVisualEffect) || (packet instanceof AbnormalStatusUpdate) || (packet instanceof ExAbnormalStatusUpdateFromTarget)))
|
||||
// Avoid flood from class change or container items.
|
||||
if ((_player.isChangingClass() || _player.isUsingContainerItem()) && ((packet instanceof SkillList) || (packet instanceof AcquireSkillList) || (packet instanceof ExUserInfoAbnormalVisualEffect) || (packet instanceof AbnormalStatusUpdate) || (packet instanceof ExAbnormalStatusUpdateFromTarget)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -569,10 +569,9 @@ public class Player extends Playable
|
||||
private final PlayerFreight _freight = new PlayerFreight(this);
|
||||
private PlayerWarehouse _warehouse;
|
||||
private PlayerRefund _refund;
|
||||
|
||||
private PrivateStoreType _privateStoreType = PrivateStoreType.NONE;
|
||||
|
||||
private TradeList _activeTradeList;
|
||||
private boolean _isUsingContainerItem;
|
||||
private ItemContainer _activeWarehouse;
|
||||
private Map<Integer, ManufactureItem> _manufactureItems;
|
||||
private String _storeName = "";
|
||||
@ -5571,6 +5570,16 @@ public class Player extends Playable
|
||||
return _activeWarehouse;
|
||||
}
|
||||
|
||||
public boolean isUsingContainerItem()
|
||||
{
|
||||
return _isUsingContainerItem;
|
||||
}
|
||||
|
||||
public void setUsingContainerItem(boolean value)
|
||||
{
|
||||
_isUsingContainerItem = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Select the TradeList to be used in next activity.
|
||||
* @param tradeList
|
||||
|
@ -53,7 +53,6 @@ import org.l2jmobius.gameserver.util.Util;
|
||||
public class PlayerStat extends PlayableStat
|
||||
{
|
||||
private long _startingXp;
|
||||
/** Player's maximum talisman count. */
|
||||
private final AtomicInteger _talismanSlots = new AtomicInteger();
|
||||
private boolean _cloakSlot = false;
|
||||
private int _vitalityPoints = 0;
|
||||
@ -708,7 +707,7 @@ public class PlayerStat extends PlayableStat
|
||||
@Override
|
||||
public void recalculateStats(boolean broadcast)
|
||||
{
|
||||
if (!getActiveChar().isChangingClass())
|
||||
if (!getActiveChar().isChangingClass() && !getActiveChar().isUsingContainerItem())
|
||||
{
|
||||
super.recalculateStats(broadcast);
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.logging.Level;
|
||||
@ -33,6 +34,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.CommonUtil;
|
||||
import org.l2jmobius.gameserver.cache.PaperdollCache;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
@ -75,6 +77,8 @@ public abstract class Inventory extends ItemContainer
|
||||
{
|
||||
protected static final Logger LOGGER = Logger.getLogger(Inventory.class.getName());
|
||||
|
||||
private ScheduledFuture<?> _containerItemTask;
|
||||
|
||||
public interface PaperdollListener
|
||||
{
|
||||
void notifyEquiped(int slot, Item inst, Inventory inventory);
|
||||
@ -1901,10 +1905,12 @@ public abstract class Inventory extends ItemContainer
|
||||
else if (slot == ItemTemplate.SLOT_L_BRACELET)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_LBRACELET;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_R_BRACELET)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_RBRACELET;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_DECO)
|
||||
{
|
||||
@ -1917,6 +1923,7 @@ public abstract class Inventory extends ItemContainer
|
||||
else if (slot == ItemTemplate.SLOT_BROOCH)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_BROOCH;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_BROOCH_JEWEL)
|
||||
{
|
||||
@ -1929,6 +1936,7 @@ public abstract class Inventory extends ItemContainer
|
||||
else if (slot == ItemTemplate.SLOT_ARTIFACT_BOOK)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_ARTIFACT_BOOK;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_ARTIFACT)
|
||||
{
|
||||
@ -1951,6 +1959,26 @@ public abstract class Inventory extends ItemContainer
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Avoid flood from container items.
|
||||
*/
|
||||
private void containerItemCheck()
|
||||
{
|
||||
final Creature owner = getOwner();
|
||||
if ((owner != null) && owner.isPlayer() && (_containerItemTask == null))
|
||||
{
|
||||
owner.getActingPlayer().setUsingContainerItem(true);
|
||||
_containerItemTask = ThreadPool.schedule(() ->
|
||||
{
|
||||
owner.getActingPlayer().setUsingContainerItem(false);
|
||||
owner.getStat().recalculateStats(true);
|
||||
owner.updateAbnormalVisualEffects();
|
||||
owner.getActingPlayer().sendSkillList();
|
||||
_containerItemTask = null;
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Equips item and returns list of alterations<br>
|
||||
* <b>If you don't need return value use {@link Inventory#equipItem(Item)} instead</b>
|
||||
|
@ -229,8 +229,8 @@ public class GameClient extends ChannelInboundHandler<GameClient>
|
||||
|
||||
if (_player != null)
|
||||
{
|
||||
// Avoid flood from class change.
|
||||
if (_player.isChangingClass() && ((packet instanceof SkillList) || (packet instanceof AcquireSkillList) || (packet instanceof ExUserInfoAbnormalVisualEffect) || (packet instanceof AbnormalStatusUpdate) || (packet instanceof ExAbnormalStatusUpdateFromTarget)))
|
||||
// Avoid flood from class change or container items.
|
||||
if ((_player.isChangingClass() || _player.isUsingContainerItem()) && ((packet instanceof SkillList) || (packet instanceof AcquireSkillList) || (packet instanceof ExUserInfoAbnormalVisualEffect) || (packet instanceof AbnormalStatusUpdate) || (packet instanceof ExAbnormalStatusUpdateFromTarget)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -585,10 +585,9 @@ public class Player extends Playable
|
||||
private final PlayerFreight _freight = new PlayerFreight(this);
|
||||
private PlayerWarehouse _warehouse;
|
||||
private PlayerRefund _refund;
|
||||
|
||||
private PrivateStoreType _privateStoreType = PrivateStoreType.NONE;
|
||||
|
||||
private TradeList _activeTradeList;
|
||||
private boolean _isUsingContainerItem;
|
||||
private ItemContainer _activeWarehouse;
|
||||
private Map<Integer, ManufactureItem> _manufactureItems;
|
||||
private String _storeName = "";
|
||||
@ -5526,6 +5525,16 @@ public class Player extends Playable
|
||||
return _activeWarehouse;
|
||||
}
|
||||
|
||||
public boolean isUsingContainerItem()
|
||||
{
|
||||
return _isUsingContainerItem;
|
||||
}
|
||||
|
||||
public void setUsingContainerItem(boolean value)
|
||||
{
|
||||
_isUsingContainerItem = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Select the TradeList to be used in next activity.
|
||||
* @param tradeList
|
||||
|
@ -53,7 +53,6 @@ import org.l2jmobius.gameserver.util.Util;
|
||||
public class PlayerStat extends PlayableStat
|
||||
{
|
||||
private long _startingXp;
|
||||
/** Player's maximum talisman count. */
|
||||
private final AtomicInteger _talismanSlots = new AtomicInteger();
|
||||
private boolean _cloakSlot = false;
|
||||
private int _vitalityPoints = 0;
|
||||
@ -706,7 +705,7 @@ public class PlayerStat extends PlayableStat
|
||||
@Override
|
||||
public void recalculateStats(boolean broadcast)
|
||||
{
|
||||
if (!getActiveChar().isChangingClass())
|
||||
if (!getActiveChar().isChangingClass() && !getActiveChar().isUsingContainerItem())
|
||||
{
|
||||
super.recalculateStats(broadcast);
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.logging.Level;
|
||||
@ -33,6 +34,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.CommonUtil;
|
||||
import org.l2jmobius.gameserver.cache.PaperdollCache;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
@ -75,6 +77,8 @@ public abstract class Inventory extends ItemContainer
|
||||
{
|
||||
protected static final Logger LOGGER = Logger.getLogger(Inventory.class.getName());
|
||||
|
||||
private ScheduledFuture<?> _containerItemTask;
|
||||
|
||||
public interface PaperdollListener
|
||||
{
|
||||
void notifyEquiped(int slot, Item inst, Inventory inventory);
|
||||
@ -1891,10 +1895,12 @@ public abstract class Inventory extends ItemContainer
|
||||
else if (slot == ItemTemplate.SLOT_L_BRACELET)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_LBRACELET;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_R_BRACELET)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_RBRACELET;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_DECO)
|
||||
{
|
||||
@ -1907,6 +1913,7 @@ public abstract class Inventory extends ItemContainer
|
||||
else if (slot == ItemTemplate.SLOT_BROOCH)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_BROOCH;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_BROOCH_JEWEL)
|
||||
{
|
||||
@ -1919,6 +1926,7 @@ public abstract class Inventory extends ItemContainer
|
||||
else if (slot == ItemTemplate.SLOT_ARTIFACT_BOOK)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_ARTIFACT_BOOK;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_ARTIFACT)
|
||||
{
|
||||
@ -1936,6 +1944,26 @@ public abstract class Inventory extends ItemContainer
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Avoid flood from container items.
|
||||
*/
|
||||
private void containerItemCheck()
|
||||
{
|
||||
final Creature owner = getOwner();
|
||||
if ((owner != null) && owner.isPlayer() && (_containerItemTask == null))
|
||||
{
|
||||
owner.getActingPlayer().setUsingContainerItem(true);
|
||||
_containerItemTask = ThreadPool.schedule(() ->
|
||||
{
|
||||
owner.getActingPlayer().setUsingContainerItem(false);
|
||||
owner.getStat().recalculateStats(true);
|
||||
owner.updateAbnormalVisualEffects();
|
||||
owner.getActingPlayer().sendSkillList();
|
||||
_containerItemTask = null;
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Equips item and returns list of alterations<br>
|
||||
* <b>If you don't need return value use {@link Inventory#equipItem(Item)} instead</b>
|
||||
|
@ -229,8 +229,8 @@ public class GameClient extends ChannelInboundHandler<GameClient>
|
||||
|
||||
if (_player != null)
|
||||
{
|
||||
// Avoid flood from class change.
|
||||
if (_player.isChangingClass() && ((packet instanceof SkillList) || (packet instanceof AcquireSkillList) || (packet instanceof ExUserInfoAbnormalVisualEffect) || (packet instanceof AbnormalStatusUpdate) || (packet instanceof ExAbnormalStatusUpdateFromTarget)))
|
||||
// Avoid flood from class change or container items.
|
||||
if ((_player.isChangingClass() || _player.isUsingContainerItem()) && ((packet instanceof SkillList) || (packet instanceof AcquireSkillList) || (packet instanceof ExUserInfoAbnormalVisualEffect) || (packet instanceof AbnormalStatusUpdate) || (packet instanceof ExAbnormalStatusUpdateFromTarget)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -558,10 +558,9 @@ public class Player extends Playable
|
||||
private final PlayerFreight _freight = new PlayerFreight(this);
|
||||
private PlayerWarehouse _warehouse;
|
||||
private PlayerRefund _refund;
|
||||
|
||||
private PrivateStoreType _privateStoreType = PrivateStoreType.NONE;
|
||||
|
||||
private TradeList _activeTradeList;
|
||||
private boolean _isUsingContainerItem;
|
||||
private ItemContainer _activeWarehouse;
|
||||
private Map<Integer, ManufactureItem> _manufactureItems;
|
||||
private String _storeName = "";
|
||||
@ -5553,6 +5552,16 @@ public class Player extends Playable
|
||||
return _activeWarehouse;
|
||||
}
|
||||
|
||||
public boolean isUsingContainerItem()
|
||||
{
|
||||
return _isUsingContainerItem;
|
||||
}
|
||||
|
||||
public void setUsingContainerItem(boolean value)
|
||||
{
|
||||
_isUsingContainerItem = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Select the TradeList to be used in next activity.
|
||||
* @param tradeList
|
||||
|
@ -52,7 +52,6 @@ import org.l2jmobius.gameserver.util.Util;
|
||||
public class PlayerStat extends PlayableStat
|
||||
{
|
||||
private long _startingXp;
|
||||
/** Player's maximum talisman count. */
|
||||
private final AtomicInteger _talismanSlots = new AtomicInteger();
|
||||
private boolean _cloakSlot = false;
|
||||
private int _vitalityPoints = 0;
|
||||
@ -664,7 +663,7 @@ public class PlayerStat extends PlayableStat
|
||||
@Override
|
||||
public void recalculateStats(boolean broadcast)
|
||||
{
|
||||
if (!getActiveChar().isChangingClass())
|
||||
if (!getActiveChar().isChangingClass() && !getActiveChar().isUsingContainerItem())
|
||||
{
|
||||
super.recalculateStats(broadcast);
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.logging.Level;
|
||||
@ -33,6 +34,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.CommonUtil;
|
||||
import org.l2jmobius.gameserver.cache.PaperdollCache;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
@ -73,6 +75,8 @@ public abstract class Inventory extends ItemContainer
|
||||
{
|
||||
protected static final Logger LOGGER = Logger.getLogger(Inventory.class.getName());
|
||||
|
||||
private ScheduledFuture<?> _containerItemTask;
|
||||
|
||||
public interface PaperdollListener
|
||||
{
|
||||
void notifyEquiped(int slot, Item inst, Inventory inventory);
|
||||
@ -1698,6 +1702,7 @@ public abstract class Inventory extends ItemContainer
|
||||
case ItemTemplate.SLOT_R_BRACELET:
|
||||
{
|
||||
pdollSlot = PAPERDOLL_RBRACELET;
|
||||
containerItemCheck();
|
||||
break;
|
||||
}
|
||||
case ItemTemplate.SLOT_DECO:
|
||||
@ -1713,6 +1718,7 @@ public abstract class Inventory extends ItemContainer
|
||||
case ItemTemplate.SLOT_BROOCH:
|
||||
{
|
||||
pdollSlot = PAPERDOLL_BROOCH;
|
||||
containerItemCheck();
|
||||
break;
|
||||
}
|
||||
case ItemTemplate.SLOT_BROOCH_JEWEL:
|
||||
@ -1738,6 +1744,26 @@ public abstract class Inventory extends ItemContainer
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Avoid flood from container items.
|
||||
*/
|
||||
private void containerItemCheck()
|
||||
{
|
||||
final Creature owner = getOwner();
|
||||
if ((owner != null) && owner.isPlayer() && (_containerItemTask == null))
|
||||
{
|
||||
owner.getActingPlayer().setUsingContainerItem(true);
|
||||
_containerItemTask = ThreadPool.schedule(() ->
|
||||
{
|
||||
owner.getActingPlayer().setUsingContainerItem(false);
|
||||
owner.getStat().recalculateStats(true);
|
||||
owner.updateAbnormalVisualEffects();
|
||||
owner.getActingPlayer().sendSkillList();
|
||||
_containerItemTask = null;
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Equips item and returns list of alterations<br>
|
||||
* <b>If you don't need return value use {@link Inventory#equipItem(Item)} instead</b>
|
||||
|
@ -229,8 +229,8 @@ public class GameClient extends ChannelInboundHandler<GameClient>
|
||||
|
||||
if (_player != null)
|
||||
{
|
||||
// Avoid flood from class change.
|
||||
if (_player.isChangingClass() && ((packet instanceof SkillList) || (packet instanceof AcquireSkillList) || (packet instanceof ExUserInfoAbnormalVisualEffect) || (packet instanceof AbnormalStatusUpdate) || (packet instanceof ExAbnormalStatusUpdateFromTarget)))
|
||||
// Avoid flood from class change or container items.
|
||||
if ((_player.isChangingClass() || _player.isUsingContainerItem()) && ((packet instanceof SkillList) || (packet instanceof AcquireSkillList) || (packet instanceof ExUserInfoAbnormalVisualEffect) || (packet instanceof AbnormalStatusUpdate) || (packet instanceof ExAbnormalStatusUpdateFromTarget)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -604,10 +604,9 @@ public class Player extends Playable
|
||||
private final PlayerFreight _freight = new PlayerFreight(this);
|
||||
private PlayerWarehouse _warehouse;
|
||||
private PlayerRefund _refund;
|
||||
|
||||
private PrivateStoreType _privateStoreType = PrivateStoreType.NONE;
|
||||
|
||||
private TradeList _activeTradeList;
|
||||
private boolean _isUsingContainerItem;
|
||||
private ItemContainer _activeWarehouse;
|
||||
private Map<Integer, ManufactureItem> _manufactureItems;
|
||||
private String _storeName = "";
|
||||
@ -5610,6 +5609,16 @@ public class Player extends Playable
|
||||
return _activeWarehouse;
|
||||
}
|
||||
|
||||
public boolean isUsingContainerItem()
|
||||
{
|
||||
return _isUsingContainerItem;
|
||||
}
|
||||
|
||||
public void setUsingContainerItem(boolean value)
|
||||
{
|
||||
_isUsingContainerItem = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Select the TradeList to be used in next activity.
|
||||
* @param tradeList
|
||||
|
@ -55,7 +55,6 @@ import org.l2jmobius.gameserver.util.Util;
|
||||
public class PlayerStat extends PlayableStat
|
||||
{
|
||||
private long _startingXp;
|
||||
/** Player's maximum talisman count. */
|
||||
private final AtomicInteger _talismanSlots = new AtomicInteger();
|
||||
private boolean _cloakSlot = false;
|
||||
private int _vitalityPoints = 0;
|
||||
@ -722,7 +721,7 @@ public class PlayerStat extends PlayableStat
|
||||
@Override
|
||||
public void recalculateStats(boolean broadcast)
|
||||
{
|
||||
if (!getActiveChar().isChangingClass())
|
||||
if (!getActiveChar().isChangingClass() && !getActiveChar().isUsingContainerItem())
|
||||
{
|
||||
super.recalculateStats(broadcast);
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.logging.Level;
|
||||
@ -33,6 +34,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.CommonUtil;
|
||||
import org.l2jmobius.gameserver.cache.PaperdollCache;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
@ -74,6 +76,8 @@ public abstract class Inventory extends ItemContainer
|
||||
{
|
||||
protected static final Logger LOGGER = Logger.getLogger(Inventory.class.getName());
|
||||
|
||||
private ScheduledFuture<?> _containerItemTask;
|
||||
|
||||
public interface PaperdollListener
|
||||
{
|
||||
void notifyEquiped(int slot, Item inst, Inventory inventory);
|
||||
@ -1999,10 +2003,12 @@ public abstract class Inventory extends ItemContainer
|
||||
else if (slot == ItemTemplate.SLOT_L_BRACELET)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_LBRACELET;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_R_BRACELET)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_RBRACELET;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_DECO)
|
||||
{
|
||||
@ -2015,6 +2021,7 @@ public abstract class Inventory extends ItemContainer
|
||||
else if (slot == ItemTemplate.SLOT_BROOCH)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_BROOCH;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_BROOCH_JEWEL)
|
||||
{
|
||||
@ -2027,6 +2034,7 @@ public abstract class Inventory extends ItemContainer
|
||||
else if (slot == ItemTemplate.SLOT_ARTIFACT_BOOK)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_ARTIFACT_BOOK;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_ARTIFACT)
|
||||
{
|
||||
@ -2044,6 +2052,26 @@ public abstract class Inventory extends ItemContainer
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Avoid flood from container items.
|
||||
*/
|
||||
private void containerItemCheck()
|
||||
{
|
||||
final Creature owner = getOwner();
|
||||
if ((owner != null) && owner.isPlayer() && (_containerItemTask == null))
|
||||
{
|
||||
owner.getActingPlayer().setUsingContainerItem(true);
|
||||
_containerItemTask = ThreadPool.schedule(() ->
|
||||
{
|
||||
owner.getActingPlayer().setUsingContainerItem(false);
|
||||
owner.getStat().recalculateStats(true);
|
||||
owner.updateAbnormalVisualEffects();
|
||||
owner.getActingPlayer().sendSkillList();
|
||||
_containerItemTask = null;
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Equips item and returns list of alterations<br>
|
||||
* <b>If you don't need return value use {@link Inventory#equipItem(Item)} instead</b>
|
||||
|
@ -229,8 +229,8 @@ public class GameClient extends ChannelInboundHandler<GameClient>
|
||||
|
||||
if (_player != null)
|
||||
{
|
||||
// Avoid flood from class change.
|
||||
if (_player.isChangingClass() && ((packet instanceof SkillList) || (packet instanceof AcquireSkillList) || (packet instanceof ExUserInfoAbnormalVisualEffect) || (packet instanceof AbnormalStatusUpdate) || (packet instanceof ExAbnormalStatusUpdateFromTarget)))
|
||||
// Avoid flood from class change or container items.
|
||||
if ((_player.isChangingClass() || _player.isUsingContainerItem()) && ((packet instanceof SkillList) || (packet instanceof AcquireSkillList) || (packet instanceof ExUserInfoAbnormalVisualEffect) || (packet instanceof AbnormalStatusUpdate) || (packet instanceof ExAbnormalStatusUpdateFromTarget)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -628,10 +628,9 @@ public class Player extends Playable
|
||||
private final PlayerFreight _freight = new PlayerFreight(this);
|
||||
private PlayerWarehouse _warehouse;
|
||||
private PlayerRefund _refund;
|
||||
|
||||
private PrivateStoreType _privateStoreType = PrivateStoreType.NONE;
|
||||
|
||||
private TradeList _activeTradeList;
|
||||
private boolean _isUsingContainerItem;
|
||||
private ItemContainer _activeWarehouse;
|
||||
private Map<Integer, ManufactureItem> _manufactureItems;
|
||||
private String _storeName = "";
|
||||
@ -5651,6 +5650,16 @@ public class Player extends Playable
|
||||
return _activeWarehouse;
|
||||
}
|
||||
|
||||
public boolean isUsingContainerItem()
|
||||
{
|
||||
return _isUsingContainerItem;
|
||||
}
|
||||
|
||||
public void setUsingContainerItem(boolean value)
|
||||
{
|
||||
_isUsingContainerItem = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Select the TradeList to be used in next activity.
|
||||
* @param tradeList
|
||||
|
@ -55,7 +55,6 @@ import org.l2jmobius.gameserver.util.Util;
|
||||
public class PlayerStat extends PlayableStat
|
||||
{
|
||||
private long _startingXp;
|
||||
/** Player's maximum talisman count. */
|
||||
private final AtomicInteger _talismanSlots = new AtomicInteger();
|
||||
private boolean _cloakSlot = false;
|
||||
private int _vitalityPoints = 0;
|
||||
@ -722,7 +721,7 @@ public class PlayerStat extends PlayableStat
|
||||
@Override
|
||||
public void recalculateStats(boolean broadcast)
|
||||
{
|
||||
if (!getActiveChar().isChangingClass())
|
||||
if (!getActiveChar().isChangingClass() && !getActiveChar().isUsingContainerItem())
|
||||
{
|
||||
super.recalculateStats(broadcast);
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.logging.Level;
|
||||
@ -33,6 +34,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.CommonUtil;
|
||||
import org.l2jmobius.gameserver.cache.PaperdollCache;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
@ -74,6 +76,8 @@ public abstract class Inventory extends ItemContainer
|
||||
{
|
||||
protected static final Logger LOGGER = Logger.getLogger(Inventory.class.getName());
|
||||
|
||||
private ScheduledFuture<?> _containerItemTask;
|
||||
|
||||
public interface PaperdollListener
|
||||
{
|
||||
void notifyEquiped(int slot, Item inst, Inventory inventory);
|
||||
@ -2008,10 +2012,12 @@ public abstract class Inventory extends ItemContainer
|
||||
else if (slot == ItemTemplate.SLOT_L_BRACELET)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_LBRACELET;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_R_BRACELET)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_RBRACELET;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_DECO)
|
||||
{
|
||||
@ -2024,6 +2030,7 @@ public abstract class Inventory extends ItemContainer
|
||||
else if (slot == ItemTemplate.SLOT_BROOCH)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_BROOCH;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_BROOCH_JEWEL)
|
||||
{
|
||||
@ -2036,6 +2043,7 @@ public abstract class Inventory extends ItemContainer
|
||||
else if (slot == ItemTemplate.SLOT_ARTIFACT_BOOK)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_ARTIFACT_BOOK;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_ARTIFACT)
|
||||
{
|
||||
@ -2053,6 +2061,26 @@ public abstract class Inventory extends ItemContainer
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Avoid flood from container items.
|
||||
*/
|
||||
private void containerItemCheck()
|
||||
{
|
||||
final Creature owner = getOwner();
|
||||
if ((owner != null) && owner.isPlayer() && (_containerItemTask == null))
|
||||
{
|
||||
owner.getActingPlayer().setUsingContainerItem(true);
|
||||
_containerItemTask = ThreadPool.schedule(() ->
|
||||
{
|
||||
owner.getActingPlayer().setUsingContainerItem(false);
|
||||
owner.getStat().recalculateStats(true);
|
||||
owner.updateAbnormalVisualEffects();
|
||||
owner.getActingPlayer().sendSkillList();
|
||||
_containerItemTask = null;
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Equips item and returns list of alterations<br>
|
||||
* <b>If you don't need return value use {@link Inventory#equipItem(Item)} instead</b>
|
||||
|
@ -229,8 +229,8 @@ public class GameClient extends ChannelInboundHandler<GameClient>
|
||||
|
||||
if (_player != null)
|
||||
{
|
||||
// Avoid flood from class change.
|
||||
if (_player.isChangingClass() && ((packet instanceof SkillList) || (packet instanceof AcquireSkillList) || (packet instanceof ExUserInfoAbnormalVisualEffect) || (packet instanceof AbnormalStatusUpdate) || (packet instanceof ExAbnormalStatusUpdateFromTarget)))
|
||||
// Avoid flood from class change or container items.
|
||||
if ((_player.isChangingClass() || _player.isUsingContainerItem()) && ((packet instanceof SkillList) || (packet instanceof AcquireSkillList) || (packet instanceof ExUserInfoAbnormalVisualEffect) || (packet instanceof AbnormalStatusUpdate) || (packet instanceof ExAbnormalStatusUpdateFromTarget)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -628,10 +628,9 @@ public class Player extends Playable
|
||||
private final PlayerFreight _freight = new PlayerFreight(this);
|
||||
private PlayerWarehouse _warehouse;
|
||||
private PlayerRefund _refund;
|
||||
|
||||
private PrivateStoreType _privateStoreType = PrivateStoreType.NONE;
|
||||
|
||||
private TradeList _activeTradeList;
|
||||
private boolean _isUsingContainerItem;
|
||||
private ItemContainer _activeWarehouse;
|
||||
private Map<Integer, ManufactureItem> _manufactureItems;
|
||||
private String _storeName = "";
|
||||
@ -5651,6 +5650,16 @@ public class Player extends Playable
|
||||
return _activeWarehouse;
|
||||
}
|
||||
|
||||
public boolean isUsingContainerItem()
|
||||
{
|
||||
return _isUsingContainerItem;
|
||||
}
|
||||
|
||||
public void setUsingContainerItem(boolean value)
|
||||
{
|
||||
_isUsingContainerItem = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Select the TradeList to be used in next activity.
|
||||
* @param tradeList
|
||||
|
@ -55,7 +55,6 @@ import org.l2jmobius.gameserver.util.Util;
|
||||
public class PlayerStat extends PlayableStat
|
||||
{
|
||||
private long _startingXp;
|
||||
/** Player's maximum talisman count. */
|
||||
private final AtomicInteger _talismanSlots = new AtomicInteger();
|
||||
private boolean _cloakSlot = false;
|
||||
private int _vitalityPoints = 0;
|
||||
@ -722,7 +721,7 @@ public class PlayerStat extends PlayableStat
|
||||
@Override
|
||||
public void recalculateStats(boolean broadcast)
|
||||
{
|
||||
if (!getActiveChar().isChangingClass())
|
||||
if (!getActiveChar().isChangingClass() && !getActiveChar().isUsingContainerItem())
|
||||
{
|
||||
super.recalculateStats(broadcast);
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.logging.Level;
|
||||
@ -33,6 +34,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.CommonUtil;
|
||||
import org.l2jmobius.gameserver.cache.PaperdollCache;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
@ -74,6 +76,8 @@ public abstract class Inventory extends ItemContainer
|
||||
{
|
||||
protected static final Logger LOGGER = Logger.getLogger(Inventory.class.getName());
|
||||
|
||||
private ScheduledFuture<?> _containerItemTask;
|
||||
|
||||
public interface PaperdollListener
|
||||
{
|
||||
void notifyEquiped(int slot, Item inst, Inventory inventory);
|
||||
@ -2008,10 +2012,12 @@ public abstract class Inventory extends ItemContainer
|
||||
else if (slot == ItemTemplate.SLOT_L_BRACELET)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_LBRACELET;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_R_BRACELET)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_RBRACELET;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_DECO)
|
||||
{
|
||||
@ -2024,6 +2030,7 @@ public abstract class Inventory extends ItemContainer
|
||||
else if (slot == ItemTemplate.SLOT_BROOCH)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_BROOCH;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_BROOCH_JEWEL)
|
||||
{
|
||||
@ -2036,6 +2043,7 @@ public abstract class Inventory extends ItemContainer
|
||||
else if (slot == ItemTemplate.SLOT_ARTIFACT_BOOK)
|
||||
{
|
||||
pdollSlot = PAPERDOLL_ARTIFACT_BOOK;
|
||||
containerItemCheck();
|
||||
}
|
||||
else if (slot == ItemTemplate.SLOT_ARTIFACT)
|
||||
{
|
||||
@ -2053,6 +2061,26 @@ public abstract class Inventory extends ItemContainer
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Avoid flood from container items.
|
||||
*/
|
||||
private void containerItemCheck()
|
||||
{
|
||||
final Creature owner = getOwner();
|
||||
if ((owner != null) && owner.isPlayer() && (_containerItemTask == null))
|
||||
{
|
||||
owner.getActingPlayer().setUsingContainerItem(true);
|
||||
_containerItemTask = ThreadPool.schedule(() ->
|
||||
{
|
||||
owner.getActingPlayer().setUsingContainerItem(false);
|
||||
owner.getStat().recalculateStats(true);
|
||||
owner.updateAbnormalVisualEffects();
|
||||
owner.getActingPlayer().sendSkillList();
|
||||
_containerItemTask = null;
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Equips item and returns list of alterations<br>
|
||||
* <b>If you don't need return value use {@link Inventory#equipItem(Item)} instead</b>
|
||||
|
@ -229,8 +229,8 @@ public class GameClient extends ChannelInboundHandler<GameClient>
|
||||
|
||||
if (_player != null)
|
||||
{
|
||||
// Avoid flood from class change.
|
||||
if (_player.isChangingClass() && ((packet instanceof SkillList) || (packet instanceof AcquireSkillList) || (packet instanceof ExUserInfoAbnormalVisualEffect) || (packet instanceof AbnormalStatusUpdate) || (packet instanceof ExAbnormalStatusUpdateFromTarget)))
|
||||
// Avoid flood from class change or container items.
|
||||
if ((_player.isChangingClass() || _player.isUsingContainerItem()) && ((packet instanceof SkillList) || (packet instanceof AcquireSkillList) || (packet instanceof ExUserInfoAbnormalVisualEffect) || (packet instanceof AbnormalStatusUpdate) || (packet instanceof ExAbnormalStatusUpdateFromTarget)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user