Example #1
0
 public DebugItemDataEntry(int snoid, string name, PluginItemTypes type, PluginItemQuality quality)
 {
     SNOID = snoid;
     Name = name;
     Type = type;
     Quality = quality;
 }
Example #2
0
        public CacheBalance(CacheItem item)
        {
            try
            {
                BalanceID     = item.ref_DiaItem.CommonData.GameBalanceId;
                _itemLevel    = item.ref_DiaItem.CommonData.Level;
                _type         = item.ref_DiaItem.CommonData.ItemType;
                _base         = item.ref_DiaItem.CommonData.ItemBaseType;
                _followerType = item.ref_DiaItem.CommonData.FollowerSpecialType;

                _pluginType = ItemFunc.DetermineItemType(item.InternalName, _type, _followerType, item.SNOID);
                if (item.ItemDropType.HasValue)
                {
                    _pluginBase = ItemFunc.DetermineBaseItemType(item.ItemDropType.Value);
                }
                else
                {
                    _pluginBase = ItemFunc.DetermineBaseItemType(item.InternalName, item.SNOID);
                }

                _isStackable = ItemFunc.DetermineIsStackable(_pluginType, item.SNOID);

                if (!_isStackable)
                {
                    _isTwoSlot = ItemFunc.DetermineIsTwoSlot(_pluginType);
                }
            }
            catch (Exception ex)
            {
                Logger.Write(LogLevel.Items,
                             String.Format("Failed to create balance data for item {0}", item.DebugStringSimple));
            }
        }
Example #3
0
 public DebugItemDataEntry(int snoid, string name, PluginItemTypes type, PluginItemQuality quality)
 {
     SNOID   = snoid;
     Name    = name;
     Type    = type;
     Quality = quality;
 }
Example #4
0
        internal static bool SellValidation(string thisinternalname, int thislevel, ItemQuality thisquality, ItemType thisdbitemtype, FollowerType thisfollowertype)
        {
            PluginItemTypes     thisPluginItemType = ItemFunc.DetermineItemType(thisinternalname, thisdbitemtype, thisfollowertype);
            PluginBaseItemTypes thisGilesBaseType  = ItemFunc.DetermineBaseType(thisPluginItemType);

            switch (thisGilesBaseType)
            {
            case PluginBaseItemTypes.WeaponRange:
            case PluginBaseItemTypes.WeaponOneHand:
            case PluginBaseItemTypes.WeaponTwoHand:
            case PluginBaseItemTypes.Armor:
            case PluginBaseItemTypes.Offhand:
            case PluginBaseItemTypes.Jewelry:
            case PluginBaseItemTypes.FollowerItem:
                return(true);

            case PluginBaseItemTypes.Gem:
            case PluginBaseItemTypes.Misc:
            case PluginBaseItemTypes.Unknown:
                if (thisPluginItemType == PluginItemTypes.LegendaryCraftingMaterial)
                {
                    return(true);
                }
                //Sell any plans not already stashed.
                return(thisdbitemtype == ItemType.CraftingPlan);
            }             // Switch giles base item type
            return(false);
        }
Example #5
0
        public void LootedItemLog(PluginItemTypes itemType, PluginBaseItemTypes baseitemType, ItemQuality itemQuality)
        {
            if (itemType == PluginItemTypes.HealthPotion)
            {
                return;
            }


            switch (baseitemType)
            {
            case PluginBaseItemTypes.WeaponOneHand:
            case PluginBaseItemTypes.WeaponTwoHand:
            case PluginBaseItemTypes.WeaponRange:
            case PluginBaseItemTypes.Offhand:
            case PluginBaseItemTypes.Armor:
            case PluginBaseItemTypes.Jewelry:
            case PluginBaseItemTypes.FollowerItem:
                if (itemQuality > ItemQuality.Rare6)
                {
                    FunkyGame.CurrentStats.CurrentProfile.LootTracker.Legendary.Looted++;
                }
                else if (itemQuality > ItemQuality.Magic3)
                {
                    FunkyGame.CurrentStats.CurrentProfile.LootTracker.Rare.Looted++;
                }
                else
                {
                    FunkyGame.CurrentStats.CurrentProfile.LootTracker.Magical.Looted++;
                }
                break;

            case PluginBaseItemTypes.Unknown:
            case PluginBaseItemTypes.Misc:
                if (itemType == PluginItemTypes.CraftingMaterial || itemType == PluginItemTypes.CraftingPlan || itemType == PluginItemTypes.CraftTome)
                {
                    FunkyGame.CurrentStats.CurrentProfile.LootTracker.Crafting.Looted++;
                }
                else if (itemType == PluginItemTypes.InfernalKey)
                {
                    FunkyGame.CurrentStats.CurrentProfile.LootTracker.Keys.Looted++;
                }
                else if (itemType == PluginItemTypes.KeyStone)
                {
                    FunkyGame.CurrentStats.CurrentProfile.LootTracker.KeyStoneFragments.Looted++;
                }
                break;

            case PluginBaseItemTypes.Gem:
                FunkyGame.CurrentStats.CurrentProfile.LootTracker.Gems.Looted++;
                break;
            }
        }
Example #6
0
        private void UpdateBackpackSlots()
        {
            Logger.DBLog.DebugFormat("Updating Backpack Slots!");

            // Array for what blocks are or are not blocked
            for (int iRow = 0; iRow <= 5; iRow++)
            {
                for (int iColumn = 0; iColumn <= 9; iColumn++)
                {
                    BackpackSlotBlocked[iColumn, iRow] = false;
                }
            }
            // Block off the entire of any "protected"
            foreach (InventorySquare iProtPage in CharacterSettings.Instance.ProtectedBagSlots)
            {
                BackpackSlotBlocked[iProtPage.Column, iProtPage.Row] = true;
            }



            // Map out all the items already in the stash
            foreach (ACDItem tempitem in ZetaDia.Me.Inventory.Backpack)
            {
                if (tempitem.BaseAddress != IntPtr.Zero)
                {
                    //StashedItems.Add(new CacheACDItem(tempitem));
                    int inventoryRow    = tempitem.InventoryRow;
                    int inventoryColumn = tempitem.InventoryColumn;
                    // Mark this slot as not-free
                    BackpackSlotBlocked[inventoryColumn, inventoryRow] = true;
                    // Try and reliably find out if this is a two slot item or not
                    PluginItemTypes tempItemType = ItemFunc.DetermineItemType(tempitem.InternalName, tempitem.ItemType, tempitem.FollowerSpecialType, tempitem.ActorSNO);

                    if (ItemFunc.DetermineIsTwoSlot(tempItemType) && inventoryRow != 5)
                    {
                        BackpackSlotBlocked[inventoryColumn, inventoryRow + 1] = true;
                    }
                    else if (ItemFunc.DetermineIsTwoSlot(tempItemType) && inventoryRow == 5)
                    {
                        Logger.DBLog.DebugFormat("GSError: DemonBuddy thinks this item is 2 slot even though it's at bottom row of a stash page: " + tempitem.Name + " [" + tempitem.InternalName +
                                                 "] type=" + tempItemType.ToString() + " @ slot " + (inventoryRow + 1).ToString(CultureInfo.InvariantCulture) + "/" +
                                                 (inventoryColumn + 1).ToString(CultureInfo.InvariantCulture));
                    }
                }
            }             // Loop through all stash items

            bUpdatedStashMap = true;
        }
