Moved to linux

This commit is contained in:
rilgamon 2021-03-04 23:55:32 +01:00
parent 3f992696e7
commit 6705b96277
3 changed files with 147 additions and 147 deletions

16
README.md Normal file → Executable file
View File

@ -1,9 +1,9 @@
# zzAuctions # zzAuctions
Quality of Life improvements for auction house Quality of Life improvements for auction house
- Quick post from Auctionsoverview by clicking itembutton (picture at the top) - Quick post from Auctionsoverview by clicking itembutton (picture at the top)
- Adjust price by itemlevel (default blizz uses the lowest price regardless the itemlevel) - Adjust price by itemlevel (default blizz uses the lowest price regardless the itemlevel)
#### Links #### Links
[Releases](https://git.grml.de/rilgamon/zzAuctions/releases "Releases") | [Source](https://git.grml.de/rilgamon/zzAuctions "Source") | [Bugs&Comments](https://git.grml.de/rilgamon/zzAuctions/issues "Bugs&Comments") | [Donate](https://liberapay.com/bundesloser "Donate") | [Contact](https://mastodon.grml.de/@robin "Contact") [Releases](https://git.grml.de/rilgamon/zzAuctions/releases "Releases") | [Source](https://git.grml.de/rilgamon/zzAuctions "Source") | [Bugs&Comments](https://git.grml.de/rilgamon/zzAuctions/issues "Bugs&Comments") | [Donate](https://liberapay.com/bundesloser "Donate") | [Contact](https://mastodon.grml.de/@robin "Contact")

270
core.lua Normal file → Executable file
View File

@ -1,136 +1,136 @@
local addonName, addon = ... local addonName, addon = ...
local events = addon['events'] or CreateFrame("FRAME") local events = addon['events'] or CreateFrame("FRAME")
local prices, pricesIlvl local prices, pricesIlvl
local function getItem() local function getItem()
return AuctionHouseFrame.CommoditiesSellFrame.ItemDisplay.ItemButton:GetItemLocation() or AuctionHouseFrame.ItemSellFrame.ItemDisplay.ItemButton:GetItemLocation() return AuctionHouseFrame.CommoditiesSellFrame.ItemDisplay.ItemButton:GetItemLocation() or AuctionHouseFrame.ItemSellFrame.ItemDisplay.ItemButton:GetItemLocation()
end end
local function hookItem(self, ...) local function hookItem(self, ...)
-- print('hook') -- print('hook')
local il = getItem() local il = getItem()
if(il) then if(il) then
if(il:IsValid() and il:IsBagAndSlot()) then if(il:IsValid() and il:IsBagAndSlot()) then
local bid = C_Item.GetItemID(il) local bid = C_Item.GetItemID(il)
if(bid) then if(bid) then
-- print("hook",self:GetName(), ...) -- print("hook",self:GetName(), ...)
-- print(AuctionHouseFrame.CommoditiesSellFrame.ItemDisplay.ItemButton:GetItemLocation()) -- print(AuctionHouseFrame.CommoditiesSellFrame.ItemDisplay.ItemButton:GetItemLocation())
-- print(AuctionHouseFrame.ItemSellFrame.ItemDisplay.ItemButton:GetItemLocation()) -- print(AuctionHouseFrame.ItemSellFrame.ItemDisplay.ItemButton:GetItemLocation())
if(C_AuctionHouse.GetItemCommodityStatus(il) and prices[bid]) then if(C_AuctionHouse.GetItemCommodityStatus(il) and prices[bid]) then
-- print("CPrice", prices[bid]) -- print("CPrice", prices[bid])
else else
local lvl = C_Item.GetCurrentItemLevel(il) local lvl = C_Item.GetCurrentItemLevel(il)
-- print(lvl) -- print(lvl)
-- print("Price",lvl,pricesIlvl[bid][lvl]) -- print("Price",lvl,pricesIlvl[bid][lvl])
if(lvl and pricesIlvl[bid] and pricesIlvl[bid][lvl]) then if(lvl and pricesIlvl[bid] and pricesIlvl[bid][lvl]) then
AuctionHouseFrame.ItemSellFrame.PriceInput:SetAmount(pricesIlvl[bid][lvl]) AuctionHouseFrame.ItemSellFrame.PriceInput:SetAmount(pricesIlvl[bid][lvl])
end end
end end
end end
end end
end end
end end
function events:ITEM_SEARCH_RESULTS_UPDATED(event, item) function events:ITEM_SEARCH_RESULTS_UPDATED(event, item)
local itemID = item['itemID'] local itemID = item['itemID']
-- print("id",itemID) -- print("id",itemID)
if(itemID) then if(itemID) then
pricesIlvl[itemID] = {} pricesIlvl[itemID] = {}
end end
-- pricesIlvl[item['itemID']][item['itemLevel']] = 0 -- pricesIlvl[item['itemID']][item['itemLevel']] = 0
for i = 1, C_AuctionHouse.GetNumItemSearchResults(item) do for i = 1, C_AuctionHouse.GetNumItemSearchResults(item) do
local result = C_AuctionHouse.GetItemSearchResultInfo(item, i) local result = C_AuctionHouse.GetItemSearchResultInfo(item, i)
if(result and result.buyoutAmount) then if(result and result.buyoutAmount) then
local itemKey = result['itemKey'] local itemKey = result['itemKey']
local itemlevel = itemKey.itemLevel local itemlevel = itemKey.itemLevel
if(itemlevel and not pricesIlvl[itemID][itemlevel]) then if(itemlevel and not pricesIlvl[itemID][itemlevel]) then
pricesIlvl[itemID][itemlevel] = 0 pricesIlvl[itemID][itemlevel] = 0
end end
-- print(itemlevel, pricesIlvl[itemID][itemlevel], result.buyoutAmount,result.buyoutAmount<pricesIlvl[itemID][itemlevel]) -- print(itemlevel, pricesIlvl[itemID][itemlevel], result.buyoutAmount,result.buyoutAmount<pricesIlvl[itemID][itemlevel])
if(pricesIlvl[itemID][itemlevel] == 0 or result.buyoutAmount<pricesIlvl[itemID][itemlevel]) then if(pricesIlvl[itemID][itemlevel] == 0 or result.buyoutAmount<pricesIlvl[itemID][itemlevel]) then
pricesIlvl[itemID][itemlevel] = result.buyoutAmount pricesIlvl[itemID][itemlevel] = result.buyoutAmount
-- print("New price",itemlevel, result.buyoutAmount) -- print("New price",itemlevel, result.buyoutAmount)
end end
else else
-- print("nr", result, result.buyoutAmount) -- print("nr", result, result.buyoutAmount)
end end
end end
hookItem() hookItem()
end end
function events:COMMODITY_SEARCH_RESULTS_UPDATED(event, itemID) function events:COMMODITY_SEARCH_RESULTS_UPDATED(event, itemID)
prices[itemID] = 0 prices[itemID] = 0
for i = 1, C_AuctionHouse.GetNumCommoditySearchResults(itemID) do for i = 1, C_AuctionHouse.GetNumCommoditySearchResults(itemID) do
local result = C_AuctionHouse.GetCommoditySearchResultInfo(itemID, 1) local result = C_AuctionHouse.GetCommoditySearchResultInfo(itemID, 1)
-- print(unpack(result)) -- print(unpack(result))
if(prices[itemID] == 0 or result.unitPrice<prices[itemID]) then if(prices[itemID] == 0 or result.unitPrice<prices[itemID]) then
prices[itemID] = result.unitPrice prices[itemID] = result.unitPrice
-- print("New price", result.unitPrice) -- print("New price", result.unitPrice)
end end
end end
end end
function events:AUCTION_HOUSE_SHOW(event) function events:AUCTION_HOUSE_SHOW(event)
self:UnregisterEvent(event) self:UnregisterEvent(event)
for k,v in pairs(AuctionHouseFrame.ItemSellFrame.ItemDisplay.ItemButton) do for k,v in pairs(AuctionHouseFrame.ItemSellFrame.ItemDisplay.ItemButton) do
-- print("-- ",k,v) -- print("-- ",k,v)
end end
-- hooksecurefunc(AuctionHouseFrame.ItemSellFrame.ItemDisplay.ItemButton, "SwitchItemWithCursor", function(...) print("sil",...) end) -- hooksecurefunc(AuctionHouseFrame.ItemSellFrame.ItemDisplay.ItemButton, "SwitchItemWithCursor", function(...) print("sil",...) end)
-- AuctionHouseFrame.CommoditiesSellFrame.Overlay:HookScript("OnReceiveDrag", hookItem) -- AuctionHouseFrame.CommoditiesSellFrame.Overlay:HookScript("OnReceiveDrag", hookItem)
-- AuctionHouseFrame.ItemSellFrame.ItemDisplay.ItemButton:HookScript("OnReceiveDrag", hookItem) -- AuctionHouseFrame.ItemSellFrame.ItemDisplay.ItemButton:HookScript("OnReceiveDrag", hookItem)
-- AuctionHouseFrame.ItemSellFrame.ItemDisplay.ItemButton:HookScript("OnClick", hookItem) -- AuctionHouseFrame.ItemSellFrame.ItemDisplay.ItemButton:HookScript("OnClick", hookItem)
AuctionHouseFrameAuctionsFrame.ItemDisplay.ItemButton:HookScript("OnClick", function(self, button, ...) AuctionHouseFrameAuctionsFrame.ItemDisplay.ItemButton:HookScript("OnClick", function(self, button, ...)
if(button == "LeftButton") then if(button == "LeftButton") then
local itemid = self:GetParent().item local itemid = self:GetParent().item
local itemKey = self:GetParent().itemKey local itemKey = self:GetParent().itemKey
local itemlevel = itemKey.itemLevel local itemlevel = itemKey.itemLevel
for bag=0,4 do for bag=0,4 do
for slot=1,GetContainerNumSlots(bag) do for slot=1,GetContainerNumSlots(bag) do
local bagitem = ItemLocation:CreateFromBagAndSlot(bag, slot) local bagitem = ItemLocation:CreateFromBagAndSlot(bag, slot)
if(bagitem:IsValid()) then if(bagitem:IsValid()) then
local bid = C_Item.GetItemID(bagitem) local bid = C_Item.GetItemID(bagitem)
local lvl = C_Item.GetCurrentItemLevel(bagitem) local lvl = C_Item.GetCurrentItemLevel(bagitem)
if(bid == itemid) then if(bid == itemid) then
if(C_AuctionHouse.GetItemCommodityStatus(bagitem) and prices[bid]) then if(C_AuctionHouse.GetItemCommodityStatus(bagitem) and prices[bid]) then
-- print('isCommodity / Handwerksware', prices[bid]) -- print('isCommodity / Handwerksware', prices[bid])
C_AuctionHouse.PostCommodity(bagitem, 1, 1, prices[bid]) C_AuctionHouse.PostCommodity(bagitem, 1, 1, prices[bid])
-- C_AuctionHouse.SendSearchQuery(itemKey, {}, false) -- C_AuctionHouse.SendSearchQuery(itemKey, {}, false)
return return
else else
-- print(self:GetParent().itemLink,self:GetParent().itemLevel) -- print(self:GetParent().itemLink,self:GetParent().itemLevel)
if(lvl == itemlevel) then if(lvl == itemlevel) then
-- print('noCommodity / Singleitem') -- print('noCommodity / Singleitem')
C_AuctionHouse.PostItem(bagitem, 1, 1, nil, pricesIlvl[bid][lvl]) C_AuctionHouse.PostItem(bagitem, 1, 1, nil, pricesIlvl[bid][lvl])
-- C_AuctionHouse.SendSearchQuery(itemKey, {}, false) -- C_AuctionHouse.SendSearchQuery(itemKey, {}, false)
return return
end end
end end
-- local itemKey = C_AuctionHouse.MakeItemKey(bid) -- local itemKey = C_AuctionHouse.MakeItemKey(bid)
-- C_AuctionHouse.SendSearchQuery(itemKey, {}, false) -- C_AuctionHouse.SendSearchQuery(itemKey, {}, false)
end end
end end
end end
end end
end end
end) end)
end end
function events:ADDON_LOADED(event, arg1) function events:ADDON_LOADED(event, arg1)
-- print(event, arg1, addonName, arg1==addonName) -- print(event, arg1, addonName, arg1==addonName)
if(arg1 == addonName) then if(arg1 == addonName) then
-- print(addonName) -- print(addonName)
zzAuctionsDB = zzAuctionsDB or { zzAuctionsDB = zzAuctionsDB or {
['prices'] = {}, ['prices'] = {},
['pricesIlvl'] = {} ['pricesIlvl'] = {}
} }
prices = zzAuctionsDB['prices'] prices = zzAuctionsDB['prices']
pricesIlvl = zzAuctionsDB['pricesIlvl'] pricesIlvl = zzAuctionsDB['pricesIlvl']
self:UnregisterEvent(event) self:UnregisterEvent(event)
end end
end end
for event, func in pairs(events) do for event, func in pairs(events) do
if(type(func) == 'function') then if(type(func) == 'function') then
events:RegisterEvent(event) events:RegisterEvent(event)
end end
end end
events:SetScript("OnEvent", function(self, event, ...) events:SetScript("OnEvent", function(self, event, ...)
self[event](self, event, ...) self[event](self, event, ...)
end) end)

8
zzAuctions.toc Normal file → Executable file
View File

@ -1,5 +1,5 @@
## Interface: 90002 ## Interface: 90002
## Name: zzAuctions ## Name: zzAuctions
## SavedVariables: zzAuctionsDB ## SavedVariables: zzAuctionsDB
## X-WoWI-ID: 25886 ## X-WoWI-ID: 25886
core.lua core.lua