Exemple #1
0
        private static void LogSalvagedItem(CacheACDItem item)
        {
            // Item log for cool stuff stashed
            PluginItemTypes     OriginalGilesItemType = ItemFunc.DetermineItemType(item);
            PluginBaseItemTypes thisGilesBaseType     = ItemFunc.DetermineBaseType(OriginalGilesItemType);

            if (thisGilesBaseType == PluginBaseItemTypes.WeaponTwoHand || thisGilesBaseType == PluginBaseItemTypes.WeaponOneHand || thisGilesBaseType == PluginBaseItemTypes.WeaponRange ||
                thisGilesBaseType == PluginBaseItemTypes.Armor || thisGilesBaseType == PluginBaseItemTypes.Jewelry || thisGilesBaseType == PluginBaseItemTypes.Offhand ||
                thisGilesBaseType == PluginBaseItemTypes.FollowerItem)
            {
                FunkyTownRunPlugin.LogJunkItems(item, thisGilesBaseType, OriginalGilesItemType);
            }
            if (FunkyGame.CurrentStats != null)
            {
                FunkyGame.CurrentStats.CurrentProfile.LootTracker.SalvagedItemLog(item);
            }
        }
Exemple #2
0
        internal static RunStatus SellInteraction(object ret)
        {
            if (FunkyGame.GameIsInvalid)
            {
                ActionsChecked = false;
                FunkyTownRunPlugin.DBLog.InfoFormat("[Funky] Town Run Behavior Failed! (Not In Game/Invalid Actor/misc)");
                return(RunStatus.Failure);
            }

            BotMain.StatusText = "Town run: Vendor Routine Interaction";

            if (!UIElements.VendorWindow.IsVisible)
            {
                FunkyTownRunPlugin.DBLog.DebugFormat("[Funky] Town Run Vednor Behavior Failed! (Vendor Window not visible)");
                return(RunStatus.Failure);
            }


            #region SellItem
            if (townRunItemCache.SellItems.Count > 0)
            {
                BotMain.StatusText = "Town run: Vendor Routine Interaction Selling Items";

                if (!Delay.Test())
                {
                    return(RunStatus.Running);
                }

                CacheACDItem thisitem = townRunItemCache.SellItems.FirstOrDefault();
                // Item log for cool stuff sold
                if (thisitem != null)
                {
                    PluginItemTypes     OriginalPluginItemType = ItemFunc.DetermineItemType(thisitem);
                    PluginBaseItemTypes thisGilesBaseType      = ItemFunc.DetermineBaseType(OriginalPluginItemType);
                    if (thisGilesBaseType == PluginBaseItemTypes.WeaponTwoHand || thisGilesBaseType == PluginBaseItemTypes.WeaponOneHand || thisGilesBaseType == PluginBaseItemTypes.WeaponRange ||
                        thisGilesBaseType == PluginBaseItemTypes.Armor || thisGilesBaseType == PluginBaseItemTypes.Jewelry || thisGilesBaseType == PluginBaseItemTypes.Offhand ||
                        thisGilesBaseType == PluginBaseItemTypes.FollowerItem)
                    {
                        FunkyTownRunPlugin.LogJunkItems(thisitem, thisGilesBaseType, OriginalPluginItemType);
                    }

                    //FunkyTownRunPlugin.TownRunStats.VendoredItemLog(thisitem);
                    if (FunkyGame.CurrentStats != null)
                    {
                        FunkyGame.CurrentStats.CurrentProfile.LootTracker.VendoredItemLog(thisitem);
                    }
                    ZetaDia.Me.Inventory.SellItem(thisitem.ACDItem);
                }
                if (thisitem != null)
                {
                    townRunItemCache.SellItems.Remove(thisitem);
                }
                if (townRunItemCache.SellItems.Count > 0)
                {
                    return(RunStatus.Running);
                }
            }
            #endregion

            #region BuyPotion
            //Check if settings for potion buy is enabled, with less than 99 potions existing!
            if (bBuyingPotions)
            {
                BotMain.StatusText = "Town run: Sell Routine Interaction Buying Potions";
                if (PotionCount >= FunkyTownRunPlugin.PluginSettings.PotionsCount)
                {
                    FunkyTownRunPlugin.DBLog.DebugFormat("[Funky] Vendor Potion Buying Finished (Potion Count Greater Than Setting) Count {0} Setting {1}", PotionCount, FunkyTownRunPlugin.PluginSettings.PotionsCount);
                    bBuyingPotions = false;
                    return(RunStatus.Running);
                }

                //Obey the timer, so we don't buy 100 potions in 3 seconds.
                if (!Delay.Test(1.5))
                {
                    return(RunStatus.Running);
                }


                //Update Dynamic ID
                if (PotionDynamicID == 0)
                {
                    FunkyTownRunPlugin.DBLog.DebugFormat("[Funky] Vendor Potion updating Dynamic ID!");

                    foreach (ACDItem item in ZetaDia.Me.Inventory.MerchantItems)
                    {
                        if (item.IsPotion)
                        {
                            PotionMerchantACDItem = item;
                            PotionDynamicID       = item.DynamicId;
                            break;
                        }
                    }

                    //Check we found a potion..
                    if (PotionDynamicID == 0)
                    {
                        FunkyTownRunPlugin.DBLog.DebugFormat("[Funky] Vendor Potion Buying Finished (Failed to find Potion Dynamic ID)");
                        bBuyingPotions = false;
                    }
                    else
                    {
                        FunkyTownRunPlugin.DBLog.DebugFormat("[Funky] Vendor Buying Potion Dynamic ID {0}", PotionDynamicID);
                    }

                    return(RunStatus.Running);
                }


                //Check we have enough gold!
                if (PotionMerchantACDItem.Gold > ZetaDia.CPlayer.Coinage)
                {
                    FunkyTownRunPlugin.DBLog.DebugFormat("[Funky] Vendor Potion Buying Finished (Not Enough Gold to buy Potions)");
                    bBuyingPotions = false;
                    return(RunStatus.Running);
                }

                FunkyTownRunPlugin.DBLog.DebugFormat("[Funky] Vendor Buying Potion!");
                ZetaDia.Actors.Me.Inventory.BuyItem(PotionDynamicID);
                //Update counter
                PotionCount++;
                return(RunStatus.Running);
            }

            #endregion

            if (bNeedsEquipmentRepairs)
            {
                BotMain.StatusText = "Town run: Vendor Routine Interaction Repairing";

                if (!Delay.Test())
                {
                    return(RunStatus.Running);
                }

                //int playerCoinage = ZetaDia.Me.Inventory.Coinage;
                //int repairCost = ZetaDia.Me.Inventory.GetRepairCost(false);
                //if (playerCoinage > 0 && playerCoinage < repairCost)
                //{
                //    FunkyTownRunPlugin.DBLog.InfoFormat("Emergency Stop: You need repairs but don't have enough money. Current Coinage {0} -- Repair Cost {1}", playerCoinage, repairCost);
                //    BotMain.Stop(false, "Not enough gold to repair item(s)!");
                //}

                ZetaDia.Me.Inventory.RepairEquippedItems();
                bNeedsEquipmentRepairs = false;
            }



            return(RunStatus.Success);
        }