public virtual bool PreChecks()
{
// If we aren't in the game of a world is loading, don't do anything yet
if (!ZetaDia.IsInGame || ZetaDia.IsLoadingWorld)
{
CurrentState = RunStatus.Success;
return false;
}
// See if we should update hotbar abilities
FunkyGame.Hero.Class.SecondaryHotbarBuffPresent();
// Special pausing *AFTER* using certain powers
#region PauseCheck
if (Cache.bWaitingAfterPower && FunkyGame.Hero.Class.PowerPrime.WaitLoopsAfter >= 1)
{
if (FunkyGame.Hero.Class.PowerPrime.WaitLoopsAfter >= 1) FunkyGame.Hero.Class.PowerPrime.WaitLoopsAfter--;
if (FunkyGame.Hero.Class.PowerPrime.WaitLoopsAfter <= 0) Cache.bWaitingAfterPower = false;
CurrentState = RunStatus.Running;
return false;
}
#endregion
// Update player-data cache -- Special combat call
FunkyGame.Hero.Update(true);
// Check for death / player being dead
#region DeadCheck
if (FunkyGame.Hero.dCurrentHealthPct <= 0)
{
//Disable OOC IDing behavior if dead!
//if (ItemIdentifyBehavior.shouldPreformOOCItemIDing) ItemIdentifyBehavior.shouldPreformOOCItemIDing = false;
CurrentState = RunStatus.Success;
return false;
}
#endregion
//Herbfunk
//Confirmation of item looted
#region ItemLootedConfirmationCheck
if (Cache.ShouldCheckItemLooted)
{
//Reset?
if (Cache.CurrentTarget == null || Cache.CurrentTarget.targetType.HasValue && Cache.CurrentTarget.targetType.Value != TargetType.Item)
{
Cache.ShouldCheckItemLooted = false;
return false;
}
//Vendor Behavior ignore checking (Unless told that we shouldn't from town run manager)
if (BrainBehavior.IsVendoring && !Cache.IgnoreVendoring)
{
CurrentState = RunStatus.Success;
return false;
}
if (FunkyGame.Hero.bIsIncapacitated)
{
CurrentState = RunStatus.Running;
return false;
}
//Count each attempt to confirm.
Cache.recheckCount++;
string statusText = "[Item Confirmation] Current recheck count " + Cache.recheckCount;
CacheItem thisCacheItem = (CacheItem)Cache.CurrentTarget;
bool LootedSuccess = false;
if (thisCacheItem.BalanceID.HasValue && thisCacheItem.Itemquality.HasValue)
LootedSuccess= Backpack.ContainsItem(thisCacheItem.BalanceID.Value, thisCacheItem.Itemquality.Value);
else
LootedSuccess = Backpack.ContainsItem(thisCacheItem);
statusText += " [ItemFound=" + LootedSuccess + "]";
if (LootedSuccess)
{
//Logger.DBLog.Info("Item Looted Successfully!");
if (FunkyBaseExtension.Settings.Debugging.DebugStatusBar) BotMain.StatusText = statusText;
//This is where we should manipulate information of both what dropped and what was looted.
if (thisCacheItem.BalanceID.HasValue && thisCacheItem.BalanceData != null && thisCacheItem.Itemquality.HasValue)
{
GameEvents.FireItemLooted(Cache.CurrentTarget.AcdGuid.Value);
if (FunkyGame.CurrentStats != null)
FunkyGame.CurrentStats.CurrentProfile.LootTracker.LootedItemLog(thisCacheItem.BalanceData.PluginType, thisCacheItem.BalanceData.PluginBase, thisCacheItem.Itemquality.Value);
}
//Remove item from cache..
Cache.CurrentTarget.NeedsRemoved = true;
//Update backpack again!
Backpack.UpdateItemList();
}
else
{
CacheItem thisObjItem = (CacheItem)Cache.CurrentTarget;
statusText += " [Quality";
//Quality of the item determines the recheck attempts.
ItemQuality curQuality = thisObjItem.Itemquality.HasValue ? thisObjItem.Itemquality.Value : ItemQuality.Normal;
#region QualityRecheckSwitch
switch (curQuality)
{
case ItemQuality.Inferior:
case ItemQuality.Invalid:
case ItemQuality.Special:
case ItemQuality.Superior:
case ItemQuality.Normal:
case ItemQuality.Magic1:
case ItemQuality.Magic2:
case ItemQuality.Magic3:
statusText += "<=Magical]";
//Non-Quality items get skipped quickly.
if (Cache.recheckCount > 3)
Cache.reCheckedFinished = true;
break;
case ItemQuality.Rare4:
case ItemQuality.Rare5:
case ItemQuality.Rare6:
statusText += "=Rare]";
if (Cache.recheckCount > 4)
Cache.reCheckedFinished = true;
//else
//bItemForcedMovement = true;
break;
case ItemQuality.Legendary:
statusText += "=Legendary]";
if (Cache.recheckCount > 6)
Cache.reCheckedFinished = true;
//else
//bItemForcedMovement = true;
break;
}
#endregion
//If we are still rechecking then use the waitAfter (powerprime Ability related) to wait a few loops.
if (!Cache.reCheckedFinished)
{
statusText += " RECHECKING";
if (FunkyBaseExtension.Settings.Debugging.DebugStatusBar)
{
BotMain.StatusText = statusText;
}
Cache.bWaitingAfterPower = true;
FunkyGame.Hero.Class.PowerPrime.WaitLoopsAfter = 3;
CurrentState = RunStatus.Running;
return false;
}
//We Rechecked Max Confirmation Checking Count, now we check if we want to retry confirmation, or simply try once more then ignore for a few.
bool stackableItem = false;
if (thisObjItem.BalanceID.HasValue && thisObjItem.BalanceData != null)
stackableItem = thisCacheItem.BalanceData.IsStackable;
else if (thisObjItem.ItemDropType.HasValue)
stackableItem = ItemFunc.DetermineIsStackable(thisObjItem.ItemDropType.Value);
if (stackableItem || (curQuality > ItemQuality.Magic3))
{
//Items above rare quality don't get blacklisted, just ignored for a few loops.
//This will force a movement if stuck.. but 5 loops is only 750ms
if (!Cache.IgnoreVendoring) //Exclude town run manager checking!
Cache.CurrentTarget.BlacklistLoops = 5;
}
else
{
//Blacklist items below rare quality!
//Cache.CurrentTarget.BlacklistFlag = BlacklistType.Temporary;
//Cache.CurrentTarget.NeedsRemoved = true;
Cache.CurrentTarget.BlacklistLoops = 50;
}
}
// Now get a new target!
Cache.bForceTargetUpdate = true;
//Reset flag, and continue..
Cache.ShouldCheckItemLooted = false;
}
#endregion
// See if we have been "newly rooted", to force target updates
if (FunkyGame.Hero.bIsRooted && !Cache.bWasRootedLastTick)
{
Cache.bWasRootedLastTick = true;
Cache.bForceTargetUpdate = true;
}
if (!FunkyGame.Hero.bIsRooted) Cache.bWasRootedLastTick = false;
return true;
}