Coder Social home page Coder Social logo

baa-studios / castform Goto Github PK

View Code? Open in Web Editor NEW
7.0 1.0 1.0 2.8 MB

A Pokemon TCG Deck Registration Sheet generator in Flutter

License: GNU General Public License v3.0

Dart 5.73% CMake 1.34% C++ 1.70% C 0.10% HTML 77.68% CSS 3.00% JavaScript 10.24% Batchfile 0.22%
decklist pokemon pokemontcg tcg

castform's Introduction

CastFORM

GitHub release (latest by date) Code Style: Google platform | windows MVP GitHub search hit counter GitHub all releases

CastFORM is an easy-to-use Pokémon TCG Deck Registration Sheet generator.
CastFORM offers an elegant graphical interface for filling in Pokémon deck lists for tournaments, and creates beautiful PDFs from user input. This reduces the likelihood of human errors associated with filling out of forms by hand, and also integrates well with existing players' workflows, given the popularity of deck strings (of various formats) in the Pokémon TCG community.

This project is based on Brandon Nguyen's CLI Python script that served a similar purpose. CastFORM was spearheaded in response to the high demand for a user-friendly program in his local TCG community, most of whom were not comfortable with CLI tools.

Gallery

Light mode: light mode screenshot

Dark mode dark mode screenshot

Installation & Usage Instructions

Note: Only 64-bit Windows 11 machines are officially supported.

ZIP Archive (Portable)

This is the portable/standalone version that can be used immediately after unzipping

  1. Download castform.zip from the releases page
    • Note: actual file name may vary
  2. Unzip it into your desired install location
  3. Run CastFORM.exe from that location
    • You can hold SHIFT and right-click it, then under Send to select Desktop to create a desktop shortcut
    • Uninstall by deleting the folder

Windows Installer - New (WiX)

  1. Download CastFORM_Installer_x64.msi from the releases page
  2. Double-click on the installer (installs to C:\Program Files\CastFORM)
  3. CastFORM should now be available in the Start menu
    • Uninstall method 1: Open Start menu, and start typing "CastFORM", you should see the context menu for CastFORM, with the option to uninstall
    • Uninstall method 2: Go to Settings > Apps > Installed Apps, clicking on the ellipsis for CastFORM and selecting Uninstall

Windows Installer - Old (IExpress)

  1. Download CastFORM_x64.exe from the releases page
  2. Run it as administrator to install CastFORM to C:\Program Files\CastFORM
  3. Run CastFORM.exe from C:\Program Files\CastFORM\CastFORM.exe, and/or create a shortcut for it
    • Uninstall by deleting the folder with administrator permissions

Video Instructions


Technical Information

CastFORM is built with Flutter 3.13.9 for 64-bit Windows 11, and targets **Google's Dart style guide **.
For testing, we aim to provide complete coverage for API behaviour internally by release.

Development Environment Set-up

  1. Install Flutter and add it to PATH
  2. Clone the repository
  3. Open the repository in IntelliJ
    • You may use your IDE of choice, but we prefer IntelliJ here at BAA Studios
    • Make sure you install the Dart and Flutter Plugin for IntelliJ
  4. Make sure Windows (desktop) is selected in the list of devices
    • The location of the button differs depending on IntelliJ version
    • For IntelliJ 2022.3 use the drop-down menu at the top right: illustration of where the menu is found
  5. Hit the Run button at the top right of the window
    • The location of the button differs depending on IntelliJ version
    • For IntelliJ 2022.3 click here: illustration of where to click

Internal Package API

API docs for the business logic are included as static HTML files in the repository.
After cloning the repository, navigate to the respective package to open them:

  • packages/deck_string_parser/doc/api/index.html
  • packages/pokemon_pdf_builder/doc/api/index.html

Toolchain

A number of standalone Python scripts have been make to automate metadata fetching and template creation:

  • ForeCAST
    • Uses Bulbapedia's REST APIs to get all known set abbreviations
  • WEATHERBall
    • Remote mode: Scrapes the official Pokémon website for the registration form templates
    • Local mode: Converts PDF files to WebP
      • Added as a fallback option upon discovery that Pokémon uses Incapsula as an anti-scraping measure
  • SunnyFORM
    • A WiX Toolset project for a custom Windows Installer for CastFORM
    • This is our new packaging method, intended for CastFORM v3 onwards
  • RainyFORM
    • A new consolidated dependency generator for CastFORM that consolidates and replaces ForeCAST and WEATHERBall
    • This is a work in progress, slated for CastFORM v3
    • Repository to be made public once we have completed migration of internal processes

