void RightClickMoveItem()
{
// ============================================================
// ✅ FIX: Block auto-wear if CTRL is pressed (PK mode)
// ============================================================
if (GetKeyState(VK_CONTROL) & 0x8000)
{
return; // Do NOT auto-equip the item
}
// ============================================================
// ✅ ORIGINAL RIGHT-CLICK LOGIC
// ============================================================
if (!ppMousePress(VK_RBUTTON) || PickedItem || ItemMove)
{
return;
}
if (pCheckWindow(pWindowThis(), 9) == 0 && pCheckWindow(pWindowThis(), 13) == 0) // ChaosBox ~ Inventory
{
return;
}
ItemMove = false;
SourceFlag = -1;
SourceSlot = *(DWORD*)((DWORD)InventoryThis(pWindowThis()) + 284);
TargetSlot = -1;
if (SourceSlot >= 0 && SourceSlot < INVENTORY_WEAR_SIZE)
{
if (*(DWORD*)MAIN_CURRENT_MAP == 10 || *(DWORD*)MAIN_CURRENT_MAP == 39)
{
if (SourceSlot == 7 &&
GetItemEquipedIndex(8) != GET_ITEM(13, 3) &&
GetItemEquipedIndex(8) != GET_ITEM(13, 4) &&
GetItemEquipedIndex(8) != GET_ITEM(13, 37))
{
return;
}
if (SourceSlot == 8 &&
(GetItemEquipedIndex(8) == GET_ITEM(13, 3) ||
GetItemEquipedIndex(8) == GET_ITEM(13, 4) ||
GetItemEquipedIndex(8) == GET_ITEM(13, 37)) &&
GetItemEquipedIndex(7) == 0xFFFF)
{
return;
}
}
DWORD ItemStruct = GetItemEquiped(SourceSlot);
if (ItemStruct && GetItemEquipedIndex(SourceSlot) != 0xFFFF)
{
ITEM_INFO2* lpItemInfo = GetItemInfo(*(WORD*)ItemStruct);
TargetSlot = InventoryFindEmptySlot(InventoryThis(pWindowThis()), lpItemInfo->Width, lpItemInfo->Height);
if (TargetSlot != -1)
{
SendRequestEquipmentItem(0, SourceSlot, ItemStruct, 0, INVENTORY_WEAR_SIZE + TargetSlot);
ResetMouseRButton();
ItemMove = true;
SourceFlag = 0;
}
}
}
else
{
int InventoryMain = InventoryFindItemSlot(GetMyInventoryCtrl(InventoryThis(pWindowThis()), 0), pCursorX, pCursorY);
int InventoryExpand1 = InventoryFindItemSlot(GetMyInventoryCtrl(InventoryThis(pWindowThis()), 1), pCursorX, pCursorY);
int InventoryExpand2 = InventoryFindItemSlot(GetMyInventoryCtrl(InventoryThis(pWindowThis()), 2), pCursorX, pCursorY);
if (pCheckWindow(pWindowThis(), 9) != 0)
{
DWORD MixItemStruct = (DWORD)InventoryFindItem(MixGetMyInventoryCtrl(MixInventoryThis(pWindowThis())), pCursorX, pCursorY);
if (MixItemStruct)
{
ITEM_INFO2* lpItemInfo = GetItemInfo(*(WORD*)MixItemStruct);
SourceSlot = InventoryFindItemSlot(MixGetMyInventoryCtrl(MixInventoryThis(pWindowThis())), pCursorX, pCursorY);
TargetSlot = InventoryFindEmptySlot(InventoryThis(pWindowThis()), lpItemInfo->Width, lpItemInfo->Height);
if (SourceSlot != -1 && TargetSlot != -1)
{
SendRequestEquipmentItem(3, SourceSlot, MixItemStruct, 0, INVENTORY_WEAR_SIZE + TargetSlot);
ResetMouseRButton();
ItemMove = true;
SourceFlag = 1;
}
}
else
{
DWORD InventoryCtrl = -1;
DWORD ItemStruct = (DWORD)InventoryFindItemAtPt(InventoryThis(pWindowThis()), pCursorX, pCursorY, &InventoryCtrl);
if (ItemStruct)
{
ITEM_INFO2* lpItemInfo = GetItemInfo(*(WORD*)ItemStruct);
if (InventoryMain != -1)
SourceSlot = INVENTORY_WEAR_SIZE + InventoryMain;
else if (InventoryExpand1 != -1)
SourceSlot = INVENTORY_EXT1_SIZE + InventoryExpand1;
else if (InventoryExpand2 != -1)
SourceSlot = INVENTORY_EXT2_SIZE + InventoryExpand2;
TargetSlot = InventoryMixFindEmptySlot(MixGetMyInventoryCtrl(MixInventoryThis(pWindowThis())), lpItemInfo->Width, lpItemInfo->Height);
if (SourceSlot != -1 && TargetSlot != -1)
{
SendRequestEquipmentItem(0, SourceSlot, ItemStruct, 3, TargetSlot);
ResetMouseRButton();
ItemMove = true;
SourceFlag = 0;
}
}
}
}
else
{
if (pCheckWindow(pWindowThis(), 7) != 0 || pCheckWindow(pWindowThis(), 8) != 0) // Trade ~ Warehouse
{
return;
}
DWORD InventoryCtrl = -1;
DWORD ItemStruct = (DWORD)InventoryFindItemAtPt(InventoryThis(pWindowThis()), pCursorX, pCursorY, &InventoryCtrl);
if (ItemStruct)
{
if (InventoryMain != -1)
SourceSlot = INVENTORY_WEAR_SIZE + InventoryMain;
else if (InventoryExpand1 != -1)
SourceSlot = INVENTORY_EXT1_SIZE + InventoryExpand1;
else if (InventoryExpand2 != -1)
SourceSlot = INVENTORY_EXT2_SIZE + InventoryExpand2;
TargetSlot = GetInventoryWearSlot(*(WORD*)ItemStruct);
if (SourceSlot != -1 && TargetSlot != 0xFF)
{
SendRequestEquipmentItem(0, SourceSlot, ItemStruct, 0, TargetSlot);
ResetMouseRButton();
ItemMove = true;
SourceFlag = 0;
}
}
}
}
}