Adapted auto peel to main version.

Contributed by Index.
This commit is contained in:
MobiusDevelopment
2022-10-25 22:15:05 +00:00
parent 04e8766198
commit 28a2bb8758
15 changed files with 527 additions and 24 deletions

View File

@@ -18,6 +18,7 @@ package handlers.itemhandlers;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
@@ -30,11 +31,15 @@ import org.l2jmobius.gameserver.instancemanager.DailyTaskManager;
import org.l2jmobius.gameserver.model.ExtractableProduct; import org.l2jmobius.gameserver.model.ExtractableProduct;
import org.l2jmobius.gameserver.model.actor.Playable; import org.l2jmobius.gameserver.model.actor.Playable;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.actor.request.AutoPeelRequest;
import org.l2jmobius.gameserver.model.holders.ItemHolder;
import org.l2jmobius.gameserver.model.item.EtcItem; import org.l2jmobius.gameserver.model.item.EtcItem;
import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.instance.Item;
import org.l2jmobius.gameserver.network.SystemMessageId; import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.InventoryUpdate; import org.l2jmobius.gameserver.network.serverpackets.InventoryUpdate;
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
import org.l2jmobius.gameserver.network.serverpackets.autopeel.ExResultItemAutoPeel;
import org.l2jmobius.gameserver.network.serverpackets.autopeel.ExStopItemAutoPeel;
/** /**
* Extractable Items handler. * Extractable Items handler.
@@ -218,7 +223,26 @@ public class ExtractableItems implements IItemHandler
for (Entry<Item, Long> entry : extractedItems.entrySet()) for (Entry<Item, Long> entry : extractedItems.entrySet())
{ {
sendMessage(player, entry.getKey(), entry.getValue().longValue()); sendMessage(player, entry.getKey(), entry.getValue());
}
final AutoPeelRequest request = player.getRequest(AutoPeelRequest.class);
if (request != null)
{
if (request.isProcessing())
{
request.setProcessing(false);
final List<ItemHolder> rewards = new LinkedList<>();
for (Entry<Item, Long> entry : extractedItems.entrySet())
{
rewards.add(new ItemHolder(entry.getKey().getId(), entry.getValue()));
}
player.sendPacket(new ExResultItemAutoPeel(true, request.getTotalPeelCount(), request.getRemainingPeelCount() - 1, rewards));
}
else
{
player.sendPacket(new ExStopItemAutoPeel(false));
}
} }
return true; return true;

View File

@@ -172,6 +172,7 @@ import org.l2jmobius.gameserver.model.actor.instance.Shuttle;
import org.l2jmobius.gameserver.model.actor.instance.TamedBeast; import org.l2jmobius.gameserver.model.actor.instance.TamedBeast;
import org.l2jmobius.gameserver.model.actor.instance.Trap; import org.l2jmobius.gameserver.model.actor.instance.Trap;
import org.l2jmobius.gameserver.model.actor.request.AbstractRequest; import org.l2jmobius.gameserver.model.actor.request.AbstractRequest;
import org.l2jmobius.gameserver.model.actor.request.AutoPeelRequest;
import org.l2jmobius.gameserver.model.actor.request.SayuneRequest; import org.l2jmobius.gameserver.model.actor.request.SayuneRequest;
import org.l2jmobius.gameserver.model.actor.stat.PlayerStat; import org.l2jmobius.gameserver.model.actor.stat.PlayerStat;
import org.l2jmobius.gameserver.model.actor.status.PlayerStatus; import org.l2jmobius.gameserver.model.actor.status.PlayerStatus;
@@ -362,6 +363,8 @@ import org.l2jmobius.gameserver.network.serverpackets.TradeOtherDone;
import org.l2jmobius.gameserver.network.serverpackets.TradeStart; import org.l2jmobius.gameserver.network.serverpackets.TradeStart;
import org.l2jmobius.gameserver.network.serverpackets.UserInfo; import org.l2jmobius.gameserver.network.serverpackets.UserInfo;
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation; import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
import org.l2jmobius.gameserver.network.serverpackets.autopeel.ExReadyItemAutoPeel;
import org.l2jmobius.gameserver.network.serverpackets.autopeel.ExStopItemAutoPeel;
import org.l2jmobius.gameserver.network.serverpackets.autoplay.ExActivateAutoShortcut; import org.l2jmobius.gameserver.network.serverpackets.autoplay.ExActivateAutoShortcut;
import org.l2jmobius.gameserver.network.serverpackets.autoplay.ExAutoPlaySettingSend; import org.l2jmobius.gameserver.network.serverpackets.autoplay.ExAutoPlaySettingSend;
import org.l2jmobius.gameserver.network.serverpackets.commission.ExResponseCommissionInfo; import org.l2jmobius.gameserver.network.serverpackets.commission.ExResponseCommissionInfo;
@@ -4916,6 +4919,14 @@ public class Player extends Playable
@Override @Override
public boolean doDie(Creature killer) public boolean doDie(Creature killer)
{ {
// Stop auto peel.
if (hasRequest(AutoPeelRequest.class))
{
sendPacket(new ExStopItemAutoPeel(true));
sendPacket(new ExReadyItemAutoPeel(false, 0));
removeRequest(AutoPeelRequest.class);
}
// Add Tranquil Soul effect. // Add Tranquil Soul effect.
SkillCaster.triggerCast(this, this, CommonSkill.TRANQUIL_SOUL.getSkill()); SkillCaster.triggerCast(this, this, CommonSkill.TRANQUIL_SOUL.getSkill());
@@ -10789,6 +10800,14 @@ public class Player extends Playable
@Override @Override
public void onTeleported() public void onTeleported()
{ {
// Stop auto peel.
if (hasRequest(AutoPeelRequest.class))
{
sendPacket(new ExStopItemAutoPeel(true));
sendPacket(new ExReadyItemAutoPeel(false, 0));
removeRequest(AutoPeelRequest.class);
}
super.onTeleported(); super.onTeleported();
if (isInAirShip()) if (isInAirShip())

View File

@@ -0,0 +1,79 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.actor.request;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.item.instance.Item;
/**
* @author Mobius
*/
public class AutoPeelRequest extends AbstractRequest
{
private final Item _item;
private long _totalPeelCount;
private long _remainingPeelCount;
public AutoPeelRequest(Player player, Item item)
{
super(player);
_item = item;
}
public Item getItem()
{
return _item;
}
public long getTotalPeelCount()
{
return _totalPeelCount;
}
public void setTotalPeelCount(long count)
{
_totalPeelCount = count;
}
public long getRemainingPeelCount()
{
return _remainingPeelCount;
}
public void setRemainingPeelCount(long count)
{
_remainingPeelCount = count;
}
@Override
public boolean isItemRequest()
{
return true;
}
@Override
public boolean canWorkWith(AbstractRequest request)
{
return !request.isItemRequest();
}
@Override
public boolean isUsing(int objectId)
{
return _item.getObjectId() == objectId;
}
}

