Documentation
¶
Index ¶
- Constants
- func AddMemoryReporter(name string, reporter MemReport)
- func BoolYN(b bool) string
- func BreakIntoParts(full string) []string
- func Compress(input []byte) []byte
- func ConvertColorShortTags(input string) string
- func ConvertForFilename(input string) string
- func Decode(base64str string) []byte
- func Decompress(input []byte) []byte
- func Encode(blobdata []byte) string
- func FilePath(pathParts ...string) string
- func FindMatchIn(searchName string, items ...string) (match string, closeMatch string)
- func FormatBytes(bytes uint64) string
- func FormatDiceRoll(attacks int, dCount int, dSides int, bonus int, buffOnCrit []int) string
- func FormatNumber(n int) string
- func GetLockSequence(lockIdentifier string, difficulty int, seed string) string
- func GetMatchNumber(input string) (string, int)
- func GetMemoryReport() (names []string, trackedResults []map[string]MemoryResult)
- func GetMyIP() string
- func GetRoundCount() uint64
- func GetServerAddress() string
- func GetTurnCount() uint64
- func Hash(input string) string
- func HashBytes(input []byte) string
- func HealthClass(health int, maxHealth int) string
- func IncrementRoundCount() uint64
- func IncrementTurnCount() uint64
- func LoadRoundCount(fpath string) uint64
- func LockMud()
- func LogRoll(name string, rollResult int, targetNumber int)
- func ManaClass(mana int, maxMana int) string
- func Md5(input string) string
- func Md5Bytes(input []byte) []byte
- func MemoryUsage(i interface{}) uint64
- func ParseDiceRoll(dRoll string) (attacks int, dCount int, dSides int, bonus int, buffOnCrit []int)
- func PercentOfTotal(value1 int, value2 int) float64
- func ProgressBar(complete float64, maxBarSize int, barParts ...string) (fullBar string, emptyBar string)
- func QuantizeTens(value int, max int) int
- func RLockMud()
- func RUnlockMud()
- func Rand(maxInt int) int
- func RollDice(dice int, sides int) int
- func SafeSave(path string, data []byte) error
- func Save(path string, data []byte, doSafe ...bool) error
- func SaveRoundCount(fpath string)
- func ServerGetMemoryUsage() map[string]MemoryResult
- func ServerStats() string
- func SetRoundCount(newRoundCount uint64)
- func SetServerAddress(addr string)
- func SplitButRespectQuotes(s string) []string
- func SplitString(input string, lineWidth int) []string
- func SplitStringNL(input string, lineWidth int, nlPrefix ...string) string
- func StringWildcardMatch(stringToSearch string, patternToSearch string) bool
- func StripANSI(str string) string
- func StripCharsForScreenReaders(s string) string
- func StripPrepositions(input string) string
- func TrackTime(name string, timePassed float64)
- func UnlockMud()
- func ValidateWorldFiles(exampleWorldPath string, worldPath string) error
- type Accumulator
- type MemReport
- type MemoryResult
Constants ¶
const ( // start at 1314000 (approx. 4 years in the future) to avoid complexities of // delta comparisons and to allow for date adjustments. RoundCountMinimum = 1314000 RoundCountFilename = `.roundcount` )
Variables ¶
This section is empty.
Functions ¶
func AddMemoryReporter ¶
func BreakIntoParts ¶
func ConvertColorShortTags ¶
func ConvertForFilename ¶
Make everything lowercase Convert anything that isn't a-z, 0-9 into _
func Decompress ¶
func FindMatchIn ¶
func FormatBytes ¶
func FormatDiceRoll ¶
func FormatNumber ¶
func GetLockSequence ¶
func GetMatchNumber ¶
accepts an input and splits it along a # if any. By default returns the full string and 1 as the number.
func GetMemoryReport ¶
func GetMemoryReport() (names []string, trackedResults []map[string]MemoryResult)
func GetRoundCount ¶
func GetRoundCount() uint64
func GetServerAddress ¶
func GetServerAddress() string
func GetTurnCount ¶
func GetTurnCount() uint64
func HealthClass ¶
func IncrementRoundCount ¶
func IncrementRoundCount() uint64
func IncrementTurnCount ¶
func IncrementTurnCount() uint64
func LoadRoundCount ¶
func LockMud ¶
func LockMud()
Mutex lock intended for synchronizing at a high level between components that may asyncronously access game data
func MemoryUsage ¶
func MemoryUsage(i interface{}) uint64
func ParseDiceRoll ¶
Gets the specifics of the item damage Format: 2@1d3+2#1,2,3
func PercentOfTotal ¶
func ProgressBar ¶
func QuantizeTens ¶
Creates a percentage and quantizes it to the nearest 10
func RUnlockMud ¶
func RUnlockMud()
func SafeSave ¶
SafeSave first saves to a temp file, then renames it to save over the target destination This is to lessen the risk of a partial write being interrupted and corrupting the file due to power loss etc.
func SaveRoundCount ¶
func SaveRoundCount(fpath string)
func ServerGetMemoryUsage ¶
func ServerGetMemoryUsage() map[string]MemoryResult
func ServerStats ¶
func ServerStats() string
func SetRoundCount ¶
func SetRoundCount(newRoundCount uint64)
func SetServerAddress ¶
func SetServerAddress(addr string)
func SplitButRespectQuotes ¶
func SplitString ¶
func SplitStringNL ¶
Splits a string by adding line breaks at the end of each line
func StringWildcardMatch ¶
func StripPrepositions ¶
Strips out common prepositions from a string
func ValidateWorldFiles ¶
Types ¶
type Accumulator ¶
type Accumulator struct { Name string Total float64 Lowest float64 Highest float64 Count float64 Start time.Time }
func GetTimeTrackers ¶
func GetTimeTrackers() []Accumulator
func (*Accumulator) Average ¶
func (t *Accumulator) Average() float64
func (*Accumulator) Record ¶
func (t *Accumulator) Record(nextValue float64)
type MemReport ¶
type MemReport func() map[string]MemoryResult