예제 #1
0
 /// <summary>
 /// Print the object's XML to the XmlWriter.
 /// </summary>
 /// <param name="objWriter">XmlTextWriter to write with.</param>
 /// <param name="strLanguageToPrint">Language in which to print</param>
 public void Print(XmlTextWriter objWriter, string strLanguageToPrint)
 {
     if (objWriter == null)
     {
         return;
     }
     objWriter.WriteStartElement("critterpower");
     objWriter.WriteElementString("guid", InternalId);
     objWriter.WriteElementString("sourceid", SourceIDString);
     objWriter.WriteElementString("name", DisplayNameShort(strLanguageToPrint));
     objWriter.WriteElementString("fullname", DisplayName(strLanguageToPrint));
     objWriter.WriteElementString("name_english", Name);
     objWriter.WriteElementString("extra", _objCharacter.TranslateExtra(_strExtra, strLanguageToPrint));
     objWriter.WriteElementString("category", DisplayCategory(strLanguageToPrint));
     objWriter.WriteElementString("category_english", Category);
     objWriter.WriteElementString("type", DisplayType(strLanguageToPrint));
     objWriter.WriteElementString("action", DisplayAction(strLanguageToPrint));
     objWriter.WriteElementString("range", DisplayRange(strLanguageToPrint));
     objWriter.WriteElementString("duration", DisplayDuration(strLanguageToPrint));
     objWriter.WriteElementString("karma", Karma.ToString(GlobalSettings.InvariantCultureInfo));
     objWriter.WriteElementString("source", _objCharacter.LanguageBookShort(Source, strLanguageToPrint));
     objWriter.WriteElementString("page", DisplayPage(strLanguageToPrint));
     if (GlobalSettings.PrintNotes)
     {
         objWriter.WriteElementString("notes", Notes);
     }
     objWriter.WriteEndElement();
 }
예제 #2
0
        protected override void WriteDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            ele.TryPathTo("Flags", true, out subEle);
            subEle.Value = Flags.ToString();

            ele.TryPathTo("Fatigue", true, out subEle);
            subEle.Value = Fatigue.ToString();

            ele.TryPathTo("BarterGold", true, out subEle);
            subEle.Value = BarterGold.ToString();

            ele.TryPathTo("Level", true, out subEle);
            subEle.Value = Level.ToString();

            ele.TryPathTo("CalcMin", true, out subEle);
            subEle.Value = CalcMin.ToString();

            ele.TryPathTo("CalcMax", true, out subEle);
            subEle.Value = CalcMax.ToString();

            ele.TryPathTo("SpeedMultiplier", true, out subEle);
            subEle.Value = SpeedMultiplier.ToString();

            ele.TryPathTo("Karma", true, out subEle);
            subEle.Value = Karma.ToString("G15");

            ele.TryPathTo("DispositionBase", true, out subEle);
            subEle.Value = DispositionBase.ToString();

            ele.TryPathTo("TemplateFlags", true, out subEle);
            subEle.Value = TemplateFlags.ToString();
        }
