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
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
import re, fileinput, sys
import utilities as u
import os


def list_names_to_str(data):  
        list_of_names = []
        for i in data:
            list_of_names.append(i['name'])
        str_of_names = ', '.join(list_of_names)
        return str_of_names

def list_to_str(list):  
        str_of_list = ', '.join(list)
        return str_of_list
def build_owners_section(owners_list):
    owner_s = 'Owner'
    if len(owners_list) > 1 :
        owner_s = 'Owners'
    owner_section_html = f"""<h2 id="owner">{owner_s}</h2> """
    # iterating through list of owners, each is a dictionary with descriptive qualities
    for owner in range(len(owners_list)) :
        secrets = '<br> '.join(owners_list[owner - 1]['secrets'])
        owner_section_html += f"""

                            <h3 id="owner_{owner}">{owners_list[owner - 1]['name']}</h3>

                            <table>

                                <thead>

                                    <tr>

                                        <th align="center"></th>

                                        <th align="center"></th>

                                    </tr>

                                </thead>

                                <tbody>

                                    <tr>

                                        <td align="center"><strong>Species</strong></td>

                                        <td align="right">{owners_list[owner - 1]['species']}</td>

                                    </tr>

                                    <tr>

                                        <td align="center"><strong>Class</strong></td>

                                        <td align="right">{owners_list[owner - 1]['class']}</td>

                                    </tr>

                                    <tr>

                                        <td align="center"><strong>Description</strong></td>

                                        <td align="left">{owners_list[owner - 1]['description']}.</td>

                                    </tr>

                                    <tr>

                                        <td align="center"><strong>Personality</strong></td>

                                        <td align="left">{owners_list[owner - 1]['personality']}</td>

                                    </tr>

                                    <tr>

                                        <td align="center"><strong>Secrets</strong></td>

                                        <td align="left">{secrets}</td>

                                    </tr>

                                </tbody>

                            </table>

                            """
    return owner_section_html



store_image_url = ""

    
# Assigning strings to variables for replacing location of dependencies for the webpage to local static folders
# Path is ../../ for the html files location in output/dated_folder/

