Files
pfUI/modules/easteregg.lua
shikulja 239bd77799 env: complete localization and sync translation keys with code
Finish the localization pass on pfUI: every key the addon uses as T["..."] is
now present in all translations_*.lua files, keys that are no longer used,
along with duplicates, have been removed, and strings that were still hardcoded
in the UI are wrapped in T[...] and added to the key list.

Summary:
* added 178 keys that were missing from enUS (and therefore from every locale);
  values are nil — structure only, no translations;
* localized 59 previously hardcoded strings (raid marker settings, language
  dropdown, dropdown labels, chat messages, innervate announcements, battleground
  mover, distance/rate/memory formats, all Easter eggs and the first-run profile
  buttons); Unknown and Legacy reuse existing keys;
* removed 46 dead keys (45 in enUS/deDE + 1 in zhCN only) — none of them is
  referenced anywhere in the code;
* removed 6 duplicates in enUS and deDE; deDE translations from the duplicate
  lines were moved to the main key lines, so nothing was lost;
* result: 1146 unique keys in each of the 8 files — exactly the number of keys
  used by the code (1599 T["..."] lookups, all literal).

Stats: +2117 key lines, -307 lines (295 dead + 12 duplicates); translated
string count 3889 -> 3774 (the decrease comes only from translations of the
removed dead keys); T["..."] lookups in code 1525 -> 1599 (+74), distinct keys
1087 -> 1146 (+59).

Behavior is unchanged: only labels are translated. Dropdown values keep their
identifiers ("1:...", "0:..."), profile buttons still call
LoadProfile("Modern"/"Nostalgia"/"Legacy"/"Slim"), and the FPS dropdown
suffixes are now one format key, `(%d FPS)`.

Verified:
* parity 1146/1146 in all 8 files: 0 missing, 0 extra, 0 duplicates;
* 0 T["..."] keys without an enUS entry; there are no dynamic T[var] lookups
  in the code (1599 of 1599 lookups are literals);
* relative order of the existing keys is unchanged (lost = 0, reordered = 0);
* no live translation was changed or lost; the translation-file diff is
  additive only (exactly 59 inserted lines per file, 0 modified lines);
* UTF-8 without BOM, CRLF, files end with "}";
* edited Lua files pass a string/comment-aware bracket-balance check
  (no Lua interpreter was available for a full parse);
* the remaining unwrapped literals are symbols and identifiers only
  (`+`, `-`, `?`, `X:`, `Y:`, color codes, frame/skin names).

<details>
<summary>Per-file stats</summary>

| File | Keys now | Lines now | Key lines added | Dead removed | Duplicates removed | Translated strings before -> after |
| --- | ---: | ---: | ---: | ---: | ---: | ---: |
| `translations_enUS.lua` | 1146 | 1150 | 237 | 45 | 6 | 0 -> 0 |
| `translations_deDE.lua` | 1146 | 1150 | 270 | 45 | 6 | 26 -> 20 |
| `translations_esES.lua` | 1146 | 1148 | 280 | 34 | 0 | 750 -> 733 |
| `translations_frFR.lua` | 1146 | 1148 | 210 | 34 | 0 | 765 -> 748 |
| `translations_koKR.lua` | 1146 | 1148 | 280 | 34 | 0 | 272 -> 268 |
| `translations_ruRU.lua` | 1146 | 1148 | 280 | 34 | 0 | 781 -> 752 |
| `translations_zhCN.lua` | 1146 | 1148 | 280 | 35 | 0 | 849 -> 816 |
| `translations_zhTW.lua` | 1146 | 1148 | 280 | 34 | 0 | 446 -> 437 |
| **Total** | 1146 each | 9188 | **2117** | **295** | **12** | **3889 -> 3774** |

The differing number of additions per locale is because `deDE` already had 11
of the keys from the throttling section and `frFR` already had 27 of the 178,
and because `deDE`/`zhCN` carried one or more locale-only entries.

</details>

<details>
<summary>Newly localized strings (59 keys)</summary>

| Module | Count | Keys |
| --- | ---: | --- |
| `modules/gui.lua` — Raid Marker section | 17 | `Mark Tracking`, `Raid Marker Width`, `Raid Marker Height`, `Raid Marker Grow`, `Raid Marker Texture`, `Raid Marker Font Size`, `Show Name`, `Show Percent HP`, `Show Portrait`, `Star Color`, `Circle Color`, `Diamond Color`, `Triangle Color`, `Moon Color`, `Square Color`, `Cross Color`, `Skull Color` |
| `modules/gui.lua` — dropdown labels | 14 | `English`, `Spanish`, `French`, `Korean`, `Russian`, `Chinese (Simplified)`, `Chinese (Traditional)`, `Original Blizzard`, `pfUI Design`, `Separate Bar`, `Overlay`, `Auto`, `Row-first (1,2,3 / 4,5,6)`, `Column-first (1,3,5 / 2,4,6)` |
| `modules/gui.lua` — messages, FPS suffix | 3 | `Please enable the Hoverbind module to use this feature.`, `Please enable the Share module to use your config.`, `(%d FPS)` |
| `modules/firstrun.lua` | 4 | `Couldn't apply settings. Chat module is disabled.`, `Modern`, `Nostalgia`, `Slim` (`Legacy` reuses an existing key) |
| `modules/easteregg.lua` | 10 | `\|cff33ffccShagu\|cffffffff wishes you a`, `\|cff444444<Click> or '/afk' to exit`, `happy valentine's day!`, `happy hallow's end!`, `merry christmas!`, `happy new year!`, `Another year with \|cff33ffccpf\|rUI has passed.\nThanks for continuing to use it!`, `You are now \|cff33ffcc%s\|r (AFK).`, `You are now \|cff33ffcc%s\|r (AFK): %s`, `You are no longer \|cff33ffcc%s\|r (AFK).\n…merry christmas…` |
| `modules/innervatecall.lua` | 2 | `>> Innervate is ready <<`, `>> Innervate cast on %s <<` (`Unknown` reuses an existing key) |
| `modules/bgscore.lua` | 2 | `\|cff3399ffAlliance: 123\|r  \|  \|cffff4444Horde: 456\|r`, `BG Score` |
| `modules/radar.lua`, `modules/xpbar.lua`, `modules/panel.lua` | 6 | `%.1f yd`, `/ min`, `(%.0f KB) %s`, `(%.2f MB) %s`, `AddOn Memory: %.0f KB`, `AddOn Memory: %.2f MB` |
| `api/ui-widgets.lua` | 1 | `Are you sure?` |

Notes:
* `(%d FPS)` replaces 12 hardcoded suffixes (`" (2 FPS)"` … `" (50 FPS)"`) in the
  two throttling dropdowns.
* The `X:` / `Y:` axis labels in `modules/unlock.lua` were deliberately left
  alone (universal axis notation).
* `RESTORE_SET_NAME = "pfUI Auto-Restore"` in `modules/equipmentmanager.lua` is a
  persisted comparison identifier and is not translatable.
* The ClassicAPI dependency-gate messages in `API_Check.lua` are not localized:
  that file runs before the pfUI environment exists, so `T` is not available.
* GM menu, debug/diagnostics output (`superwow.lua`, `unitxp.lua`), addon proper
  names, CVars, format strings and skin/frame identifiers stay untranslated.

</details>

<details>
<summary>Added keys — modules/gui.lua (101)</summary>