Example #7
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);
            }
        }
Example #8
0
 public static bool DetermineIsTwoSlot(PluginItemTypes thisPluginItemTypes)
 {
     if (thisPluginItemTypes == PluginItemTypes.Axe || thisPluginItemTypes == PluginItemTypes.CeremonialKnife || thisPluginItemTypes == PluginItemTypes.Dagger ||
          thisPluginItemTypes == PluginItemTypes.FistWeapon || thisPluginItemTypes == PluginItemTypes.Mace || thisPluginItemTypes == PluginItemTypes.MightyWeapon ||
          thisPluginItemTypes == PluginItemTypes.Spear || thisPluginItemTypes == PluginItemTypes.Sword || thisPluginItemTypes == PluginItemTypes.Wand ||
          thisPluginItemTypes == PluginItemTypes.TwoHandDaibo || thisPluginItemTypes == PluginItemTypes.TwoHandCrossbow || thisPluginItemTypes == PluginItemTypes.TwoHandMace ||
          thisPluginItemTypes == PluginItemTypes.TwoHandMighty || thisPluginItemTypes == PluginItemTypes.TwoHandPolearm || thisPluginItemTypes == PluginItemTypes.TwoHandStaff ||
          thisPluginItemTypes == PluginItemTypes.TwoHandSword || thisPluginItemTypes == PluginItemTypes.TwoHandAxe || thisPluginItemTypes == PluginItemTypes.HandCrossbow ||
          thisPluginItemTypes == PluginItemTypes.TwoHandBow || thisPluginItemTypes == PluginItemTypes.Mojo || thisPluginItemTypes == PluginItemTypes.Source ||
          thisPluginItemTypes == PluginItemTypes.Quiver || thisPluginItemTypes == PluginItemTypes.Shield || thisPluginItemTypes == PluginItemTypes.Boots ||
          thisPluginItemTypes == PluginItemTypes.Bracers || thisPluginItemTypes == PluginItemTypes.Chest || thisPluginItemTypes == PluginItemTypes.Cloak ||
          thisPluginItemTypes == PluginItemTypes.Gloves || thisPluginItemTypes == PluginItemTypes.Helm || thisPluginItemTypes == PluginItemTypes.Pants ||
          thisPluginItemTypes == PluginItemTypes.Shoulders || thisPluginItemTypes == PluginItemTypes.SpiritStone ||
          thisPluginItemTypes == PluginItemTypes.VoodooMask || thisPluginItemTypes == PluginItemTypes.WizardHat || thisPluginItemTypes == PluginItemTypes.StaffOfHerding ||
          thisPluginItemTypes == PluginItemTypes.Flail || thisPluginItemTypes == PluginItemTypes.TwoHandFlail || thisPluginItemTypes == PluginItemTypes.CrusaderShield || thisPluginItemTypes == PluginItemTypes.HoradricCache)
         return true;
     return false;
 }
Example #9
0
 public static bool DetermineIsStackable(PluginItemTypes thisPluginItemTypes, int snoid=-1)
 {
     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.HealthPotion ||
                               thisPluginItemTypes == PluginItemTypes.CraftingPlan ||
                               thisPluginItemTypes == PluginItemTypes.Dye ||
                               thisPluginItemTypes == PluginItemTypes.InfernalKey ||
                               thisPluginItemTypes == PluginItemTypes.KeyStone;
     return bIsStackable;
 }
