예제 #1
0
 public DebugItemDataEntry(CacheACDItem item)
 {
     SNOID = item.SNO;
     Name = FormatString(item.ThisRealName);
     Type = item.ItemType;
     Quality = (PluginItemQuality)Enum.Parse(typeof(PluginItemQuality), item.ThisQuality.ToString());
 }
예제 #2
0
 public override bool Equals(object obj)
 {
     //Check for null and compare run-time types.
     if (obj == null || GetType() != obj.GetType())
     {
         return(false);
     }
     else
     {
         CacheACDItem p = (CacheACDItem)obj;
         return(ThisDynamicID == p.ThisDynamicID);
     }
 }
예제 #3
0
파일: LootStats.cs 프로젝트: herbfunk/Funky
        public void StashedItemLog(CacheACDItem i)
        {
            PluginItemTypes thisPluginItemType = ItemFunc.DetermineItemType(i);
            if (thisPluginItemType == PluginItemTypes.InfernalKey)
            {
                Keys.Stashed++;
                return;
            }
            if (thisPluginItemType == PluginItemTypes.HoradricCache)
            {
                HoradricCache.Stashed++;
            }
            if (thisPluginItemType == PluginItemTypes.KeyStone)
            {
                KeyStoneFragments.Stashed += (int)i.ThisItemStackQuantity;
            }

            switch (i.ACDItem.ItemType)
            {
                case ItemType.CraftingPage:
                case ItemType.CraftingPlan:
                case ItemType.CraftingReagent:
                    Crafting.Stashed++;
                    break;
                case ItemType.Gem:
                    Gems.Stashed++;
                    break;
                case ItemType.Amulet:
                case ItemType.Axe:
                case ItemType.Belt:
                case ItemType.Boots:
                case ItemType.Bow:
                case ItemType.Bracer:
                case ItemType.CeremonialDagger:
                case ItemType.Chest:
                case ItemType.Cloak:
                case ItemType.Crossbow:
                case ItemType.Dagger:
                case ItemType.Daibo:
                case ItemType.FistWeapon:
                case ItemType.FollowerSpecial:
                case ItemType.Flail:
                case ItemType.CrusaderShield:
                case ItemType.Gloves:
                case ItemType.HandCrossbow:
                case ItemType.Helm:
                case ItemType.Legs:
                case ItemType.Mace:
                case ItemType.MightyBelt:
                case ItemType.MightyWeapon:
                case ItemType.Mojo:
                case ItemType.Orb:
                case ItemType.Polearm:
                case ItemType.Quiver:
                case ItemType.Ring:
                case ItemType.Shield:
                case ItemType.Shoulder:
                case ItemType.Spear:
                case ItemType.SpiritStone:
                case ItemType.Staff:
                case ItemType.Sword:
                case ItemType.VoodooMask:
                case ItemType.Wand:
                case ItemType.WizardHat:
                    if (i.ThisQuality == ItemQuality.Legendary)
                    {
                        Legendary.Stashed++;
                    }
                    else if (i.ThisQuality > ItemQuality.Magic3)
                    {
                        Rare.Stashed++;
                    }
                    else
                    {
                        Magical.Stashed++;
                    }
                    break;
            }
        }
예제 #4
0
파일: LootStats.cs 프로젝트: herbfunk/Funky
 public void SalvagedItemLog(CacheACDItem i)
 {
     if (i.ThisQuality == ItemQuality.Legendary)
     {
         Legendary.Salvaged++;
     }
     else if (i.ThisQuality > ItemQuality.Magic3)
     {
         Rare.Salvaged++;
     }
     else
     {
         Magical.Salvaged++;
     }
 }
예제 #5
0
		private List<CacheACDItem> GetGemCacheACDItems()
		{
			List<CacheACDItem> Gems=new List<CacheACDItem>();
			foreach (var gem in ZetaDia.Actors.GetActorsOfType<ACDItem>().Where(item => item.ItemType == ItemType.LegendaryGem))
			{
				var cItem = new CacheACDItem(gem);
				//double SuccessRate = ItemFunc.GetLegendaryGemUpgradeChance(GRiftLevel, cItem.LegendaryGemRank);
				if (GRiftLevel - cItem.LegendaryGemRank == -7) continue;
				//if (SuccessRate < FunkyBaseExtension.Settings.AdventureMode.GemUpgradingMinimumSuccessRate) continue;
				Gems.Add(new CacheACDItem(gem));
			}

			return Gems;
		}
예제 #6
0
		private List<CacheACDItem> GetGemCacheACDItems(List<int> Acdguids)
		{
			

			List<CacheACDItem> GemList = new List<CacheACDItem>();
			foreach (var item in ZetaDia.Actors.GetActorsOfType<ACDItem>().Where(item => Acdguids.Contains(item.ACDGuid)))
			{
				CacheACDItem cItem = new CacheACDItem(item);
				double SuccessRate = ItemFunc.GetLegendaryGemUpgradeChance(GRiftLevel, cItem.LegendaryGemRank);
				if (GRiftLevel - cItem.LegendaryGemRank == -7) continue;
				if (SuccessRate < FunkyBaseExtension.Settings.AdventureMode.GemUpgradingMinimumSuccessRate) continue;
				//if (SuccessRate < FunkyBaseExtension.Settings.AdventureMode.GemUpgradingMinimumSuccessRate) continue;

				GemList.Add(cItem);
			}

			return GemList;
		}
