Skip to content

Commit

Permalink
updated miner
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle Jackson committed Aug 5, 2024
1 parent c4fbdc7 commit dc601b9
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions cmd/miner/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ func main() {
if !ok {
c, err := artifacts.Client.GetCharacter(*artifacts.Client.CharacterName)
if err != nil {
utils.Logger.Fatal("failed to get character information", zap.Error(err))
utils.Logger.Error("failed to get character information", zap.Error(err))
continue
}
if c.Data.MiningLevel < models.IronLevel {
x = models.CopperX
Expand Down Expand Up @@ -60,7 +61,8 @@ func main() {
}
c, err := artifacts.Client.GetCharacter(*artifacts.Client.CharacterName)
if err != nil {
utils.Logger.Fatal("failed to get character information", zap.Error(err))
utils.Logger.Error("failed to get character information", zap.Error(err))
continue
}
if c.Data.X != x || c.Data.Y != y {
fmt.Printf("moving character to x=%d y=%d\n", x, y)
Expand All @@ -70,7 +72,7 @@ func main() {
})
if err != nil {
utils.Logger.Error("failed to move character", zap.Error(err))
return
continue
}
time.Sleep(utils.CalculateTimeDifference(resp.Data.Cooldown.StartedAt, resp.Data.Cooldown.Expiration))
}
Expand All @@ -83,13 +85,14 @@ func main() {
})
if err != nil {
utils.Logger.Error("failed to move character", zap.Error(err))
return
continue
}
fmt.Printf("moving character to bank (x=%d y=%d)\n", bankX, bankY)
time.Sleep(utils.CalculateTimeDifference(resp.Data.Cooldown.StartedAt, resp.Data.Cooldown.Expiration))
c, err := artifacts.Client.GetCharacter(*artifacts.Client.CharacterName)
if err != nil {
utils.Logger.Fatal("failed to get character information", zap.Error(err))
utils.Logger.Error("failed to get character information", zap.Error(err))
continue
}
controllers.DepositAllInventory(c.Data.Inventory)
resp, err = artifacts.Client.ActionMove(*artifacts.Client.CharacterName, models.ActionMove{
Expand All @@ -98,7 +101,7 @@ func main() {
})
if err != nil {
utils.Logger.Error("failed to move character", zap.Error(err))
return
continue
}
time.Sleep(utils.CalculateTimeDifference(resp.Data.Cooldown.StartedAt, resp.Data.Cooldown.Expiration))
} else if err == nil {
Expand Down

0 comments on commit dc601b9

Please sign in to comment.