private void cboRequirements_SelectionChangeCommitted(object sender, EventArgs e) { if (this.cboRequirements.SelectedItem == null) { return; } this.txtValue.Text = ""; this.txtID.Text = ""; RequirementItem item = this.cboRequirements.SelectedItem as RequirementItem; if (item == null) { return; } this.txtValue.Visible = !String.IsNullOrEmpty(item.Value.hasValue); this.cboOperators.Visible = !String.IsNullOrEmpty(item.Value.hasOperator); this.txtID.Visible = !String.IsNullOrEmpty(item.Value.hasID); this.lblID.Text = item.Value.strLabelID; this.lblID.Visible = this.txtID.Visible; this.lblValue.Text = item.Value.strLabelValue; this.lblValue.Visible = this.txtValue.Visible; this.lblOperator.Visible = this.cboOperators.Visible; }
public frmRequirement() { InitializeComponent(); VisibilityTypes.Clear(); VisibilityTypes.Add("Hide"); VisibilityTypes.Add("AlternateText"); Operators.Clear(); Operators.Add("None"); Operators.Add("GTE"); Operators.Add("GT"); Operators.Add("LTE"); Operators.Add("LT"); Operators.Add("EQ"); RequirementTypes.Clear(); RequirementTypes.Add(new RequirementItem("None")); RequirementTypes.Add(new RequirementItem("Buff")); RequirementTypes.Add(new RequirementItem("QuestStatus")); RequirementTypes.Add(new RequirementItem("Skill")); RequirementTypes.Add(new RequirementItem("Admin")); // Extensions enabled. if ((bool)Properties.Settings.Default["Extensions"]) { RequirementItem item = new RequirementItem("HasCVarSDX, Mods", "Condition to determine the cvar value to the supplied value", "The value for this cvar to pass the check", "The cvar name"); item.Value.strLabelValue = "Cvar Value:"; item.Value.strLabelID = "Cvar Name:"; item.Value.strExample = @"<requirement type='HasCVarSDX, Mods' requirementtype='Hide' id='cursesamaramorgan' operator='gte' value='1' />"; RequirementTypes.Add(item); item = new RequirementItem("FactionValue, Mods", "Condition to determine which faction to show using the faction value", "The faction to pass the check", "The faction name"); item.Value.strLabelValue = "Faction Value:"; item.Value.strLabelID = "Faction Name:"; item.Value.strExample = @"<requirement type='FactionValue, Mods' requirementtype='Hide' id='undead' operator='gte' value='100' />"; RequirementTypes.Add(item); item = new RequirementItem("Faction, Mods", "", "", "The faction to pass the check"); item.Value.strLabelID = "Faction Name:"; item.Value.strExample = @"<requirement type='Faction, Mods' requirementtype='Hide' id='undead' />"; RequirementTypes.Add(item); item = new RequirementItem("HasBuffSDX, Mods", "", "The buff name. This can include more than one buff, seperated by a comma. Requirement is true if any of them are found on the player. Buffs with leading ! returns true if the buff does not exist.", ""); item.Value.strLabelValue = "Buff(s):"; RequirementTypes.Add(item); item = new RequirementItem("HasItemSDX, Mods", "", "How many of the item does the player need to have? Defaults to 1.", "The name of the item to require the player to have."); item.Value.strLabelID = "ItemName:"; item.Value.strLabelValue = "Count:"; RequirementTypes.Add(item); item = new RequirementItem("HasQuestSDX, Mods", "", "", ""); item.Value.strLabelID = ""; item.Value.strLabelValue = ""; RequirementTypes.Add(item); item = new RequirementItem("HasFailedQuestSDX, Mods", "", "Quest", ""); item.Value.strLabelID = ""; item.Value.strLabelValue = "Quest: "; RequirementTypes.Add(item); item = new RequirementItem("HasCompletedQuestSDX, Mods", "", "Quest", ""); item.Value.strLabelID = ""; item.Value.strLabelValue = "Quest: "; RequirementTypes.Add(item); item = new RequirementItem("HasTaskSDX, Mods", "", "NPC Only: Check if the NPC has a particular AI Task.", ""); item.Value.strLabelValue = "AI Task:"; item.Value.strLabelID = ""; RequirementTypes.Add(item); // For NPC's that are hired. item = new RequirementItem("HiredSDX, Mods", "", "Optional: Set to not to show the response if the NPC is not hired.", ""); item.Value.strLabelValue = "Set to Not to reverse condition:"; item.Value.strLabelID = ""; RequirementTypes.Add(item); item = new RequirementItem("PatrolSDX, Mods", "", "Optional: Set to not to show the response if hte NPC is not hired.", ""); item.Value.strLabelValue = "AI Task:"; item.Value.strLabelID = ""; RequirementTypes.Add(item); } this.cboRequirements.Items.AddRange(RequirementTypes.ToArray()); this.cboVisibility.Items.AddRange(VisibilityTypes.ToArray()); this.cboOperators.Items.AddRange(Operators.ToArray()); this.cboRequirements.SelectedIndex = 0; this.cboVisibility.SelectedIndex = 0; this.cboOperators.SelectedIndex = 0; }