From ab74f660dd0301995d2b71be27e89764e1ee4b5e Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 25 May 2023 20:52:06 +0200 Subject: Remove stale stuff. --- tools/fonts/woff2css2 | 42 ------------------------------------------ tools/packreplay.sql | 8 -------- tools/readgame.sh | 10 ++++++++++ tools/showreplay.sh | 2 ++ tools/undo.sh | 6 +++--- tools/writegame.sh | 7 +++++++ 6 files changed, 22 insertions(+), 53 deletions(-) delete mode 100755 tools/fonts/woff2css2 delete mode 100644 tools/packreplay.sql create mode 100644 tools/readgame.sh create mode 100644 tools/showreplay.sh create mode 100644 tools/writegame.sh (limited to 'tools') diff --git a/tools/fonts/woff2css2 b/tools/fonts/woff2css2 deleted file mode 100755 index 8105524..0000000 --- a/tools/fonts/woff2css2 +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/python3 - -# Embed a woff2 font in a static CSS file. -# Usage: woff2css in.woff2 out.css -# -# Limitations: takes weight and style information from the file name of the font. -# This script will throw an unhelpful exception if weight and style cannot -# be determined. - -# @font-face { -# font-family: "Dinish"; -# font-weight: 700; -# font-style: bold; -# src: url(data:font/woff2;base64,d09GMgABAAAAACzcAA0AAAAAc/wAACyGAAIAxQAAAAAAAAAAAAAAAAAAAAAAAAAAGnYbnkIcg0IGYACDHAqBpT -# } - -import os -import re -import sys - -if not re.search(r"\.woff2$", sys.argv[1]): - print("Usage: woff2css *.woff2") - sys.exit(1) - -for src in sys.argv[1:]: - m = re.match(r"([\w-]+)-(\w+)\.", os.path.basename(src)) - if m: - family = m.group(1) - style = m.group(2) - else: - print("Font should be named Family-Style.woff2; could not determine font weight.") - sys.exit(1) - - s = ("@font-face{") - s += (f"font-family:'{family}';") - if style == "Bold" or style == "BoldItalic": - s += (f"font-weight:bold;") - if style == "Italic" or style == "BoldItalic": - s += (f"font-style:italic;") - s += (f"src:url('{src}')format('woff2')") - s += ("}") - print(s) diff --git a/tools/packreplay.sql b/tools/packreplay.sql deleted file mode 100644 index 28cd11f..0000000 --- a/tools/packreplay.sql +++ /dev/null @@ -1,8 +0,0 @@ -begin transaction; -create temporary table replay_repack as - select game_id,role,action,arguments - from game_replay - order by game_id,replay_id; -delete from game_replay; -insert into game_replay (game_id,role,action,arguments) select * from replay_repack; -commit; diff --git a/tools/readgame.sh b/tools/readgame.sh new file mode 100644 index 0000000..4a8fdbd --- /dev/null +++ b/tools/readgame.sh @@ -0,0 +1,10 @@ +#!/bin/bash +if [ -n "$1" -a -n "$2" ] +then + sqlite3 db "select writefile('$2',state) from game_state where game_id = $1" +elif [ -n "$1" ] +then + sqlite3 db "select state from game_state where game_id = $1" +else + echo "usage: bash tools/readgame.sh GAME [ state.json ]" +fi diff --git a/tools/showreplay.sh b/tools/showreplay.sh new file mode 100644 index 0000000..413e12f --- /dev/null +++ b/tools/showreplay.sh @@ -0,0 +1,2 @@ +#!/bin/bash +sqlite3 db "select * from game_replay where game_id=$1" diff --git a/tools/undo.sh b/tools/undo.sh index 3cd5b4a..716e88b 100644 --- a/tools/undo.sh +++ b/tools/undo.sh @@ -1,9 +1,9 @@ #!/bin/bash if [ -n "$1" ] then - RID=$(sqlite3 db "select replay_id from game_replay where game_id=$1 order by replay_id desc limit 1") - echo $RID - sqlite3 db "delete from game_replay where game_id=$1 and replay_id=$RID" + COUNT=$(sqlite3 db "select count(1) from game_replay where game_id=$1") + echo Game has $COUNT actions. + sqlite3 db "delete from game_replay where game_id=$1 and replay_id=$COUNT" node tools/patchgame.js $1 else echo "usage: bash tools/undo.sh GAME" diff --git a/tools/writegame.sh b/tools/writegame.sh new file mode 100644 index 0000000..ea0f599 --- /dev/null +++ b/tools/writegame.sh @@ -0,0 +1,7 @@ +#!/bin/bash +if [ -n "$1" -a -f "$2" ] +then + sqlite3 db "update game_state set state=readfile('$2') where game_id = $1" +else + echo "usage: bash tools/writegame.sh GAME state.json" +fi -- cgit v1.2.3