share/hedgewars/Data/Scripts/OfficialChallenges.lua
author nemo
Sun, 16 Sep 2018 09:25:10 -0400
changeset 13818 9c3f793cfe82
parent 11616 5b31f61e0723
child 13823 a623657da787
permissions -rw-r--r--
update hashes changed in r79e13080b9db (critical sprites) ra675a94b5cc1 (critical scripts)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11545
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11542
diff changeset
     1
local maps = {
13818
9c3f793cfe82 update hashes changed in r79e13080b9db (critical sprites) ra675a94b5cc1 (critical scripts)
nemo
parents: 11616
diff changeset
     2
    ["Border,60526986531,M1979096843Scripts/Multiplayer/Racer.lua"] = "Racer Challenge #1"
9c3f793cfe82 update hashes changed in r79e13080b9db (critical sprites) ra675a94b5cc1 (critical scripts)
nemo
parents: 11616
diff changeset
     3
    , ["Border,71022545335,M1840529040Scripts/Multiplayer/Racer.lua"] = "Racer Challenge #2"
9c3f793cfe82 update hashes changed in r79e13080b9db (critical sprites) ra675a94b5cc1 (critical scripts)
nemo
parents: 11616
diff changeset
     4
    , ["Border,40469748943,M1784791362Scripts/Multiplayer/Racer.lua"] = "Racer Challenge #3"
9c3f793cfe82 update hashes changed in r79e13080b9db (critical sprites) ra675a94b5cc1 (critical scripts)
nemo
parents: 11616
diff changeset
     5
    , ["85940488650,M-495887001Scripts/Multiplayer/Racer.lua"] = "Racer Challenge #4"
9c3f793cfe82 update hashes changed in r79e13080b9db (critical sprites) ra675a94b5cc1 (critical scripts)
nemo
parents: 11616
diff changeset
     6
    , ["62080348735,M2094159595Scripts/Multiplayer/Racer.lua"] = "Racer Challenge #5"
9c3f793cfe82 update hashes changed in r79e13080b9db (critical sprites) ra675a94b5cc1 (critical scripts)
nemo
parents: 11616
diff changeset
     7
    , ["56818170733,M-156349274Scripts/Multiplayer/Racer.lua"] = "Racer Challenge #6"
9c3f793cfe82 update hashes changed in r79e13080b9db (critical sprites) ra675a94b5cc1 (critical scripts)
nemo
parents: 11616
diff changeset
     8
    , ["Border,25372705797,M1597723310Scripts/Multiplayer/Racer.lua"] = "Racer Challenge #7"
9c3f793cfe82 update hashes changed in r79e13080b9db (critical sprites) ra675a94b5cc1 (critical scripts)
nemo
parents: 11616
diff changeset
     9
    , ["Border,10917540013,M740011665Scripts/Multiplayer/Racer.lua"] = "Racer Challenge #8"
9c3f793cfe82 update hashes changed in r79e13080b9db (critical sprites) ra675a94b5cc1 (critical scripts)
nemo
parents: 11616
diff changeset
    10
    , ["Border,43890274319,M849820937Scripts/Multiplayer/Racer.lua"] = "Racer Challenge #9"
9c3f793cfe82 update hashes changed in r79e13080b9db (critical sprites) ra675a94b5cc1 (critical scripts)
nemo
parents: 11616
diff changeset
    11
    , ["Border,27870148394,M1979096843Scripts/Multiplayer/Racer.lua"] = "Racer Challenge #10"
9c3f793cfe82 update hashes changed in r79e13080b9db (critical sprites) ra675a94b5cc1 (critical scripts)
nemo
parents: 11616
diff changeset
    12
    , ["Border,22647869226,M1979096843Scripts/Multiplayer/Racer.lua"] = "Racer Challenge #11"
9c3f793cfe82 update hashes changed in r79e13080b9db (critical sprites) ra675a94b5cc1 (critical scripts)
nemo
parents: 11616
diff changeset
    13
    , ["Border,46954401793,M1979096843Scripts/Multiplayer/Racer.lua"] = "Racer Challenge #12"
9c3f793cfe82 update hashes changed in r79e13080b9db (critical sprites) ra675a94b5cc1 (critical scripts)
nemo
parents: 11616
diff changeset
    14
    , ["Border,60760377667,M1979096843Scripts/Multiplayer/Racer.lua"] = "Racer Challenge #13"
9c3f793cfe82 update hashes changed in r79e13080b9db (critical sprites) ra675a94b5cc1 (critical scripts)
nemo
parents: 11616
diff changeset
    15
    , ["Border,51825989393,M1979096843Scripts/Multiplayer/Racer.lua"] = "Racer Challenge #14"
9c3f793cfe82 update hashes changed in r79e13080b9db (critical sprites) ra675a94b5cc1 (critical scripts)
nemo
parents: 11616
diff changeset
    16
    , ["81841189250,M1979096843Scripts/Multiplayer/Racer.lua"] = "Racer Challenge #15"
9c3f793cfe82 update hashes changed in r79e13080b9db (critical sprites) ra675a94b5cc1 (critical scripts)
nemo
parents: 11616
diff changeset
    17
    , ["Border,44246064625,M1979096843Scripts/Multiplayer/Racer.lua"] = "Racer Challenge #16"
9c3f793cfe82 update hashes changed in r79e13080b9db (critical sprites) ra675a94b5cc1 (critical scripts)
nemo
parents: 11616
diff changeset
    18
    , ["60906776802,M1979096843Scripts/Multiplayer/Racer.lua"] = "Racer Challenge #17"
9c3f793cfe82 update hashes changed in r79e13080b9db (critical sprites) ra675a94b5cc1 (critical scripts)
nemo
parents: 11616
diff changeset
    19
    , ["Border,70774747774,M1979096843Scripts/Multiplayer/Racer.lua"] = "Racer Challenge #18"
9c3f793cfe82 update hashes changed in r79e13080b9db (critical sprites) ra675a94b5cc1 (critical scripts)
nemo
parents: 11616
diff changeset
    20
    , ["Border,50512019610,M1979096843Scripts/Multiplayer/Racer.lua"] = "Racer Challenge #19"
9c3f793cfe82 update hashes changed in r79e13080b9db (critical sprites) ra675a94b5cc1 (critical scripts)
nemo
parents: 11616
diff changeset
    21
    , ["60715683005,M1840529040Scripts/Multiplayer/Racer.lua"] = "Racer Challenge #20"
11546
59bf29b4f523 Tech racer maps detection
unc0rr
parents: 11545
diff changeset
    22
-- tech racer
13818
9c3f793cfe82 update hashes changed in r79e13080b9db (critical sprites) ra675a94b5cc1 (critical scripts)
nemo
parents: 11616
diff changeset
    23
    , ["Border,19661006772,M80452408Scripts/Multiplayer/TechRacer.lua"] = "Tech Racer #1"
9c3f793cfe82 update hashes changed in r79e13080b9db (critical sprites) ra675a94b5cc1 (critical scripts)
nemo
parents: 11616
diff changeset
    24
    , ["Border,19661306766,M80452408Scripts/Multiplayer/TechRacer.lua"] = "Tech Racer #2"
9c3f793cfe82 update hashes changed in r79e13080b9db (critical sprites) ra675a94b5cc1 (critical scripts)
nemo
parents: 11616
diff changeset
    25
    , ["Border,19661606760,M80452408Scripts/Multiplayer/TechRacer.lua"] = "Tech Racer #3"
9c3f793cfe82 update hashes changed in r79e13080b9db (critical sprites) ra675a94b5cc1 (critical scripts)
nemo
parents: 11616
diff changeset
    26
    , ["Border,19661906754,M80452408SScripts/Multiplayer/TechRacer.lua"] = "Tech Racer #4"
9c3f793cfe82 update hashes changed in r79e13080b9db (critical sprites) ra675a94b5cc1 (critical scripts)
nemo
parents: 11616
diff changeset
    27
    , ["Border,19662206748,M80452408SScripts/Multiplayer/TechRacer.lua"] = "Tech Racer #5"
9c3f793cfe82 update hashes changed in r79e13080b9db (critical sprites) ra675a94b5cc1 (critical scripts)
nemo
parents: 11616
diff changeset
    28
    , ["Border,19662506742,M80452408SScripts/Multiplayer/TechRacer.lua"] = "Tech Racer #6"
9c3f793cfe82 update hashes changed in r79e13080b9db (critical sprites) ra675a94b5cc1 (critical scripts)
nemo
parents: 11616
diff changeset
    29
    , ["Border,19662806736,M80452408SScripts/Multiplayer/TechRacer.lua"] = "Tech Racer #7"
9c3f793cfe82 update hashes changed in r79e13080b9db (critical sprites) ra675a94b5cc1 (critical scripts)
nemo
parents: 11616
diff changeset
    30
    , ["Border,19663106730,M80452408SScripts/Multiplayer/TechRacer.lua"] = "Tech Racer #8"
11545
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11542
diff changeset
    31
    }
