test craft
This commit is contained in:
parent
8a1d244d08
commit
ca052bc10c
1
def.go
1
def.go
@ -419,6 +419,7 @@ type JobPayloadGWithdraw struct {
|
|||||||
MsgID64 int64 `json:"msg_id"`
|
MsgID64 int64 `json:"msg_id"`
|
||||||
ChatID64 int64 `json:"chat_id"`
|
ChatID64 int64 `json:"chat_id"`
|
||||||
UserID64 int64 `json:"user_id"`
|
UserID64 int64 `json:"user_id"`
|
||||||
|
VaultJobID64 int64 `json:"vault_job_id"`
|
||||||
Items []JobPayloadGWithdrawItem `json:"items"`
|
Items []JobPayloadGWithdrawItem `json:"items"`
|
||||||
Status int64 `json:"status"`
|
Status int64 `json:"status"`
|
||||||
CleanupMsg []ChatWarsMessage `json:"cleanup_msg"`
|
CleanupMsg []ChatWarsMessage `json:"cleanup_msg"`
|
||||||
|
9
job.go
9
job.go
@ -1803,7 +1803,8 @@ func jobCraftItem(j Job) {
|
|||||||
err = json.Unmarshal(b, &p2)
|
err = json.Unmarshal(b, &p2)
|
||||||
logOnError(err, "jobCraftItem : Unmarshal(p2)")
|
logOnError(err, "jobCraftItem : Unmarshal(p2)")
|
||||||
|
|
||||||
item = getObjItem(p.ObjItemID64)
|
item, err = getObjItem(p.ObjItemID64)
|
||||||
|
logOnError(err, "jobCraftItem : getObjItem")
|
||||||
availableItems = make(map[string]int64)
|
availableItems = make(map[string]int64)
|
||||||
requiredItems = make(map[string]int64)
|
requiredItems = make(map[string]int64)
|
||||||
missingItems = make(map[string]int64)
|
missingItems = make(map[string]int64)
|
||||||
@ -1828,7 +1829,8 @@ func jobCraftItem(j Job) {
|
|||||||
missing, _ := missingItems[code]
|
missing, _ := missingItems[code]
|
||||||
if (ava + craft + missing) < req {
|
if (ava + craft + missing) < req {
|
||||||
update = true
|
update = true
|
||||||
obj := getObjItem(getObjItemID(code, ``))
|
obj, err := getObjItem(getObjItemID(code, ``))
|
||||||
|
logOnError(err, "jobCraftItem : getObjItem")
|
||||||
if obj.Craft != nil {
|
if obj.Craft != nil {
|
||||||
craftItems[code] = req - ava
|
craftItems[code] = req - ava
|
||||||
totalMana = (req - ava) * obj.Craft.Mana
|
totalMana = (req - ava) * obj.Craft.Mana
|
||||||
@ -1844,11 +1846,12 @@ func jobCraftItem(j Job) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Printf("jobCraftItem[%s] : Mana : %d\n", item.Code, totalMana)
|
||||||
for code, req := range requiredItems {
|
for code, req := range requiredItems {
|
||||||
ava, _ := availableItems[code]
|
ava, _ := availableItems[code]
|
||||||
craft, _ := craftItems[code]
|
craft, _ := craftItems[code]
|
||||||
missing, _ := missingItems[code]
|
missing, _ := missingItems[code]
|
||||||
log.Printf("jobCraftItem[%s] : %s - Req : %d / Ava : %d / Craft : %d / Missing : %d\n", item.Code, v.Code, req, ava, craft, missing)
|
log.Printf("jobCraftItem[%s] : %s - Req : %d / Ava : %d / Craft : %d / Missing : %d\n", item.Code, code, req, ava, craft, missing)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* we can finish the job */
|
/* we can finish the job */
|
||||||
|
Loading…
Reference in New Issue
Block a user