Skip to content

Commit

Permalink
Scripts "Health Potion & Stone" and "Potion Used" updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed Jan 17, 2023
1 parent 764b779 commit 8025165
Show file tree
Hide file tree
Showing 18 changed files with 948 additions and 852 deletions.
3 changes: 2 additions & 1 deletion Details.toc
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ locales\Details-zhTW.lua
boot.lua
indent.lua
core\util.lua
functions\mixin.lua
API.lua
functions\events.lua

functions\events.lua
functions\private.lua
functions\profiles.lua
functions\hooks.lua
Expand Down
1 change: 1 addition & 0 deletions Details_Wrath.toc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ locales\Details-zhTW.lua
boot.lua
indent.lua
core\util.lua
functions\mixin.lua
API.lua

functions\private.lua
Expand Down
6 changes: 5 additions & 1 deletion Libs/DF/fw.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4174,6 +4174,10 @@ function DF:QuickDispatch(func, ...)
return true
end

---call a function in safe mode with payload
---@param func function
---@param ... any
---@return any
function DF:Dispatch(func, ...)
if (type(func) ~= "function") then
return dispatch_error (_, "DF:Dispatch expect a function as parameter 1.")
Expand All @@ -4183,7 +4187,7 @@ function DF:Dispatch(func, ...)
local okay = dispatchResult[1]

if (not okay) then
return nil
return false
end

