WoWInterface - View Single Post - How to fix the display of the real ilevel
 View Single Post
08-19-17, 09:15 PM   #1
cbdgv
A Deviate Faerie Dragon

Join Date: Jan 2008
Posts: 10
How to fix the display of the real ilevel

How to fix the display of the real ilevel

ls: Toasts Well, but I'm not used to it

Thank you

Code:
```local LOOT_SOURCE_GARRISON_CACHE = 10
local MAX_QUEUE_THRESHOLD = 5
local QUEUE_LIST = {}

local function GetQuestName(questID)
return SyncUI_ScanTooltipTextLeft1:GetText()
end

local function SetupAchievement(self, type, achievementID, alreadyEarned)
local _, name, points, completed, month, day, year, description, flags, icon, rewardText, isGuildAch, wasEarnedByMe, earnedBy = GetAchievementInfo(achievementID)

if isGuildAch then
self.Title:SetText(GUILD_ACHIEVEMENT_UNLOCKED)
else
self.Title:SetText(ACHIEVEMENT_UNLOCKED)
end

self.Display.Icon:SetTexture(icon)
self.Text:SetText(name)
self.type = type
self.value = achievementID
end

local function SetupCriteria(self, type, achievementID, criteriaString)
local _, name, points, completed, month, day, year, description, flags, icon, rewardText, isGuildAch = GetAchievementInfo(achievementID)

self.Display.Icon:SetTexture(icon)
self.Title:SetText(ACHIEVEMENT_PROGRESSED)
self.Text:SetText(criteriaString)
self.type = type
self.value = achievementID
end

local function SetupScenario(self, type)
local name, typeID, subtypeID, textureFile, moneyBase, moneyVar, experienceBase, experienceVar, numStrangers, numRewards = GetLFGCompletionReward()
local _, _, _, _, hasBonusStep, isBonusStepComplete = C_Scenario.GetInfo()

self.Text:SetText(name)
self.Display.Icon:SetTexture(textureFile or "Interface\\LFGFrame\\LFGIcon-Dungeon")
self.type = type

PlaySound("UI_Scenario_Ending")
end

local function SetupDungeonComplete(self, type)
local name, typeID, subtypeID, textureFile, moneyBase, moneyVar, experienceBase, experienceVar, numStrangers, numRewards = GetLFGCompletionReward()

PlaySound("LFG_Rewards")

if subtypeID == LFG_SUBTYPEID_HEROIC then
name = name.." ("..PLAYER_DIFFICULTY2..")"
--self.Skull:Show()
else
--self.Skull:Hide()
end

self.Title:SetText(DUNGEON_COMPLETED)
self.Text:SetText(name)
self.Display.Icon:SetTexture(textureFile or "Interface\\LFGFrame\\LFGIcon-Dungeon")
self.type = type
end

local function SetupLoot(self, type, itemLink, quantity, rollType, roll, specID, isCurrency, showFactionBG, lootSource, lessAwesome, isUpgraded, isPersonal)
local itemName, itemHyperLink, itemRarity, itemTexture, title

if isCurrency then
itemName, _, itemTexture, _, _, _, _, itemRarity = GetCurrencyInfo(itemLink)

if lootSource == LOOT_SOURCE_GARRISON_CACHE then
itemName = format(GARRISON_RESOURCES_LOOT, quantity)
else
itemName = format(CURRENCY_QUANTITY_TEMPLATE, quantity, itemName)
end

else
itemName, itemHyperLink, itemRarity, _, _, _, _, _, _, itemTexture = GetItemInfo(itemLink)
end

local info = (isPersonal or isCurrency) and LOOTWONALERTFRAME_VALUES.DefaultPersonal or LOOTWONALERTFRAME_VALUES.Default;
local color = ITEM_QUALITY_COLORS[itemRarity]

if showFactionBG then
local factionGroup = UnitFactionGroup("player")
else
if lootSource == LOOT_SOURCE_GARRISON_CACHE then
elseif lessAwesome then
end
end

if rollType == LOOT_ROLL_TYPE_NEED then
title = info.labelText.." "..roll.."|T".."Interface\\Buttons\\UI-GroupLoot-Dice-Up"..":12:12:0:0:64:64:10:54:10:54|t "
elseif rollType == LOOT_ROLL_TYPE_GREED then
title = info.labelText.." "..roll.."|T".."Interface\\Buttons\\UI-GroupLoot-Coin-Up"..":12:12:0:0:64:64:10:54:10:54|t "
else
title = info.labelText
end

if quantity > 1 and lootSource ~= LOOT_SOURCE_GARRISON_CACHE then
self.Display.Count:SetText(quantity)
end

self.Display.Icon:SetTexture(itemTexture)
self.Title:SetText(title)
self.Text:SetText(itemName)
self.Text:SetVertexColor(color.r, color.g, color.b)
self.type = type

if not isCurrency then
end

if lessAwesome then
PlaySoundKitID(51402)  --UI_Raid_Loot_Toast_Lesser_Item_Won
PlaySoundKitID(51561)  -- UI_Warforged_Item_Loot_Toast
else
PlaySoundKitID(31578)  --UI_EpicLoot_Toast
end
end

local itemName, itemHyperLink, itemRarity, _, _, _, _, _, _, itemTexture = GetItemInfo(itemLink)
local upgradeQualityColor = ITEM_QUALITY_COLORS[itemRarity]

self.Display.Icon:SetTexture(itemTexture)
self.Text:SetText(itemName)
self.type = type

PlaySoundKitID(31578)
end

local function SetupMoneyWon(self, type, amount)
self.Display.Icon:SetTexture("Interface\\Icons\\inv_misc_coin_02")
self.Title:SetText(YOU_WON_LABEL)
self.Text:SetText(GetMoneyString(amount))
self.type = type

PlaySoundKitID(31578)
end

local function SetupStorePurchase(self, type, category, icon, name, payloadID)
self.Display.Icon:SetTexture(icon)
self.Text:SetText(name)
self.type = type

PlaySound("UI_igStore_PurchaseDelivered_Toast_01")
end

local function SetupGarrisonBuilding(self, type, name)
self.Display.Icon:SetTexture("Interface\\Icons\\Garrison_Build")
self.Title:SetText(GARRISON_UPDATE)
self.Text:SetFormattedText(GARRISON_BUILDING_COMPLETE_TOAST, name)
self.type = type

PlaySound("UI_Garrison_Toast_BuildingComplete");
end

local function SetupGarrisonTalent(self, type, garrisonType)
local talentID = C_Garrison.GetCompleteTalent(garrisonType)
local talent = C_Garrison.GetTalent(talentID)

self.Display.Icon:SetTexture(talent.icon)
self.Title:SetText(GARRISON_UPDATE)
self.Text:SetFormattedText(GARRISON_BUILDING_COMPLETE_TOAST, garrisonType)
self.type = type

end

local function SetupGarrisonMission(self, type, missionID)
local missionInfo = C_Garrison.GetBasicMissionInfo(missionID)

self.Display.Icon:SetAtlas(missionInfo.typeAtlas)
self.Title:SetText(GARRISON_MISSION_COMPLETE)
self.Text:SetText(missionInfo.name)
self.type = type

PlaySound("UI_Garrison_Toast_MissionComplete")
end

local function SetupGarrisonRandomMission(self, type, missionID)
local missionInfo = C_Garrison.GetBasicMissionInfo(missionID)

self.Display.Icon:SetAtlas(missionInfo.typeAtlas)
self.Title:SetText(GARRISON_MISSION_COMPLETE)
self.Text:SetText(missionInfo.name)
self.type = type

PlaySound("UI_Garrison_Toast_MissionComplete")
end

local function SetupGarrisonFollower(self, type, followerID, name, level, quality, isUpgraded)
local followerInfo = C_Garrison.GetFollowerInfo(followerID)

if followerInfo.isTroop then
else
end
else
else
end
end

--self.Display.Icon:SetTexture(followerInfo)
self.Text:SetText(name)
self.type = type

PlaySound("UI_Garrison_Toast_FollowerGained")
end

local function SetupGarrisonShipFollower(self, type, followerID, name, class, texPrefix, level, quality, isUpgraded)
local mapAtlas = texPrefix .. "-List"
local color = ITEM_QUALITY_COLORS[quality]
local followerInfo = C_Garrison.GetFollowerInfo(followerID)

self.Display.Icon:SetAtlas(mapAtlas, false)

else
end

self.Text:SetText(name)
self.Text:SetTextColor(color.r, color.g, color.b)
self.type = type

PlaySound("UI_Garrison_Toast_FollowerGained")
end

local function SetupNewRecipeLearned(self, type, recipeID)

local recipeName = GetSpellInfo(recipeID)

if recipeName then
local rank = GetSpellRank(recipeID)
local rankTexture = NewRecipeLearnedAlertFrame_GetStarTextureFromRank(rank)

self.Display.Icon:SetTexture(icon)
self.Title:SetText(rank and rank > 1 and UPGRADED_RECIPE_LEARNED_TITLE or NEW_RECIPE_LEARNED_TITLE)

if rankTexture then
self.Text:SetFormattedText("%s %s", recipeName, rankTexture)
else
self.Text:SetText(recipeName)
end

self.value = recipeID
self.type = type

PlaySound("UI_Professions_NewRecipeLearned_Toast")

return true
end
end

return false
end

local function SetupLegendaryItem(self, type, itemLink)
local itemName, itemHyperLink, itemRarity, _, _, _, _, _, _, itemTexture = GetItemInfo(itemLink)
local color = ITEM_QUALITY_COLORS[itemRarity]

self.Display.Icon:SetTexture(itemTexture)
self.Title:SetText(LEGENDARY_ITEM_LOOT_LABEL)
self.Text:SetText(itemName)
self.Text:SetVertexColor(color.r, color.g, color.b)
self.type = type

PlaySound("UI_LegendaryLoot_Toast")
end

local function SetupWorldQuestComplete(self, type, questID, rewardItemLink)
local name = select(4, GetTaskInfo(questID)), GetQuestName(questID)
local icon = WorldQuestCompleteAlertFrame_GetIconForQuestID(questID)
local money = GetQuestLogRewardMoney(questID)

self.Title:SetText(WORLD_QUEST_COMPLETE)
self.Display.Icon:SetTexture(icon)
self.Text:SetText(name)
self.type = type
self.value = questID

PlaySound("UI_WorldQuest_Complete")
end

local function SetupInvasion(self, type, rewardQuestID, rewardItemLink)
-- If we're seeing this with a reward the scenario hasn't been completed yet, no toast until scenario complete is triggered
return false
end

local scenarioName, currentStage, numStages, flags, hasBonusStep, isBonusStepComplete, _, xp, money, scenarioType, areaName = C_Scenario.GetInfo()

self.Display.Icon:SetTexture("Interface\\Icons\\Ability_Warlock_DemonicPower")
self.Title:SetText(SCENARIO_INVASION_COMPLETE)
self.Text:SetText(areaName or scenarioName)
self.type = type
self.value = rewardQuestID

PlaySound("UI_Scenario_Ending")

return true
end

-- Handler
local function Clear(self)
self.Display.Icon:SetTexture("")
self.Display.Icon:SetTexCoord(0.1,0.9,0.1,0.9)
self.Display.Count:SetText("")
--self.Skull:Hide()
self.Title:SetText("")
self.Title:SetVertexColor(0.6,1,0)
self.Text:SetText("")
self.Text:SetVertexColor(1,1,1)
self.type = nil
self.value = nil
end

local function Spawn(self)
self:Show()

if self:IsMouseOver() then
self.Despawn.alpha:SetStartDelay(1)
self.Despawn.trans:SetStartDelay(1)
else
self.Despawn.alpha:SetStartDelay(3.5)
self.Despawn.trans:SetStartDelay(3.5)
self.Despawn:Play()
end
end

local function AddToQueue(self, type, ...)
if #QUEUE_LIST >= MAX_QUEUE_THRESHOLD then
table.remove(QUEUE_LIST, 1)
end

tinsert(QUEUE_LIST, {type, ...})
end

local frame, type = ...

if frame.active or frame.forceQueue then
return
end

frame:Clear()

if type == "Achievement" then
SetupAchievement(...)
end
if type == "Criteria" then
SetupCriteria(...)
end
if type == "Scenario" then
SetupScenario(...)
end
if type == "DungeonComplete" then
SetupDungeonComplete(...)
end
if type == "Loot" then
SetupLoot(...)
end
if type == "LootUpgrade" then
end
if type == "MoneyWon" then
SetupMoneyWon(...)
end
if type == "StorePurchase" then
SetupStorePurchase(...)
end
if type == "GarrisonBuilding" then
SetupGarrisonBuilding(...)
end
if type == "GarrisonTalent" then
SetupGarrisonTalent(...)
end
if type == "GarrisonMission" then
SetupGarrisonMission(...)
end
if type == "GarrisonRandomMission" then
SetupGarrisonRandomMission(...)
end
if type == "GarrisonFollower" then
SetupGarrisonFollower(...)
end
if type == "GarrisonShipFollower" then
SetupGarrisonShipFollower(...)
end
if type == "NewRecipeLearned" then
if not SetupNewRecipeLearned(...) then
return
end
end
if type == "LegendaryItem" then
SetupLegendaryItem(...)
end
if type == "WorldQuestComplete" then
SetupWorldQuestComplete(...)
end
if type == "Invasion" then
if not SetupInvasion(...) then
return
end
end

Spawn(...)
end

local function CheckForQueues(self)
if not QUEUE_LIST[1] then
return
end

C_Timer.After(0.5, function()
table.remove(QUEUE_LIST, 1)
end)
end

local function RunTest(self)
end

self:RegisterEvent("ACHIEVEMENT_EARNED")
self:RegisterEvent("CRITERIA_EARNED")
self:RegisterEvent("LFG_COMPLETION_REWARD")
self:RegisterEvent("SCENARIO_COMPLETED")
self:RegisterEvent("LOOT_ITEM_ROLL_WON")
self:RegisterEvent("SHOW_LOOT_TOAST")
self:RegisterEvent("SHOW_PVP_FACTION_LOOT_TOAST")
self:RegisterEvent("PET_BATTLE_CLOSE")
self:RegisterEvent("STORE_PRODUCT_DELIVERED")
self:RegisterEvent("GARRISON_BUILDING_ACTIVATABLE")
self:RegisterEvent("GARRISON_TALENT_COMPLETE")
self:RegisterEvent("GARRISON_MISSION_FINISHED")
self:RegisterEvent("NEW_RECIPE_LEARNED")
self:RegisterEvent("SHOW_LOOT_TOAST_LEGENDARY_LOOTED")
self:RegisterEvent("QUEST_TURNED_IN")
--self:RegisterEvent("PLAYER_REGEN_DISABLED")
--self:RegisterEvent("PLAYER_REGEN_ENABLED")
self:RegisterForClicks("AnyUp")

self.Clear = Clear
self.RunTest = RunTest

end

function SyncUI_AlertFrame_OnEvent(self, event, ...)
if event == "ACHIEVEMENT_EARNED" then
if IsKioskModeEnabled() then
return
end

if not AchievementFrame then
end

end
if event == "CRITERIA_EARNED" then
if IsKioskModeEnabled() then
return
end

if not AchievementFrame then
end

end
if event == "LFG_COMPLETION_REWARD" then
if C_Scenario.IsInScenario() and not C_Scenario.TreatScenarioAsDungeon() then
local scenarioType = select(10, C_Scenario.GetInfo())

if scenarioType ~= LE_SCENARIO_TYPE_LEGION_INVASION then
end
else
end
end
if event == "SCENARIO_COMPLETED" then
local scenarioType = select(10, C_Scenario.GetInfo())

if scenarioType == LE_SCENARIO_TYPE_LEGION_INVASION then
local rewardQuestID = ...

if rewardQuestID then
end
end
end
if event == "LOOT_ITEM_ROLL_WON" then
local itemLink, quantity, rollType, roll, isUpgraded = ...

end
if event == "SHOW_LOOT_TOAST" then
local typeIdentifier, itemLink, quantity, specID, sex, isPersonal, lootSource, lessAwesome, isUpgraded = ...

if typeIdentifier == "item" then
elseif typeIdentifier == "money" then
elseif isPersonal and (typeIdentifier == "currency") then
end
end
if event == "SHOW_PVP_FACTION_LOOT_TOAST"  then
local typeIdentifier, itemLink, quantity, specID, sex, isPersonal, lessAwesome = ...

if typeIdentifier == "item" then
self:AddAlert("Loot", itemLink, quantity, nil, nil, specID, false, true, nil, lessAwesome)
elseif typeIdentifier == "money" then
elseif typeIdentifier == "currency" then
end
end
if event == "SHOW_LOOT_TOAST_UPGRADE" then
local itemLink, quantity, specID, sex, baseQuality, isPersonal, lessAwesome = ...

end
if event == "STORE_PRODUCT_DELIVERED" then
end
if event == "GARRISON_BUILDING_ACTIVATABLE" then
GarrisonLandingPageMinimapButton.MinimapLoopPulseAnim:Play()
end
if event == "GARRISON_TALENT_COMPLETE" then
end
if event == "GARRISON_MISSION_FINISHED" then
local validInstance = false
local _, instanceType = GetInstanceInfo()

if instanceType == "none" or C_Garrison.IsOnGarrisonMap() then
validInstance = true
end

if validInstance and not UnitAffectingCombat("player") then
local followerTypeID, missionID = ...
local missionFrame = _G[GarrisonFollowerOptions[followerTypeID].missionFrame]

if not missionFrame or not missionFrame:IsShown() then
GarrisonLandingPageMinimapButton.MinimapLoopPulseAnim:Play()
end
end
end
if event == "GARRISON_FOLLOWER_ADDED" then
local followerID, name, class, level, quality, isUpgraded, texPrefix, followerType = ...

if followerType == LE_FOLLOWER_TYPE_SHIPYARD_6_2 then
else
end
end
if event == "GARRISON_RANDOM_MISSION_ADDED" then
end
if event == "NEW_RECIPE_LEARNED" then
end
if event == "SHOW_LOOT_TOAST_LEGENDARY_LOOTED" then
local itemLink = ...

end
if event == "QUEST_TURNED_IN" then
local questID = ...

--if QuestMapFrame_IsQuestWorldQuest(questID) then
--end
end
if event == "QUEST_LOOT_RECEIVED" then
local questID, rewardItemLink = ...

if QuestMapFrame_IsQuestWorldQuest(questID) then
else	-- May be invasion reward
end
end

if event == "PLAYER_REGEN_DISABLED" then
self.forceQueue = true
end
if event == "PLAYER_REGEN_ENABLED" then
self.forceQueue = false
CheckForQueues(self)
end
end

self.Despawn:Stop()
self.Despawn.alpha:SetStartDelay(1)
self.Despawn.trans:SetStartDelay(1)

if self.value then
local type = self.type

GameTooltip:SetOwner(self, "ANCHOR_TOP")

if type == "Achievement" then
--GameTooltip:SetAchievementByID(self.value)
end
if type == "Loot" or type == "LootUpgrade" or type == "LegendaryItem" then
local itemID = GetItemInfoFromHyperlink(self.value)
GameTooltip:SetItemByID(itemID)
end

GameTooltip:Show()
end
end

self.Despawn:Play()
GameTooltip_Hide()
end

self.active = true
self.Despawn:Stop()
self.Spawn:Play()
end

self.active = false
CheckForQueues(self)
end

local type = self.type

if type == "Achievement" then
if not self.value then
return
end

CloseAllWindows()
AchievementObjectiveTracker_OpenAchievement(nil, self.value)
end

if type == "Loot" or type == "LootUpgrade" or type == "LegendaryItem" then
local bag = SearchBagsForItemLink(self.value)

if bag >= 0 then
OpenBag(bag)
end
end
end```

Last edited by cbdgv : 08-19-17 at 10:42 PM.