- Хроники
- Master Class
- Исходники
- Присутствуют
- Сборка
- L2J Mobius Essence 9.2 RoseVain
Посмотрите видео ниже, чтобы узнать, как установить наш сайт в виде веб-приложения на главном экране.
Примечание: Эта функция может быть недоступна в некоторых браузерах.
package l2s.gameserver.network.l2.s2c.limitshop;
import l2s.commons.network.PacketWriter;
import l2s.gameserver.model.Player;
import l2s.gameserver.model.actor.variables.PlayerVariables;
import l2s.gameserver.network.l2.s2c.IClientOutgoingPacket;
import l2s.gameserver.templates.LimitShop.LimitShopProduct;
import java.util.Collection;
import java.util.List;
import l2s.gameserver.network.l2.packethandler.s2c.IServerPacketOpCode;
import l2s.gameserver.network.l2.packethandler.s2c.ExServerPacketsOpCodes;
/**
* @author Index
* @version Project Wolf | p516 | 05/03/2025
* interface definition S_EX_PURCHASE_LIMIT_CRAFT_ITEM_LIST
*/
public class ExPurchaseLimitCraftItemList implements...
package l2s.gameserver.network.l2.s2c.limitshop;
import l2s.commons.network.PacketWriter;
import l2s.gameserver.model.Player;
import l2s.gameserver.model.actor.variables.PlayerVariables;
import l2s.gameserver.network.l2.s2c.IClientOutgoingPacket;
import l2s.gameserver.templates.LimitShop.LimitShopProduct;
import java.util.Collection;
import java.util.List;
import l2s.gameserver.network.l2.packethandler.s2c.IServerPacketOpCode;
import l2s.gameserver.network.l2.packethandler.s2c.ExServerPacketsOpCodes;
/**
* @author Index
* @version Project Wolf | p516 | 05/03/2025
* interface definition S_EX_PURCHASE_LIMIT_CRAFT_ITEM_LIST
*/
public class ExPurchaseLimitCraftItemList implements IClientOutgoingPacket
{
private final Player _player;
private final Collection<LimitShopProduct> _products;
private final int _currentPage;
private final int _maxPage;
public ExPurchaseLimitCraftItemList(Player activeChar, int currentPage, int maxPage, List<LimitShopProduct> subList)
{
_player = activeChar;
_currentPage = currentPage;
_maxPage = maxPage;
_products = subList;
}
// Model: Codex-GPT5.1 | Date: 2025-11-18 04:18:53 | Generated by agent | Task: map packet opcodes
@Override
public IServerPacketOpCode getPacketOpCode()
{
return ExServerPacketsOpCodes.S_EX_PURCHASE_LIMIT_CRAFT_ITEM_LIST;
}
// Model: Codex-GPT5.1 | Date: 2025-11-18 04:18:53 | Generated by agent | Task: map packet opcodes
@Override
public boolean write(PacketWriter packet)
{
packet.writeC(_currentPage);
packet.writeC(_maxPage);
packet.writeD(_products.size());
for (LimitShopProduct shopProduct : _products)
{
writeLimitShopProduct(packet, _player, shopProduct);
}
return true;
}
private static void writeLimitShopProduct(PacketWriter packet, Player player, LimitShopProduct shopProduct)
{
packet.writeD(shopProduct.getId());
packet.writeD(shopProduct.getProductionId());
packet.writeD(getLimitation(player, shopProduct));
packet.writeD(shopProduct.remainTime()); // nRemainSec
packet.writeD(shopProduct.remainServerItemAmount()); // nRemainServerItemAmount
packet.writeD(getChance01(shopProduct));
packet.writeD(getChance02(shopProduct));
packet.writeD(getChance03(shopProduct));
packet.writeD(getChance04(shopProduct));
packet.writeD(getChance05(shopProduct));
}
private static int getLimitation(Player player, LimitShopProduct product)
{ // No account limits.
{
return 1;
}
}
private static int getChance01(LimitShopProduct product)
{
if (product.getProductionId() > 0 && product.getChance() > 0)
{
return getChance(product.getChance());
}
else if (product.getProductionId2() > 0 && product.getChance2() > 0)
{
return getChance(product.getChance2());
}
else if (product.getProductionId3() > 0 && product.getChance3() > 0)
{
return getChance(product.getChance3());
}
else if (product.getProductionId4() > 0 && product.getChance4() > 0)
{
return getChance(product.getChance4());
}
return getLastChance(product);
}
private static int getChance02(LimitShopProduct product)
{
if (product.getProductionId2() > 0 && product.getChance2() > 0)
{
return getChance(product.getChance2());
}
else if (product.getProductionId3() > 0 && product.getChance3() > 0)
{
return getChance(product.getChance3());
}
else if (product.getProductionId4() > 0 && product.getChance4() > 0)
{
return getChance(product.getChance4());
}
return getLastChance(product);
}
private static int getChance03(LimitShopProduct product)
{
if (product.getProductionId3() > 0 && product.getChance3() > 0)
{
return getChance(product.getChance3());
}
else if (product.getProductionId4() > 0 && product.getChance4() > 0)
{
return getChance(product.getChance4());
}
return getLastChance(product);
}
private static int getChance04(LimitShopProduct product)
{
if (product.getProductionId4() > 0 && product.getChance4() > 0)
{
return getChance(product.getChance4());
}
return getLastChance(product);
}
private static int getChance05(LimitShopProduct product)
{
return getLastChance(product);
}
private static int getLastChance(LimitShopProduct product)
{
return getChance(100d - (product.getChance() + product.getChance2() + product.getChance3() + product.getChance4()));
}
private static int getChance(double value)
{
return (int) Math.floor(100_000d * value);
}
}
package l2s.gameserver.network.l2.c2s.limitshop;
import java.util.Collections;
import java.util.List;
import l2s.commons.network.PacketReader;
import l2s.gameserver.config.instances.ConfigAltSettings;
import l2s.gameserver.data.xml.holder.LimitShopClanHolder;
import l2s.gameserver.data.xml.holder.LimitShopCraftHolder;
import l2s.gameserver.data.xml.holder.LimitShopHolder;
import l2s.gameserver.model.Player;
import l2s.gameserver.network.l2.GameClient;
import l2s.gameserver.network.l2.c2s.IClientIncomingPacket;
import l2s.gameserver.network.l2.s2c.limitshop.ExPurchaseLimitCraftItemList;
import l2s.gameserver.network.l2.s2c.limitshop.ExPurchaseLimitShopItemListNew;
import l2s.gameserver.templates.LimitShop.LimitShopProduct;
/**
* @author nexvill
*/
public class RequestExPurchaseLimitShopItemList implements IClientIncomingPacket
{
public static final int ITEMS_LIMIT_PER_PAGE = 100;
private int _listId;
@Override
public boolean readImpl(GameClient client, PacketReader packet)
{
_listId = packet.readC();
return true;
}
@Override
public void run(GameClient client)
{
Player activeChar = client.getActiveChar();
if(activeChar == null || ConfigAltSettings.DISABLE_SPECIAL_CREATION)
return;
List<LimitShopProduct> _products;
switch (_listId)
{
case 3: // Normal Lcoin Shop
{
_products = LimitShopHolder.getInstance().getProducts(activeChar);
break;
}
case 4: // Lcoin Special Craft
{
_products = LimitShopCraftHolder.getInstance().getProducts();
break;
}
case 100: // Clan Shop
{
_products = LimitShopClanHolder.getInstance().getProducts();
break;
}
default:
{
_products = Collections.emptyList();
}
}
int revision = client.getPacketRevision();
int maxPage = (int) Math.ceil(_products.size() / (double) ITEMS_LIMIT_PER_PAGE);
for (int currentPage = 1; currentPage <= maxPage; currentPage++)
{
int endIndex = currentPage * ITEMS_LIMIT_PER_PAGE;
int startIndex = endIndex - ITEMS_LIMIT_PER_PAGE;
if (revision >= 516 && _listId == 4)
{
activeChar.sendPacket(new ExPurchaseLimitCraftItemList(activeChar, currentPage, maxPage, _products.subList(startIndex, Math.min(_products.size(), endIndex))));
}
else
{
activeChar.sendPacket(new ExPurchaseLimitShopItemListNew(activeChar, _listId, currentPage, maxPage, _products.subList(startIndex, Math.min(_products.size(), endIndex))));
}
}
}
}
помогло показал в какую сторону копать спасибоУ меня как-то так написано все
Серверный пакет:
Java:package l2s.gameserver.network.l2.s2c.limitshop; import l2s.commons.network.PacketWriter; import l2s.gameserver.model.Player; import l2s.gameserver.model.actor.variables.PlayerVariables; import l2s.gameserver.network.l2.s2c.IClientOutgoingPacket; import l2s.gameserver.templates.LimitShop.LimitShopProduct; import java.util.Collection; import java.util.List; import l2s.gameserver.network.l2.packethandler.s2c.IServerPacketOpCode; import l2s.gameserver.network.l2.packethandler.s2c.ExServerPacketsOpCodes; /** * @author Index * @version Project Wolf | p516 | 05/03/2025 * interface definition S_EX_PURCHASE_LIMIT_CRAFT_ITEM_LIST */ public class ExPurchaseLimitCraftItemList implements IClientOutgoingPacket { private final Player _player; private final Collection<LimitShopProduct> _products; private final int _currentPage; private final int _maxPage; public ExPurchaseLimitCraftItemList(Player activeChar, int currentPage, int maxPage, List<LimitShopProduct> subList) { _player = activeChar; _currentPage = currentPage; _maxPage = maxPage; _products = subList; } // Model: Codex-GPT5.1 | Date: 2025-11-18 04:18:53 | Generated by agent | Task: map packet opcodes @Override public IServerPacketOpCode getPacketOpCode() { return ExServerPacketsOpCodes.S_EX_PURCHASE_LIMIT_CRAFT_ITEM_LIST; } // Model: Codex-GPT5.1 | Date: 2025-11-18 04:18:53 | Generated by agent | Task: map packet opcodes @Override public boolean write(PacketWriter packet) { packet.writeC(_currentPage); packet.writeC(_maxPage); packet.writeD(_products.size()); for (LimitShopProduct shopProduct : _products) { writeLimitShopProduct(packet, _player, shopProduct); } return true; } private static void writeLimitShopProduct(PacketWriter packet, Player player, LimitShopProduct shopProduct) { packet.writeD(shopProduct.getId()); packet.writeD(shopProduct.getProductionId()); packet.writeD(getLimitation(player, shopProduct)); packet.writeD(shopProduct.remainTime()); // nRemainSec packet.writeD(shopProduct.remainServerItemAmount()); // nRemainServerItemAmount packet.writeD(getChance01(shopProduct)); packet.writeD(getChance02(shopProduct)); packet.writeD(getChance03(shopProduct)); packet.writeD(getChance04(shopProduct)); packet.writeD(getChance05(shopProduct)); } private static int getLimitation(Player player, LimitShopProduct product) { // No account limits. { return 1; } } private static int getChance01(LimitShopProduct product) { if (product.getProductionId() > 0 && product.getChance() > 0) { return getChance(product.getChance()); } else if (product.getProductionId2() > 0 && product.getChance2() > 0) { return getChance(product.getChance2()); } else if (product.getProductionId3() > 0 && product.getChance3() > 0) { return getChance(product.getChance3()); } else if (product.getProductionId4() > 0 && product.getChance4() > 0) { return getChance(product.getChance4()); } return getLastChance(product); } private static int getChance02(LimitShopProduct product) { if (product.getProductionId2() > 0 && product.getChance2() > 0) { return getChance(product.getChance2()); } else if (product.getProductionId3() > 0 && product.getChance3() > 0) { return getChance(product.getChance3()); } else if (product.getProductionId4() > 0 && product.getChance4() > 0) { return getChance(product.getChance4()); } return getLastChance(product); } private static int getChance03(LimitShopProduct product) { if (product.getProductionId3() > 0 && product.getChance3() > 0) { return getChance(product.getChance3()); } else if (product.getProductionId4() > 0 && product.getChance4() > 0) { return getChance(product.getChance4()); } return getLastChance(product); } private static int getChance04(LimitShopProduct product) { if (product.getProductionId4() > 0 && product.getChance4() > 0) { return getChance(product.getChance4()); } return getLastChance(product); } private static int getChance05(LimitShopProduct product) { return getLastChance(product); } private static int getLastChance(LimitShopProduct product) { return getChance(100d - (product.getChance() + product.getChance2() + product.getChance3() + product.getChance4())); } private static int getChance(double value) { return (int) Math.floor(100_000d * value); } }
Клиентский пакет:
Java:package l2s.gameserver.network.l2.c2s.limitshop; import java.util.Collections; import java.util.List; import l2s.commons.network.PacketReader; import l2s.gameserver.config.instances.ConfigAltSettings; import l2s.gameserver.data.xml.holder.LimitShopClanHolder; import l2s.gameserver.data.xml.holder.LimitShopCraftHolder; import l2s.gameserver.data.xml.holder.LimitShopHolder; import l2s.gameserver.model.Player; import l2s.gameserver.network.l2.GameClient; import l2s.gameserver.network.l2.c2s.IClientIncomingPacket; import l2s.gameserver.network.l2.s2c.limitshop.ExPurchaseLimitCraftItemList; import l2s.gameserver.network.l2.s2c.limitshop.ExPurchaseLimitShopItemListNew; import l2s.gameserver.templates.LimitShop.LimitShopProduct; /** * @author nexvill */ public class RequestExPurchaseLimitShopItemList implements IClientIncomingPacket { public static final int ITEMS_LIMIT_PER_PAGE = 100; private int _listId; @Override public boolean readImpl(GameClient client, PacketReader packet) { _listId = packet.readC(); return true; } @Override public void run(GameClient client) { Player activeChar = client.getActiveChar(); if(activeChar == null || ConfigAltSettings.DISABLE_SPECIAL_CREATION) return; List<LimitShopProduct> _products; switch (_listId) { case 3: // Normal Lcoin Shop { _products = LimitShopHolder.getInstance().getProducts(activeChar); break; } case 4: // Lcoin Special Craft { _products = LimitShopCraftHolder.getInstance().getProducts(); break; } case 100: // Clan Shop { _products = LimitShopClanHolder.getInstance().getProducts(); break; } default: { _products = Collections.emptyList(); } } int revision = client.getPacketRevision(); int maxPage = (int) Math.ceil(_products.size() / (double) ITEMS_LIMIT_PER_PAGE); for (int currentPage = 1; currentPage <= maxPage; currentPage++) { int endIndex = currentPage * ITEMS_LIMIT_PER_PAGE; int startIndex = endIndex - ITEMS_LIMIT_PER_PAGE; if (revision >= 516 && _listId == 4) { activeChar.sendPacket(new ExPurchaseLimitCraftItemList(activeChar, currentPage, maxPage, _products.subList(startIndex, Math.min(_products.size(), endIndex)))); } else { activeChar.sendPacket(new ExPurchaseLimitShopItemListNew(activeChar, _listId, currentPage, maxPage, _products.subList(startIndex, Math.min(_products.size(), endIndex)))); } } } }
Ну если у тебя есть пакеты по украшениям то можешь остаться) хотя лучше новую тему сделать по нимMrKirill1232 Получается я уже не нужен?![]()
.gif)
У меня как-то так написано все
Серверный пакет:
Java:private static int getChance01(LimitShopProduct product) { if (product.getProductionId() > 0 && product.getChance() > 0) { return getChance(product.getChance()); } else if (product.getProductionId2() > 0 && product.getChance2() > 0) { return getChance(product.getChance2()); } else if (product.getProductionId3() > 0 && product.getChance3() > 0) { return getChance(product.getChance3()); } else if (product.getProductionId4() > 0 && product.getChance4() > 0) { return getChance(product.getChance4()); } return getLastChance(product); } private static int getChance02(LimitShopProduct product) { if (product.getProductionId2() > 0 && product.getChance2() > 0) { return getChance(product.getChance2()); } else if (product.getProductionId3() > 0 && product.getChance3() > 0) { return getChance(product.getChance3()); } else if (product.getProductionId4() > 0 && product.getChance4() > 0) { return getChance(product.getChance4()); } return getLastChance(product); } private static int getChance03(LimitShopProduct product) { if (product.getProductionId3() > 0 && product.getChance3() > 0) { return getChance(product.getChance3()); } else if (product.getProductionId4() > 0 && product.getChance4() > 0) { return getChance(product.getChance4()); } return getLastChance(product); } private static int getChance04(LimitShopProduct product) { if (product.getProductionId4() > 0 && product.getChance4() > 0) { return getChance(product.getChance4()); } return getLastChance(product); } private static int getChance05(LimitShopProduct product) { return getLastChance(product); } private static int getLastChance(LimitShopProduct product) { return getChance(100d - (product.getChance() + product.getChance2() + product.getChance3() + product.getChance4())); } private static int getChance(double value) { return (int) Math.floor(100_000d * value); } }
что было, с тем и работал :]Это кто такое придумал![]()