In HelperFunction.lua i change this to add Apprentice Potion
Code: Select all
function CheckPotionRecovery()
-- Prepare the variables to contain the best item and recharge.
local BestInventory = nil;
local BestRecharge = 0;
local TotalRechargeHealth = Player:GetHealthMaximum() - Player:GetHealthCurrent();
local TotalRechargeMana = Player:GetManaMaximum() - Player:GetManaCurrent();
-- Check if a potion is available.
if self._iPotionDelay == nil or self._iPotionDelay < Time() then
-- Loop through your inventory
for Inventory in ListIterator( InventoryList:GetList()) do
-- Check if this is a life potion
if string.find( Inventory:GetName(), "Design" ) == nil and string.find( Inventory:GetName(), "Recovery Potion" ) ~= nil then
if string.find( Inventory:GetName(), "Fine" ) ~= nil then
if TotalRechargeHealth >= 2120 and TotalRechargeMana >= 1830 and BestRecharge < 2120 then
BestInventory = Inventory;
BestRecharge = 2120;
end
elseif string.find( Inventory:GetName(), "Major" ) ~= nil then
if TotalRechargeHealth >= 1540 and TotalRechargeMana >= 1600 and BestRecharge < 1540 then
BestInventory = Inventory;
BestRecharge = 1540;
end
elseif string.find( Inventory:GetName(), "Greater" ) ~= nil then
if TotalRechargeHealth >= 1270 and TotalRechargeMana >= 1480 and BestRecharge < 1270 then
BestInventory = Inventory;
BestRecharge = 1270;
end
elseif string.find( Inventory:GetName(), "Lesser" ) ~= nil then
if TotalRechargeHealth >= 670 and TotalRechargeMana >= 980 and BestRecharge < 670 then
BestInventory = Inventory;
BestRecharge = 670;
end
elseif string.find( Inventory:GetName(), "Minor" ) ~= nil then
if TotalRechargeHealth >= 370 and TotalRechargeMana >= 590 and BestRecharge < 370 then
BestInventory = Inventory;
BestRecharge = 370;
end
elseif string.find( Inventory:GetName(), "Apprentice" ) ~= nil then
if TotalRechargeHealth >= 370 and BestRecharge < 370 then
BestInventory = Inventory;
BestRecharge = 370;
end
elseif TotalRechargeHealth >= 970 and TotalRechargeMana >= 1280 and BestRecharge < 970 then
BestInventory = Inventory;
BestRecharge = 970;
end
end
end
-- Check if we have a positive match and see if the cooldown allows the use of it.
if BestInventory ~= nil and BestInventory:GetCooldown() == 0 then
if PlayerInput:Inventory( BestInventory:GetName()) then
self._iPotionDelay = Time() + BestInventory:GetReuse();
end
return false;
end
end
-- We have not executed any potion.
return true;
end
I hope this help you.