- bool CHARACTER::MoveItem(TItemPos Cell, TItemPos DestCell, BYTE count)
- {
- sys_err("Evet moveitem'a dusuyor");
- LPITEM item = NULL;
- if (!IsValidItemPosition(Cell))
- return false;
- if (!(item = GetItem(Cell)))
- return false;
- if (item->IsExchanging())
- return false;
- if (item->GetCount() < count)
- return false;
- if (INVENTORY == Cell.window_type && Cell.cell >= INVENTORY_MAX_NUM && IS_SET(item->GetFlag(), ITEM_FLAG_IRREMOVABLE))
- return false;
- #ifdef __ENABLE_SPECIAL_INVENTORY_SYSTEM__
- if (item->IsSkillBook() && DestCell.window_type != SKILL_BOOK_INVENTORY)
- return false;
- if (item->IsUpgradeItem() && DestCell.window_type != UPGRADE_ITEMS_INVENTORY)
- return false;
- if (item->IsStone() && DestCell.window_type != STONE_ITEMS_INVENTORY)
- return false;
- #endif
- if (true == item->isLocked())
- return false;
- if (!IsValidItemPosition(DestCell))
- {
- return false;
- }
- if (!CanHandleItem())
- {
- if (NULL != DragonSoul_RefineWindow_GetOpener())
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°ÈâÀ» ¿¬ »óÅ¿¡¼´Â ¾ÆÀÌÅÛÀ» ¿Å±æ ¼ö ¾ø½À´Ï´Ù."));
- return false;
- }
- // ±âȹÀÚÀÇ ¿äûÀ¸·Î º§Æ® Àκ¥Å丮¿¡´Â ƯÁ¤ ŸÀÔÀÇ ¾ÆÀÌÅÛ¸¸ ³ÖÀ» ¼ö ÀÖ´Ù.
- if (DestCell.IsBeltInventoryPosition() && false == CBeltInventoryHelper::CanMoveIntoBeltInventory(item))
- {
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ ¾ÆÀÌÅÛÀº º§Æ® Àκ¥Å丮·Î ¿Å±æ ¼ö ¾ø½À´Ï´Ù."));
- return false;
- }
- // ÀÌ¹Ì Âø¿ëÁßÀÎ ¾ÆÀÌÅÛÀ» ´Ù¸¥ °÷À¸·Î ¿Å±â´Â °æ¿ì, 'ÀåÃ¥ ÇØÁ¦' °¡´ÉÇÑ Áö È®ÀÎÇÏ°í ¿Å±è
- if (Cell.IsEquipPosition() && !CanUnequipNow(item))
- return false;
- if (DestCell.IsEquipPosition())
- {
- if (GetItem(DestCell)) // ÀåºñÀÏ °æ¿ì ÇÑ °÷¸¸ °Ë»çÇØµµ µÈ´Ù.
- {
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ¹Ì Àåºñ¸¦ Âø¿ëÇϰí ÀÖ½À´Ï´Ù."));
- return false;
- }
- EquipItem(item, DestCell.cell - INVENTORY_MAX_NUM);
- }
- else
- {
- if (item->IsDragonSoul())
- {
- if (item->IsEquipped())
- {
- return DSManager::instance().PullOut(this, DestCell, item);
- }
- else
- {
- if (DestCell.window_type != DRAGON_SOUL_INVENTORY)
- {
- return false;
- }
- if (!DSManager::instance().IsValidCellForThisItem(item, DestCell))
- return false;
- }
- }
- // ¿ëÈ¥¼®ÀÌ ¾Æ´Ñ ¾ÆÀÌÅÛÀº ¿ëÈ¥¼® Àκ¥¿¡ µé¾î°¥ ¼ö ¾ø´Ù.
- else if (DRAGON_SOUL_INVENTORY == DestCell.window_type)
- return false;
- #ifdef __ENABLE_SPECIAL_INVENTORY_SYSTEM__
- if (!item->IsUpgradeItem() && UPGRADE_ITEMS_INVENTORY == DestCell.window_type)
- return false;
- if (!item->IsSkillBook() && SKILL_BOOK_INVENTORY == DestCell.window_type)
- return false;
- if (!item->IsStone() && STONE_ITEMS_INVENTORY == DestCell.window_type)
- return false;
- #endif
- LPITEM item2;
- if ((item2 = GetItem(DestCell)) && item != item2 && item2->IsStackable() &&
- !IS_SET(item2->GetAntiFlag(), ITEM_ANTIFLAG_STACK) &&
- item2->GetVnum() == item->GetVnum()) // ÇÕÄ¥ ¼ö ÀÖ´Â ¾ÆÀÌÅÛÀÇ °æ¿ì
- {
- for (int i = 0; i < ITEM_SOCKET_MAX_NUM; ++i)
- if (item2->GetSocket(i) != item->GetSocket(i))
- return false;
- if (count == 0)
- count = item->GetCount();
- sys_log(0, "%s: ITEM_STACK %s (window: %d, cell : %d) -> (window:%d, cell %d) count %d", GetName(), item->GetName(), Cell.window_type, Cell.cell,
- DestCell.window_type, DestCell.cell, count);
- /* İç içe item sayısı // ITEMMAXCOUNT // 21.10.17 - 13:43 */
- count = MIN(ITEM_MAX_COUNT - item2->GetCount(), count);
- item->SetCount(item->GetCount() - count);
- item2->SetCount(item2->GetCount() + count);
- return true;
- }
- if (!IsEmptyItemGrid(DestCell, item->GetSize(), Cell.cell))
- return false;
- if (count == 0 || count >= item->GetCount() || !item->IsStackable() || IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_STACK))
- {
- sys_log(0, "%s: ITEM_MOVE %s (window: %d, cell : %d) -> (window:%d, cell %d) count %d", GetName(), item->GetName(), Cell.window_type, Cell.cell,
- DestCell.window_type, DestCell.cell, count);
- item->RemoveFromCharacter();
- SetItem(DestCell, item);
- if (INVENTORY == Cell.window_type && INVENTORY == DestCell.window_type)
- SyncQuickslot(QUICKSLOT_TYPE_ITEM, Cell.cell, DestCell.cell);
- }
- else if (count < item->GetCount())
- {
- //check non-split items
- //if (LC_IsNewCIBN())
- //{
- // if (item->GetVnum() == 71095 || item->GetVnum() == 71050 || item->GetVnum() == 70038)
- // {
- // return false;
- // }
- //}
- sys_log(0, "%s: ITEM_SPLIT %s (window: %d, cell : %d) -> (window:%d, cell %d) count %d", GetName(), item->GetName(), Cell.window_type, Cell.cell,
- DestCell.window_type, DestCell.cell, count);
- item->SetCount(item->GetCount() - count);
- LPITEM item2 = ITEM_MANAGER::instance().CreateItem(item->GetVnum(), count);
- // copy socket -- by mhh
- FN_copy_item_socket(item2, item);
- item2->AddToCharacter(this, DestCell);
- char szBuf[51+1];
- snprintf(szBuf, sizeof(szBuf), "%u %u %u %u ", item2->GetID(), item2->GetCount(), item->GetCount(), item->GetCount() + item2->GetCount());
- LogManager::instance().ItemLog(this, item, "ITEM_SPLIT", szBuf);
- }
- }
- return true;
- }
sex