Compare commits
2
Commits
4959c470c1
...
3b4f25d87c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3b4f25d87c | ||
|
|
3065c3e70e |
No files matched your search
+152
-8
@@ -1,7 +1,9 @@
|
||||
-- Goldbeutel: zeigt dein Gold in einem kleinen, verschiebbaren Rahmen.
|
||||
-- Goldbeutel: zeigt Gold, freie Taschenplaetze, Ruestungszustand und
|
||||
-- Gegenstandsstufe in einem kleinen, verschiebbaren Rahmen.
|
||||
-- Linksziehen verschieben
|
||||
-- Rechtsklick sperren / entsperren
|
||||
-- Mauszeiger drauf Gewinn/Verlust dieser Sitzung + alle Charaktere des Realms
|
||||
-- Mauszeiger drauf Details zu Taschen, Ruestung und Gegenstandsstufe,
|
||||
-- Gewinn/Verlust dieser Sitzung + alle Charaktere des Realms
|
||||
-- /gold ein-/ausblenden
|
||||
-- /gold lock sperren / entsperren
|
||||
-- /gold reset Position zurücksetzen
|
||||
@@ -13,6 +15,20 @@ local GOLD = "|TInterface\\MoneyFrame\\UI-GoldIcon:0:0:2:0|t"
|
||||
local SILVER = "|TInterface\\MoneyFrame\\UI-SilverIcon:0:0:2:0|t"
|
||||
local COPPER = "|TInterface\\MoneyFrame\\UI-CopperIcon:0:0:2:0|t"
|
||||
|
||||
local SEP = " |cff666666||r " -- "||" ist ein woertliches |
|
||||
local LABEL = "|cffaaaaaa" -- Beschriftungen im Rahmen
|
||||
local YELLOW = "|cffffd100"
|
||||
local RED = "|cffff3333"
|
||||
|
||||
-- Rucksack (0) und die vier Taschenplaetze, dahinter ggf. die Reagenzientasche
|
||||
local NORMAL_BAGS = NUM_BAG_SLOTS or 4
|
||||
local LAST_BAG = math.max(NUM_TOTAL_EQUIPPED_BAG_SLOTS or 0, NORMAL_BAGS)
|
||||
local FIRST_SLOT = INVSLOT_FIRST_EQUIPPED or 1
|
||||
local LAST_SLOT = INVSLOT_LAST_EQUIPPED or 19
|
||||
|
||||
local GetNumSlots = C_Container and C_Container.GetContainerNumSlots or GetContainerNumSlots
|
||||
local GetFreeSlots = C_Container and C_Container.GetContainerNumFreeSlots or GetContainerNumFreeSlots
|
||||
|
||||
local db, realm, player, sessionStart
|
||||
local frame, text
|
||||
|
||||
@@ -40,6 +56,24 @@ local function formatMoney(c)
|
||||
return string.format("%d%s", k, COPPER)
|
||||
end
|
||||
|
||||
-- 245.34 -> "245,3"
|
||||
local function decimal(x)
|
||||
return (string.format("%.1f", x):gsub("%.", ","))
|
||||
end
|
||||
|
||||
local function paint(s, color)
|
||||
if color then return color .. s .. "|r" end
|
||||
return s
|
||||
end
|
||||
|
||||
local function pctColor(p)
|
||||
if p < 20 then return RED elseif p < 50 then return YELLOW end
|
||||
end
|
||||
|
||||
local function freeColor(n)
|
||||
if n == 0 then return RED elseif n <= 5 then return YELLOW end
|
||||
end
|
||||
|
||||
local function classColored(name, class)
|
||||
local c = class and RAID_CLASS_COLORS and RAID_CLASS_COLORS[class]
|
||||
if c and c.colorStr then
|
||||
@@ -56,6 +90,65 @@ local function lower(s)
|
||||
end))
|
||||
end
|
||||
|
||||
-- Freie und gesamte Plaetze. Spezialtaschen (Koecher, Kraeuter-, Reagenzientasche
|
||||
-- usw.) zaehlen getrennt, weil dort nicht alles hineinpasst.
|
||||
local function bagSpace()
|
||||
local free, total, sFree, sTotal = 0, 0, 0, 0
|
||||
for bag = 0, LAST_BAG do
|
||||
local n = GetNumSlots(bag) or 0
|
||||
if n > 0 then
|
||||
local f, family = GetFreeSlots(bag)
|
||||
f = f or 0
|
||||
if bag <= NORMAL_BAGS and (family or 0) == 0 then
|
||||
free, total = free + f, total + n
|
||||
else
|
||||
sFree, sTotal = sFree + f, sTotal + n
|
||||
end
|
||||
end
|
||||
end
|
||||
return free, total, sFree, sTotal
|
||||
end
|
||||
|
||||
-- Zustand des am staerksten beschaedigten Teils (Prozent und Slot) und der
|
||||
-- Gesamtzustand in Prozent. nil, wenn nichts mit Haltbarkeit angelegt ist.
|
||||
local function durability()
|
||||
local low, lowSlot, cur, max
|
||||
cur, max = 0, 0
|
||||
for slot = FIRST_SLOT, LAST_SLOT do
|
||||
local c, m = GetInventoryItemDurability(slot)
|
||||
if c and m and m > 0 then
|
||||
local p = c / m * 100
|
||||
if not low or p < low then low, lowSlot = p, slot end
|
||||
cur, max = cur + c, max + m
|
||||
end
|
||||
end
|
||||
if low then return low, lowSlot, cur / max * 100 end
|
||||
end
|
||||
|
||||
-- Durchschnittliche Gegenstandsstufe wie im Charakterfenster: angelegt und mit
|
||||
-- der besten Ausruestung aus den Taschen. nil, solange der Client sie nicht kennt.
|
||||
local function itemLevel()
|
||||
if not GetAverageItemLevel then return end
|
||||
local best, equipped = GetAverageItemLevel()
|
||||
if equipped and equipped > 0 then return equipped, best end
|
||||
end
|
||||
|
||||
-- Eine Zeile: Gold | Taschen 23 | 87% | iLvl 245
|
||||
local function frameText()
|
||||
local parts = { formatMoney(GetMoney()) }
|
||||
local free = bagSpace()
|
||||
parts[#parts + 1] = LABEL .. "Taschen|r " .. paint(free, freeColor(free))
|
||||
local low = durability()
|
||||
if low then
|
||||
parts[#parts + 1] = paint(math.floor(low) .. "%", pctColor(low))
|
||||
end
|
||||
local ilvl = itemLevel()
|
||||
if ilvl then
|
||||
parts[#parts + 1] = LABEL .. "iLvl|r " .. math.floor(ilvl)
|
||||
end
|
||||
return table.concat(parts, SEP)
|
||||
end
|
||||
|
||||
-- Felder aktualisieren statt den Eintrag zu ersetzen, damit der
|
||||
-- Sitzungsstart (session) erhalten bleibt
|
||||
local function record()
|
||||
@@ -66,10 +159,32 @@ local function record()
|
||||
me.money, me.class = GetMoney(), class
|
||||
end
|
||||
|
||||
local function update()
|
||||
record()
|
||||
text:SetText(formatMoney(GetMoney()))
|
||||
frame:SetSize(math.ceil(text:GetStringWidth()) + 20, math.ceil(text:GetStringHeight()) + 14)
|
||||
local function addStatusLines()
|
||||
local free, total, sFree, sTotal = bagSpace()
|
||||
GameTooltip:AddDoubleLine("Taschen frei:", paint(free, freeColor(free)) .. " / " .. total,
|
||||
1, 0.82, 0, 1, 1, 1)
|
||||
if sTotal > 0 then
|
||||
GameTooltip:AddDoubleLine("Spezialtaschen frei:", sFree .. " / " .. sTotal, 1, 0.82, 0, 1, 1, 1)
|
||||
end
|
||||
|
||||
local low, lowSlot, overall = durability()
|
||||
if low then
|
||||
GameTooltip:AddDoubleLine("Rüstung gesamt:", paint(math.floor(overall) .. "%", pctColor(overall)),
|
||||
1, 0.82, 0, 1, 1, 1)
|
||||
if low < 100 then
|
||||
local link = GetInventoryItemLink("player", lowSlot) or "?"
|
||||
GameTooltip:AddDoubleLine(" " .. link, paint(math.floor(low) .. "%", pctColor(low)),
|
||||
1, 1, 1, 1, 1, 1)
|
||||
end
|
||||
end
|
||||
|
||||
local ilvl, best = itemLevel()
|
||||
if ilvl then
|
||||
GameTooltip:AddDoubleLine("Gegenstandsstufe:", decimal(ilvl), 1, 0.82, 0, 1, 1, 1)
|
||||
if best and best - ilvl >= 0.05 then
|
||||
GameTooltip:AddDoubleLine("Beste Ausrüstung:", decimal(best), 1, 0.82, 0, 0.6, 0.6, 0.6)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function showTooltip(self)
|
||||
@@ -78,6 +193,8 @@ local function showTooltip(self)
|
||||
local anchor = (y and y > UIParent:GetHeight() / 2) and "ANCHOR_BOTTOM" or "ANCHOR_TOP"
|
||||
GameTooltip:SetOwner(self, anchor)
|
||||
GameTooltip:AddLine("Goldbeutel")
|
||||
addStatusLines()
|
||||
GameTooltip:AddLine(" ")
|
||||
|
||||
local diff = GetMoney() - sessionStart
|
||||
local sign, r, g, b = "", 1, 1, 1
|
||||
@@ -115,6 +232,25 @@ local function showTooltip(self)
|
||||
GameTooltip:Show()
|
||||
end
|
||||
|
||||
local function update()
|
||||
record()
|
||||
text:SetText(frameText())
|
||||
frame:SetSize(math.ceil(text:GetStringWidth()) + 20, math.ceil(text:GetStringHeight()) + 14)
|
||||
if GameTooltip:IsOwned(frame) then showTooltip(frame) end
|
||||
end
|
||||
|
||||
-- Mehrere Ereignisse kurz hintereinander (Ausruestung wechseln, Taschen sortieren)
|
||||
-- loesen nur eine Aktualisierung im naechsten Frame aus
|
||||
local queued = false
|
||||
local function queueUpdate()
|
||||
if queued or not frame then return end
|
||||
queued = true
|
||||
C_Timer.After(0, function()
|
||||
queued = false
|
||||
update()
|
||||
end)
|
||||
end
|
||||
|
||||
local function toggleLock()
|
||||
db.locked = not db.locked
|
||||
say(db.locked and "Rahmen gesperrt." or "Rahmen entsperrt.")
|
||||
@@ -185,6 +321,11 @@ ev:RegisterEvent("PLAYER_LOGIN")
|
||||
ev:RegisterEvent("PLAYER_MONEY")
|
||||
ev:RegisterEvent("PLAYER_LOGOUT")
|
||||
ev:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
-- Taschen, Ruestung, Gegenstandsstufe. pcall, falls ein Client eines davon nicht kennt.
|
||||
for _, e in ipairs({ "BAG_UPDATE_DELAYED", "UPDATE_INVENTORY_DURABILITY",
|
||||
"PLAYER_EQUIPMENT_CHANGED", "PLAYER_AVG_ITEM_LEVEL_UPDATE" }) do
|
||||
pcall(ev.RegisterEvent, ev, e)
|
||||
end
|
||||
ev:SetScript("OnEvent", function(self, event, arg1, arg2)
|
||||
if event == "ADDON_LOADED" then
|
||||
if arg1 ~= ADDON then return end
|
||||
@@ -208,10 +349,13 @@ ev:SetScript("OnEvent", function(self, event, arg1, arg2)
|
||||
else
|
||||
me.session = sessionStart
|
||||
end
|
||||
elseif event == "PLAYER_MONEY" then
|
||||
if frame then update() end
|
||||
-- Taschen und Ausruestung sind jetzt sicher vollstaendig geladen
|
||||
queueUpdate()
|
||||
elseif event == "PLAYER_LOGOUT" then
|
||||
if realm then record() end
|
||||
else
|
||||
-- PLAYER_MONEY und die Ereignisse fuer Taschen, Ruestung und Gegenstandsstufe
|
||||
queueUpdate()
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
## Interface: 16001
|
||||
## Title: Goldbeutel
|
||||
## Notes: Zeigt dein Gold in einem kleinen, verschiebbaren Rahmen. /gold
|
||||
## Notes: Zeigt Gold, freie Taschenplätze, Rüstungszustand und Gegenstandsstufe in einem kleinen, verschiebbaren Rahmen. /gold
|
||||
## SavedVariables: GoldbeutelDB
|
||||
Goldbeutel.lua
|
||||
@@ -1,814 +1,153 @@
|
||||
# WoW Forever: UI-Skalierung, Goldbeutel und Leistenabstand
|
||||
# WoW Forever Addons
|
||||
|
||||
Chat mit Claude, 23. November 2026. Der Quellcode der drei Addons steht im Anhang am Ende.
|
||||
Drei kleine, voneinander unabhängige Addons für **World of Warcraft: Forever**. Jedes Addon besteht aus einer einzigen Lua-Datei und braucht keine weiteren Bibliotheken.
|
||||
|
||||
**Download:** [WoW-Forever-Addons.zip](https://git.micw.org/mike/wow-forever-addons/raw/branch/master/WoW-Forever-Addons.zip) enthält alle drei Addons. Entpacke sie nach `World of Warcraft/_forever_/Interface/AddOns/` und starte WoW danach komplett neu.
|
||||
| Addon | Wozu | Befehl |
|
||||
|---|---|---|
|
||||
| [**ForeverScale**](#foreverscale) | UI-Skalierung auch unter Blizzards Minimum von 0,64, dauerhaft gespeichert | `/fscale` |
|
||||
| [**Goldbeutel**](#goldbeutel) | Gold, freie Taschenplätze, Rüstungszustand und Gegenstandsstufe in einem kleinen Rahmen | `/gold` |
|
||||
| [**Leistenabstand**](#leistenabstand) | Symbolabstand der Aktionsleisten unter 2, auch 0 oder negativ | `/abstand` |
|
||||
|
||||
## Installation
|
||||
|
||||
1. **[WoW-Forever-Addons.zip herunterladen](https://git.micw.org/mike/wow-forever-addons/raw/branch/master/WoW-Forever-Addons.zip)**
|
||||
2. Die ZIP in den AddOns-Ordner von **Forever** entpacken, nicht in den von Classic oder Retail:
|
||||
- Windows: `C:\Program Files (x86)\World of Warcraft\_forever_\Interface\AddOns\`
|
||||
- macOS: `/Applications/World of Warcraft/_forever_/Interface/AddOns/`
|
||||
|
||||
Danach liegen dort die Ordner `ForeverScale`, `Goldbeutel` und `Leistenabstand`. Wer nur einzelne Addons möchte, lässt die anderen Ordner einfach weg.
|
||||
3. WoW **komplett neu starten**. Neue Addons erkennt der Client nicht per `/reload`.
|
||||
|
||||
> **Als „veraltet“ markiert?** Nach einem Patch kann das passieren. Gib im Chat `/dump select(4, GetBuildInfo())` ein und trage die angezeigte Zahl in die Zeile `## Interface:` der `.toc`-Datei des Addons ein.
|
||||
|
||||
---
|
||||
|
||||
## 1. UI-Skalierung in WoW Forever
|
||||
## ForeverScale
|
||||
|
||||
**Mike:** wow forever scale ui
|
||||
Blizzards Regler für die UI-Skalierung (Esc → Optionen → System → Grafik) endet bei **0,64**. Auf großen oder hochauflösenden Bildschirmen ist das oft noch zu groß. Ein `/run UIParent:SetScale(0.5333)` wirkt zwar sofort, ist aber beim nächsten Logout wieder weg.
|
||||
|
||||
**Claude:**
|
||||
ForeverScale speichert deinen Wert für den ganzen Account und setzt ihn nach jedem Login, Reload und Auflösungswechsel wieder. Ändert Blizzard die Skalierung zurück, stellt ForeverScale deinen Wert wieder her.
|
||||
|
||||
I took this to mean you want to change the UI scale in WoW: Forever and have it stay that way. There are three ways, depending on how small you want it.
|
||||
| Befehl | Wirkung |
|
||||
|---|---|
|
||||
| `/fscale 0.5333` | feste Skalierung setzen, 0.30 bis 1.50 (mit Punkt) |
|
||||
| `/fscale pixel` | pixelgenau: 768 ÷ Bildschirmhöhe, wird bei jedem Auflösungswechsel neu berechnet |
|
||||
| `/fscale reset` | ForeverScale abschalten, danach `/reload` |
|
||||
| `/fscale` | aktuellen Wert und Hilfe anzeigen |
|
||||
|
||||
**1. Built-in slider (0.64 and up).** Go to Esc → Options → System → Graphics. There's a checkbox and a slider tied to the `useUiScale` and `uiScale` CVars. Tick the checkbox to set your own scale. This setting is saved. You can also type it in chat:
|
||||
**Pixelgenaue Werte** (das macht `/fscale pixel` automatisch):
|
||||
|
||||
```
|
||||
/console useUiScale 1
|
||||
/console uiScale 0.75
|
||||
```
|
||||
| Bildschirmhöhe | Skalierung |
|
||||
|---|---|
|
||||
| 1080 (Full HD) | 0.7111 |
|
||||
| 1440 (WQHD) | 0.5333 |
|
||||
| 2160 (4K) | 0.3556 |
|
||||
| 2880 (5K) | 0.2667 |
|
||||
|
||||
The catch is that Blizzard's UI scale slider stops at 0.64, which can still be too big on a large or high-resolution monitor.
|
||||
**Gut zu wissen**
|
||||
|
||||
**2. Below 0.64 (1440p, 4K, MacBook screens).** For a pixel-perfect UI, use 768 divided by your screen height: 0.5333 at 1440p, 0.3556 at 4K. `/run UIParent:SetScale(0.5333)` works right away, but it only lasts for the current session and resets when you log out. To keep it, you need an addon:
|
||||
|
||||
- **Master Scale (ready-made):** it supports WoW Retail (Interface 120105) and WoW Forever (Interface 16001) from one codebase, with a range of 0.50 to 1.50. If Blizzard resets the scale, for example after a resolution or UI Scale change, Master Scale puts yours back. There are no slash commands. You set it in Esc > Options > AddOns > Master Scale. Nameplates aren't scaled.
|
||||
- **ForeverScale.zip (I wrote this one):** about 60 lines of Lua with no dependencies, if you'd rather not use a third-party addon. It applies your scale again after every login, reload or display change, and waits until combat ends before changing anything. That matters because Forever runs on the modern WoW interface and the Midnight addon restrictions apply. The commands are `/fscale 0.5333`, `/fscale pixel` (works out 768 ÷ your screen height) and `/fscale reset`. The setting is saved for your whole account.
|
||||
|
||||
**Install:** Forever addons go in World of Warcraft > _forever_ > Interface > AddOns, not in the Classic or Retail folder. On a Mac that's `/Applications/World of Warcraft/_forever_/Interface/AddOns/`. Then restart the game completely.
|
||||
|
||||
I checked the syntax and ran the logic against a mock of the WoW functions it calls, but I haven't tried it in the actual Forever client. If the game marks it "out of date" after a patch, run `/dump select(4, GetBuildInfo())` and put that number in the `## Interface:` line of the `.toc` file. Only use one scaling addon at a time, or they'll keep overriding each other.
|
||||
|
||||
*Datei: ForeverScale.zip (Quellcode im Anhang A)*
|
||||
- Im Kampf ändert ForeverScale nichts. Die neue Skalierung gilt dann ab Kampfende.
|
||||
- Nutze nur **ein** Skalierungs-Addon, sonst überschreiben sie sich gegenseitig. Auch Blizzards eigenen Regler setzt ForeverScale wieder zurück, solange es aktiv ist.
|
||||
- `pixel` ist nicht auf 0,30 begrenzt. Auf 5K- und 6K-Bildschirmen liegt der Wert darunter, sonst wäre die Darstellung nicht mehr pixelgenau.
|
||||
|
||||
---
|
||||
|
||||
## 2. Goldbeutel: Gold in einem verschiebbaren Rahmen
|
||||
## Goldbeutel
|
||||
|
||||
**Mike:** cool, kannDu mir auch ein Aden schreiben das meinen Goldstand in einem kleinen beweglichen Rahmen anzeigt
|
||||
Ein kleiner, verschiebbarer Rahmen mit allem, was man unterwegs im Blick haben will:
|
||||
|
||||
**Claude:**
|
||||
```
|
||||
┌─────────────────────────────────────────────────────┐
|
||||
│ 12.345g 67s 89c | Taschen 23 | 87% | iLvl 245 │
|
||||
└─────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
Ich habe dir das Addon geschrieben: **Goldbeutel.zip**. Es zeigt dein Gold mit Gold-, Silber- und Kupfermünzen in einem kleinen dunklen Rahmen. Der Rahmen passt seine Breite an den Betrag an und aktualisiert sich bei jeder Änderung.
|
||||
| Anzeige | Bedeutung | Warnfarbe |
|
||||
|---|---|---|
|
||||
| Gold | dein Gold mit Gold-, Silber- und Kupfermünzen | – |
|
||||
| Taschen | freie Plätze im Rucksack und in den vier normalen Taschen | gelb bei 5 oder weniger, rot bei 0 |
|
||||
| 87% | Zustand des am stärksten beschädigten Ausrüstungsteils | gelb unter 50 %, rot unter 20 % |
|
||||
| iLvl | durchschnittliche Gegenstandsstufe der angelegten Ausrüstung, wie im Charakterfenster | – |
|
||||
|
||||
Spezialtaschen wie Köcher, Kräuter- oder Reagenzientaschen zählen nicht zu den freien Plätzen, weil dort nicht alles hineinpasst. Trägst du nichts mit Haltbarkeit, fällt die Prozentanzeige weg.
|
||||
|
||||
**Tooltip** (Maus über den Rahmen):
|
||||
|
||||
- freie und gesamte Taschenplätze, Spezialtaschen extra
|
||||
- Gesamtzustand der Rüstung und das am stärksten beschädigte Teil
|
||||
- Gegenstandsstufe mit Nachkommastelle und, falls höher, der Wert mit der besten Ausrüstung aus deinen Taschen
|
||||
- Gold gewonnen (grün) oder verloren (rot) in dieser Sitzung. Ein `/reload` setzt das nicht zurück, erst ein neuer Login.
|
||||
- alle deine Charaktere auf dem Realm, in Klassenfarbe und nach Gold sortiert, mit Gesamtsumme. Ein Charakter erscheint, sobald du dich einmal mit ihm eingeloggt hast.
|
||||
|
||||
**Bedienung**
|
||||
|
||||
- **Linke Maustaste gedrückt halten und ziehen:** Rahmen verschieben. Die Position wird gespeichert.
|
||||
- **Rechtsklick:** Rahmen sperren oder entsperren, damit du ihn nicht aus Versehen verschiebst.
|
||||
- **Maus über den Rahmen:** Ein Tooltip zeigt:
|
||||
- wie viel Gold du in dieser Sitzung gewonnen (grün) oder verloren (rot) hast
|
||||
- alle deine Charaktere auf dem Realm, in Klassenfarbe und nach Gold sortiert
|
||||
- die Gesamtsumme
|
||||
| Aktion | Wirkung |
|
||||
|---|---|
|
||||
| Linke Maustaste ziehen | Rahmen verschieben, die Position wird gespeichert |
|
||||
| Rechtsklick | Rahmen sperren oder entsperren |
|
||||
| `/gold` | Rahmen aus- oder einblenden |
|
||||
| `/gold lock` | sperren oder entsperren |
|
||||
| `/gold reset` | Position zurücksetzen und Rahmen einblenden |
|
||||
| `/gold forget <Name>` | gelöschten Charakter aus der Liste entfernen |
|
||||
|
||||
Andere Charaktere erscheinen erst in der Liste, nachdem du dich einmal mit ihnen eingeloggt hast.
|
||||
- **Befehle:**
|
||||
- `/gold` blendet den Rahmen aus oder ein.
|
||||
- `/gold lock` sperrt oder entsperrt ihn.
|
||||
- `/gold reset` setzt die Position zurück.
|
||||
- `/gold forget <Name>` entfernt einen gelöschten Charakter aus der Liste.
|
||||
|
||||
**Installation:** Wie bei ForeverScale: entpacken nach `World of Warcraft/_forever_/Interface/AddOns/`, dann WoW komplett neu starten. Weil der Rahmen am normalen Interface hängt, wird er mit ForeverScale automatisch mitskaliert.
|
||||
|
||||
**Getestet:** Ich habe das Addon gegen eine nachgebaute WoW-Umgebung laufen lassen, über zwei Sitzungen mit zwei Charakteren. Dabei funktionierten Anzeige, Verschieben, Sperren, Tooltip, gespeicherte Position und alle Befehle. Im echten Forever-Client konnte ich es nicht ausprobieren. Falls dort Fehler auftreten, schick mir einfach die Meldung.
|
||||
|
||||
*Datei: Goldbeutel.zip (Quellcode im Anhang B)*
|
||||
`/goldbeutel` funktioniert genauso wie `/gold`. Der Rahmen hängt am normalen Interface und wird mit ForeverScale automatisch mitskaliert.
|
||||
|
||||
---
|
||||
|
||||
## 3. Leistenabstand: Symbolabstand unter 2
|
||||
## Leistenabstand
|
||||
|
||||
**Mike:** bei Aktionsleisten kann ich den Symbolabstand nicht kleiner 2 einstellen
|
||||
Im Bearbeitungsmodus (Edit Mode) lässt sich der Symbolabstand der Aktionsleisten nicht unter **2** einstellen. Leistenabstand erlaubt jeden Wert von **-4 bis 10**. Nach der Installation stehen alle Leisten auf **0**.
|
||||
|
||||
**Claude:**
|
||||
| Befehl | Wirkung |
|
||||
|---|---|
|
||||
| `/abstand` | Status und Hilfe |
|
||||
| `/abstand 0` | Abstand für alle Leisten, auch Kommazahlen wie `-0,5` |
|
||||
| `/abstand 3 1` | Abstand nur für Aktionsleiste 3 |
|
||||
| `/abstand 3 aus` | Leiste 3 wieder Blizzard überlassen, danach `/reload` |
|
||||
| `/abstand aus` | alles ausschalten, danach `/reload` |
|
||||
| `/abstand rahmen` | Leistenrahmen mit verkleinern, an oder aus (experimentell) |
|
||||
|
||||
Ich habe dir dafür das Addon **Leistenabstand.zip** geschrieben. Der Bearbeitungsmodus (Edit Mode) lässt beim Symbolabstand nicht weniger als 2 zu. Nach der Installation stehen alle Leisten auf **Abstand 0**.
|
||||
Als Leiste gehen `1` bis `8` (Aktionsleisten), `haltung` (Haltungsleiste) und `pet` (Begleiterleiste). Negative Werte lassen die Ränder der Symbole überlappen. `/leistenabstand` funktioniert genauso wie `/abstand`.
|
||||
|
||||
**So funktioniert es:** Das Addon ändert Blizzards Abstandswert nicht direkt. Das führt nachweislich zu Fehlern: Wer `buttonPadding` direkt ändert, „verseucht“ diesen Wert (Taint). Der Edit Mode und anderer Blizzard-Code lesen ihn aber, und dann kommen Meldungen über blockierte Aktionen. Empfohlen wird stattdessen, die einzelnen Buttons zu nehmen und ihren Abstand per `SetPoint` neu zu setzen. Genau so macht es das Addon. Jedes Mal, wenn Blizzard eine Leiste neu anordnet, schiebt es die Buttons danach zusammen, und zwar nie im Kampf. Position, Reihen, Symbolgröße und Richtung stellst du weiter im Edit Mode ein. Den Abstandsregler dort übergeht das Addon.
|
||||
**So funktioniert es**
|
||||
|
||||
**Befehle**
|
||||
Blizzards Abstandswert (`buttonPadding`) direkt zu ändern, führt zu Taint: Der Edit Mode und anderer Blizzard-Code lesen diesen Wert, und dann erscheinen Meldungen wie „Aktion blockiert“. Leistenabstand lässt den Wert deshalb in Ruhe. Jedes Mal, wenn Blizzard eine Leiste neu anordnet, setzt es danach nur die Positionen der einzelnen Buttons neu, und zwar nie im Kampf.
|
||||
|
||||
- `/abstand` zeigt den Status.
|
||||
- `/abstand 0` setzt den Abstand für alle Leisten. Erlaubt sind Werte von -4 bis 10, auch Kommazahlen wie `-0,5`. Negative Werte lassen die Ränder überlappen.
|
||||
- `/abstand 3 1` gilt nur für Aktionsleiste 3. Statt der Nummer gehen auch `haltung` (Haltungsleiste) oder `pet` (Begleiterleiste).
|
||||
- `/abstand 3 aus` gibt Leiste 3 wieder an Blizzard zurück. Danach `/reload`.
|
||||
- `/abstand rahmen` schaltet ein, dass auch der Leistenrahmen mit verkleinert wird (experimentell, siehe unten).
|
||||
Position, Reihen, Symbolgröße und Anzahl der Symbole stellst du weiter im Edit Mode ein. Nur den Abstandsregler dort übergeht das Addon. Leere Plätze behalten ihre Lücke, auch wenn „Immer Buttons anzeigen“ aus ist.
|
||||
|
||||
**Zwei Einschränkungen**
|
||||
**Einschränkungen**
|
||||
|
||||
- **Rahmen im Edit Mode:** Ohne `rahmen` bleibt der Markierungsrahmen der Leiste im Edit Mode so groß wie bei Abstand 2. Wenn du eine zweite Leiste daneben einrastest, bleibt deshalb eine Lücke. Mit `rahmen` passt der Rahmen genau. Das geht aber über die bewährte Methode hinaus. Falls Meldungen wie „Aktion blockiert“ kommen, schalte es wieder aus.
|
||||
- **Kampf:** Ordnet Blizzard eine Leiste mitten im Kampf neu an (selten), sind die alten Abstände bis Kampfende zurück. Vorher darf ein Addon die Buttons nicht anfassen.
|
||||
|
||||
**Getestet:** Ich habe es in einer nachgebauten Umgebung mit echtem Ankersystem durchgespielt:
|
||||
|
||||
- waagerechte, senkrechte und mehrreihige Leisten, auch nach links oder unten wachsend
|
||||
- 125 % Symbolgröße
|
||||
- Änderungen im Edit Mode
|
||||
- Kampf
|
||||
- wiederholtes Anwenden ohne Verrutschen
|
||||
|
||||
Die Abstände waren danach überall exakt. Die Namen der Leisten habe ich vom aktuellen Retail-Client übernommen. Wenn `/abstand` in Forever „Nicht gefunden“ meldet oder eine Leiste nicht reagiert, schick mir die Ausgabe, dann passe ich es an.
|
||||
|
||||
Falls du lieber komplett eigene Leisten statt Blizzards willst: McAwesome Action Bars ersetzt die Aktionsleisten in WoW Forever vollständig und hat unter anderem einen eigenen Symbolabstand pro Leiste.
|
||||
|
||||
*Datei: Leistenabstand.zip (Quellcode im Anhang C)*
|
||||
- **Rahmen im Edit Mode:** Ohne `rahmen` bleibt der Markierungsrahmen einer Leiste so groß wie bei Abstand 2. Rastest du eine zweite Leiste daneben ein, bleibt eine Lücke. Mit `rahmen` passt er genau, das geht aber über die bewährte Methode hinaus. Kommen Meldungen wie „Aktion blockiert“, schalte es wieder aus.
|
||||
- **Kampf:** Ordnet Blizzard eine Leiste mitten im Kampf neu an (selten), gelten bis Kampfende wieder die alten Abstände. Vorher darf kein Addon die Buttons anfassen.
|
||||
- **Leistennamen:** Die Namen der Leisten stammen aus dem Retail-Client. Meldet `/abstand` bei einer Leiste „Nicht gefunden“, heißt sie in Forever anders.
|
||||
|
||||
---
|
||||
|
||||
## Quellen
|
||||
## Entwicklung
|
||||
|
||||
- [Master Scale – CurseForge](https://www.curseforge.com/wow/addons/master-scale)
|
||||
- [UI scaling – Warcraft Wiki](https://warcraft.wiki.gg/wiki/UI_scaling)
|
||||
- [Scale'thas – CurseForge](https://www.curseforge.com/wow/addons/scalethas)
|
||||
```
|
||||
ForeverScale/ ForeverScale.toc, ForeverScale.lua
|
||||
Goldbeutel/ Goldbeutel.toc, Goldbeutel.lua
|
||||
Leistenabstand/ Leistenabstand.toc, Leistenabstand.lua
|
||||
tests/ Tests gegen eine nachgebaute WoW-Umgebung
|
||||
make-zip.sh baut WoW-Forever-Addons.zip
|
||||
```
|
||||
|
||||
**Tests** laufen mit [LuaJIT](https://luajit.org) und spielen die Addons gegen eine nachgebaute WoW-API durch. Bei einem Fehler endet das Skript mit Exit-Code 1.
|
||||
|
||||
```sh
|
||||
luajit tests/test_leistenabstand.lua
|
||||
luajit tests/test_goldbeutel_foreverscale.lua
|
||||
```
|
||||
|
||||
**Download aktualisieren:** Nach Änderungen an einem Addon `./make-zip.sh` ausführen und die neue ZIP mit committen. Sonst bietet der Download-Link noch die alte Version an.
|
||||
|
||||
**Status:** Alle drei Addons sind gegen die nachgebaute Umgebung getestet, aber noch nicht im echten Forever-Client. Wenn dort etwas nicht funktioniert, hilft die genaue Fehlermeldung oder die Ausgabe von `/abstand` am meisten.
|
||||
|
||||
## Alternativen und Hintergrund
|
||||
|
||||
- [Master Scale](https://www.curseforge.com/wow/addons/master-scale) und [Scale'thas](https://www.curseforge.com/wow/addons/scalethas): fertige Skalierungs-Addons statt ForeverScale. Master Scale unterstützt Forever, reicht von 0,50 bis 1,50 und wird unter Esc → Optionen → AddOns eingestellt.
|
||||
- [McAwesome Action Bars](https://www.curseforge.com/wow/addons/mcawesome-action-bars): ersetzt die Aktionsleisten in Forever komplett, mit eigenem Symbolabstand pro Leiste.
|
||||
- [UI scaling – Warcraft Wiki](https://warcraft.wiki.gg/wiki/UI_scaling): Hintergrund zur UI-Skalierung und zur 768-Formel.
|
||||
- [In Game Menu and UI rescale via custom addon – Blizzard-Forum (EU)](https://eu.forums.blizzard.com/en/wow/t/in-game-menu-and-ui-rescale-via-custom-addon/527340)
|
||||
- [How to modify padding for MainMenuBar (action bar 1) in addon – Blizzard-Forum (US)](https://us.forums.blizzard.com/en/wow/t/how-to-modify-padding-for-mainmenubar-action-bar-1-in-addon/1394658)
|
||||
- [McAwesome Action Bars – CurseForge](https://www.curseforge.com/wow/addons/mcawesome-action-bars)
|
||||
|
||||
---
|
||||
|
||||
## Anhang: Quellcode
|
||||
|
||||
Jedes Addon ist ein eigener Ordner unter `World of Warcraft/_forever_/Interface/AddOns/` mit genau den zwei Dateien, die hier stehen.
|
||||
|
||||
### Anhang A: ForeverScale
|
||||
|
||||
`ForeverScale/ForeverScale.toc`
|
||||
|
||||
```
|
||||
## Interface: 16001
|
||||
## Title: ForeverScale
|
||||
## Notes: Keeps your UI scale after reloads and relogs, including below Blizzard's 0.64 floor. /fscale
|
||||
## SavedVariables: ForeverScaleDB
|
||||
ForeverScale.lua
|
||||
```
|
||||
|
||||
`ForeverScale/ForeverScale.lua`
|
||||
|
||||
```lua
|
||||
-- ForeverScale: re-applies a fixed UIParent scale on every login/reload,
|
||||
-- so values below Blizzard's 0.64 slider floor stick.
|
||||
-- /fscale 0.5333 set a scale (0.30 - 1.50), saved account-wide
|
||||
-- /fscale pixel pixel-perfect: 768 / your vertical resolution, worked out
|
||||
-- again whenever the resolution changes. Not limited to
|
||||
-- 0.30 - 1.50, so on 5K/6K screens it goes below 0.30.
|
||||
-- /fscale reset stop overriding (then /reload)
|
||||
|
||||
local ADDON = ...
|
||||
local f = CreateFrame("Frame")
|
||||
|
||||
-- the scale to enforce, or nil if there is no override
|
||||
local function target()
|
||||
local db = ForeverScaleDB
|
||||
if not db then return end
|
||||
if db.pixel then
|
||||
local _, h = GetPhysicalScreenSize()
|
||||
if h and h > 0 then return 768 / h end
|
||||
return
|
||||
end
|
||||
return db.scale
|
||||
end
|
||||
|
||||
local function apply()
|
||||
local s = target()
|
||||
if not s then return end
|
||||
if InCombatLockdown() then
|
||||
-- UIParent has protected children; wait until combat ends
|
||||
f:RegisterEvent("PLAYER_REGEN_ENABLED")
|
||||
return
|
||||
end
|
||||
if math.abs(UIParent:GetScale() - s) > 0.0001 then
|
||||
UIParent:SetScale(s)
|
||||
end
|
||||
end
|
||||
|
||||
f:RegisterEvent("ADDON_LOADED")
|
||||
f:RegisterEvent("PLAYER_LOGIN")
|
||||
f:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
f:RegisterEvent("UI_SCALE_CHANGED")
|
||||
f:RegisterEvent("DISPLAY_SIZE_CHANGED")
|
||||
|
||||
f:SetScript("OnEvent", function(self, event, arg1)
|
||||
if event == "ADDON_LOADED" then
|
||||
if arg1 == ADDON then
|
||||
ForeverScaleDB = ForeverScaleDB or {}
|
||||
self:UnregisterEvent("ADDON_LOADED")
|
||||
end
|
||||
return
|
||||
end
|
||||
if event == "PLAYER_REGEN_ENABLED" then
|
||||
self:UnregisterEvent("PLAYER_REGEN_ENABLED")
|
||||
end
|
||||
-- Blizzard may re-apply its own scale during these events; go after it
|
||||
C_Timer.After(0, apply)
|
||||
end)
|
||||
|
||||
SLASH_FOREVERSCALE1 = "/fscale"
|
||||
SlashCmdList.FOREVERSCALE = function(msg)
|
||||
msg = strtrim(msg or ""):lower()
|
||||
|
||||
if msg == "reset" then
|
||||
ForeverScaleDB.scale, ForeverScaleDB.pixel = nil, nil
|
||||
print("ForeverScale: override cleared. /reload to return to Blizzard's scale.")
|
||||
return
|
||||
elseif msg == "pixel" then
|
||||
ForeverScaleDB.scale, ForeverScaleDB.pixel = nil, true
|
||||
else
|
||||
local v = tonumber(msg)
|
||||
if not v or v < 0.3 or v > 1.5 then
|
||||
print(string.format(
|
||||
"ForeverScale: /fscale <0.30-1.50> | pixel | reset (current %.4f)",
|
||||
UIParent:GetScale()))
|
||||
return
|
||||
end
|
||||
ForeverScaleDB.scale, ForeverScaleDB.pixel = v, nil
|
||||
end
|
||||
|
||||
apply()
|
||||
print(string.format("ForeverScale: scale set to %.4f%s%s", target() or UIParent:GetScale(),
|
||||
ForeverScaleDB.pixel and " (pixel, follows your resolution)" or "",
|
||||
InCombatLockdown() and " (applies after combat)" or ""))
|
||||
end
|
||||
```
|
||||
|
||||
### Anhang B: Goldbeutel
|
||||
|
||||
`Goldbeutel/Goldbeutel.toc`
|
||||
|
||||
```
|
||||
## Interface: 16001
|
||||
## Title: Goldbeutel
|
||||
## Notes: Zeigt dein Gold in einem kleinen, verschiebbaren Rahmen. /gold
|
||||
## SavedVariables: GoldbeutelDB
|
||||
Goldbeutel.lua
|
||||
```
|
||||
|
||||
`Goldbeutel/Goldbeutel.lua`
|
||||
|
||||
```lua
|
||||
-- Goldbeutel: zeigt dein Gold in einem kleinen, verschiebbaren Rahmen.
|
||||
-- Linksziehen verschieben
|
||||
-- Rechtsklick sperren / entsperren
|
||||
-- Mauszeiger drauf Gewinn/Verlust dieser Sitzung + alle Charaktere des Realms
|
||||
-- /gold ein-/ausblenden
|
||||
-- /gold lock sperren / entsperren
|
||||
-- /gold reset Position zurücksetzen
|
||||
-- /gold forget <Name> Charakter aus der Liste entfernen
|
||||
|
||||
local ADDON = ...
|
||||
|
||||
local GOLD = "|TInterface\\MoneyFrame\\UI-GoldIcon:0:0:2:0|t"
|
||||
local SILVER = "|TInterface\\MoneyFrame\\UI-SilverIcon:0:0:2:0|t"
|
||||
local COPPER = "|TInterface\\MoneyFrame\\UI-CopperIcon:0:0:2:0|t"
|
||||
|
||||
local db, realm, player, sessionStart
|
||||
local frame, text
|
||||
|
||||
local function say(s)
|
||||
print("|cffffd100Goldbeutel:|r " .. s)
|
||||
end
|
||||
|
||||
-- 1234567 -> "1.234.567" (nutzt das Trennzeichen des Clients, falls vorhanden)
|
||||
local function thousands(n)
|
||||
if BreakUpLargeNumbers then return BreakUpLargeNumbers(n) end
|
||||
local s = tostring(n):reverse():gsub("(%d%d%d)", "%1."):reverse()
|
||||
return (s:gsub("^%.", ""))
|
||||
end
|
||||
|
||||
local function formatMoney(c)
|
||||
c = math.floor(c or 0)
|
||||
local g = math.floor(c / 10000)
|
||||
local s = math.floor(c / 100) % 100
|
||||
local k = c % 100
|
||||
if g > 0 then
|
||||
return string.format("%s%s %02d%s %02d%s", thousands(g), GOLD, s, SILVER, k, COPPER)
|
||||
elseif s > 0 then
|
||||
return string.format("%d%s %02d%s", s, SILVER, k, COPPER)
|
||||
end
|
||||
return string.format("%d%s", k, COPPER)
|
||||
end
|
||||
|
||||
local function classColored(name, class)
|
||||
local c = class and RAID_CLASS_COLORS and RAID_CLASS_COLORS[class]
|
||||
if c and c.colorStr then
|
||||
return "|c" .. c.colorStr .. name .. "|r"
|
||||
end
|
||||
return name
|
||||
end
|
||||
|
||||
-- string.lower kennt nur A-Z. Fuer Namen wie "Ärger" auch À-Þ (UTF-8 C3 80-9E,
|
||||
-- ausser ×) in Kleinbuchstaben umwandeln.
|
||||
local function lower(s)
|
||||
return (s:lower():gsub("\195([\128-\158])", function(c)
|
||||
if c ~= "\151" then return "\195" .. string.char(c:byte() + 32) end
|
||||
end))
|
||||
end
|
||||
|
||||
-- Felder aktualisieren statt den Eintrag zu ersetzen, damit der
|
||||
-- Sitzungsstart (session) erhalten bleibt
|
||||
local function record()
|
||||
local chars = db.chars[realm]
|
||||
local me = chars[player] or {}
|
||||
chars[player] = me
|
||||
local _, class = UnitClass("player")
|
||||
me.money, me.class = GetMoney(), class
|
||||
end
|
||||
|
||||
local function update()
|
||||
record()
|
||||
text:SetText(formatMoney(GetMoney()))
|
||||
frame:SetSize(math.ceil(text:GetStringWidth()) + 20, math.ceil(text:GetStringHeight()) + 14)
|
||||
end
|
||||
|
||||
local function showTooltip(self)
|
||||
-- Tooltip zur Bildschirmmitte hin öffnen, damit er den Rahmen nicht verdeckt
|
||||
local _, y = self:GetCenter()
|
||||
local anchor = (y and y > UIParent:GetHeight() / 2) and "ANCHOR_BOTTOM" or "ANCHOR_TOP"
|
||||
GameTooltip:SetOwner(self, anchor)
|
||||
GameTooltip:AddLine("Goldbeutel")
|
||||
|
||||
local diff = GetMoney() - sessionStart
|
||||
local sign, r, g, b = "", 1, 1, 1
|
||||
if diff > 0 then
|
||||
sign, r, g, b = "+", 0.2, 1, 0.2
|
||||
elseif diff < 0 then
|
||||
sign, r, g, b = "-", 1, 0.3, 0.3
|
||||
end
|
||||
GameTooltip:AddDoubleLine("Diese Sitzung:", sign .. formatMoney(math.abs(diff)), 1, 0.82, 0, r, g, b)
|
||||
GameTooltip:AddLine(" ")
|
||||
|
||||
local list, total = {}, 0
|
||||
for name, info in pairs(db.chars[realm]) do
|
||||
local m = info.money or 0
|
||||
list[#list + 1] = { name = name, money = m, class = info.class }
|
||||
total = total + m
|
||||
end
|
||||
table.sort(list, function(a, b) return a.money > b.money end)
|
||||
|
||||
for _, e in ipairs(list) do
|
||||
local label = classColored(e.name, e.class)
|
||||
if e.name == player then label = label .. " *" end
|
||||
GameTooltip:AddDoubleLine(label, formatMoney(e.money), 1, 1, 1, 1, 1, 1)
|
||||
end
|
||||
if #list > 1 then
|
||||
GameTooltip:AddDoubleLine("Gesamt (" .. realm .. "):", formatMoney(total), 1, 0.82, 0, 1, 1, 1)
|
||||
end
|
||||
|
||||
GameTooltip:AddLine(" ")
|
||||
if db.locked then
|
||||
GameTooltip:AddLine("Gesperrt. Rechtsklick zum Entsperren.", 0.6, 0.6, 0.6)
|
||||
else
|
||||
GameTooltip:AddLine("Ziehen: verschieben, Rechtsklick: sperren", 0.6, 0.6, 0.6)
|
||||
end
|
||||
GameTooltip:Show()
|
||||
end
|
||||
|
||||
local function toggleLock()
|
||||
db.locked = not db.locked
|
||||
say(db.locked and "Rahmen gesperrt." or "Rahmen entsperrt.")
|
||||
if GameTooltip:IsOwned(frame) then showTooltip(frame) end
|
||||
end
|
||||
|
||||
local function savePos()
|
||||
local point, _, relPoint, x, y = frame:GetPoint(1)
|
||||
db.pos = { point, relPoint, x, y }
|
||||
end
|
||||
|
||||
local function restorePos()
|
||||
frame:ClearAllPoints()
|
||||
local p = db.pos
|
||||
if p then
|
||||
frame:SetPoint(p[1], UIParent, p[2], p[3], p[4])
|
||||
else
|
||||
frame:SetPoint("CENTER", UIParent, "CENTER", 0, -200)
|
||||
end
|
||||
end
|
||||
|
||||
local function createFrame()
|
||||
frame = CreateFrame("Frame", "GoldbeutelFrame", UIParent, "BackdropTemplate")
|
||||
frame:SetFrameStrata("MEDIUM")
|
||||
frame:SetClampedToScreen(true)
|
||||
frame:SetMovable(true)
|
||||
frame:EnableMouse(true)
|
||||
frame:RegisterForDrag("LeftButton")
|
||||
-- Position speichern wir selbst, nicht im layout-cache des Clients
|
||||
if frame.SetDontSavePosition then frame:SetDontSavePosition(true) end
|
||||
|
||||
frame:SetBackdrop({
|
||||
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
|
||||
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
|
||||
tile = true, tileSize = 16, edgeSize = 12,
|
||||
insets = { left = 3, right = 3, top = 3, bottom = 3 },
|
||||
})
|
||||
frame:SetBackdropColor(0, 0, 0, 0.75)
|
||||
frame:SetBackdropBorderColor(0.6, 0.6, 0.6, 1)
|
||||
|
||||
text = frame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
|
||||
text:SetPoint("CENTER")
|
||||
|
||||
frame:SetScript("OnDragStart", function(self)
|
||||
if db.locked then return end
|
||||
self.dragging = true
|
||||
self:StartMoving()
|
||||
end)
|
||||
frame:SetScript("OnDragStop", function(self)
|
||||
if not self.dragging then return end
|
||||
self.dragging = false
|
||||
self:StopMovingOrSizing()
|
||||
savePos()
|
||||
end)
|
||||
frame:SetScript("OnMouseUp", function(_, button)
|
||||
if button == "RightButton" then toggleLock() end
|
||||
end)
|
||||
frame:SetScript("OnEnter", showTooltip)
|
||||
frame:SetScript("OnLeave", function() GameTooltip:Hide() end)
|
||||
|
||||
restorePos()
|
||||
frame:SetShown(not db.hidden)
|
||||
end
|
||||
|
||||
local ev = CreateFrame("Frame")
|
||||
ev:RegisterEvent("ADDON_LOADED")
|
||||
ev:RegisterEvent("PLAYER_LOGIN")
|
||||
ev:RegisterEvent("PLAYER_MONEY")
|
||||
ev:RegisterEvent("PLAYER_LOGOUT")
|
||||
ev:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
ev:SetScript("OnEvent", function(self, event, arg1, arg2)
|
||||
if event == "ADDON_LOADED" then
|
||||
if arg1 ~= ADDON then return end
|
||||
GoldbeutelDB = GoldbeutelDB or {}
|
||||
db = GoldbeutelDB
|
||||
db.chars = db.chars or {}
|
||||
self:UnregisterEvent("ADDON_LOADED")
|
||||
elseif event == "PLAYER_LOGIN" then
|
||||
realm, player = GetRealmName(), UnitName("player")
|
||||
db.chars[realm] = db.chars[realm] or {}
|
||||
sessionStart = GetMoney()
|
||||
createFrame()
|
||||
update()
|
||||
elseif event == "PLAYER_ENTERING_WORLD" then
|
||||
-- PLAYER_LOGIN kommt auch bei /reload. Erst hier steht fest, ob es nur ein
|
||||
-- Reload war (arg2 = isReloadingUi); dann zaehlt die Sitzung weiter.
|
||||
self:UnregisterEvent("PLAYER_ENTERING_WORLD")
|
||||
local me = db.chars[realm][player]
|
||||
if arg2 and me.session then
|
||||
sessionStart = me.session
|
||||
else
|
||||
me.session = sessionStart
|
||||
end
|
||||
elseif event == "PLAYER_MONEY" then
|
||||
if frame then update() end
|
||||
elseif event == "PLAYER_LOGOUT" then
|
||||
if realm then record() end
|
||||
end
|
||||
end)
|
||||
|
||||
SLASH_GOLDBEUTEL1 = "/gold"
|
||||
SLASH_GOLDBEUTEL2 = "/goldbeutel"
|
||||
SlashCmdList.GOLDBEUTEL = function(input)
|
||||
local cmd, arg = strtrim(input or ""):match("^(%S*)%s*(.-)$")
|
||||
cmd = cmd:lower()
|
||||
|
||||
if cmd == "" then
|
||||
db.hidden = frame:IsShown()
|
||||
frame:SetShown(not db.hidden)
|
||||
if db.hidden then say("ausgeblendet. /gold blendet ihn wieder ein.") end
|
||||
elseif cmd == "lock" then
|
||||
toggleLock()
|
||||
elseif cmd == "reset" then
|
||||
db.pos, db.hidden = nil, false
|
||||
restorePos()
|
||||
frame:Show()
|
||||
say("Position zurückgesetzt.")
|
||||
elseif cmd == "forget" and arg ~= "" then
|
||||
local chars, want = db.chars[realm], lower(arg)
|
||||
for name in pairs(chars) do
|
||||
if lower(name) == want and name ~= player then
|
||||
chars[name] = nil
|
||||
say(name .. " entfernt.")
|
||||
return
|
||||
end
|
||||
end
|
||||
say("Kein anderer Charakter namens '" .. arg .. "' auf " .. realm .. ".")
|
||||
else
|
||||
say("/gold (ein/aus), /gold lock, /gold reset, /gold forget <Name>")
|
||||
end
|
||||
end
|
||||
```
|
||||
|
||||
### Anhang C: Leistenabstand
|
||||
|
||||
`Leistenabstand/Leistenabstand.toc`
|
||||
|
||||
```
|
||||
## Interface: 16001
|
||||
## Title: Leistenabstand
|
||||
## Notes: Symbolabstand der Aktionsleisten unter 2 (auch 0 oder negativ). /abstand
|
||||
## SavedVariables: LeistenabstandDB
|
||||
Leistenabstand.lua
|
||||
```
|
||||
|
||||
`Leistenabstand/Leistenabstand.lua`
|
||||
|
||||
```lua
|
||||
-- Leistenabstand: erlaubt bei Blizzards Aktionsleisten Symbolabstaende unter 2.
|
||||
-- Der Bearbeitungsmodus (Edit Mode) bleibt fuer Position, Reihen, Symbolgroesse usw.
|
||||
-- zustaendig. Nach jedem Blizzard-Layout schiebt das Addon nur die Buttons enger
|
||||
-- zusammen. Es aendert keine Blizzard-Variablen (das wuerde Taint-Fehler ausloesen),
|
||||
-- sondern setzt nur die Anker der Buttons neu, und nie im Kampf.
|
||||
--
|
||||
-- /abstand Status und Hilfe
|
||||
-- /abstand 0 Abstand fuer alle Leisten (-4 bis 10)
|
||||
-- /abstand 3 1 nur Aktionsleiste 3 (1-8, haltung, pet)
|
||||
-- /abstand 3 aus Leiste 3 wieder Blizzard ueberlassen (danach /reload)
|
||||
-- /abstand aus alles aus (danach /reload)
|
||||
-- /abstand rahmen Leistenrahmen mitverkleinern an/aus (experimentell)
|
||||
|
||||
local ADDON = ...
|
||||
|
||||
local BARS = {
|
||||
{ key = "1", name = "Aktionsleiste 1", frames = { "MainActionBar", "MainMenuBar" }, prefix = "ActionButton", n = 12 },
|
||||
{ key = "2", name = "Aktionsleiste 2", frames = { "MultiBarBottomLeft" }, prefix = "MultiBarBottomLeftButton", n = 12 },
|
||||
{ key = "3", name = "Aktionsleiste 3", frames = { "MultiBarBottomRight" }, prefix = "MultiBarBottomRightButton", n = 12 },
|
||||
{ key = "4", name = "Aktionsleiste 4", frames = { "MultiBarRight" }, prefix = "MultiBarRightButton", n = 12 },
|
||||
{ key = "5", name = "Aktionsleiste 5", frames = { "MultiBarLeft" }, prefix = "MultiBarLeftButton", n = 12 },
|
||||
{ key = "6", name = "Aktionsleiste 6", frames = { "MultiBar5" }, prefix = "MultiBar5Button", n = 12 },
|
||||
{ key = "7", name = "Aktionsleiste 7", frames = { "MultiBar6" }, prefix = "MultiBar6Button", n = 12 },
|
||||
{ key = "8", name = "Aktionsleiste 8", frames = { "MultiBar7" }, prefix = "MultiBar7Button", n = 12 },
|
||||
-- Haltungsbuttons sind nie "leer": ausgeblendet heisst, die Haltung gibt es nicht
|
||||
{ key = "haltung", name = "Haltungsleiste", frames = { "StanceBar" }, prefix = "StanceButton", n = 10, onlyShown = true },
|
||||
{ key = "pet", name = "Begleiterleiste", frames = { "PetActionBar" }, prefix = "PetActionButton", n = 10 },
|
||||
}
|
||||
local BY_KEY = {}
|
||||
for _, def in ipairs(BARS) do BY_KEY[def.key] = def end
|
||||
|
||||
local MIN_PAD, MAX_PAD = -4, 10
|
||||
|
||||
local db
|
||||
local ev = CreateFrame("Frame")
|
||||
local pending, scheduled = {}, {}
|
||||
|
||||
local function say(s)
|
||||
print("|cff66bbffLeistenabstand:|r " .. s)
|
||||
end
|
||||
|
||||
local function padFor(def)
|
||||
local v = db.bars[def.key]
|
||||
if v == false then return nil end
|
||||
if v ~= nil then return v end
|
||||
return db.all
|
||||
end
|
||||
|
||||
local function getButtons(def)
|
||||
local bar = def.bar
|
||||
if bar and type(bar.actionButtons) == "table" and #bar.actionButtons > 0 then
|
||||
return bar.actionButtons
|
||||
end
|
||||
local list = {}
|
||||
for i = 1, def.n do
|
||||
local b = _G[def.prefix .. i]
|
||||
if b then list[#list + 1] = b end
|
||||
end
|
||||
return list
|
||||
end
|
||||
|
||||
-- Die Buttons, die Blizzard ins Raster legt. Dazu gehoeren auch leere Slots, die
|
||||
-- bei ausgeschaltetem "Immer Buttons anzeigen" ausgeblendet sind: Blizzard laesst
|
||||
-- ihre Luecke stehen, und wenn sie wieder erscheinen (Zauber hineingezogen, Raster
|
||||
-- beim Ziehen, Leistenwechsel), muessen sie schon am richtigen Platz sein. Buttons
|
||||
-- jenseits von "Anzahl Symbole" gehoeren nicht dazu.
|
||||
local function gridButtons(def)
|
||||
local all = getButtons(def)
|
||||
local n
|
||||
if not def.onlyShown then
|
||||
n = def.bar.numShowingButtons
|
||||
if type(n) ~= "number" then
|
||||
-- Feld fehlt: bis zum letzten sichtbaren Button, Luecken dazwischen zaehlen mit
|
||||
n = 0
|
||||
for i, b in ipairs(all) do
|
||||
if b:IsShown() then n = i end
|
||||
end
|
||||
end
|
||||
end
|
||||
local list = {}
|
||||
for i, b in ipairs(all) do
|
||||
local inGrid
|
||||
if n then inGrid = i <= n else inGrid = b:IsShown() end
|
||||
if inGrid and b:GetCenter() then list[#list + 1] = b end
|
||||
end
|
||||
return list
|
||||
end
|
||||
|
||||
-- sortiert die Werte und fasst nahe beieinanderliegende zu einer Spalte/Reihe zusammen
|
||||
local function clusters(values, tol)
|
||||
table.sort(values)
|
||||
local reps = {}
|
||||
for _, v in ipairs(values) do
|
||||
if #reps == 0 or math.abs(v - reps[#reps]) > tol then reps[#reps + 1] = v end
|
||||
end
|
||||
return reps
|
||||
end
|
||||
|
||||
local function rank(reps, v, tol)
|
||||
for i, r in ipairs(reps) do
|
||||
if math.abs(v - r) <= tol then return i end
|
||||
end
|
||||
return 1
|
||||
end
|
||||
|
||||
-- Rechteck eines Buttons in Koordinaten der Leiste
|
||||
local function rectIn(btn, bar)
|
||||
local L, R, T, B = btn:GetLeft(), btn:GetRight(), btn:GetTop(), btn:GetBottom()
|
||||
if not L then return end
|
||||
local k = btn:GetEffectiveScale() / bar:GetEffectiveScale()
|
||||
return L * k, R * k, T * k, B * k
|
||||
end
|
||||
|
||||
-- Leistenrahmen auf die zusammengeschobenen Buttons verkleinern. Der Rand wird
|
||||
-- auf der Seite des ersten Buttons gemessen (den verschiebt das Addon nie) und
|
||||
-- auf der anderen Seite gespiegelt. So bleibt das Ergebnis stabil, egal ob der
|
||||
-- Rahmen vorher Blizzards Groesse hatte oder schon verkleinert war.
|
||||
local function fitBar(bar, anchor, grid)
|
||||
local l, r, t, b
|
||||
for _, btn in ipairs(grid) do
|
||||
local L, R, T, B = rectIn(btn, bar)
|
||||
if L then
|
||||
l = l and math.min(l, L) or L
|
||||
r = r and math.max(r, R) or R
|
||||
t = t and math.max(t, T) or T
|
||||
b = b and math.min(b, B) or B
|
||||
end
|
||||
end
|
||||
local aL, _, _, aB = rectIn(anchor, bar)
|
||||
local bL, bR, bT, bB = bar:GetLeft(), bar:GetRight(), bar:GetTop(), bar:GetBottom()
|
||||
if not (l and aL and bL) then return end
|
||||
local ix = (math.abs(aL - l) < 0.5) and (l - bL) or (bR - r)
|
||||
local iy = (math.abs(aB - b) < 0.5) and (b - bB) or (bT - t)
|
||||
if ix < 0 or iy < 0 then return end
|
||||
bar:SetSize(r - l + 2 * ix, t - b + 2 * iy)
|
||||
end
|
||||
|
||||
local function compress(def, pad)
|
||||
local bar = def.bar
|
||||
local grid = gridButtons(def)
|
||||
if #grid < 2 then return end
|
||||
|
||||
-- Der erste Button bleibt, wo Blizzard ihn hingesetzt hat; alle anderen
|
||||
-- werden relativ zu ihm angeordnet. Falls er selbst an einem anderen
|
||||
-- Button haengt, lieber nichts anfassen (sonst Ankerschleife).
|
||||
local anchor = grid[1]
|
||||
for i = 1, anchor:GetNumPoints() do
|
||||
local _, rel = anchor:GetPoint(i)
|
||||
for _, b in ipairs(grid) do
|
||||
if rel == b then return end
|
||||
end
|
||||
end
|
||||
|
||||
-- Raster (Spalte/Reihe) aus Blizzards Positionen ablesen, in Bildschirmkoordinaten
|
||||
local w, h = anchor:GetSize()
|
||||
local s = anchor:GetEffectiveScale()
|
||||
local tolX, tolY = w * s / 2, h * s / 2
|
||||
local px, py, xs, ys = {}, {}, {}, {}
|
||||
for i, b in ipairs(grid) do
|
||||
local x, y = b:GetCenter()
|
||||
local es = b:GetEffectiveScale()
|
||||
px[i], py[i] = x * es, -y * es -- y negiert: Reihe 1 = oben
|
||||
xs[i], ys[i] = px[i], py[i]
|
||||
end
|
||||
local cols, rows = clusters(xs, tolX), clusters(ys, tolY)
|
||||
local c0, r0 = rank(cols, px[1], tolX), rank(rows, py[1], tolY)
|
||||
|
||||
for i = 2, #grid do
|
||||
local b = grid[i]
|
||||
local dc = rank(cols, px[i], tolX) - c0
|
||||
local dr = rank(rows, py[i], tolY) - r0
|
||||
b:ClearAllPoints()
|
||||
b:SetPoint("CENTER", anchor, "CENTER", dc * (w + pad), -dr * (h + pad))
|
||||
end
|
||||
|
||||
if db.resize then fitBar(bar, anchor, grid) end
|
||||
end
|
||||
|
||||
local function apply(def)
|
||||
local pad = padFor(def)
|
||||
if not pad or not def.bar then return end
|
||||
if InCombatLockdown() then
|
||||
pending[def] = true
|
||||
ev:RegisterEvent("PLAYER_REGEN_ENABLED")
|
||||
return
|
||||
end
|
||||
compress(def, pad)
|
||||
end
|
||||
|
||||
-- einen Frame spaeter ausfuehren, damit Blizzards Layout komplett fertig ist
|
||||
local function schedule(def)
|
||||
if scheduled[def] then return end
|
||||
scheduled[def] = true
|
||||
C_Timer.After(0, function()
|
||||
scheduled[def] = nil
|
||||
apply(def)
|
||||
end)
|
||||
end
|
||||
|
||||
local function scheduleAll()
|
||||
for _, def in ipairs(BARS) do schedule(def) end
|
||||
end
|
||||
|
||||
local function setup()
|
||||
for _, def in ipairs(BARS) do
|
||||
for _, fname in ipairs(def.frames) do
|
||||
if _G[fname] then
|
||||
def.bar = _G[fname]
|
||||
break
|
||||
end
|
||||
end
|
||||
local bar = def.bar
|
||||
if bar then
|
||||
if type(bar.UpdateGridLayout) == "function" then
|
||||
hooksecurefunc(bar, "UpdateGridLayout", function() schedule(def) end)
|
||||
end
|
||||
bar:HookScript("OnShow", function() schedule(def) end)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
ev:RegisterEvent("ADDON_LOADED")
|
||||
ev:RegisterEvent("PLAYER_LOGIN")
|
||||
ev:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
ev:RegisterEvent("EDIT_MODE_LAYOUTS_UPDATED")
|
||||
ev:SetScript("OnEvent", function(self, event, arg1)
|
||||
if event == "ADDON_LOADED" then
|
||||
if arg1 ~= ADDON then return end
|
||||
LeistenabstandDB = LeistenabstandDB or { all = 0 }
|
||||
db = LeistenabstandDB
|
||||
db.bars = db.bars or {}
|
||||
self:UnregisterEvent("ADDON_LOADED")
|
||||
elseif event == "PLAYER_LOGIN" then
|
||||
setup()
|
||||
scheduleAll()
|
||||
elseif event == "PLAYER_REGEN_ENABLED" then
|
||||
self:UnregisterEvent("PLAYER_REGEN_ENABLED")
|
||||
for def in pairs(pending) do
|
||||
pending[def] = nil
|
||||
apply(def)
|
||||
end
|
||||
else
|
||||
scheduleAll()
|
||||
end
|
||||
end)
|
||||
|
||||
local function fmt(v)
|
||||
if v == nil then return "Blizzard" end
|
||||
return (string.format("%.2f", v):gsub("%.?0+$", ""))
|
||||
end
|
||||
|
||||
local function status()
|
||||
say("Alle Leisten: " .. fmt(db.all) .. (db.resize and ", Rahmen verkleinern: an" or ""))
|
||||
local missing = {}
|
||||
for _, def in ipairs(BARS) do
|
||||
if not def.bar then
|
||||
missing[#missing + 1] = def.key
|
||||
elseif db.bars[def.key] ~= nil then
|
||||
say(" " .. def.name .. ": " .. fmt(padFor(def)))
|
||||
end
|
||||
end
|
||||
if #missing > 0 then say("Nicht gefunden: " .. table.concat(missing, ", ")) end
|
||||
say("/abstand <Wert>, /abstand <1-8|haltung|pet> <Wert|aus>, /abstand aus, /abstand rahmen")
|
||||
end
|
||||
|
||||
local function parsePad(s)
|
||||
local v = tonumber((s:gsub(",", ".")))
|
||||
if v and v >= MIN_PAD and v <= MAX_PAD then return v end
|
||||
end
|
||||
|
||||
SLASH_LEISTENABSTAND1 = "/abstand"
|
||||
SLASH_LEISTENABSTAND2 = "/leistenabstand"
|
||||
SlashCmdList.LEISTENABSTAND = function(input)
|
||||
local a, b = strtrim(input or ""):lower():match("^(%S*)%s*(%S*)")
|
||||
|
||||
if a == "" then
|
||||
status()
|
||||
elseif a == "aus" then
|
||||
db.all, db.bars = nil, {}
|
||||
say("aus. /reload stellt Blizzards Abstände wieder her.")
|
||||
elseif a == "rahmen" then
|
||||
db.resize = not db.resize
|
||||
if db.resize then
|
||||
say("Rahmen werden mitverkleinert (experimentell). Bei Fehlermeldungen wieder ausschalten.")
|
||||
scheduleAll()
|
||||
else
|
||||
say("Rahmen werden nicht mehr verkleinert. /reload, um sie zurückzusetzen.")
|
||||
end
|
||||
elseif b == "" and parsePad(a) then
|
||||
db.all = parsePad(a)
|
||||
say("Abstand für alle Leisten: " .. fmt(db.all))
|
||||
scheduleAll()
|
||||
elseif BY_KEY[a] and b ~= "" then
|
||||
local def = BY_KEY[a]
|
||||
if b == "aus" then
|
||||
db.bars[a] = false
|
||||
say(def.name .. ": Blizzard. /reload, damit es wirkt.")
|
||||
elseif parsePad(b) then
|
||||
db.bars[a] = parsePad(b)
|
||||
say(def.name .. ": " .. fmt(db.bars[a]))
|
||||
if not def.bar then say("(" .. def.name .. " gibt es in diesem Client nicht.)") end
|
||||
schedule(def)
|
||||
else
|
||||
say("Wert muss zwischen " .. MIN_PAD .. " und " .. MAX_PAD .. " liegen.")
|
||||
end
|
||||
else
|
||||
status()
|
||||
end
|
||||
end
|
||||
```
|
||||
- [How to modify padding for MainMenuBar in addon – Blizzard-Forum (US)](https://us.forums.blizzard.com/en/wow/t/how-to-modify-padding-for-mainmenubar-action-bar-1-in-addon/1394658): warum man `buttonPadding` nicht direkt ändern sollte.
|
||||
Binary file not shown.
@@ -8,7 +8,16 @@ local noop = function() end
|
||||
local function obj(t) return setmetatable(t or {}, {__index = function() return noop end}) end
|
||||
|
||||
---------------------------------------------------------------- Goldbeutel
|
||||
local money, ev, lines
|
||||
local money, ev, lines, shownText, gtimers
|
||||
-- Ausgangszustand fuer Taschen, Ruestung und Gegenstandsstufe (in Tests veraenderbar)
|
||||
-- bags[i] = { Plaetze, frei, Taschentyp }; Index 0 = Rucksack, 5 = Reagenzientasche
|
||||
local bags, dura, ilvl
|
||||
local function defaultGear()
|
||||
bags = { [0] = {16, 5, 0}, {20, 10, 0}, {16, 16, 1}, {0, 0, 0}, {20, 8, 0}, {36, 30, 0} }
|
||||
dura = { [1] = {45, 100}, [5] = {100, 100}, [7] = {80, 80} } -- Kopf, Brust, Beine
|
||||
ilvl = {247.14, 245.34} -- beste, angelegt
|
||||
end
|
||||
defaultGear()
|
||||
local function startGold(name, db)
|
||||
GoldbeutelDB = db
|
||||
print = noop
|
||||
@@ -18,6 +27,16 @@ local function startGold(name, db)
|
||||
UnitName = function() return name end
|
||||
UnitClass = function() return "Magier", "MAGE" end
|
||||
GetMoney = function() return money end
|
||||
NUM_BAG_SLOTS, NUM_TOTAL_EQUIPPED_BAG_SLOTS, INVSLOT_FIRST_EQUIPPED, INVSLOT_LAST_EQUIPPED = 4, 5, 1, 19
|
||||
C_Container = {
|
||||
GetContainerNumSlots = function(b) return bags[b] and bags[b][1] or 0 end,
|
||||
GetContainerNumFreeSlots = function(b) if bags[b] then return bags[b][2], bags[b][3] end return 0, 0 end,
|
||||
}
|
||||
GetInventoryItemDurability = function(s) if dura[s] then return dura[s][1], dura[s][2] end end
|
||||
GetInventoryItemLink = function(_, s) return "[Item" .. s .. "]" end
|
||||
GetAverageItemLevel = function() return ilvl[1], ilvl[2] end
|
||||
gtimers = {}
|
||||
C_Timer = { After = function(_, fn) gtimers[#gtimers + 1] = fn end }
|
||||
UIParent = obj{ GetHeight = function() return 800 end }
|
||||
lines = {}
|
||||
GameTooltip = obj{ AddDoubleLine = function(_, l, r) lines[l] = r end, IsOwned = function() return false end }
|
||||
@@ -28,7 +47,8 @@ local function startGold(name, db)
|
||||
GetCenter = function() return 500, 300 end,
|
||||
SetShown = function(self, v) self.shown = v end,
|
||||
IsShown = function(self) return self.shown end,
|
||||
CreateFontString = function() return obj{ GetStringWidth = function() return 80 end, GetStringHeight = function() return 12 end } end }
|
||||
CreateFontString = function() return obj{ SetText = function(_, t) shownText = t end,
|
||||
GetStringWidth = function() return 80 end, GetStringHeight = function() return 12 end } end }
|
||||
frames[#frames + 1] = f
|
||||
return f
|
||||
end
|
||||
@@ -68,6 +88,43 @@ SlashCmdList.GOLDBEUTEL("forget ÉLODIE"); check("ÉLODIE -> Élodie entfernt",
|
||||
SlashCmdList.GOLDBEUTEL("forget öx×y"); check("öx×y -> Öx×y entfernt (× unveraendert)", chars["Öx×y"] == nil)
|
||||
SlashCmdList.GOLDBEUTEL("forget testmagier"); check("Eigener Charakter bleibt", chars.Testmagier ~= nil)
|
||||
|
||||
out("Goldbeutel: Taschen, Ruestung, Gegenstandsstufe")
|
||||
local function flush() while #gtimers > 0 do table.remove(gtimers, 1)() end end
|
||||
local function plain(s) return (s:gsub("|T.-|t", ""):gsub("|c%x%x%x%x%x%x%x%x", ""):gsub("|r", ""):gsub("||", "|")) end
|
||||
defaultGear(); money = 1234567
|
||||
fr = startGold("Testmagier", nil); ev.scripts.OnEvent(ev, "PLAYER_ENTERING_WORLD", true, false); flush()
|
||||
check("Rahmen: eine Zeile mit allen vier Werten",
|
||||
plain(shownText) == "123 45 67 | Taschen 23 | 45% | iLvl 245")
|
||||
check("Spezialtaschen (Koecher, Reagenzientasche) nicht im Rahmen mitgezaehlt", plain(shownText):find("Taschen 23", 1, true))
|
||||
check("45% gelb (unter 50)", shownText:find("|cffffd10045%|r", 1, true) ~= nil)
|
||||
check("23 freie Plaetze ohne Warnfarbe", shownText:find("|r 23", 1, true) ~= nil)
|
||||
lines = {}; fr.scripts.OnEnter(fr)
|
||||
check("Tooltip: Taschen frei 23 / 56", lines["Taschen frei:"] == "23 / 56")
|
||||
check("Tooltip: Spezialtaschen frei 46 / 52", lines["Spezialtaschen frei:"] == "46 / 52")
|
||||
check("Tooltip: Ruestung gesamt 80% (225/280)", lines["Rüstung gesamt:"] == "80%")
|
||||
check("Tooltip: am staerksten beschaedigtes Teil (Kopf) mit 45%", plain(lines[" [Item1]"] or "") == "45%")
|
||||
check("Tooltip: Gegenstandsstufe 245,3", lines["Gegenstandsstufe:"] == "245,3")
|
||||
check("Tooltip: beste Ausruestung 247,1", lines["Beste Ausrüstung:"] == "247,1")
|
||||
|
||||
bags[0][2], bags[1][2], bags[4][2] = 0, 3, 0; dura[1][1] = 10
|
||||
for _ = 1, 3 do ev.scripts.OnEvent(ev, "BAG_UPDATE_DELAYED") end
|
||||
ev.scripts.OnEvent(ev, "UPDATE_INVENTORY_DURABILITY")
|
||||
check("Mehrere Ereignisse -> nur eine Aktualisierung", #gtimers == 1)
|
||||
flush()
|
||||
check("3 freie Plaetze gelb", shownText:find("|cffffd1003|r", 1, true) ~= nil)
|
||||
check("10% rot", shownText:find("|cffff333310%|r", 1, true) ~= nil)
|
||||
bags[1][2] = 0; ev.scripts.OnEvent(ev, "BAG_UPDATE_DELAYED"); flush()
|
||||
check("0 freie Plaetze rot", shownText:find("|cffff33330|r", 1, true) ~= nil)
|
||||
|
||||
dura = {}; ilvl = {0, 0}; ev.scripts.OnEvent(ev, "PLAYER_EQUIPMENT_CHANGED"); flush()
|
||||
check("Ohne Haltbarkeit und ohne iLvl nur Gold und Taschen", plain(shownText) == "123 45 67 | Taschen 0")
|
||||
lines = {}; fr.scripts.OnEnter(fr)
|
||||
check("Tooltip ohne Ruestungs- und iLvl-Zeilen", lines["Rüstung gesamt:"] == nil and lines["Gegenstandsstufe:"] == nil)
|
||||
dura = { [1] = {50, 50} }; ilvl = {245.34, 245.34}; ev.scripts.OnEvent(ev, "PLAYER_AVG_ITEM_LEVEL_UPDATE"); flush()
|
||||
lines = {}; fr.scripts.OnEnter(fr)
|
||||
check("Alles heil: keine Zeile fuer beschaedigtes Teil", lines[" [Item1]"] == nil and lines["Rüstung gesamt:"] == "100%")
|
||||
check("Beste = angelegt: keine Zeile 'Beste Ausruestung'", lines["Beste Ausrüstung:"] == nil)
|
||||
|
||||
---------------------------------------------------------------- ForeverScale
|
||||
local scale, h, combat, timers, f
|
||||
local function startScale(db)
|
||||
|
||||
Reference in new issue
Block a user