I have been playing Heroes of Might and Magic since the time of the
King of Peas, Queen Lamanda, and during this time so many cards have accumulated for 3 Heroes that I decided to sort and structure them somehow.
The objectives were as follows:
- Get rid of duplicate cards
- Know exactly whether I played this card or not; if I did, then know the status: won, lost or missed
- Have the ability to upload new cards to the organizer with a check for uniqueness
- Write your personal comment to the card
- Have the ability to instantly sort the map catalog by the following parameters:
name, status, version, encoding, map size, dungeon presence, difficulty level and file size
Screenshots
Screenshots are clickable
')
Full card catalog

Work with filters. Here I sorted maps that I didn’t play, SOD (The Shadow of Death) versions, ascii encoding, Extra Large size, there is a dungeon on the maps, Impossible difficulty level. Green icon - to download the map from the catalog to the local computer.

Work with the map, if you click on the icon with a pen. In the modal window, everything is obvious and visible when I last played this map.

Attempt to download a map that is already in the directory.
Install and Run
- Download and unpack the archive with the virtual machine:
Download from yadisk 1.44GB
- Download and install VMware Workstation Player (Skip this item if VMware-Workstation is installed).
- We start the virtual machine. We wait for it to load, and look at the IP address that VMware assigned to it:

If IP is not assignedThen either reboot the virtual machine with vmware, or log in
Login: root
Password: hero
And enter the command:
ifconfig
See the current IP.
And with the help of the command:
nmtui
You can fix it so that it does not change by adjusting the statics.
We drive this address into the browser and get into the organizer with all the cards, as in the screenshots.
Details for programmers and for those interested.
All this "farm" is written in python3.
I chose
Flask as a framework.
Database: MongoDB.
Frontend: bootstrap3 and
DataTablesYou can parse the Heroes III map using standard python modules: gzip and struct. The gzip module unpacks the file, as it is stored in a compressed form. The struct module provides the unpack () function for working with binary variable-length record formats, and the calcsize function returns the size of the structure. Code "I" for four byte without signed numbers. The code "<" indicates that standard-size numbers and bytes are written in the order of "first low" (little-endian).
The following code gets the Heroes version of the file named Zyconia.h3m
>>> h3m_versions = {0x0E: "RoE", 0x15: "AB", 0x1C: "SoD", 0x33: "WoG"} >>> import gzip >>> import struct >>> h3m_data = gzip.open('Zyconia.h3m') >>> def r(s): ... return struct.unpack(s, h3m_data.read(struct.calcsize(s))) ... >>> print(h3m_versions[r("<I")[0]]) RoE
- RoE - The Restoration of Erathia
- AB - Armageddon's Blade
- SoD - The Shadow of Death
- WoG - In the Wake of Gods
The full code of the parser can be viewed on github.
Using work with binary data, I got to the following data:
- Card size
- The presence of the cave
- Card name
- Map Description
- Level of difficulty
The unique identifier for each card (file) is considered the usual md5.
tmp = res['Version'] + res['underground'] + res['mapsize'] + res['name'].lower() + res['difficulty'] res['_id'] = hashlib.md5(str(tmp).encode('utf-8')).hexdigest()
I put all the data in the md5-hash, except for the description, because sometimes the name of the site is added to the description of the site from which it was downloaded and a duplicate is obtained, this is one of the reasons why it is impossible to just take and calculate the hash amount of the file with the card to check for uniqueness .