171 lines
3.7 KiB
Go
171 lines
3.7 KiB
Go
package main
|
|
|
|
import (
|
|
tb "gopkg.in/tucnak/telebot.v2"
|
|
"regexp"
|
|
"time"
|
|
)
|
|
|
|
type ChatWarsMessage struct {
|
|
UserID64 int64 `json:"user_id"`
|
|
SenderUserID64 int64 `json:"sender_user_id"`
|
|
Date time.Time `json:"date"`
|
|
ID64 int64 `json:"id"`
|
|
ChatID64 int64 `json:"chat_id"`
|
|
Text string `json:"text"`
|
|
}
|
|
|
|
type ChatWarsMessageAuctionAnnounce struct {
|
|
MsgID64 int64 `json:"msg_id"`
|
|
LotID int32 `json:"lot_id"`
|
|
Item string `json:"item"`
|
|
Cond string `json:"cond"`
|
|
Quality string `json:"quality"`
|
|
Seller string `json:"seller"`
|
|
Buyer string `json:"buyer"`
|
|
Price int32 `json:"price"`
|
|
Status string `json:"status"`
|
|
End time.Time `json:"end"`
|
|
}
|
|
|
|
type MessageParsingRule struct {
|
|
ID int32
|
|
Priority int32
|
|
Description string
|
|
Rule string
|
|
MsgTypeID int32
|
|
re *regexp.Regexp
|
|
}
|
|
|
|
type BotMsg struct {
|
|
To tb.Recipient
|
|
Text string
|
|
}
|
|
|
|
type Job struct {
|
|
ID64 int64
|
|
JobTypeID int32
|
|
Status int32
|
|
Payload []byte
|
|
}
|
|
|
|
type JobPayloadPillage struct {
|
|
UserID64 int64 `json:"user_id"`
|
|
}
|
|
|
|
type JobPayloadTribute struct {
|
|
UserID64 int64 `json:"user_id"`
|
|
}
|
|
|
|
type JobPayloadStatus struct {
|
|
UserID64 int64 `json:"user_id"`
|
|
}
|
|
|
|
type JobPayloadWithdrawal struct {
|
|
UserID64 int64 `json:"user_id"`
|
|
}
|
|
|
|
type JobPayloadGStock struct {
|
|
UserID64 int64 `json:"user_id"`
|
|
}
|
|
|
|
type JobPayloadRescanMsg struct {
|
|
Query string `json:"query"`
|
|
}
|
|
|
|
type JobPayloadSetDone struct {
|
|
JobID64 int64 `json:"job_id"`
|
|
}
|
|
|
|
const (
|
|
objTypeUser = 1
|
|
objTypeGuild = 2
|
|
objTypeMessage = 3
|
|
objTypeWar = 4
|
|
objTypeWarReport = 5
|
|
objTypeJob = 6
|
|
objTypeItem = 7
|
|
|
|
objSubTypeMessageUnknown = 301
|
|
objSubTypeMessageWar = 302
|
|
objSubTypeMessageMiniWar = 303
|
|
objSubTypeMessageGuildWar = 304
|
|
objSubTypeMessageReport = 305
|
|
objSubTypeMessageGReport = 306
|
|
objSubTypeMessageQuest = 307
|
|
objSubTypeMessageFight = 308
|
|
objSubTypeMessageHero = 309
|
|
objSubTypeMessageMe = 310
|
|
objSubTypeMessageInventory = 311
|
|
objSubTypeMessagePillageInc = 312
|
|
objSubTypeMessageTributeInc = 313
|
|
objSubTypeMessagePillageAck = 314
|
|
objSubTypeMessageTributeAck = 315
|
|
objSubTypeMessageAuctionAnnounce = 316
|
|
objSubTypeMessageAuctionUpdReq = 317
|
|
objSubTypeMessageAcutionUpdAck = 318
|
|
objSubTypeMessageTime = 317
|
|
objSubTypeJobPillage = 601
|
|
objSubTypeJobTribute = 602
|
|
objSubTypeJobStatus = 603
|
|
objSubTypeJobWithdrawal = 604
|
|
objSubTypeJobGStock = 605
|
|
objSubTypeJobRescanMsg = 606
|
|
objSubTypeJobSetJobDone = 607
|
|
objSubTypeItemResource = 701
|
|
objSubTypeItemAlch = 702
|
|
objSubTypeItemMisc = 703
|
|
objSubTypeItemRecipe = 704
|
|
objSubTypeItemPart = 705
|
|
objSubTypeItemOther = 706
|
|
|
|
objJobStatusNew = 0
|
|
objJonStatusPending = 10
|
|
objJobStatusDone = 20
|
|
|
|
objJobPriority = 1
|
|
objJobPriorityRescanMsg = 2
|
|
objJobPriorityRescanChildMsg = 3
|
|
objJobPriorityRescanAllMsg = 4
|
|
|
|
MQGetMsgWorkers = 3
|
|
SQLCWMsgWorkers = 6
|
|
SQLIdentifyMsgWorkers = 6
|
|
SQLJobWorkers = 3
|
|
SQLJobSliceSize = 25
|
|
)
|
|
|
|
var (
|
|
chatWarsMonth = map[string]int{
|
|
"Wintar": 1,
|
|
"Hornung": 2,
|
|
"Lenzin": 3,
|
|
"Ōstar": 4,
|
|
"Winni": 5,
|
|
"Brāh": 6,
|
|
"Hewi": 7,
|
|
"Aran": 8,
|
|
"Witu": 9,
|
|
"Wīndume": 10,
|
|
"Herbist": 11,
|
|
"Hailag": 12}
|
|
|
|
chatWarsDaysSpecial = map[int]map[int]int{
|
|
2: {1060: 29},
|
|
4: {1060: 29}}
|
|
|
|
chatWarsDays = map[int]int{
|
|
1: 31,
|
|
2: 28,
|
|
3: 31,
|
|
4: 30,
|
|
5: 31,
|
|
6: 30,
|
|
7: 31,
|
|
8: 31,
|
|
9: 30,
|
|
10: 31,
|
|
11: 30,
|
|
12: 31}
|
|
)
|