def build_html_base(store_dict) : 

    base_dir = os.path.dirname(os.path.abspath(__file__))
    dependencies_path = os.path.relpath(os.path.join(base_dir, "dependencies"), os.path.join(base_dir, "output", "test"))
   
        
    # Template for the page
    html_file_as_text = f"""<!DOCTYPE html>

<html>

    <head>

        <link href="{dependencies_path}/all.css" rel="stylesheet" />

        <link href="{dependencies_path}/css.css?family=Open+Sans:400,300,600,700" rel="stylesheet" type="text/css" />

        <link href="{dependencies_path}/bundle.css" rel="stylesheet" />

        <link rel="icon" href="{dependencies_path}/favicon.ico" type="image/x-icon" />

        <link href="{dependencies_path}/style.css" rel="stylesheet" />

        <link href="{dependencies_path}/5ePHBstyle.css" rel="stylesheet" />

        <title>{store_dict['store_name']}</title>

    </head>

<body>

    <div>

        <div class="brewRenderer" style="height: 692px;">  

            <div class="pages" lang="en">

                    <div class="page" id="p1">

                        <div class="columnWrapper">

                            <h1 id="store_name">{store_dict['store_name']}</h1>

                            <p>{store_dict['store_description']}</p>

                            <p>{store_dict['store_backstory']}</p>

                            <p>{store_dict['store_reputation']}</p>

                            <!-- Generated Image of Shop -->

                            <p><img class="" style="width:300px; mix-blend-mode:multiply;" src="{store_image_url}" alt="{store_dict['store_name']}"></p>

                              <div class="block classTable frame decoration">

                                <table>

                                    <thead>

                                        <tr>

                                            <th align="left"></th>

                                            <th align="center"></th>

                                            <th align="center"></th>

                                        </tr>

                                    </thead>

                                    <tbody>

                                        <tr>

                                            <td align="left"><strong>Size</strong></td>

                                            <td align="right">{store_dict['store_size']}</td>

                                        </tr>

                                        <tr>

                                            <td align="left"><strong>Town</strong></td>

                                            <td align="right">{store_dict['store_location']['town']}</td>

                                        </tr>

                                        <tr>

                                            <td align="left"><strong>District</strong></td>

                                            <td align="right">{store_dict['store_location']['district']}</td>

                                        </tr>

                                        <tr>

                                            <td align="left"><strong>Street</strong></td>

                                            <td align="right">{store_dict['store_location']['street']}</td>

                                        </tr>

                                        <tr>

                                            <td align="left"><strong>Type</strong></td>

                                            <td align="right">{store_dict['store_type']}</td>

                                        </tr>

                                        <tr>

                                            <td align="left"><strong>Owners</strong></td>

                                            <td align="right">{list_names_to_str(store_dict['store_owners'])}</td>

                                        </tr>

                                        <tr>

                                            <td align="left"><strong>Employees</strong></td>

                                            <td align="right">{list_names_to_str(store_dict['store_employees'])}</td>

                                        </tr>

                                        <tr>

                                            <td align="left"><strong>Store Hours</strong></td>

                                            <td align="right">{store_dict['store_hours']}</td>

                                        </tr>

                                        <tr>

                                            <td align="left"><strong>Services</strong></td>

                                            <td align="right">{list_names_to_str(store_dict['store_services'])}</td>

                                        </tr>

                                        <tr>

                                            <td align="left"><strong>Specialties</strong></td>

                                            <td align="right">{list_names_to_str(store_dict['store_specialties'])}</td>

                                        </tr>

                                        <tr>

                                            <td align="left"><strong>Reputation</strong></td>

                                            <td align="right">{store_dict['store_reputation']}</td>

                                        </tr>

                                        <tr>

                                            <td align="left"><strong>Rumors</strong></td>

                                            <td align="right">{list_to_str(store_dict['store_rumors'])}</td>

                                        </tr>

                                    </tbody>

                                </table>

                            </div>

                            <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>

                            {build_owners_section(store_dict['store_owners'])}

                            

                            

                            <p>&nbsp;</p>

                            <div class="columnSplit"></div>

                            <p>&nbsp;</p>

                        </div>

                    </div>

                    <div class="page" id="p2">

                        <div class="columnWrapper">

                            <div class="blank"></div>

                            <h2 id="employees">Employees</h2>

                            

                            <h3 id="brega">Brega</h3>

                            <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>



                            <table>

                                <thead>

                                    <tr>

                                        <th align="center"></th>

                                        <th align="center"></th>

                                    </tr>

                                </thead>

                                <tbody>

                                    <tr>

                                        <td align="center"><strong>Species</strong></td>

                                        <td align="center">Half-Orc</td>

                                    </tr>

                                    <tr>

                                        <td align="center"><strong>Class</strong></td>

                                        <td align="center">Assistant Butcher</td>

                                    </tr>

                                    <tr>

                                        <td align="center"><strong>Description</strong></td>

                                        <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>

                                    </tr>

                                    <tr>

                                        <td align="center"><strong>Personality</strong></td>

                                        <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>

                                    </tr>

                                </tbody>

                            </table>

                            

                            <div class="block">

                                <h1 id="notable-customers">Notable Customers</h1>

                                <div class="block note">

                                    <h3 id="lord-vittorio-blackthorn">Lord Vittorio Blackthorn</h3>

                                    <p>An eccentric noble known for his extravagant feasts featuring rare and exotic meats.</p>

                                    <p>Lord Blackthorn’s patronage lends an air of mystery and prestige to Morgor’s shop, attracting curious gourmands and shady characters alike.</p>

                                </div>

                                <h1 id="related-quests">Related Quests</h1>

                                <h3 id="the-basilisk-bounty">The Basilisk Bounty</h3>

                                <p>Morgor needs fresh basilisk meat and offers a handsome reward for those brave enough to hunt one.</p>

                                <p>500 gold coins and choice cuts of meat.</p>

                            </div>

                        

                        

                        <div class="columnSplit"></div>

                            <div class="block">

                                <h1 id="services-and-specialties">Services and Specialties</h1>

                                <div class="blank"></div>

                                <h2 id="services">Services</h2>

                                <h3 id="custom-slaughtering">Custom Slaughtering</h3>

                                <p>Bring your own beasts, and Morgor will prepare the meat to your specifications.

                                50 gold coins per beast.</p>

                                <div class="blank"></div>

                                <h2 id="specialties">Specialties</h2>

                                <div class="blank"></div>

                                <h3 id="basilisk-cutlets">Basilisk Cutlets</h3>

                                <p>Tender and marbled with a unique flavor, perfect for those seeking a truly rare dining experience.</p>

                                <h3 id="subterranean-lizard-tail">Subterranean Lizard Tail</h3>

                                <p>A delicacy prized for its unique texture and earthy taste, enchanted to enhance its natural flavor.</p>

                                <h1 id="security">Security</h1>

                                <div class="blank"></div>

                                <h3 id="bewitched-meat-hooks">Bewitched Meat Hooks</h3>

                                <p>These enchanted meat hooks animate and attack intruders who try to take meat without paying. 200 gold coins per pound.</p>

                                <div class="blank"></div>

                                <p>Attack: +5 to hit, 1d8+3 piercing damage.</p>

                                <h3 id="shadow-ward">Shadow Ward</h3>

                                <p>A magical barrier that alerts Morgor if someone enters the shop after hours. 150 gold coins per pound.</p>

                                <div class="blank"></div>

                                <p>Detection radius of 60 feet, triggers an audible alarm.</p>

                            </div> <!-- Close Block -->

                        </div> <!-- close columnWrapper-->

                    </div> <!-- close page 2 -->       

                        

                    <div class="page" id="p3">

                        <div class="columnWrapper">        

                          

                            <div class="block classTable frame decoration">

                                <h5 id="inventory">Inventory</h5>

                                <table>

                                    <thead>

                                        <tr>

                                            <th align="center">Name</th>

                                            <th align="center">Type</th>

                                            <th align="left">Cost</th>

                                            <th align="center">Properties</th>

                                        </tr>

                                    </thead>

                                    <tbody>

                                        <tr>

                                            <td align="center">Poultry Drumsticks</td>

                                            <td align="center">Meat</td>

                                            <td align="left">1 gp per lbs</td>

                                            <td align="center"></td>

                                        </tr>

                                        <tr>

                                            <td align="center">Ground Beef</td>

                                            <td align="center">Meat</td>

                                            <td align="left">1 gp per lbs</td>

                                            <td align="center"></td>

                                        </tr>

                                        <tr>

                                            <td align="center">Pork Chops</td>

                                            <td align="center">Meat</td>

                                            <td align="left">1 gp per lbs</td>

                                            <td align="center"></td>

                                        </tr>

                                        <tr>

                                            <td align="center">Bacon Strips</td>

                                            <td align="center">Meat</td>

                                            <td align="left">1 gp per lbs</td>

                                            <td align="center"></td>

                                        </tr>

                                        <tr>

                                            <td align="center">Sausage Links</td>

                                            <td align="center">Meat</td>

                                            <td align="left">1 gp per lbs</td>

                                            <td align="center"></td>

                                        </tr>

                                        <tr>

                                            <td align="center">Mystic Minotaur Steak</td>

                                            <td align="center">Exotic Meat</td>

                                            <td align="left">25 gold per pound</td>

                                            <td align="center">Grants temporary strength boost when consumed, Requires fine culinary skills to cook properly</td>

                                        </tr>

                                        <tr>

                                            <td align="center">Quantum Quail</td>

                                            <td align="center">Exotic Poultry</td>

                                            <td align="left">15 gold each</td>

                                            <td align="center">“Phases in and out of existence”, “Can enhance one’s agility”</td>

                                        </tr>

                                        <tr>

                                            <td align="center">Invisible Bacon</td>

                                            <td align="center">Mystical Meat</td>

                                            <td align="left">10 gold per slice</td>

                                            <td align="center">“Invisible to the naked eye”, “Tastes incredibly savory”, “Can only be seen with a special spell”</td>

                                        </tr>

                                        <tr>

                                            <td align="center">Hydra Sausage</td>

                                            <td align="center">Mythical Meat</td>

                                            <td align="left">50 gold per link</td>

                                            <td align="center">“Each bite regenerates after a while”, “Consuming too much may cause mild hallucinations”</td>

                                        </tr>

                                        <tr>

                                            <td align="center">Cursed Cleaver</td>

                                            <td align="center">Kitchen Equipment</td>

                                            <td align="left">100 gold</td>

                                            <td align="center">“Cuts through any meat effortlessly”, “Occasionally whispers in a long-forgotten language”, “Rumored to be haunted”</td>

                                        </tr>

                                        <tr>

                                            <td align="center">Vampire Spice Mix</td>

                                            <td align="center">Cooking Ingredient</td>

                                            <td align="left">20 gold per pouch</td>

                                            <td align="center">“Adds a distinct flavor”, “Enhances blood flow in the consumer”, “Leaves a lingering aftertaste of garlic”</td>

                                        </tr>

                                        <tr>

                                            <td align="center">Phoenix Feather Skewers</td>

                                            <td align="center">Cooking Utensil</td>

                                            <td align="left">75 gold per set</td>

                                            <td align="center">“Prevents meat from overcooking”, “Gives a slight warmth to cooked items”, “Reusable endlessly”</td>

                                        </tr>

                                    </tbody>

                                </table>

                            </div>

                            <p>&nbsp;</p>

                        </div><!-- Close Column Wrapper-->

                    </div> <!-- Close Page 3-->

                </div> <!-- Close pages-->

            </div> <!--Close brew renderer-->

        </div><!-- Close Div housing body-->

    </body>

</html>"""
     # Open a file path that will receive the processed text 
    store_file_path = f"output/test/{store_dict['store_name'].replace(' ', '_')}.html"
    with open(store_file_path, 'w') as clean_html:
        clean_html.write(html_file_as_text)
    clean_html.close()
   
    return store_file_path

