Page 1 of 1

Alternate RangeCheck

Posted: 12 Sep 2017, 16:00
by efiniti
Hi Kaminaris,

I am using your Add-on for a while and always had the problem that the original rangeCheck did not work properly.

So I looked at your helper.lua and tried out a different approach with LibRangeCheck-2.0 which worked for me.

Here is the new coding beginning with line 258 in the helper.lua:
  1. local rc = LibStub("LibRangeCheck-2.0");
  2. function MaxDps:IsSpellInRange(spell, unit)
  3.     unit = unit or 'target';
  4.     local inRange = 0;
  5.     local spellName, spellRank, spellIcon, spellCastingTime, spellMinRange, spellMaxRange, spellID = GetSpellInfo(spell);
  6.  
  7.     local rangeChecker = rc:GetHarmMaxChecker(spellMaxRange);
  8.  
  9.     if rangeChecker(unit) == nil then
  10.         local booktype = 'spell';
  11.         local myIndex = MaxDps:FindSpellInSpellbook(spell)
  12.         if myIndex then
  13.             return IsSpellInRange(myIndex, booktype, unit);
  14.         end
  15.         return inRange;
  16.     elseif rangeChecker(unit) == true then
  17.         inRange = 1;
  18.     end
  19. --  print("Unit ", unit, " in range ? ", inRange);
  20.     return inRange;
  21. end

Additionally I had to add the LibRangeCheck-2.0 ACE-Addon to my Interfaces and added the line:
  1. Libs\LibRangeCheck-2.0\LibRangeCheck-2.0.lua
to the MaxDps.toc file.

To be honest, I am not sure what I am doing since it is the first time editing an add-on or even working with lua.

But it may be helpfull anyways.

Best regards,
EFiNiTi :D