本文整理汇总了C#中Chummer.Improvement.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Improvement.ToString方法的具体用法?C# Improvement.ToString怎么用?C# Improvement.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chummer.Improvement
的用法示例。
在下文中一共展示了Improvement.ToString方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateImprovements
/// <summary>
/// Create all of the Improvements for an XML Node.
/// </summary>
/// <param name="objImprovementSource">Type of object that grants these Improvements.</param>
/// <param name="strSourceName">Name of the item that grants these Improvements.</param>
/// <param name="nodBonus">bonus XMLXode from the source data file.</param>
/// <param name="blnConcatSelectedValue">Whether or not any selected values should be concatinated with the SourceName string when storing.</param>
/// <param name="intRating">Selected Rating value that is used to replace the Rating string in an Improvement.</param>
/// <param name="strFriendlyName">Friendly name to show in any dialogue windows that ask for a value.</param>
/// <returns>True if successfull</returns>
public bool CreateImprovements(Improvement.ImprovementSource objImprovementSource, string strSourceName,
XmlNode nodBonus, bool blnConcatSelectedValue = false, int intRating = 1, string strFriendlyName = "",
object fCreate = null)
{
Log.Enter("CreateImprovements");
Log.Info("objImprovementSource = " + objImprovementSource.ToString());
Log.Info("strSourceName = " + strSourceName);
Log.Info("nodBonus = " + nodBonus.OuterXml.ToString());
Log.Info("blnConcatSelectedValue = " + blnConcatSelectedValue.ToString());
Log.Info("intRating = " + intRating.ToString());
Log.Info("strFriendlyName = " + strFriendlyName);
Log.Info("intRating = " + intRating.ToString());
bool blnSuccess = true;
/*try
{*/
if (nodBonus == null)
{
_strForcedValue = "";
_strLimitSelection = "";
Log.Exit("CreateImprovements");
return true;
}
string strUnique = "";
if (nodBonus.Attributes["unique"] != null)
strUnique = nodBonus.Attributes["unique"].InnerText;
_strSelectedValue = "";
Log.Info(
"_strForcedValue = " + _strForcedValue);
Log.Info(
"_strLimitSelection = " + _strLimitSelection);
// If no friendly name was provided, use the one from SourceName.
if (strFriendlyName == "")
strFriendlyName = strSourceName;
if (nodBonus.HasChildNodes)
{
Log.Info("Has Child Nodes");
// Select Text (custom entry for things like Allergy).
if (NodeExists(nodBonus, "selecttext"))
{
Log.Info("selecttext");
if (_objCharacter != null)
{
if (_strForcedValue != "")
{
_strLimitSelection = _strForcedValue;
}
else if (_objCharacter.Pushtext.Count != 0)
{
_strLimitSelection = _objCharacter.Pushtext.Pop();
}
}
Log.Info("_strForcedValue = " + _strSelectedValue);
Log.Info("_strLimitSelection = " + _strLimitSelection);
// Display the Select Text window and record the value that was entered.
frmSelectText frmPickText = new frmSelectText();
frmPickText.Description = LanguageManager.Instance.GetString("String_Improvement_SelectText")
.Replace("{0}", strFriendlyName);
if (_strLimitSelection != "")
{
frmPickText.SelectedValue = _strLimitSelection;
frmPickText.Opacity = 0;
}
frmPickText.ShowDialog();
// Make sure the dialogue window was not canceled.
if (frmPickText.DialogResult == DialogResult.Cancel)
{
Rollback();
blnSuccess = false;
_strForcedValue = "";
_strLimitSelection = "";
Log.Exit("CreateImprovements");
return false;
}
_strSelectedValue = frmPickText.SelectedValue;
if (blnConcatSelectedValue)
//.........这里部分代码省略.........
示例2: RemoveImprovements
/// <summary>
/// Remove all of the Improvements for an XML Node.
/// </summary>
/// <param name="objImprovementSource">Type of object that granted these Improvements.</param>
/// <param name="strSourceName">Name of the item that granted these Improvements.</param>
public void RemoveImprovements(Improvement.ImprovementSource objImprovementSource, string strSourceName)
{
Log.Enter("RemoveImprovements");
Log.Info("objImprovementSource = " + objImprovementSource.ToString());
Log.Info("strSourceName = " + strSourceName);
// If there is no character object, don't try to remove any Improvements.
if (_objCharacter == null)
{
Log.Exit("RemoveImprovements");
return;
}
// A List of Improvements to hold all of the items that will eventually be deleted.
List<Improvement> objImprovementList = new List<Improvement>();
foreach (Improvement objImprovement in _objCharacter.Improvements)
{
if (objImprovement.ImproveSource == objImprovementSource && objImprovement.SourceName == strSourceName)
objImprovementList.Add(objImprovement);
}
// Now that we have all of the applicable Improvements, remove them from the character.
foreach (Improvement objImprovement in objImprovementList)
{
// Remove the Improvement.
_objCharacter.Improvements.Remove(objImprovement);
if (objImprovement.ImproveType == Improvement.ImprovementType.SkillLevel)
{
//TODO: Come back here and figure out wtf this did? Think it removed nested lifemodule skills? //Didn't this handle the collapsing knowledge skills thing?
//for (int i = _objCharacter.SkillsSection.Skills.Count - 1; i >= 0; i--)
//{
// //wrote as foreach first, modify collection, not want rename
// Skill skill = _objCharacter.SkillsSection.Skills[i];
// for (int j = skill.Fold.Count - 1; j >= 0; j--)
// {
// Skill fold = skill.Fold[i];
// if (fold.Id.ToString() == objImprovement.ImprovedName)
// {
// skill.Free(fold);
// _objCharacter.SkillsSection.Skills.Remove(fold);
// }
// }
// if (skill.Id.ToString() == objImprovement.ImprovedName)
// {
// while(skill.Fold.Count > 0) skill.Free(skill.Fold[0]);
// //empty list, can't call clear as exposed list is RO
// _objCharacter.SkillsSection.Skills.Remove(skill);
// }
//}
}
if (objImprovement.ImproveType == Improvement.ImprovementType.SkillsoftAccess)
{
_objCharacter.SkillsSection.KnowledgeSkills.RemoveAll(_objCharacter.SkillsSection.KnowsoftSkills.Contains);
}
if (objImprovement.ImproveType == Improvement.ImprovementType.SkillKnowledgeForced)
{
Guid guid = Guid.Parse(objImprovement.ImprovedName);
_objCharacter.SkillsSection.KnowledgeSkills.RemoveAll(skill => skill.Id == guid);
_objCharacter.SkillsSection.KnowsoftSkills.RemoveAll(skill => skill.Id == guid);
}
// Remove "free" adept powers if any.
if (objImprovement.ImproveType == Improvement.ImprovementType.AdeptPower)
{
// Load the power from XML.
// objImprovement.Notes = name of the mentor spirit choice. Find the power name from here.
// TODO: Fix this properly. Generates a null exception if multiple adept powers are added by the improvement, as with the Dragonslayer Mentor Spirit.
try
{
XmlDocument objXmlMentorDocument = new XmlDocument();
objXmlMentorDocument = XmlManager.Instance.Load("mentors.xml");
XmlNode objXmlMentorBonus =
objXmlMentorDocument.SelectSingleNode("/chummer/mentors/mentor/choices/choice[name = \"" +
objImprovement.Notes +
"\"]");
XmlNodeList objXmlPowerList = objXmlMentorBonus["bonus"].SelectNodes("specificpower");
foreach (XmlNode objXmlSpecificPower in objXmlPowerList)
{
// Get the Power information
XmlDocument objXmlDocument = new XmlDocument();
objXmlDocument = XmlManager.Instance.Load("powers.xml");
string strPowerName = objXmlSpecificPower["name"].InnerText;
// Find the power (if it still exists)
foreach (Power objPower in _objCharacter.Powers)
{
if (objPower.Name == strPowerName)
{
// Disable the free property and remove any free levels.
//.........这里部分代码省略.........
示例3: CreateImprovement
/// <summary>
/// Create a new Improvement and add it to the Character.
/// </summary>
/// <param name="strImprovedName">Speicific name of the Improved object - typically the name of an CharacterAttribute being improved.</param>
/// <param name="objImprovementSource">Type of object that grants this Improvement.</param>
/// <param name="strSourceName">Name of the item that grants this Improvement.</param>
/// <param name="objImprovementType">Type of object the Improvement applies to.</param>
/// <param name="strUnique">Name of the pool this Improvement should be added to - only the single higest value in the pool will be applied to the character.</param>
/// <param name="intValue">Set a Value for the Improvement.</param>
/// <param name="intRating">Set a Rating for the Improvement - typically used for Adept Powers.</param>
/// <param name="intMinimum">Improve the Minimum for an CharacterAttribute by the given amount.</param>
/// <param name="intMaximum">Improve the Maximum for an CharacterAttribute by the given amount.</param>
/// <param name="intAugmented">Improve the Augmented value for an CharacterAttribute by the given amount.</param>
/// <param name="intAugmentedMaximum">Improve the Augmented Maximum value for an CharacterAttribute by the given amount.</param>
/// <param name="strExclude">A list of child items that should not receive the Improvement's benefit (typically for Skill Groups).</param>
/// <param name="blnAddToRating">Whether or not the bonus applies to a Skill's Rating instead of the dice pool in general.</param>
public void CreateImprovement(string strImprovedName, Improvement.ImprovementSource objImprovementSource,
string strSourceName, Improvement.ImprovementType objImprovementType, string strUnique,
int intValue = 0, int intRating = 1, int intMinimum = 0, int intMaximum = 0, int intAugmented = 0,
int intAugmentedMaximum = 0, string strExclude = "", bool blnAddToRating = false)
{
Log.Enter("CreateImprovement");
Log.Info(
"strImprovedName = " + strImprovedName);
Log.Info(
"objImprovementSource = " + objImprovementSource.ToString());
Log.Info(
"strSourceName = " + strSourceName);
Log.Info(
"objImprovementType = " + objImprovementType.ToString());
Log.Info( "strUnique = " + strUnique);
Log.Info(
"intValue = " + intValue.ToString());
Log.Info(
"intRating = " + intRating.ToString());
Log.Info(
"intMinimum = " + intMinimum.ToString());
Log.Info(
"intMaximum = " + intMaximum.ToString());
Log.Info(
"intAugmented = " + intAugmented.ToString());
Log.Info(
"intAugmentedMaximum = " + intAugmentedMaximum.ToString());
Log.Info( "strExclude = " + strExclude);
Log.Info(
"blnAddToRating = " + blnAddToRating.ToString());
// Record the improvement.
Improvement objImprovement = new Improvement();
objImprovement.ImprovedName = strImprovedName;
objImprovement.ImproveSource = objImprovementSource;
objImprovement.SourceName = strSourceName;
objImprovement.ImproveType = objImprovementType;
objImprovement.UniqueName = strUnique;
objImprovement.Value = intValue;
objImprovement.Rating = intRating;
objImprovement.Minimum = intMinimum;
objImprovement.Maximum = intMaximum;
objImprovement.Augmented = intAugmented;
objImprovement.AugmentedMaximum = intAugmentedMaximum;
objImprovement.Exclude = strExclude;
objImprovement.AddToRating = blnAddToRating;
// Do not attempt to add the Improvements if the Character is null (as a result of Cyberware being added to a VehicleMod).
if (_objCharacter != null)
{
// Add the Improvement to the list.
_objCharacter.Improvements.Add(objImprovement);
// Add the Improvement to the Transaction List.
_lstTransaction.Add(objImprovement);
}
Log.Exit("CreateImprovement");
}
示例4: ValueOf
/// <summary>
/// Retrieve the total Improvement value for the specified ImprovementType.
/// </summary>
/// <param name="objImprovementType">ImprovementType to retrieve the value of.</param>
/// <param name="blnAddToRating">Whether or not we should only retrieve values that have AddToRating enabled.</param>
/// <param name="strImprovedName">Name to assign to the Improvement.</param>
public int ValueOf(Improvement.ImprovementType objImprovementType, bool blnAddToRating = false,
string strImprovedName = null)
{
Log.Enter("ValueOf");
Log.Info("objImprovementType = " + objImprovementType.ToString());
Log.Info("blnAddToRating = " + blnAddToRating.ToString());
Log.Info("strImprovedName = " + ("" + strImprovedName).ToString());
if (_objCharacter == null)
{
Log.Exit("ValueOf");
return 0;
}
List<string> lstUniqueName = new List<string>();
List<string[,]> lstUniquePair = new List<string[,]>();
int intValue = 0;
foreach (Improvement objImprovement in _objCharacter.Improvements)
{
if (objImprovement.Enabled && !objImprovement.Custom)
{
bool blnAllowed = true;
// Technomancers cannot benefit from Gear-based Matrix Initiative Pass modifiers (Gear - Sim Modules).
if (_objCharacter.RESEnabled && objImprovement.ImproveSource == Improvement.ImprovementSource.Gear &&
objImprovementType == Improvement.ImprovementType.MatrixInitiativePass)
blnAllowed = false;
// Ignore items that apply to a Skill's Rating.
if (objImprovement.AddToRating != blnAddToRating)
blnAllowed = false;
// If an Improved Name has been passed, only retrieve values that have this Improved Name.
if (strImprovedName != null)
{
if (strImprovedName != objImprovement.ImprovedName)
blnAllowed = false;
}
if (blnAllowed)
{
if (objImprovement.UniqueName != "" && objImprovement.ImproveType == objImprovementType)
{
// If this has a UniqueName, run through the current list of UniqueNames seen. If it is not already in the list, add it.
bool blnFound = false;
foreach (string strName in lstUniqueName)
{
if (strName == objImprovement.UniqueName)
blnFound = true;
break;
}
if (!blnFound)
lstUniqueName.Add(objImprovement.UniqueName);
// Add the values to the UniquePair List so we can check them later.
string[,] strValues = new string[,] {{objImprovement.UniqueName, objImprovement.Value.ToString()}};
lstUniquePair.Add(strValues);
}
else
{
if (objImprovement.ImproveType == objImprovementType)
intValue += objImprovement.Value;
}
}
}
}
// Run through the list of UniqueNames and pick out the highest value for each one.
foreach (string strName in lstUniqueName)
{
int intHighest = -999;
foreach (string[,] strValues in lstUniquePair)
{
if (strValues[0, 0] == strName)
{
if (Convert.ToInt32(strValues[0, 1]) > intHighest)
intHighest = Convert.ToInt32(strValues[0, 1]);
}
}
intValue += intHighest;
}
if (lstUniqueName.Contains("precedence1"))
{
intValue = 0;
// Retrieve all of the items that are precedence1 and nothing else.
foreach (string[,] strValues in lstUniquePair)
{
if (strValues[0, 0] == "precedence1")
intValue += Convert.ToInt32(strValues[0, 1]);
}
}
if (lstUniqueName.Contains("precedence0"))
{
// Retrieve only the highest precedence0 value.
// Run through the list of UniqueNames and pick out the highest value for each one.
//.........这里部分代码省略.........
示例5: RemoveImprovements
/// <summary>
/// Remove all of the Improvements for an XML Node.
/// </summary>
/// <param name="objImprovementSource">Type of object that granted these Improvements.</param>
/// <param name="strSourceName">Name of the item that granted these Improvements.</param>
public void RemoveImprovements(Improvement.ImprovementSource objImprovementSource, string strSourceName)
{
Log.Enter("RemoveImprovements");
Log.Info("objImprovementSource = " + objImprovementSource.ToString());
Log.Info("strSourceName = " + strSourceName);
// If there is no character object, don't try to remove any Improvements.
if (_objCharacter == null)
{
Log.Exit("RemoveImprovements");
return;
}
// A List of Improvements to hold all of the items that will eventually be deleted.
List<Improvement> objImprovementList = new List<Improvement>();
foreach (Improvement objImprovement in _objCharacter.Improvements)
{
if (objImprovement.ImproveSource == objImprovementSource && objImprovement.SourceName == strSourceName)
objImprovementList.Add(objImprovement);
}
// Now that we have all of the applicable Improvements, remove them from the character.
foreach (Improvement objImprovement in objImprovementList)
{
// Remove the Improvement.
_objCharacter.Improvements.Remove(objImprovement);
if (objImprovement.ImproveType == Improvement.ImprovementType.SkillLevel)
{
for (int i = _objCharacter.Skills.Count - 1; i >= 0; i--)
{
//wrote as foreach first, modify collection, not want rename
Skill skill = _objCharacter.Skills[i];
for (int j = skill.Fold.Count - 1; j >= 0; j--)
{
Skill fold = skill.Fold[i];
if (fold.Id.ToString() == objImprovement.ImprovedName)
{
skill.Free(fold);
_objCharacter.Skills.Remove(fold);
}
}
if (skill.Id.ToString() == objImprovement.ImprovedName)
{
while(skill.Fold.Count > 0) skill.Free(skill.Fold[0]);
//empty list, can't call clear as exposed list is RO
_objCharacter.Skills.Remove(skill);
}
}
}
// Remove "free" adept powers if any.
if (objImprovement.ImproveType == Improvement.ImprovementType.AdeptPower)
{
// Load the power from XML.
// objImprovement.Notes = name of the mentor spirit choice. Find the power name from here.
XmlDocument objXmlMentorDocument = new XmlDocument();
objXmlMentorDocument = XmlManager.Instance.Load("mentors.xml");
XmlNode objXmlMentorBonus =
objXmlMentorDocument.SelectSingleNode("/chummer/mentors/mentor/choices/choice[name = \"" + objImprovement.Notes +
"\"]");
XmlNodeList objXmlPowerList = objXmlMentorBonus["bonus"].SelectNodes("specificpower");
foreach (XmlNode objXmlSpecificPower in objXmlPowerList)
{
// Get the Power information
XmlDocument objXmlDocument = new XmlDocument();
objXmlDocument = XmlManager.Instance.Load("powers.xml");
string strPowerName = objXmlSpecificPower["name"].InnerText;
// Find the power (if it still exists)
foreach (Power objPower in _objCharacter.Powers)
{
if (objPower.Name == strPowerName)
{
// Disable the free property and remove any free levels.
objPower.Free = false;
objPower.FreeLevels = 0;
}
}
}
}
// Determine if access to any Special Attributes have been lost.
if (objImprovement.ImproveType == Improvement.ImprovementType.Attribute &&
objImprovement.UniqueName == "enableattribute")
{
if (objImprovement.ImprovedName == "MAG")
{
// See if the character has anything else that is granting them access to MAG.
bool blnFound = false;
foreach (Improvement objCharacterImprovement in _objCharacter.Improvements)
{
//.........这里部分代码省略.........
示例6: RemoveImprovements
/// <summary>
/// Remove all of the Improvements for an XML Node.
/// </summary>
/// <param name="objImprovementSource">Type of object that granted these Improvements.</param>
/// <param name="strSourceName">Name of the item that granted these Improvements.</param>
public void RemoveImprovements(Improvement.ImprovementSource objImprovementSource, string strSourceName)
{
objFunctions.LogWrite(CommonFunctions.LogType.Entering, "Chummer.ImprovementManager", "RemoveImprovements");
objFunctions.LogWrite(CommonFunctions.LogType.Content, "Chummer.ImprovementManager", "objImprovementSource = " + objImprovementSource.ToString());
objFunctions.LogWrite(CommonFunctions.LogType.Content, "Chummer.ImprovementManager", "strSourceName = " + strSourceName);
// If there is no character object, don't try to remove any Improvements.
if (_objCharacter == null)
{
objFunctions.LogWrite(CommonFunctions.LogType.Exiting, "Chummer.ImprovementManager", "RemoveImprovements");
return;
}
// A List of Improvements to hold all of the items that will eventually be deleted.
List<Improvement> objImprovementList = new List<Improvement>();
foreach (Improvement objImprovement in _objCharacter.Improvements)
{
if (objImprovement.ImproveSource == objImprovementSource && objImprovement.SourceName == strSourceName)
objImprovementList.Add(objImprovement);
}
// Now that we have all of the applicable Improvements, remove them from the character.
foreach (Improvement objImprovement in objImprovementList)
{
// Remove the Improvement.
_objCharacter.Improvements.Remove(objImprovement);
// Remove "free" adept powers if any.
if (objImprovement.ImproveType == Improvement.ImprovementType.AdeptPower)
{
// Load the power from XML.
// objImprovement.Notes = name of the mentor spirit choice. Find the power name from here.
XmlDocument objXmlMentorDocument = new XmlDocument();
objXmlMentorDocument = XmlManager.Instance.Load("mentors.xml");
XmlNode objXmlMentorBonus = objXmlMentorDocument.SelectSingleNode("/chummer/mentors/mentor/choices/choice[name = \"" + objImprovement.Notes + "\"]");
XmlNodeList objXmlPowerList = objXmlMentorBonus["bonus"].SelectNodes("specificpower");
foreach (XmlNode objXmlSpecificPower in objXmlPowerList)
{
// Get the Power information
XmlDocument objXmlDocument = new XmlDocument();
objXmlDocument = XmlManager.Instance.Load("powers.xml");
string strPowerName = objXmlSpecificPower["name"].InnerText;
// Find the power (if it still exists)
foreach(Power objPower in _objCharacter.Powers)
{
if (objPower.Name == strPowerName)
{
// Disable the free property and remove any free levels.
objPower.Free = false;
objPower.FreeLevels = 0;
}
}
}
}
// Determine if access to any Special Attributes have been lost.
if (objImprovement.ImproveType == Improvement.ImprovementType.Attribute && objImprovement.UniqueName == "enableattribute")
{
if (objImprovement.ImprovedName == "MAG")
{
// See if the character has anything else that is granting them access to MAG.
bool blnFound = false;
foreach (Improvement objCharacterImprovement in _objCharacter.Improvements)
{
// Skip items from the current Improvement source.
if (objCharacterImprovement.SourceName != objImprovement.SourceName)
{
if (objCharacterImprovement.ImproveType == Improvement.ImprovementType.Attribute && objCharacterImprovement.UniqueName == "enableattribute" && objCharacterImprovement.ImprovedName == "MAG")
{
blnFound = true;
break;
}
}
}
if (!blnFound)
_objCharacter.MAGEnabled = false;
}
else if (objImprovement.ImprovedName == "RES")
{
// See if the character has anything else that is granting them access to RES.
bool blnFound = false;
foreach (Improvement objCharacterImprovement in _objCharacter.Improvements)
{
// Skip items from the current Improvement source.
if (objCharacterImprovement.SourceName != objImprovement.SourceName)
{
if (objCharacterImprovement.ImproveType == Improvement.ImprovementType.Attribute && objCharacterImprovement.UniqueName == "enableattribute" && objCharacterImprovement.ImprovedName == "RES")
{
blnFound = true;
break;
}
}
//.........这里部分代码省略.........
示例7: CreateImprovements
/// <summary>
/// Create all of the Improvements for an XML Node.
/// </summary>
/// <param name="objImprovementSource">Type of object that grants these Improvements.</param>
/// <param name="strSourceName">Name of the item that grants these Improvements.</param>
/// <param name="nodBonus">bonus XMLXode from the source data file.</param>
/// <param name="blnConcatSelectedValue">Whether or not any selected values should be concatinated with the SourceName string when storing.</param>
/// <param name="intRating">Selected Rating value that is used to replace the Rating string in an Improvement.</param>
/// <param name="strFriendlyName">Friendly name to show in any dialogue windows that ask for a value.</param>
public bool CreateImprovements(Improvement.ImprovementSource objImprovementSource, string strSourceName, XmlNode nodBonus, bool blnConcatSelectedValue = false, int intRating = 1, string strFriendlyName = "", object fCreate = null)
{
objFunctions.LogWrite(CommonFunctions.LogType.Entering, "Chummer.ImprovementManager", "CreateImprovements");
objFunctions.LogWrite(CommonFunctions.LogType.Content, "Chummer.ImprovementManager", "objImprovementSource = " + objImprovementSource.ToString());
objFunctions.LogWrite(CommonFunctions.LogType.Content, "Chummer.ImprovementManager", "strSourceName = " + strSourceName);
objFunctions.LogWrite(CommonFunctions.LogType.Content, "Chummer.ImprovementManager", "nodBonus = " + nodBonus.OuterXml.ToString());
objFunctions.LogWrite(CommonFunctions.LogType.Content, "Chummer.ImprovementManager", "blnConcatSelectedValue = " + blnConcatSelectedValue.ToString());
objFunctions.LogWrite(CommonFunctions.LogType.Content, "Chummer.ImprovementManager", "intRating = " + intRating.ToString());
objFunctions.LogWrite(CommonFunctions.LogType.Content, "Chummer.ImprovementManager", "strFriendlyName = " + strFriendlyName);
objFunctions.LogWrite(CommonFunctions.LogType.Content, "Chummer.ImprovementManager", "intRating = " + intRating.ToString());
bool blnSuccess = true;
try
{
if (nodBonus == null)
{
_strForcedValue = "";
_strLimitSelection = "";
objFunctions.LogWrite(CommonFunctions.LogType.Exiting, "Chummer.ImprovementManager", "CreateImprovements");
return true;
}
string strUnique = "";
if (nodBonus.Attributes["unique"] != null)
strUnique = nodBonus.Attributes["unique"].InnerText;
_strSelectedValue = "";
objFunctions.LogWrite(CommonFunctions.LogType.Content, "Chummer.ImprovementManager", "_strForcedValue = " + _strForcedValue);
objFunctions.LogWrite(CommonFunctions.LogType.Content, "Chummer.ImprovementManager", "_strLimitSelection = " + _strLimitSelection);
// If no friendly name was provided, use the one from SourceName.
if (strFriendlyName == "")
strFriendlyName = strSourceName;
if (nodBonus.HasChildNodes)
{
objFunctions.LogWrite(CommonFunctions.LogType.Message, "Chummer.ImprovementManager", "Has Child Nodes");
// Select Text (custom entry for things like Allergy).
if (NodeExists(nodBonus, "selecttext"))
{
objFunctions.LogWrite(CommonFunctions.LogType.Message, "Chummer.ImprovementManager", "selecttext");
if (_strForcedValue != "")
_strLimitSelection = _strForcedValue;
objFunctions.LogWrite(CommonFunctions.LogType.Content, "Chummer.ImprovementManager", "_strForcedValue = " + _strSelectedValue);
objFunctions.LogWrite(CommonFunctions.LogType.Content, "Chummer.ImprovementManager", "_strLimitSelection = " + _strLimitSelection);
// Display the Select Text window and record the value that was entered.
frmSelectText frmPickText = new frmSelectText();
frmPickText.Description = LanguageManager.Instance.GetString("String_Improvement_SelectText").Replace("{0}", strFriendlyName);
if (_strLimitSelection != "")
{
frmPickText.SelectedValue = _strLimitSelection;
frmPickText.Opacity = 0;
}
frmPickText.ShowDialog();
// Make sure the dialogue window was not canceled.
if (frmPickText.DialogResult == DialogResult.Cancel)
{
Rollback();
blnSuccess = false;
_strForcedValue = "";
_strLimitSelection = "";
objFunctions.LogWrite(CommonFunctions.LogType.Exiting, "Chummer.ImprovementManager", "CreateImprovements");
return false;
}
_strSelectedValue = frmPickText.SelectedValue;
if (blnConcatSelectedValue)
strSourceName += " (" + _strSelectedValue + ")";
objFunctions.LogWrite(CommonFunctions.LogType.Content, "Chummer.ImprovementManager", "_strSelectedValue = " + _strSelectedValue);
objFunctions.LogWrite(CommonFunctions.LogType.Content, "Chummer.ImprovementManager", "strSourceName = " + strSourceName);
// Create the Improvement.
objFunctions.LogWrite(CommonFunctions.LogType.Message, "Chummer.ImprovementManager", "Calling CreateImprovement");
CreateImprovement(frmPickText.SelectedValue, objImprovementSource, strSourceName, Improvement.ImprovementType.Text, strUnique);
}
}
// If there is no character object, don't attempt to add any Improvements.
if (_objCharacter == null)
{
objFunctions.LogWrite(CommonFunctions.LogType.Content, "Chummer.ImprovementManager", "_objCharacter = Null");
objFunctions.LogWrite(CommonFunctions.LogType.Exiting, "Chummer.ImprovementManager", "CreateImprovements");
return true;
//.........这里部分代码省略.........