Documentation ¶
Index ¶
Constants ¶
View Source
const ( ArmorTypeCloth ArmorType = "Cloth" ArmorTypeLeather = "Leather" ArmorTypePlate = "Plate" )
View Source
const ( CombatTypeMelee CombatType = "Melee" CombaTypeRanged = "Ranged" CombatTypeMagic = "Magic" )
Variables ¶
View Source
var CharacterTemplates = []CharacterTemplate{ { TemplateID: 1, Character: Character{ Name: "Mr. Warrior", Description: "Create a new Warrior", Race: RaceHuman, Class: ClassWarrior, CurrentHitPoints: 25, MaxHitPoints: 25, XP: 0, Level: 1, Attributes: createBaseAttributes(11, 8, 5, 6, 20), }, }, { TemplateID: 2, Character: Character{ Name: "Mrs. Longstride", Description: "Create a new Ranger", Race: RaceElve, Class: ClassRanger, CurrentHitPoints: 20, MaxHitPoints: 20, XP: 0, Level: 1, Attributes: createBaseAttributes(7, 15, 5, 6, 17), }, }, { TemplateID: 3, Character: Character{ Name: "Gumdalf the Bay", Description: "Create a new Wizard", Race: RaceDwarf, Class: ClassWizard, CurrentHitPoints: 17, MaxHitPoints: 17, XP: 0, Level: 1, Attributes: createBaseAttributes(5, 5, 15, 12, 13), }, }, }
CharacterTemplates TODO: move to DB or yml?
Functions ¶
This section is empty.
Types ¶
type Attribute ¶
type Attribute struct { Name string `json:"name"` Short string `json:"short"` Value int32 `json:"value"` }
Attribute data
type Character ¶
type Character struct { *entities.Entity `bson:",inline"` traits.BelongsUser `bson:",inline"` traits.CurrentRoom `bson:",inline"` Name string `json:"name"` Description string `json:"description"` Race Race `json:"race"` Class Class `json:"class"` CurrentHitPoints int32 `json:"currentHitPoints"` MaxHitPoints int32 `json:"maxHitPoints"` XP int32 `json:"xp"` Level int32 `json:"level"` Created time.Time `bson:"created" json:"created,omitempty"` Attributes Attributes `bson:"attributes" json:"attributes,omitempty"` // complex character fields Inventory Inventory `bson:"inventory" json:"inventory"` EquippedItems map[items.ItemSlot]*items.Item `bson:"equippedItems" json:"equippedItems"` // track alltime stats in character object but dont expose as json by default AllTimeStats struct { PlayersKilled int32 `bson:"playersKilled" json:"playersKilled"` GoldCollected int32 `bson:"goldCollected" json:"goldCollected"` QuestsCompleted int32 `bson:"questsCompleted" json:"questsCompleted"` } `bson:"allTimeStats" json:"_"` }
Character data
type CharacterTemplate ¶
CharacterTemplate ...
type Class ¶
type Class struct { ID string `json:"id"` Name string `json:"name"` Description string `json:"description"` ArmorType ArmorType `json:"armorType"` CombatType CombatType `json:"combatType"` }
var ( ClassWarrior Class = Class{ ID: "warrior", Name: "Warrior", Description: "Strong plate wearing melee warrior", ArmorType: ArmorTypePlate, CombatType: CombatTypeMelee, } ClassRanger Class = Class{ ID: "ranger", Name: "Ranger", Description: "Quick Bow wielding ranged combatant", ArmorType: ArmorTypeLeather, CombatType: CombaTypeRanged, } ClassWizard Class = Class{ ID: "wizard", Name: "Wizard", Description: "Master of the elements wielder of magic spells", ArmorType: ArmorTypeCloth, CombatType: CombatTypeMagic, } )
TODO: Move this to Database or YML files
type CombatType ¶
type CombatType string
type Race ¶
type Race struct { ID string `json:"id"` Name string `json:"name"` Description string `json:"description"` Heritage string `json:"heritage"` }
Race type
var ( RaceDwarf Race = Race{ ID: "dwarf", Name: "Dwarf", Description: "Small, but dont underestimate them", Heritage: "Deep below a Mountain", } RaceHuman Race = Race{ ID: "human", Name: "Human", Description: "The common race", Heritage: "Big cities", } RaceElve Race = Race{ ID: "elve", Name: "Elve", Description: "Splendid forestwalkers, great sight during nights", Heritage: "Near the forest", } )
TODO: Move this to DB or YML
Click to show internal directories.
Click to hide internal directories.