Реликвии бьет ошибку

uter81

Знающий
Участник
Сообщения
281
Розыгрыши
0
Репутация
1
Реакции
11
Баллы
460
Хроники
  1. Grand Cursade
Исходники
Присутствуют
Сборка
l2jMobius Shinemaker
Привет всем!

Подскажите пожалуйста, как поправить ош c коллекцией реликвий, базу новую залил, ошибка сохранилась.


Код:
[25/02 15:41:25] Error writing packet ExRelicsCollectionUpdate to client (Cannot invoke "org.l2jmobius.gameserver.model.holders.RelicCollectionDataHolder.getCompleteCount()" because the return value of "org.l2jmobius.gameserver.data.xml.RelicCollectionData.getRelicCollection(int)" is null) [Character: admin[268662966] - Account: adm - IP: 77.17.117.43]]]
[25/02 15:41:25] java.lang.NullPointerException: Cannot invoke "org.l2jmobius.gameserver.model.holders.RelicCollectionDataHolder.getCompleteCount()" because the return value of "org.l2jmobius.gameserver.data.xml.RelicCollectionData.getRelicCollection(int)" is null
    at org.l2jmobius.gameserver.model.actor.Player.isCompleteCollection(Player.java:15734)
    at org.l2jmobius.gameserver.network.serverpackets.relics.ExRelicsCollectionUpdate.writeImpl(ExRelicsCollectionUpdate.java:124)
    at org.l2jmobius.gameserver.network.serverpackets.ServerPacket.write(ServerPacket.java:147)
    at org.l2jmobius.gameserver.network.serverpackets.ServerPacket.write(ServerPacket.java:30)
    at org.l2jmobius.commons.network.WritablePacket.writeDataToBuffer(WritablePacket.java:72)
    at org.l2jmobius.commons.network.WritablePacket.writeData(WritablePacket.java:48)
    at org.l2jmobius.commons.network.Client.write(Client.java:141)
    at org.l2jmobius.commons.network.Client.writeNextPacket(Client.java:126)
    at org.l2jmobius.commons.network.internal.fairness.SingleBucketStrategy.doNextAction(SingleBucketStrategy.java:42)
    at org.l2jmobius.commons.network.internal.fairness.FairnessController.nextFairAction(FairnessController.java:65)
    at org.l2jmobius.commons.network.Client.writeFairPacket(Client.java:107)
    at org.l2jmobius.commons.network.Client.writePacket(Client.java:78)
    at org.l2jmobius.gameserver.network.GameClient.sendPacket(GameClient.java:240)
    at org.l2jmobius.gameserver.model.actor.Player.sendPacket(Player.java:4456)
    at org.l2jmobius.gameserver.network.clientpackets.relics.RequestRelicsUpgrade.runImpl(RequestRelicsUpgrade.java:122)
    at org.l2jmobius.gameserver.network.clientpackets.ClientPacket.run(ClientPacket.java:53)
    at org.l2jmobius.commons.threads.RunnableWrapper.run(RunnableWrapper.java:35)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
    at java.base/java.lang.Thread.run(Thread.java:1583)
 

Привет всем!

Подскажите пожалуйста, как поправить ош c коллекцией реликвий, базу новую залил, ошибка сохранилась.


