Guest User

Cor Gearswap

a guest
Jul 12th, 2014
376
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 24.50 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.  if spell.english == 'Leaden Salute' then
  292.  equip(sets.precast.WS['Leaden Salute'])
  293.  if spell.element == world.weather_element or spell_element == world.day_element then
  294.  equip(sets.Obi[spell.element])
  295.  end
  296.  end
  297.                        
  298. if spell.english == 'Wildfire' then
  299.  equip(sets.precast.WS['Wildfire'])
  300.  if spell.element == world.weather_element or spell_element == world.day_element then
  301.  equip(sets.Obi[spell.element])
  302. end
  303. end
  304.  
  305. -- gear sets
  306. if (spell.type == 'CorsairRoll' or spell.english == "Double-Up") and state.LuzafRing then
  307. equip(sets.precast.LuzafRing)
  308. elseif spell.type == 'CorsairShot' and state.CastingMode == 'Resistant' then
  309. classes.CustomClass = 'Acc'
  310. end
  311. end
  312.  
  313.  
  314. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  315. function job_aftercast(spell, action, spellMap, eventArgs)
  316. if spell.type == 'CorsairRoll' and not spell.interrupted then
  317. display_roll_info(spell)
  318. end
  319. end
  320.  
  321.  
  322. -------------------------------------------------------------------------------------------------------------------
  323. -- Customization hooks for idle and melee sets, after they've been automatically constructed.
  324. -------------------------------------------------------------------------------------------------------------------
  325.  
  326. -- Return a customized weaponskill mode to use for weaponskill sets.
  327. -- Don't return anything if you're not overriding the default value.
  328. function get_custom_wsmode(spell, spellMap, default_wsmode)
  329. if buffactive['Transcendancy'] then
  330. return 'Brew'
  331. end
  332. end
  333.  
  334. -------------------------------------------------------------------------------------------------------------------
  335. -- General hooks for other events.
  336. -------------------------------------------------------------------------------------------------------------------
  337.  
  338. -- Called when the player's status changes.
  339. function job_status_change(newStatus, oldStatus, eventArgs)
  340. if newStatus == 'Engaged' and player.equipment.main == 'Chatoyant Staff' then
  341. state.OffenseMode = 'Ranged'
  342. end
  343. end
  344.  
  345. -- Called when a player gains or loses a buff.
  346. -- buff == buff gained or lost
  347. -- gain == true if the buff was gained, false if it was lost.
  348. function job_buff_change(buff, gain)
  349.  
  350. end
  351.  
  352. -------------------------------------------------------------------------------------------------------------------
  353. --Obi Rules.
  354. -------------------------------------------------------------------------------------------------------------------
  355. function midcast(spell,act)
  356.  if spell.english == 'Leaden Salute' then
  357.                 equip(sets.precast.WS['Leaden Salute'])
  358.                         if spell.element == world.weather_element or spell_element == world.day_element then
  359.                                                 equip(sets.Obi[spell.element])
  360.                         end
  361.         end
  362.                        
  363.         if spell.english == 'Wildfire' then
  364.                 equip(sets.precast.WS['Wildfire'])
  365.                         if spell.element == world.weather_element or spell_element == world.day_element then
  366.                                                 equip(sets.Obi[spell.element])
  367.                         end
  368.         end
  369.                                
  370.                        
  371. end          
  372. -------------------------------------------------------------------------------------------------------------------
  373. -- User code that supplements self-commands.
  374. -------------------------------------------------------------------------------------------------------------------
  375.  
  376. -- Called by the 'update' self-command, for common needs.
  377. -- Set eventArgs.handled to true if we don't want automatic equipping of gear.
  378. function job_update(cmdParams, eventArgs)
  379. if newStatus == 'Engaged' and player.equipment.main == 'Chatoyant Staff' then
  380. state.OffenseMode = 'Ranged'
  381. end
  382. end
  383.  
  384. -- Job-specific toggles.
  385. function job_toggle_state(field)
  386. if field:lower() == 'luzaf' then
  387. state.LuzafRing = not state.LuzafRing
  388. return "Use of Luzaf Ring", state.LuzafRing
  389. end
  390. end
  391.  
  392. -- Set eventArgs.handled to true if we don't want the automatic display to be run.
  393. function display_current_job_state(eventArgs)
  394. local defenseString = ''
  395. if state.Defense.Active then
  396. local defMode = state.Defense.PhysicalMode
  397. if state.Defense.Type == 'Magical' then
  398. defMode = state.Defense.MagicalMode
  399. end
  400.  
  401. defenseString = 'Defense: '..state.Defense.Type..' '..defMode..', '
  402. end
  403.  
  404. local rollsize = 'Small'
  405. if state.LuzafRing then
  406. rollsize = 'Large'
  407. end
  408.  
  409. local pcTarget = ''
  410. if state.PCTargetMode ~= 'default' then
  411. pcTarget = ', Target PC: '..state.PCTargetMode
  412. end
  413.  
  414. local npcTarget = ''
  415. if state.SelectNPCTargets then
  416. pcTarget = ', Target NPCs'
  417. end
  418.  
  419.  
  420. add_to_chat(122,'Offense: '..state.OffenseMode..', Ranged: '..state.RangedMode..', WS: '..state.WeaponskillMode..
  421. ', Quick Draw: '..state.CastingMode..', '..defenseString..'Kiting: '..on_off_names[state.Kiting]..
  422. ', Roll Size: '..rollsize..pcTarget..npcTarget)
  423.  
  424. eventArgs.handled = true
  425. end
  426.  
  427. -------------------------------------------------------------------------------------------------------------------
  428. -- Utility functions specific to this job.
  429. -------------------------------------------------------------------------------------------------------------------
  430.  
  431. function define_roll_values()
  432. rolls = {
  433. ["Corsair's Roll"] = {lucky=5, unlucky=9, bonus="Experience Points"},
  434. ["Ninja Roll"] = {lucky=4, unlucky=8, bonus="Evasion"},
  435. ["Hunter's Roll"] = {lucky=4, unlucky=8, bonus="Accuracy"},
  436. ["Chaos Roll"] = {lucky=4, unlucky=8, bonus="Attack"},
  437. ["Magus's Roll"] = {lucky=2, unlucky=6, bonus="Magic Defense"},
  438. ["Healer's Roll"] = {lucky=3, unlucky=7, bonus="Cure Potency Received"},
  439. ["Puppet Roll"] = {lucky=4, unlucky=8, bonus="Pet Magic Accuracy/Attack"},
  440. ["Choral Roll"] = {lucky=2, unlucky=6, bonus="Spell Interruption Rate"},
  441. ["Monk's Roll"] = {lucky=3, unlucky=7, bonus="Subtle Blow"},
  442. ["Beast Roll"] = {lucky=4, unlucky=8, bonus="Pet Attack"},
  443. ["Samurai Roll"] = {lucky=2, unlucky=6, bonus="Store TP"},
  444. ["Evoker's Roll"] = {lucky=5, unlucky=9, bonus="Refresh"},
  445. ["Rogue's Roll"] = {lucky=5, unlucky=9, bonus="Critical Hit Rate"},
  446. ["Warlock's Roll"] = {lucky=4, unlucky=8, bonus="Magic Accuracy"},
  447. ["Fighter's Roll"] = {lucky=5, unlucky=9, bonus="Double Attack Rate"},
  448. ["Drachen Roll"] = {lucky=3, unlucky=7, bonus="Pet Accuracy"},
  449. ["Gallant's Roll"] = {lucky=3, unlucky=7, bonus="Defense"},
  450. ["Wizard's Roll"] = {lucky=5, unlucky=9, bonus="Magic Attack"},
  451. ["Dancer's Roll"] = {lucky=3, unlucky=7, bonus="Regen"},
  452. ["Scholar's Roll"] = {lucky=2, unlucky=6, bonus="Conserve MP"},
  453. ["Bolter's Roll"] = {lucky=3, unlucky=9, bonus="Movement Speed"},
  454. ["Caster's Roll"] = {lucky=2, unlucky=7, bonus="Fast Cast"},
  455. ["Courser's Roll"] = {lucky=3, unlucky=9, bonus="Snapshot"},
  456. ["Blitzer's Roll"] = {lucky=4, unlucky=9, bonus="Attack Delay"},
  457. ["Tactician's Roll"] = {lucky=5, unlucky=8, bonus="Regain"},
  458. ["Allies's Roll"] = {lucky=3, unlucky=10, bonus="Skillchain Damage"},
  459. ["Miser's Roll"] = {lucky=5, unlucky=7, bonus="Save TP"},
  460. ["Companion's Roll"] = {lucky=2, unlucky=10, bonus="Pet Regain and Regen"},
  461. ["Avenger's Roll"] = {lucky=4, unlucky=8, bonus="Counter Rate"},
  462. }
  463. end
  464.  
  465. function display_roll_info(spell)
  466. rollinfo = rolls[spell.english]
  467. local rollsize = 'Small'
  468. if state.LuzafRing then
  469. rollsize = 'Large'
  470. end
  471. if rollinfo then
  472. add_to_chat(104, spell.english..' provides a bonus to '..rollinfo.bonus..'. Roll size: '..rollsize)
  473. add_to_chat(104, 'Lucky roll is '..tostring(rollinfo.lucky)..', Unlucky roll is '..tostring(rollinfo.unlucky)..'.')
  474. end
  475. end
  476.  
  477.  
  478. -- Determine whether we have sufficient ammo for the action being attempted.
  479. function do_bullet_checks(spell, spellMap, eventArgs)
  480. local bullet_name
  481. local bullet_min_count = 1
  482.  
  483. if spell.type == 'WeaponSkill' then
  484. if spell.skill == "Marksmanship" then
  485. if spell.element == 'None' then
  486. -- physical weaponskills
  487. bullet_name = gear.WSbullet
  488. else
  489. -- magical weaponskills
  490. bullet_name = gear.MAbullet
  491. end
  492. else
  493. -- Ignore non-ranged weaponskills
  494. return
  495. end
  496. elseif spell.type == 'CorsairShot' then
  497. bullet_name = gear.QDbullet
  498. elseif spell.action_type == 'Ranged Attack' then
  499. bullet_name = gear.RAbullet
  500. if buffactive['Triple Shot'] then
  501. bullet_min_count = 3
  502. end
  503. end
  504.  
  505. local available_bullets = player.inventory[bullet_name] or player.wardrobe[bullet_name]
  506.  
  507. -- If no ammo is available, give appropriate warning and end.
  508. if not available_bullets then
  509. if spell.type == 'CorsairShot' and player.equipment.ammo ~= 'empty' then
  510. add_to_chat(104, 'No Quick Draw ammo left. Using what\'s currently equipped ('..player.equipment.ammo..').')
  511. return
  512. elseif spell.type == 'WeaponSkill' and player.equipment.ammo == gear.RAbullet then
  513. add_to_chat(104, 'No weaponskill ammo left. Using what\'s currently equipped (standard ranged bullets: '..player.equipment.ammo..').')
  514. return
  515. else
  516. add_to_chat(104, 'No ammo ('..tostring(bullet_name)..') available for that action.')
  517. eventArgs.cancel = true
  518. return
  519. end
  520. end
  521.  
  522. -- Don't allow shooting or weaponskilling with ammo reserved for quick draw.
  523. if spell.type ~= 'CorsairShot' and bullet_name == gear.QDbullet and available_bullets.count <= bullet_min_count then
  524. add_to_chat(104, 'No ammo will be left for Quick Draw. Cancelling.')
  525. eventArgs.cancel = true
  526. return
  527. end
  528.  
  529. -- Low ammo warning.
  530. if spell.type ~= 'CorsairShot' and not state.warned
  531. and available_bullets.count > 1 and available_bullets.count <= options.ammo_warning_limit then
  532. add_to_chat(104, '*******************************')
  533. add_to_chat(104, '***** LOW AMMO WARNING *****')
  534. add_to_chat(104, '*******************************')
  535. state.warned = true
  536. elseif available_bullets.count > options.ammo_warning_limit and state.warned then
  537. state.warned = false
  538. end
  539. end
  540.  
  541. -- Select default macro book on initial load or subjob change.
  542. function select_default_macro_book()
  543. set_macro_page(1, 17)
  544. end
Advertisement
Add Comment
Please, Sign In to add comment