Goldbeutel: GearScore wie GearScore Forever, Trenner repariert
- Statt Blizzards durchschnittlicher Gegenstandsstufe zeigt der Rahmen jetzt den GearScore, berechnet wie im Addon GearScore Forever (GearScoreLite- Formel), samt dessen Farbskala. Der Tooltip zeigt GearScore und Gegenstandsstufe wie dessen Charakteransicht. GearScore Forever muss nicht installiert sein. - Fehlen Gegenstandsdaten noch, wird bei GET_ITEM_INFO_RECEIVED neu gerechnet. - Trenner zwischen den Werten repariert: "||r" zeigte ein sichtbares "r", richtig ist "|||r". - Die Beschriftung "Taschen" im Rahmen entfällt, die Zahl steht allein. - Tests lesen Escape-Sequenzen jetzt wie der Client. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3b4f25d87c
commit
014db940dd
5 files changed
+234
-57
No files matched your search
+149
-28
@@ -1,8 +1,8 @@
|
|||||||
-- Goldbeutel: zeigt Gold, freie Taschenplaetze, Ruestungszustand und
|
-- Goldbeutel: zeigt Gold, freie Taschenplaetze, Ruestungszustand und
|
||||||
-- Gegenstandsstufe in einem kleinen, verschiebbaren Rahmen.
|
-- GearScore in einem kleinen, verschiebbaren Rahmen.
|
||||||
-- Linksziehen verschieben
|
-- Linksziehen verschieben
|
||||||
-- Rechtsklick sperren / entsperren
|
-- Rechtsklick sperren / entsperren
|
||||||
-- Mauszeiger drauf Details zu Taschen, Ruestung und Gegenstandsstufe,
|
-- Mauszeiger drauf Details zu Taschen, Ruestung, GearScore und Gegenstandsstufe,
|
||||||
-- Gewinn/Verlust dieser Sitzung + alle Charaktere des Realms
|
-- Gewinn/Verlust dieser Sitzung + alle Charaktere des Realms
|
||||||
-- /gold ein-/ausblenden
|
-- /gold ein-/ausblenden
|
||||||
-- /gold lock sperren / entsperren
|
-- /gold lock sperren / entsperren
|
||||||
@@ -15,7 +15,7 @@ local GOLD = "|TInterface\\MoneyFrame\\UI-GoldIcon:0:0:2:0|t"
|
|||||||
local SILVER = "|TInterface\\MoneyFrame\\UI-SilverIcon: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 COPPER = "|TInterface\\MoneyFrame\\UI-CopperIcon:0:0:2:0|t"
|
||||||
|
|
||||||
local SEP = " |cff666666||r " -- "||" ist ein woertliches |
|
local SEP = " |cff666666|||r " -- grauer Strich: "||" ist ein woertliches |, dann "|r"
|
||||||
local LABEL = "|cffaaaaaa" -- Beschriftungen im Rahmen
|
local LABEL = "|cffaaaaaa" -- Beschriftungen im Rahmen
|
||||||
local YELLOW = "|cffffd100"
|
local YELLOW = "|cffffd100"
|
||||||
local RED = "|cffff3333"
|
local RED = "|cffff3333"
|
||||||
@@ -56,11 +56,6 @@ local function formatMoney(c)
|
|||||||
return string.format("%d%s", k, COPPER)
|
return string.format("%d%s", k, COPPER)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 245.34 -> "245,3"
|
|
||||||
local function decimal(x)
|
|
||||||
return (string.format("%.1f", x):gsub("%.", ","))
|
|
||||||
end
|
|
||||||
|
|
||||||
local function paint(s, color)
|
local function paint(s, color)
|
||||||
if color then return color .. s .. "|r" end
|
if color then return color .. s .. "|r" end
|
||||||
return s
|
return s
|
||||||
@@ -125,26 +120,150 @@ local function durability()
|
|||||||
if low then return low, lowSlot, cur / max * 100 end
|
if low then return low, lowSlot, cur / max * 100 end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Durchschnittliche Gegenstandsstufe wie im Charakterfenster: angelegt und mit
|
-- GearScore genau wie im Addon "GearScore Forever" (Daeler), das die Formel von
|
||||||
-- der besten Ausruestung aus den Taschen. nil, solange der Client sie nicht kennt.
|
-- GearScoreLite uebernimmt. Das Addon bietet keine Schnittstelle nach aussen,
|
||||||
local function itemLevel()
|
-- deshalb ist die Rechnung hier nachgebaut. So stimmt der Wert mit der
|
||||||
if not GetAverageItemLevel then return end
|
-- Charakteransicht ueberein, und Goldbeutel braucht das Addon nicht.
|
||||||
local best, equipped = GetAverageItemLevel()
|
-- Die Punkte eines Gegenstands haengen nur von Stufe, Qualitaet und Platz ab.
|
||||||
if equipped and equipped > 0 then return equipped, best end
|
local GS_SLOT = {
|
||||||
|
INVTYPE_RELIC = 0.3164, INVTYPE_TRINKET = 0.5625, INVTYPE_2HWEAPON = 2.0000,
|
||||||
|
INVTYPE_WEAPONMAINHAND = 1.0000, INVTYPE_WEAPONOFFHAND = 1.0000,
|
||||||
|
INVTYPE_RANGED = 0.3164, INVTYPE_THROWN = 0.3164, INVTYPE_RANGEDRIGHT = 0.3164,
|
||||||
|
INVTYPE_SHIELD = 1.0000, INVTYPE_WEAPON = 1.0000, INVTYPE_HOLDABLE = 1.0000,
|
||||||
|
INVTYPE_HEAD = 1.0000, INVTYPE_NECK = 0.5625, INVTYPE_SHOULDER = 0.7500,
|
||||||
|
INVTYPE_CHEST = 1.0000, INVTYPE_ROBE = 1.0000, INVTYPE_WAIST = 0.7500,
|
||||||
|
INVTYPE_LEGS = 1.0000, INVTYPE_FEET = 0.7500, INVTYPE_WRIST = 0.5625,
|
||||||
|
INVTYPE_HAND = 0.7500, INVTYPE_FINGER = 0.5625, INVTYPE_CLOAK = 0.5625,
|
||||||
|
INVTYPE_BODY = 0,
|
||||||
|
}
|
||||||
|
-- [Qualitaet] = { A, B } fuer (Stufe - A) / B
|
||||||
|
local GS_HIGH = { [4] = { 91.45, 0.65 }, [3] = { 81.375, 0.8125 }, [2] = { 73, 1 } }
|
||||||
|
local GS_LOW = { [4] = { 26, 1.2 }, [3] = { 0.75, 1.8 }, [2] = { 8, 2 }, [1] = { 0, 2.25 } }
|
||||||
|
local GS_EPIC60 = { [4] = { 0.25, 1.6275 } } -- Epics unter Stufe 100
|
||||||
|
local GS_HUNTER = { [16] = 0.3164, [17] = 0.3164, [18] = 5.3224 } -- Nahkampf wenig, Fernkampf viel
|
||||||
|
|
||||||
|
-- Farbverlauf je Abschnitt der Skala wie in GearScoreLite: grau, weiss, gruen,
|
||||||
|
-- blau, lila, orange. Je Farbkanal r, g, b: { Start, Abschnitt, Steigung, Richtung }
|
||||||
|
local GS_COLOR = {
|
||||||
|
{ { 0.55, 0, 0.00045, 1 }, { 0.55, 0, 0.00045, 1 }, { 0.55, 0, 0.00045, 1 } },
|
||||||
|
{ { 1, 1, 0.00088, -1 }, { 1, 0, 0, 0 }, { 1, 1, 0.001, -1 } },
|
||||||
|
{ { 0.12, 2, 0.00012, -1 }, { 1, 2, 0.0005, -1 }, { 0, 2, 0.001, 1 } },
|
||||||
|
{ { 0, 3, 0.00069, 1 }, { 0.5, 3, 0.00022, -1 }, { 1, 3, 0.00003, -1 } },
|
||||||
|
{ { 0.69, 4, 0.00025, 1 }, { 0.28, 4, 0.00019, 1 }, { 0.97, 4, 0.00096, -1 } },
|
||||||
|
{ { 0.94, 5, 0.00006, 1 }, { 0.47, 5, 0.00047, -1 }, { 0, 0, 0, 0 } },
|
||||||
|
}
|
||||||
|
|
||||||
|
local GetItemInfo = C_Item and C_Item.GetItemInfo or GetItemInfo
|
||||||
|
local GetDetailedItemLevelInfo = C_Item and C_Item.GetDetailedItemLevelInfo or GetDetailedItemLevelInfo
|
||||||
|
|
||||||
|
local function requestItem(item)
|
||||||
|
if C_Item and C_Item.RequestLoadItemDataByID then pcall(C_Item.RequestLoadItemDataByID, item) end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Eine Zeile: Gold | Taschen 23 | 87% | iLvl 245
|
-- Punkte und Stufe eines Gegenstands. nil, solange der Client ihn nicht kennt.
|
||||||
|
local function itemScore(link)
|
||||||
|
local _, _, rarity, level, _, _, _, _, equipLoc = GetItemInfo(link)
|
||||||
|
if not rarity or not level then
|
||||||
|
requestItem(link)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local slotMod = GS_SLOT[equipLoc]
|
||||||
|
if not slotMod then return 0, 0 end
|
||||||
|
if GetDetailedItemLevelInfo then -- tatsaechliche Stufe bei skalierenden Gegenstaenden
|
||||||
|
local ok, l = pcall(GetDetailedItemLevelInfo, link)
|
||||||
|
if ok and type(l) == "number" and l > 0 then level = l end
|
||||||
|
end
|
||||||
|
local scale = 1
|
||||||
|
if rarity == 5 or rarity == 6 then -- legendaer, Artefakt
|
||||||
|
scale, rarity = 1.3, 4
|
||||||
|
elseif rarity == 7 then -- Erbstueck zaehlt wie blau
|
||||||
|
rarity = 3
|
||||||
|
elseif rarity <= 1 then -- grau, weiss: fast nichts
|
||||||
|
scale, rarity = 0.005, 2
|
||||||
|
end
|
||||||
|
local tbl
|
||||||
|
if level < 100 and rarity == 4 then
|
||||||
|
tbl = GS_EPIC60
|
||||||
|
elseif (level < 168 and rarity == 4) or (level < 148 and rarity == 3)
|
||||||
|
or (level < 138 and rarity == 2) or level <= 120 then
|
||||||
|
tbl = GS_LOW
|
||||||
|
else
|
||||||
|
tbl = GS_HIGH
|
||||||
|
end
|
||||||
|
local f = tbl[rarity] or GS_LOW[rarity]
|
||||||
|
if not f then return 0, level end
|
||||||
|
local base = (level - f[1]) / f[2] * 1.8618
|
||||||
|
return math.max(math.floor(base * slotMod * scale), 0), level
|
||||||
|
end
|
||||||
|
|
||||||
|
-- true, solange Gegenstandsdaten fehlen; dann wird bei GET_ITEM_INFO_RECEIVED
|
||||||
|
-- neu gerechnet
|
||||||
|
local gsPending = false
|
||||||
|
|
||||||
|
-- GearScore und durchschnittliche Gegenstandsstufe der angelegten Ausruestung
|
||||||
|
-- (Plaetze 1-18 ohne Hemd, also auch ohne Wappenrock), beide wie in GearScore Forever.
|
||||||
|
local function gearScore()
|
||||||
|
local function equipLoc(link) return select(9, GetItemInfo(link)) end
|
||||||
|
local mh, oh = GetInventoryItemLink("player", 16), GetInventoryItemLink("player", 17)
|
||||||
|
local grip = 1 -- Titanengriff: zwei Zweihaender zaehlen je zur Haelfte
|
||||||
|
if mh and oh and (equipLoc(mh) == "INVTYPE_2HWEAPON" or equipLoc(oh) == "INVTYPE_2HWEAPON") then
|
||||||
|
grip = 0.5
|
||||||
|
end
|
||||||
|
local _, class = UnitClass("player")
|
||||||
|
local total, count, levels, complete = 0, 0, 0, true
|
||||||
|
for slot = 1, 18 do
|
||||||
|
if slot ~= 4 then
|
||||||
|
local link = GetInventoryItemLink("player", slot)
|
||||||
|
if link then
|
||||||
|
local score, level = itemScore(link)
|
||||||
|
if score then
|
||||||
|
if class == "HUNTER" and GS_HUNTER[slot] then score = score * GS_HUNTER[slot] end
|
||||||
|
if slot == 16 or slot == 17 then score = score * grip end
|
||||||
|
total, count, levels = total + score, count + 1, levels + level
|
||||||
|
else
|
||||||
|
complete = false
|
||||||
|
end
|
||||||
|
elseif GetInventoryItemID("player", slot) then
|
||||||
|
complete = false
|
||||||
|
requestItem(GetInventoryItemID("player", slot))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
gsPending = not complete
|
||||||
|
return math.floor(total), count > 0 and math.floor(levels / count) or 0
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Farbe wie in GearScore Forever. Dessen Skala waechst mit dem hoechsten
|
||||||
|
-- GearScore, den es je gesehen hat (auch bei anderen Spielern). Den liest
|
||||||
|
-- Goldbeutel aus dessen Einstellungen, falls das Addon installiert ist.
|
||||||
|
local function gsColor(score)
|
||||||
|
if score > 2000 then return "|cffff69b5" end -- rosa
|
||||||
|
local gdb = type(GearscoreForeverDB) == "table" and GearscoreForeverDB or {}
|
||||||
|
local seen = math.max(score, tonumber(gdb.maxScoreSeen) or 0)
|
||||||
|
-- 200 je Farbe wie in Classic, hoechstens 325, damit Orange bei 2000 endet
|
||||||
|
local step = math.min(325, math.max(200, math.ceil(seen / 5.5 / 25) * 25))
|
||||||
|
score = math.min(score, step * 6 - 1)
|
||||||
|
local q = GS_COLOR[math.ceil(score / step)]
|
||||||
|
local rgb = {}
|
||||||
|
for i, c in ipairs(q) do
|
||||||
|
local v = c[1] + (score - c[2] * step) * c[3] * c[4]
|
||||||
|
rgb[i] = math.floor(math.min(1, math.max(0, v)) * 255 + 0.5)
|
||||||
|
end
|
||||||
|
return string.format("|cff%02x%02x%02x", rgb[1], rgb[2], rgb[3])
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Eine Zeile: Gold | 23 freie Taschenplaetze | 87% | GS 1234
|
||||||
local function frameText()
|
local function frameText()
|
||||||
local parts = { formatMoney(GetMoney()) }
|
local parts = { formatMoney(GetMoney()) }
|
||||||
local free = bagSpace()
|
local free = bagSpace()
|
||||||
parts[#parts + 1] = LABEL .. "Taschen|r " .. paint(free, freeColor(free))
|
parts[#parts + 1] = paint(free, freeColor(free))
|
||||||
local low = durability()
|
local low = durability()
|
||||||
if low then
|
if low then
|
||||||
parts[#parts + 1] = paint(math.floor(low) .. "%", pctColor(low))
|
parts[#parts + 1] = paint(math.floor(low) .. "%", pctColor(low))
|
||||||
end
|
end
|
||||||
local ilvl = itemLevel()
|
local gs = gearScore()
|
||||||
if ilvl then
|
if gs > 0 then
|
||||||
parts[#parts + 1] = LABEL .. "iLvl|r " .. math.floor(ilvl)
|
parts[#parts + 1] = LABEL .. "GS|r " .. paint(gs, gsColor(gs))
|
||||||
end
|
end
|
||||||
return table.concat(parts, SEP)
|
return table.concat(parts, SEP)
|
||||||
end
|
end
|
||||||
@@ -178,12 +297,10 @@ local function addStatusLines()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local ilvl, best = itemLevel()
|
local gs, ilvl = gearScore()
|
||||||
if ilvl then
|
if gs > 0 then
|
||||||
GameTooltip:AddDoubleLine("Gegenstandsstufe:", decimal(ilvl), 1, 0.82, 0, 1, 1, 1)
|
GameTooltip:AddDoubleLine("GearScore:", paint(gs, gsColor(gs)), 1, 0.82, 0, 1, 1, 1)
|
||||||
if best and best - ilvl >= 0.05 then
|
GameTooltip:AddDoubleLine("Gegenstandsstufe:", ilvl, 1, 0.82, 0, 1, 1, 1)
|
||||||
GameTooltip:AddDoubleLine("Beste Ausrüstung:", decimal(best), 1, 0.82, 0, 0.6, 0.6, 0.6)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -321,9 +438,9 @@ ev:RegisterEvent("PLAYER_LOGIN")
|
|||||||
ev:RegisterEvent("PLAYER_MONEY")
|
ev:RegisterEvent("PLAYER_MONEY")
|
||||||
ev:RegisterEvent("PLAYER_LOGOUT")
|
ev:RegisterEvent("PLAYER_LOGOUT")
|
||||||
ev:RegisterEvent("PLAYER_ENTERING_WORLD")
|
ev:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||||
-- Taschen, Ruestung, Gegenstandsstufe. pcall, falls ein Client eines davon nicht kennt.
|
-- Taschen, Ruestung, GearScore. pcall, falls ein Client eines davon nicht kennt.
|
||||||
for _, e in ipairs({ "BAG_UPDATE_DELAYED", "UPDATE_INVENTORY_DURABILITY",
|
for _, e in ipairs({ "BAG_UPDATE_DELAYED", "UPDATE_INVENTORY_DURABILITY",
|
||||||
"PLAYER_EQUIPMENT_CHANGED", "PLAYER_AVG_ITEM_LEVEL_UPDATE" }) do
|
"PLAYER_EQUIPMENT_CHANGED", "GET_ITEM_INFO_RECEIVED" }) do
|
||||||
pcall(ev.RegisterEvent, ev, e)
|
pcall(ev.RegisterEvent, ev, e)
|
||||||
end
|
end
|
||||||
ev:SetScript("OnEvent", function(self, event, arg1, arg2)
|
ev:SetScript("OnEvent", function(self, event, arg1, arg2)
|
||||||
@@ -353,8 +470,12 @@ ev:SetScript("OnEvent", function(self, event, arg1, arg2)
|
|||||||
queueUpdate()
|
queueUpdate()
|
||||||
elseif event == "PLAYER_LOGOUT" then
|
elseif event == "PLAYER_LOGOUT" then
|
||||||
if realm then record() end
|
if realm then record() end
|
||||||
|
elseif event == "GET_ITEM_INFO_RECEIVED" then
|
||||||
|
-- kommt fuer jeden Gegenstand, den der Client laedt; nur interessant,
|
||||||
|
-- solange dem GearScore noch Daten fehlen
|
||||||
|
if gsPending then queueUpdate() end
|
||||||
else
|
else
|
||||||
-- PLAYER_MONEY und die Ereignisse fuer Taschen, Ruestung und Gegenstandsstufe
|
-- PLAYER_MONEY und die Ereignisse fuer Taschen, Ruestung und Ausruestung
|
||||||
queueUpdate()
|
queueUpdate()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
## Interface: 16001
|
## Interface: 16001
|
||||||
## Title: Goldbeutel
|
## Title: Goldbeutel
|
||||||
## Notes: Zeigt Gold, freie Taschenplätze, Rüstungszustand und Gegenstandsstufe in einem kleinen, verschiebbaren Rahmen. /gold
|
## Notes: Zeigt Gold, freie Taschenplätze, Rüstungszustand und GearScore in einem kleinen, verschiebbaren Rahmen. /gold
|
||||||
## SavedVariables: GoldbeutelDB
|
## SavedVariables: GoldbeutelDB
|
||||||
Goldbeutel.lua
|
Goldbeutel.lua
|
||||||
@@ -5,7 +5,7 @@ Drei kleine, voneinander unabhängige Addons für **World of Warcraft: Forever**
|
|||||||
| Addon | Wozu | Befehl |
|
| Addon | Wozu | Befehl |
|
||||||
|---|---|---|
|
|---|---|---|
|
||||||
| [**ForeverScale**](#foreverscale) | UI-Skalierung auch unter Blizzards Minimum von 0,64, dauerhaft gespeichert | `/fscale` |
|
| [**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` |
|
| [**Goldbeutel**](#goldbeutel) | Gold, freie Taschenplätze, Rüstungszustand und GearScore in einem kleinen Rahmen | `/gold` |
|
||||||
| [**Leistenabstand**](#leistenabstand) | Symbolabstand der Aktionsleisten unter 2, auch 0 oder negativ | `/abstand` |
|
| [**Leistenabstand**](#leistenabstand) | Symbolabstand der Aktionsleisten unter 2, auch 0 oder negativ | `/abstand` |
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
@@ -57,25 +57,27 @@ ForeverScale speichert deinen Wert für den ganzen Account und setzt ihn nach je
|
|||||||
Ein kleiner, verschiebbarer Rahmen mit allem, was man unterwegs im Blick haben will:
|
Ein kleiner, verschiebbarer Rahmen mit allem, was man unterwegs im Blick haben will:
|
||||||
|
|
||||||
```
|
```
|
||||||
┌─────────────────────────────────────────────────────┐
|
┌─────────────────────────────────────────────┐
|
||||||
│ 12.345g 67s 89c | Taschen 23 | 87% | iLvl 245 │
|
│ 12.345g 67s 89c | 23 | 87% | GS 1234 │
|
||||||
└─────────────────────────────────────────────────────┘
|
└─────────────────────────────────────────────┘
|
||||||
```
|
```
|
||||||
|
|
||||||
| Anzeige | Bedeutung | Warnfarbe |
|
| Anzeige | Bedeutung | Warnfarbe |
|
||||||
|---|---|---|
|
|---|---|---|
|
||||||
| Gold | dein Gold mit Gold-, Silber- und Kupfermünzen | – |
|
| 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 |
|
| 23 | 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 % |
|
| 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 | – |
|
| GS | GearScore der angelegten Ausrüstung, derselbe Wert wie bei [GearScore Forever](https://www.curseforge.com/wow/addons/gearscore-forever) in der Charakteransicht | in dessen Farbskala (grau, weiß, grün, blau, lila, orange) |
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
|
Den **GearScore** rechnet Goldbeutel selbst aus, mit derselben Formel wie GearScore Forever (übernommen von GearScoreLite). Die Punkte eines Gegenstands hängen nur von Gegenstandsstufe, Qualität und Platz ab. Hemd und Wappenrock zählen nicht, bei Jägern zählt die Fernkampfwaffe mehr als die Nahkampfwaffen. GearScore Forever muss dafür nicht installiert sein. Ist es installiert, übernimmt Goldbeutel auch dessen Farbskala: Sie wächst mit dem höchsten GearScore, den das Addon je gesehen hat, auch bei inspizierten Spielern.
|
||||||
|
|
||||||
**Tooltip** (Maus über den Rahmen):
|
**Tooltip** (Maus über den Rahmen):
|
||||||
|
|
||||||
- freie und gesamte Taschenplätze, Spezialtaschen extra
|
- freie und gesamte Taschenplätze, Spezialtaschen extra
|
||||||
- Gesamtzustand der Rüstung und das am stärksten beschädigte Teil
|
- 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
|
- GearScore und durchschnittliche Gegenstandsstufe, beide wie in der Charakteransicht von GearScore Forever
|
||||||
- Gold gewonnen (grün) oder verloren (rot) in dieser Sitzung. Ein `/reload` setzt das nicht zurück, erst ein neuer Login.
|
- 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.
|
- 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.
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -9,13 +9,22 @@ local function obj(t) return setmetatable(t or {}, {__index = function() return
|
|||||||
|
|
||||||
---------------------------------------------------------------- Goldbeutel
|
---------------------------------------------------------------- Goldbeutel
|
||||||
local money, ev, lines, shownText, gtimers
|
local money, ev, lines, shownText, gtimers
|
||||||
-- Ausgangszustand fuer Taschen, Ruestung und Gegenstandsstufe (in Tests veraenderbar)
|
-- Ausgangszustand fuer Taschen, Ruestung und Ausruestung (in Tests veraenderbar)
|
||||||
-- bags[i] = { Plaetze, frei, Taschentyp }; Index 0 = Rucksack, 5 = Reagenzientasche
|
-- bags[i] = { Plaetze, frei, Taschentyp }; Index 0 = Rucksack, 5 = Reagenzientasche
|
||||||
local bags, dura, ilvl
|
-- gear[Platz] = { Qualitaet, Gegenstandsstufe, Ausruestungsplatz }
|
||||||
|
local bags, dura, gear, gclass, uncached
|
||||||
local function defaultGear()
|
local function defaultGear()
|
||||||
bags = { [0] = {16, 5, 0}, {20, 10, 0}, {16, 16, 1}, {0, 0, 0}, {20, 8, 0}, {36, 30, 0} }
|
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
|
dura = { [1] = {45, 100}, [5] = {100, 100}, [7] = {80, 80} } -- Kopf, Brust, Beine
|
||||||
ilvl = {247.14, 245.34} -- beste, angelegt
|
gear = {
|
||||||
|
[1] = {4, 66, "INVTYPE_HEAD"}, [2] = {3, 60, "INVTYPE_NECK"}, [3] = {4, 66, "INVTYPE_SHOULDER"},
|
||||||
|
[4] = {1, 1, "INVTYPE_BODY"}, [5] = {4, 66, "INVTYPE_ROBE"}, [6] = {3, 58, "INVTYPE_WAIST"},
|
||||||
|
[7] = {4, 66, "INVTYPE_LEGS"}, [8] = {3, 58, "INVTYPE_FEET"}, [9] = {3, 58, "INVTYPE_WRIST"},
|
||||||
|
[10] = {4, 66, "INVTYPE_HAND"}, [11] = {3, 60, "INVTYPE_FINGER"}, [12] = {3, 60, "INVTYPE_FINGER"},
|
||||||
|
[13] = {3, 60, "INVTYPE_TRINKET"}, [14] = {3, 60, "INVTYPE_TRINKET"}, [15] = {3, 60, "INVTYPE_CLOAK"},
|
||||||
|
[16] = {4, 77, "INVTYPE_2HWEAPON"}, [18] = {3, 60, "INVTYPE_RANGEDRIGHT"}, [19] = {1, 1, "INVTYPE_TABARD"},
|
||||||
|
}
|
||||||
|
gclass, uncached = "MAGE", {}
|
||||||
end
|
end
|
||||||
defaultGear()
|
defaultGear()
|
||||||
local function startGold(name, db)
|
local function startGold(name, db)
|
||||||
@@ -25,7 +34,7 @@ local function startGold(name, db)
|
|||||||
strtrim = function(s) return (s:gsub("^%s+",""):gsub("%s+$","")) end
|
strtrim = function(s) return (s:gsub("^%s+",""):gsub("%s+$","")) end
|
||||||
GetRealmName = function() return "Blackmoore" end
|
GetRealmName = function() return "Blackmoore" end
|
||||||
UnitName = function() return name end
|
UnitName = function() return name end
|
||||||
UnitClass = function() return "Magier", "MAGE" end
|
UnitClass = function() return "Klasse", gclass end
|
||||||
GetMoney = function() return money end
|
GetMoney = function() return money end
|
||||||
NUM_BAG_SLOTS, NUM_TOTAL_EQUIPPED_BAG_SLOTS, INVSLOT_FIRST_EQUIPPED, INVSLOT_LAST_EQUIPPED = 4, 5, 1, 19
|
NUM_BAG_SLOTS, NUM_TOTAL_EQUIPPED_BAG_SLOTS, INVSLOT_FIRST_EQUIPPED, INVSLOT_LAST_EQUIPPED = 4, 5, 1, 19
|
||||||
C_Container = {
|
C_Container = {
|
||||||
@@ -33,8 +42,13 @@ local function startGold(name, db)
|
|||||||
GetContainerNumFreeSlots = function(b) if bags[b] then return bags[b][2], bags[b][3] end return 0, 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
|
GetInventoryItemDurability = function(s) if dura[s] then return dura[s][1], dura[s][2] end end
|
||||||
GetInventoryItemLink = function(_, s) return "[Item" .. s .. "]" end
|
GetInventoryItemLink = function(_, s) if gear[s] then return "[Item" .. s .. "]" end end
|
||||||
GetAverageItemLevel = function() return ilvl[1], ilvl[2] end
|
GetInventoryItemID = function(_, s) if gear[s] then return 1000 + s end end
|
||||||
|
C_Item = { GetItemInfo = function(link)
|
||||||
|
local s = tonumber(link:match("%d+")); local g = gear[s]
|
||||||
|
if g and not uncached[s] then return "Name", link, g[1], g[2], 1, "Ruestung", "Stoff", 1, g[3] end
|
||||||
|
end }
|
||||||
|
GearscoreForeverDB = nil
|
||||||
gtimers = {}
|
gtimers = {}
|
||||||
C_Timer = { After = function(_, fn) gtimers[#gtimers + 1] = fn end }
|
C_Timer = { After = function(_, fn) gtimers[#gtimers + 1] = fn end }
|
||||||
UIParent = obj{ GetHeight = function() return 800 end }
|
UIParent = obj{ GetHeight = function() return 800 end }
|
||||||
@@ -88,23 +102,44 @@ 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 öx×y"); check("öx×y -> Öx×y entfernt (× unveraendert)", chars["Öx×y"] == nil)
|
||||||
SlashCmdList.GOLDBEUTEL("forget testmagier"); check("Eigener Charakter bleibt", chars.Testmagier ~= nil)
|
SlashCmdList.GOLDBEUTEL("forget testmagier"); check("Eigener Charakter bleibt", chars.Testmagier ~= nil)
|
||||||
|
|
||||||
out("Goldbeutel: Taschen, Ruestung, Gegenstandsstufe")
|
out("Goldbeutel: Taschen, Ruestung, GearScore")
|
||||||
local function flush() while #gtimers > 0 do table.remove(gtimers, 1)() end end
|
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
|
-- Liest Escape-Sequenzen wie der Client von links nach rechts: "||" ist ein |,
|
||||||
|
-- |cAARRGGBB und |r sind Farben, |T...|t eine Textur. Liefert den sichtbaren Text
|
||||||
|
-- und die Zahl der am Ende noch offenen Farben (muss 0 sein).
|
||||||
|
local function render(s)
|
||||||
|
local res, open, i = {}, 0, 1
|
||||||
|
while i <= #s do
|
||||||
|
local c, n = s:sub(i, i), s:sub(i + 1, i + 1)
|
||||||
|
if c ~= "|" then res[#res + 1] = c; i = i + 1
|
||||||
|
elseif n == "|" then res[#res + 1] = "|"; i = i + 2
|
||||||
|
elseif n == "c" and s:sub(i + 2, i + 9):match("^%x+$") and i + 9 <= #s then open = open + 1; i = i + 10
|
||||||
|
elseif n == "r" then open = open - 1; i = i + 2
|
||||||
|
elseif n == "T" then i = (s:find("|t", i, true) or #s) + 2
|
||||||
|
else res[#res + 1] = c; i = i + 1 end
|
||||||
|
end
|
||||||
|
return table.concat(res), open
|
||||||
|
end
|
||||||
|
local function plain(s) return (render(s)) end
|
||||||
|
local function tooltip() lines = {}; fr.scripts.OnEnter(fr); return lines end
|
||||||
|
-- Sollwerte (Punkte, iLvl, Farbe) stammen aus dem Originalcode von GearScore Forever 1.3.0
|
||||||
defaultGear(); money = 1234567
|
defaultGear(); money = 1234567
|
||||||
fr = startGold("Testmagier", nil); ev.scripts.OnEvent(ev, "PLAYER_ENTERING_WORLD", true, false); flush()
|
fr = startGold("Testmagier", nil); ev.scripts.OnEvent(ev, "PLAYER_ENTERING_WORLD", true, false); flush()
|
||||||
check("Rahmen: eine Zeile mit allen vier Werten",
|
check("Rahmen: eine Zeile mit allen vier Werten",
|
||||||
plain(shownText) == "123 45 67 | Taschen 23 | 45% | iLvl 245")
|
plain(shownText) == "123 45 67 | 23 | 45% | GS 856")
|
||||||
check("Spezialtaschen (Koecher, Reagenzientasche) nicht im Rahmen mitgezaehlt", plain(shownText):find("Taschen 23", 1, true))
|
check("Jede Farbe wird wieder geschlossen (grauer Trenner ohne sichtbares 'r')",
|
||||||
|
select(2, render(shownText)) == 0 and shownText:find("|cff666666|||r", 1, true) ~= nil)
|
||||||
|
check("Spezialtaschen (Koecher, Reagenzientasche) nicht im Rahmen mitgezaehlt", plain(shownText):find("| 23 |", 1, true))
|
||||||
check("45% gelb (unter 50)", shownText:find("|cffffd10045%|r", 1, true) ~= nil)
|
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)
|
check("23 freie Plaetze ohne Warnfarbe", shownText:find("|||r 23 ", 1, true) ~= nil)
|
||||||
lines = {}; fr.scripts.OnEnter(fr)
|
check("GS 856 lila wie in GearScore Forever", shownText:find("|cffb44aea856|r", 1, true) ~= nil)
|
||||||
|
tooltip()
|
||||||
check("Tooltip: Taschen frei 23 / 56", lines["Taschen frei:"] == "23 / 56")
|
check("Tooltip: Taschen frei 23 / 56", lines["Taschen frei:"] == "23 / 56")
|
||||||
check("Tooltip: Spezialtaschen frei 46 / 52", lines["Spezialtaschen frei:"] == "46 / 52")
|
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: 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: am staerksten beschaedigtes Teil (Kopf) mit 45%", plain(lines[" [Item1]"] or "") == "45%")
|
||||||
check("Tooltip: Gegenstandsstufe 245,3", lines["Gegenstandsstufe:"] == "245,3")
|
check("Tooltip: GearScore 856", plain(lines["GearScore:"] or "") == "856")
|
||||||
check("Tooltip: beste Ausruestung 247,1", lines["Beste Ausrüstung:"] == "247,1")
|
check("Tooltip: Gegenstandsstufe 62 (ohne Hemd und Wappenrock)", lines["Gegenstandsstufe:"] == 62)
|
||||||
|
|
||||||
bags[0][2], bags[1][2], bags[4][2] = 0, 3, 0; dura[1][1] = 10
|
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
|
for _ = 1, 3 do ev.scripts.OnEvent(ev, "BAG_UPDATE_DELAYED") end
|
||||||
@@ -116,14 +151,33 @@ check("10% rot", shownText:find("|cffff333310%|r", 1, true) ~= nil)
|
|||||||
bags[1][2] = 0; ev.scripts.OnEvent(ev, "BAG_UPDATE_DELAYED"); flush()
|
bags[1][2] = 0; ev.scripts.OnEvent(ev, "BAG_UPDATE_DELAYED"); flush()
|
||||||
check("0 freie Plaetze rot", shownText:find("|cffff33330|r", 1, true) ~= nil)
|
check("0 freie Plaetze rot", shownText:find("|cffff33330|r", 1, true) ~= nil)
|
||||||
|
|
||||||
dura = {}; ilvl = {0, 0}; ev.scripts.OnEvent(ev, "PLAYER_EQUIPMENT_CHANGED"); flush()
|
out("Goldbeutel: GearScore wie in GearScore Forever")
|
||||||
check("Ohne Haltbarkeit und ohne iLvl nur Gold und Taschen", plain(shownText) == "123 45 67 | Taschen 0")
|
ev.scripts.OnEvent(ev, "GET_ITEM_INFO_RECEIVED"); check("Alles geladen: GET_ITEM_INFO_RECEIVED loest nichts aus", #gtimers == 0)
|
||||||
lines = {}; fr.scripts.OnEnter(fr)
|
GearscoreForeverDB = { maxScoreSeen = 1800 }; ev.scripts.OnEvent(ev, "PLAYER_MONEY"); flush()
|
||||||
check("Tooltip ohne Ruestungs- und iLvl-Zeilen", lines["Rüstung gesamt:"] == nil and lines["Gegenstandsstufe:"] == nil)
|
check("Groessere Skala aus GearScore Forever (1800 gesehen): 856 gruen", shownText:find("|cff18e535856|r", 1, true) ~= nil)
|
||||||
dura = { [1] = {50, 50} }; ilvl = {245.34, 245.34}; ev.scripts.OnEvent(ev, "PLAYER_AVG_ITEM_LEVEL_UPDATE"); flush()
|
GearscoreForeverDB = nil
|
||||||
lines = {}; fr.scripts.OnEnter(fr)
|
gclass = "HUNTER"; ev.scripts.OnEvent(ev, "PLAYER_EQUIPMENT_CHANGED"); flush()
|
||||||
|
check("Jaeger: Nahkampfwaffe zaehlt wenig, Zauberstab viel -> 818", plain(tooltip()["GearScore:"] or "") == "818")
|
||||||
|
gclass = "MAGE"; gear[17] = {4, 77, "INVTYPE_2HWEAPON"}
|
||||||
|
ev.scripts.OnEvent(ev, "PLAYER_EQUIPMENT_CHANGED"); flush()
|
||||||
|
check("Titanengriff: zwei Zweihaender je zur Haelfte -> 856, iLvl 63",
|
||||||
|
plain(tooltip()["GearScore:"] or "") == "856" and lines["Gegenstandsstufe:"] == 63)
|
||||||
|
gear[17] = nil; uncached[1] = true
|
||||||
|
ev.scripts.OnEvent(ev, "PLAYER_EQUIPMENT_CHANGED"); flush()
|
||||||
|
check("Kopf noch nicht geladen: vorlaeufig 781", plain(shownText):find("GS 781", 1, true) ~= nil)
|
||||||
|
uncached[1] = nil; ev.scripts.OnEvent(ev, "GET_ITEM_INFO_RECEIVED")
|
||||||
|
check("GET_ITEM_INFO_RECEIVED rechnet neu, solange Daten fehlen", #gtimers == 1)
|
||||||
|
flush()
|
||||||
|
check("Danach vollstaendig: 856", plain(shownText):find("GS 856", 1, true) ~= nil)
|
||||||
|
|
||||||
|
gear, dura = {}, {}; ev.scripts.OnEvent(ev, "PLAYER_EQUIPMENT_CHANGED"); flush()
|
||||||
|
check("Ohne Ausruestung nur Gold und Taschen", plain(shownText) == "123 45 67 | 0")
|
||||||
|
tooltip()
|
||||||
|
check("Tooltip ohne Ruestungs- und GearScore-Zeilen",
|
||||||
|
lines["Rüstung gesamt:"] == nil and lines["GearScore:"] == nil and lines["Gegenstandsstufe:"] == nil)
|
||||||
|
defaultGear(); dura = { [1] = {50, 50} }; ev.scripts.OnEvent(ev, "UPDATE_INVENTORY_DURABILITY"); flush()
|
||||||
|
tooltip()
|
||||||
check("Alles heil: keine Zeile fuer beschaedigtes Teil", lines[" [Item1]"] == nil and lines["Rüstung gesamt:"] == "100%")
|
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
|
---------------------------------------------------------------- ForeverScale
|
||||||
local scale, h, combat, timers, f
|
local scale, h, combat, timers, f
|
||||||
|
|||||||
Reference in new issue
Block a user