Код:
[25/02 15:41:25] Error writing packet ExRelicsCollectionUpdate to client (Cannot invoke "org.l2jmobius.gameserver.model.holders.RelicCollectionDataHolder.getCompleteCount()" because the return value of "org.l2jmobius.gameserver.data.xml.RelicCollectionData.getRelicCollection(int)" is null) [Character: admin[268662966] - Account: adm - IP: 77.17.117.43]]]
[25/02 15:41:25] java.lang.NullPointerException: Cannot invoke "org.l2jmobius.gameserver.model.holders.RelicCollectionDataHolder.getCompleteCount()" because the return value of "org.l2jmobius.gameserver.data.xml.RelicCollectionData.getRelicCollection(int)" is null
    at org.l2jmobius.gameserver.model.actor.Player.isCompleteCollection(Player.java:15734)
    at org.l2jmobius.gameserver.network.serverpackets.relics.ExRelicsCollectionUpdate.writeImpl(ExRelicsCollectionUpdate.java:124)
    at org.l2jmobius.gameserver.network.serverpackets.ServerPacket.write(ServerPacket.java:147)
    at org.l2jmobius.gameserver.network.serverpackets.ServerPacket.write(ServerPacket.java:30)
    at org.l2jmobius.commons.network.WritablePacket.writeDataToBuffer(WritablePacket.java:72)
    at org.l2jmobius.commons.network.WritablePacket.writeData(WritablePacket.java:48)
    at org.l2jmobius.commons.network.Client.write(Client.java:141)
    at org.l2jmobius.commons.network.Client.writeNextPacket(Client.java:126)
    at org.l2jmobius.commons.network.internal.fairness.SingleBucketStrategy.doNextAction(SingleBucketStrategy.java:42)
    at org.l2jmobius.commons.network.internal.fairness.FairnessController.nextFairAction(FairnessController.java:65)
    at org.l2jmobius.commons.network.Client.writeFairPacket(Client.java:107)
    at org.l2jmobius.commons.network.Client.writePacket(Client.java:78)
    at org.l2jmobius.gameserver.network.GameClient.sendPacket(GameClient.java:240)
    at org.l2jmobius.gameserver.model.actor.Player.sendPacket(Player.java:4456)
    at org.l2jmobius.gameserver.network.clientpackets.relics.RequestRelicsUpgrade.runImpl(RequestRelicsUpgrade.java:122)
    at org.l2jmobius.gameserver.network.clientpackets.ClientPacket.run(ClientPacket.java:53)
    at org.l2jmobius.commons.threads.RunnableWrapper.run(RunnableWrapper.java:35)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
    at java.base/java.lang.Thread.run(Thread.java:1583)
Ну Costy сам писал что за основу брал коллекции, значит там где-то вместо реликвий стоит проверка на коллекции
ExRelicsCollectionUpdate.writeImpl(ExRelicsCollectionUpdate.java:124)
 
Ну Costy сам писал что за основу брал коллекции, значит там где-то вместо реликвий стоит проверка на коллекции
по поиску в файле ExRelicsCollectionUpdate везде написано RelicCollection , или я что-то не увидел
Код:
package org.l2jmobius.gameserver.network.serverpackets.relics;

import java.util.Collection;

import org.l2jmobius.commons.network.WritableBuffer;
import org.l2jmobius.gameserver.data.xml.OptionData;
import org.l2jmobius.gameserver.data.xml.RelicCollectionData;
import org.l2jmobius.gameserver.data.xml.RelicData;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.PlayerRelicCollectionData;
import org.l2jmobius.gameserver.model.holders.PlayerRelicData;
import org.l2jmobius.gameserver.model.holders.RelicCollectionDataHolder;
import org.l2jmobius.gameserver.model.holders.RelicDataHolder;
import org.l2jmobius.gameserver.model.options.Options;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.ServerPackets;
import org.l2jmobius.gameserver.network.serverpackets.ServerPacket;

public class ExRelicsCollectionUpdate extends ServerPacket
{
    private final Player _player;
    private final int _relicId;
    private final int _relicLevel;
    private int _neededRelicCollectionId = 0;
    private int _neededRelicsInCollection = 0;
    private int _neededRelicIndex = 0;
    private int _neededRelicLevel = 0;
    
    public ExRelicsCollectionUpdate(Player player, int relicId, int relicLevel)
    {
        _player = player;
        _relicId = relicId;
        _relicLevel = relicLevel;
    }
    
    @Override
    public void writeImpl(GameClient client, WritableBuffer buffer)
    {
        ServerPackets.EX_RELICS_COLLECTION_UPDATE.writeId(this, buffer);
        
        final Collection<PlayerRelicData> storedRelics = _player.getRelics();
        PlayerRelicData existingRelic = null;
        // Check if the relic with the same ID exists.
        for (PlayerRelicData relic : storedRelics)
        {
            if ((relic.getRelicId() == _relicId) && (relic.getRelicIndex() == 0)) // Only relics with index 0 can be added to collection.
            {
                existingRelic = relic;
                break;
            }
        }
        
        // Check if obtained relic is required in some collection.
        if (existingRelic != null)
        {
            final int relicId = existingRelic.getRelicId();
            for (RelicCollectionDataHolder cRelicCollectionHolder : RelicCollectionData.getInstance().getRelicCollections())
            {
                // Find the relicId into collections.
                for (RelicDataHolder relicData : cRelicCollectionHolder.getRelics())
                {
                    // Relic id found.
                    if ((relicData.getRelicId() == relicId) && (!_player.isRelicRegisteredInCollection(relicId, cRelicCollectionHolder.getCollectionId())))
                    {
                        for (int i = 0; i < cRelicCollectionHolder.getRelics().size(); i++)
                        {
                            final RelicDataHolder relic = cRelicCollectionHolder.getRelic(i);
                            if ((relic.getRelicId() == relicId))
                            {
                                // _player.sendMessage("Relic Id found in collection: " + relicCollectionHolder.getCollectionId());
                                _neededRelicCollectionId = cRelicCollectionHolder.getCollectionId();
                                _neededRelicsInCollection = cRelicCollectionHolder.getRelics().size();
                                _neededRelicIndex = i; // Position found.
                                _neededRelicLevel = cRelicCollectionHolder.getRelic(i).getEnchantLevel();
                                // _player.sendMessage("Relic needed in collection: " + _neededRelicCollectionId);
                                
                                // Add relic to collection if matches the level needed.
                                if (existingRelic.getRelicLevel() == _neededRelicLevel)
                                {
                                    // Check player relic count.
                                    long count = 0;
                                    for (RelicCollectionDataHolder relicCollectionHolder : RelicCollectionData.getInstance().getRelicCollections())
                                    {
                                        for (RelicDataHolder data : relicCollectionHolder.getRelics())
                                        {
                                            if ((data.getRelicId() == existingRelic.getRelicId()) && ((data.getEnchantLevel() == 0) || (data.getEnchantLevel() == existingRelic.getRelicLevel())))
                                            {
                                                count = existingRelic.getRelicCount();
                                                break;
                                            }
                                        }
                                    }
                                    // Remove the relic from main confirmed relics list.
                                    if (count == 0)
                                    {
                                        _player.deleteRelics(existingRelic.getRelicId(), existingRelic.getRelicLevel(), existingRelic.getRelicCount(), _neededRelicIndex, existingRelic.getRelicSummonTime());
                                        _player.getRelics().remove(existingRelic);
                                        // Save modifications
                                        _player.storeRelics();
                                        // Update Relic Collections from db.
                                        _player.getRelicCollections().add(new PlayerRelicCollectionData(_neededRelicCollectionId, existingRelic.getRelicId(), existingRelic.getRelicLevel(), _neededRelicIndex));
                                        _player.storeRelicCollections();
                                        _player.sendPacket(new ExRelicsCollectionInfo(_player));
                                        _player.sendPacket(new ExRelicsList(_player)); // Update confirmed relic list relics count.
                                        // _player.sendMessage("Removed Relic Id: " + existingRelic.getRelicId() + " from Relics list and added into Collection Id: " + _neededRelicCollectionId);
                                    }
                                    else if (count > 0) // ...or decrease relic count and set level to 0 if needed.
                                    {
                                        existingRelic.setRelicCount(existingRelic.getRelicCount() - 1);
                                        // Update Relic Collections from db.
                                        _player.getRelicCollections().add(new PlayerRelicCollectionData(_neededRelicCollectionId, existingRelic.getRelicId(), existingRelic.getRelicLevel(), _neededRelicIndex));
                                        _player.storeRelicCollections();
                                        _player.sendPacket(new ExRelicsCollectionInfo(_player));
                                        if (existingRelic.getRelicLevel() > 0)
                                        {
                                            existingRelic.setRelicLevel(0);
                                        }
                                        // _player.sendPacket(new ExRelicsList(_player)); // Update confirmed relic list relics count.
                                        // _player.sendPacket(new ExRelicsUpdateList(1, existingRelic.getRelicId(), 0, 1)); // Update confirmed relic list with new relic.
                                        // _player.sendMessage("Decreased Relic Id: " + existingRelic.getRelicId() + " count with 1 from Relics list and added into Collection Id: " + _neededRelicCollectionId);
                                    }
                                    _player.sendPacket(new ExRelicsList(_player)); // Update confirmed relic list relics count.
                                    
                                    // Save modifications.
                                    _player.storeRelics();
                                }
                                
                                // Check if collection is complete and give skills.
                                int completeCount = 0;
                                final int completeRelicsInCollection = RelicCollectionData.getInstance().getRelicCollection(_neededRelicCollectionId).getCompleteCount();
                                for (PlayerRelicCollectionData coll : _player.getRelicCollections())
                                {
                                    if (coll.getRelicCollectionId() == _neededRelicCollectionId)
                                    {
                                        completeCount++;
                                    }
                                }
                                
                                if (completeCount == completeRelicsInCollection)
                                {
                                    _player.sendPacket(new ExRelicsCollectionCompleteAnnounce(_neededRelicCollectionId));
                                    
                                    // Apply collection option if all requirements are met.
                                    final Options options = OptionData.getInstance().getOptions(RelicCollectionData.getInstance().getRelicCollection(_neededRelicCollectionId).getOptionId());
                                    if (options != null)
                                    {
                                        options.apply(_player);
                                    }
                                }
                                
                                buffer.writeInt(1); // Completed collections array size.
                                buffer.writeInt(_neededRelicCollectionId); // Collection array position.
                                buffer.writeByte(completeCount == completeRelicsInCollection); // Completed.
                                buffer.writeInt(_neededRelicsInCollection); // Needed relics count array.
                                for (int j = 0; j < completeCount; j++)
                                {
                                    buffer.writeInt(j); // Array position.
                                    buffer.writeInt(_relicId); // Relic id.
                                    buffer.writeInt(_relicLevel); // Relic level.
                                }
                            }
                        }
                        final int relicGrade = RelicData.getInstance().getRelic(_relicId).getGrade();
                        if ((relicGrade == 4) || (relicGrade == 5))
                        {
                            return;
                        }
                        continue;
                    }
                }
            }
        }
    }
}
 
