Documentation ¶
Index ¶
Constants ¶
const ( TypeKeep = "Keep" TypeGreatHouse = "Great House" )
const ( RoomFurnishingAlchemy = "alchemy" RoomFurnishingAnvil = "anvil" RoomFurnishingBed = "bed" RoomFurnishingBench = "bench" RoomFurnishingBookcase = "bookcase" RoomFurnishingCabinet = "cabinet" RoomFurnishingCarpet = "carpet" RoomFurnishingChair = "chair" RoomFurnishingCupboard = "cupboard" RoomFurnishingDesk = "desk" RoomFurnishingDresser = "dresser" RoomFurnishingFirePit = "firePit" RoomFurnishingFireplace = "fireplace" RoomFurnishingForge = "forge" RoomFurnishingLamp = "lamp" RoomFurnishingMirror = "mirror" RoomFurnishingPainting = "painting" RoomFurnishingPillar = "pillar" RoomFurnishingRack = "rack" RoomFurnishingShelf = "shelf" RoomFurnishingShrine = "shrine" RoomFurnishingSpit = "spit" RoomFurnishingTableLg = "tableLg" RoomFurnishingTableSm = "tableSm" RoomFurnishingTapestry = "tapestry" RoomFurnishingThrone = "throne" RoomFurnishingTorch = "torch" RoomFurnishingWardrobe = "wardrobe" RoomFurnishingWorkbench = "workbench" )
const ( CapacitySmall = 1 CapacityMedium = 3 CapacityLarge = 9 CapacityMassive = 27 )
Storage capacities.
const ( ItemTypeAmmo = "ammo" ItemTypeArmor = "armor" ItemTypeChancery = "chancery" ItemTypeClothing = "clothing" ItemTypeCoin = "coin" ItemTypeContainer = "container" ItemTypeFood = "food" ItemTypeFurnishing = "furnishing" ItemTypeKitchen = "kitchen" ItemTypeLiquid = "liquid" ItemTypeMiscellaneous = "miscellaneous" ItemTypeMysterious = "mysterious" ItemTypeMystic = "mystic" ItemTypePotion = "potion" ItemTypeSurvival = "survival" ItemTypeStationary = "stationary" ItemTypeTack = "tack" ItemTypeTool = "tool" ItemTypeTreasure = "treasure" ItemTypeTrinket = "trinket" ItemTypeWeapon = "weapon" )
const ( ClothingNameCloak = "cloak" ClothingNameCoat = "coat" ClothingNameGloves = "gloves" ClothingNameHat = "hat" ClothingNamePants = "pants" ClothingNameShirt = "shirt" )
Clothing
const ( StationaryNameLedger = "ledger" StationaryNameQuill = "quill" StationaryNameScroll = "scroll" )
Stationary
const ( RoomTypeArmory = "armory" RoomTypeAtrium = "atrium" RoomTypeBallroom = "ballroom" RoomTypeBathhouse = "bathhouse" RoomTypeBedroom = "bedroom" RoomTypeChamber = "chamber" RoomTypeDining = "dining" RoomTypeDormitory = "dormitory" RoomTypeGreatHall = "greatHall" RoomTypeHallway = "hallway" RoomTypeKitchen = "kitchen" RoomTypeLaboratory = "laboratory" RoomTypeLibrary = "library" RoomTypePantry = "pantry" RoomTypeParlour = "parlour" RoomTypePrison = "prison" RoomTypeRoom = "room" RoomTypeShrine = "shrine" RoomTypeSmithy = "smithy" RoomTypeStorage = "storage" RoomTypeStudy = "study" RoomTypeThrone = "throne" RoomTypeTorture = "torture" RoomTypeTreasury = "treasury" )
Variables ¶
var ( BuildingKeep = NewBuildingConfig(TypeKeep, []string{ RoomTypeGreatHall, RoomTypeKitchen, RoomTypePantry, RoomTypeBedroom, RoomTypeArmory, RoomTypePrison, }, []string{ RoomTypeAtrium, RoomTypeBallroom, RoomTypeBathhouse, RoomTypeChamber, RoomTypeDining, RoomTypeDormitory, RoomTypeHallway, RoomTypeLaboratory, RoomTypeLibrary, RoomTypeParlour, RoomTypeThrone, RoomTypeTorture, RoomTypeTreasury, }, 10, 15) BuildingGreatHouse = NewBuildingConfig(TypeGreatHouse, []string{ RoomTypeGreatHall, RoomTypeKitchen, RoomTypePantry, RoomTypeBedroom, }, []string{ RoomTypeArmory, RoomTypeAtrium, RoomTypeBallroom, RoomTypeBathhouse, RoomTypeChamber, RoomTypeDining, RoomTypeDormitory, RoomTypeHallway, RoomTypeLaboratory, RoomTypeLibrary, }, 6, 12) )
var ( QuantityNone = &FurnishingQuantity{ Name: "none", Min: 0, Max: 0, Probability: 0.25, } QuantityMinimum = &FurnishingQuantity{ Name: "minimum", Min: 1, Max: 1, Probability: 0.75, } QuantitySparse = &FurnishingQuantity{ Name: "sparse", Min: 2, Max: 2, Probability: 0.92, } QuantityAverage = &FurnishingQuantity{ Name: "average", Min: 3, Max: 4, Probability: 0.98, } QuantityFurnished = &FurnishingQuantity{ Name: "furnished", Min: 5, Max: 6, Probability: 1.0, } )
var ( RarityAbundant = &Rarity{ Name: "abundant", Probability: 25, IndicateRarity: false, } RarityCommon = &Rarity{ Name: "common", Probability: 45, IndicateRarity: false, } RarityAverage = &Rarity{ Name: "average", Probability: 65, IndicateRarity: false, } RarityUncommon = &Rarity{ Name: "uncommon", Probability: 80, IndicateRarity: true, } RarityRare = &Rarity{ Name: "rare", Probability: 93, IndicateRarity: true, } RarityExotic = &Rarity{ Name: "exotic", Probability: 99, IndicateRarity: true, } RarityLegendary = &Rarity{ Name: "legendary", Probability: 100, IndicateRarity: true, } )
var ( RoomArmory = NewRoomConfig(RoomTypeArmory, []string{ RoomFurnishingRack}, []string{ RoomFurnishingAnvil, RoomFurnishingBench, RoomFurnishingCabinet, RoomFurnishingForge, RoomFurnishingLamp, RoomFurnishingRack, RoomFurnishingTableLg, RoomFurnishingShelf, RoomFurnishingTorch, RoomFurnishingWorkbench}, ) RoomAtrium = NewRoomConfig(RoomTypeAtrium, nil, []string{ RoomFurnishingBench, RoomFurnishingCarpet, RoomFurnishingPillar}, ) RoomBallroom = NewRoomConfig(RoomTypeBallroom, nil, []string{ RoomFurnishingBench, RoomFurnishingCarpet, RoomFurnishingChair, RoomFurnishingFireplace, RoomFurnishingLamp, RoomFurnishingTableLg, RoomFurnishingTableSm}, ) RoomBathhouse = NewRoomConfig(RoomTypeBathhouse, nil, []string{ RoomFurnishingBench, RoomFurnishingRack, RoomFurnishingShelf}, ) RoomBedroom = NewRoomConfig(RoomTypeBedroom, []string{ RoomFurnishingBed}, []string{ RoomFurnishingBed, RoomFurnishingBench, RoomFurnishingBookcase, RoomFurnishingCarpet, RoomFurnishingChair, RoomFurnishingDesk, RoomFurnishingDresser, RoomFurnishingFireplace, RoomFurnishingLamp, RoomFurnishingMirror, RoomFurnishingTableSm, RoomFurnishingShelf, RoomFurnishingShrine, RoomFurnishingWardrobe}, ) RoomChamber = NewRoomConfig(RoomTypeChamber, nil, []string{ RoomFurnishingBookcase, RoomFurnishingCabinet, RoomFurnishingCarpet, RoomFurnishingChair, RoomFurnishingDesk, RoomFurnishingFireplace, RoomFurnishingLamp, RoomFurnishingTableSm, RoomFurnishingShelf, RoomFurnishingTorch}, ) RoomDining = NewRoomConfig(RoomTypeDining, []string{ RoomFurnishingTableLg}, []string{ RoomFurnishingBench, RoomFurnishingCabinet, RoomFurnishingCarpet, RoomFurnishingChair, RoomFurnishingCupboard, RoomFurnishingFireplace, RoomFurnishingLamp, RoomFurnishingTableLg, RoomFurnishingTableSm, RoomFurnishingSpit, RoomFurnishingTorch}, ) RoomDormitory = NewRoomConfig(RoomTypeDormitory, []string{ RoomFurnishingBed}, []string{ RoomFurnishingBed, RoomFurnishingCarpet, RoomFurnishingBench, RoomFurnishingBookcase, RoomFurnishingChair, RoomFurnishingCupboard, RoomFurnishingDesk, RoomFurnishingDresser, RoomFurnishingFireplace, RoomFurnishingPillar, RoomFurnishingRack, RoomFurnishingTableSm, RoomFurnishingShelf, RoomFurnishingTorch}, ) RoomGreatHall = NewRoomConfig(RoomTypeGreatHall, nil, []string{ RoomFurnishingBench, RoomFurnishingCarpet, RoomFurnishingBookcase, RoomFurnishingFireplace, RoomFurnishingForge, RoomFurnishingLamp, RoomFurnishingPillar, RoomFurnishingRack, RoomFurnishingTableLg, RoomFurnishingThrone, RoomFurnishingShrine, RoomFurnishingTorch}, ) RoomHallway = NewRoomConfig(RoomTypeHallway, nil, []string{ RoomFurnishingCarpet, RoomFurnishingShelf, RoomFurnishingTorch}, ) RoomKitchen = NewRoomConfig(RoomTypeKitchen, []string{ RoomFurnishingTableSm, RoomFurnishingSpit}, []string{ RoomFurnishingFirePit, RoomFurnishingFireplace, RoomFurnishingLamp, RoomFurnishingRack, RoomFurnishingTableLg, RoomFurnishingTableSm, RoomFurnishingShelf, RoomFurnishingSpit, RoomFurnishingWorkbench}, ) RoomLaboratory = NewRoomConfig(RoomTypeLaboratory, []string{ RoomFurnishingAlchemy, RoomFurnishingWorkbench}, []string{ RoomFurnishingAlchemy, RoomFurnishingBench, RoomFurnishingBookcase, RoomFurnishingCabinet, RoomFurnishingCarpet, RoomFurnishingChair, RoomFurnishingDesk, RoomFurnishingFireplace, RoomFurnishingLamp, RoomFurnishingMirror, RoomFurnishingRack, RoomFurnishingTableSm, RoomFurnishingTableLg, RoomFurnishingShelf, RoomFurnishingTorch, RoomFurnishingWorkbench}, ) RoomLibrary = NewRoomConfig(RoomTypeLibrary, []string{ RoomFurnishingBookcase}, []string{ RoomFurnishingBench, RoomFurnishingBookcase, RoomFurnishingCabinet, RoomFurnishingCarpet, RoomFurnishingChair, RoomFurnishingDesk, RoomFurnishingFireplace, RoomFurnishingLamp, RoomFurnishingTableLg, RoomFurnishingTableSm, RoomFurnishingShelf}, ) RoomPantry = NewRoomConfig(RoomTypePantry, []string{ RoomFurnishingShelf}, []string{ RoomFurnishingCabinet, RoomFurnishingCupboard, RoomFurnishingRack, RoomFurnishingShelf}, ) RoomParlour = NewRoomConfig(RoomTypeParlour, nil, []string{ RoomFurnishingBench, RoomFurnishingBookcase, RoomFurnishingCabinet, RoomFurnishingCarpet, RoomFurnishingChair, RoomFurnishingDesk, RoomFurnishingTableSm}, ) RoomPrison = NewRoomConfig(RoomTypePrison, nil, nil) RoomRoom = NewRoomConfig(RoomTypeRoom, nil, []string{ RoomFurnishingCarpet, RoomFurnishingFirePit, RoomFurnishingTableSm, RoomFurnishingTorch}, ) RoomShrine = NewRoomConfig(RoomTypeShrine, []string{ RoomFurnishingShrine}, []string{ RoomFurnishingCarpet, RoomFurnishingLamp, RoomFurnishingShrine, RoomFurnishingTorch}, ) RoomSmithy = NewRoomConfig(RoomTypeSmithy, []string{ RoomFurnishingAnvil, RoomFurnishingForge, RoomFurnishingWorkbench}, nil, ) RoomStorage = NewRoomConfig(RoomTypeStorage, []string{ RoomFurnishingRack}, []string{ RoomFurnishingCabinet, RoomFurnishingCupboard, RoomFurnishingRack, RoomFurnishingTableSm, RoomFurnishingShelf}, ) RoomStudy = NewRoomConfig(RoomTypeStudy, []string{ RoomFurnishingChair, RoomFurnishingDesk}, []string{ RoomFurnishingBookcase, RoomFurnishingCabinet, RoomFurnishingCarpet, RoomFurnishingChair, RoomFurnishingDesk, RoomFurnishingLamp, RoomFurnishingTableSm, RoomFurnishingShelf}, ) RoomThrone = NewRoomConfig(RoomTypeThrone, []string{ RoomFurnishingThrone}, []string{ RoomFurnishingBench, RoomFurnishingCarpet, RoomFurnishingLamp, RoomFurnishingPillar, RoomFurnishingTableLg, RoomFurnishingThrone, RoomFurnishingTorch}, ) RoomTorture = NewRoomConfig(RoomTypeTorture, []string{ RoomFurnishingChair}, []string{ RoomFurnishingFireplace, RoomFurnishingTorch, RoomFurnishingWorkbench}, ) RoomTreasury = NewRoomConfig(RoomTypeTreasury, nil, []string{ RoomFurnishingCarpet, RoomFurnishingDesk, RoomFurnishingLamp, RoomFurnishingMirror, RoomFurnishingRack, RoomFurnishingTableLg, RoomFurnishingTableSm}, ) )
var ClothingSet = &ItemSet{ Name: ItemTypeClothing, Items: []*ItemBase{ NewItemBase(ClothingNameCloak, ItemTypeClothing, func(i *ItemBase) { i.Rarity = RarityUncommon i.Size = SizeLarge }), NewItemBase(ClothingNameCoat, ItemTypeClothing, func(i *ItemBase) { i.Rarity = RarityUncommon i.Size = SizeLarge }), NewItemBase(ClothingNameGloves, ItemTypeClothing, func(i *ItemBase) { i.Rarity = RarityCommon i.Size = SizeSmall }), NewItemBase(ClothingNameHat, ItemTypeClothing, func(i *ItemBase) { i.Rarity = RarityCommon i.Size = SizeSmall }), NewItemBase(ClothingNamePants, ItemTypeClothing, func(i *ItemBase) { i.Rarity = RarityCommon i.Size = SizeMedium }), NewItemBase(ClothingNameShirt, ItemTypeClothing, func(i *ItemBase) { i.Rarity = RarityCommon i.Size = SizeMedium }), }, }
var StationarySet = &ItemSet{ Name: "stationary", Items: []*ItemBase{ NewItemBase(StationaryNameLedger, ItemTypeStationary, func(i *ItemBase) { i.Rarity = RarityCommon i.Size = SizeMedium }), NewItemBase(StationaryNameQuill, ItemTypeStationary, func(i *ItemBase) { i.Rarity = RarityCommon i.Size = SizeTiny }), NewItemBase(StationaryNameScroll, ItemTypeStationary, func(i *ItemBase) { i.Rarity = RarityCommon i.Size = SizeTiny }), }, }
Functions ¶
This section is empty.
Types ¶
type Building ¶
type Building struct { Name string // Name of the building. Rooms []*Room // Rooms in the building. Size int // Size of the building. }
A building is a collection of rooms serving a purpose with a total size and a number of inhabitants with a certain social status, profession, and hobbies.
type BuildingConfig ¶
type BuildingConfig struct { Name string // Name of the building type. Required []string // Required rooms Possible []string // Possible rooms Size [2]int // Minimum/Maximum size of the building. }
BuildingConfig represents a building prototype and all the possible variations of rooms that can be found in it.
func NewBuildingConfig ¶
func NewBuildingConfig(name string, required, possible []string, minSize, maxSize int) *BuildingConfig
NewBuildingConfig returns a new building configuration for generating a specific type of building.
func (*BuildingConfig) Generate ¶
func (bc *BuildingConfig) Generate() *Building
Generate a building from the config.
type FurnishingQuantity ¶
type ItemBase ¶
type ItemBase struct { Name string Rarity *Rarity Size Size Capacity int Type string Variants []string Set *ItemSet // TODO: Allow multiple sets. }
ItemBase represents a base item prototype.
func NewItemBase ¶
NewItemBase returns a new item base.
type Rarity ¶
type Rarity struct { Name string // Name of this rarity Probability int // Probability of this rarity (the higher the more rare) IndicateRarity bool // Indicate rarity in item name }
Rarity represents the rarity of an item.
type RoomConfig ¶
RoomConfig represents a room prototype and all the possible variations of items and furniture that can be found in it.
func NewRoomConfig ¶
func NewRoomConfig(name string, required, possible []string) *RoomConfig
NewRoomConfig returns a new room configuration.
func (*RoomConfig) Generate ¶
func (rc *RoomConfig) Generate() *Room
Generate a room from the config.