EC: Missing timer buff for invisibility potion

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


Comments

  • YoshiYoshi Posts: 3,322
    edited May 2023
    “There’s a bug report open for this for both clients because it’s wrong buff, buff is for hide skill not invisibility
    https://forum.uo.com/discussion/8036/potion-of-invisibility-buff-incorrect#latest 

    dev team been working tirelessly for 10 years trying to fix”
    Posts on this account have been pre filtered from personal comment or opinion in an effort to suppress conservative views in order to protect the reader.
  • TimStTimSt Posts: 1,797
    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.
Sign In or Register to comment.