Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nice idea/Addon, would like to try to figure out if something would be possible. #1

Closed
JourneyOver opened this issue Apr 18, 2024 · 1 comment

Comments

@JourneyOver
Copy link

JourneyOver commented Apr 18, 2024

Finding this addon gave me the idea of creating my own for my own profiles for hekili, I do have a question though on if it would be possible or not as I haven't been able to figure it out on my own, but would it be possible to create a classes.lua file (equivalent of https://github.com/Hekili/hekili/blob/dragonflight/Classes.lua without it being an exact duplicate of the file) but just to add in code like from this PR Hekili/hekili#2420 for example so that it would be possible to add health potions to hekili (or even do other things) without having to go in and edit the default hekili code?

would be a cool thing to do because then I couold add this code into a classes.lua file of my own:

local health_pots = {
    { name = "Refreshing Healing Potion 1", itemID = 191378 },
    { name = "Refreshing Healing Potion 2", itemID = 191379 },
    { name = "Refreshing Healing Potion 3", itemID = 191380 },
    { name = "Dreamwalkers Healing Potion 1", itemID = 207021 },
    { name = "Dreamwalkers Healing Potion 2", itemID = 207022 },
    { name = "Dreamwalkers Healing Potion 3", itemID = 207023 },
    { name = "Potion of Withering Dreams 1", itemID = 207039 },
    { name = "Potion of Withering Dreams 2", itemID = 207040 },
    { name = "Potion of Withering Dreams 3", itemID = 207041 },
}

for _, itemData in ipairs(health_pots) do
    local itemName = itemData.name:gsub("[^%w]+", "_"):lower()
    all:RegisterAbilities({
        [itemName] = {
            name = itemData.name,
            listName = function()
                local _, link, _, _, _, _, _, _, _, tex = GetItemInfo(itemData.itemID)
                if link and tex then return "|T" .. tex .. ":0|t " .. link end
                return "|cff00ccff[" .. itemData.name .. "]|r"
            end,
            cast = 0,
            cooldown = function() return time > 0 and 3600 or 60 end,
            gcd = "off",
            item = itemData.itemID,
            bagItem = true,
            startsCombat = false,
            texture = 4497595,
            usable = function()
                if GetItemCount(itemData.itemID) == 0 then return false, "requires " .. itemData.name .. " in bags" end
                if not IsUsableItem(itemData.itemID) then return false, itemData.name .. " on CD" end
                if health.current >= health.max then return false, "must be damaged" end
                return true
            end,
            readyTime = function()
                local start, duration = GetItemCooldown(itemData.itemID)
                return max(0, start + duration - query_time)
            end,
            handler = function()
                gain( 128250, "health" )
            end,
        }
    })
end

and have it work correctly without needing to go in and edit the classes.lua file of default hekili everytime they do an update.

@johnnylam88
Copy link
Owner

Yes, this is all possible, but not in the scope of this addon. Your suggestion is much better as pullup request to the main Hekili addon.

@johnnylam88 johnnylam88 closed this as not planned Won't fix, can't repro, duplicate, stale Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants