Quantcast

setpoint

Ou Junhui [11-23-21 - 12:17]
setpoint
Filename
oUF_Simple/core/functions.lua
oUF_Simple/modules/oUF_Swing.lua
oUF_SimpleConfig/player.lua
rFilter_Zork/classes/hunter.lua
rMinimap/core.lua
diff --git a/oUF_Simple/core/functions.lua b/oUF_Simple/core/functions.lua
index e9d46a8..82a1f8f 100644
--- a/oUF_Simple/core/functions.lua
+++ b/oUF_Simple/core/functions.lua
@@ -194,20 +194,23 @@ L.F.CreateAltPowerBar = CreateAltPowerBar
 local function CreateSwing(self)
   if not self.cfg.swing or not self.cfg.swing.enabled then return end
   --statusbar
-  local s = CreateFrame("Frame", nil, self.Power)
+  local s = CreateFrame("Frame", nil, self)
   s.texture = L.C.textures.statusbar
   s.textureBG = L.C.textures.statusbarBG
   s.color = self.cfg.swing.color
   s.colorBG = self.cfg.swing.colorBG
   s.disableRanged = self.cfg.swing.disableRanged
   s.disableMelee = self.cfg.swing.disableMelee
+
+  s:SetSize(unpack(self.cfg.swing.size))
+  SetPoint(s,self,self.cfg.swing.point)
+  s:SetFrameStrata("MEDIUM")
+
   --bg
   local bg = s:CreateTexture(nil, "BACKGROUND")
-  -- bg:SetTexture(L.C.textures.statusbar)
-  -- bg:SetColorTexture()
   bg:SetAllPoints()
   s.bg = bg
-  s:SetAllPoints()
+
   return s
 end
 L.F.CreateSwing = CreateSwing
diff --git a/oUF_Simple/modules/oUF_Swing.lua b/oUF_Simple/modules/oUF_Swing.lua
index 81377d4..848e088 100644
--- a/oUF_Simple/modules/oUF_Swing.lua
+++ b/oUF_Simple/modules/oUF_Swing.lua
@@ -6,13 +6,11 @@ local A, L = ...
 local oUF = L.oUF or oUF
 if not oUF then return end

-local strfind = string.find
+local select = select
 local GetTime = GetTime
 local GetInventoryItemID = GetInventoryItemID
 local UnitAttackSpeed = UnitAttackSpeed
 local UnitRangedDamage = UnitRangedDamage
-local CombatLogGetCurrentEventInfo = CombatLogGetCurrentEventInfo
-local UnitGUID = UnitGUID
 local IsPlayerMoving = IsPlayerMoving
 local UnitCastingInfo = UnitCastingInfo

@@ -20,9 +18,20 @@ local meleeing, rangeing, lasthit
 local MainhandID = GetInventoryItemID("player", 16)
 local OffhandID = GetInventoryItemID("player", 17)
 local RangedID = GetInventoryItemID("player", 18)
+local playerGUID = UnitGUID("player")
 local AUTO_CAST_TIME = .65
 local delayTime = 0

+local function Round(number, idp)
+	idp = idp or 0
+	local mult = 10 ^ idp
+	return floor(number * mult + .5) / mult
+end
+
+local function RoundPercent(percent)
+	return Round(percent, 2)
+end
+
 local function SwingStopped(element)
 	local bar = element.__owner
 	local swing = bar.Twohand
@@ -203,14 +212,14 @@ local function MeleeChange(self, _, unit)
 	else
 		if ohspeed then
 			if swingMH.speed and swingMH.speed ~= mhspeed then
-				local percentage = ((swingMH.max or 10) - now) / (swingMH.speed)
+				local percentage = RoundPercent(((swingMH.max or 10) - now) / swingMH.speed)
 				swingMH.min = now - mhspeed * (1 - percentage)
 				swingMH.max = now + mhspeed * percentage
 				UpdateBarMinMaxValues(swingMH)
 				swingMH.speed = mhspeed
 			end
 			if swingOH.speed and swingOH.speed ~= ohspeed then
-				local percentage = ((swingOH.max or 10)- now) / (swingOH.speed)
+				local percentage = RoundPercent(((swingOH.max or 10)- now) / swingOH.speed)
 				swingOH.min = now - ohspeed * (1 - percentage)
 				swingOH.max = now + ohspeed * percentage
 				UpdateBarMinMaxValues(swingOH)
@@ -218,7 +227,7 @@ local function MeleeChange(self, _, unit)
 			end
 		else
 			if swing.max and swing.speed ~= mhspeed then
-				local percentage = (swing.max - now) / (swing.speed)
+				local percentage = RoundPercent((swing.max - now) / swing.speed)
 				swing.min = now - mhspeed * (1 - percentage)
 				swing.max = now + mhspeed * percentage
 				UpdateBarMinMaxValues(swing)
@@ -248,7 +257,7 @@ local function RangedChange(self, _, unit)
 		swing:SetScript("OnUpdate", OnDurationUpdate)
 	else
 		if swing.speed ~= speed then
-			local percentage = (swing.max - now) / (swing.speed)
+			local percentage = RoundPercent((swing.max - now) / swing.speed)
 			swing.min = now - speed * (1 - percentage)
 			swing.max = now + speed * percentage
 			swing.speed = speed
@@ -283,10 +292,8 @@ local function Ranged(self, _, unit, _, spellID)
 	swingOH:SetScript("OnUpdate", nil)
 end

-local function Melee(self)
-	local _, subevent, _, GUID = CombatLogGetCurrentEventInfo()
-	if GUID ~= UnitGUID("player") then return end
-	if not strfind(subevent, "SWING") then return end
+local function Melee(self, event, _, sourceGUID)
+	if sourceGUID ~= playerGUID then return end

 	local bar = self.Swing
 	local swing = bar.Twohand
@@ -340,12 +347,11 @@ local function Melee(self)
 	lasthit = now
 end

-local function ParryHaste(self)
-	local _, subevent, _, _, _, _, tarGUID, _, missType = CombatLogGetCurrentEventInfo()
+local function ParryHaste(self, ...)
+	local destGUID, _, _, _, missType = select(7, ...)

-	if tarGUID ~= UnitGUID("player") then return end
+	if destGUID ~= playerGUID then return end
 	if not meleeing then return end
-	if not strfind(subevent, "MISSED") then return end
 	if missType ~= "PARRY" then return end

 	local bar = self.Swing
@@ -358,7 +364,7 @@ local function ParryHaste(self)

 	-- needed calculations, so the timer doesnt jump on parryhaste
 	if dualwield then
-		local percentage = (swingMH.max - now) / swingMH.speed
+		local percentage = RoundPercent((swingMH.max - now) / swingMH.speed)

 		if percentage > .6 then
 			swingMH.max = now + swingMH.speed * .6
@@ -370,7 +376,7 @@ local function ParryHaste(self)
 			UpdateBarMinMaxValues(swingMH)
 		end

-		percentage = (swingOH.max - now) / swingOH.speed
+		percentage = RoundPercent((swingOH.max - now) / swingOH.speed)

 		if percentage > .6 then
 			swingOH.max = now + swingOH.speed * .6
@@ -382,7 +388,7 @@ local function ParryHaste(self)
 			UpdateBarMinMaxValues(swingOH)
 		end
 	else
-		local percentage = (swing.max - now) / swing.speed
+		local percentage = RoundPercent((swing.max - now) / swing.speed)

 		if percentage > .6 then
 			swing.max = now + swing.speed * .6
@@ -496,8 +502,9 @@ local function Enable(self, unit)
 			self:RegisterEvent("UNIT_RANGEDDAMAGE", RangedChange)
 		end
 		if not bar.disableMelee then
-			self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED", Melee, true)
-			self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED", ParryHaste, true)
+			self:RegisterCombatEvent("SWING_DAMAGE", Melee)
+			self:RegisterCombatEvent("SWING_MISSED", Melee)
+			self:RegisterCombatEvent("SWING_MISSED", ParryHaste)
 			self:RegisterEvent("UNIT_ATTACK_SPEED", MeleeChange)
 		end
 		self:RegisterEvent("PLAYER_REGEN_ENABLED", Ooc, true)
@@ -514,8 +521,9 @@ local function Disable(self)
 			self:UnregisterEvent("UNIT_RANGEDDAMAGE", RangedChange)
 		end
 		if not bar.disableMelee then
-			self:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED", Melee)
-			self:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED", ParryHaste)
+			self:UnregisterCombatEvent("SWING_DAMAGE", Melee)
+			self:UnregisterCombatEvent("SWING_MISSED", Melee)
+			self:UnregisterCombatEvent("SWING_MISSED", ParryHaste)
 			self:UnregisterEvent("UNIT_ATTACK_SPEED", MeleeChange)
 		end
 		self:UnregisterEvent("PLAYER_REGEN_ENABLED", Ooc)
