📄 atlasloot.lua
字号:
local VERSION_MAJOR = "1";local VERSION_MINOR = "18";local VERSION_BOSSES = "04";ATLASLOOT_VERSION = "|cff4169e1AtlasLoot Enhanced v"..VERSION_MAJOR.."."..VERSION_MINOR.."."..VERSION_BOSSES.."|r";ATLASLOOT_CURRENT_ATLAS = "1.8.1";
-- Colours stored for code readability
local GREY = "|cff999999";
local RED = "|cffff0000";
local WHITE = "|cffFFFFFF";
local GREEN = "|cff1eff00";
local PURPLE = "|cff9F3FFF";
local BLUE = "|cff0070dd";
local ORANGE = "|cffFF8400";
local ATLAS_LOOT_BOSS_LINES = 27;
AtlasLoot_AnchorFrame = AtlasFrame;
local Hooked_Atlas_Refresh;
-- Initialise saved variables
if(AtlasLootOptions == nil) then
AtlasLootOptions = {};
end
if ( AtlasLootOptions["SafeLinks"] == nil ) then
AtlasLootOptions["SafeLinks"] = true;
end
if ( AtlasLootOptions["AllLinks"] == nil ) then
AtlasLootOptions["AllLinks"] = false;
end
if ( AtlasLootOptions["DefaultTT"] == nil ) then
AtlasLootOptions["DefaultTT"] = true;
end
if ( AtlasLootOptions["LootlinkTT"] == nil ) then
AtlasLootOptions["LootlinkTT"] = false;
end
if ( AtlasLootOptions["ItemSyncTT"] == nil ) then
AtlasLootOptions["ItemSyncTT"] = false;
end
if ( AtlasLootOptions["EquipCompare"] == nil ) then
AtlasLootOptions["EquipCompare"] = false;
end
-- Popup Box for first time users
StaticPopupDialogs["ATLASLOOT_SETUP"] = {
text = ATLASLOOT_FIRST_TIME_TEXT,
button1 = ATLASLOOT_FIRST_TIME_BUTTON,
OnAccept = function()
AtlasLootOptions_Toggle();
end,
timeout = 0,
whileDead = 1,
hideOnEscape = 1
};
--Popup Box for an old version of Atlas
StaticPopupDialogs["ATLASLOOT_OLD_ATLAS"] = {
text = ATLASLOOT_OLD_ATLAS_TEXT_PT1..ATLASLOOT_CURRENT_ATLAS..ATLASLOOT_OLD_ATLAS_TEXT_PT2,
button1 = ATLASLOOT_OLD_ATLAS_BUTTON,
OnAccept = function()
AtlasLootOptions_Toggle();
end,
timeout = 0,
whileDead = 1,
hideOnEscape = 1
};---------------------------------------------------------------------------------- OnEvent--------------------------------------------------------------------------------function AtlasLoot_OnEvent(event) if(event == "VARIABLES_LOADED") then AtlasLoot_OnVariablesLoaded(); endend---------------------------------------------------------------------------------- OnEvent - VariablesLoaded
-- When the game has loaded all variables, initialise the mod--------------------------------------------------------------------------------function AtlasLoot_OnVariablesLoaded() Hooked_Atlas_Refresh = Atlas_Refresh; Atlas_Refresh = AtlasLoot_Refresh;
AtlasLoot_Refresh();
--Disable options that don't have the supporting mods
if( not LootLink_SetTooltip and (AtlasLootOptions.LootlinkTT == true)) then
AtlasLootOptions.LootlinkTT = false;
AtlasLootOptions.DefaultTT = true;
end
if( not ISYNC_VERSION and (AtlasLootOptions.ItemSyncTT == true)) then
AtlasLootOptions.ItemSyncTT = false;
AtlasLootOptions.DefaultTT = true;
end
if( not EquipCompare_RegisterTooltip and (AtlasLootOptions.EquipCompare == true)) then
AtlasLootOptions.EquipCompare = false;
end
if((EquipCompare_RegisterTooltip) and (AtlasLootOptions["EquipCompare"] == true)) then
EquipCompare_RegisterTooltip(AtlasLootTooltip);
end
if ( Hooked_Atlas_Refresh ) then
AtlasLoot_SetupForAtlas();
--If a first time user, set up options
if( (AtlasLootVersion == nil) or (tonumber(AtlasLootVersion) < 11402)) then
AtlasLootOptions["SafeLinks"] = true;
AtlasLootOptions["AllLinks"] = false;
AtlasLootVersion = VERSION_MAJOR..VERSION_MINOR..VERSION_BOSSES;
StaticPopup_Show ("ATLASLOOT_SETUP");
end
--If not the expected Atlas version
if( ATLAS_VERSION ~= ATLASLOOT_CURRENT_ATLAS ) then
StaticPopup_Show ("ATLASLOOT_OLD_ATLAS");
end
else
AtlasLootItemsFrame:Hide();
end end
--If someone types /atlasloot, bring up the options box
function AtlasLoot_SlashCommand(msg)
if(msg == "**") then
AtlasLootOptions_Toggle();
else
AtlasLootOptions_Toggle();
end
end
--Toggle on/off the options windowfunction AtlasLootOptions_Toggle()
if(AtlasLootOptionsFrame:IsVisible()) then
AtlasLootOptionsFrame:Hide();
else
AtlasLootOptionsFrame:Show();
if(AtlasLootOptions["DefaultTT"] == true) then
AtlasLootOptions_DefaultTTToggle();
elseif(AtlasLootOptions["LootlinkTT"] == true) then
AtlasLootOptions_LootlinkTTToggle();
elseif(AtlasLootOptions["ItemSyncTT"] == true) then
AtlasLootOptions_ItemSyncTTToggle();
end
end
end
---------------------------------------------------------------------------------- OnLoad
-- When the mod loads, register to complete initialisation when
-- everything else is loaded. --------------------------------------------------------------------------------function AtlasLoot_OnLoad() this:RegisterEvent("VARIABLES_LOADED");
SLASH_ATLASLOOT1 = "/atlasloot";
SlashCmdList["ATLASLOOT"] = function(msg)
AtlasLoot_SlashCommand(msg);
endend
---------------------------------------------------------------------------------- Hooked AtlasRefresh
-- Called if any change to the Atlas Frame--------------------------------------------------------------------------------function AtlasLoot_Refresh()
if(Hooked_Atlas_Refresh) then Hooked_Atlas_Refresh(); --If we are dealing with instances if ( AtlasOptions.AtlasType == 1 ) then local zoneID = ATLAS_DROPDOWN_LIST[AtlasOptions.AtlasZone]; local text; --If we have atlasloot data if(AtlasLootBossButtons[zoneID] ~= nil) then for i = 1, 27, 1 do
--If we have items in the atlasloot data if(AtlasLootBossButtons[zoneID][i] ~= nil and AtlasLootBossButtons[zoneID][i] ~= "") then getglobal("AtlasText_"..i):Hide(); getglobal("AtlasBossLine_"..i):Show();
--Ridiculous number of special cases, need to to something to clean this up if(getglobal("AtlasText_"..i):GetText() == nil and getglobal("AtlasText_"..i-1):GetText() == nil and getglobal("AtlasText_"..i-2):GetText() ~= nil) then
if(zoneID == "TheRuinsofAhnQiraj") then
getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREY..ATLASLOOT_CLASS_BOOKS);
elseif(zoneID == "DireMaulNorth") then getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREY..ATLASLOOT_TRIBUTE_RUN);
elseif(zoneID == "WailingCaverns") then
getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREY..ATLASLOOT_VIPERSET);
elseif(zoneID == "TheDeadmines") then
getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREY..ATLASLOOT_DEFIASSET);
elseif(zoneID == "ScarletMonastery") then
getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREY..ATLASLOOT_SCARLETSET);
elseif((zoneID == "DireMaulEast") or (zoneID == "DireMaulWest")) then getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREY..ATLASLOOT_DM_BOOKS);
elseif((zoneID == "BlackrockSpireUpper") or (zoneID == "BlackrockSpireLower") or (zoneID == "Scholomance")) then getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREY..ATLASLOOT_T0_SET_PIECES);
else getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREY..ATLASLOOT_TRASH_MOBS);
end elseif(zoneID == "MoltenCore" and getglobal("AtlasBossLine_"..(i-1).."_Text"):GetText() == GREY..ATLASLOOT_TRASH_MOBS) then
getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREY..ATLASLOOT_RANDOM_LOOT);
elseif(zoneID == "MoltenCore" and getglobal("AtlasBossLine_"..(i-1).."_Text"):GetText() == GREY..ATLASLOOT_RANDOM_LOOT and AtlasLootBossButtons[zoneID][i] == "T1SET") then
getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREY..ATLASLOOT_MC_SET_PIECES);
elseif(zoneID == "BlackwingLair" and getglobal("AtlasBossLine_"..(i-1).."_Text"):GetText() == GREY..ATLASLOOT_TRASH_MOBS and AtlasLootBossButtons[zoneID][i] == "T2SET") then
getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREY..ATLASLOOT_BWL_SET_PIECES);
elseif(zoneID == "TheTempleofAhnQiraj" and getglobal("AtlasBossLine_"..(i-1).."_Text"):GetText() == GREY..ATLASLOOT_TRASH_MOBS) then
getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREY..ATLASLOOT_AQ_ENCHANTS);
elseif(zoneID == "TheTempleofAhnQiraj" and getglobal("AtlasBossLine_"..(i-1).."_Text"):GetText() == GREY..ATLASLOOT_AQ_ENCHANTS) then
getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREY..ATLASLOOT_AQ40_BROOD_RINGS);
elseif(zoneID == "TheTempleofAhnQiraj" and getglobal("AtlasBossLine_"..(i-1).."_Text"):GetText() == GREY..ATLASLOOT_AQ40_BROOD_RINGS) then
getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREY..ATLASLOOT_AQ40_CLASS_SET_PIECES_1);
elseif(zoneID == "TheRuinsofAhnQiraj" and getglobal("AtlasBossLine_"..(i-1).."_Text"):GetText() == GREY..ATLASLOOT_CLASS_BOOKS) then
getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREY..ATLASLOOT_AQ_ENCHANTS);
elseif(zoneID == "TheRuinsofAhnQiraj" and getglobal("AtlasBossLine_"..(i-1).."_Text"):GetText() == GREY..ATLASLOOT_AQ_ENCHANTS) then
getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREY..ATLASLOOT_AQ20_CLASS_SET_PIECES_1);
elseif((zoneID == "ZulGurub") and getglobal("AtlasBossLine_"..(i-1).."_Text"):GetText() == GREY..ATLASLOOT_TRASH_MOBS) then
getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREY..ATLASLOOT_RANDOM_LOOT);
elseif((zoneID == "ZulGurub") and getglobal("AtlasBossLine_"..(i-1).."_Text"):GetText() == GREY..ATLASLOOT_RANDOM_LOOT) then
getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREY..ATLASLOOT_ZG_CLASS_SET_PIECES_1);
elseif((zoneID == "ZulGurub") and getglobal("AtlasBossLine_"..(i-1).."_Text"):GetText() == GREY..ATLASLOOT_ZG_CLASS_SET_PIECES_1) then
getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREY..ATLASLOOT_ZG_ENCHANTS);
elseif(zoneID == "DireMaulNorth" and getglobal("AtlasBossLine_"..(i-1).."_Text"):GetText() == GREY..ATLASLOOT_TRIBUTE_RUN) then
getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREY..ATLASLOOT_DM_BOOKS);
elseif(zoneID == "Naxxramas" and getglobal("AtlasBossLine_"..(i-1).."_Text"):GetText() == GREY..ATLASLOOT_TRASH_MOBS and AtlasLootBossButtons[zoneID][i] == "T3SET") then
getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREY..ATLASLOOT_NAXX_SET_PIECES);
else getglobal("AtlasBossLine_"..i.."_Text"):SetText(getglobal("AtlasText_"..i):GetText()); end
getglobal("AtlasBossLine_"..i.."_Loot"):Show();
getglobal("AtlasBossLine_"..i.."_Selected"):Hide(); else getglobal("AtlasText_"..i):Show(); getglobal("AtlasBossLine_"..i):Hide(); end end getglobal("AtlasLootInfo"):Show(); else for i = 1, 27, 1 do getglobal("AtlasText_"..i):Show(); getglobal("AtlasBossLine_"..i):Hide(); end getglobal("AtlasLootInfo"):Hide(); end
--If we are dealing with battlegrounds elseif ( AtlasOptions.AtlasType == 2 ) then
zoneID = ATLAS_DROPDOWN_LIST_BG[AtlasOptions.AtlasZone];
local text;
if(AtlasLootBattlegrounds[zoneID] ~= nil) then
--If we have data, just show the rep rewards where we set them.
for i = 1, 27, 1 do
if(AtlasLootBattlegrounds[zoneID][i] ~= nil and AtlasLootBattlegrounds[zoneID][i] ~= "") then
if(getglobal("AtlasBossLine_"..(i-1).."_Text"):GetText() == GREEN..ATLASLOOT_BG_FRIENDLY) then
getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREEN..ATLASLOOT_BG_HONORED);
elseif(getglobal("AtlasBossLine_"..(i-1).."_Text"):GetText() == GREEN..ATLASLOOT_BG_HONORED) then
getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREEN..ATLASLOOT_BG_REVERED);
elseif(getglobal("AtlasBossLine_"..(i-1).."_Text"):GetText() == GREEN..ATLASLOOT_BG_REVERED) then
getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREEN..ATLASLOOT_BG_EXALTED);
elseif(getglobal("AtlasBossLine_"..(i-1).."_Text"):GetText() == GREEN..ATLASLOOT_BG_EXALTED) then
getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREEN..ATLASLOOT_PVP_SET_PIECES);
elseif(getglobal("AtlasText_"..i):GetText() == nil) then
getglobal("AtlasBossLine_"..i.."_Text"):SetText(GREEN..ATLASLOOT_BG_FRIENDLY);
end
getglobal("AtlasBossLine_"..i.."_Loot"):Show();
getglobal("AtlasBossLine_"..i.."_Selected"):Hide();
getglobal("AtlasText_"..i):Hide();
getglobal("AtlasBossLine_"..i):Show();
else
getglobal("AtlasText_"..i):Show(); getglobal("AtlasBossLine_"..i):Hide();
end
end
getglobal("AtlasLootInfo"):Show();
else
for i = 1, 27, 1 do getglobal("AtlasText_"..i):Show(); getglobal("AtlasBossLine_"..i):Hide(); end getglobal("AtlasLootInfo"):Hide();
end
--World Bosses
elseif ( AtlasOptions.AtlasType == 5 ) then
zoneID = ATLAS_DROPDOWN_LIST_RE[AtlasOptions.AtlasZone];
local text;
if(AtlasLootWBBossButtons[zoneID] ~= nil) then
--If we have data, just show the rep rewards where we set them.
for i = 1, 27, 1 do
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -