本文整理汇总了C#中Chummer.Quality类的典型用法代码示例。如果您正苦于以下问题:C# Quality类的具体用法?C# Quality怎么用?C# Quality使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Quality类属于Chummer命名空间,在下文中一共展示了Quality类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Load
//.........这里部分代码省略.........
{
}
// Sum to X point value.
try
{
_intSumtoTen = Convert.ToInt32(objXmlCharacter["sumtoten"].InnerText);
}
catch
{
}
// Build Points/Karma.
_intBuildPoints = Convert.ToInt32(objXmlCharacter["bp"].InnerText);
try
{
_intBuildKarma = Convert.ToInt32(objXmlCharacter["buildkarma"].InnerText);
if (_intMaxKarma == 0)
_intMaxKarma = _intBuildKarma;
if (_intBuildKarma == 35 && _strGameplayOption == "")
{
_strGameplayOption = "Prime Runner";
}
if (_intBuildKarma == 35 && _intMaxNuyen == 0)
{
_intMaxNuyen = 25;
}
}
catch
{
}
//Maximum number of Karma that can be spent/gained on Qualities.
try
{
_intGameplayOptionQualityLimit = Convert.ToInt32(objXmlCharacter["gameplayoptionqualitylimit"].InnerText);
}
catch
{
}
try
{
_objBuildMethod = ConvertToCharacterBuildMethod(objXmlCharacter["buildmethod"].InnerText);
}
catch
{
}
try
{
_intKnowledgeSkills = Convert.ToInt32(objXmlCharacter["knowskillpts"].InnerText);
}
catch { }
_intKnowledgeSkillPoints = Convert.ToInt32(objXmlCharacter["knowpts"].InnerText);
_intSkillPoints = Convert.ToInt32(objXmlCharacter["skillpts"].InnerText);
_intSkillPointsMaximum = Convert.ToInt32(objXmlCharacter["skillptsmax"].InnerText);
_intSkillGroups = Convert.ToInt32(objXmlCharacter["skillgrps"].InnerText);
_intSkillGroupsMaximum = Convert.ToInt32(objXmlCharacter["skillgrpsmax"].InnerText);
_decNuyenBP = Convert.ToDecimal(objXmlCharacter["nuyenbp"].InnerText, GlobalOptions.Instance.CultureInfo);
_decNuyenMaximumBP = Convert.ToDecimal(objXmlCharacter["nuyenmaxbp"].InnerText, GlobalOptions.Instance.CultureInfo);
_blnAdeptEnabled = Convert.ToBoolean(objXmlCharacter["adept"].InnerText);
_blnMagicianEnabled = Convert.ToBoolean(objXmlCharacter["magician"].InnerText);
_blnTechnomancerEnabled = Convert.ToBoolean(objXmlCharacter["technomancer"].InnerText);
try
{
_blnInitiationEnabled = Convert.ToBoolean(objXmlCharacter["initiationoverride"].InnerText);
}
catch
开发者ID:ercflemng,项目名称:chummer5a,代码行数:67,代码来源:clsCharacter.cs
示例2: ConvertOldQualities
/// <summary>
/// Convert Qualities that are still saved in the old format.
/// </summary>
private void ConvertOldQualities(XmlNodeList objXmlQualityList)
{
XmlDocument objXmlQualityDocument = XmlManager.Instance.Load("qualities.xml");
XmlDocument objXmlMetatypeDocument = XmlManager.Instance.Load("metatypes.xml");
// Convert the old Qualities.
foreach (XmlNode objXmlQuality in objXmlQualityList)
{
if (objXmlQuality["name"] == null)
{
_lstOldQualities.Add(objXmlQuality.InnerText);
string strForceValue = "";
XmlNode objXmlQualityNode = objXmlQualityDocument.SelectSingleNode("/chummer/qualities/quality[name = \"" + GetQualityName(objXmlQuality.InnerText) + "\"]");
// Re-create the bonuses for the Quality.
if (objXmlQualityNode.InnerXml.Contains("<bonus>"))
{
// Look for the existing Improvement.
foreach (Improvement objImprovement in _lstImprovements)
{
if (objImprovement.ImproveSource == Improvement.ImprovementSource.Quality && objImprovement.SourceName == objXmlQuality.InnerText && objImprovement.Enabled)
{
strForceValue = objImprovement.ImprovedName;
_lstImprovements.Remove(objImprovement);
break;
}
}
}
// Convert the item to the new Quality class.
Quality objQuality = new Quality(this);
List<Weapon> objWeapons = new List<Weapon>();
List<TreeNode> objWeaponNodes = new List<TreeNode>();
TreeNode objNode = new TreeNode();
objQuality.Create(objXmlQualityNode, this, QualitySource.Selected, objNode, objWeapons, objWeaponNodes, strForceValue);
_lstQualities.Add(objQuality);
// Add any created Weapons to the character.
foreach (Weapon objWeapon in objWeapons)
_lstWeapons.Add(objWeapon);
}
}
// Take care of the Metatype information.
XmlNode objXmlMetatype = objXmlMetatypeDocument.SelectSingleNode("/chummer/metatypes/metatype[name = \"" + _strMetatype + "\"]");
if (objXmlMetatype == null)
{
objXmlMetatypeDocument = XmlManager.Instance.Load("critters.xml");
objXmlMetatype = objXmlMetatypeDocument.SelectSingleNode("/chummer/metatypes/metatype[name = \"" + _strMetatype + "\"]");
}
// Positive Qualities.
foreach (XmlNode objXmlMetatypeQuality in objXmlMetatype.SelectNodes("qualities/positive/quality"))
{
bool blnFound = false;
// See if the Quality already exists in the character.
foreach (Quality objCharacterQuality in _lstQualities)
{
if (objCharacterQuality.Name == objXmlMetatypeQuality.InnerText)
{
blnFound = true;
break;
}
}
// If the Quality was not found, create it.
if (!blnFound)
{
string strForceValue = "";
TreeNode objNode = new TreeNode();
List<Weapon> objWeapons = new List<Weapon>();
List<TreeNode> objWeaponNodes = new List<TreeNode>();
Quality objQuality = new Quality(this);
if (objXmlMetatypeQuality.Attributes["select"] != null)
strForceValue = objXmlMetatypeQuality.Attributes["select"].InnerText;
XmlNode objXmlQuality = objXmlQualityDocument.SelectSingleNode("/chummer/qualities/quality[name = \"" + objXmlMetatypeQuality.InnerText + "\"]");
objQuality.Create(objXmlQuality, this, QualitySource.Metatype, objNode, objWeapons, objWeaponNodes, strForceValue);
_lstQualities.Add(objQuality);
// Add any created Weapons to the character.
foreach (Weapon objWeapon in objWeapons)
_lstWeapons.Add(objWeapon);
}
}
// Negative Qualities.
foreach (XmlNode objXmlMetatypeQuality in objXmlMetatype.SelectNodes("qualities/negative/quality"))
{
bool blnFound = false;
// See if the Quality already exists in the character.
foreach (Quality objCharacterQuality in _lstQualities)
{
if (objCharacterQuality.Name == objXmlMetatypeQuality.InnerText)
//.........这里部分代码省略.........
开发者ID:ercflemng,项目名称:chummer5a,代码行数:101,代码来源:clsCharacter.cs
示例3: cmdSwapQuality_Click
private void cmdSwapQuality_Click(object sender, EventArgs e)
{
// Locate the selected Quality.
try
{
if (treQualities.SelectedNode.Level == 0)
return;
}
catch
{
return;
}
Quality objQuality = _objFunctions.FindQuality(treQualities.SelectedNode.Tag.ToString(), _objCharacter.Qualities);
// Qualities that come from a Metatype cannot be removed.
if (objQuality.OriginSource == QualitySource.Metatype)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_MetavariantQualitySwap"), LanguageManager.Instance.GetString("MessageTitle_MetavariantQualitySwap"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
frmSelectQuality frmPickQuality = new frmSelectQuality(_objCharacter);
frmPickQuality.ForceCategory = objQuality.Type.ToString();
frmPickQuality.IgnoreQuality = objQuality.Name;
frmPickQuality.ShowDialog(this);
// Don't do anything else if the form was canceled.
if (frmPickQuality.DialogResult == DialogResult.Cancel)
return;
XmlDocument objXmlDocument = XmlManager.Instance.Load("qualities.xml");
XmlNode objXmlQuality = objXmlDocument.SelectSingleNode("/chummer/qualities/quality[name = \"" + frmPickQuality.SelectedQuality + "\"]");
TreeNode objNode = new TreeNode();
List<Weapon> objWeapons = new List<Weapon>();
List<TreeNode> objWeaponNodes = new List<TreeNode>();
Quality objNewQuality = new Quality(_objCharacter);
objNewQuality.Create(objXmlQuality, _objCharacter, QualitySource.Selected, objNode, objWeapons, objWeaponNodes);
objNode.ContextMenuStrip = cmsQuality;
if (objQuality.InternalId == Guid.Empty.ToString())
return;
bool blnAddItem = true;
int intKarmaCost = (objNewQuality.BP - objQuality.BP) * _objOptions.KarmaQuality;
// Make sure the character has enough Karma to pay for the Quality.
if (objNewQuality.Type == QualityType.Positive)
{
if (intKarmaCost > _objCharacter.Karma)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughKarma"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughKarma"), MessageBoxButtons.OK, MessageBoxIcon.Information);
blnAddItem = false;
}
if (blnAddItem)
{
if (!ConfirmKarmaExpense(LanguageManager.Instance.GetString("Message_QualitySwap").Replace("{0}", objQuality.DisplayNameShort).Replace("{1}", objNewQuality.DisplayNameShort)))
blnAddItem = false;
}
if (blnAddItem)
{
// Create the Karma expense.
ExpenseLogEntry objExpense = new ExpenseLogEntry();
objExpense.Create(intKarmaCost * -1, LanguageManager.Instance.GetString("String_ExpenseSwapPositiveQuality").Replace("{0}", objQuality.DisplayNameShort).Replace("{1}", objNewQuality.DisplayNameShort), ExpenseType.Karma, DateTime.Now);
_objCharacter.ExpenseEntries.Add(objExpense);
_objCharacter.Karma -= intKarmaCost;
}
}
else
{
// This should only happen when a character is trading up to a less-costly Quality.
if (intKarmaCost > 0)
{
if (intKarmaCost > _objCharacter.Karma)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughKarma"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughKarma"), MessageBoxButtons.OK, MessageBoxIcon.Information);
blnAddItem = false;
}
if (blnAddItem)
{
if (!ConfirmKarmaExpense(LanguageManager.Instance.GetString("Message_QualitySwap").Replace("{0}", objQuality.Name).Replace("{1}", objNewQuality.Name)))
blnAddItem = false;
}
if (blnAddItem)
{
// Create the Karma expense.
ExpenseLogEntry objExpense = new ExpenseLogEntry();
objExpense.Create(intKarmaCost * -1, LanguageManager.Instance.GetString("String_ExpenseSwapNegativeQuality").Replace("{0}", objQuality.DisplayNameShort).Replace("{1}", objNewQuality.DisplayNameShort), ExpenseType.Karma, DateTime.Now);
_objCharacter.ExpenseEntries.Add(objExpense);
_objCharacter.Karma -= intKarmaCost;
}
}
}
if (blnAddItem)
//.........这里部分代码省略.........
开发者ID:Althalusdlg,项目名称:chummer5a,代码行数:101,代码来源:frmCareer.cs
示例4: cmdDeleteQuality_Click
private void cmdDeleteQuality_Click(object sender, EventArgs e)
{
// Locate the selected Quality.
try
{
if (treQualities.SelectedNode.Level == 0)
return;
}
catch
{
return;
}
Quality objQuality = _objFunctions.FindQuality(treQualities.SelectedNode.Tag.ToString(), _objCharacter.Qualities);
XmlDocument objXmlDocument = XmlManager.Instance.Load("qualities.xml");
// Qualities that come from a Metatype cannot be removed.
if (objQuality.OriginSource == QualitySource.Metatype)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_MetavariantQuality"), LanguageManager.Instance.GetString("MessageTitle_MetavariantQuality"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
else if (objQuality.OriginSource == QualitySource.MetatypeRemovable)
{
// Look up the cost of the Quality.
XmlNode objXmlMetatypeQuality = objXmlDocument.SelectSingleNode("/chummer/qualities/quality[name = \"" + objQuality.Name + "\"]");
int intBP = Convert.ToInt32(objXmlMetatypeQuality["bp"].InnerText) * -1;
int intShowBP = intBP;
if (_objCharacter.BuildMethod == CharacterBuildMethod.Karma)
intShowBP *= _objOptions.KarmaQuality;
string strBP = intShowBP.ToString();
if (_objCharacter.BuildMethod == CharacterBuildMethod.Karma)
strBP += " " + LanguageManager.Instance.GetString("String_Karma");
else
strBP += " " + LanguageManager.Instance.GetString("String_BP");
if (!_objFunctions.ConfirmDelete(LanguageManager.Instance.GetString("Message_DeleteMetatypeQuality").Replace("{0}", strBP)))
return;
// Remove any Improvements that the Quality might have.
if (objXmlMetatypeQuality["bonus"] != null)
objXmlMetatypeQuality["bonus"].InnerText = "";
TreeNode objEmptyNode = new TreeNode();
List<Weapon> objWeapons = new List<Weapon>();
List<TreeNode> objWeaponNodes = new List<TreeNode>();
Quality objReplaceQuality = new Quality(_objCharacter);
objReplaceQuality.Create(objXmlMetatypeQuality, _objCharacter, QualitySource.Selected, objEmptyNode, objWeapons, objWeaponNodes);
objReplaceQuality.Cost *= -1;
// If a Negative Quality is being bought off, the replacement one is Positive.
if (objQuality.Type == QualityType.Positive)
objQuality.Type = QualityType.Negative;
else
objReplaceQuality.Type = QualityType.Positive;
// The replacement Quality does not count towards the BP limit of the new type, nor should it be printed.
objReplaceQuality.AllowPrint = false;
objReplaceQuality.ContributeToLimit = false;
_objCharacter.Qualities.Add(objReplaceQuality);
}
else
{
if (!_objFunctions.ConfirmDelete(LanguageManager.Instance.GetString("Message_DeleteQuality")))
return;
}
// Remove the Improvements that were created by the Quality.
_objImprovementManager.RemoveImprovements(Improvement.ImprovementSource.Quality, objQuality.InternalId);
XmlNode objXmlDeleteQuality = objXmlDocument.SelectSingleNode("/chummer/qualities/quality[name = \"" + objQuality.Name + "\"]");
// Remove any Critter Powers that are gained through the Quality (Infected).
if (objXmlDeleteQuality.SelectNodes("powers/power").Count > 0)
{
objXmlDocument = XmlManager.Instance.Load("critterpowers.xml");
foreach (XmlNode objXmlPower in objXmlDeleteQuality.SelectNodes("powers/power"))
{
string strExtra = "";
if (objXmlPower.Attributes["select"] != null)
strExtra = objXmlPower.Attributes["select"].InnerText;
foreach (CritterPower objPower in _objCharacter.CritterPowers)
{
if (objPower.Name == objXmlPower.InnerText && objPower.Extra == strExtra)
{
// Remove any Improvements created by the Critter Power.
_objImprovementManager.RemoveImprovements(Improvement.ImprovementSource.CritterPower, objPower.InternalId);
// Remove the Critter Power from the character.
_objCharacter.CritterPowers.Remove(objPower);
// Remove the Critter Power from the Tree.
foreach (TreeNode objNode in treCritterPowers.Nodes[0].Nodes)
{
if (objNode.Tag.ToString() == objPower.InternalId)
{
objNode.Remove();
break;
}
}
//.........这里部分代码省略.........
开发者ID:janhelke,项目名称:chummer2,代码行数:101,代码来源:frmCreate.cs
示例5: AddQuality
private Quality AddQuality(XmlNode objXmlAddQuality, XmlNode objXmlSelectedQuality, List<Weapon> objWeapons, List<TreeNode> objWeaponNodes)
{
string strForceValue = "";
if (objXmlAddQuality.Attributes["select"] != null)
strForceValue = objXmlAddQuality.Attributes["select"].InnerText;
bool blnAddQuality = true;
// Make sure the character does not yet have this Quality.
foreach (Quality objCharacterQuality in _objCharacter.Qualities)
{
if (objCharacterQuality.Name == objXmlAddQuality.InnerText && objCharacterQuality.Extra == strForceValue)
{
blnAddQuality = false;
break;
}
}
if (blnAddQuality)
{
TreeNode objAddQualityNode = new TreeNode();
List<Weapon> objAddWeapons = new List<Weapon>();
List<TreeNode> objAddWeaponNodes = new List<TreeNode>();
Quality objAddQuality = new Quality(_objCharacter);
objAddQuality.Create(objXmlSelectedQuality, _objCharacter, QualitySource.Selected, objAddQualityNode, objWeapons,
objWeaponNodes, strForceValue);
if (objAddQuality.Type == QualityType.Positive)
{
treQualities.Nodes[0].Nodes.Add(objAddQualityNode);
treQualities.Nodes[0].Expand();
}
else
{
treQualities.Nodes[1].Nodes.Add(objAddQualityNode);
treQualities.Nodes[1].Expand();
}
// Add any created Weapons to the character.
foreach (Weapon objWeapon in objAddWeapons)
_objCharacter.Weapons.Add(objWeapon);
// Create the Weapon Node if one exists.
foreach (TreeNode objWeaponNode in objAddWeaponNodes)
{
objWeaponNode.ContextMenuStrip = cmsWeapon;
treWeapons.Nodes[0].Nodes.Add(objWeaponNode);
treWeapons.Nodes[0].Expand();
}
return objAddQuality;
}
return null;
}
开发者ID:cormanater,项目名称:chummer5a,代码行数:55,代码来源:frmCreate.cs
示例6: Load
//.........这里部分代码省略.........
_intSubmersionGrade = Convert.ToInt32(objXmlCharacter["submersiongrade"].InnerText);
}
catch
{
}
try
{
_blnGroupMember = Convert.ToBoolean(objXmlCharacter["groupmember"].InnerText);
}
catch
{
}
try
{
_strGroupName = objXmlCharacter["groupname"].InnerText;
_strGroupNotes = objXmlCharacter["groupnotes"].InnerText;
}
catch
{
}
// Improvements.
XmlNodeList objXmlImprovementList = objXmlDocument.SelectNodes("/character/improvements/improvement");
foreach (XmlNode objXmlImprovement in objXmlImprovementList)
{
Improvement objImprovement = new Improvement();
objImprovement.Load(objXmlImprovement);
_lstImprovements.Add(objImprovement);
}
// Qualities
objXmlNodeList = objXmlDocument.SelectNodes("/character/qualities/quality");
bool blnHasOldQualities = false;
foreach (XmlNode objXmlQuality in objXmlNodeList)
{
if (objXmlQuality["name"] != null)
{
Quality objQuality = new Quality(this);
objQuality.Load(objXmlQuality);
_lstQualities.Add(objQuality);
}
else
{
// If the Quality does not have a name tag, it is in the old format. Set the flag to show that old Qualities are in use.
blnHasOldQualities = true;
}
}
// If old Qualities are in use, they need to be converted before we can continue.
if (blnHasOldQualities)
ConvertOldQualities(objXmlNodeList);
// Attributes.
objXmlCharacter = objXmlDocument.SelectSingleNode("/character/attributes/attribute[name = \"BOD\"]");
_attBOD.Load(objXmlCharacter);
objXmlCharacter = objXmlDocument.SelectSingleNode("/character/attributes/attribute[name = \"AGI\"]");
_attAGI.Load(objXmlCharacter);
objXmlCharacter = objXmlDocument.SelectSingleNode("/character/attributes/attribute[name = \"REA\"]");
_attREA.Load(objXmlCharacter);
objXmlCharacter = objXmlDocument.SelectSingleNode("/character/attributes/attribute[name = \"STR\"]");
_attSTR.Load(objXmlCharacter);
objXmlCharacter = objXmlDocument.SelectSingleNode("/character/attributes/attribute[name = \"CHA\"]");
_attCHA.Load(objXmlCharacter);
objXmlCharacter = objXmlDocument.SelectSingleNode("/character/attributes/attribute[name = \"INT\"]");
_attINT.Load(objXmlCharacter);
objXmlCharacter = objXmlDocument.SelectSingleNode("/character/attributes/attribute[name = \"LOG\"]");
_attLOG.Load(objXmlCharacter);
开发者ID:Nebual,项目名称:chummer,代码行数:67,代码来源:clsCharacter.cs
示例7: MentorInformation
/// <summary>
/// Retrieve the information for the Mentor Spirit or Paragon the character might have.
/// </summary>
/// <param name="objMentorType">Type of feature to check for, either Mentor Spirit or Paragon.</param>
public MentorSpirit MentorInformation(MentorType objMentorType)
{
MentorSpirit objReturn = new MentorSpirit();
string strMentorSpirit = "";
Quality objMentorQuality = new Quality(_objCharacter);
// Look for the Mentor Spirit or Paragon Quality based on the type chosen.
foreach (Quality objQuality in _objCharacter.Qualities)
{
if (objMentorType == MentorType.Mentor && objQuality.Name == "Mentor Spirit")
{
strMentorSpirit = objQuality.Extra;
objMentorQuality = objQuality;
break;
}
if (objMentorType == MentorType.Paragon && objQuality.Name == "Paragon")
{
strMentorSpirit = objQuality.Extra;
objMentorQuality = objQuality;
break;
}
}
if (strMentorSpirit != "")
{
string strAdvantage = "";
string strDisadvantage = "";
XmlDocument objXmlDocument = new XmlDocument();
XmlNode objXmlMentor;
if (strMentorSpirit != "")
{
// Load the appropriate XML document.
if (objMentorType == MentorType.Mentor)
objXmlDocument = XmlManager.Instance.Load("mentors.xml");
else
objXmlDocument = XmlManager.Instance.Load("paragons.xml");
objXmlMentor = objXmlDocument.SelectSingleNode("/chummer/mentors/mentor[name = \"" + strMentorSpirit + "\"]");
// Build the list of advantages gained through the Mentor Spirit.
if (objXmlMentor["altadvantage"] != null)
strAdvantage = objXmlMentor["altadvantage"].InnerText;
else
strAdvantage = objXmlMentor["advantage"].InnerText;
foreach (Improvement objImprovement in _objCharacter.Improvements)
{
if (objImprovement.SourceName == objMentorQuality.InternalId)
{
if (objImprovement.Notes != string.Empty)
strAdvantage += " " + LanguageManager.Instance.TranslateExtra(objImprovement.Notes) + ".";
}
}
// Build the list of disadvantages gained through the Mentor Spirit.
if (objXmlMentor["altdisadvantage"] != null)
strDisadvantage = objXmlMentor["altdisadvantage"].InnerText;
else
strDisadvantage = objXmlMentor["disadvantage"].InnerText;
// Populate the Mentor Spirit object.
objReturn.Name = strMentorSpirit;
objReturn.Advantages = LanguageManager.Instance.GetString("Label_SelectMentorSpirit_Advantage") + " " + strAdvantage + "\n\n" + LanguageManager.Instance.GetString("Label_SelectMetamagic_Disadvantage") + " " + strDisadvantage;
}
}
else
return null;
return objReturn;
}
开发者ID:Nebual,项目名称:chummer,代码行数:76,代码来源:clsMainController.cs
示例8: cmdLifeModule_Click
private void cmdLifeModule_Click(object sender, EventArgs e)
{
XmlDocument xdoc = XmlManager.Instance.Load("lifemodules.xml");
XmlNodeList xnodes = xdoc.SelectNodes("chummer/stages/stage");
//from 1 to second highest life module order possible (ye hardcoding is bad, but extra stage is a niche case)
int i;
for (i = 1; i < 5; i++)
{
XmlNode node = xdoc.SelectSingleNode("chummer/stages/stage[@order = \"" + i + "\"]");
if (node == null)
{
i--;
break;
}
Quality q = _objCharacter.Qualities.Find(x => (
x.Type == QualityType.LifeModule &&
x.Stage == node.InnerText
));
if (q == null)
{
break;
}
}
//i--; //Counter last increment
frmSelectLifeModule selectLifeModule = new frmSelectLifeModule(_objCharacter, i);
selectLifeModule.ShowDialog(this);
if (selectLifeModule.DialogResult == DialogResult.Cancel)
return;
XmlNode objXmlLifeModule = selectLifeModule.SelectedNode;
TreeNode objNode = new TreeNode();
List<Weapon> objWeapons = new List<Weapon>();
List<TreeNode> objWeaponNodes = new List<TreeNode>();
Quality objLifeModule = new Quality(_objCharacter);
objLifeModule.Create(objXmlLifeModule, _objCharacter, QualitySource.LifeModule, objNode, objWeapons, objWeaponNodes);
objNode.ContextMenuStrip = cmsQuality; //Think this is responsible for the "add notes" menu. Think
if (objLifeModule.InternalId == Guid.Empty.ToString())
return;
//Is there any reason not to add it?
if (true)
{
treQualities.Nodes[2].Nodes.Add(objNode);
treQualities.Nodes[2].Expand();
_objCharacter.Qualities.Add(objLifeModule);
foreach (Weapon objWeapon in objWeapons)
_objCharacter.Weapons.Add(objWeapon);
foreach (TreeNode objWeaponNode in objWeaponNodes)
{
objWeaponNode.ContextMenuStrip = cmsWeapon;
treWeapons.Nodes[0].Nodes.Add(objWeaponNode);
treWeapons.Nodes[0].Expand();
}
if (objXmlLifeModule.SelectNodes("addqualities/addquality").Count > 0)
{
XmlDocument objQualityDocument = XmlManager.Instance.Load("qualities.xml");
foreach (XmlNode objXmlAddQuality in objXmlLifeModule.SelectNodes("addqualities/addquality"))
{
XmlNode objXmlSelectedQuality =
objQualityDocument.SelectSingleNode("/chummer/qualities/quality[name = \"" +
objXmlAddQuality.InnerText + "\"]");
Quality objSubQuality = AddQuality(objXmlAddQuality, objXmlSelectedQuality, objWeapons,
objWeaponNodes);
if (objSubQuality != null)
{
_objCharacter.Qualities.Add(objSubQuality);
}
}
}
}
else
{
//If not add, fallback (Dead code as we don't check for exceeding karma
//Until validation
//_objImprovementManager.RemoveImprovements(Improvement.ImprovementSource.Quality, objLifeModule.InternalId);
}
//Stupid hardcoding but no sane way
//To do group skills (not that anything else is sane)
foreach (Control control in panSkillGroups.Controls)
{
SkillGroupControl sgc = (SkillGroupControl) control;
if (sgc != null)
{
sgc.BaseRating = _objImprovementManager.ValueOf(Improvement.ImprovementType.SkillGroupLevel, false,
sgc.SkillGroupObject.Name);
}
}
//.........这里部分代码省略.........
开发者ID:cormanater,项目名称:chummer5a,代码行数:101,代码来源:frmCreate.cs
示例9: TestQuality
private void TestQuality()
{
Character objCharacter = new Character();
XmlDocument objXmlDocument = XmlManager.Instance.Load("qualities.xml");
pgbProgress.Minimum = 0;
pgbProgress.Value = 0;
pgbProgress.Maximum = objXmlDocument.SelectNodes("/chummer/qualities/quality").Count;
// Qualities.
foreach (XmlNode objXmlGear in objXmlDocument.SelectNodes("/chummer/qualities/quality"))
{
pgbProgress.Value++;
Application.DoEvents();
try
{
TreeNode objTempNode = new TreeNode();
List<Weapon> objWeapons = new List<Weapon>();
List<TreeNode> objWeaponNodes = new List<TreeNode>();
Quality objTemp = new Quality(objCharacter);
objTemp.Create(objXmlGear, objCharacter, QualitySource.Selected, objTempNode, objWeapons, objWeaponNodes);
}
catch
{
txtOutput.Text += objXmlGear["name"].InnerText + " general failure\n";
}
}
}
开发者ID:hollis21,项目名称:Chummer,代码行数:27,代码来源:frmTest.cs
示例10: MetatypeSelected
//.........这里部分代码省略.........
// Sprites can never have Physical Attributes or WIL.
if (lstMetatypes.SelectedValue.ToString().EndsWith("Sprite"))
{
_objCharacter.BOD.AssignLimits("0", "0", "0");
_objCharacter.AGI.AssignLimits("0", "0", "0");
_objCharacter.REA.AssignLimits("0", "0", "0");
_objCharacter.STR.AssignLimits("0", "0", "0");
_objCharacter.WIL.AssignLimits("0", "0", "0");
_objCharacter.INI.MetatypeMinimum = Convert.ToInt32(ExpressionToString(objXmlMetatype["inimax"].InnerText, intForce, 0));
_objCharacter.INI.MetatypeMaximum = Convert.ToInt32(ExpressionToString(objXmlMetatype["inimax"].InnerText, intForce, 0));
}
// If this is a Shapeshifter, a Metavariant must be selected. Default to Human if None is selected.
if (cboCategory.SelectedValue.ToString() == "Shapeshifter" && cboMetavariant.SelectedValue.ToString() == "None")
cboMetavariant.SelectedValue = "Human";
_objCharacter.Metatype = lstMetatypes.SelectedValue.ToString();
_objCharacter.MetatypeCategory = cboCategory.SelectedValue.ToString();
if (cboMetavariant.SelectedValue.ToString() == "None")
{
_objCharacter.Metavariant = "";
_objCharacter.MetatypeBP = Convert.ToInt32(lblBP.Text);
}
else
{
_objCharacter.Metavariant = cboMetavariant.SelectedValue.ToString();
_objCharacter.MetatypeBP = Convert.ToInt32(lblMetavariantBP.Text);
}
if (objXmlMetatype["movement"] != null)
_objCharacter.Movement = objXmlMetatype["movement"].InnerText;
// Load the Qualities file.
XmlDocument objXmlQualityDocument = XmlManager.Instance.Load("qualities.xml");
if (cboMetavariant.SelectedValue.ToString() == "None")
{
// Determine if the Metatype has any bonuses.
if (objXmlMetatype.InnerXml.Contains("bonus"))
objImprovementManager.CreateImprovements(Improvement.ImprovementSource.Metatype, lstMetatypes.SelectedValue.ToString(), objXmlMetatype.SelectSingleNode("bonus"), false, 1, lstMetatypes.SelectedValue.ToString());
// Create the Qualities that come with the Metatype.
foreach (XmlNode objXmlQualityItem in objXmlMetatype.SelectNodes("qualities/positive/quality"))
{
XmlNode objXmlQuality = objXmlQualityDocument.SelectSingleNode("/chummer/qualities/quality[name = \"" + objXmlQualityItem.InnerText + "\"]");
TreeNode objNode = new TreeNode();
List<Weapon> objWeapons = new List<Weapon>();
List<TreeNode> objWeaponNodes = new List<TreeNode>();
Quality objQuality = new Quality(_objCharacter);
string strForceValue = "";
if (objXmlQualityItem.Attributes["select"] != null)
strForceValue = objXmlQualityItem.Attributes["select"].InnerText;
QualitySource objSource = new QualitySource();
objSource = QualitySource.Metatype;
if (objXmlQualityItem.Attributes["removable"] != null)
objSource = QualitySource.MetatypeRemovable;
objQuality.Create(objXmlQuality, _objCharacter, objSource, objNode, objWeapons, objWeaponNodes, strForceValue);
objQuality.ContributeToLimit = false;
_objCharacter.Qualities.Add(objQuality);
// Add any created Weapons to the character.
foreach (Weapon objWeapon in objWeapons)
_objCharacter.Weapons.Add(objWeapon);
}
foreach (XmlNode objXmlQualityItem in objXmlMetatype.SelectNodes("qualities/negative/quality"))
{
开发者ID:Nitsuj83,项目名称:chummer5a,代码行数:67,代码来源:frmKarmaMetatype.cs
示例11: TestMetatype
void TestMetatype(string strFile)
{
XmlDocument objXmlDocument = XmlManager.Instance.Load(strFile);
pgbProgress.Minimum = 0;
pgbProgress.Value = 0;
pgbProgress.Maximum = objXmlDocument.SelectNodes("/chummer/metatypes/metatype").Count;
foreach (XmlNode objXmlMetatype in objXmlDocument.SelectNodes("/chummer/metatypes/metatype"))
{
pgbProgress.Value++;
Application.DoEvents();
objXmlDocument = XmlManager.Instance.Load(strFile);
Character _objCharacter = new Character();
ImprovementManager objImprovementManager = new ImprovementManager(_objCharacter);
try
{
int intForce = 0;
if (objXmlMetatype["forcecreature"] != null)
intForce = 1;
// Set Metatype information.
if (strFile != "critters.xml" || objXmlMetatype["name"].InnerText == "Ally Spirit")
{
_objCharacter.BOD.AssignLimits(ExpressionToString(objXmlMetatype["bodmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["bodmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["bodaug"].InnerText, intForce, 0));
_objCharacter.AGI.AssignLimits(ExpressionToString(objXmlMetatype["agimin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["agimax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["agiaug"].InnerText, intForce, 0));
_objCharacter.REA.AssignLimits(ExpressionToString(objXmlMetatype["reamin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["reamax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["reaaug"].InnerText, intForce, 0));
_objCharacter.STR.AssignLimits(ExpressionToString(objXmlMetatype["strmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["strmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["straug"].InnerText, intForce, 0));
_objCharacter.CHA.AssignLimits(ExpressionToString(objXmlMetatype["chamin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["chamax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["chaaug"].InnerText, intForce, 0));
_objCharacter.INT.AssignLimits(ExpressionToString(objXmlMetatype["intmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["intmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["intaug"].InnerText, intForce, 0));
_objCharacter.LOG.AssignLimits(ExpressionToString(objXmlMetatype["logmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["logmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["logaug"].InnerText, intForce, 0));
_objCharacter.WIL.AssignLimits(ExpressionToString(objXmlMetatype["wilmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["wilmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["wilaug"].InnerText, intForce, 0));
_objCharacter.INI.AssignLimits(ExpressionToString(objXmlMetatype["inimin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["inimax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["iniaug"].InnerText, intForce, 0));
_objCharacter.MAG.AssignLimits(ExpressionToString(objXmlMetatype["magmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["magmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["magaug"].InnerText, intForce, 0));
_objCharacter.RES.AssignLimits(ExpressionToString(objXmlMetatype["resmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["resmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["resaug"].InnerText, intForce, 0));
_objCharacter.EDG.AssignLimits(ExpressionToString(objXmlMetatype["edgmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["edgmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["edgaug"].InnerText, intForce, 0));
_objCharacter.ESS.AssignLimits(ExpressionToString(objXmlMetatype["essmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["essmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["essaug"].InnerText, intForce, 0));
}
else
{
int intMinModifier = -3;
if (objXmlMetatype["category"].InnerText == "Mutant Critters")
intMinModifier = 0;
_objCharacter.BOD.AssignLimits(ExpressionToString(objXmlMetatype["bodmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["bodmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["bodmin"].InnerText, intForce, 3));
_objCharacter.AGI.AssignLimits(ExpressionToString(objXmlMetatype["agimin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["agimin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["agimin"].InnerText, intForce, 3));
_objCharacter.REA.AssignLimits(ExpressionToString(objXmlMetatype["reamin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["reamin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["reamin"].InnerText, intForce, 3));
_objCharacter.STR.AssignLimits(ExpressionToString(objXmlMetatype["strmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["strmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["strmin"].InnerText, intForce, 3));
_objCharacter.CHA.AssignLimits(ExpressionToString(objXmlMetatype["chamin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["chamin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["chamin"].InnerText, intForce, 3));
_objCharacter.INT.AssignLimits(ExpressionToString(objXmlMetatype["intmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["intmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["intmin"].InnerText, intForce, 3));
_objCharacter.LOG.AssignLimits(ExpressionToString(objXmlMetatype["logmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["logmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["logmin"].InnerText, intForce, 3));
_objCharacter.WIL.AssignLimits(ExpressionToString(objXmlMetatype["wilmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["wilmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["wilmin"].InnerText, intForce, 3));
_objCharacter.INI.AssignLimits(ExpressionToString(objXmlMetatype["inimin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["inimax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["iniaug"].InnerText, intForce, 0));
_objCharacter.MAG.AssignLimits(ExpressionToString(objXmlMetatype["magmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["magmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["magmin"].InnerText, intForce, 3));
_objCharacter.RES.AssignLimits(ExpressionToString(objXmlMetatype["resmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["resmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["resmin"].InnerText, intForce, 3));
_objCharacter.EDG.AssignLimits(ExpressionToString(objXmlMetatype["edgmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["edgmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["edgmin"].InnerText, intForce, 3));
_objCharacter.ESS.AssignLimits(ExpressionToString(objXmlMetatype["essmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["essmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["essaug"].InnerText, intForce, 0));
}
// If we're working with a Critter, set the
|
请发表评论