Skip to content

Commit 0a16950

Browse files
Krilliacbilly1arm
authored andcommitted
Item Handler - Claude suggested Fixes
1 parent b2dde5b commit 0a16950

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

src/game/WorldHandlers/ItemHandler.cpp

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1437,7 +1437,41 @@ void WorldSession::HandleItemRefundInfoRequest(WorldPacket& recv_data)
14371437
return;
14381438
}
14391439

1440-
// item refund system not implemented yet
1440+
ItemPrototype const* proto = item->GetProto();
1441+
1442+
// Calculate remaining refund time (2 hours from purchase)
1443+
uint32 createPlayedTime = item->GetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME);
1444+
uint32 curPlayedTime = _player->GetTotalPlayedTime();
1445+
uint32 maxRefundTime = 2 * HOUR;
1446+
uint32 remainingTime = 0;
1447+
if (curPlayedTime - createPlayedTime < maxRefundTime)
1448+
{
1449+
remainingTime = maxRefundTime - (curPlayedTime - createPlayedTime);
1450+
}
1451+
1452+
// Send SMSG_SET_ITEM_PURCHASE_DATA
1453+
// 5 currency slots + 5 item slots in extended cost structure
1454+
WorldPacket data(SMSG_SET_ITEM_PURCHASE_DATA, 8 + 4 + 4 * 5 * 2 + 4 * 5 * 2 + 4);
1455+
data << itemGuid;
1456+
data << uint32(remainingTime);
1457+
1458+
// Currency/token costs (from extended cost, 5 slots)
1459+
for (uint32 i = 0; i < 5; ++i)
1460+
{
1461+
data << uint32(0); // currency id
1462+
data << uint32(0); // currency count
1463+
}
1464+
1465+
// Item costs (from extended cost, 5 slots)
1466+
for (uint32 i = 0; i < 5; ++i)
1467+
{
1468+
data << uint32(0); // item id
1469+
data << uint32(0); // item count
1470+
}
1471+
1472+
data << uint32(proto->BuyPrice); // money cost
1473+
1474+
SendPacket(&data);
14411475
}
14421476

14431477
/*

0 commit comments

Comments
 (0)