Zadrot ItemLevel

20.08.2020 - Zadrot

Zadrot ItemLevel

И ещё аддон для WoW

Zadrot ItemLevel - Показывает уровень предметов игроков (как союзников, так и врагов) при наведении на них мышкой, в списках гильдий и сообществ, поиске групп, рядом с сообщениями в чате и (самое главное) на БГшках!

На данный момент не работает на американских и азиатских серверах
Уровень предметов может отставать от актуального на недельку

Скриншоты:

Zadrot ItemLevel Zadrot ItemLevel Zadrot ItemLevel
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
function split(input, separator)
	local t = {}
	for str in string.gmatch(input, string.format("([^%s]+)", separator)) do
		table.insert(t, str)
	end
	return t
end

local function GetItemLevel(name, realm)
	if not realm or realm == "" then realm = GetNormalizedRealmName() end
	local slugrealm = zadrotRealms[realm]
	if not slugrealm then return end
	if zadrotCharacters[slugrealm] and zadrotCharacters[slugrealm][name] then
		return zadrotCharacters[slugrealm][name]
	end
end

local function AddLine(itemLevel)
	GameTooltip:AddLine(string.format("%s: |cFF00CCFF%s|r", STAT_AVERAGE_ITEM_LEVEL, itemLevel), 1, 1, 1)
	GameTooltip:Show()
end

local tempNames = {}
hooksecurefunc(PVPMatchScoreboard, "ShutdownPrivate", function() tempNames = {} end)
hooksecurefunc(PVPMatchUtil, "UpdateTable", function(table1, table2)
	for _, button in pairs(table2.buttons) do
		if button.cell.rowData then
			if tempNames[button.cell.rowData.name] then
				button.cells[3].text:SetText(string.format("%s [%s]", button.cell.rowData.name, tempNames[button.cell.rowData.name]))
			else
				local table = split(button.cell.rowData.name, "-")
				local itemLevel = GetItemLevel(table[1], table[2])
				if itemLevel then tempNames[button.cell.rowData.name] = itemLevel end
			end
		end
	end
end)

local function OnButtonEnter(self)
	local memberInfo = self:GetMemberInfo()
	if memberInfo.name then
		local table = split(memberInfo.name, "-")
		local itemLevel = GetItemLevel(table[1], table[2])
		if itemLevel then AddLine(itemLevel) end
	end
end
local assigned = {}
local f = CreateFrame("Frame")
f:SetScript("OnEvent", function(self, event, name)
	if event == "ADDON_LOADED" then
		if name == "Blizzard_Communities" then
			hooksecurefunc(CommunitiesFrame.MemberList, "UpdateMemberCount", function()
				for _, button in pairs(CommunitiesFrame.MemberList.ListScrollFrame.buttons) do
					if not assigned[button] then
						button:HookScript("OnEnter", OnButtonEnter)
						assigned[button] = true
					end
				end
			end)
		end
	end
end)
f:RegisterEvent("ADDON_LOADED")

local tempPlayerName, tempItemLevel
local function myChatFilter(self, event, text, playerName, languageName, channelName, playerName2, specialFlags, zoneChannelID,	channelIndex, channelBaseName, unused, lineID, guid, bnSenderID, isMobile, isSubtitle, hideSenderInLetterbox, supressRaidIcons)
	local itemLevel
	if tempPlayerName == playerName then itemLevel = tempItemLevel
	else
		if guid then
			local _, _, _, _, _, name, realm = GetPlayerInfoByGUID(guid)
			itemLevel = GetItemLevel(name, realm)
			tempPlayerName = playerName
			tempItemLevel = itemLevel
		end
	end
	if itemLevel then
		return false, string.format("[|cFF00CCFF%s|r] %s", itemLevel, text), playerName, languageName, channelName, playerName2, specialFlags, zoneChannelID, channelIndex, channelBaseName, unused, lineID, guid, bnSenderID, isMobile, isSubtitle, hideSenderInLetterbox, supressRaidIcons
	end
end

ChatFrame_AddMessageEventFilter("CHAT_MSG_CHANNEL", myChatFilter)
ChatFrame_AddMessageEventFilter("CHAT_MSG_SAY", myChatFilter)
ChatFrame_AddMessageEventFilter("CHAT_MSG_ACHIEVEMENT", myChatFilter)
ChatFrame_AddMessageEventFilter("CHAT_MSG_YELL", myChatFilter)
ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER", myChatFilter)
ChatFrame_AddMessageEventFilter("CHAT_MSG_GUILD", myChatFilter)
ChatFrame_AddMessageEventFilter("CHAT_MSG_GUILD_ACHIEVEMENT", myChatFilter)
ChatFrame_AddMessageEventFilter("CHAT_MSG_PARTY", myChatFilter)
ChatFrame_AddMessageEventFilter("CHAT_MSG_PARTY_LEADER", myChatFilter)
ChatFrame_AddMessageEventFilter("CHAT_MSG_RAID", myChatFilter)
ChatFrame_AddMessageEventFilter("CHAT_MSG_RAID_LEADER", myChatFilter)
ChatFrame_AddMessageEventFilter("CHAT_MSG_RAID_WARNING", myChatFilter)
ChatFrame_AddMessageEventFilter("CHAT_MSG_COMMUNITIES_CHANNEL", myChatFilter)
ChatFrame_AddMessageEventFilter("CHAT_MSG_INSTANCE_CHAT", myChatFilter)
ChatFrame_AddMessageEventFilter("CHAT_MSG_EMOTE", myChatFilter)
ChatFrame_AddMessageEventFilter("CHAT_MSG_DND", myChatFilter)
ChatFrame_AddMessageEventFilter("CHAT_MSG_AFK", myChatFilter)

GameTooltip:HookScript("OnTooltipSetUnit", function(self)
	local unit = select(2, self:GetUnit())
	if not UnitIsPlayer(unit) then return end
	local name, realm = UnitName(unit)
	local itemLevel = GetItemLevel(name, realm)
	if itemLevel then AddLine(itemLevel) end
end)

hooksecurefunc("LFGListUtil_SetSearchEntryTooltip", function(tooltip, resultID)
	local searchResultInfo = C_LFGList.GetSearchResultInfo(resultID)
	if (searchResultInfo.leaderName) then
		local table = split(searchResultInfo.leaderName, "-")
		local itemLevel = GetItemLevel(table[1], table[2])
		if itemLevel then AddLine(itemLevel) end
	end
end)

GameTooltip.FadeOut = function()
	GameTooltip:Hide()
end