Your little self-coded addons

In my time playing, I have written various little addons for myself. Nothing grand, just some small tools. The one I currently get the most use out of simply loops through all of Legion and BfA’s available World Quests and lists any that award transmogs that I have yet to unlock.

I’m wondering what other players have written for themselves as minor Quality of Life improvements.

I’d actually be interested in learning more about that and other addons you’ve written.

That sounds like a neat addon. you should publish it. I would dload it. I have some little tracking addons I have written to help track hit combo moves for my ww. I have also written some small alt status tracking apps.

Alright, here’s a screenshot of my “wqmog” addon in action: https://i.imgur.com/AzyRZY1.png

In the screenshot, I’ve run /wqmog 3 times because some network data didn’t load the first two runs.

Here’s the code:

local maps = {
  -- [12] = "Kalimdor",
  -- [13] = "Eastern Kingdoms",
  [619] = "Broken Isles",
  [994] = "Argus",
  [875] = "Zandalar",
  [876] = "Kul Tiras"
}

local function main()
  local questCount = 0
  local rewardCount = 0
  local appearanceCount = 0
  local knownCount = 0
  local failedCount = 0

  for mapID,_ in pairs(maps) do
    local taskPOIs = C_TaskQuest.GetQuestsForPlayerByMapID(mapID)
    for _,TaskPOIData in pairs(taskPOIs) do
      questCount = questCount + 1
      local numQuestRewards = GetNumQuestLogRewards(TaskPOIData.questId)
      if numQuestRewards > 0 then
        rewardCount = rewardCount + 1

        local rewardName,_,_,_,_,rewardID = GetQuestLogRewardInfo(1,TaskPOIData.questId)

        if rewardID then
          local UiMapDetails = C_Map.GetMapInfo(TaskPOIData.mapID)
          local questLink = GetQuestLink(TaskPOIData.questId)
          local _,itemType,itemSubType,itemEquipLoc = GetItemInfoInstant(rewardID)

          if itemType == GetItemClassInfo(LE_ITEM_CLASS_ARMOR) or itemType == GetItemClassInfo(LE_ITEM_CLASS_WEAPON) then
            local appearanceID = C_TransmogCollection.GetItemInfo(rewardID)
            if appearanceID then
              appearanceCount = appearanceCount + 1

              local known = C_TransmogCollection.PlayerHasTransmog(rewardID)
              if known then
                knownCount = knownCount + 1
              else
                print(questLink,UiMapDetails.name)
              end
            end
          end
        else
          failedCount = failedCount + 1
        end
      end
    end
  end
  print(questCount,"world quests,",rewardCount,"items,",knownCount,"of",appearanceCount,"appearances,",failedCount,"failed")
end

SLASH_WORLDQUESTTRANSMOG1 = "/wqmog"

SlashCmdList["WORLDQUESTTRANSMOG"] = function(msg)
  main()
end

The Kalimdor and Eastern Kingdoms maps are commented out because the Darkshore and Arathi World Quests never award equipment.

2 Likes

I dislike the presentation of the default bags but don’t like one-bag solutions so I wrote a bag wrangler that allows me to change the scale and position of them (including the bank bags).

It’s not its own addon, but is embedded in a startup addon I use to house little things like that.

Because it’s not intended for general distribution, it’s pretty much either going to require modification for anyone else to use or they’ll have to have ElvUI installed (I use ElvUI’s Bags anchor to help me with positioning).

Defined elsewhere:

  MyData.Functions = {}

BagModule

local AddOnName, MyData = ...

local f = MyData.Functions

MyData.BagScale = 0.70

function f:GetScale()

  return (MyData.BagScale or 1.00)

end

function f:SetScale(inScale)

  MyData.BagScale = (inScale or 1.00)

end

function f:ApplyBagOverrides(scaleVal)

  local TL, TC, TR, LC, CC, RC, BL, BC, BR = 
        "TOPLEFT", "TOP", "TOPRIGHT", 
        "LEFT", "CENTER", "RIGHT", 
        "BOTTOMLEFT", "BOTTOM", "BOTTOMRIGHT"
  local widthFactor = 191
  local heightFactor = 383
  local bags = {
    {TL, ElvUIBagMover	, BR, (-5 * widthFactor) + 28, heightFactor},
    {TL, ContainerFrame1 , TR,  -7,    0},
    {TL, ContainerFrame2 , TR,  -7,    0},
    {TL, ContainerFrame3 , TR,  -7,    0},
    {TL, ContainerFrame4 , TR,  -7,    0},
    {TL, BankFrame       , TR,   0,    0},
    {LC, ContainerFrame6 , RC,   0,    0},
    {LC, ContainerFrame7 , RC,   0,    0},
    {LC, ContainerFrame8 , RC,   0,    0},
    {TL, ContainerFrame6 , BL,   0,    0},
    {LC, ContainerFrame10, RC,   0,    0},
    {LC, ContainerFrame11, RC,   0,    0},
  }

  for i = 1, #bags do

    local bag = _G["ContainerFrame"..i]
    bag:SetScale(MyData.BagScale)
    bag:SetMovable(true)
    bag:SetUserPlaced(true)
    bag:ClearAllPoints()
    bag:SetPoint(unpack(bags[i]))
    bag:SetMovable(false)
    hooksecurefunc(bag, "SetPoint", function(self)
      if not self.moving then
        self.moving = true
        self:SetMovable(true)
        self:SetUserPlaced(true)
        self:ClearAllPoints()
        self:SetPoint(unpack(bags[i]))
        self:SetMovable(false)
        self.moving = nil
      end
    end)
    hooksecurefunc(bag, "SetScale", function(self)
      if not self.scaling then
        self.scaling = true
        self:SetScale(MyData.BagScale)
        self.scaling = nil
      end
    end)
    OpenAllBags()
    CloseAllBags()
  end

end
1 Like

This isn’t an addon, but a very nice mob-farming macro:

/cleartarget
/targetexact Unborn Val'kyr
/stopmacro [noharm][noexists]
/dismount
/use Goblin Glider Kit

Last time I used this I was looking for Unborn Val’kyr, but you can put ANY targetable name in there.

Fly about, spam this macro, as soon as it’s in targeting range you’ll drop off your mount and onto your glider.

That’s a clear signal that it’s nearby and you can go fetch it.

In the interest of “addon safety” I would suggest changing:

function main()

to

local function main()

All addons share the same global space. Naming a global using something simple/common like main() lends itself to being overwritten by another addon doing the same thing. Blizzard also tend to use (reserve :wink:) common or plain global names which could be overwritten by your addon.

Prefixing global names with the addon name or uncommon abbreviation is one way to make them unique.

Apologies for being “that” person.

Thank you for the addon BTW.

2 Likes

Thanks, that was an oversight. :slight_smile: I’ve updated the code in the earlier post.

1 Like

Don’t know why I thought this was a thread about Macros.

Been considering some for Classic just to save bar space with some automation. Never used macros up until now, so they’re pretty simple.

#showtooltip
/cast [help]Mark of the Wild;[group]Gift of the Wild;[@player]Mark of the Wild

Just makes it so you have 1 button for both based on the context of when you’re casting them.

No (or hostile) target when solo will buff yourself, no (or hostile) target in party will buff the party, specifically targeting someone will allow you to buff only them whether you’re in a party or not. #showtooltip changes the macro icon based on which parameter is active at the time.

Been considering doing this for my heals as well like:

#showtooltip
/cast [help]Healing Touch;[group]Healing Touch;[@player]Healing Touch

Basically the same as enabling automatic self-casting in the interface settings, except it’s disabled in party. May not need these if HealBot is a thing, but without it I like to use keyboard shortcuts to apply heals to my cursor and click portraits.

Hmmm… would love to use this to get it working for regular bags with or without ElvUI. Any chance you could update it? :slight_smile:

Sorry, I know you posted this a while ago… fingers crossed! :crossed_fingers:

Ehiz isn’t around these days.

Post the following into the website addon.bool.no to create/download a small standalone addon. Change the SetToScale numer to whatever scale you want (will require a /reload or logout/login to take effect).

local SetToScale = 0.7
for i=1, 5 do
	hooksecurefunc(_G["ContainerFrame"..i], "SetScale", function(self, scale)
		if scale ~= SetToScale then
			self:SetScale(SetToScale)
		end
	end)
end

Intended for the stock Blizzard UI bags. Results may vary if you have other addons interacting with the bags.

Thanks, but I’m mainly looking to reposition the bags where I want them more so than scale them.