forked from broderickhyman/albiondata-client
-
Notifications
You must be signed in to change notification settings - Fork 29
/
operation_get_cluster_map_info.go
52 lines (43 loc) · 1.46 KB
/
operation_get_cluster_map_info.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package client
import (
"strconv"
"github.com/ao-data/albiondata-client/lib"
"github.com/ao-data/albiondata-client/log"
)
type operationGetClusterMapInfo struct {
}
func (op operationGetClusterMapInfo) Process(state *albionState) {
log.Debug("Got GetClusterMapInfo operation...")
}
type operationGetClusterMapInfoResponse struct {
ZoneID string `mapstructure:"0"`
BuildingType []int `mapstructure:"5"`
AvailableFood []int `mapstructure:"10"`
Reward []int `mapstructure:"12"`
AvailableSilver []int `mapstructure:"13"`
Owners []string `mapstructure:"14"`
Buildable []bool `mapstructure:"19"`
IsForSale []bool `mapstructure:"27"`
BuyPrice []int `mapstructure:"28"`
}
func (op operationGetClusterMapInfoResponse) Process(state *albionState) {
log.Debug("Got response to GetClusterMapInfo operation...")
zoneInt, err := strconv.Atoi(op.ZoneID)
if err != nil {
log.Debugf("Unable to convert zoneID to int. Probably an instance.. ZoneID: %v", op.ZoneID)
return
}
upload := lib.MapDataUpload{
ZoneID: zoneInt,
BuildingType: op.BuildingType,
AvailableFood: op.AvailableFood,
Reward: op.Reward,
AvailableSilver: op.AvailableSilver,
Owners: op.Owners,
Buildable: op.Buildable,
IsForSale: op.IsForSale,
BuyPrice: op.BuyPrice,
}
log.Info("Sending map data to ingest")
sendMsgToPublicUploaders(upload, lib.NatsMapDataIngest, state)
}