4 Commits

1350 changed files with 109435 additions and 1032 deletions
-3
View File
@@ -1,3 +0,0 @@
/config.local
/tmp
/cache
-8
View File
@@ -1,8 +0,0 @@
[cache]
type = "hardlink,copy"
[core]
remote = customization
['remote "customization"']
url = s3://warcraft-client/dvc/moonwell-client-sources/customization
endpointurl = https://storage.yandexcloud.net
region = ru-central1
-3
View File
@@ -1,3 +0,0 @@
# Add patterns of files dvc should ignore, which could improve
# the performance. Learn more at
# https://dvc.org/doc/user-guide/dvcignore
-4
View File
@@ -2,7 +2,6 @@ WOW_HOME=C:\Games\World of Warcraft 3.3.5
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_SESSION_TOKEN=
AWS_DEFAULT_REGION=
AWS_BUCKET=
AWS_ENDPOINT=
@@ -11,6 +10,3 @@ AWS_USE_PATH_STYLE_ENDPOINT=
PRODUCTION_REALMLIST=
PTR_REALMLIST=
LOCAL_REALMLIST=
SSH_USER=root
SSH_HOST=strictlypragmatic.ru
+82
View File
@@ -0,0 +1,82 @@
# DragonUI_NewEra compatibility
Compatibility was audited against `ghbset/DragonUI_NewEra` commit
`37a29d640f97545ff1bb7d4b0ba7a5329cce1b8c` (2026-08-09).
## Status
DragonUI_NewEra is bundled in `patch-ruRU-5` as a required MoonWell system
component. It is enabled by default and hidden from the AddOns list together
with DragonUI and `!!!ClassicAPI`.
The MoonWell DragonUI exposes the integration seams used by NewEra:
- global `DragonUI` addon table;
- `ModuleRegistry`;
- `MoversSystem` and the editable-frame API;
- `OptionsPanel` and `PanelControls` after `DragonUI_Options` is loaded;
- `Fonts`, `SafeCall`, `CombatQueue`, and global `SetAtlasTexture`.
NewEra remains a separate addon folder rather than being merged into DragonUI.
Its TOC retains:
```toc
## Interface: 30300
## Dependencies: DragonUI, !!!ClassicAPI
## OptionalDeps: DragonUI_Options
```
`DragonUI_NewEra` is an extension, not a replacement for the HUD modules. It
does not need `X-DragonUI-Overrides` unless a future NewEra module explicitly
takes ownership of `mainbars`, `minimap`, `buffs`, or another registered HUD
module.
## Bundled sources
The system package contains:
```text
Interface/AddOns/!!!ClassicAPI/ b3da3000bba23a2c31aa9c9b7c0232d5973789e6
Interface/AddOns/DragonUI_NewEra/ 37a29d640f97545ff1bb7d4b0ba7a5329cce1b8c
```
Upstream Git metadata, screenshots, and top-level build tools are excluded.
Runtime sources, assets, and the upstream QA harness are retained. The exact
revisions are also recorded in addon TOC metadata as `X-Upstream-Commit`.
Neither audited upstream contains an explicit repository-wide redistribution
license. MoonWell maintainers must obtain and archive redistribution permission
before a public release. The source revisions above preserve provenance but do
not replace that permission.
## Known ownership conflict
Both MoonWellClient and NewEra provide an Encounter Journal / Adventure Guide
and the `ToggleEncounterJournal` entry point. MoonWell's journal is currently
authoritative because it receives server-backed data. NewEra's encounter
journal files are intentionally omitted from its system TOC, and its dead
options toggle is hidden.
The NewEra combined-bag module is marked work in progress upstream. Treat it as
opt-in and do not use it as the default replacement for DragonUI/Blizzard bags
without a separate gameplay test pass.
NewEra ships 94 power-of-two BLP atlases with one dimension above the project's
conservative 512-pixel authoring limit; the largest are 2048x2048. Upstream
marks their BLP2 encodings as 3.3.5a-loadable and they package successfully,
but every affected panel still requires an in-client render pass on MoonWell's
exact executable before release. If that client rejects them, split the atlases
without changing their public atlas names instead of silently scaling UI
geometry.
## Release checklist
1. Update only from reviewed, pinned DragonUI_NewEra and ClassicAPI revisions.
2. Obtain and record licenses or permissions for code, fonts, sounds, and BLPs.
3. Keep DragonUI_NewEra as its own folder and TOC; do not merge it into
DragonUI or FrameXML.
4. Keep NewEra Encounter Journal disabled until ownership is deliberately
migrated from MoonWellClient.
5. Test Character, Spellbook, Talents, Professions, Auction House, LFG, Social,
Collections, and the DragonUI options tab on build 12340.
6. Test login with NewEra disabled: the default DragonUI must remain complete.
+105
View File
@@ -0,0 +1,105 @@
# DragonUI: replacement addons
MoonWell ships DragonUI as the default interface. Players can replace an
individual DragonUI module without copying or editing the bundled addon.
## Replacement addon structure
The replacement must use its own folder and addon name. Do not create another
folder named `DragonUI`; files inside an MPQ and loose files with the same
virtual path do not form a supported update mechanism.
```text
MyDragonUIMinimap/
|-- MyDragonUIMinimap.toc
`-- MyDragonUIMinimap.lua
```
`MyDragonUIMinimap.toc`:
```toc
## Interface: 30300
## Title: My DragonUI Minimap
## Dependencies: DragonUI
## X-DragonUI-Overrides: minimap
## X-DragonUI-Override-Priority: 100
MyDragonUIMinimap.lua
```
The `X-DragonUI-Overrides` declaration is required. DragonUI reads it before
dependent addons execute and does not apply the bundled implementation. A list
may contain several comma-separated module identifiers.
`MyDragonUIMinimap.lua`:
```lua
local provider = {}
function provider:Activate(dragonUI, moduleName)
-- Create or show the replacement here.
end
function provider:Deactivate(dragonUI, moduleName)
-- Hide frames and unregister events created by this provider.
end
local ok, reason = DragonUI:RegisterModuleOverride(
"minimap",
"MyDragonUIMinimap",
provider,
{ priority = 100 }
)
if not ok then
DEFAULT_CHAT_FRAME:AddMessage("MyDragonUIMinimap: " .. tostring(reason))
end
```
The owner passed to `RegisterModuleOverride` must match the addon folder/TOC
name. Supported provider activation names are `Activate`, `Apply`, `Enable`, or
`OnEnable`; cleanup names are `Deactivate`, `Restore`, `Disable`, or
`OnDisable`.
## Public API (version 1)
```lua
DragonUI.PUBLIC_API_VERSION
DragonUI:RegisterModuleOverride(moduleName, owner, provider[, options])
DragonUI:UnregisterModuleOverride(moduleName, owner)
DragonUI:IsModuleOverridden(moduleName)
DragonUI:GetModuleOverride(moduleName) -- owner, provider
```
DragonUI also sends the Ace message `DRAGONUI_OVERRIDE_CHANGED` with
`moduleName, owner`. `owner` is nil after the final provider is removed.
Registering a replacement at runtime without TOC metadata is supported only
for a module that can be restored safely. For a load-once module the call
returns `true, "RELOAD_REQUIRED"`; add the metadata and reload the UI.
## Bundled module identifiers
The registry currently exposes these identifiers:
```text
bagsort, boss, buffs, buttons, castbar, chatmods, combuctor, cooldowns,
darkmode, itemquality, keybinding, mainbars, micromenu, minimap, multicast,
noop, petbar, player, questtracker, rage_indicator, stance, tooltip,
unitframe_layers, vehicle
```
Target/focus/party frames still contain legacy startup code and will be added
to the public registry before they are advertised as independently replaceable.
## Conflict resolution
When multiple enabled addons claim the same module, the highest numeric
`X-DragonUI-Override-Priority` wins. Equal priorities are resolved by addon
name to make the result deterministic. A declaration that never registers a
provider is rejected at `PLAYER_LOGIN`, and DragonUI restores its bundled
module so the player is not left without that UI element.
Module suppression is session-only. DragonUI restores the player's saved
enabled/disabled choice during `PLAYER_LOGOUT`, so removing a replacement addon
automatically brings back the previous DragonUI configuration.
+12 -7
View File
@@ -47,8 +47,6 @@ git submodule update --remote vendor/warcraftxl vendor/modules/*
- Visual Studio 2022 с C++ toolchain для Win32;
- CMake 3.20+;
- Rust/Cargo для существующего MPQ-сборщика;
- Python 3 и DVC с поддержкой S3 для содержимого внешних графических патчей
(`py -m pip install -r requirements-dvc.txt`);
- локальный оригинальный `Wow_Original.exe` с SHA-256
`AA63A5750D60EF16746C686B3D5E26876D98953EAB08B1C026CD0FAF78E88CB8`.
@@ -125,16 +123,23 @@ WarcraftXL не требуется и в объектное хранилище
- `patch-ruRU-5` — русская локализация и интерфейс;
- `patch-Z` — Mythic+ ресурсы и клиентские данные.
## DragonUI и пользовательские замены
DragonUI поставляется как включённый системный интерфейс. Игрок не заменяет
файлы из MPQ: отдельный аддон может заранее объявить, какие модули он берёт под
свой контроль, и зарегистрировать собственную реализацию после загрузки
DragonUI. Формат TOC, Lua API, приоритеты и рабочий пример описаны в
[`DRAGONUI_OVERRIDES.md`](DRAGONUI_OVERRIDES.md).
DragonUI_NewEra и его `!!!ClassicAPI` входят в системный интерфейс MoonWell.
Зафиксированные upstream-версии, состав поставки и решение конфликта двух
Encounter Journal описаны в [`DRAGONUI_NEWERA.md`](DRAGONUI_NEWERA.md).
Управляемые репозиторием MPQ и внешние графические патчи перечислены отдельно в
`patch-layout.json`. Сборка и deploy синхронизируют только `repositoryPatches` и
не изменяют `graphicsPatches`. При пересечении списков репозиторный патч имеет
приоритет.
Распакованное содержимое больших патчей кастомизации хранится через DVC в
`assets/graphics/`, а бинарные объекты — в настроенном S3. Инструкции по первичной
загрузке, изменению и импорту MPQ находятся в
[`assets/graphics/README.md`](assets/graphics/README.md).
## Лицензирование
WarcraftXL распространяется по GPL-3.0 и подключён как отдельный неизменённый upstream submodule.
-1
View File
@@ -1 +0,0 @@
/patch-X
-6
View File
@@ -1,6 +0,0 @@
outs:
- md5: 012ce72d8dfdf089b20a28f6e6158b58.dir
size: 1195310
nfiles: 4
hash: md5
path: patch-X
-14
View File
@@ -1,14 +0,0 @@
/patch-ruRU-X
/patch-ruRU-Y
/backup-ruRU
/patch-ruRU-6
/patch-ruRU-A
/patch-ruRU-B
/patch-ruRU-E
/patch-ruRU-H
/patch-ruRU-I
/patch-ruRU-M
/patch-ruRU-S
/patch-ruRU-T
/patch-ruRU-U
/patch-ruRU-W
@@ -1,6 +0,0 @@
outs:
- md5: b120587dfcd255f78392ca52705a00ff.dir
size: 38876467
nfiles: 161
hash: md5
path: backup-ruRU
@@ -1,6 +0,0 @@
outs:
- md5: 9ca2ee746d80e8a0c951c5ef476ae654.dir
size: 1064210
nfiles: 3
hash: md5
path: patch-ruRU-6
@@ -1,6 +0,0 @@
outs:
- md5: 97232ae859eaa1a16b137efd1a2e9122.dir
size: 2748988973
nfiles: 8817
hash: md5
path: patch-ruRU-A
@@ -1,6 +0,0 @@
outs:
- md5: bb686aebf7c9cae2c02433abde9a9f19.dir
size: 771051083
nfiles: 2911
hash: md5
path: patch-ruRU-B
@@ -1,6 +0,0 @@
outs:
- md5: d6b2fe0e3f23c47dc944ca4a8f82d97a.dir
size: 9275755440
nfiles: 21977
hash: md5
path: patch-ruRU-E
@@ -1,6 +0,0 @@
outs:
- md5: 5e95536d2c6f6ff792f05b800105bedc.dir
size: 3727395837
nfiles: 40296
hash: md5
path: patch-ruRU-H
@@ -1,6 +0,0 @@
outs:
- md5: 5db07768b0814c970d84a99b6072fd9f.dir
size: 31453961
nfiles: 186
hash: md5
path: patch-ruRU-I
@@ -1,6 +0,0 @@
outs:
- md5: e927ae98c9971f378a82feb3299fdcb8.dir
size: 69521651
nfiles: 1552
hash: md5
path: patch-ruRU-M
@@ -1,6 +0,0 @@
outs:
- md5: 449383bbe05ebebb6bad2c37da7793c4.dir
size: 142167464
nfiles: 1751
hash: md5
path: patch-ruRU-S
@@ -1,6 +0,0 @@
outs:
- md5: fc19500b5ce0fd312a415a3118afd58d.dir
size: 656858260
nfiles: 1810
hash: md5
path: patch-ruRU-T
@@ -1,6 +0,0 @@
outs:
- md5: 783909a6c2ebed5d4f43516fe1ea68bb.dir
size: 460642379
nfiles: 1837
hash: md5
path: patch-ruRU-U
@@ -1,6 +0,0 @@
outs:
- md5: e2a1448eb0e443797acd577fc4b67249.dir
size: 44597910
nfiles: 484
hash: md5
path: patch-ruRU-W
@@ -1,6 +0,0 @@
outs:
- md5: 3d322d290959d1ead612f3b76860a1ea.dir
size: 3984134962
nfiles: 29495
hash: md5
path: patch-ruRU-X
@@ -1,6 +0,0 @@
outs:
- md5: 42f3a8ac35674e33c0a4420c84cadcb8.dir
size: 11053212781
nfiles: 36191
hash: md5
path: patch-ruRU-Y
-66
View File
@@ -1,66 +0,0 @@
# Графические MPQ-патчи
В этой директории через DVC версионируется распакованное содержимое всех 15 патчей из
`graphicsPatches` в `patch-layout.json`. Git хранит небольшие файлы `*.dvc`, а сами ресурсы —
в S3 remote `customization`. Хэшированные пути в S3 являются внутренней адресацией DVC:
исходное дерево с обычными именами восстанавливается командой `dvc pull`.
## Первичная настройка
```powershell
py -m pip install -r requirements-dvc.txt
Copy-Item .env.example .env # если локального .env ещё нет
.\configure-dvc.ps1
py -m dvc pull
```
Можно скачать один патч, передав его указатель явно:
```powershell
py -m dvc pull assets/graphics/Data/ruRU/patch-ruRU-X.dvc
```
Секреты записываются только в `.dvc/config.local`; этот файл исключён из Git. Вместо ключей
из `.env` можно использовать AWS profile: `.\configure-dvc.ps1 -Profile moonwell`.
## Изменение ресурсов
DVC-кэш использует hardlink на NTFS. Перед ручным изменением дерева отвяжите его от кэша:
```powershell
py -m dvc unprotect assets/graphics/Data/ruRU/patch-ruRU-X
# изменить, добавить или удалить файлы
py -m dvc add assets/graphics/Data/ruRU/patch-ruRU-X
py -m dvc push
git add assets/graphics/Data/ruRU/patch-ruRU-X.dvc
```
Сначала выполняйте `dvc push`, затем коммитьте Git-указатель, чтобы коммит не ссылался на ещё
не загруженные объекты.
## Импорт MPQ
`mpqextract` принимает встроенный `(listfile)` и любое количество внешних listfile. Он извлекает
все известные пути, а блоки с неизвестными именами сохраняет в `__mpqmeta__/unresolved/`.
Манифест `__mpqmeta__/unresolved.json` связывает каждый blob с MPQ-хэшами и индексом блока,
поэтому содержимое архива не теряется даже при неполном listfile.
```powershell
cargo run --release --manifest-path tool/Cargo.toml --bin mpqextract -- `
'patch.mpq' 'assets/graphics/Data/ruRU/patch-ruRU-N' 'master-list.txt'
```
В `patch-ruRU-A`, `B`, `S`, `T`, `U` и `W` есть такие безымянные блоки. Для их безопасной
пересборки нужен авторитетный listfile с исходными путями; пока он не найден, исходные MPQ в
дистрибуционном S3 остаются каноническими архивами. `mpqpack` намеренно отказывается собирать
дерево с `__mpqmeta__`, поскольку подмена путей хэшами изменила бы семантику патча.
Полностью разрешённое дерево собирается так:
```powershell
cargo run --release --manifest-path tool/Cargo.toml --bin mpqpack -- `
'assets/graphics/Data/ruRU/patch-ruRU-X' 'build/graphics/patch-ruRU-X.MPQ'
```
Сводка исходных объектов, DVC-хэшей и количества разрешённых блоков находится в
`assets/graphics/sources.json`.
-157
View File
@@ -1,157 +0,0 @@
{
"sourcePrefix": "s3://warcraft-client/World of Warcraft/",
"patches": [
{
"archive": "Data/patch-X.MPQ",
"archiveBytes": 496584,
"dvcPointer": "assets/graphics/Data/patch-X.dvc",
"dvcMd5": "012ce72d8dfdf089b20a28f6e6158b58.dir",
"extractedBytes": 1195310,
"trackedFiles": 4,
"resolvedFiles": 4,
"unresolvedBlocks": 0
},
{
"archive": "Data/ruRU/backup-ruRU.MPQ",
"archiveBytes": 23981093,
"dvcPointer": "assets/graphics/Data/ruRU/backup-ruRU.dvc",
"dvcMd5": "b120587dfcd255f78392ca52705a00ff.dir",
"extractedBytes": 38876467,
"trackedFiles": 161,
"resolvedFiles": 161,
"unresolvedBlocks": 0
},
{
"archive": "Data/ruRU/patch-ruRU-6.MPQ",
"archiveBytes": 375062,
"dvcPointer": "assets/graphics/Data/ruRU/patch-ruRU-6.dvc",
"dvcMd5": "9ca2ee746d80e8a0c951c5ef476ae654.dir",
"extractedBytes": 1064210,
"trackedFiles": 3,
"resolvedFiles": 3,
"unresolvedBlocks": 0
},
{
"archive": "Data/ruRU/patch-ruRU-A.mpq",
"archiveBytes": 1451338841,
"dvcPointer": "assets/graphics/Data/ruRU/patch-ruRU-A.dvc",
"dvcMd5": "97232ae859eaa1a16b137efd1a2e9122.dir",
"extractedBytes": 2748988973,
"trackedFiles": 8817,
"resolvedFiles": 5649,
"unresolvedBlocks": 3167
},
{
"archive": "Data/ruRU/patch-ruRU-B.mpq",
"archiveBytes": 384938550,
"dvcPointer": "assets/graphics/Data/ruRU/patch-ruRU-B.dvc",
"dvcMd5": "bb686aebf7c9cae2c02433abde9a9f19.dir",
"extractedBytes": 771051083,
"trackedFiles": 2911,
"resolvedFiles": 1679,
"unresolvedBlocks": 1231
},
{
"archive": "Data/ruRU/patch-ruRU-E.mpq",
"archiveBytes": 1862937450,
"dvcPointer": "assets/graphics/Data/ruRU/patch-ruRU-E.dvc",
"dvcMd5": "d6b2fe0e3f23c47dc944ca4a8f82d97a.dir",
"extractedBytes": 9275755440,
"trackedFiles": 21977,
"resolvedFiles": 21977,
"unresolvedBlocks": 0
},
{
"archive": "Data/ruRU/patch-ruRU-H.MPQ",
"archiveBytes": 2154531136,
"dvcPointer": "assets/graphics/Data/ruRU/patch-ruRU-H.dvc",
"dvcMd5": "5e95536d2c6f6ff792f05b800105bedc.dir",
"extractedBytes": 3727395837,
"trackedFiles": 40296,
"resolvedFiles": 40296,
"unresolvedBlocks": 0
},
{
"archive": "Data/ruRU/patch-ruRU-I.mpq",
"archiveBytes": 14891516,
"dvcPointer": "assets/graphics/Data/ruRU/patch-ruRU-I.dvc",
"dvcMd5": "5db07768b0814c970d84a99b6072fd9f.dir",
"extractedBytes": 31453961,
"trackedFiles": 186,
"resolvedFiles": 186,
"unresolvedBlocks": 0
},
{
"archive": "Data/ruRU/patch-ruRU-M.MPQ",
"archiveBytes": 48772900,
"dvcPointer": "assets/graphics/Data/ruRU/patch-ruRU-M.dvc",
"dvcMd5": "e927ae98c9971f378a82feb3299fdcb8.dir",
"extractedBytes": 69521651,
"trackedFiles": 1552,
"resolvedFiles": 1552,
"unresolvedBlocks": 0
},
{
"archive": "Data/ruRU/patch-ruRU-S.mpq",
"archiveBytes": 80492633,
"dvcPointer": "assets/graphics/Data/ruRU/patch-ruRU-S.dvc",
"dvcMd5": "449383bbe05ebebb6bad2c37da7793c4.dir",
"extractedBytes": 142167464,
"trackedFiles": 1751,
"resolvedFiles": 1432,
"unresolvedBlocks": 318
},
{
"archive": "Data/ruRU/patch-ruRU-T.mpq",
"archiveBytes": 418595462,
"dvcPointer": "assets/graphics/Data/ruRU/patch-ruRU-T.dvc",
"dvcMd5": "fc19500b5ce0fd312a415a3118afd58d.dir",
"extractedBytes": 656858260,
"trackedFiles": 1810,
"resolvedFiles": 1731,
"unresolvedBlocks": 78
},
{
"archive": "Data/ruRU/patch-ruRU-U.mpq",
"archiveBytes": 233678341,
"dvcPointer": "assets/graphics/Data/ruRU/patch-ruRU-U.dvc",
"dvcMd5": "783909a6c2ebed5d4f43516fe1ea68bb.dir",
"extractedBytes": 460642379,
"trackedFiles": 1837,
"resolvedFiles": 1372,
"unresolvedBlocks": 464
},
{
"archive": "Data/ruRU/patch-ruRU-W.mpq",
"archiveBytes": 29433979,
"dvcPointer": "assets/graphics/Data/ruRU/patch-ruRU-W.dvc",
"dvcMd5": "e2a1448eb0e443797acd577fc4b67249.dir",
"extractedBytes": 44597910,
"trackedFiles": 484,
"resolvedFiles": 381,
"unresolvedBlocks": 102
},
{
"archive": "Data/ruRU/patch-ruRU-X.MPQ",
"archiveBytes": 2673854694,
"archiveSha256": "CD8CED6FA6C863D509DAE458E6DD44C3986B8B57731B6DC6192FE94125F8C1FD",
"dvcPointer": "assets/graphics/Data/ruRU/patch-ruRU-X.dvc",
"dvcMd5": "3d322d290959d1ead612f3b76860a1ea.dir",
"extractedBytes": 3984134962,
"trackedFiles": 29495,
"resolvedFiles": 29495,
"unresolvedBlocks": 0
},
{
"archive": "Data/ruRU/patch-ruRU-Y.MPQ",
"archiveBytes": 3001665276,
"archiveSha256": "534D496C1A1EE023B910ABC80B727BA88BB09CD2F5767100FC18EE41F4306B90",
"dvcPointer": "assets/graphics/Data/ruRU/patch-ruRU-Y.dvc",
"dvcMd5": "42f3a8ac35674e33c0a4420c84cadcb8.dir",
"extractedBytes": 11053212781,
"trackedFiles": 36191,
"resolvedFiles": 36191,
"unresolvedBlocks": 0
}
]
}
-56
View File
@@ -1,56 +0,0 @@
param(
[string]$EnvFile = (Join-Path $PSScriptRoot '.env'),
[string]$Profile
)
$ErrorActionPreference = 'Stop'
function Get-EnvValue([string]$Path, [string]$Name) {
if (-not (Test-Path -LiteralPath $Path)) {
return $null
}
$line = Get-Content -LiteralPath $Path |
Where-Object { $_ -match "^$([regex]::Escape($Name))=" } |
Select-Object -First 1
if ($line) {
return $line.Substring($Name.Length + 1).Trim()
}
return $null
}
function Invoke-Dvc([string[]]$Arguments) {
& py -m dvc @Arguments
if ($LASTEXITCODE -ne 0) {
throw "DVC command failed: dvc $($Arguments -join ' ')"
}
}
if (-not (Test-Path -LiteralPath (Join-Path $PSScriptRoot '.dvc\config'))) {
throw 'DVC is not initialized in this repository.'
}
& py -c 'import dvc, dvc_s3' *> $null
if ($LASTEXITCODE -ne 0) {
throw 'DVC with S3 support is not installed. Run: py -m pip install -r requirements-dvc.txt'
}
if ($Profile) {
Invoke-Dvc @('remote', 'modify', '--local', 'customization', 'profile', $Profile)
} else {
$accessKey = Get-EnvValue $EnvFile 'AWS_ACCESS_KEY_ID'
$secretKey = Get-EnvValue $EnvFile 'AWS_SECRET_ACCESS_KEY'
$sessionToken = Get-EnvValue $EnvFile 'AWS_SESSION_TOKEN'
if (-not $accessKey -or -not $secretKey) {
throw "AWS credentials are missing in $EnvFile. Pass -Profile or fill AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY."
}
Invoke-Dvc @('remote', 'modify', '--local', 'customization', 'access_key_id', $accessKey)
Invoke-Dvc @('remote', 'modify', '--local', 'customization', 'secret_access_key', $secretKey)
if ($sessionToken) {
Invoke-Dvc @('remote', 'modify', '--local', 'customization', 'session_token', $sessionToken)
}
}
Write-Host 'Local DVC credentials configured. They are stored in ignored .dvc/config.local.'
-1
View File
@@ -1 +0,0 @@
dvc[s3]==3.67.1
@@ -0,0 +1,10 @@
## Interface: 30300
## Title: !!!ClassicAPI
## Notes: Blizzard Classic API Emulation
## Version: 1.1.64
## Author: Tsoukie
## DefaultState: Enabled
## X-MoonWell-System: 1
## X-Upstream-Commit: b3da3000bba23a2c31aa9c9b7c0232d5973789e6
Lib\Load.xml
Load.xml
@@ -0,0 +1,238 @@
--[[ $Id: CallbackHandler-1.0.lua 18 2014-10-16 02:52:20Z mikk $ ]]
local MAJOR, MINOR = "CallbackHandler-1.0", 7
local CallbackHandler = LibStub:NewLibrary(MAJOR, MINOR)
if not CallbackHandler then return end -- No upgrade needed
local meta = {__index = function(tbl, key) tbl[key] = {} return tbl[key] end}
-- Lua APIs
local tconcat = table.concat
local assert, error, loadstring = assert, error, loadstring
local setmetatable, rawset, rawget = setmetatable, rawset, rawget
local next, select, pairs, type, tostring = next, select, pairs, type, tostring
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
-- List them here for Mikk's FindGlobals script
-- GLOBALS: geterrorhandler
local xpcall = xpcall
local function errorhandler(err)
return geterrorhandler()(err)
end
local function CreateDispatcher(argCount)
local code = [[
local next, xpcall, eh = ...
local method, ARGS
local function call() method(ARGS) end
local function dispatch(handlers, ...)
local index
index, method = next(handlers)
if not method then return end
local OLD_ARGS = ARGS
ARGS = ...
repeat
xpcall(call, eh)
index, method = next(handlers, index)
until not method
ARGS = OLD_ARGS
end
return dispatch
]]
local ARGS, OLD_ARGS = {}, {}
for i = 1, argCount do ARGS[i], OLD_ARGS[i] = "arg"..i, "old_arg"..i end
code = code:gsub("OLD_ARGS", tconcat(OLD_ARGS, ", ")):gsub("ARGS", tconcat(ARGS, ", "))
return assert(loadstring(code, "safecall Dispatcher["..argCount.."]"))(next, xpcall, errorhandler)
end
local Dispatchers = setmetatable({}, {__index=function(self, argCount)
local dispatcher = CreateDispatcher(argCount)
rawset(self, argCount, dispatcher)
return dispatcher
end})
--------------------------------------------------------------------------
-- CallbackHandler:New
--
-- target - target object to embed public APIs in
-- RegisterName - name of the callback registration API, default "RegisterCallback"
-- UnregisterName - name of the callback unregistration API, default "UnregisterCallback"
-- UnregisterAllName - name of the API to unregister all callbacks, default "UnregisterAllCallbacks". false == don't publish this API.
function CallbackHandler:New(target, RegisterName, UnregisterName, UnregisterAllName)
RegisterName = RegisterName or "RegisterCallback"
UnregisterName = UnregisterName or "UnregisterCallback"
if UnregisterAllName==nil then -- false is used to indicate "don't want this method"
UnregisterAllName = "UnregisterAllCallbacks"
end
-- we declare all objects and exported APIs inside this closure to quickly gain access
-- to e.g. function names, the "target" parameter, etc
-- Create the registry object
local events = setmetatable({}, meta)
local registry = { recurse=0, events=events }
-- registry:Fire() - fires the given event/message into the registry
function registry:Fire(eventname, ...)
if not rawget(events, eventname) or not next(events[eventname]) then return end
local oldrecurse = registry.recurse
registry.recurse = oldrecurse + 1
Dispatchers[select('#', ...) + 1](events[eventname], eventname, ...)
registry.recurse = oldrecurse
if registry.insertQueue and oldrecurse==0 then
-- Something in one of our callbacks wanted to register more callbacks; they got queued
for eventname,callbacks in pairs(registry.insertQueue) do
local first = not rawget(events, eventname) or not next(events[eventname]) -- test for empty before. not test for one member after. that one member may have been overwritten.
for self,func in pairs(callbacks) do
events[eventname][self] = func
-- fire OnUsed callback?
if first and registry.OnUsed then
registry.OnUsed(registry, target, eventname)
first = nil
end
end
end
registry.insertQueue = nil
end
end
-- Registration of a callback, handles:
-- self["method"], leads to self["method"](self, ...)
-- self with function ref, leads to functionref(...)
-- "addonId" (instead of self) with function ref, leads to functionref(...)
-- all with an optional arg, which, if present, gets passed as first argument (after self if present)
target[RegisterName] = function(self, eventname, method, ... --[[actually just a single arg]])
if type(eventname) ~= "string" then
error("Usage: "..RegisterName.."(eventname, method[, arg]): 'eventname' - string expected.", 2)
end
method = method or eventname
local first = not rawget(events, eventname) or not next(events[eventname]) -- test for empty before. not test for one member after. that one member may have been overwritten.
if type(method) ~= "string" and type(method) ~= "function" then
error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): 'methodname' - string or function expected.", 2)
end
local regfunc
if type(method) == "string" then
-- self["method"] calling style
if type(self) ~= "table" then
error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): self was not a table?", 2)
elseif self==target then
error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): do not use Library:"..RegisterName.."(), use your own 'self'", 2)
elseif type(self[method]) ~= "function" then
error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): 'methodname' - method '"..tostring(method).."' not found on self.", 2)
end
if select("#",...)>=1 then -- this is not the same as testing for arg==nil!
local arg=select(1,...)
regfunc = function(...) self[method](self,arg,...) end
else
regfunc = function(...) self[method](self,...) end
end
else
-- function ref with self=object or self="addonId" or self=thread
if type(self)~="table" and type(self)~="string" and type(self)~="thread" then
error("Usage: "..RegisterName.."(self or \"addonId\", eventname, method): 'self or addonId': table or string or thread expected.", 2)
end
if select("#",...)>=1 then -- this is not the same as testing for arg==nil!
local arg=select(1,...)
regfunc = function(...) method(arg,...) end
else
regfunc = method
end
end
if events[eventname][self] or registry.recurse<1 then
-- if registry.recurse<1 then
-- we're overwriting an existing entry, or not currently recursing. just set it.
events[eventname][self] = regfunc
-- fire OnUsed callback?
if registry.OnUsed and first then
registry.OnUsed(registry, target, eventname)
end
else
-- we're currently processing a callback in this registry, so delay the registration of this new entry!
-- yes, we're a bit wasteful on garbage, but this is a fringe case, so we're picking low implementation overhead over garbage efficiency
registry.insertQueue = registry.insertQueue or setmetatable({},meta)
registry.insertQueue[eventname][self] = regfunc
end
end
-- Unregister a callback
target[UnregisterName] = function(self, eventname)
if not self or self==target then
error("Usage: "..UnregisterName.."(eventname): bad 'self'", 2)
end
if type(eventname) ~= "string" then
error("Usage: "..UnregisterName.."(eventname): 'eventname' - string expected.", 2)
end
if rawget(events, eventname) and events[eventname][self] then
events[eventname][self] = nil
-- Fire OnUnused callback?
if registry.OnUnused and not next(events[eventname]) then
registry.OnUnused(registry, target, eventname)
end
end
if registry.insertQueue and rawget(registry.insertQueue, eventname) and registry.insertQueue[eventname][self] then
registry.insertQueue[eventname][self] = nil
end
end
-- OPTIONAL: Unregister all callbacks for given selfs/addonIds
if UnregisterAllName then
target[UnregisterAllName] = function(...)
if select("#",...)<1 then
error("Usage: "..UnregisterAllName.."([whatFor]): missing 'self' or \"addonId\" to unregister events for.", 2)
end
if select("#",...)==1 and ...==target then
error("Usage: "..UnregisterAllName.."([whatFor]): supply a meaningful 'self' or \"addonId\"", 2)
end
for i=1,select("#",...) do
local self = select(i,...)
if registry.insertQueue then
for eventname, callbacks in pairs(registry.insertQueue) do
if callbacks[self] then
callbacks[self] = nil
end
end
end
for eventname, callbacks in pairs(events) do
if callbacks[self] then
callbacks[self] = nil
-- Fire OnUnused callback?
if registry.OnUnused and not next(callbacks) then
registry.OnUnused(registry, target, eventname)
end
end
end
end
end
end
return registry
end
-- CallbackHandler purposefully does NOT do explicit embedding. Nor does it
-- try to upgrade old implicit embeds since the system is selfcontained and
-- relies on closures to work.
@@ -0,0 +1,4 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Script file="CallbackHandler-1.0.lua"/>
</Ui>
@@ -0,0 +1,51 @@
-- $Id: LibStub.lua 103 2014-10-16 03:02:50Z mikk $
-- LibStub is a simple versioning stub meant for use in Libraries. http://www.wowace.com/addons/libstub/ for more info
-- LibStub is hereby placed in the Public Domain
-- Credits: Kaelten, Cladhaire, ckknight, Mikk, Ammo, Nevcairiel, joshborke
local LIBSTUB_MAJOR, LIBSTUB_MINOR = "LibStub", 3 -- NEVER MAKE THIS AN SVN REVISION! IT NEEDS TO BE USABLE IN ALL REPOS!
local LibStub = _G[LIBSTUB_MAJOR]
-- Check to see is this version of the stub is obsolete
if not LibStub or LibStub.minor < LIBSTUB_MINOR then
LibStub = LibStub or {libs = {}, minors = {} }
_G[LIBSTUB_MAJOR] = LibStub
LibStub.minor = LIBSTUB_MINOR
-- LibStub:NewLibrary(major, minor)
-- major (string) - the major version of the library
-- minor (string or number ) - the minor version of the library
--
-- returns nil if a newer or same version of the lib is already present
-- returns empty library object or old library object if upgrade is needed
function LibStub:NewLibrary(major, minor)
assert(type(major) == "string", "Bad argument #2 to `NewLibrary' (string expected)")
minor = assert(tonumber(strmatch(minor, "%d+")), "Minor version must either be a number or contain a number.")
local oldminor = self.minors[major]
if oldminor and oldminor >= minor then return nil end
self.minors[major], self.libs[major] = minor, self.libs[major] or {}
return self.libs[major], oldminor
end
-- LibStub:GetLibrary(major, [silent])
-- major (string) - the major version of the library
-- silent (boolean) - if true, library is optional, silently return nil if its not found
--
-- throws an error if the library can not be found (except silent is set)
-- returns the library object if found
function LibStub:GetLibrary(major, silent)
if not self.libs[major] and not silent then
error(("Cannot find a library instance of %q."):format(tostring(major)), 2)
end
return self.libs[major], self.minors[major]
end
-- LibStub:IterateLibraries()
--
-- Returns an iterator for the currently registered libraries
function LibStub:IterateLibraries()
return pairs(self.libs)
end
setmetatable(LibStub, { __call = LibStub.GetLibrary })
end
@@ -0,0 +1,523 @@
--
-- ChatThrottleLib by Mikk
--
-- Manages AddOn chat output to keep player from getting kicked off.
--
-- ChatThrottleLib:SendChatMessage/:SendAddonMessage functions that accept
-- a Priority ("BULK", "NORMAL", "ALERT") as well as prefix for SendChatMessage.
--
-- Priorities get an equal share of available bandwidth when fully loaded.
-- Communication channels are separated on extension+chattype+destination and
-- get round-robinned. (Destination only matters for whispers and channels,
-- obviously)
--
-- Will install hooks for SendChatMessage and SendAddonMessage to measure
-- bandwidth bypassing the library and use less bandwidth itself.
--
--
-- Fully embeddable library. Just copy this file into your addon directory,
-- add it to the .toc, and it's done.
--
-- Can run as a standalone addon also, but, really, just embed it! :-)
--
-- LICENSE: ChatThrottleLib is released into the Public Domain
--
local CTL_VERSION = 25
local _G = _G
if _G.ChatThrottleLib then
if _G.ChatThrottleLib.version >= CTL_VERSION then
-- There's already a newer (or same) version loaded. Buh-bye.
return
elseif not _G.ChatThrottleLib.securelyHooked then
print("ChatThrottleLib: Warning: There's an ANCIENT ChatThrottleLib.lua (pre-wow 2.0, <v16) in an addon somewhere. Get the addon updated or copy in a newer ChatThrottleLib.lua (>=v16) in it!")
-- ATTEMPT to unhook; this'll behave badly if someone else has hooked...
-- ... and if someone has securehooked, they can kiss that goodbye too... >.<
_G.SendChatMessage = _G.ChatThrottleLib.ORIG_SendChatMessage
if _G.ChatThrottleLib.ORIG_SendAddonMessage then
_G.SendAddonMessage = _G.ChatThrottleLib.ORIG_SendAddonMessage
end
end
_G.ChatThrottleLib.ORIG_SendChatMessage = nil
_G.ChatThrottleLib.ORIG_SendAddonMessage = nil
end
if not _G.ChatThrottleLib then
_G.ChatThrottleLib = {}
end
ChatThrottleLib = _G.ChatThrottleLib -- in case some addon does "local ChatThrottleLib" above us and we're copypasted (AceComm-2, sigh)
local ChatThrottleLib = _G.ChatThrottleLib
ChatThrottleLib.version = CTL_VERSION
------------------ TWEAKABLES -----------------
ChatThrottleLib.MAX_CPS = 800 -- 2000 seems to be safe if NOTHING ELSE is happening. let's call it 800.
ChatThrottleLib.MSG_OVERHEAD = 40 -- Guesstimate overhead for sending a message; source+dest+chattype+protocolstuff
ChatThrottleLib.BURST = 4000 -- WoW's server buffer seems to be about 32KB. 8KB should be safe, but seen disconnects on _some_ servers. Using 4KB now.
ChatThrottleLib.MIN_FPS = 20 -- Reduce output CPS to half (and don't burst) if FPS drops below this value
local setmetatable = setmetatable
local table_remove = table.remove
local tostring = tostring
local GetTime = GetTime
local math_min = math.min
local math_max = math.max
local next = next
local strlen = string.len
local GetFramerate = GetFramerate
local strlower = string.lower
local unpack,type,pairs,wipe = unpack,type,pairs,wipe
local UnitInRaid,GetNumPartyMembers = UnitInRaid,GetNumPartyMembers
-----------------------------------------------------------------------
-- Double-linked ring implementation
local Ring = {}
local RingMeta = { __index = Ring }
function Ring:New()
local ret = {}
setmetatable(ret, RingMeta)
return ret
end
function Ring:Add(obj) -- Append at the "far end" of the ring (aka just before the current position)
if self.pos then
obj.prev = self.pos.prev
obj.prev.next = obj
obj.next = self.pos
obj.next.prev = obj
else
obj.next = obj
obj.prev = obj
self.pos = obj
end
end
function Ring:Remove(obj)
obj.next.prev = obj.prev
obj.prev.next = obj.next
if self.pos == obj then
self.pos = obj.next
if self.pos == obj then
self.pos = nil
end
end
end
-----------------------------------------------------------------------
-- Recycling bin for pipes
-- A pipe is a plain integer-indexed queue of messages
-- Pipes normally live in Rings of pipes (3 rings total, one per priority)
ChatThrottleLib.PipeBin = nil -- pre-v19, drastically different
local PipeBin = setmetatable({}, {__mode="k"})
local function DelPipe(pipe)
for i = #pipe, 1, -1 do
pipe[i] = nil
end
pipe.prev = nil
pipe.next = nil
PipeBin[pipe] = true
end
local function NewPipe()
local pipe = next(PipeBin)
if pipe then
wipe(pipe)
PipeBin[pipe] = nil
return pipe
end
return {}
end
-----------------------------------------------------------------------
-- Recycling bin for messages
ChatThrottleLib.MsgBin = nil -- pre-v19, drastically different
local MsgBin = setmetatable({}, {__mode="k"})
local function DelMsg(msg)
msg[1] = nil
-- there's more parameters, but they're very repetetive so the string pool doesn't suffer really, and it's faster to just not delete them.
MsgBin[msg] = true
end
local function NewMsg()
local msg = next(MsgBin)
if msg then
MsgBin[msg] = nil
return msg
end
return {}
end
-----------------------------------------------------------------------
-- ChatThrottleLib:Init
-- Initialize queues, set up frame for OnUpdate, etc
function ChatThrottleLib:Init()
-- Set up queues
if not self.Prio then
self.Prio = {}
self.Prio["ALERT"] = { ByName = {}, Ring = Ring:New(), avail = 0 }
self.Prio["NORMAL"] = { ByName = {}, Ring = Ring:New(), avail = 0 }
self.Prio["BULK"] = { ByName = {}, Ring = Ring:New(), avail = 0 }
end
-- v4: total send counters per priority
for _, Prio in pairs(self.Prio) do
Prio.nTotalSent = Prio.nTotalSent or 0
end
if not self.avail then
self.avail = 0 -- v5
end
if not self.nTotalSent then
self.nTotalSent = 0 -- v5
end
-- Set up a frame to get OnUpdate events
if not self.Frame then
self.Frame = CreateFrame("Frame")
self.Frame:Hide()
end
self.Frame:SetScript("OnUpdate", self.OnUpdate)
self.Frame:SetScript("OnEvent", self.OnEvent) -- v11: Monitor P_E_W so we can throttle hard for a few seconds
self.Frame:RegisterEvent("PLAYER_ENTERING_WORLD")
self.OnUpdateDelay = 0
self.LastAvailUpdate = GetTime()
self.HardThrottlingBeginTime = GetTime() -- v11: Throttle hard for a few seconds after startup
-- Hook SendChatMessage and SendAddonMessage so we can measure unpiped traffic and avoid overloads (v7)
if not self.securelyHooked then
-- Use secure hooks as of v16. Old regular hook support yanked out in v21.
self.securelyHooked = true
--SendChatMessage
hooksecurefunc("SendChatMessage", function(...)
return ChatThrottleLib.Hook_SendChatMessage(...)
end)
--SendAddonMessage
hooksecurefunc("SendAddonMessage", function(...)
return ChatThrottleLib.Hook_SendAddonMessage(...)
end)
end
self.nBypass = 0
end
-----------------------------------------------------------------------
-- ChatThrottleLib.Hook_SendChatMessage / .Hook_SendAddonMessage
local bMyTraffic = false
function ChatThrottleLib.Hook_SendChatMessage(text, chattype, language, destination, ...)
if bMyTraffic then
return
end
local self = ChatThrottleLib
local size = strlen(tostring(text or "")) + strlen(tostring(destination or "")) + self.MSG_OVERHEAD
self.avail = self.avail - size
self.nBypass = self.nBypass + size -- just a statistic
end
function ChatThrottleLib.Hook_SendAddonMessage(prefix, text, chattype, destination, ...)
if bMyTraffic then
return
end
local self = ChatThrottleLib
local size = tostring(text or ""):len() + tostring(prefix or ""):len();
size = size + tostring(destination or ""):len() + self.MSG_OVERHEAD
self.avail = self.avail - size
self.nBypass = self.nBypass + size -- just a statistic
end
-----------------------------------------------------------------------
-- ChatThrottleLib:UpdateAvail
-- Update self.avail with how much bandwidth is currently available
function ChatThrottleLib:UpdateAvail()
local now = GetTime()
local MAX_CPS = self.MAX_CPS;
local newavail = MAX_CPS * (now - self.LastAvailUpdate)
local avail = self.avail
if now - self.HardThrottlingBeginTime < 5 then
-- First 5 seconds after startup/zoning: VERY hard clamping to avoid irritating the server rate limiter, it seems very cranky then
avail = math_min(avail + (newavail*0.1), MAX_CPS*0.5)
self.bChoking = true
elseif GetFramerate() < self.MIN_FPS then -- GetFramerate call takes ~0.002 secs
avail = math_min(MAX_CPS, avail + newavail*0.5)
self.bChoking = true -- just a statistic
else
avail = math_min(self.BURST, avail + newavail)
self.bChoking = false
end
avail = math_max(avail, 0-(MAX_CPS*2)) -- Can go negative when someone is eating bandwidth past the lib. but we refuse to stay silent for more than 2 seconds; if they can do it, we can.
self.avail = avail
self.LastAvailUpdate = now
return avail
end
-----------------------------------------------------------------------
-- Despooling logic
-- Reminder:
-- - We have 3 Priorities, each containing a "Ring" construct ...
-- - ... made up of N "Pipe"s (1 for each destination/pipename)
-- - and each pipe contains messages
function ChatThrottleLib:Despool(Prio)
local ring = Prio.Ring
while ring.pos and Prio.avail > ring.pos[1].nSize do
local msg = table_remove(ring.pos, 1)
if not ring.pos[1] then -- did we remove last msg in this pipe?
local pipe = Prio.Ring.pos
Prio.Ring:Remove(pipe)
Prio.ByName[pipe.name] = nil
DelPipe(pipe)
else
Prio.Ring.pos = Prio.Ring.pos.next
end
local didSend=false
local lowerDest = strlower(msg[3] or "")
if lowerDest == "raid" and not UnitInRaid("player") then
-- do nothing
elseif lowerDest == "party" and GetNumPartyMembers() == 0 then
-- do nothing
else
Prio.avail = Prio.avail - msg.nSize
bMyTraffic = true
msg.f(unpack(msg, 1, msg.n))
bMyTraffic = false
Prio.nTotalSent = Prio.nTotalSent + msg.nSize
DelMsg(msg)
didSend = true
end
-- notify caller of delivery (even if we didn't send it)
if msg.callbackFn then
msg.callbackFn (msg.callbackArg, didSend)
end
-- USER CALLBACK MAY ERROR
end
end
function ChatThrottleLib.OnEvent(this,event)
-- v11: We know that the rate limiter is touchy after login. Assume that it's touchy after zoning, too.
local self = ChatThrottleLib
if event == "PLAYER_ENTERING_WORLD" then
self.HardThrottlingBeginTime = GetTime() -- Throttle hard for a few seconds after zoning
self.avail = 0
end
end
function ChatThrottleLib.OnUpdate(this,delay)
local self = ChatThrottleLib
self.OnUpdateDelay = self.OnUpdateDelay + delay
if self.OnUpdateDelay < 0.08 then
return
end
self.OnUpdateDelay = 0
self:UpdateAvail()
if self.avail < 0 then
return -- argh. some bastard is spewing stuff past the lib. just bail early to save cpu.
end
-- See how many of our priorities have queued messages (we only have 3, don't worry about the loop)
local n = 0
for prioname,Prio in pairs(self.Prio) do
if Prio.Ring.pos or Prio.avail < 0 then
n = n + 1
end
end
-- Anything queued still?
if n<1 then
-- Nope. Move spillover bandwidth to global availability gauge and clear self.bQueueing
for prioname, Prio in pairs(self.Prio) do
self.avail = self.avail + Prio.avail
Prio.avail = 0
end
self.bQueueing = false
self.Frame:Hide()
return
end
-- There's stuff queued. Hand out available bandwidth to priorities as needed and despool their queues
local avail = self.avail/n
self.avail = 0
for prioname, Prio in pairs(self.Prio) do
if Prio.Ring.pos or Prio.avail < 0 then
Prio.avail = Prio.avail + avail
if Prio.Ring.pos and Prio.avail > Prio.Ring.pos[1].nSize then
self:Despool(Prio)
-- Note: We might not get here if the user-supplied callback function errors out! Take care!
end
end
end
end
-----------------------------------------------------------------------
-- Spooling logic
function ChatThrottleLib:Enqueue(prioname, pipename, msg)
local Prio = self.Prio[prioname]
local pipe = Prio.ByName[pipename]
if not pipe then
self.Frame:Show()
pipe = NewPipe()
pipe.name = pipename
Prio.ByName[pipename] = pipe
Prio.Ring:Add(pipe)
end
pipe[#pipe + 1] = msg
self.bQueueing = true
end
function ChatThrottleLib:SendChatMessage(prio, prefix, text, chattype, language, destination, queueName, callbackFn, callbackArg)
if not self or not prio or not prefix or not text or not self.Prio[prio] then
error('Usage: ChatThrottleLib:SendChatMessage("{BULK||NORMAL||ALERT}", "prefix", "text"[, "chattype"[, "language"[, "destination"]]]', 2)
end
if callbackFn and type(callbackFn)~="function" then
error('ChatThrottleLib:ChatMessage(): callbackFn: expected function, got '..type(callbackFn), 2)
end
local nSize = text:len()
if nSize>255 then
error("ChatThrottleLib:SendChatMessage(): message length cannot exceed 255 bytes", 2)
end
nSize = nSize + self.MSG_OVERHEAD
-- Check if there's room in the global available bandwidth gauge to send directly
if not self.bQueueing and nSize < self:UpdateAvail() then
self.avail = self.avail - nSize
bMyTraffic = true
_G.SendChatMessage(text, chattype, language, destination)
bMyTraffic = false
self.Prio[prio].nTotalSent = self.Prio[prio].nTotalSent + nSize
if callbackFn then
callbackFn (callbackArg, true)
end
-- USER CALLBACK MAY ERROR
return
end
-- Message needs to be queued
local msg = NewMsg()
msg.f = _G.SendChatMessage
msg[1] = text
msg[2] = chattype or "SAY"
msg[3] = language
msg[4] = destination
msg.n = 4
msg.nSize = nSize
msg.callbackFn = callbackFn
msg.callbackArg = callbackArg
self:Enqueue(prio, queueName or (prefix..(chattype or "SAY")..(destination or "")), msg)
end
function ChatThrottleLib:SendAddonMessage(prio, prefix, text, chattype, target, queueName, callbackFn, callbackArg)
if not self or not prio or not prefix or not text or not chattype or not self.Prio[prio] then
error('Usage: ChatThrottleLib:SendAddonMessage("{BULK||NORMAL||ALERT}", "prefix", "text", "chattype"[, "target"])', 2)
end
if callbackFn and type(callbackFn)~="function" then
error('ChatThrottleLib:SendAddonMessage(): callbackFn: expected function, got '..type(callbackFn), 2)
end
local nSize = prefix:len() + 1 + text:len();
if nSize>255 then
error("ChatThrottleLib:SendAddonMessage(): prefix + message length cannot exceed 254 bytes", 2)
end
nSize = nSize + self.MSG_OVERHEAD;
-- Check if there's room in the global available bandwidth gauge to send directly
if not self.bQueueing and nSize < self:UpdateAvail() then
self.avail = self.avail - nSize
bMyTraffic = true
_G.SendAddonMessage(prefix, text, chattype, target)
bMyTraffic = false
self.Prio[prio].nTotalSent = self.Prio[prio].nTotalSent + nSize
if callbackFn then
callbackFn (callbackArg, true)
end
-- USER CALLBACK MAY ERROR
return
end
-- Message needs to be queued
local msg = NewMsg()
msg.f = _G.SendAddonMessage
msg[1] = prefix
msg[2] = text
msg[3] = chattype
msg[4] = target
msg.n = (target~=nil) and 4 or 3;
msg.nSize = nSize
msg.callbackFn = callbackFn
msg.callbackArg = callbackArg
self:Enqueue(prio, queueName or (prefix..chattype..(target or "")), msg)
end
-----------------------------------------------------------------------
-- Get the ball rolling!
ChatThrottleLib:Init()
--[[ WoWBench debugging snippet
if(WOWB_VER) then
local function SayTimer()
print("SAY: "..GetTime().." "..arg1)
end
ChatThrottleLib.Frame:SetScript("OnEvent", SayTimer)
ChatThrottleLib.Frame:RegisterEvent("CHAT_MSG_SAY")
end
]]
@@ -0,0 +1,523 @@
--
-- ChatThrottleLib by Mikk
--
-- Manages AddOn chat output to keep player from getting kicked off.
--
-- ChatThrottleLib:SendChatMessage/:SendAddonMessage functions that accept
-- a Priority ("BULK", "NORMAL", "ALERT") as well as prefix for SendChatMessage.
--
-- Priorities get an equal share of available bandwidth when fully loaded.
-- Communication channels are separated on extension+chattype+destination and
-- get round-robinned. (Destination only matters for whispers and channels,
-- obviously)
--
-- Will install hooks for SendChatMessage and SendAddonMessage to measure
-- bandwidth bypassing the library and use less bandwidth itself.
--
--
-- Fully embeddable library. Just copy this file into your addon directory,
-- add it to the .toc, and it's done.
--
-- Can run as a standalone addon also, but, really, just embed it! :-)
--
-- LICENSE: ChatThrottleLib is released into the Public Domain
--
local CTL_VERSION = 25
local _G = _G
if _G.ChatThrottleLib then
if _G.ChatThrottleLib.version >= CTL_VERSION then
-- There's already a newer (or same) version loaded. Buh-bye.
return
elseif not _G.ChatThrottleLib.securelyHooked then
print("ChatThrottleLib: Warning: There's an ANCIENT ChatThrottleLib.lua (pre-wow 2.0, <v16) in an addon somewhere. Get the addon updated or copy in a newer ChatThrottleLib.lua (>=v16) in it!")
-- ATTEMPT to unhook; this'll behave badly if someone else has hooked...
-- ... and if someone has securehooked, they can kiss that goodbye too... >.<
_G.SendChatMessage = _G.ChatThrottleLib.ORIG_SendChatMessage
if _G.ChatThrottleLib.ORIG_SendAddonMessage then
_G.SendAddonMessage = _G.ChatThrottleLib.ORIG_SendAddonMessage
end
end
_G.ChatThrottleLib.ORIG_SendChatMessage = nil
_G.ChatThrottleLib.ORIG_SendAddonMessage = nil
end
if not _G.ChatThrottleLib then
_G.ChatThrottleLib = {}
end
ChatThrottleLib = _G.ChatThrottleLib -- in case some addon does "local ChatThrottleLib" above us and we're copypasted (AceComm-2, sigh)
local ChatThrottleLib = _G.ChatThrottleLib
ChatThrottleLib.version = CTL_VERSION
------------------ TWEAKABLES -----------------
ChatThrottleLib.MAX_CPS = 800 -- 2000 seems to be safe if NOTHING ELSE is happening. let's call it 800.
ChatThrottleLib.MSG_OVERHEAD = 40 -- Guesstimate overhead for sending a message; source+dest+chattype+protocolstuff
ChatThrottleLib.BURST = 4000 -- WoW's server buffer seems to be about 32KB. 8KB should be safe, but seen disconnects on _some_ servers. Using 4KB now.
ChatThrottleLib.MIN_FPS = 20 -- Reduce output CPS to half (and don't burst) if FPS drops below this value
local setmetatable = setmetatable
local table_remove = table.remove
local tostring = tostring
local GetTime = GetTime
local math_min = math.min
local math_max = math.max
local next = next
local strlen = string.len
local GetFramerate = GetFramerate
local strlower = string.lower
local unpack,type,pairs,wipe = unpack,type,pairs,wipe
local UnitInRaid,GetNumPartyMembers = UnitInRaid,GetNumPartyMembers
-----------------------------------------------------------------------
-- Double-linked ring implementation
local Ring = {}
local RingMeta = { __index = Ring }
function Ring:New()
local ret = {}
setmetatable(ret, RingMeta)
return ret
end
function Ring:Add(obj) -- Append at the "far end" of the ring (aka just before the current position)
if self.pos then
obj.prev = self.pos.prev
obj.prev.next = obj
obj.next = self.pos
obj.next.prev = obj
else
obj.next = obj
obj.prev = obj
self.pos = obj
end
end
function Ring:Remove(obj)
obj.next.prev = obj.prev
obj.prev.next = obj.next
if self.pos == obj then
self.pos = obj.next
if self.pos == obj then
self.pos = nil
end
end
end
-----------------------------------------------------------------------
-- Recycling bin for pipes
-- A pipe is a plain integer-indexed queue of messages
-- Pipes normally live in Rings of pipes (3 rings total, one per priority)
ChatThrottleLib.PipeBin = nil -- pre-v19, drastically different
local PipeBin = setmetatable({}, {__mode="k"})
local function DelPipe(pipe)
for i = #pipe, 1, -1 do
pipe[i] = nil
end
pipe.prev = nil
pipe.next = nil
PipeBin[pipe] = true
end
local function NewPipe()
local pipe = next(PipeBin)
if pipe then
wipe(pipe)
PipeBin[pipe] = nil
return pipe
end
return {}
end
-----------------------------------------------------------------------
-- Recycling bin for messages
ChatThrottleLib.MsgBin = nil -- pre-v19, drastically different
local MsgBin = setmetatable({}, {__mode="k"})
local function DelMsg(msg)
msg[1] = nil
-- there's more parameters, but they're very repetetive so the string pool doesn't suffer really, and it's faster to just not delete them.
MsgBin[msg] = true
end
local function NewMsg()
local msg = next(MsgBin)
if msg then
MsgBin[msg] = nil
return msg
end
return {}
end
-----------------------------------------------------------------------
-- ChatThrottleLib:Init
-- Initialize queues, set up frame for OnUpdate, etc
function ChatThrottleLib:Init()
-- Set up queues
if not self.Prio then
self.Prio = {}
self.Prio["ALERT"] = { ByName = {}, Ring = Ring:New(), avail = 0 }
self.Prio["NORMAL"] = { ByName = {}, Ring = Ring:New(), avail = 0 }
self.Prio["BULK"] = { ByName = {}, Ring = Ring:New(), avail = 0 }
end
-- v4: total send counters per priority
for _, Prio in pairs(self.Prio) do
Prio.nTotalSent = Prio.nTotalSent or 0
end
if not self.avail then
self.avail = 0 -- v5
end
if not self.nTotalSent then
self.nTotalSent = 0 -- v5
end
-- Set up a frame to get OnUpdate events
if not self.Frame then
self.Frame = CreateFrame("Frame")
self.Frame:Hide()
end
self.Frame:SetScript("OnUpdate", self.OnUpdate)
self.Frame:SetScript("OnEvent", self.OnEvent) -- v11: Monitor P_E_W so we can throttle hard for a few seconds
self.Frame:RegisterEvent("PLAYER_ENTERING_WORLD")
self.OnUpdateDelay = 0
self.LastAvailUpdate = GetTime()
self.HardThrottlingBeginTime = GetTime() -- v11: Throttle hard for a few seconds after startup
-- Hook SendChatMessage and SendAddonMessage so we can measure unpiped traffic and avoid overloads (v7)
if not self.securelyHooked then
-- Use secure hooks as of v16. Old regular hook support yanked out in v21.
self.securelyHooked = true
--SendChatMessage
hooksecurefunc("SendChatMessage", function(...)
return ChatThrottleLib.Hook_SendChatMessage(...)
end)
--SendAddonMessage
hooksecurefunc("SendAddonMessage", function(...)
return ChatThrottleLib.Hook_SendAddonMessage(...)
end)
end
self.nBypass = 0
end
-----------------------------------------------------------------------
-- ChatThrottleLib.Hook_SendChatMessage / .Hook_SendAddonMessage
local bMyTraffic = false
function ChatThrottleLib.Hook_SendChatMessage(text, chattype, language, destination, ...)
if bMyTraffic then
return
end
local self = ChatThrottleLib
local size = strlen(tostring(text or "")) + strlen(tostring(destination or "")) + self.MSG_OVERHEAD
self.avail = self.avail - size
self.nBypass = self.nBypass + size -- just a statistic
end
function ChatThrottleLib.Hook_SendAddonMessage(prefix, text, chattype, destination, ...)
if bMyTraffic then
return
end
local self = ChatThrottleLib
local size = tostring(text or ""):len() + tostring(prefix or ""):len();
size = size + tostring(destination or ""):len() + self.MSG_OVERHEAD
self.avail = self.avail - size
self.nBypass = self.nBypass + size -- just a statistic
end
-----------------------------------------------------------------------
-- ChatThrottleLib:UpdateAvail
-- Update self.avail with how much bandwidth is currently available
function ChatThrottleLib:UpdateAvail()
local now = GetTime()
local MAX_CPS = self.MAX_CPS;
local newavail = MAX_CPS * (now - self.LastAvailUpdate)
local avail = self.avail
if now - self.HardThrottlingBeginTime < 5 then
-- First 5 seconds after startup/zoning: VERY hard clamping to avoid irritating the server rate limiter, it seems very cranky then
avail = math_min(avail + (newavail*0.1), MAX_CPS*0.5)
self.bChoking = true
elseif GetFramerate() < self.MIN_FPS then -- GetFramerate call takes ~0.002 secs
avail = math_min(MAX_CPS, avail + newavail*0.5)
self.bChoking = true -- just a statistic
else
avail = math_min(self.BURST, avail + newavail)
self.bChoking = false
end
avail = math_max(avail, 0-(MAX_CPS*2)) -- Can go negative when someone is eating bandwidth past the lib. but we refuse to stay silent for more than 2 seconds; if they can do it, we can.
self.avail = avail
self.LastAvailUpdate = now
return avail
end
-----------------------------------------------------------------------
-- Despooling logic
-- Reminder:
-- - We have 3 Priorities, each containing a "Ring" construct ...
-- - ... made up of N "Pipe"s (1 for each destination/pipename)
-- - and each pipe contains messages
function ChatThrottleLib:Despool(Prio)
local ring = Prio.Ring
while ring.pos and Prio.avail > ring.pos[1].nSize do
local msg = table_remove(ring.pos, 1)
if not ring.pos[1] then -- did we remove last msg in this pipe?
local pipe = Prio.Ring.pos
Prio.Ring:Remove(pipe)
Prio.ByName[pipe.name] = nil
DelPipe(pipe)
else
Prio.Ring.pos = Prio.Ring.pos.next
end
local didSend=false
local lowerDest = strlower(msg[3] or "")
if lowerDest == "raid" and not UnitInRaid("player") then
-- do nothing
elseif lowerDest == "party" and GetNumPartyMembers() == 0 then
-- do nothing
else
Prio.avail = Prio.avail - msg.nSize
bMyTraffic = true
msg.f(unpack(msg, 1, msg.n))
bMyTraffic = false
Prio.nTotalSent = Prio.nTotalSent + msg.nSize
DelMsg(msg)
didSend = true
end
-- notify caller of delivery (even if we didn't send it)
if msg.callbackFn then
msg.callbackFn (msg.callbackArg, didSend)
end
-- USER CALLBACK MAY ERROR
end
end
function ChatThrottleLib.OnEvent(this,event)
-- v11: We know that the rate limiter is touchy after login. Assume that it's touchy after zoning, too.
local self = ChatThrottleLib
if event == "PLAYER_ENTERING_WORLD" then
self.HardThrottlingBeginTime = GetTime() -- Throttle hard for a few seconds after zoning
self.avail = 0
end
end
function ChatThrottleLib.OnUpdate(this,delay)
local self = ChatThrottleLib
self.OnUpdateDelay = self.OnUpdateDelay + delay
if self.OnUpdateDelay < 0.08 then
return
end
self.OnUpdateDelay = 0
self:UpdateAvail()
if self.avail < 0 then
return -- argh. some bastard is spewing stuff past the lib. just bail early to save cpu.
end
-- See how many of our priorities have queued messages (we only have 3, don't worry about the loop)
local n = 0
for prioname,Prio in pairs(self.Prio) do
if Prio.Ring.pos or Prio.avail < 0 then
n = n + 1
end
end
-- Anything queued still?
if n<1 then
-- Nope. Move spillover bandwidth to global availability gauge and clear self.bQueueing
for prioname, Prio in pairs(self.Prio) do
self.avail = self.avail + Prio.avail
Prio.avail = 0
end
self.bQueueing = false
self.Frame:Hide()
return
end
-- There's stuff queued. Hand out available bandwidth to priorities as needed and despool their queues
local avail = self.avail/n
self.avail = 0
for prioname, Prio in pairs(self.Prio) do
if Prio.Ring.pos or Prio.avail < 0 then
Prio.avail = Prio.avail + avail
if Prio.Ring.pos and Prio.avail > Prio.Ring.pos[1].nSize then
self:Despool(Prio)
-- Note: We might not get here if the user-supplied callback function errors out! Take care!
end
end
end
end
-----------------------------------------------------------------------
-- Spooling logic
function ChatThrottleLib:Enqueue(prioname, pipename, msg)
local Prio = self.Prio[prioname]
local pipe = Prio.ByName[pipename]
if not pipe then
self.Frame:Show()
pipe = NewPipe()
pipe.name = pipename
Prio.ByName[pipename] = pipe
Prio.Ring:Add(pipe)
end
pipe[#pipe + 1] = msg
self.bQueueing = true
end
function ChatThrottleLib:SendChatMessage(prio, prefix, text, chattype, language, destination, queueName, callbackFn, callbackArg)
if not self or not prio or not prefix or not text or not self.Prio[prio] then
error('Usage: ChatThrottleLib:SendChatMessage("{BULK||NORMAL||ALERT}", "prefix", "text"[, "chattype"[, "language"[, "destination"]]]', 2)
end
if callbackFn and type(callbackFn)~="function" then
error('ChatThrottleLib:ChatMessage(): callbackFn: expected function, got '..type(callbackFn), 2)
end
local nSize = text:len()
if nSize>255 then
error("ChatThrottleLib:SendChatMessage(): message length cannot exceed 255 bytes", 2)
end
nSize = nSize + self.MSG_OVERHEAD
-- Check if there's room in the global available bandwidth gauge to send directly
if not self.bQueueing and nSize < self:UpdateAvail() then
self.avail = self.avail - nSize
bMyTraffic = true
_G.SendChatMessage(text, chattype, language, destination)
bMyTraffic = false
self.Prio[prio].nTotalSent = self.Prio[prio].nTotalSent + nSize
if callbackFn then
callbackFn (callbackArg, true)
end
-- USER CALLBACK MAY ERROR
return
end
-- Message needs to be queued
local msg = NewMsg()
msg.f = _G.SendChatMessage
msg[1] = text
msg[2] = chattype or "SAY"
msg[3] = language
msg[4] = destination
msg.n = 4
msg.nSize = nSize
msg.callbackFn = callbackFn
msg.callbackArg = callbackArg
self:Enqueue(prio, queueName or (prefix..(chattype or "SAY")..(destination or "")), msg)
end
function ChatThrottleLib:SendAddonMessage(prio, prefix, text, chattype, target, queueName, callbackFn, callbackArg)
if not self or not prio or not prefix or not text or not chattype or not self.Prio[prio] then
error('Usage: ChatThrottleLib:SendAddonMessage("{BULK||NORMAL||ALERT}", "prefix", "text", "chattype"[, "target"])', 2)
end
if callbackFn and type(callbackFn)~="function" then
error('ChatThrottleLib:SendAddonMessage(): callbackFn: expected function, got '..type(callbackFn), 2)
end
local nSize = prefix:len() + 1 + text:len();
if nSize>255 then
error("ChatThrottleLib:SendAddonMessage(): prefix + message length cannot exceed 254 bytes", 2)
end
nSize = nSize + self.MSG_OVERHEAD;
-- Check if there's room in the global available bandwidth gauge to send directly
if not self.bQueueing and nSize < self:UpdateAvail() then
self.avail = self.avail - nSize
bMyTraffic = true
_G.SendAddonMessage(prefix, text, chattype, target)
bMyTraffic = false
self.Prio[prio].nTotalSent = self.Prio[prio].nTotalSent + nSize
if callbackFn then
callbackFn (callbackArg, true)
end
-- USER CALLBACK MAY ERROR
return
end
-- Message needs to be queued
local msg = NewMsg()
msg.f = _G.SendAddonMessage
msg[1] = prefix
msg[2] = text
msg[3] = chattype
msg[4] = target
msg.n = (target~=nil) and 4 or 3;
msg.nSize = nSize
msg.callbackFn = callbackFn
msg.callbackArg = callbackArg
self:Enqueue(prio, queueName or (prefix..chattype..(target or "")), msg)
end
-----------------------------------------------------------------------
-- Get the ball rolling!
ChatThrottleLib:Init()
--[[ WoWBench debugging snippet
if(WOWB_VER) then
local function SayTimer()
print("SAY: "..GetTime().." "..arg1)
end
ChatThrottleLib.Frame:SetScript("OnEvent", SayTimer)
ChatThrottleLib.Frame:RegisterEvent("CHAT_MSG_SAY")
end
]]
@@ -0,0 +1,6 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Script file="ChatThrottleLib.lua" />
<Script file="LibHealComm-4.0.lua" />
</Ui>
@@ -0,0 +1,3 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="ChatThrottleLib.lua" />
</Ui>
@@ -0,0 +1,58 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Script file="Util\Constants.lua" />
<Script file="Util\SoundKit.lua" />
<Script file="Util\C_TimerAugment.lua" />
<Script file="Util\EventHandler.lua" />
<Script file="Util\EventHandlerSupport.lua" />
<Script file="Util\Unit.lua" />
<Script file="Util\Cooldown.lua" />
<Script file="Util\Group.lua" />
<Script file="Util\Spell.lua" />
<Script file="Util\HealPrediction.lua" />
<Script file="Util\C_CreatureInfo.lua" />
<Script file="Util\C_FriendList.lua" />
<Script file="Util\C_IncomingSummon.lua" />
<Script file="Util\C_Map.lua" />
<Script file="Util\C_PvP.lua" />
<Script file="Util\C_Texture.lua" />
<Script file="Util\C_Talent.lua" />
<Script file="Util\C_VoiceChat.lua" />
<Script file="Util\C_NamePlate.lua" />
<Script file="Util\C_GossipInfo.lua" />
<Script file="Util\C_ChatInfo.lua" />
<Script file="Util\C_Spell.lua" />
<Script file="Util\C_Item.lua" />
<Script file="Util\C_UI.lua" />
<Script file="Util\C_NewItems.lua" />
<Script file="Util\Mixin.lua" />
<Script file="Util\Pools.lua" />
<Script file="Util\Color.lua" />
<Script file="Util\ColorUtil.lua" />
<Script file="Util\API.lua" />
<Script file="Util\TableUtil.lua" />
<Script file="Util\MathUtil.lua" />
<Script file="Util\EnumUtil.lua" />
<Script file="Util\Atlas.lua" />
<Script file="Util\SharedExtendedMethods.lua" />
<Script file="Util\PartyUtil.lua" />
<Script file="Util\PixelUtil.lua" />
<Script file="Util\AuraUtil.lua" />
<Script file="Util\Aura.lua" />
<Script file="Util\NineSlice.lua" />
<Script file="Util\TextureUtil.lua" />
<Script file="Util\SmoothStatusBar.lua" />
<Script file="Util\CallbackRegistry.lua" />
<Script file="Util\GlobalCallbackRegistry.lua" />
<Script file="Util\SpellUtil.lua" />
<Script file="Util\ItemUtil.lua" />
<Script file="Util\AddOnCompat.lua" />
<!-- Templates -->
<Include file="Templates\Load.xml" />
</Ui>
@@ -0,0 +1,455 @@
BackdropTemplateMixin = BackdropTemplateMixin or {}
BACKDROP_TOOLTIP_8_8_1111 = {
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
tile = true,
tileEdge = true,
tileSize = 8,
edgeSize = 8,
insets = { left = 1, right = 1, top = 1, bottom = 1 },
};
BACKDROP_TOOLTIP_8_12_1111 = {
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
tile = true,
tileEdge = true,
tileSize = 8,
edgeSize = 12,
insets = { left = 1, right = 1, top = 1, bottom = 1 },
};
BACKDROP_TOOLTIP_16_16_5555 = {
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
tile = true,
tileEdge = true,
tileSize = 16,
edgeSize = 16,
insets = { left = 5, right = 5, top = 5, bottom = 5 },
};
BACKDROP_TOOLTIP_12_12_4444 = {
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
tile = true,
tileEdge = true,
tileSize = 12,
edgeSize = 12,
insets = { left = 4, right = 4, top = 4, bottom = 4 },
};
BACKDROP_TOOLTIP_0_16 = {
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
edgeSize = 16,
tileEdge = true,
};
BACKDROP_TOOLTIP_0_12_0055 = {
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
edgeSize = 12,
tileEdge = true,
insets = { left = 0, right = 0, top = 5, bottom = 5 },
};
BACKDROP_TOOLTIP_0_16_5555 = {
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
edgeSize = 16,
tileEdge = true,
insets = { left = 5, right = 5, top = 5, bottom = 5 },
};
BACKDROP_ACHIEVEMENTS_0_64 = {
edgeFile = "Interface\\AchievementFrame\\UI-Achievement-WoodBorder",
edgeSize = 64,
tileEdge = true,
};
BACKDROP_ARENA_32_32 = {
bgFile = "Interface\\CharacterFrame\\UI-Party-Background",
edgeFile = "Interface\\ArenaEnemyFrame\\UI-Arena-Border",
tile = true,
tileEdge = true,
tileSize = 32,
edgeSize = 32,
insets = { left = 32, right = 32, top = 32, bottom = 32 },
};
BACKDROP_DIALOG_32_32 = {
bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
tile = true,
tileEdge = true,
tileSize = 32,
edgeSize = 32,
insets = { left = 11, right = 12, top = 12, bottom = 11 },
};
BACKDROP_GOLD_DIALOG_32_32 = {
bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Gold-Border",
tile = true,
tileEdge = true,
tileSize = 32,
edgeSize = 32,
insets = { left = 11, right = 12, top = 12, bottom = 11 },
};
BACKDROP_WATERMARK_DIALOG_0_16 = {
edgeFile = "Interface\\DialogFrame\\UI-DialogBox-TestWatermark-Border",
tileEdge = true,
edgeSize = 16,
};
BACKDROP_SLIDER_8_8 = {
bgFile = "Interface\\Buttons\\UI-SliderBar-Background",
edgeFile = "Interface\\Buttons\\UI-SliderBar-Border",
tile = true,
tileEdge = true,
tileSize = 8,
edgeSize = 8,
insets = { left = 3, right = 3, top = 6, bottom = 6 },
};
BACKDROP_PARTY_32_32 = {
bgFile = "Interface\\CharacterFrame\\UI-Party-Background",
edgeFile = "Interface\\CharacterFrame\\UI-Party-Border",
tile = true,
tileEdge = true,
tileSize = 32,
edgeSize = 32,
insets = { left = 32, right = 32, top = 32, bottom = 32 },
};
BACKDROP_TOAST_12_12 = {
bgFile = "Interface\\FriendsFrame\\UI-Toast-Background",
edgeFile = "Interface\\FriendsFrame\\UI-Toast-Border",
tile = true,
tileEdge = true,
tileSize = 12,
edgeSize = 12,
insets = { left = 5, right = 5, top = 5, bottom = 5 },
};
BACKDROP_CALLOUT_GLOW_0_16 = {
edgeFile = "Interface\\TutorialFrame\\UI-TutorialFrame-CalloutGlow",
edgeSize = 16,
tileEdge = true,
};
BACKDROP_CALLOUT_GLOW_0_20 = {
edgeFile = "Interface\\TutorialFrame\\UI-TutorialFrame-CalloutGlow",
edgeSize = 20,
tileEdge = true,
};
BACKDROP_GLUE_TOOLTIP_16_16 = {
bgFile = "Interface\\Glues\\Common\\Glue-Tooltip-Background",
edgeFile = "Interface\\Glues\\Common\\Glue-Tooltip-Border",
tile = true,
tileEdge = true,
tileSize = 16,
edgeSize = 16,
insets = { left = 10, right = 5, top = 4, bottom = 9 },
};
BACKDROP_GLUE_TOOLTIP_0_16 = {
edgeFile = "Interface\\Glues\\Common\\Glue-Tooltip-Border",
tileEdge = true,
edgeSize = 16,
};
BACKDROP_MIXED_TOOLTIP_16_16 = {
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
edgeFile = "Interface\\Glues\\Common\\Glue-Tooltip-Border",
tile = true,
tileEdge = true,
tileSize = 16,
edgeSize = 16,
insets = { left = 10, right = 5, top = 4, bottom = 9 },
};
BACKDROP_TEXT_PANEL_0_16 = {
edgeFile = "Interface\\Glues\\Common\\TextPanel-Border",
tileEdge = true,
edgeSize = 16,
};
local coordStart = 0.0625;
local coordEnd = 1 - coordStart;
local textureUVs = { -- keys have to match pieceNames in nineSliceSetup table
TopLeftCorner = { setWidth = true, setHeight = true, ULx = 0.5078125, ULy = coordStart, LLx = 0.5078125, LLy = coordEnd, URx = 0.6171875, URy = coordStart, LRx = 0.6171875, LRy = coordEnd },
TopRightCorner = { setWidth = true, setHeight = true, ULx = 0.6328125, ULy = coordStart, LLx = 0.6328125, LLy = coordEnd, URx = 0.7421875, URy = coordStart, LRx = 0.7421875, LRy = coordEnd },
BottomLeftCorner = { setWidth = true, setHeight = true, ULx = 0.7578125, ULy = coordStart, LLx = 0.7578125, LLy = coordEnd, URx = 0.8671875, URy = coordStart, LRx = 0.8671875, LRy = coordEnd },
BottomRightCorner = { setWidth = true, setHeight = true, ULx = 0.8828125, ULy = coordStart, LLx = 0.8828125, LLy = coordEnd, URx = 0.9921875, URy = coordStart, LRx = 0.9921875, LRy = coordEnd },
TopEdge = { setHeight = true, ULx = 0.2578125, ULy = "repeatX", LLx = 0.3671875, LLy = "repeatX", URx = 0.2578125, URy = coordStart, LRx = 0.3671875, LRy = coordStart },
BottomEdge = { setHeight = true, ULx = 0.3828125, ULy = "repeatX", LLx = 0.4921875, LLy = "repeatX", URx = 0.3828125, URy = coordStart, LRx = 0.4921875, LRy = coordStart },
LeftEdge = { setWidth = true, ULx = 0.0078125, ULy = coordStart, LLx = 0.0078125, LLy = "repeatY", URx = 0.1171875, URy = coordStart, LRx = 0.1171875, LRy = "repeatY" },
RightEdge = { setWidth = true, ULx = 0.1328125, ULy = coordStart, LLx = 0.1328125, LLy = "repeatY", URx = 0.2421875, URy = coordStart, LRx = 0.2421875, LRy = "repeatY" },
Center = { ULx = 0, ULy = 0, LLx = 0, LLy = "repeatY", URx = "repeatX", URy = 0, LRx = "repeatX", LRy = "repeatY" },
};
local defaultEdgeSize = 39; -- the old default
function BackdropTemplateMixin:OnBackdropLoaded()
if self.backdropInfo then
-- check for invalid info
if not self.backdropInfo.edgeFile and not self.backdropInfo.bgFile then
self.backdropInfo = nil;
return;
end
self:ApplyBackdrop();
do
if self.backdropColor then
local r, g, b = 1, 1, 1;
r, g, b = self.backdropColor:GetRGB();
local a = self.backdropColorAlpha or 1;
self:SetBackdropColor(r, g, b, a);
end
end
do
if self.backdropBorderColor then
local r, g, b = 1, 1, 1;
r, g, b = self.backdropBorderColor:GetRGB();
local a = self.backdropBorderColorAlpha or 1;
self:SetBackdropBorderColor(r, g, b, a);
end
end
if self.backdropBorderBlendMode then
self:SetBorderBlendMode(self.backdropBorderBlendMode);
end
end
end
function BackdropTemplateMixin:OnBackdropSizeChanged()
if self.backdropInfo then
self:SetupTextureCoordinates();
end
end
function BackdropTemplateMixin:GetEdgeSize()
if self.backdropInfo.edgeSize and self.backdropInfo.edgeSize > 0 then
return self.backdropInfo.edgeSize;
else
return defaultEdgeSize;
end
end
local function GetBackdropCoordValue(coord, pieceSetup, repeatX, repeatY)
local value = pieceSetup[coord];
if value == "repeatX" then
return repeatX;
elseif value == "repeatY" then
return repeatY;
else
return value;
end
end
local function SetupBackdropTextureCoordinates(region, pieceSetup, repeatX, repeatY)
region:SetTexCoord( GetBackdropCoordValue("ULx", pieceSetup, repeatX, repeatY), GetBackdropCoordValue("ULy", pieceSetup, repeatX, repeatY),
GetBackdropCoordValue("LLx", pieceSetup, repeatX, repeatY), GetBackdropCoordValue("LLy", pieceSetup, repeatX, repeatY),
GetBackdropCoordValue("URx", pieceSetup, repeatX, repeatY), GetBackdropCoordValue("URy", pieceSetup, repeatX, repeatY),
GetBackdropCoordValue("LRx", pieceSetup, repeatX, repeatY), GetBackdropCoordValue("LRy", pieceSetup, repeatX, repeatY));
end
function BackdropTemplateMixin:SetupTextureCoordinates()
local width = self:GetWidth();
local height = self:GetHeight();
local effectiveScale = self:GetEffectiveScale();
local edgeSize = self:GetEdgeSize();
local edgeRepeatX = max(0, (width / edgeSize) * effectiveScale - 2 - coordStart);
local edgeRepeatY = max(0, (height / edgeSize) * effectiveScale - 2 - coordStart);
for pieceName, pieceSetup in pairs(textureUVs) do
local region = self[pieceName];
if region then
if pieceName == "Center" then
local repeatX = 1;
local repeatY = 1;
if self.backdropInfo.tile then
local divisor = self.backdropInfo.tileSize;
if not divisor or divisor == 0 then
divisor = edgeSize;
end
if divisor ~= 0 then
repeatX = (width / divisor) * effectiveScale;
repeatY = (height / divisor) * effectiveScale;
end
end
SetupBackdropTextureCoordinates(region, pieceSetup, repeatX, repeatY);
else
SetupBackdropTextureCoordinates(region, pieceSetup, edgeRepeatX, edgeRepeatY);
end
end
end
end
function BackdropTemplateMixin:SetupPieceVisuals(piece, setupInfo, pieceLayout)
local textureInfo = textureUVs[setupInfo.pieceName];
local tileVerts = false;
local file;
if setupInfo.pieceName == "Center" then
file = self.backdropInfo.bgFile;
tileVerts = self.backdropInfo.tile;
else
if self.backdropInfo.tileEdge ~= false then
tileVerts = true;
end
file = self.backdropInfo.edgeFile;
end
piece:SetTexture(file, tileVerts, tileVerts);
local cornerWidth = textureInfo.setWidth and self:GetEdgeSize() or 0;
local cornerHeight = textureInfo.setHeight and self:GetEdgeSize() or 0;
piece:SetSize(cornerWidth, cornerHeight);
end
function BackdropTemplateMixin:SetBorderBlendMode(blendMode)
if not self.backdropInfo then
return;
end
for pieceName in pairs(textureUVs) do
local region = self[pieceName];
if region and pieceName ~= "Center" then
region:SetBlendMode(blendMode);
end
end
end
function BackdropTemplateMixin:HasBackdropInfo(backdropInfo)
return self.backdropInfo == backdropInfo;
end
function BackdropTemplateMixin:ClearBackdrop()
if self.backdropInfo then
for pieceName in pairs(textureUVs) do
local region = self[pieceName];
if region then
region:SetTexture(nil);
end
end
self.backdropInfo = nil;
end
end
function BackdropTemplateMixin:ApplyBackdrop()
local x, y, x1, y1 = 0, 0, 0, 0;
if self.backdropInfo.bgFile then
local edgeSize = self:GetEdgeSize();
x = -edgeSize;
y = edgeSize;
x1 = edgeSize;
y1 = -edgeSize;
local insets = self.backdropInfo.insets;
if insets then
x = x + (insets.left or 0);
y = y - (insets.top or 0);
x1 = x1 - (insets.right or 0);
y1 = y1 + (insets.bottom or 0);
end
end
local layout = {
TopLeftCorner = { },
TopRightCorner = { },
BottomLeftCorner = { },
BottomRightCorner = { },
TopEdge = { },
BottomEdge = { },
LeftEdge = { },
RightEdge = { },
Center = { layer = "BACKGROUND", x = x, y = y, x1 = x1, y1 = y1 },
setupPieceVisualsFunction = BackdropTemplateMixin.SetupPieceVisuals,
};
NineSliceUtil.ApplyLayout(self, layout);
--self:SetBackdropColor(1, 1, 1, 1);
--self:SetBackdropBorderColor(1, 1, 1, 1);
self:SetupTextureCoordinates();
end
-- backwards compatibility API starts here
function BackdropTemplateMixin:SetBackdrop(backdropInfo)
if backdropInfo then
if self:HasBackdropInfo(backdropInfo) then
return;
end
if not backdropInfo.edgeFile and not backdropInfo.bgFile then
self:ClearBackdrop();
return;
end
self.backdropInfo = backdropInfo;
self:ApplyBackdrop();
else
self:ClearBackdrop();
end
end
function BackdropTemplateMixin:GetBackdrop()
if self.backdropInfo then
-- make a copy because it will be altered to match old API output
local backdropInfo = CopyTable(self.backdropInfo);
-- fill in defaults
if not backdropInfo.bgFile then
backdropInfo.bgFile = "";
end
if not backdropInfo.edgeFile then
backdropInfo.edgeFile = "";
end
if backdropInfo.tile == nil then
backdropInfo.tile = false;
end
if backdropInfo.tileSize == nil then
backdropInfo.tileSize = 0;
end
if backdropInfo.tileEdge == nil then
backdropInfo.tileEdge = true;
end
if not backdropInfo.edgeSize then
backdropInfo.edgeSize = self:GetEdgeSize();
end
if not backdropInfo.insets then
backdropInfo.insets = { };
end
if not backdropInfo.insets.left then
backdropInfo.insets.left = 0;
end
if not backdropInfo.insets.right then
backdropInfo.insets.right = 0;
end
if not backdropInfo.insets.top then
backdropInfo.insets.top = 0;
end
if not backdropInfo.insets.bottom then
backdropInfo.insets.bottom = 0;
end
return backdropInfo;
end
return nil;
end
function BackdropTemplateMixin:GetBackdropColor()
if not self.backdropInfo then
return;
end
if self.Center then
return self.Center:GetVertexColor();
end
end
function BackdropTemplateMixin:SetBackdropColor(r, g, b, a)
if not self.backdropInfo then
-- Ideally this would throw an error here but the old API just failed silently
return;
end
if self.Center then
self.Center:SetVertexColor(r, g, b, a or 1);
end
end
function BackdropTemplateMixin:GetBackdropBorderColor()
if not self.backdropInfo then
return
end
-- return the vertex color of any valid region
for pieceName in pairs(textureUVs) do
local region = self[pieceName];
if region and pieceName ~= "Center" then
return region:GetVertexColor();
end
end
end
function BackdropTemplateMixin:SetBackdropBorderColor(r, g, b, a)
if not self.backdropInfo then
-- Ideally this would throw an error here but the old API just failed silently
return;
end
for pieceName in pairs(textureUVs) do
local region = self[pieceName];
if region and pieceName ~= "Center" then
region:SetVertexColor(r, g, b, a or 1);
end
end
end
@@ -0,0 +1,15 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Script file="Backdrop.lua" />
<Frame name="BackdropTemplate" virtual="true">
<Scripts>
<OnLoad>
Mixin(self, BackdropTemplateMixin)
</OnLoad>
<OnSizeChanged>
self:OnBackdropLoaded()
self:OnBackdropSizeChanged()
</OnSizeChanged>
</Scripts>
</Frame>
</Ui>
@@ -0,0 +1,33 @@
-- Simplified Menu Display System
-- This is a basic system for displaying a menu from a structure table.
--
-- See UIDropDownMenu.lua for the menuList details.
--
-- Args:
-- menuList - menu table
-- menuFrame - the UI frame to populate
-- anchor - where to anchor the frame (e.g. CURSOR)
-- x - x offset
-- y - y offset
-- displayMode - border type
-- autoHideDelay - how long until the menu disappears
--
--
function C_EasyMenu(menuList, menuFrame, anchor, x, y, displayMode, autoHideDelay )
if ( displayMode == "MENU" ) then
menuFrame.displayMode = displayMode;
end
C_UIDropDownMenu_Initialize(menuFrame, EasyMenu_Initialize, displayMode, nil, menuList);
C_ToggleDropDownMenu(1, nil, menuFrame, anchor, x, y, menuList);
end
function C_EasyMenu_Initialize( frame, level, menuList )
for index = 1, #menuList do
local value = menuList[index]
if (value.text) then
value.index = index;
C_UIDropDownMenu_AddButton( value, level );
end
end
end
@@ -0,0 +1,371 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Button name="C_UIDropDownMenuButtonTemplate" virtual="true">
<Size x="100" y="16"/>
<Layers>
<Layer level="BACKGROUND">
<Texture name="$parentHighlight" file="Interface\QuestFrame\UI-QuestTitleHighlight" alphaMode="ADD" setAllPoints="true" hidden="true"/>
</Layer>
<Layer level="ARTWORK">
<Texture name="$parentCheck" file="Interface\Buttons\UI-CheckBox-Check">
<Size x="18" y="18"/>
<Anchors>
<Anchor point="LEFT">
<Offset x="0" y="0"/>
</Anchor>
</Anchors>
</Texture>
<Texture name="$parentIcon" hidden="true">
<Size>
<AbsDimension x="16" y="16"/>
</Size>
<Anchors>
<Anchor point="RIGHT">
<Offset x="0" y="0"/>
</Anchor>
</Anchors>
</Texture>
</Layer>
</Layers>
<Frames>
<Button name="$parentColorSwatch" hidden="true">
<Size>
<AbsDimension x="16" y="16"/>
</Size>
<Anchors>
<Anchor point="RIGHT">
<Offset>
<AbsDimension x="-6" y="0"/>
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer level="BACKGROUND">
<Texture name="$parentSwatchBg">
<Size>
<AbsDimension x="14" y="14"/>
</Size>
<Anchors>
<Anchor point="CENTER">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
<Color r="1.0" g="1.0" b="1.0"/>
</Texture>
</Layer>
</Layers>
<Scripts>
<OnClick>
CloseMenus();
C_UIDropDownMenuButton_OpenColorPicker(self:GetParent());
</OnClick>
<OnEnter>
C_CloseDropDownMenus(self:GetParent():GetParent():GetID() + 1);
_G[self:GetName().."SwatchBg"]:SetVertexColor(NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b);
C_UIDropDownMenu_StopCounting(self:GetParent():GetParent());
</OnEnter>
<OnLeave>
_G[self:GetName().."SwatchBg"]:SetVertexColor(HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b);
C_UIDropDownMenu_StartCounting(self:GetParent():GetParent());
</OnLeave>
</Scripts>
<NormalTexture name="$parentNormalTexture" file="Interface\ChatFrame\ChatFrameColorSwatch"/>
</Button>
<Button name="$parentExpandArrow" hidden="true">
<Size>
<AbsDimension x="16" y="16"/>
</Size>
<Anchors>
<Anchor point="RIGHT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick>
C_ToggleDropDownMenu(self:GetParent():GetParent():GetID() + 1, self:GetParent().value, nil, nil, nil, nil, self:GetParent().menuList, self);
</OnClick>
<OnEnter>
local level = self:GetParent():GetParent():GetID() + 1;
local listFrame = _G["C_DropDownList"..level];
if ( not listFrame or not listFrame:IsShown() or select(2, listFrame:GetPoint()) ~= self ) then
C_ToggleDropDownMenu(level, self:GetParent().value, nil, nil, nil, nil, self:GetParent().menuList, self);
end
C_UIDropDownMenu_StopCounting(self:GetParent():GetParent());
</OnEnter>
<OnLeave>
C_UIDropDownMenu_StartCounting(self:GetParent():GetParent());
</OnLeave>
</Scripts>
<NormalTexture file="Interface\ChatFrame\ChatFrameExpandArrow"/>
</Button>
<Button name="$parentInvisibleButton" hidden="true">
<Anchors>
<Anchor point="TOPLEFT"/>
<Anchor point="BOTTOMLEFT"/>
<Anchor point="RIGHT" relativeTo="$parentColorSwatch" relativePoint="LEFT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnEnter>
C_UIDropDownMenu_StopCounting(self:GetParent():GetParent());
C_CloseDropDownMenus(self:GetParent():GetParent():GetID() + 1);
local parent = self:GetParent();
if ( parent.tooltipTitle and parent.tooltipWhileDisabled) then
if ( parent.tooltipOnButton ) then
GameTooltip:SetOwner(parent, "ANCHOR_RIGHT");
GameTooltip:AddLine(parent.tooltipTitle, 1.0, 1.0, 1.0);
GameTooltip:AddLine(parent.tooltipText);
GameTooltip:Show();
else
GameTooltip_AddNewbieTip(parent, parent.tooltipTitle, 1.0, 1.0, 1.0, parent.tooltipText, 1);
end
end
</OnEnter>
<OnLeave>
C_UIDropDownMenu_StartCounting(self:GetParent():GetParent());
GameTooltip:Hide();
</OnLeave>
</Scripts>
</Button>
</Frames>
<Scripts>
<OnLoad>
self:SetFrameLevel(2);
</OnLoad>
<OnClick>
C_UIDropDownMenuButton_OnClick(self, button, down);
</OnClick>
<OnEnter>
if ( self.hasArrow ) then
local level = self:GetParent():GetID() + 1;
local listFrame = _G["C_DropDownList"..level];
if ( not listFrame or not listFrame:IsShown() or select(2, listFrame:GetPoint()) ~= self ) then
C_ToggleDropDownMenu(self:GetParent():GetID() + 1, self.value, nil, nil, nil, nil, self.menuList, self);
end
else
C_CloseDropDownMenus(self:GetParent():GetID() + 1);
end
_G[self:GetName().."Highlight"]:Show();
C_UIDropDownMenu_StopCounting(self:GetParent());
if ( self.tooltipTitle ) then
if ( self.tooltipOnButton ) then
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
GameTooltip:AddLine(self.tooltipTitle, 1.0, 1.0, 1.0);
GameTooltip:AddLine(self.tooltipText);
GameTooltip:Show();
else
GameTooltip_AddNewbieTip(self, self.tooltipTitle, 1.0, 1.0, 1.0, self.tooltipText, 1);
end
end
</OnEnter>
<OnLeave>
_G[self:GetName().."Highlight"]:Hide();
C_UIDropDownMenu_StartCounting(self:GetParent());
GameTooltip:Hide();
</OnLeave>
</Scripts>
<ButtonText name="$parentNormalText">
<Anchors>
<Anchor point="LEFT">
<Offset x="-5" y="0"/>
</Anchor>
</Anchors>
</ButtonText>
<NormalFont style="GameFontHighlightSmallLeft"/>
<HighlightFont style="GameFontHighlightSmallLeft"/>
<DisabledFont style="GameFontDisableSmallLeft"/>
</Button>
<Button name="C_UIDropDownListTemplate" hidden="true" frameStrata="DIALOG" enableMouse="true" virtual="true">
<Frames>
<Frame name="$parentBackdrop" setAllPoints="true">
<Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Background-Dark" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true">
<BackgroundInsets>
<AbsInset left="11" right="12" top="12" bottom="9"/>
</BackgroundInsets>
<TileSize>
<AbsValue val="32"/>
</TileSize>
<EdgeSize>
<AbsValue val="32"/>
</EdgeSize>
</Backdrop>
</Frame>
<Frame name="$parentMenuBackdrop" setAllPoints="true">
<Backdrop bgFile="Interface\Tooltips\UI-Tooltip-Background" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true">
<EdgeSize>
<AbsValue val="16"/>
</EdgeSize>
<TileSize>
<AbsValue val="16"/>
</TileSize>
<BackgroundInsets>
<AbsInset left="5" right="5" top="5" bottom="4"/>
</BackgroundInsets>
</Backdrop>
<Scripts>
<OnLoad>
self:SetBackdropBorderColor(TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b);
self:SetBackdropColor(TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, TOOLTIP_DEFAULT_BACKGROUND_COLOR.b);
</OnLoad>
</Scripts>
</Frame>
<Button name="$parentButton1" inherits="C_UIDropDownMenuButtonTemplate" id="1"/>
<Button name="$parentButton2" inherits="C_UIDropDownMenuButtonTemplate" id="2"/>
<Button name="$parentButton3" inherits="C_UIDropDownMenuButtonTemplate" id="3"/>
<Button name="$parentButton4" inherits="C_UIDropDownMenuButtonTemplate" id="4"/>
<Button name="$parentButton5" inherits="C_UIDropDownMenuButtonTemplate" id="5"/>
<Button name="$parentButton6" inherits="C_UIDropDownMenuButtonTemplate" id="6"/>
<Button name="$parentButton7" inherits="C_UIDropDownMenuButtonTemplate" id="7"/>
<Button name="$parentButton8" inherits="C_UIDropDownMenuButtonTemplate" id="8"/>
</Frames>
<Scripts>
<OnClick>
self:Hide();
</OnClick>
<OnEnter>
C_UIDropDownMenu_StopCounting(self, motion);
</OnEnter>
<OnLeave>
C_UIDropDownMenu_StartCounting(self, motion);
</OnLeave>
<OnUpdate>
C_UIDropDownMenu_OnUpdate(self, elapsed);
</OnUpdate>
<OnShow>
for i=1, C_UIDROPDOWNMENU_MAXBUTTONS do
if (not self.noResize) then
_G[self:GetName().."Button"..i]:SetWidth(self.maxWidth);
end
end
if (not self.noResize) then
self:SetWidth(self.maxWidth+25);
end
self.showTime = nil;
if ( self:GetID() > 1 ) then
self.parent = _G["C_DropDownList"..(self:GetID() - 1)];
end
</OnShow>
<OnHide>
C_UIDropDownMenu_OnHide(self);
</OnHide>
</Scripts>
</Button>
<Frame name="C_UIDropDownMenuTemplate" virtual="true">
<Size>
<AbsDimension x="40" y="32"/>
</Size>
<Layers>
<Layer level="ARTWORK">
<Texture name="$parentLeft" file="Interface\Glues\CharacterCreate\CharacterCreate-LabelFrame">
<Size>
<AbsDimension x="25" y="64"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="0" y="17"/>
</Offset>
</Anchor>
</Anchors>
<TexCoords left="0" right="0.1953125" top="0" bottom="1"/>
</Texture>
<Texture name="$parentMiddle" file="Interface\Glues\CharacterCreate\CharacterCreate-LabelFrame">
<Size>
<AbsDimension x="115" y="64"/>
</Size>
<Anchors>
<Anchor point="LEFT" relativeTo="$parentLeft" relativePoint="RIGHT"/>
</Anchors>
<TexCoords left="0.1953125" right="0.8046875" top="0" bottom="1"/>
</Texture>
<Texture name="$parentRight" file="Interface\Glues\CharacterCreate\CharacterCreate-LabelFrame">
<Size>
<AbsDimension x="25" y="64"/>
</Size>
<Anchors>
<Anchor point="LEFT" relativeTo="$parentMiddle" relativePoint="RIGHT"/>
</Anchors>
<TexCoords left="0.8046875" right="1" top="0" bottom="1"/>
</Texture>
<FontString name="$parentText" inherits="GameFontHighlightSmall" justifyH="RIGHT">
<Size>
<AbsDimension x="0" y="10"/>
</Size>
<Anchors>
<Anchor point="RIGHT" relativeTo="$parentRight">
<Offset>
<AbsDimension x="-43" y="2"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Frames>
<Button name="$parentButton">
<Size>
<AbsDimension x="24" y="24"/>
</Size>
<Anchors>
<Anchor point="TOPRIGHT" relativeTo="$parentRight">
<Offset>
<AbsDimension x="-16" y="-18"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick>
C_ToggleDropDownMenu(nil, nil, self:GetParent());
PlaySound("igMainMenuOptionCheckBoxOn");
</OnClick>
</Scripts>
<NormalTexture name="$parentNormalTexture" file="Interface\ChatFrame\UI-ChatIcon-ScrollDown-Up">
<Size>
<AbsDimension x="24" y="24"/>
</Size>
<Anchors>
<Anchor point="RIGHT"/>
</Anchors>
</NormalTexture>
<PushedTexture name="$parentPushedTexture" file="Interface\ChatFrame\UI-ChatIcon-ScrollDown-Down">
<Size>
<AbsDimension x="24" y="24"/>
</Size>
<Anchors>
<Anchor point="RIGHT"/>
</Anchors>
</PushedTexture>
<DisabledTexture name="$parentDisabledTexture" file="Interface\ChatFrame\UI-ChatIcon-ScrollDown-Disabled">
<Size>
<AbsDimension x="24" y="24"/>
</Size>
<Anchors>
<Anchor point="RIGHT"/>
</Anchors>
</DisabledTexture>
<HighlightTexture name="$parentHighlightTexture" file="Interface\Buttons\UI-Common-MouseHilight" alphaMode="ADD">
<Size>
<AbsDimension x="24" y="24"/>
</Size>
<Anchors>
<Anchor point="RIGHT"/>
</Anchors>
</HighlightTexture>
</Button>
</Frames>
<Scripts>
<OnHide>
C_CloseDropDownMenus();
</OnHide>
</Scripts>
</Frame>
<Script file="C_UIDropDownMenu.lua" />
<Script file="C_EasyMenu.lua" />
</Ui>
@@ -0,0 +1,13 @@
local WIDTH, HEIGHT = 858, 660
local IOF = InterfaceOptionsFrame
IOF:SetPoint("CENTER", UIParent, "CENTER")
InterfaceOptionsFrameCategories:SetPoint("BOTTOMLEFT", IOF, "BOTTOMLEFT", 22, 50)
InterfaceOptionsFrameAddOns:SetPoint("BOTTOMLEFT", IOF, "BOTTOMLEFT", 22, 50)
IOF:SetSize(WIDTH, HEIGHT)
IOF:SetToplevel(true)
IOF:HookScript("OnShow", function()
IOF:SetSize(WIDTH, HEIGHT)
end)
@@ -0,0 +1,9 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Include file="XML_Helper.lua" />
<Include file="Backdrop.xml" />
<Include file="UIPanelTemplates.xml" />
<Include file="C_UIDropDownMenu.xml" />
<Script file="InterfaceOptions.lua" />
</Ui>
@@ -0,0 +1,50 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Button name="UIPanelButtonNoTooltipTemplate" virtual="true">
<Size x="40" y="22" />
<Layers>
<Layer level="BACKGROUND">
<Texture parentKey="Left" file="Interface\Buttons\UI-Panel-Button-Up">
<Size x="12" y="22" />
<Anchors>
<Anchor point="TOPLEFT" />
<Anchor point="BOTTOMLEFT" />
</Anchors>
<TexCoords left="0" right="0.09375" top="0" bottom="0.6875" />
</Texture>
<Texture parentKey="Right" file="Interface\Buttons\UI-Panel-Button-Up">
<Size x="12" y="22" />
<Anchors>
<Anchor point="TOPRIGHT" />
<Anchor point="BOTTOMRIGHT" />
</Anchors>
<TexCoords left="0.53125" right="0.625" top="0" bottom="0.6875" />
</Texture>
<Texture parentKey="Middle" file="Interface\Buttons\UI-Panel-Button-Up">
<Size x="12" y="22" />
<Anchors>
<Anchor point="TOPLEFT" relativeKey="$parent.Left" relativePoint="TOPRIGHT" />
<Anchor point="BOTTOMRIGHT" relativeKey="$parent.Right" relativePoint="BOTTOMLEFT" />
</Anchors>
<TexCoords left="0.09375" right="0.53125" top="0" bottom="0.6875" />
</Texture>
</Layer>
</Layers>
<Scripts>
<OnLoad function="UIPanelButton_OnLoad" />
<OnMouseDown function="UIPanelButton_OnMouseDown" />
<OnMouseUp function="UIPanelButton_OnMouseUp" />
<OnShow function="UIPanelButton_OnShow" />
<OnDisable function="UIPanelButton_OnDisable" />
<OnEnable function="UIPanelButton_OnEnable" />
</Scripts>
<ButtonText name="$parentText" parentKey="Text" />
<NormalFont style="GameFontNormal" />
<HighlightFont style="GameFontHighlight" />
<DisabledFont style="GameFontDisable" />
<HighlightTexture inherits="UIPanelButtonHighlightTexture" />
</Button>
</Ui>
@@ -0,0 +1,62 @@
--[[
Search Box Template
]]
function InputBoxInstructions_OnTextChanged(self)
self.Instructions:SetShown(self:GetText() == "")
end
function InputBoxInstructions_UpdateColorForEnabledState(self, color)
if color then
self:SetTextColor(color:GetRGBA());
end
end
function InputBoxInstructions_OnDisable(self)
InputBoxInstructions_UpdateColorForEnabledState(self, self.disabledColor);
end
function InputBoxInstructions_OnEnable(self)
InputBoxInstructions_UpdateColorForEnabledState(self, self.enabledColor);
end
function SearchBoxTemplate_OnLoad(self)
self.searchIcon:SetVertexColor(0.6, 0.6, 0.6);
self:SetTextInsets(16, 20, 0, 0);
self.Instructions:SetText(SEARCH);
self.Instructions:ClearAllPoints();
self.Instructions:SetPoint("TOPLEFT", self, "TOPLEFT", 16, 0);
self.Instructions:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -20, 0);
end
function SearchBoxTemplate_OnEditFocusLost(self)
if ( self:GetText() == "" ) then
self.searchIcon:SetVertexColor(0.6, 0.6, 0.6);
self.clearButton:Hide();
end
end
function SearchBoxTemplate_OnEditFocusGained(self)
self.searchIcon:SetVertexColor(1.0, 1.0, 1.0);
self.clearButton:Show();
end
function SearchBoxTemplate_OnTextChanged(self)
if ( not self:HasFocus() and self:GetText() == "" ) then
self.searchIcon:SetVertexColor(0.6, 0.6, 0.6);
self.clearButton:Hide();
else
self.searchIcon:SetVertexColor(1.0, 1.0, 1.0);
self.clearButton:Show();
end
InputBoxInstructions_OnTextChanged(self);
end
function SearchBoxTemplateClearButton_OnClick(self)
--PlaySound(SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON);
local editBox = self:GetParent();
editBox:SetText("");
editBox:ClearFocus();
end
@@ -0,0 +1,312 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Script file="SharedUIPanelTemplates.lua" />
<EditBox name="InputBoxInstructionsTemplate" inherits="InputBoxTemplate" virtual="true">
<!--KeyValues>
Optional
<KeyValue key="disabledColor" value="GRAY_FONT_COLOR" type="global"/>
<KeyValue key="enabledColor" value="HIGHLIGHT_FONT_COLOR" type="global"/>
</KeyValues-->
<Layers>
<Layer level="ARTWORK">
<FontString parentKey="Instructions" justifyH="LEFT" justifyV="MIDDLE" inherits="GameFontDisableSmall" setAllPoints="true">
<Color r="0.35" g="0.35" b="0.35"/>
</FontString>
</Layer>
</Layers>
<Scripts>
<OnTextChanged function="InputBoxInstructions_OnTextChanged"/>
<OnDisable function="InputBoxInstructions_OnDisable"/>
<OnEnable function="InputBoxInstructions_OnEnable"/>
</Scripts>
<FontString inherits="GameFontHighlightSmall"/>
</EditBox>
<EditBox name="SearchBoxTemplate" inherits="InputBoxInstructionsTemplate" autoFocus="false" virtual="true">
<Layers>
<Layer level="OVERLAY">
<Texture name="$parentSearchIcon" atlas="common-search-magnifyingglass" useAtlasSize="false" parentKey="searchIcon">
<Size x="10" y="10"/>
<Anchors>
<Anchor point="LEFT" x="1" y="-1"/>
</Anchors>
</Texture>
</Layer>
</Layers>
<Frames>
<Button name="$parentClearButton" parentKey="clearButton" hidden="true">
<Size x="17" y="17"/>
<Anchors>
<Anchor point="RIGHT" x="-3" y="0"/>
</Anchors>
<Layers>
<Layer level="ARTWORK">
<Texture atlas="common-search-clearbutton" useAtlasSize="false" alpha="0.5" parentKey="texture">
<Size x="10" y="10"/>
<Anchors>
<Anchor point="TOPLEFT" x="3" y="-3"/>
</Anchors>
</Texture>
</Layer>
</Layers>
<Scripts>
<OnEnter>
self.texture:SetAlpha(1.0);
</OnEnter>
<OnLeave>
self.texture:SetAlpha(0.5);
</OnLeave>
<OnMouseDown>
if self:IsEnabled() then
self.texture:SetPoint("TOPLEFT", self, "TOPLEFT", 4, -4);
end
</OnMouseDown>
<OnMouseUp>
self.texture:SetPoint("TOPLEFT", self, "TOPLEFT", 3, -3);
</OnMouseUp>
<OnClick function="SearchBoxTemplateClearButton_OnClick"/>
</Scripts>
</Button>
</Frames>
<Scripts>
<OnLoad function="SearchBoxTemplate_OnLoad"/>
<OnEscapePressed function="EditBox_ClearFocus"/>
<OnEnterPressed function="EditBox_ClearFocus"/>
<OnEditFocusLost function="SearchBoxTemplate_OnEditFocusLost"/>
<OnEditFocusGained function="SearchBoxTemplate_OnEditFocusGained"/>
<OnTextChanged function="SearchBoxTemplate_OnTextChanged"/>
</Scripts>
</EditBox>
<Slider name="HorizontalSliderTemplate" orientation="HORIZONTAL" enableMouse="true" virtual="true" inherits="BackdropTemplate">
<HitRectInsets>
<AbsInset left="0" right="0" top="-10" bottom="-10" />
</HitRectInsets>
<ThumbTexture parentKey="Thumb" name="$parentThumb" file="Interface\Buttons\UI-SliderBar-Button-Horizontal">
<Size x="32" y="32" />
</ThumbTexture>
<Scripts>
<OnLoad>
self.backdropInfo = _G["BACKDROP_SLIDER_8_8"]
</OnLoad>
</Scripts>
</Slider>
<Frame name="DialogBorderNoCenterTemplate" useParentLevel="true" frameLevel="15" setAllPoints="true" virtual="true">
<Scripts>
<OnLoad>
self.layoutType = "Dialog"
Mixin(self, NineSlicePanelMixin)
self:OnLoad()
</OnLoad>
</Scripts>
</Frame>
<Frame name="DialogBorderDarkTemplate" inherits="DialogBorderNoCenterTemplate" virtual="true">
<Layers>
<Layer level="BACKGROUND">
<!-- TODO: Convert this to atlas -->
<Texture parentKey="Bg" file="Interface\DialogFrame\UI-DialogBox-Background-Dark" horizTile="true" vertTile="true">
<Anchors>
<Anchor point="TOPLEFT" x="7" y="-7" />
<Anchor point="BOTTOMRIGHT" x="-7" y="7" />
</Anchors>
</Texture>
</Layer>
</Layers>
</Frame>
<Button name="UIPanelInfoButton" virtual="true">
<Size>
<AbsDimension x="16" y="16" />
</Size>
<Layers>
<Layer level="ARTWORK">
<Texture name="$parentTexture" file="Interface\FriendsFrame\InformationIcon" parentKey="texture">
<Anchors>
<Anchor point="TOPLEFT" />
</Anchors>
</Texture>
</Layer>
</Layers>
<Scripts>
<OnMouseDown>
self.texture:SetPoint("TOPLEFT", 1, -1);
</OnMouseDown>
<OnMouseUp>
self.texture:SetPoint("TOPLEFT", 0, 0);
</OnMouseUp>
</Scripts>
<HighlightTexture file="Interface\FriendsFrame\InformationIcon-Highlight" alphaMode="ADD">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentTexture" relativePoint="TOPLEFT" />
</Anchors>
<Color r="1" g="1" b="1" a="0.4" />
</HighlightTexture>
</Button>
<Button name="UIMenuButtonStretchTemplate" virtual="true">
<Size x="40" y="26" />
<Layers>
<Layer level="BORDER">
<Texture parentKey="TopLeft" name="$parentTopLeft" file="Interface\Buttons\UI-Silver-Button-Up">
<Size x="12" y="6" />
<Anchors>
<Anchor point="TOPLEFT" />
</Anchors>
<TexCoords left="0" right="0.09375" top="0" bottom="0.1875" />
</Texture>
<Texture parentKey="TopRight" name="$parentTopRight" file="Interface\Buttons\UI-Silver-Button-Up">
<Size x="12" y="6" />
<Anchors>
<Anchor point="TOPRIGHT" />
</Anchors>
<TexCoords left="0.53125" right="0.625" top="0" bottom="0.1875" />
</Texture>
<Texture parentKey="BottomLeft" name="$parentBottomLeft" file="Interface\Buttons\UI-Silver-Button-Up">
<Size x="12" y="6" />
<Anchors>
<Anchor point="BOTTOMLEFT" />
</Anchors>
<TexCoords left="0" right="0.09375" top="0.625" bottom="0.8125" />
</Texture>
<Texture parentKey="BottomRight" name="$parentBottomRight" file="Interface\Buttons\UI-Silver-Button-Up">
<Size x="12" y="6" />
<Anchors>
<Anchor point="BOTTOMRIGHT" />
</Anchors>
<TexCoords left="0.53125" right="0.625" top="0.625" bottom="0.8125" />
</Texture>
<Texture parentKey="TopMiddle" name="$parentTopMiddle" file="Interface\Buttons\UI-Silver-Button-Up">
<Size x="56" y="6" />
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentTopLeft" relativePoint="TOPRIGHT" />
<Anchor point="BOTTOMRIGHT" relativeTo="$parentTopRight" relativePoint="BOTTOMLEFT" />
</Anchors>
<TexCoords left="0.09375" right="0.53125" top="0" bottom="0.1875" />
</Texture>
<Texture parentKey="MiddleLeft" name="$parentMiddleLeft" file="Interface\Buttons\UI-Silver-Button-Up">
<Size x="12" y="14" />
<Anchors>
<Anchor point="TOPRIGHT" relativeTo="$parentTopLeft" relativePoint="BOTTOMRIGHT" />
<Anchor point="BOTTOMLEFT" relativeTo="$parentBottomLeft" relativePoint="TOPLEFT" />
</Anchors>
<TexCoords left="0" right="0.09375" top="0.1875" bottom="0.625" />
</Texture>
<Texture parentKey="MiddleRight" name="$parentMiddleRight" file="Interface\Buttons\UI-Silver-Button-Up">
<Size x="12" y="14" />
<Anchors>
<Anchor point="TOPRIGHT" relativeTo="$parentTopRight" relativePoint="BOTTOMRIGHT" />
<Anchor point="BOTTOMLEFT" relativeTo="$parentBottomRight" relativePoint="TOPLEFT" />
</Anchors>
<TexCoords left="0.53125" right="0.625" top="0.1875" bottom="0.625" />
</Texture>
<Texture parentKey="BottomMiddle" name="$parentBottomMiddle" file="Interface\Buttons\UI-Silver-Button-Up">
<Size x="56" y="6" />
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentBottomLeft" relativePoint="TOPRIGHT" />
<Anchor point="BOTTOMRIGHT" relativeTo="$parentBottomRight" relativePoint="BOTTOMLEFT" />
</Anchors>
<TexCoords left="0.09375" right="0.53125" top="0.625" bottom="0.8125" />
</Texture>
<Texture parentKey="MiddleMiddle" name="$parentMiddleMiddle" file="Interface\Buttons\UI-Silver-Button-Up">
<Size x="56" y="14" />
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentTopLeft" relativePoint="BOTTOMRIGHT" />
<Anchor point="BOTTOMRIGHT" relativeTo="$parentBottomRight" relativePoint="TOPLEFT" />
</Anchors>
<TexCoords left="0.09375" right="0.53125" top="0.1875" bottom="0.625" />
</Texture>
</Layer>
</Layers>
<Scripts>
<OnMouseDown>
if self:IsEnabled() ~= 0 then
self.TopLeft:SetTexture("Interface\\Buttons\\UI-Silver-Button-Down")
self.TopRight:SetTexture("Interface\\Buttons\\UI-Silver-Button-Down")
self.BottomLeft:SetTexture("Interface\\Buttons\\UI-Silver-Button-Down")
self.BottomRight:SetTexture("Interface\\Buttons\\UI-Silver-Button-Down")
self.TopMiddle:SetTexture("Interface\\Buttons\\UI-Silver-Button-Down")
self.MiddleLeft:SetTexture("Interface\\Buttons\\UI-Silver-Button-Down")
self.MiddleRight:SetTexture("Interface\\Buttons\\UI-Silver-Button-Down")
self.BottomMiddle:SetTexture("Interface\\Buttons\\UI-Silver-Button-Down")
self.MiddleMiddle:SetTexture("Interface\\Buttons\\UI-Silver-Button-Down")
if ( self.Icon ) then
if ( not self.Icon.oldPoint ) then
local point, relativeTo, relativePoint, x, y = self.Icon:GetPoint(1)
self.Icon.oldPoint = point
self.Icon.oldX = x
self.Icon.oldY = y
end
self.Icon:SetPoint(self.Icon.oldPoint, self.Icon.oldX + 1, self.Icon.oldY - 1)
end
end
</OnMouseDown>
<OnMouseUp>
if self:IsEnabled() ~= 0 then
self.TopLeft:SetTexture("Interface\\Buttons\\UI-Silver-Button-Up")
self.TopRight:SetTexture("Interface\\Buttons\\UI-Silver-Button-Up")
self.BottomLeft:SetTexture("Interface\\Buttons\\UI-Silver-Button-Up")
self.BottomRight:SetTexture("Interface\\Buttons\\UI-Silver-Button-Up")
self.TopMiddle:SetTexture("Interface\\Buttons\\UI-Silver-Button-Up")
self.MiddleLeft:SetTexture("Interface\\Buttons\\UI-Silver-Button-Up")
self.MiddleRight:SetTexture("Interface\\Buttons\\UI-Silver-Button-Up")
self.BottomMiddle:SetTexture("Interface\\Buttons\\UI-Silver-Button-Up")
self.MiddleMiddle:SetTexture("Interface\\Buttons\\UI-Silver-Button-Up")
if ( self.Icon ) then
self.Icon:SetPoint(self.Icon.oldPoint, self.Icon.oldX, self.Icon.oldY)
end
end
</OnMouseUp>
<OnShow>
if self:IsEnabled() ~= 0 then
-- we need to reset our textures just in case we were hidden before a mouse up fired
self.TopLeft:SetTexture("Interface\\Buttons\\UI-Silver-Button-Up")
self.TopRight:SetTexture("Interface\\Buttons\\UI-Silver-Button-Up")
self.BottomLeft:SetTexture("Interface\\Buttons\\UI-Silver-Button-Up")
self.BottomRight:SetTexture("Interface\\Buttons\\UI-Silver-Button-Up")
self.TopMiddle:SetTexture("Interface\\Buttons\\UI-Silver-Button-Up")
self.MiddleLeft:SetTexture("Interface\\Buttons\\UI-Silver-Button-Up")
self.MiddleRight:SetTexture("Interface\\Buttons\\UI-Silver-Button-Up")
self.BottomMiddle:SetTexture("Interface\\Buttons\\UI-Silver-Button-Up")
self.MiddleMiddle:SetTexture("Interface\\Buttons\\UI-Silver-Button-Up")
end
</OnShow>
<OnEnable>
self.TopLeft:SetTexture("Interface\\Buttons\\UI-Silver-Button-Up")
self.TopRight:SetTexture("Interface\\Buttons\\UI-Silver-Button-Up")
self.BottomLeft:SetTexture("Interface\\Buttons\\UI-Silver-Button-Up")
self.BottomRight:SetTexture("Interface\\Buttons\\UI-Silver-Button-Up")
self.TopMiddle:SetTexture("Interface\\Buttons\\UI-Silver-Button-Up")
self.MiddleLeft:SetTexture("Interface\\Buttons\\UI-Silver-Button-Up")
self.MiddleRight:SetTexture("Interface\\Buttons\\UI-Silver-Button-Up")
self.BottomMiddle:SetTexture("Interface\\Buttons\\UI-Silver-Button-Up")
self.MiddleMiddle:SetTexture("Interface\\Buttons\\UI-Silver-Button-Up")
</OnEnable>
<OnEnter>
if(self.tooltipText ~= nil) then
GameTooltip_AddNewbieTip(self, self.tooltipText, 1.0, 1.0, 1.0, self.newbieText)
end
</OnEnter>
<OnLeave>
if(self.tooltipText ~= nil) then
GameTooltip:Hide()
end
</OnLeave>
</Scripts>
<ButtonText parentKey="Text" name="$parentText">
<Anchors>
<Anchor point="CENTER" x="0" y="-1" />
</Anchors>
</ButtonText>
<NormalFont style="GameFontHighlightSmall" />
<HighlightFont style="GameFontHighlightSmall" />
<DisabledFont style="GameFontDisableSmall" />
<HighlightTexture file="Interface\Buttons\UI-Silver-Button-Highlight" alphaMode="ADD">
<TexCoords left="0" right="1.0" top="0.03" bottom="0.7175" />
</HighlightTexture>
</Button>
</Ui>
@@ -0,0 +1,79 @@
local function UIDropDownMenu_CreateUnChecked(object)
local uncheck = _G[object:GetName().."UnCheck"];
if ( uncheck ) then
return;
end
uncheck = object:CreateTexture("$parentUnCheck", "BORDER");
_G[object:GetName().."UnCheck"] = uncheck;
uncheck:SetSize(16, 16);
uncheck:SetPoint("Left");
end
hooksecurefunc("UIDropDownMenu_AddButton", function(info, level)
if ( not level ) then
level = 1;
end
local listFrame = _G["DropDownList"..level];
local index = listFrame and listFrame.numButtons or 1;
listFrame = listFrame or _G["DropDownList"..level];
local listFrameName = listFrame:GetName();
local button = _G[listFrameName.."Button"..index];
UIDropDownMenu_CreateUnChecked(button);
if ( not info.notCheckable ) then
local check = _G[listFrameName.."Button"..index.."Check"];
local uncheck = _G[listFrameName.."Button"..index.."UnCheck"];
if ( info.disabled ) then
check:SetDesaturated(true);
check:SetAlpha(0.5);
uncheck:SetDesaturated(true);
uncheck:SetAlpha(0.5);
else
check:SetDesaturated(false);
check:SetAlpha(1);
uncheck:SetDesaturated(false);
uncheck:SetAlpha(1);
end
if ( info.isRadio ) then
--check:SetTexCoord(0.0, 0.5, 0.5, 1.0);
check:SetTexCoord(0.25, 0.5, 0, 1);
check:SetTexture("Interface\\Buttons\\UI-RadioButton");
--uncheck:SetTexCoord(0.5, 1.0, 0.5, 1.0);
uncheck:SetTexCoord(0.75, 1, 0, 1);
uncheck:SetTexture("Interface\\Buttons\\UI-RadioButton");
else
check:SetTexCoord(0, 1, 0, 1);
check:SetTexture("Interface\\Buttons\\UI-CheckBox-Check");
end
-- Checked can be a function now
local checked = info.checked;
if ( type(checked) == "function" ) then
checked = checked(button);
end
-- Show the check if checked
if ( checked ) then
button:LockHighlight();
check:Show();
uncheck:Hide();
else
button:UnlockHighlight();
check:Hide();
uncheck:Show();
end
else
_G[listFrameName.."Button"..index.."Check"]:Hide();
_G[listFrameName.."Button"..index.."UnCheck"]:Hide();
end
if ( not info.isRadio ) then
_G[listFrameName.."Button"..index.."UnCheck"]:Hide();
end
button.checked = info.checked;
end)
@@ -0,0 +1,398 @@
function SearchBoxTemplate_OnLoad(self)
self:SetText(SEARCH);
self:SetFontObject("GameFontDisable");
self.searchIcon:SetVertexColor(0.6, 0.6, 0.6);
self:SetTextInsets(16, 20, 0, 0);
end
function SearchBoxTemplate_OnEditFocusLost(self)
self:HighlightText(0, 0);
self:SetFontObject("GameFontDisable");
self.searchIcon:SetVertexColor(0.6, 0.6, 0.6);
if ( self:GetText() == "" or self:GetText() == SEARCH ) then
self:SetText(SEARCH);
self.clearButton:Hide();
end
end
function SerachBoxTemplate_OnEditFocusGained(self)
self:HighlightText();
self:SetFontObject("ChatFontSmall");
self.searchIcon:SetVertexColor(1.0, 1.0, 1.0);
if ( self:GetText() == SEARCH ) then
self:SetText("")
end
self.clearButton:Show();
end
ITEM_SEARCHBAR_LIST = {
"BagItemSearchBox",
"GuildItemSearchBox",
"VoidItemSearchBox",
"BankItemSearchBox",
};
function BagSearch_OnHide(self)
local allClosed = true;
for _,barName in pairs(ITEM_SEARCHBAR_LIST) do
local bar = _G[barName];
if bar and bar ~= self and bar:IsVisible() then
allClosed = false;
end
end
if ( allClosed ) then
self.clearButton:Click();
BagSearch_OnTextChanged(self);
end
end
function BagSearch_OnTextChanged(self, userChanged)
local text = self:GetText();
if ( text == SEARCH ) then
text = "";
end
SetItemSearch(text);
if (text ~= "") then
self.clearButton:Show();
else
self.clearButton:Hide();
end
end
function BagSearch_OnChar(self, text)
-- clear focus if the player is repeating keys (ie - trying to move)
-- TODO: move into base editbox code?
local MIN_REPEAT_CHARACTERS = 3
local searchString = self:GetText();
if (string.len(searchString) > MIN_REPEAT_CHARACTERS) then
local repeatChar = true;
for i=1, MIN_REPEAT_CHARACTERS, 1 do
if ( string.sub(searchString,(0-i), (0-i)) ~= string.sub(searchString,(-1-i),(-1-i)) ) then
repeatChar = false;
break;
end
end
if ( repeatChar ) then
self:ClearFocus();
end
end
end
function BagSearch_OnEditFocusGained(self)
SerachBoxTemplate_OnEditFocusGained(self);
for _,barName in pairs(ITEM_SEARCHBAR_LIST) do
local bar = _G[barName];
if bar and bar ~= self then
bar:SetText(SEARCH);
end
end
end
function BagSearch_OnEditFocusLost(self)
SerachBoxTemplate_OnEditFocusGained(self);
local search = self:GetText();
for _,barName in pairs(ITEM_SEARCHBAR_LIST) do
local bar = _G[barName];
if bar and bar ~= self then
bar:SetText(search);
end
end
end
-- Scrollframe functions
function ScrollBar_AdjustAnchors(scrollBar, topAdj, bottomAdj, xAdj)
-- assumes default anchoring of topleft-topright, bottomleft-bottomright
local topY = 0;
local bottomY = 0;
local point, parent, refPoint, x, y;
for i = 1, 2 do
point, parent, refPoint, x, y = scrollBar:GetPoint(i);
if ( point == "TOPLEFT" ) then
topY = y;
elseif ( point == "BOTTOMLEFT" ) then
bottomY = y;
end
end
xAdj = xAdj or 0;
topAdj = topAdj or 0;
bottomAdj = bottomAdj or 0;
scrollBar:SetPoint("TOPLEFT", parent, "TOPRIGHT", x + xAdj, topY + topAdj);
scrollBar:SetPoint("BOTTOMLEFT", parent, "BOTTOMRIGHT", x + xAdj, bottomY + bottomAdj);
end
-- Truncated Button code
function TruncatedButton_OnEnter(self)
local text = _G[self:GetName().."Text"];
if ( text:IsTruncated() ) then
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
GameTooltip:SetText(text:GetText());
GameTooltip:Show();
end
end
function TruncatedButton_OnLeave(self)
if ( GameTooltip:GetOwner() == self ) then
GameTooltip:Hide();
end
end
-- Magic Button code
function MagicButton_OnLoad(self)
local leftHandled = false;
local rightHandled = false;
-- Find out where this button is anchored and adjust positions/separators as necessary
for i=1, self:GetNumPoints() do
local point, relativeTo, relativePoint, offsetX, offsetY = self:GetPoint(i);
if (relativeTo:GetObjectType() == "Button" and (point == "TOPLEFT" or point == "LEFT")) then
if (offsetX == 0 and offsetY == 0) then
self:SetPoint(point, relativeTo, relativePoint, 1, 0);
end
if (relativeTo.RightSeparator) then
-- Modify separator to make it a Middle
self.LeftSeparator = relativeTo.RightSeparator;
else
-- Add a Middle separator
self.LeftSeparator = self:CreateTexture(self:GetName().."_LeftSeparator", "BORDER");
relativeTo.RightSeparator = self.LeftSeparator;
end
self.LeftSeparator:SetTexture("Interface\\AddOns\\!!!ClassicAPI\\Texture\\FrameGeneral\\UI-Frame");
self.LeftSeparator:SetTexCoord("0.00781250", "0.10937500", "0.75781250", "0.95312500");
self.LeftSeparator:SetWidth(13);
self.LeftSeparator:SetHeight(25);
self.LeftSeparator:SetPoint("TOPRIGHT", self, "TOPLEFT", 5, 1);
leftHandled = true;
elseif (relativeTo:GetObjectType() == "Button" and (point == "TOPRIGHT" or point == "RIGHT")) then
if (offsetX == 0 and offsetY == 0) then
self:SetPoint(point, relativeTo, relativePoint, -1, 0);
end
if (relativeTo.LeftSeparator) then
-- Modify separator to make it a Middle
self.RightSeparator = relativeTo.LeftSeparator;
else
-- Add a Middle separator
self.RightSeparator = self:CreateTexture(self:GetName().."_RightSeparator", "BORDER");
relativeTo.LeftSeparator = self.RightSeparator;
end
self.RightSeparator:SetTexture("Interface\\AddOns\\!!!ClassicAPI\\Texture\\FrameGeneral\\UI-Frame");
self.RightSeparator:SetTexCoord("0.00781250", "0.10937500", "0.75781250", "0.95312500");
self.RightSeparator:SetWidth(13);
self.RightSeparator:SetHeight(25);
self.RightSeparator:SetPoint("TOPLEFT", self, "TOPRIGHT", -5, 1);
rightHandled = true;
elseif (point == "BOTTOMLEFT") then
if (offsetX == 0 and offsetY == 0) then
self:SetPoint(point, relativeTo, relativePoint, 4, 4);
end
leftHandled = true;
elseif (point == "BOTTOMRIGHT") then
if (offsetX == 0 and offsetY == 0) then
self:SetPoint(point, relativeTo, relativePoint, -6, 4);
end
rightHandled = true;
elseif (point == "BOTTOM") then
if (offsetY == 0) then
self:SetPoint(point, relativeTo, relativePoint, 0, 4);
end
end
end
-- If this button didn't have a left anchor, add the left border texture
if (not leftHandled) then
if (not self.LeftSeparator) then
-- Add a Left border
self.LeftSeparator = self:CreateTexture(self:GetName().."_LeftSeparator", "BORDER");
self.LeftSeparator:SetTexture("Interface\\AddOns\\!!!ClassicAPI\\Texture\\FrameGeneral\\UI-Frame");
self.LeftSeparator:SetTexCoord("0.24218750", "0.32812500", "0.63281250", "0.82812500");
self.LeftSeparator:SetWidth(11);
self.LeftSeparator:SetHeight(25);
self.LeftSeparator:SetPoint("TOPRIGHT", self, "TOPLEFT", 6, 1);
end
end
-- If this button didn't have a right anchor, add the right border texture
if (not rightHandled) then
if (not self.RightSeparator) then
-- Add a Right border
self.RightSeparator = self:CreateTexture(self:GetName().."_RightSeparator", "BORDER");
self.RightSeparator:SetTexture("Interface\\AddOns\\!!!ClassicAPI\\Texture\\FrameGeneral\\UI-Frame");
self.RightSeparator:SetTexCoord("0.90625000", "0.99218750", "0.00781250", "0.20312500");
self.RightSeparator:SetWidth(11);
self.RightSeparator:SetHeight(25);
self.RightSeparator:SetPoint("TOPLEFT", self, "TOPRIGHT", -6, 1);
end
end
end
-- ButtonFrameTemplate code
function ButtonFrameTemplate_HideButtonBar(self)
if self.bottomInset then
self.bottomInset:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", PANEL_INSET_RIGHT_OFFSET, PANEL_INSET_BOTTOM_OFFSET);
else
_G[self:GetName() .. "Inset"]:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", PANEL_INSET_RIGHT_OFFSET, PANEL_INSET_BOTTOM_OFFSET);
end
_G[self:GetName() .. "BtnCornerLeft"]:Hide();
_G[self:GetName() .. "BtnCornerRight"]:Hide();
_G[self:GetName() .. "ButtonBottomBorder"]:Hide();
end
function ButtonFrameTemplate_ShowButtonBar(self)
if self.topInset then
self.topInset:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", PANEL_INSET_RIGHT_OFFSET, PANEL_INSET_BOTTOM_BUTTON_OFFSET);
else
_G[self:GetName() .. "Inset"]:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", PANEL_INSET_RIGHT_OFFSET, PANEL_INSET_BOTTOM_BUTTON_OFFSET);
end
_G[self:GetName() .. "BtnCornerLeft"]:Show();
_G[self:GetName() .. "BtnCornerRight"]:Show();
_G[self:GetName() .. "ButtonBottomBorder"]:Show();
end
function ButtonFrameTemplate_HideAttic(self)
if self.topInset then
self.topInset:SetPoint("TOPLEFT", self, "TOPLEFT", PANEL_INSET_LEFT_OFFSET, PANEL_INSET_TOP_OFFSET);
else
self.Inset:SetPoint("TOPLEFT", self, "TOPLEFT", PANEL_INSET_LEFT_OFFSET, PANEL_INSET_TOP_OFFSET);
end
self.TopTileStreaks:Hide();
end
function ButtonFrameTemplate_ShowAttic(self)
if self.topInset then
self.topInset:SetPoint("TOPLEFT", self, "TOPLEFT", PANEL_INSET_LEFT_OFFSET, PANEL_INSET_ATTIC_OFFSET);
else
self.Inset:SetPoint("TOPLEFT", self, "TOPLEFT", PANEL_INSET_LEFT_OFFSET, PANEL_INSET_ATTIC_OFFSET);
end
self.TopTileStreaks:Show();
end
function ButtonFrameTemplate_HidePortrait(self)
self.portrait:Hide();
self.portraitFrame:Hide();
self.topLeftCorner:Show();
self.topBorderBar:SetPoint("TOPLEFT", self.topLeftCorner, "TOPRIGHT", 0, 0);
self.leftBorderBar:SetPoint("TOPLEFT", self.topLeftCorner, "BOTTOMLEFT", 0, 0);
end
function ButtonFrameTemplate_ShowPortrait(self)
self.portrait:Show();
self.portraitFrame:Show();
self.topLeftCorner:Hide();
self.topBorderBar:SetPoint("TOPLEFT", self.portraitFrame, "TOPRIGHT", 0, -10);
self.leftBorderBar:SetPoint("TOPLEFT", self.portraitFrame, "BOTTOMLEFT", 8, 0);
end
-- SquareButton template code
SQUARE_BUTTON_TEXCOORDS = {
["UP"] = { 0.45312500, 0.64062500, 0.01562500, 0.20312500};
["DOWN"] = { 0.45312500, 0.64062500, 0.20312500, 0.01562500};
["LEFT"] = { 0.23437500, 0.42187500, 0.01562500, 0.20312500};
["RIGHT"] = { 0.42187500, 0.23437500, 0.01562500, 0.20312500};
["DELETE"] = { 0.01562500, 0.20312500, 0.01562500, 0.20312500};
};
function SquareButton_SetIcon(self, name)
local coords = SQUARE_BUTTON_TEXCOORDS[strupper(name)];
if (coords) then
self.icon:SetTexCoord(coords[1], coords[2], coords[3], coords[4]);
end
end
-- Cap progress bar
function CapProgressBar_SetNotches(capBar, count)
local barWidth = capBar:GetWidth();
local barName = capBar:GetName();
if ( capBar.notchCount and capBar.notchCount > count ) then
for i = count + 1, capBar.notchCount do
_G[barName.."Divider"..i]:Hide();
end
end
local notchWidth = barWidth / count;
for i=1, count - 1 do
local notch = _G[barName.."Divider"..i];
if ( not notch ) then
notch = capBar:CreateTexture(barName.."Divider"..i, "BORDER", "CapProgressBarDividerTemplate", -1);
end
notch:ClearAllPoints();
notch:SetPoint("LEFT", capBar, "LEFT", notchWidth * i - 2, 0);
end
capBar.notchCount = count;
end
function CapProgressBar_Update(capBar, cap1Quantity, cap1Limit, cap2Quantity, cap2Limit, totalQuantity, totalLimit, hasNoSharedStats)
if ( totalLimit == 0) then
return;
end
local barWidth = capBar:GetWidth();
local sizePerPoint = barWidth / totalLimit;
local progressWidth = totalQuantity * sizePerPoint;
local cap1Width, cap2Width;
if ( cap2Quantity and cap2Limit ) then
cap1Width = min(cap1Limit - cap1Quantity, cap2Limit - cap2Quantity) * sizePerPoint; --cap1 can't go past the cap2 LFG limit either.
cap2Width = (cap2Limit - cap2Quantity) * sizePerPoint - cap1Width;
else
cap1Width = (cap1Limit - cap1Quantity) * sizePerPoint;
cap2Width = 0;
end
--Don't let it go past the end.
progressWidth = min(progressWidth, barWidth);
cap1Width = min(cap1Width, barWidth - progressWidth);
cap2Width = min(cap2Width, barWidth - progressWidth - cap1Width);
capBar.progress:SetWidth(progressWidth);
capBar.cap1:SetWidth(cap1Width);
capBar.cap2:SetWidth(cap2Width);
local lastFrame, lastRelativePoint = capBar, "LEFT";
if ( progressWidth > 0 ) then
capBar.progress:Show();
capBar.progress:SetPoint("LEFT", lastFrame, lastRelativePoint, 0, 0);
lastFrame, lastRelativePoint = capBar.progress, "RIGHT";
else
capBar.progress:Hide();
end
if ( cap1Width > 0 and not hasNoSharedStats) then
capBar.cap1:Show();
capBar.cap1Marker:Show();
capBar.cap1:SetPoint("LEFT", lastFrame, lastRelativePoint, 0, 0);
lastFrame, lastRelativePoint = capBar.cap1, "RIGHT";
else
capBar.cap1:Hide();
capBar.cap1Marker:Hide();
end
if ( cap2Width > 0 and not hasNoSharedStats) then
capBar.cap2:Show();
capBar.cap2Marker:Show();
capBar.cap2:SetPoint("LEFT", lastFrame, lastRelativePoint, 0, 0);
lastFrame, lastRelativePoint = capBar.cap2, "RIGHT";
else
capBar.cap2:Hide();
capBar.cap2Marker:Hide();
end
end
@@ -0,0 +1,9 @@
function XML_NineSlice(Self, Layout)
Self.layoutType = Layout
Mixin(Self, NineSlicePanelMixin)
Self:OnLoad()
end
function XML_UseParentLevel(Self)
Self:SetFrameLevel(Self:GetParent():GetFrameLevel())
end

Some files were not shown because too many files have changed in this diff Show More