From 977f65828d83a924ca3310b6d689b3afe6956d7c Mon Sep 17 00:00:00 2001 From: shoopea Date: Mon, 3 Jun 2019 16:31:28 +0800 Subject: [PATCH] test --- README.md | 4 +++- obj.go | 24 ++++++++++++++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2acc201..65d4980 100644 --- a/README.md +++ b/README.md @@ -14,4 +14,6 @@ ChirpNestBot - [ ] Experience graphs & forecast - [ ] Impersonate - [x] Foray interception - \ No newline at end of file +Progression : + - 0 -> 4 : Forest + Foray ; + - 5 -> 10 : Forest + Foray + Arena ; \ No newline at end of file diff --git a/obj.go b/obj.go index dedebc7..80a9b16 100644 --- a/obj.go +++ b/obj.go @@ -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⚡\+[0-9]+) (?P[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⚡\+[0-9]+) (?P[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 {