Ejemplo n.º 1
0
 public CTFFlag(CTFBase homebase, int team)
     : base(0x161D)
 {
     this.Hue      = BaseChallengeGame.TeamColor(team);
     this.Name     = String.Format("Team {0} Flag", team);
     this.HomeBase = homebase;
 }
Ejemplo n.º 2
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            this.HomeBase = reader.ReadItem() as CTFBase;
        }
Ejemplo n.º 3
0
        public void TeleportPlayersToBase()
        {
            // teleport players to the base
            if (this.Participants != null)
            {
                foreach (ChallengeEntry entry in this.Participants)
                {
                    CTFBase teambase = this.FindBase(entry.Team);

                    if (entry.Participant != null && teambase != null)
                    {
                        entry.Participant.MoveToWorld(teambase.Location, teambase.Map);
                    }
                }
            }
        }
Ejemplo n.º 4
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			HomeBase = reader.ReadItem() as CTFBase;
		}
Ejemplo n.º 5
0
		public CTFFlag(CTFBase homebase, int team) : base( 0x161D )
		{
            Hue = BaseChallengeGame.TeamColor(team);;
            Name = String.Format("Team {0} Flag", team);
            HomeBase = homebase;
		}
Ejemplo n.º 6
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 0:
                int count = reader.ReadInt();
                for (int i = 0; i < count; i++)
                {
                    CTFBase b = reader.ReadItem() as CTFBase;
                    this.HomeBases.Add(b);
                }
                this.m_Challenger = reader.ReadMobile();

                this.m_Organizers.Add(this.m_Challenger);

                this.m_GameLocked     = reader.ReadBool();
                this.m_GameInProgress = reader.ReadBool();
                this.m_TotalPurse     = reader.ReadInt();
                this.m_EntryFee       = reader.ReadInt();
                this.m_ArenaSize      = reader.ReadInt();
                this.m_TargetScore    = reader.ReadInt();
                this.m_MatchLength    = reader.ReadTimeSpan();

                TimeSpan elapsed = reader.ReadTimeSpan();

                if (elapsed > TimeSpan.Zero)
                {
                    this.m_MatchStart = DateTime.Now - elapsed;
                }

                this.m_MatchEnd = reader.ReadDateTime();

                count = reader.ReadInt();
                for (int i = 0; i < count; i++)
                {
                    ChallengeEntry entry = new ChallengeEntry();
                    entry.Participant = reader.ReadMobile();
                    string sname = reader.ReadString();
                    // look up the enum by name
                    ChallengeStatus status = ChallengeStatus.None;
                    try
                    {
                        status = (ChallengeStatus)Enum.Parse(typeof(ChallengeStatus), sname);
                    }
                    catch
                    {
                    }
                    entry.Status          = status;
                    entry.Accepted        = reader.ReadBool();
                    entry.PageBeingViewed = reader.ReadInt();
                    entry.Score           = reader.ReadInt();
                    entry.Winner          = reader.ReadBool();
                    entry.Team            = reader.ReadInt();

                    this.Participants.Add(entry);
                }
                break;
            }

            if (this.GameCompleted)
            {
                Timer.DelayCall(this.PostGameDecayTime, new TimerCallback(Delete));
            }

            // start the challenge timer
            this.StartChallengeTimer();

            this.SetNameHue();
        }
Ejemplo n.º 7
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (from == null || targeted == null || this.m_gauntlet == null || this.m_team == 0)
                    return;

                if (targeted is IPoint3D)
                {
                    IPoint3D p = targeted as IPoint3D;

                    CTFBase newbase = this.m_gauntlet.FindBase(this.m_team);

                    if (newbase == null)
                    {
                        newbase = new CTFBase(this.m_gauntlet, this.m_team);
                        // add the base to the gauntlet list
                        this.m_gauntlet.HomeBases.Add(newbase);
                    }

                    newbase.MoveToWorld(new Point3D(p), from.Map);

                    // clear all acceptances
                    this.m_gauntlet.ResetAcceptance();

                    // refresh all gumps
                    RefreshAllGumps(this.m_gauntlet, true);
                    // refresh the gump with the new member
                    //from.SendGump( new CTFGump( m_gauntlet, from));
                }
            }
Ejemplo n.º 8
0
            public override void OnResponse(NetState state, RelayInfo info)
            {
                if (state == null || info == null || state.Mobile == null || this.m_gauntlet == null)
                    return;

                switch (info.ButtonID)
                {
                    default:
                        {
                            // base buttons
                            if (info.ButtonID >= 1000)
                            {
                                int team = info.ButtonID - 1000;
                                //state.Mobile.Target = new CTFBaseTarget(m_gauntlet, team);

                                //   for hardcoded base locations instead of manually placed
                                // comment out the Target line above  and uncomment the code below
                                //

                                Point3D baseloc = Point3D.Zero;
                                switch (team)
                                {
                                    // hardcode the base locations for as many teams as you would like
                                    case 1:
                                        baseloc = new Point3D(5450, 1150, 0);
                                        break;
                                    case 2:
                                        baseloc = new Point3D(5500, 1150, 0);
                                        break;
                                    case 3:
                                        baseloc = new Point3D(5450, 1150, 0);
                                        break;
                                    case 4:
                                        baseloc = new Point3D(5500, 1150, 0);
                                        break;
                                }
                                CTFBase newbase = this.m_gauntlet.FindBase(team);

                                if (baseloc != Point3D.Zero)
                                {
                                    if (newbase == null)
                                    {
                                        newbase = new CTFBase(this.m_gauntlet, team);
                                        // add the base to the gauntlet list
                                        this.m_gauntlet.HomeBases.Add(newbase);
                                    }

                                    newbase.MoveToWorld(new Point3D(baseloc), state.Mobile.Map);
                                }

                                state.Mobile.SendGump(new TeamsGump(this.m_gauntlet, state.Mobile));
                            }
                            break;
                        }
                }
            }