Skip to content

Commit

Permalink
fix(biohash): some fixes to the recent biohash changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Torwent committed Dec 17, 2024
1 parent 2362825 commit 7de69c6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion optional/handlers/combathandler.simba
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ begin
end;
end;

procedure TRSCombatHandler.Setup(npc: TRSNPCV2; timer: Int64 = 4000; safeSpotTile: TPoint = [-1, -1]);
procedure TRSCombatHandler.Setup(npc: TRSNPCV2; timer: Int64 = 4000; safeSpotTile: TPoint = [-1, -1]);
var
eConsumable: ERSConsumable;
begin
Expand Down
2 changes: 1 addition & 1 deletion utils/biometrics.simba
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ begin
begin
if (Length(Login.Players) = 0) or (BioHash <> 0) then
begin
BioHash := Random($FFFFFFFF) / $FFFFFFFF;
BioHash := Random($FFFFFFFF) * 0.111111111111111;
DebugLn('Temporary Biohash: ' + ToStr(BioHash));
Exit;
end;
Expand Down
17 changes: 11 additions & 6 deletions utils/math.simba
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,23 @@ end;
*)
function Double.GetDigit(n: Int32): Int32;
var
s: String;
i: Int32;
str: String;
begin
s := ToStr(Self).Replace('.', '');
Result := StrToInt(s[Max(n+1, Length(s))]);
str := ToStr(Self).Replace('.', '');
if Length(str) = 0 then Exit;
if not InRange(Inc(n), 1, Length(str)) then Exit;
Result := StrToInt(str[n]);
end;

function Double.GetDigit(n: Int64): Int64; overload;
var
s: String;
str: String;
begin
s := ToStr(Self).Replace('.', '');
Result := StrToInt64(s[Max(n+1, Length(s))]);
str := ToStr(Self).Replace('.', '');
if Length(str) = 0 then Exit;
if not InRange(Inc(n), 1, Length(str)) then Exit;
Result := StrToInt64(str[n]);
end;

(*
Expand Down

0 comments on commit 7de69c6

Please sign in to comment.