🧙‍♂️ Brought to you by Peptides.gg — Use code UO20 for 20% off — GLP-1's, 90+ Peptides and more!

EC: Missing timer buff for invisibility potion

Started by TimSt · 2023-05-02 · 3 posts · General Discussions
#0
The following code additions to the EC will add a timer to the existing invisibility buff when you drink an invisibility potion

In the file source\BuffDebuffWindow.lua add the following code somewhere near the top
--start of added code	
BuffDebuff.checkIfInvisibilityPotion = false
--end of added code

In the file source\BuffDebuffWindow.lua add the following code to the function BuffDebuff.Update after the line
	if (BuffDebuff.Timers ~= nil) then
--start of added code	
if(BuffDebuff.checkIfInvisibilityPotion) then
BuffDebuff.checkIfInvisibilityPotion = false
local potionTimer = 20
local playerRace = PaperdollWindow.HUMAN
local mobileData = Interface.GetMobileData(WindowData.PlayerStatus.PlayerId, false)

if (mobileData) then
playerRace = mobileData.Race
end
if(playerRace == PaperdollWindow.HUMAN) then
potionTimer = potionTimer + 5 --humans get 5 more seconds
end
if(WindowData ~= nil and WindowData.PlayerStatus ~= nil) then
local ep = WindowData.PlayerStatus["EnhancePotions"]
if(ep == nil) then
ep = 0
end
local serverId = WindowData.SkillsCSV[1].ServerId
local alchemy = WindowData.SkillDynamicData[serverId].RealSkillValue
alchemy = math.floor(alchemy / 10)
local epal = ep
local altep = ep
if (alchemy > 0) then
local alBonus = 0

if(alchemy == 100) then --gm bonuses
if(ep == 50 or ep == 0) then
alBonus = 100
elseif(ep == 45) then
alBonus = 95
elseif(ep == 40 or ep == 35) then
alBonus = 90
elseif(ep > 15) then
alBonus = 85
else
alBonus = 85
altep = 20
end
else
alBonus = math.floor(alchemy / 3.0) - 5
end
epal = altep + alBonus
end

potionTimer = potionTimer + math.floor(epal/5) --every 5 points of EnhancePotions gives 1 additional second
end
BuffDebuff.Timers[1012] = potionTimer --add timer
end
--end of added code

In the file source\BuffDebuffWindow.lua add the following code to the function BuffDebuff.CreateNewBuff. I recommend putting it above the line
if (buffId == 1015) then
 --start of added code	
if(buffId == 1012) then --either hiding or invisibility potion
BuffDebuff.checkIfInvisibilityPotion = true
end
--end of added code

In the file source\TextParsing.Lua add the following code to the function TextParsing.TimersNbuff

--start of added code
if(SystemData.TextID == 501240) then -- You have hidden yourself well
BuffDebuff.checkIfInvisibilityPotion = false
end
--end of added code


#2
The code above is a work around to that bug by putting a timer on the buff if the invisibility potion was used and not putting a timer on the buff if the hiding skill was used.
← Browse more General Discussions discussions