예제 #7
0
        internal static bool StashValidation(CacheACDItem thisitem)
        {
            // Stash all unidentified items - assume we want to keep them since we are using an identifier over-ride
            if (thisitem.IsUnidentified)
            {
                //if (bOutputItemScores) FunkyTownRunPlugin.DBLog.InfoFormat(thisitem.ThisRealName + " [" + thisitem.ThisInternalName + "] = (autokeep unidentified items)");
                return true;
            }
            // Now look for Misc items we might want to keep
            PluginItemTypes TrueItemType = ItemFunc.DetermineItemType(thisitem);
            if (TrueItemType == PluginItemTypes.KeyStone)
            {
                //if (bOutputItemScores) FunkyTownRunPlugin.DBLog.InfoFormat(thisitem.ThisRealName + " [" + thisitem.ThisInternalName + "] [" + TrueItemType + "] = (autokeep keystone fragments)");
                return true;
            }
            if (TrueItemType == PluginItemTypes.HoradricCache)
            {
                //if (bOutputItemScores) FunkyTownRunPlugin.DBLog.InfoFormat(thisitem.ThisRealName + " [" + thisitem.ThisInternalName + "] [" + TrueItemType + "] = (autokeep cache)");
                return FunkyTownRunPlugin.PluginSettings.StashHoradricCache;
            }
            if (TrueItemType == PluginItemTypes.StaffOfHerding)
            {
                //if (bOutputItemScores) FunkyTownRunPlugin.DBLog.InfoFormat(thisitem.ThisRealName + " [" + thisitem.ThisInternalName + "] [" + TrueItemType + "] = (autokeep staff of herding)");
                return true;
            }
            if (TrueItemType == PluginItemTypes.CraftingMaterial)
            {
                //if (bOutputItemScores) FunkyTownRunPlugin.DBLog.InfoFormat(thisitem.ThisRealName + " [" + thisitem.ThisInternalName + "] [" + TrueItemType + "] = (autokeep craft materials)");
                return true;
            }
            if (TrueItemType == PluginItemTypes.CraftingPlan)
            {
                //if (bOutputItemScores) FunkyTownRunPlugin.DBLog.InfoFormat(thisitem.ThisRealName + " [" + thisitem.ThisInternalName + "] [" + TrueItemType + "] = (autokeep plans)");
                return true;
            }
            if (TrueItemType == PluginItemTypes.Emerald)
            {
                //if (bOutputItemScores) FunkyTownRunPlugin.DBLog.InfoFormat(thisitem.ThisRealName + " [" + thisitem.ThisInternalName + "] [" + TrueItemType + "] = (autokeep gems)");
                return true;
            }
            if (TrueItemType == PluginItemTypes.Amethyst)
            {
                //if (bOutputItemScores) FunkyTownRunPlugin.DBLog.InfoFormat(thisitem.ThisRealName + " [" + thisitem.ThisInternalName + "] [" + TrueItemType + "] = (autokeep gems)");
                return true;
            }
            if (TrueItemType == PluginItemTypes.Topaz)
            {
                //if (bOutputItemScores) FunkyTownRunPlugin.DBLog.InfoFormat(thisitem.ThisRealName + " [" + thisitem.ThisInternalName + "] [" + TrueItemType + "] = (autokeep gems)");
                return true;
            }
            if (TrueItemType == PluginItemTypes.Ruby)
            {
                //if (bOutputItemScores) FunkyTownRunPlugin.DBLog.InfoFormat(thisitem.ThisRealName + " [" + thisitem.ThisInternalName + "] [" + TrueItemType + "] = (autokeep gems)");
                return true;
            }
            if (TrueItemType == PluginItemTypes.Diamond)
            {
                //if (bOutputItemScores) FunkyTownRunPlugin.DBLog.InfoFormat(thisitem.ThisRealName + " [" + thisitem.ThisInternalName + "] [" + TrueItemType + "] = (autokeep gems)");
                return true;
            }
            if (TrueItemType == PluginItemTypes.LegendaryGem)
            {
                return true;
            }
            if (TrueItemType==PluginItemTypes.RamaladnisGift)
            {
                return true;
            }
            if (TrueItemType == PluginItemTypes.CraftTome)
            {
                //if (bOutputItemScores) FunkyTownRunPlugin.DBLog.InfoFormat(thisitem.ThisRealName + " [" + thisitem.ThisInternalName + "] [" + TrueItemType + "] = (autokeep tomes)");
                return true;
            }
            if (TrueItemType == PluginItemTypes.InfernalKey)
            {
                //if (bOutputItemScores) FunkyTownRunPlugin.DBLog.InfoFormat(thisitem.ThisRealName + " [" + thisitem.ThisInternalName + "] [" + TrueItemType + "] = (autokeep infernal key)");
                return true;
            }
            if (TrueItemType == PluginItemTypes.HealthPotion || TrueItemType == PluginItemTypes.LegendaryHealthPotion)
            {
                //if (bOutputItemScores) FunkyTownRunPlugin.DBLog.InfoFormat(thisitem.ThisRealName + " [" + thisitem.ThisInternalName + "] [" + TrueItemType + "] = (ignoring potions)");
                return false;
            }

            if (thisitem.ThisQuality >= ItemQuality.Legendary)
            {
                //if (bOutputItemScores) FunkyTownRunPlugin.DBLog.InfoFormat(thisitem.ThisRealName + " [" + thisitem.ThisInternalName + "] [" + TrueItemType + "] = (autokeep legendaries)");
                return true;
            }

            if (TrueItemType == PluginItemTypes.Dye)
            {
                return true;
            }

            // Ok now try to do some decent item scoring based on item types
            //double iNeedScore = ScoreNeeded(TrueItemType);
            //double iMyScore = ValueThisItem(thisitem, TrueItemType);
            //if (bOutputItemScores) FunkyTownRunPlugin.DBLog.InfoFormat(thisitem.ThisRealName + " [" + thisitem.ThisInternalName + "] [" + TrueItemType + "] = " + iMyScore);
            //if (iMyScore >= iNeedScore) return true;

            // If we reached this point, then we found no reason to keep the item!
            return false;
        }
