Çözüldü Yang ve İtem Toplayamama Sorunu

  • Konuyu açan Konuyu açan hiqermod
  • Açılış Tarihi Açılış Tarihi
  • Yanıt Yanıt 1
  • Gösterim Gösterim 415
Bu konu çözüme ulaştırılmıştır. Çözüm için konuya yazılan tüm yorumları okumayı unutmayın. Eğer konudaki yorumlar sorununuzu çözmediyse yeni bir konu açabilirsiniz.
Durum
İçerik kilitlendiği için mesaj gönderimine kapatıldı.

hiqermod

Üye
Üye
Mesaj
124
Çözümler
14
Beğeni
40
Puan
454
Ticaret Puanı
0
Merhaba arkadaşlar yine ben son bir bugum kaldı

Serverimde slot kestikten sonra düşen item ve dropları ilk düştüğüde alabiliyorum fakat 5 saniye beklersem 'z' ve ' " ' tuşlarıyla alamıyorum üzerine tıklayıp almam gerekiyor
sizce problemin kaynağı nedir ben k envanterle ilgili bir bug olduğunu düşünüyorum

char_item.cpp:
Genişlet Daralt Kopyala
bool CHARACTER::PickupItem(DWORD dwVID)
{
    LPITEM item = ITEM_MANAGER::instance().FindByVID(dwVID);

    if (IsObserverMode())
        return false;

    if (!item || !item->GetSectree())
        return false;

    if (item->DistanceValid(this))
    {
        if (item->IsOwnership(this))
        {
            // 만약 주으려 하는 아이템이 엘크라면
            if (item->GetType() == ITEM_ELK)
            {
                GiveGold(item->GetCount());
                item->RemoveFromGround();

                M2_DESTROY_ITEM(item);

                Save();
            }
            // 평범한 아이템이라면
            else
            {
                if (item->IsStackable() && !IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_STACK))
                {
                    BYTE bCount = item->GetCount();

//k env
#ifdef ENABLE_SPLIT_INVENTORY_SYSTEM
                    for (int i = 0; i < INVENTORY_AND_EQUIP_SLOT_MAX; ++i)
#else
                    for (int i = 0; i < INVENTORY_MAX_NUM; ++i)
#endif
//k env sonu
                    {
                        LPITEM item2 = GetInventoryItem(i);

                        if (!item2)
                            continue;

                        if (item2->GetVnum() == item->GetVnum())
                        {
                            int j;

                            for (j = 0; j < ITEM_SOCKET_MAX_NUM; ++j)
                                if (item2->GetSocket(j) != item->GetSocket(j))
                                    break;

                            if (j != ITEM_SOCKET_MAX_NUM)
                                continue;

                            BYTE bCount2 = MIN(g_bItemCountLimit - item2->GetCount(), bCount);
                            bCount -= bCount2;

                            item2->SetCount(item2->GetCount() + bCount2);

                            if (bCount == 0)
                            {
                                ChatPacket(CHAT_TYPE_INFO, LC_TEXT("아이템 획득: %s"), item2->GetName());
                                M2_DESTROY_ITEM(item);
                                if (item2->GetType() == ITEM_QUEST)
                                    quest::CQuestManager::instance().PickupItem (GetPlayerID(), item2);
                                return true;
                            }
                        }
                    }

                    item->SetCount(bCount);
                }

                int iEmptyCell;
                if (item->IsDragonSoul())
                {
                    if ((iEmptyCell = GetEmptyDragonSoulInventory(item)) == -1)
                    {
                        sys_log(0, "No empty ds inventory pid %u size %ud itemid %u", GetPlayerID(), item->GetSize(), item->GetID());
                        ChatPacket(CHAT_TYPE_INFO, LC_TEXT("소지하고 있는 아이템이 너무 많습니다."));
                        return false;
                    }
                }
//k env
#ifdef ENABLE_SPLIT_INVENTORY_SYSTEM
                else if (item->IsSkillBook())
                {
                    if ((iEmptyCell = GetEmptySkillBookInventory(item->GetSize())) == -1)
                    {
                        sys_log(0, "No empty ds inventory pid %u size %ud itemid %u", GetPlayerID(), item->GetSize(), item->GetID());
                        ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼OAoCI°i AO´A ¾ÆAIAUAI ³E¹≪ ¸¹½A´I´U."));
                        return false;
                    }
                }
                else if (item->IsUpgradeItem())
                {
                    if ((iEmptyCell = GetEmptyUpgradeItemsInventory(item->GetSize())) == -1)
                    {
                        sys_log(0, "No empty ds inventory pid %u size %ud itemid %u", GetPlayerID(), item->GetSize(), item->GetID());
                        ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼OAoCI°i AO´A ¾ÆAIAUAI ³E¹≪ ¸¹½A´I´U."));
                        return false;
                    }
                }
                else if (item->IsStone())
                {
                    if ((iEmptyCell = GetEmptyStoneInventory(item->GetSize())) == -1)
                    {
                        sys_log(0, "No empty ds inventory pid %u size %ud itemid %u", GetPlayerID(), item->GetSize(), item->GetID());
                        ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼OAoCI°i AO´A ¾ÆAIAUAI ³E¹≪ ¸¹½A´I´U."));
                        return false;
                    }
                }
                else if (item->IsBox())
                {
                    if ((iEmptyCell = GetEmptyBoxInventory(item->GetSize())) == -1)
                    {
                        sys_log(0, "No empty ds inventory pid %u size %ud itemid %u", GetPlayerID(), item->GetSize(), item->GetID());
                        ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼OAoCI°i AO´A ¾ÆAIAUAI ³E¹≪ ¸¹½A´I´U."));
                        return false;
                    }
                }
                else if (item->IsEfsun())
                {
                    if ((iEmptyCell = GetEmptyEfsunInventory(item->GetSize())) == -1)
                    {
                        sys_log(0, "No empty ds inventory pid %u size %ud itemid %u", GetPlayerID(), item->GetSize(), item->GetID());
                        ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼OAoCI°i AO´A ¾ÆAIAUAI ³E¹≪ ¸¹½A´I´U."));
                        return false;
                    }
                }
                else if (item->IsCicek())
                {
                    if ((iEmptyCell = GetEmptyCicekInventory(item->GetSize())) == -1)
                    {
                        sys_log(0, "No empty ds inventory pid %u size %ud itemid %u", GetPlayerID(), item->GetSize(), item->GetID());
                        ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼OAoCI°i AO´A ¾ÆAIAUAI ³E¹≪ ¸¹½A´I´U."));
                        return false;
                    }
                }
#endif
//k env sonu
                else
                {
                    if ((iEmptyCell = GetEmptyInventory(item->GetSize())) == -1)
                    {
                        sys_log(0, "No empty inventory pid %u size %ud itemid %u", GetPlayerID(), item->GetSize(), item->GetID());
                        ChatPacket(CHAT_TYPE_INFO, LC_TEXT("소지하고 있는 아이템이 너무 많습니다."));
                        return false;
                    }
                }

                item->RemoveFromGround();
                
                if (item->IsDragonSoul())
                    item->AddToCharacter(this, TItemPos(DRAGON_SOUL_INVENTORY, iEmptyCell));
//k env
#ifdef ENABLE_SPLIT_INVENTORY_SYSTEM
                else if (item->IsSkillBook())
                    item->AddToCharacter(this, TItemPos(INVENTORY, iEmptyCell));
                else if (item->IsUpgradeItem())
                    item->AddToCharacter(this, TItemPos(INVENTORY, iEmptyCell));
                else if (item->IsStone())
                    item->AddToCharacter(this, TItemPos(INVENTORY, iEmptyCell));
                else if (item->IsBox())
                    item->AddToCharacter(this, TItemPos(INVENTORY, iEmptyCell));
                else if (item->IsEfsun())
                    item->AddToCharacter(this, TItemPos(INVENTORY, iEmptyCell));
                else if (item->IsCicek())
                    item->AddToCharacter(this, TItemPos(INVENTORY, iEmptyCell));
#endif
//k env sonu
                else
                    item->AddToCharacter(this, TItemPos(INVENTORY, iEmptyCell));

                char szHint[32+1];
                snprintf(szHint, sizeof(szHint), "%s %u %u", item->GetName(), item->GetCount(), item->GetOriginalVnum());
                LogManager::instance().ItemLog(this, item, "GET", szHint);
                ChatPacket(CHAT_TYPE_INFO, LC_TEXT("아이템 획득: %s"), item->GetName());

                if (item->GetType() == ITEM_QUEST)
                    quest::CQuestManager::instance().PickupItem (GetPlayerID(), item);
            }

            //Motion(MOTION_PICKUP);
            return true;
        }
        else if (!IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_GIVE | ITEM_ANTIFLAG_DROP) && GetParty())
        {
            // 다른 파티원 소유권 아이템을 주으려고 한다면
            NPartyPickupDistribute::FFindOwnership funcFindOwnership(item);

            GetParty()->ForEachOnlineMember(funcFindOwnership);

            LPCHARACTER owner = funcFindOwnership.owner;

            int iEmptyCell;

            if (item->IsDragonSoul())
            {
                if (!(owner && (iEmptyCell = owner->GetEmptyDragonSoulInventory(item)) != -1))
                {
                    owner = this;

                    if ((iEmptyCell = GetEmptyDragonSoulInventory(item)) == -1)
                    {
                        owner->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("소지하고 있는 아이템이 너무 많습니다."));
                        return false;
                    }
                }
            }
