Exemplo n.º 1
0
        public GameTeamSelector(CTFGame game, int teamSize, bool randomTeam) : base(50, 50)
        {
            m_Game       = game;
            m_TeamSize   = teamSize;
            m_RandomTeam = randomTeam;

            //Closable = false;
            Dragable = false;

            AddPage(0);
            AddBackground(0, 0, 250, 220, 5054);
            AddBackground(10, 10, 230, 200, 3000);

            AddPage(1);
            AddLabel(20, 20, 0, "Select a team:");

            if (m_RandomTeam)
            {
                AddButton(20, 60, 4005, 4006, 1, GumpButtonType.Reply, 0);
                AddLabel(55, 60, 0, "Join Random Team");
            }
            else
            {
                for (int i = 0; i < m_Game.Teams.Count; i++)
                {
                    CTFTeam team = (CTFTeam)m_Game.Teams[i];
                    if (team.ActiveMemberCount < m_TeamSize)
                    {
                        AddButton(20, 60 + i * 20, 4005, 4006, i + 1, GumpButtonType.Reply, 0);
                        AddLabel(55, 60 + i * 20, 0, "Join Team " + team.Name);
                    }
                }
            }
        }
Exemplo n.º 2
0
        public override bool AllowHarmful(Mobile from, Mobile target)
        {
            CTFTeam ft = CTFGame.FindTeamFor(from);
            CTFTeam tt = CTFGame.FindTeamFor(target);

            return(ft != null && tt != null && ft != tt && ft.Game == tt.Game && ft.Game.Running);
        }
Exemplo n.º 3
0
        public override bool OnSingleClick(Mobile from, object o)
        {
            if (!(o is Mobile))
            {
                return(base.OnSingleClick(from, o));
            }

            Mobile  m    = (Mobile)o;
            CTFTeam team = CTFGame.FindTeamFor(m);

            if (team != null)
            {
                string msg;
                Item[] items = null;

                if (m.Backpack != null)
                {
                    items = m.Backpack.FindItemsByType(typeof(CTFFlag));
                }

                if (items == null || items.Length == 0)
                {
                    msg = String.Format("(Team: {0})", team.Name);
                }
                else
                {
                    StringBuilder sb = new StringBuilder("(Team: ");
                    sb.Append(team.Name);
                    sb.Append(" -- Flag");
                    if (items.Length > 1)
                    {
                        sb.Append("s");
                    }
                    sb.Append(": ");

                    for (int j = 0; j < items.Length; j++)
                    {
                        CTFFlag flag = (CTFFlag)items[j];

                        if (flag != null && flag.Team != null)
                        {
                            if (j > 0)
                            {
                                sb.Append(", ");
                            }

                            sb.Append(flag.Team.Name);
                        }
                    }

                    sb.Append(")");
                    msg = sb.ToString();
                }
                m.PrivateOverheadMessage(Network.MessageType.Label, team.Hue, true, msg, from.NetState);
            }

            return(true);
        }
Exemplo n.º 4
0
        public GameJoinGump(CTFGame game, string gameName)
            : base(String.Format("Welcome to {0}! Enter the game with caution! All non-bless/non-newbied items will be lost! All pets will be lost! Bank your items before joining, supplies will be provided.  Enjoy!", gameName), null)
        {
            m_Game = game;

            List <String> mAnswers = new List <String>();

            mAnswers.Add("Cancel");
            mAnswers.Add("Okay, Join!");

            Answers = mAnswers.ToArray();
        }
Exemplo n.º 5
0
        public override bool AllowHarmful(Mobile from, Mobile target)
        {
            CTFTeam ft = CTFGame.FindTeamFor(from);

            if (ft == null)
            {
                return(false);
            }
            CTFTeam tt = CTFGame.FindTeamFor(target);

            if (tt == null)
            {
                return(false);
            }
            return(ft != tt && ft.Game == tt.Game && ft.Game.Running);
        }
Exemplo n.º 6
0
        public GameTeamSelector(CTFGame game, int teamSize) : base("Select a Team", null)
        {
            List <String> mTeams = new List <String>();

            m_Game     = game;
            m_TeamSize = teamSize;

            for (int i = 0; i < m_Game.Teams.Count; i++)
            {
                CTFTeam team = (CTFTeam)m_Game.Teams[i];
                if (team.ActiveMemberCount < m_TeamSize)
                {
                    mTeams.Add("Join Team " + team.Name);
                }
            }

            Answers = mTeams.ToArray();
        }