예제 #8
0
파일: DebugData.cs 프로젝트: herbfunk/Funky
 public void CheckEntry(CacheACDItem entry)
 {
     var d = new DebugItemDataEntry(entry);
     if (ItemsData.Entries.Contains(d)) return;
     ItemsData.Entries.Add(d);
     DebugData_Items.SerializeToXML(ItemsData);
 }
예제 #9
0
파일: Backpack.cs 프로젝트: herbfunk/Funky
        public static void UpdateItemList()
        {
            List<int> SeenACDGuid = new List<int>();

            //Clear New Item List
            NewItemList.Clear();

            using (ZetaDia.Memory.AcquireFrame())
            {
                foreach (var thisitem in ZetaDia.Me.Inventory.Backpack)
                {
                    var ACDGuid = thisitem.ACDGuid;
                    SeenACDGuid.Add(ACDGuid);

                    if (CacheItemList.ContainsKey(ACDGuid))
                    {
                        var cachedItem = CacheItemList[ACDGuid];

                        //Stackable item that increased
                        if (CacheItemList[ACDGuid].IsStackableItem)
                        {
                            try
                            {
                                if (cachedItem.ThisItemStackQuantity != thisitem.ItemStackQuantity)
                                {
                                    //Update it..
                                    cachedItem.ThisItemStackQuantity = thisitem.ItemStackQuantity;

                                    //Check if stack quanity is maxed to remove it from our list
                                    if (cachedItem.ThisItemStackQuantity >= cachedItem.MaxStackQuanity &&
                                        _stackableItems.Contains(cachedItem.SNO))
                                        _stackableItems.Remove(cachedItem.SNO);

                                    //Add it to new item list..
                                    NewItemList.Add(CacheItemList[ACDGuid]);
                                }
                            }
                            catch (Exception ex)
                            {
                                //Logger.DBLog.DebugFormat("Item {0} stack quanity threw exception {1}",
                                    //CacheItemList[ACDGuid].ThisInternalName, ex.Message);
                            }
                        }

                        continue;
                    }

                    var thiscacheditem = new CacheACDItem(thisitem);
                    CacheItemList.Add(thiscacheditem.ACDGUID, thiscacheditem);

                    //Add it to new item list..
                    NewItemList.Add(thiscacheditem);

                    //
                    _occupiedSlots += thiscacheditem.IsTwoSlot ? 2 : 1;
                    if (thiscacheditem.IsStackableItem &&
                        thiscacheditem.ThisItemStackQuantity < thiscacheditem.MaxStackQuanity &&
                        !_stackableItems.Contains(thiscacheditem.SNO))
                        _stackableItems.Add(thiscacheditem.SNO);

                    if (thiscacheditem.invCol >= 0 && thiscacheditem.invCol <= 9 && thiscacheditem.invRow >= 0 &&
                        thiscacheditem.invRow <= 5)
                    {
                        _backpackslotblocked[thiscacheditem.invCol, thiscacheditem.invRow] = true;
                        if (thiscacheditem.IsTwoSlot)
                            _backpackslotblocked[thiscacheditem.invCol, thiscacheditem.invRow + 1] = true;
                    }
                }
            }

            //Trim away items missing..
            var UnseenACDGuids = CacheItemList.Keys.Where(k => !SeenACDGuid.Contains(k)).ToList();
            foreach (var unseenAcdguiD in UnseenACDGuids)
            {
                var item = CacheItemList[unseenAcdguiD];

                if (item.IsStackableItem && _stackableItems.Contains(item.SNO))
                    _stackableItems.Remove(item.SNO);

                _occupiedSlots -= item.IsTwoSlot ? 2 : 1;
                _backpackslotblocked[item.invCol, item.invRow] = false;
                if (item.IsTwoSlot)
                    _backpackslotblocked[item.invCol, item.invRow + 1] = false;

                CacheItemList.Remove(unseenAcdguiD);
            }
        }
예제 #10
0
파일: ItemFunc.cs 프로젝트: herbfunk/Funky
 public static bool DetermineIsStackable(CacheACDItem item)
 {
     PluginItemTypes thisPluginItemTypes = DetermineItemType(item);
     bool bIsStackable = thisPluginItemTypes == PluginItemTypes.CraftingMaterial || thisPluginItemTypes == PluginItemTypes.LegendaryCraftingMaterial || thisPluginItemTypes == PluginItemTypes.CraftTome || thisPluginItemTypes == PluginItemTypes.Ruby ||
                               thisPluginItemTypes == PluginItemTypes.Diamond || thisPluginItemTypes == PluginItemTypes.Emerald || thisPluginItemTypes == PluginItemTypes.Topaz || thisPluginItemTypes == PluginItemTypes.Amethyst || thisPluginItemTypes == PluginItemTypes.LegendaryGem ||
                               thisPluginItemTypes == PluginItemTypes.HealthPotion || thisPluginItemTypes == PluginItemTypes.CraftingPlan || thisPluginItemTypes == PluginItemTypes.Dye ||
                               thisPluginItemTypes == PluginItemTypes.InfernalKey || thisPluginItemTypes == PluginItemTypes.KeyStone;
     return bIsStackable;
 }
