diff options
author | Machiavelli <none@none> | 2010-03-18 22:56:48 +0100 |
---|---|---|
committer | Machiavelli <none@none> | 2010-03-18 22:56:48 +0100 |
commit | 35a7f4849e161ebab96120a091cce7ed40bb5fc8 (patch) | |
tree | 495f4a04523ddec2ac31c217b3f87745ec95759c /src/game/ItemHandler.cpp | |
parent | ef57a96ccec821ca63cdf0a6b9f73f6df174fc7f (diff) |
Store alternate currency spent on an item by Item ExtendedCost entry instead of honorPts/arenaPts/items seperately. Thanks to Opterman for the idea.
--HG--
branch : trunk
Diffstat (limited to 'src/game/ItemHandler.cpp')
-rw-r--r-- | src/game/ItemHandler.cpp | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/src/game/ItemHandler.cpp b/src/game/ItemHandler.cpp index 1afe43f43a9..5952f73062e 100644 --- a/src/game/ItemHandler.cpp +++ b/src/game/ItemHandler.cpp @@ -1382,18 +1382,24 @@ void WorldSession::HandleItemRefundInfoRequest(WorldPacket& recv_data) item->SetNotRefundable(GetPlayer()); return; } + + ItemExtendedCostEntry const* iece = sItemExtendedCostStore.LookupEntry(RefundData->paidExtendedCost); + if (!iece) + { + sLog.outDebug("Item refund: cannot find extendedcost data."); + return; + } item->UpdatePlayedTime(GetPlayer()); - WorldPacket data(SMSG_ITEM_REFUND_INFO_RESPONSE, 8+4+4+4+4*4+4*4+4+4); data << uint64(guid); // item guid data << uint32(RefundData->paidMoney); // money cost - data << uint32(RefundData->paidHonorPoints); // honor point cost - data << uint32(RefundData->paidArenaPoints); // arena point cost + data << uint32(iece->reqhonorpoints); // honor point cost + data << uint32(iece->reqarenapoints); // arena point cost for (uint8 i = 0; i < 5; ++i) // item cost data { - data << RefundData->paidItemId[i]; - data << RefundData->paidItemCount[i]; + data << iece->reqitem[i]; + data << iece->reqitemcount[i]; } data << uint32(0); data << uint32(GetPlayer()->GetTotalPlayedTime() - item->GetPlayedTime()); @@ -1444,11 +1450,18 @@ void WorldSession::HandleItemRefund(WorldPacket &recv_data) return; } + ItemExtendedCostEntry const* iece = sItemExtendedCostStore.LookupEntry(RefundData->paidExtendedCost); + if (!iece) + { + sLog.outDebug("Item refund: cannot find extendedcost data."); + return; + } + bool store_error = false; for (uint8 i = 0; i < 5; ++i) { - uint32 count = RefundData->paidItemCount[i]; - uint32 itemid = RefundData->paidItemId[i]; + uint32 count = iece->reqitemcount[i]; + uint32 itemid = iece->reqitem[i]; if (count && itemid) { @@ -1475,12 +1488,12 @@ void WorldSession::HandleItemRefund(WorldPacket &recv_data) data << uint64(guid); // item guid data << uint32(0); // 0, or error code data << uint32(RefundData->paidMoney); // money cost - data << uint32(RefundData->paidHonorPoints); // honor point cost - data << uint32(RefundData->paidArenaPoints); // arena point cost + data << uint32(iece->reqhonorpoints); // honor point cost + data << uint32(iece->reqarenapoints); // arena point cost for (uint8 i = 0; i < 5; ++i) // item cost data { - data << RefundData->paidItemId[i]; - data << RefundData->paidItemCount[i]; + data << iece->reqitem[i]; + data << iece->reqitemcount[i]; } SendPacket(&data); @@ -1493,8 +1506,8 @@ void WorldSession::HandleItemRefund(WorldPacket &recv_data) // Grant back extendedcost items for (uint8 i = 0; i < 5; ++i) { - uint32 count = RefundData->paidItemCount[i]; - uint32 itemid = RefundData->paidItemId[i]; + uint32 count = iece->reqitemcount[i]; + uint32 itemid = iece->reqitem[i]; if (count && itemid) { ItemPosCountVec dest; @@ -1511,12 +1524,12 @@ void WorldSession::HandleItemRefund(WorldPacket &recv_data) _player->ModifyMoney(moneyRefund); // Grant back Honor points - uint32 honorRefund = RefundData->paidHonorPoints; + uint32 honorRefund = iece->reqhonorpoints; if (honorRefund) _player->ModifyHonorPoints(honorRefund); // Grant back Arena points - uint32 arenaRefund = RefundData->paidArenaPoints; + uint32 arenaRefund = iece->reqarenapoints; if (arenaRefund) _player->ModifyArenaPoints(arenaRefund); |