Jump to content
  • 0

[Problema]Herrero


NazoX

Pregunta

Pues llevo tiempo preguntando en otros foros, y aquí y no he logrado recibir respuesta, algún compañero me ha dicho que haga un debug o un chat_noseque XD para ver que función hace y cual no,  pero no se como se hace. Mi problema es que tengo el almacén especial público, y lo arreglé, lo adapte, etc, y funciona a la perfección pero hasta el otro día que me dio por probar el herrero no me di cuenta. Resulta que cuando quiero mejorar un ítem no me va el herrero, ni las bendiciones, metales, etc. Algo curioso porque no se ha editado ninguna línea de do_refine, o todo lo relacionado con el herrero, ya que no se ha remplazado ninguna línea, no tengo ningún sysser ni un game.core, así que no logro encontrar el error, este es el char_item.cpp  del sistema :

Debes iniciar sesión para ver el contenido del enlace en esta publicación.

No tengo sysser ni en db,ni ch1, ni cliente, ni game.core ni nada :S alguna idea? gracias al que me eche un cable.

 

 

//1. Search:
LPITEM CHARACTER::GetInventoryItem(WORD wCell) const
{
    return GetItem(TItemPos(INVENTORY, wCell));
}
//1. Add after:
#ifdef ENABLE_SPECIAL_STORAGE
LPITEM CHARACTER::GetUpgradeInventoryItem(WORD wCell) const
{
    return GetItem(TItemPos(UPGRADE_INVENTORY, wCell));
}
LPITEM CHARACTER::GetBookInventoryItem(WORD wCell) const
{
    return GetItem(TItemPos(BOOK_INVENTORY, wCell));
}
LPITEM CHARACTER::GetStoneInventoryItem(WORD wCell) const
{
    return GetItem(TItemPos(STONE_INVENTORY, wCell));
}
#endif


//3. Search: function ( LPITEM CHARACTER::GetItem )
    case DRAGON_SOUL_INVENTORY:
        if (wCell >= DRAGON_SOUL_INVENTORY_MAX_NUM)
        {
            sys_err("CHARACTER::GetInventoryItem: invalid DS item cell %d", wCell);
            return NULL;
        }
        return m_pointsInstant.pDSItems[wCell];
//2. Add after:
#ifdef ENABLE_SPECIAL_STORAGE
    case UPGRADE_INVENTORY:
        if (wCell >= SPECIAL_INVENTORY_MAX_NUM)
        {
            sys_err("CHARACTER::GetInventoryItem: invalid SSU item cell %d", wCell);
            return NULL;
        }
        return m_pointsInstant.pSSUItems[wCell];
    case BOOK_INVENTORY:
        if (wCell >= SPECIAL_INVENTORY_MAX_NUM)
        {
            sys_err("CHARACTER::GetInventoryItem: invalid SSB item cell %d", wCell);
            return NULL;
        }
        return m_pointsInstant.pSSBItems[wCell];
    case STONE_INVENTORY:
        if (wCell >= SPECIAL_INVENTORY_MAX_NUM)
        {
            sys_err("CHARACTER::GetInventoryItem: invalid SSS item cell %d", wCell);
            return NULL;
        }
        return m_pointsInstant.pSSSItems[wCell];
#endif


//3. Search: function ( void CHARACTER::SetItem )
    default:
        sys_err ("Invalid Inventory type %d", window_type);
        return;
//3. Add before:
#ifdef ENABLE_SPECIAL_STORAGE    
    case UPGRADE_INVENTORY:
        {
            LPITEM pOld = m_pointsInstant.pSSUItems[wCell];

            if (pOld)
            {
                if (wCell < SPECIAL_INVENTORY_MAX_NUM)
                {
                    for (int i = 0; i < pOld->GetSize(); ++i)
                    {
                        int p = wCell + (i * 5);

                        if (p >= SPECIAL_INVENTORY_MAX_NUM)
                            continue;

                        if (m_pointsInstant.pSSUItems[p] && m_pointsInstant.pSSUItems[p] != pOld)
                            continue;

                        m_pointsInstant.wSSUItemGrid[p] = 0;
                    }
                }
                else
                    m_pointsInstant.wSSUItemGrid[wCell] = 0;
            }

            if (pItem)
            {
                if (wCell >= SPECIAL_INVENTORY_MAX_NUM)
                {
                    sys_err("CHARACTER::SetItem: invalid SSU item cell %d", wCell);
                    return;
                }

                if (wCell < SPECIAL_INVENTORY_MAX_NUM)
                {
                    for (int i = 0; i < pItem->GetSize(); ++i)
                    {
                        int p = wCell + (i * 5);

                        if (p >= SPECIAL_INVENTORY_MAX_NUM)
                            continue;

                        m_pointsInstant.wSSUItemGrid[p] = wCell + 1;
                    }
                }
                else
                    m_pointsInstant.wSSUItemGrid[wCell] = wCell + 1;
            }

            m_pointsInstant.pSSUItems[wCell] = pItem;
        }
        break;
    case BOOK_INVENTORY:
        {
            LPITEM pOld = m_pointsInstant.pSSBItems[wCell];

            if (pOld)
            {
                if (wCell < SPECIAL_INVENTORY_MAX_NUM)
                {
                    for (int i = 0; i < pOld->GetSize(); ++i)
                    {
                        int p = wCell + (i * 5);

                        if (p >= SPECIAL_INVENTORY_MAX_NUM)
                            continue;

                        if (m_pointsInstant.pSSBItems[p] && m_pointsInstant.pSSBItems[p] != pOld)
                            continue;

                        m_pointsInstant.wSSBItemGrid[p] = 0;
                    }
                }
                else
                    m_pointsInstant.wSSBItemGrid[wCell] = 0;
            }

            if (pItem)
            {
                if (wCell >= SPECIAL_INVENTORY_MAX_NUM)
                {
                    sys_err("CHARACTER::SetItem: invalid SSB item cell %d", wCell);
                    return;
                }

                if (wCell < SPECIAL_INVENTORY_MAX_NUM)
                {
                    for (int i = 0; i < pItem->GetSize(); ++i)
                    {
                        int p = wCell + (i * 5);

                        if (p >= SPECIAL_INVENTORY_MAX_NUM)
                            continue;

                        m_pointsInstant.wSSBItemGrid[p] = wCell + 1;
                    }
                }
                else
                    m_pointsInstant.wSSBItemGrid[wCell] = wCell + 1;
            }

            m_pointsInstant.pSSBItems[wCell] = pItem;
        }
        break;
    case STONE_INVENTORY:
        {
            LPITEM pOld = m_pointsInstant.pSSSItems[wCell];

            if (pOld)
            {
                if (wCell < SPECIAL_INVENTORY_MAX_NUM)
                {
                    for (int i = 0; i < pOld->GetSize(); ++i)
                    {
                        int p = wCell + (i * 5);

                        if (p >= SPECIAL_INVENTORY_MAX_NUM)
                            continue;

                        if (m_pointsInstant.pSSSItems[p] && m_pointsInstant.pSSSItems[p] != pOld)
                            continue;

                        m_pointsInstant.wSSSItemGrid[p] = 0;
                    }
                }
                else
                    m_pointsInstant.wSSSItemGrid[wCell] = 0;
            }

            if (pItem)
            {
                if (wCell >= SPECIAL_INVENTORY_MAX_NUM)
                {
                    sys_err("CHARACTER::SetItem: invalid SSB item cell %d", wCell);
                    return;
                }

                if (wCell < SPECIAL_INVENTORY_MAX_NUM)
                {
                    for (int i = 0; i < pItem->GetSize(); ++i)
                    {
                        int p = wCell + (i * 5);

                        if (p >= SPECIAL_INVENTORY_MAX_NUM)
                            continue;

                        m_pointsInstant.wSSSItemGrid[p] = wCell + 1;
                    }
                }
                else
                    m_pointsInstant.wSSSItemGrid[wCell] = wCell + 1;
            }

            m_pointsInstant.pSSSItems[wCell] = pItem;
        }
        break;
#endif


//4.Search: function ( void CHARACTER::SetItem )
        case DRAGON_SOUL_INVENTORY:
            pItem->SetWindow(DRAGON_SOUL_INVENTORY);
            break;
//4. Add after:
#ifdef ENABLE_SPECIAL_STORAGE
        case UPGRADE_INVENTORY:
            pItem->SetWindow(UPGRADE_INVENTORY);
            break;
        case BOOK_INVENTORY:
            pItem->SetWindow(BOOK_INVENTORY);
            break;
        case STONE_INVENTORY:
            pItem->SetWindow(STONE_INVENTORY);
            break;
#endif


//5. Search: function ( void CHARACTER::ClearItem )
    for (i = 0; i < DRAGON_SOUL_INVENTORY_MAX_NUM; ++i)
    {
        if ((item = GetItem(TItemPos(DRAGON_SOUL_INVENTORY, i))))
        {
            item->SetSkipSave(true);
            ITEM_MANAGER::instance().FlushDelayedSave(item);

            item->RemoveFromCharacter();
            M2_DESTROY_ITEM(item);
        }
    }
//5. Add after:
#ifdef ENABLE_SPECIAL_STORAGE
    for (i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
    {
        if ((item = GetItem(TItemPos(UPGRADE_INVENTORY, i))))
        {
            item->SetSkipSave(true);
            ITEM_MANAGER::instance().FlushDelayedSave(item);

            item->RemoveFromCharacter();
            M2_DESTROY_ITEM(item);
        }
    }
    for (i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
    {
        if ((item = GetItem(TItemPos(BOOK_INVENTORY, i))))
        {
            item->SetSkipSave(true);
            ITEM_MANAGER::instance().FlushDelayedSave(item);

            item->RemoveFromCharacter();
            M2_DESTROY_ITEM(item);
        }
    }
    for (i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
    {
        if ((item = GetItem(TItemPos(STONE_INVENTORY, i))))
        {
            item->SetSkipSave(true);
            ITEM_MANAGER::instance().FlushDelayedSave(item);

            item->RemoveFromCharacter();
            M2_DESTROY_ITEM(item);
        }
    }
#endif


//6. Search: function ( bool CHARACTER::IsEmptyItemGrid )
                    if (m_pointsInstant.bItemGrid[p])
                        if (m_pointsInstant.wDSItemGrid[p] != iExceptionCell)
                            return false;
                }
                while (++j < bSize);

                return true;
            }
        }
//6. Add after:
#ifdef ENABLE_SPECIAL_STORAGE
        break;
    case UPGRADE_INVENTORY:
        {
            WORD wCell = Cell.cell;
            if (wCell >= SPECIAL_INVENTORY_MAX_NUM)
                return false;

            iExceptionCell++;

            if (m_pointsInstant.wSSUItemGrid[wCell])
            {
                if (m_pointsInstant.wSSUItemGrid[wCell] == iExceptionCell)
                {
                    if (bSize == 1)
                        return true;

                    int j = 1;

                    do
                    {
                        int p = wCell + (5 * j);

                        if (p >= SPECIAL_INVENTORY_MAX_NUM)
                            return false;

                        if (m_pointsInstant.wSSUItemGrid[p])
                            if (m_pointsInstant.wSSUItemGrid[p] != iExceptionCell)
                                return false;
                    }
                    while (++j < bSize);

                    return true;
                }
                else
                    return false;
            }

            if (1 == bSize)
                return true;
            else
            {
                int j = 1;

                do
                {
                    int p = wCell + (5 * j);

                    if (p >= SPECIAL_INVENTORY_MAX_NUM)
                        return false;

                    if (m_pointsInstant.bItemGrid[p]) // old bItemGrid
                        if (m_pointsInstant.wSSUItemGrid[p] != iExceptionCell)
                            return false;
                }
                while (++j < bSize);

                return true;
            }
        }
        break;
    case BOOK_INVENTORY:
        {
            WORD wCell = Cell.cell;
            if (wCell >= SPECIAL_INVENTORY_MAX_NUM)
                return false;

            iExceptionCell++;

            if (m_pointsInstant.wSSBItemGrid[wCell])
            {
                if (m_pointsInstant.wSSBItemGrid[wCell] == iExceptionCell)
                {
                    if (bSize == 1)
                        return true;

                    int j = 1;

                    do
                    {
                        int p = wCell + (5 * j);

                        if (p >= SPECIAL_INVENTORY_MAX_NUM)
                            return false;

                        if (m_pointsInstant.wSSBItemGrid[p])
                            if (m_pointsInstant.wSSBItemGrid[p] != iExceptionCell)
                                return false;
                    }
                    while (++j < bSize);

                    return true;
                }
                else
                    return false;
            }

            if (1 == bSize)
                return true;
            else
            {
                int j = 1;

                do
                {
                    int p = wCell + (5 * j);

                    if (p >= SPECIAL_INVENTORY_MAX_NUM)
                        return false;

                    if (m_pointsInstant.bItemGrid[p]) // old bItemGrid
                        if (m_pointsInstant.wSSBItemGrid[p] != iExceptionCell)
                            return false;
                }
                while (++j < bSize);

                return true;
            }
        }
    case STONE_INVENTORY:
        {
            WORD wCell = Cell.cell;
            if (wCell >= SPECIAL_INVENTORY_MAX_NUM)
                return false;

            iExceptionCell++;

            if (m_pointsInstant.wSSSItemGrid[wCell])
            {
                if (m_pointsInstant.wSSSItemGrid[wCell] == iExceptionCell)
                {
                    if (bSize == 1)
                        return true;

                    int j = 1;

                    do
                    {
                        int p = wCell + (5 * j);

                        if (p >= SPECIAL_INVENTORY_MAX_NUM)
                            return false;

                        if (m_pointsInstant.wSSSItemGrid[p])
                            if (m_pointsInstant.wSSSItemGrid[p] != iExceptionCell)
                                return false;
                    }
                    while (++j < bSize);

                    return true;
                }
                else
                    return false;
            }

            if (1 == bSize)
                return true;
            else
            {
                int j = 1;

                do
                {
                    int p = wCell + (5 * j);

                    if (p >= SPECIAL_INVENTORY_MAX_NUM)
                        return false;

                    if (m_pointsInstant.bItemGrid[p]) // old bItemGrid
                        if (m_pointsInstant.wSSSItemGrid[p] != iExceptionCell)
                            return false;
                }
                while (++j < bSize);

                return true;
            }
        }
#endif


//7. Search:
void CHARACTER::CopyDragonSoulItemGrid(std::vector<WORD>& vDragonSoulItemGrid) const
{
    vDragonSoulItemGrid.resize(DRAGON_SOUL_INVENTORY_MAX_NUM);

    std::copy(m_pointsInstant.wDSItemGrid, m_pointsInstant.wDSItemGrid + DRAGON_SOUL_INVENTORY_MAX_NUM, vDragonSoulItemGrid.begin());
}
//7. Add after:
#ifdef ENABLE_SPECIAL_STORAGE
int CHARACTER::GetSameUpgradeInventory(LPITEM pItem) const
{
    if (NULL == pItem || !pItem->IsUpgradeItem())
        return -1;

    for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
        if (GetUpgradeInventoryItem(i)->GetVnum() == pItem->GetVnum())
            return i;

    return -1;
}
int CHARACTER::GetSameBookInventory(LPITEM pItem) const
{
    if (NULL == pItem || !pItem->IsBook())
        return -1;

    for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
        if (GetBookInventoryItem(i)->GetVnum() == pItem->GetVnum() && GetBookInventoryItem(i)->GetSocket(0) == pItem->GetSocket(0))
            return i;

    return -1;
}
int CHARACTER::GetSameStoneInventory(LPITEM pItem) const
{
    if (NULL == pItem || !pItem->IsStone())
        return -1;

    for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
        if (GetStoneInventoryItem(i)->GetVnum() == pItem->GetVnum())
            return i;

    return -1;
}
int CHARACTER::GetEmptyUpgradeInventory(LPITEM pItem) const
{
    if (NULL == pItem || !pItem->IsUpgradeItem())
        return -1;
    
    BYTE bSize = pItem->GetSize();
    
    for ( int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
        if (IsEmptyItemGrid(TItemPos (UPGRADE_INVENTORY, i), bSize))
            return i;
        
    return -1;
}
int CHARACTER::GetEmptyBookInventory(LPITEM pItem) const
{
    if (NULL == pItem || !pItem->IsBook())
        return -1;
    
    BYTE bSize = pItem->GetSize();
    
    for ( int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
        if (IsEmptyItemGrid(TItemPos (BOOK_INVENTORY, i), bSize))
            return i;
        
    return -1;
}
int CHARACTER::GetEmptyStoneInventory(LPITEM pItem) const
{
    if (NULL == pItem || !pItem->IsStone())
        return -1;
    
    BYTE bSize = pItem->GetSize();
    
    for ( int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
        if (IsEmptyItemGrid(TItemPos (STONE_INVENTORY, i), bSize))
            return i;
        
    return -1;
}
#endif


//8. Search: function ( bool CHARACTER::MoveItem )
        else if (DRAGON_SOUL_INVENTORY == DestCell.window_type)
            return false;
//8. Add after:
#ifdef ENABLE_SPECIAL_STORAGE
        if (!item->IsUpgradeItem() && UPGRADE_INVENTORY == DestCell.window_type)
            return false;
        
        if (!item->IsBook() && BOOK_INVENTORY == DestCell.window_type)
            return false;
        
        if (!item->IsStone() && STONE_INVENTORY == DestCell.window_type)
            return false;
#endif


//9. Search: function ( bool CHARACTER::PickupItem )
                                    quest::CQuestManager::instance().PickupItem (GetPlayerID(), item2);
                                return true;
                            }
                        }
                    }

                    item->SetCount(bCount);
                }
//9. Add after:
#ifdef ENABLE_SPECIAL_STORAGE
                if (item->IsUpgradeItem() && item->IsStackable() && !IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_STACK))
                {
                    BYTE bCount = item->GetCount();

                    for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
                    {
                        LPITEM item2 = GetUpgradeInventoryItem(i);

                        if (!item2)
                            continue;

                        if (item2->GetVnum() == item->GetVnum())
                        {

                            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);
                                return true;
                            }
                        }
                    }

                    item->SetCount(bCount);
                }
                else if (item->IsBook() && item->IsStackable() && !IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_STACK))
                {
                    BYTE bCount = item->GetCount();

                    for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
                    {
                        LPITEM item2 = GetBookInventoryItem(i);

                        if (!item2)
                            continue;

                        if (item2->GetVnum() == item->GetVnum())
                        {
                            //SKILL BOOK FIX: ITEM_STACKABLE
                            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);
                                return true;
                            }
                        }
                    }

                    item->SetCount(bCount);
                }
                else if (item->IsStone() && item->IsStackable() && !IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_STACK))
                {
                    BYTE bCount = item->GetCount();

                    for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
                    {
                        LPITEM item2 = GetStoneInventoryItem(i);

                        if (!item2)
                            continue;

                        if (item2->GetVnum() == item->GetVnum())
                        {

                            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);
                                return true;
                            }
                        }
                    }

                    item->SetCount(bCount);
                }
#endif


//10. Search: function ( bool CHARACTER::PickupItem )
                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;
                    }
                }
//10. Add after:
#ifdef ENABLE_SPECIAL_STORAGE
                else if (item->IsUpgradeItem())
                {
                    if ((iEmptyCell = GetEmptyUpgradeInventory(item)) == -1)
                    {
                        sys_log(0, "No empty ssu inventory pid %u size %ud itemid %u", GetPlayerID(), item->GetSize(), item->GetID());
                        ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼ÒÁöÇÏ°í ÀÖ´Â ¾ÆÀÌÅÛÀÌ ³Ê¹« ¸¹½À´Ï´Ù."));
                        return false;
                    }
                }
                else if (item->IsBook())
                {
                    if ((iEmptyCell = GetEmptyBookInventory(item)) == -1)
                    {
                        sys_log(0, "No empty ssu inventory pid %u size %ud itemid %u", GetPlayerID(), item->GetSize(), item->GetID());
                        ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼ÒÁöÇÏ°í ÀÖ´Â ¾ÆÀÌÅÛÀÌ ³Ê¹« ¸¹½À´Ï´Ù."));
                        return false;
                    }
                }
                else if (item->IsStone())
                {
                    if ((iEmptyCell = GetEmptyStoneInventory(item)) == -1)
                    {
                        sys_log(0, "No empty ssu inventory pid %u size %ud itemid %u", GetPlayerID(), item->GetSize(), item->GetID());
                        ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼ÒÁöÇÏ°í ÀÖ´Â ¾ÆÀÌÅÛÀÌ ³Ê¹« ¸¹½À´Ï´Ù."));
                        return false;
                    }
                }
#endif


//11. Search: function ( bool CHARACTER::PickupItem )
                if (item->IsDragonSoul())
                    item->AddToCharacter(this, TItemPos(DRAGON_SOUL_INVENTORY, iEmptyCell));
//11. Add after:
#ifdef ENABLE_SPECIAL_STORAGE
                else if (item->IsUpgradeItem())
                    item->AddToCharacter(this, TItemPos(UPGRADE_INVENTORY, iEmptyCell));
                else if (item->IsBook())
                    item->AddToCharacter(this, TItemPos(BOOK_INVENTORY, iEmptyCell));
                else if (item->IsStone())
                    item->AddToCharacter(this, TItemPos(STONE_INVENTORY, iEmptyCell));
#endif


//12. Search: function ( bool CHARACTER::PickupItem )
            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;
                    }
                }
            }
//12. Add after:
#ifdef ENABLE_SPECIAL_STORAGE
            else if (item->IsUpgradeItem())
            {
                if (!(owner && (iEmptyCell = owner->GetEmptyUpgradeInventory(item)) != -1))
                {
                    owner = this;

                    if ((iEmptyCell = GetEmptyUpgradeInventory(item)) == -1)
                    {
                        owner->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼ÒÁöÇÏ°í ÀÖ´Â ¾ÆÀÌÅÛÀÌ ³Ê¹« ¸¹½À´Ï´Ù."));
                        return false;
                    }
                }
            }
            else if (item->IsBook())
            {
                if (!(owner && (iEmptyCell = owner->GetEmptyBookInventory(item)) != -1))
                {
                    owner = this;

                    if ((iEmptyCell = GetEmptyBookInventory(item)) == -1)
                    {
                        owner->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼ÒÁöÇÏ°í ÀÖ´Â ¾ÆÀÌÅÛÀÌ ³Ê¹« ¸¹½À´Ï´Ù."));
                        return false;
                    }
                }
            }
            else if (item->IsStone())
            {
                if (!(owner && (iEmptyCell = owner->GetEmptyStoneInventory(item)) != -1))
                {
                    owner = this;

                    if ((iEmptyCell = GetEmptyStoneInventory(item)) == -1)
                    {
                        owner->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼ÒÁöÇÏ°í ÀÖ´Â ¾ÆÀÌÅÛÀÌ ³Ê¹« ¸¹½À´Ï´Ù."));
                        return false;
                    }
                }
            }
#endif


//13. Search: function ( bool CHARACTER::PickupItem )
            if (item->IsDragonSoul())
                item->AddToCharacter(owner, TItemPos(DRAGON_SOUL_INVENTORY, iEmptyCell));
//13. Add after:
#ifdef ENABLE_SPECIAL_STORAGE
            else if (item->IsUpgradeItem())
                item->AddToCharacter(owner, TItemPos(UPGRADE_INVENTORY, iEmptyCell));
            else if (item->IsBook())
                item->AddToCharacter(owner, TItemPos(BOOK_INVENTORY, iEmptyCell));
            else if (item->IsStone())
                item->AddToCharacter(owner, TItemPos(STONE_INVENTORY, iEmptyCell));
#endif


//14. Search function : int CHARACTER::CountSpecifyItem
//14. Replace with :
int CHARACTER::CountSpecifyItem(DWORD vnum) const
{
    int    count = 0;
    LPITEM item;

    for (int i = 0; i < INVENTORY_MAX_NUM; ++i)
    {
        item = GetInventoryItem(i);
        if (NULL != item && item->GetVnum() == vnum)
        {
            // 개인 상점에 등록된 물건이면 넘어간다.
            if (m_pkMyShop && m_pkMyShop->IsSellingItem(item->GetID()))
            {
                continue;
            }
            else
            {
                count += item->GetCount();
            }
        }
    }
    
#ifdef ENABLE_SPECIAL_STORAGE
    for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
    {
        item = GetUpgradeInventoryItem(i);
        if (NULL != item && item->GetVnum() == vnum)
        {
            if (m_pkMyShop && m_pkMyShop->IsSellingItem(item->GetID()))
                continue;
            else
                count += item->GetCount();
        }
    }
    for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
    {
        item = GetBookInventoryItem(i);
        if (NULL != item && item->GetVnum() == vnum)
        {
            if (m_pkMyShop && m_pkMyShop->IsSellingItem(item->GetID()))
                continue;
            else
                count += item->GetCount();
        }
    }
    for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
    {
        item = GetStoneInventoryItem(i);
        if (NULL != item && item->GetVnum() == vnum)
        {
            if (m_pkMyShop && m_pkMyShop->IsSellingItem(item->GetID()))
                continue;
            else
                count += item->GetCount();
        }
    }
#endif

    return count;
}


//15. Search: function ( void CHARACTER::RemoveSpecifyItem )
        if (vnum >= 80003 && vnum <= 80007)
            LogManager::instance().GoldBarLog(GetPlayerID(), GetInventoryItem(i)->GetID(), QUEST, "RemoveSpecifyItem");

        if (count >= GetInventoryItem(i)->GetCount())
        {
            count -= GetInventoryItem(i)->GetCount();
            GetInventoryItem(i)->SetCount(0);

            if (0 == count)
                return;
        }
        else
        {
            GetInventoryItem(i)->SetCount(GetInventoryItem(i)->GetCount() - count);
            return;
        }
    }