Example #10
0
 //public static bool DetermineItemTypeUsingSNO(int snoid, out PluginItemTypes types)
 //{
 //    types = PluginItemTypes.Unknown;
 //    if (ItemSnoCache.GEMS_AmethystSNOIds.Contains(snoid))
 //    {
 //        types = PluginItemTypes.Amethyst;
 //        return true;
 //    }
 //    if (ItemSnoCache.GEMS_RubySNOIds.Contains(snoid))
 //    {
 //        types = PluginItemTypes.Ruby;
 //        return true;
 //    }
 //    if (ItemSnoCache.GEMS_TopazSNOIds.Contains(snoid))
 //    {
 //        types = PluginItemTypes.Topaz;
 //        return true;
 //    }
 //    if (ItemSnoCache.GEMS_EmeraldSNOIds.Contains(snoid))
 //    {
 //        types = PluginItemTypes.Emerald;
 //        return true;
 //    }
 //    if (ItemSnoCache.GEMS_DiamondSNOIds.Contains(snoid))
 //    {
 //        types = PluginItemTypes.Diamond;
 //        return true;
 //    }
 //    if (ItemSnoCache.HealthPotionSNOIds.Contains(snoid))
 //    {
 //        types = PluginItemTypes.HealthPotion;
 //        return true;
 //    }
 //    if (ItemSnoCache.CraftingMaterialSNOIds.Contains(snoid))
 //    {
 //        types = PluginItemTypes.CraftingMaterial;
 //        return true;
 //    }
 //    if (ItemSnoCache.InfernalKeySNOIds.Contains(snoid))
 //    {
 //        types = PluginItemTypes.InfernalKey;
 //        return true;
 //    }
 //    if (ItemSnoCache.MiscItemSNOIds.Contains(snoid))
 //    {
 //        types = PluginItemTypes.CraftingMaterial;
 //        return true;
 //    }
 //    if (ItemSnoCache.DyesSNOIds.Contains(snoid))
 //    {
 //        types = PluginItemTypes.Dye;
 //        return true;
 //    }
 //    if (ItemSnoCache.HoradricCacheSNOIds.Contains(snoid))
 //    {
 //        types=PluginItemTypes.HoradricCache;
 //        return true;
 //    }
 //    return types != PluginItemTypes.Unknown;
 //}
 public static PluginBaseItemTypes DetermineBaseType(PluginItemTypes thisPluginItemTypes)
 {
     PluginBaseItemTypes thisGilesBaseTypes = PluginBaseItemTypes.Unknown;
     if (thisPluginItemTypes == PluginItemTypes.Axe || thisPluginItemTypes == PluginItemTypes.CeremonialKnife || thisPluginItemTypes == PluginItemTypes.Dagger ||
          thisPluginItemTypes == PluginItemTypes.FistWeapon || thisPluginItemTypes == PluginItemTypes.Mace || thisPluginItemTypes == PluginItemTypes.MightyWeapon ||
          thisPluginItemTypes == PluginItemTypes.Spear || thisPluginItemTypes == PluginItemTypes.Sword || thisPluginItemTypes == PluginItemTypes.Wand || thisPluginItemTypes == PluginItemTypes.Flail)
     {
         thisGilesBaseTypes = PluginBaseItemTypes.WeaponOneHand;
     }
     else if (thisPluginItemTypes == PluginItemTypes.TwoHandDaibo || thisPluginItemTypes == PluginItemTypes.TwoHandMace ||
          thisPluginItemTypes == PluginItemTypes.TwoHandMighty || thisPluginItemTypes == PluginItemTypes.TwoHandPolearm || thisPluginItemTypes == PluginItemTypes.TwoHandStaff ||
          thisPluginItemTypes == PluginItemTypes.TwoHandSword || thisPluginItemTypes == PluginItemTypes.TwoHandAxe || thisPluginItemTypes == PluginItemTypes.TwoHandFlail)
     {
         thisGilesBaseTypes = PluginBaseItemTypes.WeaponTwoHand;
     }
     else if (thisPluginItemTypes == PluginItemTypes.TwoHandCrossbow || thisPluginItemTypes == PluginItemTypes.HandCrossbow || thisPluginItemTypes == PluginItemTypes.TwoHandBow)
     {
         thisGilesBaseTypes = PluginBaseItemTypes.WeaponRange;
     }
     else if (thisPluginItemTypes == PluginItemTypes.Mojo || thisPluginItemTypes == PluginItemTypes.Source ||
          thisPluginItemTypes == PluginItemTypes.Quiver || thisPluginItemTypes == PluginItemTypes.Shield || thisPluginItemTypes == PluginItemTypes.CrusaderShield)
     {
         thisGilesBaseTypes = PluginBaseItemTypes.Offhand;
     }
     else if (thisPluginItemTypes == PluginItemTypes.Boots || thisPluginItemTypes == PluginItemTypes.Bracers || thisPluginItemTypes == PluginItemTypes.Chest ||
          thisPluginItemTypes == PluginItemTypes.Cloak || thisPluginItemTypes == PluginItemTypes.Gloves || thisPluginItemTypes == PluginItemTypes.Helm ||
          thisPluginItemTypes == PluginItemTypes.Pants || thisPluginItemTypes == PluginItemTypes.Shoulders || thisPluginItemTypes == PluginItemTypes.SpiritStone ||
          thisPluginItemTypes == PluginItemTypes.VoodooMask || thisPluginItemTypes == PluginItemTypes.WizardHat || thisPluginItemTypes == PluginItemTypes.Belt ||
          thisPluginItemTypes == PluginItemTypes.MightyBelt)
     {
         thisGilesBaseTypes = PluginBaseItemTypes.Armor;
     }
     else if (thisPluginItemTypes == PluginItemTypes.Amulet || thisPluginItemTypes == PluginItemTypes.Ring)
     {
         thisGilesBaseTypes = PluginBaseItemTypes.Jewelry;
     }
     else if (thisPluginItemTypes == PluginItemTypes.FollowerEnchantress || thisPluginItemTypes == PluginItemTypes.FollowerScoundrel ||
          thisPluginItemTypes == PluginItemTypes.FollowerTemplar)
     {
         thisGilesBaseTypes = PluginBaseItemTypes.FollowerItem;
     }
     else if (thisPluginItemTypes == PluginItemTypes.CraftingMaterial || thisPluginItemTypes == PluginItemTypes.LegendaryCraftingMaterial || thisPluginItemTypes == PluginItemTypes.CraftTome || thisPluginItemTypes == PluginItemTypes.MiscBook ||
          thisPluginItemTypes == PluginItemTypes.SpecialItem || thisPluginItemTypes == PluginItemTypes.CraftingPlan || thisPluginItemTypes == PluginItemTypes.HealthPotion || thisPluginItemTypes == PluginItemTypes.LegendaryHealthPotion ||
          thisPluginItemTypes == PluginItemTypes.Dye || thisPluginItemTypes == PluginItemTypes.StaffOfHerding || thisPluginItemTypes == PluginItemTypes.InfernalKey ||
         thisPluginItemTypes == PluginItemTypes.KeyStone || thisPluginItemTypes == PluginItemTypes.HoradricCache || thisPluginItemTypes == PluginItemTypes.BloodShard || thisPluginItemTypes == PluginItemTypes.RamaladnisGift)
     {
         thisGilesBaseTypes = PluginBaseItemTypes.Misc;
     }
     else if (thisPluginItemTypes == PluginItemTypes.Ruby || thisPluginItemTypes == PluginItemTypes.Emerald || thisPluginItemTypes == PluginItemTypes.Topaz ||
          thisPluginItemTypes == PluginItemTypes.Amethyst || thisPluginItemTypes == PluginItemTypes.Diamond || thisPluginItemTypes == PluginItemTypes.LegendaryGem)
     {
         thisGilesBaseTypes = PluginBaseItemTypes.Gem;
     }
     else if (thisPluginItemTypes == PluginItemTypes.HealthGlobe)
     {
         thisGilesBaseTypes = PluginBaseItemTypes.HealthGlobe;
     }
     return thisGilesBaseTypes;
 }
Example #11
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.");
            }
        }
Example #12
0
 public ItemDataEntry(int snoid, PluginItemTypes type, LegendaryItemTypes legendarytype = LegendaryItemTypes.None)
 {
     SnoId = snoid;
     ItemType = type;
     LegendaryType = legendarytype;
 }
Example #13
0
        public void DroppedItemLog(PluginItemTypes itemType, ItemQuality itemQuality)
        {
            switch (itemType)
            {
                case PluginItemTypes.CraftingMaterial:
                case PluginItemTypes.CraftingPlan:
                case PluginItemTypes.LegendaryCraftingMaterial:
                case PluginItemTypes.CraftTome:
                    FunkyGame.CurrentStats.CurrentProfile.LootTracker.Crafting.Dropped++;
                    break;

                case PluginItemTypes.Ruby:
                case PluginItemTypes.Emerald:
                case PluginItemTypes.Topaz:
                case PluginItemTypes.Amethyst:
                case PluginItemTypes.Diamond:
                    FunkyGame.CurrentStats.CurrentProfile.LootTracker.Gems.Dropped++;
                    break;

                case PluginItemTypes.Axe:
                case PluginItemTypes.CeremonialKnife:
                case PluginItemTypes.HandCrossbow:
                case PluginItemTypes.Dagger:
                case PluginItemTypes.FistWeapon:
                case PluginItemTypes.Flail:
                case PluginItemTypes.Mace:
                case PluginItemTypes.MightyWeapon:
                case PluginItemTypes.Spear:
                case PluginItemTypes.Sword:
                case PluginItemTypes.Wand:
                case PluginItemTypes.TwoHandAxe:
                case PluginItemTypes.TwoHandBow:
                case PluginItemTypes.TwoHandDaibo:
                case PluginItemTypes.TwoHandCrossbow:
                case PluginItemTypes.TwoHandFlail:
                case PluginItemTypes.TwoHandMace:
                case PluginItemTypes.TwoHandMighty:
                case PluginItemTypes.TwoHandPolearm:
                case PluginItemTypes.TwoHandStaff:
                case PluginItemTypes.TwoHandSword:
                case PluginItemTypes.Mojo:
                case PluginItemTypes.Source:
                case PluginItemTypes.Quiver:
                case PluginItemTypes.Shield:
                case PluginItemTypes.CrusaderShield:
                case PluginItemTypes.Amulet:
                case PluginItemTypes.Ring:
                case PluginItemTypes.Belt:
                case PluginItemTypes.Boots:
                case PluginItemTypes.Bracers:
                case PluginItemTypes.Chest:
                case PluginItemTypes.Cloak:
                case PluginItemTypes.Gloves:
                case PluginItemTypes.Helm:
                case PluginItemTypes.Pants:
                case PluginItemTypes.MightyBelt:
                case PluginItemTypes.Shoulders:
                case PluginItemTypes.SpiritStone:
                case PluginItemTypes.VoodooMask:
                case PluginItemTypes.WizardHat:
                    if (itemQuality == ItemQuality.Legendary)
                    {
                        FunkyGame.CurrentStats.CurrentProfile.LootTracker.Legendary.Dropped++;
                    }
                    else if (itemQuality > ItemQuality.Magic3)
                    {
                        FunkyGame.CurrentStats.CurrentProfile.LootTracker.Rare.Dropped++;
                    }
                    else
                    {
                        FunkyGame.CurrentStats.CurrentProfile.LootTracker.Magical.Dropped++;
                    }
                    break;

                case PluginItemTypes.FollowerEnchantress:
                case PluginItemTypes.FollowerScoundrel:
                case PluginItemTypes.FollowerTemplar:
                    break;

                case PluginItemTypes.SpecialItem:
                    break;

                case PluginItemTypes.HealthPotion:
                    break;

                case PluginItemTypes.HealthGlobe:
                    break;

                case PluginItemTypes.InfernalKey:
                    FunkyGame.CurrentStats.CurrentProfile.LootTracker.Keys.Dropped++;
                    break;
                case PluginItemTypes.KeyStone:
                    break;
                case PluginItemTypes.BloodShard:
                    break;
            }
        }
Example #14
0
        public static ItemType PluginItemTypeToDBItemType(PluginItemTypes thisPluginItemTypes)
        {
            switch (thisPluginItemTypes)
            {
                case PluginItemTypes.Axe: return ItemType.Axe;
                case PluginItemTypes.CeremonialKnife: return ItemType.CeremonialDagger;
                case PluginItemTypes.HandCrossbow: return ItemType.HandCrossbow;
                case PluginItemTypes.Dagger: return ItemType.Dagger;
                case PluginItemTypes.FistWeapon: return ItemType.FistWeapon;

                case PluginItemTypes.Flail: return ItemType.Flail;
                case PluginItemTypes.TwoHandFlail: return ItemType.Flail;
                case PluginItemTypes.CrusaderShield: return ItemType.CrusaderShield;

                case PluginItemTypes.Mace: return ItemType.Mace;
                case PluginItemTypes.MightyWeapon: return ItemType.MightyWeapon;
                case PluginItemTypes.Spear: return ItemType.Spear;
                case PluginItemTypes.Sword: return ItemType.Sword;
                case PluginItemTypes.Wand: return ItemType.Wand;
                case PluginItemTypes.TwoHandAxe: return ItemType.Axe;
                case PluginItemTypes.TwoHandBow: return ItemType.Bow;
                case PluginItemTypes.TwoHandDaibo: return ItemType.Daibo;
                case PluginItemTypes.TwoHandCrossbow: return ItemType.Crossbow;
                case PluginItemTypes.TwoHandMace: return ItemType.Mace;
                case PluginItemTypes.TwoHandMighty: return ItemType.MightyWeapon;
                case PluginItemTypes.TwoHandPolearm: return ItemType.Polearm;
                case PluginItemTypes.TwoHandStaff: return ItemType.Staff;
                case PluginItemTypes.TwoHandSword: return ItemType.Sword;
                case PluginItemTypes.StaffOfHerding: return ItemType.Staff;
                case PluginItemTypes.Mojo: return ItemType.Mojo;
                case PluginItemTypes.Source: return ItemType.Orb;
                case PluginItemTypes.Quiver: return ItemType.Quiver;
                case PluginItemTypes.Shield: return ItemType.Shield;
                case PluginItemTypes.Amulet: return ItemType.Amulet;
                case PluginItemTypes.Ring: return ItemType.Ring;
                case PluginItemTypes.Belt: return ItemType.Belt;
                case PluginItemTypes.Boots: return ItemType.Boots;
                case PluginItemTypes.Bracers: return ItemType.Bracer;
                case PluginItemTypes.Chest: return ItemType.Chest;
                case PluginItemTypes.Cloak: return ItemType.Cloak;
                case PluginItemTypes.Gloves: return ItemType.Gloves;
                case PluginItemTypes.Helm: return ItemType.Helm;
                case PluginItemTypes.Pants: return ItemType.Legs;
                case PluginItemTypes.MightyBelt: return ItemType.MightyBelt;
                case PluginItemTypes.Shoulders: return ItemType.Shoulder;
                case PluginItemTypes.SpiritStone: return ItemType.SpiritStone;
                case PluginItemTypes.VoodooMask: return ItemType.VoodooMask;
                case PluginItemTypes.WizardHat: return ItemType.WizardHat;
                case PluginItemTypes.FollowerEnchantress: return ItemType.FollowerSpecial;
                case PluginItemTypes.FollowerScoundrel: return ItemType.FollowerSpecial;
                case PluginItemTypes.FollowerTemplar: return ItemType.FollowerSpecial;
                case PluginItemTypes.CraftingMaterial: return ItemType.CraftingReagent;
                case PluginItemTypes.LegendaryCraftingMaterial: return ItemType.CraftingReagent;
                case PluginItemTypes.CraftTome: return ItemType.CraftingPage;
                case PluginItemTypes.Ruby: return ItemType.Gem;
                case PluginItemTypes.Emerald: return ItemType.Gem;
                case PluginItemTypes.Topaz: return ItemType.Gem;
                case PluginItemTypes.Amethyst: return ItemType.Gem;
                case PluginItemTypes.Diamond: return ItemType.Gem;
                case PluginItemTypes.LegendaryGem: return ItemType.Gem;
                case PluginItemTypes.SpecialItem: return ItemType.Unknown;
                case PluginItemTypes.CraftingPlan: return ItemType.CraftingPlan;
                case PluginItemTypes.HealthPotion: return ItemType.Potion;
                case PluginItemTypes.LegendaryHealthPotion: return ItemType.Potion;
                case PluginItemTypes.Dye: return ItemType.Unknown;
                case PluginItemTypes.InfernalKey: return ItemType.CraftingReagent;
                case PluginItemTypes.MiscBook: return ItemType.CraftingPage;
                case PluginItemTypes.KeyStone: return ItemType.KeystoneFragment;
                case PluginItemTypes.HoradricCache: return ItemType.HoradricCache;
                case PluginItemTypes.RamaladnisGift: return ItemType.CraftingReagent;

            }
            return ItemType.Unknown;
        }
