Skip to content

Commit

Permalink
Add print_version.py for BlmapChill
Browse files Browse the repository at this point in the history
It is a bit ugly to put it next to themes
but its related to BlmapChill only

And moving the themes into a sub folder would break a bunch of scripts
such as DDNetPP/server
  • Loading branch information
ChillerDragon committed Jan 26, 2024
1 parent cc43bf9 commit 314f44c
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions BlmapChill/print_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env python
# print_version.py
# written by ChillerDragon
#
# parses BlmapChill version from text tile layer
#
# usage: python print_version.py BlmapChill.map
#
# expected sample output: 184
#

import sys

import twmap

if len(sys.argv) != 2:
print(f"usage: {sys.argv[0]} map")
sys.exit(0)

m = twmap.Map(sys.argv[1])

# TXT+Deep (version number text)
txt_tiles = m.groups[17].layers[5].tiles

digits = []
digits.append(txt_tiles[1][4][0])
digits.append(txt_tiles[1][5][0])
digits.append(txt_tiles[1][6][0])
digits.append(txt_tiles[1][7][0])

version_str = ''
for digit in digits:
if digit == 39:
version_str += '0'
else:
version_str += str(digit - 29)

version = int(version_str)

print(str(version))

0 comments on commit 314f44c

Please sign in to comment.