Build Instructions

  1. Run flutter build windows
  2. Navigate to the output folder /build/windows/runner/Release
  3. Add the following dlls (which can be found in a Visual Studio 2022 installation folder, e.g. C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Redist\MSVC\14.32.31326\x64\Microsoft.VC143.CRT)
    • msvcp140.dll
    • vcruntime140.dll
    • vcruntime140_1.dll
  4. Package the contents of this folder as a ZIP file
    • Users can unzip to their desired location and run CastFORM.exe from there

Bundle with Windows Installer (New - WiX Toolset)

A sample WiX-based project has been made to simplify this. Refer to SunnyFORM's README for instructions.

Bundle with Windows Installer (Legacy)

Note: This assumes you've already run through steps 1-4 of the build instructions
First time bundling:

  1. Add a batch script setup.bat (refer to /sample_setup.bat for template)
  2. Run iexpress.exe as administrator
  3. Select Create new Self Extraction Directive file, and hit Next
  4. Select Extract files and run an installation command, and hit Next
  5. Input a title (e.g. CastFORM Installer), and hit Next
  6. Select No prompt, and hit Next
  7. Select Do not display a license, and hit Next
  8. Use the Add button to add all the files in the output folder from above, and hit Next
    • The file picker dialog box allows CTRL + A to select all files
    • The file picker dialog box ignores folders, and does not add them recursively
    • You may use CTRL + A on the output folder and repeat for all nested folders to quickly add everything
  9. In the Install Program field, click on it and manually replace with cmd /c setup.bat, and hit Next
    • You are able to type in this drop down box
    • The cmd /c part is REQUIRED
    • IExpress simply bundles/extracts as well as wrap around a batch script, so all installation logic should be written in setup.bat
  10. Select Default, and hit Next
  11. Input a message if you like, and hit Next
  12. Click Browse and select an output folder for the resulting installer EXE, and give it a name
  13. Check Store files using Long File Name inside Package, and hit Next
  14. Select No restart, and hit Next
  15. Select Save Self Extraction Directive (SED) file, and use Browse to choose a save location, then hit Next
    • The SED file contains all the configuration you've done up to this point
    • Importing this file will allow you to reuse the same configuration for future bundling attempts
  16. On the Create package page, hit Next to start the bundling process, and then Finish once it's done

For subsequent bundling:

  1. Run iexpress.exe as administrator
  2. Select Open existing Self Extraction Directive file, and select the SED file with Browse
  3. Select Create Package
  4. On the Create package page, hit Next to start the bundling process, and then Finish once it's done

Disclaimer

CastFORM is an open-source program for a generating a niche type of PDF documents. CastFORM is not affiliated with Nintendo, The Pokémon Company, or any Pokémon-related organisations fan-driven or otherwise. CastFORM is non-monetised, and provided as is. Every reasonable effort has been taken to ensure correctness and reliability of * CastFORM. We will not be liable for any special, direct, indirect, or consequential damages or any damages whatsoever resulting from loss of use, data or profits, whether in an action if contract, negligence or other tortious action, arising out of or in connection with the use of CastFORM (in part or in whole).

castform's People

Contributors

bratah123 avatar gaardus avatar kookiiestudios avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

gaardus

castform's Issues

Form doesn't gracefully handle when there are more trainer cards in a deck than rows

Hi,
I'm unsure what one does on the official form when you have more trainers than rows on the form, but it doesn't look like this code gracefully handles this issue. Please see attached screenshot. Also, below is the exported decklist from LIVE, so you can try to recreate the issue:
trainer overflow isnt handled well

Pokémon: 10
1 Eiscue BRS 44
1 Meloetta FST 124
1 Mew VMAX LOR-TG 30
2 Genesect V FST 185
1 Genesect V FST 255
2 Mew VMAX FST 114
1 Mew V FST 250
3 Mew V FST 113
1 Drapion V LOR 182
1 Genesect V FST 254

Trainer: 23
1 Iono PAL 254
1 Switch CRZ 144
1 Escape Rope BST 125
1 Forest Seal Stone SIT 156
1 Choice Belt ASR 211
2 Feather Ball ASR 141
1 Pal Pad SVI 182
2 Lost Vacuum LOR 162
1 Lost City LOR 161
3 Cram-o-matic FST 229
4 Battle VIP Pass FST 225
2 Nest Ball SVI 255
2 Path to the Peak CRE 148
3 Ultra Ball BRS 150
1 Cyllene ASR 201
3 Power Tablet FST 236
3 Elesa's Sparkle FST 233
1 Iono PAL 185 PH
1 Power Tablet FST 281
1 Judge FST 235
1 Avery CRE 187
1 Collapsed Stadium LOR 215
2 Boss's Orders BRS 132

