Guest User

Untitled

a guest
Apr 10th, 2020
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 20.66 KB | None | 0 0
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Xml;
  6. using TaleWorlds.Library;
  7. using TaleWorlds.Localization;
  8. using TaleWorlds.SaveSystem;
  9.  
  10. namespace TaleWorlds.Core
  11. {
  12.     // Token: 0x02000013 RID: 19
  13.     [SaveableClass(10037)]
  14.     public class BasicCharacterObject : MBObjectBase
  15.     {
  16.         // Token: 0x17000037 RID: 55
  17.         // (get) Token: 0x060000BA RID: 186 RVA: 0x0000456A File Offset: 0x0000276A
  18.         // (set) Token: 0x060000BB RID: 187 RVA: 0x00004572 File Offset: 0x00002772
  19.         public virtual TextObject Name
  20.         {
  21.             get
  22.             {
  23.                 return this._basicName;
  24.             }
  25.             set
  26.             {
  27.                 this.SetName(value);
  28.             }
  29.         }
  30.  
  31.         // Token: 0x060000BC RID: 188 RVA: 0x0000457B File Offset: 0x0000277B
  32.         private void SetName(TextObject name)
  33.         {
  34.             this._basicName = name;
  35.         }
  36.  
  37.         // Token: 0x060000BD RID: 189 RVA: 0x00004584 File Offset: 0x00002784
  38.         public override TextObject GetName()
  39.         {
  40.             return this.Name;
  41.         }
  42.  
  43.         // Token: 0x17000038 RID: 56
  44.         // (get) Token: 0x060000BE RID: 190 RVA: 0x0000458C File Offset: 0x0000278C
  45.         // (set) Token: 0x060000BF RID: 191 RVA: 0x00004594 File Offset: 0x00002794
  46.         public virtual StaticBodyProperties StaticBodyPropertiesMin { get; set; }
  47.  
  48.         // Token: 0x17000039 RID: 57
  49.         // (get) Token: 0x060000C0 RID: 192 RVA: 0x0000459D File Offset: 0x0000279D
  50.         // (set) Token: 0x060000C1 RID: 193 RVA: 0x000045A5 File Offset: 0x000027A5
  51.         public virtual StaticBodyProperties StaticBodyPropertiesMax { get; set; }
  52.  
  53.         // Token: 0x1700003A RID: 58
  54.         // (get) Token: 0x060000C2 RID: 194 RVA: 0x000045AE File Offset: 0x000027AE
  55.         // (set) Token: 0x060000C3 RID: 195 RVA: 0x000045B6 File Offset: 0x000027B6
  56.         public int DefaultFormationGroup { get; set; }
  57.  
  58.         // Token: 0x1700003B RID: 59
  59.         // (get) Token: 0x060000C4 RID: 196 RVA: 0x000045BF File Offset: 0x000027BF
  60.         // (set) Token: 0x060000C5 RID: 197 RVA: 0x000045C7 File Offset: 0x000027C7
  61.         public FormationClass CurrentFormationClass { get; set; }
  62.  
  63.         // Token: 0x1700003C RID: 60
  64.         // (get) Token: 0x060000C6 RID: 198 RVA: 0x000045D0 File Offset: 0x000027D0
  65.         // (set) Token: 0x060000C7 RID: 199 RVA: 0x000045D8 File Offset: 0x000027D8
  66.         public FormationPositionPreference FormationPositionPreference { get; protected set; }
  67.  
  68.         // Token: 0x1700003D RID: 61
  69.         // (get) Token: 0x060000C8 RID: 200 RVA: 0x000045E1 File Offset: 0x000027E1
  70.         // (set) Token: 0x060000C9 RID: 201 RVA: 0x000045E9 File Offset: 0x000027E9
  71.         public virtual bool IsFemale { get; set; }
  72.  
  73.         // Token: 0x1700003E RID: 62
  74.         // (get) Token: 0x060000CA RID: 202 RVA: 0x000045F2 File Offset: 0x000027F2
  75.         public virtual MBReadOnlyList<Equipment> AllEquipments
  76.         {
  77.             get
  78.             {
  79.                 return this._equipmentsAsReadOnlyList;
  80.             }
  81.         }
  82.  
  83.         // Token: 0x1700003F RID: 63
  84.         // (get) Token: 0x060000CB RID: 203 RVA: 0x000045FA File Offset: 0x000027FA
  85.         public virtual Equipment Equipment
  86.         {
  87.             get
  88.             {
  89.                 return this._equipments.FirstOrDefault<Equipment>();
  90.             }
  91.         }
  92.  
  93.         // Token: 0x060000CC RID: 204 RVA: 0x00004607 File Offset: 0x00002807
  94.         private bool HasCivilianEquipment()
  95.         {
  96.             return this.AllEquipments.Any((Equipment eq) => eq.IsCivilian);
  97.         }
  98.  
  99.         // Token: 0x060000CD RID: 205 RVA: 0x00004633 File Offset: 0x00002833
  100.         public void InitializeEquipmentsOnLoad(List<Equipment> equipments)
  101.         {
  102.             this._equipments = equipments;
  103.             this._equipmentsAsReadOnlyList = this._equipments.GetReadOnlyList<Equipment>();
  104.         }
  105.  
  106.         // Token: 0x060000CE RID: 206 RVA: 0x00004650 File Offset: 0x00002850
  107.         public Equipment GetFirstEquipment(bool civilianSet)
  108.         {
  109.             if (!civilianSet)
  110.             {
  111.                 return this.Equipment;
  112.             }
  113.             if (!this.HasCivilianEquipment())
  114.             {
  115.                 return this.Equipment;
  116.             }
  117.             return this.AllEquipments.FirstOrDefault((Equipment eq) => eq.IsCivilian);
  118.         }
  119.  
  120.         // Token: 0x17000040 RID: 64
  121.         // (get) Token: 0x060000CF RID: 207 RVA: 0x000046A0 File Offset: 0x000028A0
  122.         // (set) Token: 0x060000D0 RID: 208 RVA: 0x000046A8 File Offset: 0x000028A8
  123.         public virtual int Level { get; set; }
  124.  
  125.         // Token: 0x17000041 RID: 65
  126.         // (get) Token: 0x060000D1 RID: 209 RVA: 0x000046B1 File Offset: 0x000028B1
  127.         // (set) Token: 0x060000D2 RID: 210 RVA: 0x000046B9 File Offset: 0x000028B9
  128.         public BasicCultureObject Culture
  129.         {
  130.             get
  131.             {
  132.                 return this._culture;
  133.             }
  134.             set
  135.             {
  136.                 this._culture = value;
  137.             }
  138.         }
  139.  
  140.         // Token: 0x17000042 RID: 66
  141.         // (get) Token: 0x060000D3 RID: 211 RVA: 0x000046C2 File Offset: 0x000028C2
  142.         public virtual bool IsPlayerCharacter
  143.         {
  144.             get
  145.             {
  146.                 return false;
  147.             }
  148.         }
  149.  
  150.         // Token: 0x17000043 RID: 67
  151.         // (get) Token: 0x060000D4 RID: 212 RVA: 0x000046C5 File Offset: 0x000028C5
  152.         // (set) Token: 0x060000D5 RID: 213 RVA: 0x000046CD File Offset: 0x000028CD
  153.         public virtual float Age
  154.         {
  155.             get
  156.             {
  157.                 return this._age;
  158.             }
  159.             set
  160.             {
  161.                 this._age = value;
  162.             }
  163.         }
  164.  
  165.         // Token: 0x17000044 RID: 68
  166.         // (get) Token: 0x060000D6 RID: 214 RVA: 0x000046D6 File Offset: 0x000028D6
  167.         public virtual int HitPoints
  168.         {
  169.             get
  170.             {
  171.                 return this.MaxHitPoints();
  172.             }
  173.         }
  174.  
  175.         // Token: 0x060000D7 RID: 215 RVA: 0x000046DE File Offset: 0x000028DE
  176.         public virtual BodyProperties GetBodyPropertiesMin(bool returnBaseValue = false)
  177.         {
  178.             return new BodyProperties(this._dynamicBodyProperties, this.StaticBodyPropertiesMin);
  179.         }
  180.  
  181.         // Token: 0x060000D8 RID: 216 RVA: 0x000046F1 File Offset: 0x000028F1
  182.         public virtual BodyProperties GetBodyPropertiesMax()
  183.         {
  184.             return new BodyProperties(this._dynamicBodyProperties, this.StaticBodyPropertiesMax);
  185.         }
  186.  
  187.         // Token: 0x060000D9 RID: 217 RVA: 0x00004704 File Offset: 0x00002904
  188.         public virtual BodyProperties GetBodyProperties(Equipment equipment, int seed = -1)
  189.         {
  190.             BodyProperties bodyPropertiesMin = this.GetBodyPropertiesMin(false);
  191.             BodyProperties bodyPropertiesMax = this.GetBodyPropertiesMax();
  192.             return FaceGen.GetRandomBodyProperties(this.IsFemale, bodyPropertiesMin, bodyPropertiesMax, (int)((equipment != null) ? equipment.HairCoverType : ArmorComponent.HairCoverTypes.None), seed, this.HairTags, this.BeardTags, this.TattooTags);
  193.         }
  194.  
  195.         // Token: 0x060000DA RID: 218 RVA: 0x0000474C File Offset: 0x0000294C
  196.         public virtual void UpdatePlayerCharacterBodyProperties(BodyProperties properties, bool isFemale)
  197.         {
  198.             this.StaticBodyPropertiesMax = properties.StaticProperties;
  199.             this.StaticBodyPropertiesMin = properties.StaticProperties;
  200.             this._dynamicBodyProperties = properties.DynamicProperties;
  201.             this.IsFemale = isFemale;
  202.         }
  203.  
  204.         // Token: 0x17000045 RID: 69
  205.         // (get) Token: 0x060000DB RID: 219 RVA: 0x0000477C File Offset: 0x0000297C
  206.         // (set) Token: 0x060000DC RID: 220 RVA: 0x00004784 File Offset: 0x00002984
  207.         [SaveableProperty(16)]
  208.         public float FaceDirtAmount { get; set; }
  209.  
  210.         // Token: 0x17000046 RID: 70
  211.         // (get) Token: 0x060000DD RID: 221 RVA: 0x0000478D File Offset: 0x0000298D
  212.         // (set) Token: 0x060000DE RID: 222 RVA: 0x00004795 File Offset: 0x00002995
  213.         public string HairTags { get; set; }
  214.  
  215.         // Token: 0x17000047 RID: 71
  216.         // (get) Token: 0x060000DF RID: 223 RVA: 0x0000479E File Offset: 0x0000299E
  217.         // (set) Token: 0x060000E0 RID: 224 RVA: 0x000047A6 File Offset: 0x000029A6
  218.         public string BeardTags { get; set; }
  219.  
  220.         // Token: 0x17000048 RID: 72
  221.         // (get) Token: 0x060000E1 RID: 225 RVA: 0x000047AF File Offset: 0x000029AF
  222.         // (set) Token: 0x060000E2 RID: 226 RVA: 0x000047B7 File Offset: 0x000029B7
  223.         public string TattooTags { get; set; }
  224.  
  225.         // Token: 0x17000049 RID: 73
  226.         // (get) Token: 0x060000E3 RID: 227 RVA: 0x000047C0 File Offset: 0x000029C0
  227.         public virtual bool IsHero
  228.         {
  229.             get
  230.             {
  231.                 return this._isBasicHero;
  232.             }
  233.         }
  234.  
  235.         // Token: 0x1700004A RID: 74
  236.         // (get) Token: 0x060000E4 RID: 228 RVA: 0x000047C8 File Offset: 0x000029C8
  237.         // (set) Token: 0x060000E5 RID: 229 RVA: 0x000047D0 File Offset: 0x000029D0
  238.         public bool IsSoldier { get; private set; }
  239.  
  240.         // Token: 0x060000E6 RID: 230 RVA: 0x000047DC File Offset: 0x000029DC
  241.         public BasicCharacterObject()
  242.         {
  243.             this._equipments = new List<Equipment>();
  244.             this._equipmentsAsReadOnlyList = this._equipments.GetReadOnlyList<Equipment>();
  245.             this._emptyEquipment = new Equipment(true);
  246.             this._equipments.Add(this._emptyEquipment);
  247.         }
  248.  
  249.         // Token: 0x060000E7 RID: 231 RVA: 0x00004828 File Offset: 0x00002A28
  250.         [LoadInitializationCallback]
  251.         private void OnLoad(MetaData metaData)
  252.         {
  253.             this._equipments = new List<Equipment>();
  254.             this._equipmentsAsReadOnlyList = this._equipments.GetReadOnlyList<Equipment>();
  255.             this._emptyEquipment = new Equipment(true);
  256.             this._equipments.Add(this._emptyEquipment);
  257.         }
  258.  
  259.         // Token: 0x060000E8 RID: 232 RVA: 0x00004864 File Offset: 0x00002A64
  260.         public int GetDefaultFaceSeed(int rank)
  261.         {
  262.             int num = base.StringId.GetDeterministicHashCode() * 6791 + rank * 197;
  263.             return ((num >= 0) ? num : (-num)) % 2000;
  264.         }
  265.  
  266.         // Token: 0x060000E9 RID: 233 RVA: 0x0000489A File Offset: 0x00002A9A
  267.         public float GetStepSize()
  268.         {
  269.             return 0.8f + 0.2f * (float)this.GetSkillValue(DefaultSkills.Athletics) * 0.00333333f;
  270.         }
  271.  
  272.         // Token: 0x060000EA RID: 234 RVA: 0x000048BC File Offset: 0x00002ABC
  273.         public bool HasMount()
  274.         {
  275.             return this.Equipment[10].Item != null;
  276.         }
  277.  
  278.         // Token: 0x060000EB RID: 235 RVA: 0x000048E1 File Offset: 0x00002AE1
  279.         public virtual int MaxHitPoints()
  280.         {
  281.             return Game.Current.HumanMonster.HitPoints;
  282.         }
  283.  
  284.         // Token: 0x060000EC RID: 236 RVA: 0x000048F4 File Offset: 0x00002AF4
  285.         public virtual float GetPower()
  286.         {
  287.             float num = 0f;
  288.             float num2 = (float)this.Level + num;
  289.             return 0.2f + (num2 + 10f) * (num2 + 10f) * 0.0025f;
  290.         }
  291.  
  292.         // Token: 0x060000ED RID: 237 RVA: 0x0000492C File Offset: 0x00002B2C
  293.         public virtual int GetMountKeySeed()
  294.         {
  295.             return MBRandom.RandomInt();
  296.         }
  297.  
  298.         // Token: 0x060000EE RID: 238 RVA: 0x00004933 File Offset: 0x00002B33
  299.         public virtual int GetSkillValue(SkillObject skill)
  300.         {
  301.             return this._characterSkills.GetPropertyValue(skill);
  302.         }
  303.  
  304.         // Token: 0x060000EF RID: 239 RVA: 0x00004941 File Offset: 0x00002B41
  305.         public void SetSkillValue(SkillObject skill, int value)
  306.         {
  307.             this._characterSkills.SetPropertyValue(skill, value);
  308.         }
  309.  
  310.         // Token: 0x060000F0 RID: 240 RVA: 0x00004950 File Offset: 0x00002B50
  311.         public void InitializeHeroBasicCharacterOnAfterLoad(BasicCharacterObject originCharacter, TextObject name)
  312.         {
  313.             this.Name = name;
  314.             this.IsSoldier = originCharacter.IsSoldier;
  315.             this._isBasicHero = originCharacter._isBasicHero;
  316.             this._characterSkills = originCharacter._characterSkills;
  317.             this.HairTags = originCharacter.HairTags;
  318.             this.BeardTags = originCharacter.BeardTags;
  319.             this.TattooTags = originCharacter.TattooTags;
  320.             this.StaticBodyPropertiesMin = originCharacter.StaticBodyPropertiesMin;
  321.             this.StaticBodyPropertiesMax = originCharacter.StaticBodyPropertiesMax;
  322.             this.IsFemale = originCharacter.IsFemale;
  323.             this.Culture = originCharacter.Culture;
  324.             this.DefaultFormationGroup = originCharacter.DefaultFormationGroup;
  325.             this.CurrentFormationClass = originCharacter.CurrentFormationClass;
  326.             this.FormationPositionPreference = originCharacter.FormationPositionPreference;
  327.             this._equipments = originCharacter._equipments;
  328.             this._equipmentsAsReadOnlyList = this._equipments.GetReadOnlyList<Equipment>();
  329.         }
  330.  
  331.         // Token: 0x060000F1 RID: 241 RVA: 0x00004A20 File Offset: 0x00002C20
  332.         public override void Deserialize(MBObjectManager objectManager, XmlNode node)
  333.         {
  334.             base.Deserialize(objectManager, node);
  335.             XmlAttribute xmlAttribute = node.Attributes["name"];
  336.             if (xmlAttribute != null)
  337.             {
  338.                 this._basicName = new TextObject(xmlAttribute.Value, null);
  339.             }
  340.             XmlNode xmlNode = node.Attributes["occupation"];
  341.             if (xmlNode != null)
  342.             {
  343.                 this.IsSoldier = (xmlNode.InnerText.IndexOf("soldier", StringComparison.OrdinalIgnoreCase) >= 0);
  344.             }
  345.             XmlNodeList childNodes = node.ChildNodes;
  346.             this._isBasicHero = XmlHelper.ReadBool(node, "is_hero");
  347.             BasicCharacterObject basicCharacterObject = objectManager.ReadObjectReferenceFromXml("skill_template", typeof(BasicCharacterObject), node) as BasicCharacterObject;
  348.             if (basicCharacterObject != null)
  349.             {
  350.                 this._characterSkills = new CharacterSkills(basicCharacterObject._characterSkills);
  351.             }
  352.             else
  353.             {
  354.                 this._characterSkills = new CharacterSkills();
  355.             }
  356.             childNodes = node.ChildNodes;
  357.             foreach (object obj in childNodes)
  358.             {
  359.                 XmlNode xmlNode2 = (XmlNode)obj;
  360.                 if (xmlNode2.Name == "Skills" || xmlNode2.Name == "skills")
  361.                 {
  362.                     if (!this._isBasicHero)
  363.                     {
  364.                         this._characterSkills.Deserialize(objectManager, xmlNode2);
  365.                     }
  366.                 }
  367.                 else if (xmlNode2.Name == "face")
  368.                 {
  369.                     this.HairTags = "";
  370.                     this.BeardTags = "";
  371.                     this.TattooTags = "";
  372.                     foreach (object obj2 in xmlNode2.ChildNodes)
  373.                     {
  374.                         XmlNode xmlNode3 = (XmlNode)obj2;
  375.                         if (xmlNode3.Name == "hair_tags")
  376.                         {
  377.                             using (IEnumerator enumerator3 = xmlNode3.ChildNodes.GetEnumerator())
  378.                             {
  379.                                 while (enumerator3.MoveNext())
  380.                                 {
  381.                                     object obj3 = enumerator3.Current;
  382.                                     XmlNode xmlNode4 = (XmlNode)obj3;
  383.                                     this.HairTags = this.HairTags + xmlNode4.Attributes["name"].Value + ",";
  384.                                 }
  385.                                 continue;
  386.                             }
  387.                         }
  388.                         if (xmlNode3.Name == "beard_tags")
  389.                         {
  390.                             using (IEnumerator enumerator3 = xmlNode3.ChildNodes.GetEnumerator())
  391.                             {
  392.                                 while (enumerator3.MoveNext())
  393.                                 {
  394.                                     object obj4 = enumerator3.Current;
  395.                                     XmlNode xmlNode5 = (XmlNode)obj4;
  396.                                     this.BeardTags = this.BeardTags + xmlNode5.Attributes["name"].Value + ",";
  397.                                 }
  398.                                 continue;
  399.                             }
  400.                         }
  401.                         if (xmlNode3.Name == "tattoo_tags")
  402.                         {
  403.                             using (IEnumerator enumerator3 = xmlNode3.ChildNodes.GetEnumerator())
  404.                             {
  405.                                 while (enumerator3.MoveNext())
  406.                                 {
  407.                                     object obj5 = enumerator3.Current;
  408.                                     XmlNode xmlNode6 = (XmlNode)obj5;
  409.                                     this.TattooTags = this.TattooTags + xmlNode6.Attributes["name"].Value + ",";
  410.                                 }
  411.                                 continue;
  412.                             }
  413.                         }
  414.                         if (xmlNode3.Name == "BodyProperties")
  415.                         {
  416.                             BodyProperties bodyProperties;
  417.                             if (BodyProperties.FromXmlNode(xmlNode3, out bodyProperties))
  418.                             {
  419.                                 this.StaticBodyPropertiesMin = bodyProperties.StaticProperties;
  420.                                 this._dynamicBodyProperties = bodyProperties.DynamicProperties;
  421.                             }
  422.                         }
  423.                         else if (xmlNode3.Name == "BodyPropertiesMax")
  424.                         {
  425.                             BodyProperties bodyProperties2;
  426.                             if (BodyProperties.FromXmlNode(xmlNode3, out bodyProperties2))
  427.                             {
  428.                                 this.StaticBodyPropertiesMax = bodyProperties2.StaticProperties;
  429.                                 this._dynamicBodyProperties = bodyProperties2.DynamicProperties;
  430.                             }
  431.                             else
  432.                             {
  433.                                 this.StaticBodyPropertiesMax = this.StaticBodyPropertiesMin;
  434.                             }
  435.                         }
  436.                         else if (xmlNode3.Name == "face_key_template")
  437.                         {
  438.                             BasicCharacterObject basicCharacterObject2 = objectManager.ReadObjectReferenceFromXml<BasicCharacterObject>("value", xmlNode3);
  439.                             this.StaticBodyPropertiesMin = basicCharacterObject2.StaticBodyPropertiesMin;
  440.                             this.StaticBodyPropertiesMax = basicCharacterObject2.StaticBodyPropertiesMax;
  441.                             this._dynamicBodyProperties = basicCharacterObject2._dynamicBodyProperties;
  442.                             if (!basicCharacterObject2.HairTags.IsStringNoneOrEmpty())
  443.                             {
  444.                                 this.HairTags = basicCharacterObject2.HairTags;
  445.                             }
  446.                             if (!basicCharacterObject2.BeardTags.IsStringNoneOrEmpty())
  447.                             {
  448.                                 this.BeardTags = basicCharacterObject2.BeardTags;
  449.                             }
  450.                             if (!basicCharacterObject2.TattooTags.IsStringNoneOrEmpty())
  451.                             {
  452.                                 this.TattooTags = basicCharacterObject2.TattooTags;
  453.                             }
  454.                         }
  455.                     }
  456.                 }
  457.             }
  458.             this.IsFemale = false;
  459.             this.DefaultFormationGroup = 0;
  460.             XmlNode xmlNode7 = node.Attributes["is_female"];
  461.             if (xmlNode7 != null)
  462.             {
  463.                 this.IsFemale = Convert.ToBoolean(xmlNode7.InnerText);
  464.             }
  465.             this.Culture = objectManager.ReadObjectReferenceFromXml<BasicCultureObject>("culture", node);
  466.             XmlNode xmlNode8 = node.Attributes["age"];
  467.             this.Age = ((xmlNode8 == null) ? 20f : ((float)Convert.ToInt32(xmlNode8.InnerText)));
  468.             XmlNode xmlNode9 = node.Attributes["level"];
  469.             this.Level = ((xmlNode9 != null) ? Convert.ToInt32(xmlNode9.InnerText) : 1);
  470.             XmlNode xmlNode10 = node.Attributes["default_group"];
  471.             if (xmlNode10 != null)
  472.             {
  473.                 this.DefaultFormationGroup = this.FetchDefaultFormationGroup(xmlNode10.InnerText);
  474.             }
  475.             this.CurrentFormationClass = (FormationClass)this.DefaultFormationGroup;
  476.             XmlNode xmlNode11 = node.Attributes["formation_position_preference"];
  477.             this.FormationPositionPreference = ((xmlNode11 != null) ? ((FormationPositionPreference)Enum.Parse(typeof(FormationPositionPreference), xmlNode11.InnerText)) : FormationPositionPreference.Middle);
  478.             List<XmlNode> list = new List<XmlNode>();
  479.             List<XmlNode> list2 = new List<XmlNode>();
  480.             foreach (object obj6 in childNodes)
  481.             {
  482.                 XmlNode xmlNode12 = (XmlNode)obj6;
  483.                 if (xmlNode12.Name == "equipmentSet")
  484.                 {
  485.                     list.Add(xmlNode12);
  486.                 }
  487.                 else if (xmlNode12.Name == "equipment")
  488.                 {
  489.                     list2.Add(xmlNode12);
  490.                 }
  491.             }
  492.             List<Equipment> list3 = new List<Equipment>();
  493.             if (list.Count > 0)
  494.             {
  495.                 int num = 0;
  496.                 foreach (XmlNode xmlNode13 in list)
  497.                 {
  498.                     XmlAttribute xmlAttribute2 = xmlNode13.Attributes["civilian"];
  499.                     bool isCivilian = xmlAttribute2 != null && bool.Parse(xmlAttribute2.Value);
  500.                     list3.Add(new Equipment(isCivilian));
  501.                     list3[list3.Count - 1].Deserialize(objectManager, xmlNode13);
  502.                     num++;
  503.                 }
  504.                 if (list3.Count > 0)
  505.                 {
  506.                     this.AddEquipment(list3);
  507.                 }
  508.             }
  509.             if (list2.Count > 0)
  510.             {
  511.                 foreach (XmlNode node2 in list2)
  512.                 {
  513.                     foreach (Equipment equipment in this._equipments)
  514.                     {
  515.                         if (!equipment.IsCivilian)
  516.                         {
  517.                             equipment.DeserializeNode(objectManager, node2);
  518.                         }
  519.                     }
  520.                 }
  521.             }
  522.             XmlNode xmlNode14 = node.Attributes["default_equipment_set"];
  523.             if (xmlNode14 != null)
  524.             {
  525.                 if (this._equipments[0] == null)
  526.                 {
  527.                     this._equipments[0] = new Equipment(false);
  528.                 }
  529.                 this._equipments[0].FillFrom(Game.Current.GetDefaultEquipmentWithName(xmlNode14.Value), true);
  530.             }
  531.             BasicCharacterObject basicCharacterObject3 = objectManager.ReadObjectReferenceFromXml("battleTemplate", typeof(BasicCharacterObject), node) as BasicCharacterObject;
  532.             if (basicCharacterObject3 != null)
  533.             {
  534.                 List<Equipment> list4 = new List<Equipment>();
  535.                 int num2 = 0;
  536.                 foreach (Equipment equipment2 in basicCharacterObject3.AllEquipments)
  537.                 {
  538.                     if (!equipment2.IsCivilian)
  539.                     {
  540.                         list4.Add(new Equipment(false));
  541.                         list4[num2].FillFrom(equipment2, false);
  542.                         num2++;
  543.                     }
  544.                 }
  545.                 this.AddEquipment(list4);
  546.             }
  547.             BasicCharacterObject basicCharacterObject4 = objectManager.ReadObjectReferenceFromXml("civilianTemplate", typeof(BasicCharacterObject), node) as BasicCharacterObject;
  548.             if (basicCharacterObject4 != null)
  549.             {
  550.                 List<Equipment> list5 = new List<Equipment>();
  551.                 int num3 = 0;
  552.                 foreach (Equipment equipment3 in basicCharacterObject4.AllEquipments)
  553.                 {
  554.                     if (equipment3.IsCivilian)
  555.                     {
  556.                         list5.Add(new Equipment(true));
  557.                         list5[num3].FillFrom(equipment3, false);
  558.                         num3++;
  559.                     }
  560.                 }
  561.                 this.AddEquipment(list5);
  562.             }
  563.             this._equipments = new List<Equipment>(from eq in this._equipments
  564.             orderby !eq.IsCivilian descending
  565.             select eq);
  566.             this._equipmentsAsReadOnlyList = this._equipments.GetReadOnlyList<Equipment>();
  567.         }
  568.  
  569.         // Token: 0x060000F2 RID: 242 RVA: 0x00005418 File Offset: 0x00003618
  570.         private void AddEquipment(List<Equipment> eq)
  571.         {
  572.             if (this._equipments.Contains(this._emptyEquipment))
  573.             {
  574.                 this._equipments.Remove(this._emptyEquipment);
  575.             }
  576.             this._equipments.AddRange(eq);
  577.         }
  578.  
  579.         // Token: 0x060000F3 RID: 243 RVA: 0x0000544C File Offset: 0x0000364C
  580.         protected int FetchDefaultFormationGroup(string innerText)
  581.         {
  582.             FormationClass result;
  583.             if (Enum.TryParse<FormationClass>(innerText, true, out result))
  584.             {
  585.                 return (int)result;
  586.             }
  587.             return -1;
  588.         }
  589.  
  590.         // Token: 0x04000109 RID: 265
  591.         private TextObject _basicName;
  592.  
  593.         // Token: 0x0400010C RID: 268
  594.         private DynamicBodyProperties _dynamicBodyProperties;
  595.  
  596.         // Token: 0x04000111 RID: 273
  597.         private List<Equipment> _equipments;
  598.  
  599.         // Token: 0x04000112 RID: 274
  600.         private MBReadOnlyList<Equipment> _equipmentsAsReadOnlyList;
  601.  
  602.         // Token: 0x04000113 RID: 275
  603.         private Equipment _emptyEquipment;
  604.  
  605.         // Token: 0x04000115 RID: 277
  606.         private BasicCultureObject _culture;
  607.  
  608.         // Token: 0x04000116 RID: 278
  609.         private float _age;
  610.  
  611.         // Token: 0x0400011B RID: 283
  612.         private bool _isBasicHero;
  613.  
  614.         // Token: 0x0400011D RID: 285
  615.         protected CharacterSkills _characterSkills;
  616.     }
  617. }
Advertisement
Add Comment
Please, Sign In to add comment