Skip to content

Commit

Permalink
fix: read notes
Browse files Browse the repository at this point in the history
- scoped all enums in wasplib. Tested every single script on the website:
  - Community scripts all compile fine except the ones that didn't already prior to this
  - Unrelated to this but I unpublished every script that wasn't compiling prior to this since they are not being maintained anyway (plank maker, jacz sandminer, deets teleporter, reld drift net)
  - Some of my scripts don't compile with the changes but will be updated after this.
- added string casing methods because I like bloat:
  - `String.CamelCase()`
  - `String.SnakeCase()`
  - `String.UpperSnakeCase()`
  - `String.KebabCase()`
  - `String.PascalCase()`
  - `String.SencenceCase()`
  - `String.TitleCase()`
- remade and fixed the lectern interface. It also supports all lecterns now but still is missing the tabs names for the non standard spell tablets
- removed the favour tab from the achievements gametab since the game removed it as well
- added deprecated warning to the agility.graph
  • Loading branch information
Torwent committed Jan 16, 2024
1 parent b197c6f commit d9c460f
Show file tree
Hide file tree
Showing 10 changed files with 445 additions and 95 deletions.
3 changes: 3 additions & 0 deletions osr.simba
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
{$I utils.simba}
{$ENDIF}

{$SCOPEDENUMS ON}

// The following allows individual include files to compile on their own with just having {$I SRL-T/osr.simba}
// Summary: It includes this file until the current file is reached.

Expand Down Expand Up @@ -73,6 +75,7 @@
{$IFNDEF ANDREW_MUSHTREE_INCLUDED} {$I osr/interfaces/mushtree.simba}
{$IFNDEF YOLANDI_WORLDHOPPER_INCLUDED} {$I osr/interfaces/worldhopper.simba}

{$SCOPEDENUMS OFF}

{$ELSE}{$ENDIF}
{$ELSE}{$ENDIF}
Expand Down
4 changes: 2 additions & 2 deletions osr/antiban/antiban.simba
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ end;
procedure TAntiban.RandomAchievementTab();
begin
Self.DebugLn('Random Achievement Tab');
Achievements.OpenTab(ERSAchievementTab(Random(0, Ord(FAVOUR))));
Achievements.OpenTab(ERSAchievementTab(Random(0, Ord(High(ERSAchievementTab)))));
end;

procedure TAntiban.ToggleAchievementTabs();
Expand All @@ -393,7 +393,7 @@ begin
if Self.BioDice(50) then
begin
case Achievements.GetCurrentTab() of
QUESTS, DIARIES:
ERSAchievementTab.QUESTS, ERSAchievementTab.DIARIES:
Achievements.RandomScroll(Achievements.GetScrollPosition() < 50);
end;
end;
Expand Down
26 changes: 13 additions & 13 deletions osr/handlers/combathandler.simba
Original file line number Diff line number Diff line change
Expand Up @@ -955,23 +955,23 @@ var
prayer: ERSPrayer;
activePrayers: ERSPrayerArray;
begin
if CombatHandler.CombatStyle.CombatType = ERSCombatType.COMBAT_UNKNOWN then
if CombatHandler.CombatStyle.CombatType = ERSCombatType.UNKNOWN then
CombatHandler.CombatStyle.GetCombatType;

activePrayers := Self.GetActivePrayers();

case CombatHandler.CombatStyle.CombatType of
COMBAT_RANGED:
ERSCombatType.RANGED:
for prayer in RANGED_PRAYERS do
if activePrayers.Find(prayer) > -1 then
Exit(True);

COMBAT_MELEE:
ERSCombatType.MELEE:
for prayer in MELEE_PRAYERS do
if activePrayers.Find(prayer) > -1 then
Exit(True);

COMBAT_MAGIC:
ERSCombatType.MAGIC:
for prayer in MAGIC_PRAYERS do
if activePrayers.Find(prayer) > -1 then
Exit(True);
Expand All @@ -982,16 +982,16 @@ function TRSPrayer.FixPrayers(): Boolean;
var
i: Int32;
begin
if CombatHandler.CombatStyle.CombatType = ERSCombatType.COMBAT_UNKNOWN then
if CombatHandler.CombatStyle.CombatType = ERSCombatType.UNKNOWN then
CombatHandler.CombatStyle.GetCombatType();

