Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- _addon.name = 'Chanter'
- _addon.author = 'Lili'
- _addon.version = '0.0.1'
- _addon.command = 'chanter'
- --[[
- Select a target, do //chanter, and it will tell you what bonuses you are getting at what strength.
- Cardinal Chant bonuses have 8 tiers. You can calculate specific value with
- floor(max value * tier / 8)
- At lvl99 GEO has Cardinal Chant IV, with these maximum values for each bonus:
- Bonus Normal Spells -ra Spells Direction
- Magic Attack +13 +17 East
- Magic Accuracy +13 +17 South
- Magic Burst Bonus +22 +28 West
- Magic Crit. Rate +11 +16 North
- ]]
- bonus = { N = 'Magic Crit. Chance', S = 'Magic Accuracy',W = 'Magic Burst Bonus', E = 'Magic Attack Bonus', }
- windower.register_event('addon command',function(angle, dist)
- local t = windower.ffxi.get_mob_by_target('t')
- if not t then
- windower.add_to_chat(123,'Please select a target.')
- return
- end
- --local me = windower.ffxi.get_mob_by_target('me')
- local h = get_heading_to(t.x,t.y)
- local chant = heading_to_nswe(h)
- local msg = ''
- for d,v in pairs(chant) do
- if v > 0 then
- msg = msg .. bonus[d] ..' ['..v..'/8] '
- end
- end
- windower.add_to_chat(80,msg)
- end)
- function get_heading_to(x,y) --
- local me = windower.ffxi.get_mob_by_target('me')
- local x = x - me.x
- local y = y - me.y
- local h = math.atan2(x,y)
- return h
- --return h - math.pi/2 -- <- change the above line to this one if you want to use this function together with windower.ffxi.turn()
- end
- function heading_to_nswe(heading)
- if not heading then return end
- local compass = {N=0,S=0,W=0,E=0}
- -- vertical and horizontal half planes
- local px = 'N'
- local py = heading <= 0 and 'W' or 'E'
- heading = math.abs(heading) -- get rid of sign
- if heading > math.pi/2 then
- heading = math.pi - heading -- flip!
- px = 'S'
- end
- local slice = math.floor( (heading+math.pi/32) / (math.pi/16) ) -- 1-8
- compass[py] = slice
- compass[px] = 8-slice
- return(compass)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement