Guest User

WHM lua

a guest
May 23rd, 2014
299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.22 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 (and its supplementary files) to go with this.
  6.  
  7. -- Initialization function for this job file.
  8. function get_sets()
  9. -- Load and initialize the include file.
  10. include('Mote-Include.lua')
  11. end
  12.  
  13. -- Setup vars that are user-independent.
  14. function job_setup()
  15. state.Buff['Afflatus Solace'] = buffactive['afflatus solace'] or false
  16. end
  17.  
  18.  
  19. -- Setup vars that are user-dependent. Can override this function in a sidecar file.
  20. function user_setup()
  21. -- Options: Override default values
  22. options.OffenseModes = {'None', 'Normal'}
  23. options.DefenseModes = {'Normal'}
  24. options.WeaponskillModes = {'Normal'}
  25. options.CastingModes = {'Normal', 'Resistant', 'Dire'}
  26. options.IdleModes = {'Normal', 'PDT'}
  27. options.RestingModes = {'Normal'}
  28. options.PhysicalDefenseModes = {'PDT'}
  29. options.MagicalDefenseModes = {'MDT'}
  30.  
  31. state.Defense.PhysicalMode = 'PDT'
  32. state.OffenseMode = 'None'
  33.  
  34.  
  35. -- Default macro set/book
  36. set_macro_page(4, 14)
  37. end
  38.  
  39. -- Called when this job file is unloaded (eg: job change)
  40. function file_unload()
  41. if binds_on_unload then
  42. binds_on_unload()
  43. end
  44. end
  45.  
  46.  
  47. -- Define sets and vars used by this job file.
  48. function init_gear_sets()
  49. --------------------------------------
  50. -- Start defining the sets
  51. --------------------------------------
  52.  
  53. -- Precast Sets
  54.  
  55. -- Fast cast sets for spells
  56. sets.precast.FC = {main=gear.FastcastStaff,ammo="Incantor Stone",
  57. head="Piety Cap",neck="Orison Locket",ear2="Loquacious Earring",
  58. body="Marduk's Jubbah",hands="Piety Mitts",ring1="Prolix Ring",
  59. back="Swith Cape +1",waist="Witful Belt",legs="Piety Pantaloons",feet="Rostrum Pumps"}
  60.  
  61. sets.precast.FC['Enhancing Magic'] = set_combine(sets.precast.FC, {waist="Siegel Sash"})
  62.  
  63. sets.precast.FC.Stoneskin = set_combine(sets.precast.FC['Enhancing Magic'])
  64.  
  65. sets.precast.FC['Healing Magic'] = set_combine(sets.precast.FC, {legs="Orison Pantaloons +2"})
  66.  
  67. sets.precast.FC.StatusRemoval = sets.precast.FC['Healing Magic']
  68.  
  69. sets.precast.FC.Cure = set_combine(sets.precast.FC['Healing Magic'], {main="Tamaxchi",sub="Genbu's Shield",body="Heka's Kalasiris",back="Pahtli Cape",waist="Cleric's Belt",feet="Litany Clogs"})
  70.  
  71. sets.precast.FC.Curaga = sets.precast.FC.Cure
  72.  
  73. -- Precast sets to enhance JAs
  74. sets.precast.JA.Benediction = {body="Piety Briault"}
  75.  
  76. -- Waltz set (chr and vit)
  77. sets.precast.Waltz = {
  78. head="Nahtirah Hat",ear1="Roundel Earring",
  79. body="Vanir Cotehardie",hands="Yaoyotl Gloves",
  80. back="Refraction Cape",legs="Gendewitha Spats",feet="Gendewitha Galoshes"}
  81.  
  82.  
  83. -- Weaponskill sets
  84.  
  85. -- Default set for any weaponskill that isn't any more specifically defined
  86. gear.default.weaponskill_neck = "Asperity Necklace"
  87. gear.default.weaponskill_waist = ""
  88. sets.precast.WS = {
  89. head="Nahtirah Hat",neck=gear.ElementalGorget,ear1="Bladeborn Earring",ear2="Steelflash Earring",
  90. body="Vanir Cotehardie",hands="Yaoyotl Gloves",ring1="Rajas Ring",ring2="K'ayres Ring",
  91. back="Refraction Cape",waist=gear.ElementalBelt,legs="Gendewitha Spats",feet="Gendewitha Galoshes"}
  92.  
  93. sets.precast.WS['Flash Nova'] = {
  94. head="Nahtirah Hat",neck="Stoicheion Medal",ear1="Friomisi Earring",ear2="Hecate's Earring",
  95. body="Vanir Cotehardie",hands="Yaoyotl Gloves",ring1="Rajas Ring",ring2="Strendu Ring",
  96. back="Toro Cape",waist="Thunder Belt",legs="Gendewitha Spats",feet="Gendewitha Galoshes"}
  97.  
  98.  
  99. -- Midcast Sets
  100.  
  101. sets.midcast.FastRecast = {
  102. head="Piety Cap",ear1="Gifted Earring",
  103. body="Piety Briault",hands="Piety Mitts",ring1="Prolix Ring",
  104. back="Swith Cape +1",waist="Witful Belt",legs="Piety Pantaloons",feet="Piety Duckbills"}
  105.  
  106. -- Cure sets
  107. gear.default.obi_waist = "Cleric's Belt"
  108. gear.default.obi_back = "Orison Cape"
  109.  
  110. sets.midcast.CureSolace = {main="Tamaxchi",sub="Genbu's Shield",ammo="Incantor Stone",
  111. head="Theophany Cap",neck="Orison Locket",ear2="Loquacious Earring",ear1="Orison Earring",
  112. body="Heka's Kalasiris",hands="Theophany Mitts",ring1="Prolix Ring",ring2="Sirona's Ring",
  113. back="Orison Cape",waist=gear.ElementalObi,legs="Piety Pantaloons",feet="Piety Duckbills"}
  114.  
  115. sets.midcast.Cure = {main="Tamaxchi",sub="Genbu's Shield",ammo="Incantor Stone",
  116. head="Theophany Cap",neck="Orison Locket",ear2="Loquacious Earring",ear1="Orison Earring",
  117. body="Heka's Kalasiris",hands="Theophany Mitts",ring1="Prolix Ring",ring2="Sirona's Ring",
  118. back="Orison Cape",waist=gear.ElementalObi,legs="Piety Pantaloons",feet="Piety Duckbills"}
  119.  
  120. sets.midcast.Curaga = {main="Tamaxchi",sub="Genbu's Shield",ammo="Incantor Stone",
  121. head="Theophany Cap",neck="Orison Locket",ear2="Loquacious Earring",ear1="Orison Earring",
  122. body="Heka's Kalasiris",hands="Theophany Mitts",ring1="Prolix Ring",ring2="Sirona's Ring",
  123. back="Orison Cape",waist=gear.ElementalObi,legs="Piety Pantaloons",feet="Piety Duckbills"}
  124.  
  125. sets.midcast.CureMelee = {ammo="Incantor Stone",
  126. head="Theophany Cap",neck="Orison Locket",ear2="Loquacious Earring",ear1="Orison Earring",
  127. body="Vanir Cotehardie",hands="Theophany Mitts",ring1="Prolix Ring",ring2="Sirona's Ring",
  128. back="Tuilha Cape",waist=gear.ElementalObi,legs="Piety Pantaloons",feet="Piety Duckbills"}
  129.  
  130. sets.midcast.Cursna = {main="Beneficus",sub="Genbu's Shield",
  131. head="Orison Cap +2",neck="Malison Medallion",
  132. body="Orison Bliaud +2",hands="Theophany Mitts",ring2="Ephedra Ring",ring1="Sirona's Ring",
  133. back="Swith Cape +1",waist="Witful Belt",legs="Theophany Pantaloons",feet="Orison Duckbills +2"}
  134.  
  135. sets.midcast.StatusRemoval = {
  136. head="Orison Cap +2",legs="Orison Pantaloons +2"}
  137.  
  138. -- 110 total Enhancing Magic Skill; caps even without Light Arts
  139. sets.midcast['Enhancing Magic'] = {main="Beneficus",sub="Genbu's Shield",
  140. head="Piety Cap",neck="Colossus's Torque",
  141. body="Heka's Kalasiris",hands="Theophany Mitts",
  142. back="Merciful Cape",waist="Olympus Sash",legs="Piety Pantaloons",feet="Orison Duckbills +2"}
  143.  
  144. sets.midcast.Stoneskin = {
  145. head="Piety Cap",neck="Orison Locket",ear2="Loquacious Earring",
  146. body="Marduk's Jubbah",hands="Augur's Gloves",
  147. back="Swith Cape +1",waist="Siegel Sash",legs="Piety Pantaloons",feet="Piety Duckbills"}
  148.  
  149. sets.midcast.Auspice = {hands="Augur's Gloves",feet="Orison Duckbills +2"}
  150.  
  151. sets.midcast.BarElement = {main="Beneficus",sub="Genbu's Shield",
  152. head="Piety Cap",neck="Colossus's Torque",
  153. body="Orison Bliaud +2",hands="Augur's Gloves",
  154. back="Merciful Cape",waist="Olympus Sash",legs="Piety Pantaloons",feet="Orison Duckbills +2"}
  155.  
  156. sets.midcast.Regen = {main="Tamaxchi",sub="Genbu's Shield",
  157. body="Piety Briault",hands="Orison Mitts +2",
  158. legs="Theophany Pantaloons"}
  159.  
  160. sets.midcast.Protectra = {feet="Piety Duckbills"}
  161.  
  162. sets.midcast.Shellra = {legs="Piety Pantaloons"}
  163.  
  164.  
  165. sets.midcast['Divine Magic'] = {main="Tamaxchi",sub="Genbu's Shield",
  166. head="Nefer Khat",neck="Colossus's Torque",ear1="Magnetic Earring",ear2="Loquacious Earring",
  167. body="Theophany Briault",hands="Piety Mitts",ring2="Mediator's Ring",ring1="Omega Ring",
  168. back="Altruistic Cape",waist=gear.ElementalObi,legs="Theophany Pantaloons",feet="Piety Duckbills"}
  169.  
  170. sets.midcast['Dark Magic'] = {main="Tamaxchi", sub="Genbu's Shield",
  171. head="Nefer Khat",neck="Aesir Torque",ear1="Abyssal Earring",ear2="Loquacious Earring",
  172. body="Theophany Briault",hands="Piety Mitts",ring2="Mediator's Ring",ring1="Omega Ring",
  173. back="Merciful Cape",waist="Cleric's Belt",legs="Piety Pantaloons",feet="Piety Duckbills"}
  174.  
  175. -- Custom spell classes
  176. sets.midcast.MndEnfeebles = {main="Tamaxchi", sub="Genbu's Shield",
  177. head="Theophany Cap",neck="Imbodla Necklace",ear1="Magnetic Earring",ear2="Loquacious Earring",
  178. body="Theophany Briault",hands="Piety Mitts",ring2="Mediator's Ring",ring1="Omega Ring",
  179. back="Altruistic Cape",waist="Cleric's Belt",legs="Piety Pantaloons",feet="Piety Duckbills"}
  180.  
  181. sets.midcast.IntEnfeebles = {main="Tamaxchi", sub="Genbu's Shield",
  182. head="Theophany Cap",neck="Imbodla Necklace",ear1="Abyssal Earring",ear2="Loquacious Earring",
  183. body="Theophany Briault",hands="Piety Mitts",ring2="Mediator's Ring",ring1="Omega Ring",
  184. back="Altruistic Cape",waist="Cleric's Belt",legs="Piety Pantaloons",feet="Piety Duckbills"}
  185.  
  186.  
  187. -- Sets to return to when not performing an action.
  188.  
  189. -- Resting sets
  190. sets.resting = {main=gear.Staff.HMP,
  191. body="Heka's Kalasiris",main="Boonwell Staff",hands="Serpentes Cuffs",
  192. waist="Cleric's Belt",legs="Nares Trews",head="Nefer Khat",neck="Eidolon Pendant",
  193. ear1="Relaxing Earring",ear2="Magnetic Earring",back="Vita Cape",ring1="Star Ring",ring2="Tamas Ring",
  194. feet="Serpentes Sabots"}
  195.  
  196.  
  197. -- Idle sets (default idle set not needed since the other three are defined, but leaving for testing purposes)
  198. sets.idle = {main="Terra's Staff", sub="Achaq Grip",ammo="Incantor Stone",
  199. head="Nefer Khat",neck="Orison Locket",ear1="Gifted Earring",ear2="Loquacious Earring",
  200. body="Heka's Kalasiris",hands="Serpentes Cuffs",ring1="Prolix Ring",ring2="Mediator's Ring",
  201. back="Pahtli Cape",waist="Cleric's Belt",legs="Nares Trews",feet="Serpentes Sabots"}
  202.  
  203. sets.idle.PDT = {main="Terra's Staff", sub="Achaq Grip",ammo="Incantor Stone",
  204. head="Piety Cap",neck="Twilight Torque",ear1="Novia Earring",ear2="Medicine Earring",
  205. body="Piety Briault",hands="Piety Mitts",ring1="Jelly Ring",ring2="Kunaji Ring",
  206. back="Umbra Cape",waist="Witful Belt",legs="Piety Pantaloons",feet="Herald's Gaiters"}
  207.  
  208. sets.idle.Town = {main="Terra's Staff", sub="Achaq Grip",ammo="Incantor Stone",
  209. head="Nefer Khat",neck="Orison Locket",ear1="Gifted Earring",ear2="Loquacious Earring",
  210. body="Heka's Kalasiris",hands="Serpentes Cuffs",ring1="Prolix Ring",ring2="Mediator's Ring",
  211. back="Pahtli Cape",waist="Cleric's Belt",legs="Nares Trews",feet="Herald's Gaiters"}
  212.  
  213. sets.idle.Weak = {main="Terra's Staff", sub="Achaq Grip",ammo="Incantor Stone",
  214. head="Piety Cap",neck="Twilight Torque",ear1="Novia Earring",ear2="Medicine Earring",
  215. body="Piety Briault",hands="Piety Mitts",ring1="Jelly Ring",ring2="Kunaji Ring",
  216. back="Umbra Cape",waist="Witful Belt",legs="Piety Pantaloons",feet="Herald's Gaiters"}
  217.  
  218. -- Defense sets
  219.  
  220. sets.defense.PDT = {main=gear.Staff.PDT,sub="Achaq Grip",
  221. head="Gendewitha Caubeen",neck="Twilight Torque",
  222. body="Gendewitha Bliaut",hands="Gendewitha Gages",ring1="Dark Ring",ring2="Dark Ring",
  223. back="Umbra Cape",legs="Gendewitha Spats",feet="Gendewitha Galoshes"}
  224.  
  225. sets.defense.MDT = {main=gear.Staff.PDT,sub="Achaq Grip",
  226. head="Nahtirah Hat",neck="Twilight Torque",
  227. body="Vanir Cotehardie",hands="Yaoyotl Gloves",ring1="Dark Ring",ring2="Shadow Ring",
  228. back="Tuilha Cape",legs="Bokwus Slops",feet="Gendewitha Galoshes"}
  229.  
  230. sets.Kiting = {feet="Herald's Gaiters"}
  231.  
  232. -- Engaged sets
  233.  
  234. -- Variations for TP weapon and (optional) offense/defense modes. Code will fall back on previous
  235. -- sets if more refined versions aren't defined.
  236. -- If you create a set with both offense and defense modes, the offense mode should be first.
  237. -- EG: sets.engaged.Dagger.Accuracy.Evasion
  238.  
  239. -- Basic set for if no TP weapon is defined.
  240. sets.engaged = {
  241. head="Nahtirah Hat",neck="Asperity Necklace",ear1="Bladeborn Earring",ear2="Steelflash Earring",
  242. body="Vanir Cotehardie",hands="Dynasty Mitts",ring1="Rajas Ring",ring2="K'ayres Ring",
  243. back="Umbra Cape",waist="Goading Belt",legs="Gendewitha Spats",feet="Gendewitha Galoshes"}
  244.  
  245.  
  246. -- Buff sets: Gear that needs to be worn to actively enhance a current player buff.
  247. sets.buff['Divine Caress'] = {hands="Orison Mitts +2",back="Mending Cape"}
  248. end
  249.  
  250. -------------------------------------------------------------------------------------------------------------------
  251. -- Job-specific hooks that are called to process player actions at specific points in time.
  252. -------------------------------------------------------------------------------------------------------------------
  253.  
  254. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  255. -- Set eventArgs.useMidcastGear to true if we want midcast gear equipped on precast.
  256. function job_precast(spell, action, spellMap, eventArgs)
  257. if spell.english == "Paralyna" and buffactive.Paralyzed then
  258. -- no gear swaps if we're paralyzed, to avoid blinking while trying to remove it.
  259. eventArgs.handled = true
  260. end
  261.  
  262. if spell.skill == 'Healing Magic' then
  263. gear.default.obi_back = "Mending Cape"
  264. else
  265. gear.default.obi_back = "Toro Cape"
  266. end
  267. end
  268.  
  269.  
  270. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  271. function job_midcast(spell, action, spellMap, eventArgs)
  272. if spell.action_type == 'Magic' then
  273. -- Default base equipment layer of fast recast.
  274. equip(sets.midcast.FastRecast)
  275. end
  276. end
  277.  
  278.  
  279. function job_post_midcast(spell, action, spellMap, eventArgs)
  280. -- Apply Divine Caress boosting items as highest priority over other gear, if applicable.
  281. if spellMap == 'StatusRemoval' and buffactive['Divine Caress'] then
  282. equip(sets.buff['Divine Caress'])
  283. end
  284. end
  285.  
  286.  
  287. -- Return true if we handled the aftercast work. Otherwise it will fall back
  288. -- to the general aftercast() code in Mote-Include.
  289. function job_aftercast(spell, action, spellMap, eventArgs)
  290. if not spell.interrupted then
  291. if state.Buff[spell.name] ~= nil then
  292. state.Buff[spell.name] = true
  293. elseif spell.name == "Afflatus Misery" then
  294. state.Buff['Afflatus Solace'] = false
  295. end
  296. end
  297. end
  298.  
  299.  
  300. -------------------------------------------------------------------------------------------------------------------
  301. -- Customization hooks for idle and melee sets, after they've been automatically constructed.
  302. -------------------------------------------------------------------------------------------------------------------
  303.  
  304. -- Custom spell mapping.
  305. function job_get_spell_map(spell, default_spell_map)
  306. if spell.action_type == 'Magic' then
  307. if (default_spell_map == 'Cure' or default_spell_map == 'Curaga') and player.status == 'Engaged' then
  308. return "CureMelee"
  309. elseif default_spell_map == 'Cure' and state.Buff['Afflatus Solace'] then
  310. return "CureSolace"
  311. elseif spell.skill == "Enfeebling Magic" then
  312. if spell.type == "WhiteMagic" then
  313. return "MndEnfeebles"
  314. else
  315. return "IntEnfeebles"
  316. end
  317. end
  318. end
  319. end
  320.  
  321.  
  322. -------------------------------------------------------------------------------------------------------------------
  323. -- General hooks for other events.
  324. -------------------------------------------------------------------------------------------------------------------
  325.  
  326. -- Called when a player gains or loses a buff.
  327. -- buff == buff gained or lost
  328. -- gain == true if the buff was gained, false if it was lost.
  329. function job_buff_change(buff, gain)
  330. if state.Buff[buff] ~= nil then
  331. state.Buff[buff] = gain
  332. end
  333. end
  334.  
  335.  
  336. -------------------------------------------------------------------------------------------------------------------
  337. -- User code that supplements self-commands.
  338. -------------------------------------------------------------------------------------------------------------------
  339.  
  340. -- Called by the 'update' self-command.
  341. function job_update(cmdParams, eventArgs)
  342. if cmdParams[1] == 'user' and not areas.Cities:contains(world.area) then
  343. local needsArts =
  344. player.sub_job:lower() == 'sch' and
  345. not buffactive['Light Arts'] and
  346. not buffactive['Addendum: White'] and
  347. not buffactive['Dark Arts'] and
  348. not buffactive['Addendum: Black']
  349.  
  350. if not buffactive['Afflatus Solace'] and not buffactive['Afflatus Misery'] then
  351. if needsArts then
  352. send_command('@input /ja "Afflatus Solace" <me>;wait 1.2;input /ja "Light Arts" <me>')
  353. else
  354. send_command('@input /ja "Afflatus Solace" <me>')
  355. end
  356. end
  357. end
  358. end
  359.  
  360.  
  361. -- Handle notifications of general user state change.
  362. function job_state_change(stateField, newValue)
  363. if stateField == 'OffenseMode' then
  364. if newValue == 'Normal' then
  365. disable('main','sub')
  366. else
  367. enable('main','sub')
  368. end
  369. elseif stateField == 'Reset' then
  370. if state.OffenseMode == 'None' then
  371. enable('main','sub')
  372. end
  373. end
  374. end
  375.  
  376.  
  377. -- Function to display the current relevant user state when doing an update.
  378. -- Return true if display was handled, and you don't want the default info shown.
  379. function display_current_job_state(eventArgs)
  380. local defenseString = ''
  381. if state.Defense.Active then
  382. local defMode = state.Defense.PhysicalMode
  383. if state.Defense.Type == 'Magical' then
  384. defMode = state.Defense.MagicalMode
  385. end
  386.  
  387. defenseString = 'Defense: '..state.Defense.Type..' '..defMode..', '
  388. end
  389.  
  390. local meleeString = ''
  391. if state.OffenseMode == 'Normal' then
  392. meleeString = 'Melee: Weapons locked, '
  393. end
  394.  
  395. add_to_chat(122,'Casting ['..state.CastingMode..'], '..meleeString..'Idle ['..state.IdleMode..'], '..defenseString..
  396. 'Kiting: '..on_off_names[state.Kiting])
  397.  
  398. eventArgs.handled = true
  399. end
  400.  
  401. -------------------------------------------------------------------------------------------------------------------
  402. -- Utility functions specific to this job.
  403. -------------------------------------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment