Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2017
702
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.30 KB | None | 0 0
  1. local profile = {}
  2.  
  3. local library = {
  4.     stone = { skillType = 1, id = 119 },
  5.     cure = { skillType = 1, id = 120 }
  6. }
  7.  
  8. local state = {
  9.     config = {
  10.         dps = false,
  11.         autoTargeting = false
  12.     }
  13. }
  14.  
  15. local config = {
  16.     IsDpsEnabled = function() return state.config.dps end,
  17.     IsAutoTargetingEnabled = function() return state.config.autoTargeting end
  18. }
  19.  
  20. local function GetStateName()
  21.     return profile.GUI.name .. "_State"
  22. end
  23.  
  24. local function OnCast()
  25.     local stone = ActionList:Get(library.stone.skillType, library.stone.id)
  26.     local cure = ActionList:Get(library.cure.skillType, library.cure.id)
  27.  
  28.     -- First, check our hp
  29.     if Player.hp.percent < 75 then
  30.         -- We're low on hp, so cast cure
  31.         if cure and cure:IsReady(Player.id) then
  32.             cure:Cast(Player.id)
  33.         end
  34.         return true
  35.     end
  36.  
  37.     -- We don't need to heal, but are we configured for DPS?
  38.     if not config.IsDpsEnabled() then
  39.         return false
  40.     end
  41.  
  42.     -- We're not low on hp, so check if we have a target
  43.     local target = Player:GetTarget()
  44.     if target == nil then
  45.         -- Nothing to do
  46.         return false
  47.     end
  48.  
  49.     -- We have a target, so cast stone on it
  50.     if (stone and stone:IsReady(target.id)) then
  51.         stone:Cast(target.id)
  52.         return true
  53.     end
  54.  
  55.     return false
  56. end
  57.  
  58. local function OnUpdate(event, tickcount)
  59.     -- This is called when ACR is running in standalone mode.
  60.     -- Combat logic should be in OnCast.
  61.     -- Targeting, movement etc should be in OnUpdate.
  62.     local target = Player:GetTarget()
  63.    
  64.     if target == nil and config.IsAutoTargetingEnabled() then
  65.         -- It's important to specify the target is alive, otherwise we will just keep targeting the monster we killed
  66.         local targetList = EntityList("nearest,onmesh,attackable,maxdistance=20,alive")
  67.         if targetList then
  68.             local entityId, entity = next(targetList)
  69.             if entity ~= nil then
  70.                 Player:SetTarget(entityId)
  71.             end
  72.         end
  73.     end
  74.  
  75.     if Player.incombat then
  76.         -- Call this regardless of whether we have a target, as the combat routine may not rely on one (buffs, healing etc)
  77.         OnCast()
  78.     end
  79. end
  80.  
  81. local function OnDraw()
  82.     if (profile.GUI.open) then
  83.         profile.GUI.visible, profile.GUI.open = GUI:Begin(profile.GUI.name, profile.GUI.open)
  84.         if (profile.GUI.visible) then
  85.             state.config.dps = GUI:Checkbox("Enable DPS Rotation", state.config.dps)
  86.             state.config.autoTargeting = GUI:Checkbox("Enable Auto Targeting", state.config.autoTargeting)
  87.             if GUI:Button("Save", 64, 16) then
  88.                 ACR.SetGUIVar(state.config, GetStateName())
  89.             end
  90.         end
  91.         GUI:End()
  92.     end    
  93. end
  94.  
  95. local function OnOpen()
  96.     profile.GUI.open = true
  97. end
  98.  
  99. local function OnLoad()
  100.     state.config = ACR.GetSetting(GetStateName(), state.config)
  101. end
  102.  
  103. profile.classes = {
  104.     -- GLA/PLD
  105.     [FFXIV.JOBS.GLADIATOR]      = false,
  106.     [FFXIV.JOBS.PALADIN]        = false,
  107.     -- PGL/MNK
  108.     [FFXIV.JOBS.PUGILIST]       = false,
  109.     [FFXIV.JOBS.MONK]           = false,
  110.     -- MRD/WAR
  111.     [FFXIV.JOBS.MARAUDER]       = false,
  112.     [FFXIV.JOBS.WARRIOR]        = false,
  113.     -- LNC/DRG
  114.     [FFXIV.JOBS.LANCER]         = false,
  115.     [FFXIV.JOBS.DRAGOON]        = false,
  116.     -- ARC/BRD
  117.     [FFXIV.JOBS.ARCHER]         = false,
  118.     [FFXIV.JOBS.BARD]           = false,
  119.     -- ROG/NIN
  120.     [FFXIV.JOBS.ROGUE]          = false,
  121.     [FFXIV.JOBS.NINJA]          = false,
  122.     -- CNJ/WHM
  123.     [FFXIV.JOBS.CONJURER]       = true, -- Enabled
  124.     [FFXIV.JOBS.WHITEMAGE]      = true, -- Enabled
  125.     -- THM/BLM
  126.     [FFXIV.JOBS.THAUMATURGE]    = false,
  127.     [FFXIV.JOBS.BLACKMAGE]      = false,
  128.     -- ACN/SCH/SMN
  129.     [FFXIV.JOBS.ARCANIST]       = false,
  130.     [FFXIV.JOBS.SCHOLAR]        = false,
  131.     [FFXIV.JOBS.SUMMONER]       = false,
  132.     -- DRK
  133.     [FFXIV.JOBS.DARKKNIGHT]     = false,
  134.     -- MCH
  135.     [FFXIV.JOBS.MACHINIST]      = false,
  136.     -- AST
  137.     [FFXIV.JOBS.ASTROLOGIAN]    = false,
  138.     -- BTN        
  139.     [FFXIV.JOBS.BOTANIST]       = false,
  140.     -- FSH
  141.     [FFXIV.JOBS.FISHER]         = false,
  142.     -- MIN
  143.     [FFXIV.JOBS.MINER]          = false,
  144.     -- CRP
  145.     [FFXIV.JOBS.CARPENTER]      = false,
  146.     -- BLK
  147.     [FFXIV.JOBS.BLACKSMITH]     = false,
  148.     -- ARM
  149.     [FFXIV.JOBS.ARMORER]        = false,
  150.     -- GLD
  151.     [FFXIV.JOBS.GOLDSMITH]      = false,
  152.     -- LTW
  153.     [FFXIV.JOBS.LEATHERWORKER]  = false,
  154.     -- WVR
  155.     [FFXIV.JOBS.WEAVER]         = false,
  156.     -- ALC
  157.     [FFXIV.JOBS.ALCHEMIST]      = false,
  158.     -- CLN
  159.     [FFXIV.JOBS.CULINARIAN]     = false,
  160. }
  161.  
  162. profile.GUI = {
  163.     open = false,
  164.     visible = true,
  165.     name = "AutoWHM Settings"
  166. }
  167.  
  168. -- The Draw() function provides a place where a developer can show custom options.
  169. profile.Draw = function() if OnDraw ~= nil then return OnDraw() end end
  170.  
  171. -- The OnOpen() function is fired when a user pressed "View Profile Options" on the main ACR window.
  172. profile.OnOpen = function() if OnOpen ~= nil then return OnOpen() end end
  173.  
  174. -- The OnLoad() function is fired when a profile is prepped and loaded by ACR.
  175. profile.OnLoad = function() if OnLoad ~= nil then return OnLoad() end end
  176.  
  177. -- The OnClick function is fired when a user clicks on the ACR party interface.
  178. -- It accepts 5 parameters:
  179. -- mouse /int/ - Possible values are 0 (Left-click), 1 (Right-click), 2 (Middle-click)
  180. -- shiftState /bool/ - Is shift currently pressed?
  181. -- controlState /bool/ - Is control currently pressed?
  182. -- altState /bool/ - Is alt currently pressed?
  183. -- entity /table/ - The entity information for the party member that was clicked on.
  184. profile.OnClick = function(mouse,shiftState,controlState,altState,entity) if OnClick ~= nil then return OnClick(mouse,shiftState,controlState,altState,entity) end end
  185.  
  186. -- The OnUpdate() function is fired on the gameloop, like any other OnUpdate function found in FFXIVMinion code.
  187. profile.OnUpdate = function(event, tickcount) if OnUpdate() ~= nil then return OnUpdate(event, tickcount) end end
  188.  
  189. -- Cast is called constantly by the FFXIVMinion assist bot. This contains our combat logic. It must be called manually by OnUpdate to use with ACR standalone.
  190. profile.Cast = function() if OnCast ~= nil then return OnCast() end end
  191.  
  192. return profile
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement