This commit is contained in:
shoopea 2020-01-02 20:04:12 +08:00
parent c5e26e5849
commit 444eb64f2a
7 changed files with 211 additions and 210 deletions

28
bot.go
View File

@ -293,8 +293,8 @@ func botMsgRescan(m *tb.Message) {
} }
b, _ := json.Marshal(p) b, _ := json.Marshal(p)
log.Printf("botMsgRescan : json : %s\n", string(b)) log.Printf("botMsgRescan : json : %s\n", string(b))
_, err := createJob(objSubTypeJobRescanMsg, objJobPriorityRescanMsg, int64(m.Sender.ID), 0, time.Now().UTC(), b) _, err := createJob(cacheObjSubType[`job_rescan_msg`], objJobPriorityRescanMsg, int64(m.Sender.ID), 0, time.Now().UTC(), b)
logOnError(err, "botMsgRescan : createJob(objSubTypeJobRescanMsg)") logOnError(err, "botMsgRescan : createJob(cacheObjSubType[`job_rescan_msg`])")
if err != nil { if err != nil {
c := TGCommand{ c := TGCommand{
Type: commandReplyMsg, Type: commandReplyMsg,
@ -352,8 +352,8 @@ func botMsgRescanAll(m *tb.Message) {
ChatID64: m.Chat.ID, ChatID64: m.Chat.ID,
} }
b, _ := json.Marshal(p) b, _ := json.Marshal(p)
_, err := createJob(objSubTypeJobRescanMsg, objJobPriorityRescanAllMsg, int64(m.Sender.ID), 0, time.Now().UTC(), b) _, err := createJob(cacheObjSubType[`job_rescan_msg`], objJobPriorityRescanAllMsg, int64(m.Sender.ID), 0, time.Now().UTC(), b)
logOnError(err, "botMsgRescan : createJob(objSubTypeJobRescanMsg)") logOnError(err, "botMsgRescan : createJob(cacheObjSubType[`job_rescan_msg`])")
if err != nil { if err != nil {
c := TGCommand{ c := TGCommand{
@ -407,8 +407,8 @@ func botBackupExport(m *tb.Message) {
ChatID64: m.Chat.ID, ChatID64: m.Chat.ID,
} }
b, _ := json.Marshal(p) b, _ := json.Marshal(p)
_, err := createJob(objSubTypeJobBackupExport, objJobPriorityBackup, int64(m.Sender.ID), 0, time.Now().UTC(), b) _, err := createJob(cacheObjSubType[`job_backup_export`], objJobPriorityBackup, int64(m.Sender.ID), 0, time.Now().UTC(), b)
logOnError(err, "botBackupExport : createJob(objSubTypeJobBackupExport)") logOnError(err, "botBackupExport : createJob(cacheObjSubType[`job_backup_export`])")
return return
} }
@ -459,8 +459,8 @@ func botBackupImport(m *tb.Message) {
ChatID64: m.Chat.ID, ChatID64: m.Chat.ID,
} }
b, _ := json.Marshal(p) b, _ := json.Marshal(p)
_, err := createJob(objSubTypeJobBackupImport, objJobPriorityBackup, int64(m.Sender.ID), 0, time.Now().UTC(), b) _, err := createJob(cacheObjSubType[`job_backup_import`], objJobPriorityBackup, int64(m.Sender.ID), 0, time.Now().UTC(), b)
logOnError(err, "botBackupImport : createJob(objSubTypeJobBackupImport)") logOnError(err, "botBackupImport : createJob(cacheObjSubType[`job_backup_import`])")
return return
} }
@ -665,7 +665,7 @@ func botGStock(m *tb.Message) {
} }
b, _ := json.Marshal(p) b, _ := json.Marshal(p)
t := time.Now().UTC().Add(1 * time.Second) t := time.Now().UTC().Add(1 * time.Second)
_, err = createJob(objSubTypeJobGStock, objJobPriority, userID64, 0, t, b) _, err = createJob(cacheObjSubType[`job_gstock`], objJobPriority, userID64, 0, t, b)
if err != nil { if err != nil {
c := TGCommand{ c := TGCommand{
@ -781,7 +781,7 @@ func botVaultItem(m *tb.Message) {
if len(p.ItemListID64) > 0 { if len(p.ItemListID64) > 0 {
b, _ := json.Marshal(p) b, _ := json.Marshal(p)
t := time.Now().UTC() t := time.Now().UTC()
_, err := createJob(objSubTypeJobVaultItemStatus, objJobPriority, int64(m.Sender.ID), 0, t, b) _, err := createJob(cacheObjSubType[`job_vault_item_status`], objJobPriority, int64(m.Sender.ID), 0, t, b)
if err != nil { if err != nil {
c := TGCommand{ c := TGCommand{
Type: commandReplyMsg, Type: commandReplyMsg,
@ -831,7 +831,7 @@ func botVault(m *tb.Message, itemTypeList []int64) {
b, _ := json.Marshal(p) b, _ := json.Marshal(p)
t := time.Now().UTC() t := time.Now().UTC()
_, err := createJob(objSubTypeJobVaultUserStatus, objJobPriority, int64(m.Sender.ID), 0, t, b) _, err := createJob(cacheObjSubType[`job_vault_user_status`], objJobPriority, int64(m.Sender.ID), 0, t, b)
if err != nil { if err != nil {
c := TGCommand{ c := TGCommand{
@ -899,7 +899,7 @@ func botGDepositAll(m *tb.Message) {
b, _ := json.Marshal(p) b, _ := json.Marshal(p)
t := time.Now().UTC() t := time.Now().UTC()
_, err := createJob(objSubTypeJobGDeposit, objJobPriority, int64(m.Chat.ID), 0, t, b) _, err := createJob(cacheObjSubType[`job_gdeposit`], objJobPriority, int64(m.Chat.ID), 0, t, b)
//log.Printf("botGDepositAll : json : %s\n", string(b)) //log.Printf("botGDepositAll : json : %s\n", string(b))
@ -939,7 +939,7 @@ func botGWithdraw(m *tb.Message) {
} }
b, _ := json.Marshal(p) b, _ := json.Marshal(p)
t := time.Now().UTC() t := time.Now().UTC()
_, err := createJob(objSubTypeJobGWithdraw, objJobPriority, int64(m.Chat.ID), 0, t, b) _, err := createJob(cacheObjSubType[`job_gwithdraw`], objJobPriority, int64(m.Chat.ID), 0, t, b)
if err != nil { if err != nil {
c := TGCommand{ c := TGCommand{
Type: commandReplyMsg, Type: commandReplyMsg,
@ -999,7 +999,7 @@ func botTimer(m *tb.Message) {
} }
b, _ := json.Marshal(p) b, _ := json.Marshal(p)
t := time.Now().UTC().Add(d) t := time.Now().UTC().Add(d)
objID64, err := createJob(objSubTypeJobMsgClient, objJobPriority, int64(m.Chat.ID), 0, t, b) objID64, err := createJob(cacheObjSubType[`job_msg_client`], objJobPriority, int64(m.Chat.ID), 0, t, b)
logOnError(err, "botTimer : createJob") logOnError(err, "botTimer : createJob")
if err != nil { if err != nil {
c := TGCommand{ c := TGCommand{

View File

@ -31,7 +31,7 @@ func cronSendWarReport() {
ChatID64: cfg.Bot.Reportchat, ChatID64: cfg.Bot.Reportchat,
} }
b, _ := json.Marshal(&p) b, _ := json.Marshal(&p)
err := createJobCallback(objSubTypeJobFwdMsg, c.TGUserID64, cacheObjSubType[`msg_report_ack`], b, 1*time.Minute) err := createJobCallback(cacheObjSubType[`job_msg_fwd`], c.TGUserID64, cacheObjSubType[`msg_report_ack`], b, 1*time.Minute)
logOnError(err, "cronSendWarReport : createJobCallback") logOnError(err, "cronSendWarReport : createJobCallback")
clientSendCWMsgDelay(c.TGUserID64, `/report`, 0) clientSendCWMsgDelay(c.TGUserID64, `/report`, 0)
} }
@ -46,7 +46,7 @@ func cronSetDef() {
if c.Active { if c.Active {
p := JobPayloadSetDef{} p := JobPayloadSetDef{}
b, _ := json.Marshal(&p) b, _ := json.Marshal(&p)
err := createJobCallback(objSubTypeJobSetDef, c.TGUserID64, cacheObjSubType[`msg_me_ack`], b, 1*time.Minute) err := createJobCallback(cacheObjSubType[`job_set_def`], c.TGUserID64, cacheObjSubType[`msg_me_ack`], b, 1*time.Minute)
logOnError(err, "cronSetDef : createJobCallback") logOnError(err, "cronSetDef : createJobCallback")
clientSendCWMsgDelay(c.TGUserID64, `🏅Me`, 0) clientSendCWMsgDelay(c.TGUserID64, `🏅Me`, 0)
} }
@ -64,7 +64,7 @@ func cronGetHammerTime() {
clt.Mux.Unlock() clt.Mux.Unlock()
p := JobPayloadGetHammerTime{} p := JobPayloadGetHammerTime{}
b, _ := json.Marshal(&p) b, _ := json.Marshal(&p)
err = createJobCallback(objSubTypeJobGetHammerTime, clt.TGUserID64, cacheObjSubType[`msg_time_ack`], b, 1*time.Minute) err = createJobCallback(cacheObjSubType[`job_get_hammer_time`], clt.TGUserID64, cacheObjSubType[`msg_time_ack`], b, 1*time.Minute)
logOnError(err, "cronGetHammerTime : createJobCallback") logOnError(err, "cronGetHammerTime : createJobCallback")
clientSendCWMsgDelay(clt.TGUserID64, `/time`, 0) clientSendCWMsgDelay(clt.TGUserID64, `/time`, 0)
} }

View File

@ -595,7 +595,7 @@
"obj_type": "job" "obj_type": "job"
}, },
{ {
"intl_id": "job_fwd_msg", "intl_id": "job_msg_fwd",
"name": "Forward Message job", "name": "Forward Message job",
"obj_type": "job" "obj_type": "job"
}, },

279
def.go
View File

@ -466,146 +466,147 @@ const (
objSubTypeUser = 101 objSubTypeUser = 101
objSubTypeGuild = 201 objSubTypeGuild = 201
/* /*
cacheObjSubType[`msg`] = 301 cacheObjSubType[`msg`] = 301
cacheObjSubType[`msg_war`] = 302 // from Chat Wars Reports (not done) cacheObjSubType[`msg_war`] = 302 // from Chat Wars Reports (not done)
objSubTypeMessageMiniWar = 303 // FIXME DELETE objSubTypeMessageMiniWar = 303 // FIXME DELETE
cacheObjSubType[`msg_guild_war`] = 304 // from Chat Wars Reports (not done) cacheObjSubType[`msg_guild_war`] = 304 // from Chat Wars Reports (not done)
cacheObjSubType[`msg_report_req`] = 305 // /report (done) cacheObjSubType[`msg_report_req`] = 305 // /report (done)
cacheObjSubType[`msg_report_ack`] = 306 // result from /report (done) cacheObjSubType[`msg_report_ack`] = 306 // result from /report (done)
cacheObjSubType[`msg_g_report_req`] = 307 // /g_report (done) cacheObjSubType[`msg_g_report_req`] = 307 // /g_report (done)
cacheObjSubType[`msg_g_report_ack`] = 308 // result from /g_report (not done) cacheObjSubType[`msg_g_report_ack`] = 308 // result from /g_report (not done)
cacheObjSubType[`msg_quest_res`] = 309 // result from going to quest (not done) cacheObjSubType[`msg_quest_res`] = 309 // result from going to quest (not done)
cacheObjSubType[`msg_duel_fight`] = 310 // result from going to duel fight (done) cacheObjSubType[`msg_duel_fight`] = 310 // result from going to duel fight (done)
cacheObjSubType[`msg_hero_req`] = 311 // /hero (done) cacheObjSubType[`msg_hero_req`] = 311 // /hero (done)
cacheObjSubType[`msg_hero_ack`] = 312 // result from /hero (not done) cacheObjSubType[`msg_hero_ack`] = 312 // result from /hero (not done)
cacheObjSubType[`msg_me_req`] = 313 // 🏅Me (done) cacheObjSubType[`msg_me_req`] = 313 // 🏅Me (done)
cacheObjSubType[`msg_me_ack`] = 314 // result from 🏅Me (done) cacheObjSubType[`msg_me_ack`] = 314 // result from 🏅Me (done)
cacheObjSubType[`msg_inv_req`] = 315 // /inv (done) cacheObjSubType[`msg_inv_req`] = 315 // /inv (done)
cacheObjSubType[`msg_inv_ack`] = 316 // result from /inv (not done) cacheObjSubType[`msg_inv_ack`] = 316 // result from /inv (not done)
cacheObjSubType[`msg_pillage_inc`] = 317 // random incoming pillage (done) cacheObjSubType[`msg_pillage_inc`] = 317 // random incoming pillage (done)
cacheObjSubType[`msg_pillage_go`] = 318 // ack from /go (done) cacheObjSubType[`msg_pillage_go`] = 318 // ack from /go (done)
cacheObjSubType[`msg_pillage_timeout`] = 319 // ack from lack of /go (done) cacheObjSubType[`msg_pillage_timeout`] = 319 // ack from lack of /go (done)
cacheObjSubType[`msg_pillage_win`] = 320 // pillage successfully intercepted (done) cacheObjSubType[`msg_pillage_win`] = 320 // pillage successfully intercepted (done)
cacheObjSubType[`msg_pillage_loss`] = 321 // pillage not intercepted (done) cacheObjSubType[`msg_pillage_loss`] = 321 // pillage not intercepted (done)
cacheObjSubType[`msg_tribute_inc`] = 322 // request for a /pledge (not done) cacheObjSubType[`msg_tribute_inc`] = 322 // request for a /pledge (not done)
cacheObjSubType[`msg_tribute_ack`] = 323 // pledge accepted (not done) cacheObjSubType[`msg_tribute_ack`] = 323 // pledge accepted (not done)
cacheObjSubType[`msg_auction_announce`] = 324 // from Boris and Co, Ltd (done) cacheObjSubType[`msg_auction_announce`] = 324 // from Boris and Co, Ltd (done)
cacheObjSubType[`msg_auction_upd_req`] = 325 // /l_123456 msg (not done) cacheObjSubType[`msg_auction_upd_req`] = 325 // /l_123456 msg (not done)
cacheObjSubType[`msg_auction_upd_ack`] = 326 // result from /l_123456 (not done) cacheObjSubType[`msg_auction_upd_ack`] = 326 // result from /l_123456 (not done)
cacheObjSubType[`msg_time_ack`] = 327 // result from /time (done) cacheObjSubType[`msg_time_ack`] = 327 // result from /time (done)
cacheObjSubType[`msg_time_req`] = 328 // /time (done) cacheObjSubType[`msg_time_req`] = 328 // /time (done)
cacheObjSubType[`msg_go`] = 329 // /go (done) cacheObjSubType[`msg_go`] = 329 // /go (done)
cacheObjSubType[`msg_pledge`] = 330 // /pledge (done) cacheObjSubType[`msg_pledge`] = 330 // /pledge (done)
cacheObjSubType[`msg_go_quest_req`] = 331 // 🌲Forest or 🍄Swamp or ⛰Valley (not done) cacheObjSubType[`msg_go_quest_req`] = 331 // 🌲Forest or 🍄Swamp or ⛰Valley (not done)
cacheObjSubType[`msg_fast_fight`] = 332 // ▶Fast fight (not done) cacheObjSubType[`msg_fast_fight`] = 332 // ▶Fast fight (not done)
cacheObjSubType[`msg_go_arena`] = 333 // 📯Arena (not done) cacheObjSubType[`msg_go_arena`] = 333 // 📯Arena (not done)
cacheObjSubType[`msg_top`] = 334 // any /topXX (not done) cacheObjSubType[`msg_top`] = 334 // any /topXX (not done)
cacheObjSubType[`msg_menu`] = 335 // main menu (not done) cacheObjSubType[`msg_menu`] = 335 // main menu (not done)
cacheObjSubType[`msg_buy_req`] = 336 // /wtb_xx (done) cacheObjSubType[`msg_buy_req`] = 336 // /wtb_xx (done)
cacheObjSubType[`msg_sell_req`] = 337 // /wts_xx (done) cacheObjSubType[`msg_sell_req`] = 337 // /wts_xx (done)
cacheObjSubType[`msg_orderbook_req`] = 338 // /t_xx (done) cacheObjSubType[`msg_orderbook_req`] = 338 // /t_xx (done)
cacheObjSubType[`msg_orderbook_acl`] = 339 // orderbook summary (not done) cacheObjSubType[`msg_orderbook_acl`] = 339 // orderbook summary (not done)
cacheObjSubType[`msg_withdraw_req`] = 340 // /g_withdraw (done) cacheObjSubType[`msg_withdraw_req`] = 340 // /g_withdraw (done)
cacheObjSubType[`msg_withdraw_code`] = 341 // code to receive (done) cacheObjSubType[`msg_withdraw_code`] = 341 // code to receive (done)
cacheObjSubType[`msg_withdraw_rcv`] = 342 // Withdraw "received" msg (done) cacheObjSubType[`msg_withdraw_rcv`] = 342 // Withdraw "received" msg (done)
cacheObjSubType[`msg_stock_req`] = 343 // /stock (done) cacheObjSubType[`msg_stock_req`] = 343 // /stock (done)
cacheObjSubType[`msg_stock_ack`] = 344 // result from /stock (not done) cacheObjSubType[`msg_stock_ack`] = 344 // result from /stock (not done)
cacheObjSubType[`msg_misc_req`] = 345 // /misc (done) cacheObjSubType[`msg_misc_req`] = 345 // /misc (done)
cacheObjSubType[`msg_misc_ack`] = 346 // result from /misc (not done) cacheObjSubType[`msg_misc_ack`] = 346 // result from /misc (not done)
cacheObjSubType[`msg_union_war`] = 347 // from Chat Wars Reports (not done) cacheObjSubType[`msg_union_war`] = 347 // from Chat Wars Reports (not done)
cacheObjSubType[`msg_tureport_req`] = 348 // /tu_report (not done) cacheObjSubType[`msg_tureport_req`] = 348 // /tu_report (not done)
cacheObjSubType[`msg_tureport_ack`] = 349 // result from /tu_report (not done) cacheObjSubType[`msg_tureport_ack`] = 349 // result from /tu_report (not done)
cacheObjSubType[`msg_timeout`] = 350 // generic timeout for action cacheObjSubType[`msg_timeout`] = 350 // generic timeout for action
cacheObjSubType[`msg_go_quest_ack`] = 351 // confirm quest destination/busyness (done) cacheObjSubType[`msg_go_quest_ack`] = 351 // confirm quest destination/busyness (done)
cacheObjSubType[`msg_groles_req`] = 352 // /g_roles (done) cacheObjSubType[`msg_groles_req`] = 352 // /g_roles (done)
cacheObjSubType[`msg_groles_ack`] = 353 // result from /g_roles (done) cacheObjSubType[`msg_groles_ack`] = 353 // result from /g_roles (done)
cacheObjSubType[`msg_gstock_res_req`] = 354 // /g_stock_res (done) cacheObjSubType[`msg_gstock_res_req`] = 354 // /g_stock_res (done)
cacheObjSubType[`msg_gstock_alch_req`] = 355 // /g_stock_alch (done) cacheObjSubType[`msg_gstock_alch_req`] = 355 // /g_stock_alch (done)
cacheObjSubType[`msg_gstock_misc_req`] = 356 // /g_stock_misc (done) cacheObjSubType[`msg_gstock_misc_req`] = 356 // /g_stock_misc (done)
cacheObjSubType[`msg_gstock_rec_req`] = 357 // /g_stock_rec (done) cacheObjSubType[`msg_gstock_rec_req`] = 357 // /g_stock_rec (done)
cacheObjSubType[`msg_gstock_part_req`] = 358 // /g_stock_parts (done) cacheObjSubType[`msg_gstock_part_req`] = 358 // /g_stock_parts (done)
cacheObjSubType[`msg_gstock_oth_req`] = 359 // /g_stock_other (done) cacheObjSubType[`msg_gstock_oth_req`] = 359 // /g_stock_other (done)
cacheObjSubType[`msg_gstock_any_ack`] = 360 // result from any /g_stock_xxx (done) cacheObjSubType[`msg_gstock_any_ack`] = 360 // result from any /g_stock_xxx (done)
cacheObjSubType[`msg_gstock_req`] = 361 // /g_stock (done) cacheObjSubType[`msg_gstock_req`] = 361 // /g_stock (done)
cacheObjSubType[`msg_gstock_ack`] = 362 // result from /g_stock (done) cacheObjSubType[`msg_gstock_ack`] = 362 // result from /g_stock (done)
cacheObjSubType[`msg_busy`] = 363 // too busy now cacheObjSubType[`msg_busy`] = 363 // too busy now
cacheObjSubType[`msg_res_stock_req`] = 364 // 📦Resources or /stock (done) cacheObjSubType[`msg_res_stock_req`] = 364 // 📦Resources or /stock (done)
cacheObjSubType[`msg_alch_stock_req`] = 365 // ⚗Alchemy (done) cacheObjSubType[`msg_alch_stock_req`] = 365 // ⚗Alchemy (done)
cacheObjSubType[`msg_misc_stock_req`] = 366 // 🗃Misc or /misc (done) cacheObjSubType[`msg_misc_stock_req`] = 366 // 🗃Misc or /misc (done)
cacheObjSubType[`msg_equip_stock_req`] = 367 // 🏷Equipment (done) cacheObjSubType[`msg_equip_stock_req`] = 367 // 🏷Equipment (done)
cacheObjSubType[`msg_craft_stock_req`] = 368 // ⚒Crafting (done) cacheObjSubType[`msg_craft_stock_req`] = 368 // ⚒Crafting (done)
cacheObjSubType[`msg_stock_empty`] = 369 // [empty] (done) cacheObjSubType[`msg_stock_empty`] = 369 // [empty] (done)
cacheObjSubType[`msg_stock_any_ack`] = 370 // list of stock (done) cacheObjSubType[`msg_stock_any_ack`] = 370 // list of stock (done)
cacheObjSubType[`msg_g_deposit_req`] = 371 // /g_deposit xx y (done) cacheObjSubType[`msg_g_deposit_req`] = 371 // /g_deposit xx y (done)
cacheObjSubType[`msg_g_deposit_ack`] = 372 // Deposited successfully: xx (y) (done) cacheObjSubType[`msg_g_deposit_ack`] = 372 // Deposited successfully: xx (y) (done)
cacheObjSubType[`msg_castle_attack_req`] = 373 // Attack (done) cacheObjSubType[`msg_castle_attack_req`] = 373 // Attack (done)
cacheObjSubType[`msg_castle_attack_ack`] = 374 // Read for attack, select target (done) cacheObjSubType[`msg_castle_attack_ack`] = 374 // Read for attack, select target (done)
cacheObjSubType[`msg_castle_target_req`] = 375 // Castle selection (done) cacheObjSubType[`msg_castle_target_req`] = 375 // Castle selection (done)
cacheObjSubType[`msg_castle_target_ack`] = 376 // Castle confirmation (done) cacheObjSubType[`msg_castle_target_ack`] = 376 // Castle confirmation (done)
cacheObjSubType[`msg_castle_def_req`] = 377 // Defend (done) cacheObjSubType[`msg_castle_def_req`] = 377 // Defend (done)
cacheObjSubType[`msg_castle_def_ack`] = 378 // Defend confirmation (done) cacheObjSubType[`msg_castle_def_ack`] = 378 // Defend confirmation (done)
cacheObjSubType[`msg_back`] = 379 // Back (done) cacheObjSubType[`msg_back`] = 379 // Back (done)
cacheObjSubType[`msg_castle_req`] = 380 // Castle (done) cacheObjSubType[`msg_castle_req`] = 380 // Castle (done)
cacheObjSubType[`msg_castle_ack`] = 381 // Castle msg (not done) cacheObjSubType[`msg_castle_ack`] = 381 // Castle msg (not done)
cacheObjSubType[`msg_exchange_req`] = 382 // ⚖Exchange (done) cacheObjSubType[`msg_exchange_req`] = 382 // ⚖Exchange (done)
cacheObjSubType[`msg_exchange_ack`] = 383 // List of deals (done) cacheObjSubType[`msg_exchange_ack`] = 383 // List of deals (done)
cacheObjSubType[`msg_equip_req`] = 384 // /on_item (done) cacheObjSubType[`msg_equip_req`] = 384 // /on_item (done)
cacheObjSubType[`msg_equip_ack`] = 385 // Item equipped (done) cacheObjSubType[`msg_equip_ack`] = 385 // Item equipped (done)
cacheObjSubType[`msg_unequip_req`] = 386 // /off_item (done) cacheObjSubType[`msg_unequip_req`] = 386 // /off_item (done)
cacheObjSubType[`msg_unequip_ack`] = 387 // Item unequipped (done) cacheObjSubType[`msg_unequip_ack`] = 387 // Item unequipped (done)
cacheObjSubType[`msg_no_stamina`] = 388 // Not enough stamina. (done) cacheObjSubType[`msg_no_stamina`] = 388 // Not enough stamina. (done)
cacheObjSubType[`msg_orderbook_search`] = 389 // /t <something> cacheObjSubType[`msg_orderbook_search`] = 389 // /t <something>
cacheObjSubType[`msg_quest_req`] = 390 // quest cacheObjSubType[`msg_quest_req`] = 390 // quest
cacheObjSubType[`msg_quest_ack`] = 391 // forest/swamp/valley/arena cacheObjSubType[`msg_quest_ack`] = 391 // forest/swamp/valley/arena
cacheObjSubType[`msg_battle`] = 392 // wind is howling cacheObjSubType[`msg_battle`] = 392 // wind is howling
cacheObjSubType[`msg_order_cancel_req`] = 393 // /rm_xxx cacheObjSubType[`msg_order_cancel_req`] = 393 // /rm_xxx
cacheObjSubType[`msg_order_cancel_ack`] = 394 // Cancelling order cacheObjSubType[`msg_order_cancel_ack`] = 394 // Cancelling order
cacheObjSubType[`msg_stamina_restored`] = 395 // Stamina Restored cacheObjSubType[`msg_stamina_restored`] = 395 // Stamina Restored
cacheObjSubType[`msg_top`]Req = 396 cacheObjSubType[`msg_top`]Req = 396
cacheObjSubType[`msg_quest_res_ambush`] = 397 // result from going to quest with ambush (not done) cacheObjSubType[`msg_quest_res_ambush`] = 397 // result from going to quest with ambush (not done)
cacheObjSubType[`msg_heal_up`] = 398 // you should heal up first (done) cacheObjSubType[`msg_heal_up`] = 398 // you should heal up first (done)
cacheObjSubType[`msg_arena_fight_ack`] = 399 // thirsty for blood ... (done) cacheObjSubType[`msg_arena_fight_ack`] = 399 // thirsty for blood ... (done)
cacheObjSubType[`msg_go_arena`]Ack = 400 // Welcome to Arena! (done) cacheObjSubType[`msg_go_arena`]Ack = 400 // Welcome to Arena! (done)
cacheObjSubType[`msg_withdraw_nack`] = 401 // not enought items (done) cacheObjSubType[`msg_withdraw_nack`] = 401 // not enought items (done)
cacheObjSubType[`msg_pillage_defeat`] = 402 // You tried stopping (done) cacheObjSubType[`msg_pillage_defeat`] = 402 // You tried stopping (done)
cacheObjSubType[`msg_level_up_req`] = 403 // /level_up cacheObjSubType[`msg_level_up_req`] = 403 // /level_up
cacheObjSubType[`msg_level_up_ack`] = 404 cacheObjSubType[`msg_level_up_ack`] = 404
cacheObjSubType[`job_pillage`] = 601
cacheObjSubType[`job_tribute`] = 602
cacheObjSubType[`job_status`] = 603
cacheObjSubType[`job_gwithdraw`] = 604
cacheObjSubType[`job_gstock`] = 605
cacheObjSubType[`job_rescan_msg`] = 606
cacheObjSubType[`job_set_done`] = 607
cacheObjSubType[`job_msg_client`] = 608
cacheObjSubType[`job_msg_refresh`] = 609
cacheObjSubType[`job_backup_export`] = 610
cacheObjSubType[`job_backup_import`] = 611
cacheObjSubType[`job_gdeposit`] = 612
cacheObjSubType[`job_gdeposit_fwd`] = 613
cacheObjSubType[`job_save_res`] = 614
cacheObjSubType[`job_vault_user_status`] = 615
cacheObjSubType[`job_vault_item_status`] = 616
cacheObjSubType[`job_msg_fwd`] = 617 // rename to objSubTypeJobMsgFwd
cacheObjSubType[`job_set_def`] = 618
cacheObjSubType[`job_msg_del`] = 619
cacheObjSubType[`job_get_hammer_time`] = 620
*/ */
objSubTypeJobPillage = 601 objSubTypeItemResource = 701
objSubTypeJobTribute = 602 objSubTypeItemAlch = 702
objSubTypeJobStatus = 603 objSubTypeItemMisc = 703
objSubTypeJobGWithdraw = 604 objSubTypeItemRecipe = 704
objSubTypeJobGStock = 605 objSubTypeItemPart = 705
objSubTypeJobRescanMsg = 606 objSubTypeItemOther = 706
objSubTypeJobSetJobDone = 607 objSubTypeItemUnique = 707
objSubTypeJobMsgClient = 608 objSubTypeCastle = 801
objSubTypeJobMsgRefresh = 609 objSubTypeFair = 901
objSubTypeJobBackupExport = 610 objSubTypeUnion = 1001
objSubTypeJobBackupImport = 611 objSubTypeTribute = 1101
objSubTypeJobGDeposit = 612 objSubTypeExperience = 1201
objSubTypeJobGDepositForward = 613 objSubTypeQuestForest = 1301
objSubTypeJobSaveRes = 614 objSubTypeQuestSwamp = 1302
objSubTypeJobVaultUserStatus = 615 objSubTypeQuestValley = 1303
objSubTypeJobVaultItemStatus = 616
objSubTypeJobFwdMsg = 617 // rename to objSubTypeJobMsgFwd
objSubTypeJobSetDef = 618
objSubTypeJobMsgDel = 619
objSubTypeJobGetHammerTime = 620
objSubTypeItemResource = 701
objSubTypeItemAlch = 702
objSubTypeItemMisc = 703
objSubTypeItemRecipe = 704
objSubTypeItemPart = 705
objSubTypeItemOther = 706
objSubTypeItemUnique = 707
objSubTypeCastle = 801
objSubTypeFair = 901
objSubTypeUnion = 1001
objSubTypeTribute = 1101
objSubTypeExperience = 1201
objSubTypeQuestForest = 1301
objSubTypeQuestSwamp = 1302
objSubTypeQuestValley = 1303
objJobStatusCallBack = -1 objJobStatusCallBack = -1
objJobStatusNew = 0 objJobStatusNew = 0

32
job.go
View File

@ -266,8 +266,8 @@ func jobRescan(j Job) {
Text: fmt.Sprintf("%d messages processed in %s.", len(ids), time.Since(start)), Text: fmt.Sprintf("%d messages processed in %s.", len(ids), time.Since(start)),
} }
b, _ := json.Marshal(r) b, _ := json.Marshal(r)
_, err := createJob(objSubTypeJobSetJobDone, objJobPriorityRescanAllMsg, j.UserID64, j.ID64, time.Now().UTC(), b) _, err := createJob(cacheObjSubType[`job_set_done`], objJobPriorityRescanAllMsg, j.UserID64, j.ID64, time.Now().UTC(), b)
logOnError(err, "jobRescan : createJob(objSubTypeJobSetJobDone)") logOnError(err, "jobRescan : createJob(cacheObjSubType[`job_set_done`])")
} else if len(ids) == 1 { } else if len(ids) == 1 {
SQLMsgIdentifyQueue <- ids[0] SQLMsgIdentifyQueue <- ids[0]
@ -717,7 +717,7 @@ func jobGStock(j Job) {
case 0: // send /g_stock_res case 0: // send /g_stock_res
p.Progress = 1 p.Progress = 1
b, _ := json.Marshal(&p) b, _ := json.Marshal(&p)
jobID64, err := createJob(objSubTypeJobGStock, objJobPriority, j.UserID64, 0, time.Unix(maxUnixTimestamp, 0).UTC(), b) jobID64, err := createJob(cacheObjSubType[`job_gstock`], objJobPriority, j.UserID64, 0, time.Unix(maxUnixTimestamp, 0).UTC(), b)
logOnError(err, "jobGStock : createJob") logOnError(err, "jobGStock : createJob")
setJobCallback(jobID64, j.UserID64, cacheObjSubType[`msg_gstock_any_ack`]) setJobCallback(jobID64, j.UserID64, cacheObjSubType[`msg_gstock_any_ack`])
setJobCallback(jobID64, j.UserID64, cacheObjSubType[`msg_busy`]) setJobCallback(jobID64, j.UserID64, cacheObjSubType[`msg_busy`])
@ -737,7 +737,7 @@ func jobGStock(j Job) {
} }
p.Progress = 2 p.Progress = 2
b, _ := json.Marshal(&p) b, _ := json.Marshal(&p)
err = createJobCallback(objSubTypeJobGStock, j.UserID64, cacheObjSubType[`msg_gstock_any_ack`], b, 1*time.Minute) err = createJobCallback(cacheObjSubType[`job_gstock`], j.UserID64, cacheObjSubType[`msg_gstock_any_ack`], b, 1*time.Minute)
logOnError(err, "jobGStock : createJobCallback") logOnError(err, "jobGStock : createJobCallback")
clientSendCWMsg(j.UserID64, "/g_stock_alch") clientSendCWMsg(j.UserID64, "/g_stock_alch")
} else if rule.MsgTypeID64 == cacheObjSubType[`msg_busy`] || rule.MsgTypeID64 == cacheObjSubType[`msg_battle`] { } else if rule.MsgTypeID64 == cacheObjSubType[`msg_busy`] || rule.MsgTypeID64 == cacheObjSubType[`msg_battle`] {
@ -761,7 +761,7 @@ func jobGStock(j Job) {
} }
p.Progress = 3 p.Progress = 3
b, _ := json.Marshal(&p) b, _ := json.Marshal(&p)
err = createJobCallback(objSubTypeJobGStock, j.UserID64, cacheObjSubType[`msg_gstock_any_ack`], b, 1*time.Minute) err = createJobCallback(cacheObjSubType[`job_gstock`], j.UserID64, cacheObjSubType[`msg_gstock_any_ack`], b, 1*time.Minute)
logOnError(err, "jobGStock : createJobCallback") logOnError(err, "jobGStock : createJobCallback")
clientSendCWMsg(j.UserID64, "/g_stock_misc") clientSendCWMsg(j.UserID64, "/g_stock_misc")
case 3: // send /g_stock_rec case 3: // send /g_stock_rec
@ -775,7 +775,7 @@ func jobGStock(j Job) {
} }
p.Progress = 4 p.Progress = 4
b, _ := json.Marshal(&p) b, _ := json.Marshal(&p)
err = createJobCallback(objSubTypeJobGStock, j.UserID64, cacheObjSubType[`msg_gstock_any_ack`], b, 1*time.Minute) err = createJobCallback(cacheObjSubType[`job_gstock`], j.UserID64, cacheObjSubType[`msg_gstock_any_ack`], b, 1*time.Minute)
logOnError(err, "jobGStock : createJobCallback") logOnError(err, "jobGStock : createJobCallback")
clientSendCWMsg(j.UserID64, "/g_stock_rec") clientSendCWMsg(j.UserID64, "/g_stock_rec")
case 4: // send /g_stock_parts case 4: // send /g_stock_parts
@ -789,7 +789,7 @@ func jobGStock(j Job) {
} }
p.Progress = 5 p.Progress = 5
b, _ := json.Marshal(&p) b, _ := json.Marshal(&p)
err = createJobCallback(objSubTypeJobGStock, j.UserID64, cacheObjSubType[`msg_gstock_any_ack`], b, 1*time.Minute) err = createJobCallback(cacheObjSubType[`job_gstock`], j.UserID64, cacheObjSubType[`msg_gstock_any_ack`], b, 1*time.Minute)
logOnError(err, "jobGStock : createJobCallback") logOnError(err, "jobGStock : createJobCallback")
clientSendCWMsg(j.UserID64, "/g_stock_parts") clientSendCWMsg(j.UserID64, "/g_stock_parts")
case 5: // send /g_stock_other case 5: // send /g_stock_other
@ -803,7 +803,7 @@ func jobGStock(j Job) {
} }
p.Progress = 6 p.Progress = 6
b, _ := json.Marshal(&p) b, _ := json.Marshal(&p)
err = createJobCallback(objSubTypeJobGStock, j.UserID64, cacheObjSubType[`msg_gstock_any_ack`], b, 1*time.Minute) err = createJobCallback(cacheObjSubType[`job_gstock`], j.UserID64, cacheObjSubType[`msg_gstock_any_ack`], b, 1*time.Minute)
logOnError(err, "jobGStock : createJobCallback") logOnError(err, "jobGStock : createJobCallback")
clientSendCWMsg(j.UserID64, "/g_stock_other") clientSendCWMsg(j.UserID64, "/g_stock_other")
case 6: // collate everything and reply case 6: // collate everything and reply
@ -943,7 +943,7 @@ func jobGDeposit(j Job) {
clientSendCWMsgDelay(p.ChatID64, `📦Resources`, delay) clientSendCWMsgDelay(p.ChatID64, `📦Resources`, delay)
p.Status = cacheObjSubType[`msg_stock_ack`] p.Status = cacheObjSubType[`msg_stock_ack`]
b, _ = json.Marshal(&p) b, _ = json.Marshal(&p)
err = createJobCallback(objSubTypeJobGDeposit, j.UserID64, cacheObjSubType[`msg_stock_ack`], b, 1*time.Minute) err = createJobCallback(cacheObjSubType[`job_gdeposit`], j.UserID64, cacheObjSubType[`msg_stock_ack`], b, 1*time.Minute)
logOnError(err, "jobGDeposit : createJobCallback") logOnError(err, "jobGDeposit : createJobCallback")
delay = delay + 2*time.Second delay = delay + 2*time.Second
} }
@ -951,7 +951,7 @@ func jobGDeposit(j Job) {
clientSendCWMsgDelay(p.ChatID64, `Alchemy`, delay) clientSendCWMsgDelay(p.ChatID64, `Alchemy`, delay)
p.Status = 1 // FIXME UPDATE WITH PROPER TYPE p.Status = 1 // FIXME UPDATE WITH PROPER TYPE
b, _ = json.Marshal(&p) b, _ = json.Marshal(&p)
err = createJobCallback(objSubTypeJobGDeposit, j.UserID64, cacheObjSubType[`msg_orderbook_acl`], b, 1*time.Minute) err = createJobCallback(cacheObjSubType[`job_gdeposit`], j.UserID64, cacheObjSubType[`msg_orderbook_acl`], b, 1*time.Minute)
logOnError(err, "jobGDeposit : createJobCallback") logOnError(err, "jobGDeposit : createJobCallback")
delay = delay + 2*time.Second delay = delay + 2*time.Second
} }
@ -959,7 +959,7 @@ func jobGDeposit(j Job) {
clientSendCWMsgDelay(p.ChatID64, `🗃Misc`, delay) clientSendCWMsgDelay(p.ChatID64, `🗃Misc`, delay)
p.Status = 1 // FIXME UPDATE WITH PROPER TYPE p.Status = 1 // FIXME UPDATE WITH PROPER TYPE
b, _ = json.Marshal(&p) b, _ = json.Marshal(&p)
err = createJobCallback(objSubTypeJobGDeposit, j.UserID64, cacheObjSubType[`msg_orderbook_acl`], b, 1*time.Minute) err = createJobCallback(cacheObjSubType[`job_gdeposit`], j.UserID64, cacheObjSubType[`msg_orderbook_acl`], b, 1*time.Minute)
logOnError(err, "jobGDeposit : createJobCallback") logOnError(err, "jobGDeposit : createJobCallback")
delay = delay + 2*time.Second delay = delay + 2*time.Second
} }
@ -967,7 +967,7 @@ func jobGDeposit(j Job) {
clientSendCWMsgDelay(p.ChatID64, `⚒Crafting`, delay) clientSendCWMsgDelay(p.ChatID64, `⚒Crafting`, delay)
p.Status = cacheObjSubType[`msg_stock_any_ack`] p.Status = cacheObjSubType[`msg_stock_any_ack`]
b, _ = json.Marshal(&p) b, _ = json.Marshal(&p)
err = createJobCallback(objSubTypeJobGDeposit, j.UserID64, cacheObjSubType[`msg_stock_any_ack`], b, 1*time.Minute) err = createJobCallback(cacheObjSubType[`job_gdeposit`], j.UserID64, cacheObjSubType[`msg_stock_any_ack`], b, 1*time.Minute)
logOnError(err, "jobGDeposit : createJobCallback") logOnError(err, "jobGDeposit : createJobCallback")
delay = delay + 2*time.Second delay = delay + 2*time.Second
} }
@ -975,7 +975,7 @@ func jobGDeposit(j Job) {
clientSendCWMsgDelay(p.ChatID64, `🏷Equipment`, delay) clientSendCWMsgDelay(p.ChatID64, `🏷Equipment`, delay)
p.Status = 1 // FIXME UPDATE WITH PROPER TYPE p.Status = 1 // FIXME UPDATE WITH PROPER TYPE
b, _ = json.Marshal(&p) b, _ = json.Marshal(&p)
err = createJobCallback(objSubTypeJobGDeposit, j.UserID64, cacheObjSubType[`msg_orderbook_acl`], b, 1*time.Minute) err = createJobCallback(cacheObjSubType[`job_gdeposit`], j.UserID64, cacheObjSubType[`msg_orderbook_acl`], b, 1*time.Minute)
logOnError(err, "jobGDeposit : createJobCallback") logOnError(err, "jobGDeposit : createJobCallback")
delay = delay + 2*time.Second delay = delay + 2*time.Second
} }
@ -1002,7 +1002,7 @@ func jobGDeposit(j Job) {
Quantity: cwm.Stock[stockIdx].Quantity, Quantity: cwm.Stock[stockIdx].Quantity,
} }
b2, _ := json.Marshal(p2) b2, _ := json.Marshal(p2)
err = createJobCallback(objSubTypeJobGDepositForward, j.UserID64, cacheObjSubType[`msg_g_deposit_req`], b2, time.Duration(1*time.Minute)) err = createJobCallback(cacheObjSubType[`job_gdeposit_fwd`], j.UserID64, cacheObjSubType[`msg_g_deposit_req`], b2, time.Duration(1*time.Minute))
} }
} }
} }
@ -1024,7 +1024,7 @@ func jobGDeposit(j Job) {
Quantity: cwm.Stock[stockIdx].Quantity, Quantity: cwm.Stock[stockIdx].Quantity,
} }
b2, _ := json.Marshal(p2) b2, _ := json.Marshal(p2)
err = createJobCallback(objSubTypeJobGDepositForward, j.UserID64, cacheObjSubType[`msg_g_deposit_req`], b2, time.Duration(1*time.Minute)) err = createJobCallback(cacheObjSubType[`job_gdeposit_fwd`], j.UserID64, cacheObjSubType[`msg_g_deposit_req`], b2, time.Duration(1*time.Minute))
} }
} }
} }
@ -1283,7 +1283,7 @@ func jobGWithdraw(j Job) {
ChatWarsItems ChatWarsItems
b, _ := json.Marshal(p) b, _ := json.Marshal(p)
t := time.Now().UTC() t := time.Now().UTC()
_, err := createJob(objSubTypeJobGDeposit, objJobPriority, int64(m.Chat.ID), 0, t, b) _, err := createJob(cacheObjSubType[`job_gdeposit`], objJobPriority, int64(m.Chat.ID), 0, t, b)
*/ */
} }

