public RulesetGump(Mobile from, Ruleset ruleset, RulesetLayout page, DuelContext duelContext, bool readOnly) : base(readOnly ? 310 : 50, 50) { this.m_From = from; this.m_Ruleset = ruleset; this.m_Page = page; this.m_DuelContext = duelContext; this.m_ReadOnly = readOnly; this.Dragable = !readOnly; from.CloseGump(typeof(RulesetGump)); from.CloseGump(typeof(DuelContextGump)); from.CloseGump(typeof(ParticipantGump)); RulesetLayout depthCounter = page; int depth = 0; while (depthCounter != null) { ++depth; depthCounter = depthCounter.Parent; } int count = page.Children.Length + page.Options.Length; this.AddPage(0); int height = 35 + 10 + 2 + (count * 22) + 2 + 30; this.AddBackground(0, 0, 260, height, 9250); this.AddBackground(10, 10, 240, height - 20, 0xDAC); this.AddHtml(35, 25, 190, 20, this.Center(page.Title), false, false); int x = 35; int y = 47; for (int i = 0; i < page.Children.Length; ++i) { this.AddGoldenButton(x, y, 1 + i); this.AddHtml(x + 25, y, 250, 22, page.Children[i].Title, false, false); y += 22; } for (int i = 0; i < page.Options.Length; ++i) { bool enabled = ruleset.Options[page.Offset + i]; if (readOnly) this.AddImage(x, y, enabled ? 0xD3 : 0xD2); else this.AddCheck(x, y, 0xD2, 0xD3, enabled, i); this.AddHtml(x + 25, y, 250, 22, page.Options[i], false, false); y += 22; } }
public PickRulesetGump(Mobile from, DuelContext context, Ruleset ruleset) : base(50, 50) { this.m_From = from; this.m_Context = context; this.m_Ruleset = ruleset; this.m_Defaults = ruleset.Layout.Defaults; this.m_Flavors = ruleset.Layout.Flavors; int height = 25 + 20 + ((this.m_Defaults.Length + 1) * 22) + 6 + 20 + (this.m_Flavors.Length * 22) + 25; this.AddPage(0); this.AddBackground(0, 0, 260, height, 9250); this.AddBackground(10, 10, 240, height - 20, 0xDAC); this.AddHtml(35, 25, 190, 20, this.Center("Rules"), false, false); int y = 25 + 20; for (int i = 0; i < this.m_Defaults.Length; ++i) { Ruleset cur = this.m_Defaults[i]; this.AddHtml(35 + 14, y, 176, 20, cur.Title, false, false); if (ruleset.Base == cur && !ruleset.Changed) this.AddImage(35, y + 4, 0x939); else if (ruleset.Base == cur) this.AddButton(35, y + 4, 0x93A, 0x939, 2 + i, GumpButtonType.Reply, 0); else this.AddButton(35, y + 4, 0x938, 0x939, 2 + i, GumpButtonType.Reply, 0); y += 22; } this.AddHtml(35 + 14, y, 176, 20, "Custom", false, false); this.AddButton(35, y + 4, ruleset.Changed ? 0x939 : 0x938, 0x939, 1, GumpButtonType.Reply, 0); y += 22; y += 6; this.AddHtml(35, y, 190, 20, this.Center("Flavors"), false, false); y += 20; for (int i = 0; i < this.m_Flavors.Length; ++i) { Ruleset cur = this.m_Flavors[i]; this.AddHtml(35 + 14, y, 176, 20, cur.Title, false, false); if (ruleset.Flavors.Contains(cur)) this.AddButton(35, y + 4, 0x939, 0x938, 2 + m_Defaults.Length + i, GumpButtonType.Reply, 0); else this.AddButton(35, y + 4, 0x938, 0x939, 2 + m_Defaults.Length + i, GumpButtonType.Reply, 0); y += 22; } }
public void AddFlavor( Ruleset flavor ) { if ( m_Flavors.Contains( flavor ) ) return; m_Flavors.Add( flavor ); m_Options.Or( flavor.m_Options ); }
public void RemoveFlavor( Ruleset flavor ) { if ( !m_Flavors.Contains( flavor ) ) return; m_Flavors.Remove( flavor ); m_Options.And( flavor.m_Options.Not() ); flavor.m_Options.Not(); }
public void ApplyFlavorsTo( Ruleset ruleset ) { for ( int i = 0; i < m_Flavors.Count; ++i ) { Ruleset flavor = m_Flavors[i]; m_Options.Or( flavor.m_Options ); } }
public void ApplyDefault(Ruleset newDefault) { this.m_Base = newDefault; this.m_Changed = false; this.m_Options = new BitArray(newDefault.m_Options); this.ApplyFlavorsTo(this); }
public void ApplyDefault( Ruleset newDefault ) { m_Base = newDefault; Era = Era.UOR; m_Changed = false; m_Options = new BitArray( newDefault.m_Options ); ApplyFlavorsTo( this ); }
public DuelContext(Mobile initiator, RulesetLayout layout, bool addNew) { this.m_Initiator = initiator; this.m_Participants = new ArrayList(); this.m_Ruleset = new Ruleset(layout); this.m_Ruleset.ApplyDefault(layout.Defaults[0]); if (addNew) { this.m_Participants.Add(new Participant(this, 1)); this.m_Participants.Add(new Participant(this, 1)); ((Participant)this.m_Participants[0]).Add(initiator); } }
public Tournament() { this.m_ParticipantsPerMatch = 2; this.m_PlayersPerParticipant = 1; this.m_Pyramid = new TournyPyramid(); this.m_Ruleset = new Ruleset(RulesetLayout.Root); this.m_Ruleset.ApplyDefault(this.m_Ruleset.Layout.Defaults[0]); this.m_Participants = new ArrayList(); this.m_Undefeated = new ArrayList(); this.m_Arenas = new ArrayList(); this.m_SignupPeriod = TimeSpan.FromMinutes(10.0); Timer.DelayCall(SliceInterval, SliceInterval, new TimerCallback(Slice)); }
public Tournament(GenericReader reader) { int version = reader.ReadEncodedInt(); switch ( version ) { case 4: { this.m_EventController = reader.ReadItem() as EventController; goto case 3; } case 3: { this.m_SuddenDeathRounds = reader.ReadEncodedInt(); goto case 2; } case 2: { this.m_TournyType = (TournyType)reader.ReadEncodedInt(); goto case 1; } case 1: { this.m_GroupType = (GroupingType)reader.ReadEncodedInt(); this.m_TieType = (TieType)reader.ReadEncodedInt(); this.m_SignupPeriod = reader.ReadTimeSpan(); goto case 0; } case 0: { if (version < 3) this.m_SuddenDeathRounds = 3; this.m_ParticipantsPerMatch = reader.ReadEncodedInt(); this.m_PlayersPerParticipant = reader.ReadEncodedInt(); this.m_SignupPeriod = reader.ReadTimeSpan(); this.m_Stage = TournamentStage.Inactive; this.m_Pyramid = new TournyPyramid(); this.m_Ruleset = new Ruleset(RulesetLayout.Root); this.m_Ruleset.ApplyDefault(this.m_Ruleset.Layout.Defaults[0]); this.m_Participants = new ArrayList(); this.m_Undefeated = new ArrayList(); this.m_Arenas = new ArrayList(); break; } } Timer.DelayCall(SliceInterval, SliceInterval, new TimerCallback(Slice)); }
public PickRulesetGump(Mobile from, DuelContext context, Ruleset ruleset) : base(50, 50) { m_From = from; m_Context = context; m_Ruleset = ruleset; m_Defaults = ruleset.Layout.Defaults; m_Flavors = ruleset.Layout.Flavors; m_Eras = ruleset.Layout.Eras; int height = 25 + 20 + ((m_Defaults.Length + 1) * 22) + 6 + 20 + (m_Flavors.Length * 22) + 125; AddPage(0); AddBackground(0, 0, 260, height, 9250); AddBackground(10, 10, 240, height - 20, 0xDAC); int y = 25; AddHtml(35, y, 190, 20, Center("Era"), false, false); y += 20; AddHtml(35 + 14, y, 176, 20, "Ultima Online: Renaissance", false, false); if (ruleset.Era == Era.UOR) { AddImage(35, y + 4, 0x939); } else { AddButton(35, y + 4, 0x938, 0x939, 99, GumpButtonType.Reply, 0); } y += 22; AddHtml(35 + 14, y, 176, 20, "Ultima Online: T2A", false, false); if (ruleset.Era == Era.T2A) { AddImage(35, y + 4, 0x939); } else { AddButton(35, y + 4, 0x938, 0x939, 100, GumpButtonType.Reply, 0); } y += 22; AddHtml(35 + 14, y, 176, 20, "Ultima Online: Arcade", false, false); if (ruleset.Era == Era.Arcade) { AddImage(35, y + 4, 0x939); } else { AddButton(35, y + 4, 0x938, 0x939, 101, GumpButtonType.Reply, 0); } y += 22; y += 6; AddHtml(35, y, 190, 20, Center("Rules"), false, false); y += 20; for (int i = 0; i < m_Defaults.Length; ++i) { Ruleset cur = m_Defaults[i]; AddHtml(35 + 14, y, 176, 20, cur.Title, false, false); if (ruleset.Base == cur && !ruleset.Changed) { AddImage(35, y + 4, 0x939); } else if (ruleset.Base == cur) { AddButton(35, y + 4, 0x93A, 0x939, 2 + i, GumpButtonType.Reply, 0); } else { AddButton(35, y + 4, 0x938, 0x939, 2 + i, GumpButtonType.Reply, 0); } y += 22; } AddHtml(35 + 14, y, 176, 20, "Custom", false, false); AddButton(35, y + 4, ruleset.Changed ? 0x939 : 0x938, 0x939, 1, GumpButtonType.Reply, 0); y += 22; y += 6; AddHtml(35, y, 190, 20, Center("Flavors"), false, false); y += 20; for (int i = 0; i < m_Flavors.Length; ++i) { Ruleset cur = m_Flavors[i]; AddHtml(35 + 14, y, 176, 20, cur.Title, false, false); if (ruleset.Flavors.Contains(cur)) { AddButton(35, y + 4, 0x939, 0x938, 2 + m_Defaults.Length + i, GumpButtonType.Reply, 0); } else { AddButton(35, y + 4, 0x938, 0x939, 2 + m_Defaults.Length + i, GumpButtonType.Reply, 0); } y += 22; } }
public DuelContext( Mobile initiator, RulesetLayout layout, bool addNew ) { m_Initiator = initiator; m_Participants = new List<Participant>(); m_Ruleset = new Ruleset( layout ); m_Ruleset.ApplyDefault( layout.Defaults[0] ); if ( addNew ) { m_Participants.Add( new Participant( this, 1 ) ); m_Participants.Add( new Participant( this, 1 ) ); m_Participants[0].Add( initiator ); } }
public RulesetGump(Mobile from, Ruleset ruleset, RulesetLayout page, DuelContext duelContext) : this(from, ruleset, page, duelContext, false) { }