Follow along with the video below to see how to install our site as a web app on your home screen.
Примечание: This feature may not be available in some browsers.
Проблема всё ещё актуальна, подскажите кто...
Проблема уже решилась, за что спасибо JunkyFunkyСмешение пакетного ур
1 причина клиент system заменить
2 правка уротправки пакета структуру и также проверить содержимое на нач значение
package l2p.gameserver.serverpackets;
import l2p.commons.net.nio.impl.SendablePacket;
import l2p.gameserver.GameServer;
import l2p.gameserver.data.xml.holder.ItemHolder;
import l2p.gameserver.model.Player;
import l2p.gameserver.model.base.Element;
import l2p.gameserver.model.base.MultiSellIngredient;
import l2p.gameserver.model.items.ItemInfo;
import l2p.gameserver.model.items.ItemInstance;
import l2p.gameserver.network.GameClient;
import l2p.gameserver.serverpackets.components.IStaticPacket;
import l2p.gameserver.templates.item.ItemTemplate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Set;
public abstract class L2GameServerPacket extends SendablePacket<GameClient> implements IStaticPacket {
private static final Logger _log = LoggerFactory.getLogger(L2GameServerPacket.class);
@Override
public final boolean write() {
try {
writeImpl();
return true;
} catch (final Exception e) {
_log.error("Client: " + getClient() + " - Failed writing: " + getType() + " - Server Version: " + GameServer.getInstance().getVersion().getRevisionNumber(), e);
}
return false;
}
protected abstract void writeImpl();
protected void writeEx(final int value) {
writeC(0xFE);
writeH(value);
}
protected void writeD(final boolean b) {
writeD(b ? 1 : 0);
}
/**
* Отсылает число позиций + массив
*/
protected void writeDD(final int[] values, final boolean sendCount) {
if (sendCount) {
getByteBuffer().putInt(values.length);
}
for (final int value : values) {
getByteBuffer().putInt(value);
}
}
protected void writeDD(final Set<Integer> values, final boolean sendCount) {
if (sendCount) {
getByteBuffer().putInt(values.size());
}
for (final int value : values) {
getByteBuffer().putInt(value);
}
}
protected void writeDD(final int[] values) {
writeDD(values, false);
}
protected void writeItemElements(ItemInfo item) {
writeH(item.getAttackElement());
writeH(item.getAttackElementValue());
writeH(item.getDefenceFire());
writeH(item.getDefenceWater());
writeH(item.getDefenceWind());
writeH(item.getDefenceEarth());
writeH(item.getDefenceHoly());
writeH(item.getDefenceUnholy());
}
protected void writeItemElements(ItemInstance item) {
writeH(item.getAttackElement().getId());
writeH(item.getAttackElementValue());
writeH(item.getDefenceFire());
writeH(item.getDefenceWater());
writeH(item.getDefenceWind());
writeH(item.getDefenceEarth());
writeH(item.getDefenceHoly());
writeH(item.getDefenceUnholy());
}
protected void writeItemElements(MultiSellIngredient item) {
if(item.getItemId() <= 0) {
writeItemElements();
return;
}
ItemTemplate i = ItemHolder.getInstance().getTemplate(item.getItemId());
if(item.getItemAttributes().getValue() > 0) {
if(i.isWeapon()) {
Element e = item.getItemAttributes().getElement();
writeH(e.getId()); // attack element (-1 - none)
writeH(item.getItemAttributes().getValue(e) + i.getBaseAttributeValue(e)); // attack element value
writeH(0); // водная стихия (fire pdef)
writeH(0); // огненная стихия (water pdef)
writeH(0); // земляная стихия (wind pdef)
writeH(0); // воздушная стихия (earth pdef)
writeH(0); // темная стихия (holy pdef)
writeH(0); // светлая стихия (dark pdef)
} else if(i.isArmor()) {
writeH(-1); // attack element (-1 - none)
writeH(0); // attack element value
for(Element e : Element.VALUES)
writeH(item.getItemAttributes().getValue(e) + i.getBaseAttributeValue(e));
} else {
writeItemElements();
}
} else {
writeItemElements();
}
}
protected void writeItemElements() {
writeH(-1); // attack element (-1 - none)
writeH(0x00); // attack element value
writeH(0x00); // водная стихия (fire pdef)
writeH(0x00); // огненная стихия (water pdef)
writeH(0x00); // земляная стихия (wind pdef)
writeH(0x00); // воздушная стихия (earth pdef)
writeH(0x00); // темная стихия (holy pdef)
writeH(0x00); // светлая стихия (dark pdef)
}
protected void writeItemEnchantOptions(final ItemInfo item) {
writeH(item.getEnchantOptions()[0]); // может они тут не нужны и нужно просто слать пустышку?
writeH(item.getEnchantOptions()[1]);
writeH(item.getEnchantOptions()[2]);
}
protected void writeItemEnchantOptions(final ItemInstance item) {
writeH(item.getEnchantOptions()[0]); // может они тут не нужны и нужно просто слать пустышку?
writeH(item.getEnchantOptions()[1]);
writeH(item.getEnchantOptions()[2]);
}
protected void writeItemInfo152(final ItemInstance item) {
writeItemInfo152(item, item.getCount());
}
protected void writeItemInfo152(final ItemInstance item, final long count) {
writeH(item.getTemplate().getType1());
writeD(item.getObjectId());
writeD(item.getItemId());
writeQ(item.getCount());
writeH(item.getTemplate().getType2ForPackets());
writeH(item.getCustomType1());
writeD(item.getBodyPart());
writeH(item.getEnchantLevel());
writeH(item.getCustomType2());
writeH(0); // ?
writeD(item.getObjectId()); // return value for define item (object_id)
writeD(item.getAugmentations()[0]);
writeD(item.getAugmentations()[1]);
writeItemElements(item);
writeD(item.getTemporalLifeTime());
writeD(item.isTemporalItem() ? item.getTemporalLifeTime() : 0x00); // limited time item life remaining
}
protected void writeItemInfo152(final ItemInfo item) {
writeItemInfo152(item, item.getCount());
}
protected void writeItemInfo152(final ItemInfo item, final long count) {
writeH(item.getType1());
writeD(item.getObjectId());
writeD(item.getItemId());
writeQ(item.getCount());
writeH(item.getItem().getType2ForPackets());
writeH(item.getCustomType1());
writeD(item.getBodyPart());
writeH(item.getEnchantLevel());
writeH(item.getCustomType2());
writeH(0); // ?
writeD(item.getObjectId()); // return value for define item (object_id)
writeD(item.getAugmentations()[0]);
writeD(item.getAugmentations()[1]);
writeItemElements(item);
writeD(item.getTemporalLifeTime());
writeD(item.getItem().isTemporal() ? item.getTemporalLifeTime() : 0x00); // limited time item life remaining
}
protected void writeItemInfo(final ItemInstance item) {
writeItemInfo(item, item.getCount());
}
protected void writeItemInfo(final ItemInstance item, final long count) {
writeH(item.getTemplate().getType1()); // item type1
writeD(item.getObjectId());
writeD(item.getItemId());
writeD(item.getEquipSlot()); // order
writeQ(count);
writeH(item.getTemplate().getType2ForPackets()); // item type2
writeH(item.getCustomType1()); // item type3
writeH(item.isEquipped() ? 1 : 0);
writeD(item.getBodyPart()); // rev 415 slot 0006-lr.ear 0008-neck 0030-lr.finger 0040-head 0080-?? 0100-l.hand 0200-gloves 0400-chest 0800-pants 1000-feet 2000-?? 4000-r.hand 8000-r.hand
writeH(item.getEnchantLevel()); // enchant level
writeH(item.getCustomType2()); // item type3
writeH(item.getAugmentations()[0]);
writeH(item.getAugmentations()[1]);
writeD(item.isShadowItem() ? item.getShadowLifeTime() : -1);
writeItemElements(item);
writeD(item.isTemporalItem() ? item.getTemporalLifeTime() : 0x00); // limited time item life remaining
writeItemEnchantOptions(item);
}
protected void writeItemInfo(final ItemInfo item) {
writeItemInfo(item, item.getCount());
}
protected void writeItemInfo(final ItemInfo item, final long count) {
writeH(item.getType1()); // item type1
writeD(item.getObjectId());
writeD(item.getItemId());
writeD(item.getEquipSlot()); // order
writeQ(count);
writeH(item.getItem().getType2ForPackets()); // item type2
writeH(item.getCustomType1()); // item type3
writeH(item.isEquipped() ? 1 : 0);
writeD(item.getBodyPart()); // rev 415 slot 0006-lr.ear 0008-neck 0030-lr.finger 0040-head 0080-?? 0100-l.hand 0200-gloves 0400-chest 0800-pants 1000-feet 2000-?? 4000-r.hand 8000-r.hand
writeH(item.getEnchantLevel()); // enchant level
writeH(item.getCustomType2()); // item type3
writeH(item.getAugmentations()[0]);
writeH(item.getAugmentations()[1]);
writeD(item.getItem().isShadowItem() ? item.getShadowLifeTime() : -1);
writeItemElements(item);
writeD(item.getItem().isTemporal() ? item.getTemporalLifeTime() : 0x00); // limited time item life remaining
writeItemEnchantOptions(item);
}
public String getType() {
return "[S] " + getClass().getSimpleName();
}
@Override
public L2GameServerPacket packet(final Player player) {
return this;
}
}
package l2p.gameserver.serverpackets;
import l2p.commons.lang.ArrayUtils;
import l2p.gameserver.model.Player;
import l2p.gameserver.model.items.ItemInfo;
import l2p.gameserver.model.items.ItemInstance;
import l2p.gameserver.model.items.Warehouse.ItemClassComparator;
import l2p.gameserver.model.items.Warehouse.WarehouseType;
import java.util.ArrayList;
import java.util.List;
public class WareHouseDepositList extends L2GameServerPacket {
private final int _whtype;
private final long _adena;
private final List<ItemInfo> _itemList;
public WareHouseDepositList(final Player cha, final WarehouseType whtype) {
_whtype = whtype.ordinal();
_adena = cha.getAdena();
final ItemInstance[] items = cha.getInventory().getItems();
ArrayUtils.eqSort(items, ItemClassComparator.getInstance());
_itemList = new ArrayList<>(items.length);
for (final ItemInstance item : items) {
if (item.canBeStored(cha, _whtype == 1)) {
_itemList.add(new ItemInfo(item));
}
}
}
@Override
protected final void writeImpl() {
writeC(0x41);
writeH(_whtype);
writeQ(_adena);
writeH(_itemList.size());
for (final ItemInfo item : _itemList) {
writeItemInfo152(item);
writeItemEnchantOptions(item);
}
}
}
package l2p.gameserver.serverpackets;
import l2p.commons.lang.ArrayUtils;
import l2p.gameserver.model.Player;
import l2p.gameserver.model.items.ItemInfo;
import l2p.gameserver.model.items.ItemInstance;
import l2p.gameserver.model.items.Warehouse.ItemClassComparator;
import l2p.gameserver.model.items.Warehouse.WarehouseType;
import l2p.gameserver.templates.item.ItemTemplate.ItemClass;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class WareHouseWithdrawList extends L2GameServerPacket {
private final long _adena;
private List<ItemInfo> _itemList = new ArrayList<>();
private final int _type;
public WareHouseWithdrawList(final Player player, final WarehouseType type, final ItemClass clss) {
_adena = player.getAdena();
_type = type.ordinal();
ItemInstance[] items;
switch (type) {
case PRIVATE:
items = player.getWarehouse().getItems(clss);
break;
case FREIGHT:
items = player.getFreight().getItems(clss);
break;
case CLAN:
case CASTLE:
items = player.getClan().getWarehouse().getItems(clss);
break;
default:
_itemList = Collections.emptyList();
return;
}
_itemList = new ArrayList<>(items.length);
ArrayUtils.eqSort(items, ItemClassComparator.getInstance());
for(ItemInstance item : items) {
_itemList.add(new ItemInfo(item));
}
}
@Override
protected final void writeImpl() {
writeC(0x42);
writeH(_type);
writeQ(_adena);
writeH(_itemList.size());
for(ItemInfo item : _itemList){
writeItemInfo152(item);
writeItemEnchantOptions(item);
}
}
}