case CombatHandler.CombatStyle.CombatType of
COMBAT_RANGED:
ERSCombatType.RANGED:
for i := 0 to Ord(High(RANGED_PRAYERS)) do
if Self.ActivatePrayer(RANGED_PRAYERS[i]) then
Exit(True);

COMBAT_MELEE:
ERSCombatType.MELEE:
for i := 0 to Ord(High(MELEE_PRAYERS)) do
begin
if i > 1 then
Expand All @@ -1005,7 +1005,7 @@ begin
Exit(True);
end;

COMBAT_MAGIC:
ERSCombatType.MAGIC:
for i := 0 to Ord(High(MAGIC_PRAYERS)) do
if Self.ActivatePrayer(MAGIC_PRAYERS[i]) then
Exit(True);
Expand All @@ -1017,19 +1017,19 @@ function TRSQuickPrayer.SelectBestPrayers(): Boolean;
var
i: Int32;
begin
if CombatHandler.CombatStyle.CombatType = ERSCombatType.COMBAT_UNKNOWN then
if CombatHandler.CombatStyle.CombatType = ERSCombatType.UNKNOWN then
CombatHandler.CombatStyle.GetCombatType();

if not Self.Open() then
Exit;

case CombatHandler.CombatStyle.CombatType of
COMBAT_RANGED:
ERSCombatType.RANGED:
for i := 0 to High(RANGED_PRAYERS) do
if Result := Self.SelectPrayer(RANGED_PRAYERS[i]) then
Break;

COMBAT_MELEE:
ERSCombatType.MELEE:
for i := 0 to High(MELEE_PRAYERS) do
begin
if i > 1 then
Expand All @@ -1043,7 +1043,7 @@ begin
Break;
end;

COMBAT_MAGIC:
ERSCombatType.MAGIC:
for i := 0 to High(MAGIC_PRAYERS) do
if Result := Self.SelectPrayer(MAGIC_PRAYERS[i]) then
Break;
Expand All @@ -1055,7 +1055,7 @@ end;

function TRSMinimap.EnablePrayer(checkPrayers: Boolean): Boolean; overload;
begin
if checkPrayers and (CombatHandler.CombatStyle.CombatType = ERSCombatType.COMBAT_UNKNOWN) then
if checkPrayers and (CombatHandler.CombatStyle.CombatType = ERSCombatType.UNKNOWN) then
CombatHandler.CombatStyle.GetCombatType();

Result := Self.EnablePrayer();
Expand Down
10 changes: 5 additions & 5 deletions osr/interfaces/collectbox.simba
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ begin
Exit;

// black with tolerance for when item is transparent
Result := SRL.CountColor(CTS1(1118740, 35), Self.GetSlotBox(Slot, CHANGE)) > 0;
Result := SRL.CountColor(CTS1(1118740, 35), Self.GetSlotBox(Slot, ERSCollectSlotBoxes.CHANGE)) > 0;
end;

function TRSCollectBox.GetSlotsWithChange(): TIntegerArray;
Expand Down Expand Up @@ -280,7 +280,7 @@ begin
Self.ItemInterface.ClickSlot(slot);

if Self.HasChange(slot) then
Mouse.Click(Self.GetSlotBox(slot, CHANGE), MOUSE_LEFT);
Mouse.Click(Self.GetSlotBox(slot, ERSCollectSlotBoxes.CHANGE), MOUSE_LEFT);

Result := WaitUntil(Self.ItemInterface.SlotEmpty(slot) and not Self.HasChange(slot), SRL.TruncatedGauss(50, 1500), 1000);
end;
Expand All @@ -294,7 +294,7 @@ begin

if Self.HasChange(slot) then
begin
Mouse.Move(Self.GetSlotBox(Slot, CHANGE));
Mouse.Move(Self.GetSlotBox(Slot, ERSCollectSlotBoxes.CHANGE));
if ChooseOption.Open then
ChooseOption.Select('Bank', MOUSE_LEFT);
end;
Expand Down Expand Up @@ -332,15 +332,15 @@ begin
if Self.GetFullSlots = [] then
Exit;

