Jump to content

Recommended Posts

M2 Download Center

This is the hidden content, please
( Internal )

Spoiler

2523499dc7fc62f45f1115eaa99b88cf8c81e3.g

 

Hello
Excuse me, I do not like introductions

Go to: game/src/char.h

Spoiler

 

-- // Unter:
        bool            IsEmptyItemGrid(TItemPos Cell, BYTE size, int iExceptionCell = -1) const;

 -- // Add:
        bool            SwapItemToItem(TItemPos srcCell, TItemPos destCell);

 

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

Go to : game/src/char_item.cpp

Spoiler

 

-- // Search:
        if (!IsEmptyItemGrid(DestCell, item->GetSize(), Cell.cell))
            return false;


-- // change:
        if (!IsEmptyItemGrid(DestCell, item->GetSize(), Cell.cell))
        {
            if (!SwapItemToItem(Cell, DestCell))
                return false;
            else
                return true;
        }

 

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

Spoiler

 

-- // Search:

bool CHARACTER::CanUnequipNow(const LPITEM item, const TItemPos& srcCell, const TItemPos& destCell) /*const*/

{

         [ ... ]

            ChatPacket(CHAT_TYPE_INFO, LC_TEXT("For can do this unwear the costume weapon."));
            return false;
        }
    }
#endif
    
    return true;
}

 

-- // Add This end:

bool CHARACTER::SwapItemToItem(TItemPos srcCell, TItemPos destCell)
{
    if (!CanHandleItem())
        return false;
    BYTE bCell = srcCell.cell;
    BYTE bDestCell = destCell.cell;
    BYTE pages_count = 4;

    if (srcCell.IsDragonSoulEquipPosition() || destCell.IsDragonSoulEquipPosition())
        return false;

    if (bCell == bDestCell)
        return false;

    if (srcCell.IsEquipPosition() || destCell.IsEquipPosition())
        return false;
    if (srcCell.window_type != INVENTORY || destCell.window_type != INVENTORY || destCell.cell >= INVENTORY_MAX_NUM)
        return false;

    LPITEM item1, item2;

    item1 = GetInventoryItem(bCell);
    item2 = GetInventoryItem(bDestCell);

    if (!item1 || !item2)
        return false;
    
    if (item1 == item2)
    {
        sys_log(0, "[WARNING][WARNING][HACK USER!] : %s %d %d", m_stName.c_str(), bCell, bDestCell);
        return false;
    }
    if (item1->GetSize() == item2->GetSize())
    {
        BYTE bCell1 = item1->GetCell();
        BYTE bCell2 = item2->GetCell();
        
        item1->RemoveFromCharacter();
        item2->RemoveFromCharacter();

        item1->AddToCharacter(this, TItemPos(INVENTORY, bCell2));
        item2->AddToCharacter(this, TItemPos(INVENTORY, bCell1));
    }
    
    if (item1->GetSize() > item2->GetSize())
    {
        BYTE bCell1 = item1->GetCell();
        ChatPacket(CHAT_TYPE_INFO, "Slot %d", bDestCell);
        BYTE pPageDest = bDestCell / (INVENTORY_MAX_NUM / pages_count);
        BYTE pPageDest2 = (((item1->GetSize()-1) * 5) + bDestCell) / (INVENTORY_MAX_NUM / pages_count);
        if (bDestCell >= INVENTORY_MAX_NUM)
            return false;
        if (pPageDest != pPageDest2)
        {
            for (int ii = 1; ii < 4; ++ii)
            {
                pPageDest2 = (bDestCell + (5*(item1->GetSize()-1)) - (5 * ii)) / (INVENTORY_MAX_NUM / pages_count);
                if (pPageDest == pPageDest2)
                {
                    bDestCell = bDestCell - (5 * ii);
                    break;
                }
            }
        }
        if (pPageDest != pPageDest2)
            return false;
        item1->RemoveFromCharacter();
        for (int i = 0; i < item1->GetSize(); ++i)
        {
            BYTE bBusyCell = bDestCell + (5 * i);
            BYTE lpage = bBusyCell / (INVENTORY_MAX_NUM / pages_count);
            if (lpage != pPageDest)
                continue;
            TItemPos busyCell(INVENTORY, bBusyCell);
            LPITEM busy = GetItem(busyCell);
            if (busy)
            {
                busy->RemoveFromCharacter();
                busy->AddToCharacter(this, TItemPos(INVENTORY, bCell1 + (5 * i)));
            }
        }
        item1->AddToCharacter(this, TItemPos(INVENTORY, bDestCell));
    }

    return true;
}

 

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

 

Note:

char_item.cpp > Search:

Spoiler

BYTE pages_count = 4;

Edit the number of pages inventory

  • Metin2 Dev 2
  • Good 1
  • Love 7
Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...
  • 1 year later...
  • 1 year later...

Help ? 

 

char_item.cpp: In member function 'bool CHARACTER::SwapItemToItem(TItemPos, TItemPos)':
char_item.cpp:7821:26: error: expected unqualified-id before '?' token
     BYTE bCell = srcCell.?cell;
                          ^
char_item.cpp:7821:27: error: 'cell' was not declared in this scope
     BYTE bCell = srcCell.?cell;
                           ^
char_item.cpp:7821:31: error: expected ':' before ';' token
     BYTE bCell = srcCell.?cell;
                               ^
char_item.cpp:7821:31: error: expected primary-expression before ';' token
char_item.cpp:7857:31: error: expected primary-expression before '?' token
         item1->AddToCharacter(?this, TItemPos(INVENTORY, bCell2));
                               ^
char_item.cpp:7857:65: error: expected ':' before ')' token
         item1->AddToCharacter(?this, TItemPos(INVENTORY, bCell2));
                                                                 ^
char_item.cpp:7857:65: error: expected primary-expression before ')' token
char_item.cpp:7864:20: error: 'CHAT_TYPE_' was not declared in this scope
         ChatPacket(CHAT_TYPE_?INFO, "Slot %d", bDestCell);
                    ^
char_item.cpp:7864:31: error: 'INFO' was not declared in this scope
         ChatPacket(CHAT_TYPE_?INFO, "Slot %d", bDestCell);
                               ^
char_item.cpp:7864:57: error: expected ':' before ')' token
         ChatPacket(CHAT_TYPE_?INFO, "Slot %d", bDestCell);
                                                         ^
char_item.cpp:7864:57: error: expected primary-expression before ')' token
char_item.cpp:7884:36: error: 'class CItem' has no member named 'G'
         for (int i = 0; i < item1->G?etSize(); ++i)
                                    ^
char_item.cpp:7884:45: error: 'etSize' was not declared in this scope
         for (int i = 0; i < item1->G?etSize(); ++i)
                                             ^
char_item.cpp:7884:46: error: expected ':' before ';' token
         for (int i = 0; i < item1->G?etSize(); ++i)
                                              ^
char_item.cpp:7884:46: error: expected primary-expression before ';' token
char_item.cpp:7895:17: error: expected primary-expression before '?' token
                 ?busy->AddToCharacter(this, TItemPos(INVENTORY, bCell1 + (5 * i)));
                 ^
char_item.cpp:7895:83: error: expected ':' before ';' token
                 ?busy->AddToCharacter(this, TItemPos(INVENTORY, bCell1 + (5 * i)));
     

Link to comment
Share on other sites

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.