test craft all
This commit is contained in:
parent
8112df10c0
commit
87278e293d
42
job.go
42
job.go
@ -1935,12 +1935,12 @@ func jobCraftItem(j Job) {
|
||||
|
||||
func jobCraftAll(j Job) {
|
||||
var (
|
||||
p JobPayloadCraftAll
|
||||
p2 JobPayloadGetVault
|
||||
b []byte
|
||||
requiredItems map[string]int64
|
||||
missingItems map[string]int64
|
||||
availableItems map[string]int64
|
||||
p JobPayloadCraftAll
|
||||
p2 JobPayloadGetVault
|
||||
b []byte
|
||||
partsItems map[int64]string
|
||||
recipesItems map[int64]string
|
||||
ratioItems map[string]int64
|
||||
)
|
||||
|
||||
err := setJobStart(j.ID64)
|
||||
@ -1977,19 +1977,31 @@ func jobCraftAll(j Job) {
|
||||
err = json.Unmarshal(b, &p2)
|
||||
logOnError(err, "jobCraftAll : Unmarshal(p2)")
|
||||
|
||||
availableItems = make(map[string]int64)
|
||||
requiredItems = make(map[string]int64)
|
||||
missingItems = make(map[string]int64)
|
||||
partsItems = make(map[string]int64)
|
||||
recipesItems = make(map[string]int64)
|
||||
ratioItems = make(map[string]int64)
|
||||
|
||||
muxObjItem.RLock()
|
||||
defer muxObjItem.RUnlock()
|
||||
for _, v := range objItems {
|
||||
if v.ItemTypeID == cacheObjSubType[`item_other`] {
|
||||
availableItems[v.Code] = 0
|
||||
requiredItems[v.Code] = 0
|
||||
missingItems[v.Code] = 0
|
||||
for _, o := range objItems {
|
||||
if o.ItemTypeID == cacheObjSubType[`item_other`] {
|
||||
if o.Craftable && o.Craft != nil {
|
||||
for _, i := range o.Craft.Items {
|
||||
p, _ := getObjItem(i.ItemID64)
|
||||
if p.ItemTypeID == cacheObjSubType[`item_part`] {
|
||||
ratioItems[o.Code] = i.Quantity
|
||||
partsItems[p.ObjID64] = o.Code
|
||||
} else if p.ItemTypeID == cacheObjSubType[`item_recipe`] {
|
||||
recipesItems[p.ObjID64] = o.Code
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
muxObjItem.RUnlock()
|
||||
|
||||
for _, i := range p2.Vault {
|
||||
|
||||
}
|
||||
|
||||
/* we can finish the job */
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user