Exemplo n.º 7
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 0:
            {
                m_TeamID = reader.ReadInt();
                m_Game   = reader.ReadItem() as CTFGame;
                m_Timer  = reader.ReadInt();
                m_Points = reader.ReadInt();
                break;
            }
            }
        }
Exemplo n.º 8
0
        public GameJoinGump(CTFGame game, string gameName, bool randomTeam) : base(20, 30)
        {
            m_Game       = game;
            m_RandomTeam = randomTeam;

            AddPage(0);
            AddBackground(0, 0, 550, 220, 5054);
            AddBackground(10, 10, 530, 200, 3000);

            AddPage(1);
            AddLabel(20, 20, 0, String.Format("Welcome to {0}!", gameName));
            AddLabel(20, 80, 0, "Bank your items before joining, supplies");
            AddLabel(20, 100, 0, "will be provided.  Enjoy!");

            AddLabel(55, 180, 0, "Cancel");
            AddButton(20, 180, 4005, 4006, 0, GumpButtonType.Reply, 0);
            AddLabel(165, 180, 0, "Okay, Join!");
            AddButton(130, 180, 4005, 4006, 1, GumpButtonType.Reply, 0);
        }
Exemplo n.º 9
0
        public GameJoinGump(CTFGame game, string gameName) : base(20, 30)
        {
            m_Game = game;

            AddPage(0);
            AddBackground(0, 0, 550, 220, 5054);
            AddBackground(10, 10, 530, 200, 3000);

            AddPage(1);
            AddLabel(20, 20, 0, String.Format("Welcome to {0}!", gameName));
            //AddLabel( 20, 60, 0, "Let it be known to all who join the the melee that lays within, you will not" );
            AddLabel(20, 60, 0, "Enter the game with caution! ll non-bless/non-newbied items will be lost!");
            AddLabel(20, 80, 0, "All pets will be lost! Bank your items before joining, supplies");
            AddLabel(20, 100, 0, "will be provided.  Enjoy!");

            AddLabel(55, 180, 0, "Cancel");
            AddButton(20, 180, 4005, 4006, 0, GumpButtonType.Reply, 0);
            AddLabel(165, 180, 0, "Okay, Join!");
            AddButton(130, 180, 4005, 4006, 1, GumpButtonType.Reply, 0);
        }
Exemplo n.º 10
0
            protected override void OnTarget(Mobile from, object targ)
            {
                if (!(targ is PlayerMobile))
                {
                    from.SendMessage("You can only target players.");
                    return;
                }

                CTFTeam team = CTFGame.FindTeamFor((PlayerMobile)targ);

                if (team == null)
                {
                    from.SendMessage("This player is not in a CTF game.");
                }
                else
                {
                    team.Game.LeaveGame((PlayerMobile)targ);
                    LeaveGameGate.Strip((PlayerMobile)targ);
                    from.SendMessage("Player kicked from CTF.");
                }
            }
