режим предателя + UI референсы и DragonUI
This commit is contained in:
@@ -86,7 +86,7 @@ local detailedRaceTooltips = {};
|
||||
local detailedClassTooltips = {};
|
||||
local GAME_MODE_TILE_BACKGROUNDS = {
|
||||
[GAME_MODE_NORMAL] = "Interface\\GluesVideo\\Assets\\RealmSelection\\Realm1.blp",
|
||||
[GAME_MODE_TRAITOR] = "Interface\\GluesVideo\\Assets\\RealmSelection\\Realm2.blp",
|
||||
[GAME_MODE_TRAITOR] = "Interface\\Glues\\CharacterCreate\\Traitor_Mode.blp",
|
||||
};
|
||||
|
||||
local function UTF8Chars(text)
|
||||
@@ -239,16 +239,17 @@ local function UpdateRaceTooltip(button, toggleDetails)
|
||||
if info["Spell_"..i] and info["Spell_"..i].name ~= "" then
|
||||
if not tooltip["spellContainer"..i] then
|
||||
tooltip["spellContainer"..i] = CreateFrame("Frame", nil, tooltip)
|
||||
tooltip["spellContainer"..i]:SetSize(260, 60)
|
||||
tooltip["spellContainer"..i]:SetSize(280, 60)
|
||||
|
||||
tooltip["spellIcon"..i] = tooltip["spellContainer"..i]:CreateTexture(nil, "OVERLAY")
|
||||
tooltip["spellIcon"..i]:SetTexture("Interface\\Icons\\"..info["Spell_"..i].icon)
|
||||
tooltip["spellIcon"..i]:SetSize(25, 25)
|
||||
tooltip["spellIcon"..i]:SetPoint("TOPLEFT", -35, -20)
|
||||
tooltip["spellIcon"..i]:SetSize(24, 24)
|
||||
tooltip["spellIcon"..i]:SetPoint("TOPLEFT", tooltip["spellContainer"..i], "TOPLEFT", 0, 0)
|
||||
|
||||
tooltip["spellName"..i] = tooltip["spellContainer"..i]:CreateFontString(nil, "OVERLAY")
|
||||
tooltip["spellName"..i]:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")
|
||||
tooltip["spellName"..i]:SetPoint("LEFT", tooltip["spellIcon"..i], "RIGHT", 5, 8)
|
||||
tooltip["spellName"..i]:SetPoint("TOPLEFT", tooltip["spellIcon"..i], "TOPRIGHT", 6, 0)
|
||||
tooltip["spellName"..i]:SetWidth(220)
|
||||
tooltip["spellName"..i]:SetTextColor(1, 0.82, 0)
|
||||
tooltip["spellName"..i]:SetJustifyH("LEFT")
|
||||
|
||||
@@ -256,6 +257,7 @@ local function UpdateRaceTooltip(button, toggleDetails)
|
||||
tooltip["spellDesc"..i]:SetFont("Fonts\\FRIZQT__.TTF", 9, "OUTLINE")
|
||||
tooltip["spellDesc"..i]:SetWordWrap(true)
|
||||
tooltip["spellDesc"..i]:SetJustifyH("LEFT")
|
||||
tooltip["spellDesc"..i]:SetWidth(220)
|
||||
tooltip["spellDesc"..i]:SetPoint("TOPLEFT", tooltip["spellName"..i], "BOTTOMLEFT", 0, -2)
|
||||
end
|
||||
|
||||
@@ -264,7 +266,8 @@ local function UpdateRaceTooltip(button, toggleDetails)
|
||||
|
||||
tooltip["spellContainer"..i]:Show()
|
||||
tooltip["spellContainer"..i]:ClearAllPoints()
|
||||
tooltip["spellContainer"..i]:SetPoint("TOPLEFT", lastElement, "BOTTOMLEFT", 0, 3)
|
||||
tooltip["spellContainer"..i]:SetPoint("LEFT", tooltip, "LEFT", 10, 0)
|
||||
tooltip["spellContainer"..i]:SetPoint("TOP", lastElement, "BOTTOM", 0, -4)
|
||||
|
||||
local containerHeight = tooltip["spellIcon"..i]:GetHeight() + tooltip["spellDesc"..i]:GetHeight() + 3
|
||||
tooltip["spellContainer"..i]:SetHeight(containerHeight)
|
||||
@@ -655,7 +658,6 @@ function CharacterCreate_CreateWithGameMode(modeId)
|
||||
-- The patched Wow.exe reads the second argument as outfitId
|
||||
-- and writes it into the CMSG_CHAR_CREATE packet.
|
||||
local name = CharacterCreateNameEdit:GetText();
|
||||
message("DEBUG: CreateCharacter('" .. tostring(name) .. "', " .. tostring(modeId) .. ")");
|
||||
CreateCharacter(name, modeId);
|
||||
CharacterCreate.personalizationMode = false;
|
||||
CharacterCreate.gameModeSelectionMode = false;
|
||||
@@ -764,6 +766,12 @@ local function CharacterCreate_InitGameModeTiles()
|
||||
CharacterCreateGameModeTraitorPlayButton:SetScript("OnClick", function()
|
||||
CharacterCreate_CreateWithGameMode(GAME_MODE_TRAITOR);
|
||||
end);
|
||||
|
||||
CharacterCreateGameModeNormalDesc:SetText("Классический режим игры.\nСбалансированная прокачка\nи геймплей выверенный годами.");
|
||||
CharacterCreateGameModeNormalDesc:SetTextColor(0.90, 0.87, 0.75);
|
||||
|
||||
CharacterCreateGameModeTraitorDesc:SetText("Ваш персонаж отверг идеалы\nсвоей фракции и перешёл на другую сторону.\nВы начинаете игру в рядах противоположной фракции\nс пониженной репутацией.");
|
||||
CharacterCreateGameModeTraitorDesc:SetTextColor(0.90, 0.87, 0.75);
|
||||
end
|
||||
|
||||
function CharacterCreate_OnLoad(self)
|
||||
@@ -866,15 +874,16 @@ function CharacterCreate_SetupCustomButtons()
|
||||
{button = CharacterCreateRandomName, width = 30, height = 30}
|
||||
}
|
||||
|
||||
local texturePath = "Interface\\Buttons\\charactercreate.blp"
|
||||
|
||||
local texturePath = "Interface\\Glues\\CharacterCreate\\charactercreate"
|
||||
|
||||
for _, btnInfo in ipairs(buttons) do
|
||||
local button = btnInfo.button
|
||||
if button then
|
||||
button:SetNormalTexture(texturePath.."-Up")
|
||||
button:SetNormalTexture(texturePath)
|
||||
button:GetNormalTexture():SetTexCoord(0.261230469, 0.292480469, 0.890625000, 0.920410156)
|
||||
button:GetNormalTexture():SetAlpha(1)
|
||||
|
||||
button:SetPushedTexture(texturePath.."-Down")
|
||||
button:SetPushedTexture(texturePath)
|
||||
button:GetPushedTexture():SetTexCoord(0.223144531, 0.253906250, 0.890625000, 0.920410156)
|
||||
|
||||
button:SetHighlightTexture("Interface\\Buttons\\UI-Common-MouseHilight")
|
||||
@@ -1532,7 +1541,6 @@ function CharacterCreate_Okay()
|
||||
if ( PAID_SERVICE_TYPE ) then
|
||||
GlueDialog_Show("CONFIRM_PAID_SERVICE");
|
||||
else
|
||||
message("DEBUG: old path CreateCharacter (no outfitId!)");
|
||||
CreateCharacter(CharacterCreateNameEdit:GetText());
|
||||
end
|
||||
|
||||
|
||||
@@ -188,8 +188,8 @@
|
||||
</Frames>
|
||||
</Frame>
|
||||
<!-- Game mode tile template -->
|
||||
<Frame name="CharacterCreateGameModeTileTemplate" virtual="true" enableMouse="false">
|
||||
<Size x="220" y="126"/>
|
||||
<Frame name="CharacterCreateGameModeTileTemplate" virtual="true" enableMouse="true">
|
||||
<Size x="220" y="252"/>
|
||||
<Layers>
|
||||
<Layer level="BACKGROUND">
|
||||
<Texture name="$parentBg">
|
||||
@@ -207,11 +207,24 @@
|
||||
</Anchors>
|
||||
<Color r="0" g="0" b="0" a="0.18"/>
|
||||
</Texture>
|
||||
<Texture name="$parentOverlay">
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT" x="4" y="-4"/>
|
||||
<Anchor point="BOTTOMRIGHT" x="-4" y="4"/>
|
||||
</Anchors>
|
||||
<Color r="0" g="0" b="0" a="0.45"/>
|
||||
</Texture>
|
||||
</Layer>
|
||||
<Layer level="OVERLAY">
|
||||
<FontString name="$parentTitle" inherits="GlueFontNormalLarge" justifyH="CENTER">
|
||||
<Anchors>
|
||||
<Anchor point="CENTER" x="0" y="16"/>
|
||||
<Anchor point="TOP" x="0" y="-18"/>
|
||||
</Anchors>
|
||||
</FontString>
|
||||
<FontString name="$parentDesc" inherits="GlueFontHighlightSmall" justifyH="CENTER">
|
||||
<Size x="190" y="150"/>
|
||||
<Anchors>
|
||||
<Anchor point="TOP" x="0" y="-56"/>
|
||||
</Anchors>
|
||||
</FontString>
|
||||
</Layer>
|
||||
@@ -622,6 +635,7 @@
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
self:RegisterForClicks("LeftButtonDown", "LeftButtonUp");
|
||||
if self:GetNormalTexture() then self:GetNormalTexture():SetAlpha(1); end
|
||||
</OnLoad>
|
||||
<OnClick>
|
||||
PlaySound("igInventoryRotateCharacter");
|
||||
@@ -632,6 +646,7 @@
|
||||
</Scripts>
|
||||
<NormalTexture file="Interface\Glues\CharacterCreate\UI-RotationRight-Big-Up">
|
||||
<TexCoords left="1.0" right="0" top="0" bottom="1.0"/>
|
||||
<Color r="1" g="1" b="1" a="1"/>
|
||||
</NormalTexture>
|
||||
<PushedTexture file="Interface\Glues\CharacterCreate\UI-RotationRight-Big-Down">
|
||||
<TexCoords left="1.0" right="0" top="0" bottom="1.0"/>
|
||||
@@ -654,6 +669,7 @@
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
self:RegisterForClicks("LeftButtonDown", "LeftButtonUp");
|
||||
if self:GetNormalTexture() then self:GetNormalTexture():SetAlpha(1); end
|
||||
</OnLoad>
|
||||
<OnClick>
|
||||
PlaySound("igInventoryRotateCharacter");
|
||||
@@ -662,7 +678,9 @@
|
||||
CharacterCreateRotateRight_OnUpdate(self);
|
||||
</OnUpdate>
|
||||
</Scripts>
|
||||
<NormalTexture file="Interface\Glues\CharacterCreate\UI-RotationRight-Big-Up"/>
|
||||
<NormalTexture file="Interface\Glues\CharacterCreate\UI-RotationRight-Big-Up">
|
||||
<Color r="1" g="1" b="1" a="1"/>
|
||||
</NormalTexture>
|
||||
<PushedTexture file="Interface\Glues\CharacterCreate\UI-RotationRight-Big-Down"/>
|
||||
<HighlightTexture file="Interface\Buttons\UI-Common-MouseHilight" alphaMode="ADD">
|
||||
<Size x="30" y="30"/>
|
||||
@@ -683,6 +701,7 @@
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
self:RegisterForClicks("LeftButtonDown");
|
||||
if self:GetNormalTexture() then self:GetNormalTexture():SetAlpha(1); end
|
||||
</OnLoad>
|
||||
<OnClick>
|
||||
PlaySound("igInventoryRotateCharacter");
|
||||
@@ -691,6 +710,7 @@
|
||||
</Scripts>
|
||||
<NormalTexture file="Interface\Glues\CharacterCreate\charactercreate">
|
||||
<TexCoords left="0.256347656" right="0.294921875" top="0.921386719" bottom="0.956542969"/>
|
||||
<Color r="1" g="1" b="1" a="1"/>
|
||||
</NormalTexture>
|
||||
<PushedTexture file="Interface\Glues\CharacterCreate\charactercreate">
|
||||
<TexCoords left="0.218261719" right="0.256835938" top="0.921386719" bottom="0.957031250"/>
|
||||
@@ -722,6 +742,7 @@
|
||||
</Scripts>
|
||||
<NormalTexture file="Interface\Glues\CharacterCreate\charactercreate">
|
||||
<TexCoords left="0.256835938" right="0.295410156" top="0.958007813" bottom="0.994140625"/>
|
||||
<Color r="1" g="1" b="1" a="1"/>
|
||||
</NormalTexture>
|
||||
<PushedTexture file="Interface\Glues\CharacterCreate\charactercreate">
|
||||
<TexCoords left="0.218750000" right="0.257324219" top="0.958007813" bottom="0.994140625"/>
|
||||
@@ -736,7 +757,7 @@
|
||||
|
||||
<!-- Game mode selection -->
|
||||
<Frame name="CharacterCreateGameModeFrame" hidden="true">
|
||||
<Size x="520" y="190"/>
|
||||
<Size x="520" y="316"/>
|
||||
<Anchors>
|
||||
<Anchor point="BOTTOM" relativeTo="CharacterCreateNameEdit" relativePoint="TOP" x="0" y="26"/>
|
||||
</Anchors>
|
||||
|
||||
@@ -9,7 +9,7 @@ CHARACTER_ROTATION_CONSTANT = 0.6;
|
||||
MAX_CHARACTERS_DISPLAYED = 8;
|
||||
MAX_CHARACTERS_PER_REALM = 8;
|
||||
GAMEMODE_CHARACTER_FLAG_TRAITOR = 0x40000000;
|
||||
CHARACTER_SELECT_DEBUG_CHARFLAGS = true;
|
||||
CHARACTER_SELECT_DEBUG_CHARFLAGS = false;
|
||||
|
||||
local function CharacterSelect_HasFlag(charFlags, flagMask)
|
||||
if ( type(charFlags) ~= "number" or type(flagMask) ~= "number" ) then
|
||||
@@ -137,7 +137,9 @@ local function CharacterSelect_UpdateTraitorVisuals(button, buttonIndex, isTrait
|
||||
if ( not traitorBadge ) then
|
||||
traitorBadge = button:CreateFontString("CharSelectCharacterButton"..buttonIndex.."TraitorBadge", "OVERLAY", "GlueFontNormalSmall");
|
||||
traitorBadge:ClearAllPoints();
|
||||
traitorBadge:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -18, 10);
|
||||
traitorBadge:SetPoint("BOTTOM", button, "BOTTOMLEFT", 193, 8);
|
||||
traitorBadge:SetJustifyH("CENTER");
|
||||
traitorBadge:SetWidth(60);
|
||||
traitorBadge:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE");
|
||||
end
|
||||
traitorBadge:SetText("ПРЕДАТЕЛЬ");
|
||||
@@ -742,7 +744,7 @@ function UpdateCharacterList()
|
||||
factionIcon = button:CreateTexture("CharSelectCharacterButton"..index.."FactionIcon", "OVERLAY", nil, 3);
|
||||
end
|
||||
factionIcon:ClearAllPoints();
|
||||
factionIcon:SetPoint("TOPLEFT", button, "TOPLEFT", 170, -5);
|
||||
factionIcon:SetPoint("TOPLEFT", button, "TOPLEFT", 163, -5);
|
||||
factionIcon:SetSize(60, 60);
|
||||
|
||||
if faction == "Alliance" then
|
||||
@@ -835,18 +837,20 @@ function UpdateCharacterList()
|
||||
end
|
||||
statusText:ClearAllPoints();
|
||||
|
||||
statusText:SetJustifyH("CENTER");
|
||||
statusText:SetWidth(60);
|
||||
if ghost then
|
||||
statusText:SetPoint("TOPLEFT", button, "TOPLEFT", 170, -5);
|
||||
statusText:SetPoint("TOP", button, "TOPLEFT", 193, -5);
|
||||
statusText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE");
|
||||
statusText:SetTextColor(1, 0.2, 0.2);
|
||||
|
||||
|
||||
local glueLocale = GetGlueLocale and GetGlueLocale() or GetLocale() or "enUS";
|
||||
local deadText = _G["DEAD_INF"] or
|
||||
(_G["GlueStrings"] and _G["GlueStrings"]["DEAD_INF"] and
|
||||
_G["GlueStrings"]["DEAD_INF"][glueLocale]);
|
||||
statusText:SetText(deadText);
|
||||
else
|
||||
statusText:SetPoint("TOPLEFT", button, "TOPLEFT", 182, -5);
|
||||
statusText:SetPoint("TOP", button, "TOPLEFT", 193, -5);
|
||||
statusText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE");
|
||||
statusText:SetTextColor(0.2, 1, 0.2);
|
||||
|
||||
@@ -926,13 +930,6 @@ function UpdateCharacterList()
|
||||
CharacterSelect_ResetTraitorVisuals(button, i);
|
||||
end
|
||||
|
||||
if ( CHARACTER_SELECT_DEBUG_CHARFLAGS and table.getn(debugCharFlagsLines) > 0 ) then
|
||||
local debugCharFlagsMessage = table.concat(debugCharFlagsLines, "\n");
|
||||
if ( CharacterSelect.lastCharFlagsDebugMessage ~= debugCharFlagsMessage ) then
|
||||
CharacterSelect.lastCharFlagsDebugMessage = debugCharFlagsMessage;
|
||||
message("CHAR_ENUM charFlags debug:\n" .. debugCharFlagsMessage);
|
||||
end
|
||||
end
|
||||
|
||||
if ( numChars == 0 ) then
|
||||
CharacterSelect.selectedIndex = 0;
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -939,10 +939,14 @@ local function ApplyMicromenuSystem()
|
||||
end
|
||||
|
||||
local icon = button.DragonUIPVPIcon
|
||||
if englishFaction == 'Alliance' then
|
||||
-- MoonWell: traitors display opposite faction icon
|
||||
local displayFaction = (MoonWell_IsTraitor and englishFaction == 'Alliance') and 'Horde'
|
||||
or (MoonWell_IsTraitor and englishFaction == 'Horde') and 'Alliance'
|
||||
or englishFaction
|
||||
if displayFaction == 'Alliance' then
|
||||
icon:SetTexture(microTexture)
|
||||
icon:SetTexCoord(0, 118 / 256, 0, 151 / 256)
|
||||
elseif englishFaction == 'Horde' then
|
||||
elseif displayFaction == 'Horde' then
|
||||
icon:SetTexture(microTexture)
|
||||
icon:SetTexCoord(118 / 256, 236 / 256, 0, 151 / 256)
|
||||
else
|
||||
@@ -959,10 +963,10 @@ local function ApplyMicromenuSystem()
|
||||
-- WoW shows/hides this automatically on mouse enter/leave.
|
||||
local highlightTexture = button:GetHighlightTexture()
|
||||
if highlightTexture then
|
||||
if englishFaction == 'Alliance' then
|
||||
if displayFaction == 'Alliance' then
|
||||
highlightTexture:SetTexture(microTexture)
|
||||
highlightTexture:SetTexCoord(0, 118 / 256, 0, 151 / 256)
|
||||
elseif englishFaction == 'Horde' then
|
||||
elseif displayFaction == 'Horde' then
|
||||
highlightTexture:SetTexture(microTexture)
|
||||
highlightTexture:SetTexCoord(118 / 256, 236 / 256, 0, 151 / 256)
|
||||
else
|
||||
|
||||
@@ -1462,14 +1462,18 @@ local function StylePVPBattlefieldFrame()
|
||||
MiniMapBattlefieldFrame:SetPushedTexture('')
|
||||
|
||||
-- Detect player faction and apply appropriate textures
|
||||
local faction = string.lower(UnitFactionGroup('player'))
|
||||
-- MoonWell: traitors display opposite faction icon
|
||||
local realFaction = UnitFactionGroup('player')
|
||||
local displayFaction = (MoonWell_IsTraitor and realFaction == 'Alliance') and 'horde'
|
||||
or (MoonWell_IsTraitor and realFaction == 'Horde') and 'alliance'
|
||||
or string.lower(realFaction)
|
||||
|
||||
-- Apply textures using SetAtlasTexture
|
||||
if MiniMapBattlefieldFrame:GetNormalTexture() then
|
||||
SetAtlasTexture(MiniMapBattlefieldFrame:GetNormalTexture(), 'Minimap-PVP-' .. faction .. '-Normal')
|
||||
SetAtlasTexture(MiniMapBattlefieldFrame:GetNormalTexture(), 'Minimap-PVP-' .. displayFaction .. '-Normal')
|
||||
end
|
||||
if MiniMapBattlefieldFrame:GetPushedTexture() then
|
||||
SetAtlasTexture(MiniMapBattlefieldFrame:GetPushedTexture(), 'Minimap-PVP-' .. faction .. '-Pushed')
|
||||
SetAtlasTexture(MiniMapBattlefieldFrame:GetPushedTexture(), 'Minimap-PVP-' .. displayFaction .. '-Pushed')
|
||||
end
|
||||
|
||||
-- Configure click script like in minimapa_old.lua
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
-- ============================================================================
|
||||
-- MoonWell Client
|
||||
-- Server integration: game modes, traitor faction display
|
||||
-- ============================================================================
|
||||
|
||||
-- Global flag read by FrameXML files to decide which faction icon to show.
|
||||
-- true = show opposite faction icon (traitor)
|
||||
-- false = show real faction icon (normal)
|
||||
MoonWell_IsTraitor = false
|
||||
|
||||
-- ============================================================================
|
||||
-- AIO handler — called by server on login
|
||||
-- Server: AIO:Handle(player, "MoonWellClient", "Init", gameMode)
|
||||
-- gameMode: 0 = normal, 1 = traitor
|
||||
-- ============================================================================
|
||||
|
||||
if not AIO then
|
||||
return
|
||||
end
|
||||
|
||||
local Handler = AIO.AddHandlers("MoonWellClient", {})
|
||||
|
||||
local function MoonWell_RefreshFactionIcons()
|
||||
-- Portrait PvP icon
|
||||
if PlayerFrame_UpdatePvPStatus then
|
||||
PlayerFrame_UpdatePvPStatus()
|
||||
end
|
||||
-- DragonUI PvP micro button: SetupPVPButton() runs on load before AIO responds,
|
||||
-- so we refresh its DragonUIPVPIcon texture directly after Init.
|
||||
if PVPMicroButton and PVPMicroButton.DragonUIPVPIcon then
|
||||
local factionGroup = UnitFactionGroup("player")
|
||||
if factionGroup then
|
||||
local displayFaction = MoonWell_IsTraitor
|
||||
and (factionGroup == "Alliance" and "Horde" or "Alliance")
|
||||
or factionGroup
|
||||
local microTexture = "Interface\\AddOns\\DragonUI\\Textures\\Micromenu\\micropvp"
|
||||
local icon = PVPMicroButton.DragonUIPVPIcon
|
||||
if displayFaction == "Alliance" then
|
||||
icon:SetTexture(microTexture)
|
||||
icon:SetTexCoord(0, 118/256, 0, 151/256)
|
||||
elseif displayFaction == "Horde" then
|
||||
icon:SetTexture(microTexture)
|
||||
icon:SetTexCoord(118/256, 236/256, 0, 151/256)
|
||||
end
|
||||
local hl = PVPMicroButton:GetHighlightTexture()
|
||||
if hl then
|
||||
if displayFaction == "Alliance" then
|
||||
hl:SetTexture(microTexture)
|
||||
hl:SetTexCoord(0, 118/256, 0, 151/256)
|
||||
elseif displayFaction == "Horde" then
|
||||
hl:SetTexture(microTexture)
|
||||
hl:SetTexCoord(118/256, 236/256, 0, 151/256)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Handler.Init(_, mode)
|
||||
MoonWell_IsTraitor = (tonumber(mode) == 1)
|
||||
MoonWell_RefreshFactionIcons()
|
||||
end
|
||||
@@ -0,0 +1,11 @@
|
||||
## Interface: 30300
|
||||
## Title: MoonWell Client
|
||||
## Notes: MoonWell server integration — game modes, traitor faction display
|
||||
## Version: 1.0.0
|
||||
## Author: MoonWell
|
||||
## SavedVariables: MoonWellClientDB
|
||||
## Dependencies: AIO_Client
|
||||
## DefaultState: Enabled
|
||||
## X-Hidden: 1
|
||||
|
||||
MoonWellClient.lua
|
||||
@@ -0,0 +1,807 @@
|
||||
-- MoonWell: returns display faction (opposite for traitors)
|
||||
local function MoonWell_GetDisplayFaction()
|
||||
local f = UnitFactionGroup("player");
|
||||
if MoonWell_IsTraitor and f then
|
||||
return f == "Alliance" and "Horde" or "Alliance";
|
||||
end
|
||||
return f;
|
||||
end
|
||||
|
||||
BATTLEFIELD_ZONES_DISPLAYED = 5;
|
||||
BATTLEFIELD_ZONES_HEIGHT = 20;
|
||||
BATTLEFIELD_SHUTDOWN_TIMER = 0;
|
||||
BATTLEFIELD_TIMER_THRESHOLDS = {600, 300, 60, 15};
|
||||
BATTLEFIELD_TIMER_THRESHOLD_INDEX = 1;
|
||||
PREVIOUS_BATTLEFIELD_MOD = 0;
|
||||
BATTLEFIELD_TIMER_DELAY = 3;
|
||||
BATTLEFIELD_MAP_WIDTH = 320;
|
||||
BATTLEFIELD_MAP_HEIGHT = 213;
|
||||
MAX_BATTLEFIELD_QUEUES = 2;
|
||||
MAX_WORLD_PVP_QUEUES = 1;
|
||||
CURRENT_BATTLEFIELD_QUEUES = {};
|
||||
PREVIOUS_BATTLEFIELD_QUEUES = {};
|
||||
|
||||
local BATTLEFIELD_FRAME_FADE_TIME = 0.15
|
||||
|
||||
function BattlefieldFrame_OnLoad (self)
|
||||
self:RegisterEvent("PLAYER_ENTERING_WORLD");
|
||||
self:RegisterEvent("BATTLEFIELDS_SHOW");
|
||||
self:RegisterEvent("BATTLEFIELDS_CLOSED");
|
||||
self:RegisterEvent("UPDATE_BATTLEFIELD_STATUS");
|
||||
self:RegisterEvent("PARTY_LEADER_CHANGED");
|
||||
self:RegisterEvent("ZONE_CHANGED");
|
||||
self:RegisterEvent("ZONE_CHANGED_NEW_AREA");
|
||||
|
||||
self:RegisterEvent("BATTLEFIELD_MGR_QUEUE_REQUEST_RESPONSE");
|
||||
self:RegisterEvent("BATTLEFIELD_MGR_QUEUE_INVITE");
|
||||
self:RegisterEvent("BATTLEFIELD_MGR_ENTRY_INVITE");
|
||||
self:RegisterEvent("BATTLEFIELD_MGR_EJECT_PENDING");
|
||||
self:RegisterEvent("BATTLEFIELD_MGR_EJECTED");
|
||||
self:RegisterEvent("BATTLEFIELD_MGR_ENTERED");
|
||||
|
||||
BattlefieldFrame.timerDelay = 0;
|
||||
end
|
||||
|
||||
function BattlefieldFrame_OnEvent (self, event, ...)
|
||||
if ( event == "PLAYER_ENTERING_WORLD" ) then
|
||||
MiniMapBattlefieldDropDown_OnLoad();
|
||||
BattlefieldFrame_UpdateStatus(false, nil);
|
||||
elseif ( event == "BATTLEFIELDS_SHOW" ) then
|
||||
if ( not IsBattlefieldArena() ) then
|
||||
ShowUIPanel(BattlefieldFrame);
|
||||
|
||||
-- Default to first available
|
||||
SetSelectedBattlefield(0);
|
||||
|
||||
if ( not BattlefieldFrame:IsShown() ) then
|
||||
CloseBattlefield();
|
||||
return;
|
||||
end
|
||||
UpdateMicroButtons();
|
||||
BattlefieldFrame_Update();
|
||||
end
|
||||
elseif ( event == "BATTLEFIELDS_CLOSED" ) then
|
||||
HideUIPanel(BattlefieldFrame);
|
||||
elseif ( event == "UPDATE_BATTLEFIELD_STATUS" or event == "ZONE_CHANGED_NEW_AREA" or event == "ZONE_CHANGED") then
|
||||
local arg1 = ...
|
||||
BattlefieldFrame_UpdateStatus(false, arg1);
|
||||
BattlefieldFrame_Update();
|
||||
elseif ( event == "BATTLEFIELD_MGR_QUEUE_REQUEST_RESPONSE" ) then
|
||||
local battleID, accepted, warmup, inArea, loggingIn = ...;
|
||||
if(not loggingIn) then
|
||||
if(accepted) then
|
||||
if(warmup) then
|
||||
StaticPopup_Show("BFMGR_CONFIRM_WORLD_PVP_QUEUED_WARMUP", "Wintergrasp", nil, arg1);
|
||||
elseif (inArea) then
|
||||
StaticPopup_Show("BFMGR_EJECT_PENDING", "Wintergrasp", nil, arg1);
|
||||
else
|
||||
StaticPopup_Show("BFMGR_CONFIRM_WORLD_PVP_QUEUED", "Wintergrasp", nil, arg1);
|
||||
end
|
||||
else
|
||||
StaticPopup_Show("BFMGR_DENY_WORLD_PVP_QUEUED", "Wintergrasp", nil, arg1);
|
||||
end
|
||||
end
|
||||
BattlefieldFrame_UpdateStatus(false);
|
||||
BattlefieldFrame_Update();
|
||||
elseif ( event == "BATTLEFIELD_MGR_EJECT_PENDING" ) then
|
||||
local battleID, remote = ...;
|
||||
if(remote) then
|
||||
local dialog = StaticPopup_Show("BFMGR_EJECT_PENDING_REMOTE", "Wintergrasp", nil, arg1);
|
||||
else
|
||||
local dialog = StaticPopup_Show("BFMGR_EJECT_PENDING", "Wintergrasp", nil, arg1);
|
||||
end
|
||||
BattlefieldFrame_UpdateStatus(false);
|
||||
BattlefieldFrame_Update();
|
||||
elseif ( event == "BATTLEFIELD_MGR_EJECTED" ) then
|
||||
local battleID, playerExited, relocated, battleActive, lowLevel = ...;
|
||||
StaticPopup_Hide("BFMGR_INVITED_TO_QUEUE");
|
||||
StaticPopup_Hide("BFMGR_INVITED_TO_QUEUE_WARMUP");
|
||||
StaticPopup_Hide("BFMGR_INVITED_TO_ENTER");
|
||||
StaticPopup_Hide("BFMGR_EJECT_PENDING");
|
||||
if(lowLevel) then
|
||||
local dialog = StaticPopup_Show("BFMGR_PLAYER_LOW_LEVEL", "Wintergrasp", nil, arg1);
|
||||
elseif (playerExited and battleActive and not relocated) then
|
||||
local dialog = StaticPopup_Show("BFMGR_PLAYER_EXITED_BATTLE", "Wintergrasp", nil, arg1);
|
||||
end
|
||||
BattlefieldFrame_UpdateStatus(false);
|
||||
BattlefieldFrame_Update();
|
||||
elseif ( event == "BATTLEFIELD_MGR_QUEUE_INVITE" ) then
|
||||
local battleID, warmup = ...;
|
||||
if(warmup) then
|
||||
local dialog = StaticPopup_Show("BFMGR_INVITED_TO_QUEUE_WARMUP", "Wintergrasp", nil, arg1);
|
||||
else
|
||||
local dialog = StaticPopup_Show("BFMGR_INVITED_TO_QUEUE", "Wintergrasp", nil, arg1);
|
||||
end
|
||||
StaticPopup_Hide("BFMGR_EJECT_PENDING");
|
||||
BattlefieldFrame_UpdateStatus(false);
|
||||
BattlefieldFrame_Update();
|
||||
elseif ( event == "BATTLEFIELD_MGR_ENTRY_INVITE" ) then
|
||||
local battleID = ...;
|
||||
local dialog = StaticPopup_Show("BFMGR_INVITED_TO_ENTER", "Wintergrasp", nil, arg1);
|
||||
StaticPopup_Hide("BFMGR_EJECT_PENDING");
|
||||
BattlefieldFrame_UpdateStatus(false);
|
||||
BattlefieldFrame_Update();
|
||||
elseif ( event == "BATTLEFIELD_MGR_ENTERED" ) then
|
||||
StaticPopup_Hide("BFMGR_INVITED_TO_QUEUE");
|
||||
StaticPopup_Hide("BFMGR_INVITED_TO_QUEUE_WARMUP");
|
||||
StaticPopup_Hide("BFMGR_INVITED_TO_ENTER");
|
||||
StaticPopup_Hide("BFMGR_EJECT_PENDING");
|
||||
BattlefieldFrame_UpdateStatus(false);
|
||||
BattlefieldFrame_Update();
|
||||
end
|
||||
|
||||
if ( event == "PARTY_LEADER_CHANGED" ) then
|
||||
BattlefieldFrame_Update();
|
||||
end
|
||||
end
|
||||
|
||||
function BattlefieldTimerFrame_OnUpdate(self, elapsed)
|
||||
local keepUpdating = false;
|
||||
if ( BATTLEFIELD_SHUTDOWN_TIMER > 0 ) then
|
||||
keepUpdating = true;
|
||||
BattlefieldIconText:Hide();
|
||||
else
|
||||
local lowestExpiration = 0;
|
||||
for i = 1, MAX_BATTLEFIELD_QUEUES do
|
||||
local expiration = GetBattlefieldPortExpiration(i);
|
||||
if ( expiration > 0 ) then
|
||||
if( expiration < lowestExpiration or lowestExpiration == 0 ) then
|
||||
lowestExpiration = expiration;
|
||||
end
|
||||
|
||||
keepUpdating = true;
|
||||
end
|
||||
end
|
||||
|
||||
if( lowestExpiration > 0 and lowestExpiration <= 10 ) then
|
||||
BattlefieldIconText:SetText(lowestExpiration);
|
||||
BattlefieldIconText:Show();
|
||||
else
|
||||
BattlefieldIconText:Hide();
|
||||
end
|
||||
end
|
||||
|
||||
if ( not keepUpdating ) then
|
||||
BattlefieldTimerFrame:SetScript("OnUpdate", nil);
|
||||
return;
|
||||
end
|
||||
|
||||
local frame = BattlefieldFrame
|
||||
|
||||
BATTLEFIELD_SHUTDOWN_TIMER = BATTLEFIELD_SHUTDOWN_TIMER - elapsed;
|
||||
-- Set the time for the score frame
|
||||
WorldStateScoreFrameTimer:SetFormattedText(SecondsToTimeAbbrev(BATTLEFIELD_SHUTDOWN_TIMER));
|
||||
-- Check if I should send a message only once every 3 seconds (BATTLEFIELD_TIMER_DELAY)
|
||||
frame.timerDelay = frame.timerDelay + elapsed;
|
||||
if ( frame.timerDelay < BATTLEFIELD_TIMER_DELAY ) then
|
||||
return;
|
||||
else
|
||||
frame.timerDelay = 0
|
||||
end
|
||||
|
||||
local threshold = BATTLEFIELD_TIMER_THRESHOLDS[BATTLEFIELD_TIMER_THRESHOLD_INDEX];
|
||||
if ( BATTLEFIELD_SHUTDOWN_TIMER > 0 ) then
|
||||
if ( BATTLEFIELD_SHUTDOWN_TIMER < threshold and BATTLEFIELD_TIMER_THRESHOLD_INDEX ~= #BATTLEFIELD_TIMER_THRESHOLDS ) then
|
||||
-- If timer past current threshold advance to the next one
|
||||
BATTLEFIELD_TIMER_THRESHOLD_INDEX = BATTLEFIELD_TIMER_THRESHOLD_INDEX + 1;
|
||||
else
|
||||
-- See if time should be posted
|
||||
local currentMod = floor(BATTLEFIELD_SHUTDOWN_TIMER/threshold);
|
||||
if ( PREVIOUS_BATTLEFIELD_MOD ~= currentMod ) then
|
||||
-- Print message
|
||||
local info = ChatTypeInfo["SYSTEM"];
|
||||
local string;
|
||||
if ( GetBattlefieldWinner() ) then
|
||||
local isArena = IsActiveBattlefieldArena();
|
||||
if ( isArena ) then
|
||||
string = format(ARENA_COMPLETE_MESSAGE, SecondsToTime(ceil(BATTLEFIELD_SHUTDOWN_TIMER/threshold) * threshold));
|
||||
else
|
||||
string = format(BATTLEGROUND_COMPLETE_MESSAGE, SecondsToTime(ceil(BATTLEFIELD_SHUTDOWN_TIMER/threshold) * threshold));
|
||||
end
|
||||
else
|
||||
string = format(INSTANCE_SHUTDOWN_MESSAGE, SecondsToTime(ceil(BATTLEFIELD_SHUTDOWN_TIMER/threshold) * threshold));
|
||||
end
|
||||
DEFAULT_CHAT_FRAME:AddMessage(string, info.r, info.g, info.b, info.id);
|
||||
PREVIOUS_BATTLEFIELD_MOD = currentMod;
|
||||
end
|
||||
end
|
||||
else
|
||||
BATTLEFIELD_SHUTDOWN_TIMER = 0;
|
||||
end
|
||||
end
|
||||
|
||||
function BattlefieldFrame_UpdateStatus(tooltipOnly, mapIndex)
|
||||
local status, mapName, instanceID, queueID, levelRangeMin, levelRangeMax, teamSize, registeredMatch;
|
||||
local numberQueues = 0;
|
||||
local waitTime, timeInQueue;
|
||||
local tooltip;
|
||||
local showRightClickText;
|
||||
BATTLEFIELD_SHUTDOWN_TIMER = 0;
|
||||
|
||||
-- Reset tooltip
|
||||
MiniMapBattlefieldFrame.tooltip = nil;
|
||||
MiniMapBattlefieldFrame.waitTime = {};
|
||||
MiniMapBattlefieldFrame.status = nil;
|
||||
|
||||
-- Copy current queues into previous queues
|
||||
if ( not tooltipOnly ) then
|
||||
PREVIOUS_BATTLEFIELD_QUEUES = {};
|
||||
for index, value in pairs(CURRENT_BATTLEFIELD_QUEUES) do
|
||||
tinsert(PREVIOUS_BATTLEFIELD_QUEUES, value);
|
||||
end
|
||||
CURRENT_BATTLEFIELD_QUEUES = {};
|
||||
end
|
||||
|
||||
if ( CanHearthAndResurrectFromArea() ) then
|
||||
if ( not MiniMapBattlefieldFrame.inWorldPVPArea ) then
|
||||
MiniMapBattlefieldFrame.inWorldPVPArea = true;
|
||||
UIFrameFadeIn(MiniMapBattlefieldFrame, BATTLEFIELD_FRAME_FADE_TIME);
|
||||
BattlegroundShineFadeIn();
|
||||
end
|
||||
else
|
||||
MiniMapBattlefieldFrame.inWorldPVPArea = false;
|
||||
end
|
||||
|
||||
for i=1, MAX_BATTLEFIELD_QUEUES do
|
||||
status, mapName, instanceID, levelRangeMin, levelRangeMax, teamSize, registeredMatch = GetBattlefieldStatus(i);
|
||||
if ( mapName ) then
|
||||
if ( instanceID ~= 0 ) then
|
||||
mapName = mapName.." "..instanceID;
|
||||
end
|
||||
if ( teamSize ~= 0 ) then
|
||||
if ( registeredMatch ) then
|
||||
mapName = ARENA_RATED_MATCH.." "..format(PVP_TEAMSIZE, teamSize, teamSize);
|
||||
else
|
||||
mapName = ARENA_CASUAL.." "..format(PVP_TEAMSIZE, teamSize, teamSize);
|
||||
end
|
||||
end
|
||||
end
|
||||
tooltip = nil;
|
||||
MiniMapBattlefieldFrame_isArena();
|
||||
if ( not tooltipOnly and (status ~= "confirm") ) then
|
||||
StaticPopup_Hide("CONFIRM_BATTLEFIELD_ENTRY", i);
|
||||
end
|
||||
|
||||
if ( status ~= "none" ) then
|
||||
numberQueues = numberQueues+1;
|
||||
if ( status == "queued" ) then
|
||||
-- Update queue info show button on minimap
|
||||
waitTime = GetBattlefieldEstimatedWaitTime(i);
|
||||
timeInQueue = GetBattlefieldTimeWaited(i)/1000;
|
||||
if ( waitTime == 0 ) then
|
||||
waitTime = QUEUE_TIME_UNAVAILABLE;
|
||||
elseif ( waitTime < 60000 ) then
|
||||
waitTime = LESS_THAN_ONE_MINUTE;
|
||||
else
|
||||
waitTime = SecondsToTime(waitTime/1000, 1);
|
||||
end
|
||||
MiniMapBattlefieldFrame.waitTime[i] = waitTime;
|
||||
tooltip = format(BATTLEFIELD_IN_QUEUE, mapName, waitTime, SecondsToTime(timeInQueue));
|
||||
|
||||
if ( not tooltipOnly ) then
|
||||
if ( not IsAlreadyInQueue(mapName) ) then
|
||||
UIFrameFadeIn(MiniMapBattlefieldFrame, BATTLEFIELD_FRAME_FADE_TIME);
|
||||
BattlegroundShineFadeIn();
|
||||
PlaySound("PVPENTERQUEUE");
|
||||
end
|
||||
tinsert(CURRENT_BATTLEFIELD_QUEUES, mapName);
|
||||
end
|
||||
showRightClickText = 1;
|
||||
elseif ( status == "confirm" ) then
|
||||
-- Have been accepted show enter battleground dialog
|
||||
local seconds = SecondsToTime(GetBattlefieldPortExpiration(i));
|
||||
if ( seconds ~= "" ) then
|
||||
tooltip = format(BATTLEFIELD_QUEUE_CONFIRM, mapName, seconds);
|
||||
else
|
||||
tooltip = format(BATTLEFIELD_QUEUE_PENDING_REMOVAL, mapName);
|
||||
end
|
||||
if ( (i==mapIndex) and (not tooltipOnly) ) then
|
||||
local dialog = StaticPopup_Show("CONFIRM_BATTLEFIELD_ENTRY", mapName, nil, i);
|
||||
PlaySound("PVPTHROUGHQUEUE");
|
||||
MiniMapBattlefieldFrame:Show();
|
||||
end
|
||||
showRightClickText = 1;
|
||||
BattlefieldTimerFrame:SetScript("OnUpdate", BattlefieldTimerFrame_OnUpdate);
|
||||
elseif ( status == "active" ) then
|
||||
-- In the battleground
|
||||
if ( teamSize ~= 0 ) then
|
||||
tooltip = mapName;
|
||||
else
|
||||
tooltip = format(BATTLEFIELD_IN_BATTLEFIELD, mapName);
|
||||
end
|
||||
BATTLEFIELD_SHUTDOWN_TIMER = GetBattlefieldInstanceExpiration()/1000;
|
||||
if ( BATTLEFIELD_SHUTDOWN_TIMER > 0 ) then
|
||||
BattlefieldTimerFrame:SetScript("OnUpdate", BattlefieldTimerFrame_OnUpdate);
|
||||
end
|
||||
BATTLEFIELD_TIMER_THRESHOLD_INDEX = 1;
|
||||
PREVIOUS_BATTLEFIELD_MOD = 0;
|
||||
MiniMapBattlefieldFrame.status = status;
|
||||
elseif ( status == "error" ) then
|
||||
-- Should never happen haha
|
||||
end
|
||||
if ( tooltip ) then
|
||||
if ( MiniMapBattlefieldFrame.tooltip ) then
|
||||
MiniMapBattlefieldFrame.tooltip = MiniMapBattlefieldFrame.tooltip.."\n\n"..tooltip;
|
||||
else
|
||||
MiniMapBattlefieldFrame.tooltip = tooltip;
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for i=1, MAX_WORLD_PVP_QUEUES do
|
||||
status, mapName, queueID = GetWorldPVPQueueStatus(i);
|
||||
if ( status ~= "none" ) then
|
||||
numberQueues = numberQueues + 1;
|
||||
end
|
||||
if ( status == "queued" or status == "confirm" ) then
|
||||
if ( status == "queued" ) then
|
||||
tooltip = format(BATTLEFIELD_IN_QUEUE_SIMPLE, mapName);
|
||||
elseif ( status == "confirm" ) then
|
||||
tooltip = format(BATTLEFIELD_QUEUE_CONFIRM_SIMPLE, mapName);
|
||||
end
|
||||
|
||||
if ( MiniMapBattlefieldFrame.tooltip ) then
|
||||
MiniMapBattlefieldFrame.tooltip = MiniMapBattlefieldFrame.tooltip.."\n\n"..tooltip;
|
||||
else
|
||||
MiniMapBattlefieldFrame.tooltip = tooltip;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- See if should add right click message
|
||||
if ( MiniMapBattlefieldFrame.tooltip and showRightClickText ) then
|
||||
MiniMapBattlefieldFrame.tooltip = MiniMapBattlefieldFrame.tooltip.."\n"..RIGHT_CLICK_MESSAGE;
|
||||
elseif ( MiniMapBattlefieldFrame_isArena() ) then
|
||||
MiniMapBattlefieldFrame.tooltip = MiniMapBattlefieldFrame.tooltip;
|
||||
end
|
||||
|
||||
if ( not tooltipOnly ) then
|
||||
MiniMapBattlefieldFrame_isArena();
|
||||
if ( numberQueues == 0 and (not CanHearthAndResurrectFromArea()) ) then
|
||||
-- Clear everything out
|
||||
MiniMapBattlefieldFrame:Hide();
|
||||
else
|
||||
MiniMapBattlefieldFrame:Show();
|
||||
end
|
||||
end
|
||||
BattlefieldFrame.numQueues = numberQueues;
|
||||
end
|
||||
|
||||
function MiniMapBattlefieldFrame_isArena()
|
||||
-- Set minimap icon here since it bugs out on login
|
||||
local status, mapName, instanceID, levelRangeMin, levelRangeMax, teamSize, registeredMatch = GetBattlefieldStatus(1);
|
||||
local isArena, isRegistered = IsActiveBattlefieldArena();
|
||||
if ( registeredMatch or isRegistered ) then
|
||||
MiniMapBattlefieldIcon:SetTexture("Interface\\PVPFrame\\PVP-ArenaPoints-Icon");
|
||||
MiniMapBattlefieldIcon:SetWidth(19);
|
||||
MiniMapBattlefieldIcon:SetHeight(19);
|
||||
MiniMapBattlefieldIcon:SetPoint("CENTER", "MiniMapBattlefieldFrame", "CENTER", -1, 2);
|
||||
elseif ( UnitFactionGroup("player") ) then
|
||||
MiniMapBattlefieldIcon:SetTexture("Interface\\BattlefieldFrame\\Battleground-"..MoonWell_GetDisplayFaction());
|
||||
MiniMapBattlefieldIcon:SetTexCoord(0, 1, 0, 1);
|
||||
MiniMapBattlefieldIcon:SetWidth(32);
|
||||
MiniMapBattlefieldIcon:SetHeight(32);
|
||||
MiniMapBattlefieldIcon:SetPoint("CENTER", "MiniMapBattlefieldFrame", "CENTER", -1, 0);
|
||||
end
|
||||
end
|
||||
|
||||
function BattlefieldFrame_Update()
|
||||
local zoneIndex;
|
||||
local zoneOffset = FauxScrollFrame_GetOffset(BattlefieldListScrollFrame);
|
||||
local playerLevel = UnitLevel("player");
|
||||
local button, buttonStatus;
|
||||
local instanceID;
|
||||
local mapName, mapDescription, maxGroup = GetBattlefieldInfo();
|
||||
local factionTexture = "Interface\\PVPFrame\\PVP-Currency-"..MoonWell_GetDisplayFaction();
|
||||
|
||||
if ( not mapName ) then
|
||||
return;
|
||||
end
|
||||
|
||||
-- Set title text
|
||||
BattlefieldFrameFrameLabel:SetText(mapName);
|
||||
-- Set the Join as Group text based on the limits of which instances can join as group.
|
||||
if ( maxGroup and maxGroup == 5 ) then
|
||||
BattlefieldFrameGroupJoinButton:SetText(JOIN_AS_PARTY);
|
||||
else
|
||||
BattlefieldFrameGroupJoinButton:SetText(JOIN_AS_GROUP);
|
||||
end
|
||||
-- Setup instance buttons
|
||||
-- add one to battlefields because of the fake "first available" button
|
||||
local numBattlefields = GetNumBattlefields() + 1;
|
||||
for i=1, BATTLEFIELD_ZONES_DISPLAYED, 1 do
|
||||
zoneIndex = zoneOffset + i;
|
||||
button = _G["BattlefieldZone"..i];
|
||||
|
||||
if ( zoneIndex == 1 ) then
|
||||
-- The first entry in the list is always "first available"
|
||||
button:SetText(FIRST_AVAILABLE);
|
||||
-- Set tooltip
|
||||
button.title = FIRST_AVAILABLE;
|
||||
button.tooltip = NEWBIE_TOOLTIP_FIRST_AVAILABLE;
|
||||
button:Show();
|
||||
elseif ( zoneIndex > numBattlefields ) then
|
||||
button:Hide();
|
||||
else
|
||||
instanceID = GetBattlefieldInstanceInfo(zoneIndex - 1);
|
||||
button:SetText(mapName.." "..instanceID);
|
||||
-- Set tooltip
|
||||
button.title = mapName.." "..instanceID;
|
||||
button.tooltip = NEWBIE_TOOLTIP_ENTER_BATTLEGROUND;
|
||||
button:Show();
|
||||
end
|
||||
|
||||
-- Set queued status
|
||||
button.status:Hide();
|
||||
local queueStatus, queueMapName, queueInstanceID;
|
||||
for i=1, MAX_BATTLEFIELD_QUEUES do
|
||||
queueStatus, queueMapName, queueInstanceID = GetBattlefieldStatus(i);
|
||||
if ( queueStatus ~= "none" and queueMapName.." "..queueInstanceID == button.title ) then
|
||||
if ( queueStatus == "queued" ) then
|
||||
button.status.texture:SetTexture(factionTexture);
|
||||
button.status.texture:SetTexCoord(0.0, 1.0, 0.0, 1.0);
|
||||
button.status.tooltip = BATTLEFIELD_QUEUE_STATUS;
|
||||
button.status:Show();
|
||||
elseif ( queueStatus == "confirm" ) then
|
||||
button.status.texture:SetTexture("Interface\\CharacterFrame\\UI-StateIcon");
|
||||
button.status.texture:SetTexCoord(0.45, 0.95, 0.0, 0.5);
|
||||
button.status.tooltip = BATTLEFIELD_CONFIRM_STATUS;
|
||||
button.status:Show();
|
||||
end
|
||||
elseif ( button.title == FIRST_AVAILABLE and queueMapName == mapName and queueInstanceID == 0 ) then
|
||||
if ( queueStatus == "queued" ) then
|
||||
button.status.texture:SetTexture(factionTexture);
|
||||
button.status.texture:SetTexCoord(0.0, 1.0, 0.0, 1.0);
|
||||
button.status.tooltip = BATTLEFIELD_QUEUE_STATUS;
|
||||
button.status:Show();
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Set selected instance
|
||||
if ( zoneIndex == 1 and GetSelectedBattlefield() == 0 ) then
|
||||
button:LockHighlight();
|
||||
elseif ( zoneIndex - 1 == GetSelectedBattlefield() ) then
|
||||
button:LockHighlight();
|
||||
else
|
||||
button:UnlockHighlight();
|
||||
end
|
||||
end
|
||||
|
||||
local mapName, mapDescription, maxGroup, canEnter, isHoliday, isRandom = GetBattlefieldInfo();
|
||||
|
||||
if ( isRandom or isHoliday ) then
|
||||
BattlefieldFrame_UpdateRandomInfo();
|
||||
BattlefieldFrameInfoScrollFrameChildFrameRewardsInfo:Show();
|
||||
BattlefieldFrameInfoScrollFrameChildFrameDescription:Hide();
|
||||
else
|
||||
if ( mapDescription ~= BattlefieldFrameInfoScrollFrameChildFrameDescription:GetText() ) then
|
||||
BattlefieldFrameInfoScrollFrameChildFrameDescription:SetText(mapDescription);
|
||||
BattlefieldFrameInfoScrollFrame:SetVerticalScroll(0);
|
||||
end
|
||||
|
||||
BattlefieldFrameInfoScrollFrameChildFrameRewardsInfo:Hide();
|
||||
BattlefieldFrameInfoScrollFrameChildFrameDescription:Show();
|
||||
end
|
||||
|
||||
-- Enable or disable the group join button
|
||||
if ( CanJoinBattlefieldAsGroup() ) then
|
||||
if ( ((GetNumPartyMembers() > 0) or (GetNumRaidMembers() > 0)) and IsPartyLeader() ) then
|
||||
-- If this is true then can join as a group
|
||||
BattlefieldFrameGroupJoinButton:Enable();
|
||||
else
|
||||
BattlefieldFrameGroupJoinButton:Disable();
|
||||
end
|
||||
BattlefieldFrameGroupJoinButton:Show();
|
||||
else
|
||||
BattlefieldFrameGroupJoinButton:Hide();
|
||||
end
|
||||
|
||||
if ( BattlefieldFrame.numQueues ) then
|
||||
if ( BattlefieldFrame.numQueues <= 3 ) then
|
||||
BattlefieldFrameJoinButton:Enable();
|
||||
else
|
||||
BattlefieldFrameJoinButton:Disable();
|
||||
end
|
||||
end
|
||||
|
||||
FauxScrollFrame_Update(BattlefieldListScrollFrame, numBattlefields, BATTLEFIELD_ZONES_DISPLAYED, BATTLEFIELD_ZONES_HEIGHT, "BattlefieldZone", 293, 315);
|
||||
end
|
||||
|
||||
function PVPQueue_UpdateRandomInfo(base, infoFunc)
|
||||
local BGname, canEnter, isHoliday, isRandom = infoFunc();
|
||||
|
||||
local hasWin, lossHonor, winHonor, winArena, lossArena;
|
||||
|
||||
if ( isRandom ) then
|
||||
hasWin, winHonor, winArena, lossHonor, lossArena = GetRandomBGHonorCurrencyBonuses();
|
||||
base.title:SetText(RANDOM_BATTLEGROUND);
|
||||
base.description:SetText(RANDOM_BATTLEGROUND_EXPLANATION);
|
||||
else
|
||||
base.title:SetText(BATTLEGROUND_HOLIDAY);
|
||||
base.description:SetText(BATTLEGROUND_HOLIDAY_EXPLANATION);
|
||||
hasWin, winHonor, winArena, lossHonor, lossArena = GetHolidayBGHonorCurrencyBonuses();
|
||||
end
|
||||
|
||||
if (winHonor ~= 0) then
|
||||
base.winReward.honorSymbol:Show();
|
||||
base.winReward.honorAmount:Show();
|
||||
base.winReward.honorAmount:SetText(winHonor);
|
||||
else
|
||||
base.winReward.honorSymbol:Hide();
|
||||
base.winReward.honorAmount:Hide();
|
||||
end
|
||||
|
||||
if (winArena ~= 0) then
|
||||
base.winReward.arenaSymbol:Show();
|
||||
base.winReward.arenaAmount:Show();
|
||||
base.winReward.arenaAmount:SetText(winArena);
|
||||
else
|
||||
base.winReward.arenaSymbol:Hide();
|
||||
base.winReward.arenaAmount:Hide();
|
||||
end
|
||||
|
||||
if (lossHonor ~= 0) then
|
||||
base.lossReward.honorSymbol:Show();
|
||||
base.lossReward.honorAmount:Show();
|
||||
base.lossReward.honorAmount:SetText(lossHonor);
|
||||
else
|
||||
base.lossReward.honorSymbol:Hide();
|
||||
base.lossReward.honorAmount:Hide();
|
||||
end
|
||||
|
||||
if (lossArena ~= 0) then
|
||||
base.lossReward.arenaSymbol:Show();
|
||||
base.lossReward.arenaAmount:Show();
|
||||
base.lossReward.arenaAmount:SetText(lossArena);
|
||||
else
|
||||
base.lossReward.arenaSymbol:Hide();
|
||||
base.lossReward.arenaAmount:Hide();
|
||||
end
|
||||
|
||||
local englishFaction = MoonWell_GetDisplayFaction();
|
||||
base.winReward.honorSymbol:SetTexture("Interface\\PVPFrame\\PVP-Currency-"..englishFaction);
|
||||
base.lossReward.honorSymbol:SetTexture("Interface\\PVPFrame\\PVP-Currency-"..englishFaction);
|
||||
end
|
||||
|
||||
function BattlefieldFrame_GetSelectedBattlegroundInfo()
|
||||
local BGname, description, groupSize, canEnter, isHoliday, isRandom = GetBattlefieldInfo();
|
||||
return BGname, canEnter, isHoliday, isRandom;
|
||||
end
|
||||
|
||||
function BattlefieldFrame_UpdateRandomInfo()
|
||||
PVPQueue_UpdateRandomInfo(BattlefieldFrameInfoScrollFrameChildFrameRewardsInfo, BattlefieldFrame_GetSelectedBattlegroundInfo);
|
||||
end
|
||||
|
||||
function BattlefieldButton_OnClick(self)
|
||||
local id = self:GetID();
|
||||
SetSelectedBattlefield(FauxScrollFrame_GetOffset(BattlefieldListScrollFrame) + id - 1);
|
||||
BattlefieldFrame_Update();
|
||||
end
|
||||
|
||||
function BattlefieldFrameJoinButton_OnClick(self)
|
||||
local GROUPJOIN_BUTTONID = 2;
|
||||
local id = self:GetID();
|
||||
if ( id == GROUPJOIN_BUTTONID ) then
|
||||
JoinBattlefield(GetSelectedBattlefield(), 1);
|
||||
else
|
||||
JoinBattlefield(GetSelectedBattlefield());
|
||||
end
|
||||
|
||||
HideUIPanel(BattlefieldFrame);
|
||||
end
|
||||
|
||||
function MiniMapBattlefieldDropDown_OnLoad()
|
||||
UIDropDownMenu_Initialize(MiniMapBattlefieldDropDown, MiniMapBattlefieldDropDown_Initialize, "MENU");
|
||||
end
|
||||
|
||||
function MiniMapBattlefieldDropDown_Initialize()
|
||||
local info;
|
||||
local status, mapName, instanceID, queueID, levelRangeMin, levelRangeMax, teamSize, registeredMatch;
|
||||
local numQueued = 0;
|
||||
local numShown = 0;
|
||||
|
||||
local shownHearthAndRes;
|
||||
|
||||
for i=1, MAX_BATTLEFIELD_QUEUES do
|
||||
status, mapName, instanceID, levelRangeMin, levelRangeMax, teamSize, registeredMatch = GetBattlefieldStatus(i);
|
||||
|
||||
-- Inserts a spacer if it's not the first option... to make it look nice.
|
||||
if ( status ~= "none" ) then
|
||||
numShown = numShown + 1;
|
||||
if ( numShown > 1 ) then
|
||||
info = UIDropDownMenu_CreateInfo();
|
||||
info.isTitle = 1;
|
||||
info.notCheckable = 1;
|
||||
UIDropDownMenu_AddButton(info);
|
||||
end
|
||||
end
|
||||
|
||||
if ( status == "queued" or status == "confirm" ) then
|
||||
numQueued = numQueued + 1;
|
||||
-- Add a spacer if there were dropdown items before this
|
||||
|
||||
info = UIDropDownMenu_CreateInfo();
|
||||
if ( teamSize ~= 0 ) then
|
||||
if ( registeredMatch ) then
|
||||
info.text = ARENA_RATED_MATCH.." "..format(PVP_TEAMSIZE, teamSize, teamSize);
|
||||
else
|
||||
info.text = ARENA_CASUAL.." "..format(PVP_TEAMSIZE, teamSize, teamSize);
|
||||
end
|
||||
else
|
||||
info.text = mapName;
|
||||
end
|
||||
info.isTitle = 1;
|
||||
info.notCheckable = 1;
|
||||
UIDropDownMenu_AddButton(info);
|
||||
|
||||
if ( CanHearthAndResurrectFromArea() and not shownHearthAndRes and GetRealZoneText() == mapName ) then
|
||||
info = UIDropDownMenu_CreateInfo();
|
||||
info.text = format(LEAVE_ZONE, GetRealZoneText());
|
||||
|
||||
info.func = HearthAndResurrectFromArea;
|
||||
info.notCheckable = 1;
|
||||
UIDropDownMenu_AddButton(info);
|
||||
shownHearthAndRes = true;
|
||||
end
|
||||
|
||||
if ( status == "queued" ) then
|
||||
|
||||
info = UIDropDownMenu_CreateInfo();
|
||||
info.text = LEAVE_QUEUE;
|
||||
info.func = function (self, ...) AcceptBattlefieldPort(...) end;
|
||||
info.arg1 = i;
|
||||
info.notCheckable = 1;
|
||||
UIDropDownMenu_AddButton(info);
|
||||
|
||||
elseif ( status == "confirm" ) then
|
||||
|
||||
info = UIDropDownMenu_CreateInfo();
|
||||
info.text = ENTER_BATTLE;
|
||||
info.func = function (self, ...) AcceptBattlefieldPort(...) end;
|
||||
info.arg1 = i;
|
||||
info.arg2 = 1;
|
||||
info.notCheckable = 1;
|
||||
UIDropDownMenu_AddButton(info);
|
||||
|
||||
if ( teamSize == 0 ) then
|
||||
info = UIDropDownMenu_CreateInfo();
|
||||
info.text = LEAVE_QUEUE;
|
||||
info.func = function (self, ...) AcceptBattlefieldPort(...) end;
|
||||
info.arg1 = i;
|
||||
info.notCheckable = 1;
|
||||
UIDropDownMenu_AddButton(info);
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
elseif ( status == "active" ) then
|
||||
|
||||
info = UIDropDownMenu_CreateInfo();
|
||||
if ( teamSize ~= 0 ) then
|
||||
info.text = mapName.." "..format(PVP_TEAMSIZE, teamSize, teamSize);
|
||||
else
|
||||
info.text = mapName;
|
||||
end
|
||||
info.isTitle = 1;
|
||||
info.notCheckable = 1;
|
||||
UIDropDownMenu_AddButton(info);
|
||||
|
||||
info = UIDropDownMenu_CreateInfo();
|
||||
if ( IsActiveBattlefieldArena() ) then
|
||||
info.text = LEAVE_ARENA;
|
||||
else
|
||||
info.text = LEAVE_BATTLEGROUND;
|
||||
end
|
||||
info.func = function (self, ...) LeaveBattlefield(...) end;
|
||||
info.notCheckable = 1;
|
||||
UIDropDownMenu_AddButton(info);
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
for i=1, MAX_WORLD_PVP_QUEUES do
|
||||
status, mapName, queueID = GetWorldPVPQueueStatus(i);
|
||||
|
||||
-- Inserts a spacer if it's not the first option... to make it look nice.
|
||||
if ( status ~= "none" ) then
|
||||
numShown = numShown + 1;
|
||||
if ( numShown > 1 ) then
|
||||
info = UIDropDownMenu_CreateInfo();
|
||||
info.isTitle = 1;
|
||||
info.notCheckable = 1;
|
||||
UIDropDownMenu_AddButton(info);
|
||||
end
|
||||
end
|
||||
|
||||
if ( status == "queued" or status == "confirm" ) then
|
||||
numQueued = numQueued + 1;
|
||||
-- Add a spacer if there were dropdown items before this
|
||||
|
||||
info = UIDropDownMenu_CreateInfo();
|
||||
info.text = mapName;
|
||||
info.isTitle = 1;
|
||||
info.notCheckable = 1;
|
||||
UIDropDownMenu_AddButton(info);
|
||||
|
||||
if ( CanHearthAndResurrectFromArea() and not shownHearthAndRes and GetRealZoneText() == mapName ) then
|
||||
info = UIDropDownMenu_CreateInfo();
|
||||
info.text = format(LEAVE_ZONE, GetRealZoneText());
|
||||
|
||||
info.func = HearthAndResurrectFromArea;
|
||||
info.notCheckable = 1;
|
||||
UIDropDownMenu_AddButton(info);
|
||||
shownHearthAndRes = true;
|
||||
end
|
||||
|
||||
if ( status == "queued" ) then
|
||||
|
||||
info = UIDropDownMenu_CreateInfo();
|
||||
info.text = LEAVE_QUEUE;
|
||||
info.func = function (self, ...) BattlefieldMgrExitRequest(...) end;
|
||||
info.arg1 = queueID;
|
||||
info.notCheckable = 1;
|
||||
UIDropDownMenu_AddButton(info);
|
||||
|
||||
elseif ( status == "confirm" ) then
|
||||
|
||||
info = UIDropDownMenu_CreateInfo();
|
||||
info.text = ENTER_BATTLE;
|
||||
info.func = function (self, ...) BattlefieldMgrEntryInviteResponse(...) end;
|
||||
info.arg1 = queueID;
|
||||
info.arg2 = 1;
|
||||
info.notCheckable = 1;
|
||||
UIDropDownMenu_AddButton(info);
|
||||
|
||||
info = UIDropDownMenu_CreateInfo();
|
||||
info.text = LEAVE_QUEUE;
|
||||
info.func = function (self, ...) BattlefieldMgrEntryInviteResponse(...) end;
|
||||
info.arg1 = i;
|
||||
info.notCheckable = 1;
|
||||
UIDropDownMenu_AddButton(info);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if ( CanHearthAndResurrectFromArea() and not shownHearthAndRes ) then
|
||||
numShown = numShown + 1;
|
||||
info = UIDropDownMenu_CreateInfo();
|
||||
info.text = GetRealZoneText();
|
||||
info.isTitle = 1;
|
||||
info.notCheckable = 1;
|
||||
UIDropDownMenu_AddButton(info);
|
||||
|
||||
info = UIDropDownMenu_CreateInfo();
|
||||
info.text = format(LEAVE_ZONE, GetRealZoneText());
|
||||
|
||||
info.func = HearthAndResurrectFromArea;
|
||||
info.notCheckable = 1;
|
||||
UIDropDownMenu_AddButton(info);
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function BattlegroundShineFadeIn()
|
||||
-- Fade in the shine and then fade it out with the ComboPointShineFadeOut function
|
||||
local fadeInfo = {};
|
||||
fadeInfo.mode = "IN";
|
||||
fadeInfo.timeToFade = 0.5;
|
||||
fadeInfo.finishedFunc = BattlegroundShineFadeOut;
|
||||
UIFrameFade(BattlegroundShine, fadeInfo);
|
||||
end
|
||||
|
||||
--hack since a frame can't have a reference to itself in it
|
||||
function BattlegroundShineFadeOut()
|
||||
UIFrameFadeOut(BattlegroundShine, 0.5);
|
||||
end
|
||||
|
||||
function IsAlreadyInQueue(mapName)
|
||||
local inQueue = nil;
|
||||
for index,value in pairs(PREVIOUS_BATTLEFIELD_QUEUES) do
|
||||
if ( value == mapName ) then
|
||||
inQueue = 1;
|
||||
end
|
||||
end
|
||||
return inQueue;
|
||||
end
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,316 @@
|
||||
-- MoonWell: returns display faction (opposite for traitors)
|
||||
local function MoonWell_GetDisplayFaction()
|
||||
local f = UnitFactionGroup("player");
|
||||
if MoonWell_IsTraitor and f then
|
||||
return f == "Alliance" and "Horde" or "Alliance";
|
||||
end
|
||||
return f;
|
||||
end
|
||||
|
||||
NUM_DISPLAYED_BATTLEGROUNDS = 5;
|
||||
|
||||
local PVPBATTLEGROUND_TEXTURELIST = {};
|
||||
PVPBATTLEGROUND_TEXTURELIST[1] = "Interface\\PVPFrame\\PvpBg-AlteracValley";
|
||||
PVPBATTLEGROUND_TEXTURELIST[2] = "Interface\\PVPFrame\\PvpBg-WarsongGulch";
|
||||
PVPBATTLEGROUND_TEXTURELIST[3] = "Interface\\PVPFrame\\PvpBg-ArathiBasin";
|
||||
PVPBATTLEGROUND_TEXTURELIST[7] = "Interface\\PVPFrame\\PvpBg-EyeOfTheStorm";
|
||||
PVPBATTLEGROUND_TEXTURELIST[9] = "Interface\\PVPFrame\\PvpBg-StrandOfTheAncients";
|
||||
PVPBATTLEGROUND_TEXTURELIST[30] = "Interface\\PVPFrame\\PvpBg-IsleOfConquest";
|
||||
PVPBATTLEGROUND_TEXTURELIST[32] = "Interface\\PVPFrame\\PvpRandomBg";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function PVPBattleground_UpdateBattlegrounds()
|
||||
local frame;
|
||||
local localizedName, canEnter, isHoliday;
|
||||
local tempString, BGindex, isBig;
|
||||
|
||||
local offset = FauxScrollFrame_GetOffset(PVPBattlegroundFrameTypeScrollFrame);
|
||||
local currentFrameNum = -offset + 1;
|
||||
local numBGs = 0;
|
||||
|
||||
for i=1,GetNumBattlegroundTypes() do
|
||||
frame = _G["BattlegroundType"..currentFrameNum];
|
||||
|
||||
localizedName, canEnter, isHoliday = GetBattlegroundInfo(i);
|
||||
tempString = localizedName;
|
||||
if ( localizedName and canEnter ) then
|
||||
if ( frame ) then
|
||||
frame.BGindex = i;
|
||||
frame.localizedName = localizedName;
|
||||
if ( not PVPBattlegroundFrame.selectedBG ) then
|
||||
PVPBattlegroundFrame.selectedBG = i;
|
||||
end
|
||||
frame:Enable();
|
||||
if ( isHoliday ) then
|
||||
tempString = tempString.." ("..BATTLEGROUND_HOLIDAY..")";
|
||||
end
|
||||
|
||||
frame.title:SetText(tempString);
|
||||
frame:Show();
|
||||
if ( i == PVPBattlegroundFrame.selectedBG ) then
|
||||
frame:LockHighlight();
|
||||
else
|
||||
frame:UnlockHighlight();
|
||||
end
|
||||
end
|
||||
currentFrameNum = currentFrameNum + 1;
|
||||
numBGs = numBGs + 1;
|
||||
end
|
||||
end
|
||||
|
||||
if ( currentFrameNum <= NUM_DISPLAYED_BATTLEGROUNDS ) then
|
||||
isBig = true; --Espand the highlight to cover where the scroll bar usually is.
|
||||
end
|
||||
|
||||
for i=1,NUM_DISPLAYED_BATTLEGROUNDS do
|
||||
frame = _G["BattlegroundType"..i];
|
||||
if ( isBig ) then
|
||||
frame:SetWidth(315);
|
||||
else
|
||||
frame:SetWidth(295);
|
||||
end
|
||||
end
|
||||
|
||||
for i=currentFrameNum,NUM_DISPLAYED_BATTLEGROUNDS do
|
||||
frame = _G["BattlegroundType"..i];
|
||||
frame:Hide();
|
||||
end
|
||||
|
||||
PVPBattleground_UpdateQueueStatus();
|
||||
|
||||
PVPBattlegroundFrame_UpdateGroupAvailable();
|
||||
FauxScrollFrame_Update(PVPBattlegroundFrameTypeScrollFrame, numBGs, NUM_DISPLAYED_BATTLEGROUNDS, 16);
|
||||
end
|
||||
|
||||
function PVPBattleground_UpdateInfo(BGindex)
|
||||
if ( type(BGindex) ~= "number" ) then
|
||||
BGindex = PVPBattlegroundFrame.selectedBG;
|
||||
end
|
||||
|
||||
local BGname, canEnter, isHoliday, isRandom, BattleGroundID = GetBattlegroundInfo(BGindex);
|
||||
|
||||
|
||||
if(PVPBATTLEGROUND_TEXTURELIST[BattleGroundID]) then
|
||||
PVPBattlegroundFrameBGTex:SetTexture(PVPBATTLEGROUND_TEXTURELIST[BattleGroundID]);
|
||||
end
|
||||
|
||||
if ( isRandom or isHoliday ) then
|
||||
PVPBattleground_UpdateRandomInfo();
|
||||
PVPBattlegroundFrameInfoScrollFrameChildFrameRewardsInfo:Show();
|
||||
PVPBattlegroundFrameInfoScrollFrameChildFrameDescription:Hide();
|
||||
else
|
||||
local mapName, mapDescription, maxGroup = GetBattlefieldInfo();
|
||||
if ( mapDescription ~= PVPBattlegroundFrameInfoScrollFrameChildFrameDescription:GetText() ) then
|
||||
PVPBattlegroundFrameInfoScrollFrameChildFrameDescription:SetText(mapDescription);
|
||||
PVPBattlegroundFrameInfoScrollFrame:SetVerticalScroll(0);
|
||||
end
|
||||
|
||||
PVPBattlegroundFrameInfoScrollFrameChildFrameRewardsInfo:Hide();
|
||||
PVPBattlegroundFrameInfoScrollFrameChildFrameDescription:Show();
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function PVPBattleground_GetSelectedBattlegroundInfo()
|
||||
return GetBattlegroundInfo(PVPBattlegroundFrame.selectedBG);
|
||||
end
|
||||
|
||||
function PVPBattleground_UpdateRandomInfo()
|
||||
PVPQueue_UpdateRandomInfo(PVPBattlegroundFrameInfoScrollFrameChildFrameRewardsInfo, PVPBattleground_GetSelectedBattlegroundInfo);
|
||||
end
|
||||
|
||||
function PVPBattleground_UpdateQueueStatus()
|
||||
local queueStatus, queueMapName, queueInstanceID, frame;
|
||||
for i=1, NUM_DISPLAYED_BATTLEGROUNDS do
|
||||
frame = _G["BattlegroundType"..i];
|
||||
frame.status:Hide();
|
||||
end
|
||||
local factionTexture = "Interface\\PVPFrame\\PVP-Currency-"..MoonWell_GetDisplayFaction();
|
||||
for i=1, MAX_BATTLEFIELD_QUEUES do
|
||||
queueStatus, queueMapName, queueInstanceID = GetBattlefieldStatus(i);
|
||||
if ( queueStatus ~= "none" ) then
|
||||
for j=1, NUM_DISPLAYED_BATTLEGROUNDS do
|
||||
local frame = _G["BattlegroundType"..j];
|
||||
if ( frame.localizedName == queueMapName ) then
|
||||
if ( queueStatus == "queued" ) then
|
||||
frame.status.texture:SetTexture(factionTexture);
|
||||
frame.status.texture:SetTexCoord(0.0, 1.0, 0.0, 1.0);
|
||||
frame.status.tooltip = BATTLEFIELD_QUEUE_STATUS;
|
||||
frame.status:Show();
|
||||
elseif ( queueStatus == "confirm" ) then
|
||||
frame.status.texture:SetTexture("Interface\\CharacterFrame\\UI-StateIcon");
|
||||
frame.status.texture:SetTexCoord(0.45, 0.95, 0.0, 0.5);
|
||||
frame.status.tooltip = BATTLEFIELD_CONFIRM_STATUS;
|
||||
frame.status:Show();
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PVPBattleground_ResetInfo()
|
||||
RequestBattlegroundInstanceInfo(PVPBattlegroundFrame.selectedBG);
|
||||
|
||||
PVPBattleground_UpdateInfo();
|
||||
end
|
||||
|
||||
function PVPBattlegroundButton_OnClick(self)
|
||||
local offset = FauxScrollFrame_GetOffset(PVPBattlegroundFrameTypeScrollFrame);
|
||||
local id = self:GetID() + offset;
|
||||
|
||||
for i=1,NUM_DISPLAYED_BATTLEGROUNDS do
|
||||
if ( id == i + offset ) then
|
||||
_G["BattlegroundType"..i]:LockHighlight();
|
||||
else
|
||||
_G["BattlegroundType"..i]:UnlockHighlight();
|
||||
end
|
||||
end
|
||||
|
||||
if ( self.BGindex == PVPBattlegroundFrame.selectedBG ) then
|
||||
return;
|
||||
end
|
||||
|
||||
PVPBattlegroundFrame.selectedBG = self.BGindex;
|
||||
|
||||
PVPBattleground_ResetInfo();
|
||||
|
||||
PVPBattleground_UpdateJoinButton();
|
||||
end
|
||||
|
||||
function PVPBattleground_UpdateJoinButton()
|
||||
local mapName, mapDescription, maxGroup = GetBattlefieldInfo();
|
||||
|
||||
if ( maxGroup and maxGroup == 5 ) then
|
||||
PVPBattlegroundFrameGroupJoinButton:SetText(JOIN_AS_PARTY);
|
||||
else
|
||||
PVPBattlegroundFrameGroupJoinButton:SetText(JOIN_AS_GROUP);
|
||||
end
|
||||
end
|
||||
|
||||
function PVPBattlegroundFrameJoinButton_OnClick(self)
|
||||
local joinAsGroup;
|
||||
if ( self == PVPBattlegroundFrameGroupJoinButton ) then
|
||||
joinAsGroup = true;
|
||||
end
|
||||
|
||||
JoinBattlefield(0, joinAsGroup);
|
||||
end
|
||||
|
||||
function PVPBattlegroundFrame_OnLoad(self)
|
||||
self:RegisterEvent("PVPQUEUE_ANYWHERE_SHOW");
|
||||
self:RegisterEvent("NPC_PVPQUEUE_ANYWHERE");
|
||||
self:RegisterEvent("UPDATE_BATTLEFIELD_STATUS");
|
||||
self:RegisterEvent("PVPQUEUE_ANYWHERE_UPDATE_AVAILABLE");
|
||||
self:RegisterEvent("PLAYER_ENTERING_WORLD");
|
||||
self:RegisterEvent("PARTY_MEMBERS_CHANGED");
|
||||
|
||||
PanelTemplates_SetTab(PVPParentFrame, 1);
|
||||
PVPBattlegroundFrame_UpdateVisible();
|
||||
|
||||
BattlegroundType1:Click();
|
||||
end
|
||||
|
||||
function PVPBattlegroundFrame_OnEvent(self, event, ...)
|
||||
if ( event == "PVPQUEUE_ANYWHERE_SHOW" or event == "NPC_PVPQUEUE_ANYWHERE") then
|
||||
self.currentData = true;
|
||||
PVPBattleground_UpdateBattlegrounds();
|
||||
if ( self.selectedBG ) then
|
||||
PVPBattleground_UpdateInfo();
|
||||
end
|
||||
if ( event == "NPC_PVPQUEUE_ANYWHERE" ) then
|
||||
ShowUIPanel(PVPParentFrame);
|
||||
PVPFrame_SetJustBG(true);
|
||||
end
|
||||
elseif ( event == "UPDATE_BATTLEFIELD_STATUS" ) then
|
||||
PVPBattleground_UpdateQueueStatus();
|
||||
elseif ( event == "PVPQUEUE_ANYWHERE_UPDATE_AVAILABLE" or event == "PLAYER_ENTERING_WORLD" ) then
|
||||
self:UnregisterEvent("PLAYER_ENTERING_WORLD");
|
||||
|
||||
FauxScrollFrame_SetOffset(PVPBattlegroundFrameTypeScrollFrame, 0);
|
||||
FauxScrollFrame_OnVerticalScroll(PVPBattlegroundFrameTypeScrollFrame, 0, 16, PVPBattleground_UpdateBattlegrounds); --We may be changing brackets, so we don't want someone to see an outdated version of the data.
|
||||
if ( self.selectedBG ) then
|
||||
PVPBattleground_ResetInfo();
|
||||
PVPBattleground_UpdateJoinButton();
|
||||
end
|
||||
PVPBattlegroundFrame_UpdateVisible();
|
||||
elseif ( event == "PARTY_MEMBERS_CHANGED" ) then
|
||||
PVPBattlegroundFrame_UpdateGroupAvailable();
|
||||
end
|
||||
end
|
||||
|
||||
function PVPBattlegroundFrame_OnShow(self)
|
||||
if ( IsInInstance() ) then
|
||||
WintergraspTimer:Hide();
|
||||
else
|
||||
WintergraspTimer:Show();
|
||||
end
|
||||
|
||||
SortBGList();
|
||||
|
||||
PVPBattleground_UpdateBattlegrounds();
|
||||
RequestBattlegroundInstanceInfo(self.selectedBG or 1);
|
||||
end
|
||||
|
||||
function PVPBattlegroundFrame_OnHide(self)
|
||||
CloseBattlefield();
|
||||
end
|
||||
|
||||
function PVPBattlegroundFrame_UpdateVisible()
|
||||
for i=1, GetNumBattlegroundTypes() do
|
||||
local _, canEnter = GetBattlegroundInfo(i);
|
||||
if ( canEnter ) then
|
||||
if ( not PVPFrame_IsJustBG() ) then
|
||||
PVPParentFrameTab1:Show();
|
||||
PVPParentFrameTab2:Show();
|
||||
end
|
||||
return;
|
||||
end
|
||||
end
|
||||
PVPParentFrameTab1:Click();
|
||||
PVPParentFrameTab1:Hide();
|
||||
PVPParentFrameTab2:Hide();
|
||||
end
|
||||
|
||||
function PVPBattlegroundFrame_UpdateGroupAvailable()
|
||||
if ( ((GetNumPartyMembers() > 0) or (GetNumRaidMembers() > 0)) and IsPartyLeader() ) then
|
||||
-- If this is true then can join as a group
|
||||
PVPBattlegroundFrameGroupJoinButton:Enable();
|
||||
else
|
||||
PVPBattlegroundFrameGroupJoinButton:Disable();
|
||||
end
|
||||
end
|
||||
|
||||
function WintergraspTimer_OnLoad(self)
|
||||
self.canQueue = false;
|
||||
self.tooltip = PVPBATTLEGROUND_WINTERGRASPTIMER_CANNOT_QUEUE;
|
||||
self.texture:SetTexCoord(0.0, 1.0, 0.0, 0.5);
|
||||
end
|
||||
|
||||
function WintergraspTimer_OnUpdate(self, elapsed)
|
||||
local nextBattleTime = GetWintergraspWaitTime();
|
||||
if ( nextBattleTime and nextBattleTime > 60 ) then
|
||||
self.text:SetFormattedText(PVPBATTLEGROUND_WINTERGRASPTIMER, SecondsToTime(nextBattleTime, true));
|
||||
elseif ( nextBattleTime and nextBattleTime > 0 ) then
|
||||
self.text:SetFormattedText(PVPBATTLEGROUND_WINTERGRASPTIMER, SecondsToTime(nextBattleTime, false));
|
||||
else
|
||||
self.text:SetFormattedText(PVPBATTLEGROUND_WINTERGRASPTIMER, WINTERGRASP_IN_PROGRESS);
|
||||
end
|
||||
|
||||
local canQueue = CanQueueForWintergrasp();
|
||||
if ( self.canQueue ~= canQueue ) then
|
||||
-- simple safeguard so we're not doing a bunch of unnecessary work for each OnUpdate
|
||||
if ( canQueue ) then
|
||||
self.tooltip = PVPBATTLEGROUND_WINTERGRASPTIMER_CAN_QUEUE;
|
||||
self.texture:SetTexCoord(0.0, 1.0, 0.5, 1.0);
|
||||
else
|
||||
self.tooltip = PVPBATTLEGROUND_WINTERGRASPTIMER_CANNOT_QUEUE;
|
||||
self.texture:SetTexCoord(0.0, 1.0, 0.0, 0.5);
|
||||
end
|
||||
self.canQueue = canQueue;
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,601 @@
|
||||
MAX_ARENA_TEAMS = 3;
|
||||
MAX_ARENA_TEAM_MEMBERS = 10;
|
||||
MAX_ARENA_TEAM_NAME_WIDTH = 310;
|
||||
|
||||
function PVPFrame_OnLoad(self)
|
||||
PVPFrameLine1:SetAlpha(0.3);
|
||||
PVPHonorKillsLabel:SetVertexColor(0.6, 0.6, 0.6);
|
||||
PVPHonorHonorLabel:SetVertexColor(0.6, 0.6, 0.6);
|
||||
PVPHonorTodayLabel:SetVertexColor(0.6, 0.6, 0.6);
|
||||
PVPHonorYesterdayLabel:SetVertexColor(0.6, 0.6, 0.6);
|
||||
PVPHonorLifetimeLabel:SetVertexColor(0.6, 0.6, 0.6);
|
||||
self:RegisterEvent("PLAYER_ENTERING_WORLD");
|
||||
self:RegisterEvent("ARENA_TEAM_UPDATE");
|
||||
self:RegisterEvent("ARENA_TEAM_ROSTER_UPDATE");
|
||||
self:RegisterEvent("PLAYER_PVP_KILLS_CHANGED");
|
||||
self:RegisterEvent("PLAYER_PVP_RANK_CHANGED");
|
||||
self:RegisterEvent("HONOR_CURRENCY_UPDATE");
|
||||
--self:RegisterEvent("ARENA_SEASON_WORLD_STATE");
|
||||
end
|
||||
|
||||
function PVPFrame_OnEvent(self, event, ...)
|
||||
local arg1 = ...;
|
||||
if ( event == "PLAYER_ENTERING_WORLD" ) then
|
||||
-- PVPFrame.season = GetCurrentArenaSeason();
|
||||
PVPFrame_Update();
|
||||
PVPHonor_Update();
|
||||
elseif ( event == "PLAYER_PVP_KILLS_CHANGED" or event == "PLAYER_PVP_RANK_CHANGED") then
|
||||
PVPHonor_Update();
|
||||
elseif ( event == "ARENA_TEAM_UPDATE" ) then
|
||||
PVPFrame_Update();
|
||||
if ( PVPTeamDetails:IsShown() ) then
|
||||
local team = GetArenaTeam(PVPTeamDetails.team);
|
||||
if ( not team ) then
|
||||
PVPTeamDetails:Hide();
|
||||
else
|
||||
PVPTeamDetails_Update(PVPTeamDetails.team); -- team games played/won are shown in the detail frame
|
||||
end
|
||||
end
|
||||
--[[ elseif ( event == "ARENA_SEASON_WORLD_STATE" ) then
|
||||
PVPFrame.season = GetCurrentArenaSeason();
|
||||
PVPFrame_Update(); ]]
|
||||
elseif ( event == "HONOR_CURRENCY_UPDATE" ) then
|
||||
PVPHonor_Update();
|
||||
elseif ( event == "ARENA_TEAM_ROSTER_UPDATE" ) then
|
||||
if ( arg1 ) then
|
||||
if ( PVPTeamDetails:IsShown() ) then
|
||||
ArenaTeamRoster(PVPTeamDetails.team);
|
||||
end
|
||||
elseif ( PVPTeamDetails.team ) then
|
||||
PVPTeamDetails_Update(PVPTeamDetails.team);
|
||||
PVPFrame_Update();
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PVPFrame_OnShow()
|
||||
PVPFrame_SetFaction();
|
||||
PVPFrame_Update();
|
||||
PVPMicroButton_SetPushed();
|
||||
UpdateMicroButtons();
|
||||
SetPortraitTexture(PVPFramePortrait, "player");
|
||||
PlaySound("igCharacterInfoOpen");
|
||||
end
|
||||
|
||||
function PVPFrame_OnHide()
|
||||
PVPTeamDetails:Hide();
|
||||
PVPFrame_SetJustBG(false);
|
||||
PVPMicroButton_SetNormal();
|
||||
UpdateMicroButtons();
|
||||
PlaySound("igCharacterInfoClose");
|
||||
end
|
||||
|
||||
function PVPFrame_SetFaction()
|
||||
local factionGroup = UnitFactionGroup("player");
|
||||
if ( factionGroup ) then
|
||||
-- MoonWell: traitors display opposite faction icon
|
||||
local displayFaction = MoonWell_IsTraitor
|
||||
and (factionGroup == "Alliance" and "Horde" or "Alliance")
|
||||
or factionGroup;
|
||||
PVPFrameHonorIcon:SetTexture("Interface\\TargetingFrame\\UI-PVP-"..displayFaction);
|
||||
PVPFrameHonorIcon:Show();
|
||||
end
|
||||
end
|
||||
|
||||
function PVPFrame_Update()
|
||||
for i=1, MAX_ARENA_TEAMS do
|
||||
GetArenaTeam(i);
|
||||
end
|
||||
PVPHonor_Update();
|
||||
PVPTeam_Update();
|
||||
|
||||
if ( GetCurrentArenaSeason() == 0 ) then --We're in an off-season.
|
||||
PVPFrame_SetToOffSeason();
|
||||
elseif ( PVPFrameOffSeason:IsShown() ) then
|
||||
PVPFrame_SetToInSeason();
|
||||
end
|
||||
end
|
||||
|
||||
function PVPTeam_Update()
|
||||
-- Display Elements
|
||||
local button, buttonName, highlight, data, standard, emblem, border;
|
||||
-- Data Elements
|
||||
local teamName, teamSize, teamRating, teamPlayed, teamWins, teamLoss, seasonTeamPlayed, seasonTeamWins, playerPlayed, seasonPlayerPlayed, playerPlayedPct, teamRank, playerRating;
|
||||
local played, wins, loss;
|
||||
local background = {};
|
||||
local borderColor = {};
|
||||
local emblemColor = {};
|
||||
local ARENA_TEAMS = {};
|
||||
ARENA_TEAMS[1] = {size = 2};
|
||||
ARENA_TEAMS[2] = {size = 3};
|
||||
ARENA_TEAMS[3] = {size = 5};
|
||||
|
||||
-- Sort teams by size
|
||||
|
||||
local count = 0;
|
||||
local buttonIndex = 0;
|
||||
for index, value in pairs(ARENA_TEAMS) do
|
||||
for i=1, MAX_ARENA_TEAMS do
|
||||
teamName, teamSize = GetArenaTeam(i);
|
||||
if ( value.size == teamSize ) then
|
||||
value.index = i;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- fill out data
|
||||
for index, value in pairs(ARENA_TEAMS) do
|
||||
buttonIndex = buttonIndex + 1;
|
||||
button = _G["PVPTeam"..buttonIndex];
|
||||
if ( value.index ) then
|
||||
-- Pull Values
|
||||
teamName, teamSize, teamRating, teamPlayed, teamWins, seasonTeamPlayed, seasonTeamWins, playerPlayed, seasonPlayerPlayed, teamRank, playerRating, background.r, background.g, background.b, emblem, emblemColor.r, emblemColor.g, emblemColor.b, border, borderColor.r, borderColor.g, borderColor.b = GetArenaTeam(value.index);
|
||||
|
||||
-- Set button elements to variables
|
||||
buttonName = "PVPTeam"..buttonIndex;
|
||||
data = buttonName.."Data";
|
||||
standard = buttonName.."Standard";
|
||||
|
||||
button:SetID(value.index);
|
||||
|
||||
|
||||
if ( PVPFrame.seasonStats ) then
|
||||
_G[data.."TypeLabel"]:SetText(ARENA_THIS_SEASON);
|
||||
PVPFrameToggleButton:SetText(ARENA_THIS_WEEK_TOGGLE);
|
||||
played = seasonTeamPlayed;
|
||||
wins = seasonTeamWins;
|
||||
playerPlayed = seasonPlayerPlayed;
|
||||
else
|
||||
_G[data.."TypeLabel"]:SetText(ARENA_THIS_WEEK);
|
||||
PVPFrameToggleButton:SetText(ARENA_THIS_SEASON_TOGGLE);
|
||||
played = teamPlayed;
|
||||
wins = teamWins;
|
||||
playerPlayed = playerPlayed;
|
||||
end
|
||||
|
||||
loss = played - wins;
|
||||
if ( played ~= 0 ) then
|
||||
playerPlayedPct = floor( ( playerPlayed / played ) * 100 );
|
||||
else
|
||||
playerPlayedPct = floor( ( playerPlayed / 1 ) * 100 );
|
||||
end
|
||||
|
||||
-- Populate Data
|
||||
_G[data.."Name"]:SetText(teamName);
|
||||
_G[data.."Rating"]:SetText(teamRating);
|
||||
_G[data.."Games"]:SetText(played);
|
||||
_G[data.."Wins"]:SetText(wins);
|
||||
_G[data.."Loss"]:SetText(loss);
|
||||
|
||||
if ( PVPFrame.seasonStats ) then
|
||||
_G[data.."Played"]:SetText(playerRating);
|
||||
_G[data.."Played"]:SetVertexColor(1.0, 1.0, 1.0);
|
||||
_G[data.."PlayedLabel"]:SetText(PVP_YOUR_RATING);
|
||||
else
|
||||
-- played %
|
||||
if ( playerPlayedPct < 10 ) then
|
||||
_G[data.."Played"]:SetVertexColor(1.0, 0, 0);
|
||||
else
|
||||
_G[data.."Played"]:SetVertexColor(1.0, 1.0, 1.0);
|
||||
end
|
||||
-- FIXME: Turn this into a localized format string
|
||||
playerPlayedPct = format("%d", playerPlayedPct);
|
||||
_G[data.."Played"]:SetText(playerPlayed.." ("..playerPlayedPct.."%)");
|
||||
_G[data.."PlayedLabel"]:SetText(PLAYED);
|
||||
end
|
||||
|
||||
|
||||
-- Set TeamSize Banner
|
||||
_G[standard.."Banner"]:SetTexture("Interface\\PVPFrame\\PVP-Banner-"..teamSize);
|
||||
_G[standard.."Banner"]:SetVertexColor(background.r, background.g, background.b);
|
||||
_G[standard.."Border"]:SetVertexColor(borderColor.r, borderColor.g, borderColor.b);
|
||||
_G[standard.."Emblem"]:SetVertexColor(emblemColor.r, emblemColor.g, emblemColor.b);
|
||||
if ( border ~= -1 ) then
|
||||
_G[standard.."Border"]:SetTexture("Interface\\PVPFrame\\PVP-Banner-"..teamSize.."-Border-"..border);
|
||||
end
|
||||
if ( emblem ~= -1 ) then
|
||||
_G[standard.."Emblem"]:SetTexture("Interface\\PVPFrame\\Icons\\PVP-Banner-Emblem-"..emblem);
|
||||
end
|
||||
|
||||
-- Set visual elements
|
||||
_G[data]:Show();
|
||||
button:SetAlpha(1);
|
||||
_G[buttonName.."Highlight"]:SetAlpha(1);
|
||||
_G[buttonName.."Highlight"]:SetBackdropBorderColor(1.0, 0.82, 0);
|
||||
_G[standard]:SetAlpha(1);
|
||||
_G[standard.."Border"]:Show();
|
||||
_G[standard.."Emblem"]:Show();
|
||||
_G[buttonName.."Background"]:SetVertexColor(0, 0, 0);
|
||||
_G[buttonName.."Background"]:SetAlpha(1);
|
||||
_G[buttonName.."TeamType"]:Hide();
|
||||
else
|
||||
-- Set button elements to variables
|
||||
buttonName = "PVPTeam"..buttonIndex;
|
||||
data = buttonName.."Data";
|
||||
|
||||
button:SetID(0);
|
||||
|
||||
-- Set standard type
|
||||
local standardBanner = _G[buttonName.."StandardBanner"];
|
||||
standardBanner:SetTexture("Interface\\PVPFrame\\PVP-Banner-"..value.size);
|
||||
standardBanner:SetVertexColor(1, 1, 1);
|
||||
|
||||
-- Hide or Show items
|
||||
button:SetAlpha(0.4);
|
||||
_G[data]:Hide();
|
||||
_G[buttonName.."Background"]:SetVertexColor(0, 0, 0);
|
||||
_G[buttonName.."Standard"]:SetAlpha(0.1);
|
||||
_G[buttonName.."StandardBorder"]:Hide();
|
||||
_G[buttonName.."StandardEmblem"]:Hide();
|
||||
_G[buttonName.."TeamType"]:SetFormattedText(PVP_TEAMSIZE, value.size, value.size);
|
||||
_G[buttonName.."TeamType"]:Show(); end
|
||||
count = count +1;
|
||||
end
|
||||
if ( count == 3 ) then
|
||||
PVPFrameToggleButton:Hide();
|
||||
else
|
||||
PVPFrameToggleButton:Show();
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function PVPTeam_OnEnter(self)
|
||||
if ( GetArenaTeam(self:GetID() ) ) then
|
||||
_G[self:GetName().."Highlight"]:Show();
|
||||
GameTooltip_AddNewbieTip(self, ARENA_TEAM, 1.0, 1.0, 1.0, CLICK_FOR_DETAILS, 1);
|
||||
else
|
||||
GameTooltip_AddNewbieTip(self, ARENA_TEAM, 1.0, 1.0, 1.0, ARENA_TEAM_LEAD_IN, 1);
|
||||
end
|
||||
end
|
||||
|
||||
function PVPTeam_OnLeave(self)
|
||||
_G[self:GetName().."Highlight"]:Hide();
|
||||
GameTooltip:Hide();
|
||||
end
|
||||
|
||||
function PVPTeamDetails_OnShow()
|
||||
PlaySound("igSpellBookOpen");
|
||||
end
|
||||
|
||||
function PVPTeamDetails_OnHide()
|
||||
CloseArenaTeamRoster();
|
||||
PlaySound("igSpellBookClose");
|
||||
end
|
||||
|
||||
function PVPTeamDetails_Update(id)
|
||||
local numMembers = GetNumArenaTeamMembers(id, 1);
|
||||
local name, rank, level, class, online, played, win, loss, seasonPlayed, seasonWin, seasonLoss, rating;
|
||||
local teamName, teamSize, teamRating, teamPlayed, teamWins, seasonTeamPlayed, seasonTeamWins, playerPlayed, seasonPlayerPlayed, teamRank, personalRating = GetArenaTeam(id);
|
||||
local button;
|
||||
local teamIndex;
|
||||
|
||||
-- Display General Team Stats
|
||||
PVPTeamDetailsName:SetText(teamName);
|
||||
PVPTeamDetailsSize:SetFormattedText(PVP_TEAMSIZE, teamSize, teamSize);
|
||||
PVPTeamDetailsRank:SetText(teamRank);
|
||||
PVPTeamDetailsRating:SetText(teamRating);
|
||||
|
||||
-- Tidy up team name display if it's too long - mostly for CN
|
||||
PVPTeamDetailsName:SetWidth(0);
|
||||
if ( PVPTeamDetailsName:GetWidth() > MAX_ARENA_TEAM_NAME_WIDTH ) then
|
||||
PVPTeamDetailsName:SetWidth(MAX_ARENA_TEAM_NAME_WIDTH);
|
||||
end
|
||||
|
||||
-- Display General Team Data
|
||||
if ( PVPTeamDetails.season ) then
|
||||
PVPTeamDetailsFrameColumnHeader3.sortType = "seasonplayed";
|
||||
PVPTeamDetailsFrameColumnHeader4.sortType = "seasonwon";
|
||||
PVPTeamDetailsGames:SetText(seasonTeamPlayed);
|
||||
PVPTeamDetailsWins:SetText(seasonTeamWins);
|
||||
PVPTeamDetailsLoss:SetText(seasonTeamPlayed - seasonTeamWins);
|
||||
PVPTeamDetailsStatsType:SetText(strupper(ARENA_THIS_SEASON));
|
||||
PVPTeamDetailsToggleButton:SetText(ARENA_THIS_WEEK_TOGGLE);
|
||||
else
|
||||
PVPTeamDetailsFrameColumnHeader3.sortType = "played";
|
||||
PVPTeamDetailsFrameColumnHeader4.sortType = "won";
|
||||
PVPTeamDetailsGames:SetText(teamPlayed);
|
||||
PVPTeamDetailsWins:SetText(teamWins);
|
||||
PVPTeamDetailsLoss:SetText(teamPlayed - teamWins);
|
||||
PVPTeamDetailsStatsType:SetText(strupper(ARENA_THIS_WEEK));
|
||||
PVPTeamDetailsToggleButton:SetText(ARENA_THIS_SEASON_TOGGLE);
|
||||
end
|
||||
|
||||
local nameText, classText, playedText, winLossWin, winLossLoss, ratingText;
|
||||
local nameButton, classButton, playedButton, winLossButton;
|
||||
-- Display Team Member Specific Info
|
||||
local playedValue, winValue, lossValue, playedPct;
|
||||
for i=1, MAX_ARENA_TEAM_MEMBERS, 1 do
|
||||
button = _G["PVPTeamDetailsButton"..i];
|
||||
if ( i > numMembers ) then
|
||||
button:Hide();
|
||||
else
|
||||
|
||||
button.teamIndex = i;
|
||||
-- Get Data
|
||||
name, rank, level, class, online, played, win, seasonPlayed, seasonWin, rating = GetArenaTeamRosterInfo(id, i);
|
||||
loss = played - win;
|
||||
seasonLoss = seasonPlayed - seasonWin;
|
||||
if ( class ) then
|
||||
button.tooltip = LEVEL.." "..level.." "..class;
|
||||
else
|
||||
button.tooltip = LEVEL.." "..level;
|
||||
end
|
||||
|
||||
-- Populate Data into the display, season or this week
|
||||
if ( PVPTeamDetails.season ) then
|
||||
playedValue = seasonPlayed;
|
||||
winValue = seasonWin;
|
||||
lossValue = seasonLoss;
|
||||
teamPlayed = seasonTeamPlayed;
|
||||
else
|
||||
playedValue = played;
|
||||
winValue = win;
|
||||
lossValue = loss;
|
||||
teamPlayed = teamPlayed;
|
||||
end
|
||||
|
||||
if ( teamPlayed ~= 0 ) then
|
||||
playedPct = floor( ( playedValue / teamPlayed ) * 100 );
|
||||
else
|
||||
playedPct = floor( (playedValue / 1 ) * 100 );
|
||||
end
|
||||
|
||||
if ( playedPct < 10 ) then
|
||||
_G["PVPTeamDetailsButton"..i.."PlayedText"]:SetVertexColor(1.0, 0, 0);
|
||||
else
|
||||
_G["PVPTeamDetailsButton"..i.."PlayedText"]:SetVertexColor(1.0, 1.0, 1.0);
|
||||
end
|
||||
|
||||
playedPct = format("%d", playedPct);
|
||||
|
||||
_G["PVPTeamDetailsButton"..i.."Played"].tooltip = playedPct.."%";
|
||||
|
||||
nameText = _G["PVPTeamDetailsButton"..i.."NameText"];
|
||||
classText = _G["PVPTeamDetailsButton"..i.."ClassText"];
|
||||
playedText = _G["PVPTeamDetailsButton"..i.."PlayedText"]
|
||||
winLossWin = _G["PVPTeamDetailsButton"..i.."WinLossWin"];
|
||||
winLossLoss = _G["PVPTeamDetailsButton"..i.."WinLossLoss"];
|
||||
ratingText = _G["PVPTeamDetailsButton"..i.."RatingText"];
|
||||
|
||||
--- Not needed after Arena Season 3 change.
|
||||
nameButton = _G["PVPTeamDetailsButton"..i.."Name"];
|
||||
classButton = _G["PVPTeamDetailsButton"..i.."Class"];
|
||||
playedButton = _G["PVPTeamDetailsButton"..i.."Played"]
|
||||
winLossButton = _G["PVPTeamDetailsButton"..i.."WinLoss"];
|
||||
|
||||
nameText:SetText(name);
|
||||
classText:SetText(class);
|
||||
playedText:SetText(playedValue);
|
||||
winLossWin:SetText(winValue)
|
||||
winLossLoss:SetText(lossValue);
|
||||
ratingText:SetText(rating);
|
||||
|
||||
-- Color Entries based on Online status
|
||||
local r, g, b;
|
||||
if ( online ) then
|
||||
if ( rank > 0 ) then
|
||||
r = 1.0;
|
||||
g = 1.0;
|
||||
b = 1.0;
|
||||
else
|
||||
r = 1.0;
|
||||
g = 0.82;
|
||||
b = 0.0;
|
||||
end
|
||||
else
|
||||
r = 0.5;
|
||||
g = 0.5;
|
||||
b = 0.5;
|
||||
end
|
||||
|
||||
nameText:SetTextColor(r, g, b);
|
||||
classText:SetTextColor(r, g, b);
|
||||
playedText:SetTextColor(r, g, b);
|
||||
winLossWin:SetTextColor(r, g, b);
|
||||
_G["PVPTeamDetailsButton"..i.."WinLoss-"]:SetTextColor(r, g, b);
|
||||
winLossLoss:SetTextColor(r, g, b);
|
||||
ratingText:SetTextColor(r, g, b);
|
||||
|
||||
button:Show();
|
||||
|
||||
-- Highlight the correct who
|
||||
if ( GetArenaTeamRosterSelection(id) == i ) then
|
||||
button:LockHighlight();
|
||||
else
|
||||
button:UnlockHighlight();
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
function PVPTeamDetailsToggleButton_OnClick()
|
||||
if ( PVPTeamDetails.season ) then
|
||||
PVPTeamDetails.season = nil;
|
||||
else
|
||||
PVPTeamDetails.season = 1;
|
||||
end
|
||||
PVPTeamDetails_Update(PVPTeamDetails.team);
|
||||
end
|
||||
|
||||
function PVPFrameToggleButton_OnClick()
|
||||
if ( PVPFrame.seasonStats ) then
|
||||
PVPFrame.seasonStats = nil;
|
||||
else
|
||||
PVPFrame.seasonStats = 1;
|
||||
end
|
||||
PVPTeam_Update();
|
||||
end
|
||||
|
||||
|
||||
function PVPTeamDetailsButton_OnClick(self, button)
|
||||
if ( button == "LeftButton" ) then
|
||||
PVPTeamDetails.previousSelectedTeamMember = PVPTeamDetails.selectedTeamMember;
|
||||
PVPTeamDetails.selectedTeamMember = self.teamIndex;
|
||||
SetArenaTeamRosterSelection(PVPTeamDetails.team, PVPTeamDetails.selectedTeamMember);
|
||||
PVPTeamDetails_Update(PVPTeamDetails.team);
|
||||
else
|
||||
local name, rank, level, class, online = GetArenaTeamRosterInfo(PVPTeamDetails.team, self.teamIndex);
|
||||
PVPFrame_ShowDropdown(name, online);
|
||||
end
|
||||
end
|
||||
|
||||
function PVPDropDown_Initialize()
|
||||
UnitPopup_ShowMenu(UIDROPDOWNMENU_OPEN_MENU, "TEAM", nil, PVPDropDown.name);
|
||||
end
|
||||
|
||||
function PVPFrame_ShowDropdown(name, online)
|
||||
HideDropDownMenu(1);
|
||||
|
||||
if ( not IsArenaTeamCaptain(PVPTeamDetails.team) ) then
|
||||
if ( online ) then
|
||||
PVPDropDown.initialize = PVPDropDown_Initialize;
|
||||
PVPDropDown.displayMode = "MENU";
|
||||
PVPDropDown.name = name;
|
||||
PVPDropDown.online = online;
|
||||
ToggleDropDownMenu(1, nil, PVPDropDown, "cursor");
|
||||
end
|
||||
else
|
||||
PVPDropDown.initialize = PVPDropDown_Initialize;
|
||||
PVPDropDown.displayMode = "MENU";
|
||||
PVPDropDown.name = name;
|
||||
PVPDropDown.online = online;
|
||||
ToggleDropDownMenu(1, nil, PVPDropDown, "cursor");
|
||||
end
|
||||
end
|
||||
|
||||
function PVPStandard_OnLoad(self)
|
||||
self:SetAlpha(0.1);
|
||||
end
|
||||
|
||||
function PVPTeam_OnClick(self)
|
||||
local id = self:GetID();
|
||||
|
||||
local teamName, teamSize = GetArenaTeam(id);
|
||||
if ( not teamName ) then
|
||||
return;
|
||||
else
|
||||
if ( PVPTeamDetails:IsShown() and id == PVPTeamDetails.team ) then
|
||||
PVPTeamDetails:Hide();
|
||||
else
|
||||
PVPTeamDetails.team = id;
|
||||
ArenaTeamRoster(id);
|
||||
PVPTeamDetails_Update(id);
|
||||
PVPTeamDetails:Show();
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PVPTeam_OnMouseDown(self)
|
||||
if ( GetArenaTeam(self:GetID()) and (not self.isDown) ) then
|
||||
self.isDown = true;
|
||||
local point, relativeTo, relativePoint, offsetX, offsetY = self:GetPoint();
|
||||
self:SetPoint(point, relativeTo, relativePoint, offsetX-2, offsetY-2);
|
||||
end
|
||||
end
|
||||
function PVPTeam_OnMouseUp(self)
|
||||
--Note that this function is also called OnShow. Make sure it always checks if it was previously down.
|
||||
if ( GetArenaTeam(self:GetID()) and (self.isDown) ) then
|
||||
self.isDown = false;
|
||||
local point, relativeTo, relativePoint, offsetX, offsetY = self:GetPoint();
|
||||
self:SetPoint(point, relativeTo, relativePoint, offsetX+2, offsetY+2);
|
||||
end
|
||||
end
|
||||
|
||||
-- PVP Honor Data
|
||||
function PVPHonor_Update()
|
||||
local hk, cp, dk, contribution, rank, highestRank, rankName, rankNumber;
|
||||
|
||||
-- Yesterday's values
|
||||
hk, contribution = GetPVPYesterdayStats();
|
||||
PVPHonorYesterdayKills:SetText(hk);
|
||||
PVPHonorYesterdayHonor:SetText(contribution);
|
||||
|
||||
-- Lifetime values
|
||||
hk, contribution = GetPVPLifetimeStats();
|
||||
PVPHonorLifetimeKills:SetText(hk);
|
||||
PVPFrameHonorPoints:SetText(GetHonorCurrency());
|
||||
PVPFrameArenaPoints:SetText(GetArenaCurrency())
|
||||
|
||||
-- Today's values
|
||||
hk, cp = GetPVPSessionStats();
|
||||
PVPHonorTodayKills:SetText(hk);
|
||||
PVPHonorTodayHonor:SetText(cp);
|
||||
PVPHonorTodayHonor:SetHeight(14);
|
||||
end
|
||||
|
||||
function PVPMicroButton_SetPushed()
|
||||
PVPMicroButtonTexture:SetPoint("TOP", PVPMicroButton, "TOP", 5, -31);
|
||||
PVPMicroButtonTexture:SetAlpha(0.5);
|
||||
end
|
||||
|
||||
function PVPMicroButton_SetNormal()
|
||||
PVPMicroButtonTexture:SetPoint("TOP", PVPMicroButton, "TOP", 6, -30);
|
||||
PVPMicroButtonTexture:SetAlpha(1.0);
|
||||
end
|
||||
|
||||
function PVPFrame_SetToOffSeason()
|
||||
PVPTeam1:Hide();
|
||||
PVPTeam1Standard:Hide();
|
||||
PVPTeam2:Hide();
|
||||
PVPTeam2Standard:Hide();
|
||||
PVPTeam3:Hide();
|
||||
PVPTeam3Standard:Hide();
|
||||
|
||||
PVPFrameBlackFilter:Show();
|
||||
|
||||
PVPFrameOffSeason:Show();
|
||||
|
||||
local previousArenaSeason = GetPreviousArenaSeason();
|
||||
PVPFrameOffSeasonText:SetText(format(ARENA_OFF_SEASON_TEXT, previousArenaSeason, previousArenaSeason+1));
|
||||
end
|
||||
|
||||
function PVPFrame_SetToInSeason()
|
||||
PVPTeam1:Show();
|
||||
PVPTeam1Standard:Show();
|
||||
PVPTeam2:Show();
|
||||
PVPTeam2Standard:Show();
|
||||
PVPTeam3:Show();
|
||||
PVPTeam3Standard:Show();
|
||||
|
||||
PVPFrameBlackFilter:Hide();
|
||||
|
||||
PVPFrameOffSeason:Hide();
|
||||
end
|
||||
|
||||
function TogglePVPFrame()
|
||||
if ( PVPFrame_IsJustBG() ) then
|
||||
PVPFrame_SetJustBG(false);
|
||||
else
|
||||
if ( UnitLevel("player") >= SHOW_PVP_LEVEL ) then
|
||||
ToggleFrame(PVPParentFrame);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PVPFrame_IsJustBG()
|
||||
return PVPParentFrame.justBG;
|
||||
end
|
||||
|
||||
function PVPFrame_SetJustBG(justBG)
|
||||
local pvpParentFrame = PVPParentFrame;
|
||||
if ( justBG ) then
|
||||
pvpParentFrame.justBG = true;
|
||||
pvpParentFrame.savedSelectedTab = PanelTemplates_GetSelectedTab(pvpParentFrame);
|
||||
PVPParentFrameTab2:Click();
|
||||
PVPParentFrameTab1:Hide();
|
||||
PVPParentFrameTab2:Hide();
|
||||
UpdateMicroButtons();
|
||||
else
|
||||
pvpParentFrame.justBG = false;
|
||||
if ( pvpParentFrame.savedSelectedTab ) then
|
||||
_G["PVPParentFrameTab"..pvpParentFrame.savedSelectedTab]:Click();
|
||||
pvpParentFrame.savedSelectedTab = nil;
|
||||
end
|
||||
CloseBattlefield();
|
||||
PVPBattlegroundFrame_UpdateVisible();
|
||||
UpdateMicroButtons();
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,688 @@
|
||||
REQUIRED_REST_HOURS = 5;
|
||||
|
||||
function PlayerFrame_OnLoad(self)
|
||||
UnitFrame_Initialize(self, "player", PlayerName, PlayerPortrait,
|
||||
PlayerFrameHealthBar, PlayerFrameHealthBarText,
|
||||
PlayerFrameManaBar, PlayerFrameManaBarText,
|
||||
PlayerFrameFlash);
|
||||
|
||||
self.statusCounter = 0;
|
||||
self.statusSign = -1;
|
||||
CombatFeedback_Initialize(self, PlayerHitIndicator, 30);
|
||||
PlayerFrame_Update();
|
||||
self:RegisterEvent("UNIT_LEVEL");
|
||||
self:RegisterEvent("UNIT_COMBAT");
|
||||
self:RegisterEvent("UNIT_FACTION");
|
||||
self:RegisterEvent("UNIT_MAXMANA");
|
||||
self:RegisterEvent("PLAYER_ENTERING_WORLD");
|
||||
self:RegisterEvent("PLAYER_ENTER_COMBAT");
|
||||
self:RegisterEvent("PLAYER_LEAVE_COMBAT");
|
||||
self:RegisterEvent("PLAYER_REGEN_DISABLED");
|
||||
self:RegisterEvent("PLAYER_REGEN_ENABLED");
|
||||
self:RegisterEvent("PLAYER_UPDATE_RESTING");
|
||||
self:RegisterEvent("PARTY_MEMBERS_CHANGED");
|
||||
self:RegisterEvent("PARTY_LEADER_CHANGED");
|
||||
self:RegisterEvent("PARTY_LOOT_METHOD_CHANGED");
|
||||
self:RegisterEvent("VOICE_START");
|
||||
self:RegisterEvent("VOICE_STOP");
|
||||
self:RegisterEvent("RAID_ROSTER_UPDATE");
|
||||
self:RegisterEvent("READY_CHECK");
|
||||
self:RegisterEvent("READY_CHECK_CONFIRM");
|
||||
self:RegisterEvent("READY_CHECK_FINISHED");
|
||||
self:RegisterEvent("UNIT_ENTERED_VEHICLE");
|
||||
self:RegisterEvent("UNIT_ENTERING_VEHICLE");
|
||||
self:RegisterEvent("UNIT_EXITING_VEHICLE");
|
||||
self:RegisterEvent("UNIT_EXITED_VEHICLE");
|
||||
self:RegisterEvent("PLAYER_FLAGS_CHANGED");
|
||||
self:RegisterEvent("PLAYER_ROLES_ASSIGNED");
|
||||
|
||||
-- Chinese playtime stuff
|
||||
self:RegisterEvent("PLAYTIME_CHANGED");
|
||||
|
||||
PlayerAttackBackground:SetVertexColor(0.8, 0.1, 0.1);
|
||||
PlayerAttackBackground:SetAlpha(0.4);
|
||||
|
||||
local showmenu = function()
|
||||
ToggleDropDownMenu(1, nil, PlayerFrameDropDown, "PlayerFrame", 106, 27);
|
||||
end
|
||||
SecureUnitButton_OnLoad(self, "player", showmenu);
|
||||
end
|
||||
|
||||
function PlayerFrame_Update ()
|
||||
if ( UnitExists("player") ) then
|
||||
PlayerLevelText:SetText(UnitLevel(PlayerFrame.unit));
|
||||
PlayerFrame_UpdatePartyLeader();
|
||||
PlayerFrame_UpdatePvPStatus();
|
||||
PlayerFrame_UpdateStatus();
|
||||
PlayerFrame_UpdatePlaytime();
|
||||
PlayerFrame_UpdateLayout();
|
||||
end
|
||||
end
|
||||
|
||||
function PlayerFrame_UpdatePartyLeader()
|
||||
if ( IsPartyLeader() ) then
|
||||
if ( HasLFGRestrictions() ) then
|
||||
PlayerGuideIcon:Show();
|
||||
PlayerLeaderIcon:Hide();
|
||||
else
|
||||
PlayerLeaderIcon:Show()
|
||||
PlayerGuideIcon:Hide();
|
||||
end
|
||||
else
|
||||
PlayerLeaderIcon:Hide();
|
||||
PlayerGuideIcon:Hide();
|
||||
end
|
||||
|
||||
local lootMethod;
|
||||
local lootMaster;
|
||||
lootMethod, lootMaster = GetLootMethod();
|
||||
if ( lootMaster == 0 and ((GetNumPartyMembers() > 0) or (GetNumRaidMembers() > 0)) ) then
|
||||
PlayerMasterIcon:Show();
|
||||
else
|
||||
PlayerMasterIcon:Hide();
|
||||
end
|
||||
end
|
||||
|
||||
function PlayerFrame_UpdatePvPStatus()
|
||||
local factionGroup, factionName = UnitFactionGroup("player");
|
||||
if ( UnitIsPVPFreeForAll("player") ) then
|
||||
if ( not PlayerPVPIcon:IsShown() ) then
|
||||
PlaySound("igPVPUpdate");
|
||||
end
|
||||
PlayerPVPIcon:SetTexture("Interface\\TargetingFrame\\UI-PVP-FFA");
|
||||
PlayerPVPIcon:Show();
|
||||
|
||||
-- Setup newbie tooltip
|
||||
PlayerPVPIconHitArea.tooltipTitle = PVPFFA;
|
||||
PlayerPVPIconHitArea.tooltipText = NEWBIE_TOOLTIP_PVPFFA;
|
||||
PlayerPVPIconHitArea:Show();
|
||||
|
||||
PlayerPVPTimerText:Hide();
|
||||
PlayerPVPTimerText.timeLeft = nil;
|
||||
elseif ( factionGroup and UnitIsPVP("player") ) then
|
||||
if ( not PlayerPVPIcon:IsShown() ) then
|
||||
PlaySound("igPVPUpdate");
|
||||
end
|
||||
-- MoonWell: traitors display the opposite faction icon
|
||||
local displayFaction = factionGroup;
|
||||
if ( MoonWell_IsTraitor ) then
|
||||
displayFaction = (factionGroup == "Alliance") and "Horde" or "Alliance";
|
||||
end
|
||||
PlayerPVPIcon:SetTexture("Interface\\TargetingFrame\\UI-PVP-"..displayFaction);
|
||||
PlayerPVPIcon:Show();
|
||||
|
||||
-- Setup newbie tooltip
|
||||
PlayerPVPIconHitArea.tooltipTitle = factionName;
|
||||
PlayerPVPIconHitArea.tooltipText = _G["NEWBIE_TOOLTIP_"..strupper(factionGroup)];
|
||||
PlayerPVPIconHitArea:Show();
|
||||
else
|
||||
PlayerPVPIcon:Hide();
|
||||
PlayerPVPIconHitArea:Hide();
|
||||
PlayerPVPTimerText:Hide();
|
||||
PlayerPVPTimerText.timeLeft = nil;
|
||||
end
|
||||
end
|
||||
|
||||
function PlayerFrame_OnEvent(self, event, ...)
|
||||
UnitFrame_OnEvent(self, event, ...);
|
||||
|
||||
local arg1, arg2, arg3, arg4, arg5 = ...;
|
||||
if ( event == "UNIT_LEVEL" ) then
|
||||
if ( arg1 == "player" ) then
|
||||
PlayerLevelText:SetText(UnitLevel(self.unit));
|
||||
end
|
||||
elseif ( event == "UNIT_COMBAT" ) then
|
||||
if ( arg1 == self.unit ) then
|
||||
CombatFeedback_OnCombatEvent(self, arg2, arg3, arg4, arg5);
|
||||
end
|
||||
elseif ( event == "UNIT_FACTION" ) then
|
||||
if ( arg1 == "player" ) then
|
||||
PlayerFrame_UpdatePvPStatus();
|
||||
end
|
||||
elseif ( event == "PLAYER_ENTERING_WORLD" ) then
|
||||
PlayerFrame_ToPlayerArt(self);
|
||||
-- if ( UnitHasVehicleUI("player") ) then
|
||||
-- UnitFrame_SetUnit(self, "vehicle", PlayerFrameHealthBar, PlayerFrameManaBar);
|
||||
-- else
|
||||
-- UnitFrame_SetUnit(self, "player", PlayerFrameHealthBar, PlayerFrameManaBar);
|
||||
-- end
|
||||
self.inCombat = nil;
|
||||
self.onHateList = nil;
|
||||
PlayerFrame_Update();
|
||||
PlayerFrame_UpdateStatus();
|
||||
PlayerFrame_UpdateRolesAssigned();
|
||||
PlayerSpeakerFrame:Show();
|
||||
PlayerFrame_UpdateVoiceStatus(UnitIsTalking(UnitName("player")));
|
||||
|
||||
if ( IsPVPTimerRunning() ) then
|
||||
PlayerPVPTimerText:Show();
|
||||
PlayerPVPTimerText.timeLeft = GetPVPTimer();
|
||||
else
|
||||
PlayerPVPTimerText:Hide();
|
||||
PlayerPVPTimerText.timeLeft = nil;
|
||||
end
|
||||
elseif ( event == "PLAYER_ENTER_COMBAT" ) then
|
||||
self.inCombat = 1;
|
||||
PlayerFrame_UpdateStatus();
|
||||
elseif ( event == "PLAYER_LEAVE_COMBAT" ) then
|
||||
self.inCombat = nil;
|
||||
PlayerFrame_UpdateStatus();
|
||||
elseif ( event == "PLAYER_REGEN_DISABLED" ) then
|
||||
self.onHateList = 1;
|
||||
PlayerFrame_UpdateStatus();
|
||||
|
||||
if ( GetCVarBool("screenEdgeFlash") ) then
|
||||
CombatFeedback_StartFullscreenStatus();
|
||||
end
|
||||
elseif ( event == "PLAYER_REGEN_ENABLED" ) then
|
||||
self.onHateList = nil;
|
||||
PlayerFrame_UpdateStatus();
|
||||
|
||||
CombatFeedback_StopFullscreenStatus();
|
||||
elseif ( event == "PLAYER_UPDATE_RESTING" ) then
|
||||
PlayerFrame_UpdateStatus();
|
||||
elseif ( event == "PARTY_MEMBERS_CHANGED" or event == "PARTY_LEADER_CHANGED" or event == "RAID_ROSTER_UPDATE" ) then
|
||||
PlayerFrame_UpdateGroupIndicator();
|
||||
PlayerFrame_UpdatePartyLeader();
|
||||
PlayerFrame_UpdateReadyCheck();
|
||||
elseif ( event == "PARTY_LOOT_METHOD_CHANGED" ) then
|
||||
local lootMethod;
|
||||
local lootMaster;
|
||||
lootMethod, lootMaster = GetLootMethod();
|
||||
if ( lootMaster == 0 and ((GetNumPartyMembers() > 0) or (GetNumRaidMembers() > 0)) ) then
|
||||
PlayerMasterIcon:Show();
|
||||
else
|
||||
PlayerMasterIcon:Hide();
|
||||
end
|
||||
elseif ( event == "VOICE_START") then
|
||||
if ( arg1 == "player" ) then
|
||||
PlayerFrame_UpdateVoiceStatus(true);
|
||||
end
|
||||
elseif ( event == "VOICE_STOP" ) then
|
||||
if ( arg1 == "player" ) then
|
||||
PlayerFrame_UpdateVoiceStatus(false);
|
||||
end
|
||||
elseif ( event == "PLAYTIME_CHANGED" ) then
|
||||
PlayerFrame_UpdatePlaytime();
|
||||
elseif ( event == "READY_CHECK" or event == "READY_CHECK_CONFIRM" ) then
|
||||
PlayerFrame_UpdateReadyCheck();
|
||||
elseif ( event == "READY_CHECK_FINISHED" ) then
|
||||
ReadyCheck_Finish(PlayerFrameReadyCheck);
|
||||
elseif ( event == "UNIT_RUNIC_POWER" and arg1 == "player" ) then
|
||||
PlayerFrame_SetRunicPower(UnitPower("player"));
|
||||
elseif ( event == "UNIT_ENTERING_VEHICLE" ) then
|
||||
if ( arg1 == "player" ) then
|
||||
if ( arg2 ) then
|
||||
PlayerFrame_AnimateOut(self);
|
||||
else
|
||||
if ( PlayerFrame.state == "vehicle" ) then
|
||||
PlayerFrame_AnimateOut(self);
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif ( event == "UNIT_ENTERED_VEHICLE" ) then
|
||||
if ( arg1 == "player" ) then
|
||||
self.inSeat = true;
|
||||
PlayerFrame_UpdateArt(self);
|
||||
end
|
||||
elseif ( event == "UNIT_EXITING_VEHICLE" ) then
|
||||
if ( arg1 == "player" ) then
|
||||
if ( self.state == "vehicle" ) then
|
||||
PlayerFrame_AnimateOut(self);
|
||||
end
|
||||
end
|
||||
elseif ( event == "UNIT_EXITED_VEHICLE" ) then
|
||||
if ( arg1 == "player" ) then
|
||||
self.inSeat = true;
|
||||
PlayerFrame_UpdateArt(self);
|
||||
end
|
||||
elseif ( event == "PLAYER_FLAGS_CHANGED" ) then
|
||||
if ( IsPVPTimerRunning() ) then
|
||||
PlayerPVPTimerText:Show();
|
||||
PlayerPVPTimerText.timeLeft = GetPVPTimer();
|
||||
else
|
||||
PlayerPVPTimerText:Hide();
|
||||
PlayerPVPTimerText.timeLeft = nil;
|
||||
end
|
||||
elseif ( event == "PLAYER_ROLES_ASSIGNED" ) then
|
||||
PlayerFrame_UpdateRolesAssigned();
|
||||
end
|
||||
end
|
||||
|
||||
function PlayerFrame_UpdateRolesAssigned()
|
||||
local frame = PlayerFrame;
|
||||
local icon = _G[frame:GetName().."RoleIcon"];
|
||||
local isTank, isHealer, isDamage = UnitGroupRolesAssigned("player");
|
||||
|
||||
if ( isTank ) then
|
||||
icon:SetTexCoord(0, 19/64, 22/64, 41/64);
|
||||
icon:Show();
|
||||
elseif ( isHealer ) then
|
||||
icon:SetTexCoord(20/64, 39/64, 1/64, 20/64);
|
||||
icon:Show();
|
||||
elseif ( isDamage ) then
|
||||
icon:SetTexCoord(20/64, 39/64, 22/64, 41/64);
|
||||
icon:Show();
|
||||
else
|
||||
icon:Hide();
|
||||
end
|
||||
end
|
||||
|
||||
local function PlayerFrame_AnimPos(self, fraction)
|
||||
return "TOPLEFT", UIParent, "TOPLEFT", -19, fraction*140-4;
|
||||
end
|
||||
|
||||
local PlayerFrameAnimTable = {
|
||||
totalTime = 0.3,
|
||||
updateFunc = "SetPoint",
|
||||
getPosFunc = PlayerFrame_AnimPos,
|
||||
}
|
||||
function PlayerFrame_AnimateOut(self)
|
||||
self.inSeat = false;
|
||||
self.animFinished = false;
|
||||
self.inSequence = true;
|
||||
SetUpAnimation(PlayerFrame, PlayerFrameAnimTable, PlayerFrame_AnimFinished, false)
|
||||
end
|
||||
|
||||
function PlayerFrame_AnimFinished(self)
|
||||
self.animFinished = true;
|
||||
PlayerFrame_UpdateArt(self);
|
||||
end
|
||||
|
||||
function PlayerFrame_UpdateArt(self)
|
||||
if ( self.animFinished and self.inSeat and self.inSequence) then
|
||||
SetUpAnimation(PlayerFrame, PlayerFrameAnimTable, PlayerFrame_SequenceFinished, true)
|
||||
if ( UnitHasVehicleUI("player") ) then
|
||||
PlayerFrame_ToVehicleArt(self, UnitVehicleSkin("player"));
|
||||
else
|
||||
PlayerFrame_ToPlayerArt(self);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PlayerFrame_SequenceFinished(self)
|
||||
self.inSequence = false;
|
||||
PetFrame_Update(PetFrame);
|
||||
end
|
||||
|
||||
function PlayerFrame_ToVehicleArt(self, vehicleType)
|
||||
--Swap frame
|
||||
|
||||
PlayerFrame.state = "vehicle";
|
||||
|
||||
UnitFrame_SetUnit(self, "vehicle", PlayerFrameHealthBar, PlayerFrameManaBar);
|
||||
UnitFrame_SetUnit(PetFrame, "player", PetFrameHealthBar, PetFrameManaBar);
|
||||
PetFrame_Update(PetFrame);
|
||||
PlayerFrame_Update();
|
||||
BuffFrame_Update();
|
||||
ComboFrame_Update();
|
||||
|
||||
PlayerFrameTexture:Hide();
|
||||
if ( vehicleType == "Natural" ) then
|
||||
PlayerFrameVehicleTexture:SetTexture("Interface\\Vehicles\\UI-Vehicle-Frame-Organic");
|
||||
PlayerFrameHealthBar:SetWidth(103);
|
||||
PlayerFrameHealthBar:SetPoint("TOPLEFT",116,-41);
|
||||
PlayerFrameManaBar:SetWidth(103);
|
||||
PlayerFrameManaBar:SetPoint("TOPLEFT",116,-52);
|
||||
else
|
||||
PlayerFrameVehicleTexture:SetTexture("Interface\\Vehicles\\UI-Vehicle-Frame");
|
||||
PlayerFrameHealthBar:SetWidth(100);
|
||||
PlayerFrameHealthBar:SetPoint("TOPLEFT",119,-41);
|
||||
PlayerFrameManaBar:SetWidth(100);
|
||||
PlayerFrameManaBar:SetPoint("TOPLEFT",119,-52);
|
||||
end
|
||||
PlayerFrameVehicleTexture:Show();
|
||||
|
||||
PlayerName:SetPoint("CENTER",50,23);
|
||||
PlayerLeaderIcon:SetPoint("TOPLEFT",40,-12);
|
||||
PlayerMasterIcon:SetPoint("TOPLEFT",86,0);
|
||||
PlayerFrameGroupIndicator:SetPoint("BOTTOMLEFT", PlayerFrame, "TOPLEFT", 97, -13);
|
||||
|
||||
PlayerFrameBackground:SetWidth(114);
|
||||
PlayerLevelText:Hide();
|
||||
end
|
||||
|
||||
function PlayerFrame_ToPlayerArt(self)
|
||||
--Unswap frame
|
||||
|
||||
PlayerFrame.state = "player";
|
||||
|
||||
UnitFrame_SetUnit(self, "player", PlayerFrameHealthBar, PlayerFrameManaBar);
|
||||
UnitFrame_SetUnit(PetFrame, "pet", PetFrameHealthBar, PetFrameManaBar);
|
||||
PetFrame_Update(PetFrame);
|
||||
PlayerFrame_Update();
|
||||
BuffFrame_Update();
|
||||
ComboFrame_Update();
|
||||
|
||||
PlayerFrameTexture:Show();
|
||||
PlayerFrameVehicleTexture:Hide();
|
||||
PlayerName:SetPoint("CENTER",50,19);
|
||||
PlayerLeaderIcon:SetPoint("TOPLEFT",40,-12);
|
||||
PlayerMasterIcon:SetPoint("TOPLEFT",80,-10);
|
||||
PlayerFrameGroupIndicator:SetPoint("BOTTOMLEFT", PlayerFrame, "TOPLEFT", 97, -20);
|
||||
PlayerFrameHealthBar:SetWidth(119);
|
||||
PlayerFrameHealthBar:SetPoint("TOPLEFT",106,-41);
|
||||
PlayerFrameManaBar:SetWidth(119);
|
||||
PlayerFrameManaBar:SetPoint("TOPLEFT",106,-52);
|
||||
PlayerFrameBackground:SetWidth(119);
|
||||
PlayerLevelText:Show();
|
||||
end
|
||||
|
||||
function PlayerFrame_UpdateVoiceStatus (status)
|
||||
if ( status ) then
|
||||
UIFrameFadeIn(PlayerSpeakerFrame, 0.2, PlayerSpeakerFrame:GetAlpha(), 1);
|
||||
VoiceChat_Animate(PlayerSpeakerFrame, 1);
|
||||
else
|
||||
UIFrameFadeOut(PlayerSpeakerFrame, 0.2, PlayerSpeakerFrame:GetAlpha(), 0);
|
||||
VoiceChat_Animate(PlayerSpeakerFrame, nil);
|
||||
end
|
||||
end
|
||||
|
||||
function PlayerFrame_UpdateReadyCheck ()
|
||||
local readyCheckStatus = GetReadyCheckStatus("player");
|
||||
if ( readyCheckStatus ) then
|
||||
if ( readyCheckStatus == "ready" ) then
|
||||
ReadyCheck_Confirm(PlayerFrameReadyCheck, 1);
|
||||
elseif ( readyCheckStatus == "notready" ) then
|
||||
ReadyCheck_Confirm(PlayerFrameReadyCheck, 0);
|
||||
else -- "waiting"
|
||||
ReadyCheck_Start(PlayerFrameReadyCheck);
|
||||
end
|
||||
else
|
||||
PlayerFrameReadyCheck:Hide();
|
||||
end
|
||||
end
|
||||
|
||||
function PlayerFrame_OnUpdate (self, elapsed)
|
||||
if ( PlayerStatusTexture:IsShown() ) then
|
||||
local alpha = 255;
|
||||
local counter = self.statusCounter + elapsed;
|
||||
local sign = self.statusSign;
|
||||
|
||||
if ( counter > 0.5 ) then
|
||||
sign = -sign;
|
||||
self.statusSign = sign;
|
||||
end
|
||||
counter = mod(counter, 0.5);
|
||||
self.statusCounter = counter;
|
||||
|
||||
if ( sign == 1 ) then
|
||||
alpha = (55 + (counter * 400)) / 255;
|
||||
else
|
||||
alpha = (255 - (counter * 400)) / 255;
|
||||
end
|
||||
PlayerStatusTexture:SetAlpha(alpha);
|
||||
PlayerStatusGlow:SetAlpha(alpha);
|
||||
end
|
||||
|
||||
if ( PlayerPVPTimerText.timeLeft ) then
|
||||
PlayerPVPTimerText.timeLeft = PlayerPVPTimerText.timeLeft - elapsed*1000;
|
||||
local timeLeft = PlayerPVPTimerText.timeLeft;
|
||||
if ( timeLeft < 0 ) then
|
||||
PlayerPVPTimerText:Hide()
|
||||
end
|
||||
PlayerPVPTimerText:SetFormattedText(SecondsToTimeAbbrev(floor(timeLeft/1000)));
|
||||
else
|
||||
PlayerPVPTimerText:Hide();
|
||||
end
|
||||
CombatFeedback_OnUpdate(self, elapsed);
|
||||
end
|
||||
|
||||
function PlayerFrame_OnReceiveDrag ()
|
||||
if ( CursorHasItem() ) then
|
||||
AutoEquipCursorItem();
|
||||
end
|
||||
end
|
||||
|
||||
function PlayerFrame_UpdateStatus()
|
||||
if ( UnitHasVehicleUI("player") ) then
|
||||
PlayerStatusTexture:Hide()
|
||||
PlayerRestIcon:Hide()
|
||||
PlayerAttackIcon:Hide()
|
||||
PlayerRestGlow:Hide()
|
||||
PlayerAttackGlow:Hide()
|
||||
PlayerStatusGlow:Hide()
|
||||
PlayerAttackBackground:Hide()
|
||||
elseif ( IsResting() ) then
|
||||
PlayerStatusTexture:SetVertexColor(1.0, 0.88, 0.25, 1.0);
|
||||
PlayerStatusTexture:Show();
|
||||
PlayerRestIcon:Show();
|
||||
PlayerAttackIcon:Hide();
|
||||
PlayerRestGlow:Show();
|
||||
PlayerAttackGlow:Hide();
|
||||
PlayerStatusGlow:Show();
|
||||
PlayerAttackBackground:Hide();
|
||||
elseif ( PlayerFrame.inCombat ) then
|
||||
PlayerStatusTexture:SetVertexColor(1.0, 0.0, 0.0, 1.0);
|
||||
PlayerStatusTexture:Show();
|
||||
PlayerAttackIcon:Show();
|
||||
PlayerRestIcon:Hide();
|
||||
PlayerAttackGlow:Show();
|
||||
PlayerRestGlow:Hide();
|
||||
PlayerStatusGlow:Show();
|
||||
PlayerAttackBackground:Show();
|
||||
elseif ( PlayerFrame.onHateList ) then
|
||||
PlayerAttackIcon:Show();
|
||||
PlayerRestIcon:Hide();
|
||||
PlayerStatusGlow:Hide();
|
||||
PlayerAttackBackground:Hide();
|
||||
else
|
||||
PlayerStatusTexture:Hide();
|
||||
PlayerRestIcon:Hide();
|
||||
PlayerAttackIcon:Hide();
|
||||
PlayerStatusGlow:Hide();
|
||||
PlayerAttackBackground:Hide();
|
||||
end
|
||||
end
|
||||
|
||||
function PlayerFrame_UpdateGroupIndicator()
|
||||
PlayerFrameGroupIndicator:Hide();
|
||||
local name, rank, subgroup;
|
||||
if ( GetNumRaidMembers() == 0 ) then
|
||||
PlayerFrameGroupIndicator:Hide();
|
||||
return;
|
||||
end
|
||||
local numRaidMembers = GetNumRaidMembers();
|
||||
for i=1, MAX_RAID_MEMBERS do
|
||||
if ( i <= numRaidMembers ) then
|
||||
name, rank, subgroup = GetRaidRosterInfo(i);
|
||||
-- Set the player's group number indicator
|
||||
if ( name == UnitName("player") ) then
|
||||
PlayerFrameGroupIndicatorText:SetText(GROUP.." "..subgroup);
|
||||
PlayerFrameGroupIndicator:SetWidth(PlayerFrameGroupIndicatorText:GetWidth()+40);
|
||||
PlayerFrameGroupIndicator:Show();
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PlayerFrameDropDown_OnLoad (self)
|
||||
UIDropDownMenu_Initialize(self, PlayerFrameDropDown_Initialize, "MENU");
|
||||
end
|
||||
|
||||
function PlayerFrameDropDown_Initialize ()
|
||||
if ( PlayerFrame.unit == "vehicle" ) then
|
||||
UnitPopup_ShowMenu(PlayerFrameDropDown, "VEHICLE", "vehicle");
|
||||
else
|
||||
UnitPopup_ShowMenu(PlayerFrameDropDown, "SELF", "player");
|
||||
end
|
||||
end
|
||||
|
||||
function PlayerFrame_UpdatePlaytime()
|
||||
if ( PartialPlayTime() ) then
|
||||
PlayerPlayTimeIcon:SetTexture("Interface\\CharacterFrame\\UI-Player-PlayTimeTired");
|
||||
PlayerPlayTime.tooltip = format(PLAYTIME_TIRED, REQUIRED_REST_HOURS - floor(GetBillingTimeRested()/60));
|
||||
PlayerPlayTime:Show();
|
||||
elseif ( NoPlayTime() ) then
|
||||
PlayerPlayTimeIcon:SetTexture("Interface\\CharacterFrame\\UI-Player-PlayTimeUnhealthy");
|
||||
PlayerPlayTime.tooltip = format(PLAYTIME_UNHEALTHY, REQUIRED_REST_HOURS - floor(GetBillingTimeRested()/60));
|
||||
PlayerPlayTime:Show();
|
||||
else
|
||||
PlayerPlayTime:Hide();
|
||||
end
|
||||
end
|
||||
|
||||
function PlayerFrame_SetupDeathKnniggetLayout ()
|
||||
PlayerFrame:SetHitRectInsets(0,0,0,35);
|
||||
|
||||
--[[ PlayerFrame:SetPoint("TOPLEFT", -11, -8);
|
||||
PlayerFrame:RegisterEvent("UNIT_RUNIC_POWER");
|
||||
PlayerPortrait:SetDrawLayer("BACKGROUND");
|
||||
PlayerFrameTexture:ClearAllPoints();
|
||||
PlayerFrameTexture:SetTexture("Interface\\PlayerFrame\\UI-PlayerFrame-Deathknight");
|
||||
PlayerFrameTexture:SetPoint("TOPLEFT", 15, 15);
|
||||
PlayerFrameTexture:SetTexCoord(0, 1, 0, 1)
|
||||
PlayerFrameTexture:SetHeight(128);
|
||||
PlayerFrameTexture:SetWidth(256)
|
||||
|
||||
PlayerFrame:CreateTexture("PlayerFrameBackgroundTexture", "BACKGROUND");
|
||||
PlayerFrameBackgroundTexture:SetTexture("Interface\\PlayerFrame\\UI-PlayerFrame-DeathKnight-Background");
|
||||
PlayerFrameBackgroundTexture:SetPoint("TOPLEFT", 15, 15);
|
||||
PlayerFrameBackgroundTexture:SetWidth(256);
|
||||
PlayerFrameBackgroundTexture:SetHeight(128);
|
||||
PlayerFrameBackgroundTexture:SetDrawLayer("BORDER");
|
||||
PlayerFrameBackground:SetDrawLayer("ARTWORK");
|
||||
PlayerFrameBackground:SetHeight(4);
|
||||
PlayerFrameBackground:SetWidth(4);
|
||||
PlayerFrameBackground:SetPoint("TOPLEFT", 108, -24);
|
||||
|
||||
PlayerName:SetPoint("CENTER", 50, 18);
|
||||
PlayerFrameHealthBar:SetPoint("TOPLEFT", PlayerFrame, "TOPLEFT", 113, -41);
|
||||
PlayerFrameHealthBar:SetWidth(112);
|
||||
PlayerFrameHealthBarText:SetPoint("CENTER", 53, 3);
|
||||
|
||||
-- Death Knight Specific Border Frame
|
||||
PlayerFrame:CreateTexture("PlayerFrameRunicPowerOverlay", "OVERLAY");
|
||||
PlayerFrameRunicPowerOverlay:SetPoint("TOPLEFT", 15, 15);
|
||||
PlayerFrameRunicPowerOverlay:SetWidth(256);
|
||||
PlayerFrameRunicPowerOverlay:SetHeight(128);
|
||||
PlayerFrameRunicPowerOverlay:SetTexture("Interface\\PlayerFrame\\UI-PlayerFrame-DeathKnight-GoldBorder");
|
||||
|
||||
-- Death Knight Runic Power Glow
|
||||
local frame = CreateFrame("Frame");
|
||||
frame:SetPoint("TOPLEFT", PlayerFrame);
|
||||
frame:SetPoint("BOTTOMRIGHT", PlayerFrame);
|
||||
|
||||
frame:CreateTexture("PlayerFrameRunicPowerGlow", "BORDER");
|
||||
PlayerFrameRunicPowerGlow:SetPoint("TOPLEFT", 15, 15);
|
||||
PlayerFrameRunicPowerGlow:SetPoint("BOTTOMRIGHT", PlayerFrameBackgroundTexture);
|
||||
PlayerFrameRunicPowerGlow:SetAlpha(0.050);
|
||||
PlayerFrameRunicPowerGlow:SetWidth(256);
|
||||
PlayerFrameRunicPowerGlow:SetHeight(128);
|
||||
PlayerFrameRunicPowerGlow:Hide();
|
||||
PlayerFrameRunicPowerGlow:SetTexture("Interface\\PlayerFrame\\UI-PlayerFrame-DeathKnight-Sword-Glow");
|
||||
|
||||
--Hoorah for hacks!
|
||||
PlayerFrameManaBar:UnregisterAllEvents();
|
||||
PlayerFrameManaBar:Hide();
|
||||
PlayerFrameManaBar:ClearAllPoints();
|
||||
PlayerFrameManaBar:SetPoint("TOPLEFT", UIParent, "BOTTOMRIGHT");
|
||||
PlayerFrameManaBarText:SetParent(PlayerFrameManaBar);
|
||||
|
||||
local runicPowerBar = PlayerFrame:CreateTexture("$parentRunicPowerBar", "ARTWORK");
|
||||
-- Mmmm, runic Power Bars, my favorite kind. Tastes like Death Knnigget.
|
||||
runicPowerBar:SetTexture("Interface\\PlayerFrame\\UI-PlayerFrame-DeathKnight-RunicPower");
|
||||
runicPowerBar:SetPoint("BOTTOMLEFT", "$parent", "BOTTOMLEFT", 70, 24);
|
||||
runicPowerBar:SetWidth(64);
|
||||
runicPowerBar:SetHeight(63);
|
||||
|
||||
PlayerFrame_SetRunicPower(UnitPower("player"));--]]
|
||||
end
|
||||
|
||||
CustomClassLayouts = {
|
||||
["DEATHKNIGHT"] = PlayerFrame_SetupDeathKnniggetLayout,
|
||||
}
|
||||
|
||||
local layoutUpdated = false;
|
||||
|
||||
function PlayerFrame_UpdateLayout ()
|
||||
if ( layoutUpdated ) then
|
||||
return;
|
||||
end
|
||||
layoutUpdated = true;
|
||||
|
||||
local _, class = UnitClass("player");
|
||||
|
||||
if ( CustomClassLayouts[class] ) then
|
||||
CustomClassLayouts[class]();
|
||||
end
|
||||
end
|
||||
|
||||
local RUNICPOWERBARHEIGHT = 63;
|
||||
local RUNICPOWERBARWIDTH = 64;
|
||||
|
||||
local RUNICGLOW_FADEALPHA = .050
|
||||
local RUNICGLOW_MINALPHA = .40
|
||||
local RUNICGLOW_MAXALPHA = .80
|
||||
local RUNICGLOW_THROBINTERVAL = .8;
|
||||
|
||||
RUNICGLOW_FINISHTHROBANDHIDE = false;
|
||||
local RUNICGLOW_THROBSTART = 0;
|
||||
|
||||
function PlayerFrame_SetRunicPower (runicPower)
|
||||
PlayerFrameRunicPowerBar:SetHeight(RUNICPOWERBARHEIGHT * (runicPower / 100));
|
||||
PlayerFrameRunicPowerBar:SetTexCoord(0, 1, (1 - (runicPower / 100)), 1);
|
||||
|
||||
if ( runicPower >= 90 ) then
|
||||
-- Oh, God help us for these function and variable names.
|
||||
RUNICGLOW_FINISHTHROBANDHIDE = false;
|
||||
if ( not PlayerFrameRunicPowerGlow:IsShown() ) then
|
||||
PlayerFrameRunicPowerGlow:Show();
|
||||
end
|
||||
PlayerFrameRunicPowerGlow:GetParent():SetScript("OnUpdate", DeathKnniggetThrobFunction);
|
||||
elseif ( PlayerFrameRunicPowerGlow:GetParent():GetScript("OnUpdate") ) then
|
||||
RUNICGLOW_FINISHTHROBANDHIDE = true;
|
||||
else
|
||||
PlayerFrameRunicPowerGlow:Hide();
|
||||
end
|
||||
end
|
||||
|
||||
local firstFadeIn = true;
|
||||
function DeathKnniggetThrobFunction (self, elapsed)
|
||||
if ( RUNICGLOW_THROBSTART == 0 ) then
|
||||
RUNICGLOW_THROBSTART = GetTime();
|
||||
elseif ( not RUNICGLOW_FINISHTHROBANDHIDE ) then
|
||||
local interval = RUNICGLOW_THROBINTERVAL - math.abs( .9 - (UnitPower("player") / 100));
|
||||
local animTime = GetTime() - RUNICGLOW_THROBSTART;
|
||||
if ( animTime >= interval ) then
|
||||
-- Fading out
|
||||
PlayerFrameRunicPowerGlow:SetAlpha(math.max(RUNICGLOW_MINALPHA, math.min(RUNICGLOW_MAXALPHA, RUNICGLOW_MAXALPHA * interval/animTime)));
|
||||
if ( animTime >= interval * 2 ) then
|
||||
self.timeSinceThrob = 0;
|
||||
RUNICGLOW_THROBSTART = GetTime();
|
||||
end
|
||||
firstFadeIn = false;
|
||||
else
|
||||
-- Fading in
|
||||
if ( firstFadeIn ) then
|
||||
PlayerFrameRunicPowerGlow:SetAlpha(math.max(RUNICGLOW_FADEALPHA, math.min(RUNICGLOW_MAXALPHA, RUNICGLOW_MAXALPHA * animTime/interval)));
|
||||
else
|
||||
PlayerFrameRunicPowerGlow:SetAlpha(math.max(RUNICGLOW_MINALPHA, math.min(RUNICGLOW_MAXALPHA, RUNICGLOW_MAXALPHA * animTime/interval)));
|
||||
end
|
||||
end
|
||||
elseif ( RUNICGLOW_FINISHTHROBANDHIDE ) then
|
||||
local currentAlpha = PlayerFrameRunicPowerGlow:GetAlpha();
|
||||
local animTime = GetTime() - RUNICGLOW_THROBSTART;
|
||||
local interval = RUNICGLOW_THROBINTERVAL;
|
||||
firstFadeIn = true;
|
||||
|
||||
if ( animTime >= interval ) then
|
||||
-- Already fading out, just keep fading out.
|
||||
local alpha = math.min(PlayerFrameRunicPowerGlow:GetAlpha(), RUNICGLOW_MAXALPHA * (interval/(animTime*(animTime/2))));
|
||||
|
||||
PlayerFrameRunicPowerGlow:SetAlpha(alpha);
|
||||
if ( alpha <= RUNICGLOW_FADEALPHA ) then
|
||||
self.timeSinceThrob = 0;
|
||||
RUNICGLOW_THROBSTART = 0;
|
||||
PlayerFrameRunicPowerGlow:Hide();
|
||||
self:SetScript("OnUpdate", nil);
|
||||
RUNICGLOW_FINISHTHROBANDHIDE = false;
|
||||
return;
|
||||
end
|
||||
else
|
||||
-- Was fading in, start fading out
|
||||
animTime = interval;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -7,6 +7,9 @@ MAX_ADDONS_DISPLAYED = 19;
|
||||
-- Addons hidden from the list (players cannot see or disable them)
|
||||
local MOONWELL_HIDDEN_ADDONS = {
|
||||
["AIO"] = true,
|
||||
["DragonUI"] = true,
|
||||
["DragonUI_Options"] = true,
|
||||
["MoonWellClient"] = true,
|
||||
};
|
||||
|
||||
local function AddonList_IsHidden(name)
|
||||
|
||||
Reference in New Issue
Block a user