Code: Select all
//v1.1
const CASTING_DELAY = "1500";
const CONSECRATE_WEAPON = "Consecrus Arma";
const DIVINE_FURY = "Divinum Furis";
const CONSECRATE_WEAPON_DURATION = "9000";
const DIVINE_FURY_DURATION = "20000";
const STAMINA_THRESHOLD = 0.2;
const SCRIPT_DELAY = "250";
function getDT(prevTime, currTime) {
return currTime - prevTime;
}
function AutoChivalry() {
while (true) {
const now = Orion.Now();
const divineFuryMsg = Orion.InJournal(DIVINE_FURY, "self");
const consecrateWeaponMsg = Orion.InJournal(CONSECRATE_WEAPON, "self");
if (!Player.Dead() && !Player.Hidden()) {
if (
Player.MaxStam() - Player.Stam() >
Player.MaxStam() * STAMINA_THRESHOLD
) {
Orion.Cast("Divine Fury");
Orion.Wait(CASTING_DELAY);
}
if (Player.WarMode()) {
if (
divineFuryMsg == null ||
getDT(divineFuryMsg.Timer(), now) > DIVINE_FURY_DURATION
) {
Orion.Cast("Divine Fury");
Orion.Wait(CASTING_DELAY);
}
}
if (Player.WarMode()) {
if (
consecrateWeaponMsg == null ||
getDT(consecrateWeaponMsg.Timer(), now) >
CONSECRATE_WEAPON_DURATION
) {
Orion.Cast("Consecrate Weapon");
Orion.Wait(CASTING_DELAY);
}
}
}
Orion.Wait(SCRIPT_DELAY);
}
}
Update: Fixed a major flaw where spells weren't being triggered due to other player journal events.
Update: Removed the ability to bypass warmode. Didn't see the point in casting chivalry spells for no reason.
Note: The script currently casts Divine Fury when you're below 80% stamina. Until I sort out the swing speed vs stamina relationship, this will have to be manually adjusted by the user.