tremove(dispatchResult, 1)
Expand Down
2 changes: 1 addition & 1 deletion Libs/DF/panel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8593,7 +8593,7 @@ detailsFramework.CastFrameFunctions = {
self.value = self.empowered and (GetTime() - self.spellStartTime) or (self.spellEndTime - GetTime())
self.maxValue = self.spellEndTime - self.spellStartTime

if (self.value < 0 or self.value >= self.maxValue) then
if (self.value < 0 or self.value > self.maxValue) then
self.value = 0
end

Expand Down
1 change: 1 addition & 0 deletions Libs/DF/spells.lua
Original file line number Diff line number Diff line change
Expand Up @@ -944,6 +944,7 @@ DF.CrowdControlSpells = {
[122] = "MAGE", --Frost Nova
[157997] = "MAGE", --Ice Nova
[31661] = "MAGE", --Dragon's Breath
[157981] = "MAGE", --Blast Wave

[205364] = "PRIEST", --Mind Control (talent)
[605] = "PRIEST", --Mind Control
Expand Down
32 changes: 23 additions & 9 deletions Libs/LibOpenRaid/LibOpenRaid.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ if (WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE and not isExpansion_Dragonflight()) t
end

local major = "LibOpenRaid-1.0"
--local CONST_LIB_VERSION = 87
local CONST_LIB_VERSION = 92 --this is a rollback version, due to some zero hour bug issues
local CONST_LIB_VERSION = 93

if (not LIB_OPEN_RAID_MAX_VERSION) then
LIB_OPEN_RAID_MAX_VERSION = CONST_LIB_VERSION
Expand Down Expand Up @@ -98,6 +97,11 @@ local unpack = table.unpack or _G.unpack
local CONST_CVAR_TEMPCACHE = "LibOpenRaidTempCache"
local CONST_CVAR_TEMPCACHE_DEBUG = "LibOpenRaidTempCacheDebug"

--delay to request all data from other players
local CONST_REQUEST_ALL_DATA_COOLDOWN = 30
--delay to send all data to other players
local CONST_SEND_ALL_DATA_COOLDOWN = 30

--show failures (when the function return an error) results to chat
local CONST_DIAGNOSTIC_ERRORS = false
--show the data to be sent and data received from comm
Expand Down Expand Up @@ -764,7 +768,7 @@ end
openRaidLib.internalCallback.TriggerEvent("talentUpdate")
end
local delayedTalentChange = function()
openRaidLib.Schedules.NewUniqueTimer(0.5 + math.random(), talentChangedCallback, "TalentChangeEventGroup", "talentChangedCallback_Schedule")
openRaidLib.Schedules.NewUniqueTimer(math.random(3, 6), talentChangedCallback, "TalentChangeEventGroup", "talentChangedCallback_Schedule")
end

local eventFunctions = {
Expand All @@ -789,7 +793,7 @@ end
--the group has changed, trigger a long timer to send full data
--as the timer is unique, a new change to the group will replace and refresh the time
--using random time, players won't trigger all at the same time
local randomTime = 0.3 + math.random(0, 0.7)
local randomTime = 5 + math.random() + math.random(1, 5)
openRaidLib.Schedules.NewUniqueTimer(randomTime, openRaidLib.mainControl.SendFullData, "mainControl", "sendFullData_Schedule")
end

Expand Down Expand Up @@ -1124,35 +1128,45 @@ end

--send a request to all players in the group to send their data
function openRaidLib.RequestAllData()
--the the player isn't in group, don't send the request
if (not IsInGroup()) then
return
end

openRaidLib.requestAllInfoCooldown = openRaidLib.requestAllInfoCooldown or 0

--check if the player can sent another request
if (openRaidLib.requestAllInfoCooldown > GetTime()) then
return
end

openRaidLib.commHandler.SendCommData(CONST_COMM_FULLINFO_PREFIX)
diagnosticComm("RequestAllInfo| " .. CONST_COMM_FULLINFO_PREFIX) --debug

openRaidLib.requestAllInfoCooldown = GetTime() + 5
openRaidLib.requestAllInfoCooldown = GetTime() + CONST_REQUEST_ALL_DATA_COOLDOWN
return true
end

--this function handles the request from another player to send all data
function openRaidLib.commHandler.SendFullData()
openRaidLib.mainControl.SendFullData()
end

openRaidLib.commHandler.RegisterComm(CONST_COMM_FULLINFO_PREFIX, function(data, sourceName)
openRaidLib.sendRequestedAllInfoCooldown = openRaidLib.sendRequestedAllInfoCooldown or 0

--some player in the group requested all information from all players
--check if there's some delay before sending the data
if (openRaidLib.sendRequestedAllInfoCooldown > GetTime()) then
--reschedule the function call
openRaidLib.Schedules.NewUniqueTimer(openRaidLib.sendRequestedAllInfoCooldown - GetTime(), openRaidLib.commHandler.SendFullData, "CommHandler", "sendFullData_Schedule")
return
end

openRaidLib.Schedules.NewUniqueTimer(random() + math.random(0, 3), openRaidLib.mainControl.SendFullData, "mainControl", "sendFullData_Schedule")
openRaidLib.sendRequestedAllInfoCooldown = GetTime() + 5
end)
openRaidLib.Schedules.NewUniqueTimer(math.random(1, 6), openRaidLib.commHandler.SendFullData, "CommHandler", "sendFullData_Schedule")

--set the delay for the next request
openRaidLib.sendRequestedAllInfoCooldown = GetTime() + CONST_SEND_ALL_DATA_COOLDOWN
end)

--------------------------------------------------------------------------------------------------------------------------------
--~player general ~info ~unit
Expand Down
11 changes: 11 additions & 0 deletions Libs/LibOpenRaid/ThingsToMantain_Dragonflight.lua
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,17 @@ do
[371339] = {tier = {[562] = 3, [476] = 1, [519] = 2}}, --Phial of Elemental Chaos
}

LIB_OPEN_RAID_ALL_POTIONS = {
[370511] = 1, --Refreshing Healing Potion
[371039] = 1, --Potion of Withering Vitality
[370607] = 1, --Aerated Mana Potion
[371024] = 1, --Elemental Potion of Power
[371028] = 1, --Elemental Potion of Ultimate Power
[371033] = 1, --Potion of Frozen Focus
[371125] = 1, --Potion of the Hushed Zephyr
[371052] = 1, --Potion of Chilled Clarity
}

--spellId of healing from potions
LIB_OPEN_RAID_HEALING_POTIONS = {
[370511] = 1, --Refreshing Healing Potion
Expand Down
2 changes: 2 additions & 0 deletions Libs/LibOpenRaid/ThingsToMantain_Wrath.lua
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ LIB_OPEN_RAID_FOOD_BUFF = {}

LIB_OPEN_RAID_FLASK_BUFF = {}

LIB_OPEN_RAID_ALL_POTIONS = {}

LIB_OPEN_RAID_MELEE_SPECS = {
[251] = "DEATHKNIGHT",
[252] = "DEATHKNIGHT",
Expand Down
9 changes: 6 additions & 3 deletions boot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
local addonName, Details222 = ...
local version, build, date, tocversion = GetBuildInfo()

_detalhes.build_counter = 10406
_detalhes.alpha_build_counter = 10406 --if this is higher than the regular counter, use it instead
_detalhes.build_counter = 10407
_detalhes.alpha_build_counter = 10407 --if this is higher than the regular counter, use it instead
_detalhes.dont_open_news = true
_detalhes.game_version = version
_detalhes.userversion = version .. " " .. _detalhes.build_counter
Expand Down Expand Up @@ -75,6 +75,7 @@
Details222.EJCache = {}
Details222.Segments = {}
Details222.Tables = {}
Details222.Mixins = {}

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--initialization stuff
Expand Down Expand Up @@ -1117,4 +1118,6 @@ function Details222.Tables.MakeWeakTable(mode)
local newTable = {}
setmetatable(newTable, {__mode = mode or "v"})
return newTable
end
end

--STRING_CUSTOM_POT_DEFAULT
Loading

0 comments on commit 8025165

Please sign in to comment.