Пример #1
0
        public TrackedItem(ACDItem item)
        {
            Name                          = item.Name;
            InternalName                  = item.InternalName;
            SNO                           = item.ActorSNO;
            BalanceId                     = item.GameBalanceId;
            Gold                          = item.Gold;
            Level                         = item.Level;
            StackQuantity                 = item.ItemStackQuantity;
            FollowerType                  = item.FollowerSpecialType;
            Quality                       = item.ItemQualityLevel;
            OneHanded                     = item.IsOneHand;
            IsUnidentified                = item.IsUnidentified;
            Type                          = item.ItemType;
            DyeType                       = item.DyeType;
            IsPotion                      = item.IsPotion;
            invRow                        = item.InventoryRow;
            invCol                        = item.InventoryColumn;
            IsVendorBought                = item.IsVendorBought;
            InventorySlot                 = item.InventorySlot;
            IsArmor                       = item.IsArmor;
            IsCrafted                     = item.IsCrafted;
            IsCraftingPage                = item.IsCraftingPage;
            IsCraftingReagent             = item.IsCraftingReagent;
            IsElite                       = item.IsElite;
            IsEquipped                    = item.IsEquipped;
            IsGem                         = item.IsGem;
            IsMiscItem                    = item.IsMiscItem;
            IsRare                        = item.IsRare;
            IsTwoHand                     = item.IsTwoHand;
            IsTwoSquareItem               = item.IsTwoSquareItem;
            IsUnique                      = item.IsUnique;
            RequiredLevel                 = item.RequiredLevel;
            ItemLevelRequirementReduction = item.ItemLevelRequirementReduction;
            MaxStackCount                 = item.MaxStackCount;
            MaxDurability                 = item.MaxDurability;
            NumSockets                    = item.NumSockets;
            GemQuality                    = item.GemQuality;
            BaseType                      = item.ItemBaseType;
            NumSocketsFilled              = item.NumSocketsFilled;
            ItemStats thesestats = item.Stats;

            ItemStats = new ItemProperties(thesestats);
        }
Пример #2
0
        bool validateOtherPlayerAndItem(IRocketPlayer caller, string playername, out ItemStats i, out UnturnedPlayer p)
        {
            p = PlayerHelper.GetPlayer(playername);
            i = default(ItemStats);

            if (p == null)
            {
                ChatHelper.SendTranslation(caller, Color.red, "noplayer");
                return(false);
            }

            i = ItemHelper.GetItemStatsFromAsset(p.Player.equipment.asset);
            if (i.itemName == "NULL")
            {
                ChatHelper.SendTranslation(caller, Color.red, "no_held_item_other");
                return(false);
            }
            return(true);
        }
Пример #3
0
        public void ParseShouldCallGetStatDataOnStatDataService()
        {
            string[] itemStringLines = this.itemStringBuilder
                                       .WithType("Oriath's Virtue's Eye")
                                       .WithItemLevel(73)
                                       .WithItemStat("Drops additional Currency Items", StatCategory.Monster)
                                       .WithDescription(Resources.OrganItemDescriptor)
                                       .BuildLines();

            ItemStats result = this.organItemStatsParser.Parse(itemStringLines, false);

            Assert.That(result.AllStats, Has.Count.EqualTo(1));
            Assert.That(result.MonsterStats, Has.Count.EqualTo(1));

            foreach (ItemStat stat in result.MonsterStats)
            {
                this.statsDataServiceMock.Verify(x => x.GetStatData(stat.Text, false, StatCategory.Monster.GetDisplayName()));
            }
        }
        public void ParseShouldParseStatText(StatCategory statCategory, string statText, string expected)
        {
            string[] itemStringLines = this.itemStringBuilder
                                       .WithName("Titan Greaves")
                                       .WithItemLevel(75)
                                       .WithItemStat(statText, statCategory)
                                       .BuildLines();

            this.statsDataServiceMock.Setup(x => x.GetStatData(It.IsAny <string>(), It.IsAny <bool>(), It.IsAny <string[]>()))
            .Returns(new StatData());

            ItemStats result = this.itemStatsParser.Parse(itemStringLines, false);

            Assert.That(result.AllStats, Has.Count.EqualTo(1));

            ItemStat itemStat = result.AllStats.First();

            Assert.That(itemStat.Text, Is.EqualTo(expected));
        }
Пример #5
0
        static void LootItems(Character character)
        {
            InEnviromentItem item = null;

            foreach (InEnviromentItem itemIter in CurrentEnvironment.environment.items)
            {
                if (!character.inventory.full(itemIter.id))
                {
                    ItemStats itemStats = Stats.GetItemStats(itemIter.id);

                    if (itemStats.type == ItemStats.ItemType.useableItem && itemStats.instantUse && !character.canUseItem(itemIter.id))
                    {
                        Audio.playSound("selectx");
                    }
                    else
                    {
                        item = itemIter;
                    }
                }
            }

            if (item == null)
            {
                return;
            }

            if (NetVerk.state == OnlineState.offline || NetVerk.state == OnlineState.server)
            {
                if (NetVerk.state == OnlineState.server)
                {
                    OnlineMessages.Add(OnlineMessageType.itemTaken, (byte)character.playerNo, (short)item.uniqueID);
                }

                character.pickupItem(item);
            }
            else
            {
                OnlineMessages.Add(OnlineMessageType.itemTaken, (byte)character.playerNo, item);
            }

            character.showEncumbranceCounter = 180;
        }
Пример #6
0
        // Example: "item id:20000027"
        private static void ProcessItemCommand(GameSession session, string command)
        {
            Dictionary <string, string> config = command.ToMap();

            int.TryParse(config.GetValueOrDefault("id", "20000027"), out int itemId);
            if (!ItemMetadataStorage.IsValid(itemId))
            {
                session.SendNotice("Invalid item: " + itemId);
                return;
            }

            // Add some bonus attributes to equips and pets
            ItemStats stats = new ItemStats();

            if (ItemMetadataStorage.GetTab(itemId) == InventoryTab.Gear ||
                ItemMetadataStorage.GetTab(itemId) == InventoryTab.Pets)
            {
                Random rng = new Random();
                stats.BonusAttributes.Add(ItemStat.Of((ItemAttribute)rng.Next(35), 0.01f));
                stats.BonusAttributes.Add(ItemStat.Of((ItemAttribute)rng.Next(35), 0.01f));
            }

            Item item = new Item(itemId)
            {
                Uid          = Environment.TickCount64,
                CreationTime = DateTimeOffset.UtcNow.ToUnixTimeSeconds(),
                TransferFlag = TransferFlag.Splitable | TransferFlag.Tradeable,
                Stats        = stats
            };

            int.TryParse(config.GetValueOrDefault("rarity", "5"), out item.Rarity);
            int.TryParse(config.GetValueOrDefault("amount", "1"), out item.Amount);

            // Simulate looting item
            InventoryController.Add(session, item, true);

            /*if (session.Player.Inventory.Add(item))
             * {
             *  session.Send(ItemInventoryPacket.Add(item));
             *  session.Send(ItemInventoryPacket.MarkItemNew(item, item.Amount));
             * }*/
        }
