quality
This commit is contained in:
parent
2821e603e2
commit
061fcbdddd
4
def.go
4
def.go
@ -184,7 +184,9 @@ type ChatWarsItem struct {
|
|||||||
Auction bool `json:"auction"`
|
Auction bool `json:"auction"`
|
||||||
Craftable bool `json:"craftable"`
|
Craftable bool `json:"craftable"`
|
||||||
Craft *ChatWarsItemCraft `json:"craft"`
|
Craft *ChatWarsItemCraft `json:"craft"`
|
||||||
Classes []ChatWarsClass
|
Quality string `json:"-"`
|
||||||
|
Modifiers string `json:"-"`
|
||||||
|
Classes []ChatWarsClass `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ChatWarsItemCraft struct {
|
type ChatWarsItemCraft struct {
|
||||||
|
22
msg.go
22
msg.go
@ -289,6 +289,25 @@ func parseSubTypeMessageAuctionAnnounce(m *ChatWarsMessage, r *regexp.Regexp) (*
|
|||||||
cwm.Cond = r.ReplaceAllString(m.Text, "${Cond}")
|
cwm.Cond = r.ReplaceAllString(m.Text, "${Cond}")
|
||||||
cwm.Mod = r.ReplaceAllString(m.Text, "${Mod}")
|
cwm.Mod = r.ReplaceAllString(m.Text, "${Mod}")
|
||||||
cwm.Quality = r.ReplaceAllString(m.Text, "${Quality}")
|
cwm.Quality = r.ReplaceAllString(m.Text, "${Quality}")
|
||||||
|
switch cwm.Quality {
|
||||||
|
case `Fine`:
|
||||||
|
cwm.Quality = `e`
|
||||||
|
case `High`:
|
||||||
|
cwm.Quality = `d`
|
||||||
|
case `Great`:
|
||||||
|
cwm.Quality = `c`
|
||||||
|
case `Excellent`:
|
||||||
|
cwm.Quality = `b`
|
||||||
|
case `Masterpiece`:
|
||||||
|
cwm.Quality = `a`
|
||||||
|
case `Epic Fine`:
|
||||||
|
cwm.Quality = `se`
|
||||||
|
case `Epic High`:
|
||||||
|
cwm.Quality = `sd`
|
||||||
|
default:
|
||||||
|
|
||||||
|
cwm.Quality = ``
|
||||||
|
}
|
||||||
cwm.SellerUserID64 = getObjUserID(r.ReplaceAllString(m.Text, "${SellerUser}"))
|
cwm.SellerUserID64 = getObjUserID(r.ReplaceAllString(m.Text, "${SellerUser}"))
|
||||||
cwm.SellerGuildID64 = getObjGuildID(r.ReplaceAllString(m.Text, "${SellerGuild}"))
|
cwm.SellerGuildID64 = getObjGuildID(r.ReplaceAllString(m.Text, "${SellerGuild}"))
|
||||||
cwm.SellerCastleID64 = getObjCastleID(r.ReplaceAllString(m.Text, "${SellerCastle}"))
|
cwm.SellerCastleID64 = getObjCastleID(r.ReplaceAllString(m.Text, "${SellerCastle}"))
|
||||||
@ -327,6 +346,7 @@ func parseSubTypeMessageGStockAnyAck(m *ChatWarsMessage, r *regexp.Regexp) (*Cha
|
|||||||
cwm := ChatWarsMessageGStock{}
|
cwm := ChatWarsMessageGStock{}
|
||||||
stock := []ChatWarsItems{}
|
stock := []ChatWarsItems{}
|
||||||
re := regexp.MustCompile(`\n([0-9a-z]+) (.*) x ([0-9]+)`)
|
re := regexp.MustCompile(`\n([0-9a-z]+) (.*) x ([0-9]+)`)
|
||||||
|
rq := regexp.MustCompile(`[a-z][0-9]+(?P<Quality>[a-z]+)`)
|
||||||
for _, l := range re.FindAllStringSubmatch(r.ReplaceAllString(m.Text, "${Stock}"), -1) {
|
for _, l := range re.FindAllStringSubmatch(r.ReplaceAllString(m.Text, "${Stock}"), -1) {
|
||||||
i := getObjItemID(l[1], l[2])
|
i := getObjItemID(l[1], l[2])
|
||||||
q, _ := strconv.ParseInt(l[3], 10, 64)
|
q, _ := strconv.ParseInt(l[3], 10, 64)
|
||||||
@ -336,7 +356,9 @@ func parseSubTypeMessageGStockAnyAck(m *ChatWarsMessage, r *regexp.Regexp) (*Cha
|
|||||||
Name: l[2],
|
Name: l[2],
|
||||||
ItemID64: i,
|
ItemID64: i,
|
||||||
Quantity: q,
|
Quantity: q,
|
||||||
|
Quality: rq.ReplaceAllString(l[1], "${Quality}"),
|
||||||
}
|
}
|
||||||
|
|
||||||
stock = append(stock, item)
|
stock = append(stock, item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
4
sql.go
4
sql.go
@ -258,7 +258,7 @@ func initDB() {
|
|||||||
,item_id BIGINT UNSIGNED
|
,item_id BIGINT UNSIGNED
|
||||||
,cond VARCHAR(32)
|
,cond VARCHAR(32)
|
||||||
,quality VARCHAR(32)
|
,quality VARCHAR(32)
|
||||||
,modifiers VARCHAR(80)
|
,modifiers VARCHAR(400)
|
||||||
,seller_castle_id BIGINT UNSIGNED
|
,seller_castle_id BIGINT UNSIGNED
|
||||||
,seller_guild_id BIGINT UNSIGNED
|
,seller_guild_id BIGINT UNSIGNED
|
||||||
,seller_id BIGINT UNSIGNED
|
,seller_id BIGINT UNSIGNED
|
||||||
@ -275,7 +275,7 @@ func initDB() {
|
|||||||
,FOREIGN KEY (buyer_guild_id) REFERENCES obj_guild(obj_id) ON DELETE CASCADE
|
,FOREIGN KEY (buyer_guild_id) REFERENCES obj_guild(obj_id) ON DELETE CASCADE
|
||||||
,FOREIGN KEY (seller_castle_id) REFERENCES obj_castle(obj_id) ON DELETE CASCADE
|
,FOREIGN KEY (seller_castle_id) REFERENCES obj_castle(obj_id) ON DELETE CASCADE
|
||||||
,FOREIGN KEY (buyer_castle_id) REFERENCES obj_castle(obj_id) ON DELETE CASCADE
|
,FOREIGN KEY (buyer_castle_id) REFERENCES obj_castle(obj_id) ON DELETE CASCADE
|
||||||
,KEY (lot_id)
|
,UNIQUE KEY (lot_id)
|
||||||
) ENGINE = InnoDB CHARSET=utf8mb4 COLLATE utf8mb4_bin;`)
|
) ENGINE = InnoDB CHARSET=utf8mb4 COLLATE utf8mb4_bin;`)
|
||||||
failOnError(err, "initDB : create table obj_msg_auction_announce")
|
failOnError(err, "initDB : create table obj_msg_auction_announce")
|
||||||
log.Println("initDB : obj_msg_auction_announce created ...")
|
log.Println("initDB : obj_msg_auction_announce created ...")
|
||||||
|
@ -263,7 +263,7 @@ func MQTGCmdWorker(id int, cmds <-chan TGCommand) {
|
|||||||
if clt, ok := getLockedClient(c.FromUserID64, false); ok {
|
if clt, ok := getLockedClient(c.FromUserID64, false); ok {
|
||||||
j, err := json.Marshal(c)
|
j, err := json.Marshal(c)
|
||||||
logOnError(err, "MQTGCmdWorker["+strconv.Itoa(id)+"] : Marshal(c)")
|
logOnError(err, "MQTGCmdWorker["+strconv.Itoa(id)+"] : Marshal(c)")
|
||||||
log.Printf("MQTGCmdWorker["+strconv.Itoa(id)+"] : new command.\n%s\n", string(j))
|
//log.Printf("MQTGCmdWorker["+strconv.Itoa(id)+"] : new command.\n%s\n", string(j))
|
||||||
for clt.MQ.Connection == nil || clt.MQ.Connection.IsClosed() {
|
for clt.MQ.Connection == nil || clt.MQ.Connection.IsClosed() {
|
||||||
clt.Active = false
|
clt.Active = false
|
||||||
log.Printf("MQTGCmdWorker : Resetting MQ connection for #%d.\n", c.FromUserID64)
|
log.Printf("MQTGCmdWorker : Resetting MQ connection for #%d.\n", c.FromUserID64)
|
||||||
|
Loading…
Reference in New Issue
Block a user