예제 #3
0
        public void Print(XmlTextWriter objWriter)
        {
            objWriter.WriteStartElement("skill");

            int rating     = PoolOtherAttribute(AttributeObject.TotalValue);
            int specRating = Specializations.Count == 0
                                ? rating
                                : (!IsKnowledgeSkill && Name == "Artisan" &&
                                   CharacterObject.Qualities.Any(objQuality => objQuality.Name == "Inspired")
                                        ? rating + 3
                                        : rating + 2);

            int ratingModifiers = 0, dicePoolModifiers = 0;

            objWriter.WriteElementString("name", DisplayName);
            objWriter.WriteElementString("skillgroup", SkillGroupObject?.DisplayName ?? LanguageManager.Instance.GetString("String_None"));
            objWriter.WriteElementString("skillgroup_english", SkillGroupObject?.Name ?? LanguageManager.Instance.GetString("String_None"));
            objWriter.WriteElementString("skillcategory", SkillCategory);
            objWriter.WriteElementString("skillcategory_english", SkillCategory);              //Might exist legacy but not existing atm, will see if stuff breaks
            objWriter.WriteElementString("grouped", (SkillGroupObject?.CareerIncrease).ToString());
            objWriter.WriteElementString("default", Default.ToString());
            objWriter.WriteElementString("rating", Rating.ToString());
            objWriter.WriteElementString("ratingmax", RatingMaximum.ToString());
            objWriter.WriteElementString("specializedrating", specRating.ToString());
            objWriter.WriteElementString("total", PoolOtherAttribute(AttributeObject.TotalValue).ToString());
            objWriter.WriteElementString("knowledge", IsKnowledgeSkill.ToString());
            objWriter.WriteElementString("exotic", IsExoticSkill.ToString());
            objWriter.WriteElementString("buywithkarma", BuyWithKarma.ToString());
            objWriter.WriteElementString("base", Base.ToString());
            objWriter.WriteElementString("karma", Karma.ToString());
            objWriter.WriteElementString("spec", Specialization);
            objWriter.WriteElementString("attribute", Attribute);
            objWriter.WriteElementString("displayattribute", DisplayAttribute);
            objWriter.WriteElementString("notes", _strNotes);
            objWriter.WriteElementString("source", CharacterObject.Options.LanguageBookShort(Source));
            objWriter.WriteElementString("page", Page);
            if (Attribute == "MAG" && CharacterObject.AdeptEnabled && CharacterObject.MagicianEnabled)
            {
                objWriter.WriteElementString("attributemod", CharacterObject.MAGMagician.ToString());
            }
            else
            {
                objWriter.WriteElementString("attributemod", CharacterObject.GetAttribute(Attribute).TotalValue.ToString());
            }
            objWriter.WriteElementString("ratingmod", (ratingModifiers + dicePoolModifiers).ToString());
            objWriter.WriteElementString("poolmod", dicePoolModifiers.ToString());
            objWriter.WriteElementString("islanguage", (SkillCategory == "Language").ToString());
            objWriter.WriteElementString("bp", CurrentKarmaCost().ToString());
            objWriter.WriteStartElement("skillspecializations");
            foreach (SkillSpecialization objSpec in Specializations)
            {
                objSpec.Print(objWriter);
            }
            objWriter.WriteEndElement();

            objWriter.WriteEndElement();
        }
예제 #4
0
        /// <summary>
        /// Print the object's XML to the XmlWriter.
        /// </summary>
        /// <param name="objWriter">XmlTextWriter to write with.</param>
        /// <param name="strLanguageToPrint">Language in which to print</param>
        public async ValueTask Print(XmlWriter objWriter, string strLanguageToPrint)
        {
            if (objWriter == null)
            {
                return;
            }
            // <critterpower>
            XmlElementWriteHelper objBaseElement = await objWriter.StartElementAsync("critterpower");

            try
            {
                await objWriter.WriteElementStringAsync("guid", InternalId);

                await objWriter.WriteElementStringAsync("sourceid", SourceIDString);

                await objWriter.WriteElementStringAsync("name", await DisplayNameShortAsync(strLanguageToPrint));

                await objWriter.WriteElementStringAsync("fullname", await DisplayNameAsync(strLanguageToPrint));

                await objWriter.WriteElementStringAsync("name_english", Name);

                await objWriter.WriteElementStringAsync("extra", await _objCharacter.TranslateExtraAsync(_strExtra, strLanguageToPrint));

                await objWriter.WriteElementStringAsync("category", await DisplayCategoryAsync(strLanguageToPrint));

                await objWriter.WriteElementStringAsync("category_english", Category);

                await objWriter.WriteElementStringAsync("type", await DisplayTypeAsync(strLanguageToPrint));

                await objWriter.WriteElementStringAsync("action", await DisplayActionAsync(strLanguageToPrint));

                await objWriter.WriteElementStringAsync("range", await DisplayRangeAsync(strLanguageToPrint));

                await objWriter.WriteElementStringAsync("duration", await DisplayDurationAsync(strLanguageToPrint));

                await objWriter.WriteElementStringAsync("karma", Karma.ToString(GlobalSettings.InvariantCultureInfo));

                await objWriter.WriteElementStringAsync("source", await _objCharacter.LanguageBookShortAsync(Source, strLanguageToPrint));

                await objWriter.WriteElementStringAsync("page", await DisplayPageAsync(strLanguageToPrint));

                if (GlobalSettings.PrintNotes)
                {
                    await objWriter.WriteElementStringAsync("notes", Notes);
                }
            }
            finally
            {
                // </critterpower>
                await objBaseElement.DisposeAsync();
            }
        }
예제 #5
0
        internal void Print(XmlWriter objWriter, CultureInfo objCulture, string strLanguageToPrint)
        {
            objWriter.WriteStartElement("skillgroup");

            objWriter.WriteElementString("name", DisplayNameMethod(strLanguageToPrint));
            objWriter.WriteElementString("name_english", Name);
            objWriter.WriteElementString("rating", Rating.ToString(objCulture));
            objWriter.WriteElementString("ratingmax", RatingMaximum.ToString(objCulture));
            objWriter.WriteElementString("base", Base.ToString(objCulture));
            objWriter.WriteElementString("karma", Karma.ToString(objCulture));

            objWriter.WriteEndElement();
        }
