Documentation ¶
Overview ¶
Package util provides miscellaneous utility functions that don't deserve their own package.
Index ¶
- Constants
- func CoreExport(db *sql.DB, prefs *CorePreferences, fp *os.File) error
- func CoreImport(db *sql.DB, prefs *CorePreferences, fp io.Reader) error
- func DebugFlagNameSlice(flags DebugFlags, collapse bool) []string
- func DebugFlagNames(flags DebugFlags) string
- func ExportBestiary(fp *os.File, db *sql.DB, prefs *CorePreferences) error
- func ExportClasses(fp *os.File, db *sql.DB, prefs *CorePreferences) error
- func ExportFeats(fp *os.File, db *sql.DB, prefs *CorePreferences) error
- func ExportLanguages(fp *os.File, db *sql.DB, prefs *CorePreferences) error
- func ExportSkills(fp *os.File, db *sql.DB, prefs *CorePreferences) error
- func ExportSpells(fp *os.File, db *sql.DB, prefs *CorePreferences) error
- func ExportWeapons(fp *os.File, db *sql.DB, prefs *CorePreferences) error
- func FancyFileName(path string, extras map[byte]string) (string, error)
- func Hexdump(data []byte, opts ...func(*hdopt)) string
- func ImportClass(decoder *json.Decoder, db *sql.DB, prefs *CorePreferences) error
- func ImportFeat(decoder *json.Decoder, db *sql.DB, prefs *CorePreferences) error
- func ImportLanguage(decoder *json.Decoder, db *sql.DB, prefs *CorePreferences) error
- func ImportMonster(decoder *json.Decoder, db *sql.DB, prefs *CorePreferences) error
- func ImportSkill(decoder *json.Decoder, db *sql.DB, prefs *CorePreferences) error
- func ImportSpell(decoder *json.Decoder, db *sql.DB, prefs *CorePreferences) error
- func ImportWeapon(decoder *json.Decoder, db *sql.DB, prefs *CorePreferences) error
- func OverrideBool(key string, value bool) func(SimpleConfigurationData) error
- func OverrideBoolWithNegation(key string, value bool, neg bool) func(SimpleConfigurationData) error
- func OverrideInt(key string, value int) func(SimpleConfigurationData) error
- func OverrideString(key string, value string) func(SimpleConfigurationData) error
- func PluralizeCustom(base, singularSuffix, pluralSuffix string, qty int) string
- func PluralizeString(base string, qty int) string
- func SearchInPath(program string) (string, error)
- func TypeFilterNameSlice(types TypeFilter, collapse bool) []string
- func TypeFilterNames(types TypeFilter) string
- func UpdateSimpleConfig(inputFile io.Reader, data SimpleConfigurationData) error
- func VersionCompare(a, b string) (int, error)
- func WithStartingAddress(a int) func(*hdopt)
- func WithWidth(w int) func(*hdopt)
- func WithWordSize(w int) func(*hdopt)
- func WithoutText(o *hdopt)
- type AbilityScore
- type AttackMode
- type BaseLanguage
- type ButtonSize
- type CasterData
- type Class
- type ClassSpellLevel
- type ClockStyles
- type ColorSet
- type CorePreferences
- type DebugFlags
- type DialogStyles
- type DieRollComponent
- type DieRollStyles
- type Feat
- type FontSlant
- type FontWeight
- type GMANetworkProfile
- type GMAPreferences
- type GMAWorld
- type GridGuide
- type GridOffsets
- type ImageType
- type InitiativeSeedData
- type Language
- type Monster
- type MonsterFeat
- type MonsterSkill
- type PreparedSpell
- type SavingThrow
- type ServerProfile
- type SimpleConfigurationData
- func (c SimpleConfigurationData) Get(key string) (string, bool)
- func (c SimpleConfigurationData) GetBool(key string) (bool, error)
- func (c SimpleConfigurationData) GetBoolDefault(key string, def bool) bool
- func (c SimpleConfigurationData) GetDefault(key, def string) (string, bool)
- func (c SimpleConfigurationData) GetInt(key string) (int, error)
- func (c SimpleConfigurationData) GetIntDefault(key string, def int) (int, error)
- func (c SimpleConfigurationData) Override(opts ...func(SimpleConfigurationData) error) error
- func (c SimpleConfigurationData) Set(key, value string)
- func (c SimpleConfigurationData) SetInt(key string, value int)
- type Skill
- type Spell
- type SpellBlock
- type SpellSlot
- type StyleDescription
- type TimerVisibility
- type TypeFilter
- type UnsupportedPreferencesVersionError
- type UserFont
- type UserPreferences
- type Weapon
- type WeaponDamageType
- type WeaponQuality
Constants ¶
const ( GMAMapperPreferencesMinimumVersion int = 1 GMAMapperPreferencesMaximumVersion int = 8 GMAPreferencesMinimumVersion int = 1 GMAPreferencesMaximumVersion int = 2 )
const ( DefaultFGColorDark = "#aaaaaa" DefaultFGColorLight = "#000000" DefaultBGColorDark = "#232323" DefaultBGColorLight = "#cccccc" DefaultCheckSelectDark = "#ffffff" DefaultCheckSelectLight = "#000000" DefaultCheckMenuDark = "#ffffff" DefaultCheckMenuLight = "#000000" DefaultBrightFGDark = "#ffffff" DefaultBrightFGLight = "#000000" DefaultGridDark = "#aaaaaa" DefaultGridLight = "blue" DefaultGridMajorDark = "#345f12" DefaultGridMajorLight = "#345f12" DefaultGridMinorDark = "#b00b03" DefaultGridMinorLight = "#b00b03" DefaultHandColorLight = "black" DefaultHandColorDark = "#aaaaaa" DefaultTickColorLight = "blue" DefaultTickColorDark = "#aaaaaa" DefaultFListFGLight = "black" DefaultFListFGDark = "white" DefaultFListBGLight = "white" DefaultFListBGDark = "#232323" DefaultNextFGLight = "white" DefaultNextFGDark = "white" DefaultNextBGLight = "black" DefaultNextBGDark = "#cc0000" DefaultCurBGLight = "#9cffb4" DefaultCurBGDark = "#003300" DefaultReadyBGLight = "#ff3333" DefaultReadyBGDark = "#ff0000" DefaultHoldBGLight = "#ffaaaa" DefaultHoldBGDark = "#610400" DefaultZeroHPLight = "#ff0000" DefaultZeroHPDark = "#ff0000" DefaultNegativeHPLight = "#000000" DefaultNegativeHPDark = "#000000" DefaultSlotFGLight = "#000000" DefaultSlotFGDark = "#666666" DefaultSlotBGLight = "#666666" DefaultSlotBGDark = "#232323" DefaultFlatFootedLight = "#3333ff" DefaultFlatFootedDark = "#3333ff" DefaultPresetNameLight = "blue" DefaultPresetNameDark = "cyan" )
Variables ¶
This section is empty.
Functions ¶
func CoreExport ¶ added in v5.7.0
CoreExport is the main interface for exporting data to JSON files from the GMA core database. The JSON file will be written in the format documented for the CoreImport function.
Given an open database connection db and a file fp open for writing, this will read through the database entries, calling the appropriate subordinate functions to handle the export of each data object found:
JSON Field Go Type Subordinate Function Bestiary Monster ExportBestiary Classes Class ExportClasses Feats Feat ExportFeats Languages BaseLanguage ExportLanguages Skills Skill ExportSkills Spells Spell ExportSpells Weapons Weapon ExportWeapons
The prefs parameter specifies debugging flags which control what information is logged during the export operation, as well as filtering options which specify which subset of the core database to actually export. The prefs.SRD field indicates whether the public SRD records should be exported (if true) or if the local entries should be exported instead (if false).
func CoreImport ¶ added in v5.7.0
CoreImport is the main interface for importing data from JSON files into the GMA core database. The format of the input JSON file must be:
{ "GMA_Core_Database_Export_Version": <v>, <type>: [ <objects of that type>, ... ], ... "SRD": <srd_bool> }
The amount of whitespace between JSON elements is immaterial but GMA_Core_Database_Export_Version must appear first, and SRD must appear last.
<v> ::= <integer> (file format version; currently must be 1) <type> ::= Bestiary | Classes | Feats | Languages | Skills | Spells | Weapons <srd_bool> ::= true | false (true if importing/exporting SRD data; false for local entries)
Given an open database connection db and a file fp open for reading, this will read through the JSON-encoded data from fp, calling the appropriate subordinate functions to handle the import of each data object found:
JSON Field Go Type Subordinate Function Bestiary Monster ImportMonster Classes Class ImportClass Feats Feat ImportFeat Languages BaseLanguage ImportLanguage Skills Skill ImportSkill Spells Spell ImportSpell Weapons Weapon ImportWeapon
The prefs parameter specifies debugging flags which control what information is logged during the import operation, as well as filtering options which specify which subset of the file data to actually read into the database. The prefs.SRD field indicates whether the imported entries should be noted as public SRD data (if true) or as local entries (if false).
Note that the SRD field in the JSON file merely indicates whether the data previously exported into that file was public SRD data or local entries; it is ignored by the CoreImport function.
func DebugFlagNameSlice ¶ added in v5.7.0
func DebugFlagNameSlice(flags DebugFlags, collapse bool) []string
DebugFlagNameSlice takes a set of bit-encoded debug flags and returns a slice of strings representing the bits that were set. If collapse is true, the single string "all" will be the only element in the slice if all bits are set; otherwise the individual bit names will be returned.
func DebugFlagNames ¶ added in v5.7.0
func DebugFlagNames(flags DebugFlags) string
DebugFlagNames is like DebugFlagNameSlice but returns a single string value listing the bit names in angle brackets, separated by commas.
func ExportBestiary ¶ added in v5.7.0
ExportBestiary exports all Monster values from the database, writing them to the open JSON file.
func ExportClasses ¶ added in v5.7.0
ExportClasses exports all classes from the database to the open JSON file, subect to any filtering options specified in prefs
func ExportFeats ¶ added in v5.7.0
ExportFeats reads all Feats from the database, writing them to the open JSON file.
func ExportLanguages ¶ added in v5.7.0
ExportLanguages reads all languages from the database, writing them to the open JSON file.
func ExportSkills ¶ added in v5.7.0
ExportSkills exports all the skill data from the database to the open JSON file.
func ExportSpells ¶ added in v5.7.0
ExportSpells exports the Spell objects from the database, writing them to the open JSON file.
func ExportWeapons ¶ added in v5.7.0
ExportWeapons exports all weapons from the database to the JSON file fp.
func FancyFileName ¶
FancyFileName expands tokens found in the path string to allow the user to specify dynamically-named files at runtime. If there's a problem with the formatting, an error is returned along with the original path.
The tokens which may appear in the path include the following (note that all of these are modified as appropriate to the locale's national conventions and language):
%A full weekday name %a abbreviated weekday name %B full month name %b abbreviated month name %C zero-padded two-digit year 00-99 %c time and date %d day of month as number 01-31 (zero padded) %e day of month as number 1-31 (space padded) %F == %Y-%m-%d %H hour as number 00-23 (zero padded) %h abbreviated month name (same as %b) %I hour as number 01-12 (zero padded) %j day of year as number 001-366 %k hour as number 0-23 (space padded) %L milliseconds as number 000-999 %l hour as number 1-12 (space padded) %M minute as number 00-59 %m month as number 01-12 %P process ID %p AM or PM %R == %H:%M %r == %I:%M:%S %p %S second as number 00-60 %s Unix timestamp as a number %T == %H:%M:%S %U week of the year as number 00-53 (Sunday as first day of week) %u weekday as number (1=Monday .. 7=Sunday) %V week of the year as number 00-53 (Monday as first day of week) %v == %e-%b-%Y %W week of the year as number 00-53 (Monday as first day of week) %w weekday as number (0=Sunday .. 6=Saturday) %X time %x date %Y full year %y two-digit year (00-99) %Z time zone name %z time zone offset from UTC %µ microseconds as number 000-999 %% literal % character
The extras parameter maps token names to static string values, so more tokens specific to the task at hand can be added, such as these that the mapper client adds:
%G "GM" if logged in as the GM, otherwise "" %N username %n module name
func Hexdump ¶
Hexdump takes an array of bytes and returns a multi-line string representing those bytes in a traditional hexdump format with an address field on the left, starting at address 0, showing 16 bytes per line, and a text bar along the right showing any printable ASCII characters found in the hexdump.
For example, calling
Hexdump([]byte("\x00\x81\x02\x03Hello, World™<>ABCDEFG"))
will return the string
00000000: 00 81 02 03 48 65 6C 6C 6F 2C 20 57 6F 72 6C 64 |....Hello, World| 00000010: E2 84 A2 3C 3E 41 42 43 44 45 46 47 |...<>ABCDEFG |
Options may be added after the data slice to control how the hex dump will be formatted: WithStartingAddress(addr), WithWidth(nbytes), WithWordSize(nbytes), and/or WithoutText.
func ImportClass ¶ added in v5.7.0
ImportClass reads the next Class object from the open JSON data stream, writing it to the database.
func ImportFeat ¶ added in v5.7.0
ImportFeat reads the next Feat object from the JSON stream, writing it to the database.
func ImportLanguage ¶ added in v5.7.0
ImportLanguage reads a BaseLanguage from the input JSON data stream, writing it to the database.
func ImportMonster ¶ added in v5.7.0
ImportMonster reads a Monster from the JSON input stream, writing it to the database.
func ImportSkill ¶ added in v5.7.0
ImportSkill reads a skill from the JSON stream and writes it to the database.
func ImportSpell ¶ added in v5.7.0
ImportSpell reads the next Spell from the input JSON stream, writing it to the database.
func ImportWeapon ¶ added in v5.7.0
ImportWeapon reads a weapon from the JSON input stream, writing it to the database.
func OverrideBool ¶
func OverrideBool(key string, value bool) func(SimpleConfigurationData) error
if the supplied value is true, update the config data to be true.
func OverrideBoolWithNegation ¶
func OverrideBoolWithNegation(key string, value bool, neg bool) func(SimpleConfigurationData) error
if the supplied value is true, update the config data to be true. if the supplied negation value is true, update the config data to be false.
func OverrideInt ¶
func OverrideInt(key string, value int) func(SimpleConfigurationData) error
if the supplied value is nonzero, update the config data to match.
func OverrideString ¶
func OverrideString(key string, value string) func(SimpleConfigurationData) error
if the supplied value is nonempty, update the config data to match.
func PluralizeCustom ¶
PluralizeCustom emits a properly-pluralized version of a string, where that is more complicated than just adding an "s" to the end.
func PluralizeString ¶
PluralizeString emits a properly-pluralized version of a string, by adding an "s" for quantities other than one.
func SearchInPath ¶ added in v5.3.0
SearchInPath looks for an executable program name by searching the user's execution path ($PATH environment variable)
func TypeFilterNameSlice ¶ added in v5.7.0
func TypeFilterNameSlice(types TypeFilter, collapse bool) []string
TypeFilterNameSlice takes a set of bit-encoded type filter flags and returns a slice of strings representing the bits that were set. If collapse is true, the single string "all" will be the only element in the slice if all bits are set; otherwise the individual bit names will be returned.
func TypeFilterNames ¶ added in v5.7.0
func TypeFilterNames(types TypeFilter) string
TypeFilterNames is like TypeFilterNameSlice but returns a single string value listing the bit names in angle brackets, separated by commas.
func UpdateSimpleConfig ¶
func UpdateSimpleConfig(inputFile io.Reader, data SimpleConfigurationData) error
UpdateSimpleConfig reads a configuration file as described for ParseSimpleConfig, but instead of creating a new set of config data, it updates an existing data set.
func VersionCompare ¶
VersionCompare compares version strings a and b. These strings must consist of integers separated with dots, such as "2" or "3.1". Any number of version levels are allowed, although generally only 2 or 3 are of practical use.
Returns <0 if a is a version before b, >0 if a is after b, or zero if they are the same.
As of version 5.0.0, this is simply a wrapper to the hashicorp go-version package.
func WithStartingAddress ¶
func WithStartingAddress(a int) func(*hdopt)
WithStartingAddress may be added as an option to the Hexdump function to change the starting address of the data being shown.
Example:
data := []byte("\x00\x81\x02\x03Hello, World™<>ABCDEFG") Hexdump(data, WithStartingAddress(0x4444))
will return the string
00004444: 00 81 02 03 48 65 6C 6C 6F 2C 20 57 6F 72 6C 64 |....Hello, World| 00004454: E2 84 A2 3C 3E 41 42 43 44 45 46 47 |...<>ABCDEFG |
func WithWidth ¶
func WithWidth(w int) func(*hdopt)
WithWidth may be added as an option to the Hexdump function to change the output width in bytes.
The behavior is undefined if the width is not a multiple of the word size.
Example:
data := []byte("\x00\x81\x02\x03Hello, World™<>ABCDEFG") Hexdump(data, WithWidth(8), WithStartingAddress(0x4444))
will return the string
00004444: 00 81 02 03 48 65 6C 6C |....Hell| 0000444C: 6F 2C 20 57 6F 72 6C 64 |o, World| 00004454: E2 84 A2 3C 3E 41 42 43 |...<>ABC| 0000445C: 44 45 46 47 |DEFG |
func WithWordSize ¶
func WithWordSize(w int) func(*hdopt)
WithWordSize may be added as an option to the Hexdump function to change the output word size in bytes.
Example:
data := []byte("\x00\x81\x02\x03Hello, World™<>ABCDEFG") Hexdump(data, WithWordSize(2))
will return the string
00000000: 0081 0203 4865 6C6C 6F2C 2057 6F72 6C64 |....Hello, World| 00000010: E284 A23C 3E41 4243 4445 4647 |...<>ABCDEFG |
func WithoutText ¶
func WithoutText(o *hdopt)
WithoutText may be added as an option to the Hexdump function to suppress the text column from the generated display.
Example:
data := []byte("\x00\x81\x02\x03Hello, World™<>ABCDEFG") Hexdump(data, WithWordSize(2), WithoutText)
will return the string
00000000: 0081 0203 4865 6C6C 6F2C 2057 6F72 6C64 00000010: E284 A23C 3E41 4243 4445 4647
Types ¶
type AbilityScore ¶ added in v5.7.0
type AbilityScore struct { // Raw score. Base int `json:",omitempty"` Special string `json:",omitempty"` // If NullScore is true, the creature simply does not have this ability score at all, // which is different than an ability score of zero. NullScore bool `json:",omitempty"` }
AbilityScore describes each of the creature's ability scores.
type AttackMode ¶ added in v5.7.0
type AttackMode struct { // Each tier is an individual way a monster can attack in a round. // If multiple AttackModes have the same Tier, they are all taken // together if making a full-round attack. Tier int // If this attack is based on a weapon, its Code appears here. BaseWeaponID string `json:",omitempty"` // The number of attacks the creature gets for this. Normally this is 1, // but could be, e.g., 2 for an attack listed as "2 Claws". Multiple int Name string // The name of the attack. If only part of this should be visible to the players // (e.g., in the online die-roller), then the player-visible parts should be in // square brackets (e.g., "+1 vorpal [shortsword]") // // If multiple attacks with different attack rolls are applicable, then // Multiple will be 1 and the different attacks are listed here with slashes // between them (e.g., "+17/+12/+7/+2") Attack string `json:",omitempty"` // The damage dealt by each blow from this attack. If there are parts of the // damage which should be seen by the GM only and not given to the players NOR the // die-roller, put the parts which should be given to the players and die roller in // square brackets (e.g., "[2d6 acid] plus poison"). // // If there is damage which is not multiplied on critical hits, enclose those // portions in angle brackets, including any math operators they use // (e.g., "2d6 <+1d6 electricity>"). On a critical hit, any text inside <...> will be // omitted entirely from the extra damage. Damage string `json:",omitempty"` Critical struct { CantCritical bool `json:",omitempty"` Threat int `json:",omitempty"` Multiplier int `json:",omitempty"` } `json:",omitempty"` Ranged struct { IsRanged bool `json:",omitempty"` Increment int `json:",omitempty"` MaxIncrements int `json:",omitempty"` } `json:",omitempty"` IsReach bool `json:",omitempty"` Special string `json:",omitempty"` // Attack mode (melee or ranged) Mode string `json:",omitempty"` }
AttackMode describes each attack a monster can make.
type BaseLanguage ¶ added in v5.7.0
BaseLanguage describes a language in use in the campaign world.
type ButtonSize ¶ added in v5.3.0
type ButtonSize byte
ButtonSize represents the valid sizes for buttons to be.
const ( SmallButtons ButtonSize = iota MediumButtons LargeButtons )
func (*ButtonSize) MarshalJSON ¶ added in v5.3.0
func (bs *ButtonSize) MarshalJSON() ([]byte, error)
func (*ButtonSize) UnmarshalJSON ¶ added in v5.3.0
func (bs *ButtonSize) UnmarshalJSON(b []byte) error
type CasterData ¶ added in v5.7.0
CasterData represents each entry in the GMA caster level list.
type Class ¶ added in v5.7.0
type Class struct { Code string Name string IsLocal bool `json:",omitempty"` // If this class includes spellcasting capability, the details are here. Spells struct { // Magic type (arcane, etc) Type string `json:",omitempty"` // Ability score relevant to spells Ability string `json:",omitempty"` // Does this class allow bonus spells (e.g., domain spells)? HasBonusSpells bool `json:",omitempty"` // Is this a spontaneous (vs prepared) casting class? IsSpontaneous bool `json:",omitempty"` // A list of the number of spells which may be cast per day by class and spell level CastPerDay []ClassSpellLevel `json:",omitempty"` // A list of the number of spells which may be prepared per day by class and spell level (or empty list if that doesn't apply) PreparedPerDay []ClassSpellLevel `json:",omitempty"` // A list of the number of spells which may be known by class and spell level (or empty list if that doesn't apply) SpellsKnown []ClassSpellLevel `json:",omitempty"` } `json:",omitempty"` }
Class describes a character class.
type ClassSpellLevel ¶ added in v5.7.0
type ClassSpellLevel struct { ClassLevel int SpellLevel int // Is this level of spell even possible at this class level (or is this thing applicable at all)? IsProhibited bool `json:",omitempty"` // Is this level of spell unlimited (in terms of usages per day) at this class level? IsUnlimitedUse bool `json:",omitempty"` // The number of spells granted at this spell and class level. Number int `json:",omitempty"` }
ClassSpellLevel describes a given spell-casting capability offered at a given class and spell level.
type ClockStyles ¶ added in v5.3.0
type ClockStyles struct { HandColor ColorSet `json:"hand_color,omitempty"` TickColor ColorSet `json:"tick_color,omitempty"` FListFGColor ColorSet `json:"flist_fg,omitempty"` FListBGColor ColorSet `json:"flist_bg,omitempty"` NextFGColor ColorSet `json:"next_fg,omitempty"` NextBGColor ColorSet `json:"next_bg,omitempty"` CurrentBGColor ColorSet `json:"cur_bg,omitempty"` ReadyBGColor ColorSet `json:"ready_bg,omitempty"` HoldBGColor ColorSet `json:"hold_bg,omitempty"` ZeroHPColor ColorSet `json:"zero_hp,omitempty"` NegativeHPColor ColorSet `json:"negative_hp,omitempty"` SlotFGColor ColorSet `json:"slot_fg,omitempty"` SlotBGColor ColorSet `json:"slot_bg,omitempty"` FlatFootedColor ColorSet `json:"flat_footed,omitempty"` TimeDispFont string `json:"timedisp_font,omitempty"` TurnDispFont string `json:"turndisp_font,omitempty"` DefaultFont string `json:"default_font,omitempty"` }
type CorePreferences ¶ added in v5.7.0
type CorePreferences struct { // If true, the sense of FilterRegexp is reversed: import/export only if pattern NOT matched. FilterExclude bool // If true, import/export SRD data, otherwise local entries. SRD bool // These bits indicate what kind of debugging information to send to the log output. DebugBits DebugFlags // These bits filter the kinds of entries to be imported or exported. TypeBits TypeFilter // If non-nil, only entries matching this regular expression will be included. // For most data types, the regexp is matched against the Code and Name struct fields. // The entry is considered a match if either field contains text that matches the regexp. // For BaseLanguage, the Language field is matched. For monsters, the Code and Species // fields are checked. FilterRegexp *regexp.Regexp }
CorePreferences holds preferences related to how import/export operations are filtered and executed.
type DebugFlags ¶ added in v5.7.0
type DebugFlags uint64
const ( DebugQuery DebugFlags = 1 << iota DebugMisc DebugAll DebugFlags = 0xffffffff )
func NamedDebugFlags ¶ added in v5.7.0
func NamedDebugFlags(names ...string) (DebugFlags, error)
NamedDebugFlags takes any number of string arguments which each name one of the DebugFlags bits. It returns the bit-encoded DebugFlags value with the named bits set.
type DialogStyles ¶ added in v5.3.0
type DialogStyles struct { HeadingFG ColorSet `json:"heading_fg,omitempty"` NormalFG ColorSet `json:"normal_fg,omitempty"` NormalBG ColorSet `json:"normal_bg,omitempty"` HighlightFG ColorSet `json:"highlight_fg,omitempty"` OddRowBG ColorSet `json:"odd_bg,omitempty"` EvenRowBG ColorSet `json:"even_bg,omitempty"` CheckSelectColor ColorSet `json:"check_select,omitempty"` CheckMenuColor ColorSet `json:"check_menu,omitempty"` BrightFG ColorSet `json:"bright_fg,omitempty"` GridColor ColorSet `json:"grid,omitempty"` MinorGridColor ColorSet `json:"grid_minor,omitempty"` MajorGridColor ColorSet `json:"grid_major,omitempty"` PresetNameColor ColorSet `json:"preset_name,omitempty"` }
type DieRollComponent ¶ added in v5.3.0
type DieRollComponent struct { FG ColorSet `json:"fg,omitempty"` BG ColorSet `json:"bg,omitempty"` FontName string `json:"font,omitempty"` Format string `json:"format,omitempty"` Overstrike bool `json:"overstrike,omitempty"` Underline bool `json:"underline,omitempty"` BaselineOffset int `json:"offset,omitempty"` }
DieRollComponent describes the settings for a specific chat or die-roll style component.
type DieRollStyles ¶ added in v5.3.0
type DieRollStyles struct { CompactRecents bool `json:"compact_recents,omitempty"` Components map[string]DieRollComponent `json:"components,omitempty"` }
type Feat ¶ added in v5.7.0
type Feat struct { Code string Name string // If there are parameters allowed for this feat, this describes them. Parameters string `json:",omitempty"` IsLocal bool `json:",omitempty"` Description string `json:",omitempty"` Flags uint64 `json:"-"` Prerequisites string `json:",omitempty"` Benefit string `json:",omitempty"` Normal string `json:",omitempty"` Special string `json:",omitempty"` Source string `json:",omitempty"` Race string `json:",omitempty"` Note string `json:",omitempty"` Goal string `json:",omitempty"` CompletionBenefit string `json:",omitempty"` SuggestedTraits string `json:",omitempty"` Types []string `json:",omitempty"` FlagNames []string `json:"Flags,omitempty"` // If this is a metamagic feat, the following will apply. MetaMagic struct { IsMetaMagicFeat bool `json:",omitempty"` Adjective string `json:",omitempty"` LevelCost int `json:",omitempty"` IsLevelCostVariable bool `json:",omitempty"` // Symbol to place in checkboxes on character sheets, if any. Symbol string `json:",omitempty"` } `json:",omitempty"` }
Feat describes each feat that is in play for the game.
type FontSlant ¶ added in v5.3.0
type FontSlant byte
FontSlant is the set of valid font slant values
type FontWeight ¶ added in v5.3.0
type FontWeight byte
FontWeight is the set of valid font weight values
const ( Regular FontWeight = iota Bold )
type GMANetworkProfile ¶ added in v5.7.0
type GMANetworkProfile struct { Hostname string `json:"hostname,omitempty"` Port int `json:"port,omitempty"` }
GMANetworkProfile represents the preferences settings for each network profile.
type GMAPreferences ¶ added in v5.7.0
type GMAPreferences struct { GMAPreferencesVersion int `json:"gma_preferences_file_version"` CoreDBPath string `json:"core_db"` Appearance struct { DarkMode bool `json:"dark_mode"` Scaling float64 `json:"scaling"` } `json:"appearance"` Worlds map[string]GMAWorld `json:"worlds"` Networks map[string]GMANetworkProfile `json:"networks"` CurrentWorldName string `json:"current_world"` CurrentNetworkName string `json:"network_profile"` }
GMAPreferences represents the preferences settings for GMA and its supporting utilities.
func DefaultGMAPreferences ¶ added in v5.7.0
func DefaultGMAPreferences() (GMAPreferences, error)
DefaultGMAPreferences returns a GMAPreferences value with default values.
func LoadGMAPreferencesWithDefaults ¶ added in v5.7.0
func LoadGMAPreferencesWithDefaults(stream io.Reader) (GMAPreferences, error)
LoadGMAPreferencesWithDefaults is like LoadPreferencesWithDefaults but for the GMA preferences file instead of the mapper's.
func (*GMAPreferences) Update ¶ added in v5.7.0
func (prefs *GMAPreferences) Update(stream io.Reader) error
Update reads a set of saved preferences as LoadGMAPreferences does, but rather than returning a new GMAPreferences value, it updates the values of an existing GMAPreferences value with the input data.
type GMAWorld ¶ added in v5.7.0
type GMAWorld struct { CalendarType string `json:"calendar_type"` ModulePath string `json:"module,omitempty"` BlurHP int `json:"blur_hp,omitempty"` DBName string `json:"db_name"` DisplayName string `json:"display_name"` InitiativeBackupPath string `json:"initiative_backup_path,omitempty"` Password string `json:"password,omitempty"` InitiativeSeed []InitiativeSeedData `json:"initiative_seed"` CasterLevels []CasterData `json:"caster_levels"` }
GMAWorld represents the preferences settings for each campaign world.
type GridGuide ¶ added in v5.3.0
type GridGuide struct { Interval int `json:"interval,omitempty"` Offsets GridOffsets `json:"offsets,omitempty"` }
GridGuide describes extra grid guidelines
type GridOffsets ¶ added in v5.3.0
GridOffsets provide x and y offsets for grid guides
type ImageType ¶ added in v5.3.0
type ImageType byte
ImageType represents the valid bitmap types supported by the mapper.
func (*ImageType) MarshalJSON ¶ added in v5.3.0
func (*ImageType) UnmarshalJSON ¶ added in v5.3.0
type InitiativeSeedData ¶ added in v5.7.0
type InitiativeSeedData struct { Name string `json:"name"` Dexterity int `json:"dex"` Constitution int `json:"con"` InitAdj int `json:"init_adj"` HP int `json:"hp"` BlurHP int `json:"blur_hp"` IsPC bool `json:"is_pc"` DieSpec string `json:"die_spec"` }
InitiativeSeedData represents each entry in the GMA initiative seed list.
type Language ¶ added in v5.7.0
type Language struct { Name string `json:",omitempty"` // Can the creature understand the language but not speak? IsMute bool `json:",omitempty"` // Any special considerations for this language for this creature. Special string `json:",omitempty"` }
Language describes each language known by a creature.
type Monster ¶ added in v5.7.0
type Monster struct { IsLocal bool Species string Code string CR string XP int Class string `json:",omitempty"` Alignment struct { Alignments []string Special string `json:",omitempty"` } Source string `json:",omitempty"` Size struct { Code string SpaceText string `json:",omitempty"` ReachText string `json:",omitempty"` } Type string Subtypes []string `json:",omitempty"` Initiative struct { Mod int Special string `json:",omitempty"` } Senses string `json:",omitempty"` Aura string `json:",omitempty"` HP struct { Typical int `json:",omitempty"` Current int `json:",omitempty"` Special string `json:",omitempty"` HitDice string } Save struct { Fort SavingThrow Refl SavingThrow Will SavingThrow Special string `json:",omitempty"` } DefensiveAbilities string `json:",omitempty"` DR struct { DR int `json:",omitempty"` Bypass string `json:",omitempty"` } `json:",omitempty"` Immunities string `json:",omitempty"` Resists string `json:",omitempty"` SR struct { SR int `json:",omitempty"` Special string `json:",omitempty"` } `json:",omitempty"` Weaknesses string `json:",omitempty"` Speed struct { Code string Special string `json:",omitempty"` } SpecialAttacks string `json:",omitempty"` Abilities struct { Str AbilityScore Dex AbilityScore Con AbilityScore Int AbilityScore Wis AbilityScore Cha AbilityScore } Combat struct { BAB int CMB int CMD int CMBSpecial string `json:",omitempty"` CMDSpecial string `json:",omitempty"` } SQ string `json:",omitempty"` Environment string `json:",omitempty"` Organization string `json:",omitempty"` Treasure string `json:",omitempty"` Appearance string `json:",omitempty"` Group string `json:",omitempty"` IsTemplate bool `json:",omitempty"` Strategy struct { BeforeCombat string `json:",omitempty"` DuringCombat string `json:",omitempty"` Morale string `json:",omitempty"` } `json:",omitempty"` IsCharacter bool `json:",omitempty"` IsCompanion bool `json:",omitempty"` IsUnique bool `json:",omitempty"` AgeCategory string `json:",omitempty"` Gender string `json:",omitempty"` Bloodline string `json:",omitempty"` Patron string `json:",omitempty"` AlternateNameForm string `json:",omitempty"` DontUseRacialHD bool `json:",omitempty"` VariantParent string `json:",omitempty"` Mythic struct { IsMythic bool `json:",omitempty"` MR int `json:",omitempty"` MT int `json:",omitempty"` } `json:",omitempty"` OffenseNote string `json:",omitempty"` StatisticsNote string `json:",omitempty"` Gear struct { Combat string `json:",omitempty"` Other string `json:",omitempty"` } `json:",omitempty"` Schools struct { Focused string `json:",omitempty"` Prohibited string `json:",omitempty"` Opposition string `json:",omitempty"` } `json:",omitempty"` ClassArchetypes string `json:",omitempty"` BaseStatistics string `json:",omitempty"` RacialMods string `json:",omitempty"` Mystery string `json:",omitempty"` Notes string `json:",omitempty"` Domains []string `json:",omitempty"` AC struct { Components map[string]int `json:",omitempty"` Adjustments map[string]int `json:",omitempty"` } `json:",omitempty"` AttackModes []AttackMode `json:",omitempty"` Languages []Language `json:",omitempty"` Feats []MonsterFeat `json:",omitempty"` Skills []MonsterSkill `json:",omitempty"` Spells []SpellBlock `json:",omitempty"` }
Monster describes a creature (could be an individual or descriptive of a species)
type MonsterFeat ¶ added in v5.7.0
type MonsterFeat struct { // Feat code identifies the feat (must exist in the core feat list). Code string `json:",omitempty"` // Parameters hold any specific parameters (e.g. "sword" in "weapon focus (sword)"). Parameters string `json:",omitempty"` // Is this a bonus feat for this creature? IsBonus bool `json:",omitempty"` }
MonsterFeat describes each feat known by the creature.
type MonsterSkill ¶ added in v5.7.0
type MonsterSkill struct { Code string `json:",omitempty"` Modifier int `json:",omitempty"` Notes string `json:",omitempty"` }
MonsterSkill describes the significant skills for the creature.
type PreparedSpell ¶ added in v5.7.0
type PreparedSpell struct { Name string // Some spell-like abilities are based on a core spell (named in Name), // with some different effects (listed in Special), and with a new name // (named in AlternateName). For example, "coldball" is like "fireball" // but deals cold damage. AlternateName string `json:",omitempty"` // For spell-like abilities, how may times per day the spell can be cast. Frequency string `json:",omitempty"` Special string `json:",omitempty"` // Each instance of this prepared spell is described in Slots. Slots []SpellSlot }
PreparedSpell describes a spell that a creature has prepared to cast, or a spell-like ability it can use.
type SavingThrow ¶ added in v5.7.0
type SavingThrow struct { Mod int Special string `json:",omitempty"` NoSavingThrow bool `json:",omitempty"` }
SavingThrow describes each of the creature's saving throw.
type ServerProfile ¶ added in v5.3.0
type ServerProfile struct { Name string `json:"name"` Host string `json:"host,omitempty"` Port int `json:"port,omitempty"` UserName string `json:"username,omitempty"` Password string `json:"password,omitempty"` CurlProxy string `json:"curl_proxy,omitempty"` BlurAll bool `json:"blur_all,omitempty"` BlurPct int `json:"blur_pct,omitempty"` SuppressChat bool `json:"suppress_chat,omitempty"` ChatLimit int `json:"chat_limit,omitempty"` ChatLog string `json:"chat_log,omitempty"` CurlServer string `json:"curl_server,omitempty"` UpdateURL string `json:"update_url,omitempty"` ModuleID string `json:"module_id,omitempty"` ServerMkdir string `json:"server_mkdir,omitempty"` NcPath string `json:"nc_path,omitempty"` ScpPath string `json:"scp_path,omitempty"` ScpDest string `json:"scp_dest,omitempty"` ScpServer string `json:"scp_server,omitempty"` ScpProxy string `json:"scp_proxy,omitempty"` SshPath string `json:"ssh_path,omitempty"` }
ServerProfile describes each set of preferences associated with a given server as opposed to global settings which apply regardless of server.
type SimpleConfigurationData ¶
func NewSimpleConfigurationData ¶
func NewSimpleConfigurationData() SimpleConfigurationData
NewSimpleConfigurationData creates a ready-to-use SampleConfigurationData value which you can call Set, et al. directly without having read in a configuration from a file first.
func ParseSimpleConfig ¶
func ParseSimpleConfig(inputFile io.Reader) (SimpleConfigurationData, error)
ParseSimpleConfig parses a minimal configuration file format used by the mapper that isn't a full INI file. Rather, it's a simple "key=value" collection with one entry per line in the file. The key must be alphanumeric (including underscores and hyphens), while the value may include any characters. Spaces before or after the key are ignored, as are spaces before or after the value.
A key alone on a line (without an = sign) indicates a boolean true value for that key.
Lines starting with a # sign (allowing for leading spaces before that) are ignored as comments.
func (SimpleConfigurationData) Get ¶
func (c SimpleConfigurationData) Get(key string) (string, bool)
Get retrieves a string value from the configuration data. Returns the string value, or "" if the key does not exist, and a boolean indicating whether the value existed in the data.
func (SimpleConfigurationData) GetBool ¶
func (c SimpleConfigurationData) GetBool(key string) (bool, error)
GetBool retrieves a boolean value from the configuration data. Returns an error if the value does not exist or could not be converted to a boolean.
This considers values "0", "false", "no", or "off" to be false, and non-zero integers, "true", "yes", or "on" to be true. Non-existent keys are considered to be false.
func (SimpleConfigurationData) GetBoolDefault ¶
func (c SimpleConfigurationData) GetBoolDefault(key string, def bool) bool
func (SimpleConfigurationData) GetDefault ¶
func (c SimpleConfigurationData) GetDefault(key, def string) (string, bool)
GetDefault retrieves a string value from the configuration data, or the supplied default value if no such key exists.
func (SimpleConfigurationData) GetInt ¶
func (c SimpleConfigurationData) GetInt(key string) (int, error)
GetInt retrieves an integer value from the configuration data. Returns an error if the value does not exist or could not be converted to an integer.
func (SimpleConfigurationData) GetIntDefault ¶
func (c SimpleConfigurationData) GetIntDefault(key string, def int) (int, error)
GetIntDefault retrieves an integer value from the configuration data. Returns an error if the value could not be converted to an integer, or the given default value if the key could not be found.
func (SimpleConfigurationData) Override ¶
func (c SimpleConfigurationData) Override(opts ...func(SimpleConfigurationData) error) error
func (SimpleConfigurationData) Set ¶
func (c SimpleConfigurationData) Set(key, value string)
Set adds a key/value pair to the SimpleConfigurationData receiver. If key already exists, it will be replaced with this new value.
func (SimpleConfigurationData) SetInt ¶
func (c SimpleConfigurationData) SetInt(key string, value int)
type Skill ¶ added in v5.7.0
type Skill struct { Name string Code string // List of the class Code strings for those classes which have this skill as a class skill. ClassSkillFor []string `json:",omitempty"` // Relevant ability score name Ability string HasArmorPenalty bool `json:",omitempty"` TrainingRequired bool `json:",omitempty"` Source string `json:",omitempty"` Description string `json:",omitempty"` FullText string `json:",omitempty"` // If this is a sub-skill, the skill code for its parent (e.g., "craft" for "craft.alchemy") ParentSkill string `json:",omitempty"` // If this is a parent skill but ONLY its children should be instantiated, not this skill itself. IsVirtual bool `json:",omitempty"` IsBackground bool `json:",omitempty"` IsLocal bool `json:",omitempty"` }
Skill describes a skill that any creature might have.
type Spell ¶ added in v5.7.0
type Spell struct { IsLocal bool `json:",omitempty"` Name string Code string School string Descriptors []string `json:",omitempty"` Components struct { Components []string Material string `json:",omitempty"` Focus string `json:",omitempty"` HasCostlyComponents bool `json:",omitempty"` MaterialCosts int `json:",omitempty"` } Casting struct { Time string Special string `json:",omitempty"` } Range struct { // Range code Range string // Specific distance if called for by the range code. Distance int `json:",omitempty"` // Distance to add per level. DistancePerLevel int `json:",omitempty"` DistanceSpecial string `json:",omitempty"` } Effect struct { Area string `json:",omitempty"` Effect string `json:",omitempty"` Targets string `json:",omitempty"` } Duration struct { // Duration code. Duration string // Specific amount of time if called for by the duration code. Time string `json:",omitempty"` Special string `json:",omitempty"` // Does the spell last while concentrated upon? Concentration bool `json:",omitempty"` // Is the duration specified here multiplied by their level? PerLevel bool `json:",omitempty"` } SR struct { SR string `json:",omitempty"` Special string `json:",omitempty"` Object bool `json:",omitempty"` Harmless bool `json:",omitempty"` } `json:",omitempty"` Save struct { SavingThrow string `json:",omitempty"` Effect string `json:",omitempty"` Special string `json:",omitempty"` Object bool `json:",omitempty"` Harmless bool `json:",omitempty"` } `json:",omitempty"` IsDismissible bool `json:",omitempty"` IsDischarge bool `json:",omitempty"` IsShapeable bool `json:",omitempty"` // ClassLevels lists what level of spell this is for each spellcasting class that can cast it. // Note that Class is "SLA" for spell-like abilities. ClassLevels []struct { Class string Level int } Deity string `json:",omitempty"` Domain string `json:",omitempty"` Description string `json:",omitempty"` Source string `json:",omitempty"` Bloodline string `json:",omitempty"` Patron string `json:",omitempty"` }
Spell describes a spell in the campaign world.
type SpellBlock ¶ added in v5.7.0
type SpellBlock struct { ClassName string CL int `json:",omitempty"` Concentration int `json:",omitempty"` NoConcentrationValue bool `json:",omitempty"` // Add this many domain spells at each level. PlusDomain int `json:",omitempty"` Description string `json:",omitempty"` Special string `json:",omitempty"` // List of the spells prepared/known for this block. Spells []PreparedSpell }
SpellBlock describes a set of spells prepared by a creature. There may be multiple blocks if it has multiple types of spells. There will also be one of these for spell-like abilities in which case ClassName will be "SLA".
type SpellSlot ¶ added in v5.7.0
type SpellSlot struct { IsCast bool `json:",omitempty"` IsDomain bool `json:",omitempty"` // A list of metamagic feats used when preparing this instance. MetaMagic []string `json:",omitempty"` }
SpellSlot describes each prepared instance of a particular spell.
type StyleDescription ¶ added in v5.3.0
type StyleDescription struct { Clocks ClockStyles `json:"clocks,omitempty"` Dialogs DialogStyles `json:"dialogs,omitempty"` DieRolls DieRollStyles `json:"dierolls,omitempty"` }
StyleDescription describes the different kinds of style settings.
type TimerVisibility ¶ added in v5.19.0
type TimerVisibility byte
TimerVisibility represents which timers a user wishes to see on their client's display.
const ( ShowNoTimers TimerVisibility = iota ShowMyTimers ShowAllTimers )
func (*TimerVisibility) MarshalJSON ¶ added in v5.19.0
func (tv *TimerVisibility) MarshalJSON() ([]byte, error)
func (*TimerVisibility) UnmarshalJSON ¶ added in v5.19.0
func (tv *TimerVisibility) UnmarshalJSON(b []byte) error
type TypeFilter ¶ added in v5.7.0
type TypeFilter uint64
const ( TypeBestiary TypeFilter = 1 << iota TypeClass TypeFeat TypeLanguage TypeSkill TypeSpell TypeWeapon AllTypes TypeFilter = 0xffffffff )
func NamedTypeFilters ¶ added in v5.7.0
func NamedTypeFilters(names ...string) (TypeFilter, error)
NamedTypeFilters takes any number of string arguments which each name one of the TypeFilter bits. It returns the bit-encoded TypeFilter value with the named bits set.
type UnsupportedPreferencesVersionError ¶ added in v5.15.0
type UnsupportedPreferencesVersionError struct { MinimumVersion int MaximumVersion int DataVersion int }
func (UnsupportedPreferencesVersionError) Error ¶ added in v5.15.0
func (e UnsupportedPreferencesVersionError) Error() string
type UserFont ¶ added in v5.3.0
type UserFont struct { Family string `json:"family,omitempty"` Size float64 `json:"size,omitempty"` Weight FontWeight `json:"weight,omitempty"` Slant FontSlant `json:"slant,omitempty"` Overstrike bool `json:"overstrike,omitempty"` Underline string `json:"underline,omitempty"` }
UserFont describes a user-defined font.
type UserPreferences ¶ added in v5.3.0
type UserPreferences struct { GMAMapperPreferencesVersion int `json:"GMA_Mapper_preferences_version"` Animate bool `json:"animate,omitempty"` ButtonSize ButtonSize `json:"button_size,omitempty"` ChatTimestamp bool `json:"chat_timestamp,omitempty"` ColorizeDieRolls bool `json:"colorize_die_rolls,omitempty"` CurlPath string `json:"curl_path,omitempty"` CurlInsecure bool `json:"curl_insecure,omitempty"` CurrentProfile string `json:"current_profile,omitempty"` DarkMode bool `json:"dark,omitempty"` DebugLevel int `json:"debug_level,omitempty"` DebugProtocol bool `json:"debug_proto,omitempty"` FlashUpdates bool `json:"flash_updates,omitempty"` GuideLines struct { Major GridGuide `json:"major,omitempty"` Minor GridGuide `json:"minor,omitempty"` } `json:"guide_lines,omitempty"` ImageFormat ImageType `json:"image_format,omitempty"` KeepTools bool `json:"keep_tools,omitempty"` MenuButton bool `json:"menu_button,omitempty"` NeverAnimate bool `json:"never_animate,omitempty"` PreloadImages bool `json:"preload,omitempty"` Profiles []ServerProfile `json:"profiles,omitempty"` Fonts map[string]UserFont `json:"fonts,omitempty"` Scaling float64 `json:"scaling,omitempty"` ShowTimers TimerVisibility `json:"show_timers,omitempty"` Styles StyleDescription `json:"styles,omitempty"` }
UserPreferences represents the preferences settings for the GMA Mapper.
This represents preferences version 4.
func DefaultPreferences ¶ added in v5.3.0
func DefaultPreferences() UserPreferences
DefaultPreferences returns a UserPreferences list with a reasonable set of default values.
func LoadPreferences ¶ added in v5.3.0
func LoadPreferences(stream io.Reader) (UserPreferences, error)
LoadPreferences reads a set of saved preferences from an io.Reader, returning a new UserPreferences value from that data. Any fields not specified in the input data will have zero values.
func LoadPreferencesWithDefaults ¶ added in v5.3.0
func LoadPreferencesWithDefaults(stream io.Reader) (UserPreferences, error)
LoadPreferencesWithDefaults reads a set of saved preferences from an open file or other io.Reader object. It provides default values for fields not specified in the input data.
func (*UserPreferences) Update ¶ added in v5.3.0
func (prefs *UserPreferences) Update(stream io.Reader) error
Update reads a set of saved preferences as LoadPreferences does, but rather than returning a new UserPreferences value, it updates the values of an existing UserPreferences value with the input data.
func (*UserPreferences) UpdateFromSimpleConfig ¶ added in v5.3.0
func (prefs *UserPreferences) UpdateFromSimpleConfig(profileName string, cfg SimpleConfigurationData) error
UpdateFromSimpleConfig updates the corresponding configuration values in a UserPreferences value from a set of key=value pairs read from a simple config file.
type Weapon ¶ added in v5.7.0
type Weapon struct { IsLocal bool `json:",omitempty"` Code string // Cost is in units of copper pieces. Cost int `json:",omitempty"` Name string // Damage maps a size code to the damage done for a weapon of that size. Damage map[string]string Critical struct { // If true, no critical information is available / weapon can't inflict critical damage. CantCritical bool `json:",omitempty"` Multiplier int `json:",omitempty"` Threat int `json:",omitempty"` } Ranged struct { Increment int `json:",omitempty"` MaxIncrements int `json:",omitempty"` IsRanged bool `json:",omitempty"` } `json:",omitempty"` // Weight is in units of grams. Weight int `json:",omitempty"` // DamageTypes is a bitmap of types of damage done by this weapon DamageTypes WeaponDamageType `json:",omitempty"` // Qualities is a bitmap of weapon qualities Qualities WeaponQuality `json:",omitempty"` }
Weapon describes a weapon in the core data.
type WeaponDamageType ¶ added in v5.17.0
type WeaponDamageType byte
const ( BludgeoningDamage WeaponDamageType = 1 << iota PiercingDamage SlashingDamage )
DO NOT add new items in the middle of this list without completely rebuilding the core database; adding to the end is fine.
func (WeaponDamageType) MarshalJSON ¶ added in v5.17.0
func (w WeaponDamageType) MarshalJSON() ([]byte, error)
MarshalJSON represents the bitmapped set of weapon damage types as a list of strings so the JSON version is easily understood and managed by other programs.
func (*WeaponDamageType) UnmarshalJSON ¶ added in v5.17.0
func (w *WeaponDamageType) UnmarshalJSON(input []byte) error
type WeaponQuality ¶ added in v5.17.0
type WeaponQuality uint32
const ( BraceWeapon WeaponQuality = 1 << iota DeadlyWeapon DisarmWeapon DoubleWeapon DwarvenWeapon ElvenWeapon ExoticWeapon FragileWeapon GnomeWeapon GrappleWeapon HalflingWeapon LightWeapon MartialWeapon MasterworkWeapon MonkWeapon NonLethalWeapon OneHandedWeapon OrcWeapon RangedWeapon ReachWeapon SimpleWeapon TripWeapon TwoHandedWeapon UnarmedWeapon )
DO NOT add new items in the middle of this list without completely rebuilding the core database; adding to the end is fine.
func (WeaponQuality) MarshalJSON ¶ added in v5.17.0
func (q WeaponQuality) MarshalJSON() ([]byte, error)
MarshalJSON represents the bitmapped set of weapon qualities as a list of strings so the JSON version is easily understood and managed by other programs.
func (*WeaponQuality) UnmarshalJSON ¶ added in v5.17.0
func (q *WeaponQuality) UnmarshalJSON(input []byte) error