перед выполнением методов getCompleteCount и getOptionId
Java:
 final int completeRelicsInCollection = RelicCollectionData.getInstance().getRelicCollection(_neededRelicCollectionId).getCompleteCount();
 
 final Options options = OptionData.getInstance().getOptions(RelicCollectionData.getInstance().getRelicCollection(_neededRelicCollectionId).getOptionId());

стоит проверять метод getRelicCollection(_neededRelicCollectionId) на null.
смотреть код метода getRelicCollection класса RelicCollectionData, и разбираться почему этот метод возвращает null.
а также возможно что в метод getRelicCollection передается в качестве аргумента переменная _neededRelicCollectionId с некорректным значением.
 
по поиску в файле ExRelicsCollectionUpdate везде написано RelicCollection , или я что-то не увидел
Код:
package org.l2jmobius.gameserver.network.serverpackets.relics;

import java.util.Collection;

import org.l2jmobius.commons.network.WritableBuffer;
import org.l2jmobius.gameserver.data.xml.OptionData;
import org.l2jmobius.gameserver.data.xml.RelicCollectionData;
import org.l2jmobius.gameserver.data.xml.RelicData;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.PlayerRelicCollectionData;
import org.l2jmobius.gameserver.model.holders.PlayerRelicData;
import org.l2jmobius.gameserver.model.holders.RelicCollectionDataHolder;
import org.l2jmobius.gameserver.model.holders.RelicDataHolder;
import org.l2jmobius.gameserver.model.options.Options;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.ServerPackets;
import org.l2jmobius.gameserver.network.serverpackets.ServerPacket;

