Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added README for web wiki and Faction list is now done #47

Merged
merged 5 commits into from
Apr 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions web wiki/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Web Wiki

The purpose of the Web Wiki is to create a web based Encyclopedia of the game. There is already a Encyclopedia in the game but having it in web would make it more easy to access. We could host this wiki on the internet which wouldn't require a reader to download and running the full game to read the Encyclopedia. Also making a Encyclopedia can be a lot easier and some people enjoy using web more.

## Only read-only

As of writting this this wiki is read only but we could of course add write functionality like renaming leaders and adding more history.

## Screenshots

![image](https://user-images.githubusercontent.com/124282214/233780005-29965187-6c48-46d3-a17a-e0f5c1271358.png)

![image](https://user-images.githubusercontent.com/124282214/233780071-50c8aee1-109e-4d1a-b4e4-688823ee75f5.png)

![image](https://user-images.githubusercontent.com/124282214/233794571-bb636952-df2d-4b16-8a04-13b13d550642.png)

![image](https://user-images.githubusercontent.com/124282214/233794593-8757e20a-9289-4e30-ac76-0c940095be9d.png)

18 changes: 16 additions & 2 deletions web wiki/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,17 @@ def regions():
def factions():
factions = list()

faction_no_leaders = defaultdict(int)
faction_no_troop_types = defaultdict(int)

for leader in game.leader_data.leader_list.values():
for faction in leader["Faction"]:
faction_no_leaders[faction] += 1

for troop in game.troop_data.troop_list.values():
for faction in troop["Faction"]:
faction_no_troop_types[faction] += 1

for k, v in game.faction_data.faction_list.items():
if k != 0: # skip all faction
faction = {
Expand All @@ -181,7 +192,10 @@ def factions():
"strengths": v["Strengths"],
"weaknesses": v["Weaknesses"],
"favoured-troop": v["Favoured Troop"],
"region": v["Type"]}
"region": v["Type"],
"no-leaders": faction_no_leaders[k],
"no-troop-types": faction_no_troop_types[k],
}
factions.append(faction)

factions.sort(key=lambda a: a["name"])
Expand Down Expand Up @@ -349,7 +363,7 @@ def leaders(leader_id=None):
pygame.image.save(image, leader_image_server_path)

leader_name = data["Name"]
sprite_icon = get_subunit_icon(leader_id, 100, None)
sprite_icon = get_subunit_icon(leader_id, 140, None)

return render_template(
"leader.j2",
Expand Down
5 changes: 3 additions & 2 deletions web wiki/templates/base.j2
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@
table { border-collapse: collapse; border-spacing: 0; margin-top: 12px }
hr { margin: 6px 0 6px 0; height: 1px; border: 0; border-bottom: 1px solid #ccc; display: block; padding: 0 }
th { text-align: left; color: #fefefe; font-size: 12px; font-weight: normal; padding: 6px; border-bottom: 1px solid #604030; border-top: 1px solid #604030; margin-bottom: 28px }
#content { background: #fefefe; border-left: 1px solid #ccc; border-right: 1px solid #ccc; width: 1300px; margin: 0 auto 0 auto; height: 100% }
#content { background: #fefefe; border-left: 1px solid #ccc; border-right: 1px solid #ccc; width: 1300px; margin: 0 auto 0 auto; min-height: 100% }
#inner-content { padding: 70px; padding-top: 40px }
a{ color: #a13c12 }
tr:nth-child(odd) td { background: #f2f3f4 }
td{ padding: 6px; font-size: 12px; vertical-align:top }
.inner td{ padding: 2px; background: 0 !important; border: 0; color: #000; padding-right: 14px }
ul{ display: block; padding: 0; margin: 0 }
li{ display: block; padding: 0; margin: 0 }
li{ padding: 0; margin: 0; margin-left: 12px }
.inner { margin-top: 0 }
.inner th{ padding:2px; background: 0; border: 0; font-weight:bold; padding-right:0; color: #000 }
p{ font-size:14px; font-family: "DejaVu Sans"; line-height: 22.4px }
.r{text-align: right }
Expand Down
19 changes: 15 additions & 4 deletions web wiki/templates/factions.j2
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,27 @@
{% block content %}
<h2>Factions</h2>
<table>
<tr><th></th><th>Name</th><th>Leaders</th><th>Strengths</th><th>Weaknesses</th><th>Favoured Troop</th><th>Region</th></tr>
<tr>
<th></th>
<th style="width:250px">Name</th>
<th>Strengths</th>
<th>Weaknesses</th>
<th>Favoured Troop</th>

<th class="r" style="width:130px">Number of leaders</th>
<th class="r" style="width:130px">Number of troop types</th>


</tr>
{% for faction in factions %}
<tr>
<td><img src="{{faction["icon"]}}"></td>
<td>{{faction["name"]}}</td>
<td><a href="/leaders?faction={{faction["id"]}}">See leaders</a></td>
<td><a href="">{{faction["name"]}}</a><br>{{faction["region"]}}</td>
<td>{{faction["strengths"]}}</td>
<td>{{faction["weaknesses"]}}</td>
<td>{{faction["favoured-troop"]}}</td>
<td>{{faction["region"]}}</td>
<td class="r"><a href="/leaders?faction={{faction["id"]}}">{{faction["no-leaders"]}} leaders</a></td>
<td class="r"><a href="/troops?faction={{faction["id"]}}">{{faction["no-troop-types"]}} troop types</a></td>
</tr>
{% endfor %}
{% endblock %}
Expand Down
2 changes: 1 addition & 1 deletion web wiki/templates/leaders.j2
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
{{unit["mount"][2]}}
</td>

<td>{{unit["skill"]}}</td>
<td><ul>{% for skill in unit["skill"] %}<li>{{skill}}</li>{% endfor %}</ul></td>

</tr>
{% endfor %}
Expand Down