File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -29,14 +29,17 @@ local UNKNOWN = UNKNOWN
29
29
local QuestRep = 0
30
30
31
31
local function GetValues (currentStanding , currentReactionThreshold , nextReactionThreshold )
32
+ local current = currentStanding - currentReactionThreshold
32
33
local maximum = nextReactionThreshold - currentReactionThreshold
33
- local current , diff = currentStanding - currentReactionThreshold , maximum
34
34
35
- if diff == 0 then diff = 1 end -- prevent a division by zero
35
+ if maximum < 0 then
36
+ maximum = current -- account for negative maximum
37
+ end
36
38
37
39
if current == maximum then
38
40
return 1 , 1 , 100 , true
39
41
else
42
+ local diff = (maximum ~= 0 and maximum ) or 1 -- prevent a division by zero
40
43
return current , maximum , current / diff * 100
41
44
end
42
45
end
Original file line number Diff line number Diff line change @@ -21,14 +21,17 @@ local STANDING = STANDING
21
21
local UNKNOWN = UNKNOWN
22
22
23
23
local function GetValues (currentStanding , currentReactionThreshold , nextReactionThreshold )
24
+ local current = currentStanding - currentReactionThreshold
24
25
local maximum = nextReactionThreshold - currentReactionThreshold
25
- local current , diff = currentStanding - currentReactionThreshold , maximum
26
26
27
- if diff == 0 then diff = 1 end -- prevent a division by zero
27
+ if maximum < 0 then
28
+ maximum = current -- account for negative maximum
29
+ end
28
30
29
31
if current == maximum then
30
32
return 1 , 1 , 100 , true
31
33
else
34
+ local diff = (maximum ~= 0 and maximum ) or 1 -- prevent a division by zero
32
35
return current , maximum , current / diff * 100
33
36
end
34
37
end
You can’t perform that action at this time.
0 commit comments