Advertisement
lilig

Chanter 0.0.1-poc

May 13th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.01 KB | None | 0 0
  1. _addon.name = 'Chanter'
  2. _addon.author = 'Lili'
  3. _addon.version = '0.0.1'
  4. _addon.command = 'chanter'
  5.  
  6. --[[
  7.  
  8. Select a target, do //chanter, and it will tell you what bonuses you are getting at what strength.
  9.  
  10. Cardinal Chant bonuses have 8 tiers. You can calculate specific value with
  11. floor(max value * tier / 8)
  12.  
  13. At lvl99 GEO has Cardinal Chant IV, with these maximum values for each bonus:
  14. Bonus           Normal Spells   -ra Spells  Direction
  15. Magic Attack        +13             +17     East
  16. Magic Accuracy      +13             +17     South
  17. Magic Burst Bonus   +22             +28     West
  18. Magic Crit. Rate    +11             +16     North
  19.  
  20. ]]
  21.  
  22. bonus = { N = 'Magic Crit. Chance', S = 'Magic Accuracy',W = 'Magic Burst Bonus', E = 'Magic Attack Bonus', }
  23.  
  24. windower.register_event('addon command',function(angle, dist)
  25.     local t = windower.ffxi.get_mob_by_target('t')
  26.    
  27.     if not t then
  28.         windower.add_to_chat(123,'Please select a target.')
  29.         return
  30.     end
  31.    
  32.     --local me = windower.ffxi.get_mob_by_target('me')    
  33.     local h = get_heading_to(t.x,t.y)
  34.    
  35.     local chant = heading_to_nswe(h)
  36.    
  37.     local msg = ''
  38.     for d,v in pairs(chant) do
  39.         if v > 0 then
  40.             msg = msg .. bonus[d] ..' ['..v..'/8] '
  41.         end
  42.     end
  43.    
  44.     windower.add_to_chat(80,msg)
  45. end)
  46.  
  47. function get_heading_to(x,y) --
  48.     local me = windower.ffxi.get_mob_by_target('me')
  49.     local x = x - me.x
  50.     local y = y - me.y
  51.     local h = math.atan2(x,y)
  52.     return h
  53.     --return h - math.pi/2 -- <- change the above line to this one if you want to use this function together with windower.ffxi.turn()
  54. end
  55.  
  56. function heading_to_nswe(heading)
  57.     if not heading then return end
  58.    
  59.     local compass = {N=0,S=0,W=0,E=0}
  60.    
  61.     -- vertical and horizontal half planes
  62.     local px = 'N'
  63.     local py = heading <= 0 and 'W' or 'E'
  64.    
  65.     heading = math.abs(heading) -- get rid of sign
  66.  
  67.     if heading > math.pi/2 then
  68.         heading = math.pi - heading -- flip!
  69.         px = 'S'
  70.     end
  71.    
  72.     local slice = math.floor( (heading+math.pi/32) / (math.pi/16) ) -- 1-8
  73.    
  74.     compass[py] = slice
  75.     compass[px] = 8-slice
  76.  
  77.     return(compass)
  78. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement