Documentation ¶
Index ¶
- Variables
- type Building
- type BuildingInfo
- type Client
- func (c *Client) GetBuildingInfo(ctx context.Context, baseURL *url.URL) (BuildingInfo, error)
- func (c *Client) GetEnnoblements(ctx context.Context, baseURL *url.URL, since time.Time) ([]Ennoblement, error)
- func (c *Client) GetOpenServers(ctx context.Context, baseURL *url.URL) ([]Server, error)
- func (c *Client) GetPlayers(ctx context.Context, baseURL *url.URL) ([]Player, error)
- func (c *Client) GetServerConfig(ctx context.Context, baseURL *url.URL) (ServerConfig, error)
- func (c *Client) GetTribes(ctx context.Context, baseURL *url.URL) ([]Tribe, error)
- func (c *Client) GetUnitInfo(ctx context.Context, baseURL *url.URL) (UnitInfo, error)
- func (c *Client) GetVillages(ctx context.Context, baseURL *url.URL) ([]Village, error)
- type ClientOption
- type Ennoblement
- type EnnoblementsUseInterfaceFunc
- 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") )
View Source
var ErrBaseURLCantBeNil = errors.New("baseURL can't be nil")
Functions ¶
This section is empty.
Types ¶
type Building ¶ added in v0.2.0
type Building struct { BuildTime float64 `xml:"build_time"` BuildTimeFactor float64 `xml:"build_time_factor"` Iron int `xml:"iron"` IronFactor float64 `xml:"iron_factor"` MaxLevel int `xml:"max_level"` MinLevel int `xml:"min_level"` Pop int `xml:"pop"` PopFactor float64 `xml:"pop_factor"` Stone int `xml:"stone"` StoneFactor float64 `xml:"stone_factor"` Wood int `xml:"wood"` WoodFactor float64 `xml:"wood_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 EnnoblementsUseInterfaceFunc) ClientOption
WithEnnoblementsUseInterfaceFunc takes a function that will be called on every Client.GetEnnoblements call to determine whether the client should use /interface.php?func=get_conquer_extended or /map/conquer_extended.txt The default function checks whether since is after now() - 23h, if so, it calls /map/conquer_extended.txt, otherwise /interface.php?func=get_conquer_extended.
func WithHTTPClient ¶
func WithHTTPClient(hc *http.Client) ClientOption
func WithUserAgent ¶
func WithUserAgent(ua string) ClientOption
type Ennoblement ¶ added in v0.2.0
type EnnoblementsUseInterfaceFunc ¶ added in v1.0.0
type KnightNewItems ¶ added in v0.5.6
type KnightNewItems int
func (KnightNewItems) Int ¶ added in v1.0.0
func (k KnightNewItems) Int() int
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 int `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 { AllytimeSupport int `xml:"allytime_support"` FixedAllies int `xml:"fixed_allies"` Levels int `xml:"levels"` Limit int `xml:"limit"` NoHarm int `xml:"no_harm"` NoJoin int `xml:"no_join"` NoLeave int `xml:"no_leave"` NoOtherSupport int `xml:"no_other_support"` NoOtherSupportType int `xml:"no_other_support_type"` PointsMemberCount int `xml:"points_member_count"` WarsAutoacceptDays int `xml:"wars_autoaccept_days"` WarsMemberRequirement int `xml:"wars_member_requirement"` WarsPointsRequirement int `xml:"wars_points_requirement"` XpRequirements string `xml:"xp_requirements"` }
type ServerConfigBuild ¶ added in v0.2.0
type ServerConfigBuild struct {
Destroy int `xml:"destroy"`
}
type ServerConfigBuildings ¶ added in v0.2.0
type ServerConfigBuildings struct { CustomBarracks int `xml:"custom_barracks"` CustomChurch int `xml:"custom_church"` CustomFarm int `xml:"custom_farm"` CustomGarage int `xml:"custom_garage"` CustomHide int `xml:"custom_hide"` CustomIron int `xml:"custom_iron"` CustomMain int `xml:"custom_main"` CustomMarket int `xml:"custom_market"` CustomPlace int `xml:"custom_place"` CustomSmith int `xml:"custom_smith"` CustomSnob int `xml:"custom_snob"` CustomStable int `xml:"custom_stable"` CustomStatue int `xml:"custom_statue"` CustomStone int `xml:"custom_stone"` CustomStorage int `xml:"custom_storage"` CustomWall int `xml:"custom_wall"` CustomWatchtower int `xml:"custom_watchtower"` CustomWood int `xml:"custom_wood"` }
type ServerConfigCommands ¶ added in v0.2.0
type ServerConfigCoord ¶ added in v0.2.0
type ServerConfigCoord struct { BonusNew int `xml:"bonus_new"` BonusVillages int `xml:"bonus_villages"` EmptyVillages int `xml:"empty_villages"` Func int `xml:"func"` Inner int `xml:"inner"` MapSize int `xml:"map_size"` NobleRestart int `xml:"noble_restart"` SelectStart int `xml:"select_start"` StartVillages int `xml:"start_villages"` VillageMoveWait int `xml:"village_move_wait"` }
type ServerConfigGame ¶ added in v0.2.0
type ServerConfigGame struct { Archer int `xml:"archer"` BarbarianMaxPoints int `xml:"barbarian_max_points"` BarbarianRise float64 `xml:"barbarian_rise"` BarbarianShrink int `xml:"barbarian_shrink"` BaseProduction int `xml:"base_production"` BuildtimeFormula int `xml:"buildtime_formula"` Church int `xml:"church"` Event int `xml:"event"` FakeLimit float64 `xml:"fake_limit"` FarmLimit int `xml:"farm_limit"` Hauls int `xml:"hauls"` HaulsBase int `xml:"hauls_base"` HaulsMax int `xml:"hauls_max"` Knight int `xml:"knight"` KnightNewItems KnightNewItems `xml:"knight_new_items"` Scavenging int `xml:"scavenging"` Stronghold int `xml:"stronghold"` SuppressEvents int `xml:"suppress_events"` Tech int `xml:"tech"` Watchtower int `xml:"watchtower"` }
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 int `xml:"allow"`
}
type ServerConfigSleep ¶ added in v0.2.0
type ServerConfigSnob ¶ added in v0.2.0
type ServerConfigSnob struct { CheapRebuild int `xml:"cheap_rebuild"` CoinIron int `xml:"coin_iron"` CoinStone int `xml:"coin_stone"` CoinWood int `xml:"coin_wood"` Factor float64 `xml:"factor"` Gold int `xml:"gold"` MaxDist int `xml:"max_dist"` NoBarbConquer int `xml:"no_barb_conquer"` Rise int `xml:"rise"` }
type ServerConfigWin ¶ added in v0.2.0
type ServerConfigWin struct {
Check int `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.