Выдача итема у НПСа Витаминов

uter81

Знающий
Участник
Сообщения
293
Розыгрыши
0
Репутация
1
Реакции
11
Баллы
460
Хроники
  1. Chaotic Throne: High Five
Исходники
Присутствуют
Сборка
l2jMobius
Добрый день, подскажите как поправить выдачу предметов у менеджера витаминов, с топика на форуме заменил строки из поста Выдача итема у менеджера витамин
при компиляции теперь ошибку выдает.

изначальный файл такой

Код:
package org.l2jmobius.gameserver.network.clientpackets;

import org.l2jmobius.Config;
import org.l2jmobius.gameserver.model.PremiumItem;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.ExGetPremiumItemList;
import org.l2jmobius.gameserver.util.Util;

public class RequestWithDrawPremiumItem extends ClientPacket
{
    private int _itemNum;
    private int _charId;
    private long _itemCount;
    
    @Override
    protected void readImpl()
    {
        _itemNum = readInt();
        _charId = readInt();
        _itemCount = readLong();
    }

    @Override
    protected void runImpl()
    {
        final Player player = getPlayer();
        if (player == null)
        {
            return;
        }
        else if (_itemCount <= 0)
        {
            return;
        }
        else if (player.getObjectId() != _charId)
        {
            Util.handleIllegalPlayerAction(player, "[RequestWithDrawPremiumItem] Incorrect owner, Player: " + player.getName(), Config.DEFAULT_PUNISH);
            return;
        }
        else if (player.getPremiumItemList().isEmpty())
        {
            Util.handleIllegalPlayerAction(player, "[RequestWithDrawPremiumItem] Player: " + player.getName() + " try to get item with empty list!", Config.DEFAULT_PUNISH);
            return;
        }
        else if ((player.getWeightPenalty() >= 3) || !player.isInventoryUnder90(false))
        {
            player.sendPacket(SystemMessageId.YOU_CANNOT_RECEIVE_THE_DIMENSIONAL_ITEM_BECAUSE_YOU_HAVE_EXCEED_YOUR_INVENTORY_WEIGHT_QUANTITY_LIMIT);
            return;
        }
        else if (player.isProcessingTransaction())
        {
            player.sendPacket(SystemMessageId.ITEMS_FROM_GAME_ASSISTANTS_CANNOT_BE_EXCHANGED);
            return;
        }

        final PremiumItem item = player.getPremiumItemList().get(_itemNum);
        if (item == null)
        {
            return;
        }
        else if (item.getCount() < _itemCount)
        {
            return;
        }

        final long itemsLeft = (item.getCount() - _itemCount);
        player.addItem("PremiumItem", item.getItemId(), _itemCount, player.getTarget(), true);
        if (itemsLeft > 0)
        {
            item.updateCount(itemsLeft);
            player.updatePremiumItem(_itemNum, itemsLeft);
        }
        else
        {
            player.getPremiumItemList().remove(_itemNum);
            player.deletePremiumItem(_itemNum);
        }

        if (player.getPremiumItemList().isEmpty())
        {
            player.sendPacket(SystemMessageId.THERE_ARE_NO_MORE_DIMENSIONAL_ITEMS_TO_BE_FOUND);
        }
        else
        {
            player.sendPacket(new ExGetPremiumItemList(player));
        }
    }
}


заменил так

Код:
public class RequestWithDrawPremiumItem implements ClientPacket
{
    private int _itemNum;
    // private int _charId;
    private long _itemCount;
  
    @Override
    public void read(ReadablePacket packet)
    {
        _itemNum = packet.readInt();
        packet.readInt(); // 0x00
        _itemCount = packet.readLong();
    }
  
