commit b68b3939304f7b69c31ef21726c6f2c983e2c21a
parent 06f2ca59b85909caf4188c4880461c7a7e04539d
Author: anon <anon@example.com>
Date: Sun, 8 Nov 2026 06:20:48 +0000
Use concise labels and tables for remaining admin details
Diffstat:
3 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/server/control_data_test.go b/server/control_data_test.go
@@ -293,8 +293,8 @@ func TestControlCharacterFormSavesNativeFieldsAndNamedSlots(t *testing.T) {
if response.Code != http.StatusSeeOther || err != nil || name != "Edited" || x != 53 || head != 31 || points != 12345 || rifle != 42 || health != 31 || credits != 913 {
t.Fatalf("native character fields were not saved: %d %s, %v", response.Code, response.Body.String(), err)
}
- if !strings.Contains(page.Body.String(), "Breed: 1 Solitus") || !strings.Contains(page.Body.String(), "Sex: 2 male, 3 female") || strings.Contains(page.Body.String(), "<textarea") {
- t.Fatal("the form lost its appearance documentation")
+ if !strings.Contains(page.Body.String(), "<label>Breed<select") || !strings.Contains(page.Body.String(), ">Solitus (1)</option>") || !strings.Contains(page.Body.String(), "<label>Sex<select") || strings.Contains(page.Body.String(), "<textarea") {
+ t.Fatal("the form lost its named appearance choices")
}
if restarted.characters[1].appearance != 64277 || restarted.characters[1].position != [3]float32{53, 14, 60} || restarted.characters[1].inventory.Credits != 913 {
t.Fatal("the native row did not restore the edited character")
diff --git a/server/control_player_form.go b/server/control_player_form.go
@@ -200,6 +200,9 @@ func (field playerFormField) render(w io.Writer) {
if index := strings.LastIndex(label, "."); index >= 0 {
label = label[index+1:]
}
+ if strings.HasPrefix(field.name, "reclaim.") && label == "id" {
+ label = "Item ID (0 = empty)"
+ }
fmt.Fprintf(w, "<label>%s", html.EscapeString(playerFieldLabel(label)))
// Reclaim always refers to an ordinary inventory slot.
if strings.HasPrefix(field.name, "reclaim.") && strings.HasSuffix(field.name, ".original_slot") {
@@ -334,19 +337,13 @@ func renderPlayerForm(w io.Writer, data characterEditor) {
index, _ := strconv.Atoi(strings.TrimPrefix(next, "reclaim."))
title = fmt.Sprintf("Reclaim item %d", index+1)
}
- fmt.Fprintf(w, "<section><h3>%s</h3>", html.EscapeString(title))
- if next == "appearance" {
- fmt.Fprint(w, "<p>Breed: 1 Solitus, 2 Opifex, 3 Nanomage, 4 Atrox, 6 creature. Sex: 2 male, 3 female; 1 for Atrox and creatures. Side: 0 neutral, 1 Clan, 2 Omni-Tek. Body build (fatness): 0 slim, 1 normal, 2 heavy. Race: 1 default. Head: 0-31; head mesh selects the visible head.</p>")
- }
if next == "inventory.slots" || next == "equipment" || next == "bank" {
- fmt.Fprint(w, "<p>Item instance IDs. Leave a slot blank to unassign its item. Use the item links below to inspect or edit an instance.</p>")
- }
- if strings.HasPrefix(next, "reclaim.") {
- fmt.Fprint(w, "<p>Set the item instance ID, original inventory slot and availability time. ID 0 leaves the entry empty or removes it from reclaim.</p>")
+ title += " (item IDs; blank = empty)"
}
if next == "return_door" {
- fmt.Fprint(w, "<p>Set both fields to zero to clear the return door.</p>")
+ title += " (both 0 = none)"
}
+ fmt.Fprintf(w, "<section><h3>%s</h3>", html.EscapeString(title))
fmt.Fprint(w, "<div class='player-fields'>")
group = next
}
diff --git a/server/item_source_pages.go b/server/item_source_pages.go
@@ -77,18 +77,24 @@ func (server *server) itemTemplatePage(w http.ResponseWriter, r *http.Request) {
quality = "Mission level"
}
fmt.Fprintf(w, "<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>", source.kind, icon, name, quality)
+ if source.kind == "Loot" || source.shop != 0 || len(source.locations) != 0 {
+ fmt.Fprint(w, "<table>")
+ }
if source.kind == "Loot" {
- fmt.Fprintf(w, "%d%% per roll, NPC levels %d-%d. ", source.chance, source.level[0], source.level[1])
+ fmt.Fprintf(w, "<tr><th scope='row'>Chance per roll</th><td>%d%%</td></tr><tr><th scope='row'>NPC levels</th><td>%d-%d</td></tr>", source.chance, source.level[0], source.level[1])
}
if source.shop != 0 {
- fmt.Fprint(w, html.EscapeString(shopAccess(gamedata.ItemTemplates[source.shop])), ". ")
+ fmt.Fprintf(w, "<tr><th scope='row'>Access</th><td>%s</td></tr>", html.EscapeString(shopAccess(gamedata.ItemTemplates[source.shop])))
}
if len(source.locations) != 0 {
- fmt.Fprintf(w, "<details><summary>%d locations</summary><ul>", len(source.locations))
+ fmt.Fprint(w, "<tr><th scope='row'>Locations</th><td><ul>")
for _, location := range source.locations {
fmt.Fprintf(w, "<li><a href='admin/map?playfield=%d&x=%g&z=%g'>%s - %s (%d), X %.1f Z %.1f</a></li>", location.playfield, location.position[0], location.position[2], html.EscapeString(adminName(location.name)), html.EscapeString(gamedata.Playfields[location.playfield].Name), location.playfield, location.position[0], location.position[2])
}
- fmt.Fprint(w, "</ul></details>")
+ fmt.Fprint(w, "</ul></td></tr>")
+ }
+ if source.kind == "Loot" || source.shop != 0 || len(source.locations) != 0 {
+ fmt.Fprint(w, "</table>")
}
fmt.Fprint(w, "</td></tr>")
}