//k env
#ifdef ENABLE_SPLIT_INVENTORY_SYSTEM
            else if (item->IsSkillBook())
            {
                if (!(owner && (iEmptyCell = owner->GetEmptySkillBookInventory(item->GetSize())) != -1))
                {
                    owner = this;

                    if ((iEmptyCell = GetEmptySkillBookInventory(item->GetSize())) == -1)
                    {
                        owner->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼OAoCI°i AO´A ¾ÆAIAUAI ³E¹≪ ¸¹½A´I´U."));
                        return false;
                    }
                }
            }
            else if (item->IsUpgradeItem())
            {
                if (!(owner && (iEmptyCell = owner->GetEmptyUpgradeItemsInventory(item->GetSize())) != -1))
                {
                    owner = this;

                    if ((iEmptyCell = GetEmptyUpgradeItemsInventory(item->GetSize())) == -1)
                    {
                        owner->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼OAoCI°i AO´A ¾ÆAIAUAI ³E¹≪ ¸¹½A´I´U."));
                        return false;
                    }
                }
            }
            else if (item->IsStone())
            {
                if (!(owner && (iEmptyCell = owner->GetEmptyStoneInventory(item->GetSize())) != -1))
                {
                    owner = this;

                    if ((iEmptyCell = GetEmptyStoneInventory(item->GetSize())) == -1)
                    {
                        owner->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼OAoCI°i AO´A ¾ÆAIAUAI ³E¹≪ ¸¹½A´I´U."));
                        return false;
                    }
                }
            }
            else if (item->IsBox())
            {
                if (!(owner && (iEmptyCell = owner->GetEmptyBoxInventory(item->GetSize())) != -1))
                {
                    owner = this;

                    if ((iEmptyCell = GetEmptyBoxInventory(item->GetSize())) == -1)
                    {
                        owner->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼OAoCI°i AO´A ¾ÆAIAUAI ³E¹≪ ¸¹½A´I´U."));
                        return false;
                    }
                }
            }
            else if (item->IsEfsun())
            {
                if (!(owner && (iEmptyCell = owner->GetEmptyEfsunInventory(item->GetSize())) != -1))
                {
                    owner = this;

                    if ((iEmptyCell = GetEmptyEfsunInventory(item->GetSize())) == -1)
                    {
                        owner->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼OAoCI°i AO´A ¾ÆAIAUAI ³E¹≪ ¸¹½A´I´U."));
                        return false;
                    }
                }
            }
            else if (item->IsCicek())
            {
                if (!(owner && (iEmptyCell = owner->GetEmptyCicekInventory(item->GetSize())) != -1))
                {
                    owner = this;

                    if ((iEmptyCell = GetEmptyCicekInventory(item->GetSize())) == -1)
                    {
                        owner->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼OAoCI°i AO´A ¾ÆAIAUAI ³E¹≪ ¸¹½A´I´U."));
                        return false;
                    }
                }
            }
