Example #1
0
        public void ResetGame()
        {
            AnnounceToPlayers("The game has started.");
            AnnounceToPlayers("Game will end when one of the teams reaches {0} Score.", MaxScore);
            AnnounceToPlayers("Team gets 15 Score for each flag captured and 1 point for each kill.");

            for (int i = 0; i < Teams.Count; i++)
            {
                CTFTeam team = (CTFTeam)Teams[i];

                team.Score = 0;
                if (team.Flag != null)
                {
                    team.Flag.ReturnToHome();

                    Item flagItem = (Item)team.Flag;
                    flagItem.EventItem = true;
                }
                else
                {
                    CTFFlag flag = new CTFFlag(this, team);
                    flag.EventItem = true;
                }
            }
        }
Example #2
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 1:
            {
                m_DeathDelay = reader.ReadTimeSpan();
                goto case 0;
            }

            case 0:
            {
                m_DeathPoint = reader.ReadBool();
                break;
            }
            }

            if (Running)
            {
                foreach (CTFTeam team in Teams)
                {
                    CTFFlag flag = new CTFFlag(this, team);
                    flag.EventItem = true;
                }
            }
        }
Example #3
0
            protected override void OnTarget(Mobile from, object target)
            {
                if (m_Flag.Game == null || !m_Flag.Game.Running)
                {
                    return;
                }

                CTFTeam fteam = m_Flag.Game.GetTeam(from) as CTFTeam;

                if (target is Mobile)
                {
                    Mobile  targ  = (Mobile)target;
                    CTFTeam tteam = m_Flag.Game.GetTeam(targ) as CTFTeam;
                    if (tteam == fteam && from != targ)
                    {
                        if (targ.Backpack != null)
                        {
                            targ.Backpack.DropItem(m_Flag);
                            targ.SendMessage("{0} gave you the {1} flag!", from.Name, m_Flag.Team.Name);
                            m_Flag.Game.AnnounceToPlayers("{0} passed the {1} flag to {2}!", from.Name, m_Flag.Team.Name, targ.Name);
                        }
                    }
                    else
                    {
                        from.SendMessage("You cannot give the flag to them!");
                    }
                }
                else if (target is CTFFlag)
                {
                    CTFFlag flag = target as CTFFlag;
                    if (flag.Team == fteam)
                    {
                        if (flag.Home)
                        {
                            from.SendMessage("You captured the {0} flag!", m_Flag.Team.Name);
                            flag.Game.AnnounceToPlayers("{0} ({1}) captured the {2} flag!", from.Name, fteam.Name, m_Flag.Team.Name);
                            m_Flag.ReturnToHome();
                            fteam.Score += 15;
                            m_Flag.Game.AddPlayerScore(from, 15);
                            m_Flag.Game.AnnounceScore();
                            m_Flag.Game.SendGMGump();
                            m_Flag.Game.SendPlayerGumps();
                        }
                        else
                        {
                            from.SendMessage("Your flag must be at home to capture!");
                        }
                    }
                    else
                    {
                        from.SendMessage("You can only capture for your own team!");
                    }
                }
            }
Example #4
0
 public ReturnTimer(CTFFlag flag) : base(TimeSpan.Zero, TimeSpan.FromSeconds(30.0))
 {
     m_Flag   = flag;
     m_Start  = DateTime.Now;
     Priority = TimerPriority.TwoFiftyMS;
 }
Example #5
0
 public CaptureTarget(CTFFlag flag) : base(3, false, TargetFlags.None)
 {
     m_Flag = flag;
 }
Example #6
0
			public ReturnTimer( CTFFlag flag ) : base( TimeSpan.Zero, TimeSpan.FromSeconds( 30.0 ) )
			{
				m_Flag = flag;
				m_Start = DateTime.Now;
				Priority = TimerPriority.TwoFiftyMS;
			}
Example #7
0
			public CaptureTarget( CTFFlag flag ) : base( 3, false, TargetFlags.None )
			{
				m_Flag = flag;
			}