예제 #11
0
        private void UpdateMovingItemList()
        {
            Logger.DBLog.DebugFormat("Updating Moving Items!");

            IEnumerable<ACDItem> ItemEnumerableSource =
                Itemsource == ItemSource.Stash ? ZetaDia.Me.Inventory.StashItems :
                ZetaDia.Me.Inventory.Backpack;

            List<CacheACDItem> Items = new List<CacheACDItem>();
            foreach (var i in ItemEnumerableSource)
            {
                if (i.BaseAddress != IntPtr.Zero)
                {
                    CacheACDItem cacheItem = new CacheACDItem(i);
                    Items.Add(cacheItem);
                }
            }

            if (KeyType != KeystoneType.None)
            {
                if (!_keyStoneHighest)
                    Items = Items.OrderBy(i => i.KeystoneRank).ThenByDescending(i => i.ThisItemStackQuantity).ToList();
                else
                    Items = Items.OrderByDescending(i => i.KeystoneRank).ThenByDescending(i => i.ThisItemStackQuantity).ToList();
            }

            foreach (var tempitem in Items)
            {

                if (KeyType != KeystoneType.None)
                {
                    int tieredLevel = tempitem.KeystoneRank;
                    if (KeyType == KeystoneType.Fragment)
                    {
                        if (tieredLevel == -1)
                        {
                            MovingItemList.Add(tempitem);
                            if (!All) break;
                        }

                        continue;
                    }

                    if (KeyType == KeystoneType.Trial)
                    {
                        if (tieredLevel == 0)
                        {
                            MovingItemList.Add(tempitem);
                            if (!All) break;
                        }
                        continue;
                    }

                    if (KeyType == KeystoneType.Tiered)
                    {
                        if (tieredLevel > 0 && tieredLevel <= FunkyBaseExtension.Settings.AdventureMode.MaximumTieredRiftKeyAllowed)
                        {
                            MovingItemList.Add(tempitem);
                            if (!All) break;
                        }
                    }
                }
                else if (tempitem.SNO == Sno)
                {
                    MovingItemList.Add(tempitem);
                    if (!All) break;
                }

            }

            updatedItemList = true;
            Logger.DBLog.InfoFormat("Found a total of {0} items to be moved!", MovingItemList.Count);
        }
예제 #12
0
        private ACDItem GetKeystoneItem()
        {
            IEnumerable<ACDItem> itemEnumerableSource = ZetaDia.Me.Inventory.Backpack;
            List<CacheACDItem> items = new List<CacheACDItem>();
            foreach (var i in itemEnumerableSource)
            {
                if (i.BaseAddress != IntPtr.Zero)
                {
                    CacheACDItem cacheitem = new CacheACDItem(i);
                    items.Add(cacheitem);
                }
            }

            if (KeyType == KeystoneType.Tiered)
            {
                if (!KeyStoneHighest)
                    items = items.OrderBy(i => i.KeystoneRank).ToList();
                else
                    items = items.OrderByDescending(i => i.KeystoneRank).ToList();
            }

            foreach (var tempitem in items)
            {
                if (tempitem.ItemType == PluginItemTypes.KeyStone)
                {
                    int tieredLevel = tempitem.KeystoneRank;
                    if (KeyType == KeystoneType.Fragment)
                    {
                        if (tieredLevel == -1)
                            return tempitem.ACDItem;

                        continue;
                    }

                    if (KeyType == KeystoneType.Trial)
                    {
                        if (tieredLevel == 0)
                            return tempitem.ACDItem;

                        continue;
                    }

                    if (KeyType == KeystoneType.Tiered)
                    {
                        if (tieredLevel > 0 && tieredLevel <= FunkyBaseExtension.Settings.AdventureMode.MaximumTieredRiftKeyAllowed)
                            return tempitem.ACDItem;
                    }
                }
            }

            return null;
        }
예제 #13
0
        public override bool GetConditionExec()
        {
            if (Itemsource == ItemSource.Stash)
            {
                foreach (ACDItem tempitem in ZetaDia.Me.Inventory.StashItems)
                {

                    if (tempitem.BaseAddress != IntPtr.Zero)
                    {
                        CacheACDItem cacheItem = new CacheACDItem(tempitem);
                        if (cacheItem.ItemType != PluginItemTypes.KeyStone) continue;

                        int tieredLevel = cacheItem.KeystoneRank;
                        if (Type == KeystoneType.Fragment)
                        {
                            if (tieredLevel == -1)
                                return !NOT;

                            continue;
                        }

                        if (Type == KeystoneType.Trial)
                        {
                            if (tieredLevel == 0)
                                return !NOT;

                            continue;
                        }

                        if (Type == KeystoneType.Tiered)
                        {
                            if (tieredLevel > 0 && tieredLevel<=FunkyBaseExtension.Settings.AdventureMode.MaximumTieredRiftKeyAllowed)
                                return !NOT;
                        }
                    }
                }
            }
            else
            {
                foreach (ACDItem tempitem in ZetaDia.Me.Inventory.Backpack)
                {
                    if (tempitem.BaseAddress != IntPtr.Zero)
                    {
                        CacheACDItem cacheItem = new CacheACDItem(tempitem);
                        if (cacheItem.ItemType != PluginItemTypes.KeyStone) continue;

                        int tieredLevel = cacheItem.KeystoneRank;
                        if (Type == KeystoneType.Fragment)
                        {
                            if (tieredLevel == -1)
                                return !NOT;

                            continue;
                        }

                        if (Type == KeystoneType.Trial)
                        {
                            if (tieredLevel == 0)
                                return !NOT;

                            continue;
                        }

                        if (Type == KeystoneType.Tiered)
                        {
                            if (tieredLevel > 0 && tieredLevel <= FunkyBaseExtension.Settings.AdventureMode.MaximumTieredRiftKeyAllowed)
                                return !NOT;
                        }
                    }
                }
            }

            return NOT;
        }
