Ejemplo n.º 1
0
 public static BodyProperties GetRandomBodyProperties(
     bool isFemale,
     BodyProperties bodyPropertiesMin,
     BodyProperties bodyPropertiesMax,
     int hairCoverType,
     int seed,
     string hairTags,
     string beardTags,
     string tattooTags)
 {
     return(FaceGen.GetRandomBodyProperties(isFemale, bodyPropertiesMin, bodyPropertiesMax, hairCoverType, seed, hairTags, beardTags, tattooTags));
 }
 public void Init(BodyProperties bodyPropertyMin, BodyProperties bodyPropertyMax)
 {
     this._bodyPropertyMin = bodyPropertyMin;
     this._bodyPropertyMax = bodyPropertyMax;
     if ((double)this._bodyPropertyMax.Age <= 0.0)
     {
         this._bodyPropertyMax = this._bodyPropertyMin;
     }
     if ((double)this._bodyPropertyMin.Age > 0.0)
     {
         return;
     }
     this._bodyPropertyMin = this._bodyPropertyMax;
 }
Ejemplo n.º 3
0
        public static bool FromXmlNode(XmlNode node, out BodyProperties bodyProperties)
        {
            XmlAttributeCollection attributes = node.Attributes;
            float result1;
            float result2;
            float result3;
            DynamicBodyProperties dynamicBodyProperties = (attributes != null ? (attributes.Count == 5 ? 1 : 0) : 0) == 0 || node.Attributes["age"].Value == null || (node.Attributes["weight"].Value == null || node.Attributes["build"].Value == null) ? new DynamicBodyProperties() : (!float.TryParse(node.Attributes["age"].Value, out result1) || !float.TryParse(node.Attributes["weight"].Value, out result2) || !float.TryParse(node.Attributes["build"].Value, out result3) ? new DynamicBodyProperties() : new DynamicBodyProperties(result1, result2, result3));
            StaticBodyProperties  staticBodyProperties;

            if (StaticBodyProperties.FromXmlNode(node, out staticBodyProperties))
            {
                bodyProperties = new BodyProperties(dynamicBodyProperties, staticBodyProperties);
                return(true);
            }
            bodyProperties = new BodyProperties();
            return(false);
        }
Ejemplo n.º 4
0
 public static bool FromString(string keyValue, out BodyProperties bodyProperties)
 {
     if (keyValue.StartsWith("<BodyProperties ", StringComparison.InvariantCultureIgnoreCase) || keyValue.StartsWith("<BodyPropertiesMax ", StringComparison.InvariantCultureIgnoreCase))
     {
         XmlDocument xmlDocument = new XmlDocument();
         try
         {
             xmlDocument.LoadXml(keyValue);
         }
         catch (XmlException ex)
         {
             bodyProperties = new BodyProperties();
             return(false);
         }
         if (xmlDocument.FirstChild.Name.Equals(nameof(BodyProperties), StringComparison.InvariantCultureIgnoreCase) || xmlDocument.FirstChild.Name.Equals("BodyPropertiesMax", StringComparison.InvariantCultureIgnoreCase))
         {
             BodyProperties.FromXmlNode(xmlDocument.FirstChild, out bodyProperties);
             float result1 = 20f;
             float result2 = 0.0f;
             float result3 = 0.0f;
             if (xmlDocument.FirstChild.Attributes["age"] != null)
             {
                 float.TryParse(xmlDocument.FirstChild.Attributes["age"].Value, out result1);
             }
             if (xmlDocument.FirstChild.Attributes["weight"] != null)
             {
                 float.TryParse(xmlDocument.FirstChild.Attributes["weight"].Value, out result2);
             }
             if (xmlDocument.FirstChild.Attributes["build"] != null)
             {
                 float.TryParse(xmlDocument.FirstChild.Attributes["build"].Value, out result3);
             }
             bodyProperties = new BodyProperties(new DynamicBodyProperties(result1, result2, result3), bodyProperties.StaticProperties);
             return(true);
         }
         bodyProperties = new BodyProperties();
         return(false);
     }
     bodyProperties = new BodyProperties();
     return(false);
 }
        public static CharacterCode CreateFrom(
            string equipmentCode,
            BodyProperties bodyProperties,
            bool isFemale,
            bool isHero,
            uint color1,
            uint color2,
            FormationClass formationClass)
        {
            CharacterCode characterCode = new CharacterCode();

            characterCode.EquipmentCode  = equipmentCode;
            characterCode.BodyProperties = bodyProperties;
            characterCode.IsFemale       = isFemale;
            characterCode.IsHero         = isHero;
            characterCode.Color1         = color1;
            characterCode.Color2         = color2;
            characterCode.FormationClass = formationClass;
            MBStringBuilder mbStringBuilder = new MBStringBuilder();

            mbStringBuilder.Initialize(callerMemberName: nameof(CreateFrom));
            mbStringBuilder.Append <string>("@---@");
            mbStringBuilder.Append <string>(equipmentCode);
            mbStringBuilder.Append <string>("@---@");
            mbStringBuilder.Append <string>(characterCode.BodyProperties.ToString());
            mbStringBuilder.Append <string>("@---@");
            mbStringBuilder.Append <string>(characterCode.IsFemale ? "1" : "0");
            mbStringBuilder.Append <string>("@---@");
            mbStringBuilder.Append <string>(characterCode.IsHero ? "1" : "0");
            mbStringBuilder.Append <string>("@---@");
            mbStringBuilder.Append <string>(((int)characterCode.FormationClass).ToString());
            mbStringBuilder.Append <string>("@---@");
            mbStringBuilder.Append <string>(characterCode.Color1.ToString());
            mbStringBuilder.Append <string>("@---@");
            mbStringBuilder.Append <string>(characterCode.Color2.ToString());
            mbStringBuilder.Append <string>("@---@");
            characterCode.Code = mbStringBuilder.ToStringAndRelease();
            return(characterCode);
        }
 public override void Deserialize(MBObjectManager objectManager, XmlNode node)
 {
     base.Deserialize(objectManager, node);
     foreach (XmlNode childNode in node.ChildNodes)
     {
         if (childNode.Name == "BodyPropertiesMin")
         {
             BodyProperties.FromXmlNode(childNode, out this._bodyPropertyMin);
         }
         else if (childNode.Name == "BodyPropertiesMax")
         {
             BodyProperties.FromXmlNode(childNode, out this._bodyPropertyMax);
         }
     }
     if ((double)this._bodyPropertyMax.Age <= 0.0)
     {
         this._bodyPropertyMax = this._bodyPropertyMin;
     }
     if ((double)this._bodyPropertyMin.Age > 0.0)
     {
         return;
     }
     this._bodyPropertyMin = this._bodyPropertyMax;
 }
Ejemplo n.º 7
0
 public AgentBuildData BodyProperties(TaleWorlds.Core.BodyProperties bodyProperties)
 {
     this.AgentData.BodyProperties(bodyProperties);
     return(this);
 }
 public AgentVisualsData BodyProperties(TaleWorlds.Core.BodyProperties bodyProperties)
 {
     this.BodyPropertiesData = bodyProperties;
     return(this);
 }