Advertisement
Guest User

SAT - SendAllTarget.lua

a guest
Feb 15th, 2022
757
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.41 KB | None | 0 0
  1. local packets = require('packets')
  2. require('strings')
  3.  
  4. _addon.name = 'SendAllTarget'
  5. _addon.version = '1.1'
  6. _addon.author = 'Selindrile, Thanks and apologies to Arcon for abusing his code.'
  7. _addon.commands = {'sendalltarget','sendallt','sendat','sat'}
  8.  
  9. windower.register_event('addon command',function (cmd,cmd2,...)
  10. if cmd == nil then return
  11. elseif cmd == 'stop' or cmd == 'unfollow' then
  12. windower.ffxi.run(false)
  13. windower.ffxi.follow()
  14. elseif cmd == 'alltarget' then
  15. local target = windower.ffxi.get_mob_by_target('t')
  16. windower.send_command('send @all sendalltarget target ' .. tostring(target.id))
  17. elseif cmd == 'youtarget' then
  18. local target = windower.ffxi.get_mob_by_target('t')
  19. windower.send_command('send '..cmd2..' sendalltarget target ' .. tostring(target.id))
  20. elseif cmd == 'allattack' then
  21. local target = windower.ffxi.get_mob_by_target('t')
  22. windower.send_command('send @all sendalltarget attack ' .. tostring(target.id))
  23. elseif cmd == 'youattack' then
  24. local target = windower.ffxi.get_mob_by_target('t')
  25. windower.send_command('send '..cmd2..' sendalltarget attack ' .. tostring(target.id))
  26. elseif cmd == 'attack' then
  27. local id = tonumber(cmd2)
  28. local target = windower.ffxi.get_mob_by_id(id)
  29. if target and target.valid_target and target.spawn_type == 16 and math.sqrt(target.distance) <= 30 then
  30. packets.inject(packets.new('outgoing', 0x1a, {
  31. ['Target'] = target.id,
  32. ['Target Index'] = target.index,
  33. ['Category'] = 0x02,
  34. }))
  35. end
  36. elseif cmd == 'target' then
  37. local id = tonumber(cmd2)
  38. local target = windower.ffxi.get_mob_by_id(id)
  39. if not target then
  40. return
  41. end
  42.  
  43. local player = windower.ffxi.get_player()
  44. packets.inject(packets.new('incoming', 0x058, {
  45. ['Player'] = player.id,
  46. ['Target'] = target.id,
  47. ['Player Index'] = player.index,
  48. }))
  49. elseif cmd == 'allcommand' then
  50. local command = ...
  51. local mobid = windower.ffxi.get_mob_by_target('t')
  52. if mobid and mobid.id then
  53. if command == nil then
  54. windower.send_command('send @all '..cmd2..' '..mobid.id..'')
  55. elseif cmd2 then
  56. windower.send_command('send @all '..cmd2..' '..command..' '..mobid.id..'')
  57. end
  58. end
  59. elseif cmd == 'youcommand' then
  60. local command = ...
  61. local mobid = windower.ffxi.get_mob_by_target('t')
  62. if mobid and mobid.id then
  63. windower.send_command('send '..cmd2..' '..command..' '..mobid.id..'')
  64. end
  65. end
  66. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement