Blame


1 7ea8226e 2021-09-06 xhr /*
2 7ea8226e 2021-09-06 xhr * Copyright (c) 2021 Matthias Schmidt <xhr@giessen.ccc.de>
3 7ea8226e 2021-09-06 xhr *
4 7ea8226e 2021-09-06 xhr * Permission to use, copy, modify, and distribute this software for any
5 7ea8226e 2021-09-06 xhr * purpose with or without fee is hereby granted, provided that the above
6 7ea8226e 2021-09-06 xhr * copyright notice and this permission notice appear in all copies.
7 7ea8226e 2021-09-06 xhr *
8 7ea8226e 2021-09-06 xhr * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 7ea8226e 2021-09-06 xhr * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 7ea8226e 2021-09-06 xhr * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 7ea8226e 2021-09-06 xhr * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 7ea8226e 2021-09-06 xhr * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 7ea8226e 2021-09-06 xhr * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 7ea8226e 2021-09-06 xhr * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 7ea8226e 2021-09-06 xhr */
16 7ea8226e 2021-09-06 xhr
17 ce559d58 2021-09-05 xhr #include "isscrolls.h"
18 ce559d58 2021-09-05 xhr
19 ce559d58 2021-09-05 xhr #include <json-c/json.h>
20 ce559d58 2021-09-05 xhr
21 7f1d5406 2021-09-06 xhr #include <limits.h>
22 ce559d58 2021-09-05 xhr #include <stdio.h>
23 ce559d58 2021-09-05 xhr #include <string.h>
24 c49b5003 2021-09-06 xhr
25 c49b5003 2021-09-06 xhr static char oracle_is_names[200][MAX_NAME_LEN];
26 c49b5003 2021-09-06 xhr static char oracle_elf_names[100][MAX_NAME_LEN];
27 c49b5003 2021-09-06 xhr static char oracle_giant_names[100][MAX_NAME_LEN];
28 c49b5003 2021-09-06 xhr static char oracle_varou_names[100][MAX_NAME_LEN];
29 c49b5003 2021-09-06 xhr static char oracle_troll_names[100][MAX_NAME_LEN];
30 c49b5003 2021-09-06 xhr
31 c49b5003 2021-09-06 xhr static char oracle_action[100][MAX_NAME_LEN];
32 c49b5003 2021-09-06 xhr static char oracle_theme[100][MAX_NAME_LEN];
33 c49b5003 2021-09-06 xhr
34 c49b5003 2021-09-06 xhr static char oracle_rank[100][MAX_RANK_LEN];
35 c49b5003 2021-09-06 xhr static char oracle_combat_action[100][MAX_PLOT_LEN];
36 c49b5003 2021-09-06 xhr static char oracle_plot_twist[100][MAX_PLOT_LEN];
37 c49b5003 2021-09-06 xhr static char oracle_mystic_backslash[100][MAX_MYSTIC_LEN];
38 ce559d58 2021-09-05 xhr
39 1a26b5c7 2021-09-06 xhr static char oracle_regions[100][MAX_PLACES_LEN];
40 1a26b5c7 2021-09-06 xhr static char oracle_locations[100][MAX_PLACES_LEN];
41 1a26b5c7 2021-09-06 xhr static char oracle_location_descriptions[100][MAX_PLACES_LEN];
42 3ea4b207 2021-09-09 xhr static char oracle_coastal_locations[100][MAX_PLACES_LEN];
43 1a26b5c7 2021-09-06 xhr
44 3ad507cb 2021-09-13 xhr static char oracle_pay_the_price[100][MAX_PTP_LEN];
45 3ad507cb 2021-09-13 xhr
46 90849b35 2021-09-05 xhr static int read_names = 0;
47 90849b35 2021-09-05 xhr static int read_action = 0;
48 90849b35 2021-09-05 xhr static int read_turning = 0;
49 1a26b5c7 2021-09-06 xhr static int read_places = 0;
50 3ad507cb 2021-09-13 xhr static int read_moves = 0;
51 483f88df 2021-09-06 xhr
52 483f88df 2021-09-06 xhr static void read_names_from_json(void);
53 3ad507cb 2021-09-13 xhr static void read_moves_from_json(void);
54 483f88df 2021-09-06 xhr static void read_action_from_json(void);
55 483f88df 2021-09-06 xhr static void read_turning_from_json(void);
56 1a26b5c7 2021-09-06 xhr static void read_places_from_json(void);
57 ce559d58 2021-09-05 xhr
58 29889142 2021-09-05 xhr enum oracle_codes {
59 29889142 2021-09-05 xhr ORACLE_IS_NAMES,
60 29889142 2021-09-05 xhr ORACLE_ELF_NAMES,
61 29889142 2021-09-05 xhr ORACLE_GIANT_NAMES,
62 29889142 2021-09-05 xhr ORACLE_VAROU_NAMES,
63 29889142 2021-09-05 xhr ORACLE_TROLL_NAMES,
64 29889142 2021-09-05 xhr ORACLE_ACTIONS,
65 29889142 2021-09-05 xhr ORACLE_THEMES,
66 29889142 2021-09-05 xhr ORACLE_RANKS,
67 29889142 2021-09-05 xhr ORACLE_COMBAT_ACTIONS,
68 29889142 2021-09-05 xhr ORACLE_PLOT_TWISTS,
69 29889142 2021-09-05 xhr ORACLE_MYSTIC_BACKSLASH,
70 1a26b5c7 2021-09-06 xhr ORACLE_REGION,
71 1a26b5c7 2021-09-06 xhr ORACLE_LOCATION ,
72 3ea4b207 2021-09-09 xhr ORACLE_COASTAL,
73 1a26b5c7 2021-09-06 xhr ORACLE_DESCRIPTION,
74 3ad507cb 2021-09-13 xhr ORACLE_PAYTHEPRICE,
75 29889142 2021-09-05 xhr };
76 29889142 2021-09-05 xhr
77 ce559d58 2021-09-05 xhr static void
78 89da551e 2021-09-05 xhr add_to_array(int what, int id, const char *value)
79 ce559d58 2021-09-05 xhr {
80 89da551e 2021-09-05 xhr log_debug("%d, %d, %s\n", what, id, value);
81 ce559d58 2021-09-05 xhr
82 ce559d58 2021-09-05 xhr switch (what) {
83 89da551e 2021-09-05 xhr case -1:
84 89da551e 2021-09-05 xhr log_debug("Unknown array\n");
85 2e5fe15b 2021-09-05 xhr return;
86 29889142 2021-09-05 xhr case ORACLE_IS_NAMES:
87 ce559d58 2021-09-05 xhr if (id < 0 || id > 200)
88 ce559d58 2021-09-05 xhr return;
89 89da551e 2021-09-05 xhr snprintf(oracle_is_names[id], MAX_NAME_LEN, "%s", value);
90 ce559d58 2021-09-05 xhr break;
91 29889142 2021-09-05 xhr case ORACLE_ELF_NAMES:
92 ce559d58 2021-09-05 xhr if (id < 0 || id > 100)
93 ce559d58 2021-09-05 xhr return;
94 89da551e 2021-09-05 xhr snprintf(oracle_elf_names[id], MAX_NAME_LEN, "%s", value);
95 ce559d58 2021-09-05 xhr break;
96 29889142 2021-09-05 xhr case ORACLE_GIANT_NAMES:
97 ce559d58 2021-09-05 xhr if (id < 0 || id > 100)
98 ce559d58 2021-09-05 xhr return;
99 89da551e 2021-09-05 xhr snprintf(oracle_giant_names[id], MAX_NAME_LEN, "%s", value);
100 ce559d58 2021-09-05 xhr break;
101 29889142 2021-09-05 xhr case ORACLE_VAROU_NAMES:
102 ce559d58 2021-09-05 xhr if (id < 0 || id > 100)
103 ce559d58 2021-09-05 xhr return;
104 89da551e 2021-09-05 xhr snprintf(oracle_varou_names[id], MAX_NAME_LEN, "%s", value);
105 ce559d58 2021-09-05 xhr break;
106 29889142 2021-09-05 xhr case ORACLE_TROLL_NAMES:
107 ce559d58 2021-09-05 xhr if (id < 0 || id > 100)
108 ce559d58 2021-09-05 xhr return;
109 89da551e 2021-09-05 xhr snprintf(oracle_troll_names[id], MAX_NAME_LEN, "%s", value);
110 ce559d58 2021-09-05 xhr break;
111 323180ed 2021-09-05 xhr /* -------------------------------------------------------------------- */
112 29889142 2021-09-05 xhr case ORACLE_ACTIONS:
113 89da551e 2021-09-05 xhr if (id < 0 || id > 100)
114 89da551e 2021-09-05 xhr return;
115 89da551e 2021-09-05 xhr snprintf(oracle_action[id], MAX_NAME_LEN, "%s", value);
116 89da551e 2021-09-05 xhr break;
117 29889142 2021-09-05 xhr case ORACLE_THEMES:
118 89da551e 2021-09-05 xhr if (id < 0 || id > 100)
119 89da551e 2021-09-05 xhr return;
120 89da551e 2021-09-05 xhr snprintf(oracle_theme[id], MAX_NAME_LEN, "%s", value);
121 89da551e 2021-09-05 xhr break;
122 323180ed 2021-09-05 xhr /* -------------------------------------------------------------------- */
123 29889142 2021-09-05 xhr case ORACLE_RANKS:
124 90849b35 2021-09-05 xhr if (id < 0 || id > 100)
125 90849b35 2021-09-05 xhr return;
126 90849b35 2021-09-05 xhr snprintf(oracle_rank[id], MAX_RANK_LEN, "%s", value);
127 90849b35 2021-09-05 xhr break;
128 29889142 2021-09-05 xhr case ORACLE_COMBAT_ACTIONS:
129 323180ed 2021-09-05 xhr if (id < 0 || id > 100)
130 323180ed 2021-09-05 xhr return;
131 323180ed 2021-09-05 xhr snprintf(oracle_combat_action[id], MAX_PLOT_LEN, "%s", value);
132 323180ed 2021-09-05 xhr break;
133 29889142 2021-09-05 xhr case ORACLE_PLOT_TWISTS:
134 323180ed 2021-09-05 xhr if (id < 0 || id > 100)
135 323180ed 2021-09-05 xhr return;
136 323180ed 2021-09-05 xhr snprintf(oracle_plot_twist[id], MAX_PLOT_LEN, "%s", value);
137 323180ed 2021-09-05 xhr break;
138 29889142 2021-09-05 xhr case ORACLE_MYSTIC_BACKSLASH:
139 d49e0a78 2021-09-05 xhr if (id < 0 || id > 100)
140 d49e0a78 2021-09-05 xhr return;
141 d49e0a78 2021-09-05 xhr snprintf(oracle_mystic_backslash[id], MAX_MYSTIC_LEN, "%s", value);
142 d49e0a78 2021-09-05 xhr break;
143 1a26b5c7 2021-09-06 xhr /* -------------------------------------------------------------------- */
144 1a26b5c7 2021-09-06 xhr case ORACLE_REGION:
145 1a26b5c7 2021-09-06 xhr if (id < 0 || id > 100)
146 1a26b5c7 2021-09-06 xhr return;
147 1a26b5c7 2021-09-06 xhr snprintf(oracle_regions[id], MAX_PLACES_LEN, "%s", value);
148 1a26b5c7 2021-09-06 xhr break;
149 1a26b5c7 2021-09-06 xhr case ORACLE_LOCATION:
150 1a26b5c7 2021-09-06 xhr if (id < 0 || id > 100)
151 1a26b5c7 2021-09-06 xhr return;
152 1a26b5c7 2021-09-06 xhr snprintf(oracle_locations[id], MAX_PLACES_LEN, "%s", value);
153 1a26b5c7 2021-09-06 xhr break;
154 3ea4b207 2021-09-09 xhr case ORACLE_COASTAL:
155 1a26b5c7 2021-09-06 xhr if (id < 0 || id > 100)
156 1a26b5c7 2021-09-06 xhr return;
157 3ea4b207 2021-09-09 xhr snprintf(oracle_coastal_locations[id], MAX_PLACES_LEN, "%s", value);
158 1a26b5c7 2021-09-06 xhr break;
159 1a26b5c7 2021-09-06 xhr case ORACLE_DESCRIPTION:
160 1a26b5c7 2021-09-06 xhr if (id < 0 || id > 100)
161 1a26b5c7 2021-09-06 xhr return;
162 1a26b5c7 2021-09-06 xhr snprintf(oracle_location_descriptions[id], MAX_PLACES_LEN, "%s", value);
163 1a26b5c7 2021-09-06 xhr break;
164 3ad507cb 2021-09-13 xhr /* -------------------------------------------------------------------- */
165 3ad507cb 2021-09-13 xhr case ORACLE_PAYTHEPRICE:
166 3ad507cb 2021-09-13 xhr if (id < 0 || id > 100)
167 3ad507cb 2021-09-13 xhr return;
168 3ad507cb 2021-09-13 xhr snprintf(oracle_pay_the_price[id], MAX_PTP_LEN, "%s", value);
169 3ad507cb 2021-09-13 xhr break;
170 ce559d58 2021-09-05 xhr default:
171 64d52bc9 2021-09-16 xhr log_errx(1, "add_to_array: This should not happen\n");
172 ce559d58 2021-09-05 xhr }
173 ce559d58 2021-09-05 xhr }
174 ce559d58 2021-09-05 xhr
175 ce559d58 2021-09-05 xhr
176 ce559d58 2021-09-05 xhr static void
177 ce559d58 2021-09-05 xhr read_names_from_json()
178 ce559d58 2021-09-05 xhr {
179 7f1d5406 2021-09-06 xhr char path[_POSIX_PATH_MAX];
180 37902866 2021-09-05 xhr json_object *root, *oracles, *temp, *table, *name, *desc, *chance;
181 ce559d58 2021-09-05 xhr int n_oracles, n_entries, i, j, what;
182 ce559d58 2021-09-05 xhr
183 7f1d5406 2021-09-06 xhr snprintf(path, sizeof(path), "%s/ironsworn_oracles_names.json", _PATH_SHARE_DIR);
184 7f1d5406 2021-09-06 xhr
185 ce559d58 2021-09-05 xhr if ((root = json_object_from_file(path)) == NULL) {
186 90849b35 2021-09-05 xhr log_errx(1, "Cannot open %s\n", path);
187 ce559d58 2021-09-05 xhr }
188 37902866 2021-09-05 xhr
189 a1c776dd 2021-09-16 xhr if (!json_object_object_get_ex(root, "Oracles", &oracles)) {
190 a1c776dd 2021-09-16 xhr log_debug("Cannot find a [Oracles] array in %s\n", path);
191 a1c776dd 2021-09-16 xhr return;
192 a1c776dd 2021-09-16 xhr }
193 a1c776dd 2021-09-16 xhr
194 ce559d58 2021-09-05 xhr n_oracles = json_object_array_length(oracles);
195 ce559d58 2021-09-05 xhr
196 ce559d58 2021-09-05 xhr log_debug("number of oracles: %d\n", n_oracles);
197 ce559d58 2021-09-05 xhr for (i = 0; i < n_oracles; i++) {
198 ce559d58 2021-09-05 xhr temp = json_object_array_get_idx(oracles, i);
199 90922303 2021-09-16 xhr json_object_object_get_ex(temp, "Oracle Table", &table);
200 90922303 2021-09-16 xhr json_object_object_get_ex(temp, "Name", &name);
201 ce559d58 2021-09-05 xhr log_debug("Name %s\n", json_object_get_string(name));
202 ce559d58 2021-09-05 xhr
203 ce559d58 2021-09-05 xhr if ((strcmp(json_object_get_string(name), "Ironlander Names") == 0))
204 29889142 2021-09-05 xhr what = ORACLE_IS_NAMES;
205 ce559d58 2021-09-05 xhr else if ((strcmp(json_object_get_string(name), "Elf Names") == 0))
206 29889142 2021-09-05 xhr what = ORACLE_ELF_NAMES;
207 ce559d58 2021-09-05 xhr else if ((strcmp(json_object_get_string(name), "Giant Names") == 0))
208 29889142 2021-09-05 xhr what = ORACLE_GIANT_NAMES;
209 ce559d58 2021-09-05 xhr else if ((strcmp(json_object_get_string(name), "Varou Names") == 0))
210 29889142 2021-09-05 xhr what = ORACLE_VAROU_NAMES;
211 ce559d58 2021-09-05 xhr else if ((strcmp(json_object_get_string(name), "Troll Names") == 0))
212 29889142 2021-09-05 xhr what = ORACLE_TROLL_NAMES;
213 d6e4bd9d 2021-09-16 xhr else {
214 89da551e 2021-09-05 xhr what = -1;
215 d6e4bd9d 2021-09-16 xhr continue;
216 d6e4bd9d 2021-09-16 xhr }
217 ce559d58 2021-09-05 xhr
218 ce559d58 2021-09-05 xhr n_entries = json_object_array_length(table);
219 ce559d58 2021-09-05 xhr for (j = 0; j < n_entries; j++) {
220 ce559d58 2021-09-05 xhr temp = json_object_array_get_idx(table, j);
221 90922303 2021-09-16 xhr json_object_object_get_ex(temp, "Description", &desc);
222 90922303 2021-09-16 xhr json_object_object_get_ex(temp, "Chance", &chance);
223 37902866 2021-09-05 xhr add_to_array(what, json_object_get_int(chance), json_object_get_string(desc));
224 ce559d58 2021-09-05 xhr }
225 ce559d58 2021-09-05 xhr }
226 ce559d58 2021-09-05 xhr
227 743ad35d 2021-09-06 xhr /* Decrement the reference count of json_object and free if it reaches zero. */
228 743ad35d 2021-09-06 xhr json_object_put(root);
229 743ad35d 2021-09-06 xhr
230 89da551e 2021-09-05 xhr read_names = 1;
231 ce559d58 2021-09-05 xhr }
232 ce559d58 2021-09-05 xhr
233 89da551e 2021-09-05 xhr static void
234 3ad507cb 2021-09-13 xhr read_moves_from_json()
235 3ad507cb 2021-09-13 xhr {
236 3ad507cb 2021-09-13 xhr char path[_POSIX_PATH_MAX];
237 3ad507cb 2021-09-13 xhr json_object *root, *oracles, *temp, *table, *name, *desc, *chance;
238 3ad507cb 2021-09-13 xhr int n_oracles, n_entries, i, j, what;
239 3ad507cb 2021-09-13 xhr
240 3ad507cb 2021-09-13 xhr snprintf(path, sizeof(path), "%s/ironsworn_move_oracles.json", _PATH_SHARE_DIR);
241 3ad507cb 2021-09-13 xhr
242 3ad507cb 2021-09-13 xhr if ((root = json_object_from_file(path)) == NULL) {
243 3ad507cb 2021-09-13 xhr log_errx(1, "Cannot open %s\n", path);
244 3ad507cb 2021-09-13 xhr }
245 3ad507cb 2021-09-13 xhr
246 a1c776dd 2021-09-16 xhr if (!json_object_object_get_ex(root, "Oracles", &oracles)) {
247 a1c776dd 2021-09-16 xhr log_debug("Cannot find a [Oracles] array in %s\n", path);
248 a1c776dd 2021-09-16 xhr return;
249 a1c776dd 2021-09-16 xhr }
250 a1c776dd 2021-09-16 xhr
251 3ad507cb 2021-09-13 xhr n_oracles = json_object_array_length(oracles);
252 3ad507cb 2021-09-13 xhr
253 3ad507cb 2021-09-13 xhr log_debug("number of oracles: %d\n", n_oracles);
254 3ad507cb 2021-09-13 xhr for (i = 0; i < n_oracles; i++) {
255 3ad507cb 2021-09-13 xhr temp = json_object_array_get_idx(oracles, i);
256 90922303 2021-09-16 xhr json_object_object_get_ex(temp, "Oracle Table", &table);
257 90922303 2021-09-16 xhr json_object_object_get_ex(temp, "Name", &name);
258 3ad507cb 2021-09-13 xhr log_debug("Name %s\n", json_object_get_string(name));
259 3ad507cb 2021-09-13 xhr
260 3ad507cb 2021-09-13 xhr if ((strcmp(json_object_get_string(name), "Pay the Price") == 0))
261 3ad507cb 2021-09-13 xhr what = ORACLE_PAYTHEPRICE;
262 3ad507cb 2021-09-13 xhr else {
263 3ad507cb 2021-09-13 xhr what = -1;
264 3ad507cb 2021-09-13 xhr continue;
265 3ad507cb 2021-09-13 xhr }
266 3ad507cb 2021-09-13 xhr
267 3ad507cb 2021-09-13 xhr n_entries = json_object_array_length(table);
268 3ad507cb 2021-09-13 xhr for (j = 0; j < n_entries; j++) {
269 3ad507cb 2021-09-13 xhr temp = json_object_array_get_idx(table, j);
270 90922303 2021-09-16 xhr json_object_object_get_ex(temp, "Description", &desc);
271 90922303 2021-09-16 xhr json_object_object_get_ex(temp, "Chance", &chance);
272 90922303 2021-09-16 xhr add_to_array(what, json_object_get_int(chance), json_object_get_string(desc));
273 3ad507cb 2021-09-13 xhr }
274 3ad507cb 2021-09-13 xhr }
275 3ad507cb 2021-09-13 xhr
276 3ad507cb 2021-09-13 xhr /* Decrement the reference count of json_object and free if it reaches zero. */
277 3ad507cb 2021-09-13 xhr json_object_put(root);
278 3ad507cb 2021-09-13 xhr
279 e8d826b7 2021-09-16 xhr read_moves = 1;
280 3ad507cb 2021-09-13 xhr }
281 3ad507cb 2021-09-13 xhr
282 3ad507cb 2021-09-13 xhr static void
283 89da551e 2021-09-05 xhr read_action_from_json()
284 89da551e 2021-09-05 xhr {
285 7f1d5406 2021-09-06 xhr char path[_POSIX_PATH_MAX];
286 89da551e 2021-09-05 xhr json_object *root, *oracles, *temp, *table, *name, *desc, *chance;
287 89da551e 2021-09-05 xhr int n_oracles, n_entries, i, j, what;
288 89da551e 2021-09-05 xhr
289 7f1d5406 2021-09-06 xhr snprintf(path, sizeof(path), "%s/ironsworn_oracles_prompts.json", _PATH_SHARE_DIR);
290 7f1d5406 2021-09-06 xhr
291 89da551e 2021-09-05 xhr if ((root = json_object_from_file(path)) == NULL) {
292 90849b35 2021-09-05 xhr log_errx(1, "Cannot open %s\n", path);
293 89da551e 2021-09-05 xhr }
294 89da551e 2021-09-05 xhr
295 a1c776dd 2021-09-16 xhr if (!json_object_object_get_ex(root, "Oracles", &oracles)) {
296 a1c776dd 2021-09-16 xhr log_debug("Cannot find a [Oracles] array in %s\n", path);
297 a1c776dd 2021-09-16 xhr return;
298 a1c776dd 2021-09-16 xhr }
299 a1c776dd 2021-09-16 xhr
300 89da551e 2021-09-05 xhr n_oracles = json_object_array_length(oracles);
301 89da551e 2021-09-05 xhr
302 89da551e 2021-09-05 xhr log_debug("number of oracles: %d\n", n_oracles);
303 89da551e 2021-09-05 xhr for (i = 0; i < n_oracles; i++) {
304 89da551e 2021-09-05 xhr temp = json_object_array_get_idx(oracles, i);
305 90922303 2021-09-16 xhr json_object_object_get_ex(temp, "Oracle Table", &table);
306 90922303 2021-09-16 xhr json_object_object_get_ex(temp, "Name", &name);
307 89da551e 2021-09-05 xhr log_debug("Name %s\n", json_object_get_string(name));
308 89da551e 2021-09-05 xhr
309 89da551e 2021-09-05 xhr if ((strcmp(json_object_get_string(name), "Action") == 0))
310 29889142 2021-09-05 xhr what = ORACLE_ACTIONS;
311 89da551e 2021-09-05 xhr else if ((strcmp(json_object_get_string(name), "Theme") == 0))
312 29889142 2021-09-05 xhr what = ORACLE_THEMES;
313 89da551e 2021-09-05 xhr /* The following oracles are not yet supported */
314 89da551e 2021-09-05 xhr else if ((strcmp(json_object_get_string(name), "Feature") == 0))
315 89da551e 2021-09-05 xhr continue;
316 89da551e 2021-09-05 xhr else if ((strcmp(json_object_get_string(name), "Focus") == 0))
317 89da551e 2021-09-05 xhr continue;
318 89da551e 2021-09-05 xhr else if ((strcmp(json_object_get_string(name), "Trap") == 0))
319 89da551e 2021-09-05 xhr continue;
320 89da551e 2021-09-05 xhr else if ((strcmp(json_object_get_string(name), "Combat Event") == 0))
321 90849b35 2021-09-05 xhr continue;
322 d6e4bd9d 2021-09-16 xhr else {
323 90849b35 2021-09-05 xhr what = -1;
324 d6e4bd9d 2021-09-16 xhr continue;
325 d6e4bd9d 2021-09-16 xhr }
326 90849b35 2021-09-05 xhr
327 90849b35 2021-09-05 xhr n_entries = json_object_array_length(table);
328 90849b35 2021-09-05 xhr for (j = 0; j < n_entries; j++) {
329 90849b35 2021-09-05 xhr temp = json_object_array_get_idx(table, j);
330 90922303 2021-09-16 xhr json_object_object_get_ex(temp, "Description", &desc);
331 90922303 2021-09-16 xhr json_object_object_get_ex(temp, "Chance", &chance);
332 90922303 2021-09-16 xhr add_to_array(what, json_object_get_int(chance), json_object_get_string(desc));
333 90849b35 2021-09-05 xhr }
334 90849b35 2021-09-05 xhr }
335 90849b35 2021-09-05 xhr
336 743ad35d 2021-09-06 xhr /* Decrement the reference count of json_object and free if it reaches zero. */
337 743ad35d 2021-09-06 xhr json_object_put(root);
338 743ad35d 2021-09-06 xhr
339 90849b35 2021-09-05 xhr read_action = 1;
340 90849b35 2021-09-05 xhr }
341 90849b35 2021-09-05 xhr
342 90849b35 2021-09-05 xhr static void
343 90849b35 2021-09-05 xhr read_turning_from_json()
344 90849b35 2021-09-05 xhr {
345 af65c79f 2021-09-06 xhr char path[_POSIX_PATH_MAX];
346 90849b35 2021-09-05 xhr json_object *root, *oracles, *temp, *table, *name, *desc, *chance;
347 90849b35 2021-09-05 xhr int n_oracles, n_entries, i, j, what;
348 90849b35 2021-09-05 xhr
349 af65c79f 2021-09-06 xhr snprintf(path, sizeof(path), "%s/ironsworn_oracles_turning_point.json", _PATH_SHARE_DIR);
350 af65c79f 2021-09-06 xhr
351 90849b35 2021-09-05 xhr if ((root = json_object_from_file(path)) == NULL) {
352 90849b35 2021-09-05 xhr log_errx(1, "Cannot open %s\n", path);
353 90849b35 2021-09-05 xhr }
354 90849b35 2021-09-05 xhr
355 a1c776dd 2021-09-16 xhr if (!json_object_object_get_ex(root, "Oracles", &oracles)) {
356 a1c776dd 2021-09-16 xhr log_debug("Cannot find a [Oracles] array in %s\n", path);
357 a1c776dd 2021-09-16 xhr return;
358 a1c776dd 2021-09-16 xhr }
359 a1c776dd 2021-09-16 xhr
360 90849b35 2021-09-05 xhr n_oracles = json_object_array_length(oracles);
361 90849b35 2021-09-05 xhr
362 90849b35 2021-09-05 xhr log_debug("number of oracles: %d\n", n_oracles);
363 90849b35 2021-09-05 xhr for (i = 0; i < n_oracles; i++) {
364 90849b35 2021-09-05 xhr temp = json_object_array_get_idx(oracles, i);
365 90922303 2021-09-16 xhr json_object_object_get_ex(temp, "Oracle Table", &table);
366 90922303 2021-09-16 xhr json_object_object_get_ex(temp, "Name", &name);
367 90849b35 2021-09-05 xhr log_debug("Name %s\n", json_object_get_string(name));
368 90849b35 2021-09-05 xhr
369 90849b35 2021-09-05 xhr if ((strcmp(json_object_get_string(name), "Challenge Rank") == 0))
370 29889142 2021-09-05 xhr what = ORACLE_RANKS;
371 90849b35 2021-09-05 xhr else if ((strcmp(json_object_get_string(name), "Combat Action") == 0))
372 29889142 2021-09-05 xhr what = ORACLE_COMBAT_ACTIONS;
373 90849b35 2021-09-05 xhr else if ((strcmp(json_object_get_string(name), "Major Plot Twist") == 0))
374 29889142 2021-09-05 xhr what = ORACLE_PLOT_TWISTS;
375 90849b35 2021-09-05 xhr else if ((strcmp(json_object_get_string(name), "Mystic Backlash") == 0))
376 29889142 2021-09-05 xhr what = ORACLE_MYSTIC_BACKSLASH;
377 d6e4bd9d 2021-09-16 xhr else {
378 89da551e 2021-09-05 xhr what = -1;
379 d6e4bd9d 2021-09-16 xhr continue;
380 d6e4bd9d 2021-09-16 xhr }
381 89da551e 2021-09-05 xhr
382 89da551e 2021-09-05 xhr n_entries = json_object_array_length(table);
383 89da551e 2021-09-05 xhr for (j = 0; j < n_entries; j++) {
384 89da551e 2021-09-05 xhr temp = json_object_array_get_idx(table, j);
385 90922303 2021-09-16 xhr json_object_object_get_ex(temp, "Description", &desc);
386 90922303 2021-09-16 xhr json_object_object_get_ex(temp, "Chance", &chance);
387 90922303 2021-09-16 xhr add_to_array(what, json_object_get_int(chance), json_object_get_string(desc));
388 89da551e 2021-09-05 xhr }
389 89da551e 2021-09-05 xhr }
390 89da551e 2021-09-05 xhr
391 743ad35d 2021-09-06 xhr /* Decrement the reference count of json_object and free if it reaches zero. */
392 743ad35d 2021-09-06 xhr json_object_put(root);
393 743ad35d 2021-09-06 xhr
394 323180ed 2021-09-05 xhr read_turning = 1;
395 89da551e 2021-09-05 xhr }
396 89da551e 2021-09-05 xhr
397 1a26b5c7 2021-09-06 xhr static void
398 1a26b5c7 2021-09-06 xhr read_places_from_json()
399 1a26b5c7 2021-09-06 xhr {
400 1a26b5c7 2021-09-06 xhr char path[_POSIX_PATH_MAX];
401 1a26b5c7 2021-09-06 xhr json_object *root, *oracles, *temp, *table, *name, *desc, *chance;
402 1a26b5c7 2021-09-06 xhr int n_oracles, n_entries, i, j, what;
403 1a26b5c7 2021-09-06 xhr
404 1a26b5c7 2021-09-06 xhr snprintf(path, sizeof(path), "%s/ironsworn_oracles_place.json", _PATH_SHARE_DIR);
405 1a26b5c7 2021-09-06 xhr
406 1a26b5c7 2021-09-06 xhr if ((root = json_object_from_file(path)) == NULL) {
407 1a26b5c7 2021-09-06 xhr log_errx(1, "Cannot open %s\n", path);
408 1a26b5c7 2021-09-06 xhr }
409 1a26b5c7 2021-09-06 xhr
410 a1c776dd 2021-09-16 xhr if (!json_object_object_get_ex(root, "Oracles", &oracles)) {
411 a1c776dd 2021-09-16 xhr log_debug("Cannot find a [Oracles] array in %s\n", path);
412 a1c776dd 2021-09-16 xhr return;
413 a1c776dd 2021-09-16 xhr }
414 a1c776dd 2021-09-16 xhr
415 1a26b5c7 2021-09-06 xhr n_oracles = json_object_array_length(oracles);
416 1a26b5c7 2021-09-06 xhr
417 1a26b5c7 2021-09-06 xhr log_debug("number of oracles: %d\n", n_oracles);
418 1a26b5c7 2021-09-06 xhr for (i = 0; i < n_oracles; i++) {
419 1a26b5c7 2021-09-06 xhr temp = json_object_array_get_idx(oracles, i);
420 90922303 2021-09-16 xhr json_object_object_get_ex(temp, "Oracle Table", &table);
421 90922303 2021-09-16 xhr json_object_object_get_ex(temp, "Name", &name);
422 1a26b5c7 2021-09-06 xhr log_debug("Name %s\n", json_object_get_string(name));
423 1a26b5c7 2021-09-06 xhr
424 1a26b5c7 2021-09-06 xhr if ((strcmp(json_object_get_string(name), "Region") == 0))
425 1a26b5c7 2021-09-06 xhr what = ORACLE_REGION;
426 1a26b5c7 2021-09-06 xhr else if ((strcmp(json_object_get_string(name), "Location") == 0))
427 1a26b5c7 2021-09-06 xhr what = ORACLE_LOCATION;
428 1a26b5c7 2021-09-06 xhr else if ((strcmp(json_object_get_string(name), "Coastal Waters Location") == 0))
429 3ea4b207 2021-09-09 xhr what = ORACLE_COASTAL;
430 1a26b5c7 2021-09-06 xhr else if ((strcmp(json_object_get_string(name), "Location Descriptors") == 0))
431 1a26b5c7 2021-09-06 xhr what = ORACLE_DESCRIPTION;
432 d6e4bd9d 2021-09-16 xhr else {
433 1a26b5c7 2021-09-06 xhr what = -1;
434 d6e4bd9d 2021-09-16 xhr continue;
435 d6e4bd9d 2021-09-16 xhr }
436 1a26b5c7 2021-09-06 xhr
437 1a26b5c7 2021-09-06 xhr n_entries = json_object_array_length(table);
438 1a26b5c7 2021-09-06 xhr for (j = 0; j < n_entries; j++) {
439 1a26b5c7 2021-09-06 xhr temp = json_object_array_get_idx(table, j);
440 90922303 2021-09-16 xhr json_object_object_get_ex(temp, "Description", &desc);
441 90922303 2021-09-16 xhr json_object_object_get_ex(temp, "Chance", &chance);
442 90922303 2021-09-16 xhr add_to_array(what, json_object_get_int(chance), json_object_get_string(desc));
443 1a26b5c7 2021-09-06 xhr }
444 1a26b5c7 2021-09-06 xhr }
445 1a26b5c7 2021-09-06 xhr
446 1a26b5c7 2021-09-06 xhr /* Decrement the reference count of json_object and free if it reaches zero. */
447 1a26b5c7 2021-09-06 xhr json_object_put(root);
448 1a26b5c7 2021-09-06 xhr
449 1a26b5c7 2021-09-06 xhr read_places = 1;
450 1a26b5c7 2021-09-06 xhr }
451 1a26b5c7 2021-09-06 xhr
452 ce559d58 2021-09-05 xhr void
453 ce559d58 2021-09-05 xhr cmd_show_iron_name(__attribute__((unused))char *unused)
454 ce559d58 2021-09-05 xhr {
455 29889142 2021-09-05 xhr show_info_from_oracle(ORACLE_IS_NAMES, 200);
456 ce559d58 2021-09-05 xhr }
457 ce559d58 2021-09-05 xhr
458 ce559d58 2021-09-05 xhr void
459 ce559d58 2021-09-05 xhr cmd_show_elf_name(__attribute__((unused))char *unused)
460 ce559d58 2021-09-05 xhr {
461 29889142 2021-09-05 xhr show_info_from_oracle(ORACLE_ELF_NAMES, 100);
462 ce559d58 2021-09-05 xhr }
463 ce559d58 2021-09-05 xhr
464 ce559d58 2021-09-05 xhr void
465 ce559d58 2021-09-05 xhr cmd_show_giant_name(__attribute__((unused))char *unused)
466 ce559d58 2021-09-05 xhr {
467 29889142 2021-09-05 xhr show_info_from_oracle(ORACLE_GIANT_NAMES, 100);
468 ce559d58 2021-09-05 xhr }
469 ce559d58 2021-09-05 xhr
470 ce559d58 2021-09-05 xhr void
471 ce559d58 2021-09-05 xhr cmd_show_varou_name(__attribute__((unused))char *unused)
472 ce559d58 2021-09-05 xhr {
473 29889142 2021-09-05 xhr show_info_from_oracle(ORACLE_VAROU_NAMES, 100);
474 ce559d58 2021-09-05 xhr }
475 ce559d58 2021-09-05 xhr
476 ce559d58 2021-09-05 xhr void
477 ce559d58 2021-09-05 xhr cmd_show_troll_name(__attribute__((unused))char *unused)
478 ce559d58 2021-09-05 xhr {
479 29889142 2021-09-05 xhr show_info_from_oracle(ORACLE_TROLL_NAMES, 100);
480 ce559d58 2021-09-05 xhr }
481 ce559d58 2021-09-05 xhr
482 89da551e 2021-09-05 xhr void
483 89da551e 2021-09-05 xhr cmd_show_action(__attribute__((unused))char *unused)
484 89da551e 2021-09-05 xhr {
485 29889142 2021-09-05 xhr show_info_from_oracle(ORACLE_ACTIONS, 100);
486 89da551e 2021-09-05 xhr }
487 89da551e 2021-09-05 xhr
488 89da551e 2021-09-05 xhr void
489 89da551e 2021-09-05 xhr cmd_show_theme(__attribute__((unused))char *unused)
490 89da551e 2021-09-05 xhr {
491 29889142 2021-09-05 xhr show_info_from_oracle(ORACLE_THEMES, 100);
492 89da551e 2021-09-05 xhr }
493 89da551e 2021-09-05 xhr
494 90849b35 2021-09-05 xhr void
495 90849b35 2021-09-05 xhr cmd_show_rank(__attribute__((unused))char *unused)
496 90849b35 2021-09-05 xhr {
497 29889142 2021-09-05 xhr show_info_from_oracle(ORACLE_RANKS, 100);
498 323180ed 2021-09-05 xhr }
499 323180ed 2021-09-05 xhr
500 323180ed 2021-09-05 xhr void
501 323180ed 2021-09-05 xhr cmd_show_combat_action(__attribute__((unused))char *unused)
502 323180ed 2021-09-05 xhr {
503 29889142 2021-09-05 xhr show_info_from_oracle(ORACLE_COMBAT_ACTIONS, 100);
504 90849b35 2021-09-05 xhr }
505 90849b35 2021-09-05 xhr
506 323180ed 2021-09-05 xhr void
507 323180ed 2021-09-05 xhr cmd_show_plot_twist(__attribute__((unused))char *unused)
508 323180ed 2021-09-05 xhr {
509 29889142 2021-09-05 xhr show_info_from_oracle(ORACLE_PLOT_TWISTS, 100);
510 323180ed 2021-09-05 xhr }
511 323180ed 2021-09-05 xhr
512 d49e0a78 2021-09-05 xhr void
513 d49e0a78 2021-09-05 xhr cmd_show_mystic_backshlash(__attribute__((unused))char *unused)
514 d49e0a78 2021-09-05 xhr {
515 29889142 2021-09-05 xhr show_info_from_oracle(ORACLE_MYSTIC_BACKSLASH, 100);
516 29889142 2021-09-05 xhr }
517 d49e0a78 2021-09-05 xhr
518 29889142 2021-09-05 xhr void
519 1a26b5c7 2021-09-06 xhr cmd_show_location(__attribute__((unused))char *unused)
520 1a26b5c7 2021-09-06 xhr {
521 1a26b5c7 2021-09-06 xhr show_info_from_oracle(ORACLE_LOCATION, 100);
522 1a26b5c7 2021-09-06 xhr }
523 1a26b5c7 2021-09-06 xhr
524 1a26b5c7 2021-09-06 xhr void
525 1a26b5c7 2021-09-06 xhr cmd_show_location_description(__attribute__((unused))char *unused)
526 1a26b5c7 2021-09-06 xhr {
527 1a26b5c7 2021-09-06 xhr show_info_from_oracle(ORACLE_DESCRIPTION, 100);
528 1a26b5c7 2021-09-06 xhr }
529 1a26b5c7 2021-09-06 xhr
530 1a26b5c7 2021-09-06 xhr void
531 3ea4b207 2021-09-09 xhr cmd_show_coastal_location(__attribute__((unused))char *unused)
532 1a26b5c7 2021-09-06 xhr {
533 3ea4b207 2021-09-09 xhr show_info_from_oracle(ORACLE_COASTAL, 100);
534 1a26b5c7 2021-09-06 xhr }
535 1a26b5c7 2021-09-06 xhr
536 1a26b5c7 2021-09-06 xhr void
537 1a26b5c7 2021-09-06 xhr cmd_show_region(__attribute__((unused))char *unused)
538 1a26b5c7 2021-09-06 xhr {
539 1a26b5c7 2021-09-06 xhr show_info_from_oracle(ORACLE_REGION, 100);
540 3ad507cb 2021-09-13 xhr }
541 3ad507cb 2021-09-13 xhr
542 3ad507cb 2021-09-13 xhr void
543 3ad507cb 2021-09-13 xhr cmd_show_pay_the_price(__attribute__((unused))char *unused)
544 3ad507cb 2021-09-13 xhr {
545 3ad507cb 2021-09-13 xhr show_info_from_oracle(ORACLE_PAYTHEPRICE, 100);
546 1a26b5c7 2021-09-06 xhr }
547 1a26b5c7 2021-09-06 xhr
548 1a26b5c7 2021-09-06 xhr void
549 29889142 2021-09-05 xhr show_info_from_oracle(int what, int max)
550 29889142 2021-09-05 xhr {
551 29889142 2021-09-05 xhr char temp[255];
552 8c090849 2021-09-09 xhr long die, die2, saved_die;
553 d49e0a78 2021-09-05 xhr
554 8c090849 2021-09-09 xhr die = saved_die = roll_oracle_die();
555 29889142 2021-09-05 xhr if (die < 0 || die >= max)
556 d49e0a78 2021-09-05 xhr return;
557 d49e0a78 2021-09-05 xhr
558 29889142 2021-09-05 xhr memset(temp, 0, sizeof(temp));
559 d49e0a78 2021-09-05 xhr
560 7c7a71d6 2021-09-06 xhr if (read_names == 0)
561 7c7a71d6 2021-09-06 xhr read_names_from_json();
562 7c7a71d6 2021-09-06 xhr if (read_action == 0)
563 7c7a71d6 2021-09-06 xhr read_action_from_json();
564 7c7a71d6 2021-09-06 xhr if (read_turning == 0)
565 7c7a71d6 2021-09-06 xhr read_turning_from_json();
566 1a26b5c7 2021-09-06 xhr if (read_places == 0)
567 1a26b5c7 2021-09-06 xhr read_places_from_json();
568 3ad507cb 2021-09-13 xhr if (read_moves == 0)
569 3ad507cb 2021-09-13 xhr read_moves_from_json();
570 29889142 2021-09-05 xhr
571 29889142 2021-09-05 xhr switch(what) {
572 29889142 2021-09-05 xhr case ORACLE_IS_NAMES:
573 29889142 2021-09-05 xhr die2 = roll_oracle_die();
574 29889142 2021-09-05 xhr die += die2;
575 29889142 2021-09-05 xhr snprintf(temp, sizeof(temp), "%s", oracle_is_names[die]);
576 29889142 2021-09-05 xhr break;
577 29889142 2021-09-05 xhr case ORACLE_ELF_NAMES:
578 996f1345 2021-09-06 xhr while (strlen(oracle_elf_names[die]) == 0)
579 996f1345 2021-09-06 xhr die++;
580 29889142 2021-09-05 xhr snprintf(temp, sizeof(temp), "%s", oracle_elf_names[die]);
581 29889142 2021-09-05 xhr break;
582 29889142 2021-09-05 xhr case ORACLE_GIANT_NAMES:
583 29889142 2021-09-05 xhr while (strlen(oracle_giant_names[die]) == 0)
584 29889142 2021-09-05 xhr die++;
585 29889142 2021-09-05 xhr snprintf(temp, sizeof(temp), "%s", oracle_giant_names[die]);
586 29889142 2021-09-05 xhr break;
587 29889142 2021-09-05 xhr case ORACLE_VAROU_NAMES:
588 29889142 2021-09-05 xhr while (strlen(oracle_varou_names[die]) == 0)
589 29889142 2021-09-05 xhr die++;
590 29889142 2021-09-05 xhr snprintf(temp, sizeof(temp), "%s", oracle_varou_names[die]);
591 29889142 2021-09-05 xhr break;
592 29889142 2021-09-05 xhr case ORACLE_TROLL_NAMES:
593 29889142 2021-09-05 xhr while (strlen(oracle_troll_names[die]) == 0)
594 29889142 2021-09-05 xhr die++;
595 29889142 2021-09-05 xhr snprintf(temp, sizeof(temp), "%s", oracle_troll_names[die]);
596 29889142 2021-09-05 xhr break;
597 29889142 2021-09-05 xhr case ORACLE_ACTIONS:
598 29889142 2021-09-05 xhr while (strlen(oracle_action[die]) == 0)
599 29889142 2021-09-05 xhr die++;
600 29889142 2021-09-05 xhr snprintf(temp, sizeof(temp), "%s", oracle_action[die]);
601 29889142 2021-09-05 xhr break;
602 29889142 2021-09-05 xhr case ORACLE_THEMES:
603 29889142 2021-09-05 xhr while (strlen(oracle_theme[die]) == 0)
604 29889142 2021-09-05 xhr die++;
605 29889142 2021-09-05 xhr snprintf(temp, sizeof(temp), "%s", oracle_theme[die]);
606 29889142 2021-09-05 xhr break;
607 29889142 2021-09-05 xhr case ORACLE_RANKS:
608 29889142 2021-09-05 xhr while (strlen(oracle_rank[die]) == 0)
609 29889142 2021-09-05 xhr die++;
610 29889142 2021-09-05 xhr snprintf(temp, sizeof(temp), "%s", oracle_rank[die]);
611 29889142 2021-09-05 xhr break;
612 29889142 2021-09-05 xhr case ORACLE_COMBAT_ACTIONS:
613 29889142 2021-09-05 xhr while (strlen(oracle_combat_action[die]) == 0)
614 29889142 2021-09-05 xhr die++;
615 29889142 2021-09-05 xhr snprintf(temp, sizeof(temp), "%s", oracle_combat_action[die]);
616 29889142 2021-09-05 xhr break;
617 29889142 2021-09-05 xhr case ORACLE_PLOT_TWISTS:
618 29889142 2021-09-05 xhr while (strlen(oracle_plot_twist[die]) == 0)
619 29889142 2021-09-05 xhr die++;
620 29889142 2021-09-05 xhr snprintf(temp, sizeof(temp), "%s", oracle_plot_twist[die]);
621 29889142 2021-09-05 xhr break;
622 29889142 2021-09-05 xhr case ORACLE_MYSTIC_BACKSLASH:
623 29889142 2021-09-05 xhr while (strlen(oracle_mystic_backslash[die]) == 0)
624 29889142 2021-09-05 xhr die++;
625 29889142 2021-09-05 xhr snprintf(temp, sizeof(temp), "%s", oracle_mystic_backslash[die]);
626 29889142 2021-09-05 xhr break;
627 1a26b5c7 2021-09-06 xhr case ORACLE_REGION:
628 1a26b5c7 2021-09-06 xhr while (strlen(oracle_regions[die]) == 0)
629 1a26b5c7 2021-09-06 xhr die++;
630 1a26b5c7 2021-09-06 xhr snprintf(temp, sizeof(temp), "%s", oracle_regions[die]);
631 1a26b5c7 2021-09-06 xhr break;
632 1a26b5c7 2021-09-06 xhr case ORACLE_LOCATION:
633 1a26b5c7 2021-09-06 xhr while (strlen(oracle_locations[die]) == 0)
634 1a26b5c7 2021-09-06 xhr die++;
635 1a26b5c7 2021-09-06 xhr snprintf(temp, sizeof(temp), "%s", oracle_locations[die]);
636 1a26b5c7 2021-09-06 xhr break;
637 3ea4b207 2021-09-09 xhr case ORACLE_COASTAL:
638 3ea4b207 2021-09-09 xhr while (strlen(oracle_coastal_locations[die]) == 0)
639 1a26b5c7 2021-09-06 xhr die++;
640 3ea4b207 2021-09-09 xhr snprintf(temp, sizeof(temp), "%s", oracle_coastal_locations[die]);
641 1a26b5c7 2021-09-06 xhr break;
642 1a26b5c7 2021-09-06 xhr case ORACLE_DESCRIPTION:
643 1a26b5c7 2021-09-06 xhr while (strlen(oracle_location_descriptions[die]) == 0)
644 1a26b5c7 2021-09-06 xhr die++;
645 1a26b5c7 2021-09-06 xhr snprintf(temp, sizeof(temp), "%s", oracle_location_descriptions[die]);
646 1a26b5c7 2021-09-06 xhr break;
647 3ad507cb 2021-09-13 xhr case ORACLE_PAYTHEPRICE:
648 3ad507cb 2021-09-13 xhr while (strlen(oracle_pay_the_price[die]) == 0)
649 3ad507cb 2021-09-13 xhr die++;
650 3ad507cb 2021-09-13 xhr snprintf(temp, sizeof(temp), "%s", oracle_pay_the_price[die]);
651 3ad507cb 2021-09-13 xhr break;
652 29889142 2021-09-05 xhr }
653 29889142 2021-09-05 xhr
654 8c090849 2021-09-09 xhr printf("%s (%ld)\n", temp, saved_die);
655 d49e0a78 2021-09-05 xhr }
656 d49e0a78 2021-09-05 xhr