예제 #6
0
        internal void Print(XmlWriter objWriter)
        {
            objWriter.WriteStartElement("skillgroup");

            objWriter.WriteElementString("name", DisplayName);
            objWriter.WriteElementString("name_english", Name);
            objWriter.WriteElementString("rating", Rating.ToString());
            objWriter.WriteElementString("ratingmax", RatingMaximum.ToString());
            objWriter.WriteElementString("base", Base.ToString());
            objWriter.WriteElementString("karma", Karma.ToString());

            objWriter.WriteEndElement();
        }
예제 #7
0
파일: Skill.cs 프로젝트: PStucke/chummer5a
        public void Print(XmlTextWriter objWriter)
        {
            KnowledgeSkill objSkillAsKnowledgeSkill = this as KnowledgeSkill;

            objWriter.WriteStartElement("skill");

            int rating     = PoolOtherAttribute(AttributeObject.TotalValue);
            int specRating = Specializations.Count == 0 || CharacterObject.Improvements.Any(objImprovement => objImprovement.ImproveType == Improvement.ImprovementType.DisableSpecializationEffects && objImprovement.UniqueName == Name && string.IsNullOrEmpty(objImprovement.Condition))
                ? rating
                : (!IsKnowledgeSkill && Name == "Artisan" &&
                   CharacterObject.Qualities.Any(objQuality => objQuality.Name == "Inspired")
                    ? rating + 3
                    : rating + 2);

            int ratingModifiers = RatingModifiers, dicePoolModifiers = PoolModifiers;

            if (objSkillAsKnowledgeSkill == null)
            {
                objWriter.WriteElementString("name", DisplayName);
            }
            else
            {
                objWriter.WriteElementString("name", objSkillAsKnowledgeSkill.WriteableName);
            }
            objWriter.WriteElementString("skillgroup", SkillGroupObject?.DisplayName ?? LanguageManager.GetString("String_None"));
            objWriter.WriteElementString("skillgroup_english", SkillGroupObject?.Name ?? LanguageManager.GetString("String_None"));
            objWriter.WriteElementString("skillcategory", DisplayCategory);
            objWriter.WriteElementString("skillcategory_english", SkillCategory);  //Might exist legacy but not existing atm, will see if stuff breaks
            objWriter.WriteElementString("grouped", (SkillGroupObject != null && SkillGroupObject.CareerIncrease && SkillGroupObject.Rating > 0).ToString());
            objWriter.WriteElementString("default", Default.ToString());
            objWriter.WriteElementString("rating", Rating.ToString());
            objWriter.WriteElementString("ratingmax", RatingMaximum.ToString());
            objWriter.WriteElementString("specializedrating", specRating.ToString());
            objWriter.WriteElementString("specbonus", (specRating - rating).ToString());
            objWriter.WriteElementString("total", PoolOtherAttribute(AttributeObject.TotalValue).ToString());
            objWriter.WriteElementString("knowledge", IsKnowledgeSkill.ToString());
            objWriter.WriteElementString("exotic", IsExoticSkill.ToString());
            objWriter.WriteElementString("buywithkarma", BuyWithKarma.ToString());
            objWriter.WriteElementString("base", Base.ToString());
            objWriter.WriteElementString("karma", Karma.ToString());
            objWriter.WriteElementString("spec", DisplaySpecialization);
            objWriter.WriteElementString("attribute", Attribute);
            objWriter.WriteElementString("displayattribute", DisplayAttribute);
            if (CharacterObject.Options.PrintNotes)
            {
                objWriter.WriteElementString("notes", _strNotes);
            }
            objWriter.WriteElementString("source", CharacterObject.Options.LanguageBookShort(Source));
            objWriter.WriteElementString("page", Page);
            objWriter.WriteElementString("attributemod", CharacterObject.GetAttribute(Attribute).TotalValue.ToString());
            objWriter.WriteElementString("ratingmod", (ratingModifiers + dicePoolModifiers).ToString());
            objWriter.WriteElementString("poolmod", dicePoolModifiers.ToString());
            objWriter.WriteElementString("islanguage", (SkillCategory == "Language").ToString());
            objWriter.WriteElementString("bp", CurrentKarmaCost().ToString());
            objWriter.WriteStartElement("skillspecializations");
            foreach (SkillSpecialization objSpec in Specializations)
            {
                objSpec.Print(objWriter);
            }
            objWriter.WriteEndElement();

            objWriter.WriteEndElement();
        }