Result := Self.GetButton(COLLECT_INVENTORY).Click;
Result := Self.GetButton(ERSCollectButton.COLLECT_INVENTORY).Click();
end;

function TRSCollectBox.CollectToBank(): Boolean;
begin
if Self.GetFullSlots = [] then
Exit;

Result := Self.GetButton(COLLECT_BANK).Click;
Result := Self.GetButton(ERSCollectButton.COLLECT_BANK).Click();
end;


Expand Down
17 changes: 8 additions & 9 deletions osr/interfaces/gametabs/achievements.simba
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ type
ERSAchievementTab = (
SUMMARY,
QUESTS,
DIARIES,
FAVOUR
DIARIES
);

ERSSummaryButton = (
Expand Down Expand Up @@ -65,12 +64,12 @@ var
tab: ERSAchievementTab;
begin
tab := Self.GetCurrentTab();
if (tab <> QUESTS) and (tab <> DIARIES) then
if (tab <> ERSAchievementTab.QUESTS) and (tab <> ERSAchievementTab.DIARIES) then
Exit;

Result := Self.Bounds();

if tab = QUESTS then
if tab = ERSAchievementTab.QUESTS then
begin
Result.X1 += 9;
Result.Y1 += 51;
Expand Down Expand Up @@ -130,7 +129,7 @@ end;

function TRSAchievements.GetTabs(): TBoxArray;
begin
Result := Grid(4, 1, 41, 19, [5], [Self.X1+2, Self.Y1 + 5]);
Result := Grid(3, 1, 55, 19, [7, 0], [Self.X1+2, Self.Y1 + 5]);
end;

function TRSAchievements.OpenTab(tab: ERSAchievementTab): Boolean;
Expand All @@ -142,12 +141,12 @@ begin

case Self.GetCurrentTab() of
tab: Exit(True);
SUMMARY:
if ((tab = QUESTS) or (tab = DIARIES)) and Antiban.BioDice(EBioBehavior.MOUSE_GRAVITY) then //MOUSE_GRAVITY is not related to this at all but I figure I could use it.
ERSAchievementTab.SUMMARY:
if ((tab = ERSAchievementTab.QUESTS) or (tab = ERSAchievementTab.DIARIES)) and Antiban.BioDice(EBioBehavior.MOUSE_GRAVITY) then //MOUSE_GRAVITY is not related to this at all but I figure I could use it.
begin
case tab of
QUESTS: button := QUESTS_COMPLETED;
DIARIES: button := DIARIES_COMPLETED;
ERSAchievementTab.QUESTS: button := ERSSummaryButton.QUESTS_COMPLETED;
ERSAchievementTab.DIARIES: button := ERSSummaryButton.DIARIES_COMPLETED;
end;

Self.GetButton(button).Click();
Expand Down
14 changes: 7 additions & 7 deletions osr/interfaces/gametabs/combat.simba
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

type
ERSCombatType = (
COMBAT_UNKNOWN,
COMBAT_RANGED,
COMBAT_MELEE,
COMBAT_MAGIC
UNKNOWN,
RANGED,
MELEE,
MAGIC
);

TRSCombatStyle = record
Expand Down Expand Up @@ -60,17 +60,17 @@ begin
begin
if button.FindText(MELEE_ATTACK_STYLES, RS_FONT_PLAIN_11, str) then
begin
Self.CombatType := ERSCombatType.COMBAT_MELEE;
Self.CombatType := ERSCombatType.MELEE;
Exit(Self.CombatType);
end;

if button.FindText(COMBAT_STYLE_RAPID, RS_FONT_PLAIN_11) then
begin
Self.CombatType := ERSCombatType.COMBAT_RANGED;
Self.CombatType := ERSCombatType.RANGED;
Exit(Self.CombatType);
end;
end;

Self.CombatType := ERSCombatType.COMBAT_MAGIC;
Self.CombatType := ERSCombatType.MAGIC;
Result := Self.CombatType;
end;
Loading

0 comments on commit d9c460f

Please sign in to comment.