Example #15
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);
        }
Example #16
0
 public ItemDataEntry(int snoid, PluginItemTypes type, LegendaryItemTypes legendarytype = LegendaryItemTypes.None)
 {
     SnoId         = snoid;
     ItemType      = type;
     LegendaryType = legendarytype;
 }
Example #17
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.");
            }
        }
Example #18
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.");
            }
        }
Example #19
0
        public static FollowerType ReturnFollowerType(PluginItemTypes types)
        {
            if (types == PluginItemTypes.FollowerEnchantress)
                return FollowerType.Enchantress;
            if (types == PluginItemTypes.FollowerTemplar)
                return FollowerType.Templar;
            if (types == PluginItemTypes.FollowerScoundrel)
                return FollowerType.Scoundrel;

            return FollowerType.None;
        }
Example #20
0
        public void DroppedItemLog(PluginItemTypes itemType, ItemQuality itemQuality)
        {
            switch (itemType)
            {
            case PluginItemTypes.CraftingMaterial:
            case PluginItemTypes.CraftingPlan:
            case PluginItemTypes.LegendaryCraftingMaterial:
            case PluginItemTypes.CraftTome:
                FunkyGame.CurrentStats.CurrentProfile.LootTracker.Crafting.Dropped++;
                break;

            case PluginItemTypes.Ruby:
            case PluginItemTypes.Emerald:
            case PluginItemTypes.Topaz:
            case PluginItemTypes.Amethyst:
            case PluginItemTypes.Diamond:
                FunkyGame.CurrentStats.CurrentProfile.LootTracker.Gems.Dropped++;
                break;


            case PluginItemTypes.Axe:
            case PluginItemTypes.CeremonialKnife:
            case PluginItemTypes.HandCrossbow:
            case PluginItemTypes.Dagger:
            case PluginItemTypes.FistWeapon:
            case PluginItemTypes.Flail:
            case PluginItemTypes.Mace:
            case PluginItemTypes.MightyWeapon:
            case PluginItemTypes.Spear:
            case PluginItemTypes.Sword:
            case PluginItemTypes.Wand:
            case PluginItemTypes.TwoHandAxe:
            case PluginItemTypes.TwoHandBow:
            case PluginItemTypes.TwoHandDaibo:
            case PluginItemTypes.TwoHandCrossbow:
            case PluginItemTypes.TwoHandFlail:
            case PluginItemTypes.TwoHandMace:
            case PluginItemTypes.TwoHandMighty:
            case PluginItemTypes.TwoHandPolearm:
            case PluginItemTypes.TwoHandStaff:
            case PluginItemTypes.TwoHandSword:
            case PluginItemTypes.Mojo:
            case PluginItemTypes.Source:
            case PluginItemTypes.Quiver:
            case PluginItemTypes.Shield:
            case PluginItemTypes.CrusaderShield:
            case PluginItemTypes.Amulet:
            case PluginItemTypes.Ring:
            case PluginItemTypes.Belt:
            case PluginItemTypes.Boots:
            case PluginItemTypes.Bracers:
            case PluginItemTypes.Chest:
            case PluginItemTypes.Cloak:
            case PluginItemTypes.Gloves:
            case PluginItemTypes.Helm:
            case PluginItemTypes.Pants:
            case PluginItemTypes.MightyBelt:
            case PluginItemTypes.Shoulders:
            case PluginItemTypes.SpiritStone:
            case PluginItemTypes.VoodooMask:
            case PluginItemTypes.WizardHat:
                if (itemQuality == ItemQuality.Legendary)
                {
                    FunkyGame.CurrentStats.CurrentProfile.LootTracker.Legendary.Dropped++;
                }
                else if (itemQuality > ItemQuality.Magic3)
                {
                    FunkyGame.CurrentStats.CurrentProfile.LootTracker.Rare.Dropped++;
                }
                else
                {
                    FunkyGame.CurrentStats.CurrentProfile.LootTracker.Magical.Dropped++;
                }
                break;

            case PluginItemTypes.FollowerEnchantress:
            case PluginItemTypes.FollowerScoundrel:
            case PluginItemTypes.FollowerTemplar:
                break;


            case PluginItemTypes.SpecialItem:
                break;

            case PluginItemTypes.HealthPotion:
                break;

            case PluginItemTypes.HealthGlobe:
                break;

            case PluginItemTypes.InfernalKey:
                FunkyGame.CurrentStats.CurrentProfile.LootTracker.Keys.Dropped++;
                break;

            case PluginItemTypes.KeyStone:
                break;

            case PluginItemTypes.BloodShard:
                break;
            }
        }
