Make sure recipes end when max durability/quality is reached.

This commit is contained in:
Joshua Sigona 2020-06-10 23:12:09 +09:00
parent 3047c3e072
commit 2dc9413ee0
2 changed files with 99 additions and 93 deletions

View File

@ -163,9 +163,17 @@ WaitForReady() {
} }
} }
DisplayInfo(step,cp,durability) {
global WASTENOT
DEBUGSTRING := "Step " . step . ": " . cp . "CP, " . durability . " durability"
DEBUGSTRING := DEBUGSTRING . "/ WASTENOT: " . WASTENOT
return DEBUGSTRING
}
CraftingRotationTemplate(ByRef STEP) { CraftingRotationTemplate(ByRef STEP) {
global toggle, CP, RECIPEDONE global toggle, CP, RECIPEDONE
FINALSTEP = 13 FINALSTEP = 13
DURABILITY := 40
loop { loop {
if (IsMaxQuality()) { if (IsMaxQuality()) {
@ -197,7 +205,7 @@ CraftingRotationTemplate(ByRef STEP) {
ProgressStep(STEP,CP,0) ProgressStep(STEP,CP,0)
} }
} }
Stdout("STEP " . STEP . ": " . CP) Stdout(DisplayInfo(STEP,CP,DURABILITY))
} until (STEP >= FINALSTEP + 1 or !toggle) } until (STEP >= FINALSTEP + 1 or !toggle)
} }
@ -227,7 +235,7 @@ QuickerCraftRotation(ByRef STEP) {
send, {1} send, {1}
ProgressStep(STEP,CP,0) ProgressStep(STEP,CP,0)
} }
Stdout("STEP " . STEP . ": " . CP) Stdout(DisplayInfo(STEP,CP,DURABILITY))
} until (STEP >= FINALSTEP + 1 or !toggle) } until (STEP >= FINALSTEP + 1 or !toggle)
} }
@ -274,7 +282,7 @@ QuickCraftRotation(ByRef STEP) {
send, {1} send, {1}
ProgressStep(STEP,CP,0) ProgressStep(STEP,CP,0)
} }
Stdout("STEP " . STEP . ": " . CP) Stdout(DisplayInfo(STEP,CP,DURABILITY))
} until (STEP >= FINALSTEP + 1 or !toggle) } until (STEP >= FINALSTEP + 1 or !toggle)
} }
@ -288,11 +296,11 @@ StrongCraft60(ByRef STEP) {
loop { loop {
if (IsMaxQuality()) { if (IsMaxQuality()) {
STEP := 99
RECIPEDONE := true
Veneration(STEP,CP,DURABILITY,0) Veneration(STEP,CP,DURABILITY,0)
BasicSynthesis(STEP,CP,DURABILITY,0) BasicSynthesis(STEP,CP,DURABILITY,0)
BasicSynthesis(STEP,CP,DURABILITY) BasicSynthesis(STEP,CP,DURABILITY)
STEP := 99
RECIPEDONE := true
} }
Switch STEP Switch STEP
{ {
@ -316,7 +324,7 @@ StrongCraft60(ByRef STEP) {
BasicSynthesis(STEP,CP,DURABILITY) BasicSynthesis(STEP,CP,DURABILITY)
} }
} }
Stdout("STEP " . STEP . ": " . CP) Stdout(DisplayInfo(STEP,CP,DURABILITY))
} until (STEP >= FINALSTEP + 1 or !toggle) } until (STEP >= FINALSTEP + 1 or !toggle)
} }
@ -330,11 +338,11 @@ LongCraft60(ByRef STEP) {
loop { loop {
if (IsMaxQuality()) { if (IsMaxQuality()) {
STEP := 99
RECIPEDONE := true
Veneration(STEP,CP,DURABILITY,0) Veneration(STEP,CP,DURABILITY,0)
BasicSynthesis(STEP,CP,DURABILITY,0) BasicSynthesis(STEP,CP,DURABILITY,0)
BasicSynthesis(STEP,CP,DURABILITY) BasicSynthesis(STEP,CP,DURABILITY)
STEP := 99
RECIPEDONE := true
} }
Switch STEP Switch STEP
{ {
@ -373,16 +381,17 @@ LongCraft60(ByRef STEP) {
STEP := 12 STEP := 12
} }
} }
Stdout("STEP " . STEP . ": " . CP) Stdout(DisplayInfo(STEP,CP,DURABILITY))
} until (STEP >= FINALSTEP + 1 or !toggle) } until (STEP >= FINALSTEP + 1 or !toggle)
} }
CraftingRotation(ByRef STEP) { CraftingRotation(ByRef STEP) {
global toggle, CP, RECIPEDONE global toggle, CP, RECIPEDONE, WASTENOT
FINALSTEP = 13 FINALSTEP = 6
SIDESTEPS = 0 SIDESTEPS = 0
ACTIVATESIDESTEP := false ACTIVATESIDESTEP := false
DURABILITY := 40
loop { loop {
if (IsMaxQuality()) { if (IsMaxQuality()) {
@ -392,93 +401,68 @@ CraftingRotation(ByRef STEP) {
Switch STEP Switch STEP
{ {
Case 1: Case 1:
send, {5} InnerQuiet(STEP,CP,DURABILITY)
ProgressStep(STEP,CP,18)
Case 2: Case 2:
if (IsExcellent()) { if (IsExcellent()) {
send, {2} BasicTouch(STEP,CP,DURABILITY,0)
ProgressStep(STEP,CP,18,2)
WaitForReady()
PressKeyWithModifier("Ctrl","1")
ProgressStep(STEP,CP,56,0)
} else {
TricksOfTheTrade(CP)
PressKeyWithModifier("Ctrl","1")
ProgressStep(STEP,CP,56)
}
Case 3, 4, 5, 6, 7:
if ((IsGood() or IsExcellent()) and CP > 160) {
send, {2}
ProgressStep(STEP,CP,18)
} else {
PressKeyWithModifier("Ctrl","3")
ProgressStep(STEP,CP,0)
}
Case 8:
if (CP >= 176) {
ACTIVATESIDESTEP := true
SIDESTEPS = 0
} }
TricksOfTheTrade(CP) TricksOfTheTrade(CP)
send, {3} WasteNot(STEP,CP,DURABILITY)
ProgressStep(STEP,CP,88) Case 3:
;sleep, 2000 if (DURABILITY > 10) {
Case 9: if (IsGood() or IsExcellent()) {
TricksOfTheTrade(CP) BasicTouch(STEP,CP,DURABILITY)
if (ACTIVATESIDESTEP) {
Stdout("SIDESTEP " . SIDESTEPS)
SIDESTEPS := SIDESTEPS+1 ;1
PressKeyWithModifier("Ctrl","3")
ProgressStep(STEP,CP,0)
} else {
send, {4}
ProgressStep(STEP,CP,18)
}
Case 10, 11, 12:
if (ACTIVATESIDESTEP) {
Stdout("SIDESTEP " . SIDESTEPS)
if (SIDESTEPS >= 2) {
ACTIVATESIDESTEP := false
if (CP >= 194) {
send, {2}
ProgressStep(STEP,CP,18)
} else {
PressKeyWithModifier("Ctrl","3")
ProgressStep(STEP,CP,0)
}
STEP = 8
} else { } else {
SIDESTEPS := SIDESTEPS+1 ;2,3 HastyTouch(STEP,CP,DURABILITY)
PressKeyWithModifier("Ctrl","3")
ProgressStep(STEP,CP,0)
} }
} else STEP := 3
{ } else {
if (CP > 54) { STEP := STEP + 1
PressKeyWithModifier("Shift","2") }
ProgressStep(STEP,CP,32) Case 4:
} else TricksOfTheTrade(CP)
if (CP >= 18) { MastersMend(STEP,CP,DURABILITY,0)
send, {2} if (IsExcellent()) {
ProgressStep(STEP,CP,18) BasicTouch(STEP,CP,DURABILITY,0)
}
TricksOfTheTrade(CP)
WasteNot(STEP,CP,DURABILITY,0)
if (IsExcellent()) {
BasicTouch(STEP,CP,DURABILITY,0)
}
TricksOfTheTrade(CP)
if (!Innovation(STEP,CP,DURABILITY)) {
RECIPEDONE := true
STEP := FINALSTEP+1
Stdout("Something went wrong! Could not perform Innovation!")
}
Case 5:
if (DURABILITY > 10) {
if (IsExcellent() or IsGood()) {
BasicTouch(STEP,CP,DURABILITY)
} else } else
{ {
PressKeyWithModifier("Ctrl","3") if (DURABILITY = 20 and CP >= 18) {
ProgressStep(STEP,CP,0) ChooseBestProgressStep(STEP,CP,DURABILITY)
} else {
HastyTouch(STEP,CP,DURABILITY)
}
} }
STEP := 5
} else {
STEP := STEP + 1
} }
Case 13: Case 6:
send, {1} BasicSynthesis(STEP,CP,DURABILITY)
ProgressStep(STEP,CP,0)
} }
Stdout("STEP " . STEP . ": " . CP) Stdout(DisplayInfo(STEP,CP,DURABILITY))
} until (STEP >= FINALSTEP + 1 or !toggle) } until (STEP >= FINALSTEP + 1 or !toggle)
} }
SkillTemplate(ByRef STEP,ByRef CP,ByRef DURABILITY,stepcount=1) { ;Optionally remove DURABILITY IF NOT REQUIRED. SkillTemplate(ByRef STEP,ByRef CP,ByRef DURABILITY,stepcount=1) { ;Optionally remove DURABILITY IF NOT REQUIRED.
CPCOST := 18 ;CP Cost goes here. CPCOST := 18 ;CP Cost goes here.
DURABILITYCOST := ModDurability(0) ;Durability Cost goes inside ModDurability. DURABILITYCOST := ModDurability(0) ;Durability Cost goes inside ModDurability.
if (CP >= CPCOST and DURABILITY >= DURABILITYCOST) { if (CP >= CPCOST and DURABILITY >= DURABILITYCOST) { ;To prevent a touch from destroying an item, change >= to >
send, {5} ;Use PressKeyWithModifier("Ctrl","1") for modifiers. send, {5} ;Use PressKeyWithModifier("Ctrl","1") for modifiers.
ProgressStep(STEP,CP,CPCOST,stepcount) ProgressStep(STEP,CP,CPCOST,stepcount)
DURABILITY := DURABILITY - DURABILITYCOST DURABILITY := DURABILITY - DURABILITYCOST
@ -521,8 +505,8 @@ GreatStrides(ByRef STEP,ByRef CP,ByRef DURABILITY,stepcount=1) {
HastyTouch(ByRef STEP,ByRef CP,ByRef DURABILITY,stepcount=1) { HastyTouch(ByRef STEP,ByRef CP,ByRef DURABILITY,stepcount=1) {
global GREATSTRIDES global GREATSTRIDES
CPCOST := ModDurability(0) ;CP Cost goes here. CPCOST := ModDurability(0) ;CP Cost goes here.
DURABILITYCOST := 10 ;Durability Cost goes here. DURABILITYCOST := ModDurability(10) ;Durability Cost goes here.
if (CP >= CPCOST and DURABILITY >= DURABILITYCOST) { if (CP >= CPCOST and DURABILITY > DURABILITYCOST) {
PressKeyWithModifier("Ctrl","3") ;Use PressKeyWithModifier("Ctrl","1") for modifiers. PressKeyWithModifier("Ctrl","3") ;Use PressKeyWithModifier("Ctrl","1") for modifiers.
ProgressStep(STEP,CP,CPCOST,stepcount) ProgressStep(STEP,CP,CPCOST,stepcount)
DURABILITY := DURABILITY - DURABILITYCOST DURABILITY := DURABILITY - DURABILITYCOST
@ -578,7 +562,7 @@ Observe(ByRef STEP,ByRef CP,ByRef DURABILITY,stepcount=1) {
BrandOfTheElements(ByRef STEP,ByRef CP,ByRef DURABILITY,stepcount=1) { BrandOfTheElements(ByRef STEP,ByRef CP,ByRef DURABILITY,stepcount=1) {
CPCOST := 6 ;CP Cost goes here. CPCOST := 6 ;CP Cost goes here.
DURABILITYCOST := ModDurability(10) ;Durability Cost goes here. DURABILITYCOST := ModDurability(10) ;Durability Cost goes here.
if (CP >= CPCOST and DURABILITY >= DURABILITYCOST) { if (CP >= CPCOST) {
PressKeyWithModifier("Ctrl","X") ;Use PressKeyWithModifier("Ctrl","1") for modifiers. PressKeyWithModifier("Ctrl","X") ;Use PressKeyWithModifier("Ctrl","1") for modifiers.
ProgressStep(STEP,CP,CPCOST,stepcount) ProgressStep(STEP,CP,CPCOST,stepcount)
DURABILITY := DURABILITY - DURABILITYCOST DURABILITY := DURABILITY - DURABILITYCOST
@ -622,7 +606,7 @@ RapidSynthesis(ByRef STEP,ByRef CP,ByRef DURABILITY,stepcount=1) {
global GREATSTRIDES global GREATSTRIDES
CPCOST := 0 ;CP Cost goes here. CPCOST := 0 ;CP Cost goes here.
DURABILITYCOST := ModDurability(10) ;Durability Cost goes here. DURABILITYCOST := ModDurability(10) ;Durability Cost goes here.
if (CP >= CPCOST and DURABILITY >= DURABILITYCOST) { if (CP >= CPCOST) {
PressKeyWithModifier("Shift","4") ;Use PressKeyWithModifier("Ctrl","1") for modifiers. PressKeyWithModifier("Shift","4") ;Use PressKeyWithModifier("Ctrl","1") for modifiers.
ProgressStep(STEP,CP,CPCOST,stepcount) ProgressStep(STEP,CP,CPCOST,stepcount)
DURABILITY := DURABILITY - DURABILITYCOST DURABILITY := DURABILITY - DURABILITYCOST
@ -638,7 +622,7 @@ StandardTouch(ByRef STEP,ByRef CP,ByRef DURABILITY,stepcount=1) {
CPCOST := 18 ;CP Cost goes here. CPCOST := 18 ;CP Cost goes here.
DURABILITYCOST := ModDurability(10) ;Durability Cost goes here. DURABILITYCOST := ModDurability(10) ;Durability Cost goes here.
Stdout(CPCOST . "/" . DURABILITYCOST . "/" . CP . "/" . DURABILITY) Stdout(CPCOST . "/" . DURABILITYCOST . "/" . CP . "/" . DURABILITY)
if (CP >= CPCOST and DURABILITY >= DURABILITYCOST) { if (CP >= CPCOST and DURABILITY > DURABILITYCOST) {
PressKeyWithModifier("Shift","2") ;Use PressKeyWithModifier("Ctrl","1") for modifiers. PressKeyWithModifier("Shift","2") ;Use PressKeyWithModifier("Ctrl","1") for modifiers.
ProgressStep(STEP,CP,CPCOST,stepcount) ProgressStep(STEP,CP,CPCOST,stepcount)
DURABILITY := DURABILITY - DURABILITYCOST DURABILITY := DURABILITY - DURABILITYCOST
@ -653,7 +637,7 @@ BasicTouch(ByRef STEP,ByRef CP,ByRef DURABILITY,stepcount=1) {
global GREATSTRIDES global GREATSTRIDES
CPCOST := 18 ;CP Cost goes here. CPCOST := 18 ;CP Cost goes here.
DURABILITYCOST := ModDurability(10) ;Durability Cost goes here. DURABILITYCOST := ModDurability(10) ;Durability Cost goes here.
if (CP >= CPCOST and DURABILITY >= DURABILITYCOST) { if (CP >= CPCOST and DURABILITY > DURABILITYCOST) {
send, {2} ;Use PressKeyWithModifier("Ctrl","1") for modifiers. send, {2} ;Use PressKeyWithModifier("Ctrl","1") for modifiers.
ProgressStep(STEP,CP,CPCOST,stepcount) ProgressStep(STEP,CP,CPCOST,stepcount)
DURABILITY := DURABILITY - DURABILITYCOST DURABILITY := DURABILITY - DURABILITYCOST
@ -667,7 +651,7 @@ BasicTouch(ByRef STEP,ByRef CP,ByRef DURABILITY,stepcount=1) {
BasicSynthesis(ByRef STEP,ByRef CP,ByRef DURABILITY,stepcount=1) { BasicSynthesis(ByRef STEP,ByRef CP,ByRef DURABILITY,stepcount=1) {
CPCOST := 0 ;CP Cost goes here. CPCOST := 0 ;CP Cost goes here.
DURABILITYCOST := ModDurability(10) ;Durability Cost goes here. DURABILITYCOST := ModDurability(10) ;Durability Cost goes here.
if (CP >= CPCOST and DURABILITY >= DURABILITYCOST) { if (CP >= CPCOST) {
send, {1} ;Use PressKeyWithModifier("Ctrl","1") for modifiers. send, {1} ;Use PressKeyWithModifier("Ctrl","1") for modifiers.
ProgressStep(STEP,CP,CPCOST,stepcount) ProgressStep(STEP,CP,CPCOST,stepcount)
DURABILITY := DURABILITY - DURABILITYCOST DURABILITY := DURABILITY - DURABILITYCOST
@ -699,6 +683,23 @@ WasteNot(ByRef STEP,ByRef CP,ByRef DURABILITY,stepcount=1) {
ProgressStep(STEP,CP,CPCOST,stepcount) ProgressStep(STEP,CP,CPCOST,stepcount)
DURABILITY := DURABILITY - DURABILITYCOST DURABILITY := DURABILITY - DURABILITYCOST
WASTENOT := 4 WASTENOT := 4
Stdout("WASTENOT set to " . WASTENOT)
return true
} else {
return false
}
}
WasteNotII(ByRef STEP,ByRef CP,ByRef DURABILITY,stepcount=1) {
global WASTENOT
CPCOST := 98
DURABILITYCOST := ModDurability(0) ;Durability Cost goes here.
if (CP >= CPCOST and DURABILITY >= DURABILITYCOST) {
PressKeyWithModifier("Ctrl","4")
ProgressStep(STEP,CP,CPCOST,stepcount)
DURABILITY := DURABILITY - DURABILITYCOST
WASTENOT := 8
Stdout("WASTENOT set to " . WASTENOT)
return true return true
} else { } else {
return false return false
@ -708,9 +709,13 @@ WasteNot(ByRef STEP,ByRef CP,ByRef DURABILITY,stepcount=1) {
ModDurability(durability) { ModDurability(durability) {
global WASTENOT global WASTENOT
if (WASTENOT > 0) { if (WASTENOT > 0) {
return durability / 2 DURABILITYCOST := durability / 2
Stdout("WASTENOT is on. " . DURABILITYCOST . " will be used.")
return DURABILITYCOST
} else { } else {
return durability DURABILITYCOST := durability
Stdout("WASTENOT is off. " . DURABILITYCOST . " will be used.")
return DURABILITYCOST
} }
} }
@ -790,6 +795,7 @@ ProgressStep(ByRef step,ByRef cp,cpcost,stepamt=1) {
global WASTENOT, INNOVATION, GREATSTRIDES, VENERATION, NAMEOFTHEELEMENTS, FINALAPPRAISAL, toggle, RECIPEDONE global WASTENOT, INNOVATION, GREATSTRIDES, VENERATION, NAMEOFTHEELEMENTS, FINALAPPRAISAL, toggle, RECIPEDONE
if (WASTENOT > 0) { if (WASTENOT > 0) {
WASTENOT := WASTENOT - 1 WASTENOT := WASTENOT - 1
Stdout("WASTENOT reduced to " . WASTENOT)
} }
if (INNOVATION > 0) { if (INNOVATION > 0) {
INNOVATION := INNOVATION - 1 INNOVATION := INNOVATION - 1

Binary file not shown.