public ShipModule(ModuleGenList gen) { this.id = gen.id; this.slotType = gen.slot; this.level = gen.level; this.name = gen.name; this.workshop = gen.workshop; this.templateModuleId = gen.dataId; this.craftMaterials = new Dictionary <string, int>(); foreach (var di in gen.deconstructOre) { this.craftMaterials.Add(di.id, di.count); } this.difficulty = gen.difficulty; this.color = gen.color; this.prefab = gen.model; this.hp = gen.hp; this.speed = gen.speed; this.hold = gen.hold; this.critDamage = gen.critDamage; SetCommonResist(gen.resist); this.damageBonus = gen.damageBonus; this.energyBonus = gen.energyBonus; this.critChance = gen.critChance; this.speedBonus = gen.speedBonus; this.holdBonus = gen.holdBonus; this.skillId = gen.skill; this.set = gen.setId; var dump = GetInfo(); }
public SpecialBotShipComponentData(XElement element) : base(element) { var modulesElement = element.Element("modules"); moduleList = new ConcurrentDictionary <ShipModelSlotType, ModuleGenList>(); var dump = modulesElement.Elements("module").Select(me => { ShipModelSlotType slot = (ShipModelSlotType)Enum.Parse(typeof(ShipModelSlotType), me.GetString("slot")); string id = me.GetString("id"); int level = me.GetInt("level"); string name = me.GetString("name"); Workshop workshop = (Workshop)Enum.Parse(typeof(Workshop), me.GetString("workshop")); string dataId = me.GetString("data_id"); ObjectColor color = (ObjectColor)Enum.Parse(typeof(ObjectColor), me.GetString("color")); string model = me.GetString("model"); float hp = me.GetFloat("hp"); float speed = me.GetFloat("speed"); int hold = me.GetInt("hold"); float critDamage = me.GetFloat("crit_damage"); float resist = me.GetFloat("resist"); float damageBonus = me.GetFloat("damage_bonus"); float energyBonus = me.GetFloat("energy_bonus"); float critChance = me.GetFloat("crit_chance"); float speedBonus = me.GetFloat("speed_bonus"); float holdBonus = me.GetFloat("hold_bonus"); int skill = me.GetInt("skill"); string setId = me.GetString("set_id"); List <DeconstructItem> dItems = me.Element("ditems").Elements("item").Select(die => { return(new DeconstructItem { id = die.GetString("id"), count = die.GetInt("count") }); }).ToList(); ModuleGenList gen = new ModuleGenList { id = id, slot = slot, level = level, name = name, workshop = workshop, dataId = dataId, deconstructOre = dItems, difficulty = difficulty, color = color, model = model, hp = hp, speed = speed, hold = hold, critDamage = critDamage, resist = resist, damageBonus = damageBonus, energyBonus = energyBonus, critChance = critChance, speedBonus = speedBonus, holdBonus = holdBonus, skill = skill, setId = setId }; moduleList.TryAdd(gen.slot, gen); return(gen); }).ToList(); }