I made it work with Book of Cain.
1. fixing trinity for it
TrinityItemManager.cs
Code:
private static DateTime _zlastStashCheck = DateTime.MinValue;
...........................
...........................
if (trinityItemType == GItemType.HealthPotion)
{
[B]if (DateTime.Now.Subtract(_zlastStashCheck).TotalSeconds > 30)
{
_zlastStashCheck = DateTime.Now;
if (evaluationType == ItemEvaluationType.Keep)
Logger.Log(TrinityLogLevel.Normal, LogCategory.ItemValuation, "{0} [{1}] [{2}] = (ignoring potions)", cItem.RealName, cItem.InternalName, trinityItemType);
return true;
}
return false;[/B]
}
if (cItem.IsUnidentified)
{
if (evaluationType == ItemEvaluationType.Keep)
Logger.Log(TrinityLogLevel.Normal, LogCategory.UserInformation, "{0} [{1}] = (autokeep unidentified items)", cItem.RealName, cItem.InternalName);
[B]return false;[/B]
}
stash HealthPotions once in 30 seconds, ignore all UNIDs
2.
Uniddealer.cs
Code:
public void OnPulse()
{
if (Zeta.Internals.UIElements.StashWindow.IsVisible)
{ // Stash Checks
double _tempLastStashCheck = DateTime.Now.Subtract(_lastStashCheck).TotalSeconds;
if (_tempLastStashCheck < 60)
{
}
else
{
BotMain.PauseWhile(CheckStashUNID, 0, new TimeSpan?(TimeSpan.FromSeconds(30.0)));
}
}
}
private void OnItemIdentificationRequest(object sender, ItemIdentifyRequestEventArgs args)
{
if (DateTime.Now.Subtract(_lastStashCheck).TotalSeconds>5)
ShouldStashUNID = true;
args.IgnoreIdentification = ShouldStashUNID;
}
public bool CheckStashUNID()
{
foreach (ACDItem item in ZetaDia.Me.Inventory.Backpack)
{
bool keep = ShouldKeep(item);
Random timerRandomizerZ = new Random();
int randomTimerVal = -1;
DateTime _tempLastStashCheck = DateTime.Now;
if (keep)
{
randomTimerVal = timerRandomizerZ.Next(250, 1000);
_tempLastStashCheck = DateTime.Now;
while (DateTime.Now.Subtract(_tempLastStashCheck).TotalMilliseconds < randomTimerVal)
{
}
int _stashpage =0;
if (ZetaDia.Me.Inventory.ItemInLocation(InventorySlot.PlayerSharedStash, 6, 8))
{
_stashpage =1;
if (ZetaDia.Me.Inventory.ItemInLocation(InventorySlot.PlayerSharedStash, 6, 18))
_stashpage =2;
}
ZetaDia.Me.Inventory.SwitchStashPage(_stashpage);
ZetaDia.Me.Inventory.QuickStash(item);
}
}
foreach (ACDItem item in ZetaDia.Me.Inventory.StashItems)
{
CachedACDItem cItem = CachedACDItem.GetCachedItem(item);
GItemType trinityItemType = cItem.TrinityItemType;
if (trinityItemType == GItemType.HealthPotion)
{
ZetaDia.Me.Inventory.QuickWithdraw(item);
_lastStashCheck = DateTime.Now;
ShouldStashUNID = false;
return false;
}
}
_lastStashCheck = DateTime.Now;
ShouldStashUNID = false;
return false;
}
3.
Variables.cs ( unidd.)
Code:
private static bool ShouldStashUNID = true;
private static DateTime _lastStashCheck = DateTime.MinValue;
also you need to add
Code:
using Zeta;
using Zeta.Common;
using Zeta.CommonBot;
using System;
using System.IO;
using System.Linq;
i don't know which one add DateTime...
also i don't know how properly add random delay)
Ok, how it works:
book of cain ON (always on)
1.
IgnoreIdentification - true
we don't wanna use book, skip idnent. move to stash
[for open stash we will use healthpotions]
(trinity itemmanager
should stash potion? - TRUE ( it's needed to open stash)
should stash unindent items? - FALSE ( don't wanna stash all items from our backpack)
2.
pause bot while in stash, then stash only UNID items that we should keep
[also check free space, if not enough switch to the next stash page, esle use 1st stash page (start from 0 to 2)]
withdraw potions ( we don't wanna die^^)
on next OnItemIdentificationRequest
ShouldStashUNID = true to prevent using book of cain
3.
IgnoreIdentification - false
unpausebot
close stash
use book of cain
sell
salvage
should stash potions? FALSE, don't wanna stash it 2nd time (30sec cd after 1st stash)