implement string functions
@@ -517,6 +517,15 @@ type Highscore struct {
Players []HighscorePlayer
}
+// String ...
+func (h Highscore) String() string {
+ return "NbPage: " + strconv.FormatInt(h.NbPage, 10) + "\n" +
+ "CurrPage: " + strconv.FormatInt(h.CurrPage, 10) + "\n" +
+ "Category: " + strconv.FormatInt(h.Category, 10) + "\n" +
+ "Type: " + strconv.FormatInt(h.Type, 10) + "\n" +
+ "Players:" + strconv.Itoa(len(h.Players)) + "\n"
+}
+
// HighscorePlayer ...
type HighscorePlayer struct {
Position int64
@@ -528,6 +537,17 @@ type HighscorePlayer struct {
Homeworld Coordinate
}
+// String ...
+func (h HighscorePlayer) String() string {
+ return "Position: " + strconv.FormatInt(h.Position, 10) + "\n" +
+ "ID: " + strconv.FormatInt(h.ID, 10) + "\n" +
+ "Name: " + h.Name + "\n" +
+ "Score: " + strconv.FormatInt(h.Score, 10) + "\n" +
+ "AllianceID: " + strconv.FormatInt(h.AllianceID, 10) + "\n" +
+ "HonourPoints:" + strconv.FormatInt(h.HonourPoints, 10) + "\n" +
+ "Homeworld:" + h.Homeworld.String() + "\n"
+}
+
func extractHighscoreFromDocV71(doc *goquery.Document) (out Highscore, err error) {
s := doc.Selection
isFullPage := doc.Find("#stat_list_content").Size() == 1
