tcg/README.org

58 lines
3.8 KiB
Org Mode

* tcg
Python scripts to generate a mobile-friendly static site for tracking tcg cards (designed for [[https://colors-tcg.dreamwidth.org][colors]]).
** Instructions
*** Requirements
- =python3= (needs the following libraries: =bs4, collections, datetime, os, random, re, requests=)
- server space
- subdomain pointing to your site root on the server
- =rclone= with your server set up as a remote
*** Setup
- Download and create the initial files by running:
#+BEGIN_SRC bash
git clone https://git.praze.net/tre/tcg.git
cd tcg
cp log-template.py log.py
cp variables-template.py variables.py
cp trade-template.py trade.py
#+END_SRC
- Edit =variables.py= to set the variables as follows:
- =servername=: name set for your remote in =rclone=
- =serverpath=: path to the site root on the server (with leading slash, without trailing slash)
- =subfolder=: subfolder under your (sub)domain in which the TCG pages will be located (leave as an empty string if they are at the top level)
- =url=: URL of your site index page including =https://=
- =name=: the name you use in the game
- =sig=: set to =True= when you have a signature card
- =banner=: set to =True= when you have a player banner, and save this in =build/assets/= as =banner.png=
- =highpriority=: a list of high priority decks you’re collecting
- =trademedium=: whether to allow trading medium-priority cards away in exchange for high-priority cards (special cards will not be listed as tradeable)
- =tradepost=: URL of your trade post on Dreamwidth
- =faves=: a list of cards to showcase on the index page
- =headerbackground=: an HTML colour to display behind your header image and set as a theme colour
- =british=: =True= if you want “grey” to display on the site, =False= if you want “gray”
- =sketchprize=: prize you normally want for sketchpads in the art shop (1 or 2)
- =collectthreshold=: minimum number of owned cards for putting a deck in the “collecting” category (all cards in mass decks will be included)
- =mediumthreshold=: minimum number of owned cards for marking a deck as medium priority
- =massmediumthreshold=: minimum number of owned cards for marking a deck in a mass deck medium priority (should normally be lower than =mediumthreshold=)
- =highthreshold=: minimum number of owned cards for marking a deck as high priority
- =keepsig=: =True= if you always want to keep one copy of your signature, =False= if you want to make them all available for trading
- =tradestatement=: statement to place on your trading page
- =maxmastered=: maximum number of most recently mastered decks to show on the index page
- =firstmasteries=: a list of decks you mastered first
- =misclink=: under ="link"=, a link to any page you choose, and under ~"text"~, text to display as the link
- =donations= : lists of donated decks and individual scrapbook cards
- =masscollect=: list (python dict) of series/themes being mass collected, each containing at least one of ="decks"= specifying a list of decks, or ="singles"= specifying a list of individual cards
- =anniversary= : list of current anniversary decks
- Run the following:
#+BEGIN_SRC bash
python3 setup.py
chmod +x build.sh
#+END_SRC
- Save a header image to =build/assets/header.png=
- Save each stage of a filled sketchpad to =build/assets/sketch/=, as =00.gif=, =01.gif=, etc.
- Save coupons to =build/assets/coupons/=, with filenames that match the codes you’ve given them in =log.py=.
- Add level images manually to =build/assets/levels/=
- Add custom CSS to =build/user.css=
*** Updating and building
- For each transaction, add a dictionary ={}= to the =log= list like in the example (removing any of ="received"=, ="lost"=, ="crayons"=, ="decks"=, ="coupons"=, ="pend"=, ="unpend"= that aren’t relevant).
- Run =./build.sh= in this directory to download the relevant card images and then upload everything to the server.