]> Pileus Git - ~andy/rhawk/commitdiff
Split plain into nounicode and nocolor
authorAndy Spencer <andy753421@gmail.com>
Sun, 19 May 2013 21:26:27 +0000 (21:26 +0000)
committerAndy Spencer <andy753421@gmail.com>
Sun, 19 May 2013 21:26:27 +0000 (21:26 +0000)
rhawk
spades.awk

diff --git a/rhawk b/rhawk
index 80de4ba1b902201ba2a0943e996eef0b1bdeae2e..a1c210d092ccfe93c800482058c83f26eca2c0a5 100755 (executable)
--- a/rhawk
+++ b/rhawk
@@ -7,8 +7,9 @@
 
 # Initialization
 BEGIN {
-       json_load("var/login.json", login);
-       json_load("var/plain.json", plain);
+       json_load("var/login.json",     login);
+       json_load("var/nounicode.json", nounicode);
+       json_load("var/nocolor.json",   nocolors);
 
        OWNER = login["owner"];
 
@@ -75,15 +76,25 @@ CMD == "NICK" && FROM in bots {
 }
 
 
-# Unicode
+# Fancy output
 /[Uu]nicode :-?\(/ {
-       plain[FROM] = 1
-       json_save("var/plain.json", plain);
+       nounicode[FROM] = 1
+       json_save("var/nounicode.json", nounicode);
 }
 
 /[Uu]nicode :-?\)/ {
-       delete plain[FROM]
-       json_save("var/plain.json", plain);
+       delete nounicode[FROM]
+       json_save("var/nounicode.json", nounicode);
+}
+
+/[Cc]olors :-?\(/ {
+       nocolor[FROM] = 1
+       json_save("var/nocolor.json", nocolor);
+}
+
+/[Cc]olors :-?\)/ {
+       delete nocolor[FROM]
+       json_save("var/nocolor.json", nocolor);
 }
 
 # SFV Lug
index 02e4d036f5928a724f35c8d2836b4110f3fe066f..61b967cae98313b70f51051ab89f81de5c922663 100644 (file)
@@ -136,9 +136,11 @@ function sp_load(file,     game)
 
 function sp_pretty(cards, who)
 {
-       if (!plain[who]) {
+       if (!nocolor[who]) {
                gsub(/[0-9JQKA]*[sc]/, "\0031,00\002&\017", cards) # black
                gsub(/[0-9JQKA]*[hd]/, "\0034,00\002&\017", cards) # red
+       }
+       if (!nounicode[who]) {
                gsub(/s/, "\002♠", cards)
                gsub(/h/, "\002♥", cards)
                gsub(/d/, "\002♦", cards)