dict_template = {
  "store_name": "The Mirage Emporium",
  "store_description": "A peculiar shop filled with the odd and the useless, where each corner hides a laugh and a mystery.",
  "store_reputation": "Locally famous for its bizarre and delightful inventory, though not particularly useful.",
  "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.",
  "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.",
  "store_type": "Curiosity Shop",
  "store_size": "Small",
  "store_hours": "From dawn until the moonlight dances.",
  "store_location": {
    "town": "Bramblebrook",
    "district": "Harlequin Quarter",
    "street": "Twilight Alley"
  },
  "store_owners": [
    {
      "name": "Fizzwidget Funsquirrel",
      "species": "Gnome",
      "class": "Bard",
      "description": "A lively gnome with a perpetual twinkle in his eye and a knack for making people smile.",
      "personality": "Joyful, playful, and a tad mischievous.",
      "secrets": ["Fizzwidget once performed a jester act for the Queen of Faerun.", "He has a hidden collection of practical jokes for special customers."],
      "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."
    }
  ],
  "store_employees": [
    {
      "name": "Marigold Merryleaf",
      "role": "Shop Assistant",
      "species": "Halfling",
      "description": "A spry halfling with a knack for finding peculiar trinkets buried under heaps of clutter.",
      "personality": "Curious, quirky, and always up for a laugh.",
      "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."
    }
  ],
  "store_quests": [
    {
      "name": "The Great Sock Hunt",
      "description": "Help Fizzwidget locate a rare pair of mismatched socks rumored to bring joy and luck, hidden somewhere in the town of Bramblebrook.",
      "reward": "A pair of enchanted socks that make the wearer extraordinarily lucky in games of chance."
    }
  ],
  "store_customers": [
    {
      "name": "Lord Twiddleton",
      "description": "An eccentric noble who collects oddities and revels in the unusual.",
      "influence": "High, due to his noble status and wealth."
    }
  ],
  "store_rumors": [
    "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."
  ],
  "store_security": [
    {
      "name": "Gizmo Gearshaft",
      "description": "An ingenious contraption that includes clockwork gears, springs, and enchanted runes.",
      "mechanics": "Gizmo Gearshaft patrols the shop, alert for intruders and mischief-makers, and can deploy harmless yet startling pranks to deter trouble."
    }
  ],
  "store_services": [
    {
      "name": "Laughter Therapy",
      "description": "A session with Fizzwidget who tells jokes and performs tricks to brighten your day.",
      "price": "1 gold coin per session"
    }
  ],
  "store_specialties": [
    {
      "name": "Mystery Mounds",
      "description": "A pile of assorted oddities bundled together; you never know what you'll get, but it'll always be a conversation starter!",
      "price": "5 silver per bundle"
    }
  ]
}