Guest User

Cor Gearswap

a guest
Jul 12th, 2014
294
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 24.77 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="Elanid Belt",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="Aquiline Belt",legs="Shneddick +1",feet="Lanun Bottes +1"}
  171.  
  172. --Copy and pasted set from Snprphnx_SCH example--      
  173.         --Obis--
  174.                 sets.Obi = {}
  175.                 sets.Obi.Fire = {waist="Karin Obi"}
  176.                 sets.Obi.Earth = {waist="Dorin Obi"}
  177.                 sets.Obi.Water = {waist="Suirin Obi"}
  178.                 sets.Obi.Wind = {waist="Furin Obi"}
  179.                 sets.Obi.Ice = {waist="Hyorin Obi"}
  180.                 sets.Obi.Thunder = {waist="Rairin Obi"}
  181.                 sets.Obi.Light = {waist="Korin Obi"}
  182.                 sets.Obi.Dark = {waist="Anrin Obi"}
  183.              
  184. -- Midcast Sets
  185. sets.midcast.FastRecast = {
  186. head="Whirlpool Mask",
  187. body="Iuitl Vest",hands="Iuitl Wristbands",
  188. legs="Manibozho Brais",feet="Iuitl Gaiters +1"}
  189.  
  190. -- Specific spells
  191. sets.midcast.Utsusemi = sets.midcast.FastRecast
  192.  
  193. sets.midcast.CorsairShot = {ammo=gear.QDbullet,
  194. main="Atoyac",head="Laksamana's Hat +1",neck="Stoicheion Medal",ear1="Friomisi Earring",ear2="Crematio Earring",
  195. body="Mirke Wardecors",hands="Laksamana's Gants +1",ring1="Sangoma Ring",ring2="Acumen Ring",
  196. back="Gunslinger's Cape",waist="Aquiline Belt",legs="Laksamana's Trews +1",feet="Lanun Bottes +1"}
  197.  
  198. sets.midcast.CorsairShot['Light Shot'] = {ammo=gear.QDbullet,
  199. main="Atoyac",head="Laksamana's Hat +1",neck="Stoicheion Medal",ear1="Lifestorm Earring",ear2="Psystorm Earring",
  200. body="Mirke Wardecors",hands="Laksamana's Gants +1",ring1="Sangoma Ring",ring2="Demon's Ring",
  201. back="Gunslinger's Cape",waist="Aquiline Belt",legs="Laksamana's Trews +1",feet="Lanun Bottes +1"}
  202.  
  203. sets.midcast.CorsairShot['Dark Shot'] = sets.midcast.CorsairShot['Light Shot']
  204.  
  205.  
  206. -- Ranged gear
  207. sets.midcast.RangedAttack = {ammo=gear.RAbullet,
  208. main="Surcouf's Jambiya",range="Death Penalty",
  209. head="Umbani Cap",neck="Ej Necklace",ear1="Clearview Earring",ear2="Volley Earring",
  210. body="Laksamana's Frac +1",hands="Lanun Gants +1",ring1="Hajduk Ring",ring2="Paqichikaji Ring",
  211. back="Gunslinger's Cape",waist="Elanid Belt",legs="Lanun Culottes +1",feet="Laksamana's Bottes +1"}
  212.  
  213. -- Sets to return to when not performing an action.
  214.  
  215. -- Resting sets
  216. sets.resting = {neck="Wiglen Gorget",ring1="Sheltered Ring",ring2="Paguroidea Ring"}
  217.  
  218.  
  219. -- Idle sets
  220. sets.idle = {ammo=gear.RAbullet,
  221. main="Surcouf's Jambiya",range="Death Penalty",Sub="Legion Scutum",
  222. head="Umbani Cap",neck="Ej Necklace",ear1="Clearview Earring",ear2="Volley Earring",
  223. body="Laksamana's Frac +1",hands="Lanun Gants +1",ring1="Hajduk Ring",ring2="Paqichikaji Ring",
  224. back="Gunslinger's Cape",waist="Elanid Belt",legs="Lanun Culottes +1",feet="Laksamana's Bottes +1"}
  225.  
  226. sets.idle.Town = {ammo=gear.RAbullet,main="Surcouf's Jambiya",range="Death Penalty",Sub="Legion Scutum",
  227. head="Umbani Cap",neck="Ej Necklace",ear1="Clearview Earring",ear2="Volley Earring",
  228. body="Laksamana's Frac +1",hands="Lanun Gants +1",ring1="Hajduk Ring",ring2="Paqichikaji Ring",
  229. back="Gunslinger's Cape",waist="Elanid Belt",legs="Lanun Culottes +1",feet="Laksamana's Bottes +1"}
  230.  
  231. -- Defense sets
  232. sets.defense.PDT = {
  233. head="Whirlpool Mask",neck="Twilight Torque",ear1="Clearview Earring",ear2="Volley Earring",
  234. body="Iuitl Vest",hands="Iuitl Wristbands",ring1="Defending Ring",ring2=gear.DarkRing.physical,
  235. back="Shadow Mantle",waist="Flume Belt",legs="Nahtirah Trousers",feet="Iuitl Gaiters +1"}
  236.  
  237. sets.defense.MDT = {
  238. head="Whirlpool Mask",neck="Twilight Torque",ear1="Clearview Earring",ear2="Volley Earring",
  239. body="Iuitl Vest",hands="Iuitl Wristbands",ring1="Defending Ring",ring2="Shadow Ring",
  240. back="Engulfer Cape",waist="Flume Belt",legs="Nahtirah Trousers",feet="Iuitl Gaiters +1"}
  241.  
  242.  
  243. sets.Kiting = {feet="Skadi's Jambeaux +1"}
  244.  
  245. -- Engaged sets
  246.  
  247. -- Variations for TP weapon and (optional) offense/defense modes. Code will fall back on previous
  248. -- sets if more refined versions aren't defined.
  249. -- If you create a set with both offense and defense modes, the offense mode should be first.
  250. -- EG: sets.engaged.Dagger.Accuracy.Evasion
  251.  
  252. -- Normal melee group
  253. sets.engaged.Melee = {ammo=gear.RAbullet,
  254. head="Whirlpool Mask",neck="Asperity Necklace",ear1="Bladeborn Earring",ear2="Steelflash Earring",
  255. body="Iuitl Vest",hands="Iuitl Wristbands",ring1="Rajas Ring",ring2="Epona's Ring",
  256. back="Atheling Mantle",waist="Windbuffet Belt",legs="Manibozho Brais",feet="Iuitl Gaiters +1"}
  257.  
  258. sets.engaged.Acc = {ammo=gear.RAbullet,
  259. head="Whirlpool Mask",neck="Asperity Necklace",ear1="Bladeborn Earring",ear2="Steelflash Earring",
  260. body="Iuitl Vest",hands="Iuitl Wristbands",ring1="Rajas Ring",ring2="Epona's Ring",
  261. back="Atheling Mantle",waist="Hurch'lan Sash",legs="Manibozho Brais",feet="Iuitl Gaiters +1"}
  262.  
  263. sets.engaged.Melee.DW = {ammo=gear.RAbullet,
  264. head="Whirlpool Mask",neck="Asperity Necklace",ear1="Dudgeon Earring",ear2="Heartseeker Earring",
  265. body="Iuitl Vest",hands="Iuitl Wristbands",ring1="Rajas Ring",ring2="Epona's Ring",
  266. back="Atheling Mantle",waist="Windbuffet Belt",legs="Manibozho Brais",feet="Iuitl Gaiters +1"}
  267.  
  268. sets.engaged.Acc.DW = {ammo=gear.RAbullet,
  269. head="Whirlpool Mask",neck="Asperity Necklace",ear1="Dudgeon Earring",ear2="Heartseeker Earring",
  270. body="Iuitl Vest",hands="Iuitl Wristbands",ring1="Rajas Ring",ring2="Epona's Ring",
  271. back="Atheling Mantle",waist="Hurch'lan Sash",legs="Manibozho Brais",feet="Iuitl Gaiters +1"}
  272.  
  273.  
  274. sets.engaged.Ranged = {ammo=gear.RAbullet,
  275. head="Whirlpool Mask",neck="Twilight Torque",ear1="Clearview Earring",ear2="Volley Earring",
  276. body="Iuitl Vest",hands="Iuitl Wristbands",ring1="Defending Ring",ring2=gear.DarkRing.physical,
  277. back="Shadow Mantle",waist="Flume Belt",legs="Nahtirah Trousers",feet="Iuitl Gaiters +1"}
  278. end
  279.  
  280. -------------------------------------------------------------------------------------------------------------------
  281. -- Job-specific hooks that are called to process player actions at specific points in time.
  282. -------------------------------------------------------------------------------------------------------------------
  283.  
  284. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  285. -- Set eventArgs.useMidcastGear to true if we want midcast gear equipped on precast.
  286. function job_precast(spell, action, spellMap, eventArgs)
  287. -- Check that proper ammo is available if we're using ranged attacks or similar.
  288. if spell.action_type == 'Ranged Attack' or spell.type == 'WeaponSkill' or spell.type == 'CorsairShot' then
  289. do_bullet_checks(spell, spellMap, eventArgs)
  290. end
  291.  
  292.  
  293. -- gear sets
  294. if (spell.type == 'CorsairRoll' or spell.english == "Double-Up") and state.LuzafRing then
  295. equip(sets.precast.LuzafRing)
  296. elseif spell.type == 'CorsairShot' and state.CastingMode == 'Resistant' then
  297. classes.CustomClass = 'Acc'
  298. end
  299. end
  300.  
  301.  
  302. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  303. function job_aftercast(spell, action, spellMap, eventArgs)
  304. if spell.type == 'CorsairRoll' and not spell.interrupted then
  305. display_roll_info(spell)
  306. end
  307. end
  308.  
  309.  
  310. -------------------------------------------------------------------------------------------------------------------
  311. -- Customization hooks for idle and melee sets, after they've been automatically constructed.
  312. -------------------------------------------------------------------------------------------------------------------
  313.  
  314. -- Return a customized weaponskill mode to use for weaponskill sets.
  315. -- Don't return anything if you're not overriding the default value.
  316. function get_custom_wsmode(spell, spellMap, default_wsmode)
  317. if buffactive['Transcendancy'] then
  318. return 'Brew'
  319. end
  320. end
  321.  
  322. -------------------------------------------------------------------------------------------------------------------
  323. -- General hooks for other events.
  324. -------------------------------------------------------------------------------------------------------------------
  325.  
  326. -- Called when the player's status changes.
  327. function job_status_change(newStatus, oldStatus, eventArgs)
  328. if newStatus == 'Engaged' and player.equipment.main == 'Chatoyant Staff' then
  329. state.OffenseMode = 'Ranged'
  330. end
  331. end
  332.  
  333. -- Called when a player gains or loses a buff.
  334. -- buff == buff gained or lost
  335. -- gain == true if the buff was gained, false if it was lost.
  336. function job_buff_change(buff, gain)
  337.  
  338. end
  339.  
  340. -------------------------------------------------------------------------------------------------------------------
  341. --Obi Rules.
  342. -------------------------------------------------------------------------------------------------------------------
  343. function precast(spell)
  344.    if spell.english == 'Leaden Salute' then
  345.                 equip(sets.precast.WS['Leaden Salute'])
  346.                         if spell.element == world.weather_element or spell_element == world.day_element then
  347.                                                 equip(sets.Obi[spell.element])
  348.                         end
  349.         end
  350.                        
  351.         if spell.english == 'Wildfire' then
  352.                 equip(sets.precast.WS['Wildfire'])
  353.                         if spell.element == world.weather_element or spell_element == world.day_element then
  354.                                                 equip(sets.Obi[spell.element])
  355.                         end
  356.         end
  357. end  
  358.  
  359. function midcast(spell,act)
  360.  if spell.english == 'Leaden Salute' then
  361.                 equip(sets.precast.WS['Leaden Salute'])
  362.                         if spell.element == world.weather_element or spell_element == world.day_element then
  363.                                                 equip(sets.Obi[spell.element])
  364.                         end
  365.         end
  366.                        
  367.         if spell.english == 'Wildfire' then
  368.                 equip(sets.precast.WS['Wildfire'])
  369.                         if spell.element == world.weather_element or spell_element == world.day_element then
  370.                                                 equip(sets.Obi[spell.element])
  371.                         end
  372.         end
  373.                                
  374.                        
  375. end          
  376. -------------------------------------------------------------------------------------------------------------------
  377. -- User code that supplements self-commands.
  378. -------------------------------------------------------------------------------------------------------------------
  379.  
  380. -- Called by the 'update' self-command, for common needs.
  381. -- Set eventArgs.handled to true if we don't want automatic equipping of gear.
  382. function job_update(cmdParams, eventArgs)
  383. if newStatus == 'Engaged' and player.equipment.main == 'Chatoyant Staff' then
  384. state.OffenseMode = 'Ranged'
  385. end
  386. end
  387.  
  388. -- Job-specific toggles.
  389. function job_toggle_state(field)
  390. if field:lower() == 'luzaf' then
  391. state.LuzafRing = not state.LuzafRing
  392. return "Use of Luzaf Ring", state.LuzafRing
  393. end
  394. end
  395.  
  396. -- Set eventArgs.handled to true if we don't want the automatic display to be run.
  397. function display_current_job_state(eventArgs)
  398. local defenseString = ''
  399. if state.Defense.Active then
  400. local defMode = state.Defense.PhysicalMode
  401. if state.Defense.Type == 'Magical' then
  402. defMode = state.Defense.MagicalMode
  403. end
  404.  
  405. defenseString = 'Defense: '..state.Defense.Type..' '..defMode..', '
  406. end
  407.  
  408. local rollsize = 'Small'
  409. if state.LuzafRing then
  410. rollsize = 'Large'
  411. end
  412.  
  413. local pcTarget = ''
  414. if state.PCTargetMode ~= 'default' then
  415. pcTarget = ', Target PC: '..state.PCTargetMode
  416. end
  417.  
  418. local npcTarget = ''
  419. if state.SelectNPCTargets then
  420. pcTarget = ', Target NPCs'
  421. end
  422.  
  423.  
  424. add_to_chat(122,'Offense: '..state.OffenseMode..', Ranged: '..state.RangedMode..', WS: '..state.WeaponskillMode..
  425. ', Quick Draw: '..state.CastingMode..', '..defenseString..'Kiting: '..on_off_names[state.Kiting]..
  426. ', Roll Size: '..rollsize..pcTarget..npcTarget)
  427.  
  428. eventArgs.handled = true
  429. end
  430.  
  431. -------------------------------------------------------------------------------------------------------------------
  432. -- Utility functions specific to this job.
  433. -------------------------------------------------------------------------------------------------------------------
  434.  
  435. function define_roll_values()
  436. rolls = {
  437. ["Corsair's Roll"] = {lucky=5, unlucky=9, bonus="Experience Points"},
  438. ["Ninja Roll"] = {lucky=4, unlucky=8, bonus="Evasion"},
  439. ["Hunter's Roll"] = {lucky=4, unlucky=8, bonus="Accuracy"},
  440. ["Chaos Roll"] = {lucky=4, unlucky=8, bonus="Attack"},
  441. ["Magus's Roll"] = {lucky=2, unlucky=6, bonus="Magic Defense"},
  442. ["Healer's Roll"] = {lucky=3, unlucky=7, bonus="Cure Potency Received"},
  443. ["Puppet Roll"] = {lucky=4, unlucky=8, bonus="Pet Magic Accuracy/Attack"},
  444. ["Choral Roll"] = {lucky=2, unlucky=6, bonus="Spell Interruption Rate"},
  445. ["Monk's Roll"] = {lucky=3, unlucky=7, bonus="Subtle Blow"},
  446. ["Beast Roll"] = {lucky=4, unlucky=8, bonus="Pet Attack"},
  447. ["Samurai Roll"] = {lucky=2, unlucky=6, bonus="Store TP"},
  448. ["Evoker's Roll"] = {lucky=5, unlucky=9, bonus="Refresh"},
  449. ["Rogue's Roll"] = {lucky=5, unlucky=9, bonus="Critical Hit Rate"},
  450. ["Warlock's Roll"] = {lucky=4, unlucky=8, bonus="Magic Accuracy"},
  451. ["Fighter's Roll"] = {lucky=5, unlucky=9, bonus="Double Attack Rate"},
  452. ["Drachen Roll"] = {lucky=3, unlucky=7, bonus="Pet Accuracy"},
  453. ["Gallant's Roll"] = {lucky=3, unlucky=7, bonus="Defense"},
  454. ["Wizard's Roll"] = {lucky=5, unlucky=9, bonus="Magic Attack"},
  455. ["Dancer's Roll"] = {lucky=3, unlucky=7, bonus="Regen"},
  456. ["Scholar's Roll"] = {lucky=2, unlucky=6, bonus="Conserve MP"},
  457. ["Bolter's Roll"] = {lucky=3, unlucky=9, bonus="Movement Speed"},
  458. ["Caster's Roll"] = {lucky=2, unlucky=7, bonus="Fast Cast"},
  459. ["Courser's Roll"] = {lucky=3, unlucky=9, bonus="Snapshot"},
  460. ["Blitzer's Roll"] = {lucky=4, unlucky=9, bonus="Attack Delay"},
  461. ["Tactician's Roll"] = {lucky=5, unlucky=8, bonus="Regain"},
  462. ["Allies's Roll"] = {lucky=3, unlucky=10, bonus="Skillchain Damage"},
  463. ["Miser's Roll"] = {lucky=5, unlucky=7, bonus="Save TP"},
  464. ["Companion's Roll"] = {lucky=2, unlucky=10, bonus="Pet Regain and Regen"},
  465. ["Avenger's Roll"] = {lucky=4, unlucky=8, bonus="Counter Rate"},
  466. }
  467. end
  468.  
  469. function display_roll_info(spell)
  470. rollinfo = rolls[spell.english]
  471. local rollsize = 'Small'
  472. if state.LuzafRing then
  473. rollsize = 'Large'
  474. end
  475. if rollinfo then
  476. add_to_chat(104, spell.english..' provides a bonus to '..rollinfo.bonus..'. Roll size: '..rollsize)
  477. add_to_chat(104, 'Lucky roll is '..tostring(rollinfo.lucky)..', Unlucky roll is '..tostring(rollinfo.unlucky)..'.')
  478. end
  479. end
  480.  
  481.  
  482. -- Determine whether we have sufficient ammo for the action being attempted.
  483. function do_bullet_checks(spell, spellMap, eventArgs)
  484. local bullet_name
  485. local bullet_min_count = 1
  486.  
  487. if spell.type == 'WeaponSkill' then
  488. if spell.skill == "Marksmanship" then
  489. if spell.element == 'None' then
  490. -- physical weaponskills
  491. bullet_name = gear.WSbullet
  492. else
  493. -- magical weaponskills
  494. bullet_name = gear.MAbullet
  495. end
  496. else
  497. -- Ignore non-ranged weaponskills
  498. return
  499. end
  500. elseif spell.type == 'CorsairShot' then
  501. bullet_name = gear.QDbullet
  502. elseif spell.action_type == 'Ranged Attack' then
  503. bullet_name = gear.RAbullet
  504. if buffactive['Triple Shot'] then
  505. bullet_min_count = 3
  506. end
  507. end
  508.  
  509. local available_bullets = player.inventory[bullet_name] or player.wardrobe[bullet_name]
  510.  
  511. -- If no ammo is available, give appropriate warning and end.
  512. if not available_bullets then
  513. if spell.type == 'CorsairShot' and player.equipment.ammo ~= 'empty' then
  514. add_to_chat(104, 'No Quick Draw ammo left. Using what\'s currently equipped ('..player.equipment.ammo..').')
  515. return
  516. elseif spell.type == 'WeaponSkill' and player.equipment.ammo == gear.RAbullet then
  517. add_to_chat(104, 'No weaponskill ammo left. Using what\'s currently equipped (standard ranged bullets: '..player.equipment.ammo..').')
  518. return
  519. else
  520. add_to_chat(104, 'No ammo ('..tostring(bullet_name)..') available for that action.')
  521. eventArgs.cancel = true
  522. return
  523. end
  524. end
  525.  
  526. -- Don't allow shooting or weaponskilling with ammo reserved for quick draw.
  527. if spell.type ~= 'CorsairShot' and bullet_name == gear.QDbullet and available_bullets.count <= bullet_min_count then
  528. add_to_chat(104, 'No ammo will be left for Quick Draw. Cancelling.')
  529. eventArgs.cancel = true
  530. return
  531. end
  532.  
  533. -- Low ammo warning.
  534. if spell.type ~= 'CorsairShot' and not state.warned
  535. and available_bullets.count > 1 and available_bullets.count <= options.ammo_warning_limit then
  536. add_to_chat(104, '*******************************')
  537. add_to_chat(104, '***** LOW AMMO WARNING *****')
  538. add_to_chat(104, '*******************************')
  539. state.warned = true
  540. elseif available_bullets.count > options.ammo_warning_limit and state.warned then
  541. state.warned = false
  542. end
  543. end
  544.  
  545. -- Select default macro book on initial load or subjob change.
  546. function select_default_macro_book()
  547. set_macro_page(1, 17)
  548. end
Advertisement
Add Comment
Please, Sign In to add comment