    @Override
    public void run(GameClient client)
    {
        final Player player = client.getPlayer();
        if ((player == null) || (_itemCount <= 0))
        {
            return;
        }
        // else if (player.getObjectId() != _charId)
        // {
        // Util.handleIllegalPlayerAction(player, "[RequestWithDrawPremiumItem] Incorrect owner, Player: " + player.getName(), Config.DEFAULT_PUNISH);
        // return;
        // }
        else if (player.getPremiumItemList().isEmpty())
        {
            Util.handleIllegalPlayerAction(player, "[RequestWithDrawPremiumItem] Player: " + player.getName() + " try to get item with empty list!", Config.DEFAULT_PUNISH);
            return;
        }
        else if ((player.getWeightPenalty() >= 3) || !player.isInventoryUnder90(false))
        {
            player.sendPacket(SystemMessageId.YOU_CANNOT_RECEIVE_THE_DIMENSIONAL_ITEM_BECAUSE_YOU_HAVE_EXCEED_YOUR_INVENTORY_WEIGHT_QUANTITY_LIMIT);
            return;
        }
        else if (player.isProcessingTransaction())
        {
            player.sendPacket(SystemMessageId.ITEMS_FROM_GAME_ASSISTANTS_CANNOT_BE_EXCHANGED);
            return;
        }
      
        final PremiumItem item = player.getPremiumItemList().get(_itemNum);
        if ((item == null) || (item.getCount() < _itemCount))
        {
            return;
        }
      
        final long itemsLeft = (item.getCount() - _itemCount);
        player.addItem("PremiumItem", item.getItemId(), _itemCount, player.getTarget(), true);
        if (itemsLeft > 0)
        {
            item.updateCount(itemsLeft);
            player.updatePremiumItem(_itemNum, itemsLeft);
        }
        else
        {
            player.getPremiumItemList().remove(_itemNum);
            player.deletePremiumItem(_itemNum);
        }
      
        if (player.getPremiumItemList().isEmpty())
        {
            player.sendPacket(SystemMessageId.THERE_ARE_NO_MORE_DIMENSIONAL_ITEMS_TO_BE_FOUND);
        }
        else
        {
            player.sendPacket(new ExGetPremiumItemList(player));
        }
    }
}

ошибки при компиле такие

1705514688090.png
 
JavaScript:
    [javac] Compiling 2710 source files to E:\game\Lineage II - Assassin\build\bin
    [javac] E:\game\Lineage II - Assassin\L2J_Mobius_11.3_Shinemaker\java\org\l2jmobius\gameserver\network\clientpackets\RequestWithDrawPremiumItem.java:29: error: interface expected here
    [javac] public class RequestWithDrawPremiumItem implements ClientPacket
    [javac]                                                    ^
    [javac] E:\game\Lineage II - Assassin\L2J_Mobius_11.3_Shinemaker\java\org\l2jmobius\gameserver\network\clientpackets\RequestWithDrawPremiumItem.java:36: error: cannot find symbol
    [javac]     public void read(ReadablePacket packet)
    [javac]                      ^
    [javac]   symbol:   class ReadablePacket
    [javac]   location: class RequestWithDrawPremiumItem
    [javac] E:\game\Lineage II - Assassin\L2J_Mobius_11.3_Shinemaker\java\org\l2jmobius\gameserver\network\clientpackets\RequestWithDrawPremiumItem.java:44: error: cannot find symbol
    [javac]     public void run(GameClient client)
    [javac]                     ^
    [javac]   symbol:   class GameClient
    [javac]   location: class RequestWithDrawPremiumItem
    [javac] E:\game\Lineage II - Assassin\L2J_Mobius_11.3_Shinemaker\java\org\l2jmobius\gameserver\network\ExClientPackets.java:337: error: incompatible types: bad return type in method reference
    [javac]     REQUEST_WITHDRAW_PREMIUM_ITEM(0x4F, RequestWithDrawPremiumItem::new, ConnectionState.IN_GAME),
    [javac]                                         ^
    [javac]     RequestWithDrawPremiumItem cannot be converted to ClientPacket
    [javac] E:\game\Lineage II - Assassin\L2J_Mobius_11.3_Shinemaker\java\org\l2jmobius\gameserver\network\clientpackets\RequestWithDrawPremiumItem.java:35: error: method does not override or implement a method from a supertype
    [javac]     @Override
    [javac]     ^
    [javac] E:\game\Lineage II - Assassin\L2J_Mobius_11.3_Shinemaker\java\org\l2jmobius\gameserver\network\clientpackets\RequestWithDrawPremiumItem.java:43: error: method does not override or implement a method from a supertype
    [javac]     @Override
    [javac]     ^
    [javac] Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
    [javac] 6 errors
кто сможет обьяснить как быть с этим я что то не пойму
 

Назад
Сверху Снизу