View File

@@ -61,6 +61,7 @@ import org.l2jmobius.gameserver.model.WorldRegion;
import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.actor.Summon; import org.l2jmobius.gameserver.model.actor.Summon;
import org.l2jmobius.gameserver.model.actor.request.AutoPeelRequest;
import org.l2jmobius.gameserver.model.conditions.Condition; import org.l2jmobius.gameserver.model.conditions.Condition;
import org.l2jmobius.gameserver.model.ensoul.EnsoulOption; import org.l2jmobius.gameserver.model.ensoul.EnsoulOption;
import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.events.EventDispatcher;
@@ -1853,8 +1854,8 @@ public class Item extends WorldObject
return true; return true;
} }
final Creature owner = getActingPlayer(); final Player player = getActingPlayer();
if (owner != null) if (player != null)
{ {
for (Condition condition : _itemTemplate.getConditions()) for (Condition condition : _itemTemplate.getConditions())
{ {
@@ -1863,7 +1864,16 @@ public class Item extends WorldObject
continue; continue;
} }
if (!condition.testImpl(owner, owner, null, _itemTemplate)) if (!condition.testImpl(player, player, null, _itemTemplate))
{
return false;
}
}
if (player.hasRequest(AutoPeelRequest.class))
{
final EtcItem etcItem = getEtcItem();
if ((etcItem != null) && (etcItem.getExtractableItems() != null))
{ {
return false; return false;
} }

View File

@@ -46,6 +46,9 @@ import org.l2jmobius.gameserver.network.clientpackets.attendance.RequestVipAtten
import org.l2jmobius.gameserver.network.clientpackets.attributechange.RequestChangeAttributeCancel; import org.l2jmobius.gameserver.network.clientpackets.attributechange.RequestChangeAttributeCancel;
import org.l2jmobius.gameserver.network.clientpackets.attributechange.RequestChangeAttributeItem; import org.l2jmobius.gameserver.network.clientpackets.attributechange.RequestChangeAttributeItem;
import org.l2jmobius.gameserver.network.clientpackets.attributechange.SendChangeAttributeTargetItem; import org.l2jmobius.gameserver.network.clientpackets.attributechange.SendChangeAttributeTargetItem;
import org.l2jmobius.gameserver.network.clientpackets.autopeel.ExRequestItemAutoPeel;
import org.l2jmobius.gameserver.network.clientpackets.autopeel.ExRequestReadyItemAutoPeel;
import org.l2jmobius.gameserver.network.clientpackets.autopeel.ExRequestStopItemAutoPeel;
import org.l2jmobius.gameserver.network.clientpackets.autoplay.ExAutoPlaySetting; import org.l2jmobius.gameserver.network.clientpackets.autoplay.ExAutoPlaySetting;
import org.l2jmobius.gameserver.network.clientpackets.autoplay.ExRequestActivateAutoShortcut; import org.l2jmobius.gameserver.network.clientpackets.autoplay.ExRequestActivateAutoShortcut;
import org.l2jmobius.gameserver.network.clientpackets.awakening.RequestCallToChangeClass; import org.l2jmobius.gameserver.network.clientpackets.awakening.RequestCallToChangeClass;
@@ -771,9 +774,9 @@ public enum ExIncomingPackets implements IIncomingPackets<GameClient>
EX_WORLD_EXCHANGE_BUY_ITEM(0x240, null, ConnectionState.IN_GAME), EX_WORLD_EXCHANGE_BUY_ITEM(0x240, null, ConnectionState.IN_GAME),
EX_WORLD_EXCHANGE_SETTLE_LIST(0x241, null, ConnectionState.IN_GAME), EX_WORLD_EXCHANGE_SETTLE_LIST(0x241, null, ConnectionState.IN_GAME),
EX_WORLD_EXCHANGE_SETTLE_RECV_RESULT(0x242, null, ConnectionState.IN_GAME), EX_WORLD_EXCHANGE_SETTLE_RECV_RESULT(0x242, null, ConnectionState.IN_GAME),
EX_READY_ITEM_AUTO_PEEL(0x243, null, ConnectionState.IN_GAME), EX_READY_ITEM_AUTO_PEEL(0x243, ExRequestReadyItemAutoPeel::new, ConnectionState.IN_GAME),
EX_REQUEST_ITEM_AUTO_PEEL(0x244, null, ConnectionState.IN_GAME), EX_REQUEST_ITEM_AUTO_PEEL(0x244, ExRequestItemAutoPeel::new, ConnectionState.IN_GAME),
EX_STOP_ITEM_AUTO_PEEL(0x245, null, ConnectionState.IN_GAME), EX_STOP_ITEM_AUTO_PEEL(0x245, ExRequestStopItemAutoPeel::new, ConnectionState.IN_GAME),
EX_VARIATION_OPEN_UI(0x246, ExVariationOpenUi::new, ConnectionState.IN_GAME), EX_VARIATION_OPEN_UI(0x246, ExVariationOpenUi::new, ConnectionState.IN_GAME),
EX_VARIATION_CLOSE_UI(0x247, ExVariationCloseUi::new, ConnectionState.IN_GAME), EX_VARIATION_CLOSE_UI(0x247, ExVariationCloseUi::new, ConnectionState.IN_GAME),
EX_APPLY_VARIATION_OPTION(0x248, ExApplyVariationOption::new, ConnectionState.IN_GAME), EX_APPLY_VARIATION_OPTION(0x248, ExApplyVariationOption::new, ConnectionState.IN_GAME),

View File

@@ -34,6 +34,7 @@ import org.l2jmobius.gameserver.instancemanager.FortSiegeManager;
import org.l2jmobius.gameserver.model.World; import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.actor.request.AutoPeelRequest;
import org.l2jmobius.gameserver.model.effects.EffectType; import org.l2jmobius.gameserver.model.effects.EffectType;
import org.l2jmobius.gameserver.model.events.EventDispatcher; import org.l2jmobius.gameserver.model.events.EventDispatcher;
import org.l2jmobius.gameserver.model.events.EventType; import org.l2jmobius.gameserver.model.events.EventType;
@@ -284,6 +285,11 @@ public class UseItem implements IClientIncomingPacket
else else
{ {
final EtcItem etcItem = item.getEtcItem(); final EtcItem etcItem = item.getEtcItem();
if ((etcItem != null) && (etcItem.getExtractableItems() != null) && (player.hasRequest(AutoPeelRequest.class)))
{
return;
}
final IItemHandler handler = ItemHandler.getInstance().getHandler(etcItem); final IItemHandler handler = ItemHandler.getInstance().getHandler(etcItem);
if (handler == null) if (handler == null)
{ {

View File

@@ -0,0 +1,97 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.network.clientpackets.autopeel;
import java.util.Collections;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.handler.IItemHandler;
import org.l2jmobius.gameserver.handler.ItemHandler;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.actor.request.AutoPeelRequest;
import org.l2jmobius.gameserver.model.item.EtcItem;
import org.l2jmobius.gameserver.model.item.instance.Item;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.autopeel.ExResultItemAutoPeel;
/**
* @author Mobius
*/
public class ExRequestItemAutoPeel implements IClientIncomingPacket
{
private int _itemObjectId;
private long _totalPeelCount;
private long _remainingPeelCount;
@Override
public boolean read(GameClient client, PacketReader packet)
{
_itemObjectId = packet.readD();
_totalPeelCount = packet.readQ();
_remainingPeelCount = packet.readQ();
return true;
}
@Override
public void run(GameClient client)
{
final Player player = client.getPlayer();
if (player == null)
{
return;
}
AutoPeelRequest request = player.getRequest(AutoPeelRequest.class);
if (request == null)
{
final Item item = player.getInventory().getItemByObjectId(_itemObjectId);
if ((item == null) || !item.isEtcItem() || (item.getEtcItem().getExtractableItems() == null) || item.getEtcItem().getExtractableItems().isEmpty())
{
return;
}
request = new AutoPeelRequest(player, item);
player.addRequest(request);
}
else if (request.isProcessing())
{
return;
}
request.setProcessing(true);
final Item item = request.getItem();
if ((item.getObjectId() != _itemObjectId) || (item.getOwnerId() != player.getObjectId()))
{
player.removeRequest(request.getClass());
return;
}
request.setTotalPeelCount(_totalPeelCount);
request.setRemainingPeelCount(_remainingPeelCount);
final EtcItem etcItem = (EtcItem) item.getTemplate();
if ((etcItem.getExtractableItems() != null) && !etcItem.getExtractableItems().isEmpty())
{
final IItemHandler handler = ItemHandler.getInstance().getHandler(item.getEtcItem());
if ((handler != null) && !handler.useItem(player, item, false))
{
request.setProcessing(false);
player.sendPacket(new ExResultItemAutoPeel(false, _totalPeelCount, _remainingPeelCount, Collections.emptyList()));
}
}
}
}

View File

@@ -0,0 +1,60 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.network.clientpackets.autopeel;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.actor.request.AutoPeelRequest;
import org.l2jmobius.gameserver.model.item.instance.Item;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.autopeel.ExReadyItemAutoPeel;
/**
* @author Mobius
*/
public class ExRequestReadyItemAutoPeel implements IClientIncomingPacket
{
private int _itemObjectId;
@Override
public boolean read(GameClient client, PacketReader packet)
{
_itemObjectId = packet.readD();
return true;
}
@Override
public void run(GameClient client)
{
final Player player = client.getPlayer();
if (player == null)
{
return;
}
final Item item = player.getInventory().getItemByObjectId(_itemObjectId);
if ((item == null) || !item.isEtcItem() || (item.getEtcItem().getExtractableItems() == null) || item.getEtcItem().getExtractableItems().isEmpty())
{
player.sendPacket(new ExReadyItemAutoPeel(false, _itemObjectId));
return;
}
player.addRequest(new AutoPeelRequest(player, item));
player.sendPacket(new ExReadyItemAutoPeel(true, _itemObjectId));
}
}

View File

@@ -0,0 +1,52 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.network.clientpackets.autopeel;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.actor.request.AutoPeelRequest;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.autopeel.ExReadyItemAutoPeel;
import org.l2jmobius.gameserver.network.serverpackets.autopeel.ExStopItemAutoPeel;
/**
* @author Mobius
*/
public class ExRequestStopItemAutoPeel implements IClientIncomingPacket
{
@Override
public boolean read(GameClient client, PacketReader packet)
{
packet.readC();
return true;
}
@Override
public void run(GameClient client)
{
final Player player = client.getPlayer();
if (player == null)
{
return;
}
player.removeRequest(AutoPeelRequest.class);
player.sendPacket(new ExStopItemAutoPeel(true));
player.sendPacket(new ExReadyItemAutoPeel(false, 0));
}
}

View File

@@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.network.clientpackets.collection;
import org.l2jmobius.commons.network.PacketReader; import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.actor.request.AutoPeelRequest;
import org.l2jmobius.gameserver.network.GameClient; import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket; import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.collection.ExCollectionOpenUI; import org.l2jmobius.gameserver.network.serverpackets.collection.ExCollectionOpenUI;
@@ -43,6 +44,11 @@ public class RequestExCollectionOpenUI implements IClientIncomingPacket
return; return;
} }
if (player.hasRequest(AutoPeelRequest.class))
{
return;
}
player.setTarget(null); player.setTarget(null);
player.sendPacket(new ExCollectionOpenUI()); player.sendPacket(new ExCollectionOpenUI());
} }

View File

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

View File

@@ -0,0 +1,60 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.network.serverpackets.autopeel;
import java.util.Collection;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.model.holders.ItemHolder;
import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author Mobius
*/
public class ExResultItemAutoPeel implements IClientOutgoingPacket
{
private final boolean _result;
private final long _totalPeelCount;
private final long _remainingPeelCount;
private final Collection<ItemHolder> _itemList;
public ExResultItemAutoPeel(boolean result, long totalPeelCount, long remainingPeelCount, Collection<ItemHolder> itemList)
{
_result = result;
_totalPeelCount = totalPeelCount;
_remainingPeelCount = remainingPeelCount;
_itemList = itemList;
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_RESULT_ITEM_AUTO_PEEL.writeId(packet);
packet.writeC(_result ? 1 : 0);
packet.writeQ(_totalPeelCount);
packet.writeQ(_remainingPeelCount);
packet.writeD(_itemList.size());
for (ItemHolder holder : _itemList)
{
packet.writeD(holder.getId());
packet.writeQ(holder.getCount());
packet.writeD(0); // TODO: Announce level.
}
return true;
}
}

View File

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

View File

@@ -10888,8 +10888,6 @@ public class Player extends Playable
@Override @Override
public void onTeleported() public void onTeleported()
{ {
super.onTeleported();
// Stop auto peel. // Stop auto peel.
if (hasRequest(AutoPeelRequest.class)) if (hasRequest(AutoPeelRequest.class))
{ {
@@ -10898,6 +10896,8 @@ public class Player extends Playable
removeRequest(AutoPeelRequest.class); removeRequest(AutoPeelRequest.class);
} }
super.onTeleported();
if (isInAirShip()) if (isInAirShip())
{ {
getAirShip().sendInfo(this); getAirShip().sendInfo(this);

View File

@@ -2588,21 +2588,6 @@ public class Item extends WorldObject
} }
} }
/**
* Returns the item in String format
* @return String
*/
@Override
public String toString()
{
final StringBuilder sb = new StringBuilder();
sb.append(_itemTemplate);
sb.append("[");
sb.append(getObjectId());
sb.append("]");
return sb.toString();
}
public void onVisualLifeTimeEnd() public void onVisualLifeTimeEnd()
{ {
onVisualLifeTimeEnd(true); onVisualLifeTimeEnd(true);
@@ -2658,4 +2643,19 @@ public class Item extends WorldObject
} }
vars.storeMe(); vars.storeMe();
} }
/**
* Returns the item in String format
* @return String
*/
@Override
public String toString()
{
final StringBuilder sb = new StringBuilder();
sb.append(_itemTemplate);
sb.append("[");
sb.append(getObjectId());
sb.append("]");
return sb.toString();
}
} }