Пример #7
0
 private void RefreshStationSaleItems()
 {
     foreach (KeyValuePair <string, DockableStationData> station in GameManager.Inst.WorldManager.DockableStationDatas)
     {
         foreach (SaleItem item in station.Value.TraderSaleItems)
         {
             //update quantity
             Debug.Log("loading item " + item.ItemID + " in station " + station.Value.StationID);
             ItemStats stats = GameManager.Inst.ItemManager.GetItemStats(item.ItemID);
             if (stats.Type == ItemType.Commodity)
             {
                 item.Quantity = UnityEngine.Random.Range(10, 500);
             }
             else
             {
                 item.Quantity = 1;
             }
         }
     }
 }
Пример #8
0
    public Dictionary <string, ItemStats> LoadAllItemStats()
    {
        Dictionary <string, ItemStats> items = new Dictionary <string, ItemStats>();
        DirectoryInfo topDirInfo             = new DirectoryInfo(this.Path + "Items/");

        DirectoryInfo [] dirInfos = topDirInfo.GetDirectories();
        foreach (DirectoryInfo dirInfo in dirInfos)
        {
            FileInfo [] infos = dirInfo.GetFiles("*.json");
            foreach (FileInfo info in infos)
            {
                ItemStats stats = LoadItemStatsJson(dirInfo.Name + "/" + info.Name);
                items.Add(stats.ID, stats);

                Debug.Log(stats.ID + " " + stats.Attributes[0].Name + " " + stats.Attributes[0].SerValue);
            }
        }

        return(items);
    }
Пример #9
0
        public void ParseShouldParseStatWithCorrectText()
        {
            const string expected = "Drops additional Currency Items";

            string[] itemStringLines = this.itemStringBuilder
                                       .WithType("Oriath's Virtue's Eye")
                                       .WithItemLevel(73)
                                       .WithItemStat(expected, StatCategory.Monster)
                                       .WithDescription(Resources.OrganItemDescriptor)
                                       .BuildLines();

            ItemStats result = this.organItemStatsParser.Parse(itemStringLines, false);

            Assert.That(result.AllStats, Has.Count.EqualTo(1));
            Assert.That(result.MonsterStats, Has.Count.EqualTo(1));

            ItemStat stat = result.MonsterStats.First();

            Assert.That(stat.Text, Is.EqualTo(expected));
        }
Пример #10
0
        private void LoadItemStats()
        {
            DataTable itemStats = null;

            using (DatabaseClient dbClient = Program.DatabaseManager.GetClient())
            {
                itemStats = dbClient.ReadDataTable("SELECT  *FROM ItemStats");
            }
            foreach (DataRow row in itemStats.Rows)
            {
                string   Iteminx = row["itemIndex"].ToString();
                ItemInfo Iteminf;
                if (!this.ItemsByName.TryGetValue(Iteminx, out Iteminf))
                {
                    Log.WriteLine(LogLevel.Warn, "Can not Find item {0} by ItemStatLoad", Iteminx);
                    continue;
                }
                Iteminf.Stats = ItemStats.LoadItemStatsFromDatabase(row);
            }
        }
Пример #11
0
        public override void ApplyToItem(ItemStats stats)
        {
            base.ApplyToItem(stats);

            var wStats = stats as WeaponStats;

            if (this.AttackSpeed != null)
            {
                wStats.AttackSpeed = (float)this.AttackSpeed;
            }

            if (this.Impact != null)
            {
                wStats.Impact = (float)this.Impact;
            }

            if (this.BaseDamage != null)
            {
                wStats.BaseDamage = SL_Damage.GetDamageList(this.BaseDamage);

                // fix for m_activeBaseDamage
                var weapon = wStats.GetComponent <Weapon>();
                At.SetField(weapon, "m_activeBaseDamage", wStats.BaseDamage.Clone());
                At.SetField(weapon, "m_baseDamage", wStats.BaseDamage.Clone());
            }

            if (this.StamCost != null)
            {
                wStats.StamCost = (float)this.StamCost;
            }

            if (AutoGenerateAttackData || this.Attacks == null || this.Attacks.Length < 1)
            {
                // SL.Log("Generating AttackData automatically");
                wStats.Attacks = GetScaledAttackData(wStats.GetComponent <Weapon>());
            }
            else
            {
                wStats.Attacks = Attacks;
            }
        }
Пример #12
0
        public virtual void ApplyToItem(ItemStats stats)
        {
            //set base value
            if (this.BaseValue != null)
            {
                At.SetField(stats, "m_baseValue", (int)this.BaseValue);
            }

            //set raw weight
            if (this.RawWeight != null)
            {
                At.SetField(stats, "m_rawWeight", (float)this.RawWeight);
            }

            //max durability
            if (this.MaxDurability != null)
            {
                At.SetField(stats, "m_baseMaxDurability", (int)this.MaxDurability);
                stats.StartingDurability = (int)this.MaxDurability;
            }
        }
Пример #13
0
 public void RefreshSupplyLevel(DockableStationData stationData)
 {
     //supply level for commodity slowly grows when there's no econ events affecting it
     //at the speed of DemandNormalizeSpeed
     //max at 4 for now
     foreach (SaleItem saleItem in stationData.TraderSaleItems)
     {
         ItemStats stats = GameManager.Inst.ItemManager.GetItemStats(saleItem.ItemID);
         if (stats.Type == ItemType.Commodity)
         {
             if (saleItem.SupplyLevel < 1)
             {
                 saleItem.SupplyLevel += stationData.DemandNormalizeSpeed;
             }
             else
             {
                 saleItem.SupplyLevel = saleItem.SupplyLevel + stationData.DemandNormalizeSpeed * Mathf.Clamp01(1 - (saleItem.SupplyLevel - 1) / 2f);
             }
         }
     }
 }
Пример #14
0
        static bool ItemStats_Effectiveness_Pre(ItemStats __instance, ref float __result)
        {
            #region quit
            if (!_linearEffectiveness || __instance.m_item.IsNot <Equipment>())
            {
                return(true);
            }
            #endregion

            float ratio = __instance.m_item.DurabilityRatio;
            if (ratio > 0)
            {
                __result = __instance.m_item.DurabilityRatio.MapFrom01(_minNonBrokenEffectiveness / 100f, 1f);
            }
            else
            {
                __result = _brokenEffectiveness / 100f;
            }

            return(false);
        }
Пример #15
0
        public IActionResult Create(string type, string itemName, string speed, string damageDie, string damageType, string attackRange)
        {
            User user = IdCheck.Check(HttpContext.Session.Id);

            if (user == null)
            {
                return(RedirectToAction("Index", "User", new { errorcode = 1 }));
            }
            ItemStats item = new ItemStats();

            item.Type        = type;
            item.Name        = itemName;
            item.Speed       = int.Parse(speed);
            item.DamageDie   = int.Parse(damageDie);
            item.DamageType  = damageType;
            item.AttackRange = int.Parse(attackRange);

            string id = DB.CreateItem(item);

            return(RedirectToAction("Show", new { id = id }));
        }
