Advertisement
Quixacotl

[LUA] FFXI Globals LUA

Apr 14th, 2015
471
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.80 KB | None | 0 0
  1. ------------------------------------------------------------------------------
  2. -- An example of setting up user-specific global handling of certain events.
  3. -- This is for personal globals, as opposed to library globals.
  4. ------------------------------------------------------------------------------
  5.  
  6. -------------------------------------------------------------------------------------------------------------------
  7. -- Job-specific hooks for standard casting events.
  8. -------------------------------------------------------------------------------------------------------------------
  9. function user_job_precast(spell, action, spellMap, eventArgs)
  10.     custom_aftermath_timers_precast(spell)
  11. end
  12.  
  13. function user_post_precast(spell, action, spellMap, eventArgs)
  14.     if spell.type == 'WeaponSkill' then
  15.         if is_sc_element_today(spell) or is_sc_element_weather(spell) then
  16.             equip({neck="Fotia Gorget", waist="Fotia Belt"})
  17.         end
  18.         send_command('wait 0.2;gs c TP')
  19.     end
  20. end
  21.  
  22. function user_post_midcast(spell, action, spellMap, eventArgs)
  23.     if spell.skill == 'Elemental Magic' then
  24.         if spell.element == world.day_element or spell.element == world.weather_element then
  25.             equip({back="Twilight Cape", waist="Hachirin-no-Obi"})
  26.         end
  27.     elseif spell.skill == 'Healing Magic' then
  28.         if spell.english:startswith('Cure') and world.day_element == 'Light' or world.weather_element == 'Light' then
  29.             equip({waist="Hachirin-no-Obi"})
  30.         end
  31.     end
  32. end
  33.  
  34. function user_job_aftercast(spell, action, spellMap, eventArgs)
  35.     custom_aftermath_timers_aftercast(spell)
  36. end
  37.  
  38. -------------------------------------------------------------------------------------------------------------------
  39. -- User code that supplements standard library decisions.
  40. -------------------------------------------------------------------------------------------------------------------
  41.  
  42. ------------------------------------------------------------------------------
  43. -- You must have an OffenseMode option:'Capacity' for the following to work.
  44. -- Ex. state.OffenseMode:options('Normal', 'Acc', 'Capacity')
  45. ------------------------------------------------------------------------------
  46. function user_customize_idle_set(idleSet)
  47.     if state.OffenseMode.value == 'Capacity' then
  48.         idleSet = set_combine(idleSet, {back="Mecisto. Mantle"})
  49.     end
  50.  
  51.     return idleSet
  52. end
  53.  
  54. function user_customize_melee_set(meleeSet)
  55.     if state.OffenseMode.value == 'Capacity' then
  56.         meleeSet = set_combine(meleeSet, {back="Mecisto. Mantle"})
  57.     end
  58.  
  59.     return meleeSet
  60. end
  61.  
  62. function user_customize_defense_set(defenseSet)
  63.     if state.OffenseMode.value == 'Capacity' then
  64.         defenseSet = set_combine(defenseSet, {back="Mecisto. Mantle"})
  65.     end
  66.  
  67.     return defenseSet
  68. end
  69.  
  70. -------------------------------------------------------------------------------------------------------------------
  71. -- User code that supplements self-commands.
  72. -------------------------------------------------------------------------------------------------------------------
  73.  
  74. -- Called for custom player commands.
  75. function user_job_self_command(cmdParams, eventArgs)
  76.     if cmdParams[1]:lower() == 'tp' then
  77.         add_to_chat(158,'TP Return: ['..tostring(player.tp)..']')
  78.     end
  79. end
  80.  
  81. -------------------------------------------------------------------------------------------------------------------
  82. -- Utility specific functions.
  83. -------------------------------------------------------------------------------------------------------------------
  84.  
  85. function is_sc_element_today(spell) -- Returns true if WS-element matches day-element. Otherwise returns false.
  86.     if spell.type ~= 'WeaponSkill' then
  87.         return
  88.     end
  89.  
  90.     local weaponskill_elements = S{}:
  91.         union(skillchain_elements[spell.skillchain_a]):
  92.         union(skillchain_elements[spell.skillchain_b]):
  93.         union(skillchain_elements[spell.skillchain_c])
  94.  
  95.     if weaponskill_elements:contains(world.day_element) then
  96.         return true
  97.     else
  98.         return false
  99.     end
  100. end
  101.  
  102. function is_sc_element_weather(spell) -- Returns true if WS-element matches weather-element. Otherwise returns false.
  103.     if spell.type ~= 'WeaponSkill' then
  104.         return
  105.     end
  106.  
  107.     local weaponskill_elements = S{}:
  108.         union(skillchain_elements[spell.skillchain_a]):
  109.         union(skillchain_elements[spell.skillchain_b]):
  110.         union(skillchain_elements[spell.skillchain_c])
  111.  
  112.     if weaponskill_elements:contains(world.weather_element) then
  113.         return true
  114.     else
  115.         return false
  116.     end
  117. end
  118.  
  119. -----------------------------------------------------------
  120. -- Test function to use to avoid modifying library files.
  121. -----------------------------------------------------------
  122. function user_test(params)
  123.  
  124. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement