share/hedgewars/Data/Scripts/OfficialChallenges.lua
author Wuzzy <almikes@aol.com>
Tue, 15 Nov 2016 02:00:27 +0100
changeset 11888 bc738a87d8ab
parent 11621 5b31f61e0723
child 13789 9c3f793cfe82
permissions -rw-r--r--
Upgrade appdata file to AppStream 0.8 format, update screenshots
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11550
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11547
diff changeset
     1
local maps = {
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11547
diff changeset
     2
    ["Border,60526986531,M838018718Scripts/Multiplayer/Racer.lua"] = "Racer Challenge #1"
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11547
diff changeset
     3
    , ["Border,71022545335,M-490229244Scripts/Multiplayer/Racer.lua"] = "Racer Challenge #2"
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11547
diff changeset
     4
    , ["Border,40469748943,M806689586Scripts/Multiplayer/Racer.lua"] = "Racer Challenge #3"
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11547
diff changeset
     5
    , ["85940488650,M-134869715Scripts/Multiplayer/Racer.lua"] = "Racer Challenge #4"
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11547
diff changeset
     6
    , ["62080348735,M-661895109Scripts/Multiplayer/Racer.lua"] = "Racer Challenge #5"
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11547
diff changeset
     7
    , ["56818170733,M479034891Scripts/Multiplayer/Racer.lua"] = "Racer Challenge #6"
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11547
diff changeset
     8
    , ["Border,25372705797,M1770509913Scripts/Multiplayer/Racer.lua"] = "Racer Challenge #7"
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11547
diff changeset
     9
    , ["Border,10917540013,M1902370941Scripts/Multiplayer/Racer.lua"] = "Racer Challenge #8"
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11547
diff changeset
    10
    , ["Border,43890274319,M185940363Scripts/Multiplayer/Racer.lua"] = "Racer Challenge #9"
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11547
diff changeset
    11
    , ["Border,27870148394,M751885839Scripts/Multiplayer/Racer.lua"] = "Racer Challenge #10"
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11547
diff changeset
    12
    , ["Border,22647869226,M178845011Scripts/Multiplayer/Racer.lua"] = "Racer Challenge #11"
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11547
diff changeset
    13
    , ["Border,46954401793,M706743197Scripts/Multiplayer/Racer.lua"] = "Racer Challenge #12"
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11547
diff changeset
    14
    , ["Border,60760377667,M157242054Scripts/Multiplayer/Racer.lua"] = "Racer Challenge #13"
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11547
diff changeset
    15
    , ["Border,51825989393,M-1585582638Scripts/Multiplayer/Racer.lua"] = "Racer Challenge #14"
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11547
diff changeset
    16
    , ["81841189250,M256715557Scripts/Multiplayer/Racer.lua"] = "Racer Challenge #15"
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11547
diff changeset
    17
    , ["Border,44246064625,M-528106034Scripts/Multiplayer/Racer.lua"] = "Racer Challenge #16"
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11547
diff changeset
    18
    , ["60906776802,M-1389184823Scripts/Multiplayer/Racer.lua"] = "Racer Challenge #17"
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11547
diff changeset
    19
    , ["Border,70774747774,M-534640804Scripts/Multiplayer/Racer.lua"] = "Racer Challenge #18"
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11547
diff changeset
    20
    , ["Border,50512019610,M-1839546856Scripts/Multiplayer/Racer.lua"] = "Racer Challenge #19"
11621
5b31f61e0723 racer map #20
unC0Rr
parents: 11551
diff changeset
    21
    , ["60715683005,M-281312897Scripts/Multiplayer/Racer.lua"] = "Racer Challenge #20"
11551
59bf29b4f523 Tech racer maps detection
unc0rr
parents: 11550
diff changeset
    22
-- tech racer
59bf29b4f523 Tech racer maps detection
unc0rr
parents: 11550
diff changeset
    23
    , ["Border,19661006772,M-975391975Scripts/Multiplayer/TechRacer.lua"] = "Tech Racer #1"
59bf29b4f523 Tech racer maps detection
unc0rr
parents: 11550
diff changeset
    24
    , ["Border,19661306766,M-975391975Scripts/Multiplayer/TechRacer.lua"] = "Tech Racer #2"
59bf29b4f523 Tech racer maps detection
unc0rr
parents: 11550
diff changeset
    25
    , ["Border,19661606760,M-975391975Scripts/Multiplayer/TechRacer.lua"] = "Tech Racer #3"
59bf29b4f523 Tech racer maps detection
unc0rr
parents: 11550
diff changeset
    26
    , ["Border,19661906754,M-975391975Scripts/Multiplayer/TechRacer.lua"] = "Tech Racer #4"
59bf29b4f523 Tech racer maps detection
unc0rr
parents: 11550
diff changeset
    27
    , ["Border,19662206748,M-975391975Scripts/Multiplayer/TechRacer.lua"] = "Tech Racer #5"
59bf29b4f523 Tech racer maps detection
unc0rr
parents: 11550
diff changeset
    28
    , ["Border,19662506742,M-975391975Scripts/Multiplayer/TechRacer.lua"] = "Tech Racer #6"
59bf29b4f523 Tech racer maps detection
unc0rr
parents: 11550
diff changeset
    29
    , ["Border,19662806736,M-975391975Scripts/Multiplayer/TechRacer.lua"] = "Tech Racer #7"
59bf29b4f523 Tech racer maps detection
unc0rr
parents: 11550
diff changeset
    30
    , ["Border,19663106730,M-975391975Scripts/Multiplayer/TechRacer.lua"] = "Tech Racer #8"
11550
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11547
diff changeset
    31
    }
11547
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11540
diff changeset
    32
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11540
diff changeset
    33
-- modified Adler hash
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11540
diff changeset
    34
local hashA = 0
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11540
diff changeset
    35
local hashB = 0
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11540
diff changeset
    36
local hashModule = 299993
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11540
diff changeset
    37
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11540
diff changeset
    38
function resetHash()
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11540
diff changeset
    39
    hashA = 0
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11540
diff changeset
    40
    hashB = 0
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11540
diff changeset
    41
end
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11540
diff changeset
    42
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11540
diff changeset
    43
function addHashData(i)
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11540
diff changeset
    44
    hashA = (hashA + i + 65536) % hashModule
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11540
diff changeset
    45
    hashB = (hashB + hashA) % hashModule
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11540
diff changeset
    46
end
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11540
diff changeset
    47
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11540
diff changeset
    48
function hashDigest()
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11540
diff changeset
    49
    return(hashB * hashModule + hashA)
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11540
diff changeset
    50
end
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11540
diff changeset
    51
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11540
diff changeset
    52
function detectMapWithDigest()
11550
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11547
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: 11547
diff changeset
    54
        mapString = hashDigest() .. "," .. LandDigest
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11547
diff changeset
    55
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11547
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: 11547
diff changeset
    57
            mapString = "Border," .. mapString
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11547
diff changeset
    58
        end
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11547
diff changeset
    59
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11547
diff changeset
    60
        --WriteLnToConsole(mapString)
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11547
diff changeset
    61
        return(maps[mapString])
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11547
diff changeset
    62
    end
11547
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11540
diff changeset
    63
end