Skip to content
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
8 changes: 3 additions & 5 deletions _datafiles/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,10 @@ XPScale: 100
# processed per turn. This is not the same as rounds, which is how often the
# mobs choose their actions, but if multiple actions are queued up, they will
# be processed in order once per turn.
# The effect of this can be easily seen in the initial login to the game,
# where several commands are queued up at once and processed in order for the
# player.
# 100 is a good balance between handling input from players and not bogging
# 50 is a good balance between handling input from players and not bogging
# down the server.
TurnMs: 100
# Note: If your automapper/walker seems slow, this is probably the culprit.
TurnMs: 50
# - RoundSeconds -
# How many seconds per round. Anything gated by rounds will be affected by
# this. This is the main setting for controlling the pace of the game.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ Set a property of the room. This updates basic properties of the room you are in
<ansi fg="command">room nouns</ansi> - List all nouns for the room
<ansi fg="command">room noun [name] [description]</ansi> - Add or overwrite a noun

Containers:
You can interactively add/remove/edit containers using the command:
<ansi fg="command">room edit containers</ansi>

<ansi fg="command">room exit [exit_name] [room_id]</ansi> - e.g. <ansi fg="command">room exit west 159</ansi>
This will create a new exit that links to a specific room_id using the exit_name provided.
<ansi fg="red-bold">!Beware!</ansi> if the spacial relationship with compass direction rooms is done incorrectly,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