| # | Key |
| ---: | --- |
| 1 | `1 Decimal (2.1)` |
| 2 | `2 Decimals (2.14)` |
| 3 | `Abbreviate 1 Decimal (4.2k)` |
| 4 | `Abbreviate 2 Decimals (4.25k)` |
| 5 | `Abbreviate Numbers` |
| 6 | `Always Show Equipment Slot Flyouts` |
| 7 | `Announce Automatic Set Switches In Chat` |
| 8 | `Auto Sort When Opening Bags` |
| 9 | `Automatic Set Switching` * |
| 10 | `Castbar Timer Decimals` |
| 11 | `Character` |
| 12 | `ClassicAPI (UnitInRange)` |
| 13 | `Disable Friendly Nameplates In Friendly Zones` |
| 14 | `Disable Hostile Nameplates In Friendly Zones` |
| 15 | `Display Raid Group Label` |
| 16 | `Druid Mana Bar Spacing` |
| 17 | `Druid Mana Bar Texture` |
| 18 | `Druid Mana Bar Width (-1 = auto)` |
| 19 | `Druid Mana Bar X-Offset` |
| 20 | `Druid Mana Bar Y-Offset` |
| 21 | `Druid Settings` |
| 22 | `Enable Automatic Set Switching` * |
| 23 | `Enable OS Notifications` |
| 24 | `Enable Player Levels` |
| 25 | `Energy/Mana Ticks` |
| 26 | `Equipment Manager` |
| 27 | `Fill Order` |
| 28 | `Five Second Rule Color` |
| 29 | `Five Second Rule Height` |
| 30 | `Five Second Rule Style` |
| 31 | `Full Numbers (4250)` |
| 32 | `Group Label X-Offset` |
| 33 | `Group Label Y-Offset` |
| 34 | `Hide yd characters` |
| 35 | `Hook Distance to Portrait Frame` |
| 36 | `Include Bank Items` |
| 37 | `Inventory` |
| 38 | `Items` |
| 39 | `Items Not In Any Set` * |
| 40 | `Layout Uneven Orientation` |
| 41 | `Mainhand Bar Color` |
| 42 | `Merge Tradeskill Casts` |
| 43 | `Minimap Player Arrow Scale` |
| 44 | `Minimum Item Quality` |
| 45 | `Name Text Position` |
| 46 | `Nampower Settings` |
| 47 | `Note: Only works when Cursor Align is NOT 'Native'` |
| 48 | `Offhand Bar Color` |
| 49 | `Only Show Your Debuffs` |
| 50 | `Pixel Perfect UI-Scale: %s (Overrides UI-Scale)` |
| 51 | `PvP Flag Position` |
| 52 | `PVP Flag Size` |
| 53 | `PvP Flag X-Offset` |
| 54 | `PvP Flag Y-Offset` |
| 55 | `Raid Mark Icon Style` |
| 56 | `Range Check Mode` |
| 57 | `Ranged Bar Color` |
| 58 | `Ranged Warn Color (Hunter)` |
| 59 | `Reactive Indicator Size` |
| 60 | `Reverse Sort Direction (Last Bag First)` |
| 61 | `Reverse Sort Priority (Hearthstone Last)` |
| 62 | `Show Attack Speed` |
| 63 | `Show Aura Caster` |
| 64 | `Show Behind Indicator` |
| 65 | `Show Debuffs on Friendly` |
| 66 | `Show Debuffs on Hostile` |
| 67 | `Show Distance of Target` |
| 68 | `Show Durability` |
| 69 | `Show Faction Icons` |
| 70 | `Show Five Second Rule` |
| 71 | `Show Line of Sight Indicator` |
| 72 | `Show MH/OH Labels` |
| 73 | `Show Movement Speed` |
| 74 | `Show Offhand Bar` |
| 75 | `Show On Next Attack Queue Color` |
| 76 | `Show Only Own Debuffs` |
| 77 | `Show Race Icons` |
| 78 | `Show Ranged Bar` |
| 79 | `Show Reactive Spell Indicator` |
| 80 | `Show Reputation Remaining` |
| 81 | `Show Spell IDs` |
| 82 | `Show Spell Queue Indicator` |
| 83 | `Show Timestamps In Chat Copy` |
| 84 | `Show Unit Buffs` |
| 85 | `Show Unit IDs` |
| 86 | `Spell Queue Icon Size` |
| 87 | `Spells` |
| 88 | `Swing Timer` |
| 89 | `Swing Timer Font Size` |
| 90 | `Swing Timer Height` |
| 91 | `Swing Timer Texture` |
| 92 | `Swing Timer Width` |
| 93 | `Target Indicator Font Size` |
| 94 | `Target Indicators` |
| 95 | `Track Group on Minimap` |
| 96 | `Uninterruptible Color` |
| 97 | `Units` |
| 98 | `UnitXP (Precise)` |
| 99 | `UnitXP Range Threshold (yards)` |
| 100 | `UnitXP Settings` |
| 101 | `Use UI-Scale` |

\* also used in `modules/equipmentmanager.lua`.

</details>

<details>
<summary>Added keys — modules/equipmentmanager.lua (66)</summary>