#endif
//k env sonu
            else
            {
                if (!(owner && (iEmptyCell = owner->GetEmptyInventory(item->GetSize())) != -1))
                {
                    owner = this;

                    if ((iEmptyCell = GetEmptyInventory(item->GetSize())) == -1)
                    {
                        owner->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("소지하고 있는 아이템이 너무 많습니다."));
                        return false;
                    }
                }
            }

            item->RemoveFromGround();

            if (item->IsDragonSoul())
                item->AddToCharacter(owner, TItemPos(DRAGON_SOUL_INVENTORY, iEmptyCell));
//k env
#ifdef ENABLE_SPLIT_INVENTORY_SYSTEM
            else if (item->IsSkillBook())
                item->AddToCharacter(owner, TItemPos(INVENTORY, iEmptyCell));
            else if (item->IsUpgradeItem())
                item->AddToCharacter(owner, TItemPos(INVENTORY, iEmptyCell));
            else if (item->IsStone())
                item->AddToCharacter(owner, TItemPos(INVENTORY, iEmptyCell));
            else if (item->IsBox())
                item->AddToCharacter(owner, TItemPos(INVENTORY, iEmptyCell));
            else if (item->IsEfsun())
                item->AddToCharacter(owner, TItemPos(INVENTORY, iEmptyCell));
            else if (item->IsCicek())
                item->AddToCharacter(owner, TItemPos(INVENTORY, iEmptyCell));
#endif
//k env sonu
            else
                item->AddToCharacter(owner, TItemPos(INVENTORY, iEmptyCell));

            char szHint[32+1];
            snprintf(szHint, sizeof(szHint), "%s %u %u", item->GetName(), item->GetCount(), item->GetOriginalVnum());
            LogManager::instance().ItemLog(owner, item, "GET", szHint);

            if (owner == this)
                ChatPacket(CHAT_TYPE_INFO, LC_TEXT("아이템 획득: %s"), item->GetName());
            else
            {
                owner->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("아이템 획득: %s 님으로부터 %s"), GetName(), item->GetName());
                ChatPacket(CHAT_TYPE_INFO, LC_TEXT("아이템 전달: %s 님에게 %s"), owner->GetName(), item->GetName());
            }

            if (item->GetType() == ITEM_QUEST)
                quest::CQuestManager::instance().PickupItem (owner->GetPlayerID(), item);

            return true;
        }
    }

    return false;
}

