Skip to content

Commit

Permalink
Fix Random Function (#241)
Browse files Browse the repository at this point in the history
* [fix] use RandomNumberGenerator

* [fix] version up
  • Loading branch information
Garume authored Dec 19, 2024
1 parent 49fc62d commit 6329ae8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Security.Cryptography;
using Dalamud.Game.ClientState.Objects.SubKinds;
using Dalamud.Game.ClientState.Objects.Types;
using Dalamud.Game.ClientState.Statuses;
Expand Down Expand Up @@ -74,7 +75,7 @@ public enum Mode
private State _state = State.None;

public override HashSet<uint>? ValidTerritories => [1238];
public override Metadata? Metadata => new(8, "Garume");
public override Metadata? Metadata => new(9, "Garume");

private Config C => Controller.GetConfig<Config>();

Expand Down Expand Up @@ -168,7 +169,7 @@ public override void OnGainBuffEffect(uint sourceId, Status Status)
var myKindFire = GetKindFire(Player.Status);
var random = 0;
if (C.ShouldUseRandomWait)
random = new Random().Next((int)(C.WaitRange.X * 1000), (int)(C.WaitRange.Y * 1000));
random = RandomNumberGenerator.GetInt32((int)(C.WaitRange.X * 1000), (int)(C.WaitRange.Y * 1000));
Controller.Schedule(() =>
{
switch (myKindFire)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Security.Cryptography;
using Dalamud.Game.ClientState.Conditions;
using Dalamud.Game.ClientState.Objects.SubKinds;
using Dalamud.Game.ClientState.Objects.Types;
Expand Down Expand Up @@ -85,7 +86,7 @@ private IPlayerCharacter BasePlayer
private bool IsActive => Svc.Objects.Any(x => x.DataId == 17837) && !BasePlayer.IsDead;

public override HashSet<uint>? ValidTerritories => [1238];
public override Metadata? Metadata => new(6, "Garume, NightmareXIV");
public override Metadata? Metadata => new(7, "Garume, NightmareXIV");

private Config C => Controller.GetConfig<Config>();

Expand Down Expand Up @@ -255,7 +256,7 @@ public override void OnGainBuffEffect(uint sourceId, Status Status)
{
var random = 0;
if (C.ShouldUseRandomWait)
random = new Random().Next((int)(C.WaitRange.X * 1000), (int)(C.WaitRange.Y * 1000));
random = RandomNumberGenerator.GetInt32((int)(C.WaitRange.X * 1000), (int)(C.WaitRange.Y * 1000));
Controller.Schedule(() => { Chat.Instance.ExecuteCommand(C.CommandWhenBlueDebuff); }, random);
}

Expand Down

0 comments on commit 6329ae8

Please sign in to comment.