just playing with sync changes to try and fix trap sync bug
@@ -557,6 +557,38 @@
end
end
+function mod:OnSync(msg, victim)--Lets try two onsync handlers with a diff arg name to maybe work around the trap bug?
+ if msg == "TrapOn" then
+ if not self.Options.BypassLatencyCheck then
+ warnTrapCast:Show(victim)
+ if self.Options.TrapIcon then
+ self:SetIcon(player, 8, 10)
+ end
+ if victim == UnitName("player") then
+ specWarnTrap:Show()
+ if self.Options.YellOnTrap then
+ SendChatMessage(L.YellTrap, "SAY")
+ end
+ end
+ local uId = DBM:GetRaidUnitId(victim)
+ if uId ~= "none" then
+ local inRange = CheckInteractDistance(uId, 2)
+ local x, y = GetPlayerMapPosition(uId)
+ if x == 0 and y == 0 then
+ SetMapToCurrentZone()
+ x, y = GetPlayerMapPosition(uId)
+ end
+ if inRange then
+ specWarnTrapNear:Show()
+ if self.Options.TrapArrow then
+ DBM.Arrow:ShowRunAway(x, y, 10, 5)
+ end
+ end
+ end
+ end
+ end
+end
+
function mod:OnSync(msg, target)
if msg == "PALGrabbed" then
if self.Options.specWarnHealerGrabbed then
@@ -596,34 +628,6 @@
end
end
end
- elseif msg == "TrapOn" then
- if not self.Options.BypassLatencyCheck then
- warnTrapCast:Show(target)
- if self.Options.TrapIcon then
- self:SetIcon(target, 8, 10)
- end
- if target == UnitName("player") then
- specWarnTrap:Show()
- if self.Options.YellOnTrap then
- SendChatMessage(L.YellTrap, "SAY")
- end
- end
- local uId = DBM:GetRaidUnitId(target)
- if uId ~= "none" then
- local inRange = CheckInteractDistance(uId, 2)
- local x, y = GetPlayerMapPosition(uId)
- if x == 0 and y == 0 then
- SetMapToCurrentZone()
- x, y = GetPlayerMapPosition(uId)
- end
- if inRange then
- specWarnTrapNear:Show()
- if self.Options.TrapArrow then
- DBM.Arrow:ShowRunAway(x, y, 10, 5)
- end
- end
- end
- end
elseif msg == "PlagueOn" and self:IsInCombat() then
if GetTime() - lastPlagueCast > 1 then --Dirty hack to prevent function from doing anything for lich kings direct casts of necrotic plague.
warnNecroticPlagueJump:Show(target) --We only want this function to work when it jumps from target to target.