From 843392349f3d8621c774bf115561e3d1c32c8e95 Mon Sep 17 00:00:00 2001 From: Clank-o-matic <898+clank-o-matic@noreply.octowow.st> Date: Fri, 18 Sep 2026 09:30:26 +0000 Subject: [PATCH] Upload files to "/" --- Core.lua | 62 ++++++++++++++++++++++++++++++++++++++++------------- OSHS.toc | 2 +- Options.lua | 2 +- 3 files changed, 49 insertions(+), 17 deletions(-) diff --git a/Core.lua b/Core.lua index eb2c92e..6897796 100644 --- a/Core.lua +++ b/Core.lua @@ -12,7 +12,7 @@ local defaults = { showMisses = true, colorBySchool = true, critColor = true, - hideBlizzardDamage = false, + disableFloatingCombatText = true, useTargetFrame = true, scale = .9, textSize = 22, @@ -119,10 +119,18 @@ local function applyDefaults() HS.db = OSHSDB end +local function readCVar(name) + if not GetCVar then return nil end + local ok, value = pcall(GetCVar, name) + if ok and value ~= nil and value ~= "" then return tonumber(value) or value end +end + +local function writeCVar(name, value) + if SetCVar then pcall(SetCVar, name, value) end +end + function HS:ResetSettings() - if self.db and self.db.nativeDamageBeforeOSHS ~= nil and SetCVar then - SetCVar("CombatDamage", self.db.nativeDamageBeforeOSHS) - end + self:RestoreNativeTextSetting() OSHSDB = {} applyDefaults() self:ApplyNativeTextSetting() @@ -130,17 +138,30 @@ function HS:ResetSettings() if self.SetStatusAnchorLocked then self:SetStatusAnchorLocked(self.db.statusAnchorLocked) end end -function HS:ApplyNativeTextSetting() - if not self.db or not SetCVar then return end - if self.db.hideBlizzardDamage then - if self.db.nativeDamageBeforeOSHS == nil then - self.db.nativeDamageBeforeOSHS = tonumber(GetCVar("CombatDamage")) or 1 - end - SetCVar("CombatDamage", 0) - elseif self.db.nativeDamageBeforeOSHS ~= nil then - SetCVar("CombatDamage", self.db.nativeDamageBeforeOSHS) +function HS:RestoreNativeTextSetting() + if not self.db then return end + if self.db.nativeDamageBeforeOSHS ~= nil then + writeCVar("CombatDamage", self.db.nativeDamageBeforeOSHS) self.db.nativeDamageBeforeOSHS = nil end + if self.db.nativeHealingBeforeOSHS ~= nil then + writeCVar("CombatHealing", self.db.nativeHealingBeforeOSHS) + self.db.nativeHealingBeforeOSHS = nil + end +end + +function HS:ApplyNativeTextSetting() + if not self.db or not SetCVar then return end + if self.db.disableFloatingCombatText then + if self.db.nativeDamageBeforeOSHS == nil then + self.db.nativeDamageBeforeOSHS = readCVar("CombatDamage") or 1 + end + if self.db.nativeHealingBeforeOSHS == nil then + self.db.nativeHealingBeforeOSHS = readCVar("CombatHealing") + end + writeCVar("CombatDamage", 0) + if self.db.nativeHealingBeforeOSHS ~= nil then writeCVar("CombatHealing", 0) end + else self:RestoreNativeTextSetting() end end local function schoolKey(school) @@ -498,13 +519,20 @@ function HS:ShowSplat(targetName, amount, isCrit, isHeal, school, anchorHint, al item.text:SetFont("Interface\\AddOns\\OSHS\\Assets\\runescape.ttf", math.max(1, textSize - 1), "OUTLINE") if item.text.SetTextHeight then item.text:SetTextHeight(textSize) end item.text:SetText(amountText) - if isCrit and self.db.critColor then item.text:SetTextColor(1, .88, .3) else item.text:SetTextColor(1, 1, 1) end + if isHeal then + item.text:SetTextColor(.35, 1, .35) + elseif isCrit and self.db.critColor then + item.text:SetTextColor(1, .88, .3) + else + item.text:SetTextColor(1, 1, 1) + end local texture = schoolTextures[self.db.colorBySchool and schoolKey(school) or "physical"] if isHeal then texture = "Interface\\AddOns\\OSHS\\Assets\\Hitsplat-Heal.tga" elseif not numeric or numeric == 0 then texture = "Interface\\AddOns\\OSHS\\Assets\\Hitsplat-Miss.tga" end item.splat:SetTexture(texture) - item.splat:SetVertexColor(1, 1, 1) + if isHeal then item.splat:SetVertexColor(.15, 1, .15) + else item.splat:SetVertexColor(1, 1, 1) end item.splat:SetWidth(math.max(42, 26 + string.len(amountText) * 7) * scale) item.splat:SetHeight(42 * scale) item:SetAlpha(1) @@ -1086,6 +1114,7 @@ end HS:RegisterEvent("VARIABLES_LOADED") HS:RegisterEvent("PLAYER_ENTERING_WORLD") HS:RegisterEvent("PLAYER_TARGET_CHANGED") +HS:RegisterEvent("PLAYER_LOGOUT") HS:RegisterEvent("LEARNED_SPELL_IN_TAB") HS:RegisterEvent("SPELLS_CHANGED") HS:RegisterEvent("CHAT_MSG_SPELL_AURA_GONE_SELF") @@ -1124,6 +1153,8 @@ HS:SetScript("OnEvent", function() if DEFAULT_CHAT_FRAME then DEFAULT_CHAT_FRAME:AddMessage("|cffd58cffOSHS:|r loaded. Type |cffffffff/oshs|r for settings.") end + elseif event == "PLAYER_LOGOUT" then + HS:RestoreNativeTextSetting() elseif event == "PLAYER_TARGET_CHANGED" then rememberCurrentBoss() elseif event == "LEARNED_SPELL_IN_TAB" or event == "SPELLS_CHANGED" then @@ -1341,6 +1372,7 @@ SLASH_OSHS2 = "/hitsplats" SlashCmdList.OSHS = function(msg) msg = string.lower(msg or "") if msg == "test" then HS:Preview() + elseif msg == "heal" then HS:ShowSplat(UnitName("player"), 125, false, true, nil, nil, true) elseif msg == "interrupt" then local targetName = UnitExists("target") and UnitName("target") local targetGUID = targetName and UnitGUID and UnitGUID("target") diff --git a/OSHS.toc b/OSHS.toc index 31a4606..b0e2a4f 100644 --- a/OSHS.toc +++ b/OSHS.toc @@ -1,7 +1,7 @@ ## Interface: 11200 ## Title: OSRS Hit Splashes ## Notes: Old School RuneScape-style combat hit splashes for OctoWoW -## Version: 1.2.6 +## Version: 1.2.8 ## SavedVariables: OSHSDB ## OptionalDeps: pfUI, !!!ClassicAPI diff --git a/Options.lua b/Options.lua index 77195c9..935dccd 100644 --- a/Options.lua +++ b/Options.lua @@ -42,8 +42,8 @@ addCheck("Damage-school splats", "colorBySchool", 178, -94) addCheck("Gold critical numbers", "critColor", 334, -94) addCheck("Show damage taken", "showDamageTaken", 22, -126) addCheck("Target-frame fallback", "useTargetFrame", 178, -126) -addCheck("Hide native damage", "hideBlizzardDamage", 350, -126, function() HS:ApplyNativeTextSetting() end) addCheck("Show interrupt messages", "showInterrupts", 22, -154) +addCheck("Disable floating combat text", "disableFloatingCombatText", 178, -154, function() HS:ApplyNativeTextSetting() end) local sliders, sliderCount = {}, 0 local function formatValue(value, step)