This commit is contained in:
Robin 2021-01-13 16:18:00 +01:00
commit 017f7c1cb5
23 changed files with 864 additions and 0 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "Common"]
path = Common
url = https://git.grml.de/rilgamon/Common.git

1
Common Submodule

@ -0,0 +1 @@
Subproject commit 762c59c6c6abc6ecaa71f3e36bb2c6dd16b8e0ed

15
Moduls/Moduls.xml Normal file
View File

@ -0,0 +1,15 @@
<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/ ..\FrameXML\UI.xsd">
<Script file="autogreed.lua"/>
<Script file="autoport.lua"/>
<Script file="noduel.lua"/>
<Script file="autogroup.lua"/>
<Script file="bopconfirm.lua"/>
<Script file="lootconfirm.lua"/>
<Script file="deconfirm.lua"/>
<Script file="sellgrey.lua"/>
<Script file="passdragon.lua"/>
<Script file="autorepair.lua"/>
<Script file="greedorbs.lua"/>
<Script file="hideclock.lua"/>
<Script file="oldbags.lua"/>
</Ui>

19
Moduls/auctionconfirm.lua Normal file
View File

@ -0,0 +1,19 @@
local name, addon = ...
local modName = "auctionconfirm"
local message = {
["enUS"] = "Confirm auction",
["deDE"] = "Auktion bestätigen"
}
addon['mhmods'] = addon['mhmods'] or {}
addon['mhmods'][#addon['mhmods'] + 1] = {
['name'] = modName,
['message'] = message[GetLocale()] or message["enUS"],
['init'] = function()
end,
['events'] = { "MAIL_SHOW" },
['onevent'] = function(event)
print(event)
end,
}

124
Moduls/autogreed.lua Normal file
View File

