Fix refunding

This commit is contained in:
Lawin0129
2022-01-15 13:45:57 +00:00
committed by GitHub
parent 9673f2b09c
commit 8f59b8e717

View File

@@ -1975,22 +1975,22 @@ express.post("/fortnite/api/game/v2/profile/*/client/RefundMtxPurchase", async (
profile.stats.attributes.mtx_purchase_history.refundsUsed += 1; profile.stats.attributes.mtx_purchase_history.refundsUsed += 1;
profile.stats.attributes.mtx_purchase_history.refundCredits -= 1; profile.stats.attributes.mtx_purchase_history.refundCredits -= 1;
for (var purchase in profile.stats.attributes.mtx_purchase_history.purchases) { for (var i = 0; i < profile.stats.attributes.mtx_purchase_history.purchases.length; i++) {
if (profile.stats.attributes.mtx_purchase_history.purchases[purchase].purchaseId == req.body.purchaseId) { if (profile.stats.attributes.mtx_purchase_history.purchases[i].purchaseId == req.body.purchaseId) {
for (var item in profile.stats.attributes.mtx_purchase_history.purchases[purchase].lootResult) { for (var x = 0; x < profile.stats.attributes.mtx_purchase_history.purchases[i].lootResult.length; x++) {
ItemGuids.push(profile.stats.attributes.mtx_purchase_history.purchases[purchase].lootResult[item].itemGuid) ItemGuids.push(profile.stats.attributes.mtx_purchase_history.purchases[i].lootResult[x].itemGuid)
} }
profile.stats.attributes.mtx_purchase_history.purchases[purchase].refundDate = new Date().toISOString(); profile.stats.attributes.mtx_purchase_history.purchases[i].refundDate = new Date().toISOString();
} }
} }
for (var item in ItemGuids) { for (var i = 0; i < ItemGuids.length; i++) {
delete ItemProfile.items[item] delete ItemProfile.items[ItemGuids[i]]
MultiUpdate[0].profileChanges.push({ MultiUpdate[0].profileChanges.push({
"changeType": "itemRemoved", "changeType": "itemRemoved",
"itemId": item "itemId": ItemGuids[i]
}) })
} }