public UnitStats(string Name, IniFile UnitFile, Dictionary <string, BaseSkillRequirement> DicRequirement, Dictionary <string, BaseEffect> DicEffect) : this() { this.Name = Name; EXPValue = Convert.ToInt32(UnitFile.ReadField("Unit Stats", "EXP")); _MaxHP.Value = Convert.ToInt32(UnitFile.ReadField("Unit Stats", "BaseHP")); _MaxEN.Value = Convert.ToInt32(UnitFile.ReadField("Unit Stats", "BaseEN")); _Armor.Value = Convert.ToInt32(UnitFile.ReadField("Unit Stats", "BaseArmor")); _Mobility.Value = Convert.ToInt32(UnitFile.ReadField("Unit Stats", "BaseMobility")); _MaxMovement.Value = Convert.ToInt32(UnitFile.ReadField("Unit Stats", "BaseMovement")); AttackUpgradesSpeed = (AttackUpgradesSpeeds)Convert.ToInt32(UnitFile.ReadField("Unit Stats", "AttackUpgradesValueIndex")); AttackUpgradesCost = (AttackUpgradesCosts)Convert.ToInt32(UnitFile.ReadField("Unit Stats", "AttackUpgradesCostIndex")); string[] TerrainValues = new string[] { "-", "S", "A", "B", "C", "D" }; DicTerrainValue = new Dictionary <string, int>(); foreach (KeyValuePair <string, string> ActiveField in UnitFile.ReadHeader("Unit Terrain")) { DicTerrainValue.Add(ActiveField.Key, Array.IndexOf(TerrainValues, ActiveField.Value)); } ListTerrainChoices = new List <string>(); foreach (KeyValuePair <string, string> ActiveField in UnitFile.ReadHeader("Unit Movements")) { ListTerrainChoices.Add(ActiveField.Key); } Size = UnitFile.ReadField("Unit Stats", "Size"); int SizeWidth = Convert.ToInt32(UnitFile.ReadField("Unit Stats", "Size Mask Width")); int SizeHeight = Convert.ToInt32(UnitFile.ReadField("Unit Stats", "Size Mask Height")); ArrayMapSize = new bool[SizeWidth, SizeHeight]; foreach (KeyValuePair <string, string> ActiveField in UnitFile.ReadHeader("Size Mask")) { int IndexOfX = ActiveField.Key.IndexOf('X') + 1; int IndexOfY = ActiveField.Key.IndexOf('Y'); int X = Convert.ToInt32(ActiveField.Key.Substring(IndexOfX, IndexOfY - IndexOfX)); int Y = Convert.ToInt32(ActiveField.Key.Substring(IndexOfY + 1)); ArrayMapSize[X, Y] = Convert.ToBoolean(ActiveField.Value); } //Read Pilots whitelist. ListCharacterIDWhitelist = new List <string>(); foreach (KeyValuePair <string, string> ActiveField in UnitFile.ReadHeader("Pilot Whitelist")) { string CharacterName = ActiveField.Value; ListCharacterIDWhitelist.Add(CharacterName); } Dictionary <string, string> DicAttackAnimations = UnitFile.ReadHeader("Attack Animations"); ListAttack = new List <Attack>(); foreach (KeyValuePair <string, string> ActiveField in UnitFile.ReadHeader("Attacks")) { int A = Convert.ToInt32(ActiveField.Key.Substring(7)); Attack NewAttack = new Attack(ActiveField.Value, DicRequirement, DicEffect); NewAttack.Ammo = NewAttack.MaxAmmo; if (NewAttack.Pri == WeaponPrimaryProperty.PLA) { PLAAttack = A; } //Load Animation paths. foreach (KeyValuePair <string, string> ActiveAnimationField in DicAttackAnimations) { if (ActiveAnimationField.Key.StartsWith(ActiveField.Key)) { int An = Convert.ToInt32(ActiveAnimationField.Key.Substring(ActiveField.Key.Length + 5)); NewAttack.Animations[An] = new AnimationInfo(ActiveField.Key); } } ListAttack.Add(NewAttack); ++A; } foreach (KeyValuePair <string, string> ActiveField in UnitFile.ReadHeader("Animations")) { int A = Convert.ToInt32(ActiveField.Key.Substring(5)); Animations[A] = ActiveField.Value; } List <BaseAutomaticSkill> ListAbility = new List <BaseAutomaticSkill>(); foreach (KeyValuePair <string, string> ActiveField in UnitFile.ReadHeader("Abilities")) { ListAbility.Add(new BaseAutomaticSkill("Content/Units/Abilities/" + ActiveField.Value + ".pes", DicRequirement, DicEffect)); } ArrayUnitAbility = ListAbility.ToArray(); }
public UnitStats(string Name, BinaryReader BR, Dictionary <string, BaseSkillRequirement> DicRequirement, Dictionary <string, BaseEffect> DicEffect) : this() { this.Name = Name; EXPValue = BR.ReadInt32(); _MaxHP.Value = BR.ReadInt32(); _MaxEN.Value = BR.ReadInt32(); _Armor.Value = BR.ReadInt32(); _Mobility.Value = BR.ReadInt32(); _MaxMovement.Value = (int)BR.ReadSingle(); AttackUpgradesSpeed = (AttackUpgradesSpeeds)BR.ReadByte(); AttackUpgradesCost = (AttackUpgradesCosts)BR.ReadByte(); int TerrainGradeCount = BR.ReadInt32(); DicTerrainValue = new Dictionary <string, int>(TerrainGradeCount); for (int G = 0; G < TerrainGradeCount; ++G) { DicTerrainValue.Add(BR.ReadString(), BR.ReadInt32()); } int TerrainChoicesCount = BR.ReadInt32(); ListTerrainChoices = new List <string>(TerrainChoicesCount); for (int i = 0; i < TerrainChoicesCount; i++) { ListTerrainChoices.Add(BR.ReadString()); } Size = BR.ReadString(); int SizeWidth = BR.ReadInt32(); int SizeHeight = BR.ReadInt32(); ArrayMapSize = new bool[SizeWidth, SizeHeight]; for (int X = 0; X < SizeWidth; X++) { for (int Y = 0; Y < SizeHeight; Y++) { ArrayMapSize[X, Y] = BR.ReadBoolean(); } } //Read Pilots whitelist. ListCharacterIDWhitelist = new List <string>(); Int32 ListPilotCount = BR.ReadInt32(); for (int P = 0; P < ListPilotCount; P++) { string CharacterName = BR.ReadString(); ListCharacterIDWhitelist.Add(CharacterName); } Int32 ListAttackCount = BR.ReadInt32(); ListAttack = new List <Attack>(ListAttackCount); for (int A = 0; A < ListAttackCount; ++A) { Attack NewAttack; bool IsExternal = BR.ReadBoolean(); string AttackName = BR.ReadString(); if (IsExternal) { NewAttack = new Attack(AttackName, DicRequirement, DicEffect); } else { NewAttack = new Attack(BR, AttackName, DicRequirement, DicEffect); } NewAttack.Ammo = NewAttack.MaxAmmo; if (NewAttack.Pri == WeaponPrimaryProperty.PLA) { PLAAttack = A; } //Load Animation paths. int AttackAnimationCount = BR.ReadInt32(); for (int An = 0; An < AttackAnimationCount; ++An) { NewAttack.Animations[An] = new AnimationInfo(BR.ReadString()); } ListAttack.Add(NewAttack); } Animations = new UnitAnimations(BR); Int32 ListAbilityCount = BR.ReadInt32(); ArrayUnitAbility = new BaseAutomaticSkill[ListAbilityCount]; for (int A = ListAbilityCount - 1; A >= 0; --A) { ArrayUnitAbility[A] = new BaseAutomaticSkill("Content/Units/Abilities/" + BR.ReadString() + ".pes", DicRequirement, DicEffect); } }