diff --git a/rules.go b/rules.go index fc86924..6c97846 100644 --- a/rules.go +++ b/rules.go @@ -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(objSubTypeMessagePillageWin) + `,"Pillage Win", "^You successfully defeated (\\[(?P[A-Z0-9]{1,3})\\]){0,1}(?P.*). As he was crawling away, you picked up some of the gold he left behind. Received (?P[0-9]+) gold and (?P[0-9]+) exp.$") ,(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[A-Z0-9]{1,3})\\]){0,1}(?P.*) go and he pillaged the village. We hope you feel terrible.$") ,(5000, ` + strconv.Itoa(objSubTypeMessageDuelFight) + `, "Duel Fight result #2", "(?P(\\-){0,1}[0-9]+).*(?P[πŸ‰πŸ¦…πŸΊπŸ¦ˆπŸ¦ŒπŸ₯”πŸŒ‘])(\\[(?P[A-Z0-9]{1,3})\\]){0,1}(?P.*)\\n` + `VS\\n` + `(?P(\\-){0,1}[0-9]+).*(?P[πŸ‰πŸ¦…πŸΊπŸ¦ˆπŸ¦ŒπŸ₯”πŸŒ‘])(\\[(?P[A-Z0-9]{1,3})\\]){0,1}(?P.*)\\n` + diff --git a/sql.go b/sql.go index 0fd7b3e..a9973ed 100644 --- a/sql.go +++ b/sql.go @@ -220,11 +220,11 @@ func initDB() { _, err = db.Exec(`CREATE TABLE obj_msg_duel_fight ( obj_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_life SMALLINT NOT NULL ,loss_castle_id BIGINT UNSIGNED NOT NULL - ,loss_guild VARCHAR(3) + ,loss_guild_id BIGINT UNSIGNED ,loss_user VARCHAR(32) ,loss_life SMALLINT 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 (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 (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;`) failOnError(err, "initDB : create table obj_msg_duel_fight") log.Println("initDB : obj_msg_duel_fight created ...") @@ -1407,14 +1409,14 @@ func insertMsgDuelFight(m *ChatWarsMessageDuelFight) error { 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) - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?);`) + 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 (?, ?, ?, ?, ?, ?, ?, ?, ?, ?);`) if err != nil { return err } 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 { return err }