Advertisement
Guest User

Cor Gearswap

a guest
Jul 12th, 2014
312
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 22.82 KB | None | 0 0
  1. -------------------------------------------------------------------------------------------------------------------
  2. -- Initialization function that defines sets and variables to be used.
  3. -------------------------------------------------------------------------------------------------------------------
  4.  
  5. -- IMPORTANT: Make sure to also get the Mote-Include.lua file to go with this.
  6.  
  7. --[[
  8. gs c toggle luzaf -- Toggles use of Luzaf Ring on and off
  9. Offense mode is melee or ranged. Used ranged offense mode if you are engaged
  10. for ranged weaponskills, but not actually meleeing.
  11. Acc on offense mode (which is intended for melee) will currently use .Acc weaponskill
  12. mode for both melee and ranged weaponskills. Need to fix that in core.
  13. --]]
  14.  
  15.  
  16. -- Initialization function for this job file.
  17. function get_sets()
  18. -- Load and initialize the include file.
  19. include('Mote-Include.lua')
  20. end
  21.  
  22. -- Setup vars that are user-independent.
  23. function job_setup()
  24. -- Whether to use Luzaf's Ring
  25. state.LuzafRing = true
  26. -- Whether a warning has been given for low ammo
  27. state.warned = false
  28.  
  29. define_roll_values()
  30. end
  31.  
  32.  
  33. -- Setup vars that are user-dependent. Can override this function in a sidecar file.
  34. function user_setup()
  35. -- Options: Override default values
  36. options.OffenseModes = {'Ranged', 'Melee', 'Acc'}
  37. options.RangedModes = {'Normal', 'Acc'}
  38. options.WeaponskillModes = {'Normal', 'Acc', 'Att', 'Mod'}
  39. options.CastingModes = {'Normal', 'Resistant'}
  40. options.IdleModes = {'Normal'}
  41. options.RestingModes = {'Normal'}
  42. options.PhysicalDefenseModes = {'PDT'}
  43. options.MagicalDefenseModes = {'MDT'}
  44.  
  45. state.Defense.PhysicalMode = 'PDT'
  46.  
  47. gear.RAbullet = "Adlivun Bullet"
  48. gear.WSbullet = "Adlivun Bullet"
  49. gear.MAbullet = "Animikii Bullet"
  50. gear.QDbullet = "Adlivun Bullet"
  51. options.ammo_warning_limit = 15
  52.  
  53. -- Additional local binds
  54. -- Cor doesn't use hybrid defense mode; using that for ranged mode adjustments.
  55. send_command('bind ^f9 gs c cycle RangedMode')
  56.  
  57. send_command('bind ^` input /ja "Double-up" <me>')
  58. send_command('bind !` input /ja "Bolter\'s Roll" <me>')
  59.  
  60.  
  61. select_default_macro_book()
  62. end
  63.  
  64.  
  65. -- Called when this job file is unloaded (eg: job change)
  66. function job_file_unload()
  67. send_command('unbind ^`')
  68. send_command('unbind !`')
  69. end
  70.  
  71. -- Define sets and vars used by this job file.
  72. function init_gear_sets()
  73. --------------------------------------
  74. -- Start defining the sets
  75. --------------------------------------
  76.  
  77. -- Precast Sets
  78.  
  79. -- Precast sets to enhance JAs
  80.  
  81. sets.precast.JA['Triple Shot'] = {body="Navarch's Frac +2"}
  82. sets.precast.JA['Snake Eye'] = {legs="Lanun Culottes +1"}
  83. sets.precast.JA['Wild Card'] = {feet="Lanun Bottes +1"}
  84. sets.precast.JA['Random Deal'] = {body="Lanun Frac +1"}
  85.  
  86.  
  87. sets.precast.CorsairRoll = {head="Lanun Tricorne +1",hands="Navarch's Gants +2",ring1="Barataria Ring",Legs="Desultor Tassets"}
  88. sets.precast.CorsairRoll["Caster's Roll"] = set_combine(sets.precast.CorsairRoll, {legs="Navarch's Culottes +2"})
  89. sets.precast.CorsairRoll["Courser's Roll"] = set_combine(sets.precast.CorsairRoll, {feet="Navarch's Bottes +2"})
  90. sets.precast.CorsairRoll["Blitzer's Roll"] = set_combine(sets.precast.CorsairRoll, {head="Navarch's Tricorne +2"})
  91. sets.precast.CorsairRoll["Tactician's Roll"] = set_combine(sets.precast.CorsairRoll, {body="Navarch's Frac +2"})
  92. sets.precast.CorsairRoll["Allies' Roll"] = set_combine(sets.precast.CorsairRoll, {hands="Navarch's Gants +2"})
  93. sets.precast.CorsairRoll["Chaos Roll"] = set_combine(sets.precast.CorsairRoll, {hands="Navarch's Gants +2"})
  94. sets.precast.CorsairRoll["Hunter's Roll"] = set_combine(sets.precast.CorsairRoll, {hands="Navarch's Gants +2"})
  95. sets.precast.CorsairRoll["Fighter's Roll"] = set_combine(sets.precast.CorsairRoll, {hands="Navarch's Gants +2"})
  96. sets.precast.CorsairRoll["Rogue's Roll"] = set_combine(sets.precast.CorsairRoll, {hands="Navarch's Gants +2"})
  97. sets.precast.CorsairRoll["Caster's Roll"] = set_combine(sets.precast.CorsairRoll, {hands="Navarch's Gants +2"})
  98. sets.precast.CorsairRoll["Evoker's Roll"] = set_combine(sets.precast.CorsairRoll, {hands="Navarch's Gants +2"})
  99. sets.precast.CorsairRoll["Monk's Roll"] = set_combine(sets.precast.CorsairRoll, {hands="Navarch's Gants +2"})
  100. sets.precast.CorsairRoll["Healer's Roll"] = set_combine(sets.precast.CorsairRoll, {hands="Navarch's Gants +2"})
  101. sets.precast.CorsairRoll["Wizard's Roll"] = set_combine(sets.precast.CorsairRoll, {hands="Navarch's Gants +2"})
  102. sets.precast.CorsairRoll["Warlock's Roll"] = set_combine(sets.precast.CorsairRoll, {hands="Navarch's Gants +2"})
  103. sets.precast.CorsairRoll["Samurai Roll"] = set_combine(sets.precast.CorsairRoll, {hands="Navarch's Gants +2"})
  104. sets.precast.CorsairRoll["Gallant's Roll"] = set_combine(sets.precast.CorsairRoll, {hands="Navarch's Gants +2"})
  105. sets.precast.CorsairRoll["Beast Roll"] = set_combine(sets.precast.CorsairRoll, {hands="Navarch's Gants +2"})
  106. sets.precast.CorsairRoll["Choral Roll"] = set_combine(sets.precast.CorsairRoll, {hands="Navarch's Gants +2"})
  107. sets.precast.CorsairRoll["Ninja Roll"] = set_combine(sets.precast.CorsairRoll, {hands="Navarch's Gants +2"})
  108. sets.precast.CorsairRoll["Drachen Roll"] = set_combine(sets.precast.CorsairRoll, {hands="Navarch's Gants +2"})
  109. sets.precast.CorsairRoll["Magus's Roll"] = set_combine(sets.precast.CorsairRoll, {hands="Navarch's Gants +2"})
  110. sets.precast.CorsairRoll["Puppet Roll"] = set_combine(sets.precast.CorsairRoll, {hands="Navarch's Gants +2"})
  111. sets.precast.CorsairRoll["Dancer's Roll"] = set_combine(sets.precast.CorsairRoll, {hands="Navarch's Gants +2"})
  112. sets.precast.CorsairRoll["Scholar's Roll"] = set_combine(sets.precast.CorsairRoll, {hands="Navarch's Gants +2"})
  113. sets.precast.CorsairRoll["Bolter's Roll"] = set_combine(sets.precast.CorsairRoll, {hands="Navarch's Gants +2"})
  114. sets.precast.CorsairRoll["Miser's Roll"] = set_combine(sets.precast.CorsairRoll, {hands="Navarch's Gants +2"})
  115. sets.precast.CorsairRoll["Companion's Roll"] = set_combine(sets.precast.CorsairRoll, {hands="Navarch's Gants +2"})
  116.  
  117. sets.precast.LuzafRing = {ring2="Luzaf's Ring"}
  118. sets.precast.CorsairShot = {head="Blood Mask", feet="Navarch's Bottes +2"}
  119.  
  120. -- Waltz set (chr and vit)
  121. sets.precast.Waltz = {
  122. head="Whirlpool Mask",
  123. body="Iuitl Vest",hands="Iuitl Wristbands",
  124. legs="Nahtirah Trousers",feet="Iuitl Gaiters +1"}
  125.  
  126. -- Don't need any special gear for Healing Waltz.
  127. sets.precast.Waltz['Healing Waltz'] = {}
  128.  
  129. -- Fast cast sets for spells
  130.  
  131. sets.precast.FC = {head="Haruspex Hat",ear2="Loquacious Earring",hands="Thaumas Gloves",ring1="Prolix Ring"}
  132.  
  133. sets.precast.FC.Utsusemi = set_combine(sets.precast.FC, {neck="Magoraga Beads"})
  134.  
  135.  
  136. sets.precast.RangedAttack = {ammo=gear.RAbullet,
  137. head="Aurore Beret",
  138. body="Laksamana's Frac +1",hands="Manibozho Gloves",
  139. back="Navarch's Mantle",waist="Impulse Belt",legs="Nahtirah Trousers",feet="Wurrukatte Boots"}
  140.  
  141.        
  142. -- Weaponskill sets
  143. -- Default set for any weaponskill that isn't any more specifically defined
  144. sets.precast.WS = {
  145. head="Whirlpool Mask",neck=gear.ElementalGorget,ear1="Bladeborn Earring",ear2="Steelflash Earring",
  146. body="Manibozho Jerkin",hands="Iuitl Wristbands",ring1="Rajas Ring",ring2="Epona's Ring",
  147. back="Atheling Mantle",waist=gear.ElementalBelt,legs="Manibozho Brais",feet="Iuitl Gaiters +1"}
  148.  
  149.  
  150. -- Specific weaponskill sets. Uses the base set if an appropriate WSMod version isn't found.
  151. sets.precast.WS['Evisceration'] = sets.precast.WS
  152.  
  153. sets.precast.WS['Exenterator'] = set_combine(sets.precast.WS, {legs="Nahtirah Trousers"})
  154.  
  155. sets.precast.WS['Requiescat'] = set_combine(sets.precast.WS, {legs="Nahtirah Trousers"})
  156.  
  157. sets.precast.WS['Last Stand'] = {ammo=gear.WSbullet,
  158. head="Lanun Tricorne +1",neck="Ej Necklace",ear1="Clearview Earring",ear2="Volley Earring",
  159. body="Laksamana's Frac +1",hands="Lanun Gants +1",ring1="Stormsoul Ring",ring2="Stormsoul Ring",
  160. back="Gunslinger's Cape",waist="Elanid Belt",legs="Nahtirah Trousers",feet="Laksamana's Bottes +1"}
  161.  
  162.  sets.precast.WS['Leaden Salute'] = {ammo=gear.WSbullet,
  163.         head="Lanun Tricorne +1",neck="Stoicheion Medal",ear1="Friomisi Earring",ear2="Crematio Earring",
  164.         body="Lanun Frac +1",hands="Thurandaut Gloves +1",ring1="Stormsoul Ring",ring2="Stormsoul Ring",
  165.         back="Gunslinger's Cape",waist=gear.ElementalObi,legs="Laksamana's Trews +1",feet="Lanun Bottes +1"
  166.  
  167.  sets.precast.WS['Wildfire'] = {ammo=gear.WSbullet,
  168.         head="Thaumas Hat",neck="Stoicheion Medal",ear1="Friomisi Earring",ear2="Crematio Earring",
  169.         body="Lanun Frac +1",hands="Thurandaut +1",ring1="Acumen Ring",ring2="Stormsoul Ring",
  170.         back="Gunslinger's Cape",waist=gear.ElementalObi,legs="Shneddick +1",feet="Lanun Bottes +1"}
  171.              
  172. -- Midcast Sets
  173. sets.midcast.FastRecast = {
  174. head="Whirlpool Mask",
  175. body="Iuitl Vest",hands="Iuitl Wristbands",
  176. legs="Manibozho Brais",feet="Iuitl Gaiters +1"}
  177.  
  178. -- Specific spells
  179. sets.midcast.Utsusemi = sets.midcast.FastRecast
  180.  
  181. sets.midcast.CorsairShot = {ammo=gear.QDbullet,
  182. main="Atoyac",head="Laksamana's Hat +1",neck="Stoicheion Medal",ear1="Friomisi Earring",ear2="Crematio Earring",
  183. body="Mirke Wardecors",hands="Laksamana's Gants +1",ring1="Sangoma Ring",ring2="Acumen Ring",
  184. back="Gunslinger's Cape",waist="Aquiline Belt",legs="Laksamana's Trews +1",feet="Lanun Bottes +1"}
  185.  
  186. sets.midcast.CorsairShot['Light Shot'] = {ammo=gear.QDbullet,
  187. main="Atoyac",head="Laksamana's Hat +1",neck="Stoicheion Medal",ear1="Lifestorm Earring",ear2="Psystorm Earring",
  188. body="Mirke Wardecors",hands="Laksamana's Gants +1",ring1="Sangoma Ring",ring2="Demon's Ring",
  189. back="Gunslinger's Cape",waist="Aquiline Belt",legs="Laksamana's Trews +1",feet="Lanun Bottes +1"}
  190.  
  191. sets.midcast.CorsairShot['Dark Shot'] = sets.midcast.CorsairShot['Light Shot']
  192.  
  193.  
  194. -- Ranged gear
  195. sets.midcast.RangedAttack = {ammo=gear.RAbullet,
  196. main="Surcouf's Jambiya",range="Death Penalty",
  197. head="Umbani Cap",neck="Ej Necklace",ear1="Clearview Earring",ear2="Volley Earring",
  198. body="Laksamana's Frac +1",hands="Lanun Gants +1",ring1="Hajduk Ring",ring2="Paqichikaji Ring",
  199. back="Gunslinger's Cape",waist="Elanid Belt",legs="Lanun Culottes +1",feet="Laksamana's Bottes +1"}
  200.  
  201. -- Sets to return to when not performing an action.
  202.  
  203. -- Resting sets
  204. sets.resting = {neck="Wiglen Gorget",ring1="Sheltered Ring",ring2="Paguroidea Ring"}
  205.  
  206.  
  207. -- Idle sets
  208. sets.idle = {ammo=gear.RAbullet,
  209. main="Surcouf's Jambiya",range="Death Penalty",Sub="Legion Scutum",
  210. head="Umbani Cap",neck="Ej Necklace",ear1="Clearview Earring",ear2="Volley Earring",
  211. body="Laksamana's Frac +1",hands="Lanun Gants +1",ring1="Hajduk Ring",ring2="Paqichikaji Ring",
  212. back="Gunslinger's Cape",waist="Elanid Belt",legs="Lanun Culottes +1",feet="Laksamana's Bottes +1"}
  213.  
  214. sets.idle.Town = {ammo=gear.RAbullet,main="Surcouf's Jambiya",range="Death Penalty",Sub="Legion Scutum",
  215. head="Umbani Cap",neck="Ej Necklace",ear1="Clearview Earring",ear2="Volley Earring",
  216. body="Laksamana's Frac +1",hands="Lanun Gants +1",ring1="Hajduk Ring",ring2="Paqichikaji Ring",
  217. back="Gunslinger's Cape",waist="Elanid Belt",legs="Lanun Culottes +1",feet="Laksamana's Bottes +1"}
  218.  
  219. -- Defense sets
  220. sets.defense.PDT = {
  221. head="Whirlpool Mask",neck="Twilight Torque",ear1="Clearview Earring",ear2="Volley Earring",
  222. body="Iuitl Vest",hands="Iuitl Wristbands",ring1="Defending Ring",ring2=gear.DarkRing.physical,
  223. back="Shadow Mantle",waist="Flume Belt",legs="Nahtirah Trousers",feet="Iuitl Gaiters +1"}
  224.  
  225. sets.defense.MDT = {
  226. head="Whirlpool Mask",neck="Twilight Torque",ear1="Clearview Earring",ear2="Volley Earring",
  227. body="Iuitl Vest",hands="Iuitl Wristbands",ring1="Defending Ring",ring2="Shadow Ring",
  228. back="Engulfer Cape",waist="Flume Belt",legs="Nahtirah Trousers",feet="Iuitl Gaiters +1"}
  229.  
  230.  
  231. sets.Kiting = {feet="Skadi's Jambeaux +1"}
  232.  
  233. -- Engaged sets
  234.  
  235. -- Variations for TP weapon and (optional) offense/defense modes. Code will fall back on previous
  236. -- sets if more refined versions aren't defined.
  237. -- If you create a set with both offense and defense modes, the offense mode should be first.
  238. -- EG: sets.engaged.Dagger.Accuracy.Evasion
  239.  
  240. -- Normal melee group
  241. sets.engaged.Melee = {ammo=gear.RAbullet,
  242. head="Whirlpool Mask",neck="Asperity Necklace",ear1="Bladeborn Earring",ear2="Steelflash Earring",
  243. body="Iuitl Vest",hands="Iuitl Wristbands",ring1="Rajas Ring",ring2="Epona's Ring",
  244. back="Atheling Mantle",waist="Windbuffet Belt",legs="Manibozho Brais",feet="Iuitl Gaiters +1"}
  245.  
  246. sets.engaged.Acc = {ammo=gear.RAbullet,
  247. head="Whirlpool Mask",neck="Asperity Necklace",ear1="Bladeborn Earring",ear2="Steelflash Earring",
  248. body="Iuitl Vest",hands="Iuitl Wristbands",ring1="Rajas Ring",ring2="Epona's Ring",
  249. back="Atheling Mantle",waist="Hurch'lan Sash",legs="Manibozho Brais",feet="Iuitl Gaiters +1"}
  250.  
  251. sets.engaged.Melee.DW = {ammo=gear.RAbullet,
  252. head="Whirlpool Mask",neck="Asperity Necklace",ear1="Dudgeon Earring",ear2="Heartseeker Earring",
  253. body="Iuitl Vest",hands="Iuitl Wristbands",ring1="Rajas Ring",ring2="Epona's Ring",
  254. back="Atheling Mantle",waist="Windbuffet Belt",legs="Manibozho Brais",feet="Iuitl Gaiters +1"}
  255.  
  256. sets.engaged.Acc.DW = {ammo=gear.RAbullet,
  257. head="Whirlpool Mask",neck="Asperity Necklace",ear1="Dudgeon Earring",ear2="Heartseeker Earring",
  258. body="Iuitl Vest",hands="Iuitl Wristbands",ring1="Rajas Ring",ring2="Epona's Ring",
  259. back="Atheling Mantle",waist="Hurch'lan Sash",legs="Manibozho Brais",feet="Iuitl Gaiters +1"}
  260.  
  261.  
  262. sets.engaged.Ranged = {ammo=gear.RAbullet,
  263. head="Whirlpool Mask",neck="Twilight Torque",ear1="Clearview Earring",ear2="Volley Earring",
  264. body="Iuitl Vest",hands="Iuitl Wristbands",ring1="Defending Ring",ring2=gear.DarkRing.physical,
  265. back="Shadow Mantle",waist="Flume Belt",legs="Nahtirah Trousers",feet="Iuitl Gaiters +1"}
  266. end
  267.  
  268. -------------------------------------------------------------------------------------------------------------------
  269. -- Job-specific hooks that are called to process player actions at specific points in time.
  270. -------------------------------------------------------------------------------------------------------------------
  271.  
  272. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  273. -- Set eventArgs.useMidcastGear to true if we want midcast gear equipped on precast.
  274. function job_precast(spell, action, spellMap, eventArgs)
  275. -- Check that proper ammo is available if we're using ranged attacks or similar.
  276. if spell.action_type == 'Ranged Attack' or spell.type == 'WeaponSkill' or spell.type == 'CorsairShot' then
  277. do_bullet_checks(spell, spellMap, eventArgs)
  278. end
  279.  -- Define proper defaults for weaponskills that use obis
  280.     if spell.english == 'Leaden Salute' then
  281.         gear.default.obi_waist = "Elanid Belt"
  282.     elseif spell.english == 'Wildfire' then
  283.         gear.default.obi_waist = "Aquiline Belt"
  284.     end
  285. end
  286. if (spell.type == 'CorsairRoll' or spell.english == "Double-Up") and state.LuzafRing then
  287. equip(sets.precast.LuzafRing)
  288. elseif spell.type == 'CorsairShot' and state.CastingMode == 'Resistant' then
  289. classes.CustomClass = 'Acc'
  290. end
  291. end
  292.  
  293. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  294. function job_aftercast(spell, action, spellMap, eventArgs)
  295. if spell.type == 'CorsairRoll' and not spell.interrupted then
  296. display_roll_info(spell)
  297. end
  298. end
  299.  
  300.  
  301. -------------------------------------------------------------------------------------------------------------------
  302. -- Customization hooks for idle and melee sets, after they've been automatically constructed.
  303. -------------------------------------------------------------------------------------------------------------------
  304.  
  305. -- Return a customized weaponskill mode to use for weaponskill sets.
  306. -- Don't return anything if you're not overriding the default value.
  307. function get_custom_wsmode(spell, spellMap, default_wsmode)
  308. if buffactive['Transcendancy'] then
  309. return 'Brew'
  310. end
  311. end
  312.  
  313. -------------------------------------------------------------------------------------------------------------------
  314. -- General hooks for other events.
  315. -------------------------------------------------------------------------------------------------------------------
  316.  
  317. -- Called when the player's status changes.
  318. function job_status_change(newStatus, oldStatus, eventArgs)
  319. if newStatus == 'Engaged' and player.equipment.main == 'Chatoyant Staff' then
  320. state.OffenseMode = 'Ranged'
  321. end
  322. end
  323.  
  324. -- Called when a player gains or loses a buff.
  325. -- buff == buff gained or lost
  326. -- gain == true if the buff was gained, false if it was lost.
  327. function job_buff_change(buff, gain)
  328.  
  329. end
  330.        
  331. -------------------------------------------------------------------------------------------------------------------
  332. -- User code that supplements self-commands.
  333. -------------------------------------------------------------------------------------------------------------------
  334.  
  335. -- Called by the 'update' self-command, for common needs.
  336. -- Set eventArgs.handled to true if we don't want automatic equipping of gear.
  337. function job_update(cmdParams, eventArgs)
  338. if newStatus == 'Engaged' and player.equipment.main == 'Chatoyant Staff' then
  339. state.OffenseMode = 'Ranged'
  340. end
  341. end
  342.  
  343. -- Job-specific toggles.
  344. function job_toggle_state(field)
  345. if field:lower() == 'luzaf' then
  346. state.LuzafRing = not state.LuzafRing
  347. return "Use of Luzaf Ring", state.LuzafRing
  348. end
  349. end
  350.  
  351. -- Set eventArgs.handled to true if we don't want the automatic display to be run.
  352. function display_current_job_state(eventArgs)
  353. local defenseString = ''
  354. if state.Defense.Active then
  355. local defMode = state.Defense.PhysicalMode
  356. if state.Defense.Type == 'Magical' then
  357. defMode = state.Defense.MagicalMode
  358. end
  359.  
  360. defenseString = 'Defense: '..state.Defense.Type..' '..defMode..', '
  361. end
  362.  
  363. local rollsize = 'Small'
  364. if state.LuzafRing then
  365. rollsize = 'Large'
  366. end
  367.  
  368. local pcTarget = ''
  369. if state.PCTargetMode ~= 'default' then
  370. pcTarget = ', Target PC: '..state.PCTargetMode
  371. end
  372.  
  373. local npcTarget = ''
  374. if state.SelectNPCTargets then
  375. pcTarget = ', Target NPCs'
  376. end
  377.  
  378.  
  379. add_to_chat(122,'Offense: '..state.OffenseMode..', Ranged: '..state.RangedMode..', WS: '..state.WeaponskillMode..
  380. ', Quick Draw: '..state.CastingMode..', '..defenseString..'Kiting: '..on_off_names[state.Kiting]..
  381. ', Roll Size: '..rollsize..pcTarget..npcTarget)
  382.  
  383. eventArgs.handled = true
  384. end
  385.  
  386. -------------------------------------------------------------------------------------------------------------------
  387. -- Utility functions specific to this job.
  388. -------------------------------------------------------------------------------------------------------------------
  389.  
  390. function define_roll_values()
  391. rolls = {
  392. ["Corsair's Roll"] = {lucky=5, unlucky=9, bonus="Experience Points"},
  393. ["Ninja Roll"] = {lucky=4, unlucky=8, bonus="Evasion"},
  394. ["Hunter's Roll"] = {lucky=4, unlucky=8, bonus="Accuracy"},
  395. ["Chaos Roll"] = {lucky=4, unlucky=8, bonus="Attack"},
  396. ["Magus's Roll"] = {lucky=2, unlucky=6, bonus="Magic Defense"},
  397. ["Healer's Roll"] = {lucky=3, unlucky=7, bonus="Cure Potency Received"},
  398. ["Puppet Roll"] = {lucky=4, unlucky=8, bonus="Pet Magic Accuracy/Attack"},
  399. ["Choral Roll"] = {lucky=2, unlucky=6, bonus="Spell Interruption Rate"},
  400. ["Monk's Roll"] = {lucky=3, unlucky=7, bonus="Subtle Blow"},
  401. ["Beast Roll"] = {lucky=4, unlucky=8, bonus="Pet Attack"},
  402. ["Samurai Roll"] = {lucky=2, unlucky=6, bonus="Store TP"},
  403. ["Evoker's Roll"] = {lucky=5, unlucky=9, bonus="Refresh"},
  404. ["Rogue's Roll"] = {lucky=5, unlucky=9, bonus="Critical Hit Rate"},
  405. ["Warlock's Roll"] = {lucky=4, unlucky=8, bonus="Magic Accuracy"},
  406. ["Fighter's Roll"] = {lucky=5, unlucky=9, bonus="Double Attack Rate"},
  407. ["Drachen Roll"] = {lucky=3, unlucky=7, bonus="Pet Accuracy"},
  408. ["Gallant's Roll"] = {lucky=3, unlucky=7, bonus="Defense"},
  409. ["Wizard's Roll"] = {lucky=5, unlucky=9, bonus="Magic Attack"},
  410. ["Dancer's Roll"] = {lucky=3, unlucky=7, bonus="Regen"},
  411. ["Scholar's Roll"] = {lucky=2, unlucky=6, bonus="Conserve MP"},
  412. ["Bolter's Roll"] = {lucky=3, unlucky=9, bonus="Movement Speed"},
  413. ["Caster's Roll"] = {lucky=2, unlucky=7, bonus="Fast Cast"},
  414. ["Courser's Roll"] = {lucky=3, unlucky=9, bonus="Snapshot"},
  415. ["Blitzer's Roll"] = {lucky=4, unlucky=9, bonus="Attack Delay"},
  416. ["Tactician's Roll"] = {lucky=5, unlucky=8, bonus="Regain"},
  417. ["Allies's Roll"] = {lucky=3, unlucky=10, bonus="Skillchain Damage"},
  418. ["Miser's Roll"] = {lucky=5, unlucky=7, bonus="Save TP"},
  419. ["Companion's Roll"] = {lucky=2, unlucky=10, bonus="Pet Regain and Regen"},
  420. ["Avenger's Roll"] = {lucky=4, unlucky=8, bonus="Counter Rate"},
  421. }
  422. end
  423.  
  424. function display_roll_info(spell)
  425. rollinfo = rolls[spell.english]
  426. local rollsize = 'Small'
  427. if state.LuzafRing then
  428. rollsize = 'Large'
  429. end
  430. if rollinfo then
  431. add_to_chat(104, spell.english..' provides a bonus to '..rollinfo.bonus..'. Roll size: '..rollsize)
  432. add_to_chat(104, 'Lucky roll is '..tostring(rollinfo.lucky)..', Unlucky roll is '..tostring(rollinfo.unlucky)..'.')
  433. end
  434. end
  435.  
  436.  
  437. -- Determine whether we have sufficient ammo for the action being attempted.
  438. function do_bullet_checks(spell, spellMap, eventArgs)
  439. local bullet_name
  440. local bullet_min_count = 1
  441.  
  442. if spell.type == 'WeaponSkill' then
  443. if spell.skill == "Marksmanship" then
  444. if spell.element == 'None' then
  445. -- physical weaponskills
  446. bullet_name = gear.WSbullet
  447. else
  448. -- magical weaponskills
  449. bullet_name = gear.MAbullet
  450. end
  451. else
  452. -- Ignore non-ranged weaponskills
  453. return
  454. end
  455. elseif spell.type == 'CorsairShot' then
  456. bullet_name = gear.QDbullet
  457. elseif spell.action_type == 'Ranged Attack' then
  458. bullet_name = gear.RAbullet
  459. if buffactive['Triple Shot'] then
  460. bullet_min_count = 3
  461. end
  462. end
  463.  
  464. local available_bullets = player.inventory[bullet_name] or player.wardrobe[bullet_name]
  465.  
  466. -- If no ammo is available, give appropriate warning and end.
  467. if not available_bullets then
  468. if spell.type == 'CorsairShot' and player.equipment.ammo ~= 'empty' then
  469. add_to_chat(104, 'No Quick Draw ammo left. Using what\'s currently equipped ('..player.equipment.ammo..').')
  470. return
  471. elseif spell.type == 'WeaponSkill' and player.equipment.ammo == gear.RAbullet then
  472. add_to_chat(104, 'No weaponskill ammo left. Using what\'s currently equipped (standard ranged bullets: '..player.equipment.ammo..').')
  473. return
  474. else
  475. add_to_chat(104, 'No ammo ('..tostring(bullet_name)..') available for that action.')
  476. eventArgs.cancel = true
  477. return
  478. end
  479. end
  480.  
  481. -- Don't allow shooting or weaponskilling with ammo reserved for quick draw.
  482. if spell.type ~= 'CorsairShot' and bullet_name == gear.QDbullet and available_bullets.count <= bullet_min_count then
  483. add_to_chat(104, 'No ammo will be left for Quick Draw. Cancelling.')
  484. eventArgs.cancel = true
  485. return
  486. end
  487.  
  488. -- Low ammo warning.
  489. if spell.type ~= 'CorsairShot' and not state.warned
  490. and available_bullets.count > 1 and available_bullets.count <= options.ammo_warning_limit then
  491. add_to_chat(104, '*******************************')
  492. add_to_chat(104, '***** LOW AMMO WARNING *****')
  493. add_to_chat(104, '*******************************')
  494. state.warned = true
  495. elseif available_bullets.count > options.ammo_warning_limit and state.warned then
  496. state.warned = false
  497. end
  498. end
  499.  
  500. -- Select default macro book on initial load or subjob change.
  501. function select_default_macro_book()
  502. set_macro_page(1, 17)
  503. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement