-
Notifications
You must be signed in to change notification settings - Fork 46
Template-based rendering system for item and mob descriptions #420
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
Closed
Closed
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2be9936
Added template-based rendering for items and mobs
MorquinDevlar 7d7abe1
Added configurable equipment display for mob template
MorquinDevlar 903f0b0
Refactored templates and improved defensive programming
MorquinDevlar e84b47f
Setting correct default settings in config.yaml
MorquinDevlar 7ad4472
Refactored ItemLookData to use string-based type comparisons
MorquinDevlar 975264b
Removed deprecated TextFormats config structure
MorquinDevlar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
_datafiles/world/default/templates/character/description.screenreader.template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| {{ .Name }} ({{ .AlignmentName }}) | ||
| {{- $tnl := .XPTNL -}} | ||
| {{- $pct := (pct .Experience $tnl ) -}} | ||
|
|
||
| Description: | ||
| {{ .GetDescription }} | ||
|
|
||
| Health Status: {{ .GetHealthAppearance }} |
22 changes: 22 additions & 0 deletions
22
_datafiles/world/default/templates/character/inventory-look.screenreader.template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| Equipment: | ||
| {{ if not .Equipment.Weapon.IsDisabled }}Weapon: {{ .Equipment.Weapon.NameSimple }} | ||
| {{ end -}} | ||
| {{- if not .Equipment.Offhand.IsDisabled }}Offhand: {{ .Equipment.Offhand.NameSimple }} | ||
| {{ end -}} | ||
| {{- if not .Equipment.Head.IsDisabled }}Head: {{ .Equipment.Head.NameSimple }} | ||
| {{ end -}} | ||
| {{- if not .Equipment.Neck.IsDisabled }}Neck: {{ .Equipment.Neck.NameSimple }} | ||
| {{ end -}} | ||
| {{- if not .Equipment.Body.IsDisabled }}Body: {{ .Equipment.Body.NameSimple }} | ||
| {{ end -}} | ||
| {{- if not .Equipment.Belt.IsDisabled }}Belt: {{ .Equipment.Belt.NameSimple }} | ||
| {{ end -}} | ||
| {{- if not .Equipment.Gloves.IsDisabled }}Gloves: {{ .Equipment.Gloves.NameSimple }} | ||
| {{ end -}} | ||
| {{- if not .Equipment.Ring.IsDisabled }}Ring: {{ .Equipment.Ring.NameSimple }} | ||
| {{ end -}} | ||
| {{- if not .Equipment.Legs.IsDisabled }}Legs: {{ .Equipment.Legs.NameSimple }} | ||
| {{ end -}} | ||
| {{- if not .Equipment.Feet.IsDisabled }}Feet: {{ .Equipment.Feet.NameSimple }} | ||
| {{ end }} | ||
| Carrying: {{ $itmCt := len .ItemNames }}{{ if eq $itmCt 0 }}no{{ else if lt $itmCt 4 }}a few{{ else if lt $itmCt 7 }}several{{ else }}lots of{{ end }} objects |
37 changes: 37 additions & 0 deletions
37
_datafiles/world/default/templates/descriptions/look-item.screenreader.template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| {{/* Screenreader-friendly template for looking at items */}} | ||
| You look at the {{ .Item.Name }} {{ .Location }}: | ||
|
|
||
| {{ .ItemSpec.Description }} | ||
| {{- if .IsReadable }} | ||
| You should probably read this. | ||
| {{- else if .IsDrinkable }} | ||
| You could probably drink this. | ||
| {{- else if .IsEdible }} | ||
| You could probably eat this. | ||
| {{- else if .IsLockpicks }} | ||
| These are used with the picklock command. | ||
| {{- else if .IsKey }} | ||
| When you find the right door, keys are added to your keyring automatically. | ||
| {{- else if .IsWearable }} | ||
| It looks like wearable {{ .ItemSpec.Type }} equipment. | ||
| {{- end }} | ||
| {{- if .IsWeapon }} | ||
| It looks like a {{ .WeaponHands }}-Handed weapon. | ||
| {{- if eq .WeaponType "claws" }} | ||
| It looks like a claws weapon. These can be dual wielded without training. | ||
| {{- else if eq .WeaponType "shooting" }} | ||
| This can fired into adjacent areas. (help shoot) | ||
| {{- end }} | ||
| {{- if gt .WaitRounds 0 }} | ||
| It requires an extra {{ .WaitRounds }} round(s) between attacks. | ||
| {{- end }} | ||
| {{- end }} | ||
| {{- if .HasUses }} | ||
| It has {{ .UsesRemaining }}/{{ .MaxUses }} uses remaining. | ||
| {{- end }} | ||
| {{- if .IsCursed }} | ||
| It's CURSED! Once equipped, it cannot be removed without magical help. | ||
| {{- end }} | ||
| {{- if .IsEnchanted }} | ||
| It glows with a magical aura (enchantment level {{ .EnchantLevel }}). | ||
| {{- end }} |
37 changes: 37 additions & 0 deletions
37
_datafiles/world/default/templates/descriptions/look-item.template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| {{/* Template for looking at items */}} | ||
| You look at the <ansi fg="item">{{ .Item.DisplayName }}</ansi> {{ .Location }}: | ||
|
|
||
| {{ .ItemSpec.Description }} | ||
| {{- if .IsReadable }} | ||
| - You should probably <ansi fg="command">read</ansi> this. | ||
| {{- else if .IsDrinkable }} | ||
| - You could probably <ansi fg="command">drink</ansi> this. | ||
| {{- else if .IsEdible }} | ||
| - You could probably <ansi fg="command">eat</ansi> this. | ||
| {{- else if .IsLockpicks }} | ||
| - These are used with the <ansi fg="command">picklock</ansi> command. | ||
| {{- else if .IsKey }} | ||
| - When you find the right door, keys are added to your keyring automatically. | ||
| {{- else if .IsWearable }} | ||
| - It looks like wearable <ansi fg="magenta">{{ .ItemSpec.Type }}</ansi> equipment. | ||
| {{- end }} | ||
| {{- if .IsWeapon }} | ||
| - It looks like a <ansi fg="yellow">{{ .WeaponHands }}-Handed</ansi> weapon. | ||
| {{- if eq .WeaponType "claws" }} | ||
| - It looks like a <ansi fg="yellow">claws</ansi> weapon. These can be dual wielded without training. | ||
| {{- else if eq .WeaponType "shooting" }} | ||
| - This can fired into adjacent areas. (<ansi fg="command">help shoot</ansi>) | ||
| {{- end }} | ||
| {{- if gt .WaitRounds 0 }} | ||
| - It requires an extra <ansi fg="red">{{ .WaitRounds }}</ansi> round(s) between attacks. | ||
| {{- end }} | ||
| {{- end }} | ||
| {{- if .HasUses }} | ||
| - It has <ansi fg="yellow">{{ .UsesRemaining }}/{{ .MaxUses }}</ansi> uses remaining. | ||
| {{- end }} | ||
| {{- if .IsCursed }} | ||
| - It's <ansi fg="red-bold">CURSED!</ansi> Once equipped, it cannot be removed without magical help. | ||
| {{- end }} | ||
| {{- if .IsEnchanted }} | ||
| - It glows with a <ansi fg="enchanted">magical aura</ansi> (enchantment level {{ .EnchantLevel }}). | ||
| {{- end }} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.