From 5afd217146f10befdeb6b0f89eb70433a3692fa8 Mon Sep 17 00:00:00 2001 From: ovc Date: Tue, 2 Sep 2025 00:44:05 +0300 Subject: [PATCH] first commit --- README.md | 0 main.lua | 152 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ main.xml | 8 +++ obd.toc | 7 +++ 4 files changed, 167 insertions(+) create mode 100644 README.md create mode 100644 main.lua create mode 100644 main.xml create mode 100644 obd.toc diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/main.lua b/main.lua new file mode 100644 index 0000000..0b52189 --- /dev/null +++ b/main.lua @@ -0,0 +1,152 @@ +local textures = {} + +textures['Claw'] = 'Ability_Druid_Rake' +textures['Rip'] = 'Ability_GhoulFrenzy' +textures['Ferocious Bite'] = 'Ability_Druid_FerociousBite' +textures['Tiger\'s Fury'] = 'Ability_Mount_JungleTiger' + + +local function getTexture(spellName) + if textures[spellName] ~= nil then + return textures[spellName] + end + return false +end + +local function getSlot(spellTexture) + for i = 1, 120, 1 do + if GetActionTexture(i) ~= nil then + -- print(GetActionTexture(i)) + if (strfind(GetActionTexture(i), spellTexture)) then + return i + end + end + end + return 0 +end + +local function isUsable(spellName) + local spellTexture = getTexture(spellName) + if spellTexture then + local slot = getSlot(spellTexture) + local usable, _ = IsUsableAction(slot) + return usable + else + return false + end +end + +local function debuffIndex(spellTexture) + for i = 1, 40 do + local texturePath = UnitDebuff('target', i) + if texturePath ~= nil and strfind(texturePath, spellTexture) then + return i + end + end + return 0 +end + +local function debuffStacks(spellName) + local spellTexture = getTexture(spellName) + if spellTexture then + local _, stacks = UnitDebuff('target', debuffIndex(spellTexture)) + if stacks == nill then + return 0 + else + return stacks + end + else + print(spellName) + return false + end +end + +function onCooldown(spellName) + local spellID = 1 + local name, _ = GetSpellName(spellID, 'BOOKTYPE_SPELL') + while (name) do + if spellName == name then + if GetSpellCooldown(spellID, 'BOOKTYPE_SPELL') == 0 then + return false + else + return true + end + end + spellID = spellID + 1 + name, _ = GetSpellName(spellID, 'BOOKTYPE_SPELL') + end +end + +local function comboPoints() + return GetComboPoints('player', 'target') +end + +local function cast(spellName) + CastSpellByName(spellName) +end + +local function gt(percent, value, max) + if value / max > percent / 100 then + return true + end + return false +end + +local function attack() + if GetUnitName('target') == nil then + TargetNearestEnemy() + return + else + if UnitCanAttack('player', 'target') == nil then + ClearTarget() + return + elseif UnitIsDead('target') == 1 then + ClearTarget() + return + elseif UnitIsPlayer('target') == 1 then + ClearTarget() + return + end + + local mana = UnitMana('player') + local health = UnitHealth('player') + + if (not PlayerFrame.inCombat) then + AttackTarget() + else + if isUsable('Tiger\'s Fury') and not buffed('Tiger\'s Fury', 'player') then + cast('Tiger\'s Fury') + elseif isUsable('Ferocious Bite') and comboPoints() > 1 then + cast('Ferocious Bite') + -- elseif isUsable('Rip') and comboPoints() > 0 and not buffed('Rip', 'target') then + -- cast('Rip') + elseif isUsable('Claw') then + cast('Claw') + -- elseif isUsable('Blood Fury') and not onCooldown('Blood Fury') then + -- cast('Blood Fury') + -- elseif not IsAutoRepeatAction(47) then + -- cast('Auto Shot') + -- elseif isUsable('Multi-Shot') and not onCooldown('Multi-Shot') then + -- cast('Multi-Shot') + -- elseif isUsable('Steady Shot') and not onCooldown('Steady Shot') then + -- cast('Steady Shot') + -- elseif isUsable('Baited Shot') and not onCooldown('Baited Shot') then + -- cast('Baited Shot') + -- elseif isUsable('Kill Command') and not onCooldown('Kill Command') then + -- cast('Kill Command') + -- elseif isUsable('Arcane Shot') and not onCooldown('Arcane Shot') then + -- cast('Arcane Shot(Rank 1)') + -- elseif isUsable('Serpent Sting') and not buffed('Serpent Sting', 'target') and + -- healthGtThan(25, UnitHealth('target'), UnitHealthMax('target')) then + -- cast('Serpent Sting') + -- elseif isUsable('Concussive Shot') and not onCooldown('Concussive Shot') then + -- cast('Concussive Shot') + end + end + end +end + +function obd_onLoad() + SlashCmdList['OBD'] = attack + SLASH_OBD1 = '/obd_lvl' +end diff --git a/main.xml b/main.xml new file mode 100644 index 0000000..7ca14c0 --- /dev/null +++ b/main.xml @@ -0,0 +1,8 @@ + +