예제 #14
0
        internal static void LogJunkItems(CacheACDItem thisgooditem, PluginBaseItemTypes thisPluginBaseItemTypes, PluginItemTypes thisPluginItemType)
        {
            FileStream LogStream = null;
            string outputPath = FolderPaths.LoggingFolderPath + @"\JunkLog.log";

            try
            {
                LogStream = File.Open(outputPath, FileMode.Append, FileAccess.Write, FileShare.Read);
                using (StreamWriter LogWriter = new StreamWriter(LogStream))
                {
                    if (!TownRunManager.bLoggedJunkThisStash)
                    {
                        TownRunManager.bLoggedJunkThisStash = true;
                        LogWriter.WriteLine(DateTime.Now.ToString() + ":");
                        LogWriter.WriteLine("====================");
                    }
                    string sLegendaryString = "";
                    if (thisgooditem.ThisQuality >= ItemQuality.Legendary)
                        sLegendaryString = " {legendary item}";
                    LogWriter.WriteLine(thisgooditem.ThisQuality.ToString() + " " + thisPluginItemType.ToString() + " '" + thisgooditem.ThisRealName + sLegendaryString);
                    LogWriter.Write(thisgooditem.ItemStatProperties.ReturnPrimaryStatString());
                    LogWriter.WriteLine("");
                }

            }
            catch (IOException)
            {
                DBLog.Info("Fatal Error: File access error for junk log file.");
            }
        }
예제 #15
0
        internal static void LogGoodItems(CacheACDItem thisgooditem, PluginBaseItemTypes thisPluginBaseItemTypes, PluginItemTypes thisPluginItemType)
        {
            try
            {
                //Update this item
                using (ZetaDia.Memory.AcquireFrame())
                {
                    thisgooditem = new CacheACDItem(thisgooditem.ACDItem);
                }
            }
            catch
            {
                DBLog.DebugFormat("Failure to update CacheACDItem during Logging");
            }
            //double iThisItemValue = ItemFunc.ValueThisItem(thisgooditem, thisPluginItemType);

            FileStream LogStream = null;
            try
            {
                string outputPath = FolderPaths.LoggingFolderPath + @"\StashLog.log";

                LogStream = File.Open(outputPath, FileMode.Append, FileAccess.Write, FileShare.Read);
                using (StreamWriter LogWriter = new StreamWriter(LogStream))
                {
                    if (!TownRunManager.bLoggedAnythingThisStash)
                    {
                        TownRunManager.bLoggedAnythingThisStash = true;
                        LogWriter.WriteLine(DateTime.Now.ToString() + ":");
                        LogWriter.WriteLine("====================");
                    }
                    string sLegendaryString = "";
                    if (thisgooditem.ThisQuality >= ItemQuality.Legendary)
                    {
                        if (!thisgooditem.IsUnidentified)
                        {
                            //Prowl.AddNotificationToQueue(thisgooditem.ThisRealName + " [" + thisPluginItemType.ToString() + "] (Score=" + iThisItemValue.ToString() + ". " + TownRunManager.sValueItemStatString + ")", ZetaDia.Service.Hero.Name + " new legendary!", Prowl.ProwlNotificationPriority.Emergency);
                            sLegendaryString = " {legendary item}";
                            // Change made by bombastic
                            DBLog.Info("+=+=+=+=+=+=+=+=+ LEGENDARY FOUND +=+=+=+=+=+=+=+=+");
                            DBLog.Info("+  Name:       " + thisgooditem.ThisRealName + " (" + thisPluginItemType.ToString() + ")");
                            //DBLog.Info("+  Score:       " + Math.Round(iThisItemValue).ToString());
                            DBLog.Info("+  Attributes: " + thisgooditem.ItemStatString);
                            DBLog.Info("+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+");
                        }
                        else
                        {
                            DBLog.Info("+=+=+=+=+=+=+=+=+ LEGENDARY FOUND +=+=+=+=+=+=+=+=+");
                            DBLog.Info("+  Unid:       " + thisPluginItemType.ToString());
                            DBLog.Info("+  Level:       " + thisgooditem.ThisLevel.ToString());
                            DBLog.Info("+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+");
                        }

                    }
                    else
                    {
                        // Check for non-legendary notifications
                        bool bShouldNotify = false;
                        switch (thisPluginBaseItemTypes)
                        {
                            case PluginBaseItemTypes.WeaponOneHand:
                            case PluginBaseItemTypes.WeaponRange:
                            case PluginBaseItemTypes.WeaponTwoHand:
                                //if (ithisitemvalue >= settings.iNeedPointsToNotifyWeapon)
                                //  bShouldNotify = true;
                                break;
                            case PluginBaseItemTypes.Armor:
                            case PluginBaseItemTypes.Offhand:
                                //if (ithisitemvalue >= settings.iNeedPointsToNotifyArmor)
                                //bShouldNotify = true;
                                break;
                            case PluginBaseItemTypes.Jewelry:
                                //if (ithisitemvalue >= settings.iNeedPointsToNotifyJewelry)
                                //bShouldNotify = true;
                                break;
                        }
                        //if (bShouldNotify)
                        //Prowl.AddNotificationToQueue(thisgooditem.ThisRealName + " [" + thisPluginItemType.ToString() + "] (Score=" + iThisItemValue.ToString() + ". " + TownRunManager.sValueItemStatString + ")", ZetaDia.Service.Hero.Name + " new item!", Prowl.ProwlNotificationPriority.Emergency);
                    }
                    if (!thisgooditem.IsUnidentified)
                    {

                        LogWriter.WriteLine(thisgooditem.ThisQuality.ToString() + "  " + thisPluginItemType.ToString() + " '" + thisgooditem.ThisRealName + sLegendaryString);
                        LogWriter.WriteLine("  " + thisgooditem.ItemStatString);
                        LogWriter.WriteLine("");
                    }
                    else
                    {
                        LogWriter.WriteLine(thisgooditem.ThisQuality.ToString() + "  " + thisPluginItemType.ToString() + " '" + sLegendaryString);
                        LogWriter.WriteLine("iLevel " + thisgooditem.ThisLevel.ToString());
                        LogWriter.WriteLine("");
                    }
                }

            }
            catch (IOException)
            {
                DBLog.Info("Fatal Error: File access error for stash log file.");
            }
        }
