Remove scanning for role/soul change abilities and count the roles in Inspect.Role.List.

Mere [07-30-13 - 21:22]
Remove scanning for role/soul change abilities and count the roles in Inspect.Role.List.

Might fix the performance warning from: ScanAvailableSpecs

I suspect not, as I don't see it suggesting someone with a slow computer (in which case it's probably also slow creating the config UI)
Filename
ConfigUI_SoulSpecsTab.lua
RiftAddon.toc
diff --git a/ConfigUI_SoulSpecsTab.lua b/ConfigUI_SoulSpecsTab.lua
index 5098bb4..b5c874b 100644
--- a/ConfigUI_SoulSpecsTab.lua
+++ b/ConfigUI_SoulSpecsTab.lua
@@ -13,7 +13,6 @@ MereHealingFrames.Config.UI.SoulSpecsTab = {
 	}

 local MaxSoulSpecs = MereHealingFrames.StaticGlobals.numberOfSoulSpecs
-local ChangeRoleAbility = "A2DEBC0F3EAB4AA48"

 function MereHealingFrames.Config.UI.SoulSpecsTab:new ()
 	local this = {}
@@ -41,29 +40,18 @@ end

 -- TODO this should really live in a utility function somewhere
 function MereHealingFrames.Config.UI.ScanAvailableSpecs()
-	local abilityDetail = Inspect.Ability.New.Detail(ChangeRoleAbility)
+	local roleList = Inspect.Role.List()

-	if not abilityDetail then
-		MereHealingFrames.Debug(1, "Didn't find ability %s, perhaps no roles have been purchased, using one role (let me know if this is wrong)", ChangeRoleAbility)
-		return 1
-	end
-
-	local availableSpecs = 0
-	local abilityIds = Inspect.Ability.New.List()
-	local abilityDetails = Inspect.Ability.New.Detail(abilityIds)
-	for id, details in pairs(abilityDetails) do
-		if details.name == abilityDetail.name then
-			MereHealingFrames.Debug(1, "Found %s, id: %s", details.name, id)
-			availableSpecs = availableSpecs + 1
-		end
-	end
-
-	if availableSpecs == 0 then
-		MereHealingFrames.Debug(1, "Didn't find any abilities called %s, which is odd, assuming %d specs.", abilityDetail.name, MaxSoulSpecs)
-		return MaxSoulSpecs
-	end
-
-	return availableSpecs
+    if (roleList == nil) then
+        return 1
+    end
+
+    local roleCounter = 0
+    for id, name in pairs(roleList) do
+        roleCounter = roleCounter + 1
+    end
+    MereHealingFrames.Debug(1, "Found %d specs.", roleCounter)
+    return roleCounter
 end

 function MereHealingFrames.Config.UI.SoulSpecsTab:CreateUI(parentFrame)
diff --git a/RiftAddon.toc b/RiftAddon.toc
index 205ad96..8777699 100644
--- a/RiftAddon.toc
+++ b/RiftAddon.toc
@@ -7,7 +7,7 @@ Name = "Mere Healing Frames"
 NameShort = "MHF"
 Description = "A set of healing frames"
 Author = "Mere"
-Version = "0.4.32"
+Version = "0.4.33"
 Email = "rift@dokein.co.uk"
 Environment = "2.3"