| # | Key |
| ---: | --- |
| 1 | `%d items, %d ignored` |
| 2 | `Add the current zone` |
| 3 | `Any Form` |
| 4 | `Aquatic Form` |
| 5 | `Automatic Set Switching` * |
| 6 | `Battle Stance` |
| 7 | `Battleground` |
| 8 | `Bear Form` |
| 9 | `Berserker Stance` |
| 10 | `Cat Form` |
| 11 | `Condition met, but a trigger higher in the list wins` |
| 12 | `Create an equipment set first.` |
| 13 | `Currently active` |
| 14 | `Defensive Stance` |
| 15 | `Do Nothing` |
| 16 | `Dungeon` |
| 17 | `Eating / Drinking` |
| 18 | `Enable Automatic Set Switching` * |
| 19 | `Equip` |
| 20 | `Equip sets automatically when mounted, swimming, eating, in a zone, at a given time and more.` |
| 21 | `Equippable items in your bags, bank and paperdoll that no equipment set uses.` |
| 22 | `Equipping %s` |
| 23 | `Equipping %s (%s)` |
| 24 | `Every equippable item is part of a set.` |
| 25 | `Ghost Wolf` |
| 26 | `Here` |
| 27 | `Ignored (Right-Click to unignore)` |
| 28 | `In Bags` |
| 29 | `In Bank` |
| 30 | `Instance Type` |
| 31 | `Items Not In Any Set` * |
| 32 | `Local time window, e.g. 20:00-23:00` |
| 33 | `Moonkin Form` |
| 34 | `Mounted` |
| 35 | `New Trigger` |
| 36 | `No Form (Caster)` |
| 37 | `No set selected` |
| 38 | `No triggers yet. Click "New Trigger" to add one.` |
| 39 | `Not part of any equipment set` |
| 40 | `Open World` |
| 41 | `Resting (Inn / City)` |
| 42 | `Restore Previous Gear` |
| 43 | `Restoring previous gear` |
| 44 | `Select a trigger to edit it.` |
| 45 | `Selected Trigger` |
| 46 | `Separate several zones with ;` |
| 47 | `Shadowform` |
| 48 | `Shapeshift Form / Stance` |
| 49 | `Shift-Click: Link  Ctrl-Click: Preview\nRight-Click: Ignore / Unignore` |
| 50 | `Show Ignored` |
| 51 | `Stealth` |
| 52 | `Stealthed` |
| 53 | `Swimming` |
| 54 | `Targeting A Boss` |
| 55 | `Time Of Day` |
| 56 | `Travel Form` |
| 57 | `Tree of Life Form` |
| 58 | `Triggers` |
| 59 | `Triggers higher in the list take priority. Gear is never swapped in combat, while dead or while casting: the switch waits until it can happen.` |
| 60 | `Unused` |
| 61 | `Value` |
| 62 | `When` |
| 63 | `When It Ends` |
| 64 | `Windows may wrap past midnight (22:00-02:00).` |
| 65 | `Zone` |
| 66 | `Zone or subzone name` |

\* also used in `modules/gui.lua`.

</details>

<details>
<summary>Added keys — other modules (14)</summary>

| Module | Key |
| --- | --- |
| `modules/radar.lua` | `Above you` |
| `modules/radar.lua` | `Below you` |
| `modules/radar.lua` | `Out of line of sight` |
| `modules/radar.lua` | `Radar` |
| `modules/tooltip.lua` | `Cast by` |
| `modules/tooltip.lua` | `Speed` |
| `modules/tooltip.lua` | `SpellID` |
| `modules/tooltip.lua` | `UnitID` |
| `modules/hoverbind.lua` | `is currently overridden by` |
| `modules/hoverbind.lua` | `was unbound from` |
| `modules/xpbar.lua` | `Rested Gain` |
| `modules/xpbar.lua` | `Time to Rested Cap` |
| `api.lua` | `The UI-Scale has changed. Reload the UI to redraw the borders?` |
| `modules/firstrun.lua` | `Cancel` |

</details>

<details>
<summary>Removed dead keys (46)</summary>