예제 #16
0
파일: LootStats.cs 프로젝트: herbfunk/Funky
 public void VendoredItemLog(CacheACDItem i)
 {
     switch (i.ACDItem.ItemType)
     {
         case ItemType.CraftingPage:
         case ItemType.CraftingPlan:
         case ItemType.CraftingReagent:
             Crafting.Vendored++;
             break;
         case ItemType.Gem:
             Gems.Vendored++;
             break;
         case ItemType.Amulet:
         case ItemType.Axe:
         case ItemType.Belt:
         case ItemType.Boots:
         case ItemType.Bow:
         case ItemType.Bracer:
         case ItemType.CeremonialDagger:
         case ItemType.Chest:
         case ItemType.Cloak:
         case ItemType.Crossbow:
         case ItemType.Dagger:
         case ItemType.Daibo:
         case ItemType.FistWeapon:
         case ItemType.FollowerSpecial:
         case ItemType.Gloves:
         case ItemType.HandCrossbow:
         case ItemType.Helm:
         case ItemType.Legs:
         case ItemType.Mace:
         case ItemType.MightyBelt:
         case ItemType.MightyWeapon:
         case ItemType.Mojo:
         case ItemType.Orb:
         case ItemType.Polearm:
         case ItemType.Quiver:
         case ItemType.Ring:
         case ItemType.Shield:
         case ItemType.Shoulder:
         case ItemType.Spear:
         case ItemType.SpiritStone:
         case ItemType.Staff:
         case ItemType.Sword:
         case ItemType.VoodooMask:
         case ItemType.Wand:
         case ItemType.WizardHat:
             if (i.ThisQuality == ItemQuality.Legendary)
             {
                 Legendary.Vendored++;
             }
             else if (i.ThisQuality > ItemQuality.Magic3)
             {
                 Rare.Vendored++;
             }
             else
             {
                 Magical.Vendored++;
             }
             break;
     }
 }
예제 #17
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);
 }
예제 #18
0
파일: ItemFunc.cs 프로젝트: herbfunk/Funky
 public static PluginItemTypes DetermineItemType(CacheACDItem cacheItem)
 {
     return DetermineItemType(cacheItem.ThisInternalName, cacheItem.ThisDBItemType, cacheItem.ThisFollowerType, cacheItem.SNO);
 }
