update stash
This commit is contained in:
parent
d93ecb96ee
commit
f531a28053
2
def.go
2
def.go
@ -641,7 +641,7 @@ type JobPayloadGetStash struct {
|
||||
UserID64 int64 `json:"user_id"`
|
||||
ClientID64 []int64 `json:"clients_id"`
|
||||
ClientCount int64 `json:"client_count"`
|
||||
Stock []ChatWarsItems `json:"stock"`
|
||||
Stash map[int64]int64 `json:"stock"`
|
||||
CleanupMsg []ChatWarsMessage `json:"cleanup_msg"`
|
||||
}
|
||||
|
||||
|
15
job.go
15
job.go
@ -2110,6 +2110,13 @@ func jobGetStash(j Job) {
|
||||
break
|
||||
}
|
||||
}
|
||||
cwm, err := parseSubTypeMessageExchangeAck(m, rule)
|
||||
logOnError(err, "jobGetStash : parseSubTypeMessageExchangeAck")
|
||||
if err == nil {
|
||||
for _, d := range cwm.DealList {
|
||||
p.Stash[d.ItemID64] += d.Quantity
|
||||
}
|
||||
}
|
||||
fmt.Printf("jobGetStash : %d clients remaining\n", len(p.ClientID64))
|
||||
fmt.Printf("jobGetStash : clearing trigger for next client\n")
|
||||
j.Trigger = 0
|
||||
@ -2161,13 +2168,19 @@ func jobGetStash(j Job) {
|
||||
if len(p.ClientID64) == 0 && j.Trigger == 0 {
|
||||
fmt.Printf("jobGetStash : Cleaning up\n")
|
||||
for _, m := range p.CleanupMsg {
|
||||
fmt.Printf("jobGetStash : clientDelTGMsg(%d, %d, %d)\n", m.TGUserID64, m.ID64, m.ChatID64)
|
||||
clientDelTGMsg(m.TGUserID64, m.ID64, m.ChatID64)
|
||||
}
|
||||
}
|
||||
|
||||
out = "Stash:\n"
|
||||
for k, v := range p.Stash {
|
||||
out = fmt.Sprintf(" %d : %d\n", k, v)
|
||||
}
|
||||
|
||||
c := TGCommand{
|
||||
Type: commandReplyMsg,
|
||||
Text: "Done.",
|
||||
Text: out,
|
||||
FromMsgID64: p.MsgID64,
|
||||
FromChatID64: p.ChatID64,
|
||||
ParseMode: cmdParseModeHTML,
|
||||
|
Loading…
Reference in New Issue
Block a user