Energy: 2
4 Fusion Strike Energy FST 244
3 Double Turbo Energy BRS 151

Total Cards: 60

LimitlessTCG Deck Format Support

Copying deck strings from https://limitlesstcg.com/ will result in a deck string with no headers:

4 Ralts ASR 60
4 Kirlia SIT 68
2 Gardevoir ex SVI 86
1 Gardevoir CRE 61
1 Mewtwo V-UNION PR-SW 159
1 Mewtwo V-UNION PR-SW 162
1 Mewtwo V-UNION PR-SW 160
1 Mewtwo V-UNION PR-SW 161
1 Zacian V CEL 16
1 Manaphy BRS 41
1 Mew CEL 11
1 Radiant Greninja ASR 46
1 Klefki SVI 96

3 Professor's Research SVI 189
1 Judge SVI 176
1 Miriam SVI 179
1 Peonia CRE 149
1 Klara CRE 145
1 Serena SIT 164
1 Roxanne ASR 150
1 Boss's Orders BRS 132
4 Level Ball BST 129
4 Battle VIP Pass FST 225
3 Ultra Ball SVI 196
3 Fog Crystal CRE 140
1 Rescue Carrier CRZ 142
1 Pal Pad SVI 182
1 Sky Seal Stone CRZ 143
2 Temple of Sinnoh ASR 155

11 Psychic Energy 5

parsing a deck from this string does not work, because the removeHeader method will delete a valid pokemon card.

Basic Energies from PTCGL exports do not combine

Okay, I think this is last attempt at fuzzing the decklist parser for bugs tonight:

I imagine like-basic energy cards, whether secret rares, or not, should be combined. Below is an example export from PTCGL that has two scenarios of basic energy that should be combined:

  1. Two basic grass secret energies, one from Fusion Strike, and one from Paldea Evolved.
  2. Two basic lightning energies - one completely basic, one secret.

Decklist:
Pokémon: 10
1 Regieleki VMAX SIT 58
2 Regieleki V SIT 57
1 Zeraora SIT 56
3 Pachirisu SVI 68
1 Ting-Lu ex PAL 263
1 Pikachu PR-SV 27
1 Cyclizar ex PR-SV 18
1 Bombirdier SVI 219
1 Pelipper PAL 159
1 Pelipper PR-SV 22

Trainer: 17
2 Ultra Ball SVI 196
1 Boss's Orders PAL 265
1 Boss's Orders PAL 248
4 Professor's Research SVI 190
2 Escape Rope BST 125
1 Energy Recycler BST 124
4 Nest Ball SVI 181
3 Leafy Camo Poncho SIT 160
4 Electric Generator SVI 170
3 Beach Court SVI 167
2 Cynthia's Ambition BRS 138
1 Iono PAL 185 PH
1 Iono PAL 269
1 Iono PAL 254
1 Giacomo PAL 182
1 Giacomo PAL 267
1 Giacomo PAL 252

Energy: 4
11 Basic {L} Energy SVE 4
1 Basic {G} Energy FST 283
1 Basic {G} Energy PAL 278
1 Basic {L} Energy SVI 257

Total Cards: 60

Screenshot:
secret energy not combined

Form can print a row with qty, but blank trainer name

As requested, putting this into its own issue...

So it looks like the code at least checks for 60 cards, otherwise it'll print nothing on the form...but look at this one. if I remove one of the Iono rows, and then rewrite the last trainer card as just "Collapsed Stadium" and make sure my deck adds up to 60, it still overprints the rows, but the last row is blank.

Decklist:
Pokémon: 10
1 Eiscue BRS 44
1 Meloetta FST 124
1 Mew VMAX LOR-TG 30
2 Genesect V FST 185
1 Genesect V FST 255
2 Mew VMAX FST 114
1 Mew V FST 250
3 Mew V FST 113
1 Drapion V LOR 182
1 Genesect V FST 254

Trainer: 23
2 Iono PAL 254
1 Switch CRZ 144
1 Escape Rope BST 125
1 Forest Seal Stone SIT 156
1 Choice Belt ASR 211
2 Feather Ball ASR 141
1 Pal Pad SVI 182
2 Lost Vacuum LOR 162
1 Lost City LOR 161
3 Cram-o-matic FST 229
4 Battle VIP Pass FST 225
2 Nest Ball SVI 255
2 Path to the Peak CRE 148
3 Ultra Ball BRS 150
1 Cyllene ASR 201
3 Power Tablet FST 236
3 Elesa's Sparkle FST 233
1 Power Tablet FST 281
1 Judge FST 235
1 Avery CRE 187
3 Collapsed Stadium