public class ExRelicsCollectionUpdate extends ServerPacket
{
    private final Player _player;
    private final int _relicId;
    private final int _relicLevel;
    private int _neededRelicCollectionId = 0;
    private int _neededRelicsInCollection = 0;
    private int _neededRelicIndex = 0;
    private int _neededRelicLevel = 0;
   
    public ExRelicsCollectionUpdate(Player player, int relicId, int relicLevel)
    {
        _player = player;
        _relicId = relicId;
        _relicLevel = relicLevel;
    }
   
    @Override
    public void writeImpl(GameClient client, WritableBuffer buffer)
    {
        ServerPackets.EX_RELICS_COLLECTION_UPDATE.writeId(this, buffer);
       
        final Collection<PlayerRelicData> storedRelics = _player.getRelics();
        PlayerRelicData existingRelic = null;
        // Check if the relic with the same ID exists.
        for (PlayerRelicData relic : storedRelics)
        {
            if ((relic.getRelicId() == _relicId) && (relic.getRelicIndex() == 0)) // Only relics with index 0 can be added to collection.
            {
                existingRelic = relic;
                break;
            }
        }
       
        // Check if obtained relic is required in some collection.
        if (existingRelic != null)
        {
            final int relicId = existingRelic.getRelicId();
            for (RelicCollectionDataHolder cRelicCollectionHolder : RelicCollectionData.getInstance().getRelicCollections())
            {
                // Find the relicId into collections.
                for (RelicDataHolder relicData : cRelicCollectionHolder.getRelics())
                {
                    // Relic id found.
                    if ((relicData.getRelicId() == relicId) && (!_player.isRelicRegisteredInCollection(relicId, cRelicCollectionHolder.getCollectionId())))
                    {
                        for (int i = 0; i < cRelicCollectionHolder.getRelics().size(); i++)
                        {
                            final RelicDataHolder relic = cRelicCollectionHolder.getRelic(i);
                            if ((relic.getRelicId() == relicId))
                            {
                                // _player.sendMessage("Relic Id found in collection: " + relicCollectionHolder.getCollectionId());
                                _neededRelicCollectionId = cRelicCollectionHolder.getCollectionId();
                                _neededRelicsInCollection = cRelicCollectionHolder.getRelics().size();
                                _neededRelicIndex = i; // Position found.
                                _neededRelicLevel = cRelicCollectionHolder.getRelic(i).getEnchantLevel();
                                // _player.sendMessage("Relic needed in collection: " + _neededRelicCollectionId);
                               
                                // Add relic to collection if matches the level needed.
                                if (existingRelic.getRelicLevel() == _neededRelicLevel)
                                {
                                    // Check player relic count.
                                    long count = 0;
                                    for (RelicCollectionDataHolder relicCollectionHolder : RelicCollectionData.getInstance().getRelicCollections())
                                    {
                                        for (RelicDataHolder data : relicCollectionHolder.getRelics())
                                        {
                                            if ((data.getRelicId() == existingRelic.getRelicId()) && ((data.getEnchantLevel() == 0) || (data.getEnchantLevel() == existingRelic.getRelicLevel())))
                                            {
                                                count = existingRelic.getRelicCount();
                                                break;
                                            }
                                        }
                                    }
                                    // Remove the relic from main confirmed relics list.
                                    if (count == 0)
                                    {
                                        _player.deleteRelics(existingRelic.getRelicId(), existingRelic.getRelicLevel(), existingRelic.getRelicCount(), _neededRelicIndex, existingRelic.getRelicSummonTime());
                                        _player.getRelics().remove(existingRelic);
                                        // Save modifications
                                        _player.storeRelics();
                                        // Update Relic Collections from db.
                                        _player.getRelicCollections().add(new PlayerRelicCollectionData(_neededRelicCollectionId, existingRelic.getRelicId(), existingRelic.getRelicLevel(), _neededRelicIndex));
                                        _player.storeRelicCollections();
                                        _player.sendPacket(new ExRelicsCollectionInfo(_player));
                                        _player.sendPacket(new ExRelicsList(_player)); // Update confirmed relic list relics count.
                                        // _player.sendMessage("Removed Relic Id: " + existingRelic.getRelicId() + " from Relics list and added into Collection Id: " + _neededRelicCollectionId);
                                    }
                                    else if (count > 0) // ...or decrease relic count and set level to 0 if needed.
                                    {
                                        existingRelic.setRelicCount(existingRelic.getRelicCount() - 1);
                                        // Update Relic Collections from db.
                                        _player.getRelicCollections().add(new PlayerRelicCollectionData(_neededRelicCollectionId, existingRelic.getRelicId(), existingRelic.getRelicLevel(), _neededRelicIndex));
                                        _player.storeRelicCollections();
                                        _player.sendPacket(new ExRelicsCollectionInfo(_player));
                                        if (existingRelic.getRelicLevel() > 0)
                                        {
                                            existingRelic.setRelicLevel(0);
                                        }
                                        // _player.sendPacket(new ExRelicsList(_player)); // Update confirmed relic list relics count.
                                        // _player.sendPacket(new ExRelicsUpdateList(1, existingRelic.getRelicId(), 0, 1)); // Update confirmed relic list with new relic.
                                        // _player.sendMessage("Decreased Relic Id: " + existingRelic.getRelicId() + " count with 1 from Relics list and added into Collection Id: " + _neededRelicCollectionId);
                                    }
                                    _player.sendPacket(new ExRelicsList(_player)); // Update confirmed relic list relics count.
                                   
                                    // Save modifications.
                                    _player.storeRelics();
                                }
                               
                                // Check if collection is complete and give skills.
                                int completeCount = 0;
                                final int completeRelicsInCollection = RelicCollectionData.getInstance().getRelicCollection(_neededRelicCollectionId).getCompleteCount();
                                for (PlayerRelicCollectionData coll : _player.getRelicCollections())
                                {
                                    if (coll.getRelicCollectionId() == _neededRelicCollectionId)
                                    {
                                        completeCount++;
                                    }
                                }
                               
                                if (completeCount == completeRelicsInCollection)
                                {
                                    _player.sendPacket(new ExRelicsCollectionCompleteAnnounce(_neededRelicCollectionId));
                                   
                                    // Apply collection option if all requirements are met.
                                    final Options options = OptionData.getInstance().getOptions(RelicCollectionData.getInstance().getRelicCollection(_neededRelicCollectionId).getOptionId());
                                    if (options != null)
                                    {
                                        options.apply(_player);
                                    }
                                }
                               
                                buffer.writeInt(1); // Completed collections array size.
                                buffer.writeInt(_neededRelicCollectionId); // Collection array position.
                                buffer.writeByte(completeCount == completeRelicsInCollection); // Completed.
                                buffer.writeInt(_neededRelicsInCollection); // Needed relics count array.
                                for (int j = 0; j < completeCount; j++)
                                {
                                    buffer.writeInt(j); // Array position.
                                    buffer.writeInt(_relicId); // Relic id.
                                    buffer.writeInt(_relicLevel); // Relic level.
                                }
                            }
                        }
                        final int relicGrade = RelicData.getInstance().getRelic(_relicId).getGrade();
                        if ((relicGrade == 4) || (relicGrade == 5))
                        {
                            return;
                        }
                        continue;
                    }
                }
            }
        }
    }
}
Оффтоп:
Извиняюсь, но, господи, какой ужас
 
Не понимаю о чем вы, норм код
Не та ветка - сорян.
 
Не понимаю о чем вы, норм код
Не та ветка - сорян.
1709038155615.png
от шо это такое?
 
Назад
Сверху Снизу