public TourneyStoneEditGump(Mobile from, ref TourneyStoneAddon tsaddon, int irule) : base(50, 50) { from.CloseGump(typeof(TourneyStoneEditGump)); m_TourneyStone = tsaddon; m_iRule = irule; ConfigOptions = new ArrayList(); Rule CurRule = (Rule)m_TourneyStone.Ruleset[irule]; // Ascertain which conditions are configurable and add them into array for reference foreach (RuleCondition rc in CurRule.Conditions) { if (rc.Configurable) { ConfigOptions.Add(rc); } } int CondCount = ConfigOptions.Count; // Calculate the gump sizes int optionheight = 40; int height = (CondCount * optionheight) + 140; int width = 350; AddPage(0); AddBackground(10, 10, width, height, 0x242C); string CurDesc = CurRule.DynFill(CurRule.Desc); AddHtml(50, 35, width - 60, 50, string.Format("<div align=LEFT>Editing rule '{0}'</div>", CurDesc), false, false); AddHtml(50, 75, width, 50, string.Format("<div align=LEFT>Conditions :</div>", CurDesc), false, false); for (int icon = 0; icon < CondCount; icon++) { RuleCondition CurCon = (RuleCondition)ConfigOptions[icon]; if (CurCon.PropertyVal == "") { // Quantity is customizable property of this condition AddButton(50, 105 + (optionheight * icon), 0x15E1, 0x15E5, icon + 1, GumpButtonType.Reply, 0); AddHtml(100, 105 + (optionheight * icon), width, 50, string.Format("<div align=left>Quantity : {0}</div>", CurCon.Quantity), false, false); } else { // PropertyVal is customizable property of this condition AddButton(50, 105 + (optionheight * icon), 0x15E1, 0x15E5, icon + 1, GumpButtonType.Reply, 0); AddHtml(100, 105 + (optionheight * icon), width, 50, string.Format("<div align=left>Value : {0}</div>", CurCon.PropertyVal), false, false); } } AddButton((width / 2) - 8, (height - 40), 0x81A, 0x81B, 98, GumpButtonType.Reply, 0); // Okay }
public AlterCondValPrompt(int condid, int ruleid, ref TourneyStoneAddon ts, Mobile from) { m_iRule = ruleid; m_TourneyStone = ts; m_CondID = condid; string sMessage = ""; if (((RuleCondition)((Rule)ts.Ruleset[ruleid]).Conditions[condid]).PropertyVal == "") { // It's the quantity sMessage = "Please enter the new quantity for this condition :"; } else { // It's the property value sMessage = "Please enter the new value for this condition :"; } from.SendMessage(sMessage); }
public TourneyStoneUseGump(Mobile from, TourneyStoneAddon tsaddon) : base(50, 50) { from.CloseGump(typeof(TourneyStoneUseGump)); // Additional check to ensure we have a full tourney stone (!) if (tsaddon == null) { from.SendMessage("I'm afraid there is a fault. Please contact your supplier and request maintenance. Apologies for any inconveniences caused."); return; } m_TourneyStone = tsaddon; int RuleCount = m_TourneyStone.Ruleset.Count; // Calculate the gump sizes int optionheight = 50; int height = (RuleCount * optionheight) + 128; int width = 450; AddPage(0); AddBackground(10, 10, width, height, 0x242C); AddHtml(10, 20, width, 50, "<div align=CENTER>Tournament Stone Options</div>", false, false); AddHtml(10, 35, width, 50, string.Format("<div align=CENTER>Version {0}</div>", m_TourneyStone.RulesetVersion), false, false); int confcount = 0; for (int irule = 0; irule < RuleCount; irule++) { Rule CurRule = (Rule)m_TourneyStone.Ruleset[irule]; string CurDesc = CurRule.DynFill(CurRule.Desc); AddHtml(90, 80 + (irule * optionheight), width - (80 * 2), 75, CurDesc, false, false); AddButton(45, 80 + (irule * optionheight), 4005, 4007, irule + 1, GumpButtonType.Reply, 0); AddHtml(width - 55, 80 + (irule * optionheight), width, 75, (((Rule)m_TourneyStone.Ruleset[irule]).Active ? "<b>Active</b>" : "Inactive"), false, false); bool confound = false; for (int rcpos = 0; rcpos < CurRule.Conditions.Count; rcpos++) { if (((RuleCondition)CurRule.Conditions[rcpos]).Configurable) { confound = true; } } if (confound) { // Add configure button AddButton(90, 105 + (irule * optionheight) + 3, 0x15E1, 0x15E5, RuleCount + irule, GumpButtonType.Reply, 0); AddHtml(120, 105 + (irule * optionheight), 90, 110 + (irule * optionheight), "Edit", false, false); confcount++; } } AddButton((width / 2) - 8, (height - 40), 0x81A, 0x81B, 98, GumpButtonType.Reply, 0); // Okay m_ConfCount = confcount; }