| Key | Category | Was present in |
| --- | --- | --- |
| `Heal Prediction Cleanup` | dead, throttling-section leftover | enUS, deDE |
| `Health/Status Bar` | dead, throttling-section leftover | enUS, deDE |
| `Libpredict` | dead, throttling-section leftover | enUS, deDE |
| `Mass` | dead, throttling-section leftover | enUS, deDE |
| `Panel Alignment` | dead, throttling-section leftover | enUS, deDE |
| `Panel Alignment Check` | dead, throttling-section leftover | enUS, deDE |
| `Player Frame` | dead, throttling-section leftover | enUS, deDE |
| `Raid/Party Frames` | dead, throttling-section leftover | enUS, deDE |
| `Target/Casting` | dead, throttling-section leftover | enUS, deDE |
| `Target/Casting Plates` | dead, throttling-section leftover | enUS, deDE |
| `Unit Frame Update Rate` | dead, throttling-section leftover | enUS, deDE |
| `Abbreviate Numbers (4200 -> 4.2k)` | legacy | all 8 |
| `Border Size` | legacy | all 8 |
| `Close` | legacy | all 8 |
| `Config UI Settings` | legacy | all 8 |
| `Cooldown / Durations` | legacy | all 8 |
| `Cooldown Text Threshold` | legacy | all 8 |
| `Defaults` | legacy | all 8 |
| `Display Debuff Durations` | legacy | all 8 |
| `Do you really want to reset \|cffffaaaaEVERYTHING\|r?` | legacy | all 8 |
| `Druid Mana Bar Text` | legacy | all 8 |
| `Effective Haste (Haste * cast time reduction)` | legacy | all 8 |
| `Enable Pixel Perfect Borders` | legacy | all 8 |
| `Enable UI-Scale` | legacy | all 8 |
| `Estimate Debuffs` | legacy | all 8 |
| `Focus Castbar` | legacy | all 8 |
| `Haste (cast speed increase)` | legacy | all 8 |
| `Huge (PixelPerfect)` | legacy | all 8 |
| `Load Defaults` | legacy | all 8 |
| `Look & Feel` | legacy | all 8 |
| `Menu Font` | legacy | all 8 |
| `Menu Font Size` | legacy | all 8 |
| `Off` | legacy | all 8 |
| `Only` | legacy | all 8 |
| `Only Show Own Debuffs (\|cffffaaaaExperimental\|r)` | legacy | all 8 |
| `Player Castbar` | legacy | all 8 |
| `Regional Settings` | legacy | all 8 |
| `Save & Reload` | legacy | all 8 |
| `Scale Border On HiDPI Displays` | legacy | all 8 |
| `Show Incompatible Config Entries` | legacy | all 8 |
| `Soul Shard` | legacy | all 8 |
| `Soulshards` | legacy | all 8 |
| `Target Castbar` | legacy | all 8 |
| `Tiny (PixelPerfect)` | legacy | all 8 |
| `Use Blizzard Borders` | legacy | all 8 |
| `Show Player Levels` | stale, zhCN only | zhCN |

</details>

<details>
<summary>Removed duplicates (6, in enUS and deDE)</summary>

| Key | What was done |
| --- | --- |
| `Fast` | kept the first occurrence; in deDE the "Schnell" value was moved from the duplicate into the main key line |
| `Nameplates` | kept the first occurrence; in deDE "Namensplaketten" was moved into the main key line |
| `Normal` | kept the first occurrence (inside the throttling block); both deDE values were identical |
| `Slow` | kept the first occurrence; in deDE "Langsam" was moved into the main key line |
| `Very Fast` | kept the first occurrence; in deDE "Sehr Schnell" was moved into the main key line |
| `Very Slow` | kept the first occurrence; in deDE "Sehr Langsam" was moved into the main key line |

</details>
2026-11-12 10:28:21 -06:00

409 lines
14 KiB
Lua

