What's new
  • Visit Rebornbuddy
  • Visit Resources
  • Visit API Documentation
  • Visit Downloads
  • Visit Portal
  • Visit Panda Profiles
  • Visit LLamamMagic

Fix for the Health Potion Bug

iborr

New Member
Joined
Apr 1, 2014
Messages
5
Reaction score
0
For everyone who dont read all Posts in Threads.
Full Credit to GuuD and rrix

For everyone who encounters potion problem (aka everyone) here is the fix:
Open Plugins/Trinity/Combat/HandleTarget.cs with Sublime Text, Visual Studio, Notepad++ or any other editor.
Find
Code:
bool hasPotion = ZetaDia.Me.Inventory.Backpack.Any(p => p.GameBalanceId == -2142362846);
line.

Add this code just below it:
Code:
if (hasPotion && Player.CurrentHealthPct <= PlayerEmergencyHealthPotionLimit && !IsWaitingForPower && !IsWaitingForPotion
                        && !Player.IsIncapacitated && SNOPowerUseTimer(SNOPower.DrinkHealthPotion))
                    {
                        Logger.Log(TrinityLogLevel.Debug, LogCategory.Targetting, "Setting isWaitingForPotion: MyHP={0}, Limit={1}", Player.CurrentHealthPct, PlayerEmergencyHealthPotionLimit);
                        IsWaitingForPotion = true;
                        runStatus = HandlerRunStatus.TreeRunning;
                    }

Save the file and restart DB.

All credits go to rrix, it's his code till the last ";", he just lost it in the latest Trinity.
 
For everyone who dont read all Posts in Threads.
Full Credit to GuuD and rrix

I do not have "bool hasPotion = ZetaDia.Me.Inventory.Backpack.Any(p => p.GameBalanceId == -2142362846);" in my handletarget.cs
Why is this? It wont using my potions :(
 
I do not have "bool hasPotion = ZetaDia.Me.Inventory.Backpack.Any(p => p.GameBalanceId == -2142362846);" in my handletarget.cs
Why is this? It wont using my potions :(

This won't work on trinity .20.
Wait for a fix from rixx I guess.
 
[edit]: this board is producing tons of PHP errors. Didn't know I posted D:
 
Last edited:
I do not have "bool hasPotion = ZetaDia.Me.Inventory.Backpack.Any(p => p.GameBalanceId == -2142362846);" in my handletarget.cs
Why is this? It wont using my potions :(

Get Trinity .19, it is there on line 272.


FYI: this fixed my bot not using potions. Good find, and thanks for reposting it so I could see it :)!
 
Ok, another fix for the people on .20 Trinity:

Open Plugins\Trinity\Combat\HandleTarget.cs
Find this block of code (it's the part of "if" condition):
Code:
SpellHistory.TimeSinceUse(SNOPower.DrinkHealthPotion) < TimeSpan.FromSeconds(30)

Replace it with:
Code:
(SpellHistory.TimeSinceUse(SNOPower.DrinkHealthPotion) > TimeSpan.FromSeconds(30) ||
                    SpellHistory.GetSpellLastused(SNOPower.DrinkHealthPotion) == DateTime.MinValue)

Your condition should look like:
Code:
if (!Player.IsIncapacitated && Player.CurrentHealthPct > 0 && 
                    (SpellHistory.TimeSinceUse(SNOPower.DrinkHealthPotion) > TimeSpan.FromSeconds(30) ||
                    SpellHistory.GetSpellLastused(SNOPower.DrinkHealthPotion) == DateTime.MinValue) &&  
                    Player.CurrentHealthPct <= PlayerEmergencyHealthPotionLimit)

Enjoy.
 
Last edited:
Ok, another fix for the people on .20 Trinity:

Find this block of code (it's the part of "if" condition):
Code:
SpellHistory.TimeSinceUse(SNOPower.DrinkHealthPotion) < TimeSpan.FromSeconds(30)

Replace it with:
Code:
(SpellHistory.TimeSinceUse(SNOPower.DrinkHealthPotion) > TimeSpan.FromSeconds(30) ||
                    SpellHistory.GetSpellLastused(SNOPower.DrinkHealthPotion) == DateTime.MinValue)

Your condition should look like:
Code:
if (!Player.IsIncapacitated && Player.CurrentHealthPct > 0 && 
                    (SpellHistory.TimeSinceUse(SNOPower.DrinkHealthPotion) > TimeSpan.FromSeconds(30) ||
                    SpellHistory.GetSpellLastused(SNOPower.DrinkHealthPotion) == DateTime.MinValue) &&  
                    Player.CurrentHealthPct <= PlayerEmergencyHealthPotionLimit)

Enjoy.

thanks , worked
 
Ok, another fix for the people on .20 Trinity:

Find this block of code (it's the part of "if" condition):
Code:
SpellHistory.TimeSinceUse(SNOPower.DrinkHealthPotion) < TimeSpan.FromSeconds(30)

Replace it with:
Code:
(SpellHistory.TimeSinceUse(SNOPower.DrinkHealthPotion) > TimeSpan.FromSeconds(30) ||
                    SpellHistory.GetSpellLastused(SNOPower.DrinkHealthPotion) == DateTime.MinValue)

Your condition should look like:
Code:
if (!Player.IsIncapacitated && Player.CurrentHealthPct > 0 && 
                    (SpellHistory.TimeSinceUse(SNOPower.DrinkHealthPotion) > TimeSpan.FromSeconds(30) ||
                    SpellHistory.GetSpellLastused(SNOPower.DrinkHealthPotion) == DateTime.MinValue) &&  
                    Player.CurrentHealthPct <= PlayerEmergencyHealthPotionLimit)

Enjoy.

I'm using .20 Trinity, where should I exactly Edit this?

Thanks in advance.
 
Back
Top