예제 #19
0
        private static bool GilesStashAttempt(CacheACDItem item, out int[] XY, out int StashPage)
        {
            XY = new[] { -1, -1 };
            StashPage = -1;

            int iPlayerDynamicID = ZetaDia.Me.CommonData.DynamicId;
            int iOriginalGameBalanceId = item.ThisBalanceID;
            int iOriginalDynamicID = item.ThisDynamicID;
            int iOriginalStackQuantity = (int)item.ThisItemStackQuantity;
            string sOriginalItemName = item.ThisRealName;
            string sOriginalInternalName = item.ThisInternalName;
            PluginItemTypes OriginalPluginItemType = ItemFunc.DetermineItemType(item);
            PluginBaseItemTypes thisGilesBaseType = ItemFunc.DetermineBaseType(OriginalPluginItemType);
            bool bOriginalTwoSlot = ItemFunc.DetermineIsTwoSlot(OriginalPluginItemType);
            bool bOriginalIsStackable = ItemFunc.DetermineIsStackable(OriginalPluginItemType);
            int iAttempts;
            if (_dictItemStashAttempted.TryGetValue(iOriginalDynamicID, out iAttempts))
            {
                FunkyTownRunPlugin.DBLog.InfoFormat("GSError: Detected a duplicate stash attempt, DB item mis-read error, now forcing this item as a 2-slot item");
                _dictItemStashAttempted[iOriginalDynamicID] = iAttempts + 1;
                bOriginalTwoSlot = true;
                bOriginalIsStackable = false;
                if (iAttempts > 6)
                {
                    FunkyTownRunPlugin.DBLog.InfoFormat("GSError: Detected an item stash loop risk, now re-mapping stash treating everything as 2-slot and re-attempting");
                    // Array for what blocks are or are not blocked
                    for (int iRow = 0; iRow <= 49; iRow++)
                        for (int iColumn = 0; iColumn <= 6; iColumn++)
                            GilesStashSlotBlocked[iColumn, iRow] = false;
                    // Block off the entire of any "protected stash pages"
                    foreach (int iProtPage in CharacterSettings.Instance.ProtectedStashPages)
                        for (int iProtRow = 0; iProtRow <= 9; iProtRow++)
                            for (int iProtColumn = 0; iProtColumn <= 6; iProtColumn++)
                                GilesStashSlotBlocked[iProtColumn, iProtRow + (iProtPage * 10)] = true;
                    // Remove rows we don't have
                    for (int iRow = (ZetaDia.Me.NumSharedStashSlots / 7); iRow <= 49; iRow++)
                        for (int iColumn = 0; iColumn <= 6; iColumn++)
                            GilesStashSlotBlocked[iColumn, iRow] = true;
                    // Map out all the items already in the stash
                    foreach (ACDItem tempitem in ZetaDia.Me.Inventory.StashItems)
                    {
                        if (tempitem.BaseAddress != IntPtr.Zero)
                        {
                            int inventoryRow = tempitem.InventoryRow;
                            int inventoryColumn = tempitem.InventoryColumn;
                            // Mark this slot as not-free
                            GilesStashSlotBlocked[inventoryColumn, inventoryRow] = true;
                            // Try and reliably find out if this is a two slot item or not
                            GilesStashSlotBlocked[inventoryColumn, inventoryRow + 1] = true;
                            if (inventoryRow != 19 && inventoryRow != 9 && inventoryRow != 29 && inventoryRow != 39 && inventoryRow != 49)
                            {
                                GilesStashSlotBlocked[inventoryColumn, inventoryRow + 1] = true;
                            }
                        }
                    }
                }
                if (iAttempts > 15)
                {
                    FunkyTownRunPlugin.DBLog.InfoFormat("***************************");
                    FunkyTownRunPlugin.DBLog.InfoFormat("GSError: Emergency Stop: No matter what we tried, we couldn't prevent an infinite stash loop. Sorry. Now stopping the bot.");
                    BotMain.Stop();
                    return false;
                }
            }
            else
            {
                _dictItemStashAttempted.Add(iOriginalDynamicID, 1);
            }
            // Safety incase it's not actually in the backpack anymore
            /*if (item.InventorySlot != InventorySlot.PlayerBackpack)
            {
                 FunkyTownRunPlugin.DBLog.InfoFormat("GSError: Diablo 3 memory read error, or item became invalid [StashAttempt-4]", true);
                 return false;
            }*/
            int iLeftoverStackQuantity;
            // Item log for cool stuff stashed

            if (thisGilesBaseType == PluginBaseItemTypes.WeaponTwoHand || thisGilesBaseType == PluginBaseItemTypes.WeaponOneHand || thisGilesBaseType == PluginBaseItemTypes.WeaponRange ||
                 thisGilesBaseType == PluginBaseItemTypes.Armor || thisGilesBaseType == PluginBaseItemTypes.Jewelry || thisGilesBaseType == PluginBaseItemTypes.Offhand ||
                 thisGilesBaseType == PluginBaseItemTypes.FollowerItem)
            {

                FunkyTownRunPlugin.LogGoodItems(item, thisGilesBaseType, OriginalPluginItemType);
            }

            int iPointX = -1;
            int iPointY = -1;
            // First check if we can top-up any already-existing stacks in the stash
            if (bOriginalIsStackable)
            {
                foreach (ACDItem tempitem in ZetaDia.Me.Inventory.StashItems)
                {
                    if (tempitem.BaseAddress == IntPtr.Zero)
                    {
                        FunkyTownRunPlugin.DBLog.InfoFormat("GSError: Diablo 3 memory read error, or stash item became invalid [StashAttempt-5]");
                        return false;
                    }
                    // Check if we combine the stacks, we won't overfill them
                    if ((tempitem.GameBalanceId == iOriginalGameBalanceId) && (tempitem.ItemStackQuantity < tempitem.MaxStackCount))
                    {
                        iLeftoverStackQuantity = (int)((tempitem.ItemStackQuantity + iOriginalStackQuantity) - tempitem.MaxStackCount);
                        iPointX = tempitem.InventoryColumn;
                        iPointY = tempitem.InventoryRow;

                        // Will we have leftovers?
                        if (iLeftoverStackQuantity <= 0)
                            goto FoundStashLocation;
                        goto HandleStackMovement;
                    }
                }
            HandleStackMovement:
                if ((iPointX >= 0) && (iPointY >= 0))
                {
                    ZetaDia.Me.Inventory.MoveItem(iOriginalDynamicID, iPlayerDynamicID, InventorySlot.SharedStash, iPointX, iPointY);
                }
            }
            iPointX = -1;
            iPointY = -1;
            // If it's a 2-square item, find a double-slot free
            if (bOriginalTwoSlot)
            {
                for (int iRow = 0; iRow <= 49; iRow++)
                {
                    bool bBottomPageRow = (iRow == 9 || iRow == 19 || iRow == 29 || iRow == 39 || iRow == 49);
                    for (int iColumn = 0; iColumn <= 6; iColumn++)
                    {
                        // If nothing in the 1st row
                        if (!GilesStashSlotBlocked[iColumn, iRow])
                        {
                            bool bNotEnoughSpace = false;
                            // Bottom row of a page = no room
                            if (bBottomPageRow)
                                bNotEnoughSpace = true;
                            // Already something in the stash in the 2nd row)
                            else if (GilesStashSlotBlocked[iColumn, iRow + 1])
                                bNotEnoughSpace = true;
                            if (!bNotEnoughSpace)
                            {
                                iPointX = iColumn;
                                iPointY = iRow;
                                goto FoundStashLocation;
                            }
                        }
                    }
                }
            } // 2 slot item?
            // Now deal with any leftover 1-slot items
            else
            {
                // First we try and find somewhere "sensible"
                for (int iRow = 0; iRow <= 49; iRow++)
                {
                    bool bTopPageRow = (iRow == 0 || iRow == 10 || iRow == 20 || iRow == 30 || iRow == 40);
                    bool bBottomPageRow = (iRow == 9 || iRow == 19 || iRow == 29 || iRow == 39 || iRow==49);
                    for (int iColumn = 0; iColumn <= 6; iColumn++)
                    {
                        // Nothing in this slot
                        if (!GilesStashSlotBlocked[iColumn, iRow])
                        {
                            bool bSensibleLocation = false;
                            if (!bTopPageRow && !bBottomPageRow)
                            {
                                // Something above and below this slot, or an odd-numbered row, so put something here
                                if ((GilesStashSlotBlocked[iColumn, iRow + 1] && GilesStashSlotBlocked[iColumn, iRow - 1]) ||
                                     (iRow) % 2 != 0)
                                    bSensibleLocation = true;
                            }
                            // Top page row with something directly underneath already blocking
                            else if (bTopPageRow)
                            {
                                if (GilesStashSlotBlocked[iColumn, iRow + 1])
                                    bSensibleLocation = true;
                            }
                            // Bottom page row with something directly over already blocking
                            else
                            {
                                bSensibleLocation = true;
                            }
                            // Sensible location? Yay, stash it here!
                            if (bSensibleLocation)
                            {
                                iPointX = iColumn;
                                iPointY = iRow;
                                // Keep looking for places if it's a stackable to try to stick it at the end
                                if (!bOriginalIsStackable)
                                    goto FoundStashLocation;
                            }
                        }
                    }
                }
                // Didn't find a "sensible" place, let's try and force it in absolutely anywhere
                if ((iPointX < 0) || (iPointY < 0))
                {
                    for (int iRow = 0; iRow <= 49; iRow++)
                    {
                        for (int iColumn = 0; iColumn <= 6; iColumn++)
                        {
                            // Nothing in this spot, we're good!
                            if (!GilesStashSlotBlocked[iColumn, iRow])
                            {
                                iPointX = iColumn;
                                iPointY = iRow;
                                // Keep looking for places if it's a stackable to try to stick it at the end
                                if (!bOriginalIsStackable)
                                    goto FoundStashLocation;
                            }
                        }
                    }
                }
            }
            FoundStashLocation:
            if ((iPointX < 0) || (iPointY < 0))
            {
                FunkyTownRunPlugin.DBLog.DebugFormat("Fatal Error: No valid stash location found for '" + sOriginalItemName + "' [" + sOriginalInternalName + " - " + OriginalPluginItemType.ToString() + "]");
                FunkyTownRunPlugin.DBLog.InfoFormat("***************************");
                FunkyTownRunPlugin.DBLog.InfoFormat("GSError: Emergency Stop: You need to stash an item but no valid space could be found. Stash is full? Stopping the bot to prevent infinite town-run loop.");

                BotMain.Stop(true, "No Room To Stash!");
                ZetaDia.Service.Party.LeaveGame();
                return false;
            }
            // We have two valid points that are empty, move the object here!
            GilesStashSlotBlocked[iPointX, iPointY] = true;
            if (bOriginalTwoSlot)
                GilesStashSlotBlocked[iPointX, iPointY + 1] = true;

            XY = new[] { iPointX, iPointY };

            if (iPointY < 10)
                StashPage = 0;
            else if (iPointY < 20)
                StashPage = 1;
            else if (iPointY < 30)
                StashPage = 2;
            else if (iPointY < 40)
                StashPage = 3;
            else
                StashPage = 4;

            return true;
        }
