Посмотрите видео ниже, чтобы узнать, как установить наш сайт в виде веб-приложения на главном экране.
Примечание: Эта функция может быть недоступна в некоторых браузерах.
а в каком файле подскажите.....Double меняем на Integer .
@Override
protected void writeImpl()
{
writeId(ServerPackets.EX_GET_CRYSTALIZING_ESTIMATION);
writeD(_items.size());
for (CrystallizeData item : _items)
{
writeD(item.getId());
writeQ(item.getCount());
writeF(item.getChance());
}
}
ну паке отсылающий инфу вот этот вот
если у тебя структура та же, то возможно в более новых хрониках поменяли отправку шанса с отправки double на int, с предварительным умножением шанса чтобы привести его к целому.Java:@Override protected void writeImpl() { writeId(ServerPackets.EX_GET_CRYSTALIZING_ESTIMATION); writeD(_items.size()); for (CrystallizeData item : _items) { writeD(item.getId()); writeQ(item.getCount()); writeF(item.getChance()); } }
package org.l2jmobius.gameserver.network.clientpackets.crystalization;
import java.util.List;
import org.l2jmobius.Config;
import org.l2jmobius.gameserver.data.xml.ItemCrystallizationData;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.ItemChanceHolder;
import org.l2jmobius.gameserver.model.item.instance.Item;
import org.l2jmobius.gameserver.model.item.type.CrystalType;
import org.l2jmobius.gameserver.model.skill.CommonSkill;
import org.l2jmobius.gameserver.network.PacketLogger;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.clientpackets.ClientPacket;
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
import org.l2jmobius.gameserver.network.serverpackets.crystalization.ExGetCrystalizingEstimation;
import org.l2jmobius.gameserver.util.Util;
public class RequestCrystallizeEstimate extends ClientPacket
{
private int _objectId;
private long _count;
@Override
protected void readImpl()
{
_objectId = readInt();
_count = readLong();
}
@Override
protected void runImpl()
{
final Player player = getPlayer();
if ((player == null) || player.isInCrystallize())
{
return;
}
// if (!client.getFloodProtectors().canPerformTransaction())
// {
// player.sendMessage("You are crystallizing too fast.");
// return;
// }
if (_count < 1)
{
Util.handleIllegalPlayerAction(player, "[RequestCrystallizeItem] count <= 0! ban! oid: " + _objectId + " owner: " + player.getName(), Config.DEFAULT_PUNISH);
return;
}
if (player.isInStoreMode() || player.isInCrystallize())
{
player.sendPacket(SystemMessageId.WHILE_OPERATING_A_PRIVATE_STORE_OR_WORKSHOP_YOU_CANNOT_DISCARD_DESTROY_OR_TRADE_AN_ITEM);
return;
}
final int skillLevel = player.getSkillLevel(CommonSkill.CRYSTALLIZE.getId());
if (skillLevel <= 0)
{
player.sendPacket(SystemMessageId.YOU_MAY_NOT_CRYSTALLIZE_THIS_ITEM_YOUR_CRYSTALLIZATION_SKILL_LEVEL_IS_TOO_LOW);
player.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
final Item item = player.getInventory().getItemByObjectId(_objectId);
if ((item == null) || item.isShadowItem() || item.isTimeLimitedItem() || item.isHeroItem() || (!Config.ALT_ALLOW_AUGMENT_DESTROY && item.isAugmented()))
{
player.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
if (!item.getTemplate().isCrystallizable() || (item.getTemplate().getCrystalCount() <= 0) || (item.getTemplate().getCrystalType() == CrystalType.NONE))
{
player.sendPacket(ActionFailed.STATIC_PACKET);
PacketLogger.warning(player + ": tried to crystallize " + item.getTemplate());
return;
}
if (_count > item.getCount())
{
_count = player.getInventory().getItemByObjectId(_objectId).getCount();
}
if (!player.getInventory().canManipulateWithItemId(item.getId()))
{
player.sendMessage("You cannot use this item.");
return;
}
// Check if the char can crystallize items and return if false;
boolean canCrystallize = true;
switch (item.getTemplate().getCrystalTypePlus())
{
case D:
{
if (skillLevel < 1)
{
canCrystallize = false;
}
break;
}
case C:
{
if (skillLevel < 2)
{
canCrystallize = false;
}
break;
}
case B:
{
if (skillLevel < 3)
{
canCrystallize = false;
}
break;
}
case A:
{
if (skillLevel < 4)
{
canCrystallize = false;
}
break;
}
case S:
{
if (skillLevel < 5)
{
canCrystallize = false;
}
break;
}
case R:
{
if (skillLevel < 6)
{
canCrystallize = false;
}
break;
}
case L:
{
if (skillLevel < 7)
{
canCrystallize = false;
}
break;
}
}
if (!canCrystallize)
{
player.sendPacket(SystemMessageId.YOU_MAY_NOT_CRYSTALLIZE_THIS_ITEM_YOUR_CRYSTALLIZATION_SKILL_LEVEL_IS_TOO_LOW);
player.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
// Show crystallization rewards window.
final List<ItemChanceHolder> crystallizationRewards = ItemCrystallizationData.getInstance().getCrystallizationRewards(item);
if ((crystallizationRewards != null) && !crystallizationRewards.isEmpty())
{
player.setInCrystallize(true);
player.sendPacket(new ExGetCrystalizingEstimation(crystallizationRewards));
}
else
{
player.sendMessage("Crystallization cannot be proceeded because there are no items registered.");
// CRYSTALLIZATION_CANNOT_BE_PROCEEDED_BECAUSE_THERE_ARE_NO_ITEMS_REGISTERED changed to ANGEL_NEVIT_S_DESCENT_BONUS_TIME_S1
// player.sendPacket(SystemMessageId.CRYSTALLIZATION_CANNOT_BE_PROCEEDED_BECAUSE_THERE_ARE_NO_ITEMS_REGISTERED);
}
}
}
package org.l2jmobius.gameserver.network.clientpackets.crystalization;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.network.clientpackets.ClientPacket;
public class RequestCrystallizeItemCancel extends ClientPacket
{
@Override
protected void readImpl()
{
}
@Override
protected void runImpl()
{
final Player player = getPlayer();
if (player == null)
{
return;
}
// if (!client.getFloodProtectors().canPerformTransaction())
// {
// player.sendMessage("You are crystallizing too fast.");
// return;
// }
if (player.isInCrystallize())
{
player.setInCrystallize(false);
}
}
}
package org.l2jmobius.gameserver.network.serverpackets.crystalization;
import java.util.List;
import org.l2jmobius.commons.network.WritableBuffer;
import org.l2jmobius.gameserver.model.holders.ItemChanceHolder;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.ServerPackets;
import org.l2jmobius.gameserver.network.serverpackets.ServerPacket;
public class ExGetCrystalizingEstimation extends ServerPacket
{
private final List<ItemChanceHolder> _items;
public ExGetCrystalizingEstimation(List<ItemChanceHolder> items)
{
_items = items;
}
@Override
public void writeImpl(GameClient client, WritableBuffer buffer)
{
ServerPackets.EX_GET_CRYSTALIZING_ESTIMATION.writeId(this, buffer);
buffer.writeInt(_items.size());
for (ItemChanceHolder holder : _items)
{
buffer.writeInt(holder.getId());
buffer.writeLong(holder.getCount());
buffer.writeDouble(holder.getChance());
}
}
}
неужели когда ты заменил writeDouble на writeInteger тебе не подсветило ошибку в Idea?
buffer.writeInt((int) Math.floor(holder.getChance() * 100d));
получилось спасибо!buffer.writeInt((int) Math.floor(holder.getChance() * 100d));