本文整理汇总了C#中Chummer.ExpenseUndo.CreateKarma方法的典型用法代码示例。如果您正苦于以下问题:C# ExpenseUndo.CreateKarma方法的具体用法?C# ExpenseUndo.CreateKarma怎么用?C# ExpenseUndo.CreateKarma使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chummer.ExpenseUndo
的用法示例。
在下文中一共展示了ExpenseUndo.CreateKarma方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: objGroup_KarmaClicked
private void objGroup_KarmaClicked(Object sender)
{
SkillGroupControl objGroupControl = (SkillGroupControl)sender;
// Make sure the character has enough Karma to improve the Skill Group.
int intKarmaCost = 0;
if (objGroupControl.GroupRating == 0)
intKarmaCost = _objOptions.KarmaNewSkillGroup;
else
intKarmaCost = (objGroupControl.GroupRating + 1) * _objOptions.KarmaImproveSkillGroup;
if (intKarmaCost > _objCharacter.Karma)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughKarma"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughKarma"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (!ConfirmKarmaExpense(LanguageManager.Instance.GetString("Message_ConfirmKarmaExpense").Replace("{0}", objGroupControl.SkillGroupObject.DisplayName).Replace("{1}", (objGroupControl.GroupRating + 1).ToString()).Replace("{2}", intKarmaCost.ToString())))
return;
// Create the Karma Expense.
ExpenseLogEntry objExpense = new ExpenseLogEntry();
objExpense.Create(intKarmaCost * -1, LanguageManager.Instance.GetString("String_ExpenseSkillGroup") + " " + objGroupControl.SkillGroupObject.DisplayName + " " + objGroupControl.GroupRating.ToString() + " -> " + (objGroupControl.GroupRating + 1).ToString(), ExpenseType.Karma, DateTime.Now);
_objCharacter.ExpenseEntries.Add(objExpense);
ExpenseUndo objUndo = new ExpenseUndo();
objUndo.CreateKarma(KarmaExpenseType.ImproveSkillGroup, objGroupControl.GroupName);
objExpense.Undo = objUndo;
_objCharacter.Karma -= intKarmaCost;
objGroupControl.GroupRating += 1;
UpdateCharacterInfo();
_blnIsDirty = true;
UpdateWindowTitle();
}
示例2: cmdQuickenSpell_Click
private void cmdQuickenSpell_Click(object sender, EventArgs e)
{
try
{
if (treSpells.SelectedNode.Level != 1)
return;
}
catch
{
return;
}
frmSelectNumber frmPickNumber = new frmSelectNumber();
frmPickNumber.Description = LanguageManager.Instance.GetString("String_QuickeningKarma").Replace("{0}", treSpells.SelectedNode.Text);
frmPickNumber.Minimum = 1;
frmPickNumber.ShowDialog(this);
if (frmPickNumber.DialogResult == DialogResult.Cancel)
return;
// Make sure the character has enough Karma to improve the Attribute.
int intKarmaCost = frmPickNumber.SelectedValue;
if (intKarmaCost > _objCharacter.Karma)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughKarma"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughKarma"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (!ConfirmKarmaExpense(LanguageManager.Instance.GetString("Message_ConfirmKarmaExpenseQuickeningMetamagic").Replace("{0}", intKarmaCost.ToString()).Replace("{1}", treSpells.SelectedNode.Text)))
return;
// Create the Karma expense.
ExpenseLogEntry objExpense = new ExpenseLogEntry();
objExpense.Create(intKarmaCost * -1, LanguageManager.Instance.GetString("String_ExpenseQuickenMetamagic") + " " + treSpells.SelectedNode.Text, ExpenseType.Karma, DateTime.Now);
_objCharacter.ExpenseEntries.Add(objExpense);
_objCharacter.Karma -= intKarmaCost;
ExpenseUndo objUndo = new ExpenseUndo();
objUndo.CreateKarma(KarmaExpenseType.QuickeningMetamagic, "");
objExpense.Undo = objUndo;
UpdateCharacterInfo();
_blnIsDirty = true;
UpdateWindowTitle();
}
示例3: SaveCharacterAsCreated
/// <summary>
/// Save the character as Created and re-open it in Career Mode.
/// </summary>
private void SaveCharacterAsCreated()
{
// If the character was built with Karma, record their staring Karma amount (if any).
if (_objCharacter.BuildMethod == CharacterBuildMethod.Karma)
{
if (_objCharacter.Karma > 0)
{
ExpenseLogEntry objKarma = new ExpenseLogEntry();
objKarma.Create(_objCharacter.Karma, "Starting Karma", ExpenseType.Karma, DateTime.Now);
_objCharacter.ExpenseEntries.Add(objKarma);
// Create an Undo entry so that the starting Karma amount can be modified if needed.
ExpenseUndo objKarmaUndo = new ExpenseUndo();
objKarmaUndo.CreateKarma(KarmaExpenseType.ManualAdd, "");
objKarma.Undo = objKarmaUndo;
}
}
// Create an Expense Entry for Starting Nuyen.
ExpenseLogEntry objNuyen = new ExpenseLogEntry();
objNuyen.Create(_objCharacter.Nuyen, "Starting Nuyen", ExpenseType.Nuyen, DateTime.Now);
_objCharacter.ExpenseEntries.Add(objNuyen);
// Create an Undo entry so that the Starting Nuyen amount can be modified if needed.
ExpenseUndo objNuyenUndo = new ExpenseUndo();
objNuyenUndo.CreateNuyen(NuyenExpenseType.ManualAdd, "");
objNuyen.Undo = objNuyenUndo;
_blnSkipToolStripRevert = true;
_objCharacter.Save();
GlobalOptions.Instance.MainForm.LoadCharacter(_objCharacter.FileName, false);
this.Close();
}
示例4: cmdImproveWIL_Click
private void cmdImproveWIL_Click(object sender, EventArgs e)
{
// Make sure the character has enough Karma to improve the Attribute.
int intKarmaCost = (_objCharacter.WIL.Value + _objCharacter.WIL.AttributeValueModifiers + 1) * _objOptions.KarmaAttribute;
if (_objOptions.AlternateMetatypeAttributeKarma)
intKarmaCost -= (_objCharacter.WIL.MetatypeMinimum - 1) * _objOptions.KarmaAttribute;
if (intKarmaCost > _objCharacter.Karma)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughKarma"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughKarma"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (!ConfirmKarmaExpense(LanguageManager.Instance.GetString("Message_ConfirmKarmaExpense").Replace("{0}", LanguageManager.Instance.GetString("String_AttributeWILShort")).Replace("{1}", (_objCharacter.WIL.Value + _objCharacter.WIL.AttributeValueModifiers + 1).ToString()).Replace("{2}", intKarmaCost.ToString())))
return;
// Create the Karma expense.
ExpenseLogEntry objExpense = new ExpenseLogEntry();
objExpense.Create(intKarmaCost * -1, LanguageManager.Instance.GetString("String_ExpenseAttribute") + " " + LanguageManager.Instance.GetString("String_AttributeWILShort") + " " + (_objCharacter.WIL.Value + _objCharacter.WIL.AttributeValueModifiers).ToString() + " -> " + (_objCharacter.WIL.Value + _objCharacter.WIL.AttributeValueModifiers + 1).ToString(), ExpenseType.Karma, DateTime.Now);
_objCharacter.ExpenseEntries.Add(objExpense);
_objCharacter.Karma -= intKarmaCost;
ExpenseUndo objUndo = new ExpenseUndo();
objUndo.CreateKarma(KarmaExpenseType.ImproveAttribute, "WIL");
objExpense.Undo = objUndo;
_objCharacter.WIL.Value += 1;
UpdateCharacterInfo();
_blnIsDirty = true;
UpdateWindowTitle();
}
示例5: cmdKarmaGained_Click
private void cmdKarmaGained_Click(object sender, EventArgs e)
{
frmExpense frmNewExpense = new frmExpense();
frmNewExpense.ShowDialog(this);
if (frmNewExpense.DialogResult == DialogResult.Cancel)
return;
// Create the Expense Log Entry.
ExpenseLogEntry objEntry = new ExpenseLogEntry();
objEntry.Create(frmNewExpense.Amount, frmNewExpense.strReason, ExpenseType.Karma, frmNewExpense.SelectedDate, frmNewExpense.Refund);
_objCharacter.ExpenseEntries.Add(objEntry);
ExpenseUndo objUndo = new ExpenseUndo();
objUndo.CreateKarma(KarmaExpenseType.ManualAdd, "");
objEntry.Undo = objUndo;
// Adjust the character's Karma total.
_objCharacter.Karma += frmNewExpense.Amount;
UpdateCharacterInfo();
_blnIsDirty = true;
UpdateWindowTitle();
}
示例6: cmdDeleteQuality_Click
private void cmdDeleteQuality_Click(object sender, EventArgs e)
{
bool blnMetatypeQuality = false;
// 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) * -2;
int intShowBP = intBP * _objOptions.KarmaQuality;
string strBP = intShowBP.ToString() + " " + LanguageManager.Instance.GetString("String_Karma");
if (!_objFunctions.ConfirmDelete(LanguageManager.Instance.GetString("Message_DeleteMetatypeQuality").Replace("{0}", strBP)))
return;
blnMetatypeQuality = true;
}
if (objQuality.Type == QualityType.Positive)
{
if (!blnMetatypeQuality)
{
if (!_objFunctions.ConfirmDelete(LanguageManager.Instance.GetString("Message_DeletePositiveQualityCareer")))
return;
}
// Remove the Improvements that were created by the Quality.
_objImprovementManager.RemoveImprovements(Improvement.ImprovementSource.Quality, objQuality.InternalId);
if (objQuality.Name == "One Trick Pony")
{
if (treMartialArts.Nodes[1].Nodes.Count > 0)
{
foreach (MartialArt objMartialArt in _objCharacter.MartialArts)
{
if (objMartialArt.Name == "One Trick Pony")
{
_objCharacter.MartialArts.Remove(objMartialArt);
treMartialArts.Nodes[1].Nodes[0].Remove();
break;
}
}
}
}
_objCharacter.Qualities.Remove(objQuality);
treQualities.SelectedNode.Remove();
}
else
{
// Make sure the character has enough Karma to buy off the Quality.
int intKarmaCost = (objQuality.BP * _objOptions.KarmaQuality) * -2;
if (intKarmaCost > _objCharacter.Karma)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughKarma"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughKarma"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (!blnMetatypeQuality)
{
if (!ConfirmKarmaExpense(LanguageManager.Instance.GetString("Message_ConfirmKarmaExpenseRemove").Replace("{0}", objQuality.DisplayNameShort).Replace("{1}", intKarmaCost.ToString())))
return;
}
// Create the Karma expense.
ExpenseLogEntry objExpense = new ExpenseLogEntry();
objExpense.Create(intKarmaCost * -1, LanguageManager.Instance.GetString("String_ExpenseRemoveNegativeQuality") + " " + objQuality.DisplayNameShort, ExpenseType.Karma, DateTime.Now);
_objCharacter.ExpenseEntries.Add(objExpense);
_objCharacter.Karma -= intKarmaCost;
ExpenseUndo objUndo = new ExpenseUndo();
objUndo.CreateKarma(KarmaExpenseType.RemoveQuality, objQuality.Name);
objUndo.Extra = objQuality.Extra;
objExpense.Undo = objUndo;
// Remove the Improvements that were created by the Quality.
_objImprovementManager.RemoveImprovements(Improvement.ImprovementSource.Quality, objQuality.InternalId);
_objCharacter.Qualities.Remove(objQuality);
//.........这里部分代码省略.........
示例7: cmdImproveInitiation_Click
private void cmdImproveInitiation_Click(object sender, EventArgs e)
{
if (_objCharacter.MAGEnabled)
{
// Make sure that the Initiate Grade is not attempting to go above the character's MAG Attribute.
if (_objCharacter.InitiateGrade + 1 > _objCharacter.MAG.TotalValue)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_CannotIncreaseInitiateGrade"), LanguageManager.Instance.GetString("MessageTitle_CannotIncreaseInitiateGrade"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
// Make sure the character has enough Karma.
double dblMultiplier = 1.0;
dblMultiplier = Math.Round(dblMultiplier, 2);
int intKarmaExpense = Convert.ToInt32(Math.Ceiling(Convert.ToDouble((10 + ((_objCharacter.InitiateGrade + 1) * _objOptions.KarmaInitiation)), GlobalOptions.Instance.CultureInfo) * dblMultiplier));
if (intKarmaExpense > _objCharacter.Karma)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughKarma"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughKarma"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (!ConfirmKarmaExpense(LanguageManager.Instance.GetString("Message_ConfirmKarmaExpense").Replace("{0}", LanguageManager.Instance.GetString("String_InitiateGrade")).Replace("{1}", (_objCharacter.InitiateGrade + 1).ToString()).Replace("{2}", intKarmaExpense.ToString())))
return;
// Create the Expense Log Entry.
ExpenseLogEntry objExpense = new ExpenseLogEntry();
objExpense.Create(intKarmaExpense * -1, LanguageManager.Instance.GetString("String_ExpenseInitiateGrade") + " " + _objCharacter.InitiateGrade.ToString() + " -> " + (_objCharacter.InitiateGrade + 1).ToString(), ExpenseType.Karma, DateTime.Now);
_objCharacter.ExpenseEntries.Add(objExpense);
_objCharacter.Karma -= intKarmaExpense;
// Create the Initiate Grade object.
InitiationGrade objGrade = new InitiationGrade(_objCharacter);
objGrade.Create(_objCharacter.InitiateGrade + 1, _objCharacter.RESEnabled, chkInitiationGroup.Checked, chkInitiationOrdeal.Checked, chkInitiationSchooling.Checked);
_objCharacter.InitiationGrades.Add(objGrade);
ExpenseUndo objUndo = new ExpenseUndo();
objUndo.CreateKarma(KarmaExpenseType.ImproveInitiateGrade, objGrade.InternalId);
objExpense.Undo = objUndo;
// Set the character's Initiate Grade.
_objCharacter.InitiateGrade += 1;
// Remove any existing Initiation Improvements.
_objImprovementManager.RemoveImprovements(Improvement.ImprovementSource.Initiation, "Initiation");
// Create the replacement Improvement.
_objImprovementManager.CreateImprovement("MAG", Improvement.ImprovementSource.Initiation, "Initiation", Improvement.ImprovementType.Attribute, "", 0, 1, 0, _objCharacter.InitiateGrade);
_objImprovementManager.Commit();
// Update any Metamagic Improvements the character might have.
foreach (Metamagic objMetamagic in _objCharacter.Metamagics)
{
if (objMetamagic.Bonus != null)
{
// If the Bonus contains "Rating", remove the existing Improvement and create new ones.
if (objMetamagic.Bonus.InnerXml.Contains("Rating"))
{
_objImprovementManager.RemoveImprovements(Improvement.ImprovementSource.Metamagic, objMetamagic.InternalId);
_objImprovementManager.CreateImprovements(Improvement.ImprovementSource.Metamagic, objMetamagic.InternalId, objMetamagic.Bonus, false, _objCharacter.InitiateGrade, objMetamagic.DisplayNameShort);
}
}
}
int intAmount = Convert.ToInt32(Math.Ceiling(Convert.ToDouble((10 + ((_objCharacter.InitiateGrade + 1) * _objOptions.KarmaInitiation)), GlobalOptions.Instance.CultureInfo) * dblMultiplier));
string strInitTip = LanguageManager.Instance.GetString("Tip_ImproveInitiateGrade").Replace("{0}", (_objCharacter.InitiateGrade + 1).ToString()).Replace("{1}", intAmount.ToString());
tipTooltip.SetToolTip(cmdAddMetamagic, strInitTip);
}
else if (_objCharacter.RESEnabled)
{
// Make sure that the Initiate Grade is not attempting to go above the character's RES Attribute.
if (_objCharacter.SubmersionGrade + 1 > _objCharacter.RES.TotalValue)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_CannotIncreaseSubmersionGrade"), LanguageManager.Instance.GetString("MessageTitle_CannotIncreaseSubmersionGrade"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
// Make sure the character has enough Karma.
double dblMultiplier = 1.0;
dblMultiplier = Math.Round(dblMultiplier, 2);
int intKarmaExpense = Convert.ToInt32(Math.Ceiling(Convert.ToDouble((10 + ((_objCharacter.SubmersionGrade + 1) * _objOptions.KarmaInitiation)), GlobalOptions.Instance.CultureInfo) * dblMultiplier));
if (intKarmaExpense > _objCharacter.Karma)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughKarma"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughKarma"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (!ConfirmKarmaExpense(LanguageManager.Instance.GetString("Message_ConfirmKarmaExpense").Replace("{0}", LanguageManager.Instance.GetString("String_SubmersionGrade")).Replace("{1}", (_objCharacter.SubmersionGrade + 1).ToString()).Replace("{2}", intKarmaExpense.ToString())))
return;
// Create the Expense Log Entry.
ExpenseLogEntry objExpense = new ExpenseLogEntry();
objExpense.Create(intKarmaExpense * -1, LanguageManager.Instance.GetString("String_ExpenseSubmersionGrade") + " " + _objCharacter.SubmersionGrade.ToString() + " -> " + (_objCharacter.SubmersionGrade + 1).ToString(), ExpenseType.Karma, DateTime.Now);
_objCharacter.ExpenseEntries.Add(objExpense);
_objCharacter.Karma -= intKarmaExpense;
//.........这里部分代码省略.........
示例8: tsMartialArtsAddAdvantage_Click
private void tsMartialArtsAddAdvantage_Click(object sender, EventArgs e)
{
try
{
// Select the Martial Arts node if we're currently on a child.
if (treMartialArts.SelectedNode.Level > 1)
treMartialArts.SelectedNode = treMartialArts.SelectedNode.Parent;
MartialArt objMartialArt = _objFunctions.FindMartialArt(treMartialArts.SelectedNode.Tag.ToString(), _objCharacter.MartialArts);
frmSelectMartialArtAdvantage frmPickMartialArtAdvantage = new frmSelectMartialArtAdvantage(_objCharacter);
frmPickMartialArtAdvantage.MartialArt = objMartialArt.Name;
frmPickMartialArtAdvantage.ShowDialog(this);
if (frmPickMartialArtAdvantage.DialogResult == DialogResult.Cancel)
return;
// Open the Martial Arts XML file and locate the selected piece.
XmlDocument objXmlDocument = XmlManager.Instance.Load("martialarts.xml");
XmlNode objXmlAdvantage = objXmlDocument.SelectSingleNode("/chummer/martialarts/martialart[name = \"" + objMartialArt.Name + "\"]/techniques/technique[name = \"" + frmPickMartialArtAdvantage.SelectedAdvantage + "\"]");
// Create the Improvements for the Advantage if there are any.
TreeNode objNode = new TreeNode();
MartialArtAdvantage objAdvantage = new MartialArtAdvantage(_objCharacter);
objAdvantage.Create(objXmlAdvantage, _objCharacter, objNode);
if (objAdvantage.InternalId == Guid.Empty.ToString())
return;
objMartialArt.Advantages.Add(objAdvantage);
objNode.ContextMenuStrip = cmsTechnique;
treMartialArts.SelectedNode.Nodes.Add(objNode);
treMartialArts.SelectedNode.Expand();
// Create the Expense Log Entry.
if (treMartialArts.SelectedNode.Nodes.Count > 1)
{
ExpenseLogEntry objEntry = new ExpenseLogEntry();
objEntry.Create(_objOptions.KarmaManeuver * -1, LanguageManager.Instance.GetString("String_ExpenseLearnTechnique") + " " + frmPickMartialArtAdvantage.SelectedAdvantage, ExpenseType.Karma, DateTime.Now);
_objCharacter.ExpenseEntries.Add(objEntry);
_objCharacter.Karma -= _objOptions.KarmaManeuver;
ExpenseUndo objUndo = new ExpenseUndo();
objUndo.CreateKarma(KarmaExpenseType.AddMartialArtManeuver, frmPickMartialArtAdvantage.SelectedAdvantage);
objEntry.Undo = objUndo;
}
UpdateCharacterInfo();
_blnIsDirty = true;
UpdateWindowTitle();
}
catch
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_SelectMartialArtAdvantage"), LanguageManager.Instance.GetString("MessageTitle_SelectMartialArtAdvantage"), MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
示例9: tsMetamagicAddArt_Click
private void tsMetamagicAddArt_Click(object sender, EventArgs e)
{
// Character can only have a number of Metamagics/Echoes equal to their Initiate Grade. Additional ones cost Karma.
bool blnPayWithKarma = false;
string strType = "";
if (treMetamagic.SelectedNode.Level != 0)
return;
int intGrade = 0;
foreach (InitiationGrade objGrade in _objCharacter.InitiationGrades)
{
if (objGrade.InternalId == treMetamagic.SelectedNode.Tag.ToString())
{
intGrade = objGrade.Grade;
break;
}
}
if (blnPayWithKarma && _objCharacter.Karma < _objOptions.KarmaMetamagic)
{
// Make sure the Karma expense would not put them over the limit.
MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughKarma"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughKarma"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
frmSelectArt frmPickArt = new frmSelectArt(_objCharacter);
frmPickArt.WindowMode = frmSelectArt.Mode.Art;
frmPickArt.ShowDialog(this);
// Make sure a value was selected.
if (frmPickArt.DialogResult == DialogResult.Cancel)
return;
string strArt = frmPickArt.SelectedItem;
XmlDocument objXmlDocument = new XmlDocument();
XmlNode objXmlArt;
TreeNode objNode = new TreeNode();
Art objArt = new Art(_objCharacter);
Improvement.ImprovementSource objSource;
objXmlDocument = XmlManager.Instance.Load("metamagic.xml");
objXmlArt = objXmlDocument.SelectSingleNode("/chummer/arts/art[name = \"" + strArt + "\"]");
objSource = Improvement.ImprovementSource.Metamagic;
objArt.Create(objXmlArt, _objCharacter, objNode, objSource);
objArt.Grade = intGrade;
objNode.ContextMenuStrip = cmsInitiationNotes;
if (objArt.InternalId == Guid.Empty.ToString())
return;
_objCharacter.Arts.Add(objArt);
if (blnPayWithKarma)
{
// Create the Expense Log Entry.
ExpenseLogEntry objEntry = new ExpenseLogEntry();
objEntry.Create(_objOptions.KarmaMetamagic * -1, strType + " " + frmPickArt.SelectedItem, ExpenseType.Karma, DateTime.Now);
_objCharacter.ExpenseEntries.Add(objEntry);
ExpenseUndo objUndo = new ExpenseUndo();
objUndo.CreateKarma(KarmaExpenseType.AddMetamagic, objArt.InternalId);
objEntry.Undo = objUndo;
// Adjust the character's Karma total.
_objCharacter.Karma -= _objOptions.KarmaMetamagic;
}
treMetamagic.SelectedNode.Nodes.Add(objNode);
treMetamagic.SelectedNode.Expand();
UpdateCharacterInfo();
_blnIsDirty = true;
UpdateWindowTitle();
}
示例10: treFoci_BeforeCheck
//.........这里部分代码省略.........
intKarmaMultiplier = _objOptions.KarmaWeaponFocus;
break;
case "Spellcasting Focus":
intKarmaMultiplier = _objOptions.KarmaSpellcastingFocus;
break;
case "Ritual Spellcasting Focus":
intKarmaMultiplier = _objOptions.KarmaRitualSpellcastingFocus;
break;
case "Spell Shaping Focus":
intKarmaMultiplier = _objOptions.KarmaSpellShapingFocus;
break;
case "Summoning Focus":
intKarmaMultiplier = _objOptions.KarmaSummoningFocus;
break;
case "Alchemical Focus":
intKarmaMultiplier = _objOptions.KarmaAlchemicalFocus;
break;
case "Centering Focus":
intKarmaMultiplier = _objOptions.KarmaCenteringFocus;
break;
case "Masking Focus":
intKarmaMultiplier = _objOptions.KarmaMaskingFocus;
break;
case "Disenchanting Focus":
intKarmaMultiplier = _objOptions.KarmaDisenchantingFocus;
break;
case "Power Focus":
intKarmaMultiplier = _objOptions.KarmaPowerFocus;
break;
case "Flexible Signature Focus":
intKarmaMultiplier = _objOptions.KarmaFlexibleSignatureFocus;
break;
default:
intKarmaMultiplier = 1;
break;
}
int intKarmaExpense = objFocus.Rating * intKarmaMultiplier;
if (intKarmaExpense > _objCharacter.Karma)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughKarma"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughKarma"), MessageBoxButtons.OK, MessageBoxIcon.Information);
e.Cancel = true;
return;
}
if (!ConfirmKarmaExpense(LanguageManager.Instance.GetString("Message_ConfirmKarmaExpenseFocus").Replace("{0}", intKarmaExpense.ToString()).Replace("{1}", objFocus.DisplayNameShort)))
{
e.Cancel = true;
return;
}
// Create the Expense Log Entry.
ExpenseLogEntry objExpense = new ExpenseLogEntry();
objExpense.Create(intKarmaExpense * -1, LanguageManager.Instance.GetString("String_ExpenseBound") + " " + objFocus.DisplayNameShort, ExpenseType.Karma, DateTime.Now);
_objCharacter.ExpenseEntries.Add(objExpense);
_objCharacter.Karma -= intKarmaExpense;
ExpenseUndo objUndo = new ExpenseUndo();
objUndo.CreateKarma(KarmaExpenseType.BindFocus, objFocus.InternalId);
objExpense.Undo = objUndo;
}
else
{
// The Focus was not found in Gear, so this is a Stacked Focus.
StackedFocus objStack = new StackedFocus(_objCharacter);
foreach (StackedFocus objCharacterStack in _objCharacter.StackedFoci)
{
if (objCharacterStack.InternalId == e.Node.Tag.ToString())
{
objStack = objCharacterStack;
break;
}
}
int intKarmaExpense = objStack.BindingCost;
if (intKarmaExpense > _objCharacter.Karma)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughKarma"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughKarma"), MessageBoxButtons.OK, MessageBoxIcon.Information);
e.Cancel = true;
return;
}
if (!ConfirmKarmaExpense(LanguageManager.Instance.GetString("Message_ConfirmKarmaExpenseFocus").Replace("{0}", intKarmaExpense.ToString()).Replace("{1}", LanguageManager.Instance.GetString("String_StackedFocus") + " " + objStack.Name)))
{
e.Cancel = true;
return;
}
// Create the Expense Log Entry.
ExpenseLogEntry objExpense = new ExpenseLogEntry();
objExpense.Create(intKarmaExpense * -1, LanguageManager.Instance.GetString("String_ExpenseBound") + " " + LanguageManager.Instance.GetString("String_StackedFocus") + " " + objStack.Name, ExpenseType.Karma, DateTime.Now);
_objCharacter.ExpenseEntries.Add(objExpense);
_objCharacter.Karma -= intKarmaExpense;
ExpenseUndo objUndo = new ExpenseUndo();
objUndo.CreateKarma(KarmaExpenseType.BindFocus, objStack.InternalId);
objExpense.Undo = objUndo;
}
UpdateCharacterInfo();
}
示例11: tsCreateSpell_Click
private void tsCreateSpell_Click(object sender, EventArgs e)
{
// Make sure the character has enough Karma before letting them select a Spell.
if (_objCharacter.Karma < _objOptions.KarmaSpell)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughKarma"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughKarma"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
// Run through the list of Active Skills and pick out the two applicable ones.
int intSkillValue = 0;
foreach (SkillControl objSkillControl in panActiveSkills.Controls)
{
if ((objSkillControl.SkillName == "Spellcasting" || objSkillControl.SkillName == "Ritual Spellcasting") && objSkillControl.SkillRating > intSkillValue)
intSkillValue = objSkillControl.SkillRating;
}
// The character is still allowed to add Spells, so show the Create Spell window.
frmCreateSpell frmSpell = new frmCreateSpell(_objCharacter);
frmSpell.ShowDialog(this);
if (frmSpell.DialogResult == DialogResult.Cancel)
return;
Spell objSpell = frmSpell.SelectedSpell;
TreeNode objNode = new TreeNode();
objNode.Text = objSpell.DisplayName;
objNode.Tag = objSpell.InternalId;
objNode.ContextMenuStrip = cmsSpell;
if (!ConfirmKarmaExpense(LanguageManager.Instance.GetString("Message_ConfirmKarmaExpenseSpend").Replace("{0}", objSpell.DisplayName).Replace("{1}", _objOptions.KarmaSpell.ToString())))
return;
_objCharacter.Spells.Add(objSpell);
switch (objSpell.Category)
{
case "Combat":
treSpells.Nodes[0].Nodes.Add(objNode);
treSpells.Nodes[0].Expand();
break;
case "Detection":
treSpells.Nodes[1].Nodes.Add(objNode);
treSpells.Nodes[1].Expand();
break;
case "Health":
treSpells.Nodes[2].Nodes.Add(objNode);
treSpells.Nodes[2].Expand();
break;
case "Illusion":
treSpells.Nodes[3].Nodes.Add(objNode);
treSpells.Nodes[3].Expand();
break;
case "Manipulation":
treSpells.Nodes[4].Nodes.Add(objNode);
treSpells.Nodes[4].Expand();
break;
case "Rituals":
int intNode = 5;
if (_objCharacter.AdeptEnabled && !_objCharacter.MagicianEnabled)
intNode = 0;
treSpells.Nodes[intNode].Nodes.Add(objNode);
treSpells.Nodes[intNode].Expand();
break;
}
treSpells.SelectedNode = objNode;
// Create the Expense Log Entry.
ExpenseLogEntry objEntry = new ExpenseLogEntry();
objEntry.Create(_objOptions.KarmaSpell * -1, LanguageManager.Instance.GetString("String_ExpenseLearnSpell") + " " + objSpell.Name, ExpenseType.Karma, DateTime.Now);
_objCharacter.ExpenseEntries.Add(objEntry);
_objCharacter.Karma -= _objOptions.KarmaSpell;
ExpenseUndo objUndo = new ExpenseUndo();
objUndo.CreateKarma(KarmaExpenseType.AddSpell, objSpell.InternalId);
objEntry.Undo = objUndo;
_objFunctions.SortTree(treSpells);
UpdateCharacterInfo();
_blnIsDirty = true;
UpdateWindowTitle();
}
示例12: objSkill_SpecializationLeave
private void objSkill_SpecializationLeave(Object sender)
{
if (_blnSkipRefresh)
return;
_blnSkipRefresh = true;
SkillControl objSkillControl = (SkillControl)sender;
// Make sure the character has enough Karma to select the Specialization.
int intKarmaCost = _objOptions.KarmaSpecialization;
if (intKarmaCost > _objCharacter.Karma)
{
objSkillControl.SkillSpec = objSkillControl.OldSpecialization;
MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughKarma"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughKarma"), MessageBoxButtons.OK, MessageBoxIcon.Information);
_blnSkipRefresh = false;
return;
}
if (!ConfirmKarmaExpense(LanguageManager.Instance.GetString("Message_ConfirmKarmaExpenseSpecialization").Replace("{0}", objSkillControl.SkillSpec).Replace("{1}", intKarmaCost.ToString())))
{
objSkillControl.SkillSpec = objSkillControl.OldSpecialization;
_blnSkipRefresh = false;
return;
}
// If the Skill is Grouped, verify that the user wants to break the Group.
if (objSkillControl.IsGrouped)
{
if (MessageBox.Show(LanguageManager.Instance.GetString("Message_BreakSkillGroup").Replace("{0}", objSkillControl.SkillObject.DisplayName), LanguageManager.Instance.GetString("MessageTitle_BreakSkillGroup"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
{
objSkillControl.SkillSpec = objSkillControl.OldSpecialization;
_blnSkipRefresh = false;
return;
}
else
{
string strSkillGroup = objSkillControl.SkillGroup;
int intRating = 0;
// Break the Skill Group itself.
foreach (SkillGroupControl objSkillGroupControl in panSkillGroups.Controls)
{
if (objSkillGroupControl.GroupName == strSkillGroup)
{
intRating = objSkillGroupControl.GroupRating;
objSkillGroupControl.Broken = true;
break;
}
}
// Remove all of the Active Skills from the Skill Group being broken.
string strGroup = objSkillControl.SkillGroup;
foreach (SkillControl objActiveSkilll in panActiveSkills.Controls)
{
if (objActiveSkilll.IsGrouped && objActiveSkilll.SkillGroup == strGroup)
{
objActiveSkilll.SkillRating = intRating;
objActiveSkilll.IsGrouped = false;
}
}
}
}
else
{
// If the Skill is not Grouped, the Group should still be broken since a Skill from it has been advanced on its own.
if (objSkillControl.SkillGroup != "")
{
// Break the Skill Group.
foreach (SkillGroupControl objSkillGroupControl in panSkillGroups.Controls)
{
if (objSkillGroupControl.GroupName == objSkillControl.SkillGroup)
{
objSkillGroupControl.Broken = true;
break;
}
}
}
}
// Create the Karma Expense.
ExpenseLogEntry objExpense = new ExpenseLogEntry();
objExpense.Create(intKarmaCost * -1, objSkillControl.SkillObject.DisplayName + " " + LanguageManager.Instance.GetString("String_ExpenseSpecialization") + " -> " + objSkillControl.SkillSpec, ExpenseType.Karma, DateTime.Now);
_objCharacter.ExpenseEntries.Add(objExpense);
ExpenseUndo objUndo = new ExpenseUndo();
objUndo.CreateKarma(KarmaExpenseType.SkillSpec, objSkillControl.SkillName);
objExpense.Undo = objUndo;
_objCharacter.Karma -= intKarmaCost;
// If the option to re-group Skill Groups is enabled, run through the Skill Groups and see if they can be re-enabled.
if (_objOptions.AllowSkillRegrouping)
{
foreach (SkillGroupControl objSkillGroupControl in panSkillGroups.Controls)
{
bool blnBroken = false;
int intRating = -1;
if (objSkillGroupControl.Broken)
{
//.........这里部分代码省略.........
示例13: objSkill_KarmaClicked
private void objSkill_KarmaClicked(Object sender)
{
SkillControl objSkillControl = (SkillControl)sender;
// Make sure the character has enough Karma to improve the Skill Group.
int intKarmaCost = 0;
if (objSkillControl.SkillRating == 0)
intKarmaCost = _objOptions.KarmaNewActiveSkill;
else
{
intKarmaCost = (objSkillControl.SkillRating + 1) * _objOptions.KarmaImproveActiveSkill;
}
// If the character is Uneducated and the Skill is a Technical Active Skill, Uncouth and a Social Active Skill or Infirm and a Physical Active Skill, double its cost.
if ((_objCharacter.Uneducated && objSkillControl.SkillCategory == "Technical Active") ||
(_objCharacter.Uncouth && objSkillControl.SkillCategory == "Social Active") ||
(_objCharacter.Infirm && objSkillControl.SkillCategory == "Physical Active"))
{
intKarmaCost *= 2;
}
if (intKarmaCost > _objCharacter.Karma)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughKarma"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughKarma"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (!ConfirmKarmaExpense(LanguageManager.Instance.GetString("Message_ConfirmKarmaExpense").Replace("{0}", objSkillControl.SkillObject.DisplayName).Replace("{1}", (objSkillControl.SkillRating + 1).ToString()).Replace("{2}", intKarmaCost.ToString())))
return;
SkillGroup objSkillGroup = new SkillGroup();
foreach (SkillGroupControl objSkillGroupControl in panSkillGroups.Controls)
{
if (objSkillGroupControl.GroupName == objSkillControl.SkillGroup)
{
objSkillGroup = objSkillGroupControl.SkillGroupObject;
break;
}
}
// If the Skill is Grouped, verify that the user wants to break the Group.
if (objSkillControl.IsGrouped)
{
if (MessageBox.Show(LanguageManager.Instance.GetString("Message_BreakSkillGroup").Replace("{0}", objSkillGroup.DisplayName), LanguageManager.Instance.GetString("MessageTitle_BreakSkillGroup"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
return;
else
{
string strSkillGroup = objSkillControl.SkillGroup;
int intRating = 0;
// Break the Skill Group itself.
foreach (SkillGroupControl objSkillGroupControl in panSkillGroups.Controls)
{
if (objSkillGroupControl.GroupName == strSkillGroup)
{
intRating = objSkillGroupControl.GroupRating;
objSkillGroupControl.Broken = true;
break;
}
}
// Remove all of the Active Skills from the Skill Group being broken.
string strGroup = objSkillControl.SkillGroup;
foreach (SkillControl objActiveSkilll in panActiveSkills.Controls)
{
if (objActiveSkilll.IsGrouped && objActiveSkilll.SkillGroup == strGroup)
{
objActiveSkilll.SkillRating = intRating;
objActiveSkilll.IsGrouped = false;
}
}
}
}
else
{
// If the Skill is not Grouped, the Group should still be broken since a Skill from it has been advanced on its own.
if (objSkillControl.SkillGroup != "")
{
// Break the Skill Group.
foreach (SkillGroupControl objSkillGroupControl in panSkillGroups.Controls)
{
if (objSkillGroupControl.GroupName == objSkillControl.SkillGroup)
{
objSkillGroupControl.Broken = true;
break;
}
}
}
}
// Create the Karma Expense.
ExpenseLogEntry objExpense = new ExpenseLogEntry();
objExpense.Create(intKarmaCost * -1, LanguageManager.Instance.GetString("String_ExpenseActiveSkill") + " " + objSkillControl.SkillObject.DisplayName + " " + objSkillControl.SkillRating.ToString() + " -> " + (objSkillControl.SkillRating + 1).ToString(), ExpenseType.Karma, DateTime.Now);
_objCharacter.ExpenseEntries.Add(objExpense);
ExpenseUndo objUndo = new ExpenseUndo();
string strSkill = objSkillControl.SkillName;
if (objSkillControl.SkillName.Contains("Exotic"))
strSkill += " (" + objSkillControl.SkillSpec + ")";
objUndo.CreateKarma(KarmaExpenseType.ImproveSkill, strSkill);
//.........这里部分代码省略.........
示例14: objKnowledgeSkill_KarmaClicked
private void objKnowledgeSkill_KarmaClicked(Object sender)
{
SkillControl objSkillControl = (SkillControl)sender;
// Make sure the character has enough Karma to improve the Skill Group.
int intKarmaCost = 0;
if (objSkillControl.SkillRating == 0)
intKarmaCost = _objOptions.KarmaNewKnowledgeSkill;
else
intKarmaCost = (objSkillControl.SkillRating + 1) * _objOptions.KarmaImproveKnowledgeSkill;
// If the character is Uneducated and the Skill is an Academic or Professional Skill, double its cost.
if (_objCharacter.Uneducated && (objSkillControl.SkillCategory == "Academic" || objSkillControl.SkillCategory == "Professional"))
intKarmaCost *= 2;
// The Karma Cost for improving a Language Knowledge Skill to Rating 1 is free for characters with the Linguistics Adept Power.
if (_objImprovementManager.ValueOf(Improvement.ImprovementType.AdeptLinguistics) > 0 && objSkillControl.SkillCategory == "Language" && objSkillControl.SkillRating == 0)
intKarmaCost = 0;
//Academic Knowledge Skills over rating 3 get a 1 point discount with the College Education quality enabled.
if (_objCharacter.CollegeEducation && objSkillControl.SkillCategory == "Academic" && (objSkillControl.SkillRating + 1) >= 3)
{
intKarmaCost -= 1;
}
if (intKarmaCost > _objCharacter.Karma)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughKarma"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughKarma"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (intKarmaCost > 0)
{
if (!ConfirmKarmaExpense(LanguageManager.Instance.GetString("Message_ConfirmKarmaExpense").Replace("{0}", objSkillControl.SkillObject.DisplayName).Replace("{1}", (objSkillControl.SkillRating + 1).ToString()).Replace("{2}", intKarmaCost.ToString())))
return;
}
// Create the Karma Expense.
ExpenseLogEntry objExpense = new ExpenseLogEntry();
objExpense.Create(intKarmaCost * -1, LanguageManager.Instance.GetString("String_ExpenseKnowledgeSkill") + " " + objSkillControl.SkillObject.DisplayName + " " + objSkillControl.SkillRating.ToString() + " -> " + (objSkillControl.SkillRating + 1).ToString(), ExpenseType.Karma, DateTime.Now);
_objCharacter.ExpenseEntries.Add(objExpense);
ExpenseUndo objUndo = new ExpenseUndo();
objUndo.CreateKarma(KarmaExpenseType.ImproveSkill, objSkillControl.SkillName);
objExpense.Undo = objUndo;
_objCharacter.Karma -= intKarmaCost;
objSkillControl.SkillRating += 1;
UpdateCharacterInfo();
_blnIsDirty = true;
UpdateWindowTitle();
}
示例15: cmdAddQuality_Click
private void cmdAddQuality_Click(object sender, EventArgs e)
{
frmSelectQuality frmPickQuality = new frmSelectQuality(_objCharacter);
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 objQuality = new Quality(_objCharacter);
objQuality.Create(objXmlQuality, _objCharacter, QualitySource.Selected, objNode, objWeapons, objWeaponNodes);
objNode.ContextMenuStrip = cmsQuality;
if (objQuality.InternalId == Guid.Empty.ToString())
return;
if (frmPickQuality.FreeCost)
objQuality.BP = 0;
bool blnAddItem = true;
int intKarmaCost = objQuality.BP * _objOptions.KarmaQuality;
if (!_objCharacter.Options.DontDoubleQualities)
intKarmaCost *= 2;
// Make sure the character has enough Karma to pay for the Quality.
if (objQuality.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 && !frmPickQuality.FreeCost && objQuality.ContributeToBP)
{
if (!ConfirmKarmaExpense(LanguageManager.Instance.GetString("Message_ConfirmKarmaExpenseSpend").Replace("{0}", objQuality.DisplayNameShort).Replace("{1}", intKarmaCost.ToString())))
blnAddItem = false;
}
if (blnAddItem && objQuality.ContributeToBP)
{
// Create the Karma expense.
ExpenseLogEntry objExpense = new ExpenseLogEntry();
objExpense.Create(intKarmaCost * -1, LanguageManager.Instance.GetString("String_ExpenseAddPositiveQuality") + " " + objQuality.DisplayNameShort, ExpenseType.Karma, DateTime.Now);
_objCharacter.ExpenseEntries.Add(objExpense);
_objCharacter.Karma -= intKarmaCost;
ExpenseUndo objUndo = new ExpenseUndo();
objUndo.CreateKarma(KarmaExpenseType.AddQuality, objQuality.InternalId);
objExpense.Undo = objUndo;
}
}
else
{
if (MessageBox.Show(LanguageManager.Instance.GetString("Message_AddNegativeQuality"), LanguageManager.Instance.GetString("MessageTitle_AddNegativeQuality"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
blnAddItem = false;
if (blnAddItem)
{
// Create a Karma Expense for the Negative Quality.
ExpenseLogEntry objExpense = new ExpenseLogEntry();
objExpense.Create(0, LanguageManager.Instance.GetString("String_ExpenseAddNegativeQuality") + " " + objQuality.DisplayNameShort, ExpenseType.Karma, DateTime.Now);
_objCharacter.ExpenseEntries.Add(objExpense);
ExpenseUndo objUndo = new ExpenseUndo();
objUndo.CreateKarma(KarmaExpenseType.AddQuality, objQuality.InternalId);
objExpense.Undo = objUndo;
}
}
if (blnAddItem)
{
// Add the Quality to the appropriate parent node.
if (objQuality.Type == QualityType.Positive)
{
treQualities.Nodes[0].Nodes.Add(objNode);
treQualities.Nodes[0].Expand();
}
else
{
treQualities.Nodes[1].Nodes.Add(objNode);
treQualities.Nodes[1].Expand();
}
_objCharacter.Qualities.Add(objQuality);
// Add any created Weapons to the character.
foreach (Weapon objWeapon in objWeapons)
_objCharacter.Weapons.Add(objWeapon);
// Create the Weapon Node if one exists.
foreach (TreeNode objWeaponNode in objWeaponNodes)
{
objWeaponNode.ContextMenuStrip = cmsWeapon;
treWeapons.Nodes[0].Nodes.Add(objWeaponNode);
//.........这里部分代码省略.........