Exemple #1
0
        public void Add(StageTraits traits)
        {
            var s = new Stage(traits);
            s.GetTraits().Ruleset = new Deathmatch(s);

            _stages.Add(s);
        }
Exemple #2
0
        public static void LadderLaunch(List<Client> clients, StageTraits stage)
        {
            using (var packet = new PacketWriter(Operation.LadderLaunch, CryptFlags.Encrypt))
            {
                packet.Write(stage.StageId);
                packet.Write(stage.Map);

                clients.ForEach(c => c.Send(packet));
            }
        }
Exemple #3
0
        public Stage Add(StageTraits traits)
        {
            lock (_objectLock)
            {
                _stages.Add(traits);
                var stage = _stages.Find(traits.StageId);
                stage.GetTraits().StageIndex = _stages.Index(stage);

                return stage;
            }
        }
Exemple #4
0
        public void CreateClanwar(List<Client> red, List<Client> blue)
        {
            var traits = new StageTraits();

            traits.StageId = Globals.StageCounter.GetNext();
            traits.Name = "LADDER_GAME";
            traits.MaxPlayers = (byte)(red.Count + blue.Count);
            traits.RoundCount = 4;
            traits.Locked = true;
            traits.Gametype = ObjectStageGameType.TeamDeathMatch;
            traits.Password = "******";
            traits.Master = red[0];
            traits.Map = "Town"; //default for now
            traits.CurrentMap = Globals.Maps.GetMap(traits.Map);
            traits.WinThePoint = true;

            var stage = new Stage(traits);
            traits.Ruleset = new TeamDeathmatch(stage);

            foreach (var client in red)
            {
                client.ClientPlayer.PlayerTeam = Team.Red;
                stage.Join(client);
                StagePackets.LadderPrepare(client, (int)Team.Red);
            }
            StagePackets.ResponseSettings(red, traits);
            foreach (var client in blue)
            {
                client.ClientPlayer.PlayerTeam = Team.Blue;
                stage.Join(client);
                StagePackets.LadderPrepare(client, (int)Team.Blue);
            }
            StagePackets.ResponseSettings(blue, traits);

            traits.Ruleset.GameStartCallback(red[0], true);
        }
Exemple #5
0
        public static void ProcessStageCreate(Client client, PacketReader packetReader)
        {
            var uid = packetReader.ReadMuid();
            var name = packetReader.ReadString();
            var locked = packetReader.ReadBoolean();
            var password = packetReader.ReadString();

            if (uid != client.GetMuid())
            {
                client.Disconnect();
                return;
            }

            var traits = new StageTraits();
            traits.StageId = Globals.StageCounter.GetNext();
            traits.Name = name;
            traits.Locked = locked;
            traits.Password = password;
            traits.Master = client;

            client.ClientPlayer.PlayerStage = client.GetChannel().Add(traits);
            client.GetStage().Join(client);
        }
Exemple #6
0
        public static void ResponseSettings(List<Client> clients, StageTraits stageTraits)
        {
            using (var packet = new PacketWriter(Operation.StageResponseSettings, CryptFlags.Encrypt))
            {
                packet.Write(stageTraits.StageId);
                packet.Write(1, 69);
                packet.Write(stageTraits.StageId);
                packet.Write(stageTraits.Map, 32);
                packet.Write(0);
                packet.Write((Int32)stageTraits.Gametype);
                packet.Write(stageTraits.RoundCount);
                packet.Write((Int32)stageTraits.Time);
                packet.Write((Int32)stageTraits.Level);
                packet.Write((Int32)stageTraits.MaxPlayers);
                packet.Write(stageTraits.TeamKill);
                packet.Write(stageTraits.WinThePoint);
                packet.Write(stageTraits.ForcedEntry);
                packet.Write(stageTraits.TeamBalanced);
                packet.Write(stageTraits.RelayEnabled);

                packet.Write(stageTraits.Players.Count, 16);
                foreach (var c in stageTraits.Players)
                {
                    packet.Write(c.GetMuid());
                    packet.Write((Int32)c.ClientPlayer.PlayerTeam);
                    packet.Write((Int32)c.ClientPlayer.PlayerState);
                }

                packet.Write((Int32)stageTraits.State);
                packet.Write(stageTraits.Master.GetMuid());

                clients.ForEach(c => c.Send(packet));
            }
        }
Exemple #7
0
 public Stage(StageTraits traits)
 {
     _traits = traits;
 }