diff --git a/oUF_SimpleConfig/player.lua b/oUF_SimpleConfig/player.lua
index fa8f6ec..e5fb980 100644
--- a/oUF_SimpleConfig/player.lua
+++ b/oUF_SimpleConfig/player.lua
@@ -71,10 +71,12 @@ L.C.player = {
   --swing
   swing = {
     enabled = true,
-    color = {1,0.7,0,0.5},
+    color = {0.29,1,0.3,0.7},
     colorBG = {0,0,0,0},
     disableRanged = false,
-    disableMelee = false,
+    disableMelee = true,
+    size = {265, 5},
+    point = {"BOTTOM","TOP",0,14}
   },
   --raidmark
   raidmark = {
diff --git a/rFilter_Zork/classes/hunter.lua b/rFilter_Zork/classes/hunter.lua
index 5764436..21728e6 100644
--- a/rFilter_Zork/classes/hunter.lua
+++ b/rFilter_Zork/classes/hunter.lua
@@ -26,37 +26,40 @@ local A, L = ...
 if L.C.playerClass == "HUNTER" then
   -- 狂野, row 1 col 1
   rFilter:CreateBuff(34471,"player",36,{"TOPLEFT",oUF_SimplePlayer,"TOPRIGHT",8,0},"show",{0,1},true,nil)
-  rFilter:CreateCooldown(19574,36,{"TOPLEFT",oUF_SimplePlayer,"TOPRIGHT",8,0},"[combat]show;hide",{0.2,1},true)
+  rFilter:CreateCooldown(19574,36,{"TOPLEFT",oUF_SimplePlayer,"TOPRIGHT",8,0},"[combat]show;hide",{0.5,1},true)
   -- 急速射击, row 1 col 2
   rFilter:CreateBuff(3045,"player",36,{"TOPLEFT",oUF_SimplePlayer,"TOPRIGHT",50,0},"show",{0,1},true,nil)
-  rFilter:CreateCooldown(3045,36,{"TOPLEFT",oUF_SimplePlayer,"TOPRIGHT",50,0},"[combat]show;hide",{0.2,1},true)
+  rFilter:CreateCooldown(3045,36,{"TOPLEFT",oUF_SimplePlayer,"TOPRIGHT",50,0},"[combat]show;hide",{0.5,1},true)
   -- 杀戮命令, row 1 col 3
-  rFilter:CreateCooldown(34026,36,{"TOPLEFT",oUF_SimplePlayer,"TOPRIGHT",92,0},"[combat]show;hide",{0.2,1},true)
+  rFilter:CreateCooldown(34026,36,{"TOPLEFT",oUF_SimplePlayer,"TOPRIGHT",92,0},"[combat]show;hide",{0.5,1},true)
   -- 多重射击, row 1 col 4
-  rFilter:CreateCooldown(27021,36,{"TOPLEFT",oUF_SimplePlayer,"TOPRIGHT",134,0},"[combat]show;hide",{0.2,1},true)
+  rFilter:CreateCooldown(27021,36,{"TOPLEFT",oUF_SimplePlayer,"TOPRIGHT",134,0},"[combat]show;hide",{0.5,1},true)
   -- 奥射, row 1 col 5 315496 212283
-  rFilter:CreateCooldown(14286,36,{"TOPLEFT",oUF_SimplePlayer,"TOPRIGHT",176,0},"[combat]show;hide",{0.2,1},true)
+  rFilter:CreateCooldown(14286,36,{"TOPLEFT",oUF_SimplePlayer,"TOPRIGHT",176,0},"[combat]show;hide",{0.5,1},true)

   -- 震荡射击, row 2 col 1
   rFilter:CreateDebuff(5116,"target",24,{"TOPLEFT",oUF_SimplePlayer,"TOPRIGHT",8,-42},"show",{0,1},true,nil)
-  rFilter:CreateCooldown(5116,24,{"TOPLEFT",oUF_SimplePlayer,"TOPRIGHT",8,-42},"[combat]show;hide",{0.2,1},true)
+  rFilter:CreateCooldown(5116,24,{"TOPLEFT",oUF_SimplePlayer,"TOPRIGHT",8,-42},"[combat]show;hide",{0.5,1},true)
   -- 误导, row 2 col 2
   rFilter:CreateBuff(34477,"player",24,{"TOPLEFT",oUF_SimplePlayer,"TOPRIGHT",38,-42},"show",{0,1},true,nil)
-  rFilter:CreateCooldown(34477,24,{"TOPLEFT",oUF_SimplePlayer,"TOPRIGHT",38,-42},"[combat]show;hide",{0.2,1},true)
+  rFilter:CreateCooldown(34477,24,{"TOPLEFT",oUF_SimplePlayer,"TOPRIGHT",38,-42},"[combat]show;hide",{0.5,1},true)
   -- 假死, row 2 col 3
   rFilter:CreateBuff(5384,"player",24,{"TOPLEFT",oUF_SimplePlayer,"TOPRIGHT",68,-42},"show",{0,1},true,nil)
-  rFilter:CreateCooldown(5384,24,{"TOPLEFT",oUF_SimplePlayer,"TOPRIGHT",68,-42},"[combat]show;hide",{0.2,1},true)
+  rFilter:CreateCooldown(5384,24,{"TOPLEFT",oUF_SimplePlayer,"TOPRIGHT",68,-42},"[combat]show;hide",{0.5,1},true)
   -- 冰冻陷阱, row 2 col 4
   rFilter:CreateDebuff(14309,"target",24,{"TOPLEFT",oUF_SimplePlayer,"TOPRIGHT",98,-42},"show",{0,1},true,nil)
-  rFilter:CreateCooldown(14311,24,{"TOPLEFT",oUF_SimplePlayer,"TOPRIGHT",98,-42},"[combat]show;hide",{0.2,1},true)
+  rFilter:CreateCooldown(14311,24,{"TOPLEFT",oUF_SimplePlayer,"TOPRIGHT",98,-42},"[combat]show;hide",{0.5,1},true)
   -- 毒蛇钉刺, row 2 col 5
   rFilter:CreateDebuff(13554,"target",24,{"TOPLEFT",oUF_SimplePlayer,"TOPRIGHT",128,-42},"show",{0,1},true,"player")
+  rFilter:CreateDebuff(3043,"target",24,{"TOPLEFT",oUF_SimplePlayer,"TOPRIGHT",128,-42},"show",{0,1},true,"player")
+  rFilter:CreateDebuff(27018,"target",24,{"TOPLEFT",oUF_SimplePlayer,"TOPRIGHT",128,-42},"show",{0,1},true,"player")
+  rFilter:CreateCooldown(27018,24,{"TOPLEFT",oUF_SimplePlayer, "TOPRIGHT",128,-42},"[combat]show;hide",{0.5,1},true)
   -- 瞄准射击, row 2 col 6
   rFilter:CreateDebuff(20904,"target",24,{"TOPLEFT",oUF_SimplePlayer,"TOPRIGHT",158,-42},"show",{0,1},true,"player")
-  rFilter:CreateCooldown(20904,24,{"TOPLEFT",oUF_SimplePlayer, "TOPRIGHT",158,-42},"[combat]show;hide",{0.2,1},true)
+  rFilter:CreateCooldown(20904,24,{"TOPLEFT",oUF_SimplePlayer, "TOPRIGHT",158,-42},"[combat]show;hide",{0.5,1},true)
   -- 胁迫, row 2 col 7
   rFilter:CreateDebuff(19577,"target",24,{"TOPLEFT",oUF_SimplePlayer,"TOPRIGHT",188,-42},"show",{0,1},true,nil)
-  rFilter:CreateCooldown(19577,24,{"TOPLEFT",oUF_SimplePlayer,"TOPRIGHT",188,-42},"[combat]show;hide",{0.2,1},true)
+  rFilter:CreateCooldown(19577,24,{"TOPLEFT",oUF_SimplePlayer,"TOPRIGHT",188,-42},"[combat]show;hide",{0.5,1},true)

   -- extra target
   -- 快速射击
diff --git a/rMinimap/core.lua b/rMinimap/core.lua
index 9064ef0..c4a8e38 100644
--- a/rMinimap/core.lua
+++ b/rMinimap/core.lua
@@ -49,6 +49,12 @@ MinimapZoneText:Hide()
 MinimapToggleButton:Hide()
 GameTimeFrame:Hide()

+--quest timer frame
+QuestTimerFrame:SetParent(Minimap)
+QuestTimerFrame:SetScale(1)
+QuestTimerFrame:ClearAllPoints()
+QuestTimerFrame:SetPoint("TOP",Minimap,"BOTTOM",0,-10)
+
 --dungeon info
 -- classic-disable
 --[[