commit 3979f0e1ffb57b46a42d6e53b3b8ac28148684ff Author: gramps Date: Sun Apr 5 09:26:23 2026 -0700 Initial commit — WyntrWear v1.2.2 WotLK tabard reminder addon (2009) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..01a3370 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.DS_Store +Thumbs.db diff --git a/README.md b/README.md new file mode 100644 index 0000000..fbe311c --- /dev/null +++ b/README.md @@ -0,0 +1,71 @@ +# WyntrWear + +A World of Warcraft addon for Wrath of the Lich King (WotLK, patch 3.2). Written in Lua, June 2009. + +**Author:** Wyntrfylth of Skywall, `` + +--- + +## What It Does + +WyntrWear reminds level 80 characters to equip a tabard when entering a 5-man instance, so you +don't waste a full run accumulating rep with the wrong faction. + +On entering an instance it displays in the default chat frame either the name of the tabard you are +wearing, or a warning that you have no tabard equipped. If no tabard is equipped, a UI frame appears +with a checkbox to disable future checks for that character (useful for mains who are already exalted +with everything). + +It also tracks reputation earned during the run and reports it when you swap or unequip your tabard. + +--- + +## Commands + +| Command | Effect | +|---|---| +| `/ww status` | Reports current tabard and standing with its faction | +| `/ww check` | Re-enables the instance-entry check if you previously disabled it | +| `/wyntrwear` | Same as `/ww` | + +--- + +## Installation + +Drop the `WyntrWear/` folder into your `Interface/AddOns/` directory and reload your UI. + +**Interface version:** 3.2.0 (30200) — Wrath of the Lich King + +--- + +## Supported Factions + +WyntrWear tracks reputation for the five WotLK instance tabard factions: + +- Argent Crusade +- Knights of the Ebon Blade +- Kirin Tor +- The Wyrmrest Accord +- Horde Expedition + +--- + +## Files + +| File | Purpose | +|---|---| +| `WyntrWear.lua` | All addon logic — event handling, rep tracking, slash commands | +| `WyntrWear.xml` | UI frame definition — the checkbox panel shown on instance entry | +| `WyntrWear.toc` | WoW addon manifest — interface version, metadata, load order | +| `wyntrwear.JPG` | Screenshot — addon UI in-game | +| `ww2.JPG` | Screenshot — rep tracking output in chat frame | + +--- + +## Background + +Six level-80 toons. A lot of instancing. A persistent habit of forgetting to swap tabards before +the first pull, then noticing mid-run that Horde Expedition rep had been accumulating instead of +Argent Crusade. WyntrWear was the fix. + +Version 1.2.2 archived from the original distribution package. diff --git a/WyntrWear.lua b/WyntrWear.lua new file mode 100644 index 0000000..22ff3eb --- /dev/null +++ b/WyntrWear.lua @@ -0,0 +1,251 @@ +function WyntrWear_OnLoad(frame) + SlashCmdList["WYNTRWEAR"] = WyntrWear_CmdHandler; + SLASH_WYNTRWEAR1 = "/wyntrwear"; + SLASH_WYNTRWEAR2 = "/ww"; + NEUTRAL_MIN = 0; + NEUTRAL_MAX = 3000; + FRIENDLY_MIN = 3001; + FRIENDLY_MAX = 9000; + HONORED_MIN = 9001; + HONORED_MAX = 21000; + REVERED_MIN = 21001; + REVERED_MAX = 42000; + EXALTED_MIN = 42001; + EXALTED_MAX = 43000; + HORDE_EXPEDITION = "Horde Expedition"; + startRep = nil; + totalEarned = nil; + oldTabard = nil; + atExalted = false; + wrathNames = {"Argent Crusade", "Knights of the Ebon Blade", "Kirin Tor", "The Wyrmrest Accord", "Horde Expedition"}; + + if (IsEquippedItemType("Tabard")) then + tabardName = GetInventoryItemLink("player", GetInventorySlotInfo("TabardSlot")); + else + tabardName = HORDE_EXPEDITION; + end + oldTabard = tabardName; + startRep = getRepData(tabardName, false); + + frame:Hide(); + frame:RegisterForDrag("leftButton"); + frame:RegisterEvent("ADDON_LOADED"); + frame:RegisterEvent("PLAYER_ENTERING_WORLD"); + frame:RegisterEvent("UNIT_INVENTORY_CHANGED"); + DEFAULT_CHAT_FRAME:AddMessage("WyntrWear: wyntrwear loaded..."); +end + +function processTabardName(tabardName) + local found, _, itemString = string.find(tabardName, "^|c%x+|H(.+)|h%[.*%]"); + if (found) then + local linkType, itemID = strsplit(":", itemString); + local itemName = GetItemInfo(itemID); + itemName = string.gsub(itemName, "Tabard", ""); + itemName = string.gsub(itemName, "of", ""); + itemName = string.gsub(itemName, "the", ""); + itemName = string.gsub(itemName, "^%s*(.-)%s*$", "%1"); -- trim() + itemName = string.gsub(itemName, " ", " "); -- eliminate x2 spaces + return itemName; + else + return tabardName; + end +end + +function getRepData(tabardName, printRep) + local itemName = tabardName; + local factionIndex = 1; + local lastFactionName = nil; + local repString; + local basePoints; + local demoninator; + local repLevel; + local foundName = false; + local oldTabardIsWrath = false; + local factionColor; + local colorTemplate = "|cff%02x%02x%02x"; + local r, g, b; + if (printRep == nil) then printRep = true; end + --DEFAULT_CHAT_FRAME:AddMessage("WWDB: getRepData(" .. tabardName .. ")"); + if (tabardName ~= HORDE_EXPEDITION) then + itemName = processTabardName(tabardName); + end + if (oldTabard ~= HORDE_EXPEDITION) then + oldTabard = processTabardName(oldTabard); + end + --DEFAULT_CHAT_FRAME:AddMessage("WWDB: Processed itemName = " .. itemName); + repeat + local name, description, standingId, bottomValue, topValue, earnedValue, atWarWith, + canToggleAtWar, isHeader, isCollapsed, hasRep, isWatched, isChild = GetFactionInfo(factionIndex); + if (name == lastFactionName) then + break; + elseif (name == nil) then + break; + else + lastFactionName = name; + for i = 1, #wrathNames do + if (name == wrathNames[i]) then + foundName = true; -- is this a wotlk faction name? + end + oVal = string.find(wrathNames[i], oldTabard); + if (oVal ~= nil) then + oldTabardIsWrath = true; + end + end + oVal = string.find(name, oldTabard); + if (oVal ~= nil and startRep ~= nil and oldTabardIsWrath) then + totalEarned = earnedValue - startRep; + if (totalEarned ~= nil and totalEarned > 0) then + DEFAULT_CHAT_FRAME:AddMessage("WyntrWear: You earned " .. totalEarned .. " reputation with " .. oldTabard .."."); + end + --DEFAULT_CHAT_FRAME:AddMessage("WWDB: start rep: " .. startRep ..", earnedValue: " .. earnedValue); + else + totalEarned = 0; + end + if (itemName ~= nil and name ~= nil) then + tVal = string.find(name, itemName); + if (tVal ~= nil and foundName) then + --DEFAULT_CHAT_FRAME:AddMessage("earnedValue = " .. earnedValue); + if (earnedValue > EXALTED_MIN) then + repLevel = "exalted"; + atExalted = true; + basePoints = earnedValue - REVERED_MAX; + denominator = EXALTED_MAX - EXALTED_MIN; + r = 0.6; + g = 0.2; + b = 0.8; + elseif (earnedValue > REVERED_MIN) then + repLevel = "revered"; + basePoints = earnedValue - HONORED_MAX; + denominator = REVERED_MAX - REVERED_MIN; + r = 0.25; + g = 0.4; + b = 0.9; + elseif (earnedValue > HONORED_MIN) then + repLevel = "honored"; + basePoints = earnedValue - FRIENDLY_MAX; + denominator = HONORED_MAX - HONORED_MIN + r = 0; + g = 1; + b = 0; + elseif (earnedValue > FRIENDLY_MIN) then + repLevel = "friendly"; + basePoints = earnedValue - NEUTRAL_MAX; + denominator = FRIENDLY_MAX - FRIENDLY_MIN; + r = 1; + g = 1; + b = 1; + elseif (earnedValue > NEUTRAL_MIN) then + repLevel = "neutral"; + basePoints = earnedValue; + denominator = topvalue; + r = 0.75; + g = 0.75; + b = 0.75; + else + repLevel = "bad"; + end + if (repLevel ~= "bad") then + if (printRep) then + repString = string.format("%.2f", tostring((basePoints/denominator)*100)); + colorString = format(colorTemplate, r * 255, g * 255, b * 255); + DEFAULT_CHAT_FRAME:AddMessage("WyntrWear: Currently at " .. repString .. "% of " .. colorString .. repLevel .. "|r reputation with " .. name .. "."); + end + return earnedValue, totalEarned; + end + end + else + return; -- error trap: for some reason itemName got zapped to nil...fuggit - return + end + end + factionIndex = factionIndex + 1; + until (factionIndex > 200) +end + +function checkRep() + if (startRep == nil) then + startRep = getRepData(tabardName, true); + oldTabard = tabardName; + else + startRep = getRepData(tabardName, true); + oldTabard = tabardName; + end +end + + +function WyntrWear_OnEvent(frame, event, ...) + if (event == "PLAYER_ENTERING_WORLD") then + if ((UnitLevel("player") > 79) and not wynWearLoad) then + inInstance, instanceType = IsInInstance(); + if (instanceType == "party") then + if (not IsEquippedItemType("Tabard")) then + frame:Show(); + else -- check to see which tabard is being worn and if it generates rep + tabardName = GetInventoryItemLink("player", GetInventorySlotInfo("TabardSlot")); + local found, _, itemString = string.find(tabardName, "^|c%x+|H(.+)|h%[.*%]"); + tabardFaction = strsub(itemString, 15); + end + end + end + if (IsEquippedItemType("Tabard")) then + tabardName = GetInventoryItemLink("player", GetInventorySlotInfo("TabardSlot")); + DEFAULT_CHAT_FRAME:AddMessage("WyntrWear: Wearing: " .. tabardName .. "."); + if (atExalted) then + DEFAULT_CHAT_FRAME:AddMessage("|cffff0000WyntrWear: You are at exalted with this faction and should consider using a different tabard."); + end + else + tabardName = HORDE_EXPEDITION; + DEFAULT_CHAT_FRAME:AddMessage("WyntrWear: Not wearing a tabard."); + end + elseif (event == "ADDON_LOADED") then + if (wynWearLoad == nil) then + wynWearLoad = false; + end + elseif (event == "UNIT_INVENTORY_CHANGED") then + local repEarnedThisTabard = 0; + local newTabard = GetInventoryItemLink("player", GetInventorySlotInfo("TabardSlot")); + if (newTabard ~= tabardName) then -- if this evaluates true - the tabard change triggered the event + atExalted = false; + if (IsEquippedItemType("Tabard")) then + tabardName = newTabard; + DEFAULT_CHAT_FRAME:AddMessage("WyntrWear: Tabard equipped: " .. tabardName); + checkRep(); + elseif (UnitLevel("player") > 67 and oldTabard ~= HORDE_EXPEDITION) then + DEFAULT_CHAT_FRAME:AddMessage("WyntrWear: Tabard unequipped."); + tabardName = HORDE_EXPEDITION; + checkRep(); + end + end + end +end + +function wynCheckBoxFunction() + wynWearLoad = wynCheckBox1:GetChecked(); +end + +function WyntrWear_CmdHandler(str) + frame = getglobal("wynFrame1"); + + if (frame) then + if (frame:IsVisible()) then + frame:Hide(); + end + end + + if (str == "status") then + if (IsEquippedItemType("Tabard")) then + tabardName = GetInventoryItemLink("player", GetInventorySlotInfo("TabardSlot")); + DEFAULT_CHAT_FRAME:AddMessage("WyntrWear: You are wearing " .. tabardName .. "."); + getRepData(tabardName, true); + else + if (UnitLevel("player") > 67) then + DEFAULT_CHAT_FRAME:AddMessage("WyntrWear: You are not wearing a tabard."); + getRepData(HORDE_EXPEDITION, true); + end + end + elseif (str == "check") then + DEFAULT_CHAT_FRAME:AddMessage("WyntrWear check forced for next time you enter an instance."); + wynWearLoad = false; + else + DEFAULT_CHAT_FRAME:AddMessage("WyntrWear: Usage: /{ww}|{wyntrwear} {status}|{check}\nstatus: tells if you are currently wearing a tabard.\ncheck - forces check to be performed upon entering instance."); + end +end \ No newline at end of file diff --git a/WyntrWear.toc b/WyntrWear.toc new file mode 100644 index 0000000..6622239 --- /dev/null +++ b/WyntrWear.toc @@ -0,0 +1,10 @@ +## Interface: 30200 +## Title: WyntrWear +## Author: Wyntrfylth of Skywall +## Version: 1.0 +## Notes: Reminds you, upon entering instance, to equip a tabard. +## eMail: wyntrfylth@me.com +## DefaultState: Disabled +## LoadOnDemand: 0 +## SavedVariablesPerCharacter: wynWearLoad +WyntrWear.xml diff --git a/WyntrWear.xml b/WyntrWear.xml new file mode 100644 index 0000000..2aa19da --- /dev/null +++ b/WyntrWear.xml @@ -0,0 +1,140 @@ + +