Initial commit of OctoLatency addon
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
--------------------------------------------------------------------------------
|
||||
-- OctoLatency for Vanilla WoW (1.12.1) - Author: Palladinpala
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
-- Throttle timer to reduce CPU/performance overhead
|
||||
local elapsedTimer = 0
|
||||
local UPDATE_INTERVAL = 2.0 -- update every 2 seconds
|
||||
|
||||
function OctoLatency_OnLoad(self)
|
||||
-- Register events
|
||||
self:RegisterEvent("VARIABLES_LOADED")
|
||||
|
||||
-- Tooltip on hover
|
||||
self:SetScript("OnEnter", function()
|
||||
GameTooltip:SetOwner(this, "ANCHOR_TOP")
|
||||
GameTooltip:AddLine("OctoLatency", 0, 1, 1)
|
||||
local bandwidth, latency, homeLatency, worldLatency = GetNetStats()
|
||||
GameTooltip:AddLine("Home Latency: " .. homeLatency .. " ms", 1, 1, 1)
|
||||
GameTooltip:AddLine("World Latency: " .. worldLatency .. " ms", 1, 1, 1)
|
||||
GameTooltip:AddLine("Bandwidth: " .. string.format("%.2f", bandwidth) .. " KB/s", 1, 1, 1)
|
||||
GameTooltip:AddLine("Left-click and drag to move.", 0.7, 0.7, 0.7)
|
||||
GameTooltip:Show()
|
||||
end)
|
||||
|
||||
self:SetScript("OnLeave", function()
|
||||
GameTooltip:Hide()
|
||||
end)
|
||||
end
|
||||
|
||||
function OctoLatency_OnUpdate(elapsed)
|
||||
elapsedTimer = elapsedTimer + elapsed
|
||||
if (elapsedTimer < UPDATE_INTERVAL) then
|
||||
return
|
||||
end
|
||||
elapsedTimer = 0
|
||||
|
||||
-- GetNetStats returns: bandwidth, latency, homeLatency, worldLatency
|
||||
local _, _, homeLatency, worldLatency = GetNetStats()
|
||||
|
||||
-- We'll display world latency (or max of home/world)
|
||||
local latency = worldLatency or homeLatency or 0
|
||||
|
||||
-- Color thresholds: Green < 150ms, Yellow 150-350ms, Red > 350ms
|
||||
local colorHex
|
||||
if (latency < 150) then
|
||||
colorHex = "|cff00ff00" -- Green
|
||||
elseif (latency <= 350) then
|
||||
colorHex = "|cffffff00" -- Yellow
|
||||
else
|
||||
colorHex = "|cffff0000" -- Red
|
||||
end
|
||||
|
||||
OctoLatencyText:SetText(colorHex .. latency .. " ms|r")
|
||||
end
|
||||
|
||||
function OctoLatency_SavePosition()
|
||||
if (not OctoLatencyDB) then
|
||||
OctoLatencyDB = {}
|
||||
end
|
||||
local point, relativeTo, relativePoint, xOfs, yOfs = OctoLatencyFrame:GetPoint()
|
||||
OctoLatencyDB.point = point
|
||||
OctoLatencyDB.relativePoint = relativePoint
|
||||
OctoLatencyDB.xOfs = xOfs
|
||||
OctoLatencyDB.yOfs = yOfs
|
||||
end
|
||||
|
||||
-- Load saved position if available on PLAYER_LOGIN or VARIABLES_LOADED
|
||||
local loadFrame = CreateFrame("Frame")
|
||||
loadFrame:RegisterEvent("PLAYER_LOGIN")
|
||||
loadFrame:SetScript("OnEvent", function()
|
||||
if (OctoLatencyDB and OctoLatencyDB.point) then
|
||||
OctoLatencyFrame:ClearAllPoints()
|
||||
OctoLatencyFrame:SetPoint(OctoLatencyDB.point, UIParent, OctoLatencyDB.relativePoint, OctoLatencyDB.xOfs, OctoLatencyDB.yOfs)
|
||||
end
|
||||
end)
|
||||
@@ -0,0 +1,9 @@
|
||||
## Interface: 11200
|
||||
## Title: OctoLatency
|
||||
## Notes: Lightweight latency monitor with color-coding for Vanilla WoW (1.12.1)
|
||||
## Author: Palladinpala
|
||||
## Version: 1.0
|
||||
## SavedVariables: OctoLatencyDB
|
||||
|
||||
OctoLatency.xml
|
||||
OctoLatency.lua
|
||||
@@ -0,0 +1,58 @@
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ ..\FrameXML\UI.xsd">
|
||||
<Script file="OctoLatency.lua"/>
|
||||
<Frame name="OctoLatencyFrame" parent="UIParent" movable="true" enableMouse="true" clampedToScreen="true">
|
||||
<Size>
|
||||
<AbsDimension x="90" y="24"/>
|
||||
</Size>
|
||||
<Anchors>
|
||||
<Anchor point="CENTER"/>
|
||||
</Anchors>
|
||||
<Backdrop bgFile="Interface\Tooltips\UI-Tooltip-Background" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true">
|
||||
<BackgroundInsets>
|
||||
<AbsInset left="4" right="4" top="4" bottom="4"/>
|
||||
</BackgroundInsets>
|
||||
<TileSize>
|
||||
<AbsValue val="16"/>
|
||||
</TileSize>
|
||||
<EdgeSize>
|
||||
<AbsValue val="16"/>
|
||||
</EdgeSize>
|
||||
<Color r="0" g="0" b="0" a="0.7"/>
|
||||
</Backdrop>
|
||||
<Layers>
|
||||
<Layer level="ARTWORK">
|
||||
<FontString name="OctoLatencyText" inherits="GameFontNormalSmall" justifyH="CENTER" justifyV="CENTER">
|
||||
<Size>
|
||||
<AbsDimension x="80" y="16"/>
|
||||
</Size>
|
||||
<Anchors>
|
||||
<Anchor point="CENTER">
|
||||
<AbsDimension x="0" y="0"/>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</FontString>
|
||||
</Layer>
|
||||
</Layers>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
OctoLatency_OnLoad(this);
|
||||
</OnLoad>
|
||||
<OnUpdate>
|
||||
OctoLatency_OnUpdate(arg1);
|
||||
</OnUpdate>
|
||||
<OnMouseDown>
|
||||
if (arg1 == "LeftButton") then
|
||||
this:StartMoving();
|
||||
this.isMoving = true;
|
||||
end
|
||||
</OnMouseDown>
|
||||
<OnMouseUp>
|
||||
if (arg1 == "LeftButton" and this.isMoving) then
|
||||
this:StopMovingOrSizing();
|
||||
this.isMoving = false;
|
||||
OctoLatency_SavePosition();
|
||||
end
|
||||
</OnMouseUp>
|
||||
</Scripts>
|
||||
</Frame>
|
||||
</Ui>
|
||||
@@ -0,0 +1,19 @@
|
||||
## OctoLatency Addon Optimization Review & Recommendations
|
||||
|
||||
### Existing Addons Analysis
|
||||
Upon reviewing the installed addons (`pfQuest`, `AI_VoiceOver`, `BigWigs`, `ShaguTweaks`, `Bagnon`, etc.) in this 1.12.1 Turtle WoW / OctoWoW environment, several performance optimization opportunities can be implemented:
|
||||
1. **pfQuest / pfQuest-octo & AI_VoiceOverData_Turtle**: Large databases loaded into memory. Ensure that heavy database lookups are indexed or limited during high-combat situations.
|
||||
2. **ShaguTweaks / ShaguDPS**: Lightweight, but ensure unnecessary frame updates are throttled.
|
||||
3. **Memory Garbage Collection**: Addons like `GentleGC` are present, which helps manage Lua garbage collection spikes. Ensure that frequent string concatenation or table creation inside `OnUpdate` handlers is minimized across all custom scripts.
|
||||
|
||||
---
|
||||
|
||||
### New Addon: `OctoLatency`
|
||||
We are creating a dedicated, highly optimized, lightweight Vanilla WoW addon called **OctoLatency**.
|
||||
- It provides a movable, clean text indicator showing current latency (home and world latency via `GetNetStats()`).
|
||||
- Color codes the latency (tuned for private servers where up to 250ms is common/acceptable):
|
||||
- **Green**: < 150 ms (Good)
|
||||
- **Yellow**: 150 - 350 ms (Warning / Moderate)
|
||||
- **Red**: > 350 ms (Critical / High)
|
||||
- Fully supports drag-and-drop repositioning with position saving via SavedVariables.
|
||||
- Throttled updates (updates every 2 seconds rather than every frame) to ensure zero impact on game performance.
|
||||
Reference in New Issue
Block a user