remove g_stock
This commit is contained in:
parent
ddacb1fb27
commit
d412c85eb4
226
main.go
226
main.go
@ -404,232 +404,6 @@ func ListenGuild(c *tdlib.Client) {
|
|||||||
fmt.Println("===============================================================================================================")
|
fmt.Println("===============================================================================================================")
|
||||||
|
|
||||||
for _, line := range strings.Split(strings.TrimSuffix(txt, "\n"), "\n") {
|
for _, line := range strings.Split(strings.TrimSuffix(txt, "\n"), "\n") {
|
||||||
validID := regexp.MustCompile(`^/g_stock$`)
|
|
||||||
if validID.MatchString(line) {
|
|
||||||
fmt.Println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! GUILD STOCK REPORT SPOTTED !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
|
|
||||||
|
|
||||||
inputMsgTxt := tdlib.NewInputMessageText(tdlib.NewFormattedText("/g_stock_res\n", nil), true, true)
|
|
||||||
msgMutex.Lock()
|
|
||||||
sendMsg, _ := c.SendMessage(user_chtwrsbot, 0, false, false, nil, inputMsgTxt)
|
|
||||||
msgID64 = sendMsg.ID
|
|
||||||
msgText = string("/g_stock_res")
|
|
||||||
fmt.Println("send msgID64 (g_stock_res) : ", msgID64)
|
|
||||||
|
|
||||||
inputMsgTxt = tdlib.NewInputMessageText(tdlib.NewFormattedText("/g_stock_alch\n", nil), true, true)
|
|
||||||
msgMutex.Lock()
|
|
||||||
sendMsg, _ = c.SendMessage(user_chtwrsbot, 0, false, false, nil, inputMsgTxt)
|
|
||||||
msgID64 = sendMsg.ID
|
|
||||||
msgText = string("/g_stock_alch")
|
|
||||||
fmt.Println("send msgID64 (g_stock_alch) : ", msgID64)
|
|
||||||
|
|
||||||
inputMsgTxt = tdlib.NewInputMessageText(tdlib.NewFormattedText("/g_stock_misc\n", nil), true, true)
|
|
||||||
msgMutex.Lock()
|
|
||||||
sendMsg, _ = c.SendMessage(user_chtwrsbot, 0, false, false, nil, inputMsgTxt)
|
|
||||||
msgID64 = sendMsg.ID
|
|
||||||
msgText = string("/g_stock_misc")
|
|
||||||
fmt.Println("send msgID64 (g_stock_misc) : ", msgID64)
|
|
||||||
|
|
||||||
inputMsgTxt = tdlib.NewInputMessageText(tdlib.NewFormattedText("/g_stock_rec\n", nil), true, true)
|
|
||||||
msgMutex.Lock()
|
|
||||||
sendMsg, _ = c.SendMessage(user_chtwrsbot, 0, false, false, nil, inputMsgTxt)
|
|
||||||
msgID64 = sendMsg.ID
|
|
||||||
msgText = string("/g_stock_rec")
|
|
||||||
fmt.Println("send msgID64 (g_stock_rec) : ", msgID64)
|
|
||||||
|
|
||||||
inputMsgTxt = tdlib.NewInputMessageText(tdlib.NewFormattedText("/g_stock_parts\n", nil), true, true)
|
|
||||||
msgMutex.Lock()
|
|
||||||
sendMsg, _ = c.SendMessage(user_chtwrsbot, 0, false, false, nil, inputMsgTxt)
|
|
||||||
msgID64 = sendMsg.ID
|
|
||||||
msgText = string("/g_stock_parts")
|
|
||||||
fmt.Println("send msgID64 (g_stock_parts) : ", msgID64)
|
|
||||||
|
|
||||||
inputMsgTxt = tdlib.NewInputMessageText(tdlib.NewFormattedText("/g_stock_other\n", nil), true, true)
|
|
||||||
msgMutex.Lock()
|
|
||||||
sendMsg, _ = c.SendMessage(user_chtwrsbot, 0, false, false, nil, inputMsgTxt)
|
|
||||||
msgID64 = sendMsg.ID
|
|
||||||
msgText = string("/g_stock_other")
|
|
||||||
fmt.Println("send msgID64 (g_stock_other) : ", msgID64)
|
|
||||||
|
|
||||||
msgMutex.Lock()
|
|
||||||
msgMutex.Unlock()
|
|
||||||
|
|
||||||
r := regexp.MustCompile(`(?P<Code>[a-z0-9]+) (?P<Name>[⚡📕📗📘📙📒'a-zA-Z0-9+ ]+) x (?P<Quantity>[0-9]+)`)
|
|
||||||
s := regexp.MustCompile(`(?P<Modifier>⚡\+[0-9]+) (?P<BaseName>[a-zA-Z ]+)`)
|
|
||||||
|
|
||||||
fmt.Println("=====================> Exploring vault.Res")
|
|
||||||
vault.ResSize = 0
|
|
||||||
vault.ResCount = 0
|
|
||||||
for _, item := range strings.Split(strings.TrimSuffix(vault.Res, "\n"), "\n") {
|
|
||||||
// fmt.Printf("%s : %#v\n", item, r.FindStringSubmatch(item))
|
|
||||||
// fmt.Printf("%s : %#v\n", item, r.SubexpNames())
|
|
||||||
if r.FindStringSubmatch(item) != nil {
|
|
||||||
if _, ok := items[r.ReplaceAllString(item, "${Code}")]; ok {
|
|
||||||
if items[r.ReplaceAllString(item, "${Code}")].Weight == -1 {
|
|
||||||
fmt.Printf("=====================> Unknown size for item : %s (%s)\n", r.ReplaceAllString(item, "${Code}"), r.ReplaceAllString(item, "${Name}"))
|
|
||||||
} else {
|
|
||||||
size, _ = strconv.Atoi(r.ReplaceAllString(item, "${Quantity}"))
|
|
||||||
vault.ResSize = vault.ResSize + items[r.ReplaceAllString(item, "${Code}")].Weight*int32(size)
|
|
||||||
vault.ResCount = vault.ResCount + int32(size)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
fmt.Printf("=====================> Item not found in map : %s (%s)\n", r.ReplaceAllString(item, "${Code}"), r.ReplaceAllString(item, "${Name}"))
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if item != "Guild Warehouse:" {
|
|
||||||
fmt.Printf("=====================> Item not matched : %s\n", item)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fmt.Printf("=====================> Size for vault.Res : %d\n", vault.ResSize)
|
|
||||||
|
|
||||||
fmt.Println("=====================> Exploring vault.Alch")
|
|
||||||
vault.AlchSize = 0
|
|
||||||
vault.AlchCount = 0
|
|
||||||
for _, item := range strings.Split(strings.TrimSuffix(vault.Alch, "\n"), "\n") {
|
|
||||||
// fmt.Printf("%s : %#v\n", item, r.FindStringSubmatch(item))
|
|
||||||
// fmt.Printf("%s : %#v\n", item, r.SubexpNames())
|
|
||||||
if r.FindStringSubmatch(item) != nil {
|
|
||||||
if _, ok := items[r.ReplaceAllString(item, "${Code}")]; ok {
|
|
||||||
if items[r.ReplaceAllString(item, "${Code}")].Weight == -1 {
|
|
||||||
fmt.Printf("=====================> Unknown size for item : %s (%s)\n", r.ReplaceAllString(item, "${Code}"), r.ReplaceAllString(item, "${Name}"))
|
|
||||||
} else {
|
|
||||||
size, _ = strconv.Atoi(r.ReplaceAllString(item, "${Quantity}"))
|
|
||||||
vault.AlchSize = vault.AlchSize + items[r.ReplaceAllString(item, "${Code}")].Weight*int32(size)
|
|
||||||
vault.AlchCount = vault.AlchCount + int32(size)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
fmt.Printf("=====================> Item not found in map : %s (%s)\n", r.ReplaceAllString(item, "${Code}"), r.ReplaceAllString(item, "${Name}"))
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if item != "Guild Warehouse:" {
|
|
||||||
fmt.Printf("=====================> Item not matched : %s\n", item)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fmt.Printf("=====================> Size for vault.Alch : %d\n", vault.AlchSize)
|
|
||||||
|
|
||||||
fmt.Println("=====================> Exploring vault.Misc")
|
|
||||||
vault.MiscSize = 0
|
|
||||||
vault.MiscCount = 0
|
|
||||||
for _, item := range strings.Split(strings.TrimSuffix(vault.Misc, "\n"), "\n") {
|
|
||||||
// fmt.Printf("%s : %#v\n", item, r.FindStringSubmatch(item))
|
|
||||||
// fmt.Printf("%s : %#v\n", item, r.SubexpNames())
|
|
||||||
if r.FindStringSubmatch(item) != nil {
|
|
||||||
if _, ok := items[r.ReplaceAllString(item, "${Code}")]; ok {
|
|
||||||
if items[r.ReplaceAllString(item, "${Code}")].Weight == -1 {
|
|
||||||
fmt.Printf("=====================> Unknown size for item : %s (%s)\n", r.ReplaceAllString(item, "${Code}"), r.ReplaceAllString(item, "${Name}"))
|
|
||||||
} else {
|
|
||||||
size, _ = strconv.Atoi(r.ReplaceAllString(item, "${Quantity}"))
|
|
||||||
vault.MiscSize = vault.MiscSize + items[r.ReplaceAllString(item, "${Code}")].Weight*int32(size)
|
|
||||||
vault.MiscCount = vault.MiscCount + int32(size)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
fmt.Printf("=====================> Item not found in map : %s (%s)\n", r.ReplaceAllString(item, "${Code}"), r.ReplaceAllString(item, "${Name}"))
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if item != "Guild Warehouse:" {
|
|
||||||
fmt.Printf("=====================> Item not matched : %s\n", item)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fmt.Printf("=====================> Size for vault.Misc : %d\n", vault.MiscSize)
|
|
||||||
|
|
||||||
fmt.Println("=====================> Exploring vault.Rec")
|
|
||||||
vault.RecSize = 0
|
|
||||||
vault.RecCount = 0
|
|
||||||
for _, item := range strings.Split(strings.TrimSuffix(vault.Rec, "\n"), "\n") {
|
|
||||||
// fmt.Printf("%s : %#v\n", item, r.FindStringSubmatch(item))
|
|
||||||
// fmt.Printf("%s : %#v\n", item, r.SubexpNames())
|
|
||||||
if r.FindStringSubmatch(item) != nil {
|
|
||||||
if _, ok := items[r.ReplaceAllString(item, "${Code}")]; ok {
|
|
||||||
if items[r.ReplaceAllString(item, "${Code}")].Weight == -1 {
|
|
||||||
fmt.Printf("=====================> Unknown size for item : %s (%s)\n", r.ReplaceAllString(item, "${Code}"), r.ReplaceAllString(item, "${Name}"))
|
|
||||||
} else {
|
|
||||||
size, _ = strconv.Atoi(r.ReplaceAllString(item, "${Quantity}"))
|
|
||||||
vault.RecSize = vault.RecSize + items[r.ReplaceAllString(item, "${Code}")].Weight*int32(size)
|
|
||||||
vault.RecCount = vault.RecCount + int32(size)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
fmt.Printf("=====================> Item not found in map : %s (%s)\n", r.ReplaceAllString(item, "${Code}"), r.ReplaceAllString(item, "${Name}"))
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if item != "Guild Warehouse:" {
|
|
||||||
fmt.Printf("=====================> Item not matched : %s\n", item)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fmt.Printf("=====================> Size for vault.Rec : %d\n", vault.RecSize)
|
|
||||||
|
|
||||||
fmt.Println("=====================> Exploring vault.Parts")
|
|
||||||
vault.PartsSize = 0
|
|
||||||
vault.PartsCount = 0
|
|
||||||
for _, item := range strings.Split(strings.TrimSuffix(vault.Parts, "\n"), "\n") {
|
|
||||||
// fmt.Printf("%s : %#v\n", item, r.FindStringSubmatch(item))
|
|
||||||
// fmt.Printf("%s : %#v\n", item, r.SubexpNames())
|
|
||||||
if r.FindStringSubmatch(item) != nil {
|
|
||||||
if _, ok := items[r.ReplaceAllString(item, "${Code}")]; ok {
|
|
||||||
if items[r.ReplaceAllString(item, "${Code}")].Weight == -1 {
|
|
||||||
fmt.Printf("=====================> Unknown size for item : %s (%s)\n", r.ReplaceAllString(item, "${Code}"), r.ReplaceAllString(item, "${Name}"))
|
|
||||||
} else {
|
|
||||||
size, _ = strconv.Atoi(r.ReplaceAllString(item, "${Quantity}"))
|
|
||||||
vault.PartsSize = vault.PartsSize + items[r.ReplaceAllString(item, "${Code}")].Weight*int32(size)
|
|
||||||
vault.PartsCount = vault.PartsCount + int32(size)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
fmt.Printf("=====================> Item not found in map : %s (%s)\n", r.ReplaceAllString(item, "${Code}"), r.ReplaceAllString(item, "${Name}"))
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if item != "Guild Warehouse:" {
|
|
||||||
fmt.Printf("=====================> Item not matched : %s\n", item)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fmt.Printf("=====================> Size for vault.Parts : %d\n", vault.PartsSize)
|
|
||||||
|
|
||||||
fmt.Println("=====================> Exploring vault.Other")
|
|
||||||
vault.OtherSize = 0
|
|
||||||
vault.OtherCount = 0
|
|
||||||
for _, item := range strings.Split(strings.TrimSuffix(vault.Other, "\n"), "\n") {
|
|
||||||
// fmt.Printf("%s : %#v\n", item, r.FindStringSubmatch(item))
|
|
||||||
// fmt.Printf("%s : %#v\n", item, r.SubexpNames())
|
|
||||||
if r.FindStringSubmatch(item) != nil {
|
|
||||||
if _, ok := items[r.ReplaceAllString(item, "${Code}")]; ok {
|
|
||||||
if items[r.ReplaceAllString(item, "${Code}")].Weight == -1 {
|
|
||||||
fmt.Printf("=====================> Unknown size for item : %s (%s)\n", r.ReplaceAllString(item, "${Code}"), r.ReplaceAllString(item, "${Name}"))
|
|
||||||
} else {
|
|
||||||
size, _ = strconv.Atoi(r.ReplaceAllString(item, "${Quantity}"))
|
|
||||||
vault.OtherSize = vault.OtherSize + items[r.ReplaceAllString(item, "${Code}")].Weight*int32(size)
|
|
||||||
vault.OtherCount = vault.OtherCount + int32(size)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
fmt.Printf("=====================> Item not found in map : %s (%s)\n", r.ReplaceAllString(item, "${Code}"), r.ReplaceAllString(item, "${Name}"))
|
|
||||||
itemName := r.ReplaceAllString(item, "${Name}")
|
|
||||||
if s.FindStringSubmatch(itemName) != nil {
|
|
||||||
for k, v := range items {
|
|
||||||
if strings.Compare(v.Name, s.ReplaceAllString(itemName, "${BaseName}")) == 0 {
|
|
||||||
size, _ = strconv.Atoi(r.ReplaceAllString(item, "${Quantity}"))
|
|
||||||
vault.OtherSize = vault.OtherSize + items[k].Weight*int32(size)
|
|
||||||
vault.OtherCount = vault.OtherCount + int32(size)
|
|
||||||
fmt.Printf("=====================> Found in map : %s (%d)\n", items[k].Name, size)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if item != "Guild Warehouse:" {
|
|
||||||
fmt.Printf("=====================> Item not matched : %s\n", item)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fmt.Printf("=====================> Size for vault.Other : %d\n", vault.OtherSize)
|
|
||||||
|
|
||||||
msgText = fmt.Sprintf("Current stock [%d/38000] :\n - Resources : %d (%d)\n - Alchemist : %d (%d)\n - Misc stuff : %d (%d)\n - Recipes : %d (%d)\n - Parts : %d (%d)\n - Other : %d (%d)\n", vault.ResSize+vault.AlchSize+vault.MiscSize+vault.RecSize+vault.PartsSize+vault.OtherSize, vault.ResSize, vault.ResCount, vault.AlchSize, vault.AlchCount, vault.MiscSize, vault.MiscCount, vault.RecSize, vault.RecCount, vault.PartsSize, vault.PartsCount, vault.OtherSize, vault.OtherCount)
|
|
||||||
inputMsgTxt = tdlib.NewInputMessageText(tdlib.NewFormattedText(msgText, nil), true, true)
|
|
||||||
sendMsg, _ = c.SendMessage(chat_guild, 0, false, false, nil, inputMsgTxt)
|
|
||||||
msgText = ""
|
|
||||||
|
|
||||||
break
|
|
||||||
}
|
|
||||||
validID = regexp.MustCompile(`^/g_withdraw ([a-z0-9]+) ([0-9]+)$`)
|
validID = regexp.MustCompile(`^/g_withdraw ([a-z0-9]+) ([0-9]+)$`)
|
||||||
if validID.MatchString(line) {
|
if validID.MatchString(line) {
|
||||||
fmt.Println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! GUILD WITHDRAWAL SPOTTED !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
|
fmt.Println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! GUILD WITHDRAWAL SPOTTED !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
|
||||||
|
Loading…
Reference in New Issue
Block a user