Exemplo n.º 1
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.º 2
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.º 3
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.º 4
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.");
                }
            }