Ejemplo n.º 1
0
        private void UnequipItem(CachedACDItem item)
        {
            var location = DefaultLootProvider.FindBackpackLocation(true, false);

            if (location == DefaultLootProvider.NoFreeSlot)
            {
                return;
            }

            Core.Logger.Log("Unequipping Item {0} ({1}) from slot {2}", item.RealName, item.ActorSnoId, item.InventorySlot);
            InventoryManager.MoveItem(item.DynamicId, ZetaDia.Me.CommonData.AnnId, InventorySlot.BackpackItems, (int)location.X, (int)location.Y);
        }
Ejemplo n.º 2
0
        private static bool ShouldStartTownRun()
        {
            if (ZetaDia.IsInTown && BrainBehavior.IsVendoring)
            {
                return(!IsInTownVendoring);
            }

            if (!CanTownRun())
            {
                return(false);
            }

            if (IsWantingTownRun)
            {
                Core.Logger.Debug("Is wanting to town run.");
                return(true);
            }

            // Close Normal rift before doing a town run.
            if (ZetaDia.IsInTown && !StartedOutOfTown && ZetaDia.Storage.RiftCompleted && ZetaDia.Storage.RiftStarted)
            {
                var orek = TownInfo.Orek?.GetActor() as DiaUnit;
                if (orek != null && orek.IsQuestGiver)
                {
                    return(false);
                }
            }

            var validLocation = DefaultLootProvider.FindBackpackLocation(true, false);

            if (validLocation.X < 0 || validLocation.Y < 0)
            {
                Core.Logger.Log("No more space to pickup a 2-slot item, now running town-run routine. (TownRun)");
                return(true);
            }

            var needRepair = RepairItems.EquipmentNeedsRepair();

            if (needRepair)
            {
                Core.Logger.Debug("Townrun for repair.");
                return(true);
            }

            return(BrainBehavior.IsVendoring);
        }