예제 #20
0
        internal static bool SalvageValidation(CacheACDItem thisitem)
        {
            if (!thisitem.IsSalvagable)
            {
                return false;
            }

            //Only Check items we can actually salvage!
            if (thisitem.BaseItemType == PluginBaseItemTypes.FollowerItem || thisitem.BaseItemType == PluginBaseItemTypes.Armor ||
                thisitem.BaseItemType == PluginBaseItemTypes.Jewelry || thisitem.BaseItemType == PluginBaseItemTypes.Offhand ||
                thisitem.BaseItemType == PluginBaseItemTypes.WeaponOneHand || thisitem.BaseItemType == PluginBaseItemTypes.WeaponRange ||
                thisitem.BaseItemType == PluginBaseItemTypes.WeaponTwoHand)
            {
                if (thisitem.ThisQuality == ItemQuality.Legendary)
                {
                    if (FunkyTownRunPlugin.PluginSettings.SalvageLegendaryItemLevel > 0)
                    {
                        return FunkyTownRunPlugin.PluginSettings.SalvageLegendaryItemLevel <= thisitem.ThisLevel;
                    }
                }
                else if (thisitem.ThisQuality == ItemQuality.Rare4 || thisitem.ThisQuality == ItemQuality.Rare5 || thisitem.ThisQuality == ItemQuality.Rare6)
                {
                    if (FunkyTownRunPlugin.PluginSettings.SalvageRareItemLevel > 0)
                    {
                        return FunkyTownRunPlugin.PluginSettings.SalvageRareItemLevel <= thisitem.ThisLevel;
                    }
                }
                else if (thisitem.ThisQuality == ItemQuality.Magic1 || thisitem.ThisQuality == ItemQuality.Magic2 || thisitem.ThisQuality == ItemQuality.Magic3)
                {
                    if (FunkyTownRunPlugin.PluginSettings.SalvageMagicItemLevel > 0)
                    {
                        return FunkyTownRunPlugin.PluginSettings.SalvageMagicItemLevel <= thisitem.ThisLevel;
                    }
                }
                else if (thisitem.ThisQuality == ItemQuality.Superior || thisitem.ThisQuality == ItemQuality.Inferior || thisitem.ThisQuality == ItemQuality.Normal)
                {
                    if (FunkyTownRunPlugin.PluginSettings.SalvageWhiteItemLevel > 0)
                    {
                        return FunkyTownRunPlugin.PluginSettings.SalvageWhiteItemLevel <= thisitem.ThisLevel;
                    }
                }
            }
            // If we reached this point, then we found no reason to keep the item!
            return false;
        }