You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.2 KiB
Go
35 lines
1.2 KiB
Go
package model
|
|
|
|
// TownBuilding represents a persistent structure placed in a town.
|
|
type TownBuilding struct {
|
|
ID int64 `json:"id"`
|
|
TownID int64 `json:"townId"`
|
|
BuildingType string `json:"buildingType"` // house.quest_giver, house.merchant, house.healer, decoration.*
|
|
OffsetX float64 `json:"offsetX"`
|
|
OffsetY float64 `json:"offsetY"`
|
|
Facing string `json:"facing"` // north, south, east, west
|
|
FootprintW float64 `json:"footprintW"`
|
|
FootprintH float64 `json:"footprintH"`
|
|
}
|
|
|
|
// BuildingView is the frontend-friendly view with absolute world coordinates.
|
|
type BuildingView struct {
|
|
ID int64 `json:"id"`
|
|
BuildingType string `json:"buildingType"`
|
|
WorldX float64 `json:"worldX"`
|
|
WorldY float64 `json:"worldY"`
|
|
Facing string `json:"facing"`
|
|
FootprintW float64 `json:"footprintW"`
|
|
FootprintH float64 `json:"footprintH"`
|
|
}
|
|
|
|
// BuildingTypeForNPC returns the expected building type for a given NPC type.
|
|
func BuildingTypeForNPC(npcType string) string {
|
|
return "house." + npcType
|
|
}
|
|
|
|
// IsHouseBuilding returns true if the building type is a house (not decoration).
|
|
func IsHouseBuilding(buildingType string) bool {
|
|
return len(buildingType) > 6 && buildingType[:6] == "house."
|
|
}
|