Skip to content

Commit 3883515

Browse files
committed
Use SMODS HTTPS + Glitched Edition fix
1 parent 6f38a72 commit 3883515

File tree

17 files changed

+66
-83
lines changed

17 files changed

+66
-83
lines changed

https/thread.lua

Lines changed: 0 additions & 20 deletions
This file was deleted.

items/misc.lua

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -394,29 +394,32 @@ local glitched = {
394394
get_weight = function(self)
395395
return G.GAME.edition_rate * self.weight
396396
end,
397-
-- Note: This is happening even when it shouldn't (like in deck view)
398-
-- Also messes with rank sort order a bit for some reason
397+
-- Note: Duping playing cards resets the base chips for some reason
399398
on_apply = function(card)
400-
cry_with_deck_effects(card, function(card)
401-
cry_misprintize(card, {
402-
min = 0.1,
403-
max = 10,
404-
}, nil, true)
405-
end)
406-
if card.config.center.apply_glitched then
407-
card.config.center:apply_glitched(card, function(val)
408-
return cry_misprintize_val(val, {
409-
min = 0.1 * (G.GAME.modifiers.cry_misprint_min or 1),
410-
max = 10 * (G.GAME.modifiers.cry_misprint_max or 1),
411-
}, is_card_big(card))
399+
if not card.ability.cry_glitched then
400+
cry_with_deck_effects(card, function(card)
401+
cry_misprintize(card, {
402+
min = 0.1,
403+
max = 10,
404+
}, nil, true)
412405
end)
406+
if card.config.center.apply_glitched then
407+
card.config.center:apply_glitched(card, function(val)
408+
return cry_misprintize_val(val, {
409+
min = 0.1 * (G.GAME.modifiers.cry_misprint_min or 1),
410+
max = 10 * (G.GAME.modifiers.cry_misprint_max or 1),
411+
}, is_card_big(card))
412+
end)
413+
end
413414
end
415+
card.ability.cry_glitched = true
414416
end,
415417
on_remove = function(card)
416418
cry_with_deck_effects(card, function(card)
417419
cry_misprintize(card, { min = 1, max = 1 }, true)
418420
cry_misprintize(card) -- Correct me if i'm wrong but this is for misprint deck. or atleast it is after this patch
419421
end)
422+
card.ability.cry_glitched = nil
420423
end,
421424
init = function(self)
422425
local randtext = {

lib/https.lua

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
-- Update the Cryptid member count using HTTPS
2+
local member_fallback = 24000
3+
local https = require("SMODS.https")
4+
local last_update_time = 0
5+
local initial = true
6+
local function apply_discord_member_count(code, body, headers)
7+
if not GLOBAL_cry_member_count then
8+
GLOBAL_cry_member_count = member_fallback
9+
end
10+
if body then
11+
GLOBAL_cry_member_count = string.match(body, '"approximate_member_count"%s*:%s*(%d+)')
12+
end
13+
end
214
function update_cry_member_count()
3-
if Cryptid_config.HTTPS and Cryptid.path and false then
4-
if not GLOBAL_cry_member_update_thread then
5-
-- start up the HTTPS thread if needed
6-
local file_data = assert(NFS.newFileData(Cryptid.path .. "https/thread.lua"))
7-
GLOBAL_cry_member_update_thread = love.thread.newThread(file_data)
8-
GLOBAL_cry_member_update_thread:start()
9-
end
10-
local old = GLOBAL_cry_member_count or 5624
11-
-- get the HTTPS thread's value for Cryptid members
12-
local ret = love.thread.getChannel("member_count"):pop()
13-
if ret then
14-
GLOBAL_cry_member_count = string.match(ret, '"approximate_member_count"%s*:%s*(%d+)') -- string matching a json is odd but should be fine?
15-
end
16-
if not GLOBAL_cry_member_count then
17-
GLOBAL_cry_member_count = old
18-
-- Something failed, print the error
19-
local error = love.thread.getChannel("member_error"):pop()
20-
if error then
21-
sendDebugMessage(error)
22-
end
15+
if Cryptid_config.HTTPS then
16+
if (os.time() - last_update_time >= 60) or initial then
17+
initial = false
18+
last_update_time = os.time()
19+
https.asyncRequest(
20+
"https://discord.com/api/v10/invites/eUf9Ur6RyB?with_counts=true" .. "&v=" .. tostring(os.time()),
21+
apply_discord_member_count
22+
)
2323
end
2424
else
2525
-- Use a fallback value if HTTPS is disabled (you all are awesome)
26-
GLOBAL_cry_member_count = 24000
26+
GLOBAL_cry_member_count = member_fallback
2727
end
2828
end

localization/de.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1449,7 +1449,7 @@ return {
14491449
"{X:mult,C:white}X#1#{} Mult für jedes Mitglied",
14501450
"im {C:attention}Cryptid Discord{}",
14511451
"{C:inactive}(Momentan {X:mult,C:white}X#2#{C:inactive} Mult)",
1452-
"{C:blue,s:0.7}https://discord.gg/eUf9Ur6RyB{}",
1452+
"{C:blue,s:0.7}https://discord.gg/cryptid{}",
14531453
},
14541454
},
14551455
j_cry_membershipcardtwo = {
@@ -1458,7 +1458,7 @@ return {
14581458
"{C:chips}+#1#{} Chips für jedes Mitglied",
14591459
"im {C:attention}Cryptid Discord{}",
14601460
"{C:inactive}(Momentan {C:chips}+#2#{C:inactive} Chips)",
1461-
"{C:blue,s:0.7}https://discord.gg/eUf9Ur6RyB{}",
1461+
"{C:blue,s:0.7}https://discord.gg/cryptid{}",
14621462
},
14631463
},
14641464
j_cry_meteor = {

localization/en-us.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1821,7 +1821,7 @@ return {
18211821
"{X:mult,C:white}X#1#{} Mult for each member",
18221822
"in the {C:attention}Cryptid Discord{}",
18231823
"{C:inactive}(Currently {X:mult,C:white}X#2#{C:inactive} Mult)",
1824-
"{C:blue,s:0.7}https://discord.gg/eUf9Ur6RyB{}",
1824+
"{C:blue,s:0.7}https://discord.gg/cryptid{}",
18251825
},
18261826
},
18271827
j_cry_membershipcardtwo = {
@@ -1830,7 +1830,7 @@ return {
18301830
"{C:chips}+#1#{} Chip#<s>1# for each member",
18311831
"in the {C:attention}Cryptid Discord{}",
18321832
"{C:inactive}(Currently {C:chips}+#2#{C:inactive} Chip#<s>2#)",
1833-
"{C:blue,s:0.7}https://discord.gg/eUf9Ur6RyB{}",
1833+
"{C:blue,s:0.7}https://discord.gg/cryptid{}",
18341834
},
18351835
},
18361836
j_cry_meteor = {

localization/es_419.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,7 +1448,7 @@ return {
14481448
"{X:mult,C:white}X#1#{} multi por cada miembro",
14491449
"en el {C:attention}Discord de Cryptid{}",
14501450
"{C:inactive}(Actual: {X:mult,C:white}X#2#{C:inactive} multi)",
1451-
"{C:blue,s:0.7}https://discord.gg/eUf9Ur6RyB{}",
1451+
"{C:blue,s:0.7}https://discord.gg/cryptid{}",
14521452
},
14531453
},
14541454
j_cry_membershipcardtwo = {
@@ -1457,7 +1457,7 @@ return {
14571457
"{C:chips}+#1#{} fichas por cada miembro",
14581458
"en el {C:attention}Discord de Cryptid{}",
14591459
"{C:inactive}(Actual: {C:chips}+#2#{C:inactive} fichas)",
1460-
"{C:blue,s:0.7}https://discord.gg/eUf9Ur6RyB{}",
1460+
"{C:blue,s:0.7}https://discord.gg/cryptid{}",
14611461
},
14621462
},
14631463
j_cry_meteor = {

localization/es_ES.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1458,7 +1458,7 @@ return {
14581458
"{X:mult,C:white}X#1#{} multi por cada miembro",
14591459
"en el {C:attention}Discord de Cryptid{}",
14601460
"{C:inactive}(Actual: {X:mult,C:white}X#2#{C:inactive} multi)",
1461-
"{C:blue,s:0.7}https://discord.gg/eUf9Ur6RyB{}",
1461+
"{C:blue,s:0.7}https://discord.gg/cryptid{}",
14621462
},
14631463
},
14641464
j_cry_membershipcardtwo = {
@@ -1467,7 +1467,7 @@ return {
14671467
"{C:chips}+#1#{} fichas por cada miembro",
14681468
"en el {C:attention}Discord de Cryptid{}",
14691469
"{C:inactive}(Actual: {C:chips}+#2#{C:inactive} fichas)",
1470-
"{C:blue,s:0.7}https://discord.gg/eUf9Ur6RyB{}",
1470+
"{C:blue,s:0.7}https://discord.gg/cryptid{}",
14711471
},
14721472
},
14731473
j_cry_meteor = {

localization/fr.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1775,7 +1775,7 @@ return {
17751775
"{X:mult,C:white}X#1#{} Multi pour chaque membre",
17761776
"dans le {C:attention}serveur Discord{} de {C:attention}Cryptid{}",
17771777
"{C:inactive}(Actuellement {X:mult,C:white}X#2#{C:inactive} Multi)",
1778-
"{C:blue,s:0.7}https://discord.gg/eUf9Ur6RyB{}",
1778+
"{C:blue,s:0.7}https://discord.gg/cryptid{}",
17791779
},
17801780
},
17811781
j_cry_membershipcardtwo = {
@@ -1784,7 +1784,7 @@ return {
17841784
"{C:chips}+#1#{} Jeton#<s>1# pour chaque membre",
17851785
"dans le {C:attention}serveur Discord{} de {C:attention}Cryptid{}",
17861786
"{C:inactive}(Actuellement {C:chips}+#2#{C:inactive} Jeton#<s>2#)",
1787-
"{C:blue,s:0.7}https://discord.gg/eUf9Ur6RyB{}",
1787+
"{C:blue,s:0.7}https://discord.gg/cryptid{}",
17881788
},
17891789
},
17901790
j_cry_meteor = {

localization/id.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,7 +1236,7 @@ return {
12361236
"{X:mult,C:white}X#1#{} Mult for each member",
12371237
"in the {C:attention}Cryptid Discord{}",
12381238
"{C:inactive}(Currently {X:mult,C:white}X#2#{C:inactive} Mult)",
1239-
"{C:blue,s:0.7}https://discord.gg/eUf9Ur6RyB{}",
1239+
"{C:blue,s:0.7}https://discord.gg/cryptid{}",
12401240
},
12411241
},
12421242
j_cry_membershipcardtwo = {
@@ -1245,7 +1245,7 @@ return {
12451245
"{C:chips}+#1#{} Chips for each member",
12461246
"in the {C:attention}Cryptid Discord{}",
12471247
"{C:inactive}(Currently {C:chips}+#2#{C:inactive} Chips)",
1248-
"{C:blue,s:0.7}https://discord.gg/eUf9Ur6RyB{}",
1248+
"{C:blue,s:0.7}https://discord.gg/cryptid{}",
12491249
},
12501250
},
12511251
j_cry_meteor = {

localization/ja.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,7 +1236,7 @@ return {
12361236
"{X:mult,C:white}X#1#{} Mult for each member",
12371237
"in the {C:attention}Cryptid Discord{}",
12381238
"{C:inactive}(Currently {X:mult,C:white}X#2#{C:inactive} Mult)",
1239-
"{C:blue,s:0.7}https://discord.gg/eUf9Ur6RyB{}",
1239+
"{C:blue,s:0.7}https://discord.gg/cryptid{}",
12401240
},
12411241
},
12421242
j_cry_membershipcardtwo = {
@@ -1245,7 +1245,7 @@ return {
12451245
"{C:chips}+#1#{} Chips for each member",
12461246
"in the {C:attention}Cryptid Discord{}",
12471247
"{C:inactive}(Currently {C:chips}+#2#{C:inactive} Chips)",
1248-
"{C:blue,s:0.7}https://discord.gg/eUf9Ur6RyB{}",
1248+
"{C:blue,s:0.7}https://discord.gg/cryptid{}",
12491249
},
12501250
},
12511251
j_cry_meteor = {

0 commit comments

Comments
 (0)