vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | --[[ |
2 | Ludwig_SellValue - |
||
3 | Originally based on SellValueLite, this addon allows viewing of sellvalues |
||
4 | --]] |
||
5 | |||
6 | local currentPlayer = UnitName("player") |
||
7 | |||
8 | --[[ Local Functions ]]-- |
||
9 | |||
10 | local function LinkToID(link) |
||
11 | if link then |
||
12 | local _, _, id = string.find(link, "(%d+):"); |
||
13 | return tonumber(id); |
||
14 | end |
||
15 | end |
||
16 | |||
17 | local function AddOwners(frame, id) |
||
18 | if not(frame and id and BagnonSets.showForeverTooltips) then return; end |
||
19 | |||
20 | for player in BagnonDB.GetPlayers() do |
||
21 | if player ~= currentPlayer then |
||
22 | local invCount = BagnonDB.GetItemTotal(id, player, -2) |
||
23 | for bagID = 0, 4 do |
||
24 | invCount = invCount + BagnonDB.GetItemTotal(id, player, bagID) |
||
25 | end |
||
26 | |||
27 | local bankCount = BagnonDB.GetItemTotal(id, player, -1) |
||
28 | for bagID = 5, 10 do |
||
29 | bankCount = bankCount + BagnonDB.GetItemTotal(id, player, bagID) |
||
30 | end |
||
31 | |||
32 | if (invCount + bankCount) > 0 then |
||
33 | local tooltipString = player .. " has" |
||
34 | if invCount > 0 then |
||
35 | tooltipString = tooltipString .. " " .. invCount .. " (Bags)"; |
||
36 | end |
||
37 | if bankCount > 0 then |
||
38 | tooltipString = tooltipString .. " " .. bankCount .. " (Bank)"; |
||
39 | end |
||
40 | frame:AddLine(tooltipString, 0, 0.8, 1); |
||
41 | end |
||
42 | end |
||
43 | end |
||
44 | end |
||
45 | |||
46 | --[[ Function Hooks ]]-- |
||
47 | |||
48 | local Blizz_ContainerFrameItemButton_OnEnter = ContainerFrameItemButton_OnEnter; |
||
49 | ContainerFrameItemButton_OnEnter = function() |
||
50 | Blizz_ContainerFrameItemButton_OnEnter(); |
||
51 | |||
52 | local bag = this:GetParent():GetID(); |
||
53 | local slot = this:GetID(); |
||
54 | |||
55 | AddOwners(GameTooltip, LinkToID(GetContainerItemLink(bag, slot))); |
||
56 | GameTooltip:Show(); |
||
57 | end |
||
58 | |||
59 | local Bliz_GameTooltip_SetLootItem = GameTooltip.SetLootItem; |
||
60 | GameTooltip.SetLootItem = function(self, slot) |
||
61 | Bliz_GameTooltip_SetLootItem(self, slot); |
||
62 | |||
63 | AddOwners(self, LinkToID(GetLootSlotLink(slot))); |
||
64 | self:Show(); |
||
65 | end |
||
66 | |||
67 | local Bliz_SetHyperlink = GameTooltip.SetHyperlink; |
||
68 | GameTooltip.SetHyperlink = function(self, link, count) |
||
69 | if link then |
||
70 | Bliz_SetHyperlink(self, link, count); |
||
71 | |||
72 | if not count then |
||
73 | count = 1; |
||
74 | end |
||
75 | |||
76 | local id = LinkToID(link); |
||
77 | if id then |
||
78 | AddOwners(self, id); |
||
79 | else |
||
80 | AddOwners(self, link); |
||
81 | end |
||
82 | self:Show(); |
||
83 | end |
||
84 | end |
||
85 | |||
86 | local Bliz_GameTooltip_SetLootRollItem = GameTooltip.SetLootRollItem; |
||
87 | GameTooltip.SetLootRollItem = function(self, rollID) |
||
88 | Bliz_GameTooltip_SetLootRollItem(self, rollID); |
||
89 | |||
90 | AddOwners(self, LinkToID(GetLootRollItemLink(rollID))); |
||
91 | self:Show(); |
||
92 | end |
||
93 | |||
94 | local Bliz_SetItemRef = SetItemRef; |
||
95 | SetItemRef = function(link, text, button) |
||
96 | Bliz_SetItemRef(link, text, button); |
||
97 | |||
98 | AddOwners(ItemRefTooltip, LinkToID(link)); |
||
99 | ItemRefTooltip:Show(); |
||
100 | end |
||
101 | |||
102 | local Bliz_GameTooltip_SetAuctionItem = GameTooltip.SetAuctionItem; |
||
103 | GameTooltip.SetAuctionItem = function(self, type, index) |
||
104 | Bliz_GameTooltip_SetAuctionItem(self, type, index); |
||
105 | |||
106 | AddOwners(self, LinkToID(GetAuctionItemLink(type, index))); |
||
107 | self:Show(); |
||
108 | end |
||
109 | |||
110 | --[[ Money Frame Tooltip ]]-- |
||
111 | |||
112 | --Alters the tooltip of bagnon moneyframes to show total gold across all characters on the current realm |
||
113 | function BagnonFrameMoney_OnEnter() |
||
114 | if this:GetLeft() > (UIParent:GetRight() / 2) then |
||
115 | GameTooltip:SetOwner(this, "ANCHOR_LEFT"); |
||
116 | else |
||
117 | GameTooltip:SetOwner(this, "ANCHOR_RIGHT"); |
||
118 | end |
||
119 | GameTooltip:SetText(string.format(BAGNON_FOREVER_MONEY_ON_REALM, GetRealmName())); |
||
120 | |||
121 | local money = 0; |
||
122 | for player in BagnonDB.GetPlayers() do |
||
123 | money = money + BagnonDB.GetMoney(player); |
||
124 | end |
||
125 | |||
126 | SetTooltipMoney(GameTooltip, money); |
||
127 | GameTooltip:Show(); |
||
128 | end |