Пример #16
0
    public Item(ItemStats stats)
    {
        //create an item based on a stats template
        ID          = stats.ID;
        DisplayName = stats.DisplayName;
        Description = stats.Description;
        PrefabName  = stats.PrefabName;
        Type        = stats.Type;
        CargoUnits  = stats.CargoUnits;
        Health      = 1;
        BasePrice   = stats.BasePrice;
        Attributes  = new List <ItemAttribute>();
        foreach (ItemAttribute attribute in stats.Attributes)
        {
            ItemAttribute newAttribute = new ItemAttribute(attribute.Name, attribute.SerValue, attribute.IsHidden, attribute.Unit);
            Attributes.Add(newAttribute);
        }

        AttributeIndex = new Dictionary <string, int>();
        BuildIndex();
    }
Пример #17
0
        public override void SerializeStats(ItemStats stats, DM_ItemStats holder)
        {
            base.SerializeStats(stats, holder);

            var template = holder as DM_WeaponStats;

            var wStats = stats as WeaponStats;

            if (wStats.Attacks != null && wStats.Attacks.Length == 5)
            {
                var weapon = stats.GetComponent <Weapon>();
                CheckAttackDataMultipliers(weapon, wStats.Attacks);
            }

            template.Attacks     = wStats.Attacks;
            template.AttackSpeed = wStats.AttackSpeed;
            template.Impact      = wStats.Impact;
            template.StamCost    = wStats.StamCost;

            template.BaseDamage = Damages.ParseDamageList(wStats.BaseDamage);
        }
Пример #18
0
 public static void BaseInit(Item __instance)
 {
     try
     {
         if (__instance.ItemID == (int)eItemIDs.FlintAndSteel)
         {
             ItemStats m_stats = (ItemStats)AccessTools.Field(typeof(Item), "m_stats").GetValue(__instance);
             if (__instance.CurrentDurability == -1)
             {
                 AccessTools.Field(typeof(Item), "m_currentDurability").SetValue(__instance, WorkInProgress.ItemDurabilities[eItemIDs.FlintAndSteel].MaxDurability);
                 WorkInProgress.Instance.MyLogger.LogDebug($"BaseInit[{__instance.name}: NewDurability={__instance.CurrentDurability}");
             }
             if (m_stats && m_stats.MaxDurability == -1)
             {
                 AccessTools.Field(typeof(ItemStats), "m_baseMaxDurability").SetValue(m_stats, WorkInProgress.ItemDurabilities[eItemIDs.FlintAndSteel].MaxDurability);
             }
         }
         //if (__instance.ItemID == (int)eItemIDs.BedrollKit)
         //{
         //    ItemStats m_stats = (ItemStats)AccessTools.Field(typeof(Item), "m_stats").GetValue(__instance);
         //    AccessTools.Field(typeof(Item), "m_currentDurability").SetValue(__instance, WorkInProgress.ItemDurabilities[eItemIDs.BedrollKit].MaxDurability);
         //}
         //if (__instance.ItemID == 5000010) // Simple Tent
         //{
         //    ItemStats m_stats = (ItemStats)AccessTools.Field(typeof(Item), "m_stats").GetValue(__instance);
         //    AccessTools.Field(typeof(ItemStats), "m_baseMaxDurability").SetValue(m_stats, 10);
         //    if (__instance.CurrentDurability < 0)
         //    {
         //        AccessTools.Field(typeof(Item), "m_currentDurability").SetValue(__instance, 2);
         //    }
         //    __instance.BehaviorOnNoDurability = Item.BehaviorOnNoDurabilityType.DoNothing;
         //}
         // Sacs ?
     }
     catch (Exception ex)
     {
         WorkInProgress.Instance.MyLogger.LogError("BaseInit: " + ex.Message);
     }
     //return true;
 }
    public void EquipItem(ItemStats item)
    {
        if (item == null)
        {
            return;
        }
        EquipSlotVisuals relatedVisuals = visualsByType[(int)item.itemSlot];

        switch (item.itemSlot)
        {
        case SlotType.Head: playerData.helmetSlotAdress = item.itemAdress;
            break;

        case SlotType.Chest: playerData.chestArmorSlotAdress = item.itemAdress;
            break;

        case SlotType.Hands: playerData.gauntletSlotAdress = item.itemAdress;
            break;

        case SlotType.Legs: playerData.legArmorSlotAdress = item.itemAdress;
            break;

        case SlotType.Feet: playerData.footArmorSlotAdress = item.itemAdress;
            break;

        case SlotType.Weapon: playerData.weaponSlotAdress = item.itemAdress;
            break;
        }

        relatedVisuals.itemIcon.sprite = item.menuSprite;
        //Displays the items stats on the main equip screen
        SetSlotIcons(relatedVisuals.healthIndicator, item.healthMod, positiveHealthSprite, negativeHealthSprite);
        SetSlotIcons(relatedVisuals.armorIndicator, item.armorMod, armorSprite, null);
        SetSlotIcons(relatedVisuals.speedIndicator, Mathf.FloorToInt(item.speedMod * 10), positiveSpeedSprite, negativeSpeedSprite);
        SetSlotIcons(relatedVisuals.parryTimeIndicator, Mathf.FloorToInt(item.staggerMod * 10), positiveParryTimeSprite, negativeParryTimeSprite);
        SetSlotIcons(relatedVisuals.damageIndicator, item.damageMod, positiveDamageSprite, negativeDamageSprite);
        playerVisuals.DisplayEquipment(item);
        //Save Selection to the Savefile and return to the main equip screen.
        playerData.SaveDataToPrefs();
    }
Пример #20
0
 public bool Add(ItemStats i)
 {
     bool added = plated.Add(i);
     if (added)
     {
         UpdateVisuals(i.name);
         for (int index = 0; index < itemSprites.Length; index++)
         {
             if (itemSprites[index] == null)
             {
                 itemSprites[index] = Instantiate((GameObject)Resources.Load("Icons/" + i.name + "Icon"), canvas.transform).GetComponent<Image>();
                 itemSprites[index].transform.position = Camera.main.WorldToScreenPoint(transform.position + (itemUIPositions[index]));
                 break;
             }
         }
         return true;
     }
     else
     {
         return false;
     }
 }
Пример #21
0
        public void ParseShouldReturnItemStatWithoutValueIfTextDoesNotContainPlaceholders(StatCategory statCategory, string statText, string textWithPlaceholders)
        {
            string[] itemStringLines = this.itemStringBuilder
                                       .WithName("Titan Greaves")
                                       .WithItemLevel(75)
                                       .WithItemStat(statText, statCategory)
                                       .BuildLines();

            this.statsDataServiceMock.Setup(x => x.GetStatData(It.IsAny <string>(), It.IsAny <bool>(), It.IsAny <string[]>()))
            .Returns(new StatData
            {
                Text = textWithPlaceholders
            });

            ItemStats result = this.itemStatsParser.Parse(itemStringLines, false);

            Assert.That(result.AllStats, Has.Count.EqualTo(1));

            ItemStat itemStat = result.AllStats.First();

            Assert.That(itemStat.GetType(), Is.EqualTo(typeof(ItemStat)));
        }