{{ range $idx, $itemInfo := . }} <ansi fg="red-bold">{{ printf "%2d." (add $idx 1) }}</ansi> <ansi fg="yellow-bold">{{ printf "%-33s" $itemInfo.Name }}</ansi>{{ if eq (mod $idx 2) 1 }}{{ printf "\n" }}{{ end }}{{ end }}
{{ range $idx, $itemInfo := . }} <ansi fg="red-bold">{{ printf "%2d." (add $idx 1) }}</ansi> {{ if $itemInfo.Marked }}<ansi fg="white-bold" bg="2">{{else}}<ansi fg="yellow-bold">{{end}}{{ if $itemInfo.Marked }}*{{ printf "%-32s" $itemInfo.Name }}{{else}}{{ printf "%-33s" $itemInfo.Name }}{{end}}</ansi>{{ if eq (mod $idx 2) 1 }}{{ printf "\n" }}{{ end }}{{ end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

{{ range $idx, $itemInfo := . }} <ansi fg="red-bold">{{ printf "%2d." (add $idx 1) }}</ansi> <ansi fg="yellow-bold">{{ printf "%-17s" $itemInfo.Name }}</ansi>{{ if ne $itemInfo.Description "" }} - <ansi fg="black-bold">{{ splitstring $itemInfo.Description 54 " " }}</ansi>{{ end }}
{{ range $idx, $itemInfo := . }} <ansi fg="red-bold">{{ printf "%2d." (add $idx 1) }}</ansi> {{ if $itemInfo.Marked }}<ansi fg="white-bold" bg="2">{{else}}<ansi fg="yellow-bold">{{end}}{{ if $itemInfo.Marked }}*{{ printf "%-16s" $itemInfo.Name }}{{else}}{{ printf "%-17s" $itemInfo.Name }}{{end}}</ansi>{{ if ne $itemInfo.Description "" }} - <ansi fg="black-bold">{{ splitstring $itemInfo.Description 54 " " }}</ansi>{{ end }}
{{ end }}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ Set a property of the room. This updates basic properties of the room you are in
<ansi fg="command">room nouns</ansi> - List all nouns for the room
<ansi fg="command">room noun [name] [description]</ansi> - Add or overwrite a noun

Containers:
You can interactively add/remove/edit containers using the command:
<ansi fg="command">room edit containers</ansi>

<ansi fg="command">room exit [exit_name] [room_id]</ansi> - e.g. <ansi fg="command">room exit west 159</ansi>
This will create a new exit that links to a specific room_id using the exit_name provided.
<ansi fg="red-bold">!Beware!</ansi> if the spacial relationship with compass direction rooms is done incorrectly,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

{{ range $idx, $itemInfo := . }} <ansi fg="red-bold">{{ printf "%2d." (add $idx 1) }}</ansi> <ansi fg="yellow-bold">{{ printf "%-33s" $itemInfo.Name }}</ansi>{{ if eq (mod $idx 2) 1 }}{{ printf "\n" }}{{ end }}{{ end }}
{{ range $idx, $itemInfo := . }} <ansi fg="red-bold">{{ printf "%2d." (add $idx 1) }}</ansi> {{ if $itemInfo.Marked }}<ansi fg="white-bold" bg="2">{{else}}<ansi fg="yellow-bold">{{end}}{{ if $itemInfo.Marked }}*{{ printf "%-32s" $itemInfo.Name }}{{else}}{{ printf "%-33s" $itemInfo.Name }}{{end}}</ansi>{{ if eq (mod $idx 2) 1 }}{{ printf "\n" }}{{ end }}{{ end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

{{ range $idx, $itemInfo := . }} <ansi fg="red-bold">{{ printf "%2d." (add $idx 1) }}</ansi> <ansi fg="yellow-bold">{{ printf "%-17s" $itemInfo.Name }}</ansi>{{ if ne $itemInfo.Description "" }} - <ansi fg="black-bold">{{ splitstring $itemInfo.Description 54 " " }}</ansi>{{ end }}
{{ range $idx, $itemInfo := . }} <ansi fg="red-bold">{{ printf "%2d." (add $idx 1) }}</ansi> {{ if $itemInfo.Marked }}<ansi fg="white-bold" bg="2">{{else}}<ansi fg="yellow-bold">{{end}}{{ if $itemInfo.Marked }}*{{ printf "%-16s" $itemInfo.Name }}{{else}}{{ printf "%-17s" $itemInfo.Name }}{{end}}</ansi>{{ if ne $itemInfo.Description "" }} - <ansi fg="black-bold">{{ splitstring $itemInfo.Description 54 " " }}</ansi>{{ end }}
{{ end }}
6 changes: 6 additions & 0 deletions feature-screenshots/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ _Pets are special famliars that help the player and provide special bonuses or u

<a href="https://raw.githubusercontent.com/Volte6/GoMud/refs/heads/master/feature-screenshots/pets.png"><img src="https://raw.githubusercontent.com/Volte6/GoMud/refs/heads/master/feature-screenshots/pets.png" width="600" alt="accessibility text"></a>

## Containers & Recipes

_Containers hold stuff. Recipes turn containers into "Crafting machines"._

<a href="https://raw.githubusercontent.com/Volte6/GoMud/refs/heads/master/feature-screenshots/container-recipes.png"><img src="https://raw.githubusercontent.com/Volte6/GoMud/refs/heads/master/feature-screenshots/container-recipes.png" width="600" alt="accessibility text"></a>

## Custom Prompts

_Players can customize their prompts, including colors._
Expand Down
Binary file added feature-screenshots/container-recipes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion internal/connections/connections.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,12 @@ func Remove(id ConnectionId) (err error) {
return errors.New("connection not found")
}

func Broadcast(colorizedText []byte) {
func Broadcast(colorizedText []byte) []ConnectionId {

lock.Lock()

removeIds := []ConnectionId{}
sentToIds := []ConnectionId{}

for id, cd := range netConnections {

Expand All @@ -169,12 +170,15 @@ func Broadcast(colorizedText []byte) {
removeIds = append(removeIds, id)
}

sentToIds = append(sentToIds, id)
}
lock.Unlock()

for _, id := range removeIds {
Remove(id)
}

return sentToIds
}

func SendTo(b []byte, ids ...ConnectionId) {
Expand Down
6 changes: 5 additions & 1 deletion internal/gamelock/gamelock.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import (
"github.com/volte6/gomud/internal/util"
)

const (
DefaultRelockTime = `1 hour`
)

type Lock struct {
Difficulty uint8 `yaml:"difficulty,omitempty"` // 0 - no lock. greater than zero = difficulty to unlock.
UnlockedRound uint64 `yaml:"-"` // What round it was unlocked at, when util.GetRoundCount() > UnlockedUntil, it is relocked (set to zero).
Expand All @@ -26,7 +30,7 @@ func (l Lock) IsLocked() bool {
gd := gametime.GetDate(rndNow)

if l.RelockInterval == `` {
return rndNow >= gd.AddPeriod(`1 hour`)
return rndNow >= gd.AddPeriod(DefaultRelockTime)
}

return rndNow >= gd.AddPeriod(l.RelockInterval)
Expand Down
2 changes: 2 additions & 0 deletions internal/items/itemspec.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ type ItemTypeInfo struct {
func ItemTypes() []ItemTypeInfo {
return []ItemTypeInfo{
// Equipment
// Equipment - Weapons
{string(Weapon), `This can be wielded as a weapon.`, 0, 10000, 19999},
// Equipment - Armor
{string(Offhand), `This can be worn in the offhand.`, 0, 20000, 29999},
{string(Head), `This can be worn in the players head equipment slot.`, 0, 20000, 29999},
{string(Neck), `This can be worn in the players neck equipment slot.`, 0, 20000, 29999},
Expand Down
2 changes: 1 addition & 1 deletion internal/items/newitemfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func getNextItemId(t ItemType) int {
lowestFreeId := 1
for _, iSpec := range items {

if iSpec.Type != t {
if iSpec.ItemId < rangeMin || iSpec.ItemId > rangeMax {
continue
}

Expand Down
19 changes: 16 additions & 3 deletions internal/prompt/prompt.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,18 @@ type Question struct {
}

type Prompt struct {
Command string // Where does it call when complete?
Rest string // What is the 'rest' of the command
Questions []*Question // All questions so far
Command string // Where does it call when complete?
Rest string // What is the 'rest' of the command
Questions []*Question // All questions so far
State map[string]any // Optional place to store state
}

func New(command string, rest string) *Prompt {
return &Prompt{
Command: command,
Rest: rest,
Questions: make([]*Question, 0),
State: map[string]any{},
}
}

Expand Down Expand Up @@ -102,6 +104,17 @@ func (p *Prompt) GetNextQuestion() *Question {
return nil
}

func (p *Prompt) Store(name string, val any) {
p.State[name] = val
}

func (p *Prompt) Recall(name string) (any, bool) {
if v, ok := p.State[name]; ok {
return v, true
}
return nil, false
}

func (q *Question) Reset() {
q.Done = false
}
Expand Down
3 changes: 2 additions & 1 deletion internal/templates/name_description.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ package templates

// A common structure used in templating
type NameDescription struct {
Id any // optional identifier.
Id any // optional identifier.
Marked bool // mark in some way?
Name string
Description string
}
Loading
Loading