This commit is contained in:
Chr1Z93 2024-05-21 15:41:32 +02:00
parent 749720d845
commit 6e2379b575

View File

@ -13,7 +13,7 @@ do
---@class Request
local Request = {}
-- Sets up the ArkhamDb interface. Should be called from the parent object on load.
-- Sets up the ArkhamDb interface. Should be called from the parent object on load.
ArkhamDb.initialize = function()
configuration = internal.getConfiguration()
Request.start({ configuration.api_uri, configuration.taboo }, function(status)
@ -71,13 +71,14 @@ do
local deck = Request.start(deckUri, function(status)
if string.find(status.text, "<!DOCTYPE html>") then
internal.maybePrint("Private deck ID " .. deckId .. " is not shared", playerColor)
internal.maybePrint("Private deck ID " .. deckId .. " is not shared.", playerColor)
return false, "Private deck " .. deckId .. " is not shared"
end
local json = JSON.decode(status.text)
local json = JSON.decode(internal.fixUtf16String(status.text))
if not json then
internal.maybePrint("Deck ID " .. deckId .. " not found", playerColor)
internal.maybePrint("Deck ID " .. deckId .. " not found.", playerColor)
return false, "Deck not found!"
end
@ -177,8 +178,8 @@ do
local randomWeaknessAmount = slots[RANDOM_WEAKNESS_ID] or 0
slots[RANDOM_WEAKNESS_ID] = nil
if randomWeaknessAmount ~= 0 then
for i=1, randomWeaknessAmount do
if randomWeaknessAmount > 0 then
for i = 1, randomWeaknessAmount do
local weaknessId = allCardsBagApi.getRandomWeaknessId()
slots[weaknessId] = (slots[weaknessId] or 0) + 1
end