feat: replace CreateHTTPRequest with CreateHTTPRequestScriptVM

Allows the game client to make HTTP API calls from a listen server
(local lobby) instead of requiring a Steam dedicated server.
CreateHTTPRequestScriptVM has the exact same API signature but works
in both dedicated server and listen server contexts.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
achmad
2026-05-29 17:36:08 +07:00
parent 49b790349f
commit 72b73c4dd6
16 changed files with 70 additions and 70 deletions
+16 -16
View File
@@ -330,7 +330,7 @@ function StoreManager.prototype.handleDonatePaymentLink(self, playerId, amountRu
self:sendDonatePaymentLinkResult(playerId, false, "Игрок не найден")
return
end
local request = CreateHTTPRequest("POST", SERVER_CONFIG.API_URL .. "/payments/robokassa/link")
local request = CreateHTTPRequestScriptVM("POST", SERVER_CONFIG.API_URL .. "/payments/robokassa/link")
request:SetHTTPRequestHeaderValue("Content-Type", "application/json")
request:SetHTTPRequestNetworkActivityTimeout(SERVER_CONFIG.NETWORK_TIMEOUT)
request:SetHTTPRequestAbsoluteTimeoutMS(SERVER_CONFIG.ABSOLUTE_TIMEOUT)
@@ -470,7 +470,7 @@ function StoreManager.prototype.handleBundlePaymentLink(self, playerId, bundleId
self:sendBundlePaymentLinkResult(playerId, false, "Игрок не найден")
return
end
local request = CreateHTTPRequest("POST", SERVER_CONFIG.API_URL .. "/payments/bundles/link")
local request = CreateHTTPRequestScriptVM("POST", SERVER_CONFIG.API_URL .. "/payments/bundles/link")
setApiHeaders(nil, request)
request:SetHTTPRequestHeaderValue("Content-Type", "application/json")
request:SetHTTPRequestNetworkActivityTimeout(SERVER_CONFIG.NETWORK_TIMEOUT)
@@ -767,7 +767,7 @@ function StoreManager.prototype.handleDealsCatalogRequest(self, playerId)
self:sendDealsCatalogResult(playerId, false, {}, "Игрок не найден")
return
end
local request = CreateHTTPRequest(
local request = CreateHTTPRequestScriptVM(
"GET",
(SERVER_CONFIG.API_URL .. "/payments/deals?steam_id=") .. tostring(steamId)
)
@@ -876,7 +876,7 @@ function StoreManager.prototype.handleDealPurchase(self, playerId, dealKey)
self:sendPurchaseResult(playerId, false, "Игрок не найден")
return
end
local request = CreateHTTPRequest(
local request = CreateHTTPRequestScriptVM(
"POST",
((SERVER_CONFIG.API_URL .. "/player/") .. tostring(steamId)) .. "/deal-purchase"
)
@@ -1091,7 +1091,7 @@ function StoreManager.prototype.reloadSoundsWheelFromServer(self, playerId)
if not steamId then
return
end
local request = CreateHTTPRequest(
local request = CreateHTTPRequestScriptVM(
"GET",
((SERVER_CONFIG.API_URL .. "/player/") .. tostring(steamId)) .. "/sounds_wheel"
)
@@ -1208,7 +1208,7 @@ function StoreManager.prototype.handlePromoCode(self, playerId, rawCode)
self:sendPromoCodeResult(playerId, false, "Игрок не найден")
return
end
local request = CreateHTTPRequest(
local request = CreateHTTPRequestScriptVM(
"POST",
((SERVER_CONFIG.API_URL .. "/player/") .. tostring(steamId)) .. "/promo/redeem"
)
@@ -1449,7 +1449,7 @@ function StoreManager.prototype.syncLatestCurrencyTotalsFromApi(self, playerId,
onDone(nil, false)
return
end
local request = CreateHTTPRequest(
local request = CreateHTTPRequestScriptVM(
"GET",
((SERVER_CONFIG.API_URL .. "/player/") .. tostring(steamId)) .. "/currency"
)
@@ -1905,7 +1905,7 @@ function StoreManager.prototype.saveActiveEffectsToServer(self, playerId, active
if not steamId then
return
end
local request = CreateHTTPRequest(
local request = CreateHTTPRequestScriptVM(
"PUT",
((SERVER_CONFIG.API_URL .. "/player/") .. tostring(steamId)) .. "/active_effects"
)
@@ -1971,7 +1971,7 @@ function StoreManager.prototype.loadActiveEffectsFromServer(self, playerId, call
callback(nil, {})
return
end
local request = CreateHTTPRequest(
local request = CreateHTTPRequestScriptVM(
"GET",
((SERVER_CONFIG.API_URL .. "/player/") .. tostring(steamId)) .. "/active_effects"
)
@@ -2043,7 +2043,7 @@ function StoreManager.prototype.savePurchaseToServer(self, playerId, itemId, cat
if not steamId then
return
end
local request = CreateHTTPRequest(
local request = CreateHTTPRequestScriptVM(
"POST",
((SERVER_CONFIG.API_URL .. "/player/") .. tostring(steamId)) .. "/purchases"
)
@@ -2530,7 +2530,7 @@ function StoreManager.prototype.sendShopExtrasGiveRequest(self, playerId, amount
if arcadeStandard > 0 or arcadePremium > 0 then
body.arcade_pack_credits = {standard = arcadeStandard, premium = arcadePremium}
end
local request = CreateHTTPRequest(
local request = CreateHTTPRequestScriptVM(
"POST",
((SERVER_CONFIG.API_URL .. "/player/") .. tostring(steamId)) .. "/currency/give"
)
@@ -2596,7 +2596,7 @@ function StoreManager.prototype.saveCurrencyToServer(self, playerId)
local freeCurrency = self:getFreeCurrency(playerId)
local donateCurrency = self:getDonateCurrency(playerId)
local dustCurrency = self:getDustCurrency(playerId)
local request = CreateHTTPRequest(
local request = CreateHTTPRequestScriptVM(
"PUT",
((SERVER_CONFIG.API_URL .. "/player/") .. tostring(steamId)) .. "/currency"
)
@@ -2622,7 +2622,7 @@ function StoreManager.prototype.ensurePlayerRowOnApi(self, playerId, done)
done(nil, false)
return
end
local request = CreateHTTPRequest("POST", SERVER_CONFIG.API_URL .. "/player")
local request = CreateHTTPRequestScriptVM("POST", SERVER_CONFIG.API_URL .. "/player")
setApiHeadersLong(nil, request)
request:SetHTTPRequestRawPostBody(
"application/json",
@@ -2671,7 +2671,7 @@ function StoreManager.prototype.sendGiveCurrencyRequest(self, playerId, freeAmou
if freeAmount <= 0 and donateAmount <= 0 and dustAmount <= 0 then
return
end
local request = CreateHTTPRequest(
local request = CreateHTTPRequestScriptVM(
"POST",
((SERVER_CONFIG.API_URL .. "/player/") .. tostring(steamId)) .. "/currency/give"
)
@@ -2768,7 +2768,7 @@ function StoreManager.prototype.loadCurrencyFromServer(self, playerId)
((("[STORE] Загрузка валюты для игрока " .. tostring(playerId)) .. " (SteamID: ") .. tostring(steamId)) .. ")"
)
local loadSeq = self:advanceCurrencyLoadSeq(playerId)
local request = CreateHTTPRequest(
local request = CreateHTTPRequestScriptVM(
"GET",
((SERVER_CONFIG.API_URL .. "/player/") .. tostring(steamId)) .. "/currency"
)
@@ -2887,7 +2887,7 @@ function StoreManager.prototype.loadPurchasesFromServer(self, playerId, callback
callback(nil, {})
return
end
local request = CreateHTTPRequest(
local request = CreateHTTPRequestScriptVM(
"GET",
((SERVER_CONFIG.API_URL .. "/player/") .. tostring(steamId)) .. "/purchases"
)