update g deposit

This commit is contained in:
shoopea 2019-08-29 20:15:26 +08:00
parent 6d3c4ceedf
commit ebf928ca57
3 changed files with 30 additions and 10 deletions

31
bot.go
View File

@ -638,12 +638,33 @@ func botGDepositAll(m *tb.Message) {
Status: 0, Status: 0,
} }
p.ResObjID64 = append(p.ResObjID64, getObjItemID(`01`, `Thread`))
p.ResObjID64 = append(p.ResObjID64, getObjItemID(`02`, `Stick`))
p.ResObjID64 = append(p.ResObjID64, getObjItemID(`03`, `Pelt`))
p.ResObjID64 = append(p.ResObjID64, getObjItemID(`04`, `Bone`))
p.ResObjID64 = append(p.ResObjID64, getObjItemID(`07`, `Powder`))
p.ResObjID64 = append(p.ResObjID64, getObjItemID(`08`, `Iron Ore`))
p.ResObjID64 = append(p.ResObjID64, getObjItemID(`09`, `Cloth`)) p.ResObjID64 = append(p.ResObjID64, getObjItemID(`09`, `Cloth`))
p.ResObjID64 = append(p.ResObjID64, getObjItemID(`39`, `Stinky Sumac`)) p.ResObjID64 = append(p.ResObjID64, getObjItemID(`10`, `Silver Ore`))
p.ResObjID64 = append(p.ResObjID64, getObjItemID(`s01`, `📕Scroll of Rage`)) p.ResObjID64 = append(p.ResObjID64, getObjItemID(`11`, `Bauxite`))
p.ResObjID64 = append(p.ResObjID64, getObjItemID(`r01`, `Champion Sword recipe`)) p.ResObjID64 = append(p.ResObjID64, getObjItemID(`13`, `Magic Stone`))
p.ResObjID64 = append(p.ResObjID64, getObjItemID(`k01`, `Champion blade`)) p.ResObjID64 = append(p.ResObjID64, getObjItemID(`14`, `Wooden Shaft`))
p.ResObjID64 = append(p.ResObjID64, getObjItemID(`w07`, `Rapier`)) p.ResObjID64 = append(p.ResObjID64, getObjItemID(`15`, `Sapphire`))
p.ResObjID64 = append(p.ResObjID64, getObjItemID(`17`, `Ruby`))
p.ResObjID64 = append(p.ResObjID64, getObjItemID(`18`, `Hardener`))
p.ResObjID64 = append(p.ResObjID64, getObjItemID(`19`, `Steel`))
p.ResObjID64 = append(p.ResObjID64, getObjItemID(`21`, `Bone Powder`))
p.ResObjID64 = append(p.ResObjID64, getObjItemID(`22`, `String`))
p.ResObjID64 = append(p.ResObjID64, getObjItemID(`23`, `Coke`))
p.ResObjID64 = append(p.ResObjID64, getObjItemID(`24`, `Purified Powder`))
p.ResObjID64 = append(p.ResObjID64, getObjItemID(`31`, `Rope`))
/*
p.ResObjID64 = append(p.ResObjID64, getObjItemID(`39`, `Stinky Sumac`))
p.ResObjID64 = append(p.ResObjID64, getObjItemID(`s01`, `📕Scroll of Rage`))
p.ResObjID64 = append(p.ResObjID64, getObjItemID(`r01`, `Champion Sword recipe`))
p.ResObjID64 = append(p.ResObjID64, getObjItemID(`k01`, `Champion blade`))
p.ResObjID64 = append(p.ResObjID64, getObjItemID(`w07`, `Rapier`))
*/
b, _ := json.Marshal(p) b, _ := json.Marshal(p)
t := time.Now().UTC() t := time.Now().UTC()

5
job.go
View File

@ -851,11 +851,10 @@ func jobGDeposit(j Job) {
if cwm.Stock[stockIdx].ItemID64 == p.ResObjID64[resIdx] { if cwm.Stock[stockIdx].ItemID64 == p.ResObjID64[resIdx] {
log.Printf("jobGDeposit : objSubTypeMessageStockAck : Matching ItemID %d (%d).\n", p.ResObjID64[resIdx], cwm.Stock[stockIdx].Quantity) log.Printf("jobGDeposit : objSubTypeMessageStockAck : Matching ItemID %d (%d).\n", p.ResObjID64[resIdx], cwm.Stock[stockIdx].Quantity)
item, _ := getObjItem(p.ResObjID64[resIdx]) item, _ := getObjItem(p.ResObjID64[resIdx])
clientSendCWMsg(p.ChatID64, fmt.Sprintf("/g_deposit %s 1", item.Code)) clientSendCWMsg(p.ChatID64, fmt.Sprintf("/g_deposit %s %d", item.Code, cwm.Stock[stockIdx].Quantity))
p2 := JobPayloadGDepositForward{ p2 := JobPayloadGDepositForward{
ItemID64: p.ResObjID64[resIdx], ItemID64: p.ResObjID64[resIdx],
Quantity: 1, Quantity: cwm.Stock[stockIdx].Quantity,
//Quantity: cwm.Stock[stockIdx].Quantity,
} }
b2, _ := json.Marshal(p2) b2, _ := json.Marshal(p2)
err = createJobCallback(objSubTypeJobGDepositForward, j.UserID64, objSubTypeMessageGDepositAck, b2, time.Duration(1*time.Minute)) err = createJobCallback(objSubTypeJobGDepositForward, j.UserID64, objSubTypeMessageGDepositAck, b2, time.Duration(1*time.Minute))

View File

@ -247,7 +247,7 @@ func MQTGCmdWorker(id int, cmds <-chan TGCommand) {
if clt, ok := getLockedClient(c.FromUserID64, false); ok { if clt, ok := getLockedClient(c.FromUserID64, false); ok {
j, err := json.Marshal(c) j, err := json.Marshal(c)
logOnError(err, "MQTGCmdWorker["+strconv.Itoa(id)+"] : Marshal(c)") logOnError(err, "MQTGCmdWorker["+strconv.Itoa(id)+"] : Marshal(c)")
log.Printf("MQTGCmdWorker["+strconv.Itoa(id)+"] : new command.\n%s\n", string(j)) //log.Printf("MQTGCmdWorker["+strconv.Itoa(id)+"] : new command.\n%s\n", string(j))
for clt.MQ.Connection.IsClosed() { for clt.MQ.Connection.IsClosed() {
clt.Active = false clt.Active = false
log.Printf("MQTGCmdWorker : Resetting MQ connection for #%d.\n", c.FromUserID64) log.Printf("MQTGCmdWorker : Resetting MQ connection for #%d.\n", c.FromUserID64)
@ -510,7 +510,7 @@ func JobWorker(id int, jobs <-chan Job) {
//log.Printf("jobWorker[" + strconv.Itoa(id) + "] : Starting.") //log.Printf("jobWorker[" + strconv.Itoa(id) + "] : Starting.")
// FIXME : discard timed out jobs // FIXME : discard timed out jobs
for j := range jobs { for j := range jobs {
log.Printf("JobWorker[%d] : Starting job %d (timeout : %s).\n", id, j.ID64, j.Timeout.Format(time.RFC3339)) //log.Printf("JobWorker[%d] : Starting job %d (timeout : %s).\n", id, j.ID64, j.Timeout.Format(time.RFC3339))
if time.Now().UTC().Before(j.Timeout) { if time.Now().UTC().Before(j.Timeout) {
switch j.JobTypeID { switch j.JobTypeID {
case objSubTypeJobRescanMsg: case objSubTypeJobRescanMsg: