Example #1
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 0:
            {
                m_Duration = reader.ReadTimeSpan();
                m_TeamInfo = new DDTeamInfo[reader.ReadEncodedInt()];

                for (int i = 0; i < m_TeamInfo.Length; ++i)
                {
                    m_TeamInfo[i] = new DDTeamInfo(i, reader);
                }

                m_PointA = reader.ReadItem() as DDWayPoint;
                m_PointB = reader.ReadItem() as DDWayPoint;

                break;
            }
            }
        }
Example #2
0
        public void Dominate(DDWayPoint point, Mobile from, DDTeamInfo team)
        {
            if (point == null || from == null || team == null || !m_Capturable)
            {
                return;
            }

            bool wasDom = (m_Controller.PointA != null && m_Controller.PointB != null &&
                           m_Controller.PointA.TeamOwner == m_Controller.PointB.TeamOwner && m_Controller.PointA.TeamOwner != null);

            point.TeamOwner = team;
            Alert("{0} has captured {1}!", team.Name, point.Name);

            bool isDom = (m_Controller.PointA != null && m_Controller.PointB != null &&
                          m_Controller.PointA.TeamOwner == m_Controller.PointB.TeamOwner && m_Controller.PointA.TeamOwner != null);

            if (wasDom && !isDom)
            {
                Alert("Domination averted!");

                if (m_Controller.PointA != null)
                {
                    m_Controller.PointA.SetNonCaptureHue();
                }

                if (m_Controller.PointB != null)
                {
                    m_Controller.PointB.SetNonCaptureHue();
                }

                if (m_CaptureTimer != null)
                {
                    m_CaptureTimer.Stop();
                }
                m_CaptureTimer = null;
            }

            if (!wasDom && isDom)
            {
                m_CapStage     = 0;
                m_CaptureTimer = Timer.DelayCall(TimeSpan.Zero, TimeSpan.FromSeconds(1.0), new TimerCallback(CaptureTick));
                m_CaptureTimer.Start();
            }
        }