@ -0,0 +1,124 @@
local name, addon = ...
local modName = "autogreed"
local message = {
["enUS"] = "Greed or disentchant blue and green",
["deDE"] = "Gier/Entzaubern von gr\195\188nem/blauem Loot"
}
addon['mhmods'] = addon['mhmods'] or {}
local orbList = {
[45087] = true, -- runed orb
[52078] = true, -- chaos orb
}
local defaults = {
['deGreen'] = true,
['passGreen'] = false,
['deBlue'] = true,
['passBlue'] = false,
['deEpic'] = false,
['passEpic'] = false,
['skipNeed'] = true,
['ignoreOrbs'] = true,
['showBOE'] = 2,
['skipQuality'] = 0,
['skipQuest'] = true,
['skipPet'] = true,
['skipMount'] = true,
['skipHoliday'] = true,
}
local options
local function getPref2(key)
local db = addon['MH_GetDB'](modName, defaults)
return db[key]
end
local function getPref(pref)
return getPref2(pref[#pref])
end
local function setPref(pref,value)
local db = addon['MH_GetDB'](modName, defaults)
db[pref[#pref]] = value
end
local function checkPrefType(key, prefType)
local db = addon['MH_GetDB'](modName, defaults)
if(type(getPref2(key)) ~= prefType) then
db[key] = defaults[key]
end
end
local function initDBCheck()
for key,value in pairs(defaults) do
checkPrefType(key, type(defaults[key]))
end
end
local qualityTab = {'','Green','Blue','Epic','Legendary'}
local function START_LOOT_ROLL(event,id,...)
if (not id) then return end
if(getPref2('ignoreOrbs') and orbList[tonumber(addon:getItemId(GetLootRollItemLink(id)))]) then return end
local _, _, _, quality, bop, canNeed, canGreed, canDE = GetLootRollItemInfo(id)
local showNeed = getPref2('skipQuality') >= 0 and getPref2('skipQuality') or (GetAverageItemLevel() - 18)
local _,_,_,itemLevel,_,_,_,_,_,_,_, classID, subclassID = GetItemInfo(GetLootRollItemLink(id))
if(classID == 12 and getPref2('skipQuest')) then
return
elseif(classID == 15) then
if(subclassID == 5 and getPref2('skipMount')) then
return
elseif(subclassID == 2 and getPref2('skipPet')) then
return
elseif(subclassID == 3 and getPref2('skipHoliday')) then
return
end
end
if(canNeed and bop and getPref2('skipNeed')) then
if(showNeed < itemLevel) then
return
end
end
local arg1,arg2 = canDE and 3 or 2, 2
if(bop) then
RollOnLoot(id,getPref2('de'..qualityTab[quality]) and arg1 or arg2)
else
if(canNeed and quality>getPref2('showBOE') and getPref2('skipNeed')) then return end
if(getPref2('greedBOE')) then
RollOnLoot(id,getPref2('pass'..qualityTab[quality]) and nil or (quality==2 and arg1 or arg2))
else
RollOnLoot(id,arg1 == 3 and 3 or (getPref2('pass'..qualityTab[quality]) and nil or arg1))
end
end
end
addon['mhmods'][#addon['mhmods'] + 1] = {
['name'] = modName,
['message'] = message[GetLocale()] or message["enUS"],
['events'] = { "START_LOOT_ROLL" },
['onevent'] = START_LOOT_ROLL,
['init'] = function()
options = addon['MH_GetOptions']()
initDBCheck()
local grp = addon:AddConfigMenu({['name'] = modName, ['order'] = 20,['menuGet'] = getPref, ['menuSet'] = setPref},options)
addon:AddConfigEntry("zz_MiscHelper","header","disenchant","Disenchant",nil,1,nil,nil,nil,nil,grp)
addon:AddConfigEntry("zz_MiscHelper","toggle","deGreen","DE green",nil,2,nil,nil,nil,nil,grp)
addon:AddConfigEntry("zz_MiscHelper","toggle","deBlue","DE blue",nil,3,nil,nil,nil,nil,grp)
addon:AddConfigEntry("zz_MiscHelper","toggle","deEpic","DE epic",nil,4,nil,nil,nil,nil,grp)
addon:AddConfigEntry("zz_MiscHelper","header","boe","Bind on Equip",nil,5,nil,nil,nil,nil,grp)
addon:AddConfigEntry("zz_MiscHelper","toggle","greedBOE","Greed BoE",nil,6,nil,nil,nil,nil,grp)
addon:AddConfigEntry("zz_MiscHelper","range","showBOE","Show BoE",format("1, |c%s2|r, |c%s3|r, |c%s4|r Skip greeding BoE when quality is higher",select(4,GetItemQualityColor(2)),select(4,GetItemQualityColor(3)),select(4,GetItemQualityColor(4))),7,1,4,1,false,grp)
addon:AddConfigEntry("zz_MiscHelper","toggle","passGreen","Pass green BoE",nil,8,nil,nil,nil,nil,grp)
addon:AddConfigEntry("zz_MiscHelper","toggle","passBlue","Pass blue BoE",nil,9,nil,nil,nil,nil,grp)
addon:AddConfigEntry("zz_MiscHelper","toggle","passEpic","Pass epic BoE",nil,10,nil,nil,nil,nil,grp)
addon:AddConfigEntry("zz_MiscHelper","header","misc","Misc",nil,11,nil,nil,nil,nil,grp)
addon:AddConfigEntry("zz_MiscHelper","toggle","skipNeed","Show Need Rolls","Show items you can roll need for. Set minimum quality to hide low level items.",12,nil,nil,nil,nil,grp)
addon:AddConfigEntry("zz_MiscHelper","range","skipQuality","Minimum Quality","Dont show items with a quality lower than minimum quality when 'Show Need Rolls' is active. -1 means automagically your current average Itemlevel - 18",13,-1,1000,1,false,grp)
addon:AddConfigEntry("zz_MiscHelper","toggle","ignoreOrbs","Ignore orbs",nil,14,nil,nil,nil,nil,grp)
addon:AddConfigEntry("zz_MiscHelper","toggle","skipPet","Show Pets",nil,15,nil,nil,nil,nil,grp)
addon:AddConfigEntry("zz_MiscHelper","toggle","skipMount","Show Mounts",nil,16,nil,nil,nil,nil,grp)
addon:AddConfigEntry("zz_MiscHelper","toggle","skipHoliday","Show Holiday-Items",nil,17,nil,nil,nil,nil,grp)
addon:AddConfigEntry("zz_MiscHelper","toggle","skipQuest","Show Questitems",nil,17,nil,nil,nil,nil,grp)
end,
}

95
Moduls/autogroup.lua Normal file
View File

@ -0,0 +1,95 @@
local name, addon = ...
local modName = "autogroup"
local message = {
["enUS"] = "Autoaccept invites",
["deDE"] = "Gruppeneinladungen annehmen"
}
local f
local accepted = false
addon['mhmods'] = addon['mhmods'] or {}
local defaults = {
['fugonly'] = true,
}
local function myGuild(unitname)
for i=1,GetNumGuildMembers() do
local rostername, _, _, _, _, _, _, _, online = GetGuildRosterInfo(i)
local shortname = strsplit("-",rostername,2)
if(online and (rostername == unitname or shortname == unitname)) then
return true
end
end
return false
end
local function myFriend(unitname)
for i = 1, C_FriendList.GetNumFriends() do
local res = C_FriendList.GetFriendInfoByIndex(i)
if(res and res['connected']) then
local shortname = strsplit("-",res['name'],2)
if(res['name'] == unitname or shortname == unitname) then
return true
end
end
end
return false
end
local function myBNetFriend(unitname)
local numFriends,numOnline = BNGetNumFriends()
for i = 1, numFriends do
local res = C_BattleNet.GetFriendAccountInfo(i)
if(res and res['gameAccountInfo'] and res['gameAccountInfo']['isOnline']) then
if(res['gameAccountInfo']['clientProgram'] == BNET_CLIENT_WOW) then
return res['gameAccountInfo']['characterName'] == unitname
end
end
end
end
local function getPref2(key)
local db = addon['MH_GetDB'](modName, defaults)
return db[key]
end
local function getPref(pref)
return getPref2(pref[#pref])
end
local function setPref(pref,value)
local db = addon['MH_GetDB'](modName, defaults)
db[pref[#pref]] = value
end
local options
local function watch(self)
if(self['delay'] > GetTime()) then return end
for index = 1, STATICPOPUP_NUMDIALOGS, 1 do
local frame = _G["StaticPopup"..index];
if( frame:IsShown() and (frame['which'] == "PARTY_INVITE") ) then
local btn = _G["StaticPopup"..index..(accepted and "Button1" or "Button2")]
btn:GetScript("OnClick")(btn,'LeftButton',0)
end
end
accepted = nil
self:Hide()
end
addon['mhmods'][#addon['mhmods'] + 1] = {
['name'] = modName,
['message'] = message[GetLocale()] or message["enUS"],
['init'] = function()
f = CreateFrame("Frame")
f['delay']=0
f:Hide()
f:SetScript("OnUpdate", watch)
options = addon['MH_GetOptions']()
local grp = addon:AddConfigMenu({['name'] = modName, ['order'] = 20,['menuGet'] = getPref,['menuSet'] = setPref},options)
addon:AddConfigEntry("zz_MiscHelper","toggle","fugonly","Friends&Guild only",nil,1,nil,nil,nil,nil,grp)
end,
['events'] = { "PARTY_INVITE_REQUEST" },
['onevent'] = function (event, arg1)
if((getPref2('fugonly') and (myBNetFriend(arg1) or myFriend(arg1) or myGuild(arg1))) or not getPref2('fugonly')) then
accepted = true
end
f['delay'] = GetTime() + 0.25
f:Show()
end,
}

17
Moduls/autoport.lua Normal file
View File

@ -0,0 +1,17 @@
local name, addon = ...
local modName = "autoport"
local message = {
["enUS"] = "Autoaccept summons",
["deDE"] = "Port automatisch annehmen"
}
addon['mhmods'] = addon['mhmods'] or {}
addon['mhmods'][#addon['mhmods'] + 1] = {
['name'] = modName,
['message'] = message[GetLocale()] or message["enUS"],
['events'] = { "CONFIRM_SUMMON" },
['onevent'] = function ()
StaticPopup_Hide("CONFIRM_SUMMON")
C_SummonInfo.ConfirmSummon()
end,
}

60
Moduls/autorepair.lua Normal file
View File

@ -0,0 +1,60 @@
local name, addon = ...
local modName = "autorepair"
local getPref = addon['MH_GetPref']
local options
local message = {
["enUS"] = "Autorepair",
["deDE"] = "Automatisch reparieren",
['repaircostgb'] = function(r)
if(GetLocale() == "deDE") then
return "Reparaturkosten zu Lasten der Gildenbank "..addon:buildMoneyString(r,true)
else
return "Guildvaultrepaircost "..addon:buildMoneyString(r,true)
end
end,
['repaircost'] = function(r)
if(GetLocale() == "deDE") then
return "Reparaturkosten "..addon:buildMoneyString(r,true)
else
return "Repaired for "..addon:buildMoneyString(r,true)
end
end,
}
addon['mhmods'] = addon['mhmods'] or {}
local guildrepair = false -- switch to true to enable guildrepair
local function MERCHANT_SHOW()
guildrepair = getPref('guildrepair') or false
if(CanMerchantRepair()) then
local m = GetMoney()
local r = GetRepairAllCost()
local gbr = false
if(guildrepair) then
if(CanGuildBankRepair()) then
gbr = true
end
end
if(r > 0 and (m > r or gbr)) then
if(gbr) then
RepairAllItems(1)
addon:Print(message['repaircostgb'](r))
else
RepairAllItems()
addon:Print(message['repaircost'](r))
end
end
end
end
addon['mhmods'][#addon['mhmods'] + 1] = {
['name'] = modName,
['message'] = message[GetLocale()] or message["enUS"],
['events'] = { "MERCHANT_SHOW" },
['onevent'] = MERCHANT_SHOW,
['init'] = function()
options = addon['MH_GetOptions']()
local grp = addon:AddConfigMenu({['name'] = modName, ['order'] = 20},options)
addon:AddConfigEntry("zz_MiscHelper","toggle","guildrepair",GetLocale() == "deDE" and "Benutze Gildenbank" or "Use Guildbank funds",nil,1,nil,nil,nil,nil,grp)
end
}

18
Moduls/bopconfirm.lua Normal file
View File

@ -0,0 +1,18 @@
local name, addon = ...
local modName = "bopconfirm"
local message = {
["enUS"] = "Autoaccept BOP",
["deDE"] = "BOP automatisch best\195\164tigen"
}
addon['mhmods'] = addon['mhmods'] or {}
addon['mhmods'][#addon['mhmods'] + 1] = {
['name'] = modName,
['message'] = message[GetLocale()] or message["enUS"],
['events'] = { "LOOT_BIND_CONFIRM" },
['onevent'] = function (event, id)
ConfirmLootSlot(id)
StaticPopup_Hide("LOOT_BIND")
end,
}

19
Moduls/deconfirm.lua Normal file
View File

@ -0,0 +1,19 @@
local name, addon = ...
local modName = "deconfirm"
local message = {
["enUS"] = "Autoaccept Disenchant",
["deDE"] = "Entzaubern best\195\164tigen"
}
addon['mhmods'] = addon['mhmods'] or {}
addon['mhmods'][#addon['mhmods'] + 1] = {
['name'] = modName,
['skipClassic'] = true,
['message'] = message[GetLocale()] or message["enUS"],
['events'] = { "CONFIRM_DISENCHANT_ROLL" },
['onevent'] = function (event, id, typ)
GetLootRollItemInfo(id)
GetLootRollItemInfo(id)
ConfirmLootRoll(id,typ)
end,
}

56
Moduls/greedorbs.lua Normal file
View File

@ -0,0 +1,56 @@
local name, addon = ...
local modName = "greedorbs"
local message = {
["enUS"] = "Autogreed Runed Orb/Chaos Orb",
["deDE"] = "Gier f\195\188r runenbeschriebene Kugel/Chaoskugel"
}
addon['mhmods'] = addon['mhmods'] or {}
local orbList = {
[45087] = true, -- runed orb
[52078] = true, -- chaos orb
}
local options
local defaults = {
}
local function getPref2(key)
local db = addon['MH_GetDB'](modName, defaults)
return db[key]
end
local function getPref(pref)
return getPref2(pref[#pref])
end
local function setPref(pref,value)
local db = addon['MH_GetDB'](modName, defaults)
db[pref[#pref]] = value
end
addon['mhmods'][#addon['mhmods'] + 1] = {
['name'] = modName,
['message'] = message[GetLocale()] or message["enUS"],
['events'] = { "START_LOOT_ROLL"},
['onevent'] = function (event, id, ...)
if (not id) then return end
-- print("go",tonumber(addon['getItemId'](GetLootRollItemLink(id))),orbList[tonumber(addon['getItemId'](GetLootRollItemLink(id)))])
if(orbList[tonumber(addon:getItemId(GetLootRollItemLink(id)))]) then
if(getPref2('needOrb'..addon:getItemId(GetLootRollItemLink(id)))) then
RollOnLoot(id, 1)
else
RollOnLoot(id, 2)
end
end
end,
['init'] = function()
options = addon['MH_GetOptions']()
local grp = addon:AddConfigMenu({['name'] = modName, ['order'] = 20,['menuGet'] = getPref, ['menuSet'] = setPref},options)
for k,v in pairs(orbList) do
local itemName = GetItemInfo(k)
if(itemName) then
addon:AddConfigEntry("zz_MiscHelper","toggle","needOrb"..k,"Need "..itemName,"Greed is default if you dont need.",1,nil,nil,nil,nil,grp)
end
end
end,
}

35
Moduls/hideclock.lua Normal file
View File

@ -0,0 +1,35 @@
local name, addon = ...
local modName = "hideclock"
local message = {
["enUS"] = "Hide the minimap-clock",
["deDE"] = "Versteckt die Minimap-Uhr"
}
addon['mhmods'] = addon['mhmods'] or {}
local function script(self)
self:Hide()
end
local orgShow = nil
local function hideClock()
TimeManagerClockButton:SetScript("OnUpdate", nil)
TimeManagerClockButton:SetScript("OnEvent", nil)
orgShow = orgShow or TimeManagerClockButton:GetScript("OnShow")
TimeManagerClockButton:SetScript("OnShow", script)
TimeManagerClockButton:Hide()
end
local function unhideClock()
TimeManagerClockButton:SetScript("OnUpdate", TimeManagerClockButton_OnUpdate)
TimeManagerClockButton:SetScript("OnShow", orgShow)
TimeManagerClockButton:Show()
end
addon['mhmods'][#addon['mhmods'] + 1] = {
['name'] = modName,
['message'] = message[GetLocale()] or message["enUS"],
['init'] = function()
LoadAddOn("Blizzard_TimeManager")
hideClock()
end,
['disable'] = unhideClock,
['events'] = { "PLAYER_ENTERING_WORLD" },
['onevent'] = hideClock,
}

17
Moduls/lootconfirm.lua Normal file
View File

@ -0,0 +1,17 @@
local name, addon = ...
local modName = "lootconfirm"
local message = {
["enUS"] = "Autoaccept LOOT",
["deDE"] = "W\195\188rfeln best\195\164tigen"
}
addon['mhmods'] = addon['mhmods'] or {}
addon['mhmods'][#addon['mhmods'] + 1] = {
['name'] = modName,
['message'] = message[GetLocale()] or message["enUS"],
['events'] = { "CONFIRM_LOOT_ROLL" },
['onevent'] = function (event, id, rollType)
StaticPopup_Hide(event)
ConfirmLootRoll(id,rollType)
end,
}

17
Moduls/noduel.lua Normal file
View File

@ -0,0 +1,17 @@
local name, addon = ...
local modName = "noduel"
local message = {
["enUS"] = "Reject duels",
["deDE"] = "Duelle ablehnen"
}
addon['mhmods'] = addon['mhmods'] or {}
addon['mhmods'][#addon['mhmods'] + 1] = {
['name'] = modName,
['message'] = message[GetLocale()] or message["enUS"],
['events'] = { "DUEL_REQUESTED" },
['onevent'] = function (event)
StaticPopup_Hide(event)
CancelDuel()
end,
}

76
Moduls/oldbags.lua Normal file
View File

@ -0,0 +1,76 @@
local name, addon = ...
local modName = "oldbags"
local message = {
["enUS"] = "Open only bagpack",
["deDE"] = "Nur Rucksack \195\182ffnen"
}
addon['mhmods'] = addon['mhmods'] or {}
local function MailFrame_OnEvent(self, event, ...)
if ( event == "MAIL_SHOW" ) then
ShowUIPanel(MailFrame);
if ( not MailFrame:IsShown() ) then
CloseMail();
return;
end
-- Update the roster so auto-completion works
if ( IsInGuild() and GetNumGuildMembers() == 0 ) then
GuildRoster();
end
OpenBackpack();
SendMailFrame_Update();
MailFrameTab_OnClick(nil, 1);
CheckInbox();
DoEmote("READ", nil, true);
elseif ( event == "MAIL_INBOX_UPDATE" ) then
InboxFrame_Update();
OpenMail_Update();
elseif ( event == "MAIL_SEND_INFO_UPDATE" ) then
SendMailFrame_Update();
elseif ( event == "MAIL_SEND_SUCCESS" ) then
SendMailFrame_Reset();
PlaySound(836);
-- If open mail frame is open then switch the mail frame back to the inbox
if ( SendMailFrame.sendMode == "reply" ) then
MailFrameTab_OnClick(nil, 1);
end
elseif ( event == "MAIL_FAILED" ) then
SendMailMailButton:Enable();
elseif ( event == "MAIL_SUCCESS" ) then
SendMailMailButton:Enable();
if ( InboxNextPageButton:IsEnabled() ~= 0 ) then
InboxGetMoreMail();
end
elseif ( event == "MAIL_CLOSED" ) then
CancelEmote();
HideUIPanel(MailFrame);
CloseAllBags(self);
SendMailFrameLockSendMail:Hide();
StaticPopup_Hide("CONFIRM_MAIL_ITEM_UNREFUNDABLE");
elseif ( event == "CLOSE_INBOX_ITEM" ) then
local arg1 = ...;
if ( arg1 == InboxFrame.openMailID ) then
HideUIPanel(OpenMailFrame);
end
elseif ( event == "MAIL_LOCK_SEND_ITEMS" ) then
local slotNum, itemLink = ...;
SendMailFrameLockSendMail:Show();
local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount, itemEquipLoc, itemTexture = GetItemInfo(itemLink);
local r, g, b = GetItemQualityColor(itemRarity)
StaticPopup_Show("CONFIRM_MAIL_ITEM_UNREFUNDABLE", nil, nil, {["texture"] = itemTexture, ["name"] = itemName, ["color"] = {r, g, b, 1}, ["link"] = itemLink, ["slot"] = slotNum});
elseif ( event == "MAIL_UNLOCK_SEND_ITEMS") then
SendMailFrameLockSendMail:Hide();
StaticPopup_Hide("CONFIRM_MAIL_ITEM_UNREFUNDABLE");
end
end
addon['mhmods'][#addon['mhmods'] + 1] = {
['name'] = modName,
['message'] = message[GetLocale()] or message["enUS"],
['events'] = { "PLAYER_ENTERING_WORLD" },
['init'] = function()
MailFrame:SetScript("OnEvent", MailFrame_OnEvent)
end,
}

20
Moduls/passdragon.lua Normal file
View File

@ -0,0 +1,20 @@
local name, addon = ...
local modName = "passdragon"
local message = {
["enUS"] = "Dont roll for Bronze Drake",
["deDE"] = "Auf Bronze Drachen passen"
}
addon['mhmods'] = addon['mhmods'] or {}
local dragons = {
[43951] = true, -- bronze drake
}
addon['mhmods'][#addon['mhmods'] + 1] = {
['name'] = modName,
['message'] = message[GetLocale()] or message["enUS"],
['events'] = { "START_LOOT_ROLL" },
['onevent'] = function (event,id,...)
if (not id) then return end
local itemId = tonumber(addon:getItemId(GetLootRollItemLink(id)))
if(dragons[itemId]) then RollOnLoot(id, 0) end
end,
}

98
Moduls/sellgrey.lua Normal file
View File

@ -0,0 +1,98 @@
local name, addon = ...
local modName = "sellgrey"
local GetLocale = GetLocale
local defaults = {
['sellCards'] = true,
}
local options
local message = {
["enUS"] = "Sell grey items",
["deDE"] = "Verkaufe graue Gegenst\195\164nde",
['solditem'] = function(link,price)
if(GetLocale() == "deDE") then
return link.." verkauft f\195\188r "..addon:buildMoneyString(price,true)
else
return link.." sold for "..addon:buildMoneyString(price,true)
end
end,
['earnedmoney'] = function(earnedMoney)
if(GetLocale() == "deDE") then
return addon:buildMoneyString(earnedMoney,true).." verdient."
else
return "Earned "..addon:buildMoneyString(earnedMoney,true).."."
end
end,
}
local NUM_BAG_SLOTS = NUM_BAG_SLOTS
local GetContainerNumSlots = GetContainerNumSlots
local GetContainerItemLink = GetContainerItemLink
local GetContainerItemInfo = GetContainerItemInfo
local function getPref2(key)
local db = addon['MH_GetDB'](modName, defaults)
return db[key]
end
local function getPref(pref)
return getPref2(pref[#pref])
end
local function setPref(pref,value)
local db = addon['MH_GetDB'](modName, defaults)
db[pref[#pref]] = value
end
local function MERCHANT_SHOW(self,event,dont)
local info,i = {},{}
local a = 0
local numberOfSlots,link,id
local earnedMoney = 0
while(a<=NUM_BAG_SLOTS) do
numberOfSlots = GetContainerNumSlots(a)
local b = 1
while(b<=numberOfSlots) do
link = GetContainerItemLink(a, b)
if(link) then
id = addon:getItemId(link)
if(id) then
info = addon:itemInfo(id)
if(info) then
if(info['itemRarity'] == 0 or (getPref2('sellCards') and info['itemName'] == GetItemInfo(62559))) then
if(info['itemSellPrice'] and info['itemSellPrice'] > 0) then
local _, itemCount, _, _, _ = GetContainerItemInfo(a, b)
if(not dont) then
addon:Print(message['solditem'](link,info['itemSellPrice']))
end
earnedMoney = earnedMoney + info['itemSellPrice'] * itemCount
UseContainerItem(a, b)
end
end
end
end
end
b = b + 1
end
a = a + 1
end
if(earnedMoney > 0 and not dont) then
addon:Print(message['earnedmoney'](earnedMoney))
end
if(earnedMoney>0 and not dont) then
C_Timer.After(0.5,function() MERCHANT_SHOW(self,event,true) end)
end
end
addon['mhmods'] = addon['mhmods'] or {}
addon['mhmods'][#addon['mhmods'] + 1] = {
['name'] = modName,
['message'] = message[GetLocale()] or message["enUS"],
['events'] = { "MERCHANT_SHOW" },
['onevent'] = MERCHANT_SHOW,
['init'] = function()
options = addon['MH_GetOptions']()
local grp = addon:AddConfigMenu({['name'] = modName, ['order'] = 20,['menuGet'] = getPref, ['menuSet'] = setPref},options)
addon:AddConfigEntry("zz_MiscHelper","toggle","sellCards","Sell Fortune Cards",nil,1,nil,nil,nil,nil,grp)
end
}

19
Moduls/test.lua Normal file
View File

@ -0,0 +1,19 @@
local name, addon = ...
local modName = "test"
local message = {
["enUS"] = "Test - Open Mailbox",
["deDE"] = "Test - Oeffne Briefkasten"
}
addon['mhmods'] = addon['mhmods'] or {}
addon['mhmods'][#addon['mhmods'] + 1] = {
['name'] = modName,
['message'] = message[GetLocale()] or message["enUS"],
['init'] = function()
end,
['events'] = { "MAIL_SHOW" },
['onevent'] = function(event)
print(event)
end,
}

130
core.lua Normal file
View File

@ -0,0 +1,130 @@
local name, addon = ...
local parentName = addon['parentName'] or "BrokerPack"
local childName = "zz_MiscHelper"
local defaults = {
['test'] = false,
['sellgrey'] = true,
['noduel'] = true,
['autorepair'] = false,
['hideclock'] = true,
}
local options = {
}
addon['mhmods'] = addon['mhmods'] or {}
local mods = {}
local events = {}
local registered = {}
local db = {}
local ldbicon = LibStub:GetLibrary("LibDBIcon-1.0")
local function OnClick(self, button)
if(IsShiftKeyDown() and button == "LeftButton") then
addon['db']['global']['ldbicons'][childName]['hide'] = not addon['db']['global']['ldbicons'][childName]['hide']
if(ldbicon) then
if(addon['db']['global']['ldbicons'][childName]['hide']) then
ldbicon:Hide(childName)
else
ldbicon:Show(childName)
end
end
else
if(InterfaceOptionsFrame:IsVisible() and not InCombatLockdown()) then
InterfaceOptionsFrame:Hide()
else
InterfaceOptionsFrame_OpenToCategory(childName)
InterfaceOptionsFrame_OpenToCategory(childName) -- Twice because of a bug in InterfaceOptionsFrame_OpenToCategory
end
end
end
local function eventHandler(self, event, ...)
for k,v in pairs(mods) do
if(type(events[v][event]) == 'function' and db[v]) then
events[v][event](event, ...)
end
end
end
local inited = {}
local function iterateModuls()
for _, modul in ipairs(addon['mhmods']) do
if((addon:IsClassic() and not modul['skipClassic']) or not addon:IsClassic()) then
mods[#mods + 1] = modul['name']
for _, event in ipairs(modul['events']) do
events[modul['name']] = { [event] = modul['onevent']}
if(not registered[event]) then
registered[event] = true
addon:RegisterFunc(event, "OnEvent", eventHandler)
end
end
addon:AddConfigEntry(childName, "toggle",modul['name'],modul['message'],nil,1,nil,nil,nil,nil,options['args'][childName])
if(type(modul['init']) == 'function' and db[modul['name']]) then
modul['init']()
inited[modul['name']] = true
end
end
end
end
addon['MH_GetPref'] = function(key)
return db[key]
end
addon['MH_GetDB'] = function(subTable, def)
if(not subTable) then return db end
def = def or {}
local key = subTable.."Settings"
db[key] = db[key] or CopyTable(def)
return db[key]
end
addon['MH_SetPref'] = function(key, value)
db[key] = value
end
addon['MH_GetOptions'] = function()
return options
end
local function getPref(pref)
return db[pref[#pref]]
end
local function setPref(pref,value)
db[pref[#pref]] = value
if(value and not inited[pref[#pref]]) then
for _, modul in ipairs(addon['mhmods']) do
if(modul['name'] == pref[#pref]) then
if(type(modul['init']) == 'function') then
modul['init']()
break
end
end
end
end
if(not value) then
for _, modul in ipairs(addon['mhmods']) do
if(modul['name'] == pref[#pref]) then
if(type(modul['disable']) == 'function') then
modul['disable']()
break
end
end
end
end
end
local function init()
options = addon:InitConfig(childName, true, {
['name'] = childName,
['typ'] = 'launcher',
['OnClick'] = OnClick,
}, getPref, setPref)
db = addon['db']['profile'][childName]
iterateModuls()
end
addon:startup(name, childName, init, false, defaults)

BIN
icon2.tga Normal file

Binary file not shown.

6
license.txt Normal file
View File

@ -0,0 +1,6 @@
The following license excludes the libraries (Libs) included. See the libraries directory or website.
This AddOn is public domain. That means you can change it, rename it or paint it yellow.
My name (Rilgamon) is valid only for WoWInterface.com and curse.com.
If you use/offer this addon on another website please remove my name.
If you want to give me credit you can replace it with a link to my profile on WoWInterface.com.

4
pack.xml Normal file
View File

@ -0,0 +1,4 @@
<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/ ..\FrameXML\UI.xsd">
<Script file="core.lua"/>
<Include file="Moduls\Moduls.xml"/>
</Ui>

15
zz_MiscHelper.toc Normal file
View File

@ -0,0 +1,15 @@
## Interface: 90002
## X-Repository: https://svn.grml.de/zz_MiscHelper
## X-WoWI-ID: 15492
## X-Curse-Project-ID: 22761
## X-TOC-Classic: 11302
## Title: MiscHelper
## Notes: Misc things to make your life easier
## Notes-deDE: Verschiedene Dinge um das Leben zu vereinfachen
## Author: Rilgamon
## SavedVariables: zz_MiscHelperDB
## LoadManagers: AddonLoader
## X-LoadOn-Always: delayed
## OptionalDeps: Ace3,BrokerPack,LibBabble-3.0,zzLibCommon
Common\common.xml
pack.xml