Skip to content

Conversation

@gausie
Copy link
Contributor

@gausie gausie commented Dec 10, 2025

No description provided.

* Create and set a CCS file from a given Macro
* @param macro Macro to set as CSS
*/
export function makeCcs<M extends StrictMacro>(macro: M) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export function makeCcs<M extends StrictMacro>(macro: M) {
export function makeCcs<M extends Macro>(macro: M) {

While the garbo version extends the hotter and cooler StrictMacro class, which we use exclusively, this should probably use the OG

Comment on lines +881 to +892
export function runCombatBy<T>(initiateCombatAction: () => T) {
try {
const result = initiateCombatAction();
while (inMultiFight()) runCombat();
if (choiceFollowsFight()) visitUrl("choice.php");
return result;
} catch (e) {
throw `Combat exception! Last macro error: ${get(
"lastMacroError",
)}. Exception ${e}.`;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export function runCombatBy<T>(initiateCombatAction: () => T) {
try {
const result = initiateCombatAction();
while (inMultiFight()) runCombat();
if (choiceFollowsFight()) visitUrl("choice.php");
return result;
} catch (e) {
throw `Combat exception! Last macro error: ${get(
"lastMacroError",
)}. Exception ${e}.`;
}
}
export function runCombatBy<T>(initiateCombatAction: () => T, ...combatParams: CombatParams) {
try {
const result = initiateCombatAction();
while (inMultiFight()) runCombat(...combatParams);
if (choiceFollowsFight()) visitUrl("choice.php");
return result;
} catch (e) {
throw `Combat exception! Last macro error: ${get(
"lastMacroError",
)}. Exception ${e}.`;
}
}

Comment on lines +927 to +932
if (macroOrAction instanceof Macro || actionOrTryAuto === true) {
macro.setAutoAttack();
}

// Make a CCS of the macro or, if we have two, the second macro.
makeCcs(macroOrAction instanceof Macro ? macroOrAction : macro);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The overloads bamboozled me a little bit but I trust TS that this is correct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants