Skip to content

Commit 54b751a

Browse files
authored
Merge pull request #7996 from Cluedrew/update-quotes
2 parents 9154788 + 7838ebd commit 54b751a

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

src/clj/game/quotes.clj

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,20 @@
1010

1111
(def identity-quotes (atom {}))
1212

13+
(defn- load-quote-file [filename]
14+
(let [file (io/file filename)]
15+
(when (.exists file)
16+
(edn/read-string (slurp file)))))
17+
1318
(defn load-quotes! []
14-
(let [quotes-corp (when (.exists (io/file quotes-corp-filename))
15-
(-> (io/file quotes-corp-filename)
16-
(slurp)
17-
(edn/read-string)))
18-
quotes-runner (when (.exists (io/file quotes-runner-filename))
19-
(-> (io/file quotes-runner-filename)
20-
(slurp)
21-
(edn/read-string)))]
22-
(reset! identity-quotes (merge quotes-corp quotes-runner))))
19+
(reset! identity-quotes (merge (load-quote-file quotes-corp-filename)
20+
(load-quote-file quotes-runner-filename))))
2321

2422
(defn- choose-and-repeat [options qty]
2523
(when (not-empty options)
2624
(repeat qty (first (shuffle options)))))
2725

2826
(defn make-quote [{player-ident :title} {opp-ident :title opp-faction :faction}]
29-
3027
(let [generic (get-in @identity-quotes [player-ident generic-key])
3128
opp-faction (get-in @identity-quotes [player-ident opp-faction])
3229
opp-specific (get-in @identity-quotes [player-ident opp-ident])
@@ -37,5 +34,3 @@
3734
(if (not-empty non-blank)
3835
(first (shuffle non-blank))
3936
"NO QUOTE SRY")))
40-
41-

0 commit comments

Comments
 (0)