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 StakesContainer( DuelContext context, Participant participant ) : base( 0x9A8 ) { Movable = false; m_Initiator = context.Initiator; m_Participant = participant; m_Owners = new Hashtable(); }
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 ParticipantGump(Mobile from, DuelContext context, Participant p) : base(50, 50) { this.m_From = from; this.m_Context = context; this.m_Participant = p; from.CloseGump(typeof(RulesetGump)); from.CloseGump(typeof(DuelContextGump)); from.CloseGump(typeof(ParticipantGump)); int count = p.Players.Length; if (count < 4) count = 4; this.AddPage(0); int height = 35 + 10 + 22 + 22 + 30 + 22 + 2 + (count * 22) + 2 + 30; this.AddBackground(0, 0, 300, height, 9250); this.AddBackground(10, 10, 280, height - 20, 0xDAC); this.AddButton(240, 25, 0xFB1, 0xFB3, 3, GumpButtonType.Reply, 0); //AddButton( 223, 54, 0x265A, 0x265A, 4, GumpButtonType.Reply, 0 ); this.AddHtml(35, 25, 230, 20, this.Center("Participant Setup"), false, false); int x = 35; int y = 47; this.AddHtml(x, y, 200, 20, String.Format("Team Size: {0}", p.Players.Length), false, false); y += 22; this.AddGoldenButtonLabeled(x + 20, y, 1, "Increase"); y += 22; this.AddGoldenButtonLabeled(x + 20, y, 2, "Decrease"); y += 30; this.AddHtml(35, y, 230, 20, this.Center("Players"), false, false); y += 22; for (int i = 0; i < p.Players.Length; ++i) { DuelPlayer pl = p.Players[i]; this.AddGoldenButtonLabeled(x, y, 5 + i, String.Format("{0}: {1}", 1 + i, pl == null ? "Empty" : pl.Mobile.Name)); y += 22; } }
public DuelContextGump(Mobile from, DuelContext context) : base(50, 50) { this.m_From = from; this.m_Context = context; from.CloseGump(typeof(RulesetGump)); from.CloseGump(typeof(DuelContextGump)); from.CloseGump(typeof(ParticipantGump)); int count = context.Participants.Count; if (count < 3) count = 3; int height = 35 + 10 + 22 + 30 + 22 + 22 + 2 + (count * 22) + 2 + 30; this.AddPage(0); this.AddBackground(0, 0, 300, height, 9250); this.AddBackground(10, 10, 280, height - 20, 0xDAC); this.AddHtml(35, 25, 230, 20, this.Center("Duel Setup"), false, false); int x = 35; int y = 47; this.AddGoldenButtonLabeled(x, y, 1, "Rules"); y += 22; this.AddGoldenButtonLabeled(x, y, 2, "Start"); y += 22; this.AddGoldenButtonLabeled(x, y, 3, "Add Participant"); y += 30; this.AddHtml(35, y, 230, 20, this.Center("Participants"), false, false); y += 22; for (int i = 0; i < context.Participants.Count; ++i) { Participant p = (Participant)context.Participants[i]; this.AddGoldenButtonLabeled(x, y, 4 + i, String.Format(p.Count == 1 ? "Player {0}: {3}" : "Team {0}: {1}/{2}: {3}", 1 + i, p.FilledSlots, p.Count, p.NameList)); y += 22; } }
public void QueryRematch() { DuelContext dc = new DuelContext( m_Initiator, m_Ruleset.Layout, false ); dc.m_Ruleset = m_Ruleset; dc.m_Rematch = true; dc.m_Participants.Clear(); for ( int i = 0; i < m_Participants.Count; ++i ) { Participant oldPart = (Participant)m_Participants[i]; Participant newPart = new Participant( dc, oldPart.Players.Length ); for ( int j = 0; j < oldPart.Players.Length; ++j ) { DuelPlayer oldPlayer = oldPart.Players[j]; if ( oldPlayer != null ) newPart.Players[j] = new DuelPlayer( oldPlayer.Mobile, newPart ); } dc.m_Participants.Add( newPart ); } dc.CloseAllGumps(); dc.SendReadyUpGump(); }
public AcceptDuelGump( Mobile challenger, Mobile challenged, DuelContext context, Participant p, int slot ) : base( 50, 50 ) { m_Challenger = challenger; m_Challenged = challenged; m_Context = context; m_Participant = p; m_Slot = slot; challenged.CloseGump( typeof( AcceptDuelGump ) ); Closable = false; AddPage( 0 ); //AddBackground( 0, 0, 400, 220, 9150 ); AddBackground( 1, 1, 398, 218, 3600 ); //AddBackground( 16, 15, 369, 189, 9100 ); AddImageTiled( 16, 15, 369, 189, 3604 ); AddAlphaRegion( 16, 15, 369, 189 ); AddImage( 215, -43, 0xEE40 ); //AddImage( 330, 141, 0x8BA ); AddHtml( 22-1, 22, 294, 20, Color( Center( "Duel Challenge" ), BlackColor32 ), false, false ); AddHtml( 22+1, 22, 294, 20, Color( Center( "Duel Challenge" ), BlackColor32 ), false, false ); AddHtml( 22, 22-1, 294, 20, Color( Center( "Duel Challenge" ), BlackColor32 ), false, false ); AddHtml( 22, 22+1, 294, 20, Color( Center( "Duel Challenge" ), BlackColor32 ), false, false ); AddHtml( 22, 22, 294, 20, Color( Center( "Duel Challenge" ), LabelColor32 ), false, false ); string fmt; if ( p.Contains( challenger ) ) fmt = "You have been asked to join sides with {0} in a duel. Do you accept?"; else fmt = "You have been challenged to a duel from {0}. Do you accept?"; AddHtml( 22-1, 50, 294, 40, Color( String.Format( fmt, challenger.Name ), BlackColor32 ), false, false ); AddHtml( 22+1, 50, 294, 40, Color( String.Format( fmt, challenger.Name ), BlackColor32 ), false, false ); AddHtml( 22, 50-1, 294, 40, Color( String.Format( fmt, challenger.Name ), BlackColor32 ), false, false ); AddHtml( 22, 50+1, 294, 40, Color( String.Format( fmt, challenger.Name ), BlackColor32 ), false, false ); AddHtml( 22, 50, 294, 40, Color( String.Format( fmt, challenger.Name ), 0xB0C868 ), false, false ); AddImageTiled( 32, 88, 264, 1, 9107 ); AddImageTiled( 42, 90, 264, 1, 9157 ); AddRadio( 24, 100, 9727, 9730, true, 1 ); AddHtml( 60-1, 105, 250, 20, Color( "Yes, I will fight this duel.", BlackColor32 ), false, false ); AddHtml( 60+1, 105, 250, 20, Color( "Yes, I will fight this duel.", BlackColor32 ), false, false ); AddHtml( 60, 105-1, 250, 20, Color( "Yes, I will fight this duel.", BlackColor32 ), false, false ); AddHtml( 60, 105+1, 250, 20, Color( "Yes, I will fight this duel.", BlackColor32 ), false, false ); AddHtml( 60, 105, 250, 20, Color( "Yes, I will fight this duel.", LabelColor32 ), false, false ); AddRadio( 24, 135, 9727, 9730, false, 2 ); AddHtml( 60-1, 140, 250, 20, Color( "No, I do not wish to fight.", BlackColor32 ), false, false ); AddHtml( 60+1, 140, 250, 20, Color( "No, I do not wish to fight.", BlackColor32 ), false, false ); AddHtml( 60, 140-1, 250, 20, Color( "No, I do not wish to fight.", BlackColor32 ), false, false ); AddHtml( 60, 140+1, 250, 20, Color( "No, I do not wish to fight.", BlackColor32 ), false, false ); AddHtml( 60, 140, 250, 20, Color( "No, I do not wish to fight.", LabelColor32 ), false, false ); AddRadio( 24, 170, 9727, 9730, false, 3 ); AddHtml( 60-1, 175, 250, 20, Color( "No, knave. Do not ask again.", BlackColor32 ), false, false ); AddHtml( 60+1, 175, 250, 20, Color( "No, knave. Do not ask again.", BlackColor32 ), false, false ); AddHtml( 60, 175-1, 250, 20, Color( "No, knave. Do not ask again.", BlackColor32 ), false, false ); AddHtml( 60, 175+1, 250, 20, Color( "No, knave. Do not ask again.", BlackColor32 ), false, false ); AddHtml( 60, 175, 250, 20, Color( "No, knave. Do not ask again.", LabelColor32 ), false, false ); AddButton( 314, 173, 247, 248, 1, GumpButtonType.Reply, 0 ); Timer.DelayCall( TimeSpan.FromSeconds( 15.0 ), new TimerCallback( AutoReject ) ); }
public ReadyGump(Mobile from, DuelContext context, int count) : base(50, 50) { this.m_From = from; this.m_Context = context; this.m_Count = count; ArrayList parts = context.Participants; int height = 25 + 20; for (int i = 0; i < parts.Count; ++i) { Participant p = (Participant)parts[i]; height += 4; if (p.Players.Length > 1) height += 22; height += (p.Players.Length * 22); } height += 25; this.Closable = false; this.Dragable = false; this.AddPage(0); this.AddBackground(0, 0, 260, height, 9250); this.AddBackground(10, 10, 240, height - 20, 0xDAC); if (count == -1) { this.AddHtml(35, 25, 190, 20, this.Center("Ready"), false, false); } else { this.AddHtml(35, 25, 190, 20, this.Center("Starting"), false, false); this.AddHtml(35, 25, 190, 20, "<DIV ALIGN=RIGHT>" + count.ToString(), false, false); } int y = 25 + 20; for (int i = 0; i < parts.Count; ++i) { Participant p = (Participant)parts[i]; y += 4; bool isAllReady = true; int yStore = y; int offset = 0; if (p.Players.Length > 1) { this.AddHtml(35 + 14, y, 176, 20, String.Format("Participant #{0}", i + 1), false, false); y += 22; offset = 10; } for (int j = 0; j < p.Players.Length; ++j) { DuelPlayer pl = p.Players[j]; if (pl != null && pl.Ready) { this.AddImage(35 + offset, y + 4, 0x939); } else { this.AddImage(35 + offset, y + 4, 0x938); isAllReady = false; } string name = (pl == null ? "(Empty)" : pl.Mobile.Name); this.AddHtml(35 + offset + 14, y, 166, 20, name, false, false); y += 22; } if (p.Players.Length > 1) this.AddImage(35, yStore + 4, isAllReady ? 0x939 : 0x938); } }
public CTFGame( CTFController controller, DuelContext context ) : base(context) { m_Controller = controller; }
public ParticipantTarget( DuelContext context, Participant p, int index ) : base( 12, false, TargetFlags.None ) { m_Context = context; m_Participant = p; m_Index = index; }
public DDGame( DDController controller, DuelContext context ) : base( context ) { m_Controller = controller; }
public override EventGame Construct( DuelContext context ) { return new BRGame( this, context ); }
public ReadyUpGump( Mobile from, DuelContext context ) : base( 50, 50 ) { m_From = from; m_Context = context; Closable = false; AddPage( 0 ); if ( context.Rematch ) { int height = 25 + 20 + 10 + 22 + 25; AddBackground( 0, 0, 210, height, 9250 ); AddBackground( 10, 10, 190, height - 20, 0xDAC ); AddHtml( 35, 25, 140, 20, Center( "Rematch?" ), false, false ); AddButton( 35, 55, 247, 248, 1, GumpButtonType.Reply, 0 ); AddButton( 115, 55, 242, 241, 2, GumpButtonType.Reply, 0 ); } else { #region Participants AddPage( 1 ); ArrayList parts = context.Participants; int height = 25 + 20; for ( int i = 0; i < parts.Count; ++i ) { Participant p = (Participant)parts[i]; height += 4; if ( p.Players.Length > 1 ) height += 22; height += (p.Players.Length * 22); } height += 10 + 22 + 25; AddBackground( 0, 0, 260, height, 9250 ); AddBackground( 10, 10, 240, height - 20, 0xDAC ); AddHtml( 35, 25, 190, 20, Center( "Participants" ), false, false ); int y = 20 + 25; for ( int i = 0; i < parts.Count; ++i ) { Participant p = (Participant)parts[i]; y += 4; int offset = 0; if ( p.Players.Length > 1 ) { AddHtml( 35, y, 176, 20, String.Format( "Team #{0}", i + 1 ), false, false ); y += 22; offset = 10; } for ( int j = 0; j < p.Players.Length; ++j ) { DuelPlayer pl = p.Players[j]; string name = ( pl == null ? "(Empty)" : pl.Mobile.Name ); AddHtml( 35 + offset, y, 166, 20, name, false, false ); y += 22; } } y += 8; AddHtml( 35, y, 176, 20, "Continue?", false, false ); y -= 2; AddButton( 102, y, 247, 248, 0, GumpButtonType.Page, 2 ); AddButton( 169, y, 242, 241, 2, GumpButtonType.Reply, 0 ); #endregion #region Rules AddPage( 2 ); Ruleset ruleset = context.Ruleset; Ruleset basedef = ruleset.Base; height = 25 + 20 + 5 + 20 + 20 + 4; int changes = 0; BitArray defs; if ( ruleset.Flavors.Count > 0 ) { defs = new BitArray( basedef.Options ); for ( int i = 0; i < ruleset.Flavors.Count; ++i ) defs.Or( ((Ruleset)ruleset.Flavors[i]).Options ); height += ruleset.Flavors.Count * 18; } else { defs = basedef.Options; } BitArray opts = ruleset.Options; for ( int i = 0; i < opts.Length; ++i ) { if ( defs[i] != opts[i] ) ++changes; } height += (changes * 22); height += 10 + 22 + 25; AddBackground( 0, 0, 260, height, 9250 ); AddBackground( 10, 10, 240, height - 20, 0xDAC ); AddHtml( 35, 25, 190, 20, Center( "Rules" ), false, false ); AddHtml( 35, 50, 190, 20, String.Format( "Set: {0}", basedef.Title ), false, false ); y = 70; for ( int i = 0; i < ruleset.Flavors.Count; ++i, y += 18 ) AddHtml( 35, y, 190, 20, String.Format( " + {0}", ((Ruleset)ruleset.Flavors[i]).Title ), false, false ); y += 4; if ( changes > 0 ) { AddHtml( 35, y, 190, 20, "Modifications:", false, false ); y += 20; for ( int i = 0; i < opts.Length; ++i ) { if ( defs[i] != opts[i] ) { string name = ruleset.Layout.FindByIndex( i ); if ( name != null ) // sanity { AddImage( 35, y, opts[i] ? 0xD3 : 0xD2 ); AddHtml( 60, y, 165, 22, name, false, false ); } y += 22; } } } else { AddHtml( 35, y, 190, 20, "Modifications: None", false, false ); y += 20; } y += 8; AddHtml( 35, y, 176, 20, "Continue?", false, false ); y -= 2; AddButton( 102, y, 247, 248, 1, GumpButtonType.Reply, 0 ); AddButton( 169, y, 242, 241, 3, GumpButtonType.Reply, 0 ); #endregion } }
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 KHGame(KHController controller, DuelContext context) : base(context) { m_Controller = controller; }
public Participant(DuelContext context, int count) { this.m_Context = context; //m_Stakes = new StakesContainer( context, this ); this.Resize(count); }
public RulesetGump(Mobile from, Ruleset ruleset, RulesetLayout page, DuelContext duelContext) : this(from, ruleset, page, duelContext, false) { }
public void Start(Arena arena, Tournament tourny) { TournyParticipant first = (TournyParticipant)this.m_Participants[0]; DuelContext dc = new DuelContext((Mobile)first.Players[0], tourny.Ruleset.Layout, false); dc.Ruleset.Options.SetAll(false); dc.Ruleset.Options.Or(tourny.Ruleset.Options); for (int i = 0; i < this.m_Participants.Count; ++i) { TournyParticipant tournyPart = (TournyParticipant)this.m_Participants[i]; Participant duelPart = new Participant(dc, tournyPart.Players.Count); duelPart.TournyPart = tournyPart; for (int j = 0; j < tournyPart.Players.Count; ++j) duelPart.Add((Mobile)tournyPart.Players[j]); for (int j = 0; j < duelPart.Players.Length; ++j) { if (duelPart.Players[j] != null) duelPart.Players[j].Ready = true; } dc.Participants.Add(duelPart); } if (tourny.EventController != null) dc.m_EventGame = tourny.EventController.Construct(dc); dc.m_Tournament = tourny; dc.m_Match = this; dc.m_OverrideArena = arena; if (tourny.SuddenDeath > TimeSpan.Zero && (tourny.SuddenDeathRounds == 0 || tourny.Pyramid.Levels.Count <= tourny.SuddenDeathRounds)) dc.StartSuddenDeath(tourny.SuddenDeath); dc.SendReadyGump(0); if (dc.StartedBeginCountdown) { this.m_Context = dc; for (int i = 0; i < this.m_Participants.Count; ++i) { TournyParticipant p = (TournyParticipant)this.m_Participants[i]; for (int j = 0; j < p.Players.Count; ++j) { Mobile mob = (Mobile)p.Players[j]; foreach (Mobile view in mob.GetMobilesInRange(18)) { if (!mob.CanSee(view)) mob.Send(view.RemovePacket); } mob.LocalOverheadMessage(MessageType.Emote, 0x3B2, false, "* Your mind focuses intently on the fight and all other distractions fade away *"); } } } else { dc.Unregister(); dc.StopCountdown(); } }
public EventGame( DuelContext context ) { m_Context = context; }
public BRGame( BRController controller, DuelContext context ) : base(context) { m_Controller = controller; }
public abstract EventGame Construct( DuelContext dc );