2019-05-06 04:54:24 +02:00
|
|
|
|
package main
|
|
|
|
|
|
2019-05-09 11:19:55 +02:00
|
|
|
|
import (
|
|
|
|
|
"regexp"
|
2019-07-31 06:48:37 +02:00
|
|
|
|
"sync"
|
2019-05-09 12:36:45 +02:00
|
|
|
|
"time"
|
2019-05-17 10:09:09 +02:00
|
|
|
|
|
|
|
|
|
"github.com/streadway/amqp"
|
|
|
|
|
tb "gopkg.in/tucnak/telebot.v2"
|
2019-05-09 11:19:55 +02:00
|
|
|
|
)
|
|
|
|
|
|
2019-08-29 12:49:01 +02:00
|
|
|
|
const maxUnixTimestamp int64 = 2147483647
|
2019-10-20 14:09:25 +02:00
|
|
|
|
const chtwrsbotID64 int64 = 408101137
|
2019-10-25 06:39:25 +02:00
|
|
|
|
const angrybirbsbotID64 int64 = 833409972
|
2019-08-23 14:09:08 +02:00
|
|
|
|
|
2019-06-08 17:28:07 +02:00
|
|
|
|
type DataBackup struct {
|
2019-06-08 17:59:34 +02:00
|
|
|
|
Messages []ChatWarsMessage `json:"messages"`
|
2019-06-08 17:28:07 +02:00
|
|
|
|
}
|
|
|
|
|
|
2019-06-28 09:57:06 +02:00
|
|
|
|
type MQClient struct {
|
2019-06-28 09:58:00 +02:00
|
|
|
|
User string
|
|
|
|
|
Password string
|
|
|
|
|
Host string
|
|
|
|
|
Path string
|
|
|
|
|
SSL bool
|
2019-06-28 09:57:06 +02:00
|
|
|
|
Connection *amqp.Connection
|
|
|
|
|
Channel *amqp.Channel
|
|
|
|
|
Queue amqp.Queue
|
2019-05-17 10:09:09 +02:00
|
|
|
|
}
|
|
|
|
|
|
2019-07-31 03:24:01 +02:00
|
|
|
|
type ChirpClient struct {
|
|
|
|
|
HeartBeat time.Time `json:"heart_beat"`
|
2019-07-31 09:22:02 +02:00
|
|
|
|
Login string `json:"nickname"`
|
2019-07-31 03:24:01 +02:00
|
|
|
|
Active bool
|
|
|
|
|
TGUserID64 int64 `json:"tg_user_id"`
|
|
|
|
|
MQ MQClient `json:"mq_client"`
|
|
|
|
|
CWUserID64 int64 `json:"user_id"`
|
|
|
|
|
CWGuildID64 int64 `json:"guild_id"`
|
|
|
|
|
CWRole string `json:"role"`
|
|
|
|
|
CWState string `json:"state"`
|
|
|
|
|
CWBusyUntil time.Time `json:"busy_until"`
|
|
|
|
|
CWLastUpdate time.Time `json:"last_update"`
|
2019-12-15 08:37:58 +01:00
|
|
|
|
CWIdle bool `json:"idle"`
|
2019-07-31 03:24:01 +02:00
|
|
|
|
Mux sync.Mutex
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type MQKeepAlive struct {
|
|
|
|
|
TGUserID64 int64 `json:"tg_user_id"`
|
|
|
|
|
Nickname string `json:"nick"`
|
|
|
|
|
Queue string `json:"queue"`
|
|
|
|
|
Date time.Time `json:"date"`
|
2019-05-27 12:03:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
2019-05-16 04:16:35 +02:00
|
|
|
|
type TGCommand struct {
|
2019-08-24 08:01:26 +02:00
|
|
|
|
Type int64 `json:"type"`
|
|
|
|
|
FromChatID64 int64 `json:"from_chat_id"`
|
|
|
|
|
FromUserID64 int64 `json:"from_user_id"`
|
|
|
|
|
FromMsgID64 int64 `json:"from_msg_id"`
|
|
|
|
|
ToChatID64 int64 `json:"to_chat_id"`
|
|
|
|
|
ToUserID64 int64 `json:"to_user_id"`
|
|
|
|
|
Text string `json:"text"`
|
|
|
|
|
Document tb.Document `json:"document"`
|
|
|
|
|
ParseMode int64 `json:"parse_mode"`
|
|
|
|
|
Delay time.Duration `json:"delay"`
|
2019-05-15 10:58:25 +02:00
|
|
|
|
}
|
|
|
|
|
|
2019-05-25 09:25:11 +02:00
|
|
|
|
type ChatWarsCastle struct {
|
|
|
|
|
ObjID64 int64 `json:"obj_id"`
|
|
|
|
|
Logo string `json:"logo"`
|
|
|
|
|
Name string `json:"name"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ChatWarsGuild struct {
|
|
|
|
|
ObjID64 int64 `json:"obj_id"`
|
|
|
|
|
Tag string `json:"tag"`
|
|
|
|
|
Name string `json:"name"`
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-25 10:56:13 +02:00
|
|
|
|
type ChatWarsUser struct {
|
|
|
|
|
ObjID64 int64 `json:"obj_id"`
|
|
|
|
|
Name string `json:"name"`
|
|
|
|
|
}
|
|
|
|
|
|
2019-06-02 08:48:16 +02:00
|
|
|
|
type ChatWarsItem struct {
|
2019-12-29 09:41:24 +01:00
|
|
|
|
ObjID64 int64 `json:"obj_id"`
|
|
|
|
|
ItemTypeID int64 `json:"item_type_id"`
|
|
|
|
|
Code string `json:"code"`
|
|
|
|
|
Name string `json:"name"`
|
|
|
|
|
Weight int64 `json:"weight"`
|
2019-12-29 09:42:31 +01:00
|
|
|
|
Exchange bool `json:"exchange"`
|
2019-12-29 09:41:24 +01:00
|
|
|
|
Auction bool `json:"auction"`
|
|
|
|
|
Craft ChatWarsItemCraft `json:"craft"`
|
2019-12-29 08:50:56 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ChatWarsItemCraft struct {
|
|
|
|
|
Command string `json:"cmd"`
|
|
|
|
|
Mana int64 `json:"mana"`
|
|
|
|
|
Items []ChatWarsItems `json:"items"`
|
2019-06-02 08:48:16 +02:00
|
|
|
|
}
|
|
|
|
|
|
2019-06-02 11:30:04 +02:00
|
|
|
|
type ChatWarsItems struct {
|
2019-12-29 08:50:56 +01:00
|
|
|
|
Item string `json:"item"`
|
|
|
|
|
ItemID64 int64
|
2019-06-02 11:30:04 +02:00
|
|
|
|
Quantity int64 `json:"quantity"`
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-12 04:49:03 +01:00
|
|
|
|
type ChatWarsCallback struct {
|
|
|
|
|
Name string `json:"name"`
|
|
|
|
|
Data []byte `json:"data"`
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-06 04:54:24 +02:00
|
|
|
|
type ChatWarsMessage struct {
|
2019-12-12 10:49:18 +01:00
|
|
|
|
ObjID64 int64 `json:"obj_id"`
|
2019-12-12 04:49:03 +01:00
|
|
|
|
TGUserID64 int64 `json:"tg_user_id"`
|
|
|
|
|
TGSenderUserID64 int64 `json:"tg_sender_user_id"`
|
|
|
|
|
Date time.Time `json:"date"`
|
|
|
|
|
ID64 int64 `json:"id"`
|
|
|
|
|
ChatID64 int64 `json:"chat_id"`
|
|
|
|
|
Text string `json:"text"`
|
|
|
|
|
IsForwarded bool `json:"is_forwarded"`
|
|
|
|
|
Callbacks []ChatWarsCallback `json:"callbacks"`
|
2019-05-06 04:54:24 +02:00
|
|
|
|
}
|
2019-05-06 05:59:19 +02:00
|
|
|
|
|
2019-09-14 10:27:38 +02:00
|
|
|
|
type ChatWarsExchangeDeal struct {
|
|
|
|
|
ItemID64 int64 `json:"item_id"`
|
|
|
|
|
Quantity int64 `json:"quantity"`
|
|
|
|
|
Price int64 `json:"price"`
|
2019-09-14 10:43:18 +02:00
|
|
|
|
Status string `json:"status"`
|
2019-09-14 10:27:38 +02:00
|
|
|
|
Link string `json:"link"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ChatWarsMessageExchangeAck struct {
|
|
|
|
|
Msg *ChatWarsMessage `json:"msg"`
|
|
|
|
|
ActiveDeals int64 `json:"active_deals"`
|
|
|
|
|
MaxDeals int64 `json:"max_deals"`
|
|
|
|
|
DealList []ChatWarsExchangeDeal `json:"deals"`
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-22 11:31:16 +02:00
|
|
|
|
type ChatWarsMessageGStock struct {
|
2019-06-02 11:30:04 +02:00
|
|
|
|
Msg *ChatWarsMessage `json:"msg"`
|
|
|
|
|
OwnerID64 int64 `json:"owner_id"`
|
2019-12-13 12:19:52 +01:00
|
|
|
|
Stock []ChatWarsItems `json:"stock"`
|
2019-06-02 11:30:04 +02:00
|
|
|
|
}
|
|
|
|
|
|
2019-10-10 12:14:29 +02:00
|
|
|
|
type ChatWarsMessageWithdrawRcv struct {
|
|
|
|
|
Msg *ChatWarsMessage `json:"msg"`
|
|
|
|
|
ItemList []ChatWarsItems `json:"item_list"`
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-30 04:16:48 +02:00
|
|
|
|
type ChatWarsMessageGDepositReq struct {
|
|
|
|
|
Msg *ChatWarsMessage `json:"msg"`
|
|
|
|
|
ItemID64 int64 `json:"item_id"`
|
|
|
|
|
Quantity int64 `json:"quantity"`
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-27 17:10:57 +02:00
|
|
|
|
type ChatWarsMessageGDepositAck struct {
|
|
|
|
|
Msg *ChatWarsMessage `json:"msg"`
|
|
|
|
|
ItemID64 int64 `json:"item_id"`
|
|
|
|
|
Quantity int64 `json:"quantity"`
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-19 06:19:24 +02:00
|
|
|
|
type ChatWarsMessageReportAck struct {
|
2019-05-18 09:44:25 +02:00
|
|
|
|
ObjID64 int64 `json:"obj_id"`
|
2019-05-28 06:14:46 +02:00
|
|
|
|
}
|
|
|
|
|
|
2019-08-22 11:31:16 +02:00
|
|
|
|
type ChatWarsMessageStockAck struct {
|
|
|
|
|
Msg *ChatWarsMessage `json:"msg"`
|
|
|
|
|
Used int64 `json:"used"`
|
|
|
|
|
Available int64 `json:"available"`
|
|
|
|
|
Stock []ChatWarsItems `json:"stock"`
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-30 09:11:49 +02:00
|
|
|
|
type ChatWarsMessageStockAnyAck struct {
|
|
|
|
|
Msg *ChatWarsMessage `json:"msg"`
|
|
|
|
|
Stock []ChatWarsItems `json:"stock"`
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-21 08:37:53 +02:00
|
|
|
|
type ChatWarsMessageOrderbookAck struct {
|
|
|
|
|
Msg *ChatWarsMessage `json:"msg"`
|
|
|
|
|
Name string `json:"name"`
|
|
|
|
|
Code string `json:"code"`
|
|
|
|
|
Qty1 int64 `json:"qty1"`
|
|
|
|
|
Price1 int64 `json:"price1"`
|
|
|
|
|
Qty2 int64 `json:"qty2"`
|
|
|
|
|
Price2 int64 `json:"price2"`
|
|
|
|
|
Qty3 int64 `json:"qty3"`
|
|
|
|
|
Price3 int64 `json:"price3"`
|
|
|
|
|
Qty int64 `json:"qty"`
|
|
|
|
|
Gold int64 `json:"gold"`
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-28 06:14:46 +02:00
|
|
|
|
type ChatWarsMessageMeAck struct {
|
2019-07-31 10:57:45 +02:00
|
|
|
|
Msg *ChatWarsMessage `json:"msg"`
|
|
|
|
|
CWUserID64 int64 `json:"user_id"`
|
|
|
|
|
CWGuildID64 int64 `json:"guild_id"`
|
|
|
|
|
State string `json:"state"`
|
|
|
|
|
Level int64 `json:"level"`
|
|
|
|
|
ExpNow int64 `json:"exp_now"`
|
|
|
|
|
ExpLvl int64 `json:"exp_lvl"`
|
2019-05-18 09:44:25 +02:00
|
|
|
|
}
|
|
|
|
|
|
2019-05-30 10:38:25 +02:00
|
|
|
|
type ChatWarsMessageGRolesAck struct {
|
2019-05-30 10:36:40 +02:00
|
|
|
|
Msg *ChatWarsMessage `json:"msg"`
|
|
|
|
|
BartenderID64 int64 `json:"bartender"`
|
|
|
|
|
CommanderID64 int64 `json:"commander"`
|
|
|
|
|
SquireID64 int64 `json:"squire"`
|
|
|
|
|
TreasurerID64 int64 `json:"treasurer"`
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-28 09:00:37 +02:00
|
|
|
|
type ChatWarsMessageGoQuestAck struct {
|
2019-07-09 06:56:41 +02:00
|
|
|
|
Msg *ChatWarsMessage `json:"msg"`
|
|
|
|
|
QuestTypeID int `json:"quest"`
|
|
|
|
|
Duration time.Duration `json:"duration"`
|
2019-05-28 09:00:37 +02:00
|
|
|
|
}
|
|
|
|
|
|
2019-10-03 12:15:32 +02:00
|
|
|
|
type ChatWarsMessageQuestResult struct {
|
2019-10-03 05:35:24 +02:00
|
|
|
|
Msg *ChatWarsMessage `json:"msg"`
|
|
|
|
|
Gold int64 `json:"gold"`
|
|
|
|
|
Exp int64 `json:"exp"`
|
|
|
|
|
Loot []ChatWarsItems `json:"loot"`
|
|
|
|
|
RegenStamina bool `json:"regen_stamina"`
|
|
|
|
|
LostTorch bool `json:"lost_torch"`
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-20 14:09:25 +02:00
|
|
|
|
type ChatWarsMessageQuestResultAmbush struct {
|
|
|
|
|
Msg *ChatWarsMessage `json:"msg"`
|
|
|
|
|
Loot []ChatWarsItems `json:"loot"`
|
2019-10-20 14:28:16 +02:00
|
|
|
|
Level int64 `json:"level"`
|
2019-10-20 14:09:25 +02:00
|
|
|
|
Armored bool `json:"armored"`
|
|
|
|
|
Enraged bool `json:"enraged"`
|
|
|
|
|
SpearResists bool `json:"spear resists"`
|
|
|
|
|
Toughness bool `json:"toughness"`
|
|
|
|
|
PoisonBottles bool `json:"poison_bottles"`
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-18 16:15:24 +02:00
|
|
|
|
type ChatWarsMessageDuelFight struct {
|
2019-05-19 14:01:32 +02:00
|
|
|
|
ObjID64 int64 `json:"obj_id"`
|
|
|
|
|
WinCastle string `json:"win_castle"`
|
|
|
|
|
WinGuild string `json:"win_guild"`
|
|
|
|
|
WinUser string `json:"win_user"`
|
|
|
|
|
WinLife int64 `json:"win_life"`
|
|
|
|
|
LossCastle string `json:"loss_castle"`
|
|
|
|
|
LossGuild string `json:"loss_guild"`
|
|
|
|
|
LossUser string `json:"loss_user"`
|
|
|
|
|
LossLife int64 `json:"loss_life"`
|
|
|
|
|
Exp int64 `json:"exp"`
|
|
|
|
|
Weapon string `json:"weapon"`
|
2019-05-18 16:15:24 +02:00
|
|
|
|
}
|
|
|
|
|
|
2019-05-09 11:19:02 +02:00
|
|
|
|
type ChatWarsMessageAuctionAnnounce struct {
|
2019-06-06 07:52:22 +02:00
|
|
|
|
ObjID64 int64 `json:"obj_id"`
|
|
|
|
|
LotID int32 `json:"lot_id"`
|
|
|
|
|
ItemID64 int64 `json:"item_id"`
|
|
|
|
|
Cond string `json:"cond"`
|
|
|
|
|
Quality string `json:"quality"`
|
2019-06-06 07:54:58 +02:00
|
|
|
|
SellerUserID64 int64 `json:"seller_id"`
|
2019-06-06 07:52:22 +02:00
|
|
|
|
SellerGuildID64 int64 `json:"seller_guild_id"`
|
|
|
|
|
SellerCastleID64 int64 `json:"seller_castle_id"`
|
2019-06-06 07:54:58 +02:00
|
|
|
|
BuyerUserID64 int64 `json:"buyer_id"`
|
2019-06-06 07:52:22 +02:00
|
|
|
|
BuyerGuildID64 int64 `json:"buyer_guild_id"`
|
|
|
|
|
BuyerCastleID64 int64 `json:"buyer_castle_id"`
|
|
|
|
|
Price int32 `json:"price"`
|
|
|
|
|
Status string `json:"status"`
|
|
|
|
|
End time.Time `json:"end"`
|
2019-05-09 11:19:02 +02:00
|
|
|
|
}
|
|
|
|
|
|
2019-05-15 12:02:17 +02:00
|
|
|
|
type ChatWarsMessagePillageInc struct {
|
|
|
|
|
ObjID64 int64 `json:"obj_id"`
|
|
|
|
|
Attacker string `json:"attacker"`
|
|
|
|
|
Guild string `json:"guild"`
|
|
|
|
|
Castle string `json:"castle"`
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-25 13:12:31 +02:00
|
|
|
|
type ChatWarsMessageUnionWar struct {
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-19 04:31:28 +01:00
|
|
|
|
type ChatWarsMessageTimeAck struct {
|
|
|
|
|
RealTime time.Time `json:"real_time"`
|
|
|
|
|
TimeOfDay string `json:"time_of_day"`
|
|
|
|
|
Hour int64 `json:"hour"`
|
|
|
|
|
Minute int64 `json:"minute"`
|
|
|
|
|
Day int64 `json:"day"`
|
|
|
|
|
Month int64 `json:"month"`
|
|
|
|
|
Year int64 `json:"year"`
|
|
|
|
|
Weather string `json:"weather"`
|
|
|
|
|
WeatherNext string `json:"weather_next"`
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-07 13:15:25 +02:00
|
|
|
|
type MessageParsingRule struct {
|
2019-05-30 06:12:01 +02:00
|
|
|
|
ID int32
|
2019-12-29 08:50:56 +01:00
|
|
|
|
Priority int32 `json:"prio"`
|
|
|
|
|
Description string `json:"descn"`
|
|
|
|
|
Rule string `json:"rule"`
|
|
|
|
|
MsgType string `json:"msg_type"`
|
|
|
|
|
MsgTypeID64 int64
|
2019-05-30 06:12:01 +02:00
|
|
|
|
ChatID64 int64
|
|
|
|
|
SenderUserID64 int64
|
|
|
|
|
re *regexp.Regexp
|
2019-05-07 13:15:25 +02:00
|
|
|
|
}
|
|
|
|
|
|
2019-05-11 05:15:42 +02:00
|
|
|
|
type BotMsg struct {
|
|
|
|
|
To tb.Recipient
|
|
|
|
|
Text string
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-10 11:23:47 +02:00
|
|
|
|
type Job struct {
|
|
|
|
|
ID64 int64
|
|
|
|
|
JobTypeID int32
|
2019-08-21 05:54:01 +02:00
|
|
|
|
Trigger int64
|
2019-08-23 14:09:08 +02:00
|
|
|
|
Timeout time.Time
|
2019-05-15 12:31:03 +02:00
|
|
|
|
UserID64 int64
|
2019-05-10 11:23:47 +02:00
|
|
|
|
Payload []byte
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-19 04:31:28 +01:00
|
|
|
|
type JobPayloadGetHammerTime struct {
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-13 09:34:32 +01:00
|
|
|
|
type JobPayloadSetDef struct {
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-12 11:24:12 +01:00
|
|
|
|
type JobPayloadFwdMsg struct {
|
|
|
|
|
ChatID64 int64 `json:"chat_id"`
|
|
|
|
|
}
|
|
|
|
|
|
2019-06-08 17:28:07 +02:00
|
|
|
|
type JobPayloadMsgRefresh struct {
|
|
|
|
|
ObjID64 int64 `json:"obj_id"`
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-10 11:23:47 +02:00
|
|
|
|
type JobPayloadPillage struct {
|
2019-07-31 04:06:05 +02:00
|
|
|
|
ObjID64 int64 `json:"obj_id"`
|
|
|
|
|
Date time.Time `json:"date"`
|
2019-05-10 11:23:47 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type JobPayloadTribute struct {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type JobPayloadStatus struct {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type JobPayloadGStock struct {
|
2019-12-13 12:19:52 +01:00
|
|
|
|
MsgID64 int64 `json:"msg_id"`
|
|
|
|
|
ChatID64 int64 `json:"chat_id"`
|
|
|
|
|
Progress int64 `json:"progress"`
|
|
|
|
|
Stock []ChatWarsItems `json:"stock"`
|
2019-05-10 11:23:47 +02:00
|
|
|
|
}
|
|
|
|
|
|
2019-10-02 06:43:27 +02:00
|
|
|
|
type JobPayloadGWithdraw struct {
|
2019-10-02 07:24:35 +02:00
|
|
|
|
MsgID64 int64 `json:"msg_id"`
|
|
|
|
|
ChatID64 int64 `json:"chat_id"`
|
|
|
|
|
Request string `json:"request"`
|
|
|
|
|
Status int `json:"status"`
|
2019-10-02 06:43:27 +02:00
|
|
|
|
}
|
|
|
|
|
|
2019-08-16 12:29:07 +02:00
|
|
|
|
type JobPayloadGDeposit struct {
|
2019-08-17 08:18:25 +02:00
|
|
|
|
MsgID64 int64 `json:"msg_id"`
|
|
|
|
|
ChatID64 int64 `json:"chat_id"`
|
|
|
|
|
ResObjID64 []int64 `json:"res_obj_id"`
|
2019-08-21 05:46:42 +02:00
|
|
|
|
Status int `json:"status"`
|
2019-08-17 08:18:25 +02:00
|
|
|
|
}
|
|
|
|
|
|
2019-08-30 04:16:12 +02:00
|
|
|
|
type JobPayloadGDepositForward struct {
|
|
|
|
|
ItemID64 int64 `json:"item_id"`
|
|
|
|
|
Quantity int64 `json:"quantity"`
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-17 08:18:25 +02:00
|
|
|
|
type JobPayloadSaveRes struct {
|
|
|
|
|
MsgID64 int64 `json:"msg_id"`
|
|
|
|
|
ChatID64 int64 `json:"chat_id"`
|
|
|
|
|
ResObjID64 int64 `json:"res_obj_id"`
|
|
|
|
|
BuyRes bool `json:"buy_res"`
|
2019-08-16 12:29:07 +02:00
|
|
|
|
}
|
|
|
|
|
|
2019-05-10 11:23:47 +02:00
|
|
|
|
type JobPayloadRescanMsg struct {
|
2019-05-15 12:31:03 +02:00
|
|
|
|
Query string `json:"query"`
|
|
|
|
|
MsgID64 int64 `json:"msg_id"`
|
|
|
|
|
ChatID64 int64 `json:"chat_id"`
|
2019-05-10 13:33:29 +02:00
|
|
|
|
}
|
|
|
|
|
|
2019-05-11 06:54:12 +02:00
|
|
|
|
type JobPayloadSetDone struct {
|
2019-05-16 04:49:34 +02:00
|
|
|
|
JobID64 int64 `json:"job_id"`
|
|
|
|
|
MsgID64 int64 `json:"msg_id"`
|
|
|
|
|
ChatID64 int64 `json:"chat_id"`
|
|
|
|
|
Text string `json:"test"`
|
2019-05-11 06:54:12 +02:00
|
|
|
|
}
|
|
|
|
|
|
2019-05-30 06:12:01 +02:00
|
|
|
|
type JobPayloadMsgClient struct {
|
2019-06-03 03:01:18 +02:00
|
|
|
|
Text string `json:"msg"`
|
|
|
|
|
MsgID64 int64 `json:"msg_id"`
|
2019-06-11 04:00:37 +02:00
|
|
|
|
ChatID64 int64 `json:"chat_id"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type JobPayloadBackupExport struct {
|
|
|
|
|
MsgID64 int64 `json:"msg_id"`
|
|
|
|
|
ChatID64 int64 `json:"chat_id"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type JobPayloadBackupImport struct {
|
|
|
|
|
URL string `json:"url"`
|
|
|
|
|
MsgID64 int64 `json:"msg_id"`
|
2019-06-03 03:01:18 +02:00
|
|
|
|
ChatID64 int64 `json:"chat_id"`
|
2019-05-30 06:12:01 +02:00
|
|
|
|
}
|
|
|
|
|
|
2019-10-12 07:47:40 +02:00
|
|
|
|
type JobPayloadVaultUserStatus struct {
|
2019-10-11 07:18:53 +02:00
|
|
|
|
UserListID64 []int64 `json:"user_list"`
|
|
|
|
|
ItemTypeListID64 []int64 `json:"item_type_list"`
|
|
|
|
|
DepositChatID64 int64 `json:"deposit_chat_id"`
|
2019-10-11 10:28:25 +02:00
|
|
|
|
UserID64 int64 `json:"user_id"`
|
2019-10-11 07:18:53 +02:00
|
|
|
|
}
|
|
|
|
|
|
2019-10-12 07:47:40 +02:00
|
|
|
|
type JobPayloadVaultItemStatus struct {
|
|
|
|
|
ItemListID64 []int64 `json:"item_type_list"`
|
|
|
|
|
DepositChatID64 int64 `json:"deposit_chat_id"`
|
|
|
|
|
UserID64 int64 `json:"user_id"`
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-06 05:59:19 +02:00
|
|
|
|
const (
|
2019-05-17 10:30:01 +02:00
|
|
|
|
userID64ChtWrsBot = 408101137
|
|
|
|
|
|
2019-06-09 09:34:08 +02:00
|
|
|
|
commandForwardMsg = 1
|
|
|
|
|
commandReplyMsg = 2
|
|
|
|
|
commandSendMsg = 3
|
|
|
|
|
commandDeleteMsg = 4
|
|
|
|
|
commandRefreshMsg = 5
|
|
|
|
|
commandSendDocument = 6
|
2019-05-15 10:58:25 +02:00
|
|
|
|
|
2019-06-10 11:05:59 +02:00
|
|
|
|
cmdParseModePlain = 1
|
|
|
|
|
cmdParseModeMarkDown = 2
|
|
|
|
|
cmdParseModeHTML = 3
|
|
|
|
|
|
2019-05-31 04:02:21 +02:00
|
|
|
|
objTypeUser = 1
|
|
|
|
|
objTypeGuild = 2
|
|
|
|
|
objTypeMessage = 3
|
|
|
|
|
objTypeWar = 4
|
|
|
|
|
objTypeWarReport = 5
|
|
|
|
|
objTypeJob = 6
|
|
|
|
|
objTypeItem = 7
|
|
|
|
|
objTypeCastle = 8
|
|
|
|
|
objTypeFair = 9
|
|
|
|
|
objTypeUnion = 10
|
|
|
|
|
objTypeTribute = 11
|
|
|
|
|
objTypeExperience = 12
|
2019-07-09 06:56:41 +02:00
|
|
|
|
objTypeQuest = 13
|
2019-05-06 05:59:19 +02:00
|
|
|
|
|
2019-05-14 04:28:26 +02:00
|
|
|
|
castleDeer = 1
|
|
|
|
|
castleDragon = 2
|
|
|
|
|
castleHighnest = 3
|
|
|
|
|
castleMoon = 4
|
|
|
|
|
castlePotato = 5
|
|
|
|
|
castleShark = 6
|
|
|
|
|
castleWolf = 7
|
|
|
|
|
|
2019-10-20 11:03:54 +02:00
|
|
|
|
objSubTypeUser = 101
|
|
|
|
|
objSubTypeGuild = 201
|
|
|
|
|
objSubTypeMessageUnknown = 301
|
|
|
|
|
objSubTypeMessageWar = 302 // from Chat Wars Reports (not done)
|
|
|
|
|
objSubTypeMessageMiniWar = 303 // FIXME DELETE
|
|
|
|
|
objSubTypeMessageGuildWar = 304 // from Chat Wars Reports (not done)
|
|
|
|
|
objSubTypeMessageReportReq = 305 // /report (done)
|
|
|
|
|
objSubTypeMessageReportAck = 306 // result from /report (done)
|
|
|
|
|
objSubTypeMessageGReportReq = 307 // /g_report (done)
|
|
|
|
|
objSubTypeMessageGReportAck = 308 // result from /g_report (not done)
|
|
|
|
|
objSubTypeMessageQuestResult = 309 // result from going to quest (not done)
|
|
|
|
|
objSubTypeMessageDuelFight = 310 // result from going to duel fight (done)
|
|
|
|
|
objSubTypeMessageHeroReq = 311 // /hero (done)
|
|
|
|
|
objSubTypeMessageHeroAck = 312 // result from /hero (not done)
|
|
|
|
|
objSubTypeMessageMeReq = 313 // 🏅Me (done)
|
|
|
|
|
objSubTypeMessageMeAck = 314 // result from 🏅Me (done)
|
|
|
|
|
objSubTypeMessageInventoryReq = 315 // /inv (done)
|
|
|
|
|
objSubTypeMessageInventoryAck = 316 // result from /inv (not done)
|
|
|
|
|
objSubTypeMessagePillageInc = 317 // random incoming pillage (done)
|
|
|
|
|
objSubTypeMessagePillageGo = 318 // ack from /go (done)
|
|
|
|
|
objSubTypeMessagePillageTimeout = 319 // ack from lack of /go (done)
|
|
|
|
|
objSubTypeMessagePillageWin = 320 // pillage successfully intercepted (done)
|
|
|
|
|
objSubTypeMessagePillageLoss = 321 // pillage not intercepted (done)
|
|
|
|
|
objSubTypeMessageTributeInc = 322 // request for a /pledge (not done)
|
|
|
|
|
objSubTypeMessageTributeAck = 323 // pledge accepted (not done)
|
|
|
|
|
objSubTypeMessageAuctionAnnounce = 324 // from Boris and Co, Ltd (done)
|
|
|
|
|
objSubTypeMessageAuctionUpdReq = 325 // /l_123456 msg (not done)
|
|
|
|
|
objSubTypeMessageAuctionUpdAck = 326 // result from /l_123456 (not done)
|
|
|
|
|
objSubTypeMessageTimeAck = 327 // result from /time (done)
|
|
|
|
|
objSubTypeMessageTimeReq = 328 // /time (done)
|
|
|
|
|
objSubTypeMessageGo = 329 // /go (done)
|
|
|
|
|
objSubTypeMessagePledge = 330 // /pledge (done)
|
|
|
|
|
objSubTypeMessageGoQuestReq = 331 // 🌲Forest or 🍄Swamp or ⛰️Valley (not done)
|
|
|
|
|
objSubTypeMessageGoFastFight = 332 // ▶️Fast fight (not done)
|
|
|
|
|
objSubTypeMessageGoArena = 333 // 📯Arena (not done)
|
|
|
|
|
objSubTypeMessageTop = 334 // any /topXX (not done)
|
|
|
|
|
objSubTypeMessageMenu = 335 // main menu (not done)
|
|
|
|
|
objSubTypeMessageBuyReq = 336 // /wtb_xx (done)
|
|
|
|
|
objSubTypeMessageSellReq = 337 // /wts_xx (done)
|
|
|
|
|
objSubTypeMessageOrderbookReq = 338 // /t_xx (done)
|
|
|
|
|
objSubTypeMessageOrderbookAck = 339 // orderbook summary (not done)
|
|
|
|
|
objSubTypeMessageWithdrawReq = 340 // /g_withdraw (done)
|
|
|
|
|
objSubTypeMessageWithdrawCode = 341 // code to receive (done)
|
|
|
|
|
objSubTypeMessageWithdrawRcv = 342 // Withdraw "received" msg (done)
|
|
|
|
|
objSubTypeMessageStockReq = 343 // /stock (done)
|
|
|
|
|
objSubTypeMessageStockAck = 344 // result from /stock (not done)
|
|
|
|
|
objSubTypeMessageMiscReq = 345 // /misc (done)
|
|
|
|
|
objSubTypeMessageMiscAck = 346 // result from /misc (not done)
|
|
|
|
|
objSubTypeMessageUnionWar = 347 // from Chat Wars Reports (not done)
|
|
|
|
|
objSubTypeMessageTUReportReq = 348 // /tu_report (not done)
|
|
|
|
|
objSubTypeMessageTUReportAck = 349 // result from /tu_report (not done)
|
|
|
|
|
objSubTypeMessageTimeout = 350 // generic timeout for action
|
|
|
|
|
objSubTypeMessageGoQuestAck = 351 // confirm quest destination/busyness (done)
|
|
|
|
|
objSubTypeMessageGRolesReq = 352 // /g_roles (done)
|
|
|
|
|
objSubTypeMessageGRolesAck = 353 // result from /g_roles (done)
|
|
|
|
|
objSubTypeMessageGStockResReq = 354 // /g_stock_res (done)
|
|
|
|
|
objSubTypeMessageGStockAlchReq = 355 // /g_stock_alch (done)
|
|
|
|
|
objSubTypeMessageGStockMiscReq = 356 // /g_stock_misc (done)
|
|
|
|
|
objSubTypeMessageGStockRecReq = 357 // /g_stock_rec (done)
|
|
|
|
|
objSubTypeMessageGStockPartReq = 358 // /g_stock_parts (done)
|
|
|
|
|
objSubTypeMessageGStockOthReq = 359 // /g_stock_other (done)
|
|
|
|
|
objSubTypeMessageGStockAnyAck = 360 // result from any /g_stock_xxx (done)
|
|
|
|
|
objSubTypeMessageGStockReq = 361 // /g_stock (done)
|
|
|
|
|
objSubTypeMessageGStockAck = 362 // result from /g_stock (done)
|
|
|
|
|
objSubTypeMessageBusy = 363 // too busy now
|
|
|
|
|
objSubTypeMessageResStockReq = 364 // 📦Resources or /stock (done)
|
|
|
|
|
objSubTypeMessageAlchStockReq = 365 // ⚗️Alchemy (done)
|
|
|
|
|
objSubTypeMessageMiscStockReq = 366 // 🗃Misc or /misc (done)
|
|
|
|
|
objSubTypeMessageEquipStockReq = 367 // 🏷Equipment (done)
|
|
|
|
|
objSubTypeMessageCraftStockReq = 368 // ⚒Crafting (done)
|
|
|
|
|
objSubTypeMessageStockEmpty = 369 // [empty] (done)
|
|
|
|
|
objSubTypeMessageStockAnyAck = 370 // list of stock (done)
|
|
|
|
|
objSubTypeMessageGDepositReq = 371 // /g_deposit xx y (done)
|
|
|
|
|
objSubTypeMessageGDepositAck = 372 // Deposited successfully: xx (y) (done)
|
|
|
|
|
objSubTypeMessageAttackReq = 373 // Attack (done)
|
|
|
|
|
objSubTypeMessageAttackAck = 374 // Read for attack, select target (done)
|
|
|
|
|
objSubTypeMessageAttackTargetReq = 375 // Castle selection (done)
|
|
|
|
|
objSubTypeMessageAttackTargetAck = 376 // Castle confirmation (done)
|
|
|
|
|
objSubTypeMessageDefendReq = 377 // Defend (done)
|
|
|
|
|
objSubTypeMessageDefendAck = 378 // Defend confirmation (done)
|
|
|
|
|
objSubTypeMessageBack = 379 // Back (done)
|
|
|
|
|
objSubTypeMessageCastleReq = 380 // Castle (done)
|
|
|
|
|
objSubTypeMessageCastleAck = 381 // Castle msg (not done)
|
|
|
|
|
objSubTypeMessageExchangeReq = 382 // ⚖Exchange (done)
|
|
|
|
|
objSubTypeMessageExchangeAck = 383 // List of deals (done)
|
|
|
|
|
objSubTypeMessageEquipGearReq = 384 // /on_item (done)
|
|
|
|
|
objSubTypeMessageEquipGearAck = 385 // Item equipped (done)
|
|
|
|
|
objSubTypeMessageUnequipGearReq = 386 // /off_item (done)
|
|
|
|
|
objSubTypeMessageUnequipGearAck = 387 // Item unequipped (done)
|
|
|
|
|
objSubTypeMessageNoStamina = 388 // Not enough stamina. (done)
|
|
|
|
|
objSubTypeMessageOrderbookSearch = 389 // /t <something>
|
|
|
|
|
objSubTypeMessageQuestReq = 390 // quest
|
|
|
|
|
objSubTypeMessageQuestAck = 391 // forest/swamp/valley/arena
|
|
|
|
|
objSubTypeMessageBattle = 392 // wind is howling
|
|
|
|
|
objSubTypeMessageOrderCancelReq = 393 // /rm_xxx
|
|
|
|
|
objSubTypeMessageOrderCancelAck = 394 // Cancelling order
|
|
|
|
|
objSubTypeMessageStaminaRestored = 395 // Stamina Restored
|
|
|
|
|
objSubTypeMessageTopReq = 396
|
|
|
|
|
objSubTypeMessageQuestResultAmbush = 397 // result from going to quest with ambush (not done)
|
2019-12-16 03:56:53 +01:00
|
|
|
|
objSubTypeMessageHealUpFirst = 398 // you should heal up first (done)
|
|
|
|
|
objSubTypeMessageArenaFightAck = 399 // thirsty for blood ... (done)
|
2019-12-16 04:05:43 +01:00
|
|
|
|
objSubTypeMessageGoArenaAck = 400 // Welcome to Arena! (done)
|
2019-12-16 04:10:43 +01:00
|
|
|
|
objSubTypeMessageWithdrawNAck = 401 // not enought items (done)
|
2019-12-16 04:17:00 +01:00
|
|
|
|
objSubTypeMessagePillageDefeat = 402 // You tried stopping (done)
|
2019-12-20 03:32:33 +01:00
|
|
|
|
objSubTypeMessageLevelUpReq = 403 // /level_up
|
|
|
|
|
objSubTypeMessageLevelUpAck = 404
|
2019-10-20 11:03:54 +02:00
|
|
|
|
objSubTypeJobPillage = 601
|
|
|
|
|
objSubTypeJobTribute = 602
|
|
|
|
|
objSubTypeJobStatus = 603
|
|
|
|
|
objSubTypeJobGWithdraw = 604
|
|
|
|
|
objSubTypeJobGStock = 605
|
|
|
|
|
objSubTypeJobRescanMsg = 606
|
|
|
|
|
objSubTypeJobSetJobDone = 607
|
|
|
|
|
objSubTypeJobMsgClient = 608
|
|
|
|
|
objSubTypeJobMsgRefresh = 609
|
|
|
|
|
objSubTypeJobBackupExport = 610
|
|
|
|
|
objSubTypeJobBackupImport = 611
|
|
|
|
|
objSubTypeJobGDeposit = 612
|
|
|
|
|
objSubTypeJobGDepositForward = 613
|
|
|
|
|
objSubTypeJobSaveRes = 614
|
|
|
|
|
objSubTypeJobVaultUserStatus = 615
|
|
|
|
|
objSubTypeJobVaultItemStatus = 616
|
2019-12-13 12:19:52 +01:00
|
|
|
|
objSubTypeJobFwdMsg = 617 // rename to objSubTypeJobMsgFwd
|
2019-12-13 09:34:32 +01:00
|
|
|
|
objSubTypeJobSetDef = 618
|
2019-12-13 12:19:52 +01:00
|
|
|
|
objSubTypeJobMsgDel = 619
|
2019-12-19 04:31:28 +01:00
|
|
|
|
objSubTypeJobGetHammerTime = 620
|
2019-10-20 11:03:54 +02:00
|
|
|
|
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
|
2019-05-06 09:25:57 +02:00
|
|
|
|
|
2019-08-17 08:18:25 +02:00
|
|
|
|
objJobStatusCallBack = -1
|
2019-05-18 12:33:53 +02:00
|
|
|
|
objJobStatusNew = 0
|
|
|
|
|
objJobStatusPillageGo = 1
|
|
|
|
|
objJonStatusPending = 10
|
|
|
|
|
objJobStatusDone = 20
|
2019-05-10 11:23:47 +02:00
|
|
|
|
|
2019-05-19 05:20:01 +02:00
|
|
|
|
objJobPriority = 1
|
|
|
|
|
objJobPriorityRescanMsg = 2
|
|
|
|
|
objJobPriorityRescanAllMsg = 3
|
2019-06-11 16:50:01 +02:00
|
|
|
|
objJobPriorityBackup = 4
|
2019-05-11 06:54:12 +02:00
|
|
|
|
|
2019-06-14 05:24:43 +02:00
|
|
|
|
MQGetMsgWorkers = 12
|
|
|
|
|
MQCWMsgQueueSize = 100
|
|
|
|
|
SQLCWMsgWorkers = 6
|
|
|
|
|
SQLIdentifyMsgWorkers = 6
|
|
|
|
|
SQLMsgIdentifyQueueSize = 100
|
|
|
|
|
SQLMsgRescanJobSize = 25
|
|
|
|
|
JobWorkers = 12
|
|
|
|
|
JobQueueSize = 100
|
|
|
|
|
TGCmdWorkers = 3
|
|
|
|
|
TGCmdQueueSize = 100
|
|
|
|
|
MQTGCmdWorkers = 3
|
|
|
|
|
MQTGCmdQueueSize = 100
|
|
|
|
|
SQLJobSliceSize = 25
|
|
|
|
|
KeepAliveHeartBeatSeconds = 5
|
2019-05-06 05:59:19 +02:00
|
|
|
|
)
|
2019-05-08 17:18:17 +02:00
|
|
|
|
|
2019-05-09 04:27:21 +02:00
|
|
|
|
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}
|
2019-05-09 04:28:06 +02:00
|
|
|
|
|
|
|
|
|
chatWarsDaysSpecial = map[int]map[int]int{
|
|
|
|
|
2: {1060: 29},
|
|
|
|
|
4: {1060: 29}}
|
|
|
|
|
|
2019-05-09 04:27:21 +02:00
|
|
|
|
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}
|
|
|
|
|
)
|