Example #21
0
        }         // Custom stashing routine

        private bool BackpackStashAttempt(CacheACDItem item, out int[] XY)
        {
            XY = new[] { -1, -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       = item.IsTwoSlot;
            bool                bOriginalIsStackable   = item.IsStackableItem;
            int                 iAttempts;

            if (_dictItemStashAttempted.TryGetValue(iOriginalDynamicID, out iAttempts))
            {
                Logger.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)
                {
                    Logger.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 <= 5; iRow++)
                    {
                        for (int iColumn = 0; iColumn <= 9; iColumn++)
                        {
                            BackpackSlotBlocked[iColumn, iRow] = false;
                        }
                    }
                    // Block off the entire of any "protected stash pages"
                    foreach (InventorySquare iProtPage in CharacterSettings.Instance.ProtectedBagSlots)
                    {
                        BackpackSlotBlocked[iProtPage.Column, iProtPage.Row] = true;
                    }

                    // Map out all the items already in the stash
                    foreach (ACDItem tempitem in ZetaDia.Me.Inventory.Backpack)
                    {
                        if (tempitem.BaseAddress != IntPtr.Zero)
                        {
                            CacheACDItem tempCacheItem = new CacheACDItem(tempitem);

                            int inventoryRow    = tempCacheItem.invRow;
                            int inventoryColumn = tempCacheItem.invCol;
                            // Mark this slot as not-free
                            BackpackSlotBlocked[inventoryColumn, inventoryRow] = true;
                            // Try and reliably find out if this is a two slot item or not
                            //BackpackSlotBlocked[inventoryColumn, inventoryRow + 1] = true;
                            if (inventoryRow != 5 && tempCacheItem.IsTwoSlot)
                            {
                                BackpackSlotBlocked[inventoryColumn, inventoryRow + 1] = true;
                            }
                        }
                    }
                }
                if (iAttempts > 15)
                {
                    Logger.DBLog.InfoFormat("***************************");
                    Logger.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;


            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.Backpack)
                {
                    if (tempitem.BaseAddress == IntPtr.Zero)
                    {
                        Logger.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.BackpackItems, 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 <= 5; iRow++)
                {
                    bool bBottomPageRow = iRow == 5;
                    for (int iColumn = 0; iColumn <= 9; iColumn++)
                    {
                        // If nothing in the 1st row
                        if (!BackpackSlotBlocked[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 (BackpackSlotBlocked[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 <= 5; iRow++)
                {
                    bool bTopPageRow    = iRow == 0;
                    bool bBottomPageRow = (iRow == 5);
                    for (int iColumn = 0; iColumn <= 9; iColumn++)
                    {
                        // Nothing in this slot
                        if (!BackpackSlotBlocked[iColumn, iRow])
                        {
                            bool bSensibleLocation = false;
                            if (!bTopPageRow && !bBottomPageRow)
                            {
                                // Something above and below this slot, or an odd-numbered row, so put something here
                                if ((BackpackSlotBlocked[iColumn, iRow + 1] && BackpackSlotBlocked[iColumn, iRow - 1]) ||
                                    (iRow) % 2 != 0)
                                {
                                    bSensibleLocation = true;
                                }
                            }
                            // Top page row with something directly underneath already blocking
                            else if (bTopPageRow)
                            {
                                if (BackpackSlotBlocked[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 <= 5; iRow++)
                    {
                        for (int iColumn = 0; iColumn <= 9; iColumn++)
                        {
                            // Nothing in this spot, we're good!
                            if (!BackpackSlotBlocked[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))
            {
                Logger.DBLog.DebugFormat("Fatal Error: No valid stash location found for '" + sOriginalItemName + "' [" + sOriginalInternalName + " - " + OriginalPluginItemType.ToString() + "]");
                Logger.DBLog.InfoFormat("***************************");
                Logger.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!
            BackpackSlotBlocked[iPointX, iPointY] = true;
            if (bOriginalTwoSlot)
            {
                BackpackSlotBlocked[iPointX, iPointY + 1] = true;
            }

            XY = new[] { iPointX, iPointY };



            return(true);
        }         // Custom stashing routine
Example #22
0
        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 += 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;
            }
        }
Example #23
0
        public void LootedItemLog(PluginItemTypes itemType, PluginBaseItemTypes baseitemType, ItemQuality itemQuality)
        {
            if (itemType == PluginItemTypes.HealthPotion)
                return;

            switch (baseitemType)
            {
                case PluginBaseItemTypes.WeaponOneHand:
                case PluginBaseItemTypes.WeaponTwoHand:
                case PluginBaseItemTypes.WeaponRange:
                case PluginBaseItemTypes.Offhand:
                case PluginBaseItemTypes.Armor:
                case PluginBaseItemTypes.Jewelry:
                case PluginBaseItemTypes.FollowerItem:
                    if (itemQuality > ItemQuality.Rare6)
                    {
                        FunkyGame.CurrentStats.CurrentProfile.LootTracker.Legendary.Looted++;
                    }
                    else if (itemQuality > ItemQuality.Magic3)
                    {
                        FunkyGame.CurrentStats.CurrentProfile.LootTracker.Rare.Looted++;
                    }
                    else
                    {
                        FunkyGame.CurrentStats.CurrentProfile.LootTracker.Magical.Looted++;
                    }
                    break;

                case PluginBaseItemTypes.Unknown:
                case PluginBaseItemTypes.Misc:
                    if (itemType == PluginItemTypes.CraftingMaterial || itemType == PluginItemTypes.CraftingPlan || itemType == PluginItemTypes.CraftTome)
                    {
                        FunkyGame.CurrentStats.CurrentProfile.LootTracker.Crafting.Looted++;
                    }
                    else if (itemType == PluginItemTypes.InfernalKey)
                    {
                        FunkyGame.CurrentStats.CurrentProfile.LootTracker.Keys.Looted++;
                    }
                    else if (itemType == PluginItemTypes.KeyStone)
                    {
                        FunkyGame.CurrentStats.CurrentProfile.LootTracker.KeyStoneFragments.Looted++;
                    }
                    break;
                case PluginBaseItemTypes.Gem:
                    FunkyGame.CurrentStats.CurrentProfile.LootTracker.Gems.Looted++;
                    break;
            }
        }
Example #24
0
        public CacheBalance(CacheItem item)
        {
            try
            {
                BalanceID = item.ref_DiaItem.CommonData.GameBalanceId;
                _itemLevel = item.ref_DiaItem.CommonData.Level;
                _type = item.ref_DiaItem.CommonData.ItemType;
                _base = item.ref_DiaItem.CommonData.ItemBaseType;
                _followerType = item.ref_DiaItem.CommonData.FollowerSpecialType;

                _pluginType = ItemFunc.DetermineItemType(item.InternalName, _type, _followerType, item.SNOID);
                if (item.ItemDropType.HasValue)
                    _pluginBase = ItemFunc.DetermineBaseItemType(item.ItemDropType.Value);
                else
                    _pluginBase = ItemFunc.DetermineBaseItemType(item.InternalName, item.SNOID);

                _isStackable = ItemFunc.DetermineIsStackable(_pluginType, item.SNOID);

                if (!_isStackable)
                    _isTwoSlot = ItemFunc.DetermineIsTwoSlot(_pluginType);
            }
            catch (Exception ex)
            {
                Logger.Write(LogLevel.Items,
                    String.Format("Failed to create balance data for item {0}", item.DebugStringSimple));

            }
        }
Example #25
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);
        }
Example #26
0
        internal static RunStatus StashUpdate(object ret)
        {
            if (FunkyGame.GameIsInvalid)
            {
                ActionsChecked = false;
                FunkyTownRunPlugin.DBLog.InfoFormat("[Funky] Town Run Behavior Failed! (Not In Game/Invalid Actor/misc)");
                return(RunStatus.Failure);
            }

            if (!bUpdatedStashMap)
            {
                // 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)
                    {
                        //StashedItems.Add(new CacheACDItem(tempitem));
                        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
                        PluginItemTypes tempItemType = ItemFunc.DetermineItemType(tempitem.InternalName, tempitem.ItemType, tempitem.FollowerSpecialType, tempitem.ActorSNO);

                        if (ItemFunc.DetermineIsTwoSlot(tempItemType) && inventoryRow != 19 && inventoryRow != 9 && inventoryRow != 29 && inventoryRow != 39 && inventoryRow != 49)
                        {
                            GilesStashSlotBlocked[inventoryColumn, inventoryRow + 1] = true;
                        }
                        else if (ItemFunc.DetermineIsTwoSlot(tempItemType) && (inventoryRow == 19 || inventoryRow == 9 || inventoryRow == 29 || inventoryRow == 39 || inventoryRow == 49))
                        {
                            FunkyTownRunPlugin.DBLog.DebugFormat("GSError: DemonBuddy thinks this item is 2 slot even though it's at bottom row of a stash page: " + tempitem.Name + " [" + tempitem.InternalName +
                                                                 "] type=" + tempItemType.ToString() + " @ slot " + (inventoryRow + 1).ToString(CultureInfo.InvariantCulture) + "/" +
                                                                 (inventoryColumn + 1).ToString(CultureInfo.InvariantCulture));
                        }
                    }
                }                 // Loop through all stash items

                bUpdatedStashMap = true;
            }             // Need to update the stash map?

            return(RunStatus.Success);
        }
Example #27
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.");
            }
        }
Example #28
0
        internal static bool PickupItemValidation(CacheItem item)
        {
            //if (FunkyTownRunPlugin.ItemRulesEval != null)
            //{
            //	Interpreter.InterpreterAction action = FunkyTownRunPlugin.ItemRulesEval.checkPickUpItem(item.DynamicID.Value, item.BalanceData.thisItemType, item.ref_DiaItem.Name, item.InternalName, item.Itemquality.Value, item.BalanceData.iThisItemLevel, item.BalanceData.bThisOneHand, item.BalanceData.bThisTwoHand, item.BalanceID.Value, ItemEvaluationType.PickUp);
            //	if (action== Interpreter.InterpreterAction.PICKUP)
            //	{
            //		return true;
            //	}
            //}


            // Calculate giles item types and base types etc.
            PluginItemTypes     thisPluginItemType = PluginItemTypes.Unknown;
            PluginBaseItemTypes thisGilesBaseType  = PluginBaseItemTypes.Unknown;

            if (item.BalanceID.HasValue && item.BalanceData != null)
            {
                thisPluginItemType = item.BalanceData.PluginType;
                thisGilesBaseType  = item.BalanceData.PluginBase;
            }
            else
            {
                thisPluginItemType = ItemFunc.DetermineItemType(item.InternalName, ItemType.Unknown, FollowerType.None,
                                                                item.SNOID);
                thisGilesBaseType = ItemFunc.DetermineBaseType(thisPluginItemType);
            }


            if (thisPluginItemType == PluginItemTypes.MiscBook)
            {
                return(FunkyBaseExtension.Settings.Loot.ExpBooks);
            }

            if (thisPluginItemType == PluginItemTypes.RamaladnisGift)
            {
                return(true);
            }

            // Error logging for DemonBuddy item mis-reading
            ItemType gilesDBItemType = ItemFunc.PluginItemTypeToDBItemType(thisPluginItemType);

            if (item.BalanceID.HasValue && item.BalanceData != null && gilesDBItemType != item.BalanceData.Type)
            {
                Logger.DBLog.InfoFormat("GSError: Item type mis-match detected: Item Internal=" + item.InternalName + ". DemonBuddy ItemType thinks item type is=" + item.BalanceData.Type + ". Giles thinks item type is=" +
                                        gilesDBItemType + ". [pickup]", true);
            }

            switch (thisGilesBaseType)
            {
            case PluginBaseItemTypes.WeaponTwoHand:
            case PluginBaseItemTypes.WeaponOneHand:
            case PluginBaseItemTypes.WeaponRange:
            case PluginBaseItemTypes.Armor:
            case PluginBaseItemTypes.Offhand:
            case PluginBaseItemTypes.Jewelry:
            case PluginBaseItemTypes.FollowerItem:

                if (FunkyBaseExtension.Settings.Loot.PickupWhiteItems == 1 &&
                    FunkyBaseExtension.Settings.Loot.PickupMagicItems == 1 &&
                    FunkyBaseExtension.Settings.Loot.PickupRareItems == 1 &&
                    FunkyBaseExtension.Settings.Loot.PickupLegendaryItems == 1)
                {
                    return(true);
                }

                if (item.Itemquality.HasValue && item.BalanceID.HasValue && item.BalanceData != null)
                {
                    switch (item.Itemquality.Value)
                    {
                    case ItemQuality.Inferior:
                    case ItemQuality.Normal:
                    case ItemQuality.Superior:
                        return(FunkyBaseExtension.Settings.Loot.PickupWhiteItems > 0 && (item.BalanceData.ItemLevel >= FunkyBaseExtension.Settings.Loot.PickupWhiteItems));

                    case ItemQuality.Magic1:
                    case ItemQuality.Magic2:
                    case ItemQuality.Magic3:
                        return(FunkyBaseExtension.Settings.Loot.PickupMagicItems > 0 && (item.BalanceData.ItemLevel >= FunkyBaseExtension.Settings.Loot.PickupMagicItems));

                    case ItemQuality.Rare4:
                    case ItemQuality.Rare5:
                    case ItemQuality.Rare6:
                        return(FunkyBaseExtension.Settings.Loot.PickupRareItems > 0 && (item.BalanceData.ItemLevel >= FunkyBaseExtension.Settings.Loot.PickupRareItems));

                    case ItemQuality.Legendary:
                        return(FunkyBaseExtension.Settings.Loot.PickupLegendaryItems > 0 && (item.BalanceData.ItemLevel >= FunkyBaseExtension.Settings.Loot.PickupLegendaryItems));
                    }
                }

                return(false);

            case PluginBaseItemTypes.Gem:
                if (thisPluginItemType == PluginItemTypes.LegendaryGem)
                {
                    return(true);
                }

                GemQualityTypes qualityType  = ItemFunc.ReturnGemQualityType(item.SNOID, item.BalanceData != null?item.BalanceData.ItemLevel:-1);
                int             qualityLevel = (int)qualityType;

                if (qualityLevel < FunkyBaseExtension.Settings.Loot.MinimumGemItemLevel ||
                    (thisPluginItemType == PluginItemTypes.Ruby && !FunkyBaseExtension.Settings.Loot.PickupGems[0]) ||
                    (thisPluginItemType == PluginItemTypes.Emerald && !FunkyBaseExtension.Settings.Loot.PickupGems[1]) ||
                    (thisPluginItemType == PluginItemTypes.Amethyst && !FunkyBaseExtension.Settings.Loot.PickupGems[2]) ||
                    (thisPluginItemType == PluginItemTypes.Topaz && !FunkyBaseExtension.Settings.Loot.PickupGems[3]) ||
                    (thisPluginItemType == PluginItemTypes.Diamond && !FunkyBaseExtension.Settings.Loot.PickupGemDiamond))
                {
                    return(false);
                }
                break;

            case PluginBaseItemTypes.Misc:
                // Note; Infernal keys are misc, so should be picked up here - we aren't filtering them out, so should default to true at the end of this function
                if (thisPluginItemType == PluginItemTypes.CraftingMaterial)
                {
                    return(FunkyBaseExtension.Settings.Loot.PickupCraftMaterials);
                }
                if (thisPluginItemType == PluginItemTypes.LegendaryCraftingMaterial)
                {
                    return(true);
                }

                if (thisPluginItemType == PluginItemTypes.CraftingPlan)
                {
                    if (!FunkyBaseExtension.Settings.Loot.PickupCraftPlans)
                    {
                        return(false);
                    }

                    if (item.BalanceID.HasValue && item.BalanceData != null)
                    {
                        if (item.BalanceData.IsBlacksmithPlanSixProperties && !FunkyBaseExtension.Settings.Loot.PickupBlacksmithPlanSix)
                        {
                            return(false);
                        }
                        if (item.BalanceData.IsBlacksmithPlanFiveProperties && !FunkyBaseExtension.Settings.Loot.PickupBlacksmithPlanFive)
                        {
                            return(false);
                        }
                        if (item.BalanceData.IsBlacksmithPlanFourProperties && !FunkyBaseExtension.Settings.Loot.PickupBlacksmithPlanFour)
                        {
                            return(false);
                        }

                        if (item.BalanceData.IsBlacksmithPlanArchonSpaulders && !FunkyBaseExtension.Settings.Loot.PickupBlacksmithPlanArchonSpaulders)
                        {
                            return(false);
                        }
                        if (item.BalanceData.IsBlacksmithPlanArchonGauntlets && !FunkyBaseExtension.Settings.Loot.PickupBlacksmithPlanArchonGauntlets)
                        {
                            return(false);
                        }
                        if (item.BalanceData.IsBlacksmithPlanRazorspikes && !FunkyBaseExtension.Settings.Loot.PickupBlacksmithPlanRazorspikes)
                        {
                            return(false);
                        }


                        if (item.BalanceData.IsJewelcraftDesignAmulet && !FunkyBaseExtension.Settings.Loot.PickupJewelerDesignAmulet)
                        {
                            return(false);
                        }
                        if (item.BalanceData.IsJewelcraftDesignFlawlessStarGem && !FunkyBaseExtension.Settings.Loot.PickupJewelerDesignFlawlessStar)
                        {
                            return(false);
                        }
                        if (item.BalanceData.IsJewelcraftDesignMarquiseGem && !FunkyBaseExtension.Settings.Loot.PickupJewelerDesignMarquise)
                        {
                            return(false);
                        }
                        if (item.BalanceData.IsJewelcraftDesignPerfectStarGem && !FunkyBaseExtension.Settings.Loot.PickupJewelerDesignPerfectStar)
                        {
                            return(false);
                        }
                        if (item.BalanceData.IsJewelcraftDesignRadiantStarGem && !FunkyBaseExtension.Settings.Loot.PickupJewelerDesignRadiantStar)
                        {
                            return(false);
                        }
                    }
                }

                if (thisPluginItemType == PluginItemTypes.InfernalKey)
                {
                    return(FunkyBaseExtension.Settings.Loot.PickupInfernalKeys);
                }

                if (thisPluginItemType == PluginItemTypes.KeyStone)
                {
                    return(FunkyBaseExtension.Settings.Loot.PickupKeystoneFragments);
                }

                if (thisPluginItemType == PluginItemTypes.BloodShard)
                {
                    return(Backpack.GetBloodShardCount() < 500);
                }

                // Potion filtering
                if (thisPluginItemType == PluginItemTypes.HealthPotion || thisPluginItemType == PluginItemTypes.LegendaryHealthPotion)
                {
                    PotionTypes potionType = ItemFunc.ReturnPotionType(item.SNOID);
                    if (potionType == PotionTypes.Regular)
                    {
                        if (FunkyBaseExtension.Settings.Loot.MaximumHealthPotions <= 0)
                        {
                            return(false);
                        }


                        var BestPotionToUse = Backpack.ReturnBestPotionToUse();
                        if (BestPotionToUse == null)
                        {
                            return(true);
                        }

                        var Potions = Backpack.ReturnRegularPotions();
                        if (Potions.Sum(potions => potions.ThisItemStackQuantity) >= FunkyBaseExtension.Settings.Loot.MaximumHealthPotions)
                        {
                            return(false);
                        }
                    }
                }


                break;

            case PluginBaseItemTypes.HealthGlobe:
                return(false);

            case PluginBaseItemTypes.Unknown:
                return(false);

            default:
                return(false);
            }             // Switch giles base item type
            // Didn't cancel it, so default to true!
            return(true);
        }