pfUI:RegisterModule("easteregg", function ()
local today = date("%m%d")
-- A full screen scene for the time the player is AFK on a holiday. The
-- night fades in, and a click or coming back clears AFK and hides it.
local function CreateScene(name, greeting, info)
local scene = CreateFrame("Button", name, WorldFrame)
scene:SetFrameStrata("DIALOG")
scene:SetAllPoints()
scene:Hide()
scene.night = scene:CreateTexture(nil, "BACKGROUND")
scene.night:SetColorTexture(0,0,0,1)
scene.night:SetGradientAlpha("VERTICAL", 0,0,0,.5, 0,0,0,1)
scene.night:SetAllPoints()
scene.stext = scene:CreateFontString(nil, "ARTWORK", "GameFontWhite")
scene.stext:SetFont(STANDARD_TEXT_FONT, 14, "OUTLINE")
scene.stext:SetPoint("TOP", 0, -380)
scene.stext:SetText(T["|cff33ffccShagu|cffffffff wishes you a"])
scene.text = scene:CreateFontString(nil, "ARTWORK", "GameFontWhite")
scene.text:SetFont(pfUI.media["font:BigNoodleTitling.ttf"], 38)
scene.text:SetPoint("TOP", 0, -400)
scene.text:SetText(greeting)
local exit = T["|cff444444<Click> or '/afk' to exit"]
scene.dtext = scene:CreateFontString(nil, "ARTWORK", "GameFontWhite")
scene.dtext:SetFont(STANDARD_TEXT_FONT, 14, "OUTLINE")
scene.dtext:SetPoint("TOP", 0, -430)
scene.dtext:SetText(info and info .. "\n\n" .. exit or exit)
-- Fade the night in. The scene keeps an alpha of 1, which comes back
-- when the fade ends.
scene.dusk = scene:CreateAnimationGroup()
local fade = scene.dusk:CreateAnimation("Alpha")
fade:SetToAlpha(1)
fade:SetDuration(.8)
scene:SetScript("OnShow", function()
this.dusk:Play()
end)
-- start over on the next AFK
scene:SetScript("OnHide", function()
this:StopAnimating()
end)
-- /afk toggles, so send it only while AFK is still set
scene:SetScript("OnClick", function()
if IsChatAFK() then SendChatMessage("", "AFK") end
this:Hide()
end)
scene:RegisterEvent("PLAYER_FLAGS_CHANGED")
scene:SetScript("OnEvent", function()
this:SetShown(UnitIsAFK('player'))
end)
return scene
end
-- happy valentine's day
if today == "0214" then
local valentine = CreateScene("pfValentine", T["happy valentine's day!"])
valentine.text:SetTextColor(1, .4, .6)
-- a rosy glow around the screen edges
local glow = CreateFrame("Frame", nil, valentine)
glow:SetAllPoints()
glow:SetBackdrop({ edgeFile = pfUI.media["img:glow"], edgeSize = 32 })
glow:SetBackdropBorderColor(1, .3, .5, 1)
-- A heart is a square turned onto its corner with a round lobe on each
-- upper edge. The client's minimap mask is a plain white disc, so it
-- tints into a lobe without a texture of our own. Smaller hearts are
-- farther away, so they are darker and rise slower.
local hearts = {}
for i = 1, 40 do
local width = math.random(10, 28)
local side = width / 1.7
local shade = .4 + width / 28 * .6
local r, g, b = shade, shade * math.random() * .4, shade * (.2 + math.random() * .3)
local heart = CreateFrame("Frame", nil, valentine)
heart:SetSize(width, width)
heart.width = width
local tip = heart:CreateTexture(nil, "ARTWORK")
tip:SetColorTexture(1, 1, 1)
tip:SetVertexColor(r, g, b)
tip:SetSize(side, side)
tip:SetPoint("CENTER", 0, -side * .07)
tip:SetRotation(math.pi / 4)
for _, x in ipairs({ -1, 1 }) do
local lobe = heart:CreateTexture(nil, "ARTWORK")
lobe:SetTexture("Textures\\MinimapMask")
lobe:SetVertexColor(r, g, b)
lobe:SetSize(side, side)
lobe:SetPoint("CENTER", x * side * .354, side * .28)
end
-- like the snow, but up from below the screen
heart.float = heart:CreateAnimationGroup()
heart.float:SetLooping("REPEAT")
heart.float:SetIgnoreFramerateThrottle(true)
heart.path = heart.float:CreateAnimation("Path")
heart.path:SetCurve("SMOOTH")
heart.points = {}
for point = 1, 6 do
heart.points[point] = heart.path:CreateControlPoint()
end
hearts[i] = heart
end
local function LetThemFloat()
local width, height = valentine:GetWidth(), valentine:GetHeight()
for _, heart in ipairs(hearts) do
local rise = height + heart.width
local duration = rise / (20 + heart.width * 2)
local sway = math.random(-30, 30)
heart:ClearAllPoints()
heart:SetPoint("TOP", valentine, "BOTTOMLEFT", math.random() * width, 0)
heart.path:SetDuration(duration)
heart.path:SetStartDelay(math.random() * duration)
for point, control in ipairs(heart.points) do
control:SetOffset(point % 2 == 1 and sway or -sway, rise * point / 6)
end
heart.float:Play()
end
end
-- Cupid hovers by the side, turned towards the middle
local cupid = CreateFrame("PlayerModel", nil, valentine)
cupid:SetSize(260, 260)
cupid:SetPoint("BOTTOMRIGHT", -60, 60)
cupid:SetScript("OnShow", function()
this:SetDisplayInfo(15990)
this:SetFacing(-.5)
end)
cupid:Hide()
valentine.dusk:SetScript("OnFinished", function()
LetThemFloat()
cupid:Show()
end)
valentine:HookScript("OnHide", function()
cupid:Hide()
end)
end
-- happy hallow's end
if today == "1031" then
local halloween = CreateScene("pfHallowsEnd", T["happy hallow's end!"])
halloween.text:SetTextColor(1, .5, 0)
-- Candlelight glows in from the screen edges. It flickers in uneven
-- steps of { duration, alpha } that end where they began, so the loop
-- never jumps.
local candle = CreateFrame("Frame", nil, halloween)
candle:SetAllPoints()
candle:SetBackdrop({ edgeFile = pfUI.media["img:glow"], edgeSize = 32 })
candle:SetBackdropBorderColor(1, .5, .1, 1)
candle.flicker = candle:CreateAnimationGroup()
candle.flicker:SetLooping("REPEAT")
local steps = {
{ .18, .75 }, { .09, .85 }, { .22, .65 }, { .14, .95 }, { .3, .85 },
{ .11, .7 }, { .2, .9 }, { .16, .6 }, { .26, .85 }, { .12, 1 },
}
local from = 1
for order, step in ipairs(steps) do
local duration, alpha = unpack(step)
local fade = candle.flicker:CreateAnimation("Alpha")
fade:SetOrder(order)
fade:SetDuration(duration)
fade:SetFromAlpha(from)
fade:SetToAlpha(alpha)
fade:SetSmoothing("IN_OUT")
from = alpha
end
-- Once the night has fallen, undead rise along the bottom one after
-- another, a different few on every AFK. They are creature displays, so
-- they need no creature cache. A model frame aims its camera at the
-- middle of the model's bounds, so the frame size alone sets how big one
-- is. Bounds that reach far above the body, like the lich's, leave it
-- standing too low, so it is left out.
local undead = {
158, -- skeleton
201, -- green skeleton
1245, -- skeleton mage
137, -- ghoul
18114, -- white-handed ghoul
1200, -- zombie
1201, -- green zombie
1202, -- sea-green zombie
915, -- banshee
10690, -- green banshee
146, -- ghost
4629, -- shade
7533, -- gargoyle
7534, -- black gargoyle
7854, -- blue gargoyle
}
local function Rise()
this:SetDisplayInfo(this.display)
this:SetFacing(this.facing)
end
local risen = {}
local rising = halloween:CreateAnimationGroup()
for i = 1, 7 do
local size = math.random(180, 240)
local model = CreateFrame("PlayerModel", nil, halloween)
model:SetSize(size, size)
model:SetPoint("BOTTOM", halloween, "BOTTOM", (i - 4) * 150 + math.random(-20, 20), math.random(-10, 20))
model.facing = (math.random() - .5) * .8
model:SetScript("OnShow", Rise)
model:Hide()
risen[i] = model
local rise = rising:CreateAnimation()
rise:SetOrder(i)
rise:SetDuration(.3)
rise:SetScript("OnFinished", function() model:Show() end)
end
halloween.dusk:SetScript("OnFinished", function()
-- shuffle as many undead to the front as there are models
for i, model in ipairs(risen) do
local j = math.random(i, #undead)
undead[i], undead[j] = undead[j], undead[i]
model.display = undead[i]
end
candle.flicker:Play()
rising:Play()
end)
halloween:HookScript("OnHide", function()
for _, model in ipairs(risen) do
model:Hide()
end
end)
end
-- merry x-mas!
if today == "1224" or today == "1225" then
local title = (UnitFactionGroup("player") == "Horde") and PVP_RANK_18_0 or PVP_RANK_18_1
local oldflag = _G.CHAT_FLAG_AFK
local pvpking = CreateFrame("Frame", "pfPvPKing", UIParent)
pvpking:Hide()
pvpking:RegisterEvent("PLAYER_FLAGS_CHANGED")
pvpking:SetScript("OnEvent", function()
if UnitIsAFK('player') then
_G.CHAT_FLAG_AFK = title .. " "
this.time = GetTime()
this:Show()
end
end)
pvpking:SetScript("OnUpdate", function()
if this.time + 1 < GetTime() then
_G.CHAT_FLAG_AFK = oldflag
this:Hide()
end
end)
_G.MARKED_AFK = format(T["You are now |cff33ffcc%s|r (AFK)."], title)
_G.MARKED_AFK_MESSAGE = format(T["You are now |cff33ffcc%s|r (AFK): %s"], title, "%s")
_G.CLEARED_AFK = format(T["You are no longer |cff33ffcc%s|r (AFK).\n|cff33ffccShagu|cffffffff wishes you a merry christmas. Thanks for using |cff33ffccpf|cffffffffUI|cffffffff!|r"], title)
local snow = CreateScene("pfSnowfall", T["merry christmas!"])
snow.text:SetTextColor(1, .25, .25)
-- Flakes fall past the screen for good and sway on the way down. Before
-- each fall a flake waits above the screen for a while, which spreads
-- them out.
local flakes = {}
for i = 1, 200 do
local flake = snow:CreateTexture(nil, "OVERLAY")
flake.fall = flake:CreateAnimationGroup()
flake.fall:SetLooping("REPEAT")
flake.fall:SetIgnoreFramerateThrottle(true)
flake.path = flake.fall:CreateAnimation("Path")
flake.path:SetCurve("SMOOTH")
flake.points = {}
for point = 1, 6 do
flake.points[point] = flake.path:CreateControlPoint()
end
flakes[i] = flake
end
local function LetItSnow()
local width, height = snow:GetWidth(), snow:GetHeight()
for _, flake in ipairs(flakes) do
-- bigger flakes are closer, so they are brighter and fall faster
local size = math.random(2, 5)
local fall = height + size
local duration = fall / (40 + size * 20)
local sway = math.random(-20, 20)
flake:SetSize(size, size)
flake:SetColorTexture(1, 1, 1, .3 + size * .14)
flake:ClearAllPoints()
flake:SetPoint("BOTTOM", snow, "TOPLEFT", math.random() * width, 0)
flake.path:SetDuration(duration)
flake.path:SetStartDelay(math.random() * duration)
for point, control in ipairs(flake.points) do
control:SetOffset(point % 2 == 1 and sway or -sway, -fall * point / 6)
end
flake.fall:Play()
end
end
-- Snow piles up at the bottom for as long as the player stays AFK. The
-- drift plays a shrink backwards, so it grows to its full height over
-- ten minutes and keeps it once the group ends.
local pile = snow:CreateTexture(nil, "ARTWORK")
pile:SetPoint("BOTTOMLEFT", 0, 0)
pile:SetPoint("BOTTOMRIGHT", 0, 0)
pile:SetHeight(120)
pile:SetColorTexture(1, 1, 1, 1)
pile:SetGradientAlpha("VERTICAL", 1,1,1,.9, 1,1,1,0)
pile:Hide()
pile.grow = pile:CreateAnimationGroup()
local grow = pile.grow:CreateAnimation("Scale")
grow:SetOrigin("BOTTOM", 0, 0)
grow:SetScale(1, .01)
grow:SetDuration(600)
snow.dusk:SetScript("OnFinished", function()
LetItSnow()
pile:Show()
pile.grow:Play(true)
end)
snow:HookScript("OnHide", function()
pile:Hide()
end)
end
-- happy new year
if today == "1231" or today == "0101" then
local fireworks = CreateScene("pfFireworks", T["happy new year!"],
T["Another year with |cff33ffccpf|rUI has passed.\nThanks for continuing to use it!"])
-- Each explosion grows by 100px and fades out over 5/3s, then goes back
-- to the pool.
local explosions = CreateTexturePool(fireworks, "OVERLAY")
local function Explode(x, y, size, r, g, b, a)
local tex = explosions:Acquire()
if not tex.burst then
tex.burst = tex:CreateAnimationGroup()
tex.burst:SetIgnoreFramerateThrottle(true)
tex.burst.grow = tex.burst:CreateAnimation("Scale")
tex.burst.grow:SetDuration(5/3)
local fade = tex.burst:CreateAnimation("Alpha")
fade:SetChange(-1)
fade:SetDuration(5/3)
tex.burst:SetScript("OnFinished", function() explosions:Release(tex) end)
end
tex:SetPoint("CENTER", fireworks, "TOPLEFT", x, y)
tex:SetSize(size, size)
tex:SetColorTexture(r, g, b, a)
tex.burst.grow:SetScale((size + 100) / size, (size + 100) / size)
tex:Show()
tex.burst:Play()
end
fireworks:HookScript("OnHide", function()
explosions:ReleaseAll()
end)
-- create random amount of fireworks at random positions
fireworks:SetScript("OnUpdate", function()
if this.dusk:IsPlaying() then return end
-- let the "happy new year" blink
local r,g,b = this.text:GetTextColor()
this.text:SetTextColor(r+(math.random()-.5)/10, g+(math.random()-.5)/10, b+(math.random()-.5)/10,1)
if ( this.tick or 1) > GetTime() then return else this.tick = GetTime() + math.random() - .2 end
local x,y = math.random(1, this:GetWidth()), -1*math.random(1, this:GetHeight())
-- create the base explosion
Explode(x, y, 25, 1, 1, 1, .5)
-- create random amount of colored explosions
for i=1, math.random(20) do
Explode(x+(math.random(0,100)-50), y+(math.random(0,100)-50), 2, math.random(), math.random(), math.random(), 1)
end
end)
end
end)