Exemplo n.º 1
0
        private void GetItem()
        {
            var args = GetArgs();

            if (args.Length != 10)
            {
                return;
            }

            var itemType  = args[0];
            var itemStats = args.Skip(1)
                            .Select(s => Convert.ToDouble(s))
                            .ToArray();

            Equippment item = null;

            switch (itemType)
            {
            case "weapon":
                item = new SimpleSword();
                break;

            case "chest":
                item = new SimpleChest();
                break;

            case "gloves":
                item = new SimpleGloves();
                break;

            case "helmet":
                item = new SimpleHelmet();
                break;
            }
            item.Level                     = (int)itemStats[0];
            item.MainStat.Base             = (long)itemStats[1];
            item.MainStat.Koef             = 1.0;
            item.MainStat.EnchantKoef      = 1.0;
            item.Bonuses                   = new SomeName.Core.Items.Bonuses.ItemBonuses();
            item.Bonuses.Power.Base        = (int)itemStats[2];
            item.Bonuses.Power.Koef        = 1.0;
            item.Bonuses.Vitality.Base     = (int)itemStats[3];
            item.Bonuses.Vitality.Koef     = 1.0;
            item.Bonuses.Accuracy.Base     = (int)itemStats[4];
            item.Bonuses.Accuracy.Koef     = 1.0;
            item.Bonuses.Evasion.Base      = (int)itemStats[5];
            item.Bonuses.Evasion.Koef      = 1.0;
            item.Bonuses.CritChance.Base   = itemStats[6];
            item.Bonuses.CritChance.Koef   = 1.0;
            item.Bonuses.CritDamage.Base   = itemStats[7];
            item.Bonuses.CritDamage.Koef   = 1.0;
            item.Bonuses.HealthPerHit.Base = (long)itemStats[8];
            item.Bonuses.HealthPerHit.Koef = 1.0;
            item.UpdateGoldValueKoef();

            _inventoryService.Add(item);
        }
Exemplo n.º 2
0
        public override IEnumerable <IItem> Build(int level, int count)
        {
            var result        = new IItem[count];
            var newLevel      = GetItemLevel(level);
            var baseGoldValue = GetBaseHelmetGoldValue(newLevel);

            for (int i = 0; i < count; i++)
            {
                var globalDamageValueKoef = RollGlobalItemDamageKoef(level);
                var item = new SimpleHelmet()
                {
                    Level   = newLevel,
                    Defence = HelmetStatsBalance.GetDefence(newLevel, RollItemStatDamageKoef(level, globalDamageValueKoef)),
                    Bonuses = ItemBonusesFactory.Build(HelmetStatsBalance, newLevel, globalDamageValueKoef),
                };
                item.GoldValue.Base = baseGoldValue;
                item.UpdateGoldValueKoef();
                result[i] = item;
            }
            return(result);
        }