Energy: 2
4 Fusion Strike Energy FST 244
3 Double Turbo Energy BRS 151

Total Cards: 60

Screenshot:
blank row on form

Upgrade Flutter version

CastFORM is currently built with Flutter 3.7 (Dart 2), using the experimental Material Design 3 option.
This issue is meant to add a update reminder to our backlog, to upgrade to Flutter 3.13+ (Dart 3).

Bug: Collection #

I don't want to raise another issue or reopen a closed issue to ask a question, but I noticed in a previously closed issue that you said that filling out the Coll # won't be done. However the form says it requires it. 5.3.2 in the tournament rules say that the list must be complete...one could interpret that as having the collection #, as instructed on the form.
https://assets.pokemon.com//assets/cms2/pdf/play-pokemon/rules/play-pokemon-tournament-rules-handbook-07132023-en.pdf
If PTCGL or other decklist tools provide the Collection #, is it really a lot of effort to parse that and place it on the form as well? I only see one set name that extends past the column boundary, (LOR-TG), that may make formatting a little difficult, but having a complete form may be worth pursuing.

This is from Issue #10 and I'm placing it in another issue post.

[TODO] Idiot-proof file extension handling

It seems that users can inadvertently remove the .pdf file extension when renaming the file in the Save As dialog window.

We should get implement sanity checks and re-append the file extension if the user removes them manually

Edge Case with unflatten deck strings.

image

Given a deck list like above, the parseTrainerCards is producing Multiple Trainer objects for the same card.

Output from current parseTrainerCards algo:

Trainer(name="Judge", quantity="3")
Trainer(name="Judge", quantity="1")
Trainer(name="Cheren's Care", quantity="1")
Trainer(name="Cheren's Care", quantity="1")

Instead it should produce one Trainer object for the same card, and combines their quantities.
Example Output:

Trainer(name="Judge", quantity="4")
Trainer(name="Cheren's Care", quantity="2")

See commit: 23d9766 for details on the unit tests added.

Backend Logic

Here's a simplified logic diagram of how the program should work:
Pokemon  Decklist Diagram

Form doesn't perfectly handle combining reverse holo's and non-reverse holo cards.

Hi,

So the code handles regular and secret Power Tablet just fine, but there is something specific to Iono (and perhaps others?), where one exports a decklist from LIVE that includes a regular and FA version of Iono and they are not combined into a single row.

Screenshot below:
two iono

Decklist provided below for you to recreate issue: (Note, there is also regular and secret Power Tablet in this list and they are combined just fine.)

Pokémon: 10
1 Eiscue BRS 44
1 Meloetta FST 124
1 Mew VMAX LOR-TG 30
2 Genesect V FST 185
1 Genesect V FST 255
2 Mew VMAX FST 114
1 Mew V FST 250
3 Mew V FST 113
1 Drapion V LOR 182
1 Genesect V FST 254

Trainer: 23
1 Iono PAL 254
1 Switch CRZ 144
1 Escape Rope BST 125
1 Forest Seal Stone SIT 156
1 Choice Belt ASR 211
2 Feather Ball ASR 141
1 Pal Pad SVI 182
2 Lost Vacuum LOR 162
1 Lost City LOR 161
3 Cram-o-matic FST 229
4 Battle VIP Pass FST 225
2 Nest Ball SVI 255
2 Path to the Peak CRE 148
3 Ultra Ball BRS 150
1 Cyllene ASR 201
3 Power Tablet FST 236
3 Elesa's Sparkle FST 233
1 Iono PAL 185 PH
1 Power Tablet FST 281
1 Judge FST 235
1 Avery CRE 187
1 Collapsed Stadium LOR 215
2 Boss's Orders BRS 132

Energy: 2
4 Fusion Strike Energy FST 244
3 Double Turbo Energy BRS 151

Total Cards: 60

Age Division box isn't manually or automatically selected

I'm not always this lazy in life, but I recommend having a triple toggle on the left pane that checks whichever age division checkbox the user chooses.

If you prefer a challenge and dealing with edge cases, you could look to just calculate it based on the DoB and the current date. (The edge case is where someone will have a birthday that changes their age division between the time they print the form and the tournament date. I think that would be few and far between. so to get around that, you could have a toggle to disable automatically checking the age division boxes.)

[FEATURE] Add Card Total Display

At the top of each section, display the amount of cards listed in that section.
This makes it easier for the judge to count, and keeps player peace of mind in check while using CastFORM and looks aesthetically pleasing.

Example

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.