ben problemin burdan kaynaklandığını düşünüyorum destek olan yardım eden herkese şimdiden teşekkürler
 
Çözüm
Client Source Açılır
PythonItem.h bulunur

classların üzerine eklenir
Kod:
Genişlet Daralt Kopyala
inline int32_t DISTANCE_APPROX(int32_t dx, int32_t dy)
{
    int32_t min, max;
    if (dx < 0)
        dx = -dx;
    if (dy < 0)
        dy = -dy;
    if (dx < dy)
    {
        min = dx;
        max = dy;
    }
    else
    {
        min = dy;
        max = dx;
    }
    return max - min;
}

pyton item cpp açılır ve fonksyionlar değiştirilir
Kod:
Genişlet Daralt Kopyala
bool CPythonItem::GetCloseMoney(const TPixelPosition &c_rPixelPosition, uint32_t*pdwItemID, uint32_t dwDistance)
{
    uint32_t dwCloseItemID = 0;
    uint32_t dwCloseItemDistance = dwDistance * dwDistance;
    TGroundItemInstanceMap::iterator i;
    for (i = m_GroundItemInstanceMap.begin(); i !=...
Client Source Açılır
PythonItem.h bulunur

classların üzerine eklenir
Kod:
Genişlet Daralt Kopyala
inline int32_t DISTANCE_APPROX(int32_t dx, int32_t dy)
{
    int32_t min, max;
    if (dx < 0)
        dx = -dx;
    if (dy < 0)
        dy = -dy;
    if (dx < dy)
    {
        min = dx;
        max = dy;
    }
    else
    {
        min = dy;
        max = dx;
    }
    return max - min;
}

pyton item cpp açılır ve fonksyionlar değiştirilir
Kod:
Genişlet Daralt Kopyala
bool CPythonItem::GetCloseMoney(const TPixelPosition &c_rPixelPosition, uint32_t*pdwItemID, uint32_t dwDistance)
{
    uint32_t dwCloseItemID = 0;
    uint32_t dwCloseItemDistance = dwDistance * dwDistance;
    TGroundItemInstanceMap::iterator i;
    for (i = m_GroundItemInstanceMap.begin(); i != m_GroundItemInstanceMap.end(); ++i)
    {
        TGroundItemInstance *pInstance = i->second;
        if (pInstance->dwVirtualNumber != VNUM_MONEY)
            continue;
        uint32_t dwxDistance = DISTANCE_APPROX(c_rPixelPosition.x, pInstance->v3EndPosition.x);
        uint32_t dwyDistance = DISTANCE_APPROX(c_rPixelPosition.y, pInstance->v3EndPosition.y);
        uint32_t dwDistance = uint32_t(dwxDistance * dwxDistance + dwyDistance * dwyDistance);
        if (dwDistance < dwCloseItemDistance)
        {
            dwCloseItemID = i->first;
            dwCloseItemDistance = dwDistance;
        }
    }
    if (dwCloseItemDistance > dwDistance * dwDistance)
        return false;
    *pdwItemID = dwCloseItemID;
    return false;
}
bool CPythonItem::GetCloseItem(const TPixelPosition &c_rPixelPosition, uint32_t*pdwItemID, uint32_t dwDistance)
{
    uint32_t dwCloseItemID = 0;
    uint32_t dwCloseItemDistance = dwDistance * dwDistance;
    TGroundItemInstanceMap::iterator i;
    for (i = m_GroundItemInstanceMap.begin(); i != m_GroundItemInstanceMap.end(); ++i)
    {
        TGroundItemInstance *pInstance = i->second;
        uint32_t dwxDistance = DISTANCE_APPROX(c_rPixelPosition.x, pInstance->v3EndPosition.x);
        uint32_t dwyDistance = DISTANCE_APPROX(c_rPixelPosition.y, pInstance->v3EndPosition.y);
        uint32_t dwDistance = uint32_t(dwxDistance * dwxDistance + dwyDistance * dwyDistance);
        if (dwDistance < dwCloseItemDistance)
        {
            dwCloseItemID = i->first;
            dwCloseItemDistance = dwDistance;
        }
    }
    if (dwCloseItemDistance > dwDistance * dwDistance)
        return false;
    *pdwItemID = dwCloseItemID;
    return true;
}
 
Çözüm
Durum
İçerik kilitlendiği için mesaj gönderimine kapatıldı.
Geri
Üst