Documentation ¶
Index ¶
- Variables
- type Building
- type BuildingInfo
- type Client
- func (c *Client) GetBuildingInfo(ctx context.Context, baseURLRaw string) (BuildingInfo, error)
- func (c *Client) GetEnnoblements(ctx context.Context, baseURLRaw string, since time.Time) ([]Ennoblement, error)
- func (c *Client) GetOpenServers(ctx context.Context, baseURLRaw string) ([]Server, error)
- func (c *Client) GetPlayers(ctx context.Context, baseURLRaw string) ([]Player, error)
- func (c *Client) GetServerConfig(ctx context.Context, baseURLRaw string) (ServerConfig, error)
- func (c *Client) GetTribes(ctx context.Context, baseURLRaw string) ([]Tribe, error)
- func (c *Client) GetUnitInfo(ctx context.Context, baseURLRaw string) (UnitInfo, error)
- func (c *Client) GetVillages(ctx context.Context, baseURLRaw string) ([]Village, error)
- type ClientOption
- type Ennoblement
- type KnightNewItems
- type OpponentsDefeated
- type ParseError
- type Player
- type Server
- type ServerConfig
- type ServerConfigAlly
- type ServerConfigBuild
- type ServerConfigBuildings
- type ServerConfigCommands
- type ServerConfigCoord
- type ServerConfigGame
- type ServerConfigMisc
- type ServerConfigNewbie
- type ServerConfigNight
- type ServerConfigSitter
- type ServerConfigSleep
- type ServerConfigSnob
- type ServerConfigWin
- type Tribe
- type Unit
- type UnitInfo
- type Village
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidServerKey = errors.New("invalid server key") ErrInvalidServerURL = errors.New("invalid server URL") )
Functions ¶
This section is empty.
Types ¶
type Building ¶ added in v0.2.0
type Building struct { MaxLevel int8 `xml:"max_level"` MinLevel int8 `xml:"min_level"` Wood int32 `xml:"wood"` Stone int32 `xml:"stone"` Iron int32 `xml:"iron"` Pop int16 `xml:"pop"` WoodFactor float64 `xml:"wood_factor"` StoneFactor float64 `xml:"stone_factor"` IronFactor float64 `xml:"iron_factor"` PopFactor float64 `xml:"pop_factor"` BuildTime float64 `xml:"build_time"` BuildTimeFactor float64 `xml:"build_time_factor"` }
type BuildingInfo ¶ added in v0.2.0
type BuildingInfo struct { XMLName xml.Name `xml:"config"` Text string `xml:",chardata"` Main Building `xml:"main"` Barracks Building `xml:"barracks"` Stable Building `xml:"stable"` Garage Building `xml:"garage"` Watchtower Building `xml:"watchtower"` Snob Building `xml:"snob"` Smith Building `xml:"smith"` Place Building `xml:"place"` Statue Building `xml:"statue"` Market Building `xml:"market"` Wood Building `xml:"wood"` Stone Building `xml:"stone"` Iron Building `xml:"iron"` Farm Building `xml:"farm"` Storage Building `xml:"storage"` Hide Building `xml:"hide"` Wall Building `xml:"wall"` }
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(opts ...ClientOption) *Client
func (*Client) GetBuildingInfo ¶
func (*Client) GetEnnoblements ¶
func (*Client) GetOpenServers ¶
func (*Client) GetPlayers ¶
func (*Client) GetServerConfig ¶
func (*Client) GetUnitInfo ¶
type ClientOption ¶
type ClientOption func(c *clientConfig)
func WithEnnoblementsUseInterfaceFunc ¶ added in v0.11.2
func WithEnnoblementsUseInterfaceFunc(f func(since time.Time) bool) ClientOption
WithEnnoblementsUseInterfaceFunc runs every time Client.GetEnnoblements is called, and allows conditionally configuring the client to use /interface.php?func=get_conquer_extended instead of /map/conquer_extended.txt. If none is specified, a default function is used that checks if since is after now - 23h.
func WithHTTPClient ¶
func WithHTTPClient(hc *http.Client) ClientOption
func WithUserAgent ¶
func WithUserAgent(ua string) ClientOption
type Ennoblement ¶ added in v0.2.0
type KnightNewItems ¶ added in v0.5.6
type KnightNewItems int8
func (KnightNewItems) Int8 ¶ added in v0.5.6
func (k KnightNewItems) Int8() int8
func (*KnightNewItems) UnmarshalXML ¶ added in v0.5.6
func (k *KnightNewItems) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
type OpponentsDefeated ¶ added in v0.2.0
type ParseError ¶
func (ParseError) Error ¶
func (e ParseError) Error() string
func (ParseError) Unwrap ¶
func (e ParseError) Unwrap() error
type ServerConfig ¶ added in v0.2.0
type ServerConfig struct { XMLName xml.Name `xml:"config"` Speed float64 `xml:"speed"` UnitSpeed float64 `xml:"unit_speed"` Moral int16 `xml:"moral"` Build ServerConfigBuild `xml:"build"` Misc ServerConfigMisc `xml:"misc"` Commands ServerConfigCommands `xml:"commands"` Newbie ServerConfigNewbie `xml:"newbie"` Game ServerConfigGame `xml:"game"` Buildings ServerConfigBuildings `xml:"buildings"` Snob ServerConfigSnob `xml:"snob"` Ally ServerConfigAlly `xml:"ally"` Coord ServerConfigCoord `xml:"coord"` Sitter ServerConfigSitter `xml:"sitter"` Sleep ServerConfigSleep `xml:"sleep"` Night ServerConfigNight `xml:"night"` Win ServerConfigWin `xml:"win"` }
type ServerConfigAlly ¶ added in v0.2.0
type ServerConfigAlly struct { NoHarm int8 `xml:"no_harm"` NoOtherSupport int8 `xml:"no_other_support"` NoOtherSupportType int8 `xml:"no_other_support_type"` AllytimeSupport int32 `xml:"allytime_support"` NoLeave int8 `xml:"no_leave"` NoJoin int8 `xml:"no_join"` Limit int16 `xml:"limit"` FixedAllies int8 `xml:"fixed_allies"` PointsMemberCount int32 `xml:"points_member_count"` WarsMemberRequirement int16 `xml:"wars_member_requirement"` WarsPointsRequirement int32 `xml:"wars_points_requirement"` WarsAutoacceptDays int16 `xml:"wars_autoaccept_days"` Levels int8 `xml:"levels"` XpRequirements string `xml:"xp_requirements"` }
type ServerConfigBuild ¶ added in v0.2.0
type ServerConfigBuild struct {
Destroy int8 `xml:"destroy"`
}
type ServerConfigBuildings ¶ added in v0.2.0
type ServerConfigBuildings struct { CustomMain int8 `xml:"custom_main"` CustomFarm int8 `xml:"custom_farm"` CustomStorage int8 `xml:"custom_storage"` CustomPlace int8 `xml:"custom_place"` CustomBarracks int8 `xml:"custom_barracks"` CustomChurch int8 `xml:"custom_church"` CustomSmith int8 `xml:"custom_smith"` CustomWood int8 `xml:"custom_wood"` CustomStone int8 `xml:"custom_stone"` CustomIron int8 `xml:"custom_iron"` CustomMarket int8 `xml:"custom_market"` CustomStable int8 `xml:"custom_stable"` CustomWall int8 `xml:"custom_wall"` CustomGarage int8 `xml:"custom_garage"` CustomHide int8 `xml:"custom_hide"` CustomSnob int8 `xml:"custom_snob"` CustomStatue int8 `xml:"custom_statue"` CustomWatchtower int8 `xml:"custom_watchtower"` }
type ServerConfigCommands ¶ added in v0.2.0
type ServerConfigCoord ¶ added in v0.2.0
type ServerConfigCoord struct { MapSize int16 `xml:"map_size"` Func int8 `xml:"func"` EmptyVillages int16 `xml:"empty_villages"` BonusVillages int16 `xml:"bonus_villages"` BonusNew int16 `xml:"bonus_new"` Inner int16 `xml:"inner"` SelectStart int8 `xml:"select_start"` VillageMoveWait int32 `xml:"village_move_wait"` NobleRestart int8 `xml:"noble_restart"` StartVillages int8 `xml:"start_villages"` }
type ServerConfigGame ¶ added in v0.2.0
type ServerConfigGame struct { BuildtimeFormula int8 `xml:"buildtime_formula"` Knight int8 `xml:"knight"` KnightNewItems KnightNewItems `xml:"knight_new_items"` Archer int8 `xml:"archer"` Tech int8 `xml:"tech"` FarmLimit int32 `xml:"farm_limit"` Church int8 `xml:"church"` Watchtower int8 `xml:"watchtower"` Stronghold int8 `xml:"stronghold"` FakeLimit float64 `xml:"fake_limit"` BarbarianRise float64 `xml:"barbarian_rise"` BarbarianShrink int8 `xml:"barbarian_shrink"` BarbarianMaxPoints int32 `xml:"barbarian_max_points"` Scavenging int8 `xml:"scavenging"` Hauls int8 `xml:"hauls"` HaulsBase int32 `xml:"hauls_base"` HaulsMax int32 `xml:"hauls_max"` BaseProduction int32 `xml:"base_production"` Event int16 `xml:"event"` SuppressEvents int8 `xml:"suppress_events"` }
type ServerConfigMisc ¶ added in v0.2.0
type ServerConfigNewbie ¶ added in v0.2.0
type ServerConfigNight ¶ added in v0.2.0
type ServerConfigSitter ¶ added in v0.2.0
type ServerConfigSitter struct {
Allow int8 `xml:"allow"`
}
type ServerConfigSleep ¶ added in v0.2.0
type ServerConfigSnob ¶ added in v0.2.0
type ServerConfigSnob struct { Gold int8 `xml:"gold"` CheapRebuild int8 `xml:"cheap_rebuild"` Rise int8 `xml:"rise"` MaxDist int16 `xml:"max_dist"` Factor float64 `xml:"factor"` CoinWood int32 `xml:"coin_wood"` CoinStone int32 `xml:"coin_stone"` CoinIron int32 `xml:"coin_iron"` NoBarbConquer int8 `xml:"no_barb_conquer"` }
type ServerConfigWin ¶ added in v0.2.0
type ServerConfigWin struct {
Check int16 `xml:"check"`
}
type UnitInfo ¶ added in v0.2.0
type UnitInfo struct { XMLName xml.Name `xml:"config"` Text string `xml:",chardata"` Spear Unit `xml:"spear"` Sword Unit `xml:"sword"` Axe Unit `xml:"axe"` Archer Unit `xml:"archer"` Spy Unit `xml:"spy"` Light Unit `xml:"light"` Marcher Unit `xml:"marcher"` Heavy Unit `xml:"heavy"` Ram Unit `xml:"ram"` Catapult Unit `xml:"catapult"` Knight Unit `xml:"knight"` Snob Unit `xml:"snob"` Militia Unit `xml:"militia"` }
Click to show internal directories.
Click to hide internal directories.