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); }
public override Item Build(int level, double additionalKoef = 1.0) { var damageValueKoef = RollItemDamageKoef(additionalKoef); var item = new SimpleGloves() { Level = level, Defence = GlovesStatsBalance.GetDefence(level, damageValueKoef), Bonuses = ItemBonusesFactory.Build(GlovesStatsBalance, level, additionalKoef) }; item.GoldValue.Base = GetBaseGlovesGoldValue(level); item.UpdateGoldValueKoef(); return(item); }
public override IEnumerable <IItem> Build(int level, int count) { var result = new IItem[count]; var newLevel = GetItemLevel(level); var baseGoldValue = GetBaseGlovesGoldValue(newLevel); for (int i = 0; i < count; i++) { var globalDamageValueKoef = RollGlobalItemDamageKoef(level); var item = new SimpleGloves() { Level = newLevel, Defence = GlovesStatsBalance.GetDefence(newLevel, RollItemStatDamageKoef(level, globalDamageValueKoef)), Bonuses = ItemBonusesFactory.Build(GlovesStatsBalance, newLevel, globalDamageValueKoef), }; item.GoldValue.Base = baseGoldValue; item.UpdateGoldValueKoef(); result[i] = item; } return(result); }