Spaces:
Sleeping
Sleeping
drakosfire
commited on
Commit
•
f6ba86d
1
Parent(s):
88841c5
Added customer block and began quest block, updated width of block-container from 350px to 350px
Browse files- block_builder.py +56 -1
- storeUI.html +3 -3
- template.py +57 -121
block_builder.py
CHANGED
@@ -28,7 +28,9 @@ def build_blocks(user_input, block_id):
|
|
28 |
block_id= block_id)
|
29 |
block_id = block_id + 1
|
30 |
list_of_blocks.append(store_properties_block)
|
|
|
31 |
owner_id = 1
|
|
|
32 |
# Iterate over owners and generate owner image and details block
|
33 |
owner_title = "Owner"
|
34 |
if len(user_input['store_owners']) > 1:
|
@@ -45,6 +47,7 @@ def build_blocks(user_input, block_id):
|
|
45 |
list_of_blocks.append(owner_block)
|
46 |
owner_id += 1
|
47 |
employee_id = 1
|
|
|
48 |
# Iterate over employees and generate employee image and details block
|
49 |
employee_title = "Employee"
|
50 |
if len(user_input['store_employees']) > 1:
|
@@ -58,6 +61,15 @@ def build_blocks(user_input, block_id):
|
|
58 |
block_id = block_id + 1
|
59 |
list_of_blocks.append(employee_block)
|
60 |
employee_id += 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
return list_of_blocks
|
62 |
|
63 |
# Take in a specific item type and item, and return the html for that item
|
@@ -69,6 +81,7 @@ def process_into_html(item_type,item, block_id):
|
|
69 |
title="">{item}</textarea></td>
|
70 |
</tr>"""
|
71 |
return item_html
|
|
|
72 |
# Take in a specific iterable type and iterable, and return the html for that iterable
|
73 |
def process_iterable_into_html(iterable_type, iterable, block_id):
|
74 |
iterable_html = f""""""
|
@@ -81,6 +94,7 @@ def process_iterable_into_html(iterable_type, iterable, block_id):
|
|
81 |
</tr>"""
|
82 |
iterable_html += item_html
|
83 |
return iterable_html
|
|
|
84 |
# Take in a list of rumors and return the html for that list of rumors
|
85 |
def process_rumors_into_html(rumors, block_id):
|
86 |
rumors_html = f""""""
|
@@ -93,6 +107,7 @@ def process_rumors_into_html(rumors, block_id):
|
|
93 |
</tr>"""
|
94 |
rumors_html += rumor_html
|
95 |
return rumors_html
|
|
|
96 |
# Take in a list of secrets and return the html for that list of secrets
|
97 |
def process_secrets_into_html(secrets, block_id):
|
98 |
secrets_html = f""""""
|
@@ -105,6 +120,7 @@ def process_secrets_into_html(secrets, block_id):
|
|
105 |
</tr>"""
|
106 |
secrets_html += secret_html
|
107 |
return secrets_html
|
|
|
108 |
# Block for title, description, backstory, and reputation
|
109 |
def build_title_block(title,description,backstory,reputation):
|
110 |
title_block_html = f"""<div class="block-item" data-block-id = {block_id}><h1>
|
@@ -242,7 +258,9 @@ def build_owner_block(owner, owner_id, owner_title_block, block_id):
|
|
242 |
owner_block_html += f"""<div class="block-item" data-block-id="{block_id}">"""
|
243 |
if owner_id == 1:
|
244 |
owner_block_html+= owner_title_block
|
245 |
-
owner_block_html += f"""<h3 id="owner_{owner_id}"
|
|
|
|
|
246 |
owner_block_html += f"""<table>
|
247 |
<thead>
|
248 |
<tr>
|
@@ -298,5 +316,42 @@ def build_employee_block(employee, employee_id, employee_title_block, block_id):
|
|
298 |
"""
|
299 |
return employee_block_html
|
300 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
301 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
302 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
block_id= block_id)
|
29 |
block_id = block_id + 1
|
30 |
list_of_blocks.append(store_properties_block)
|
31 |
+
|
32 |
owner_id = 1
|
33 |
+
# Employee and owner could be combined into a single function with a parameter for the type of block
|
34 |
# Iterate over owners and generate owner image and details block
|
35 |
owner_title = "Owner"
|
36 |
if len(user_input['store_owners']) > 1:
|
|
|
47 |
list_of_blocks.append(owner_block)
|
48 |
owner_id += 1
|
49 |
employee_id = 1
|
50 |
+
|
51 |
# Iterate over employees and generate employee image and details block
|
52 |
employee_title = "Employee"
|
53 |
if len(user_input['store_employees']) > 1:
|
|
|
61 |
block_id = block_id + 1
|
62 |
list_of_blocks.append(employee_block)
|
63 |
employee_id += 1
|
64 |
+
|
65 |
+
customer_id = 1
|
66 |
+
for customer in user_input['store_customers']:
|
67 |
+
customers_block = build_customers_block(customer, customer_id, block_id)
|
68 |
+
block_id = block_id + 1
|
69 |
+
customer_id += 1
|
70 |
+
list_of_blocks.append(customers_block)
|
71 |
+
|
72 |
+
|
73 |
return list_of_blocks
|
74 |
|
75 |
# Take in a specific item type and item, and return the html for that item
|
|
|
81 |
title="">{item}</textarea></td>
|
82 |
</tr>"""
|
83 |
return item_html
|
84 |
+
|
85 |
# Take in a specific iterable type and iterable, and return the html for that iterable
|
86 |
def process_iterable_into_html(iterable_type, iterable, block_id):
|
87 |
iterable_html = f""""""
|
|
|
94 |
</tr>"""
|
95 |
iterable_html += item_html
|
96 |
return iterable_html
|
97 |
+
|
98 |
# Take in a list of rumors and return the html for that list of rumors
|
99 |
def process_rumors_into_html(rumors, block_id):
|
100 |
rumors_html = f""""""
|
|
|
107 |
</tr>"""
|
108 |
rumors_html += rumor_html
|
109 |
return rumors_html
|
110 |
+
|
111 |
# Take in a list of secrets and return the html for that list of secrets
|
112 |
def process_secrets_into_html(secrets, block_id):
|
113 |
secrets_html = f""""""
|
|
|
120 |
</tr>"""
|
121 |
secrets_html += secret_html
|
122 |
return secrets_html
|
123 |
+
|
124 |
# Block for title, description, backstory, and reputation
|
125 |
def build_title_block(title,description,backstory,reputation):
|
126 |
title_block_html = f"""<div class="block-item" data-block-id = {block_id}><h1>
|
|
|
258 |
owner_block_html += f"""<div class="block-item" data-block-id="{block_id}">"""
|
259 |
if owner_id == 1:
|
260 |
owner_block_html+= owner_title_block
|
261 |
+
owner_block_html += f"""<h3 id="owner_{owner_id}"><textarea class="title-textarea" id="user-store-rumors-{block_id}"
|
262 |
+
hx-post="/update-stats" hx-trigger="change" hx-target="#user-store-rumors-{block_id}t" hx-swap="outerHTML"
|
263 |
+
title="Owner Name">{owner['name']}</textarea><</h3>"""
|
264 |
owner_block_html += f"""<table>
|
265 |
<thead>
|
266 |
<tr>
|
|
|
316 |
"""
|
317 |
return employee_block_html
|
318 |
|
319 |
+
# Customers block with name, description, influence
|
320 |
+
def build_customers_block(customer, customer_id, block_id):
|
321 |
+
customer_block_html = f""""""
|
322 |
+
customer_block_html += f"""<div class="block-item" data-block-id="{block_id}">"""
|
323 |
+
if customer_id == 1:
|
324 |
+
customer_block_html += f"""<h1 id="notable-customers">Notable Customers</h1> """
|
325 |
+
customer_block_html += f""" <div class="block note">
|
326 |
+
<h3 id="owner_{customer_id}"><textarea class="title-textarea" id="user-store-rumors-{block_id}"
|
327 |
+
hx-post="/update-stats" hx-trigger="change" hx-target="#user-store-rumors-{block_id}t" hx-swap="outerHTML"
|
328 |
+
title="Owner Name">{customer['name']}</textarea></h3>
|
329 |
+
<p>{customer['description']}</p>
|
330 |
+
<p>{customer['influence']}</p>
|
331 |
+
</div>"""
|
332 |
+
|
333 |
+
return customer_block_html
|
334 |
|
335 |
+
# Quests block with name, description, reward
|
336 |
+
def build_quests_block(quests, quest_id, block_id):
|
337 |
+
quests_block_html = f""""""
|
338 |
+
quests_block_html += f"""<div class="block-item" data-block-id="{block_id}">"""
|
339 |
+
if quest_id == 1:
|
340 |
+
quests_block_html += f"""<h1 id="store-quests">Store Quests</h1> """
|
341 |
+
|
342 |
+
quest_block_html = f"""
|
343 |
+
<div class="Block_10">
|
344 |
+
|
345 |
+
<h3 id="the-basilisk-bounty">The Basilisk Bounty</h3>
|
346 |
+
<p>Morgor needs fresh basilisk meat and offers a handsome reward for those brave enough to hunt one.</p>
|
347 |
+
<p>500 gold coins and choice cuts of meat.</p>
|
348 |
+
</div>"""
|
349 |
|
350 |
+
#Text Area Template
|
351 |
+
"""<textarea class="string-action-description-textarea" id="user-store-rumors-{block_id}"
|
352 |
+
hx-post="/update-stats" hx-trigger="change" hx-target="#user-store-rumors-{block_id}t" hx-swap="outerHTML"
|
353 |
+
title="Rumors">{rumor}</textarea>"""
|
354 |
+
#Title Area Template
|
355 |
+
"""<h3 id="owner_{owner_id}"><textarea class="title-textarea" id="user-store-rumors-{block_id}"
|
356 |
+
hx-post="/update-stats" hx-trigger="change" hx-target="#user-store-rumors-{block_id}t" hx-swap="outerHTML"
|
357 |
+
title="Owner Name">{owner['name']}</textarea><</h3>"""
|
storeUI.html
CHANGED
@@ -45,7 +45,7 @@
|
|
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:
|
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 */
|
@@ -58,7 +58,7 @@
|
|
58 |
.block-container .page {
|
59 |
column-count: 1;
|
60 |
padding: 0;
|
61 |
-
width:
|
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;
|
@@ -66,7 +66,7 @@
|
|
66 |
|
67 |
}
|
68 |
.page-container {
|
69 |
-
margin-left:
|
70 |
width: 900px;
|
71 |
padding: 20px;
|
72 |
overflow: auto; /* Enable scrolling if needed */
|
|
|
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: 450px; /* 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 */
|
|
|
58 |
.block-container .page {
|
59 |
column-count: 1;
|
60 |
padding: 0;
|
61 |
+
width: 425px;
|
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;
|
|
|
66 |
|
67 |
}
|
68 |
.page-container {
|
69 |
+
margin-left: 450px; /* 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 */
|
template.py
CHANGED
@@ -4,124 +4,60 @@
|
|
4 |
# To save on tokens, we wont generate an SD prompt for each item, but send a request for a prompt using the item dictionary.
|
5 |
# Description of Store
|
6 |
{
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
"
|
17 |
-
"
|
18 |
-
"
|
19 |
-
|
20 |
-
|
21 |
-
|
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 |
-
# Inventory
|
66 |
-
|
67 |
-
{
|
68 |
-
"inventory": {
|
69 |
-
"core_inventory":[],
|
70 |
-
"weapons": [
|
71 |
-
{
|
72 |
-
"name": "",
|
73 |
-
"type": "",
|
74 |
-
"cost": "",
|
75 |
-
"properties": []
|
76 |
-
}
|
77 |
-
],
|
78 |
-
"armor": [
|
79 |
-
{
|
80 |
-
"name": "",
|
81 |
-
"type": "",
|
82 |
-
"cost": "",
|
83 |
-
"properties": []
|
84 |
-
}
|
85 |
-
],
|
86 |
-
"potions": [
|
87 |
-
{
|
88 |
-
"name": "",
|
89 |
-
"type": "",
|
90 |
-
"cost": "",
|
91 |
-
"properties": []
|
92 |
-
}
|
93 |
-
],
|
94 |
-
"scrolls": [
|
95 |
-
{
|
96 |
-
"name": "",
|
97 |
-
"type": "",
|
98 |
-
"cost": "",
|
99 |
-
"properties": []
|
100 |
-
}
|
101 |
-
],
|
102 |
-
"magical_items": [
|
103 |
-
{
|
104 |
-
"name": "",
|
105 |
-
"type": "",
|
106 |
-
"cost": "",
|
107 |
-
"properties": []
|
108 |
-
}
|
109 |
-
],
|
110 |
-
"mundane_items": [
|
111 |
-
{
|
112 |
-
"name": "",
|
113 |
-
"type": "",
|
114 |
-
"cost": "",
|
115 |
-
"properties": []
|
116 |
-
}
|
117 |
-
],
|
118 |
-
"miscellaneous_items": [
|
119 |
-
{
|
120 |
-
"name": "",
|
121 |
-
"type": "",
|
122 |
-
"cost": "",
|
123 |
-
"properties": []
|
124 |
-
}
|
125 |
-
]
|
126 |
-
}
|
127 |
-
}
|
|
|
4 |
# To save on tokens, we wont generate an SD prompt for each item, but send a request for a prompt using the item dictionary.
|
5 |
# Description of Store
|
6 |
{
|
7 |
+
"store_name": "Ethereal Embrace",
|
8 |
+
"store_description": "A luxury lingerie store filled with delicate silks, enchanting lace, and otherworldly designs. The air is scented with subtle perfumes and the lighting casts a warm, inviting glow.",
|
9 |
+
"store_reputation": "Renowned for its exquisite craftsmanship and magical allure, a favorite among nobility and adventurers alike.",
|
10 |
+
"store_backstory": "Ethereal Embrace was established centuries ago by a pioneering beholder named Zaltrix. His keen eye (or rather, eyes) for detail and fashion led him to create a haven where fantasy meets elegance.",
|
11 |
+
"storefront_sd_prompt": "A highly detailed fantasy oil painting of a full body beholder in an opulent lingerie store. The beholder has multiple eyes each adorned with a delicate monocle, and the shop is filled with luxurious fabrics and ornate displays. The background shows an inviting, warm-lit ambiance with customers examining exquisite lingerie.",
|
12 |
+
"store_type": "Lingerie",
|
13 |
+
"store_size": "Medium",
|
14 |
+
"store_hours": "10 AM to 8 PM",
|
15 |
+
"store_location": {
|
16 |
+
"town": "Glimmering Vale",
|
17 |
+
"district": "Silk Quarter",
|
18 |
+
"street": "Moonlit Avenue"
|
19 |
+
},
|
20 |
+
"store_owners": [{
|
21 |
+
"name": "Zaltrix",
|
22 |
+
"species": "Beholder",
|
23 |
+
"class": "Artificer",
|
24 |
+
"description": "A beholder with a penchant for fashion, each of his eyes is adorned with a tiny, fashionable monocle.",
|
25 |
+
"personality": "Charming, meticulous, and slightly eccentric. He takes immense pride in his work.",
|
26 |
+
"secrets": [],
|
27 |
+
"sd_prompt": "A highly detailed fantasy painting of a full body beholder in an opulent lingerie store. The beholder has multiple eyes each adorned with a delicate monocle, and the shop is filled with luxurious fabrics and ornate displays. The background shows an inviting, warm-lit ambiance with customers examining exquisite lingerie."
|
28 |
+
}],
|
29 |
+
"store_employees": [{
|
30 |
+
"name": "Fleur",
|
31 |
+
"role": "Designer",
|
32 |
+
"species": "Half-Elf",
|
33 |
+
"description": "A graceful half-elf with an eye for innovative designs, often seen sketching new patterns.",
|
34 |
+
"personality": "Creative, gentle, and always looking to experiment with new ideas.",
|
35 |
+
"sd_prompt": "A highly detailed fantasy drawing of a graceful half-elf artist sketching lingerie designs in a luxurious shop."
|
36 |
+
}],
|
37 |
+
"store_quests": [{
|
38 |
+
"name": "The Silk of the Moondrake",
|
39 |
+
"description": "Zaltrix needs a rare type of silk known as Moondrake Silk, found only in the nests of Moondrakes. The task is to retrieve this treasured silk without harming the mystical creatures.",
|
40 |
+
"reward": "An enchanted lingerie set that grants the wearer increased charm and charisma."
|
41 |
+
}],
|
42 |
+
"store_customers": [{
|
43 |
+
"name": "Lady Seraphina",
|
44 |
+
"description": "A well-known noblewoman who frequents Ethereal Embrace seeking the latest designs.",
|
45 |
+
"influence": "High, she often recommends the store to other members of the nobility."
|
46 |
+
}],
|
47 |
+
"store_rumors": [],
|
48 |
+
"store_security": [{
|
49 |
+
"name": "Glimmer",
|
50 |
+
"description": "An ever-vigilant magical orb that floats near the ceiling, observing every movement with silent efficiency.",
|
51 |
+
"mechanics": "Detects any illicit activity and alerts Zaltrix while casting a minor hold spell on the culprit."
|
52 |
+
}],
|
53 |
+
"store_services": [{
|
54 |
+
"name": "Custom Fittings",
|
55 |
+
"description": "Personalized lingerie fittings to ensure each piece fits perfectly.",
|
56 |
+
"price": "50 gold"
|
57 |
+
}],
|
58 |
+
"store_specialties": [{
|
59 |
+
"name": "Enchanted Ensembles",
|
60 |
+
"description": "Lingerie sets enchanted with minor charms and spells.",
|
61 |
+
"price": "200 gold"
|
62 |
+
}]
|
63 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|