xRooT 24 Posted July 1, 2016 Share Posted July 1, 2016 M2 Download Center This is the hidden content, please Sign In or Sign Up ( Internal ) Spoiler 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 3 2 7 Link to comment Share on other sites More sharing options...
ImTweet 0 Posted July 1, 2016 Share Posted July 1, 2016 Bugs? Link to comment Share on other sites More sharing options...
xRooT 24 Posted July 2, 2016 Author Share Posted July 2, 2016 13 hours ago, ImTweet said: Bugs? I do not know, but leave room for experts in repairing the bugs Link to comment Share on other sites More sharing options...
BeHappy4Ever 247 Posted July 3, 2016 Share Posted July 3, 2016 Is it tested? o.o Link to comment Share on other sites More sharing options...
xRooT 24 Posted July 3, 2016 Author Share Posted July 3, 2016 2 hours ago, BeHappy4Ever said: Is it tested? o.o No This system Link to comment Share on other sites More sharing options...
Tacticus 73 Posted July 15, 2016 Share Posted July 15, 2016 tested work perfect Link to comment Share on other sites More sharing options...
Active Member Mind Rapist 186 Posted August 23, 2016 Active Member Share Posted August 23, 2016 Thanks Link to comment Share on other sites More sharing options...
John456 50 Posted August 24, 2016 Share Posted August 24, 2016 Bug Link to comment Share on other sites More sharing options...
Active Member Mind Rapist 186 Posted August 24, 2016 Active Member Share Posted August 24, 2016 5 hours ago, John456 said: Bug What bug? Link to comment Share on other sites More sharing options...
Aioria 10 Posted September 12, 2017 Share Posted September 12, 2017 (edited) It works for me, i have just a little bug, does someone know how to solve it? Edited August 20, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
haristhc 0 Posted June 18, 2019 Share Posted June 18, 2019 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 More sharing options...
Recommended Posts