1. bool CHARACTER::MoveItem(TItemPos Cell, TItemPos DestCell, BYTE count)
  2. {
  3. sys_err("Evet moveitem'a dusuyor");
  4. LPITEM item = NULL;
  5. if (!IsValidItemPosition(Cell))
  6. return false;
  7. if (!(item = GetItem(Cell)))
  8. return false;
  9. if (item->IsExchanging())
  10. return false;
  11. if (item->GetCount() < count)
  12. return false;
  13. if (INVENTORY == Cell.window_type && Cell.cell >= INVENTORY_MAX_NUM && IS_SET(item->GetFlag(), ITEM_FLAG_IRREMOVABLE))
  14. return false;
  15. #ifdef __ENABLE_SPECIAL_INVENTORY_SYSTEM__
  16. if (item->IsSkillBook() && DestCell.window_type != SKILL_BOOK_INVENTORY)
  17. return false;
  18. if (item->IsUpgradeItem() && DestCell.window_type != UPGRADE_ITEMS_INVENTORY)
  19. return false;
  20. if (item->IsStone() && DestCell.window_type != STONE_ITEMS_INVENTORY)
  21. return false;
  22. #endif
  23. if (true == item->isLocked())
  24. return false;
  25. if (!IsValidItemPosition(DestCell))
  26. {
  27. return false;
  28. }
  29. if (!CanHandleItem())
  30. {
  31. if (NULL != DragonSoul_RefineWindow_GetOpener())
  32. ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°­È­Ã¢À» ¿¬ »óÅ¿¡¼­´Â ¾ÆÀÌÅÛÀ» ¿Å±æ ¼ö ¾ø½À´Ï´Ù."));
  33. return false;
  34. }
  35. // ±âȹÀÚÀÇ ¿äûÀ¸·Î º§Æ® Àκ¥Å丮¿¡´Â ƯÁ¤ ŸÀÔÀÇ ¾ÆÀÌÅÛ¸¸ ³ÖÀ» ¼ö ÀÖ´Ù.
  36. if (DestCell.IsBeltInventoryPosition() && false == CBeltInventoryHelper::CanMoveIntoBeltInventory(item))
  37. {
  38. ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ ¾ÆÀÌÅÛÀº º§Æ® Àκ¥Å丮·Î ¿Å±æ ¼ö ¾ø½À´Ï´Ù."));
  39. return false;
  40. }
  41. // ÀÌ¹Ì Âø¿ëÁßÀÎ ¾ÆÀÌÅÛÀ» ´Ù¸¥ °÷À¸·Î ¿Å±â´Â °æ¿ì, 'ÀåÃ¥ ÇØÁ¦' °¡´ÉÇÑ Áö È®ÀÎÇÏ°í ¿Å±è
  42. if (Cell.IsEquipPosition() && !CanUnequipNow(item))
  43. return false;
  44. if (DestCell.IsEquipPosition())
  45. {
  46. if (GetItem(DestCell)) // ÀåºñÀÏ °æ¿ì ÇÑ °÷¸¸ °Ë»çÇØµµ µÈ´Ù.
  47. {
  48. ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ¹Ì Àåºñ¸¦ Âø¿ëÇϰí ÀÖ½À´Ï´Ù."));
  49. return false;
  50. }
  51. EquipItem(item, DestCell.cell - INVENTORY_MAX_NUM);
  52. }
  53. else
  54. {
  55. if (item->IsDragonSoul())
  56. {
  57. if (item->IsEquipped())
  58. {
  59. return DSManager::instance().PullOut(this, DestCell, item);
  60. }
  61. else
  62. {
  63. if (DestCell.window_type != DRAGON_SOUL_INVENTORY)
  64. {
  65. return false;
  66. }
  67. if (!DSManager::instance().IsValidCellForThisItem(item, DestCell))
  68. return false;
  69. }
  70. }
  71. // ¿ëÈ¥¼®ÀÌ ¾Æ´Ñ ¾ÆÀÌÅÛÀº ¿ëÈ¥¼® Àκ¥¿¡ µé¾î°¥ ¼ö ¾ø´Ù.
  72. else if (DRAGON_SOUL_INVENTORY == DestCell.window_type)
  73. return false;
  74. #ifdef __ENABLE_SPECIAL_INVENTORY_SYSTEM__
  75. if (!item->IsUpgradeItem() && UPGRADE_ITEMS_INVENTORY == DestCell.window_type)
  76. return false;
  77. if (!item->IsSkillBook() && SKILL_BOOK_INVENTORY == DestCell.window_type)
  78. return false;
  79. if (!item->IsStone() && STONE_ITEMS_INVENTORY == DestCell.window_type)
  80. return false;
  81. #endif
  82. LPITEM item2;
  83. if ((item2 = GetItem(DestCell)) && item != item2 && item2->IsStackable() &&
  84. !IS_SET(item2->GetAntiFlag(), ITEM_ANTIFLAG_STACK) &&
  85. item2->GetVnum() == item->GetVnum()) // ÇÕÄ¥ ¼ö ÀÖ´Â ¾ÆÀÌÅÛÀÇ °æ¿ì
  86. {
  87. for (int i = 0; i < ITEM_SOCKET_MAX_NUM; ++i)
  88. if (item2->GetSocket(i) != item->GetSocket(i))
  89. return false;
  90. if (count == 0)
  91. count = item->GetCount();
  92. 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,
  93. DestCell.window_type, DestCell.cell, count);
  94. /* İç içe item sayısı // ITEMMAXCOUNT // 21.10.17 - 13:43 */
  95. count = MIN(ITEM_MAX_COUNT - item2->GetCount(), count);
  96. item->SetCount(item->GetCount() - count);
  97. item2->SetCount(item2->GetCount() + count);
  98. return true;
  99. }
  100. if (!IsEmptyItemGrid(DestCell, item->GetSize(), Cell.cell))
  101. return false;
  102. if (count == 0 || count >= item->GetCount() || !item->IsStackable() || IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_STACK))
  103. {
  104. 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,
  105. DestCell.window_type, DestCell.cell, count);
  106. item->RemoveFromCharacter();
  107. SetItem(DestCell, item);
  108. if (INVENTORY == Cell.window_type && INVENTORY == DestCell.window_type)
  109. SyncQuickslot(QUICKSLOT_TYPE_ITEM, Cell.cell, DestCell.cell);
  110. }
  111. else if (count < item->GetCount())
  112. {
  113. //check non-split items
  114. //if (LC_IsNewCIBN())
  115. //{
  116. // if (item->GetVnum() == 71095 || item->GetVnum() == 71050 || item->GetVnum() == 70038)
  117. // {
  118. // return false;
  119. // }
  120. //}
  121. 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,
  122. DestCell.window_type, DestCell.cell, count);
  123. item->SetCount(item->GetCount() - count);
  124. LPITEM item2 = ITEM_MANAGER::instance().CreateItem(item->GetVnum(), count);
  125. // copy socket -- by mhh
  126. FN_copy_item_socket(item2, item);
  127. item2->AddToCharacter(this, DestCell);
  128. char szBuf[51+1];
  129. snprintf(szBuf, sizeof(szBuf), "%u %u %u %u ", item2->GetID(), item2->GetCount(), item->GetCount(), item->GetCount() + item2->GetCount());
  130. LogManager::instance().ItemLog(this, item, "ITEM_SPLIT", szBuf);
  131. }
  132. }
  133. return true;
  134. }

sex