Пример #22
0
        private List <ItemStats> GenerateRandomStats(int level, int maxAmount, GameEnums.Quality quality)
        {
            //the list to store the stats
            var stats = new List <ItemStats>();

            //this item will have between 1 and maxamount stats attached
            var randStatsAmount = Random.Range(1, maxAmount);

            var prevAttribute = GameEnums.AttributesType.MAX;
            var attributeType = GameEnums.AttributesType.MAX;

            //generate the stats we need
            for (var i = 0; i < randStatsAmount; i++)
            {
                attributeType = (GameEnums.AttributesType)Random.Range(0, (int)GameEnums.AttributesType.MAX);

                //make sure we do not duplicate attributes
                while (attributeType == prevAttribute)
                {
                    attributeType = (GameEnums.AttributesType)Random.Range(0, (int)GameEnums.AttributesType.MAX);
                }

                prevAttribute = attributeType;

                var modifier = (GameEnums.Modifier)Random.Range(0, (int)GameEnums.Modifier.MAX);

                var value = modifier == GameEnums.Modifier.PERCENTAGE
                    ? GenerateMultiplier(level, quality)
                    : Random.Range(1, level);

                var attr = new AttributeType(value, attributeType);

                var itStats = new ItemStats(attr, modifier);

                stats.Add(itStats);
            }

            return(stats);
        }
Пример #23
0
        public void ParseShouldReturnSingleValueItemStatIfTextWithPlaceholdersContainsOnePlaceholder()
        {
            string[] itemStringLines = this.itemStringBuilder
                                       .WithName("Titan Greaves")
                                       .WithItemLevel(75)
                                       .WithItemStat("+25% to Cold Resistance", StatCategory.Explicit)
                                       .BuildLines();

            this.statsDataServiceMock.Setup(x => x.GetStatData(It.IsAny <string>(), It.IsAny <bool>(), It.IsAny <string[]>()))
            .Returns(new StatData
            {
                Text = "#% to Cold Resistance"
            });

            ItemStats result = this.itemStatsParser.Parse(itemStringLines, false);

            Assert.That(result.AllStats, Has.Count.EqualTo(1));

            ItemStat itemStat = result.AllStats.First();

            Assert.IsInstanceOf <SingleValueItemStat>(itemStat);
        }
Пример #24
0
        public void ParseShouldReturnMinMaxValueItemStatIfTextWithPlaceholderContainsTwoPlaceholders()
        {
            string[] itemStringLines = this.itemStringBuilder
                                       .WithName("Titan Greaves")
                                       .WithItemLevel(75)
                                       .WithItemStat("Minions deal 1 to 15 additional Physical Damage", StatCategory.Explicit)
                                       .BuildLines();

            this.statsDataServiceMock.Setup(x => x.GetStatData(It.IsAny <string>(), It.IsAny <bool>(), It.IsAny <string[]>()))
            .Returns(new StatData
            {
                Text = "Minions deal # to # additional Physical Damage"
            });

            ItemStats result = this.itemStatsParser.Parse(itemStringLines, false);

            Assert.That(result.AllStats, Has.Count.EqualTo(1));

            ItemStat itemStat = result.AllStats.First();

            Assert.IsInstanceOf <MinMaxValueItemStat>(itemStat);
        }
Пример #25
0
    //public List<object> list;

    private void Start()
    {
        item      = GetComponent <Item>();
        itemStats = item.itemStats;

        // Probably needs rework - Saves time on setting up in editor
        textBox = transform.GetChild(0).gameObject;
        List <TMPro.TextMeshProUGUI> tempList = new List <TMPro.TextMeshProUGUI>();

        foreach (Transform n in textBox.transform)
        {
            tempList.Add(n.gameObject.GetComponent <TMPro.TextMeshProUGUI>());
        }
        nameText   = tempList[0];
        prefixText = tempList[1];
        suffixText = tempList[2];
        tempList.Clear();


        textBox.SetActive(false);
        SetText();
    }
Пример #26
0
    void UpdateInfo()
    {
        if (toolType == TooltipType.Gear)
        {
            UpdateGear();
        }
        else if (toolType == TooltipType.Ability)
        {
            UpdateAbility();
        }

        ItemStats.ForceMeshUpdate();
        Vector2 newSize = new Vector2(ItemStats.textBounds.size.x, ItemStats.textBounds.size.y);

        ItemStats.rectTransform.sizeDelta = newSize * 1.2f; // make it a little bigger for safety
        ItemStats.transform.parent.GetComponent <RectTransform>().sizeDelta = newSize * 1.4f;
        ItemStats.transform.parent.localPosition = Vector3.zero;
        //ItemStats.transform.localPosition = Vector3.zero;
        GetComponent <Image>().rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, newSize.x * 1.5f);
        GetComponent <Image>().rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, newSize.y + (GetComponent <Image>().rectTransform.sizeDelta.y * 0.3f));
        // so sorry
    }
        public override void SerializeStats(ItemStats stats, DM_ItemStats holder)
        {
            base.SerializeStats(stats, holder);

            try
            {
                var item = stats.GetComponent <Item>();

                var eStats = stats as EquipmentStats;
                Cooldown_Reduction = eStats.CooldownReduction;
                Hunger_Affect      = eStats.HungerModifier;
                Thirst_Affect      = eStats.ThirstModifier;
                Fatigue_Affect     = eStats.SleepModifier;

                Impact_Resistance     = eStats.ImpactResistance;
                Damage_Protection     = eStats.GetDamageProtection(DamageType.Types.Physical);
                Stamina_Use_Penalty   = eStats.StaminaUsePenalty;
                Mana_Use_Modifier     = (float)At.GetField(eStats, "m_manaUseModifier");
                Mana_Regen            = eStats.ManaRegenBonus;
                Movement_Penalty      = eStats.MovementPenalty;
                Pouch_Bonus           = eStats.PouchCapacityBonus;
                Heat_Protection       = eStats.HeatProtection;
                Cold_Protection       = eStats.ColdProtection;
                Corruption_Protection = eStats.CorruptionResistance;

                Damage_Bonus      = At.GetField(eStats, "m_damageAttack") as float[];
                Damage_Resistance = At.GetField(eStats, "m_damageResistance") as float[];
                Impact_Bonus      = eStats.ImpactModifier;

                BarrierProtection            = eStats.BarrierProtection;
                GlobalStatusEffectResistance = (float)At.GetField(eStats, "m_baseStatusEffectResistance");
                StaminaRegenModifier         = eStats.StaminaRegenModifier;
            }
            catch (Exception e)
            {
                SL.Log("Exception getting stats of " + stats.name + "\r\n" + e.Message + "\r\n" + e.StackTrace);
            }
        }
    public void RecordStatsWotLK()
    {
        if (ItemType != "Armor" && ItemType != "Weapon")
        {
            return;
        }

        string stats = Lua.LuaDoString <string>($@"
                local itemstats=GetItemStats(""{ItemLink.Replace("\"", "\\\"")}"")
                local stats = """"
                for stat, value in pairs(itemstats) do
                    stats = stats.._G[stat]..""§""..value..""$""
                end
                return stats");

        //Logger.Log("stats -> " + stats);
        if (stats.Length < 1)
        {
            return;
        }

        List <string> statsPairs = stats.Split('$').ToList();

        foreach (string pair in statsPairs)
        {
            if (pair.Length > 0)
            {
                string[] statsPair = pair.Split('§');
                string   statName  = statsPair[0];
                float    statValue = float.Parse(statsPair[1], CultureInfo.InvariantCulture);
                if (!ItemStats.ContainsKey(statName))
                {
                    ItemStats.Add(statName, statValue);
                }
            }
        }
        RecordWeightScore();
    }
Пример #29
0
        private void SaveChanges_Click(object sender, RoutedEventArgs e)
        {
            currentItem = ItemsView.GetCurrentItem();
            string  name        = Name.Text;
            decimal cost        = decimal.Parse(Cost.Text);
            string  description = Description.Text;
            string  itemType    = ItemType.Text;
            string  rarity      = Rarity.Text;
            string  slot        = Slot.Text;

            double attack  = double.Parse(Attack.Text);
            double defence = double.Parse(Defence.Text);

            Item item = context.Items.Find(currentItem.Id);

            item.Cost        = cost;
            item.Name        = name;
            item.Description = description;
            item.ItemType    = (ItemType)Enum.Parse(typeof(ItemType), itemType);
            item.Slot        = (Slot)Enum.Parse(typeof(Slot), slot);
            item.Rarity      = (Rarity)Enum.Parse(typeof(Rarity), rarity);

            ItemStats itemStat = context.ItemStatistics.FirstOrDefault(st => st.Item.Id == currentItem.Id);

            itemStat.Attack  = attack;
            itemStat.Defence = defence;
            item.ItemStats   = itemStat;
            var result = MessageBox.Show("Are you sure you want to edit this item?", "Question",
                                         MessageBoxButton.YesNo, MessageBoxImage.Warning);

            if (result == MessageBoxResult.Yes)
            {
                context.SaveChanges();
            }

            ItemsView.items = ItemService.GetAllItems();
            this.Close();
        }
Пример #30
0
        public static void Remove(Item item)
        {
            using (var context = new RPGHelperContext())
            {
                Item      itemToRemove = context.Items.FirstOrDefault(i => i.Id == item.Id);
                ItemStats itemStats    = context.ItemStatistics.FirstOrDefault(st => st.Item.Id == item.Id);

                if (itemStats != null)
                {
                    context.ItemStatistics.Remove(itemStats);
                    context.SaveChanges();
                }
                else
                {
                    Console.WriteLine("gluposti");
                }
                if (itemToRemove != null)
                {
                    context.Items.Remove(itemToRemove);
                    context.SaveChanges();
                }
            }
        }
Пример #31
0
 /// <summary>
 /// calculates an item score based on info and stats
 /// </summary>
 /// <param name="item">info</param>
 /// <param name="stats">stats</param>
 /// <returns>float score</returns>
 public static float CalcScore(ItemInfo item, ItemStats stats)
 {
     // if it's not a gem or it's a simple gem, just use teh weightset or slots
     if (item.ItemClass != WoWItemClass.Gem || item.GemClass == WoWItemGemClass.Simple)
     {
         return item.BagSlots > 0 ? item.BagSlots : EquipMeSettings.Instance.WeightSet_Current.EvaluateItem(item, stats);
     }
     // this is a dirty f*****g dbc hack
     // look up the gemproperties entry
     var gementry = StyxWoW.Db[ClientDb.GemProperties].GetRow((uint)item.InternalInfo.GemProperties);
     if (gementry == null)
     {
         return 0;
     }
     // get the spell index from the gemproperties dbc
     var spellindex = gementry.GetField<uint>(1);
     // look up the spellitemenchantment by the index
     var spellentry = StyxWoW.Db[ClientDb.SpellItemEnchantment].GetRow(spellindex);
     if (spellentry == null)
     {
         return 0;
     }
     var newstats = stats;
     // for each of the 3 stats (minstats used, not maxstats)
     for (uint statnum = 5; statnum <= 7; statnum++)
     {
         try
         {
             // grab the stat amount
             var amount = spellentry.GetField<int>(statnum);
             if (amount <= 0)
             {
                 continue;
             }
             // grab the stat type and convert it to something that can be looked up in the stats dic below
             var stat = (WoWItemStatType)spellentry.GetField<int>(11);
             var stattype = (StatTypes)Enum.Parse(typeof(StatTypes), stat.ToString());
             if (!newstats.Stats.ContainsKey(stattype))
             {
                 // add it if it doesn't already exist
                 newstats.Stats.Add(stattype, amount);
             }
         }
         catch (Exception) { }
     }
     return EquipMeSettings.Instance.WeightSet_Current.EvaluateItem(item, newstats);
 }
Пример #32
0
 public CachedACDItem(ItemStats stats)
 {
     CacheStats(stats);
 }
Пример #33
0
        public ItemProperties(ItemStats thesestats)
        {
            MaxDamageHoly = thesestats.MaxDamageHoly;
            MinDamageHoly = thesestats.MinDamageHoly;
            HolySkillDamagePercentBonus = thesestats.HolySkillDamagePercentBonus;

            MaxDamageArcane = thesestats.MaxDamageArcane;
            MinDamageArcane = thesestats.MinDamageArcane;
            ArcaneSkillDamagePercentBonus = thesestats.ArcaneSkillDamagePercentBonus;

            MaxDamagePoison = thesestats.MaxDamagePoison;
            MinDamagePoison = thesestats.MinDamagePoison;
            PosionSkillDamagePercentBonus = thesestats.PosionSkillDamagePercentBonus;

            MaxDamageCold = thesestats.MaxDamageCold;
            MinDamageCold = thesestats.MinDamageCold;
            ColdSkillDamagePercentBonus = thesestats.ColdSkillDamagePercentBonus;

            MaxDamageLightning = thesestats.MaxDamageLightning;
            MinDamageLightning = thesestats.MinDamageLightning;
            LightningSkillDamagePercentBonus = thesestats.LightningSkillDamagePercentBonus;

            MaxDamageFire = thesestats.MaxDamageFire;
            MinDamageFire = thesestats.MinDamageFire;
            FireSkillDamagePercentBonus = thesestats.FireSkillDamagePercentBonus;

            WeaponOnHitFearProcChance = thesestats.WeaponOnHitFearProcChance;
            WeaponOnHitBlindProcChance = thesestats.WeaponOnHitBlindProcChance;
            WeaponOnHitFreezeProcChance = thesestats.WeaponOnHitFreezeProcChance;
            WeaponOnHitChillProcChance = thesestats.WeaponOnHitChillProcChance;
            WeaponOnHitImmobilizeProcChance = thesestats.WeaponOnHitImmobilizeProcChance;
            WeaponOnHitKnockbackProcChance = thesestats.WeaponOnHitKnockbackProcChance;
            WeaponOnHitSlowProcChance = thesestats.WeaponOnHitSlowProcChance;
            WeaponOnHitBleedProcChance = thesestats.WeaponOnHitBleedProcChance;

            DamagePercentBonusVsElites = thesestats.DamagePercentBonusVsElites;
            DamagePercentReductionFromElites = thesestats.DamagePercentReductionFromElites;
            DamageReductionPhysicalPercent = thesestats.DamageReductionPhysicalPercent;

            PowerCooldownReductionPercent=thesestats.PowerCooldownReductionPercent;
            ResourceCostReductionPercent = thesestats.ResourceCostReductionPercent;
            SkillDamagePercentBonus=thesestats.SkillDamagePercentBonus;
            OnHitAreaDamageProcChance = thesestats.OnHitAreaDamageProcChance;

            ArmorBonus = thesestats.ArmorBonus;
            Armor=thesestats.Armor;
            ArmorTotal=thesestats.ArmorTotal;

            Level = thesestats.Level;
            ItemLevelRequirementReduction = thesestats.ItemLevelRequirementReduction;

            ArcaneOnCrit = thesestats.ArcaneOnCrit;

            AttackSpeedPercent = thesestats.AttackSpeedPercent;
            AttackSpeedPercentBonus = thesestats.AttackSpeedPercentBonus;

            BlockChance = thesestats.BlockChance;
            BlockChanceBonus = thesestats.BlockChanceBonus;

            CritPercent = thesestats.CritPercent;
            CritDamagePercent = thesestats.CritDamagePercent;
            Dexterity = thesestats.Dexterity;
            ExperienceBonus = thesestats.ExperienceBonus;
            Intelligence = thesestats.Intelligence;

            LifePercent = thesestats.LifePercent;
            LifeOnHit = thesestats.LifeOnHit;
            LifeSteal = thesestats.LifeSteal;
            LifeOnKill=thesestats.LifeOnKill;
            HealthPerSpiritSpent = thesestats.HealthPerSpiritSpent;

            HealthPerSecond = thesestats.HealthPerSecond;
            MagicFind = thesestats.MagicFind;
            GoldFind = thesestats.GoldFind;
            GlobeBonus = thesestats.HealthGlobeBonus;
            MovementSpeed = thesestats.MovementSpeed;
            PickUpRadius = thesestats.PickUpRadius;

            ResistAll = thesestats.ResistAll;
            ResistArcane = thesestats.ResistArcane;
            ResistCold = thesestats.ResistCold;
            ResistFire = thesestats.ResistFire;
            ResistHoly = thesestats.ResistHoly;
            ResistLightning = thesestats.ResistLightning;
            ResistPhysical = thesestats.ResistPhysical;
            ResistPoison = thesestats.ResistPoison;

            MinDamage = thesestats.MinDamage;
            MaxDamage = thesestats.MaxDamage;
            MinDamageElemental = thesestats.MinDamageElemental;
            MaxDamageElemental = thesestats.MaxDamageElemental;

            MaxDiscipline = thesestats.MaxDiscipline;
            MaxMana = thesestats.MaxMana;
            MaxArcanePower = thesestats.MaxArcanePower;
            MaxFury = thesestats.MaxFury;
            MaxSpirit = thesestats.MaxSpirit;

            ManaRegen = thesestats.ManaRegen;
            HatredRegen = thesestats.HatredRegen;

            Thorns = thesestats.Thorns;

            Sockets = thesestats.Sockets;
            SpiritRegen = thesestats.SpiritRegen;
            Strength = thesestats.Strength;
            Vitality = thesestats.Vitality;
            WeaponDamagePerSecond = thesestats.WeaponDamagePerSecond;
            WeaponAttacksPerSecond = thesestats.WeaponAttacksPerSecond;
            WeaponMaxDamage=thesestats.WeaponMaxDamage;
            WeaponMinDamage = thesestats.WeaponMinDamage;
            WeaponDamagePercent = thesestats.WeaponDamagePercent;
        }
Пример #34
0
	// Use this for initialization
	void Awake () {
		instance = this;
		GetComponent<RectTransform> ().localPosition = new Vector3 (999, 999, 999);
	}
Пример #35
0
 public CachedACDItem(ItemStats stats)
 {
     WeaponDamagePerSecond = stats.WeaponDamagePerSecond;
     Dexterity = stats.Dexterity;
     Intelligence = stats.Intelligence;
     Strength = stats.Strength;
     Vitality = stats.Vitality;
     LifePercent = stats.LifePercent;
     LifeOnHit = stats.LifeOnHit;
     LifeSteal = stats.LifeSteal;
     HealthPerSecond = stats.HealthPerSecond;
     MagicFind = stats.MagicFind;
     GoldFind = stats.GoldFind;
     MovementSpeed = stats.MovementSpeed;
     PickUpRadius = stats.PickUpRadius;
     Sockets = stats.Sockets;
     CritPercent = stats.CritPercent;
     CritDamagePercent = stats.CritDamagePercent;
     AttackSpeedPercent = stats.AttackSpeedPercent;
     MinDamage = stats.MinDamage;
     MaxDamage = stats.MaxDamage;
     BlockChance = stats.BlockChance;
     Thorns = stats.Thorns;
     ResistAll = stats.ResistAll;
     ResistArcane = stats.ResistArcane;
     ResistCold = stats.ResistCold;
     ResistFire = stats.ResistFire;
     ResistHoly = stats.ResistHoly;
     ResistLightning = stats.ResistLightning;
     ResistPhysical = stats.ResistPhysical;
     ResistPoison = stats.ResistPoison;
     WeaponDamagePerSecond = stats.WeaponDamagePerSecond;
     ArmorBonus = stats.ArmorBonus;
     MaxDiscipline = stats.MaxDiscipline;
     MaxMana = stats.MaxMana;
     ArcaneOnCrit = stats.ArcaneOnCrit;
     ManaRegen = stats.ManaRegen;
     GlobeBonus = stats.HealthGlobeBonus;
     HatredRegen = stats.HatredRegen;
     MaxFury = stats.MaxFury;
     SpiritRegen = stats.SpiritRegen;
     MaxSpirit = stats.MaxSpirit;
     HealthPerSpiritSpent = stats.HealthPerSpiritSpent;
     MaxArcanePower = stats.MaxArcanePower;
     DamageReductionPhysicalPercent = stats.DamageReductionPhysicalPercent;
     ArmorTotal = stats.ArmorTotal;
     Armor = stats.Armor;
     //FireDamagePercent = stats.FireDamagePercent;
     //LightningDamagePercent = stats.LightningDamagePercent;
     //ColdDamagePercent = stats.ColdDamagePercent;
     //PoisonDamagePercent = stats.PoisonDamagePercent;
     //ArcaneDamagePercent = stats.ArcaneDamagePercent;
     //HolyDamagePercent = stats.HolyDamagePercent;
     HealthGlobeBonus = stats.HealthGlobeBonus;
     WeaponAttacksPerSecond = stats.WeaponAttacksPerSecond;
     WeaponMaxDamage = stats.WeaponMaxDamage;
     WeaponMinDamage = stats.WeaponMinDamage;
 }
        internal static ItemStatsData GetItemStatsDataFromStats(ItemStats stats)
        {
            if (!stats.Item.IsValid)
                return default(ItemStatsData);

            ItemStatsData itemStatsData = new ItemStatsData()
            {
                HatredRegen = stats.HatredRegen,
                MaxDiscipline = stats.MaxDiscipline,
                MaxArcanePower = stats.MaxArcanePower,
                MaxMana = stats.MaxMana,
                MaxFury = stats.MaxFury,
                MaxSpirit = stats.MaxSpirit,
                ManaRegen = stats.ManaRegen,
                SpiritRegen = stats.SpiritRegen,
                ArcaneOnCrit = stats.ArcaneOnCrit,
                HealthPerSpiritSpent = stats.HealthPerSpiritSpent,
                AttackSpeedPercent = stats.AttackSpeedPercent,
                AttackSpeedPercentBonus = stats.AttackSpeedPercentBonus,
                Quality = stats.Quality.ToString(),
                Level = stats.Level,
                ItemLevelRequirementReduction = stats.ItemLevelRequirementReduction,
                RequiredLevel = stats.RequiredLevel,
                CritPercent = stats.CritPercent,
                CritDamagePercent = stats.CritDamagePercent,
                BlockChance = stats.BlockChance,
                BlockChanceBonus = stats.BlockChanceBonus,
                HighestPrimaryAttribute = stats.HighestPrimaryAttribute,
                Intelligence = stats.Intelligence,
                Vitality = stats.Vitality,
                Strength = stats.Strength,
                Dexterity = stats.Dexterity,
                Armor = stats.Armor,
                ArmorBonus = stats.ArmorBonus,
                ArmorTotal = stats.ArmorTotal,
                Sockets = stats.Sockets,
                LifeSteal = stats.LifeSteal,
                LifeOnHit = stats.LifeOnHit,
                LifeOnKill = stats.LifeOnKill,
                MagicFind = stats.MagicFind,
                GoldFind = stats.GoldFind,
                ExperienceBonus = stats.ExperienceBonus,
                WeaponOnHitSlowProcChance = stats.WeaponOnHitSlowProcChance,
                WeaponOnHitBlindProcChance = stats.WeaponOnHitBlindProcChance,
                WeaponOnHitChillProcChance = stats.WeaponOnHitChillProcChance,
                WeaponOnHitFearProcChance = stats.WeaponOnHitFearProcChance,
                WeaponOnHitFreezeProcChance = stats.WeaponOnHitFreezeProcChance,
                WeaponOnHitImmobilizeProcChance = stats.WeaponOnHitImmobilizeProcChance,
                WeaponOnHitKnockbackProcChance = stats.WeaponOnHitKnockbackProcChance,
                WeaponOnHitBleedProcChance = stats.WeaponOnHitBleedProcChance,
                WeaponDamagePercent = stats.WeaponDamagePercent,
                WeaponAttacksPerSecond = stats.WeaponAttacksPerSecond,
                WeaponMinDamage = stats.WeaponMinDamage,
                WeaponMaxDamage = stats.WeaponMaxDamage,
                WeaponDamagePerSecond = stats.WeaponDamagePerSecond,
                WeaponDamageType = stats.WeaponDamageType.ToString(),
                MaxDamageElemental = stats.MaxDamageElemental,
                MinDamageElemental = stats.MinDamageElemental,
                MinDamageFire = stats.MinDamageFire,
                MaxDamageFire = stats.MaxDamageFire,
                MinDamageLightning = stats.MinDamageLightning,
                MaxDamageLightning = stats.MaxDamageLightning,
                MinDamageCold = stats.MinDamageCold,
                MaxDamageCold = stats.MaxDamageCold,
                MinDamagePoison = stats.MinDamagePoison,
                MaxDamagePoison = stats.MaxDamagePoison,
                MinDamageArcane = stats.MinDamageArcane,
                MaxDamageArcane = stats.MaxDamageArcane,
                MinDamageHoly = stats.MinDamageHoly,
                MaxDamageHoly = stats.MaxDamageHoly,
                OnHitAreaDamageProcChance = stats.OnHitAreaDamageProcChance,
                PowerCooldownReductionPercent = stats.PowerCooldownReductionPercent,
                ResourceCostReductionPercent = stats.ResourceCostReductionPercent,
                PickUpRadius = stats.PickUpRadius,
                MovementSpeed = stats.MovementSpeed,
                HealthGlobeBonus = stats.HealthGlobeBonus,
                HealthPerSecond = stats.HealthPerSecond,
                LifePercent = stats.LifePercent,
                DamagePercentBonusVsElites = stats.DamagePercentBonusVsElites,
                DamagePercentReductionFromElites = stats.DamagePercentReductionFromElites,
                Thorns = stats.Thorns,
                ResistAll = stats.ResistAll,
                ResistArcane = stats.ResistArcane,
                ResistCold = stats.ResistCold,
                ResistFire = stats.ResistFire,
                ResistHoly = stats.ResistHoly,
                ResistLightning = stats.ResistLightning,
                ResistPhysical = stats.ResistPhysical,
                ResistPoison = stats.ResistPoison,
                DamageReductionPhysicalPercent = stats.DamageReductionPhysicalPercent,
                SkillDamagePercentBonus = stats.SkillDamagePercentBonus,
                ArcaneSkillDamagePercentBonus = stats.ArcaneSkillDamagePercentBonus,
                ColdSkillDamagePercentBonus = stats.ColdSkillDamagePercentBonus,
                FireSkillDamagePercentBonus = stats.FireSkillDamagePercentBonus,
                HolySkillDamagePercentBonus = stats.HolySkillDamagePercentBonus,
                LightningSkillDamagePercentBonus = stats.LightningSkillDamagePercentBonus,
                PosionSkillDamagePercentBonus = stats.PosionSkillDamagePercentBonus,
                MinDamage = stats.MinDamage,
                MaxDamage = stats.MaxDamage,
                BaseType = stats.BaseType.ToString(),
                ItemType = stats.ItemType.ToString()
            };
            return itemStatsData;
        }
Пример #37
0
 private void DoItemRoll(int roll_id)
 {
     // pull the itemstring from the itemlink for the roll
     var roll_itemstring = Lua.GetReturnVal<string>("return string.match(GetLootRollItemLink(" + roll_id + "), 'item[%-?%d:]+')", 0).Trim();
     // if the itemstring is empty for whatever reason, don't do anything
     if (string.IsNullOrEmpty(roll_itemstring))
     {
         Lua.DoString("RollOnLoot(" + roll_id + "," + (int)LootRollType.Pass + ")");
         return;
     }
     // pulls the item id from the itemstring
     var roll_itemstring_split = roll_itemstring.Split(':');
     var roll_itemid = ToUnsignedInteger(roll_itemstring_split.ElementAtOrDefault(1));
     // don't bother rolling if it's bad
     if (roll_itemid <= 0)
     {
         Log("Bad item in roll, rolling pass");
         Lua.DoString("RollOnLoot(" + roll_id + "," + (int)LootRollType.Pass + ")");
         return;
     }
     // grabs the item info
     var roll_iteminfo = ItemInfo.FromId(roll_itemid);
     // pulls the name from the item info
     var roll_itemname = roll_iteminfo.Name;
     // checks if there is a suffix and appends to roll_itemname
     var roll_item_suffix = ToUnsignedInteger(roll_itemstring_split.ElementAtOrDefault(7));
     if (roll_item_suffix > 0)
     {
         var suffix = StyxWoW.Db[Styx.Patchables.ClientDb.ItemRandomProperties].GetRow(roll_item_suffix).GetField<string>(7);
         if (!string.IsNullOrEmpty(suffix))
         {
             roll_itemname += " " + suffix;
         }
     }
     // checks if the item is listed on the need list and roll need if so
     if (EquipMeSettings.Instance.RollNeedList.Split(',').Where(needlistitem => ToInteger(needlistitem) > 0).Any(needlistitem =>
         ToInteger(needlistitem) == roll_iteminfo.Id ||
         string.Equals(needlistitem.Trim(), roll_itemname, StringComparison.OrdinalIgnoreCase) ||
         Regex.IsMatch(roll_itemname, needlistitem, RegexOptions.IgnoreCase)))
     {
         var rolltypeneed = GetRollType(roll_id, true);
         Log("Rolling need (if possible - {0}) on item matched in need list: {1}", rolltypeneed, roll_itemname);
         Lua.DoString("RollOnLoot(" + roll_id + "," + (int)rolltypeneed + ")");
         return;
     }
     // if we can't equip it, greed/de/pass (taking into account ignore level settings
     GameError g_error;
     bool b = StyxWoW.Me.CanEquipItem(roll_iteminfo, out g_error);
     if (!b && !(EquipMeSettings.Instance.RollIgnoreLevel && g_error == GameError.CantEquipLevelI && StyxWoW.Me.Level + EquipMeSettings.Instance.RollIgnoreLevelDiff <= roll_iteminfo.RequiredLevel))
     {
         var rolltypenonequip = GetRollType(roll_id, false);
         Log("Rolling {0} on non-equippable item: {1}", rolltypenonequip, roll_itemname);
         Lua.DoString("RollOnLoot(" + roll_id + "," + (int)rolltypenonequip + ")");
     }
     // grab the item stats from wow (this takes into account random properties as it uses a wow func to construct)
     var roll_itemstats = new ItemStats(roll_itemstring);
     roll_itemstats.DPS = roll_iteminfo.DPS;
     // calculates the item score based off given info and stats (noting that this is not an equipped item)
     var roll_itemscore = CalcScore(roll_iteminfo, roll_itemstats);
     var need_item = false;
     // if there's an empty slot
     var emptySlot = InventorySlot.None;
     if (HasEmpty(roll_iteminfo, out emptySlot) && roll_itemscore > 0)
     {
         Log(" - Found empty slot: {0}", emptySlot);
         need_item = true;
     }
     else
     {
         // get a list of equipped items and their scores
         var equipped_items = GetReplaceableItems(roll_iteminfo, false);
         foreach (var equipped_item_kvp in equipped_items)
         {
             if (roll_itemscore > equipped_item_kvp.Value.score)
             {
                 Log(" - Equipped: {0}, score: {1}", equipped_item_kvp.Key.Name, equipped_item_kvp.Value);
                 need_item = true;
             }
         }
     }
     var rolltype = GetRollType(roll_id, need_item);
     Log("Rolling {0} on: {1}, score: {2}", rolltype, roll_itemname, roll_itemscore);
     Lua.DoString("RollOnLoot(" + roll_id + "," + (int)rolltype + ")");
 }
Пример #38
0
		public virtual List<SOPackageInfoEx> PackByQty(List<INItemBoxEx> boxes, ItemStats stats)
		{
			List<SOPackageInfoEx> list = new List<SOPackageInfoEx>();

			List<BoxInfo> boxList = PackByQty(boxes, stats.BaseQty);

			foreach (BoxInfo box in boxList)
			{
				SOPackageInfoEx pack = new SOPackageInfoEx();
				pack.SiteID = stats.SiteID;
				pack.BoxID = box.Box.BoxID;
				pack.CarrierBox = box.Box.CarrierBox;
				pack.InventoryID = stats.InventoryID;
				pack.DeclaredValue = (stats.DeclaredValue / stats.BaseQty) * box.Value;
				pack.Weight = (stats.BaseWeight / stats.BaseQty) * box.Value + box.Box.BoxWeight.GetValueOrDefault();
				pack.Qty = box.Value;
				pack.Length = box.Box.Length;
				pack.Width = box.Box.Width;
				pack.Height = box.Box.Height;

				list.Add(pack);
			}


			return list;
		}
Пример #39
0
        public CacheACDItem(string internalname, string realname, int level, ItemQuality quality, int goldamount, int balanceid, int dynamicid, float dps,
					 bool onehanded, DyeType dyetype, ItemType dbitemtype, FollowerType dbfollowertype, bool unidentified, int stackquantity, ItemStats thesestats, ACDItem item, int row, int col, bool ispotion, int acdguid)
        {
            ThisInternalName=internalname;
                     ThisRealName=realname;
                     ThisLevel=level;
                     ThisQuality=quality;
                     ThisGoldAmount=goldamount;
                     ThisBalanceID=balanceid;
                     ThisDynamicID=dynamicid;

                     ThisOneHanded=onehanded;
                     ThisDyeType=dyetype;
                     ThisDBItemType=dbitemtype;
                     ThisFollowerType=dbfollowertype;
                     IsUnidentified=unidentified;
                     ThisItemStackQuantity=stackquantity;

                     SpiritRegen=thesestats.SpiritRegen;
                     ExperienceBonus=thesestats.ExperienceBonus;
                     Dexterity=thesestats.Dexterity;
                     Intelligence=thesestats.Intelligence;
                     Strength=thesestats.Strength;
                     Vitality=thesestats.Vitality;
                     LifePercent=thesestats.LifePercent;
                     LifeOnHit=thesestats.LifeOnHit;
                     LifeSteal=thesestats.LifeSteal;
                     HealthPerSecond=thesestats.HealthPerSecond;
                     MagicFind=thesestats.MagicFind;
                     GoldFind=thesestats.GoldFind;
                     MovementSpeed=thesestats.MovementSpeed;
                     PickUpRadius=thesestats.PickUpRadius;
                     Sockets=thesestats.Sockets;
                     CritPercent=thesestats.CritPercent;
                     CritDamagePercent=thesestats.CritDamagePercent;
                     AttackSpeedPercent=thesestats.AttackSpeedPercent;
                     MinDamage=thesestats.MinDamage;
                     MaxDamage=thesestats.MaxDamage;
                     BlockChance=thesestats.BlockChance;
                     Thorns=thesestats.Thorns;
                     ResistAll=thesestats.ResistAll;
                     ResistArcane=thesestats.ResistArcane;
                     ResistCold=thesestats.ResistCold;
                     ResistFire=thesestats.ResistFire;
                     ResistHoly=thesestats.ResistHoly;
                     ResistLightning=thesestats.ResistLightning;
                     ResistPhysical=thesestats.ResistPhysical;
                     ResistPoison=thesestats.ResistPoison;
                     WeaponDamagePerSecond=thesestats.WeaponDamagePerSecond;
                     ArmorBonus=thesestats.ArmorBonus;
                     MaxDiscipline=thesestats.MaxDiscipline;
                     MaxMana=thesestats.MaxMana;
                     ArcaneOnCrit=thesestats.ArcaneOnCrit;
                     ManaRegen=thesestats.ManaRegen;
                     GlobeBonus=thesestats.HealthGlobeBonus;

                     ACDItem=item;
                     invRow=row;
                     invCol=col;
                     IsPotion=ispotion;
                     ACDGUID=acdguid;
        }