package api
import "github.com/andreas-jonsson/fantasim-pub/api"
- Constants
- func DecodeRequest(dec Decoder) (interface{}, int, error)
- func DecodeResponse(dec Decoder) (interface{}, int, error)
- func EncodeRequest(enc Encoder, obj interface{}, id int) error
- func EncodeResponse(enc Encoder, obj interface{}, id int) error
- func Register(req, resp interface{})
- func RegisterHandler(reqName string, req interface{}, respName string, resp interface{})
- type Allegiance
- type Any
- type AttackUnitsRequest
- type AttackUnitsResponse
- type BuildRequest
- type BuildResponse
- type BuildingType
- type CloseRequest
- type CollectItemsRequest
- type CollectItemsResponse
- type CreateViewRequest
- type CreateViewResponse
- type CutTreesRequest
- type CutTreesResponse
- type DebugCommandRequest
- type DebugCommandResponse
- type Decoder
- type DesignateRequest
- type DesignateResponse
- type DestroyViewRequest
- type DestroyViewResponse
- type Empty
- type Encoder
- type ExploreLocationRequest
- type ExploreLocationResponse
- type GameType
- type GatherSeedsRequest
- type GatherSeedsResponse
- type Header
- type HighlightRequest
- type HighlightResponse
- type ItemClass
- type ItemViewData
- type JobQueueRequest
- type JobQueueResponse
- type MineLocationRequest
- type MineLocationResponse
- type Point
- type ReadViewBase
- type ReadViewData
- type ReadViewRequest
- type ReadViewResponse
- type Rect
- type SeedFarmRequest
- type SeedFarmResponse
- type StructureType
- type TileFlag
- type UnitClass
- type UnitRace
- type UnitStatsRequest
- type UnitStatsResponse
- type UnitViewData
- type UpdateViewRequest
- type UpdateViewResponse
- type UserFlag
- type ViewHomeRequest
- type ViewHomeResponse
api.go readview.go
Constants ¶
❖const VersionString = "0.0.1"
❖func Register(req, resp interface{})
❖func RegisterHandler(reqName string, req interface{}, respName string, resp interface{})
❖type Any map[interface{}]interface{}
❖type AttackUnitsRequest struct {
Units []uint64 `json:"units"`
}
❖type AttackUnitsResponse Empty
❖type BuildRequest struct {
Structure StructureType `json:"structure"`
Material ItemClass `json:"material"`
Location Rect `json:"location"`
}
❖const (
NoBuilding BuildingType = iota
StockpileBuilding
SawmillBuilding
ButcherShoppBuilding
FarmBuilding
)
❖type CollectItemsRequest struct {
Items []Point `json:"items"`
}
❖type CollectItemsResponse Empty
❖type CreateViewRequest struct {
X int `json:"x"`
Y int `json:"y"`
W int `json:"w"`
H int `json:"h"`
}
❖type CreateViewResponse struct {
ViewID int `json:"view_id"`
}
❖type CutTreesRequest struct {
Trees []Point `json:"trees"`
}
❖type DebugCommandRequest struct {
Command string `json:"command"`
}
❖type DebugCommandResponse struct {
Error string `json:"error"`
}
❖type Decoder interface {
Decode(interface{}) error
}
❖type DesignateRequest struct {
Building BuildingType `json:"building"`
Location Rect `json:"location"`
}
❖type DesignateResponse struct {
Error string `json:"error"`
}
❖type DestroyViewRequest struct {
ViewID int `json:"view_id"`
}
❖type DestroyViewResponse Empty
❖type Encoder interface {
Encode(interface{}) error
}
❖type ExploreLocationRequest struct {
X int `json:"x"`
Y int `json:"y"`
}
❖type ExploreLocationResponse Empty
❖type GatherSeedsRequest struct {
Seeds []Point `json:"seeds"`
}
❖type GatherSeedsResponse Empty
❖type Header struct {
string `json:"type"`
int `json:"id"`
}
❖type HighlightResponse struct {
Highlight []Point `json:"highlight"`
}
❖const (
NoItem ItemClass = iota
PartialItem
LogItem
FirewoodItem
PlankItem
StoneItem
MeatItem
BonesItem
SeedsItem
CropItem
// Corpses
HumanCorpseItem
DwarfCorpseItem
GoblinCorpseItem
OrcCorpseItem
TrollCorpseItem
ElvenCorpseItem
DeamonCorpseItem
DearCorpseItem
BoarCorpseItem
WolfCorpseItem
)
❖type ItemViewData struct {
ID uint64 `json:"item_id"`
Class ItemClass `json:"class"`
}
❖type JobQueueResponse struct {
Jobs []string `json:"jobs"`
}
❖type MineLocationRequest struct {
Location Point `json:"location"`
}
❖type MineLocationResponse struct {
Error string `json:"error"`
}
❖type Point struct {
X int `json:"x"`
Y int `json:"y"`
}
❖type ReadViewBase struct {
Flags TileFlag `json:"flags"`
UserFlags UserFlag `json:"usrflags"`
Height uint8 `json:"height"`
BuildingType BuildingType `json:"building_type"`
StructureType StructureType `json:"structure_type"`
StructureMaterial ItemClass `json:"structure_material"`
Building uint64 `json:"building"`
}
❖type ReadViewRequest struct {
ViewID int `json:"view_id"`
RLE bool `json:"rle"`
}
❖type Rect struct {
Min Point `json:"min"`
Max Point `json:"max"`
}
❖type SeedFarmRequest struct {
BuildingID uint64 `json:"building_id"`
}
func (StructureType) String ¶ Uses
❖const (
Water TileFlag = 1 << iota
Brook
Sand
Snow
Tree
Bush
Plant
Stone
)
func (TileFlag) Is ¶ Uses
❖const (
Human UnitRace = iota
Dwarf
Goblin
Orc
Troll
Elven
Deamon
// Wildlife
Dear
Boar
Wolf
)
❖type UnitStatsRequest struct {
UnitID int `json:"unit_id"`
}
❖type UnitStatsResponse struct {
Name string `json:"name"`
Health float32 `json:"health"`
Thirst float32 `json:"thirst"`
Hunger float32 `json:"hunger"`
Debug []string `json:"debug"`
}
❖type UpdateViewRequest struct {
ViewID int `json:"view_id"`
X int `json:"x"`
Y int `json:"y"`
}
❖type UpdateViewResponse Empty
❖type ViewHomeRequest struct {
ViewID int `json:"view_id"`
}
❖type ViewHomeResponse struct {
X int `json:"x"`
Y int `json:"y"`
}