//15. Add after:
#ifdef ENABLE_SPECIAL_STORAGE
    for (UINT i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
    {
        if (NULL == GetUpgradeInventoryItem(i))
            continue;

        if (GetUpgradeInventoryItem(i)->GetVnum() != vnum)
            continue;

        if(m_pkMyShop)
        {
            bool isItemSelling = m_pkMyShop->IsSellingItem(GetUpgradeInventoryItem(i)->GetID());
            if (isItemSelling)
                continue;
        }

        if (count >= GetUpgradeInventoryItem(i)->GetCount())
        {
            count -= GetUpgradeInventoryItem(i)->GetCount();
            GetUpgradeInventoryItem(i)->SetCount(0);

            if (0 == count)
                return;
        }
        else
        {
            GetUpgradeInventoryItem(i)->SetCount(GetUpgradeInventoryItem(i)->GetCount() - count);
            return;
        }
    }
    for (UINT i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
    {
        if (NULL == GetBookInventoryItem(i))
            continue;

        if (GetBookInventoryItem(i)->GetVnum() != vnum)
            continue;

        if(m_pkMyShop)
        {
            bool isItemSelling = m_pkMyShop->IsSellingItem(GetBookInventoryItem(i)->GetID());
            if (isItemSelling)
                continue;
        }

        if (count >= GetBookInventoryItem(i)->GetCount())
        {
            count -= GetBookInventoryItem(i)->GetCount();
            GetBookInventoryItem(i)->SetCount(0);

            if (0 == count)
                return;
        }
        else
        {
            GetBookInventoryItem(i)->SetCount(GetBookInventoryItem(i)->GetCount() - count);
            return;
        }
    }
    for (UINT i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
    {
        if (NULL == GetStoneInventoryItem(i))
            continue;

        if (GetStoneInventoryItem(i)->GetVnum() != vnum)
            continue;

        if(m_pkMyShop)
        {
            bool isItemSelling = m_pkMyShop->IsSellingItem(GetStoneInventoryItem(i)->GetID());
            if (isItemSelling)
                continue;
        }

        if (count >= GetStoneInventoryItem(i)->GetCount())
        {
            count -= GetStoneInventoryItem(i)->GetCount();
            GetStoneInventoryItem(i)->SetCount(0);

            if (0 == count)
                return;
        }
        else
        {
            GetStoneInventoryItem(i)->SetCount(GetStoneInventoryItem(i)->GetCount() - count);
            return;
        }
    }
#endif


//16. Search: function ( void CHARACTER::AutoGiveItem )
    if (item->IsDragonSoul())
    {
        cell = GetEmptyDragonSoulInventory(item);
    }
//16. Add after:
#ifdef ENABLE_SPECIAL_STORAGE
    else if (item->IsUpgradeItem())
    {
        cell = GetEmptyUpgradeInventory(item);
    }
    else if (item->IsBook())
    {
        cell = GetEmptyBookInventory(item);
    }
    else if (item->IsStone())
    {
        cell = GetEmptyStoneInventory(item);
    }
#endif


//17. Search: function ( void CHARACTER::AutoGiveItem )
        if (item->IsDragonSoul())
            item->AddToCharacter(this, TItemPos(DRAGON_SOUL_INVENTORY, cell));
//17. Add after:
#ifdef ENABLE_SPECIAL_STORAGE
        else if (item->IsUpgradeItem())
            item->AddToCharacter(this, TItemPos(UPGRADE_INVENTORY, cell));
        else if (item->IsBook())
            item->AddToCharacter(this, TItemPos(BOOK_INVENTORY, cell));
        else if (item->IsStone())
            item->AddToCharacter(this, TItemPos(STONE_INVENTORY, cell));
#endif


//Search this is function:
LPITEM CHARACTER::AutoGiveItem(DWORD dwItemVnum, BYTE bCount, int iRarePct, bool bMsg)
{
    TItemTable * p = ITEM_MANAGER::instance().GetTable(dwItemVnum);

    if (!p)
        return NULL;

    DBManager::instance().SendMoneyLog(MONEY_LOG_DROP, dwItemVnum, bCount);

    if (p->dwFlags & ITEM_FLAG_STACKABLE && p->bType != ITEM_BLEND)
    {

//Add under:
#ifdef ENABLE_SPECIAL_STORAGE
        if (p->bType == ITEM_MATERIAL && p->bSubType == MATERIAL_LEATHER) //upgrade item
        {
            for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
            {
                LPITEM item = GetUpgradeInventoryItem(i);
                
                if (!item)
                    continue;
                
                if (item->GetVnum() == dwItemVnum && FN_check_item_socket(item))
                {
                    if (IS_SET(p->dwFlags, ITEM_FLAG_MAKECOUNT))
                    {
                        if (bCount < p->alValues[1])
                            bCount = p->alValues[1];
                    }

                    BYTE bCount2 = MIN(ITEM_MAX_COUNT - item->GetCount(), bCount);
                    bCount -= bCount2;

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

                    if (bCount == 0)
                    {
                        if (bMsg)
                            ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¾ÆÀÌÅÛ È¹µæ: %s"), item->GetName());

                        return item;
                    }
                }
            }
        }
        else if (dwItemVnum == 50300) //book item
        {
        }
        else if (p->bType == ITEM_METIN && p->bSubType == METIN_NORMAL) //stone item
        {
            for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
            {
                LPITEM item = GetStoneInventoryItem(i);
                
                if (!item)
                    continue;
                
                if (item->GetVnum() == dwItemVnum && FN_check_item_socket(item))
                {
                    if (IS_SET(p->dwFlags, ITEM_FLAG_MAKECOUNT))
                    {
                        if (bCount < p->alValues[1])
                            bCount = p->alValues[1];
                    }

                    BYTE bCount2 = MIN(ITEM_MAX_COUNT - item->GetCount(), bCount);
                    bCount -= bCount2;

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

                    if (bCount == 0)
                    {
                        if (bMsg)
                            ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¾ÆÀÌÅÛ È¹µæ: %s"), item->GetName());

                        return item;
                    }
                }
            }
        }
        else
        {
#endif

//Search this:
    }
    LPITEM item = ITEM_MANAGER::instance().CreateItem(dwItemVnum, bCount, 0, true);

//Add before:
#ifdef ENABLE_SPECIAL_STORAGE
        }
#endif

//Search this:
    LPITEM item = ITEM_MANAGER::instance().CreateItem(dwItemVnum, bCount, 0, true);

    if (!item)
    {
        sys_err("cannot create item by vnum %u (name: %s)", dwItemVnum, GetName());
        return NULL;
    }
    
//Add under:
#ifdef ENABLE_SPECIAL_STORAGE
    if (dwItemVnum == 50300)
    {
        for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
        {
            LPITEM book = GetBookInventoryItem(i);
            
            if (!book)
                continue;
            
            if (book->GetVnum() == dwItemVnum && book->GetSocket(0) == item->GetSocket(0))
            {
                if (IS_SET(p->dwFlags, ITEM_FLAG_MAKECOUNT))
                {
                    if (bCount < p->alValues[1])
                        bCount = p->alValues[1];
                }

                BYTE bCount2 = MIN(ITEM_MAX_COUNT - book->GetCount(), bCount);
                bCount -= bCount2;

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

                if (bCount == 0)
                {
                    if (bMsg)
                        ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¾ÆÀÌÅÛ È¹µæ: %s"), book->GetName());

                    M2_DESTROY_ITEM(item);
                    return book;
                }
            }
        }
    }
#endif

//Search this:
    int iEmptyCell;
    if (item->IsDragonSoul())
    {
        iEmptyCell = GetEmptyDragonSoulInventory(item);
    }
    
//Add under:
#ifdef ENABLE_SPECIAL_STORAGE
    else if (item->IsUpgradeItem())
    {
        iEmptyCell = GetEmptyUpgradeInventory(item);
    }
    else if (item->IsBook())
    {
        iEmptyCell = GetEmptyBookInventory(item);
    }
    else if (item->IsStone())
    {
        iEmptyCell = GetEmptyStoneInventory(item);
    }
#endif

//Search this:
        if (item->IsDragonSoul())
            item->AddToCharacter(this, TItemPos(DRAGON_SOUL_INVENTORY, iEmptyCell));

//Add under:
#ifdef ENABLE_SPECIAL_STORAGE
        else if (item->IsUpgradeItem())
        {
            item->AddToCharacter(this, TItemPos(UPGRADE_INVENTORY, iEmptyCell));
        }
        else if (item->IsBook())
        {
            item->AddToCharacter(this, TItemPos(BOOK_INVENTORY, iEmptyCell));
        }
        else if (item->IsStone())
        {
            item->AddToCharacter(this, TItemPos(STONE_INVENTORY, iEmptyCell));
        }
#endif


//20. Search: function ( bool CHARACTER::IsValidItemPosition )
    case DRAGON_SOUL_INVENTORY:
        return cell < (DRAGON_SOUL_INVENTORY_MAX_NUM);
//20. Add after:
#ifdef ENABLE_SPECIAL_STORAGE
    case UPGRADE_INVENTORY:
    case BOOK_INVENTORY:
    case STONE_INVENTORY:
        return cell < (SPECIAL_INVENTORY_MAX_NUM);
#endif

 

Enlace para comentar
Compartir en otros sitios

10 respuestas a esta pregunta

Mensajes recomendados

  • 0
hace 16 minutos, PACI dijo:

Pon un spoiler.

Supongo que SPECIAL_INVENTORY_MAX_NUM es mayor que INVENTORY_MAX_NUM, por lo que el packet recibido (considerando que se envia) nunca llegará a CHARACTER::DoRefine().
Comprueba lo que dije en CInputMain::Refine().

edit: ahora pongo spoiler

edit2: lo único diferente que veo, es que yo puse que el g_bItemCountLimit en 200 porque no me funcionaba con la función g_bItemCountLimit , lo demás lo veo igual  tanto el SPECIAL_INVENTORY_MAX_NUM como  INVENTORY_MAX_NUM tengo lo siguiente:  

int p = wCell + (i * 5);

 

y en CInputMain::Refine()  tengo esto if (p->type == 255) y if (500 <= item->GetRefineSet()) no se si te referias a esto, lo he comprobado en el input_main.cpp 

Enlace para comentar
Compartir en otros sitios

  • 0
hace 23 minutos, PACI dijo:

Pega la función entera.

 

 

mi char_item.cpp:

case EQUIPMENT:
        {
            if (wCell >= INVENTORY_AND_EQUIP_SLOT_MAX)
            {
                sys_err("CHARACTER::SetItem: invalid item cell %d", wCell);
                return;
            }

            LPITEM pOld = m_pointsInstant.pItems[wCell];

            if (pOld)
            {
                if (wCell < INVENTORY_MAX_NUM)
                {
                    for (int i = 0; i < pOld->GetSize(); ++i)
                    {
                        int p = wCell + (i * 5);

                        if (p >= INVENTORY_MAX_NUM)
                            continue;

                        if (m_pointsInstant.pItems[p] && m_pointsInstant.pItems[p] != pOld)
                            continue;

                        m_pointsInstant.bItemGrid[p] = 0;
                    }
                }
                else
                    m_pointsInstant.bItemGrid[wCell] = 0;
            }

            if (pItem)
            {
                if (wCell < INVENTORY_MAX_NUM)
                {
                    for (int i = 0; i < pItem->GetSize(); ++i)
                    {
                        int p = wCell + (i * 5);

                        if (p >= INVENTORY_MAX_NUM)
                            continue;

                        // wCell + 1 ·Î ÇÏ´Â °ÍÀº ºó°÷À» üũÇÒ ¶§ °°Àº
                        // ¾ÆÀÌÅÛÀº ¿¹¿Üó¸®Çϱâ À§ÇÔ
                        m_pointsInstant.bItemGrid[p] = wCell + 1;
                    }
                }
                else
                    m_pointsInstant.bItemGrid[wCell] = wCell + 1;
            }

            m_pointsInstant.pItems[wCell] = pItem;
        }
        break;
    // ¿ëÈ¥¼® Àκ¥Å丮
    case DRAGON_SOUL_INVENTORY:
        {
            LPITEM pOld = m_pointsInstant.pDSItems[wCell];

            if (pOld)
            {
                if (wCell < DRAGON_SOUL_INVENTORY_MAX_NUM)
                {
                    for (int i = 0; i < pOld->GetSize(); ++i)
                    {
                        int p = wCell + (i * DRAGON_SOUL_BOX_COLUMN_NUM);

                        if (p >= DRAGON_SOUL_INVENTORY_MAX_NUM)
                            continue;

                        if (m_pointsInstant.pDSItems[p] && m_pointsInstant.pDSItems[p] != pOld)
                            continue;

                        m_pointsInstant.wDSItemGrid[p] = 0;
                    }
                }
                else
                    m_pointsInstant.wDSItemGrid[wCell] = 0;
            }

            if (pItem)
            {
                if (wCell >= DRAGON_SOUL_INVENTORY_MAX_NUM)
                {
                    sys_err("CHARACTER::SetItem: invalid DS item cell %d", wCell);
                    return;
                }

                if (wCell < DRAGON_SOUL_INVENTORY_MAX_NUM)
                {
                    for (int i = 0; i < pItem->GetSize(); ++i)
                    {
                        int p = wCell + (i * DRAGON_SOUL_BOX_COLUMN_NUM);

                        if (p >= DRAGON_SOUL_INVENTORY_MAX_NUM)
                            continue;

                        // wCell + 1 ·Î ÇÏ´Â °ÍÀº ºó°÷À» üũÇÒ ¶§ °°Àº
                        // ¾ÆÀÌÅÛÀº ¿¹¿Üó¸®Çϱâ À§ÇÔ
                        m_pointsInstant.wDSItemGrid[p] = wCell + 1;
                    }
                }
                else
                    m_pointsInstant.wDSItemGrid[wCell] = wCell + 1;
            }

            m_pointsInstant.pDSItems[wCell] = pItem;
        }
        break;
#ifdef ENABLE_SPECIAL_STORAGE    
    case UPGRADE_INVENTORY:
        {
            LPITEM pOld = m_pointsInstant.pSSUItems[wCell];

            if (pOld)
            {
                if (wCell < SPECIAL_INVENTORY_MAX_NUM)
                {
                    for (int i = 0; i < pOld->GetSize(); ++i)
                    {
                        int p = wCell + (i * 5);

                        if (p >= SPECIAL_INVENTORY_MAX_NUM)
                            continue;

                        if (m_pointsInstant.pSSUItems[p] && m_pointsInstant.pSSUItems[p] != pOld)
                            continue;

                        m_pointsInstant.wSSUItemGrid[p] = 0;
                    }
                }
                else
                    m_pointsInstant.wSSUItemGrid[wCell] = 0;
            }

            if (pItem)
            {
                if (wCell >= SPECIAL_INVENTORY_MAX_NUM)
                {
                    sys_err("CHARACTER::SetItem: invalid SSU item cell %d", wCell);
                    return;
                }

                if (wCell < SPECIAL_INVENTORY_MAX_NUM)
                {
                    for (int i = 0; i < pItem->GetSize(); ++i)
                    {
                        int p = wCell + (i * 5);

                        if (p >= SPECIAL_INVENTORY_MAX_NUM)
                            continue;

                        m_pointsInstant.wSSUItemGrid[p] = wCell + 1;
                    }
                }
                else
                    m_pointsInstant.wSSUItemGrid[wCell] = wCell + 1;
            }

            m_pointsInstant.pSSUItems[wCell] = pItem;
        }
        break;
    case BOOK_INVENTORY:
        {
            LPITEM pOld = m_pointsInstant.pSSBItems[wCell];

            if (pOld)
            {
                if (wCell < SPECIAL_INVENTORY_MAX_NUM)
                {
                    for (int i = 0; i < pOld->GetSize(); ++i)
                    {
                        int p = wCell + (i * 5);

                        if (p >= SPECIAL_INVENTORY_MAX_NUM)
                            continue;

                        if (m_pointsInstant.pSSBItems[p] && m_pointsInstant.pSSBItems[p] != pOld)
                            continue;

                        m_pointsInstant.wSSBItemGrid[p] = 0;
                    }
                }
                else
                    m_pointsInstant.wSSBItemGrid[wCell] = 0;
            }

            if (pItem)
            {
                if (wCell >= SPECIAL_INVENTORY_MAX_NUM)
                {
                    sys_err("CHARACTER::SetItem: invalid SSB item cell %d", wCell);
                    return;
                }

                if (wCell < SPECIAL_INVENTORY_MAX_NUM)
                {
                    for (int i = 0; i < pItem->GetSize(); ++i)
                    {
                        int p = wCell + (i * 5);

                        if (p >= SPECIAL_INVENTORY_MAX_NUM)
                            continue;

                        m_pointsInstant.wSSBItemGrid[p] = wCell + 1;
                    }
                }
                else
                    m_pointsInstant.wSSBItemGrid[wCell] = wCell + 1;
            }

            m_pointsInstant.pSSBItems[wCell] = pItem;
        }
        break;
    case STONE_INVENTORY:
        {
            LPITEM pOld = m_pointsInstant.pSSSItems[wCell];

            if (pOld)
            {
                if (wCell < SPECIAL_INVENTORY_MAX_NUM)
                {
                    for (int i = 0; i < pOld->GetSize(); ++i)
                    {
                        int p = wCell + (i * 5);

                        if (p >= SPECIAL_INVENTORY_MAX_NUM)
                            continue;

                        if (m_pointsInstant.pSSSItems[p] && m_pointsInstant.pSSSItems[p] != pOld)
                            continue;

                        m_pointsInstant.wSSSItemGrid[p] = 0;
                    }
                }
                else
                    m_pointsInstant.wSSSItemGrid[wCell] = 0;
            }

            if (pItem)
            {
                if (wCell >= SPECIAL_INVENTORY_MAX_NUM)
                {
                    sys_err("CHARACTER::SetItem: invalid SSB item cell %d", wCell);
                    return;
                }

                if (wCell < SPECIAL_INVENTORY_MAX_NUM)
                {
                    for (int i = 0; i < pItem->GetSize(); ++i)
                    {
                        int p = wCell + (i * 5);

                        if (p >= SPECIAL_INVENTORY_MAX_NUM)
                            continue;

                        m_pointsInstant.wSSSItemGrid[p] = wCell + 1;
                    }
                }
                else
                    m_pointsInstant.wSSSItemGrid[wCell] = wCell + 1;
            }

            m_pointsInstant.pSSSItems[wCell] = pItem;
        }
        break;
#endif
    default:
        sys_err ("Invalid Inventory type %d", window_type);
        return;
    }

    if (GetDesc())
    {
        // È®Àå ¾ÆÀÌÅÛ: ¼­¹ö¿¡¼­ ¾ÆÀÌÅÛ Ç÷¡±× Á¤º¸¸¦ º¸³½´Ù
        if (pItem)
        {
            TPacketGCItemSet pack;
            pack.header = HEADER_GC_ITEM_SET;
            pack.Cell = Cell;

            pack.count = pItem->GetCount();
#ifdef __CHANGELOOK_SYSTEM__
            pack.transmutation = pItem->GetTransmutation();
#endif
            pack.bind = pItem->GetBind();
            pack.vnum = pItem->GetVnum();
            pack.flags = pItem->GetFlag();
            pack.anti_flags = pItem->GetAntiFlag();
#ifdef __HIGHLIGHT_SYSTEM__
            if (isHighLight)
                pack.highlight = true;
            else
                pack.highlight = (Cell.window_type == DRAGON_SOUL_INVENTORY);
#else
            pack.highlight = (Cell.window_type == DRAGON_SOUL_INVENTORY);
#endif

            thecore_memcpy(pack.alSockets, pItem->GetSockets(), sizeof(pack.alSockets));
            thecore_memcpy(pack.aAttr, pItem->GetAttributes(), sizeof(pack.aAttr));

            GetDesc()->Packet(&pack, sizeof(TPacketGCItemSet));
        }
        else
        {
            TPacketGCItemDelDeprecated pack;
            pack.header = HEADER_GC_ITEM_DEL;
            pack.Cell = Cell;
            pack.count = 0;
#ifdef __CHANGELOOK_SYSTEM__
            pack.transmutation = 0;
#endif
            pack.bind = 0;
            pack.vnum = 0;
            memset(pack.alSockets, 0, sizeof(pack.alSockets));
            memset(pack.aAttr, 0, sizeof(pack.aAttr));

            GetDesc()->Packet(&pack, sizeof(TPacketGCItemDelDeprecated));
        }
    }

    if (pItem)
    {
        pItem->SetCell(this, wCell);
        switch (window_type)
        {
        case INVENTORY:
        case EQUIPMENT:
            if ((wCell < INVENTORY_MAX_NUM) || (BELT_INVENTORY_SLOT_START <= wCell && BELT_INVENTORY_SLOT_END > wCell))
                pItem->SetWindow(INVENTORY);
            else
                pItem->SetWindow(EQUIPMENT);
            break;
        case DRAGON_SOUL_INVENTORY:
            pItem->SetWindow(DRAGON_SOUL_INVENTORY);
            break;
#ifdef ENABLE_SPECIAL_STORAGE
        case UPGRADE_INVENTORY:
            pItem->SetWindow(UPGRADE_INVENTORY);
            break;
        case BOOK_INVENTORY:
            pItem->SetWindow(BOOK_INVENTORY);
            break;
        case STONE_INVENTORY:
            pItem->SetWindow(STONE_INVENTORY);
            break;
#endif
        }
    }
}

 

mi input_main.cpp:

void CInputMain::Refine(LPCHARACTER ch, const char* c_pData)
{
    const TPacketCGRefine* p = reinterpret_cast<const TPacketCGRefine*>(c_pData);

    if (ch->GetOfflineShopOwner() || ch->GetExchange() || ch->IsOpenSafebox() || ch->GetShopOwner() || ch->GetMyShop() || ch->IsCubeOpen() || ch->IsAttrTransferOpen())
    {
        ch->ChatPacket(CHAT_TYPE_INFO,  LC_TEXT("â°í,°Å·¡Ã¢µîÀÌ ¿­¸° »óÅ¿¡¼­´Â °³·®À» ÇÒ¼ö°¡ ¾ø½À´Ï´Ù"));
        ch->ClearRefineMode();
        return;
    }

    if (p->type == 255)
    {
        // DoRefine Cancel
        ch->ClearRefineMode();
        return;
    }

#ifdef ENABLE_EXTEND_INVEN_SYSTEM
    if (p->pos >= ch->Inventory_Size())
#else
    if (p->pos >= INVENTORY_MAX_NUM)
#endif
    {
        ch->ClearRefineMode();
        return;
    }

    LPITEM item = ch->GetStoneInventoryItem(p->pos);

    if (!item)
    {
        ch->ClearRefineMode();
        return;
    }

    if (item->IsBind() || item->IsUntilBind())
    {
        ch->ClearRefineMode();
        ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ruha_bagli_nesneyi_yukseltemezsin"));
        return;
    }

    ch->SetRefineTime();

    if (p->type == REFINE_TYPE_NORMAL)
    {
        sys_log (0, "refine_type_noraml");
        ch->DoRefine(item);
    }
    else if (p->type == REFINE_TYPE_SCROLL || p->type == REFINE_TYPE_HYUNIRON || p->type == REFINE_TYPE_MUSIN || p->type == REFINE_TYPE_BDRAGON)
    {
        sys_log (0, "refine_type_scroll, ...");
        ch->DoRefineWithScroll(item);
    }
    else if (p->type == REFINE_TYPE_MONEY_ONLY)
    {
        const LPITEM item = ch->GetStoneInventoryItem(p->pos);

        if (NULL != item)
        {
            if (500 <= item->GetRefineSet())
            {
                LogManager::instance().HackLog("DEVIL_TOWER_REFINE_HACK", ch);
            }
            else
            {
                if (ch->GetQuestFlag("deviltower_zone.can_refine"))
                {
                        if (ch->DoRefine(item, true))
                        {
                                ch->SetQuestFlag("deviltower_zone.can_refine", 0);
                        }
                }
                else
                {
                    ch->ChatPacket(CHAT_TYPE_INFO, "»ç±Í Ÿ¿ö ¿Ï·á º¸»óÀº Çѹø±îÁö »ç¿ë°¡´ÉÇÕ´Ï´Ù.");
                }
            }
        }
    }

    ch->ClearRefineMode();
}

 
 
Enlace para comentar
Compartir en otros sitios

  • 0
hace 1 hora, NazoX dijo:

#ifdef ENABLE_EXTEND_INVEN_SYSTEM
    if (p->pos >= ch->Inventory_Size())
#else
    if (p->pos >= INVENTORY_MAX_NUM)
#endif
    {
        ch->ClearRefineMode();
        return;
    }

ENABLE_EXTEND_INVEN_SYSTEM, lo tienes activo? De ser así, pega la función CHARACTER::Inventory_Size() también.

Enlace para comentar
Compartir en otros sitios

  • 0
hace 23 horas, PACI dijo:

ENABLE_EXTEND_INVEN_SYSTEM, lo tienes activo? De ser así, pega la función CHARACTER::Inventory_Size() también.

Perdoname Paci, he estado liado con las clases, pero gracias por tu respuesta!, sí! tengo el inven_system esta es la función con el inventory_special incluido como lo tengo, y no he encontrado nada respecto a CHARACTER::Inventory_Size() he revisado char_item e input_main.

pd: he dejado mi char_item.cpp por si te sirve mejor que mis spoilers que a lo mejor no es lo que me has pedido, muchas gracias!

 

bool CHARACTER::IsEmptyItemGrid(TItemPos Cell, BYTE bSize, int iExceptionCell) const
{
    #ifdef ENABLE_EXTEND_INVEN_SYSTEM
    switch (Cell.window_type)
    {
    case INVENTORY:
        {
            BYTE bCell = Cell.cell;

            // bItemCellÀº 0ÀÌ falseÀÓÀ» ³ªÅ¸³»±â À§ÇØ + 1 Çؼ­ ó¸®ÇÑ´Ù.
            // µû¶ó¼­ iExceptionCell¿¡ 1À» ´õÇØ ºñ±³ÇÑ´Ù.
            ++iExceptionCell;

            if (Cell.IsBeltInventoryPosition())
            {
                LPITEM beltItem = GetWear(WEAR_BELT);

                if (NULL == beltItem)
                    return false;

                if (false == CBeltInventoryHelper::IsAvailableCell(bCell - BELT_INVENTORY_SLOT_START, beltItem->GetValue(0)))
                    return false;

                if (m_pointsInstant.bItemGrid[bCell])
                {
                    if (m_pointsInstant.bItemGrid[bCell] == iExceptionCell)
                        return true;

                    return false;
                }

                if (bSize == 1)
                    return true;

            }
            //black
            else if (bCell >= Inventory_Size())
                return false;

            if (m_pointsInstant.bItemGrid[bCell])
            {
                if (m_pointsInstant.bItemGrid[bCell] == iExceptionCell)
                {
                    if (bSize == 1)
                        return true;

                    int j = 1;
                    BYTE bPage = bCell / (INVENTORY_MAX_NUM / 4);
                    do
                    {
                        BYTE p = bCell + (5 * j);

                        if (p >= Inventory_Size())
                            return false;

                        if (p / (INVENTORY_MAX_NUM / 4) != bPage)
                            return false;

                        if (m_pointsInstant.bItemGrid[p])
                            if (m_pointsInstant.bItemGrid[p] != iExceptionCell)
                                return false;
                    }
                    while (++j < bSize);

                    return true;
                }
                else
                    return false;
            }

            // Å©±â°¡ 1À̸é ÇÑÄ­À» Â÷ÁöÇÏ´Â °ÍÀ̹ǷΠ±×³É ¸®ÅÏ
            if (1 == bSize)
                return true;
            else
            {
                int j = 1;
                BYTE bPage = bCell / (INVENTORY_MAX_NUM / 4);

                do
                {
                    BYTE p = bCell + (5 * j);

                    if (p >= Inventory_Size())
                        return false;
                    if (p / (INVENTORY_MAX_NUM / 4) != bPage)
                        return false;

                    if (m_pointsInstant.bItemGrid[p])
                        if (m_pointsInstant.bItemGrid[p] != iExceptionCell)
                            return false;
                }
                while (++j < bSize);

                return true;
            }
        }
        break;
    #else
        switch (Cell.window_type)
        {
        case INVENTORY:
            {
                BYTE bCell = Cell.cell;

                // bItemCellÀº 0ÀÌ falseÀÓÀ» ³ªÅ¸³»±â À§ÇØ + 1 Çؼ­ ó¸®ÇÑ´Ù.
                // µû¶ó¼­ iExceptionCell¿¡ 1À» ´õÇØ ºñ±³ÇÑ´Ù.
                ++iExceptionCell;

                if (Cell.IsBeltInventoryPosition())
                {
                    LPITEM beltItem = GetWear(WEAR_BELT);

                    if (NULL == beltItem)
                        return false;

                    if (false == CBeltInventoryHelper::IsAvailableCell(bCell - BELT_INVENTORY_SLOT_START, beltItem->GetValue(0)))
                        return false;

                    if (m_pointsInstant.bItemGrid[bCell])
                    {
                        if (m_pointsInstant.bItemGrid[bCell] == iExceptionCell)
                            return true;

                        return false;
                    }

                    if (bSize == 1)
                        return true;

                }
                //black
                else if (bCell >= INVENTORY_MAX_NUM)
                    return false;

                if (m_pointsInstant.bItemGrid[bCell])
                {
                    if (m_pointsInstant.bItemGrid[bCell] == iExceptionCell)
                    {
                        if (bSize == 1)
                            return true;

                        int j = 1;
                        BYTE bPage = bCell / (INVENTORY_MAX_NUM / 4);

                        do
                        {
                            BYTE p = bCell + (5 * j);

                            if (p >= INVENTORY_MAX_NUM)
                                return false;

                            if (p / (INVENTORY_MAX_NUM / 4) != bPage)
                                return false;

                            if (m_pointsInstant.bItemGrid[p])
                                if (m_pointsInstant.bItemGrid[p] != iExceptionCell)
                                    return false;
                        }
                        while (++j < bSize);

                        return true;
                    }
                    else
                        return false;
                }

                // Å©±â°¡ 1À̸é ÇÑÄ­À» Â÷ÁöÇÏ´Â °ÍÀ̹ǷΠ±×³É ¸®ÅÏ
                if (1 == bSize)
                    return true;
                else
                {
                    int j = 1;
                    BYTE bPage = bCell / (INVENTORY_MAX_NUM / 4);

                    do
                    {
                        BYTE p = bCell + (5 * j);

                        if (p >= INVENTORY_MAX_NUM)
                            return false;
                        if (p / (INVENTORY_MAX_NUM / 4) != bPage)
                            return false;

                        if (m_pointsInstant.bItemGrid[p])
                            if (m_pointsInstant.bItemGrid[p] != iExceptionCell)
                                return false;
                    }
                    while (++j < bSize);

                    return true;
                }
            }
            break;
    #endif
    case DRAGON_SOUL_INVENTORY:
        {
            WORD wCell = Cell.cell;
            if (wCell >= DRAGON_SOUL_INVENTORY_MAX_NUM)
                return false;

            // bItemCellÀº 0ÀÌ falseÀÓÀ» ³ªÅ¸³»±â À§ÇØ + 1 Çؼ­ ó¸®ÇÑ´Ù.
            // µû¶ó¼­ iExceptionCell¿¡ 1À» ´õÇØ ºñ±³ÇÑ´Ù.
            iExceptionCell++;

            if (m_pointsInstant.wDSItemGrid[wCell])
            {
                if (m_pointsInstant.wDSItemGrid[wCell] == iExceptionCell)
                {
                    if (bSize == 1)
                        return true;

                    int j = 1;

                    do
                    {
                        BYTE p = wCell + (DRAGON_SOUL_BOX_COLUMN_NUM * j);

                        if (p >= DRAGON_SOUL_INVENTORY_MAX_NUM)
                            return false;

                        if (m_pointsInstant.wDSItemGrid[p])
                            if (m_pointsInstant.wDSItemGrid[p] != iExceptionCell)
                                return false;
                    }
                    while (++j < bSize);

                    return true;
                }
                else
                    return false;
            }

            // Å©±â°¡ 1À̸é ÇÑÄ­À» Â÷ÁöÇÏ´Â °ÍÀ̹ǷΠ±×³É ¸®ÅÏ
            if (1 == bSize)
                return true;
            else
            {
                int j = 1;

                do
                {
                    BYTE p = wCell + (DRAGON_SOUL_BOX_COLUMN_NUM * j);

                    if (p >= DRAGON_SOUL_INVENTORY_MAX_NUM)
                        return false;

                    if (m_pointsInstant.bItemGrid[p])
                        if (m_pointsInstant.wDSItemGrid[p] != iExceptionCell)
                            return false;
                }
                while (++j < bSize);

                return true;
            }
        }
#ifdef ENABLE_SPECIAL_STORAGE
        break;
    case UPGRADE_INVENTORY:
        {
            WORD wCell = Cell.cell;
            if (wCell >= SPECIAL_INVENTORY_MAX_NUM)
                return false;

            iExceptionCell++;

            if (m_pointsInstant.wSSUItemGrid[wCell])
            {
                if (m_pointsInstant.wSSUItemGrid[wCell] == iExceptionCell)
                {
                    if (bSize == 1)
                        return true;

                    int j = 1;

                    do
                    {
                        int p = wCell + (5 * j);

                        if (p >= SPECIAL_INVENTORY_MAX_NUM)
                            return false;

                        if (m_pointsInstant.wSSUItemGrid[p])
                            if (m_pointsInstant.wSSUItemGrid[p] != iExceptionCell)
                                return false;
                    }
                    while (++j < bSize);

                    return true;
                }
                else
                    return false;
            }

            if (1 == bSize)
                return true;
            else
            {
                int j = 1;

                do
                {
                    int p = wCell + (5 * j);

                    if (p >= SPECIAL_INVENTORY_MAX_NUM)
                        return false;

                    if (m_pointsInstant.bItemGrid[p]) // old bItemGrid
                        if (m_pointsInstant.wSSUItemGrid[p] != iExceptionCell)
                            return false;
                }
                while (++j < bSize);

                return true;
            }
        }
        break;
    case BOOK_INVENTORY:
        {
            WORD wCell = Cell.cell;
            if (wCell >= SPECIAL_INVENTORY_MAX_NUM)
                return false;

            iExceptionCell++;

            if (m_pointsInstant.wSSBItemGrid[wCell])
            {
                if (m_pointsInstant.wSSBItemGrid[wCell] == iExceptionCell)
                {
                    if (bSize == 1)
                        return true;

                    int j = 1;

                    do
                    {
                        int p = wCell + (5 * j);

                        if (p >= SPECIAL_INVENTORY_MAX_NUM)
                            return false;

                        if (m_pointsInstant.wSSBItemGrid[p])
                            if (m_pointsInstant.wSSBItemGrid[p] != iExceptionCell)
                                return false;
                    }
                    while (++j < bSize);

                    return true;
                }
                else
                    return false;
            }

            if (1 == bSize)
                return true;
            else
            {
                int j = 1;

                do
                {
                    int p = wCell + (5 * j);

                    if (p >= SPECIAL_INVENTORY_MAX_NUM)
                        return false;

                    if (m_pointsInstant.bItemGrid[p]) // old bItemGrid
                        if (m_pointsInstant.wSSBItemGrid[p] != iExceptionCell)
                            return false;
                }
                while (++j < bSize);

                return true;
            }
        }
    case STONE_INVENTORY:
        {
            WORD wCell = Cell.cell;
            if (wCell >= SPECIAL_INVENTORY_MAX_NUM)
                return false;

            iExceptionCell++;

            if (m_pointsInstant.wSSSItemGrid[wCell])
            {
                if (m_pointsInstant.wSSSItemGrid[wCell] == iExceptionCell)
                {
                    if (bSize == 1)
                        return true;

                    int j = 1;

                    do
                    {
                        int p = wCell + (5 * j);

                        if (p >= SPECIAL_INVENTORY_MAX_NUM)
                            return false;

                        if (m_pointsInstant.wSSSItemGrid[p])
                            if (m_pointsInstant.wSSSItemGrid[p] != iExceptionCell)
                                return false;
                    }
                    while (++j < bSize);

                    return true;
                }
                else
                    return false;
            }

            if (1 == bSize)
                return true;
            else
            {
                int j = 1;

                do
                {
                    int p = wCell + (5 * j);

                    if (p >= SPECIAL_INVENTORY_MAX_NUM)
                        return false;

                    if (m_pointsInstant.bItemGrid[p]) // old bItemGrid
                        if (m_pointsInstant.wSSSItemGrid[p] != iExceptionCell)
                            return false;
                }
                while (++j < bSize);

                return true;
            }
        }
#endif
#ifdef ENABLE_SPECIAL_STORAGE
    }
#endif
}

int CHARACTER::GetEmptyInventory(BYTE size) const
{
#ifdef ENABLE_EXTEND_INVEN_SYSTEM
    for ( int i = 0; i < Inventory_Size(); ++i)
#else
    for ( int i = 0; i < INVENTORY_MAX_NUM; ++i)    
#endif
        if (IsEmptyItemGrid(TItemPos (INVENTORY, i), size))
            return i;
    return -1;
}


--------------------------

int CHARACTER::CountEmptyInventory() const
{
    int    count = 0;
#ifdef ENABLE_EXTEND_INVEN_SYSTEM
    for (int i = 0; i < Inventory_Size(); ++i)
#else
    for (int i = 0; i < INVENTORY_MAX_NUM; ++i)    
#endif
        if (GetInventoryItem(i))
            count += GetInventoryItem(i)->GetSize();

#ifdef ENABLE_EXTEND_INVEN_SYSTEM
    return (Inventory_Size() - count);
#else
    return (INVENTORY_MAX_NUM - count);
#endif
}

------------------------------

LPITEM CHARACTER::FindSpecifyItem(DWORD vnum) const
{
#ifdef ENABLE_EXTEND_INVEN_SYSTEM
    for (int i = 0; i < Inventory_Size(); ++i)
#else
    for (int i = 0; i < INVENTORY_MAX_NUM; ++i)    
#endif
    if (GetInventoryItem(i) && GetInventoryItem(i)->GetVnum() == vnum)
        return GetInventoryItem(i);

    return NULL;
}

LPITEM CHARACTER::FindItemByID(DWORD id) const
{
#ifdef ENABLE_EXTEND_INVEN_SYSTEM
    for (int i = 0; i < Inventory_Size(); ++i)
#else
    for (int i = 0; i < INVENTORY_MAX_NUM; ++i)    
#endif
    {
        if (NULL != GetInventoryItem(i) && GetInventoryItem(i)->GetID() == id)
            return GetInventoryItem(i);
    }

    for (int i=BELT_INVENTORY_SLOT_START; i < BELT_INVENTORY_SLOT_END ; ++i)
    {
        if (NULL != GetInventoryItem(i) && GetInventoryItem(i)->GetID() == id)
            return GetInventoryItem(i);
    }

    return NULL;
}

int CHARACTER::CountSpecifyItem(DWORD vnum) const
{
    int    count = 0;
    LPITEM item;
#ifdef ENABLE_EXTEND_INVEN_SYSTEM
    for (int i = 0; i < Inventory_Size(); ++i)
#else
    for (int i = 0; i < INVENTORY_MAX_NUM; ++i)    
#endif
    {
        item = GetInventoryItem(i);
        if (NULL != item && item->GetVnum() == vnum)
        {
            // °³ÀÎ »óÁ¡¿¡ µî·ÏµÈ ¹°°ÇÀÌ¸é ³Ñ¾î°£´Ù.
            if (m_pkMyShop && m_pkMyShop->IsSellingItem(item->GetID()))
            {
                continue;
            }
            else
            {
                count += item->GetCount();
            }
        }
    }

#ifdef ENABLE_SPECIAL_STORAGE
    for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
    {
        item = GetUpgradeInventoryItem(i);
        if (NULL != item && item->GetVnum() == vnum)
        {
            if (m_pkMyShop && m_pkMyShop->IsSellingItem(item->GetID()))
                continue;
            else
                count += item->GetCount();
        }
    }
    for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
    {
        item = GetBookInventoryItem(i);
        if (NULL != item && item->GetVnum() == vnum)
        {
            if (m_pkMyShop && m_pkMyShop->IsSellingItem(item->GetID()))
                continue;
            else
                count += item->GetCount();
        }
    }
    for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
    {
        item = GetStoneInventoryItem(i);
        if (NULL != item && item->GetVnum() == vnum)
        {
            if (m_pkMyShop && m_pkMyShop->IsSellingItem(item->GetID()))
                continue;
            else
                count += item->GetCount();
        }
    }
#endif

    return count;
}

void CHARACTER::RemoveSpecifyItem(DWORD vnum, DWORD count)
{
    if (0 == count)
        return;

#ifdef ENABLE_EXTEND_INVEN_SYSTEM
    for (UINT i = 0; i < Inventory_Size(); ++i)
#else
    for (UINT i = 0; i < INVENTORY_MAX_NUM; ++i)
#endif
    {
        if (NULL == GetInventoryItem(i))
            continue;

        if (GetInventoryItem(i)->GetVnum() != vnum)
            continue;

        //°³ÀÎ »óÁ¡¿¡ µî·ÏµÈ ¹°°ÇÀÌ¸é ³Ñ¾î°£´Ù. (°³ÀÎ »óÁ¡¿¡¼­ ÆǸŵɶ§ ÀÌ ºÎºÐÀ¸·Î µé¾î¿Ã °æ¿ì ¹®Á¦!)
        if(m_pkMyShop)
        {
            bool isItemSelling = m_pkMyShop->IsSellingItem(GetInventoryItem(i)->GetID());
            if (isItemSelling)
                continue;
        }

        if (vnum >= 80003 && vnum <= 80007)
            LogManager::instance().GoldBarLog(GetPlayerID(), GetInventoryItem(i)->GetID(), QUEST, "RemoveSpecifyItem");

        if (count >= GetInventoryItem(i)->GetCount())
        {
            count -= GetInventoryItem(i)->GetCount();
            GetInventoryItem(i)->SetCount(0);

            if (0 == count)
                return;
        }
        else
        {
            GetInventoryItem(i)->SetCount(GetInventoryItem(i)->GetCount() - count);
            return;
        }
    }

#ifdef ENABLE_SPECIAL_STORAGE
    for (UINT i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
    {
        if (NULL == GetUpgradeInventoryItem(i))
            continue;

        if (GetUpgradeInventoryItem(i)->GetVnum() != vnum)
            continue;

        if(m_pkMyShop)
        {
            bool isItemSelling = m_pkMyShop->IsSellingItem(GetUpgradeInventoryItem(i)->GetID());
            if (isItemSelling)
                continue;
        }

        if (count >= GetUpgradeInventoryItem(i)->GetCount())
        {
            count -= GetUpgradeInventoryItem(i)->GetCount();
            GetUpgradeInventoryItem(i)->SetCount(0);

            if (0 == count)
                return;
        }
        else
        {
            GetUpgradeInventoryItem(i)->SetCount(GetUpgradeInventoryItem(i)->GetCount() - count);
            return;
        }
    }
    for (UINT i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
    {
        if (NULL == GetBookInventoryItem(i))
            continue;

        if (GetBookInventoryItem(i)->GetVnum() != vnum)
            continue;

        if(m_pkMyShop)
        {
            bool isItemSelling = m_pkMyShop->IsSellingItem(GetBookInventoryItem(i)->GetID());
            if (isItemSelling)
                continue;
        }

        if (count >= GetBookInventoryItem(i)->GetCount())
        {
            count -= GetBookInventoryItem(i)->GetCount();
            GetBookInventoryItem(i)->SetCount(0);

            if (0 == count)
                return;
        }
        else
        {
            GetBookInventoryItem(i)->SetCount(GetBookInventoryItem(i)->GetCount() - count);
            return;
        }
    }
    for (UINT i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
    {
        if (NULL == GetStoneInventoryItem(i))
            continue;

        if (GetStoneInventoryItem(i)->GetVnum() != vnum)
            continue;

        if(m_pkMyShop)
        {
            bool isItemSelling = m_pkMyShop->IsSellingItem(GetStoneInventoryItem(i)->GetID());
            if (isItemSelling)
                continue;
        }

        if (count >= GetStoneInventoryItem(i)->GetCount())
        {
            count -= GetStoneInventoryItem(i)->GetCount();
            GetStoneInventoryItem(i)->SetCount(0);

            if (0 == count)
                return;
        }
        else
        {
            GetStoneInventoryItem(i)->SetCount(GetStoneInventoryItem(i)->GetCount() - count);
            return;
        }
    }
#endif

    // ¿¹¿Ü󸮰¡ ¾àÇÏ´Ù.
    if (count)
        sys_log(0, "CHARACTER::RemoveSpecifyItem cannot remove enough item vnum %u, still remain %d", vnum, count);
}

int CHARACTER::CountSpecifyTypeItem(BYTE type) const
{
    int    count = 0;
#ifdef ENABLE_EXTEND_INVEN_SYSTEM
    for (UINT i = 0; i < Inventory_Size(); ++i)
#else
    for (UINT i = 0; i < INVENTORY_MAX_NUM; ++i)
#endif
    {
        LPITEM pItem = GetInventoryItem(i);
        if (pItem != NULL && pItem->GetType() == type)
        {
            count += pItem->GetCount();
        }
    }

    return count;
}

void CHARACTER::RemoveSpecifyTypeItem(BYTE type, DWORD count)
{
    if (0 == count)
        return;

#ifdef ENABLE_EXTEND_INVEN_SYSTEM
    for (UINT i = 0; i < Inventory_Size(); ++i)
#else
    for (UINT i = 0; i < INVENTORY_MAX_NUM; ++i)
#endif
    {
        if (NULL == GetInventoryItem(i))
            continue;

        if (GetInventoryItem(i)->GetType() != type)
            continue;

        //°³ÀÎ »óÁ¡¿¡ µî·ÏµÈ ¹°°ÇÀÌ¸é ³Ñ¾î°£´Ù. (°³ÀÎ »óÁ¡¿¡¼­ ÆǸŵɶ§ ÀÌ ºÎºÐÀ¸·Î µé¾î¿Ã °æ¿ì ¹®Á¦!)
        if(m_pkMyShop)
        {
            bool isItemSelling = m_pkMyShop->IsSellingItem(GetInventoryItem(i)->GetID());
            if (isItemSelling)
                continue;
        }

        if (count >= GetInventoryItem(i)->GetCount())
        {
            count -= GetInventoryItem(i)->GetCount();
            GetInventoryItem(i)->SetCount(0);

            if (0 == count)
                return;
        }
        else
        {
            GetInventoryItem(i)->SetCount(GetInventoryItem(i)->GetCount() - count);
            return;
        }
    }
}

---------------------

Debes iniciar sesión para ver el contenido del enlace en esta publicación.

Enlace para comentar
Compartir en otros sitios

  • 0
hace 9 horas, PACI dijo:

Busca en char.cpp o char.h. Sino, búscalo con Visual Studio.

He revisado source cliente y source game completo y no tengo nada de CHARACTER::Inventory_size quizás lo tenga con otro nombre, alguna función que pueda buscar que este relacionada ? gracias por tu tiempo

Enlace para comentar
Compartir en otros sitios

Unirse a la conversación

Puedes publicar ahora y registrarte más tarde. Si tienes una cuenta, regístrate para publicar con su cuenta.

Guest
Responder esta pregunta...

×   Has pegado contenido con formato .   Eliminar formato

  Only 75 emoji are allowed.

×   Tu enlace se ha incorporado automáticamente.   Mostrar un enlace en su lugar

×   Se ha restaurado el contenido anterior. .   Borrar editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recientemente navegando por este tema   0 miembros

    • No hay usuarios registrados visitando esta página.
×
×
  • Crear nuevo...