test unique items

This commit is contained in:
shoopea 2020-06-27 15:35:01 +02:00
parent e15bef0345
commit fe1026a64e
2 changed files with 10 additions and 6 deletions

View File

@ -136,6 +136,10 @@ func getSilentObjItemID(code string, name string) int64 {
return objItems[id].ObjID64 return objItems[id].ObjID64
} }
if ok, _ := regexp.MatchString(`^((u|e)[0-9]+|(a|w)[0-9]+[a-e]{0,1})$`, code); ok || len(code) == 0 { if ok, _ := regexp.MatchString(`^((u|e)[0-9]+|(a|w)[0-9]+[a-e]{0,1})$`, code); ok || len(code) == 0 {
if ok, _ := regexp.MatchString(`^(Mystery|Unidentified) (amulet|ring) lvl.[0-9]+$`); ok {
return objItems[cacheObjItem[`u000`]].ObjID64
}
r := regexp.MustCompile(`^((?P<Modifier>⚡\+[0-9]+) ){0,1}(?P<BaseName>.+?)( \+(?P<Atk>[0-9]+)⚔){0,1}( \+(?P<Def>[0-9]+)🛡){0,1}( \+(?P<Mana>[0-9]+)💧){0,1}$`) r := regexp.MustCompile(`^((?P<Modifier>⚡\+[0-9]+) ){0,1}(?P<BaseName>.+?)( \+(?P<Atk>[0-9]+)⚔){0,1}( \+(?P<Def>[0-9]+)🛡){0,1}( \+(?P<Mana>[0-9]+)💧){0,1}$`)
basename := r.ReplaceAllString(name, "${BaseName}") basename := r.ReplaceAllString(name, "${BaseName}")
if id, ok := cacheObjItem[basename]; ok && len(basename) > 0 { if id, ok := cacheObjItem[basename]; ok && len(basename) > 0 {

View File

@ -621,11 +621,11 @@ func SQLJobWorker() {
for true { for true {
jobs, err := loadCurrentJobs() jobs, err := loadCurrentJobs()
logOnError(err, "SQLJobWorker : loadCurrentJobs") logOnError(err, "SQLJobWorker : loadCurrentJobs")
/*
if len(jobs) > 0 { if len(jobs) > 0 {
log.Printf("SQLJobWorker : %d jobs.\n", len(jobs)) log.Printf("SQLJobWorker : %d jobs.\n", len(jobs))
} }
*/
if err == nil { if err == nil {
for _, j := range jobs { for _, j := range jobs {
JobQueue <- j JobQueue <- j
@ -644,7 +644,7 @@ func JobWorker(id int, jobs <-chan Job) {
//log.Printf("jobWorker[" + strconv.Itoa(id) + "] : Starting.") //log.Printf("jobWorker[" + strconv.Itoa(id) + "] : Starting.")
// FIXME : discard timed out jobs // FIXME : discard timed out jobs
for j := range jobs { for j := range jobs {
log.Printf("JobWorker[%d] : Starting job %d (timeout : %s).\n", id, j.ID64, j.Timeout.Format(time.RFC3339)) //log.Printf("JobWorker[%d] : Starting job %d (timeout : %s).\n", id, j.ID64, j.Timeout.Format(time.RFC3339))
if time.Now().UTC().Before(j.Timeout) { if time.Now().UTC().Before(j.Timeout) {
switch j.JobTypeID64 { switch j.JobTypeID64 {
case cacheObjSubType[`job_rescan_msg`]: case cacheObjSubType[`job_rescan_msg`]: