Go to Page... |
Compatibility: | Embers of Neltharion (10.1.0) |
Updated: | 05-10-23 10:28 PM |
Created: | 06-01-15 11:23 AM |
Downloads: | 3,306 |
Favorites: | 4 |
MD5: |
gmLoot
A small LDB plugin to change the current loot specifications (AUTOLOOT yes/no) and to autoloot coins and currencies and/or quest items only. It manages also AutoDeposit reags at bank.
It shows in a broker display compatible the actual loot settings.
The original looting idea is from "Semi-Auto Looter" by SmileySL.
Requires a data broker display like chocolate bar, bazooka, ninjapanel, stat block, titan panel, docking station, buttonbin and more.
The scale of tooltip can be changed (and saved) by clicking on databroker display:
SHIFT+LEFT Click decrease scale till <= 0.8 SHIFT+RIGHT Click increase scale till >= 2.0 SHIFT+MIDDLE Click reset scale to 1
File Name |
Version |
Size |
Author |
Date |
1000-2022110601 |
25kB |
gmarco |
11-06-22 03:10 AM |
|
915-2021110401 |
25kB |
gmarco |
11-03-21 11:23 PM |
|
915-2021110301 |
24kB |
gmarco |
11-03-21 01:29 PM |
Comment Options |
10-03-15, 10:44 AM | |
|
... and now it's time to fix all others addons of mine with the same best practices
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot. |
|
gmarco |
View Public Profile |
Send a private message to gmarco |
Find More Posts by gmarco |
Add gmarco to Your Buddy List |
gmarco |
View Public Profile |
Send a private message to gmarco |
Find More Posts by gmarco |
Add gmarco to Your Buddy List |
gmarco |
View Public Profile |
Send a private message to gmarco |
Find More Posts by gmarco |
Add gmarco to Your Buddy List |
10-02-15, 05:20 AM | ||
|
-------------------------------- You should never specify both OnTooltipShow and OnEnter/OnLeave. When possible, just use OnTooltipShow, and let the display handle showing, positioning, and hiding the tooltip. The only reason to use OnEnter/OnLeave is if you're using a custom tooltip object (like LibQTip) or want to do something other than show a tooltip when the user mouses over your plugin. In your case, just use OnTooltipShow. Also, your OnTooltipShow method doesn't get your data object as its first argument, but does get a reference to the tooltip object being used, so this: Code:
function dataobj:OnTooltipShow() Code:
function dataobj.OnTooltipShow(tooltip) -------------------------------- You're currently doing this in both your OnClick and OnEnter methods: Code:
if InCombatLockdown() then return end -------------------------------- "elseif" is your friend! Code:
if button == "RightButton" then -- stuff end if button == "MiddleButton" then -- stuff end if button == "LeftButton" then -- stuff end -------------------------------- You don't need to (and shouldn't) create 3 separate frames to handle events. One frame can handle multiple events: Code:
local frame = CreateFrame("Frame") frame:RegisterEvent("RECEIVED_APPLES") frame:RegisterEvent("RECEIVED_BANANAS") frame:RegisterEvent("RECEIVED_COCONUTS") frame:SetScript("OnEvent", function(self, event, ...) if event == "RECEIVED_APPLES" then print("It's an apple!") elseif event == "RECEIVED_BANANAS" or event == "RECEIVED_COCONUTS" then print("It's either a banana or a coconut.") end end) When you initialize a saved variable in the main chunk (eg. right away when WoW loads your file, not waiting for any events) it will always be nil so there's no purpose in checking whether it's anything else. Code:
GMLOOT = GMLOOT or {} Code:
GMLOOT = {} Code:
GMLOOT["COINS"] = GMLOOT["COINS"] or true You should replace these three lines with this: Code:
GMLOOT = { COINS = true, QUEST = true, } -------------------------------- You could use boolean values more effectively. For example, you can simplify things like this: Code:
if GMLOOT["QUEST"] == true then GMLOOT["QUEST"] = false else GMLOOT["QUEST"] = true end Code:
GMLOOT["QUEST"] = not GMLOOT["QUEST"] Code:
if GMLOOT["COIN"] == false then summary = summary .. "[autoloot money no] " else summary = summary .. "[autoloot money yes] " end Code:
if GMLOOT["COIN"] then summary = summary .. "[autoloot money yes] " else summary = summary .. "[autoloot money no] " end Code:
if GetCVar("autoLootDefault") == "1" then Code:
if GetCVarBool("autoLootDefault") then Don't print stuff every time the player logs in. Give them credit for being able to remember that they installed your addon and configured it to their liking. When it's just your addon spamming, it's maybe not so bad, but imagine that every addon you use prints even just one line of text when you log in. That's a ton of spam, and not only is annoying, but also ends up hiding things that actually matter, like your guild's message of the day.
__________________
Retired author of too many addons. Message me if you're interested in taking over one of my addons. Don’t message me about addon bugs or programming questions. |
|
|
Phanx |
View Public Profile |
Send a private message to Phanx |
Find More Posts by Phanx |
Add Phanx to Your Buddy List |
gmarco |
View Public Profile |
Send a private message to gmarco |
Find More Posts by gmarco |
Add gmarco to Your Buddy List |