This commit is contained in:
shoopea 2019-06-03 16:31:28 +08:00
parent 3a45e3f595
commit 977f65828d
2 changed files with 25 additions and 3 deletions

View File

@ -14,4 +14,6 @@ ChirpNestBot
- [ ] Experience graphs & forecast
- [ ] Impersonate
- [x] Foray interception
Progression :
- 0 -> 4 : Forest + Foray ;
- 5 -> 10 : Forest + Foray + Arena ;

24
obj.go
View File

@ -516,9 +516,29 @@ func silentGetObjItemID(c string, n string) int64 {
if v, ok := cacheObjItem.Load(c); ok {
i := v.(ChatWarsItem)
return i.ObjID64
} else {
return 0
}
if v, ok := cacheObjItem.Load(n); ok {
i := v.(ChatWarsItem)
return i.ObjID64
}
if ok, _ := regexp.MatchString(`u[0-9]+`, c); ok {
r := regexp.MustCompile(`(?P<Modifier>⚡\+[0-9]+) (?P<BaseName>[a-zA-Z ]+)`)
n2 := r.ReplaceAllString(n, "${BaseName}")
if v, ok := cacheObjItem.Load(n2); ok {
i := v.(ChatWarsItem)
return i.ObjID64
}
}
if len(c) == 0 {
r := regexp.MustCompile(`(?P<Modifier>⚡\+[0-9]+) (?P<BaseName>[a-zA-Z ]+)`)
n2 := r.ReplaceAllString(n, "${BaseName}")
if v, ok := cacheObjItem.Load(n2); ok {
i := v.(ChatWarsItem)
return i.ObjID64
}
}
return 0
}
func loadObjItem() error {