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

[#7] Race #108

Merged
merged 43 commits into from
Nov 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
b9b6977
Extract rpg_tools_ui
Orchaldir Nov 5, 2023
4fb37b3
Increase version to 0.4.0
Orchaldir Nov 5, 2023
ef3a8b1
Improve editor
Orchaldir Nov 6, 2023
252ddd3
Add Species
Orchaldir Nov 6, 2023
d5cd43d
Add SpeciesMgr
Orchaldir Nov 6, 2023
2f0c7d6
Reduce usage of mut
Orchaldir Nov 6, 2023
83a969f
Add GenderOption
Orchaldir Nov 6, 2023
e69bea5
Add RpgData
Orchaldir Nov 7, 2023
df65ca0
Use css
Orchaldir Nov 8, 2023
975d256
Add species to home
Orchaldir Nov 8, 2023
1481ad6
Add species/all
Orchaldir Nov 8, 2023
841d2ca
Add species/all
Orchaldir Nov 8, 2023
637e2e2
show list of species
Orchaldir Nov 8, 2023
d50beb3
show species details
Orchaldir Nov 8, 2023
95d94da
Add /species/edit/<id>
Orchaldir Nov 8, 2023
7fd48cd
Add /species/update/<id>
Orchaldir Nov 8, 2023
05a6d1e
Add /species/new
Orchaldir Nov 9, 2023
fa2624f
Rename
Orchaldir Nov 9, 2023
4ffae63
Write races
Orchaldir Nov 9, 2023
162f3e0
Load races
Orchaldir Nov 9, 2023
6ac9277
Add race to character
Orchaldir Nov 9, 2023
0d1173d
Use race name
Orchaldir Nov 9, 2023
8997086
Use race options
Orchaldir Nov 9, 2023
bfd3313
Save updated character
Orchaldir Nov 9, 2023
4385ea5
Add link to race
Orchaldir Nov 9, 2023
8a4e883
Show characters per race
Orchaldir Nov 10, 2023
ddb0134
Imporv ui
Orchaldir Nov 10, 2023
0ee1203
Add update_race_name()
Orchaldir Nov 10, 2023
e3dde1e
More tests
Orchaldir Nov 10, 2023
dd9ad9f
Show error
Orchaldir Nov 10, 2023
3fc0083
clippy
Orchaldir Nov 10, 2023
913fdd3
Add update_gender_option
Orchaldir Nov 10, 2023
604548a
Show error
Orchaldir Nov 10, 2023
1f46e84
Fix bug
Orchaldir Nov 10, 2023
f5c18b4
Move
Orchaldir Nov 10, 2023
b2ee1e7
Move character
Orchaldir Nov 10, 2023
a1b40ba
Move appearance
Orchaldir Nov 10, 2023
351109e
Validate character name
Orchaldir Nov 10, 2023
90fba01
Validate character gender
Orchaldir Nov 10, 2023
df15eca
Validate character race
Orchaldir Nov 10, 2023
a312c0a
MR
Orchaldir Nov 10, 2023
2b28571
more tests
Orchaldir Nov 11, 2023
fe974c7
MR
Orchaldir Nov 11, 2023
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
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ members = [
"macro_ui",
"rpg_tools_core",
"rpg_tools_rendering",
"rpg_tools_ui",
"rpg_tools_editor",
]
resolver = "2"
2 changes: 1 addition & 1 deletion macro_convert/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "macro_convert"
version = "0.3.0"
version = "0.4.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
2 changes: 1 addition & 1 deletion macro_core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[package]
name = "macro_core"
version = "0.3.0"
version = "0.4.0"
edition = "2021"
2 changes: 1 addition & 1 deletion macro_ui/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "macro_ui"
version = "0.3.0"
version = "0.4.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
47 changes: 7 additions & 40 deletions resources/characters/characters.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
- id: 0
name: Elf
race: 1
gender: Male
appearance:
type: Humanoid
Expand Down Expand Up @@ -88,6 +89,7 @@
millimetre: 1500
- id: 1
name: Devil
race: 4
gender: Male
appearance:
type: Humanoid
Expand Down Expand Up @@ -139,45 +141,8 @@
height:
millimetre: 2500
- id: 2
name: Watcher
gender: Genderless
appearance:
type: HeadOnly
head:
ears:
type: None
eyes:
type: One
eye:
type: Normal
eye_shape: Circle
pupil_shape: VerticalSlit
pupil_color: Blue
background_color: White
eyebrows:
type: Normal
color: Fuchsia
shape: Curved
style: Even
width: Average
hair:
type: None
mouth:
type: Simple
beard:
type: None
width: Medium
teeth:
type: None
teeth_color: White
shape: Round
skin:
type: Scales
color: Purple
height:
millimetre: 1500
- id: 3
name: Vampire
race: 5
gender: Female
appearance:
type: Humanoid
Expand Down Expand Up @@ -248,8 +213,9 @@
color: White
height:
millimetre: 1500
- id: 4
- id: 3
name: Orc
race: 2
gender: Male
appearance:
type: Humanoid
Expand Down Expand Up @@ -320,8 +286,9 @@
color: Green
height:
millimetre: 1500
- id: 5
- id: 4
name: Dwarf
race: 3
gender: Male
appearance:
type: Humanoid
Expand Down
18 changes: 18 additions & 0 deletions resources/races.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
- id: 0
name: Human
gender_option: TwoGenders
- id: 1
name: Elf
gender_option: TwoGenders
- id: 2
name: Orc
gender_option: TwoGenders
- id: 3
name: Dwarf
gender_option: TwoGenders
- id: 4
name: Devil
gender_option: NoGender
- id: 5
name: Vampire
gender_option: TwoGenders
6 changes: 3 additions & 3 deletions resources/templates/appearance_edit.html.tera
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<img id="preview" src="/appearance/preview/back.svg" alt="Back Preview" width="75%"/>
</div>
<div class="editor">
<form id="appearanceForm" action="/appearance/{{ id }}/preview" method="post">
<form id="appearanceForm" action="/appearance/preview/{{ id }}" method="post">
<ul>
<li>
<b>Appearance:</b> {{ macros::add_select(name="appearance.type", options=[ "HeadOnly","Humanoid" ], selected=appearance.type, update=true) }}
Expand Down Expand Up @@ -1118,9 +1118,9 @@
</ul>
</li>
</ul>
<button formaction="/appearance/{{ id }}/update" formmethod="post">Submit</button>
<button formaction="/appearance/update/{{ id }}" formmethod="post">Submit</button>
</form>
<p><a href="/character/{{ id }}">Back</a></p>
<p><a href="/character/details/{{ id }}">Back</a></p>
</div>
</div>
{% endblock content %}
22 changes: 0 additions & 22 deletions resources/templates/character.html.tera

This file was deleted.

20 changes: 20 additions & 0 deletions resources/templates/character/all.html.tera
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{% extends "base" %}

{% block content %}
<p><h1>Characters</h1></p>
<div class="text">
<p><b>Total:</b> {{ total }}</p>
<p><a href="/character/new">Add</a></p>
</div>
<div class="grid-container">
{% for c in characters %}
<div class="grid-item">
<a href="/character/details/{{ c.0 }}">
<div class="content">{{ c.1 }}</div>
<img src = "/appearance/render/{{ c.0 }}/front.svg" alt="Character {{ c.0 }}"/>
</a>
</div>
{% endfor %}
</div>
<p class="text"><a href="/">Back</a></p>
{% endblock content %}
23 changes: 23 additions & 0 deletions resources/templates/character/details.html.tera
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{% extends "base" %}

{% block content %}
<div class="left_right_container">
<p><h1>Character: {{ name }}</h1></p>
<p><h2>Data</h2></p>
<div class="text">
<p><b>Id:</b> {{ id }}</p>
<p><b>Race:</b> <a href="/race/details/{{ race_id }}">{{ race }}</a></p>
<p><b>Gender:</b> {{ gender }}</p>
<p><a href="/character/edit/{{ id }}">Edit Data</a></p>
</div>
<p><h2>Appearance</h2></p>
<center>
<img src = "/appearance/render/{{ id }}/front.svg" alt="Front View of the Character" width="25%"/>
<img src = "/appearance/render/{{ id }}/back.svg" alt="Back View of the Character" width="25%"/>
</center>
<div class="text">
<p><a href="/appearance/edit/{{ id }}">Edit Appearance</a></p>
<p><a href="/character/all">Back</a></p>
</div>
</div>
{% endblock content %}
27 changes: 27 additions & 0 deletions resources/templates/character/edit.html.tera
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{% extends "base" %}

{% block content %}
<p><h1>Edit data of {{ name }}</h1></p>
<div class="text">
<p><b>Id:</b> {{ id }}</p>
<form action="/character/update/{{ id }}" method="post">
<b><label for="name">Name:</label></b>
<input type="text" id="name" name="name" value="{{ name }}">
{% if name_error %}<br><label class="error">{{ name_error }}</label>{% endif %}
<br>
<br>
<b><label for="race">Race:</label></b>
{{ macros::add_select(name="race", options=races, selected=race) }}
{% if race_error %}<br><label class="error">{{ race_error }}</label>{% endif %}
<br>
<br>
<b><label for="gender">Gender:</label></b>
{{ macros::add_select(name="gender", options=genders, selected=gender) }}
{% if gender_error %}<br><label class="error">{{ gender_error }}</label>{% endif %}
<br>
<br>
<input type="submit" value="Submit">
</form>
<p><a href="/character/details/{{ id }}">Back</a></p>
</div>
{% endblock content %}
18 changes: 0 additions & 18 deletions resources/templates/character_edit.html.tera

This file was deleted.

18 changes: 0 additions & 18 deletions resources/templates/characters.html.tera

This file was deleted.

5 changes: 4 additions & 1 deletion resources/templates/home.html.tera
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
{% block content %}
<p><h1>RPG Tools - Editor</h1></p>
<h2>Overview</h2>
<p><b>Characters:</b> <a href="/character">{{ characters }}</a></p>
<div class="text">
<p><b>Races:</b> <a href="/race/all">{{ races }}</a></p>
<p><b>Characters:</b> <a href="/character/all">{{ characters }}</a></p>
</div>
{% endblock content %}
15 changes: 15 additions & 0 deletions resources/templates/race/all.html.tera
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{% extends "base" %}

{% block content %}
<p><h1>Races</h1></p>
<div class="text">
<p><b>Total:</b> {{ total }}</p>
<ul>
{% for r in races %}
<li><a href="/race/details/{{ r.0 }}">{{ r.1 }}</a></li>
{% endfor %}
</ul>
<p><a href="/race/new">Add</a></p>
<p><a href="/">Back</a></p>
</div>
{% endblock content %}
22 changes: 22 additions & 0 deletions resources/templates/race/details.html.tera
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{% extends "base" %}

{% block content %}
<div class="left_right_container">
<p><h1>Race: {{ name }}</h1></p>
<p><h2>Data</h2></p>
<div class="text">
<p><b>Id:</b> {{ id }}</p>
<p><b>Gender Option:</b> {{ gender_option }}</p>
<p><a href="/race/edit/{{ id }}">Edit Data</a></p>
</div>
<p><h2>Characters</h2></p>
<div class="text">
<ul>
{% for c in characters %}
<li><a href="/character/details/{{ c.0 }}">{{ c.1 }}</a></li>
{% endfor %}
</ul>
<p><a href="/race/all">Back</a></p>
</div>
</div>
{% endblock content %}
22 changes: 22 additions & 0 deletions resources/templates/race/edit.html.tera
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{% extends "base" %}

{% block content %}
<p><h1>Edit Race: {{ name }}</h1></p>
<div class="text">
<p><b>Id:</b> {{ id }}</p>
<form action="/race/update/{{ id }}" method="post">
<b><label for="name">Name:</label></b>
<input type="text" id="name" name="name" value="{{ name }}">
{% if name_error %}<br><label class="error">{{ name_error }}</label>{% endif %}
<br>
<br>
<b><label for="gender_option">Gender Option:</label></b>
{{ macros::add_select(name="gender_option", options=gender_options, selected=gender_option) }}
{% if gender_error %}<br><label class="error">{{ gender_error }}</label>{% endif %}
<br>
<br>
<input type="submit" value="Submit">
</form>
<p><a href="/race/details/{{ id }}">Back</a></p>
</div>
{% endblock content %}
6 changes: 3 additions & 3 deletions rpg_tools_core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[package]
name = "rpg_tools_core"
version = "0.3.0"
version = "0.4.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
anyhow = "1.0"
macro_core = { path = "../macro_core" }
macro_convert = { path = "../macro_convert" }
macro_ui = { path = "../macro_ui" }
serde = { version = "1.0", features = ["derive"] }
titlecase = "2.2"
serde = { version = "1.0", features = ["derive"] }
2 changes: 1 addition & 1 deletion rpg_tools_core/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pub mod model;
pub mod ui;
pub mod usecase;

extern crate macro_core;
extern crate macro_ui;
Loading
Loading