Added error handling for when world map return crazy 4k+ dimensions
adein [05-23-14 - 21:31]
Added error handling for when world map return crazy 4k+ dimensions
diff --git a/RangeReticle.lua b/RangeReticle.lua
index 0dc5035..0255738 100755
--- a/RangeReticle.lua
+++ b/RangeReticle.lua
@@ -5,7 +5,7 @@ local hostileOORColorHex, hostileIRColorHex, hostileIMRColorHex
local alliesOORColorHex, alliesIRColorHex, alliesIMRColorHex
local neutralOORColorHex, neutralIRColorHex, neutralIMRColorHex
local npcsOORColorHex, npcsIRColorHex, npcsIMRColorHex
-
+local previousDimensionsX, previousDimensionsY
-- Defaults for settings
local defaults = {
@@ -122,7 +122,10 @@ local function AddonSetup()
npcsIRColorHex = RGBPercToHex(db.npcsOORColor.r,db.npcsOORColor.g,db.npcsOORColor.b)
npcsOORColorHex = RGBPercToHex(db.npcsIRColor.r,db.npcsIRColor.g,db.npcsIRColor.b)
- npcsIMRColorHex = RGBPercToHex(db.npcsIMRColor.r,db.npcsIMRColor.g,db.npcsIMRColor.b)
+ npcsIMRColorHex = RGBPercToHex(db.npcsIMRColor.r,db.npcsIMRColor.g,db.npcsIMRColor.b)
+
+ previousDimensionsX = 10000
+ previousDimensionsY = 10000
end
@@ -661,6 +664,25 @@ function OnRangeUpdate()
elseif mapType == MAPTYPE_ZONE then
end
end
+
+ if dimensionsX <= 2000 then
+ previousDimensionsX = dimensionsX
+ elseif previousDimensionsX <= 2000 then
+ dimensionsX = previousDimensionsX
+ end
+ if dimensionsY <= 2000 then
+ previousDimensionsY = dimensionsY
+ elseif previousDimensionsY <= 2000 then
+ dimensionsY = previousDimensionsY
+ end
+
+ if dimensionsX > 2000 or dimensionsY > 2000 then
+ local X, Y = ZO_WorldMapContainer:GetDimensions()
+ local X1, Y1 = ZO_WorldMapContainer1:GetDimensions()
+ dimensionsX = math.min(X, X1)
+ dimensionsY = math.min(Y, Y1)
+ end
+
local actualSelfX = selfX * dimensionsX
local actualSelfY = selfY * dimensionsY
local actualTargetX = targetX * dimensionsX
@@ -683,6 +705,8 @@ function OnRangeUpdate()
RangeReticleRange:SetText(tostring(distance) .. 'm')
elseif rangeEnabled then
RangeReticleRange:SetText('e')
+ CHAT_SYSTEM:AddMessage("Dimensions: " .. tostring(dimensionsX) .. ', ' .. tostring(dimensionsY))
+ CHAT_SYSTEM:AddMessage("Multiplier: " .. tostring(multiplier))
end
end
end