Quantcast

fix dungeon check for new weekly best runs

Jesse Manelius [01-28-19 - 16:09]
fix dungeon check for new weekly best runs
add "/iks c x" slash cmd in case addon missed your weekly run for some reason and wow api doesn't return anything (chances for that are currently high)
Filename
iKeystones.lua
iKeystones.toc
diff --git a/iKeystones.lua b/iKeystones.lua
index 84d96a5..b24c900 100644
--- a/iKeystones.lua
+++ b/iKeystones.lua
@@ -271,15 +271,17 @@ end
 --end
 local validDungeons
 local function IsValidDungeon(dungeonID)
+	dungeonID = tonumber(dungeonID)
+	if not dungeonID then return end
 	if not validDungeons then
+		validDungeons = {}
 		C_MythicPlus.RequestMapInfo()
-		validDungeons = C_ChallengeMode.GetMapTable()
-	end
-	if validDungeons[dungeonID] then
-		return true
-	else
-		return false
+		local t = C_ChallengeMode.GetMapTable()
+		for _,v in pairs(t) do
+			validDungeons[v] = true
+		end
 	end
+	return validDungeons[dungeonID]
 end
 function iKS:scanCharacterMaps()
 	if not iKS:createPlayer() then return end
@@ -459,7 +461,7 @@ function addon:PLAYER_LOGIN()
 	player = UnitGUID('player')
 	C_MythicPlus.RequestCurrentAffixes()
 	C_MythicPlus.RequestMapInfo()
-    C_MythicPlus.RequestRewards()
+  C_MythicPlus.RequestRewards()
 	GarrisonLandingPageMinimapButton:HookScript('OnEnter', function()
 		if IsShiftKeyDown() then
 			iKS:createMainWindow()
@@ -1047,6 +1049,13 @@ SlashCmdList["IKEYSTONES"] = function(msg)
 			print('iKS: This character is now whitelisted.')
 		elseif msg == 'help' or msg == 'h' then
 			iKS:help()
+		elseif msg:match('^completed (%d+)$') or msg:match('^c (%d+)$') then
+			local level = msg:match('^completed (%d+)$')
+			if not level then
+				level = msg:match('^c (%d+)$')
+			end
+			if not iKS:createPlayer() then return end
+			iKeystonesDB[player].maxCompleted = tonumber(level)
 		elseif msg:match('delete') or msg:match('d') then
 			local _,char,server = msg:match("^(.-) (.-) (.*)$")
 			if not (char and server) then
diff --git a/iKeystones.toc b/iKeystones.toc
index 3850952..a3e677b 100644
--- a/iKeystones.toc
+++ b/iKeystones.toc
@@ -2,7 +2,7 @@
 ## Title: iKeystones
 ## Notes: Tracks your keystones
 ## Author: Ironi
-## Version: 1.720
+## Version: 1.721
 ## DefaultState: enabled

 ## SavedVariables: iKeystonesDB, iKeystonesConfig