38
sql.go
View File

@ -560,25 +560,25 @@ func initDB() {
,(` + strconv.Itoa(cacheObjSubType[`msg_level_up_req`]) + `, "level_up_req", "Level Up Req", ` + strconv.Itoa(objTypeMessage) + `) ,(` + strconv.Itoa(cacheObjSubType[`msg_level_up_req`]) + `, "level_up_req", "Level Up Req", ` + strconv.Itoa(objTypeMessage) + `)
,(` + strconv.Itoa(cacheObjSubType[`msg_level_up_ack`]) + `, "level_up_ack", "Level Up Ack", ` + strconv.Itoa(objTypeMessage) + `) ,(` + strconv.Itoa(cacheObjSubType[`msg_level_up_ack`]) + `, "level_up_ack", "Level Up Ack", ` + strconv.Itoa(objTypeMessage) + `)
,(` + strconv.Itoa(cacheObjSubType[`msg_top`]Req) + `, "top_req", "Top Req", ` + strconv.Itoa(objTypeMessage) + `) ,(` + strconv.Itoa(cacheObjSubType[`msg_top`]Req) + `, "top_req", "Top Req", ` + strconv.Itoa(objTypeMessage) + `)
,(` + strconv.Itoa(objSubTypeJobPillage) + `, "job_pillage", "Pillage job", ` + strconv.Itoa(objTypeJob) + `) ,(` + strconv.Itoa(cacheObjSubType[`job_pillage`]) + `, "job_pillage", "Pillage job", ` + strconv.Itoa(objTypeJob) + `)
,(` + strconv.Itoa(objSubTypeJobTribute) + `, "job_tribute", "Tribute job", ` + strconv.Itoa(objTypeJob) + `) ,(` + strconv.Itoa(cacheObjSubType[`job_tribute`]) + `, "job_tribute", "Tribute job", ` + strconv.Itoa(objTypeJob) + `)
,(` + strconv.Itoa(objSubTypeJobGWithdraw) + `, "job_gwithdraw", "GWithdrawal job", ` + strconv.Itoa(objTypeJob) + `) ,(` + strconv.Itoa(cacheObjSubType[`job_gwithdraw`]) + `, "job_gwithdraw", "GWithdrawal job", ` + strconv.Itoa(objTypeJob) + `)
,(` + strconv.Itoa(objSubTypeJobGStock) + `, "job_gstock", "GStock job", ` + strconv.Itoa(objTypeJob) + `) ,(` + strconv.Itoa(cacheObjSubType[`job_gstock`]) + `, "job_gstock", "GStock job", ` + strconv.Itoa(objTypeJob) + `)
,(` + strconv.Itoa(objSubTypeJobRescanMsg) + `, "job_rescan_msg", "Rescan message job", ` + strconv.Itoa(objTypeJob) + `) ,(` + strconv.Itoa(cacheObjSubType[`job_rescan_msg`]) + `, "job_rescan_msg", "Rescan message job", ` + strconv.Itoa(objTypeJob) + `)
,(` + strconv.Itoa(objSubTypeJobSetJobDone) + `, "job_set_done", "Set job as done job", ` + strconv.Itoa(objTypeJob) + `) ,(` + strconv.Itoa(cacheObjSubType[`job_set_done`]) + `, "job_set_done", "Set job as done job", ` + strconv.Itoa(objTypeJob) + `)
,(` + strconv.Itoa(objSubTypeJobMsgClient) + `, "job_msg_client", "Send message via client", ` + strconv.Itoa(objTypeJob) + `) ,(` + strconv.Itoa(cacheObjSubType[`job_msg_client`]) + `, "job_msg_client", "Send message via client", ` + strconv.Itoa(objTypeJob) + `)
,(` + strconv.Itoa(objSubTypeJobMsgRefresh) + `, "job_msg_refresh", "Refresh message from client", ` + strconv.Itoa(objTypeJob) + `) ,(` + strconv.Itoa(cacheObjSubType[`job_msg_refresh`]) + `, "job_msg_refresh", "Refresh message from client", ` + strconv.Itoa(objTypeJob) + `)
,(` + strconv.Itoa(objSubTypeJobBackupExport) + `, "job_backup_export", "Export Backup", ` + strconv.Itoa(objTypeJob) + `) ,(` + strconv.Itoa(cacheObjSubType[`job_backup_export`]) + `, "job_backup_export", "Export Backup", ` + strconv.Itoa(objTypeJob) + `)
,(` + strconv.Itoa(objSubTypeJobBackupImport) + `, "job_backup_import", "Import Backup", ` + strconv.Itoa(objTypeJob) + `) ,(` + strconv.Itoa(cacheObjSubType[`job_backup_import`]) + `, "job_backup_import", "Import Backup", ` + strconv.Itoa(objTypeJob) + `)
,(` + strconv.Itoa(objSubTypeJobGDeposit) + `, "job_gdeposit", "GDeposit job", ` + strconv.Itoa(objTypeJob) + `) ,(` + strconv.Itoa(cacheObjSubType[`job_gdeposit`]) + `, "job_gdeposit", "GDeposit job", ` + strconv.Itoa(objTypeJob) + `)
,(` + strconv.Itoa(objSubTypeJobGDepositForward) + `, "job_gdeposit_fwd", "GDeposit Forward job", ` + strconv.Itoa(objTypeJob) + `) ,(` + strconv.Itoa(cacheObjSubType[`job_gdeposit_fwd`]) + `, "job_gdeposit_fwd", "GDeposit Forward job", ` + strconv.Itoa(objTypeJob) + `)
,(` + strconv.Itoa(objSubTypeJobSaveRes) + `, "job_save_res", "Save resources job", ` + strconv.Itoa(objTypeJob) + `) ,(` + strconv.Itoa(cacheObjSubType[`job_save_res`]) + `, "job_save_res", "Save resources job", ` + strconv.Itoa(objTypeJob) + `)
,(` + strconv.Itoa(objSubTypeJobVaultUserStatus) + `, "job_vault_user_status", "Vault User Status job", ` + strconv.Itoa(objTypeJob) + `) ,(` + strconv.Itoa(cacheObjSubType[`job_vault_user_status`]) + `, "job_vault_user_status", "Vault User Status job", ` + strconv.Itoa(objTypeJob) + `)
,(` + strconv.Itoa(objSubTypeJobVaultItemStatus) + `, "job_vault_item_status", "Vault Item Status job", ` + strconv.Itoa(objTypeJob) + `) ,(` + strconv.Itoa(cacheObjSubType[`job_vault_item_status`]) + `, "job_vault_item_status", "Vault Item Status job", ` + strconv.Itoa(objTypeJob) + `)
,(` + strconv.Itoa(objSubTypeJobFwdMsg) + `, "job_fwd_msg", "Forward Message job", ` + strconv.Itoa(objTypeJob) + `) ,(` + strconv.Itoa(cacheObjSubType[`job_msg_fwd`]) + `, "job_fwd_msg", "Forward Message job", ` + strconv.Itoa(objTypeJob) + `)
,(` + strconv.Itoa(objSubTypeJobSetDef) + `, "job_set_def", "Set Defense job", ` + strconv.Itoa(objTypeJob) + `) ,(` + strconv.Itoa(cacheObjSubType[`job_set_def`]) + `, "job_set_def", "Set Defense job", ` + strconv.Itoa(objTypeJob) + `)
,(` + strconv.Itoa(objSubTypeJobMsgDel) + `, "job_msg_del", "Msg Del job", ` + strconv.Itoa(objTypeJob) + `) ,(` + strconv.Itoa(cacheObjSubType[`job_msg_del`]) + `, "job_msg_del", "Msg Del job", ` + strconv.Itoa(objTypeJob) + `)
,(` + strconv.Itoa(objSubTypeJobGetHammerTime) + `, "job_get_hammer_time", "Get Hammer Time job", ` + strconv.Itoa(objTypeJob) + `) ,(` + strconv.Itoa(cacheObjSubType[`job_get_hammer_time`]) + `, "job_get_hammer_time", "Get Hammer Time job", ` + strconv.Itoa(objTypeJob) + `)
,(` + strconv.Itoa(objSubTypeItemResource) + `, "item_res", "Resource", ` + strconv.Itoa(objTypeItem) + `) ,(` + strconv.Itoa(objSubTypeItemResource) + `, "item_res", "Resource", ` + strconv.Itoa(objTypeItem) + `)
,(` + strconv.Itoa(objSubTypeItemAlch) + `, "item_alch", "Alchemy", ` + strconv.Itoa(objTypeItem) + `) ,(` + strconv.Itoa(objSubTypeItemAlch) + `, "item_alch", "Alchemy", ` + strconv.Itoa(objTypeItem) + `)
,(` + strconv.Itoa(objSubTypeItemMisc) + `, "item_misc", "Miscelaneous", ` + strconv.Itoa(objTypeItem) + `) ,(` + strconv.Itoa(objSubTypeItemMisc) + `, "item_misc", "Miscelaneous", ` + strconv.Itoa(objTypeItem) + `)

View File

@ -420,7 +420,7 @@ func SQLIdentifyMsgWorker(id int, objIds <-chan int64) {
Date: m.Date, Date: m.Date,
} }
b, _ := json.Marshal(&p) b, _ := json.Marshal(&p)
_, err = createJob(objSubTypeJobPillage, objJobPriority, m.TGUserID64, m.ObjID64, m.Date.Add(time.Duration(25+rand.Intn(35))*time.Second), b) _, err = createJob(cacheObjSubType[`job_pillage`], objJobPriority, m.TGUserID64, m.ObjID64, m.Date.Add(time.Duration(25+rand.Intn(35))*time.Second), b)
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : createJob(JobPillage)") logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : createJob(JobPillage)")
} }
case cacheObjSubType[`msg_me_ack`]: case cacheObjSubType[`msg_me_ack`]:
@ -464,7 +464,7 @@ func SQLIdentifyMsgWorker(id int, objIds <-chan int64) {
ObjID64: m.ObjID64, ObjID64: m.ObjID64,
} }
b, _ := json.Marshal(&p) b, _ := json.Marshal(&p)
_, err = createJob(objSubTypeJobMsgRefresh, objJobPriority, m.TGUserID64, m.ObjID64, cwm.End.Add(5*time.Minute).UTC(), b) _, err = createJob(cacheObjSubType[`job_msg_refresh`], objJobPriority, m.TGUserID64, m.ObjID64, cwm.End.Add(5*time.Minute).UTC(), b)
/* hack for autobid - FIXME */ /* hack for autobid - FIXME */
/* /*
if cwm.Price == 0 && cwm.ItemID64 == getObjItemID(`k05`, `Hunter blade`) { if cwm.Price == 0 && cwm.ItemID64 == getObjItemID(`k05`, `Hunter blade`) {
@ -549,37 +549,37 @@ func JobWorker(id int, jobs <-chan Job) {
//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 cacheObjSubType[`job_rescan_msg`]:
jobRescan(j) jobRescan(j)
case objSubTypeJobSetJobDone: case cacheObjSubType[`job_set_done`]:
jobSetDone(j) jobSetDone(j)
case objSubTypeJobPillage: case cacheObjSubType[`job_pillage`]:
jobPillage(j) jobPillage(j)
case objSubTypeJobMsgClient: case cacheObjSubType[`job_msg_client`]:
jobMsgClient(j) jobMsgClient(j)
case objSubTypeJobMsgRefresh: case cacheObjSubType[`job_msg_refresh`]:
jobMsgRefresh(j) jobMsgRefresh(j)
case objSubTypeJobBackupExport: case cacheObjSubType[`job_backup_export`]:
jobBackupExport(j) jobBackupExport(j)
case objSubTypeJobBackupImport: case cacheObjSubType[`job_backup_import`]:
jobBackupImport(j) jobBackupImport(j)
case objSubTypeJobGStock: case cacheObjSubType[`job_gstock`]:
jobGStock(j) jobGStock(j)
case objSubTypeJobGDeposit: case cacheObjSubType[`job_gdeposit`]:
jobGDeposit(j) jobGDeposit(j)
case objSubTypeJobGDepositForward: case cacheObjSubType[`job_gdeposit_fwd`]:
jobGDepositForward(j) jobGDepositForward(j)
case objSubTypeJobGWithdraw: case cacheObjSubType[`job_gwithdraw`]:
jobGWithdraw(j) jobGWithdraw(j)
case objSubTypeJobVaultUserStatus: case cacheObjSubType[`job_vault_user_status`]:
jobVaultUserStatus(j) jobVaultUserStatus(j)
case objSubTypeJobVaultItemStatus: case cacheObjSubType[`job_vault_item_status`]:
jobVaultItemStatus(j) jobVaultItemStatus(j)
case objSubTypeJobFwdMsg: case cacheObjSubType[`job_msg_fwd`]:
jobFwdMsg(j) jobFwdMsg(j)
case objSubTypeJobSetDef: case cacheObjSubType[`job_set_def`]:
jobSetDef(j) jobSetDef(j)
case objSubTypeJobGetHammerTime: case cacheObjSubType[`job_get_hammer_time`]:
jobGetHammerTime(j) jobGetHammerTime(j)
default: default:
log.Printf("jobWorker["+strconv.Itoa(id)+"] : No handler for job type #%d.\n", j.JobTypeID) log.Printf("jobWorker["+strconv.Itoa(id)+"] : No handler for job type #%d.\n", j.JobTypeID)