Exemplo n.º 11
0
        public CTFBoardGump(Mobile mob, CTFGame game, CTFTeamInfo section = null)
            : base(60, 60)
        {
            m_Game = game;

            var ourTeam = game.GetTeamInfo(mob);

            var entries = new List <IRankedCTF>();

            if (section == null)
            {
                for (var i = 0; i < game.Context.Participants.Count; ++i)
                {
                    var teamInfo = game.Controller.TeamInfo[i % 8];

                    if (teamInfo?.Flag == null)
                    {
                        continue;
                    }

                    entries.Add(teamInfo);
                }
            }
            else
            {
                foreach (var player in section.Players.Values)
                {
                    if (player.Score > 0)
                    {
                        entries.Add(player);
                    }
                }
            }

            entries.Sort((a, b) => b.Score - a.Score);

            var height = 0;

            if (section == null)
            {
                height = 73 + entries.Count * 75 + 28;
            }

            Closable = false;

            AddPage(0);

            AddBackground(1, 1, 398, height, 3600);

            AddImageTiled(16, 15, 369, height - 29, 3604);

            for (var i = 0; i < entries.Count; i += 1)
            {
                AddImageTiled(22, 58 + i * 75, 357, 70, 0x2430);
            }

            AddAlphaRegion(16, 15, 369, height - 29);

            AddImage(215, -45, 0xEE40);
            // AddImage( 330, 141, 0x8BA );

            AddBorderedText(22, 22, 294, 20, Center("CTF Scoreboard"), LabelColor32, BlackColor32);

            AddImageTiled(32, 50, 264, 1, 9107);
            AddImageTiled(42, 52, 264, 1, 9157);

            if (section == null)
            {
                for (var i = 0; i < entries.Count; ++i)
                {
                    var teamInfo = entries[i] as CTFTeamInfo;

                    if (teamInfo == null)
                    {
                        continue;
                    }

                    AddImage(30, 70 + i * 75, 10152);
                    AddImage(30, 85 + i * 75, 10151);
                    AddImage(30, 100 + i * 75, 10151);
                    AddImage(30, 106 + i * 75, 10154);

                    AddImage(24, 60 + i * 75, teamInfo == ourTeam ? 9730 : 9727, teamInfo.Color - 1);

                    var nameColor   = LabelColor32;
                    var borderColor = BlackColor32;

                    switch (teamInfo.Color)
                    {
                    case 0x47E:
                        nameColor = 0xFFFFFF;
                        break;

                    case 0x4F2:
                        nameColor = 0x3399FF;
                        break;

                    case 0x4F7:
                        nameColor = 0x33FF33;
                        break;

                    case 0x4FC:
                        nameColor = 0xFF00FF;
                        break;

                    case 0x021:
                        nameColor = 0xFF3333;
                        break;

                    case 0x01A:
                        nameColor = 0xFF66FF;
                        break;

                    case 0x455:
                        nameColor   = 0x333333;
                        borderColor = 0xFFFFFF;
                        break;
                    }

                    AddBorderedText(
                        60,
                        65 + i * 75,
                        250,
                        20,
                        $"{LadderGump.Rank(1 + i)}: {teamInfo.Name} Team",
                        nameColor,
                        borderColor
                        );

                    AddBorderedText(50 + 10, 85 + i * 75, 100, 20, "Score:", 0xFFC000, BlackColor32);
                    AddBorderedText(50 + 15, 105 + i * 75, 100, 20, teamInfo.Score.ToString("N0"), 0xFFC000, BlackColor32);

                    AddBorderedText(110 + 10, 85 + i * 75, 100, 20, "Kills:", 0xFFC000, BlackColor32);
                    AddBorderedText(110 + 15, 105 + i * 75, 100, 20, teamInfo.Kills.ToString("N0"), 0xFFC000, BlackColor32);

                    AddBorderedText(160 + 10, 85 + i * 75, 100, 20, "Captures:", 0xFFC000, BlackColor32);
                    AddBorderedText(
                        160 + 15,
                        105 + i * 75,
                        100,
                        20,
                        teamInfo.Captures.ToString("N0"),
                        0xFFC000,
                        BlackColor32
                        );

                    var pl = teamInfo.Leader;

                    AddBorderedText(235 + 10, 85 + i * 75, 250, 20, "Leader:", 0xFFC000, BlackColor32);

                    if (pl != null)
                    {
                        AddBorderedText(235 + 15, 105 + i * 75, 250, 20, pl.Player.Name, 0xFFC000, BlackColor32);
                    }
                }
            }

            AddButton(314, height - 42, 247, 248, 1);
        }
