Skip to content

Commit

Permalink
Add return of Lifeform type from extractLfBuildings func
Browse files Browse the repository at this point in the history
  • Loading branch information
YOLOP0wn committed Sep 24, 2022
1 parent 5a9b2b3 commit 147a248
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pkg/extractor/v9/extracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,17 @@ func GetNbr(doc *goquery.Document, name string) int64 {

func extractLfBuildingsFromDoc(doc *goquery.Document) (ogame.LfBuildings, error) {
res := ogame.LfBuildings{}
if doc.Find("#lifeform a div").HasClass("lifeform1") {
res.Humans = true
} else if doc.Find("#lifeform a div").HasClass("lifeform2") {
res.Rocktal = true
} else if doc.Find("#lifeform a div").HasClass("lifeform3") {
res.Mechas = true
} else if doc.Find("#lifeform a div").HasClass("lifeform4") {
res.Kaelesch = true
} else {
res.None = true
}
res.ResidentialSector = GetNbr(doc, "lifeformTech11101")
res.BiosphereFarm = GetNbr(doc, "lifeformTech11102")
res.ResearchCentre = GetNbr(doc, "lifeformTech11103")
Expand Down
5 changes: 5 additions & 0 deletions pkg/ogame/lfBuildings.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ type LazyLfBuildings func() LfBuildings

// LfBuildings lifeform buildings
type LfBuildings struct {
None bool
Humans bool
Rocktal bool
Mechas bool
Kaelesh bool
ResidentialSector int64 // 11101 // Lifeform (humans)
BiosphereFarm int64 // 11102
ResearchCentre int64 // 11103
Expand Down

0 comments on commit 147a248

Please sign in to comment.