--- RangeCheck.lua.bak	Mon Jul 02 09:06:37 2007
+++ RangeCheck.lua	Mon Jul 02 19:22:58 2007
@@ -11,19 +11,131 @@
 do
 	local _,class = UnitClass("player")
 	if class == "PRIEST" then
-		distanceCheckFunction = function(unit) return IsSpellInRange(BS["Flash Heal"], unit) == 1 or not UnitIsFriend("player", unit) end
+		distanceCheckFunction = function(unit)
+			if UnitIsFriend("player", unit) == 1 then
+				return IsSpellInRange(BS["Lesser Heal"], unit) == 1
+			else
+				return IsSpellInRange(BS["Smite"], unit) == 1 or IsSpellInRange(BS["Shadow Word: Pain"], unit) == 1
+			end
+		end
 	elseif class == "DRUID" then
-		distanceCheckFunction = function(unit) return IsSpellInRange(BS["Healing Touch"], unit) == 1 or not UnitIsFriend("player", unit) end
+		distanceCheckFunction = function(unit)
+			if UnitIsFriend("player", unit) == 1 then
+				return IsSpellInRange(BS["Healing Touch"], unit) == 1
+			else
+				return IsSpellInRange(BS["Wrath"], unit) == 1 or CheckInteractDistance(unit, 4)
+			end
+		end
 	elseif class == "PALADIN" then
-		distanceCheckFunction = function(unit) return IsSpellInRange(BS["Holy Light"], unit) == 1 or not UnitIsFriend("player", unit) end
+		distanceCheckFunction = function(unit)
+			if UnitIsFriend("player", unit) == 1 then
+				return IsSpellInRange(BS["Holy Light"], unit) == 1
+			else
+				return CheckInteractDistance(unit, 4)
+			end
+		end
+		distanceCheckFunctionLow = function(unit)
+			if UnitIsFriend("player", unit) == 1 then
+				return true
+			else
+				return IsSpellInRange(BS["Judgement"], unit) == 1
+			end
+		end
 	elseif class == "SHAMAN" then
-		distanceCheckFunction = function(unit) return IsSpellInRange(BS["Healing Wave"], unit) == 1 or not UnitIsFriend("player", unit) end
+		distanceCheckFunction = function(unit)
+			if UnitIsFriend("player", unit) == 1 then
+				return IsSpellInRange(BS["Healing Wave"], unit) == 1
+			else
+				return IsSpellInRange(BS["Lightning Bolt"], unit) == 1
+			end
+		end
+		distanceCheckFunctionLow = function(unit)
+			if UnitIsFriend("player", unit) == 1 then
+				return true
+			else
+				-- Earth Shock only available at level 4, so under level we always return true
+				return IsSpellInRange(BS["Earth Shock"], unit) == 1 or UnitLevel("player") < 4
+			end
+		end
 	elseif class == "WARLOCK" then
-		distanceCheckFunction = function(unit) return IsSpellInRange(BS["Corruption"], unit) == 1 or IsSpellInRange(BS["Shadow Bolt"], unit) == 1 or UnitIsFriend("player", unit) end
-		distanceCheckFunctionLow = function(unit) return IsSpellInRange(BS["Fear"], unit) == 1 or UnitIsFriend("player", unit) end
+		distanceCheckFunction = function(unit)
+			if UnitIsFriend("player", unit) == 1 then
+				return CheckInteractDistance(unit, 4)
+			else
+				return IsSpellInRange(BS["Corruption"], unit) == 1 or IsSpellInRange(BS["Shadow Bolt"], unit) == 1
+			end
+		end
+		distanceCheckFunctionLow = function(unit)
+			if UnitIsFriend("player", unit) == 1 then
+				return true
+			else
+				-- Fear only available at level 8, so under level we always return true
+				return IsSpellInRange(BS["Fear"], unit) == 1 or UnitLevel("player") < 8
+			end
+		end
 	elseif class == "MAGE" then
-		distanceCheckFunction = function(unit) return IsSpellInRange(BS["Fireball"], unit) == 1 or UnitIsFriend("player", unit) end
-		distanceCheckFunctionLow = function(unit) return IsSpellInRange(BS["Fire Blast"], unit) == 1 or UnitIsFriend("player", unit) end
+		distanceCheckFunction = function(unit)
+			if UnitIsFriend("player", unit) == 1 then
+				return IsSpellInRange(BS["Arcane Intellect"], unit) == 1
+			else
+				return IsSpellInRange(BS["Fireball"], unit) == 1 or IsSpellInRange(BS["Frostbolt"], unit) == 1
+			end
+		end
+		distanceCheckFunctionLow = function(unit)
+			if UnitIsFriend("player", unit) == 1 then
+				return true
+			else
+				-- Fire Blast only available at level 6, so under level we always return true
+				return IsSpellInRange(BS["Fire Blast"], unit) == 1 or UnitLevel("player") < 6
+			end
+		end
+	elseif class == "HUNTER" then
+		distanceCheckFunction = function(unit)
+			if UnitIsFriend("player", unit) == 1 then
+				return CheckInteractDistance(unit, 4)
+			else
+				return IsSpellInRange(BS["Auto Shot"], unit) == 1 or IsSpellInRange(BS["Wing Clip"], unit) == 1
+			end
+		end
+		distanceCheckFunctionLow = function(unit)
+			if UnitIsFriend("player", unit) == 1 then
+				return true
+			else
+				-- Wing Clip only available at level 12, so under level we always return true
+				return IsSpellInRange(BS["Wing Clip"], unit) == 1 or UnitLevel("player") < 12
+			end
+		end
+	elseif class == "ROGUE" then
+		distanceCheckFunction = function(unit)
+			if UnitIsFriend("player", unit) == 1 then
+				return CheckInteractDistance(unit, 4)
+			else
+				return IsSpellInRange(BS["Throw"], unit) == 1
+			end
+		end
+		distanceCheckFunctionLow = function(unit)
+			if UnitIsFriend("player", unit) == 1 then
+				return true
+			else
+				return IsSpellInRange(BS["Sinister Strike"], unit) == 1
+			end
+		end
+	elseif class == "WARRIOR" then
+		distanceCheckFunction = function(unit)
+			if UnitIsFriend("player", unit) == 1 then
+				return CheckInteractDistance(unit, 4)
+			else
+				return IsSpellInRange(BS["Charge"], unit) == 1 or IsSpellInRange(BS["Rend"], unit) == 1
+			end
+		end
+		distanceCheckFunctionLow = function(unit)
+			if UnitIsFriend("player", unit) == 1 then
+				return true
+			else
+				-- Rend only available at level 4, so under level we always return true
+				return IsSpellInRange(BS["Rend"], unit) == 1 or UnitLevel("player") < 4
+			end
+		end
 	else
 		distanceCheckFunction = function(unit) return CheckInteractDistance(unit, 4) end
 	end
