Skip to content

Commit

Permalink
Merge branch 'release/1.1.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
alaingilbert committed Sep 15, 2018
2 parents 4b85f00 + a2bf3a3 commit dccb1d9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ func main() {
### Available methods

```go
GetSession() string
GetServer() Server
SetUserAgent(newUserAgent string)
ServerURL() string
Expand Down
8 changes: 7 additions & 1 deletion ogame.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (

// Wrapper all available functions to control ogame bot
type Wrapper interface {
GetSession() string
GetServer() Server
SetUserAgent(newUserAgent string)
ServerURL() string
Expand Down Expand Up @@ -1583,7 +1584,7 @@ func extractAttacks(pageHTML string) []AttackEvent {
}
attack := AttackEvent{}
attack.MissionType = missionType
if missionType == Attack || missionType == MissileAttack {
if missionType == Attack || missionType == MissileAttack || missionType == Spy {
coordsOrigin := strings.TrimSpace(s.Find("td.coordsOrigin").Text())
attack.Origin = extractCoord(coordsOrigin)
attackerIDStr, _ := s.Find("a.sendMail").Attr("data-playerid")
Expand Down Expand Up @@ -2829,6 +2830,11 @@ func (b *OGame) getResourcesProductions(planetID PlanetID) (Resources, error) {
return productions, nil
}

// GetSession get ogame session
func (b *OGame) GetSession() string {
return b.ogameSession
}

// GetServer get ogame server information that the bot is connected to
func (b *OGame) GetServer() Server {
return b.server
Expand Down
2 changes: 2 additions & 0 deletions ogame_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ func TestExtractAttacks_spy(t *testing.T) {
pageHTMLBytes, _ := ioutil.ReadFile("samples/event_list_spy.html")
attacks := extractAttacks(string(pageHTMLBytes))
assert.Equal(t, 1, len(attacks))
assert.Equal(t, Coordinate{4, 212, 8}, attacks[0].Origin)
assert.Equal(t, 107009, attacks[0].AttackerID)
}

func TestExtractAttacks1(t *testing.T) {
Expand Down

0 comments on commit dccb1d9

Please sign in to comment.