Exemplo n.º 12
0
        public CTFBoardGump( Mobile mob, CTFGame game, CTFTeamInfo section )
            : base(60, 60)
        {
            m_Game = game;

            CTFTeamInfo ourTeam = game.GetTeamInfo( mob );

            List<IRankedCTF> entries = new List<IRankedCTF>();

            if ( section == null )
            {
                for ( int i = 0; i < game.Context.Participants.Count; ++i )
                {
                    CTFTeamInfo teamInfo = game.Controller.TeamInfo[i % 8];

                    if ( teamInfo == null || teamInfo.Flag == null )
                        continue;

                    entries.Add( teamInfo );
                }
            }
            else
            {
                foreach ( CTFPlayerInfo player in section.Players.Values )
                {
                    if ( player.Score > 0 )
                        entries.Add( player );
                }
            }

            entries.Sort( delegate( IRankedCTF a, IRankedCTF b )
            {
                return b.Score - a.Score;
            } );

            int height = 0;

            if ( section == null )
                height = 73 + ( entries.Count * 75 ) + 28;

            Closable = false;

            AddPage( 0 );

            AddBackground( 1, 1, 398, height, 3600 );

            AddImageTiled( 16, 15, 369, height - 29, 3604 );

            for ( int i = 0; i < entries.Count; i += 1 )
                AddImageTiled( 22, 58 + ( i * 75 ), 357, 70, 0x2430 );

            AddAlphaRegion( 16, 15, 369, height - 29 );

            AddImage( 215, -45, 0xEE40 );
            //AddImage( 330, 141, 0x8BA );

            AddBorderedText( 22, 22, 294, 20, Center( "CTF Scoreboard" ), LabelColor32, BlackColor32 );

            AddImageTiled( 32, 50, 264, 1, 9107 );
            AddImageTiled( 42, 52, 264, 1, 9157 );

            if ( section == null )
            {
                for ( int i = 0; i < entries.Count; ++i )
                {
                    CTFTeamInfo teamInfo = entries[i] as CTFTeamInfo;

                    AddImage( 30, 70 + ( i * 75 ), 10152 );
                    AddImage( 30, 85 + ( i * 75 ), 10151 );
                    AddImage( 30, 100 + ( i * 75 ), 10151 );
                    AddImage( 30, 106 + ( i * 75 ), 10154 );

                    AddImage( 24, 60 + ( i * 75 ), teamInfo == ourTeam ? 9730 : 9727, teamInfo.Color - 1 );

                    int nameColor = LabelColor32;
                    int borderColor = BlackColor32;

                    switch ( teamInfo.Color )
                    {
                        case 0x47E:
                            nameColor = 0xFFFFFF;
                            break;

                        case 0x4F2:
                            nameColor = 0x3399FF;
                            break;

                        case 0x4F7:
                            nameColor = 0x33FF33;
                            break;

                        case 0x4FC:
                            nameColor = 0xFF00FF;
                            break;

                        case 0x021:
                            nameColor = 0xFF3333;
                            break;

                        case 0x01A:
                            nameColor = 0xFF66FF;
                            break;

                        case 0x455:
                            nameColor = 0x333333;
                            borderColor = 0xFFFFFF;
                            break;
                    }

                    AddBorderedText( 60, 65 + ( i * 75 ), 250, 20, String.Format( "{0}: {1} Team", LadderGump.Rank( 1 + i ), teamInfo.Name ), nameColor, borderColor );

                    AddBorderedText( 50 + 10, 85 + ( i * 75 ), 100, 20, "Score:", 0xFFC000, BlackColor32 );
                    AddBorderedText( 50 + 15, 105 + ( i * 75 ), 100, 20, teamInfo.Score.ToString( "N0" ), 0xFFC000, BlackColor32 );

                    AddBorderedText( 110 + 10, 85 + ( i * 75 ), 100, 20, "Kills:", 0xFFC000, BlackColor32 );
                    AddBorderedText( 110 + 15, 105 + ( i * 75 ), 100, 20, teamInfo.Kills.ToString( "N0" ), 0xFFC000, BlackColor32 );

                    AddBorderedText( 160 + 10, 85 + ( i * 75 ), 100, 20, "Captures:", 0xFFC000, BlackColor32 );
                    AddBorderedText( 160 + 15, 105 + ( i * 75 ), 100, 20, teamInfo.Captures.ToString( "N0" ), 0xFFC000, BlackColor32 );

                    CTFPlayerInfo pl = teamInfo.Leader;

                    AddBorderedText( 235 + 10, 85 + ( i * 75 ), 250, 20, "Leader:", 0xFFC000, BlackColor32 );

                    if ( pl != null )
                        AddBorderedText( 235 + 15, 105 + ( i * 75 ), 250, 20, pl.Player.Name, 0xFFC000, BlackColor32 );
                }
            }
            else
            {
            }

            AddButton( 314, height - 42, 247, 248, 1, GumpButtonType.Reply, 0 );
        }
Exemplo n.º 13
0
 public CTFBoardGump( Mobile mob, CTFGame game )
     : this(mob, game, null)
 {
 }
Exemplo n.º 14
0
 public GameTeamSelector(CTFGame game, bool randomTeam) : this(game, game.TeamSize, randomTeam)
 {
 }
Exemplo n.º 15
0
			public StartTimer( CTFGame game, ArrayList list ) : base( StartDelay )
			{
				m_Game = game;
				m_List = list;
				Priority = TimerPriority.TwoFiftyMS;
			}
Exemplo n.º 16
0
			public DeathTimer( Mobile m, CTFTeam t, CTFGame g, TimeSpan DeathDelay ) : base( TimeSpan.Zero, TimeSpan.FromMilliseconds(250) )
			{
				m_Mob = m;
				m_Team = t;
                m_Game = g;
                m_Res = DateTime.Now + DeathDelay;

                if (m is PlayerMobile)
                {
                    m_GumpItem = new CustomGumpItem("Resurrect in", DeathDelay.Hours + ":" + DeathDelay.Minutes + ":" + DeathDelay.Seconds, m_Game, (PlayerMobile)m);
                    GameInfoGump.AddCustomMessage((PlayerMobile)m, m_GumpItem);
                }
				Priority = TimerPriority.TwoFiftyMS;
			}
Exemplo n.º 17
0
 public GameTeamSelector(CTFGame game) : this(game, game.TeamSize)
 {
 }