Spaces:
Sleeping
Sleeping
drakosfire
commited on
Commit
•
d5fb696
1
Parent(s):
c8a4cd8
Feature complete to import html and build blocks, with drag and drop, trash, reset.
Browse files- The_Mirage_Emporium.html +334 -0
- app.py +35 -267
- block_builder.py +577 -0
- closed-mimic-trashcan.png +3 -0
- mimic_trashcan.png +3 -0
- sd_generator.py +30 -0
- storeUI.html +1328 -0
- store_helper.py +26 -23
- template.html +581 -0
The_Mirage_Emporium.html
ADDED
@@ -0,0 +1,334 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html>
|
3 |
+
<head>
|
4 |
+
<link href="./dependencies/all.css" rel="stylesheet" />
|
5 |
+
<link href="./dependencies/css.css?family=Open+Sans:400,300,600,700" rel="stylesheet" type="text/css" />
|
6 |
+
<link href='./dependencies/bundle.css' rel='stylesheet' />
|
7 |
+
<link href="./dependencies/style.css" rel='stylesheet' />
|
8 |
+
<link href="./dependencies/5ePHBstyle.css" rel='stylesheet' />
|
9 |
+
|
10 |
+
|
11 |
+
</head>
|
12 |
+
<title>The Mirage Emporium</title>
|
13 |
+
<body style="overflow: hidden">
|
14 |
+
|
15 |
+
<div>
|
16 |
+
<div class="brewRenderer" style="height: 692px;">
|
17 |
+
<div class="pages" lang="en">
|
18 |
+
<div class="page" id="p1">
|
19 |
+
<div class="columnWrapper">
|
20 |
+
<div class="Block_1">
|
21 |
+
<h1 id="store_name">The Mirage Emporium</h1>
|
22 |
+
<div contenteditable="true" class="" id="user-monster-description"
|
23 |
+
hx-post="/update-stats" hx-trigger="change"
|
24 |
+
hx-target="#user-monster-description" hx-swap="outerHTML"
|
25 |
+
title="Any amount or style of description">
|
26 |
+
<p>A peculiar shop filled with the odd and the useless, where each corner hides a laugh and a mystery. The Mirage Emporium was founded by a retired jester known for his love of the whimsical and the curious. He traveled the world collecting oddball items that struck his fancy, and upon amassing a considerable collection, opened a shop to share his treasures with the world. Locally famous for its bizarre and delightful inventory, though not particularly useful.</p>
|
27 |
+
|
28 |
+
</div>
|
29 |
+
</div> <!--Close Block_1-->
|
30 |
+
<!-- Generated Image of Shop -->
|
31 |
+
<div class="Block_2">
|
32 |
+
<textarea class="string-action-description-textarea" id="user-storefront-prompt-1"
|
33 |
+
hx-post="/update-stats" hx-trigger="change" hx-target="#user-sd-prompt" hx-swap="outerHTML"
|
34 |
+
title="Storefront image description">{sd_prompt}</textarea>
|
35 |
+
|
36 |
+
<p><img id="generated-image-1" cursor: pointer; src="https://media.githubusercontent.com/media/Drakosfire/StoreGenerator/master/galleries/test_images/morgor_meaty_marvels.png" alt="The Mirage Emporium"></p>
|
37 |
+
<button class="generate-image-button" data-block-id=1>Generate Image</button>
|
38 |
+
</div> <!--Close Block_2-->
|
39 |
+
<div class="Block_3">
|
40 |
+
<div class="block classTable frame decoration">
|
41 |
+
<table>
|
42 |
+
<thead>
|
43 |
+
<tr>
|
44 |
+
<th align="left"></th>
|
45 |
+
<th align="center"></th>
|
46 |
+
<th align="center"></th>
|
47 |
+
</tr>
|
48 |
+
</thead>
|
49 |
+
<tbody>
|
50 |
+
<tr>
|
51 |
+
<td align="left"><strong>Size</strong></td>
|
52 |
+
<td align="right">Small</td>
|
53 |
+
</tr>
|
54 |
+
<tr>
|
55 |
+
<td align="left"><strong>Town</strong></td>
|
56 |
+
<td align="right">Bramblebrook</td>
|
57 |
+
</tr>
|
58 |
+
<tr>
|
59 |
+
<td align="left"><strong>District</strong></td>
|
60 |
+
<td align="right">Harlequin Quarter</td>
|
61 |
+
</tr>
|
62 |
+
<tr>
|
63 |
+
<td align="left"><strong>Street</strong></td>
|
64 |
+
<td align="right">Twilight Alley</td>
|
65 |
+
</tr>
|
66 |
+
<tr>
|
67 |
+
<td align="left"><strong>Type</strong></td>
|
68 |
+
<td align="right">Curiosity Shop</td>
|
69 |
+
</tr>
|
70 |
+
<tr>
|
71 |
+
<td align="left"><strong>Owners</strong></td>
|
72 |
+
<td align="right">Fizzwidget Funsquirrel</td>
|
73 |
+
</tr>
|
74 |
+
<tr>
|
75 |
+
<td align="left"><strong>Employees</strong></td>
|
76 |
+
<td align="right">Marigold Merryleaf</td>
|
77 |
+
</tr>
|
78 |
+
<tr>
|
79 |
+
<td align="left"><strong>Store Hours</strong></td>
|
80 |
+
<td align="right">From dawn until the moonlight dances.</td>
|
81 |
+
</tr>
|
82 |
+
<tr>
|
83 |
+
<td align="left"><strong>Services</strong></td>
|
84 |
+
<td align="right">Laughter Therapy</td>
|
85 |
+
</tr>
|
86 |
+
<tr>
|
87 |
+
<td align="left"><strong>Specialties</strong></td>
|
88 |
+
<td align="right">Mystery Mounds</td>
|
89 |
+
</tr>
|
90 |
+
<tr>
|
91 |
+
<td align="left"><strong>Reputation</strong></td>
|
92 |
+
<td align="right">Locally famous for its bizarre and delightful inventory, though not particularly useful.</td>
|
93 |
+
</tr>
|
94 |
+
<tr>
|
95 |
+
<td align="left"><strong>Rumors</strong></td>
|
96 |
+
<td align="right">It's said that Fizzwidget once outwitted a dragon using only a rubber chicken and a whoopee cushion., Marigold can find lost items using her 'half-sense' for where things hide.</td>
|
97 |
+
</tr>
|
98 |
+
</tbody>
|
99 |
+
</table>
|
100 |
+
</div>
|
101 |
+
</div> <!--Close Block_3-->
|
102 |
+
<div class="Block_4">
|
103 |
+
<p><img class="" style="width:300px; mix-blend-mode:multiply;" src="https://media.githubusercontent.com/media/Drakosfire/StoreGenerator/master/galleries/test_images/Morgor_bloodclaw.png" alt="Fizzwidget Funsquirrel"></p>
|
104 |
+
</div> <!--Close Block_4-->
|
105 |
+
<div class="Block_5">
|
106 |
+
<h2 id="owner">Owner</h2>
|
107 |
+
</div> <!--Close Block_5-->
|
108 |
+
<div class="Block_6">
|
109 |
+
<h3 id="owner_0">Fizzwidget Funsquirrel</h3>
|
110 |
+
<table>
|
111 |
+
<thead>
|
112 |
+
<tr>
|
113 |
+
<th align="center"></th>
|
114 |
+
<th align="center"></th>
|
115 |
+
</tr>
|
116 |
+
</thead>
|
117 |
+
<tbody>
|
118 |
+
<tr>
|
119 |
+
<td align="center"><strong>Species</strong></td>
|
120 |
+
<td align="right">Gnome</td>
|
121 |
+
</tr>
|
122 |
+
<tr>
|
123 |
+
<td align="center"><strong>Class</strong></td>
|
124 |
+
<td align="right">Bard</td>
|
125 |
+
</tr>
|
126 |
+
<tr>
|
127 |
+
<td align="center"><strong>Description</strong></td>
|
128 |
+
<td align="left">A lively gnome with a perpetual twinkle in his eye and a knack for making people smile..</td>
|
129 |
+
</tr>
|
130 |
+
<tr>
|
131 |
+
<td align="center"><strong>Personality</strong></td>
|
132 |
+
<td align="left">Joyful, playful, and a tad mischievous.</td>
|
133 |
+
</tr>
|
134 |
+
<tr>
|
135 |
+
<td align="center"><strong>Secrets</strong></td>
|
136 |
+
<td align="left">Fizzwidget once performed a jester act for the Queen of Faerun.<br> He has a hidden collection of practical jokes for special customers.</td>
|
137 |
+
</tr>
|
138 |
+
</tbody>
|
139 |
+
</table>
|
140 |
+
</div> <!--Close Block_6-->
|
141 |
+
|
142 |
+
|
143 |
+
<p> </p>
|
144 |
+
<div class="columnSplit"></div>
|
145 |
+
<p> </p>
|
146 |
+
</div>
|
147 |
+
</div>
|
148 |
+
<div class="page" id="p2">
|
149 |
+
<div class="columnWrapper">
|
150 |
+
<div class="blank"></div>
|
151 |
+
<div class="Block_7"></div>
|
152 |
+
<h2 id="employees">Employees</h2>
|
153 |
+
</div> <!--Close Block_7-->
|
154 |
+
|
155 |
+
<h3 id="brega">Brega</h3>
|
156 |
+
<p><img class="" style="width:150px; mix-blend-mode:multiply;" src="https://media.githubusercontent.com/media/Drakosfire/StoreGenerator/master/galleries/test_images/Brega.png" alt="Brega"></p>
|
157 |
+
|
158 |
+
<table>
|
159 |
+
<thead>
|
160 |
+
<tr>
|
161 |
+
<th align="center"></th>
|
162 |
+
<th align="center"></th>
|
163 |
+
</tr>
|
164 |
+
</thead>
|
165 |
+
<tbody>
|
166 |
+
<tr>
|
167 |
+
<td align="center"><strong>Species</strong></td>
|
168 |
+
<td align="center">Half-Orc</td>
|
169 |
+
</tr>
|
170 |
+
<tr>
|
171 |
+
<td align="center"><strong>Class</strong></td>
|
172 |
+
<td align="center">Assistant Butcher</td>
|
173 |
+
</tr>
|
174 |
+
<tr>
|
175 |
+
<td align="center"><strong>Description</strong></td>
|
176 |
+
<td align="center">A burly half-orc with a kind face and a perpetual smudge of blood on his cheek. Brega handles the heavy lifting and cutting of larger beasts.</td>
|
177 |
+
</tr>
|
178 |
+
<tr>
|
179 |
+
<td align="center"><strong>Personality</strong></td>
|
180 |
+
<td align="center">Soft-spoken and gentle despite his imposing appearance, Brega is loyal to Morgor and respects his cunning. He has a soft spot for stray animals.</td>
|
181 |
+
</tr>
|
182 |
+
</tbody>
|
183 |
+
</table>
|
184 |
+
</div> <!--Close Block_8-->
|
185 |
+
|
186 |
+
<div class="Block_9">
|
187 |
+
<h1 id="notable-customers">Notable Customers</h1>
|
188 |
+
<div class="block note">
|
189 |
+
<h3 id="lord-vittorio-blackthorn">Lord Vittorio Blackthorn</h3>
|
190 |
+
<p>An eccentric noble known for his extravagant feasts featuring rare and exotic meats.</p>
|
191 |
+
<p>Lord Blackthorn’s patronage lends an air of mystery and prestige to Morgor’s shop, attracting curious gourmands and shady characters alike.</p>
|
192 |
+
</div>
|
193 |
+
</div> <!--Close Block_9-->
|
194 |
+
<div class="Block_10"></div>
|
195 |
+
<h1 id="related-quests">Related Quests</h1>
|
196 |
+
<h3 id="the-basilisk-bounty">The Basilisk Bounty</h3>
|
197 |
+
<p>Morgor needs fresh basilisk meat and offers a handsome reward for those brave enough to hunt one.</p>
|
198 |
+
<p>500 gold coins and choice cuts of meat.</p>
|
199 |
+
|
200 |
+
</div>
|
201 |
+
|
202 |
+
|
203 |
+
<div class="columnSplit"></div>
|
204 |
+
<div class="block">
|
205 |
+
<div class="Block_11">
|
206 |
+
<h1 id="services-and-specialties">Services and Specialties</h1>
|
207 |
+
<div class="blank"></div>
|
208 |
+
<h2 id="services">Services</h2>
|
209 |
+
<h3 id="custom-slaughtering">Custom Slaughtering</h3>
|
210 |
+
<p>Bring your own beasts, and Morgor will prepare the meat to your specifications.
|
211 |
+
50 gold coins per beast.</p>
|
212 |
+
<div class="blank"></div>
|
213 |
+
<h2 id="specialties">Specialties</h2>
|
214 |
+
<div class="blank"></div>
|
215 |
+
<h3 id="basilisk-cutlets">Basilisk Cutlets</h3>
|
216 |
+
<p>Tender and marbled with a unique flavor, perfect for those seeking a truly rare dining experience.</p>
|
217 |
+
<h3 id="subterranean-lizard-tail">Subterranean Lizard Tail</h3>
|
218 |
+
<p>A delicacy prized for its unique texture and earthy taste, enchanted to enhance its natural flavor.</p>
|
219 |
+
</div> <!--Close Block_10-->
|
220 |
+
<div class="Block_12">
|
221 |
+
<h1 id="security">Security</h1>
|
222 |
+
<div class="blank"></div>
|
223 |
+
<h3 id="bewitched-meat-hooks">Bewitched Meat Hooks</h3>
|
224 |
+
<p>These enchanted meat hooks animate and attack intruders who try to take meat without paying. 200 gold coins per pound.</p>
|
225 |
+
<div class="blank"></div>
|
226 |
+
<p>Attack: +5 to hit, 1d8+3 piercing damage.</p>
|
227 |
+
<h3 id="shadow-ward">Shadow Ward</h3>
|
228 |
+
<p>A magical barrier that alerts Morgor if someone enters the shop after hours. 150 gold coins per pound.</p>
|
229 |
+
<div class="blank"></div>
|
230 |
+
<p>Detection radius of 60 feet, triggers an audible alarm.</p>
|
231 |
+
</div> <!--Close Block_11-->
|
232 |
+
</div> <!-- Close Block -->
|
233 |
+
</div> <!-- close columnWrapper-->
|
234 |
+
</div> <!-- close page 2 -->
|
235 |
+
|
236 |
+
<div class="page" id="p3">
|
237 |
+
<div class="columnWrapper">
|
238 |
+
<div class="Block_13">
|
239 |
+
<div class="block classTable frame decoration">
|
240 |
+
<h5 id="inventory">Inventory</h5>
|
241 |
+
<table>
|
242 |
+
<thead>
|
243 |
+
<tr>
|
244 |
+
<th align="center">Name</th>
|
245 |
+
<th align="center">Type</th>
|
246 |
+
<th align="left">Cost</th>
|
247 |
+
<th align="center">Properties</th>
|
248 |
+
</tr>
|
249 |
+
</thead>
|
250 |
+
<tbody>
|
251 |
+
<tr>
|
252 |
+
<td align="center">Poultry Drumsticks</td>
|
253 |
+
<td align="center">Meat</td>
|
254 |
+
<td align="left">1 gp per lbs</td>
|
255 |
+
<td align="center"></td>
|
256 |
+
</tr>
|
257 |
+
<tr>
|
258 |
+
<td align="center">Ground Beef</td>
|
259 |
+
<td align="center">Meat</td>
|
260 |
+
<td align="left">1 gp per lbs</td>
|
261 |
+
<td align="center"></td>
|
262 |
+
</tr>
|
263 |
+
<tr>
|
264 |
+
<td align="center">Pork Chops</td>
|
265 |
+
<td align="center">Meat</td>
|
266 |
+
<td align="left">1 gp per lbs</td>
|
267 |
+
<td align="center"></td>
|
268 |
+
</tr>
|
269 |
+
<tr>
|
270 |
+
<td align="center">Bacon Strips</td>
|
271 |
+
<td align="center">Meat</td>
|
272 |
+
<td align="left">1 gp per lbs</td>
|
273 |
+
<td align="center"></td>
|
274 |
+
</tr>
|
275 |
+
<tr>
|
276 |
+
<td align="center">Sausage Links</td>
|
277 |
+
<td align="center">Meat</td>
|
278 |
+
<td align="left">1 gp per lbs</td>
|
279 |
+
<td align="center"></td>
|
280 |
+
</tr>
|
281 |
+
<tr>
|
282 |
+
<td align="center">Mystic Minotaur Steak</td>
|
283 |
+
<td align="center">Exotic Meat</td>
|
284 |
+
<td align="left">25 gold per pound</td>
|
285 |
+
<td align="center">Grants temporary strength boost when consumed, Requires fine culinary skills to cook properly</td>
|
286 |
+
</tr>
|
287 |
+
<tr>
|
288 |
+
<td align="center">Quantum Quail</td>
|
289 |
+
<td align="center">Exotic Poultry</td>
|
290 |
+
<td align="left">15 gold each</td>
|
291 |
+
<td align="center">“Phases in and out of existence”, “Can enhance one’s agility”</td>
|
292 |
+
</tr>
|
293 |
+
<tr>
|
294 |
+
<td align="center">Invisible Bacon</td>
|
295 |
+
<td align="center">Mystical Meat</td>
|
296 |
+
<td align="left">10 gold per slice</td>
|
297 |
+
<td align="center">“Invisible to the naked eye”, “Tastes incredibly savory”, “Can only be seen with a special spell”</td>
|
298 |
+
</tr>
|
299 |
+
<tr>
|
300 |
+
<td align="center">Hydra Sausage</td>
|
301 |
+
<td align="center">Mythical Meat</td>
|
302 |
+
<td align="left">50 gold per link</td>
|
303 |
+
<td align="center">“Each bite regenerates after a while”, “Consuming too much may cause mild hallucinations”</td>
|
304 |
+
</tr>
|
305 |
+
<tr>
|
306 |
+
<td align="center">Cursed Cleaver</td>
|
307 |
+
<td align="center">Kitchen Equipment</td>
|
308 |
+
<td align="left">100 gold</td>
|
309 |
+
<td align="center">“Cuts through any meat effortlessly”, “Occasionally whispers in a long-forgotten language”, “Rumored to be haunted”</td>
|
310 |
+
</tr>
|
311 |
+
<tr>
|
312 |
+
<td align="center">Vampire Spice Mix</td>
|
313 |
+
<td align="center">Cooking Ingredient</td>
|
314 |
+
<td align="left">20 gold per pouch</td>
|
315 |
+
<td align="center">“Adds a distinct flavor”, “Enhances blood flow in the consumer”, “Leaves a lingering aftertaste of garlic”</td>
|
316 |
+
</tr>
|
317 |
+
<tr>
|
318 |
+
<td align="center">Phoenix Feather Skewers</td>
|
319 |
+
<td align="center">Cooking Utensil</td>
|
320 |
+
<td align="left">75 gold per set</td>
|
321 |
+
<td align="center">“Prevents meat from overcooking”, “Gives a slight warmth to cooked items”, “Reusable endlessly”</td>
|
322 |
+
</tr>
|
323 |
+
</tbody>
|
324 |
+
</table>
|
325 |
+
</div> <!--Close Block_12-->
|
326 |
+
</div>
|
327 |
+
<p> </p>
|
328 |
+
</div><!-- Close Column Wrapper-->
|
329 |
+
</div> <!-- Close Page 3-->
|
330 |
+
</div> <!-- Close pages-->
|
331 |
+
</div> <!--Close brew renderer-->
|
332 |
+
</div><!-- Close Div housing body-->
|
333 |
+
</body>
|
334 |
+
</html>
|
app.py
CHANGED
@@ -1,12 +1,13 @@
|
|
1 |
# this imports the code from files and modules
|
2 |
-
import
|
|
|
3 |
import utilities as u
|
4 |
import os
|
5 |
import ctypes
|
6 |
import store_helper as sh
|
7 |
import process_text
|
8 |
-
import
|
9 |
-
|
10 |
|
11 |
# This is a fix for the way that python doesn't release system memory back to the OS and it was leading to locking up the system
|
12 |
libc = ctypes.cdll.LoadLibrary("libc.so.6")
|
@@ -14,277 +15,44 @@ M_MMAP_THRESHOLD = -3
|
|
14 |
|
15 |
# Set malloc mmap threshold.
|
16 |
libc.mallopt(M_MMAP_THRESHOLD, 2**20)
|
|
|
17 |
|
18 |
-
# Declare accessible directories
|
19 |
-
base_dir = os.path.dirname(os.path.abspath(__file__)) # Gets the directory where app.py is located
|
20 |
-
print(f"Base Directory :",base_dir)
|
21 |
-
list_of_static_dir = [os.path.join(base_dir, "output"),
|
22 |
-
os.path.join(base_dir, "dependencies"),
|
23 |
-
os.path.join(base_dir, "galleries")]
|
24 |
-
gr.set_static_paths(paths=list_of_static_dir)
|
25 |
-
|
26 |
-
|
27 |
-
# Build gradio app
|
28 |
-
# Storing everything inside the Blocks to be accessible to the app
|
29 |
|
30 |
-
with gr.Blocks() as demo:
|
31 |
-
# Functions and State Variables
|
32 |
-
store_dict= gr.State()
|
33 |
-
store_name = gr.State()
|
34 |
-
store_description = gr.State()
|
35 |
-
store_reputation = gr.State()
|
36 |
-
store_backstory = gr.State()
|
37 |
-
store_sd_prompt = gr.State()
|
38 |
-
store_location = gr.State()
|
39 |
-
store_type = gr.State()
|
40 |
-
store_size = gr.State()
|
41 |
-
store_owner = gr.State()
|
42 |
-
store_employees = gr.State()
|
43 |
-
store_hours = gr.State()
|
44 |
-
store_services = gr.State()
|
45 |
-
store_specialties = gr.State()
|
46 |
-
notable_customers = gr.State()
|
47 |
-
store_quests = gr.State()
|
48 |
-
store_rumors = gr.State()
|
49 |
-
store_security = gr.State()
|
50 |
-
store_inventory = gr.State()
|
51 |
-
store_inventory_dict = gr.State()
|
52 |
-
specialties_description = gr.State()
|
53 |
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
store_value = item
|
58 |
-
# if type(store_value) == list:
|
59 |
-
store_value = process_text.format_qualities(store_value)
|
60 |
-
else : store_value = ""
|
61 |
-
return store_value
|
62 |
-
|
63 |
-
def gen_store_desc(user_description):
|
64 |
-
llm_output = sh.call_llm_and_cleanup(user_description)
|
65 |
-
store_dict = sh.convert_to_dict(llm_output)
|
66 |
-
# Key List for checking is speciufic keys are present before running parsing functions
|
67 |
-
keys_list = list(llm_output)
|
68 |
-
store_name_value = store_dict['store_name']
|
69 |
-
store_description_value = store_dict['store_description']
|
70 |
-
store_reputation_value = store_dict['store_reputation']
|
71 |
-
store_backstory_value = store_dict['store_backstory']
|
72 |
-
store_sd_prompt_value = store_dict['store_sd_prompt']
|
73 |
-
store_type_value = store_dict['store_type']
|
74 |
-
store_size_value = store_dict['store_size']
|
75 |
-
store_location_value = check_and_process_contents(store_dict['store_location'])
|
76 |
-
store_owner_value = check_and_process_contents(store_dict['store_owners'])
|
77 |
-
store_employees_value = check_and_process_contents(store_dict['store_employees'])
|
78 |
-
store_hours_value = store_dict['store_hours']
|
79 |
-
store_services_value = check_and_process_contents(store_dict['store_services'])
|
80 |
-
store_specialties_value = check_and_process_contents(store_dict['store_specialties'])
|
81 |
-
notable_customers_value = check_and_process_contents(store_dict['store_customers'])
|
82 |
-
store_quests_value = check_and_process_contents(store_dict['store_quests'])
|
83 |
-
store_rumors_value = check_and_process_contents(store_dict['store_rumors'])
|
84 |
-
store_security_value = check_and_process_contents(store_dict['store_security'])
|
85 |
|
86 |
-
|
87 |
-
#Return each State variable twice, once to the variable and once to the textbox
|
88 |
-
return [store_dict, store_dict,
|
89 |
-
store_name_value, store_name_value,
|
90 |
-
store_description_value, store_description_value,
|
91 |
-
store_reputation_value, store_reputation_value,
|
92 |
-
store_backstory_value, store_backstory_value,
|
93 |
-
store_sd_prompt_value, store_sd_prompt_value,
|
94 |
-
store_type_value, store_type_value,
|
95 |
-
store_size_value, store_size_value,
|
96 |
-
store_location_value, store_location_value,
|
97 |
-
store_owner_value, store_owner_value,
|
98 |
-
store_employees_value,store_employees_value,
|
99 |
-
notable_customers_value, notable_customers_value,
|
100 |
-
store_hours_value, store_hours_value,
|
101 |
-
store_services_value, store_services_value,
|
102 |
-
store_specialties_value, store_specialties_value,
|
103 |
-
store_quests_value, store_quests_value,
|
104 |
-
store_rumors_value, store_rumors_value,
|
105 |
-
store_security_value, store_security_value
|
106 |
-
]
|
107 |
-
|
108 |
-
def gen_store_inventory(store_name, store_type, store_size, store_owner, store_reputation):
|
109 |
-
inventory_description = f"{store_name}, {store_type} {store_size} {store_owner} {store_reputation}"
|
110 |
-
inventory_dict = sh.call_llm_and_cleanup(inventory_description, inventory=True)
|
111 |
-
inventory_dict = sh.convert_to_dict(inventory_dict)
|
112 |
-
if inventory_dict['store_inventory']:
|
113 |
-
store_inventory_value = inventory_dict['store_inventory']
|
114 |
-
store_inventory_value = process_text.format_inventory(store_inventory_value)
|
115 |
-
|
116 |
-
#Return each State variable twice, once to the variable and once to the textbox
|
117 |
-
return [store_inventory_value,store_inventory_value
|
118 |
-
]
|
119 |
-
def store_desc_to_dict(store_name,
|
120 |
-
store_description,
|
121 |
-
store_reputation,
|
122 |
-
store_backstory,
|
123 |
-
store_sd_prompt,
|
124 |
-
store_location,
|
125 |
-
store_type,
|
126 |
-
store_size,
|
127 |
-
store_owner,
|
128 |
-
store_employees,
|
129 |
-
store_hours,
|
130 |
-
store_services,
|
131 |
-
store_specialties,
|
132 |
-
notable_customers,
|
133 |
-
store_quests,
|
134 |
-
store_rumors,
|
135 |
-
store_security,
|
136 |
-
store_inventory
|
137 |
-
):
|
138 |
-
store_dict = process_text.parse_text_to_store_dict(store_name,
|
139 |
-
store_description,
|
140 |
-
store_reputation,
|
141 |
-
store_backstory,
|
142 |
-
store_sd_prompt,
|
143 |
-
store_location,
|
144 |
-
store_type,
|
145 |
-
store_size,
|
146 |
-
store_owner,
|
147 |
-
store_employees,
|
148 |
-
store_hours,
|
149 |
-
store_services,
|
150 |
-
store_specialties,
|
151 |
-
notable_customers,
|
152 |
-
store_quests,
|
153 |
-
store_rumors,
|
154 |
-
store_security,
|
155 |
-
store_inventory)
|
156 |
-
|
157 |
-
# Process each variable and rebuild the store dict format, pass back as dictionary to the store_dict state variable.
|
158 |
-
store_dict = sh.convert_to_dict(store_dict)
|
159 |
-
return store_dict, store_dict
|
160 |
-
|
161 |
-
def inventory_to_dict(inventory):
|
162 |
-
inventory_dict = process_text.parse_text_to_inventory_dict(inventory)
|
163 |
-
# Convert text format to data object dictionary and check for validity
|
164 |
-
inventory_dict = sh.convert_to_dict(inventory_dict)
|
165 |
-
return inventory_dict, inventory_dict
|
166 |
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
|
|
|
|
|
|
|
|
172 |
|
173 |
-
store_file_path = process_html.build_html_base(store_dict)
|
174 |
-
|
175 |
-
if not os.path.exists(store_file_path):
|
176 |
-
print(f"{store_file_path} not found")
|
177 |
-
else: print(f"{store_file_path} found")
|
178 |
-
iframe = f"""<iframe src="file={store_file_path}" width="100%" height="500px"></iframe>"""
|
179 |
-
|
180 |
-
return iframe
|
181 |
-
|
182 |
-
#Function to dynamically render textbox if it has text.
|
183 |
-
def update_visibility(textbox):
|
184 |
-
if not textbox:
|
185 |
-
return gr.update(visible=False)
|
186 |
-
return gr.update(visible=True)
|
187 |
-
with gr.Tab("Store"):
|
188 |
-
user_store_dict = gr.Textbox(label = "Step 1 : What are the core qualities of the store?",
|
189 |
-
lines = 1, placeholder=f"Ex : A trade shop with a female ogre merchant, basic trade goods and travel supplies, has a secret basement for smuggling.",
|
190 |
-
elem_id= "custom-textbox")
|
191 |
-
desc_gen = gr.Button(value = "Click to Generate Description")
|
192 |
-
store_name_output = gr.Textbox(label = "Store Name", lines = 1, interactive = True, visible = False)
|
193 |
-
store_name_output.change(fn=update_visibility,
|
194 |
-
inputs=[store_name_output],
|
195 |
-
outputs=[store_name_output])
|
196 |
-
store_dict_gen = gr.Button(value = "Click to convert test to data object")
|
197 |
-
store_dict_output = gr.Textbox(label = 'Inventory', lines = 16, interactive=True, visible=True)
|
198 |
-
|
199 |
-
store_dict_gen.click(fn = store_desc_to_dict, inputs = [store_name,
|
200 |
-
store_description,
|
201 |
-
store_reputation,
|
202 |
-
store_backstory,
|
203 |
-
store_sd_prompt,
|
204 |
-
store_location,
|
205 |
-
store_type,
|
206 |
-
store_size,
|
207 |
-
store_owner,
|
208 |
-
store_employees,
|
209 |
-
store_hours,
|
210 |
-
store_services,
|
211 |
-
store_specialties,
|
212 |
-
notable_customers,
|
213 |
-
store_quests,
|
214 |
-
store_rumors,
|
215 |
-
store_security,
|
216 |
-
store_inventory],
|
217 |
-
outputs= [store_dict, store_dict_output])
|
218 |
-
store_description_output = gr.Textbox(label = "Store Description", lines = 1, interactive = True, visible = True)
|
219 |
-
store_description_output.change(fn=update_visibility,
|
220 |
-
inputs=[store_description_output],
|
221 |
-
outputs=[store_description_output])
|
222 |
-
store_reputation_output = gr.Textbox(label = "Store Reputation", lines = 1, interactive = True, visible = True)
|
223 |
-
store_backstory_output = gr.Textbox(label = "Store Backstory", lines = 1, interactive = True, visible = True)
|
224 |
-
store_sd_prompt_output = gr.Textbox(label = "Store Image Prompt", lines = 1, interactive = True, visible = True)
|
225 |
-
store_type_output = gr.Textbox(label = "Store Type", lines = 1, interactive = True, visible = True)
|
226 |
-
store_size_output = gr.Textbox(label = "Store Size", lines = 1, interactive = True, visible = True)
|
227 |
-
store_location_output = gr.Textbox(label = "Store Location", lines = 1, interactive = True, visible = True)
|
228 |
-
store_owner_output = gr.Textbox(label = "Owners", lines = 1, interactive = True, visible = True)
|
229 |
-
store_employees_output = gr.Textbox(label = "Employees", lines = 1, interactive = True, visible = True)
|
230 |
-
notable_customers_output = gr.Textbox(label = "Notable Customers", lines = 1, interactive = True, visible = True)
|
231 |
-
store_hours_output = gr.Textbox(label = "Hours", lines = 1, interactive = True, visible = True)
|
232 |
-
store_services_output = gr.Textbox(label = "Services", lines = 1, interactive = True, visible = True)
|
233 |
-
store_specialties_output = gr.Textbox(label = "Specialties", lines = 1, interactive = True, visible = True)
|
234 |
-
store_quests_output = gr.Textbox(label = "Quests", lines = 1, interactive = True, visible = True)
|
235 |
-
store_rumors_output = gr.Textbox(label = "Rumors", lines = 1, interactive = True, visible = True)
|
236 |
-
store_security_output = gr.Textbox(label = "Security", lines = 1, interactive = True, visible = True)
|
237 |
|
|
|
238 |
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
store_location, store_location_output,
|
249 |
-
store_owner, store_owner_output,
|
250 |
-
store_employees, store_employees_output,
|
251 |
-
notable_customers, notable_customers_output,
|
252 |
-
store_hours, store_hours_output,
|
253 |
-
store_services,store_services_output,
|
254 |
-
store_specialties,store_specialties_output,
|
255 |
-
store_quests, store_quests_output,
|
256 |
-
store_rumors, store_rumors_output,
|
257 |
-
store_security, store_security_output
|
258 |
-
])
|
259 |
-
|
260 |
-
image_path_list= u.absolute_path("./folder_with_images")
|
261 |
-
|
262 |
-
with gr.Tab("Inventory"):
|
263 |
-
inv_gen = gr.Button(value = "Click to Generate Inventory")
|
264 |
-
store_inventory_output = gr.Textbox(label = 'Inventory', lines = 16, interactive=True, visible=True)
|
265 |
-
store_inventory_output.change(fn=update_visibility,
|
266 |
-
inputs=[store_inventory_output],
|
267 |
-
outputs=[store_inventory_output])
|
268 |
-
inv_gen.click(fn = gen_store_inventory, inputs = [store_name, store_type, store_size, store_owner, store_reputation],
|
269 |
-
outputs= [store_inventory, store_inventory_output
|
270 |
-
])
|
271 |
-
inv_dict_gen = gr.Button(value = "Click to convert test to data object")
|
272 |
-
store_inventory_dict_output = gr.Textbox(label = 'Inventory', lines = 16, interactive=True, visible=True)
|
273 |
-
|
274 |
-
inv_dict_gen.click(fn = inventory_to_dict, inputs = [store_inventory_output],
|
275 |
-
outputs= [store_inventory_dict, store_inventory_dict_output
|
276 |
-
])
|
277 |
-
|
278 |
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
html = gr.HTML(label="HTML preview", show_label=True)
|
285 |
-
gen_html.click(build_html_file,inputs =[store_dict],
|
286 |
-
outputs= html)
|
287 |
-
|
288 |
-
if __name__ == "__main__":
|
289 |
-
demo.launch(allowed_paths=list_of_static_dir)
|
290 |
|
|
|
|
|
|
1 |
# this imports the code from files and modules
|
2 |
+
from flask import Flask, request, jsonify
|
3 |
+
from flask_cors import CORS
|
4 |
import utilities as u
|
5 |
import os
|
6 |
import ctypes
|
7 |
import store_helper as sh
|
8 |
import process_text
|
9 |
+
import block_builder
|
10 |
+
import sd_generator as sd
|
11 |
|
12 |
# This is a fix for the way that python doesn't release system memory back to the OS and it was leading to locking up the system
|
13 |
libc = ctypes.cdll.LoadLibrary("libc.so.6")
|
|
|
15 |
|
16 |
# Set malloc mmap threshold.
|
17 |
libc.mallopt(M_MMAP_THRESHOLD, 2**20)
|
18 |
+
# Ensure the directory exists
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
+
# Initialize the Flask application
|
23 |
+
app = Flask(__name__)
|
24 |
+
os.makedirs('static/images', exist_ok=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
+
CORS(app)# Route to handle the incoming POST request with user description
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
+
@app.route('/process-description', methods=['POST'])
|
29 |
+
def process_description():
|
30 |
+
data = request.json # Get the JSON data from the request
|
31 |
+
user_input = data.get('user_input', '') # Extract the 'user_input' field
|
32 |
+
# Print the received input to the console
|
33 |
+
print(f"Received user input: {user_input}")
|
34 |
+
# Call the LLM with the user input and return the result
|
35 |
+
llm_output = sh.call_llm_and_cleanup(user_input)
|
36 |
+
processed_blocks = block_builder.build_blocks(llm_output, block_builder.block_id)
|
37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
+
return jsonify({'html_blocks': processed_blocks}) # Return the LLM output as JSON
|
40 |
|
41 |
+
@app.route('/generate-image', methods=['POST'])
|
42 |
+
def generate_image():
|
43 |
+
data = request.get_json()
|
44 |
+
sd_prompt = data.get('sd_prompt')
|
45 |
+
if not sd_prompt:
|
46 |
+
return jsonify({'error': 'Missing sd_prompt'}), 400
|
47 |
+
image_subject = data.get('image_subject')
|
48 |
+
if not sd_prompt:
|
49 |
+
return jsonify({'error': 'Missing sd_prompt'}), 400
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
+
try:
|
52 |
+
image_url = sd.preview_and_generate_image(image_subject, sd_prompt)
|
53 |
+
return jsonify({'image_url': image_url})
|
54 |
+
except Exception as e:
|
55 |
+
return jsonify({'error': str(e)}), 500
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
|
57 |
+
if __name__ == '__main__':
|
58 |
+
app.run(debug=True)
|
block_builder.py
ADDED
@@ -0,0 +1,577 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import re, fileinput, sys
|
2 |
+
import utilities as u
|
3 |
+
import os
|
4 |
+
import ast
|
5 |
+
|
6 |
+
block_id = 0
|
7 |
+
|
8 |
+
def build_blocks(user_input, block_id):
|
9 |
+
list_of_blocks = []
|
10 |
+
title_block = build_title_block(user_input['store_name'], user_input['store_description'], user_input['store_backstory'], user_input['store_reputation'])
|
11 |
+
block_id = block_id + 1
|
12 |
+
list_of_blocks.append(title_block)
|
13 |
+
store_image_block = build_image_block(user_input['storefront_sd_prompt'], block_id)
|
14 |
+
list_of_blocks.append(store_image_block)
|
15 |
+
store_properties_block = build_store_properties_block(store_type= user_input['store_type'],
|
16 |
+
store_size= user_input['store_size'],
|
17 |
+
store_hours= user_input['store_hours'],
|
18 |
+
store_location= user_input['store_location'],
|
19 |
+
store_owners= user_input['store_owners'],
|
20 |
+
store_employees= user_input['store_employees'],
|
21 |
+
store_services= user_input['store_services'],
|
22 |
+
store_specialties= user_input['store_specialties'],
|
23 |
+
store_reputation= user_input['store_reputation'],
|
24 |
+
store_rumors= user_input['store_rumors'],
|
25 |
+
block_id= block_id)
|
26 |
+
list_of_blocks.append(store_properties_block)
|
27 |
+
|
28 |
+
|
29 |
+
|
30 |
+
|
31 |
+
return list_of_blocks
|
32 |
+
|
33 |
+
def build_title_block(title,description,backstory,reputation):
|
34 |
+
title_block_html = f"""<div class="block-item" data-block-id = {block_id}><h1><textarea class="title-textarea" id="user-store-title" hx-post="/update-stats" hx-trigger="change" hx-target="#user-store-name" hx-swap="outerHTML" title="Name of store">{title}</textarea></h1><div contenteditable="true" class="description-textarea" id="user-store-description"
|
35 |
+
hx-post="/update-stats" hx-trigger="change"
|
36 |
+
hx-target="#user-monster-description" hx-swap="outerHTML"
|
37 |
+
title="Any amount or style of description">
|
38 |
+
<p>{f"{description} {backstory} {reputation}"}</p>
|
39 |
+
</div> """
|
40 |
+
|
41 |
+
return title_block_html
|
42 |
+
|
43 |
+
def build_image_block(sd_prompt, block_id):
|
44 |
+
image_block_html = f"""
|
45 |
+
<div class="block-item" data-block-id="{block_id}">
|
46 |
+
<textarea class="string-action-description-textarea" id="user-storefront-prompt-{block_id}"
|
47 |
+
hx-post="/update-stats" hx-trigger="change" hx-target="#user-sd-prompt" hx-swap="outerHTML"
|
48 |
+
title="Storefront image description">{sd_prompt}</textarea>
|
49 |
+
<button class="generate-image-button" data-block-id="{block_id}">Generate Image</button>
|
50 |
+
<img id="generated-image-{block_id}" alt="" style="display: none; cursor: pointer;">
|
51 |
+
</div>
|
52 |
+
"""
|
53 |
+
|
54 |
+
return image_block_html
|
55 |
+
# Break each part of properties into segments, add to list, loop over possible multiple owners, servies, specialties, employees, and rumors
|
56 |
+
def build_store_properties_block(store_type,
|
57 |
+
store_size,
|
58 |
+
store_hours,
|
59 |
+
store_location,
|
60 |
+
store_owners,
|
61 |
+
store_employees,
|
62 |
+
store_services,
|
63 |
+
store_specialties,
|
64 |
+
store_reputation,
|
65 |
+
store_rumors,
|
66 |
+
block_id):
|
67 |
+
store_properties_block_html = f"""
|
68 |
+
<div class="block-item" data-block-id="{block_id}">
|
69 |
+
<div class="block classTable frame decoration">
|
70 |
+
<table>
|
71 |
+
<thead>
|
72 |
+
<tr>
|
73 |
+
<th align="left"></th>
|
74 |
+
<th align="center"></th>
|
75 |
+
<th align="center"></th>
|
76 |
+
</tr>
|
77 |
+
</thead>
|
78 |
+
<tbody>
|
79 |
+
<tr>
|
80 |
+
<td align="left"><strong>Size</strong></td>
|
81 |
+
<td align="right"><textarea class="string-stat-textarea" id="user-store-size-{block_id}"
|
82 |
+
hx-post="/update-stats" hx-trigger="change" hx-target="#user-store-size-{block_id}t" hx-swap="outerHTML"
|
83 |
+
title="Store Size">{store_size}</textarea></td>
|
84 |
+
</tr>
|
85 |
+
<tr>
|
86 |
+
<td align="left"><strong>Town</strong></td>
|
87 |
+
<td align="right"><textarea class="string-stat-textarea" id="user-store-town-{block_id}"
|
88 |
+
hx-post="/update-stats" hx-trigger="change" hx-target="#user-store-town-{block_id}t" hx-swap="outerHTML"
|
89 |
+
title="Store Size">{store_location['town']}</textarea></td>
|
90 |
+
</tr>
|
91 |
+
<tr>
|
92 |
+
<td align="left"><strong>District</strong></td>
|
93 |
+
<td align="right"><textarea class="string-stat-textarea" id="user-store-district-{block_id}"
|
94 |
+
hx-post="/update-stats" hx-trigger="change" hx-target="#user-store-district-{block_id}t" hx-swap="outerHTML"
|
95 |
+
title="Store Size">{store_location['district']}</textarea></</td>
|
96 |
+
</tr>
|
97 |
+
<tr>
|
98 |
+
<td align="left"><strong>Street</strong></td>
|
99 |
+
<td align="right"><textarea class="string-stat-textarea" id="user-store-street-{block_id}"
|
100 |
+
hx-post="/update-stats" hx-trigger="change" hx-target="#user-store-street-{block_id}t" hx-swap="outerHTML"
|
101 |
+
title="Store Size">{store_location['street']}</textarea></</td>
|
102 |
+
</tr>
|
103 |
+
<tr>
|
104 |
+
<td align="left"><strong>Type</strong></td>
|
105 |
+
<td align="right"><textarea class="string-stat-textarea" id="user-store-type-{block_id}"
|
106 |
+
hx-post="/update-stats" hx-trigger="change" hx-target="#user-store-type-{block_id}t" hx-swap="outerHTML"
|
107 |
+
title="Store Size">{store_type}</textarea></</td>
|
108 |
+
</tr>
|
109 |
+
<tr>
|
110 |
+
<td align="left"><strong>Store Owners</strong></td>
|
111 |
+
<td align="right"><textarea class="string-stat-textarea" id="user-store-owners-{block_id}"
|
112 |
+
hx-post="/update-stats" hx-trigger="change" hx-target="#user-store-owners-{block_id}t" hx-swap="outerHTML"
|
113 |
+
title="Store Size">{store_owners[0]['name']}</textarea></td>
|
114 |
+
</tr>
|
115 |
+
<tr>
|
116 |
+
<td align="left"><strong>Store Employees</strong></td>
|
117 |
+
<td align="right"><textarea class="string-stat-textarea" id="user-store-employees-{block_id}"
|
118 |
+
hx-post="/update-stats" hx-trigger="change" hx-target="#user-store-employees-{block_id}t" hx-swap="outerHTML"
|
119 |
+
title="Store Size">{store_employees[0]['name']}</textarea></td>
|
120 |
+
</tr>
|
121 |
+
<tr>
|
122 |
+
<td align="left"><strong>Store Hours</strong></td>
|
123 |
+
<td align="right"><textarea class="string-stat-textarea" id="user-store-hours-{block_id}"
|
124 |
+
hx-post="/update-stats" hx-trigger="change" hx-target="#user-store-hours-{block_id}t" hx-swap="outerHTML"
|
125 |
+
title="Store Size">{store_hours}</textarea></td>
|
126 |
+
</tr>
|
127 |
+
<tr>
|
128 |
+
<td align="left"><strong>Store Services</strong></td>
|
129 |
+
<td align="right"><textarea class="string-stat-textarea" id="user-store-services-{block_id}"
|
130 |
+
hx-post="/update-stats" hx-trigger="change" hx-target="#user-store-services-{block_id}t" hx-swap="outerHTML"
|
131 |
+
title="Store Size">{store_services}</textarea></td>
|
132 |
+
</tr>
|
133 |
+
<tr>
|
134 |
+
<td align="left"><strong>Store Specialties</strong></td>
|
135 |
+
<td align="right"><textarea class="string-stat-textarea" id="user-store-specialties-{block_id}"
|
136 |
+
hx-post="/update-stats" hx-trigger="change" hx-target="#user-store-specialties-{block_id}t" hx-swap="outerHTML"
|
137 |
+
title="Store Size">{store_specialties}</textarea></td>
|
138 |
+
</tr>
|
139 |
+
<tr>
|
140 |
+
<td align="left"><strong>Store Reputation</strong></td>
|
141 |
+
<td align="right"><textarea class="string-stat-textarea" id="user-store-reputation-{block_id}"
|
142 |
+
hx-post="/update-stats" hx-trigger="change" hx-target="#user-store-reputation-{block_id}t" hx-swap="outerHTML"
|
143 |
+
title="Store Size">{store_reputation}</textarea></td>
|
144 |
+
</tr>
|
145 |
+
<tr>
|
146 |
+
<td align="left"><strong>Store Rumors</strong></td>
|
147 |
+
<td align="right"><textarea class="string-stat-textarea" id="user-store-rumors-{block_id}"
|
148 |
+
hx-post="/update-stats" hx-trigger="change" hx-target="#user-store-rumors-{block_id}t" hx-swap="outerHTML"
|
149 |
+
title="Store Size">{store_rumors}</textarea></td>
|
150 |
+
</tr>
|
151 |
+
</tbody>
|
152 |
+
</table>
|
153 |
+
</div>
|
154 |
+
</div>
|
155 |
+
"""
|
156 |
+
|
157 |
+
return store_properties_block_html
|
158 |
+
def list_names_to_str(data):
|
159 |
+
list_of_names = []
|
160 |
+
for i in data:
|
161 |
+
list_of_names.append(i['name'])
|
162 |
+
str_of_names = ', '.join(list_of_names)
|
163 |
+
return str_of_names
|
164 |
+
|
165 |
+
def list_to_str(list):
|
166 |
+
str_of_list = ', '.join(list)
|
167 |
+
return str_of_list
|
168 |
+
def build_owners_section(owners_list):
|
169 |
+
owner_s = 'Owner'
|
170 |
+
if len(owners_list) > 1 :
|
171 |
+
owner_s = 'Owners'
|
172 |
+
owner_section_html = f"""<h2 id="owner">{owner_s}</h2> """
|
173 |
+
# iterating through list of owners, each is a dictionary with descriptive qualities
|
174 |
+
for owner in range(len(owners_list)) :
|
175 |
+
secrets = '<br> '.join(owners_list[owner - 1]['secrets'])
|
176 |
+
owner_section_html += f"""
|
177 |
+
<h3 id="owner_{owner}">{owners_list[owner - 1]['name']}</h3>
|
178 |
+
<table>
|
179 |
+
<thead>
|
180 |
+
<tr>
|
181 |
+
<th align="center"></th>
|
182 |
+
<th align="center"></th>
|
183 |
+
</tr>
|
184 |
+
</thead>
|
185 |
+
<tbody>
|
186 |
+
<tr>
|
187 |
+
<td align="center"><strong>Species</strong></td>
|
188 |
+
<td align="right">{owners_list[owner - 1]['species']}</td>
|
189 |
+
</tr>
|
190 |
+
<tr>
|
191 |
+
<td align="center"><strong>Class</strong></td>
|
192 |
+
<td align="right">{owners_list[owner - 1]['class']}</td>
|
193 |
+
</tr>
|
194 |
+
<tr>
|
195 |
+
<td align="center"><strong>Description</strong></td>
|
196 |
+
<td align="left">{owners_list[owner - 1]['description']}.</td>
|
197 |
+
</tr>
|
198 |
+
<tr>
|
199 |
+
<td align="center"><strong>Personality</strong></td>
|
200 |
+
<td align="left">{owners_list[owner - 1]['personality']}</td>
|
201 |
+
</tr>
|
202 |
+
<tr>
|
203 |
+
<td align="center"><strong>Secrets</strong></td>
|
204 |
+
<td align="left">{secrets}</td>
|
205 |
+
</tr>
|
206 |
+
</tbody>
|
207 |
+
</table>
|
208 |
+
"""
|
209 |
+
return owner_section_html
|
210 |
+
|
211 |
+
|
212 |
+
|
213 |
+
store_image_url = ""
|
214 |
+
|
215 |
+
|
216 |
+
# Assigning strings to variables for replacing location of dependencies for the webpage to local static folders
|
217 |
+
# Path is ../../ for the html files location in output/dated_folder/
|
218 |
+
|
219 |
+
def build_html_base(store_dict) :
|
220 |
+
|
221 |
+
base_dir = os.path.dirname(os.path.abspath(__file__))
|
222 |
+
dependencies_path = os.path.relpath(os.path.join(base_dir, "dependencies"), os.path.join(base_dir, "output", "test"))
|
223 |
+
|
224 |
+
|
225 |
+
# Template for the page
|
226 |
+
html_file_as_text = f"""<!DOCTYPE html>
|
227 |
+
<html>
|
228 |
+
<head>
|
229 |
+
<link href="{dependencies_path}/all.css" rel="stylesheet" />
|
230 |
+
<link href="{dependencies_path}/css.css?family=Open+Sans:400,300,600,700" rel="stylesheet" type="text/css" />
|
231 |
+
<link href="{dependencies_path}/bundle.css" rel="stylesheet" />
|
232 |
+
<link rel="icon" href="{dependencies_path}/favicon.ico" type="image/x-icon" />
|
233 |
+
<link href="{dependencies_path}/style.css" rel="stylesheet" />
|
234 |
+
<link href="{dependencies_path}/5ePHBstyle.css" rel="stylesheet" />
|
235 |
+
<title>{store_dict['store_name']}</title>
|
236 |
+
</head>
|
237 |
+
<body>
|
238 |
+
<div>
|
239 |
+
<div class="brewRenderer" style="height: 692px;">
|
240 |
+
<div class="pages" lang="en">
|
241 |
+
<div class="page" id="p1">
|
242 |
+
<div class="columnWrapper">
|
243 |
+
<h1 id="store_name">{store_dict['store_name']}</h1>
|
244 |
+
<p>{store_dict['store_description']}</p>
|
245 |
+
<p>{store_dict['store_backstory']}</p>
|
246 |
+
<p>{store_dict['store_reputation']}</p>
|
247 |
+
<!-- Generated Image of Shop -->
|
248 |
+
<p><img class="" style="width:300px; mix-blend-mode:multiply;" src="{store_image_url}" alt="{store_dict['store_name']}"></p>
|
249 |
+
<div class="block classTable frame decoration">
|
250 |
+
<table>
|
251 |
+
<thead>
|
252 |
+
<tr>
|
253 |
+
<th align="left"></th>
|
254 |
+
<th align="center"></th>
|
255 |
+
<th align="center"></th>
|
256 |
+
</tr>
|
257 |
+
</thead>
|
258 |
+
<tbody>
|
259 |
+
<tr>
|
260 |
+
<td align="left"><strong>Size</strong></td>
|
261 |
+
<td align="right">{store_dict['store_size']}</td>
|
262 |
+
</tr>
|
263 |
+
<tr>
|
264 |
+
<td align="left"><strong>Town</strong></td>
|
265 |
+
<td align="right">{store_dict['store_location']['town']}</td>
|
266 |
+
</tr>
|
267 |
+
<tr>
|
268 |
+
<td align="left"><strong>District</strong></td>
|
269 |
+
<td align="right">{store_dict['store_location']['district']}</td>
|
270 |
+
</tr>
|
271 |
+
<tr>
|
272 |
+
<td align="left"><strong>Street</strong></td>
|
273 |
+
<td align="right">{store_dict['store_location']['street']}</td>
|
274 |
+
</tr>
|
275 |
+
<tr>
|
276 |
+
<td align="left"><strong>Type</strong></td>
|
277 |
+
<td align="right">{store_dict['store_type']}</td>
|
278 |
+
</tr>
|
279 |
+
<tr>
|
280 |
+
<td align="left"><strong>Owners</strong></td>
|
281 |
+
<td align="right">{list_names_to_str(store_dict['store_owners'])}</td>
|
282 |
+
</tr>
|
283 |
+
<tr>
|
284 |
+
<td align="left"><strong>Employees</strong></td>
|
285 |
+
<td align="right">{list_names_to_str(store_dict['store_employees'])}</td>
|
286 |
+
</tr>
|
287 |
+
<tr>
|
288 |
+
<td align="left"><strong>Store Hours</strong></td>
|
289 |
+
<td align="right">{store_dict['store_hours']}</td>
|
290 |
+
</tr>
|
291 |
+
<tr>
|
292 |
+
<td align="left"><strong>Services</strong></td>
|
293 |
+
<td align="right">{list_names_to_str(store_dict['store_services'])}</td>
|
294 |
+
</tr>
|
295 |
+
<tr>
|
296 |
+
<td align="left"><strong>Specialties</strong></td>
|
297 |
+
<td align="right">{list_names_to_str(store_dict['store_specialties'])}</td>
|
298 |
+
</tr>
|
299 |
+
<tr>
|
300 |
+
<td align="left"><strong>Reputation</strong></td>
|
301 |
+
<td align="right">{store_dict['store_reputation']}</td>
|
302 |
+
</tr>
|
303 |
+
<tr>
|
304 |
+
<td align="left"><strong>Rumors</strong></td>
|
305 |
+
<td align="right">{list_to_str(store_dict['store_rumors'])}</td>
|
306 |
+
</tr>
|
307 |
+
</tbody>
|
308 |
+
</table>
|
309 |
+
</div>
|
310 |
+
<p><img class="" style="width:300px; mix-blend-mode:multiply;" src="https://media.githubusercontent.com/media/Drakosfire/StoreGenerator/master/galleries/test_images/Morgor_bloodclaw.png" alt="{store_dict['store_owners'][0]['name']}"></p>
|
311 |
+
{build_owners_section(store_dict['store_owners'])}
|
312 |
+
|
313 |
+
|
314 |
+
<p> </p>
|
315 |
+
<div class="columnSplit"></div>
|
316 |
+
<p> </p>
|
317 |
+
</div>
|
318 |
+
</div>
|
319 |
+
<div class="page" id="p2">
|
320 |
+
<div class="columnWrapper">
|
321 |
+
<div class="blank"></div>
|
322 |
+
<h2 id="employees">Employees</h2>
|
323 |
+
|
324 |
+
<h3 id="brega">Brega</h3>
|
325 |
+
<p><img class="" style="width:150px; mix-blend-mode:multiply;" src="https://media.githubusercontent.com/media/Drakosfire/StoreGenerator/master/galleries/test_images/Brega.png" alt="Brega"></p>
|
326 |
+
|
327 |
+
<table>
|
328 |
+
<thead>
|
329 |
+
<tr>
|
330 |
+
<th align="center"></th>
|
331 |
+
<th align="center"></th>
|
332 |
+
</tr>
|
333 |
+
</thead>
|
334 |
+
<tbody>
|
335 |
+
<tr>
|
336 |
+
<td align="center"><strong>Species</strong></td>
|
337 |
+
<td align="center">Half-Orc</td>
|
338 |
+
</tr>
|
339 |
+
<tr>
|
340 |
+
<td align="center"><strong>Class</strong></td>
|
341 |
+
<td align="center">Assistant Butcher</td>
|
342 |
+
</tr>
|
343 |
+
<tr>
|
344 |
+
<td align="center"><strong>Description</strong></td>
|
345 |
+
<td align="center">A burly half-orc with a kind face and a perpetual smudge of blood on his cheek. Brega handles the heavy lifting and cutting of larger beasts.</td>
|
346 |
+
</tr>
|
347 |
+
<tr>
|
348 |
+
<td align="center"><strong>Personality</strong></td>
|
349 |
+
<td align="center">Soft-spoken and gentle despite his imposing appearance, Brega is loyal to Morgor and respects his cunning. He has a soft spot for stray animals.</td>
|
350 |
+
</tr>
|
351 |
+
</tbody>
|
352 |
+
</table>
|
353 |
+
|
354 |
+
<div class="block">
|
355 |
+
<h1 id="notable-customers">Notable Customers</h1>
|
356 |
+
<div class="block note">
|
357 |
+
<h3 id="lord-vittorio-blackthorn">Lord Vittorio Blackthorn</h3>
|
358 |
+
<p>An eccentric noble known for his extravagant feasts featuring rare and exotic meats.</p>
|
359 |
+
<p>Lord Blackthorn’s patronage lends an air of mystery and prestige to Morgor’s shop, attracting curious gourmands and shady characters alike.</p>
|
360 |
+
</div>
|
361 |
+
<h1 id="related-quests">Related Quests</h1>
|
362 |
+
<h3 id="the-basilisk-bounty">The Basilisk Bounty</h3>
|
363 |
+
<p>Morgor needs fresh basilisk meat and offers a handsome reward for those brave enough to hunt one.</p>
|
364 |
+
<p>500 gold coins and choice cuts of meat.</p>
|
365 |
+
</div>
|
366 |
+
|
367 |
+
|
368 |
+
<div class="columnSplit"></div>
|
369 |
+
<div class="block">
|
370 |
+
<h1 id="services-and-specialties">Services and Specialties</h1>
|
371 |
+
<div class="blank"></div>
|
372 |
+
<h2 id="services">Services</h2>
|
373 |
+
<h3 id="custom-slaughtering">Custom Slaughtering</h3>
|
374 |
+
<p>Bring your own beasts, and Morgor will prepare the meat to your specifications.
|
375 |
+
50 gold coins per beast.</p>
|
376 |
+
<div class="blank"></div>
|
377 |
+
<h2 id="specialties">Specialties</h2>
|
378 |
+
<div class="blank"></div>
|
379 |
+
<h3 id="basilisk-cutlets">Basilisk Cutlets</h3>
|
380 |
+
<p>Tender and marbled with a unique flavor, perfect for those seeking a truly rare dining experience.</p>
|
381 |
+
<h3 id="subterranean-lizard-tail">Subterranean Lizard Tail</h3>
|
382 |
+
<p>A delicacy prized for its unique texture and earthy taste, enchanted to enhance its natural flavor.</p>
|
383 |
+
<h1 id="security">Security</h1>
|
384 |
+
<div class="blank"></div>
|
385 |
+
<h3 id="bewitched-meat-hooks">Bewitched Meat Hooks</h3>
|
386 |
+
<p>These enchanted meat hooks animate and attack intruders who try to take meat without paying. 200 gold coins per pound.</p>
|
387 |
+
<div class="blank"></div>
|
388 |
+
<p>Attack: +5 to hit, 1d8+3 piercing damage.</p>
|
389 |
+
<h3 id="shadow-ward">Shadow Ward</h3>
|
390 |
+
<p>A magical barrier that alerts Morgor if someone enters the shop after hours. 150 gold coins per pound.</p>
|
391 |
+
<div class="blank"></div>
|
392 |
+
<p>Detection radius of 60 feet, triggers an audible alarm.</p>
|
393 |
+
</div> <!-- Close Block -->
|
394 |
+
</div> <!-- close columnWrapper-->
|
395 |
+
</div> <!-- close page 2 -->
|
396 |
+
|
397 |
+
<div class="page" id="p3">
|
398 |
+
<div class="columnWrapper">
|
399 |
+
|
400 |
+
<div class="block classTable frame decoration">
|
401 |
+
<h5 id="inventory">Inventory</h5>
|
402 |
+
<table>
|
403 |
+
<thead>
|
404 |
+
<tr>
|
405 |
+
<th align="center">Name</th>
|
406 |
+
<th align="center">Type</th>
|
407 |
+
<th align="left">Cost</th>
|
408 |
+
<th align="center">Properties</th>
|
409 |
+
</tr>
|
410 |
+
</thead>
|
411 |
+
<tbody>
|
412 |
+
<tr>
|
413 |
+
<td align="center">Poultry Drumsticks</td>
|
414 |
+
<td align="center">Meat</td>
|
415 |
+
<td align="left">1 gp per lbs</td>
|
416 |
+
<td align="center"></td>
|
417 |
+
</tr>
|
418 |
+
<tr>
|
419 |
+
<td align="center">Ground Beef</td>
|
420 |
+
<td align="center">Meat</td>
|
421 |
+
<td align="left">1 gp per lbs</td>
|
422 |
+
<td align="center"></td>
|
423 |
+
</tr>
|
424 |
+
<tr>
|
425 |
+
<td align="center">Pork Chops</td>
|
426 |
+
<td align="center">Meat</td>
|
427 |
+
<td align="left">1 gp per lbs</td>
|
428 |
+
<td align="center"></td>
|
429 |
+
</tr>
|
430 |
+
<tr>
|
431 |
+
<td align="center">Bacon Strips</td>
|
432 |
+
<td align="center">Meat</td>
|
433 |
+
<td align="left">1 gp per lbs</td>
|
434 |
+
<td align="center"></td>
|
435 |
+
</tr>
|
436 |
+
<tr>
|
437 |
+
<td align="center">Sausage Links</td>
|
438 |
+
<td align="center">Meat</td>
|
439 |
+
<td align="left">1 gp per lbs</td>
|
440 |
+
<td align="center"></td>
|
441 |
+
</tr>
|
442 |
+
<tr>
|
443 |
+
<td align="center">Mystic Minotaur Steak</td>
|
444 |
+
<td align="center">Exotic Meat</td>
|
445 |
+
<td align="left">25 gold per pound</td>
|
446 |
+
<td align="center">Grants temporary strength boost when consumed, Requires fine culinary skills to cook properly</td>
|
447 |
+
</tr>
|
448 |
+
<tr>
|
449 |
+
<td align="center">Quantum Quail</td>
|
450 |
+
<td align="center">Exotic Poultry</td>
|
451 |
+
<td align="left">15 gold each</td>
|
452 |
+
<td align="center">“Phases in and out of existence”, “Can enhance one’s agility”</td>
|
453 |
+
</tr>
|
454 |
+
<tr>
|
455 |
+
<td align="center">Invisible Bacon</td>
|
456 |
+
<td align="center">Mystical Meat</td>
|
457 |
+
<td align="left">10 gold per slice</td>
|
458 |
+
<td align="center">“Invisible to the naked eye”, “Tastes incredibly savory”, “Can only be seen with a special spell”</td>
|
459 |
+
</tr>
|
460 |
+
<tr>
|
461 |
+
<td align="center">Hydra Sausage</td>
|
462 |
+
<td align="center">Mythical Meat</td>
|
463 |
+
<td align="left">50 gold per link</td>
|
464 |
+
<td align="center">“Each bite regenerates after a while”, “Consuming too much may cause mild hallucinations”</td>
|
465 |
+
</tr>
|
466 |
+
<tr>
|
467 |
+
<td align="center">Cursed Cleaver</td>
|
468 |
+
<td align="center">Kitchen Equipment</td>
|
469 |
+
<td align="left">100 gold</td>
|
470 |
+
<td align="center">“Cuts through any meat effortlessly”, “Occasionally whispers in a long-forgotten language”, “Rumored to be haunted”</td>
|
471 |
+
</tr>
|
472 |
+
<tr>
|
473 |
+
<td align="center">Vampire Spice Mix</td>
|
474 |
+
<td align="center">Cooking Ingredient</td>
|
475 |
+
<td align="left">20 gold per pouch</td>
|
476 |
+
<td align="center">“Adds a distinct flavor”, “Enhances blood flow in the consumer”, “Leaves a lingering aftertaste of garlic”</td>
|
477 |
+
</tr>
|
478 |
+
<tr>
|
479 |
+
<td align="center">Phoenix Feather Skewers</td>
|
480 |
+
<td align="center">Cooking Utensil</td>
|
481 |
+
<td align="left">75 gold per set</td>
|
482 |
+
<td align="center">“Prevents meat from overcooking”, “Gives a slight warmth to cooked items”, “Reusable endlessly”</td>
|
483 |
+
</tr>
|
484 |
+
</tbody>
|
485 |
+
</table>
|
486 |
+
</div>
|
487 |
+
<p> </p>
|
488 |
+
</div><!-- Close Column Wrapper-->
|
489 |
+
</div> <!-- Close Page 3-->
|
490 |
+
</div> <!-- Close pages-->
|
491 |
+
</div> <!--Close brew renderer-->
|
492 |
+
</div><!-- Close Div housing body-->
|
493 |
+
</body>
|
494 |
+
</html>"""
|
495 |
+
# Open a file path that will receive the processed text
|
496 |
+
store_file_path = f"output/test/{store_dict['store_name'].replace(' ', '_')}.html"
|
497 |
+
with open(store_file_path, 'w') as clean_html:
|
498 |
+
clean_html.write(html_file_as_text)
|
499 |
+
clean_html.close()
|
500 |
+
|
501 |
+
return store_file_path
|
502 |
+
|
503 |
+
dict_template = {
|
504 |
+
"store_name": "The Mirage Emporium",
|
505 |
+
"store_description": "A peculiar shop filled with the odd and the useless, where each corner hides a laugh and a mystery.",
|
506 |
+
"store_reputation": "Locally famous for its bizarre and delightful inventory, though not particularly useful.",
|
507 |
+
"store_backstory": "The Mirage Emporium was founded by a retired jester known for his love of the whimsical and the curious. He traveled the world collecting oddball items that struck his fancy, and upon amassing a considerable collection, opened a shop to share his treasures with the world.",
|
508 |
+
"store_sd_prompt": "A highly detailed fantasy illustration of a middle-aged full body male gnome in an eclectic shop. The gnome is wearing a colorful patchwork vest and a jaunty hat. The shop is filled with quirky items like broken clocks, mismatched shoes, and joke books. The gnome has distinct fantasy features, such as pointed ears and a small, sturdy build. The background is a vibrant mix of colors and textures, giving the impression of organized chaos.",
|
509 |
+
"store_type": "Curiosity Shop",
|
510 |
+
"store_size": "Small",
|
511 |
+
"store_hours": "From dawn until the moonlight dances.",
|
512 |
+
"store_location": {
|
513 |
+
"town": "Bramblebrook",
|
514 |
+
"district": "Harlequin Quarter",
|
515 |
+
"street": "Twilight Alley"
|
516 |
+
},
|
517 |
+
"store_owners": [
|
518 |
+
{
|
519 |
+
"name": "Fizzwidget Funsquirrel",
|
520 |
+
"species": "Gnome",
|
521 |
+
"class": "Bard",
|
522 |
+
"description": "A lively gnome with a perpetual twinkle in his eye and a knack for making people smile.",
|
523 |
+
"personality": "Joyful, playful, and a tad mischievous.",
|
524 |
+
"secrets": ["Fizzwidget once performed a jester act for the Queen of Faerun.", "He has a hidden collection of practical jokes for special customers."],
|
525 |
+
"sd_prompt": "A highly detailed fantasy illustration of a cheerful full body male gnome in an eclectic shop. The gnome is wearing a colorful patchwork vest and a jaunty hat, with a playful expression and sparkling eyes. The shop is filled with quirky items and the background is a chaotic mix of vibrant colors and textures."
|
526 |
+
}
|
527 |
+
],
|
528 |
+
"store_employees": [
|
529 |
+
{
|
530 |
+
"name": "Marigold Merryleaf",
|
531 |
+
"role": "Shop Assistant",
|
532 |
+
"species": "Halfling",
|
533 |
+
"description": "A spry halfling with a knack for finding peculiar trinkets buried under heaps of clutter.",
|
534 |
+
"personality": "Curious, quirky, and always up for a laugh.",
|
535 |
+
"sd_prompt": "A highly detailed fantasy illustration of a spry full body female halfling in an eclectic shop. The halfling is wearing a colorful apron and has a curious expression. The shop is filled with quirky items, and the background is a chaotic mix of vibrant colors and textures."
|
536 |
+
}
|
537 |
+
],
|
538 |
+
"store_quests": [
|
539 |
+
{
|
540 |
+
"name": "The Great Sock Hunt",
|
541 |
+
"description": "Help Fizzwidget locate a rare pair of mismatched socks rumored to bring joy and luck, hidden somewhere in the town of Bramblebrook.",
|
542 |
+
"reward": "A pair of enchanted socks that make the wearer extraordinarily lucky in games of chance."
|
543 |
+
}
|
544 |
+
],
|
545 |
+
"store_customers": [
|
546 |
+
{
|
547 |
+
"name": "Lord Twiddleton",
|
548 |
+
"description": "An eccentric noble who collects oddities and revels in the unusual.",
|
549 |
+
"influence": "High, due to his noble status and wealth."
|
550 |
+
}
|
551 |
+
],
|
552 |
+
"store_rumors": [
|
553 |
+
"It's said that Fizzwidget once outwitted a dragon using only a rubber chicken and a whoopee cushion.",
|
554 |
+
"Marigold can find lost items using her 'half-sense' for where things hide."
|
555 |
+
],
|
556 |
+
"store_security": [
|
557 |
+
{
|
558 |
+
"name": "Gizmo Gearshaft",
|
559 |
+
"description": "An ingenious contraption that includes clockwork gears, springs, and enchanted runes.",
|
560 |
+
"mechanics": "Gizmo Gearshaft patrols the shop, alert for intruders and mischief-makers, and can deploy harmless yet startling pranks to deter trouble."
|
561 |
+
}
|
562 |
+
],
|
563 |
+
"store_services": [
|
564 |
+
{
|
565 |
+
"name": "Laughter Therapy",
|
566 |
+
"description": "A session with Fizzwidget who tells jokes and performs tricks to brighten your day.",
|
567 |
+
"price": "1 gold coin per session"
|
568 |
+
}
|
569 |
+
],
|
570 |
+
"store_specialties": [
|
571 |
+
{
|
572 |
+
"name": "Mystery Mounds",
|
573 |
+
"description": "A pile of assorted oddities bundled together; you never know what you'll get, but it'll always be a conversation starter!",
|
574 |
+
"price": "5 silver per bundle"
|
575 |
+
}
|
576 |
+
]
|
577 |
+
}
|
closed-mimic-trashcan.png
ADDED
Git LFS Details
|
mimic_trashcan.png
ADDED
Git LFS Details
|
sd_generator.py
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import time
|
2 |
+
import replicate
|
3 |
+
|
4 |
+
|
5 |
+
|
6 |
+
start_time = time.time()
|
7 |
+
temp_image_path = "./image_temp/"
|
8 |
+
|
9 |
+
def preview_and_generate_image(image_subject ,sd_prompt):
|
10 |
+
|
11 |
+
output = replicate.run(
|
12 |
+
"stability-ai/stable-diffusion-3",
|
13 |
+
input={
|
14 |
+
"cfg": 3.5,
|
15 |
+
"steps": 28,
|
16 |
+
"prompt": f"This is a {image_subject} it looks likes {sd_prompt} ",
|
17 |
+
"aspect_ratio": "1:1",
|
18 |
+
"output_format": "webp",
|
19 |
+
"output_quality": 90,
|
20 |
+
"negative_prompt": "",
|
21 |
+
"prompt_strength": 0.85
|
22 |
+
}
|
23 |
+
)
|
24 |
+
print(output)
|
25 |
+
image_url = output[0] # Assume the first output is the image URL
|
26 |
+
|
27 |
+
return image_url
|
28 |
+
|
29 |
+
|
30 |
+
|
storeUI.html
ADDED
@@ -0,0 +1,1328 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<link href="./dependencies/all.css" rel="stylesheet" />
|
7 |
+
<link href="./dependencies/css.css?family=Open+Sans:400,300,600,700" rel="stylesheet" type="text/css" />
|
8 |
+
<link href='./dependencies/bundle.css' rel='stylesheet' />
|
9 |
+
<link href="./dependencies/style.css" rel='stylesheet' />
|
10 |
+
<link href="./dependencies/5ePHBstyle.css" rel='stylesheet' />
|
11 |
+
<title>DnD Stat Block</title>
|
12 |
+
<link rel="stylesheet" href="styles.css">
|
13 |
+
<script src="https://unpkg.com/[email protected]/dist/htmx.min.js"></script>
|
14 |
+
</head>
|
15 |
+
<style>
|
16 |
+
:root {
|
17 |
+
--HB_Color_Background: #EEE5CE;
|
18 |
+
--HB_Color_Accent: #E0E5C1;
|
19 |
+
--HB_Color_HeaderUnderline: #C0AD6A;
|
20 |
+
--HB_Color_HorizontalRule: #9C2B1B;
|
21 |
+
--HB_Color_HeaderText: #58180D;
|
22 |
+
--HB_Color_MonsterStatBackground: #F2E5B5;
|
23 |
+
--HB_Color_CaptionText: #766649;
|
24 |
+
--HB_Color_WatercolorStain: #BBAD82;
|
25 |
+
--HB_Color_Footnotes: #C9AD6A;
|
26 |
+
}
|
27 |
+
input[type="text"], textarea {
|
28 |
+
width: auto;
|
29 |
+
padding: 8px;
|
30 |
+
margin: 5px 0;
|
31 |
+
border: 1px solid #ccc;
|
32 |
+
border-radius: 4px;
|
33 |
+
font-size: 14px;
|
34 |
+
background-color: #f9f9f9;
|
35 |
+
transition: background-color 0.3s ease, border-color 0.3s ease;
|
36 |
+
}
|
37 |
+
.grid-container {
|
38 |
+
display: grid;
|
39 |
+
grid-template-columns: 1fr 3fr; /* Two columns with the second column being three times as wide */
|
40 |
+
grid-gap: 20px;
|
41 |
+
padding: 20px;
|
42 |
+
height: 100vh;
|
43 |
+
}
|
44 |
+
.block-container {
|
45 |
+
position: fixed; /* Lock the block-container in place */
|
46 |
+
top: 20px; /* Distance from the top of the viewport */
|
47 |
+
left: 20px; /* Distance from the left of the viewport */
|
48 |
+
width: 350px; /* Set the width of the block-container */
|
49 |
+
height: calc(100vh - 40px); /* Full viewport height minus top and bottom padding */
|
50 |
+
overflow-y: auto; /* Enable vertical scrolling if needed */
|
51 |
+
border-right: 1px solid #ccc; /* Right border for visual separation */
|
52 |
+
padding-right: 20px; /* Padding inside the block-container */
|
53 |
+
box-sizing: border-box; /* Include padding and border in the element's total width and height */
|
54 |
+
background-color: #f9f9f9; /* Background color */
|
55 |
+
z-index: 1000; /* Ensure it is on top of other elements */
|
56 |
+
}
|
57 |
+
|
58 |
+
.block-container .page {
|
59 |
+
column-count: 1;
|
60 |
+
padding: 0;
|
61 |
+
width: 325px;
|
62 |
+
height: auto; /* Allow the page to expand to fit content */
|
63 |
+
overflow: visible; /* Allow content to overflow if necessary */
|
64 |
+
page-break-before: auto;
|
65 |
+
page-break-after: auto;
|
66 |
+
|
67 |
+
}
|
68 |
+
.page-container {
|
69 |
+
margin-left: 350px; /* Offset the page content by the width of block-container plus margin */
|
70 |
+
width: 900px;
|
71 |
+
padding: 20px;
|
72 |
+
overflow: auto; /* Enable scrolling if needed */
|
73 |
+
height: 100vh; /* Full viewport height */
|
74 |
+
box-sizing: border-box; /* Include padding and border in the element's total width and height */
|
75 |
+
}
|
76 |
+
|
77 |
+
|
78 |
+
.page {
|
79 |
+
column-count: 2;
|
80 |
+
column-gap: .9cm;
|
81 |
+
column-width: 8cm;
|
82 |
+
-webkit-column-count: 2;
|
83 |
+
-moz-column-count: 2;
|
84 |
+
-webkit-column-width: 8cm;
|
85 |
+
-moz-column-width: 8cm;
|
86 |
+
-webkit-column-gap: .9cm;
|
87 |
+
-moz-column-gap: .9cm;
|
88 |
+
position: relative;
|
89 |
+
z-index: 15;
|
90 |
+
box-sizing: border-box;
|
91 |
+
width: 215.9mm;
|
92 |
+
height: 279.4mm; /* Original height for print layout */
|
93 |
+
padding: 1.4cm 1.9cm 1.7cm;
|
94 |
+
overflow: hidden;
|
95 |
+
font-family: "BookInsanityRemake";
|
96 |
+
font-size: .34cm;
|
97 |
+
counter-increment: phb-page-numbers;
|
98 |
+
background-color: var(--HB_Color_Background);
|
99 |
+
background-image: url('./themes/assets/parchmentBackground.jpg');
|
100 |
+
text-rendering: optimizeLegibility;
|
101 |
+
page-break-before: always;
|
102 |
+
page-break-after: always;
|
103 |
+
contain: size;
|
104 |
+
}
|
105 |
+
|
106 |
+
.page .monster hr:last-of-type + * {
|
107 |
+
margin-top: .1cm;
|
108 |
+
}
|
109 |
+
.page * + h4 {
|
110 |
+
margin-top: .1cm;
|
111 |
+
}
|
112 |
+
.page h4 + * {
|
113 |
+
margin-top: .1cm;
|
114 |
+
}
|
115 |
+
.page dl + * {
|
116 |
+
margin-top: .1cm;
|
117 |
+
}
|
118 |
+
.page p + * {
|
119 |
+
margin-top: .1cm;
|
120 |
+
}
|
121 |
+
.page img {
|
122 |
+
width: 100%;
|
123 |
+
height: auto;
|
124 |
+
cursor: pointer;
|
125 |
+
}
|
126 |
+
|
127 |
+
/* Ensure the h1 tag is constrained within its column */
|
128 |
+
.block-content h1 {
|
129 |
+
column-span: none;
|
130 |
+
box-sizing: border-box; /* Include padding and border in the element's total width and height */
|
131 |
+
margin: 0 auto; /* Center the h1 within the column */
|
132 |
+
overflow: hidden; /* Handle overflow content */
|
133 |
+
word-wrap: break-word; /* Break long words to prevent overflow */
|
134 |
+
}
|
135 |
+
.columnWrapper {
|
136 |
+
column-gap: inherit;
|
137 |
+
max-height: 100%;
|
138 |
+
column-span: all;
|
139 |
+
columns: inherit;
|
140 |
+
height: 100%; /* Ensure it takes full height of the parent */
|
141 |
+
box-sizing: border-box; /* Ensures padding and border are included in the element's total width and height */
|
142 |
+
}
|
143 |
+
/* block-item styling */
|
144 |
+
.block-item {
|
145 |
+
border: 1px solid #ccc;
|
146 |
+
border-radius: 8px;
|
147 |
+
background-color: transparent;
|
148 |
+
padding: 15px;
|
149 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
150 |
+
transition: transform 0.3s;
|
151 |
+
}
|
152 |
+
.block-item:hover {
|
153 |
+
/* transform: translateY(-5px);
|
154 |
+
background-color: rgba(255, 255, 255, 0.5); /* Slightly visible background on hover */
|
155 |
+
}
|
156 |
+
|
157 |
+
.block-item img {
|
158 |
+
width: 100%;
|
159 |
+
height: auto;
|
160 |
+
cursor: pointer;
|
161 |
+
}
|
162 |
+
|
163 |
+
/* Modal styling */
|
164 |
+
.modal {
|
165 |
+
display: none; /* Hidden by default */
|
166 |
+
position: fixed; /* Stay in place */
|
167 |
+
z-index: 1001; /* Sit on top */
|
168 |
+
left: 0;
|
169 |
+
top: 0;
|
170 |
+
width: 100%; /* Full width */
|
171 |
+
height: 100%; /* Full height */
|
172 |
+
overflow: auto; /* Enable scroll if needed */
|
173 |
+
background-color: rgb(0,0,0); /* Fallback color */
|
174 |
+
background-color: rgba(0,0,0,0.9); /* Black w/ opacity */
|
175 |
+
}
|
176 |
+
|
177 |
+
.modal-content {
|
178 |
+
margin: auto;
|
179 |
+
display: block;
|
180 |
+
width: 80%;
|
181 |
+
max-width: 700px;
|
182 |
+
}
|
183 |
+
|
184 |
+
.modal-content, #caption {
|
185 |
+
animation-name: zoom;
|
186 |
+
animation-duration: 0.6s;
|
187 |
+
}
|
188 |
+
|
189 |
+
@keyframes zoom {
|
190 |
+
from {transform: scale(0)}
|
191 |
+
to {transform: scale(1)}
|
192 |
+
}
|
193 |
+
|
194 |
+
.close {
|
195 |
+
position: absolute;
|
196 |
+
top: 15px;
|
197 |
+
right: 35px;
|
198 |
+
color: #f1f1f1;
|
199 |
+
font-size: 40px;
|
200 |
+
font-weight: bold;
|
201 |
+
transition: 0.3s;
|
202 |
+
}
|
203 |
+
|
204 |
+
.close:hover,
|
205 |
+
.close:focus {
|
206 |
+
color: #bbb;
|
207 |
+
text-decoration: none;
|
208 |
+
cursor: pointer;
|
209 |
+
}
|
210 |
+
input[type="text"]:focus, textarea:focus {
|
211 |
+
background-color: #e9e9e9;
|
212 |
+
border-color: #aaa;
|
213 |
+
outline: none;
|
214 |
+
}
|
215 |
+
|
216 |
+
/* Specific styles for different textboxes */
|
217 |
+
|
218 |
+
.user-description-textarea {
|
219 |
+
width: 400px;
|
220 |
+
height: 40px; /* Adjust as needed for 3 lines */
|
221 |
+
resize: vertical;
|
222 |
+
background: none;
|
223 |
+
font-family: "ScalySansRemake";
|
224 |
+
font-weight: 800;
|
225 |
+
|
226 |
+
}
|
227 |
+
/* Focus styles for description textbox */
|
228 |
+
.user-description-textarea:focus {
|
229 |
+
background-color: #e9e9e9;
|
230 |
+
border-color: #aaa;
|
231 |
+
outline: none;
|
232 |
+
}
|
233 |
+
|
234 |
+
.heading-textarea {
|
235 |
+
width: 100%;
|
236 |
+
font-size: .458cm; /* Matches the font size of an h4 heading */
|
237 |
+
line-height: .7em;
|
238 |
+
font-weight: 800;
|
239 |
+
border: none;
|
240 |
+
background: none;
|
241 |
+
margin: 0;
|
242 |
+
padding: 0;
|
243 |
+
resize: none; /* Prevents the textarea from being resizable */
|
244 |
+
overflow: hidden; /* Prevents scrollbars */
|
245 |
+
outline: none; /* Removes the focus outline */
|
246 |
+
font-family: "MrEavesRemake"; /* Ensures font family is inherited */
|
247 |
+
color: var(--HB_Color_HeaderText)
|
248 |
+
|
249 |
+
}
|
250 |
+
.title-textarea{
|
251 |
+
margin-bottom: .19cm;
|
252 |
+
column-span: all;
|
253 |
+
font-size: .89cm;
|
254 |
+
line-height: 1em;
|
255 |
+
font-family: "MrEavesRemake";
|
256 |
+
font-weight: 800;
|
257 |
+
color: var(--HB_Color_HeaderText);
|
258 |
+
border: 0;
|
259 |
+
font: inherit;
|
260 |
+
background: none;
|
261 |
+
padding: 0;
|
262 |
+
resize: none; /* Prevents the textarea from being resizable */
|
263 |
+
overflow: hidden; /* Prevents scrollbars */
|
264 |
+
outline: none; /* Removes the focus outline */
|
265 |
+
|
266 |
+
}
|
267 |
+
|
268 |
+
div[contenteditable="true"]:focus {
|
269 |
+
background-color: #e9e9e9;
|
270 |
+
border-color: #aaa;
|
271 |
+
outline: none;
|
272 |
+
}
|
273 |
+
|
274 |
+
div[contenteditable="true"] p::first-letter {
|
275 |
+
float: left;
|
276 |
+
padding-bottom: 2px;
|
277 |
+
padding-left: 40px;
|
278 |
+
margin-top: -0.3cm;
|
279 |
+
margin-bottom: -20px;
|
280 |
+
margin-left: -40px;
|
281 |
+
font-family: "SolberaImitationRemake";
|
282 |
+
font-size: 3.5cm;
|
283 |
+
line-height: 1em;
|
284 |
+
color: rgba(0, 0, 0, 0);
|
285 |
+
background-image: linear-gradient(-45deg, #322814, #998250, #322814);
|
286 |
+
-webkit-background-clip: text;
|
287 |
+
background-clip: text;
|
288 |
+
border: 0;
|
289 |
+
}
|
290 |
+
.properties-textarea {
|
291 |
+
width: 100%;
|
292 |
+
font-size: 12px;
|
293 |
+
font-weight: 400;
|
294 |
+
line-height: .7em;
|
295 |
+
margin-bottom: 0;
|
296 |
+
font-style: italic;
|
297 |
+
box-sizing: border-box;
|
298 |
+
border: 0;
|
299 |
+
font-family: "ScalySansRemake";
|
300 |
+
vertical-align: baseline;
|
301 |
+
margin: 0;
|
302 |
+
padding: 0;
|
303 |
+
overflow-wrap: break-word;
|
304 |
+
text-rendering: optimizeLegibility;
|
305 |
+
background: none;
|
306 |
+
resize: none; /* Prevents the textarea from being resizable */
|
307 |
+
|
308 |
+
}
|
309 |
+
|
310 |
+
.description-textarea {
|
311 |
+
width: 100%;
|
312 |
+
height: auto;
|
313 |
+
font-size: .318cm;
|
314 |
+
font-weight: 400;
|
315 |
+
line-height: .9em;
|
316 |
+
margin-bottom: 0;
|
317 |
+
font-style: italic;
|
318 |
+
box-sizing: border-box;
|
319 |
+
border: 0;
|
320 |
+
font-family: "ScalySansSmallCapsRemake";
|
321 |
+
vertical-align: baseline;
|
322 |
+
margin: 0;
|
323 |
+
padding: 0;
|
324 |
+
overflow-wrap: break-word;
|
325 |
+
text-rendering: optimizeLegibility;
|
326 |
+
background: none;
|
327 |
+
resize: none; /* Prevents the textarea from being manually resizable */
|
328 |
+
overflow: hidden; /* Hide scrollbars */
|
329 |
+
}
|
330 |
+
|
331 |
+
.red-integer-stat-textarea {
|
332 |
+
width: 20px;
|
333 |
+
height:13px;
|
334 |
+
font-size: .318cm;
|
335 |
+
font-weight: 400;
|
336 |
+
line-height: 1.2em;
|
337 |
+
margin-bottom: 0;
|
338 |
+
font-style: italic;
|
339 |
+
box-sizing: border-box;
|
340 |
+
border: 0;
|
341 |
+
font-family: "ScalySansSmallCapsRemake";
|
342 |
+
vertical-align: baseline;
|
343 |
+
margin: 0;
|
344 |
+
padding: 0;
|
345 |
+
overflow-wrap: break-word;
|
346 |
+
text-rendering: optimizeLegibility;
|
347 |
+
background: none;
|
348 |
+
resize: none; /* Prevents the textarea from being manually resizable */
|
349 |
+
overflow: hidden; /* Hide scrollbars */
|
350 |
+
color: var(--HB_Color_HeaderText);
|
351 |
+
white-space: pre-line;
|
352 |
+
}
|
353 |
+
|
354 |
+
.integer-stat-textarea {
|
355 |
+
width: 20px;
|
356 |
+
height:13px;
|
357 |
+
font-size: .318cm;
|
358 |
+
font-weight: 400;
|
359 |
+
line-height: 1.2em;
|
360 |
+
margin-bottom: 0;
|
361 |
+
font-style: italic;
|
362 |
+
box-sizing: border-box;
|
363 |
+
border: 0;
|
364 |
+
font-family: "ScalySansRemake";
|
365 |
+
vertical-align: baseline;
|
366 |
+
margin: 0;
|
367 |
+
padding: 0;
|
368 |
+
overflow-wrap: break-word;
|
369 |
+
text-rendering: optimizeLegibility;
|
370 |
+
background: none;
|
371 |
+
resize: none; /* Prevents the textarea from being manually resizable */
|
372 |
+
overflow: hidden; /* Hide scrollbars */
|
373 |
+
white-space: pre-line;
|
374 |
+
}
|
375 |
+
|
376 |
+
.string-stat-textarea {
|
377 |
+
width: 200px;
|
378 |
+
height:13px;
|
379 |
+
font-size: .318cm;
|
380 |
+
font-weight: 400;
|
381 |
+
line-height: 1.2em;
|
382 |
+
margin-bottom: 0;
|
383 |
+
font-style: italic;
|
384 |
+
box-sizing: border-box;
|
385 |
+
border: 0;
|
386 |
+
font-family: "ScalySansRemake";
|
387 |
+
vertical-align: baseline;
|
388 |
+
margin: 0;
|
389 |
+
padding: 0;
|
390 |
+
overflow-wrap: break-word;
|
391 |
+
text-rendering: optimizeLegibility;
|
392 |
+
background: none;
|
393 |
+
resize: none; /* Prevents the textarea from being manually resizable */
|
394 |
+
overflow: hidden; /* Hide scrollbars */
|
395 |
+
white-space: pre-wrap;
|
396 |
+
}
|
397 |
+
|
398 |
+
.string-action-name-textarea {
|
399 |
+
width: 100%;
|
400 |
+
height:13px;
|
401 |
+
font-size: .318cm;
|
402 |
+
font-style: italic;
|
403 |
+
font-weight: bold;
|
404 |
+
line-height: 1.2em;
|
405 |
+
margin-bottom: 0;
|
406 |
+
font-style: italic;
|
407 |
+
box-sizing: border-box;
|
408 |
+
border: 0;
|
409 |
+
font-family: "ScalySansRemake";
|
410 |
+
vertical-align: baseline;
|
411 |
+
margin: 0;
|
412 |
+
padding: 0;
|
413 |
+
overflow-wrap: break-word;
|
414 |
+
text-rendering: optimizeLegibility;
|
415 |
+
background: none;
|
416 |
+
resize: none; /* Prevents the textarea from being manually resizable */
|
417 |
+
overflow: hidden; /* Hide scrollbars */
|
418 |
+
|
419 |
+
}
|
420 |
+
|
421 |
+
.string-action-description-textarea {
|
422 |
+
width: 100%;
|
423 |
+
height:30px;
|
424 |
+
font-size: .318cm;
|
425 |
+
font-weight: 400;
|
426 |
+
line-height: 1.2em;
|
427 |
+
margin-bottom: 0;
|
428 |
+
box-sizing: border-box;
|
429 |
+
border: 0;
|
430 |
+
font-family: "ScalySansRemake";
|
431 |
+
vertical-align: baseline;
|
432 |
+
margin: 0;
|
433 |
+
padding: 0;
|
434 |
+
overflow-wrap: break-word;
|
435 |
+
text-rendering: optimizeLegibility;
|
436 |
+
background: none;
|
437 |
+
resize: none; /* Prevents the textarea from being manually resizable */
|
438 |
+
overflow: hidden; /* Hide scrollbars */
|
439 |
+
|
440 |
+
|
441 |
+
|
442 |
+
}
|
443 |
+
|
444 |
+
.block.monster.frame.wide {
|
445 |
+
column-count: inherit;
|
446 |
+
min-height: 100px; /* Set an appropriate minimum height */
|
447 |
+
height: 859px; /* Allow height to expand automatically */
|
448 |
+
column-fill: auto;
|
449 |
+
overflow: hidden; /* Ensure content overflow is visible */
|
450 |
+
width: 100%; /* Ensure it takes the full width of the container */
|
451 |
+
|
452 |
+
}
|
453 |
+
|
454 |
+
.highlight-page {
|
455 |
+
outline: 2px dashed #2196F3; /* Blue dashed border */
|
456 |
+
background-color: rgba(33, 150, 243, 0.1); /* Light blue background */
|
457 |
+
}
|
458 |
+
|
459 |
+
.highlight-block {
|
460 |
+
border-bottom: 2px solid #2196F3; /* Blue solid border */
|
461 |
+
background-color: rgba(33, 150, 243, 0.1); /* Light blue background */
|
462 |
+
}
|
463 |
+
|
464 |
+
.highlight-block-top {
|
465 |
+
border-top: 2px solid #2196F3; /* Blue solid border at the top */
|
466 |
+
background-color: rgba(33, 150, 243, 0.1); /* Light blue background */
|
467 |
+
}
|
468 |
+
|
469 |
+
.name-textbox {
|
470 |
+
width: 50px;
|
471 |
+
font-size: 1.5em;
|
472 |
+
padding: 10px;
|
473 |
+
}
|
474 |
+
|
475 |
+
.stat-textbox {
|
476 |
+
width: 50px;
|
477 |
+
text-align: center;
|
478 |
+
font-size: 1em;
|
479 |
+
padding: 5px;
|
480 |
+
}
|
481 |
+
|
482 |
+
.trash-area {
|
483 |
+
position: fixed;
|
484 |
+
bottom: 20px;
|
485 |
+
right: 20px;
|
486 |
+
width: 100px;
|
487 |
+
height: 100px;
|
488 |
+
|
489 |
+
display: flex;
|
490 |
+
align-items: center;
|
491 |
+
justify-content: center;
|
492 |
+
|
493 |
+
cursor: pointer;
|
494 |
+
background-image: url('./closed-mimic-trashcan.png'); /* Adjust the path to your image file */
|
495 |
+
background-size: contain;
|
496 |
+
background-repeat: no-repeat;
|
497 |
+
background-position: center;
|
498 |
+
}
|
499 |
+
|
500 |
+
.trash-area:hover {
|
501 |
+
background-image: url('./mimic_trashcan.png');
|
502 |
+
}
|
503 |
+
.trash-area.over {
|
504 |
+
color: white;
|
505 |
+
background-image: url('./mimic_trashcan.png'); /* Example image change */
|
506 |
+
}
|
507 |
+
|
508 |
+
|
509 |
+
|
510 |
+
</style>
|
511 |
+
<body>
|
512 |
+
<div class="grid-container">
|
513 |
+
<div class="block-container" id="blockContainer" >
|
514 |
+
<div class="page" id = "block-page" data-page-id="block-container">
|
515 |
+
<!-- Blocks will be wrapped in a page div and loaded here -->
|
516 |
+
</div>
|
517 |
+
</div>
|
518 |
+
<div class="page-container" id="pageContainer">
|
519 |
+
<div class="brewRenderer">
|
520 |
+
<h1>Describe your creature</h1>
|
521 |
+
<textarea id="user-description" class="user-description-textarea"
|
522 |
+
hx-post="/update-stats" hx-trigger="change"
|
523 |
+
hx-target="#user-description" hx-swap="outerHTML"
|
524 |
+
title="As much or as little description as you want to provide. You can provide specific employees, inventory etc">A very standard gear store run by a fae potted plant named Gorgeous</textarea>
|
525 |
+
<button id="submitDescription">Submit</button>
|
526 |
+
<button id="parseHTML">Parse HTML</button>
|
527 |
+
<button id="resetButton">Reset</button>
|
528 |
+
<div class="pages">
|
529 |
+
<div id="page-1" class="page" data-page-id="page-0">
|
530 |
+
<div class="columnWrapper">
|
531 |
+
<div class="block monster frame wide">
|
532 |
+
</div>
|
533 |
+
</div>
|
534 |
+
</div>
|
535 |
+
</div>
|
536 |
+
</div>
|
537 |
+
</div>
|
538 |
+
</div>
|
539 |
+
<div class="trash-area" id="trashArea"></div>
|
540 |
+
|
541 |
+
<!-- The Modal -->
|
542 |
+
<div id="imageModal" class="modal">
|
543 |
+
<span class="close">×</span>
|
544 |
+
<img class="modal-content" id="modalImage">
|
545 |
+
<div id="caption"></div>
|
546 |
+
</div>
|
547 |
+
<script>
|
548 |
+
// Waits for DOM content to be fully loaded and assigns critical elements to variables.
|
549 |
+
let initialPositions = [];
|
550 |
+
document.addEventListener("DOMContentLoaded", function() {
|
551 |
+
const blockContainer = document.getElementById('blockContainer');
|
552 |
+
let blockContainerPage = document.getElementById('block-page');
|
553 |
+
const pageContainer = document.getElementById('pageContainer');
|
554 |
+
const trashArea = document.getElementById('trashArea');
|
555 |
+
const resetButton = document.getElementById('resetButton');
|
556 |
+
let currentPage = pageContainer.querySelector('.block.monster.frame.wide');
|
557 |
+
const modal = document.getElementById('imageModal');
|
558 |
+
const modalImg = document.getElementById('modalImage');
|
559 |
+
const captionText = document.getElementById('caption');
|
560 |
+
const closeModal = document.getElementsByClassName('close')[0];
|
561 |
+
const MAX_COLUMN_HEIGHT = 847;
|
562 |
+
|
563 |
+
if (!blockContainer || !pageContainer || !trashArea || !currentPage) {
|
564 |
+
console.error('Required elements are null');
|
565 |
+
return;
|
566 |
+
}
|
567 |
+
if (!modal) {
|
568 |
+
console.error('modal element not found');
|
569 |
+
return;
|
570 |
+
}
|
571 |
+
if (!modalImg) {
|
572 |
+
console.error('modalImg element not found');
|
573 |
+
return;
|
574 |
+
}
|
575 |
+
if (!captionText) {
|
576 |
+
console.error('captionText element not found');
|
577 |
+
return;
|
578 |
+
}
|
579 |
+
if (!closeModal) {
|
580 |
+
console.error('closeModal element not found');
|
581 |
+
return;
|
582 |
+
}
|
583 |
+
|
584 |
+
// Event delegation for image clicks
|
585 |
+
blockContainer.addEventListener('click', function(event) {
|
586 |
+
console.log('Click detected in blockContainer:', event.target);
|
587 |
+
if (event.target.tagName === 'IMG' && event.target.id.startsWith('generated-image-')) {
|
588 |
+
console.log('Image clicked for modal display. Image ID:', event.target.id);
|
589 |
+
modal.style.display = 'block';
|
590 |
+
modalImg.src = event.target.src;
|
591 |
+
captionText.innerHTML = event.target.alt;
|
592 |
+
} else {
|
593 |
+
console.log('Clicked element is not an image or does not match ID pattern.');
|
594 |
+
}
|
595 |
+
});
|
596 |
+
|
597 |
+
// Function to close the modal
|
598 |
+
closeModal.onclick = function() {
|
599 |
+
modal.style.display = "none";
|
600 |
+
}
|
601 |
+
|
602 |
+
// Function to close the modal when clicking outside of the modal content
|
603 |
+
window.onclick = function(event) {
|
604 |
+
if (event.target == modal) {
|
605 |
+
modal.style.display = "none";
|
606 |
+
}
|
607 |
+
}
|
608 |
+
|
609 |
+
document.getElementById('submitDescription').addEventListener('click', function() {
|
610 |
+
const userInput = document.getElementById('user-description').value;
|
611 |
+
// Clear the block container before inserting new blocks
|
612 |
+
blockContainerPage.innerHTML = '';
|
613 |
+
|
614 |
+
|
615 |
+
fetch('http://127.0.0.1:5000/process-description', {
|
616 |
+
method: 'POST',
|
617 |
+
headers: {
|
618 |
+
'Content-Type': 'application/json'
|
619 |
+
},
|
620 |
+
body: JSON.stringify({ user_input: userInput })
|
621 |
+
})
|
622 |
+
.then(response => response.json())
|
623 |
+
.then(data => {
|
624 |
+
console.log('Success:', data);
|
625 |
+
initialPositions.length = 0; // Clear the initialPositions array
|
626 |
+
insertHtmlBlocks(data.html_blocks);
|
627 |
+
const blocks = blockContainerPage.querySelectorAll('.block-item');
|
628 |
+
blocks.forEach(block => {
|
629 |
+
block.setAttribute('data-page-id', 'block-container');
|
630 |
+
block.setAttribute('draggable', true);
|
631 |
+
block.addEventListener('dragstart', handleDragStart);
|
632 |
+
block.addEventListener('dragend', handleDragEnd);
|
633 |
+
});
|
634 |
+
storeInitialPositions();
|
635 |
+
})
|
636 |
+
.catch((error) => {
|
637 |
+
console.error('Error:', error);
|
638 |
+
});
|
639 |
+
});
|
640 |
+
|
641 |
+
// Store initial positions of the blocks
|
642 |
+
function storeInitialPositions() {
|
643 |
+
initialPositions = []; // Clear initialPositions before updating
|
644 |
+
const blocks = blockContainer.querySelectorAll('.block-item');
|
645 |
+
blocks.forEach((block, index) => {
|
646 |
+
const blockId = block.getAttribute('data-block-id');
|
647 |
+
if (!blockId) {
|
648 |
+
console.error(`Block at index ${index} is missing data-block-id`);
|
649 |
+
}
|
650 |
+
initialPositions.push({
|
651 |
+
id: blockId,
|
652 |
+
index: index
|
653 |
+
});
|
654 |
+
});
|
655 |
+
console.log('Initial positions:', initialPositions);
|
656 |
+
}
|
657 |
+
|
658 |
+
function insertHtmlBlocks(blocks) {
|
659 |
+
console.log('blockContainerPage = ', blockContainerPage)
|
660 |
+
console.log('List of blocks:', blocks);
|
661 |
+
|
662 |
+
const parser = new DOMParser();
|
663 |
+
|
664 |
+
blocks.forEach(blockHtml => {
|
665 |
+
console.log('Original blockHtml:', blockHtml);
|
666 |
+
|
667 |
+
// Parse the HTML string
|
668 |
+
const doc = parser.parseFromString(blockHtml, 'text/html');
|
669 |
+
console.log('Parsed document:', doc);
|
670 |
+
const block = doc.body.firstChild;
|
671 |
+
console.log('Parsed block:', block);
|
672 |
+
if (block) {
|
673 |
+
blockContainerPage.appendChild(block); // Append the parsed block to the container
|
674 |
+
console.log('Appended block:', block);
|
675 |
+
}
|
676 |
+
|
677 |
+
});
|
678 |
+
// console.log('Final state of blockContainer:', blockContainer.innerHTML);
|
679 |
+
}
|
680 |
+
|
681 |
+
storeInitialPositions();
|
682 |
+
|
683 |
+
function adjustTextareaHeight(el) {
|
684 |
+
el.style.height = 'auto';
|
685 |
+
el.style.height = (el.scrollHeight) + 'px';
|
686 |
+
}
|
687 |
+
|
688 |
+
const classes = [
|
689 |
+
'description-textarea',
|
690 |
+
'user-description-textarea',
|
691 |
+
'heading-textarea',
|
692 |
+
'properties-textarea',
|
693 |
+
'string-stat-textarea',
|
694 |
+
'string-action-description-textarea'
|
695 |
+
];
|
696 |
+
|
697 |
+
classes.forEach(className => {
|
698 |
+
const textareas = document.querySelectorAll(`.${className}`);
|
699 |
+
textareas.forEach(textarea => {
|
700 |
+
adjustTextareaHeight(textarea);
|
701 |
+
textarea.addEventListener('input', function() {
|
702 |
+
adjustTextareaHeight(textarea);
|
703 |
+
});
|
704 |
+
});
|
705 |
+
});
|
706 |
+
|
707 |
+
async function extractBlocks() {
|
708 |
+
|
709 |
+
try {
|
710 |
+
if (blockContainerPage.children.length > 0) {
|
711 |
+
console.log('Blocks already loaded, skipping fetch');
|
712 |
+
return;
|
713 |
+
}
|
714 |
+
const response = await fetch('The_Mirage_Emporium.html');
|
715 |
+
if (!response.ok) {
|
716 |
+
throw new Error('Network response was not ok ' + response.statusText);
|
717 |
+
}
|
718 |
+
const text = await response.text();
|
719 |
+
const parser = new DOMParser();
|
720 |
+
const doc = parser.parseFromString(text, 'text/html');
|
721 |
+
const blocks = doc.querySelectorAll('[class^="Block_"]');
|
722 |
+
|
723 |
+
|
724 |
+
blocks.forEach((block, index) => {
|
725 |
+
const blockContent = block.innerHTML;
|
726 |
+
const blockItem = document.createElement('div');
|
727 |
+
blockItem.classList.add('block-item');
|
728 |
+
blockItem.innerHTML = blockContent;
|
729 |
+
const blockId = `block-${index}`;
|
730 |
+
blockItem.setAttribute('data-block-id', blockId);
|
731 |
+
const pageId = 'block-container';
|
732 |
+
blockItem.setAttribute('data-page-id', pageId);
|
733 |
+
blockItem.setAttribute('draggable', true);
|
734 |
+
blockItem.addEventListener('dragstart', handleDragStart);
|
735 |
+
blockItem.addEventListener('dragend', handleDragEnd);
|
736 |
+
|
737 |
+
console.log(`Loaded block with ID: ${blockId}`);
|
738 |
+
blockContainerPage.appendChild(blockItem);
|
739 |
+
});
|
740 |
+
|
741 |
+
storeInitialPositions();
|
742 |
+
} catch (error) {
|
743 |
+
console.error('Error fetching and parsing template.html:', error);
|
744 |
+
}
|
745 |
+
}
|
746 |
+
|
747 |
+
blockContainer.addEventListener('click', function(event) {
|
748 |
+
if (event.target && event.target.classList.contains('generate-image-button')) {
|
749 |
+
const blockId = event.target.getAttribute('data-block-id');
|
750 |
+
generateImage(blockId);
|
751 |
+
}
|
752 |
+
});
|
753 |
+
|
754 |
+
// Function to generate image
|
755 |
+
function generateImage(blockId) {
|
756 |
+
const sdPromptElement = document.getElementById(`user-storefront-prompt-${blockId}`);
|
757 |
+
const imageElement = document.getElementById(`generated-image-${blockId}`);
|
758 |
+
|
759 |
+
if (!sdPromptElement) {
|
760 |
+
console.error('Element with ID user-storefront-prompt not found');
|
761 |
+
return;
|
762 |
+
}
|
763 |
+
|
764 |
+
if (!imageElement) {
|
765 |
+
console.error('Element with ID generated-image not found');
|
766 |
+
return;
|
767 |
+
}
|
768 |
+
|
769 |
+
const sdPrompt = sdPromptElement.value;
|
770 |
+
|
771 |
+
fetch('http://127.0.0.1:5000/generate-image', {
|
772 |
+
method: 'POST',
|
773 |
+
headers: {
|
774 |
+
'Content-Type': 'application/json'
|
775 |
+
},
|
776 |
+
body: JSON.stringify({ sd_prompt: sdPrompt })
|
777 |
+
})
|
778 |
+
.then(response => response.json())
|
779 |
+
.then(data => {
|
780 |
+
console.log('Received data:', data);
|
781 |
+
imageElement.src = data.image_url;
|
782 |
+
imageElement.style.display = 'block';
|
783 |
+
|
784 |
+
// Log the image element's HTML structure
|
785 |
+
console.log('Updated imageElement HTML:', imageElement.outerHTML);
|
786 |
+
})
|
787 |
+
.catch((error) => {
|
788 |
+
console.error('Error:', error);
|
789 |
+
});
|
790 |
+
}
|
791 |
+
|
792 |
+
function handleDragStart(e) {
|
793 |
+
const target = e.target.closest('.block-item, .block-content');
|
794 |
+
if (!target) {
|
795 |
+
console.error('Drag started for an element without a valid target');
|
796 |
+
return;
|
797 |
+
}
|
798 |
+
const blockId = target.getAttribute('data-block-id');
|
799 |
+
const pageId = target.getAttribute('data-page-id');
|
800 |
+
if (!blockId) {
|
801 |
+
console.error('Drag started for an element without a data-block-id');
|
802 |
+
return;
|
803 |
+
}
|
804 |
+
if (!pageId) {
|
805 |
+
console.error('Drag started for an element without a data-page-id');
|
806 |
+
return;
|
807 |
+
}
|
808 |
+
const innerHTML = target.innerHTML;
|
809 |
+
e.dataTransfer.setData('block-id', blockId);
|
810 |
+
e.dataTransfer.setData('text/plain', innerHTML); // Store inner HTML
|
811 |
+
e.dataTransfer.setData('data-page-id', pageId); // Store original page ID
|
812 |
+
e.dataTransfer.effectAllowed = 'move';
|
813 |
+
target.style.opacity = '0.4';
|
814 |
+
|
815 |
+
// Create an invisible drag image
|
816 |
+
const dragImage = document.createElement('div');
|
817 |
+
dragImage.style.width = '1px';
|
818 |
+
dragImage.style.height = '1px';
|
819 |
+
dragImage.style.opacity = '0';
|
820 |
+
document.body.appendChild(dragImage);
|
821 |
+
e.dataTransfer.setDragImage(dragImage, 0, 0);
|
822 |
+
|
823 |
+
console.log(`Drag started for block ID: ${blockId} page ID: ${pageId}`);
|
824 |
+
}
|
825 |
+
|
826 |
+
function handleDragEnd(e) {
|
827 |
+
const target = e.target.closest('.block-item, .block-content');
|
828 |
+
if (target) {
|
829 |
+
target.style.opacity = '1'; // Reset the opacity
|
830 |
+
const blockId = target.getAttribute('data-block-id');
|
831 |
+
console.log(`Drag ended for block ID: ${blockId}`);
|
832 |
+
}
|
833 |
+
|
834 |
+
// Remove highlight classes from pages and blocks
|
835 |
+
document.querySelectorAll('.highlight-page').forEach(el => el.classList.remove('highlight-page'));
|
836 |
+
document.querySelectorAll('.highlight-block').forEach(el => el.classList.remove('highlight-block'));
|
837 |
+
document.querySelectorAll('.highlight-block-top').forEach(el => el.classList.remove('highlight-block-top'));
|
838 |
+
}
|
839 |
+
|
840 |
+
function handleDragOver(e) {
|
841 |
+
e.preventDefault();
|
842 |
+
e.dataTransfer.dropEffect = 'move';
|
843 |
+
console.log('Drag over event');
|
844 |
+
|
845 |
+
const targetPage = e.target.closest('.page');
|
846 |
+
if (targetPage) {
|
847 |
+
targetPage.classList.add('highlight-page'); // Add highlight class for pages
|
848 |
+
}
|
849 |
+
|
850 |
+
const targetBlock = e.target.closest('.block-item, .block-content');
|
851 |
+
if (targetBlock) {
|
852 |
+
const bounding = targetBlock.getBoundingClientRect();
|
853 |
+
const offset = e.clientY - bounding.top;
|
854 |
+
if (offset > bounding.height / 2) {
|
855 |
+
targetBlock.classList.add('highlight-block');
|
856 |
+
targetBlock.classList.remove('highlight-block-top');
|
857 |
+
} else {
|
858 |
+
targetBlock.classList.add('highlight-block-top');
|
859 |
+
targetBlock.classList.remove('highlight-block');
|
860 |
+
}
|
861 |
+
}
|
862 |
+
}
|
863 |
+
|
864 |
+
function handleDrop(e) {
|
865 |
+
e.preventDefault();
|
866 |
+
const blockId = e.dataTransfer.getData('block-id');
|
867 |
+
const originalPageId = e.dataTransfer.getData('data-page-id');
|
868 |
+
const innerHTML = e.dataTransfer.getData('text/plain');
|
869 |
+
console.log(`Drop event for block ID: ${blockId} from page ID: ${originalPageId}`);
|
870 |
+
|
871 |
+
if (blockId && originalPageId) {
|
872 |
+
const originalBlock = document.querySelector(`[data-block-id="${blockId}"]`);
|
873 |
+
const newPage = e.target.closest('.page');
|
874 |
+
console.log(`Over page ${newPage} from page ID: ${originalPageId}`);
|
875 |
+
const newPageId = newPage.getAttribute('data-page-id');
|
876 |
+
|
877 |
+
// Ensure the original block exists before proceeding
|
878 |
+
if (!originalBlock || !newPage) {
|
879 |
+
console.error(`Block with ID ${blockId} on page ${originalPageId} not found`);
|
880 |
+
return;
|
881 |
+
}
|
882 |
+
|
883 |
+
const newBlockContent = document.createElement('div');
|
884 |
+
newBlockContent.classList.add('block-content');
|
885 |
+
newBlockContent.innerHTML = originalBlock.innerHTML; // Transfer inner content only
|
886 |
+
|
887 |
+
// Add necessary attributes and event listeners
|
888 |
+
newBlockContent.setAttribute('data-block-id', blockId);
|
889 |
+
newBlockContent.setAttribute('data-page-id', newPageId);
|
890 |
+
console.log('newPageID:', newPageId);
|
891 |
+
newBlockContent.setAttribute('draggable', true);
|
892 |
+
newBlockContent.addEventListener('dragstart', handleDragStart);
|
893 |
+
newBlockContent.addEventListener('dragend', handleDragEnd);
|
894 |
+
|
895 |
+
const target = e.target.closest('.block-item, .block-content');
|
896 |
+
let targetColumn = 1;
|
897 |
+
if (target) {
|
898 |
+
const bounding = target.getBoundingClientRect();
|
899 |
+
const offset = e.clientY - bounding.top;
|
900 |
+
|
901 |
+
console.log('Drop target found:', target);
|
902 |
+
console.log('Bounding rectangle:', bounding);
|
903 |
+
console.log('Offset from top:', offset);
|
904 |
+
console.log('Target height:', bounding.height);
|
905 |
+
console.log('Insert before or after decision point (height / 2):', bounding.height / 2);
|
906 |
+
|
907 |
+
targetColumn = getColumnFromOffset(target, offset);
|
908 |
+
if (offset > bounding.height / 2) {
|
909 |
+
console.log('Inserting after the target');
|
910 |
+
target.parentNode.insertBefore(newBlockContent, target.nextSibling);
|
911 |
+
} else {
|
912 |
+
console.log('Inserting before the target');
|
913 |
+
target.parentNode.insertBefore(newBlockContent, target);
|
914 |
+
}
|
915 |
+
|
916 |
+
// Remove highlight borders
|
917 |
+
target.style['border-bottom'] = '';
|
918 |
+
target.style['border-top'] = '';
|
919 |
+
} else {
|
920 |
+
console.log('No valid drop target found, appending to the end');
|
921 |
+
newPage.querySelector('.block.monster.frame.wide').appendChild(newBlockContent);
|
922 |
+
}
|
923 |
+
|
924 |
+
// Remove the original block from the original container
|
925 |
+
originalBlock.parentNode.removeChild(originalBlock);
|
926 |
+
|
927 |
+
// Reset opacity of dragged element
|
928 |
+
newBlockContent.style.opacity = '1';
|
929 |
+
console.log(`Moved existing block with ID: ${blockId} to page ID: ${newPageId}`);
|
930 |
+
|
931 |
+
// Adjust layouts
|
932 |
+
if (originalPageId !== 'block-container') {
|
933 |
+
adjustPageLayout(originalPageId);
|
934 |
+
}
|
935 |
+
adjustPageLayout(newPageId, targetColumn);
|
936 |
+
} else {
|
937 |
+
console.log('No data transferred');
|
938 |
+
}
|
939 |
+
}
|
940 |
+
|
941 |
+
function getColumnFromOffset(block, offset) {
|
942 |
+
const page = block.closest('.page');
|
943 |
+
if (!page) return 1;
|
944 |
+
const columnWrapper = page.querySelector('.columnWrapper');
|
945 |
+
const columnWrapperRect = columnWrapper.getBoundingClientRect();
|
946 |
+
const relativeOffset = offset - columnWrapperRect.left; // Calculate the offset relative to the column wrapper
|
947 |
+
const columnWidth = columnWrapper.clientWidth / 2; // Assuming two columns
|
948 |
+
|
949 |
+
// Log details for debugging
|
950 |
+
console.log('Block offset:', offset);
|
951 |
+
console.log('Relative offset:', relativeOffset);
|
952 |
+
|
953 |
+
const columnNumber = Math.ceil(relativeOffset / columnWidth);
|
954 |
+
|
955 |
+
// Ensure the column number is within valid bounds (1 or 2)
|
956 |
+
const validColumnNumber = Math.min(Math.max(columnNumber, 1), 2);
|
957 |
+
return validColumnNumber;
|
958 |
+
}
|
959 |
+
|
960 |
+
|
961 |
+
// Function to get the height of a column by index
|
962 |
+
function getColumnHeights(pageElement) {
|
963 |
+
const columns = [0, 0]; // Assuming two columns for simplicity
|
964 |
+
const blocks = pageElement.querySelectorAll('.block-content');
|
965 |
+
blocks.forEach(block => {
|
966 |
+
const column = getColumnFromOffset(block, block.getBoundingClientRect().left);
|
967 |
+
columns[column - 1] += block.offsetHeight;
|
968 |
+
});
|
969 |
+
return columns;
|
970 |
+
}
|
971 |
+
|
972 |
+
function adjustPageLayout(pageId) {
|
973 |
+
const page = document.querySelector(`[data-page-id="${pageId}"]`);
|
974 |
+
if (!page) {
|
975 |
+
console.error(`Page with ID ${pageId} not found`);
|
976 |
+
return;
|
977 |
+
}
|
978 |
+
|
979 |
+
const columnHeights = getColumnHeights(page);
|
980 |
+
console.log(`Total height of columns in ${pageId}: ${columnHeights}`);
|
981 |
+
|
982 |
+
for (let i = 0; i < columnHeights.length; i++) {
|
983 |
+
if (columnHeights[i] > MAX_COLUMN_HEIGHT) {
|
984 |
+
console.log(`Column ${i + 1} in ${pageId} exceeds max height, total height: ${columnHeights[i]}px`);
|
985 |
+
handleColumnOverflow(page, i + 1);
|
986 |
+
}
|
987 |
+
}
|
988 |
+
}
|
989 |
+
|
990 |
+
let pageCounter = 1;
|
991 |
+
// Function to create new page
|
992 |
+
function createNewPage() {
|
993 |
+
const newPage = document.createElement('div');
|
994 |
+
newPage.classList.add('page');
|
995 |
+
newPage.setAttribute('data-page-id', `page-${pageCounter}`);
|
996 |
+
newPage.id = `page-${pageCounter}`;
|
997 |
+
|
998 |
+
const columnWrapper = document.createElement('div');
|
999 |
+
columnWrapper.classList.add('columnWrapper');
|
1000 |
+
|
1001 |
+
const newMonsterFrame = document.createElement('div');
|
1002 |
+
newMonsterFrame.classList.add('block', 'monster', 'frame', 'wide');
|
1003 |
+
|
1004 |
+
columnWrapper.appendChild(newMonsterFrame);
|
1005 |
+
newPage.appendChild(columnWrapper);
|
1006 |
+
pageContainer.appendChild(newPage);
|
1007 |
+
|
1008 |
+
currentPage = newMonsterFrame;
|
1009 |
+
console.log(`Created new page with ID: ${newPage.id}`);
|
1010 |
+
|
1011 |
+
// Add event listeners to the new currentPage
|
1012 |
+
currentPage.addEventListener('dragover', handleDragOver);
|
1013 |
+
currentPage.addEventListener('drop', handleDrop);
|
1014 |
+
|
1015 |
+
pageCounter++;
|
1016 |
+
return newPage;
|
1017 |
+
}
|
1018 |
+
|
1019 |
+
function handleColumnOverflow(page, targetColumn) {
|
1020 |
+
console.log(`Handling overflow for page ID: ${page.getAttribute('data-page-id')} in column ${targetColumn}`);
|
1021 |
+
const blocks = Array.from(page.querySelectorAll('.block-content'));
|
1022 |
+
let columnHeights = [0, 0];
|
1023 |
+
let overflowStartIndex = -1;
|
1024 |
+
|
1025 |
+
// Find the start index where overflow begins in the target column
|
1026 |
+
blocks.forEach((block, index) => {
|
1027 |
+
const column = getColumnFromOffset(block, block.getBoundingClientRect().left);
|
1028 |
+
columnHeights[column - 1] += block.offsetHeight;
|
1029 |
+
if (columnHeights[targetColumn - 1] > MAX_COLUMN_HEIGHT && overflowStartIndex === -1) {
|
1030 |
+
overflowStartIndex = index;
|
1031 |
+
}
|
1032 |
+
});
|
1033 |
+
|
1034 |
+
// If no overflow, return early
|
1035 |
+
if (overflowStartIndex === -1) {
|
1036 |
+
return;
|
1037 |
+
}
|
1038 |
+
const overflowBlocks = blocks.slice(overflowStartIndex);
|
1039 |
+
const overflowHeight = overflowBlocks.reduce((acc, block) => acc + block.offsetHeight, 0);
|
1040 |
+
|
1041 |
+
// If the target column is the first column, check if the second column has enough space
|
1042 |
+
if (targetColumn === 1) {
|
1043 |
+
const secondColumnAvailableHeight = MAX_COLUMN_HEIGHT - columnHeights[1];
|
1044 |
+
|
1045 |
+
if (overflowHeight <= secondColumnAvailableHeight) {
|
1046 |
+
// Move the overflowing blocks to the second column within the same page
|
1047 |
+
overflowBlocks.forEach(block => {
|
1048 |
+
const blockWrapper = block.closest('.block.monster.frame.wide');
|
1049 |
+
if (blockWrapper) {
|
1050 |
+
blockWrapper.appendChild(block);
|
1051 |
+
block.setAttribute('data-page-id', page.getAttribute('data-page-id'));
|
1052 |
+
}
|
1053 |
+
});
|
1054 |
+
return;
|
1055 |
+
}
|
1056 |
+
}
|
1057 |
+
|
1058 |
+
// Get the next page if it exists
|
1059 |
+
const nextPage = getNextPage(page);
|
1060 |
+
if (nextPage) {
|
1061 |
+
const nextPageBlocks = nextPage.querySelectorAll('.block-content, .block-item');
|
1062 |
+
let nextPageColumnHeights = [0, 0];
|
1063 |
+
|
1064 |
+
nextPageBlocks.forEach(block => {
|
1065 |
+
const column = getColumnFromOffset(block, block.getBoundingClientRect().left);
|
1066 |
+
nextPageColumnHeights[column - 1] += block.offsetHeight;
|
1067 |
+
});
|
1068 |
+
|
1069 |
+
// Check if there's enough space in the target column of the next page
|
1070 |
+
if (nextPageColumnHeights[targetColumn - 1] + overflowHeight <= MAX_COLUMN_HEIGHT) {
|
1071 |
+
const nextPageContainer = nextPage.querySelector('.block.monster.frame.wide');
|
1072 |
+
overflowBlocks.forEach(block => {
|
1073 |
+
nextPageContainer.appendChild(block);
|
1074 |
+
block.setAttribute('data-page-id', nextPage.getAttribute('data-page-id'));
|
1075 |
+
});
|
1076 |
+
return;
|
1077 |
+
}
|
1078 |
+
|
1079 |
+
// If the next page's second column has enough space for overflow from the first column
|
1080 |
+
if (targetColumn === 1 && nextPageColumnHeights[1] + overflowHeight <= MAX_COLUMN_HEIGHT) {
|
1081 |
+
const nextPageContainer = nextPage.querySelector('.block.monster.frame.wide');
|
1082 |
+
overflowBlocks.forEach(block => {
|
1083 |
+
nextPageContainer.appendChild(block);
|
1084 |
+
block.setAttribute('data-page-id', nextPage.getAttribute('data-page-id'));
|
1085 |
+
});
|
1086 |
+
return;
|
1087 |
+
}
|
1088 |
+
}
|
1089 |
+
|
1090 |
+
// Otherwise, create a new page and move the overflowing blocks there
|
1091 |
+
const newPage = createNewPage();
|
1092 |
+
if (!newPage) {
|
1093 |
+
console.error('Failed to create a new page');
|
1094 |
+
return;
|
1095 |
+
}
|
1096 |
+
const newMonsterFrame = newPage.querySelector('.block.monster.frame.wide');
|
1097 |
+
if (!newMonsterFrame) {
|
1098 |
+
console.error('New monster frame not found in the new page');
|
1099 |
+
return;
|
1100 |
+
}
|
1101 |
+
|
1102 |
+
|
1103 |
+
overflowBlocks.forEach(block => {
|
1104 |
+
newMonsterFrame.appendChild(block);
|
1105 |
+
});
|
1106 |
+
console.log(`Moved overflowing blocks to new page with ID: ${newPage.getAttribute('data-page-id')}`);
|
1107 |
+
}
|
1108 |
+
|
1109 |
+
// Utility function to get the next page element
|
1110 |
+
function getNextPage(currentPage) {
|
1111 |
+
const nextPageId = parseInt(currentPage.getAttribute('data-page-id').split('-')[1]) + 1;
|
1112 |
+
return document.querySelector(`[data-page-id="page-${nextPageId}"]`);
|
1113 |
+
}
|
1114 |
+
|
1115 |
+
|
1116 |
+
let blockCounter = 1;
|
1117 |
+
|
1118 |
+
function createNewBlock(pageId, content) {
|
1119 |
+
const newBlock = document.createElement('div');
|
1120 |
+
newBlock.classList.add('block-item');
|
1121 |
+
newBlock.setAttribute('data-block-id', `block-${blockCounter}`);
|
1122 |
+
newBlock.setAttribute('data-page-id', pageId);
|
1123 |
+
newBlock.innerHTML = content; // Add the content to the block
|
1124 |
+
|
1125 |
+
newBlock.setAttribute('draggable', true);
|
1126 |
+
newBlock.addEventListener('dragstart', handleDragStart);
|
1127 |
+
newBlock.addEventListener('dragend', handleDragEnd);
|
1128 |
+
|
1129 |
+
blockCounter++;
|
1130 |
+
return newBlock;
|
1131 |
+
}
|
1132 |
+
|
1133 |
+
function moveBlockToPage(block, newPageId) {
|
1134 |
+
block.setAttribute('data-page-id', newPageId);
|
1135 |
+
const newPage = document.querySelector(`[data-page-id="${newPageId}"] .block-container`);
|
1136 |
+
newPage.appendChild(block);
|
1137 |
+
}
|
1138 |
+
|
1139 |
+
// Handle the drop event on the trash area
|
1140 |
+
function handleTrashDrop(e) {
|
1141 |
+
e.preventDefault();
|
1142 |
+
const innerHTML = e.dataTransfer.getData('text/plain');
|
1143 |
+
const blockId = e.dataTransfer.getData('block-id');
|
1144 |
+
console.log('Trash Drop event:', e);
|
1145 |
+
console.log('Dragged block ID to trash:', blockId);
|
1146 |
+
|
1147 |
+
if (innerHTML && blockId) {
|
1148 |
+
// Find the dragged element and remove it from the DOM
|
1149 |
+
let draggedElement = document.querySelector(`[data-block-id="${blockId}"].block-content`);
|
1150 |
+
if (!draggedElement) {
|
1151 |
+
draggedElement = document.querySelector(`[data-block-id="${blockId}"].block-item`);
|
1152 |
+
}
|
1153 |
+
if (draggedElement && draggedElement.parentElement) {
|
1154 |
+
draggedElement.parentElement.removeChild(draggedElement);
|
1155 |
+
console.log(`Removed block with ID: ${blockId} from the page`);
|
1156 |
+
}
|
1157 |
+
|
1158 |
+
// Check if the block already exists in the block-container and remove it if it does
|
1159 |
+
let existingBlock = blockContainer.querySelector(`[data-block-id="${blockId}"].block-content`);
|
1160 |
+
if (!existingBlock) {
|
1161 |
+
existingBlock = blockContainer.querySelector(`[data-block-id="${blockId}"].block-item`);
|
1162 |
+
}
|
1163 |
+
if (existingBlock && existingBlock.parentElement) {
|
1164 |
+
existingBlock.parentElement.removeChild(existingBlock);
|
1165 |
+
console.log(`Removed duplicate block with ID: ${blockId} from block-container`);
|
1166 |
+
}
|
1167 |
+
|
1168 |
+
// Create a new block-item to be placed back in the block-container
|
1169 |
+
const newBlock = document.createElement('div');
|
1170 |
+
newBlock.classList.add('block-item');
|
1171 |
+
newBlock.setAttribute('data-block-id', blockId);
|
1172 |
+
newBlock.setAttribute('data-page-id', 'block-container');
|
1173 |
+
newBlock.innerHTML = innerHTML;
|
1174 |
+
newBlock.setAttribute('draggable', true);
|
1175 |
+
newBlock.addEventListener('dragstart', handleDragStart);
|
1176 |
+
newBlock.addEventListener('dragend', handleDragEnd);
|
1177 |
+
|
1178 |
+
// Ensure the block is appended to the page wrapper inside blockContainer
|
1179 |
+
let pageWrapper = blockContainer.querySelector('.page');
|
1180 |
+
if (!pageWrapper) {
|
1181 |
+
pageWrapper = document.createElement('div');
|
1182 |
+
pageWrapper.classList.add('page');
|
1183 |
+
pageWrapper.setAttribute('data-page-id', 'block-container');
|
1184 |
+
blockContainer.appendChild(pageWrapper);
|
1185 |
+
}
|
1186 |
+
|
1187 |
+
// Debugging output
|
1188 |
+
console.log('Page wrapper:', pageWrapper);
|
1189 |
+
console.log('New block:', newBlock);
|
1190 |
+
|
1191 |
+
// Find the original position to insert the new block
|
1192 |
+
const originalPosition = initialPositions.find(pos => pos.id === blockId);
|
1193 |
+
console.log('Original position:', originalPosition);
|
1194 |
+
|
1195 |
+
if (originalPosition) {
|
1196 |
+
const blocks = pageWrapper.querySelectorAll('.block-item');
|
1197 |
+
console.log('Blocks in pageWrapper:', blocks);
|
1198 |
+
console.log('Inserting at position:', originalPosition.index);
|
1199 |
+
|
1200 |
+
if (originalPosition.index < blocks.length) {
|
1201 |
+
const referenceNode = blocks[originalPosition.index];
|
1202 |
+
if (referenceNode && referenceNode.parentNode === pageWrapper) {
|
1203 |
+
console.log('Inserting before block at index:', originalPosition.index);
|
1204 |
+
pageWrapper.insertBefore(newBlock, referenceNode);
|
1205 |
+
console.log(`Moved block back to original position ${originalPosition.index} in block-container`);
|
1206 |
+
} else {
|
1207 |
+
console.warn('Reference node does not belong to pageWrapper, appending to the end');
|
1208 |
+
pageWrapper.appendChild(newBlock);
|
1209 |
+
console.log('Appended block to the end of block-container');
|
1210 |
+
}
|
1211 |
+
} else {
|
1212 |
+
console.log('Appending block to the end of pageWrapper');
|
1213 |
+
pageWrapper.appendChild(newBlock);
|
1214 |
+
console.log('Appended block to the end of block-container');
|
1215 |
+
}
|
1216 |
+
} else {
|
1217 |
+
console.log('Original position not found, appending block to the end of pageWrapper');
|
1218 |
+
pageWrapper.appendChild(newBlock);
|
1219 |
+
console.log('Appended block to the end of block-container');
|
1220 |
+
}
|
1221 |
+
|
1222 |
+
console.log(`Restored block with ID: ${blockId}`);
|
1223 |
+
} else {
|
1224 |
+
console.log('No data transferred');
|
1225 |
+
}
|
1226 |
+
|
1227 |
+
// Remove the "over" class and reset the background image
|
1228 |
+
trashArea.classList.remove('over');
|
1229 |
+
trashArea.style.backgroundImage = "url('./closed-mimic-trashcan.png')";
|
1230 |
+
}
|
1231 |
+
|
1232 |
+
function handleTrashOver(e) {
|
1233 |
+
e.preventDefault();
|
1234 |
+
e.dataTransfer.dropEffect = 'move';
|
1235 |
+
trashArea.classList.add('over');
|
1236 |
+
trashArea.style.backgroundImage = "url('./mimic_trashcan.png')";
|
1237 |
+
console.log('Trash over event');
|
1238 |
+
}
|
1239 |
+
|
1240 |
+
function handleTrashLeave(e) {
|
1241 |
+
trashArea.classList.remove('over');
|
1242 |
+
trashArea.style.backgroundImage = "url('./closed-mimic-trashcan.png')";
|
1243 |
+
console.log('Trash leave event');
|
1244 |
+
}
|
1245 |
+
|
1246 |
+
currentPage.addEventListener('dragover', handleDragOver);
|
1247 |
+
currentPage.addEventListener('drop', handleDrop);
|
1248 |
+
|
1249 |
+
trashArea.addEventListener('dragover', handleTrashOver);
|
1250 |
+
trashArea.addEventListener('dragleave', handleTrashLeave);
|
1251 |
+
trashArea.addEventListener('drop', handleTrashDrop);
|
1252 |
+
|
1253 |
+
function handleReset() {
|
1254 |
+
console.log('Reset button clicked');
|
1255 |
+
|
1256 |
+
// Collect all blocks from all pages
|
1257 |
+
const allBlocks = [];
|
1258 |
+
const pages = document.querySelectorAll('.page');
|
1259 |
+
pages.forEach(page => {
|
1260 |
+
const blocksOnPage = page.querySelectorAll('[data-block-id]');
|
1261 |
+
blocksOnPage.forEach(block => {
|
1262 |
+
const blockId = block.getAttribute('data-block-id');
|
1263 |
+
allBlocks.push({
|
1264 |
+
id: blockId,
|
1265 |
+
innerHTML: block.innerHTML
|
1266 |
+
});
|
1267 |
+
block.remove();
|
1268 |
+
console.log(`Removed block with ID: ${blockId} from page ID: ${page.getAttribute('data-page-id')}`);
|
1269 |
+
});
|
1270 |
+
});
|
1271 |
+
|
1272 |
+
// Clear all pages
|
1273 |
+
pages.forEach(page => page.remove());
|
1274 |
+
|
1275 |
+
// Clear blockContainer before reinserting blocks
|
1276 |
+
blockContainer.innerHTML = '';
|
1277 |
+
|
1278 |
+
// Reinsert blocks back into the blockContainer in their original order
|
1279 |
+
let pageWrapper = blockContainer.querySelector('.page');
|
1280 |
+
if (!pageWrapper) {
|
1281 |
+
pageWrapper = document.createElement('div');
|
1282 |
+
pageWrapper.classList.add('page');
|
1283 |
+
pageWrapper.setAttribute('id', 'block-page');
|
1284 |
+
blockContainer.appendChild(pageWrapper);
|
1285 |
+
}
|
1286 |
+
// Reassign blockContainerPage to the newly created block-page element
|
1287 |
+
blockContainerPage = document.getElementById('block-page');
|
1288 |
+
|
1289 |
+
initialPositions.forEach(pos => {
|
1290 |
+
const blockData = allBlocks.find(block => block.id === pos.id);
|
1291 |
+
if (blockData) {
|
1292 |
+
const newBlock = document.createElement('div');
|
1293 |
+
newBlock.classList.add('block-item');
|
1294 |
+
newBlock.setAttribute('data-block-id', blockData.id);
|
1295 |
+
newBlock.setAttribute('data-page-id', 'block-container');
|
1296 |
+
newBlock.innerHTML = blockData.innerHTML;
|
1297 |
+
newBlock.setAttribute('draggable', true);
|
1298 |
+
newBlock.addEventListener('dragstart', handleDragStart);
|
1299 |
+
newBlock.addEventListener('dragend', handleDragEnd);
|
1300 |
+
|
1301 |
+
const blocks = pageWrapper.querySelectorAll('.block-item');
|
1302 |
+
if (pos.index < blocks.length) {
|
1303 |
+
pageWrapper.insertBefore(newBlock, blocks[pos.index]);
|
1304 |
+
console.log(`Moved block back to original position ${pos.index} in block-container`);
|
1305 |
+
} else {
|
1306 |
+
pageWrapper.appendChild(newBlock);
|
1307 |
+
console.log('Appended block to the end of block-container');
|
1308 |
+
}
|
1309 |
+
}
|
1310 |
+
});
|
1311 |
+
createNewPage();
|
1312 |
+
|
1313 |
+
console.log('Reset complete, all blocks moved back to block-container');
|
1314 |
+
}
|
1315 |
+
|
1316 |
+
pageContainer.addEventListener('dragover', handleDragOver);
|
1317 |
+
pageContainer.addEventListener('drop', handleDrop);
|
1318 |
+
|
1319 |
+
trashArea.addEventListener('dragover', handleTrashOver);
|
1320 |
+
trashArea.addEventListener('dragleave', handleTrashLeave);
|
1321 |
+
trashArea.addEventListener('drop', handleTrashDrop);
|
1322 |
+
resetButton.addEventListener('click', handleReset);
|
1323 |
+
extractBlocks();
|
1324 |
+
});
|
1325 |
+
|
1326 |
+
</script>
|
1327 |
+
</body>
|
1328 |
+
</html>
|
store_helper.py
CHANGED
@@ -1,6 +1,7 @@
|
|
|
|
|
|
1 |
import ast
|
2 |
import gc
|
3 |
-
import os
|
4 |
from openai import OpenAI
|
5 |
|
6 |
client = OpenAI()
|
@@ -9,7 +10,7 @@ def load_llm(user_input, prompt_instructions):
|
|
9 |
prompt = f"{user_input}"
|
10 |
print(prompt)
|
11 |
response = client.chat.completions.create(
|
12 |
-
model="gpt-4o",
|
13 |
messages=[
|
14 |
{
|
15 |
"role": "user",
|
@@ -22,7 +23,7 @@ def load_llm(user_input, prompt_instructions):
|
|
22 |
frequency_penalty=0,
|
23 |
presence_penalty=0
|
24 |
)
|
25 |
-
|
26 |
return response.choices[0].message.content
|
27 |
# Call the LLM and store its output
|
28 |
def call_llm_and_cleanup(user_input, inventory = False):
|
@@ -34,7 +35,7 @@ def call_llm_and_cleanup(user_input, inventory = False):
|
|
34 |
llm_output = load_llm(user_input, prompt_instructions)
|
35 |
llm_output = "".join(llm_output)
|
36 |
print(llm_output)
|
37 |
-
llm_output =
|
38 |
gc.collect()
|
39 |
# llm_output is still available for use here
|
40 |
return llm_output
|
@@ -104,18 +105,19 @@ Image Generation Prompt Examples :
|
|
104 |
|
105 |
store_description = {
|
106 |
"store_name": "",
|
107 |
-
"
|
108 |
-
"
|
109 |
-
"
|
110 |
-
"
|
|
|
|
|
|
|
|
|
111 |
"town": "",
|
112 |
"district": "",
|
113 |
"street": ""
|
114 |
-
},
|
115 |
-
"
|
116 |
-
"size": "",
|
117 |
-
"store_sd_prompt": "",
|
118 |
-
"owners": [
|
119 |
{
|
120 |
"name": "",
|
121 |
"species": "",
|
@@ -126,7 +128,7 @@ store_description = {
|
|
126 |
"sd_prompt":""
|
127 |
}
|
128 |
],
|
129 |
-
"
|
130 |
{
|
131 |
"name": "",
|
132 |
"role": "",
|
@@ -137,7 +139,7 @@ store_description = {
|
|
137 |
}
|
138 |
],
|
139 |
|
140 |
-
"
|
141 |
{
|
142 |
"name": "",
|
143 |
"description": "",
|
@@ -145,30 +147,30 @@ store_description = {
|
|
145 |
}
|
146 |
],
|
147 |
|
148 |
-
"
|
149 |
{
|
150 |
"name": "",
|
151 |
"description": "",
|
152 |
"influence": ""
|
153 |
}
|
154 |
],
|
155 |
-
"
|
156 |
-
"
|
157 |
{
|
158 |
"name": "",
|
159 |
"description": "",
|
160 |
-
"
|
161 |
}
|
162 |
],
|
163 |
-
|
164 |
-
"
|
165 |
{
|
166 |
"name": "",
|
167 |
"description": "",
|
168 |
"price": ""
|
169 |
}
|
170 |
],
|
171 |
-
"
|
172 |
{
|
173 |
"name": "",
|
174 |
"description": "",
|
@@ -255,4 +257,5 @@ inventory_description = {
|
|
255 |
}
|
256 |
]
|
257 |
}
|
258 |
-
}
|
|
|
|
1 |
+
from flask import Flask, request, jsonify
|
2 |
+
from flask_cors import CORS
|
3 |
import ast
|
4 |
import gc
|
|
|
5 |
from openai import OpenAI
|
6 |
|
7 |
client = OpenAI()
|
|
|
10 |
prompt = f"{user_input}"
|
11 |
print(prompt)
|
12 |
response = client.chat.completions.create(
|
13 |
+
model="gpt-4o-2024-05-13",
|
14 |
messages=[
|
15 |
{
|
16 |
"role": "user",
|
|
|
23 |
frequency_penalty=0,
|
24 |
presence_penalty=0
|
25 |
)
|
26 |
+
print(f"Model : {response.model}")
|
27 |
return response.choices[0].message.content
|
28 |
# Call the LLM and store its output
|
29 |
def call_llm_and_cleanup(user_input, inventory = False):
|
|
|
35 |
llm_output = load_llm(user_input, prompt_instructions)
|
36 |
llm_output = "".join(llm_output)
|
37 |
print(llm_output)
|
38 |
+
llm_output = convert_to_dict(llm_output)
|
39 |
gc.collect()
|
40 |
# llm_output is still available for use here
|
41 |
return llm_output
|
|
|
105 |
|
106 |
store_description = {
|
107 |
"store_name": "",
|
108 |
+
"store_description": "",
|
109 |
+
"store_reputation": "",
|
110 |
+
"store_backstory": "",
|
111 |
+
"storefront_sd_prompt": "",
|
112 |
+
"store_type": "",
|
113 |
+
"store_size": "",
|
114 |
+
"store_hours": "",
|
115 |
+
"store_location": {
|
116 |
"town": "",
|
117 |
"district": "",
|
118 |
"street": ""
|
119 |
+
},
|
120 |
+
"store_owners": [
|
|
|
|
|
|
|
121 |
{
|
122 |
"name": "",
|
123 |
"species": "",
|
|
|
128 |
"sd_prompt":""
|
129 |
}
|
130 |
],
|
131 |
+
"store_employees": [
|
132 |
{
|
133 |
"name": "",
|
134 |
"role": "",
|
|
|
139 |
}
|
140 |
],
|
141 |
|
142 |
+
"store_quests": [
|
143 |
{
|
144 |
"name": "",
|
145 |
"description": "",
|
|
|
147 |
}
|
148 |
],
|
149 |
|
150 |
+
"store_customers": [
|
151 |
{
|
152 |
"name": "",
|
153 |
"description": "",
|
154 |
"influence": ""
|
155 |
}
|
156 |
],
|
157 |
+
"store_rumors": [],
|
158 |
+
"store_security": [
|
159 |
{
|
160 |
"name": "",
|
161 |
"description": "",
|
162 |
+
"mechanics": ""
|
163 |
}
|
164 |
],
|
165 |
+
|
166 |
+
"store_services": [
|
167 |
{
|
168 |
"name": "",
|
169 |
"description": "",
|
170 |
"price": ""
|
171 |
}
|
172 |
],
|
173 |
+
"store_specialties": [
|
174 |
{
|
175 |
"name": "",
|
176 |
"description": "",
|
|
|
257 |
}
|
258 |
]
|
259 |
}
|
260 |
+
}
|
261 |
+
|
template.html
ADDED
@@ -0,0 +1,581 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<link href="./dependencies/all.css" rel="stylesheet" />
|
7 |
+
<link href="./dependencies/css.css?family=Open+Sans:400,300,600,700" rel="stylesheet" type="text/css" />
|
8 |
+
<link href='./dependencies/bundle.css' rel='stylesheet' />
|
9 |
+
<link href="./dependencies/style.css" rel='stylesheet' />
|
10 |
+
<link href="./dependencies/5ePHBstyle.css" rel='stylesheet' />
|
11 |
+
<title>Template</title>
|
12 |
+
<link rel="stylesheet" href="styles.css">
|
13 |
+
<script src="https://unpkg.com/[email protected]/dist/htmx.min.js"></script>
|
14 |
+
</head>
|
15 |
+
<style>
|
16 |
+
:root {
|
17 |
+
--HB_Color_Background: #EEE5CE;
|
18 |
+
--HB_Color_Accent: #E0E5C1;
|
19 |
+
--HB_Color_HeaderUnderline: #C0AD6A;
|
20 |
+
--HB_Color_HorizontalRule: #9C2B1B;
|
21 |
+
--HB_Color_HeaderText: #58180D;
|
22 |
+
--HB_Color_MonsterStatBackground: #F2E5B5;
|
23 |
+
--HB_Color_CaptionText: #766649;
|
24 |
+
--HB_Color_WatercolorStain: #BBAD82;
|
25 |
+
--HB_Color_Footnotes: #C9AD6A;
|
26 |
+
}
|
27 |
+
input[type="text"], textarea {
|
28 |
+
width: auto;
|
29 |
+
padding: 8px;
|
30 |
+
margin: 5px 0;
|
31 |
+
border: 1px solid #ccc;
|
32 |
+
border-radius: 4px;
|
33 |
+
font-size: 14px;
|
34 |
+
background-color: #f9f9f9;
|
35 |
+
transition: background-color 0.3s ease, border-color 0.3s ease;
|
36 |
+
}
|
37 |
+
.grid-container {
|
38 |
+
display: grid;
|
39 |
+
grid-template-columns: 1fr 3fr; /* Two columns with the second column being three times as wide */
|
40 |
+
grid-gap: 20px;
|
41 |
+
padding: 20px;
|
42 |
+
height: 100vh;
|
43 |
+
}
|
44 |
+
.block-container {
|
45 |
+
display: flex;
|
46 |
+
flex-direction: column;
|
47 |
+
gap: 20px;
|
48 |
+
overflow-y: auto;
|
49 |
+
border-right: 1px solid #ccc;
|
50 |
+
padding-right: 20px;
|
51 |
+
}
|
52 |
+
.block-item {
|
53 |
+
border: 1px solid #ccc;
|
54 |
+
border-radius: 8px;
|
55 |
+
background-color: #f9f9f9;
|
56 |
+
padding: 15px;
|
57 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
58 |
+
transition: transform 0.3s;
|
59 |
+
}
|
60 |
+
.block-item:hover {
|
61 |
+
transform: translateY(-5px);
|
62 |
+
}
|
63 |
+
.page .monster hr:last-of-type + * {
|
64 |
+
margin-top: .1cm;
|
65 |
+
}
|
66 |
+
.page * + h4 {
|
67 |
+
margin-top: .1cm;
|
68 |
+
}
|
69 |
+
.page h4 + * {
|
70 |
+
margin-top: .1cm;
|
71 |
+
}
|
72 |
+
.page dl + * {
|
73 |
+
margin-top: .1cm;
|
74 |
+
}
|
75 |
+
.page p + * {
|
76 |
+
margin-top: .1cm;
|
77 |
+
}
|
78 |
+
.columnWrapper {
|
79 |
+
column-gap: inherit;
|
80 |
+
max-height: 100%;
|
81 |
+
column-span: all;
|
82 |
+
columns: inherit;
|
83 |
+
height: 100%; /* Ensure it takes full height of the parent */
|
84 |
+
box-sizing: border-box; /* Ensures padding and border are included in the element's total width and height */
|
85 |
+
}
|
86 |
+
input[type="text"]:focus, textarea:focus {
|
87 |
+
background-color: #e9e9e9;
|
88 |
+
border-color: #aaa;
|
89 |
+
outline: none;
|
90 |
+
}
|
91 |
+
|
92 |
+
/* Specific styles for different textboxes */
|
93 |
+
|
94 |
+
.user-description-textarea {
|
95 |
+
width: 400px;
|
96 |
+
height: 40px; /* Adjust as needed for 3 lines */
|
97 |
+
resize: vertical;
|
98 |
+
background: none;
|
99 |
+
font-family: "ScalySansRemake";
|
100 |
+
font-weight: 800;
|
101 |
+
|
102 |
+
}
|
103 |
+
/* Focus styles for description textbox */
|
104 |
+
.user-description-textarea:focus {
|
105 |
+
background-color: #e9e9e9;
|
106 |
+
border-color: #aaa;
|
107 |
+
outline: none;
|
108 |
+
}
|
109 |
+
|
110 |
+
.heading-textarea {
|
111 |
+
width: 100%;
|
112 |
+
font-size: .458cm; /* Matches the font size of an h4 heading */
|
113 |
+
line-height: .7em;
|
114 |
+
font-weight: 800;
|
115 |
+
border: none;
|
116 |
+
background: none;
|
117 |
+
margin: 0;
|
118 |
+
padding: 0;
|
119 |
+
resize: none; /* Prevents the textarea from being resizable */
|
120 |
+
overflow: hidden; /* Prevents scrollbars */
|
121 |
+
outline: none; /* Removes the focus outline */
|
122 |
+
font-family: "MrEavesRemake"; /* Ensures font family is inherited */
|
123 |
+
color: var(--HB_Color_HeaderText)
|
124 |
+
}
|
125 |
+
.properties-textarea {
|
126 |
+
width: 100%;
|
127 |
+
font-size: 12px;
|
128 |
+
font-weight: 400;
|
129 |
+
line-height: .7em;
|
130 |
+
margin-bottom: 0;
|
131 |
+
font-style: italic;
|
132 |
+
box-sizing: border-box;
|
133 |
+
border: 0;
|
134 |
+
font-family: "ScalySansRemake";
|
135 |
+
vertical-align: baseline;
|
136 |
+
margin: 0;
|
137 |
+
padding: 0;
|
138 |
+
overflow-wrap: break-word;
|
139 |
+
text-rendering: optimizeLegibility;
|
140 |
+
background: none;
|
141 |
+
resize: none; /* Prevents the textarea from being resizable */
|
142 |
+
|
143 |
+
}
|
144 |
+
|
145 |
+
.description-textarea {
|
146 |
+
width: 100%;
|
147 |
+
height: 125px;
|
148 |
+
font-size: .318cm;
|
149 |
+
font-weight: 400;
|
150 |
+
line-height: .9em;
|
151 |
+
margin-bottom: 0;
|
152 |
+
font-style: italic;
|
153 |
+
box-sizing: border-box;
|
154 |
+
border: 0;
|
155 |
+
font-family: "ScalySansSmallCapsRemake";
|
156 |
+
vertical-align: baseline;
|
157 |
+
margin: 0;
|
158 |
+
padding: 0;
|
159 |
+
overflow-wrap: break-word;
|
160 |
+
text-rendering: optimizeLegibility;
|
161 |
+
background: none;
|
162 |
+
resize: none; /* Prevents the textarea from being manually resizable */
|
163 |
+
overflow: hidden; /* Hide scrollbars */
|
164 |
+
}
|
165 |
+
|
166 |
+
.red-integer-stat-textarea {
|
167 |
+
width: 20px;
|
168 |
+
height:13px;
|
169 |
+
font-size: .318cm;
|
170 |
+
font-weight: 400;
|
171 |
+
line-height: 1.2em;
|
172 |
+
margin-bottom: 0;
|
173 |
+
font-style: italic;
|
174 |
+
box-sizing: border-box;
|
175 |
+
border: 0;
|
176 |
+
font-family: "ScalySansSmallCapsRemake";
|
177 |
+
vertical-align: baseline;
|
178 |
+
margin: 0;
|
179 |
+
padding: 0;
|
180 |
+
overflow-wrap: break-word;
|
181 |
+
text-rendering: optimizeLegibility;
|
182 |
+
background: none;
|
183 |
+
resize: none; /* Prevents the textarea from being manually resizable */
|
184 |
+
overflow: hidden; /* Hide scrollbars */
|
185 |
+
color: var(--HB_Color_HeaderText);
|
186 |
+
white-space: pre-line;
|
187 |
+
}
|
188 |
+
|
189 |
+
.integer-stat-textarea {
|
190 |
+
width: 20px;
|
191 |
+
height:13px;
|
192 |
+
font-size: .318cm;
|
193 |
+
font-weight: 400;
|
194 |
+
line-height: 1.2em;
|
195 |
+
margin-bottom: 0;
|
196 |
+
font-style: italic;
|
197 |
+
box-sizing: border-box;
|
198 |
+
border: 0;
|
199 |
+
font-family: "ScalySansRemake";
|
200 |
+
vertical-align: baseline;
|
201 |
+
margin: 0;
|
202 |
+
padding: 0;
|
203 |
+
overflow-wrap: break-word;
|
204 |
+
text-rendering: optimizeLegibility;
|
205 |
+
background: none;
|
206 |
+
resize: none; /* Prevents the textarea from being manually resizable */
|
207 |
+
overflow: hidden; /* Hide scrollbars */
|
208 |
+
white-space: pre-line;
|
209 |
+
}
|
210 |
+
|
211 |
+
.string-stat-textarea {
|
212 |
+
width: 200px;
|
213 |
+
height:13px;
|
214 |
+
font-size: .318cm;
|
215 |
+
font-weight: 400;
|
216 |
+
line-height: 1.2em;
|
217 |
+
margin-bottom: 0;
|
218 |
+
font-style: italic;
|
219 |
+
box-sizing: border-box;
|
220 |
+
border: 0;
|
221 |
+
font-family: "ScalySansRemake";
|
222 |
+
vertical-align: baseline;
|
223 |
+
margin: 0;
|
224 |
+
padding: 0;
|
225 |
+
overflow-wrap: break-word;
|
226 |
+
text-rendering: optimizeLegibility;
|
227 |
+
background: none;
|
228 |
+
resize: none; /* Prevents the textarea from being manually resizable */
|
229 |
+
overflow: hidden; /* Hide scrollbars */
|
230 |
+
white-space: pre-wrap;
|
231 |
+
}
|
232 |
+
|
233 |
+
.string-action-name-textarea {
|
234 |
+
width: 100%;
|
235 |
+
height:13px;
|
236 |
+
font-size: .318cm;
|
237 |
+
font-style: italic;
|
238 |
+
font-weight: bold;
|
239 |
+
line-height: 1.2em;
|
240 |
+
margin-bottom: 0;
|
241 |
+
font-style: italic;
|
242 |
+
box-sizing: border-box;
|
243 |
+
border: 0;
|
244 |
+
font-family: "ScalySansRemake";
|
245 |
+
vertical-align: baseline;
|
246 |
+
margin: 0;
|
247 |
+
padding: 0;
|
248 |
+
overflow-wrap: break-word;
|
249 |
+
text-rendering: optimizeLegibility;
|
250 |
+
background: none;
|
251 |
+
resize: none; /* Prevents the textarea from being manually resizable */
|
252 |
+
overflow: hidden; /* Hide scrollbars */
|
253 |
+
|
254 |
+
}
|
255 |
+
|
256 |
+
.string-action-description-textarea {
|
257 |
+
width: 100%;
|
258 |
+
height:30px;
|
259 |
+
font-size: .318cm;
|
260 |
+
font-weight: 400;
|
261 |
+
line-height: 1.2em;
|
262 |
+
margin-bottom: 0;
|
263 |
+
box-sizing: border-box;
|
264 |
+
border: 0;
|
265 |
+
font-family: "ScalySansRemake";
|
266 |
+
vertical-align: baseline;
|
267 |
+
margin: 0;
|
268 |
+
padding: 0;
|
269 |
+
overflow-wrap: break-word;
|
270 |
+
text-rendering: optimizeLegibility;
|
271 |
+
background: none;
|
272 |
+
resize: none; /* Prevents the textarea from being manually resizable */
|
273 |
+
overflow: hidden; /* Hide scrollbars */
|
274 |
+
white-space: pre-wrap;
|
275 |
+
|
276 |
+
|
277 |
+
}
|
278 |
+
|
279 |
+
.name-textbox {
|
280 |
+
width: 50px;
|
281 |
+
font-size: 1.5em;
|
282 |
+
padding: 10px;
|
283 |
+
}
|
284 |
+
|
285 |
+
.stat-textbox {
|
286 |
+
width: 50px;
|
287 |
+
text-align: center;
|
288 |
+
font-size: 1em;
|
289 |
+
padding: 5px;
|
290 |
+
}
|
291 |
+
</style>
|
292 |
+
<body>
|
293 |
+
<div class="brewRenderer">
|
294 |
+
<div class="pages">
|
295 |
+
<div class="page" id="p1" key="0">
|
296 |
+
<div class="columnWrapper">
|
297 |
+
<div class="block monster frame wide">
|
298 |
+
<div class="Block_1">
|
299 |
+
<textarea class="heading-textarea" id="user-monster-name" hx-post="/update-stats" hx-trigger="change" hx-target="#user-monster-name" hx-swap="outerHTML" title=" Name of creature">Ebony, the Twisted Fairy</textarea>
|
300 |
+
</div>
|
301 |
+
<div class="Block_2">
|
302 |
+
<p>
|
303 |
+
<textarea class="properties-textarea" id="user-monster-properties" hx-post="/update-stats" hx-trigger="change"
|
304 |
+
hx-target="#user-monster-properties" hx-swap="outerHTML" title=" Size, Type, Alignment">Tiny, Fey, Chaotic Evil</textarea>
|
305 |
+
</p>
|
306 |
+
</div>
|
307 |
+
<div class="Block_3">
|
308 |
+
<p>
|
309 |
+
<img class="monster-image" id="monster-image" style="width:300px; height:300px; mix-blend-mode:multiply; border:3px solid black;"
|
310 |
+
src="Ebony,%20the%20Twisted%20Fairy_files/out.png" alt="image"
|
311 |
+
hx-get="/get-new-image" hx-trigger="load" hx-target="#monster-image" hx-swap="outerHTML">
|
312 |
+
</p>
|
313 |
+
</div>
|
314 |
+
<div class="Block_4">
|
315 |
+
<div class="block descriptive">
|
316 |
+
<textarea class="description-textarea" id="user-monster-description" hx-post="/update-stats" hx-trigger="change"
|
317 |
+
hx-target="#user-monster-description" hx-swap="outerHTML" title="Any amount or style of description">Once a cheerful and benign spirit of the forest, Ebony has been corrupted by dark magic, transforming her into a sinister force of malevolence. Despite her tiny stature, her powers have grown exponentially. Her once fairy-like aura now radiates dread, and she is capable of casting deadly spells that can reduce any foe to dust. Ebony delights in tormenting the innocent and disrupting the natural balance of the world.</textarea></h5>
|
318 |
+
</div>
|
319 |
+
</div>
|
320 |
+
<div class="Block_5"><hr>
|
321 |
+
<dl><strong>Armor Class : </strong><textarea class="integer-stat-textarea" id="user-monster-armor-class" hx-post="/update-stats" hx-trigger="change"
|
322 |
+
hx-target="#user-monster-armor-class" hx-swap="outerHTML" title="Integer">14</textarea>
|
323 |
+
<strong>Hit Points : </strong><textarea class="integer-stat-textarea" id="user-monster-hit-points" hx-post="/update-stats" hx-trigger="change"
|
324 |
+
hx-target="#user-monster-hit-points" hx-swap="outerHTML" title="Integer">75</textarea>
|
325 |
+
<strong>Speed : </strong> Walk: <textarea class="integer-stat-textarea" id="user-monster-speed-walk" hx-post="/update-stats" hx-trigger="change"
|
326 |
+
hx-target="#user-monster-speed" hx-swap="outerHTML" title="Integer">10</textarea> Fly :<textarea class="integer-stat-textarea" id="user-monster-speed-fly" hx-post="/update-stats" hx-trigger="change"
|
327 |
+
hx-target="#user-monster-speed" hx-swap="outerHTML" title="Integer">60</textarea>
|
328 |
+
</dl>
|
329 |
+
</div>
|
330 |
+
<div class="Block_6"><hr>
|
331 |
+
<table>
|
332 |
+
<thead>
|
333 |
+
<tr>
|
334 |
+
<th align="center">STR</th>
|
335 |
+
<th align="center">DEX</th>
|
336 |
+
<th align="center">CON</th>
|
337 |
+
<th align="center">INT</th>
|
338 |
+
<th align="center">WIS</th>
|
339 |
+
<th align="center">CHA</th>
|
340 |
+
</tr>
|
341 |
+
</thead>
|
342 |
+
<tbody>
|
343 |
+
<tr>
|
344 |
+
<td align="center"><textarea class="red-integer-stat-textarea" id="user-monster-strength" hx-post="/update-stats" hx-trigger="change"
|
345 |
+
hx-target="#user-monster-strength" hx-swap="outerHTML" title="Integer">5</textarea></td>
|
346 |
+
<td align="center"><textarea class="red-integer-stat-textarea" id="user-monster-dexterity" hx-post="/update-stats" hx-trigger="change"
|
347 |
+
hx-target="#user-monster-dexterity" hx-swap="outerHTML" title="Integer">18</textarea></td>
|
348 |
+
<td align="center"><textarea class="red-integer-stat-textarea" id="user-monster-constitution" hx-post="/update-stats" hx-trigger="change"
|
349 |
+
hx-target="#user-monster-constitution" hx-swap="outerHTML" title="Integer">14</textarea></td>
|
350 |
+
<td align="center"><textarea class="red-integer-stat-textarea" id="user-monster-intellgience" hx-post="/update-stats" hx-trigger="change"
|
351 |
+
hx-target="#user-monster-intelligence" hx-swap="outerHTML" title="Integer">16</textarea></td>
|
352 |
+
<td align="center"><textarea class="red-integer-stat-textarea" id="user-monster-wisdom" hx-post="/update-stats" hx-trigger="change"
|
353 |
+
hx-target="#user-monster-wisdom" hx-swap="outerHTML" title="Integer">12</textarea></td>
|
354 |
+
<td align="center"><textarea class="red-integer-stat-textarea" id="user-monster-charisma" hx-post="/update-stats" hx-trigger="change"
|
355 |
+
hx-target="#user-monster-charisma" hx-swap="outerHTML" title="Integer">20</textarea></td>
|
356 |
+
</tr>
|
357 |
+
</tbody>
|
358 |
+
</table>
|
359 |
+
</div>
|
360 |
+
<div class="Block_7">
|
361 |
+
<hr>
|
362 |
+
<strong>Saving Throws</strong>
|
363 |
+
<textarea class="string-stat-textarea" id="user-monster-saves" hx-post="/update-stats" hx-trigger="change"
|
364 |
+
hx-target="#user-monster-saves" hx-swap="outerHTML" title="[Stat colon integer 2x space] STR: 2 DEX: 7">STR: 2 DEX: 7 WIS: 5</textarea>
|
365 |
+
<br><strong>Resistances :</strong> <textarea class="string-stat-textarea" id="user-monster-wis-save" hx-post="/update-stats" hx-trigger="change"
|
366 |
+
hx-target="#user-monster-wis-save" hx-swap="outerHTML" title="Integer">None</textarea>
|
367 |
+
<br><strong>Senses :</strong><textarea class="string-stat-textarea" id="user-monster-senses" hx-post="/update-stats" hx-trigger="change"
|
368 |
+
hx-target="#user-monster-senses" hx-swap="outerHTML" title="[Sense colon integer] Darkvision: 60">Darkvision: 60</textarea>
|
369 |
+
<br><strong>Languages :</strong><textarea class="string-stat-textarea" id="user-monster-languages" hx-post="/update-stats" hx-trigger="change"
|
370 |
+
hx-target="#user-monster-languages" hx-swap="outerHTML" title="[language comma space] Common, Sylvan">Common, Sylvan</textarea>
|
371 |
+
<br><strong>Challenge Rating :</strong><textarea class="string-stat-textarea" id="user-monster-languages" hx-post="/update-stats" hx-trigger="change"
|
372 |
+
hx-target="#user-monster-cr" hx-swap="outerHTML" title="[CR space parenthesis XP parenthesis] 6 (2300)">6 (2300)</textarea>
|
373 |
+
</div>
|
374 |
+
<div class="Block_8">
|
375 |
+
<hr>
|
376 |
+
<h4 id="actions">Actions</h4>
|
377 |
+
<strong>
|
378 |
+
<textarea class="string-action-name-textarea"
|
379 |
+
id="user-monster-action_name_1"
|
380 |
+
hx-post="/update-stats"
|
381 |
+
hx-trigger="change"
|
382 |
+
hx-target="#user-monster-action_name_1"
|
383 |
+
hx-swap="outerHTML"
|
384 |
+
title="[Action Name colon] Fairy Bolt:">Fairy Bolt: </textarea>
|
385 |
+
</strong>
|
386 |
+
<textarea class="string-action-description-textarea"
|
387 |
+
id="user-monster-action_details_1"
|
388 |
+
hx-post="/update-stats"
|
389 |
+
hx-trigger="change"
|
390 |
+
hx-target="#user-monster-action_details_1"
|
391 |
+
hx-swap="outerHTML"
|
392 |
+
title="[Action Type colon to hit bonus comma range comma number of targets space Hit colon damage parenthesis damage dice parenthesis damage type] Ranged Spell Attack: +7 to hit, range 60 ft., one target. Hit: 21 (3d10 + 4) radiant damage.">Ranged Spell Attack: +7 to hit, range 60 ft., one target. Hit: 21 (3d10 + 4) radiant damage.</textarea>
|
393 |
+
<strong>
|
394 |
+
<textarea class="string-action-name-textarea"
|
395 |
+
id="user-monster-action_name_2"
|
396 |
+
hx-post="/update-stats" hx-trigger="change"
|
397 |
+
hx-target="#user-monster-action_name_2"
|
398 |
+
hx-swap="outerHTML"
|
399 |
+
title="[Action Name colon] Fairy Bolt:">Poison Dust: </textarea>
|
400 |
+
</strong>
|
401 |
+
<textarea class="string-action-description-textarea"
|
402 |
+
id="user-monster-action_details_1"
|
403 |
+
hx-post="/update-stats"
|
404 |
+
hx-trigger="change"
|
405 |
+
hx-target="#user-monster-action_details_1"
|
406 |
+
hx-swap="outerHTML"
|
407 |
+
title="[Action Type colon to hit bonus comma range comma number of targets space Hit colon damage parenthesis damage dice parenthesis damage type] Ranged Spell Attack: +7 to hit, range 60 ft., one target. Hit: 21 (3d10 + 4) radiant damage.">Ebony releases a cloud of toxic dust in a 10-foot radius. Each creature within the area must succeed on a DC 15 Constitution saving throw or take 15 (3d8) poison damage and become poisoned for 1 minute. The poisoned creature can repeat the saving throw at the end of each of its turns, ending the effect on itself on a success.</textarea>
|
408 |
+
</div>
|
409 |
+
<div class="Block_9">
|
410 |
+
<h4 id="cantrips">Cantrips</h4>
|
411 |
+
<strong>
|
412 |
+
<textarea class="string-action-name-textarea"
|
413 |
+
id="user-monster-action_name_2"
|
414 |
+
hx-post="/update-stats" hx-trigger="change"
|
415 |
+
hx-target="#user-monster-action_name_2"
|
416 |
+
hx-swap="outerHTML"
|
417 |
+
title="[Action Name colon] Fairy Bolt:">Eldritch Blast: </textarea>
|
418 |
+
</strong>
|
419 |
+
<textarea class="string-action-description-textarea"
|
420 |
+
id="user-monster-action_details_1"
|
421 |
+
hx-post="/update-stats"
|
422 |
+
hx-trigger="change"
|
423 |
+
hx-target="#user-monster-action_details_1"
|
424 |
+
hx-swap="outerHTML"
|
425 |
+
title="[Action description range mechanics effect] Ranged Spell Attack: +7 to hit, range 60 ft., one target. Hit: 21 (3d10 + 4) radiant damage.">A beam of crackling energy streaks toward a creature within range. Make a ranged spell attack against the target. On a hit, the target takes 1d10 force damage.</textarea>
|
426 |
+
</div>
|
427 |
+
<div class="Block_10">
|
428 |
+
<h4 id="spell slots">Spell Slots</h4>
|
429 |
+
<dl><dt><em><strong>1st level</strong></em>:</dt><dd><textarea class="integer-stat-textarea" id="level-1-slots" hx-post="/update-stats" hx-trigger="change"
|
430 |
+
hx-target="#user-monster-armor-class" hx-swap="outerHTML" title="Integer">4</textarea></dd></dl>
|
431 |
+
<dl><dt><em><strong>2nd level</strong></em>:</dt><dd><textarea class="integer-stat-textarea" id="level-2-slots" hx-post="/update-stats" hx-trigger="change"
|
432 |
+
hx-target="#user-monster-armor-class" hx-swap="outerHTML" title="Integer">4</textarea></dd></dl>
|
433 |
+
<dl><dt><em><strong>3rd level</strong></em>:</dt><dd><textarea class="integer-stat-textarea" id="level-3-slots" hx-post="/update-stats" hx-trigger="change"
|
434 |
+
hx-target="#user-monster-armor-class" hx-swap="outerHTML" title="Integer">4</textarea></dd></dl>
|
435 |
+
<h4 id="known spells">Known Spells</h4>
|
436 |
+
<strong>
|
437 |
+
<textarea class="string-action-name-textarea"
|
438 |
+
id="user-monster-action_name_2"
|
439 |
+
hx-post="/update-stats" hx-trigger="change"
|
440 |
+
hx-target="#user-monster-action_name_2"
|
441 |
+
hx-swap="outerHTML"
|
442 |
+
title="[Action Name colon] Fairy Bolt:">Charm Person: </textarea>
|
443 |
+
</strong>
|
444 |
+
<textarea class="string-action-description-textarea"
|
445 |
+
id="user-monster-action_details_1"
|
446 |
+
hx-post="/update-stats"
|
447 |
+
hx-trigger="change"
|
448 |
+
hx-target="#user-monster-action_details_1"
|
449 |
+
hx-swap="outerHTML"
|
450 |
+
title="[Level colon description range mechanics effect] Level: 2nd. A creature you touch becomes invisible until the spell ends. Anything the target is wearing or carrying is invisible as long as it is on the target's person..">Level: 1st. You attempt to charm a humanoid you can see within range. It must make a Wisdom saving throw, and does so with advantage if you or your companions are fighting it. If it fails the saving throw, it is charmed by you until the spell ends or until you or your companions do anything harmful to it.</textarea>
|
451 |
+
<strong>
|
452 |
+
<textarea class="string-action-name-textarea"
|
453 |
+
id="user-monster-action_name_2"
|
454 |
+
hx-post="/update-stats" hx-trigger="change"
|
455 |
+
hx-target="#user-monster-action_name_2"
|
456 |
+
hx-swap="outerHTML"
|
457 |
+
title="[Action Name colon] Fairy Bolt:">Invisibility: </textarea>
|
458 |
+
</strong>
|
459 |
+
<textarea class="string-action-description-textarea"
|
460 |
+
id="user-monster-action_details_1"
|
461 |
+
hx-post="/update-stats"
|
462 |
+
hx-trigger="change"
|
463 |
+
hx-target="#user-monster-action_details_1"
|
464 |
+
hx-swap="outerHTML"
|
465 |
+
title="[Level colon description range mechanics effect] Level: 2nd. A creature you touch becomes invisible until the spell ends. Anything the target is wearing or carrying is invisible as long as it is on the target's person.">Level: 2nd. A creature you touch becomes invisible until the spell ends. Anything the target is wearing or carrying is invisible as long as it is on the target's person.</textarea>
|
466 |
+
<strong>
|
467 |
+
<textarea class="string-action-name-textarea"
|
468 |
+
id="user-monster-action_name_2"
|
469 |
+
hx-post="/update-stats" hx-trigger="change"
|
470 |
+
hx-target="#user-monster-action_name_2"
|
471 |
+
hx-swap="outerHTML"
|
472 |
+
title="[Action Name colon] Fairy Bolt:">Fireball: </textarea>
|
473 |
+
</strong>
|
474 |
+
<textarea class="string-action-description-textarea"
|
475 |
+
id="user-monster-action_details_1"
|
476 |
+
hx-post="/update-stats"
|
477 |
+
hx-trigger="change"
|
478 |
+
hx-target="#user-monster-action_details_1"
|
479 |
+
hx-swap="outerHTML"
|
480 |
+
title="[Level colon description range mechanics effect] Level: 2nd. A creature you touch becomes invisible until the spell ends. Anything the target is wearing or carrying is invisible as long as it is on the target's person.">Level: 3rd. A bright streak flashes from your pointing finger to a point you choose within range and then blossoms with a low roar into an explosion of flame. Each creature in a 20-foot radius sphere centered on that point must make a Dexterity saving throw. A target takes 8d6 fire damage on a failed save, or half as much damage on a successful one.</textarea>
|
481 |
+
</div>
|
482 |
+
<div class="Block_9">
|
483 |
+
<h4 id="legendary actions">Legendary Actions</h4>
|
484 |
+
<textarea class="string-action-description-textarea"
|
485 |
+
id="user-monster-action_details_1"
|
486 |
+
hx-post="/update-stats"
|
487 |
+
hx-trigger="change"
|
488 |
+
hx-target="#user-monster-action_details_1"
|
489 |
+
hx-swap="outerHTML"
|
490 |
+
title="[Number of legendary actions period How many actions per turn and when to play period Action regain rules] Ebony can take 3 legendary actions, choosing from the options below. Only one legendary action can be used at a time and only at the end of another creature's turn. Ebony regains spent legendary actions at the start of her turn.">Ebony can take 3 legendary actions, choosing from the options below. Only one legendary action can be used at a time and only at the end of another creature's turn. Ebony regains spent legendary actions at the start of her turn.</textarea>
|
491 |
+
<strong>
|
492 |
+
<textarea class="string-action-name-textarea"
|
493 |
+
id="user-monster-action_name_2"
|
494 |
+
hx-post="/update-stats" hx-trigger="change"
|
495 |
+
hx-target="#user-monster-action_name_2"
|
496 |
+
hx-swap="outerHTML"
|
497 |
+
title="[Action Name colon] Fairy Bolt:">Dark Whispers: </textarea>
|
498 |
+
</strong>
|
499 |
+
<textarea class="string-action-description-textarea"
|
500 |
+
id="user-monster-action_details_1"
|
501 |
+
hx-post="/update-stats"
|
502 |
+
hx-trigger="change"
|
503 |
+
hx-target="#user-monster-action_details_1"
|
504 |
+
hx-swap="outerHTML"
|
505 |
+
title="[Level colon description range mechanics effect] Level: 2nd. A creature you touch becomes invisible until the spell ends. Anything the target is wearing or carrying is invisible as long as it is on the target's person.">Ebony whispers insidiously to a target within 30 feet. The target must succeed on a DC 16 Wisdom saving throw or take 10 (3d6) psychic damage and become frightened until the end of its next turn.</textarea>
|
506 |
+
<strong>
|
507 |
+
<textarea class="string-action-name-textarea"
|
508 |
+
id="user-monster-action_name_2"
|
509 |
+
hx-post="/update-stats" hx-trigger="change"
|
510 |
+
hx-target="#user-monster-action_name_2"
|
511 |
+
hx-swap="outerHTML"
|
512 |
+
title="[Action Name colon] Fairy Bolt:">Teleport: </textarea>
|
513 |
+
</strong>
|
514 |
+
<textarea class="string-action-description-textarea"
|
515 |
+
id="user-monster-action_details_1"
|
516 |
+
hx-post="/update-stats"
|
517 |
+
hx-trigger="change"
|
518 |
+
hx-target="#user-monster-action_details_1"
|
519 |
+
hx-swap="outerHTML"
|
520 |
+
title="[Level colon description range mechanics effect] Level: 2nd. A creature you touch becomes invisible until the spell ends. Anything the target is wearing or carrying is invisible as long as it is on the target's person.">Ebony magically teleports, along with any equipment she is wearing or carrying, up to 60 feet to an unoccupied space she can see.</textarea>
|
521 |
+
<strong>
|
522 |
+
<textarea class="string-action-name-textarea"
|
523 |
+
id="user-monster-action_name_2"
|
524 |
+
hx-post="/update-stats" hx-trigger="change"
|
525 |
+
hx-target="#user-monster-action_name_2"
|
526 |
+
hx-swap="outerHTML"
|
527 |
+
title="[Action Name colon] Fairy Bolt:">Fairy Glow: </textarea>
|
528 |
+
</strong>
|
529 |
+
<textarea class="string-action-description-textarea"
|
530 |
+
id="user-monster-action_details_1"
|
531 |
+
hx-post="/update-stats"
|
532 |
+
hx-trigger="change"
|
533 |
+
hx-target="#user-monster-action_details_1"
|
534 |
+
hx-swap="outerHTML"
|
535 |
+
title="[Level colon description range mechanics effect] Level: 2nd. A creature you touch becomes invisible until the spell ends. Anything the target is wearing or carrying is invisible as long as it is on the target's person.">Ebony emits a burst of glowing lights. Each creature of her choice within 20 feet of her must succeed on a DC 16 Dexterity saving throw or be blinded until the end of Ebony's next turn.</textarea>
|
536 |
+
</div>
|
537 |
+
</div>
|
538 |
+
</div>
|
539 |
+
</div>
|
540 |
+
</div>
|
541 |
+
</div>
|
542 |
+
|
543 |
+
<script>
|
544 |
+
document.addEventListener("DOMContentLoaded", function() {
|
545 |
+
function adjustTextareaHeight(el) {
|
546 |
+
console.log('Start height:', el.scrollHeight);
|
547 |
+
if (el.scrollHeight > 16) {
|
548 |
+
el.style.height = 'auto'; // Reset the height
|
549 |
+
console.log('Auto height:', el.scrollHeight);
|
550 |
+
console.log('Adjusting height for:', el.id); // Debugging line
|
551 |
+
el.style.height = (el.scrollHeight) + 'px'; // Set it to the scroll height
|
552 |
+
console.log('New height:', el.style.height);
|
553 |
+
}
|
554 |
+
}
|
555 |
+
|
556 |
+
const classes = [
|
557 |
+
'description-textarea',
|
558 |
+
'user-description-textarea',
|
559 |
+
'heading-textarea',
|
560 |
+
'properties-textarea',
|
561 |
+
'string-stat-textarea',
|
562 |
+
'string-action-description-textarea'
|
563 |
+
];
|
564 |
+
|
565 |
+
classes.forEach(className => {
|
566 |
+
const textareas = document.querySelectorAll(`.${className}`);
|
567 |
+
console.log(`Textareas found for ${className}:`, textareas.length); // Debugging line
|
568 |
+
textareas.forEach(textarea => {
|
569 |
+
// Adjust height on page load
|
570 |
+
adjustTextareaHeight(textarea);
|
571 |
+
// Adjust height on input
|
572 |
+
textarea.addEventListener('input', function() {
|
573 |
+
adjustTextareaHeight(textarea);
|
574 |
+
console.log('Input event triggered for:', textarea.id); // Debugging line
|
575 |
+
});
|
576 |
+
});
|
577 |
+
});
|
578 |
+
});
|
579 |
+
</script>
|
580 |
+
</body>
|
581 |
+
</html>
|