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

master
Joshua Sigona 5 years ago
parent 3047c3e072
commit 2dc9413ee0
  1. 180
      autocraft.ahk
  2. BIN
      autocraft.exe

@ -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: TricksOfTheTrade(CP)
if ((IsGood() or IsExcellent()) and CP > 160) { WasteNot(STEP,CP,DURABILITY)
send, {2} Case 3:
ProgressStep(STEP,CP,18) if (DURABILITY > 10) {
if (IsGood() or IsExcellent()) {
BasicTouch(STEP,CP,DURABILITY)
} else {
HastyTouch(STEP,CP,DURABILITY)
}
STEP := 3
} else { } else {
PressKeyWithModifier("Ctrl","3") STEP := STEP + 1
ProgressStep(STEP,CP,0)
} }
Case 8: Case 4:
if (CP >= 176) { TricksOfTheTrade(CP)
ACTIVATESIDESTEP := true MastersMend(STEP,CP,DURABILITY,0)
SIDESTEPS = 0 if (IsExcellent()) {
BasicTouch(STEP,CP,DURABILITY,0)
} }
TricksOfTheTrade(CP) TricksOfTheTrade(CP)
send, {3} WasteNot(STEP,CP,DURABILITY,0)
ProgressStep(STEP,CP,88) if (IsExcellent()) {
;sleep, 2000 BasicTouch(STEP,CP,DURABILITY,0)
Case 9: }
TricksOfTheTrade(CP) TricksOfTheTrade(CP)
if (ACTIVATESIDESTEP) { if (!Innovation(STEP,CP,DURABILITY)) {
Stdout("SIDESTEP " . SIDESTEPS) RECIPEDONE := true
SIDESTEPS := SIDESTEPS+1 ;1 STEP := FINALSTEP+1
PressKeyWithModifier("Ctrl","3") Stdout("Something went wrong! Could not perform Innovation!")
ProgressStep(STEP,CP,0)
} else {
send, {4}
ProgressStep(STEP,CP,18)
} }
Case 10, 11, 12: Case 5:
if (ACTIVATESIDESTEP) { if (DURABILITY > 10) {
Stdout("SIDESTEP " . SIDESTEPS) if (IsExcellent() or IsGood()) {
if (SIDESTEPS >= 2) { BasicTouch(STEP,CP,DURABILITY)
ACTIVATESIDESTEP := false
if (CP >= 194) {
send, {2}
ProgressStep(STEP,CP,18)
} else {
PressKeyWithModifier("Ctrl","3")
ProgressStep(STEP,CP,0)
}
STEP = 8
} else {
SIDESTEPS := SIDESTEPS+1 ;2,3
PressKeyWithModifier("Ctrl","3")
ProgressStep(STEP,CP,0)
}
} else
{
if (CP > 54) {
PressKeyWithModifier("Shift","2")
ProgressStep(STEP,CP,32)
} else } else
if (CP >= 18) {
send, {2}
ProgressStep(STEP,CP,18)
} 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.
Loading…
Cancel
Save