This commit is contained in:
shoopea 2019-05-25 16:24:59 +08:00
parent 4ddbb88cd9
commit 36bd3e2250
2 changed files with 8 additions and 5 deletions

View File

@ -35,6 +35,7 @@ func resetMsgParsingRules() {
,(5000, ` + strconv.Itoa(objSubTypeMessagePillageGo) + `,"Pillage Go", "^You lift up your sword and charge at the violator.$") ,(5000, ` + strconv.Itoa(objSubTypeMessagePillageGo) + `,"Pillage Go", "^You lift up your sword and charge at the violator.$")
,(5000, ` + strconv.Itoa(objSubTypeMessagePillageWin) + `,"Pillage Win", "^You successfully defeated (\\[(?P<Guild>[A-Z0-9]{1,3})\\]){0,1}(?P<Attacker>.*). As he was crawling away, you picked up some of the gold he left behind. Received (?P<Gold>[0-9]+) gold and (?P<Exp>[0-9]+) exp.$") ,(5000, ` + strconv.Itoa(objSubTypeMessagePillageWin) + `,"Pillage Win", "^You successfully defeated (\\[(?P<Guild>[A-Z0-9]{1,3})\\]){0,1}(?P<Attacker>.*). As he was crawling away, you picked up some of the gold he left behind. Received (?P<Gold>[0-9]+) gold and (?P<Exp>[0-9]+) exp.$")
,(5000, ` + strconv.Itoa(objSubTypeMessagePillageTimeout) + `,"Pillage Timeout", "^You\\'ve failed to protect the villagers. No more rewards for you.$") ,(5000, ` + strconv.Itoa(objSubTypeMessagePillageTimeout) + `,"Pillage Timeout", "^You\\'ve failed to protect the villagers. No more rewards for you.$")
,(5000, ` + strconv.Itoa(objSubTypeMessagePillageLoss) + `,"Pillage Loss", "^You let (\\[(?P<Guild>[A-Z0-9]{1,3})\\]){0,1}(?P<Attacker>.*) go and he pillaged the village. We hope you feel terrible.$")
,(5000, ` + strconv.Itoa(objSubTypeMessageDuelFight) + `, "Duel Fight result #2", "(?P<Life1>(\\-){0,1}[0-9]+).*(?P<Castle1>[🐉🦅🐺🦈🦌🥔🌑])(\\[(?P<Guild1>[A-Z0-9]{1,3})\\]){0,1}(?P<Duelist1>.*)\\n` + ,(5000, ` + strconv.Itoa(objSubTypeMessageDuelFight) + `, "Duel Fight result #2", "(?P<Life1>(\\-){0,1}[0-9]+).*(?P<Castle1>[🐉🦅🐺🦈🦌🥔🌑])(\\[(?P<Guild1>[A-Z0-9]{1,3})\\]){0,1}(?P<Duelist1>.*)\\n` +
`VS\\n` + `VS\\n` +
`(?P<Life2>(\\-){0,1}[0-9]+).*(?P<Castle2>[🐉🦅🐺🦈🦌🥔🌑])(\\[(?P<Guild2>[A-Z0-9]{1,3})\\]){0,1}(?P<Duelist2>.*)\\n` + `(?P<Life2>(\\-){0,1}[0-9]+).*(?P<Castle2>[🐉🦅🐺🦈🦌🥔🌑])(\\[(?P<Guild2>[A-Z0-9]{1,3})\\]){0,1}(?P<Duelist2>.*)\\n` +

12
sql.go
View File

@ -220,11 +220,11 @@ func initDB() {
_, err = db.Exec(`CREATE TABLE obj_msg_duel_fight ( _, err = db.Exec(`CREATE TABLE obj_msg_duel_fight (
obj_id BIGINT UNSIGNED NOT NULL obj_id BIGINT UNSIGNED NOT NULL
,win_castle_id BIGINT UNSIGNED NOT NULL ,win_castle_id BIGINT UNSIGNED NOT NULL
,win_guild VARCHAR(3) ,win_guild_id BIGINT UNSIGNED
,win_user VARCHAR(32) ,win_user VARCHAR(32)
,win_life SMALLINT NOT NULL ,win_life SMALLINT NOT NULL
,loss_castle_id BIGINT UNSIGNED NOT NULL ,loss_castle_id BIGINT UNSIGNED NOT NULL
,loss_guild VARCHAR(3) ,loss_guild_id BIGINT UNSIGNED
,loss_user VARCHAR(32) ,loss_user VARCHAR(32)
,loss_life SMALLINT NOT NULL ,loss_life SMALLINT NOT NULL
,exp INT UNSIGNED NOT NULL ,exp INT UNSIGNED NOT NULL
@ -232,6 +232,8 @@ func initDB() {
,FOREIGN KEY (obj_id) REFERENCES obj(id) ON DELETE CASCADE ,FOREIGN KEY (obj_id) REFERENCES obj(id) ON DELETE CASCADE
,FOREIGN KEY (win_castle_id) REFERENCES obj_castle(obj_id) ON DELETE CASCADE ,FOREIGN KEY (win_castle_id) REFERENCES obj_castle(obj_id) ON DELETE CASCADE
,FOREIGN KEY (loss_castle_id) REFERENCES obj_castle(obj_id) ON DELETE CASCADE ,FOREIGN KEY (loss_castle_id) REFERENCES obj_castle(obj_id) ON DELETE CASCADE
,FOREIGN KEY (win_guild_id) REFERENCES obj_guild(obj_id) ON DELETE CASCADE
,FOREIGN KEY (loss_guild_id) REFERENCES obj_guild(obj_id) ON DELETE CASCADE
) ENGINE = InnoDB CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci;`) ) ENGINE = InnoDB CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci;`)
failOnError(err, "initDB : create table obj_msg_duel_fight") failOnError(err, "initDB : create table obj_msg_duel_fight")
log.Println("initDB : obj_msg_duel_fight created ...") log.Println("initDB : obj_msg_duel_fight created ...")
@ -1407,14 +1409,14 @@ func insertMsgDuelFight(m *ChatWarsMessageDuelFight) error {
return errors.New("Message type mismatch") return errors.New("Message type mismatch")
} }
stmt, err := db.Prepare(`INSERT INTO obj_msg_duel_fight (obj_id, win_castle_id, win_guild, win_user, win_life, loss_castle_id, loss_guild, loss_user, loss_life, weapon) stmt, err := db.Prepare(`INSERT INTO obj_msg_duel_fight (obj_id, win_castle_id, win_guild_id, win_user, win_life, loss_castle_id, loss_guild_id, loss_user, loss_life, weapon)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?);`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?);`)
if err != nil { if err != nil {
return err return err
} }
defer stmt.Close() defer stmt.Close()
_, err = stmt.Exec(m.ObjID64, getObjCastleID(m.WinCastle), m.WinGuild, m.WinUser, m.WinLife, getObjCastleID(m.LossCastle), m.LossGuild, m.LossUser, m.LossLife, m.Weapon) _, err = stmt.Exec(m.ObjID64, getObjCastleID(m.WinCastle), getObjGuildID(m.WinGuild), m.WinUser, m.WinLife, getObjCastleID(m.LossCastle), getObjGuildID(m.LossGuild), m.LossUser, m.LossLife, m.Weapon)
if err != nil { if err != nil {
return err return err
} }