11542
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11535
diff changeset
    32
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11535
diff changeset
    33
-- modified Adler hash
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11535
diff changeset
    34
local hashA = 0
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11535
diff changeset
    35
local hashB = 0
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11535
diff changeset
    36
local hashModule = 299993
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11535
diff changeset
    37
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11535
diff changeset
    38
function resetHash()
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11535
diff changeset
    39
    hashA = 0
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11535
diff changeset
    40
    hashB = 0
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11535
diff changeset
    41
end
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11535
diff changeset
    42
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11535
diff changeset
    43
function addHashData(i)
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11535
diff changeset
    44
    hashA = (hashA + i + 65536) % hashModule
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11535
diff changeset
    45
    hashB = (hashB + hashA) % hashModule
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11535
diff changeset
    46
end
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11535
diff changeset
    47
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11535
diff changeset
    48
function hashDigest()
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11535
diff changeset
    49
    return(hashB * hashModule + hashA)
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11535
diff changeset
    50
end
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11535
diff changeset
    51
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11535
diff changeset
    52
function detectMapWithDigest()
11545
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11542
diff changeset
    53
    if RopePercent == 100 and MinesNum == 0 then
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11542
diff changeset
    54
        mapString = hashDigest() .. "," .. LandDigest
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11542
diff changeset
    55
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11542
diff changeset
    56
        if band(GameFlags, gfBorder) ~= 0 then
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11542
diff changeset
    57
            mapString = "Border," .. mapString
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11542
diff changeset
    58
        end
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11542
diff changeset
    59
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11542
diff changeset
    60
        --WriteLnToConsole(mapString)
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11542
diff changeset
    61
        return(maps[mapString])
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11542
diff changeset
    62
    end
11542
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11535
diff changeset
    63
end