Tooth and Tail Wiki
Tooth and Tail Wiki

Automating updates of units attributes[]

Hi. I would like to offer help by adding some automation to this wiki. There's toothandtailwiki.com another wiki which uses automated approach to update units info. Same approach can be used here. Basically it queries information from Dev's Discord bot gitlab.com/pocketrangers/pocketbot/raw/develop/assets/units.json units.json file which is generated from game files via a script. My approach to achiving the same results on MediaWiki is to write an extension that provides www.mediawiki.org/wiki/Manual:Parser_functions parser functions for querying game information from that file. I'm going to post a link to an extension when it's ready. It's basically an educational project for me. Just wanted to make sure if this will be useful for this wiki. --Strelock (talk) 18:11, 2 May 2017 (UTC)

Hey, Strelock, if you know how to do this, give it a go, please! Encredechine (talk) 12:54, 3 May 2017 (UTC)
Here's an extension. Also it would be nice to place `<game_data.json>` somewhere as a formatted json for a reference (read only page). I'm gonna ask pocketbot devs to shere there script that extracts/agregates data into json so that this wiki is not dependent on pocketbot development. --Strelock (talk) 12:10, 4 May 2017 (UTC)
Allright, you are admin now. Although for the installation of an extension, I'd have to ask around. Encredechine (talk) 14:12, 6 May 2017 (UTC)
I created MediaWiki:Game_data.json, pages in the MediaWiki namespace are protected by default. Emberimp (talk) 14:19, 6 May 2017 (UTC)
Thank you, Emberimp. I talked to pocketbot dev Brian Franco (Mastastealth) and he agreed to include the script for game data extraction in pocketbot repo. I tried it on game version pre-alpha v27 and it works. Also make sure to configure extension to point to an external game_data.json that is accessible throught wiki web interface and do not use default one that comes with an extension, so that we can easly update that file in the future. --Strelock (talk) 14:54, 6 May 2017 (UTC)
Hey, testing and vetting a new extension would take a while and the outcome is unsure. I suggest you make a Lua module instead. This also comes with the added benefit of easy updates. You obviously know what you're doing so this shouldn't be a problem. I enabled Scribunto for this wiki and suggest you check out gphelp:Extension:Scribunto and gphelp:Template:Scribunto_example. Emberimp (talk) 17:09, 6 May 2017 (UTC)
I've made TNTGame lua module with the same functionality that my extension provides. It's definitely a safer and "faster" solution and it has everything that i need. I'm currenlty using it on Squirrel page (probably gonna move it to a template later). Also i would like to request an Arrays extension to iterate over traits. It's in the "Optional allowed extensions" category on Gamepedia. --Strelock (talk) 11:09, 8 May 2017 (UTC)
Allright, array extension should be active, soon. Encredechine (talk) 12:37, 8 May 2017 (UTC)
I've created new template Template:TnT_Unit_v2 which is basically a TnT Unit template with default values that come from Module:TNTGame. Also i've updated all structures and units to utilize this new template so almost all information is now coming from Module:TNTGame/data. So hopefully all future game patches will only take 5 mins (regenerate game_data.json and update TNTGame/data module) to update wiki --Strelock (talk) 16:07, 11 May 2017 (UTC)
Thank you, really awesome! Encredechine (talk) 16:56, 11 May 2017 (UTC)