Example #1
0
        protected internal override void Execute(IOnlineConnection Sender)
        {
            IRoomInformations CreatedRoom = Owner.Database.GenerateNewRoom(RoomName, RoomType, RoomSubtype, "", Owner.IP, Owner.Port, MinNumberOfPlayer, MaxNumberOfPlayer);

            CreatedGroup = ClientGroupTemplate.CreateFromTemplate(CreatedRoom);
            CreatedGroup.Room.AddOnlinePlayer(Sender, "Host");

            Owner.DicLocalRoom.Add(CreatedRoom.RoomID, CreatedGroup);
            Owner.DicAllRoom.Add(CreatedRoom.RoomID, CreatedRoom);
            Owner.ListPlayerToRemove.Add(Sender);

            Owner.SharedWriteBuffer.ClearWriteBuffer();
            Owner.SharedWriteBuffer.WriteScript(new RoomListScriptServer(Owner, new List <IRoomInformations>()
            {
                CreatedRoom
            }));

            foreach (IOnlineConnection ActivePlayer in Owner.ListPlayer)
            {
                if (ActivePlayer == Sender)
                {
                    continue;
                }

                ActivePlayer.SendWriteBuffer();
            }

            Sender.Send(new SendRoomIDScriptServer(CreatedRoom.RoomID));
        }
Example #2
0
 public JoinRoomLocalScriptServer(string RoomID, string CurrentDifficulty, List <BattleMapPlayer> ListJoiningPlayer, GameClientGroup ActiveGroup)
     : base(ScriptName)
 {
     this.RoomID            = RoomID;
     this.CurrentDifficulty = CurrentDifficulty;
     this.ListJoiningPlayer = ListJoiningPlayer;
     this.ActiveGroup       = ActiveGroup;
 }
Example #3
0
        protected internal override void Execute(IOnlineConnection ActivePlayer)
        {
            GameClientGroup ActiveTransferingRoom;

            if (Owner.DicTransferingRoom.TryGetValue(RoomID, out ActiveTransferingRoom) && ActiveTransferingRoom.Room.ListOnlinePlayer.Count < ActiveTransferingRoom.Room.CurrentPlayerCount)
            {
                ActiveTransferingRoom.Room.AddOnlinePlayer(ActivePlayer, "Host");
            }
            else if (Owner.DicAllRoom.ContainsKey(RoomID))
            {
                GameClientGroup NewRoom = ClientGroupTemplate.CreateFromTemplate(Owner.TransferRoom(RoomID));
                Owner.DicTransferingRoom.Add(RoomID, NewRoom);
                NewRoom.Room.AddOnlinePlayer(ActivePlayer, "Host");
                ActivePlayer.Send(new AskGameDataFromClientScriptServer());
            }
        }
Example #4
0
        protected internal override void Execute(IOnlineConnection Sender)
        {
            IRoomInformations RoomToJoin;

            if (Owner.DicAllRoom.TryGetValue(RoomID, out RoomToJoin))
            {
                GameClientGroup LocalRoom = null;
                if (RoomToJoin.OwnerServerIP != Owner.IP)
                {
                    Sender.Send(new JoinRoomRemoteScriptServer(RoomID, RoomToJoin.OwnerServerIP, RoomToJoin.OwnerServerPort));
                }
                else if (Owner.DicLocalRoom.TryGetValue(RoomID, out LocalRoom) && LocalRoom.Room.ListOnlinePlayer.Count < LocalRoom.Room.MaxNumberOfPlayer)
                {
                    Owner.DicLocalRoom[RoomID].Room.AddOnlinePlayer(Sender, "Player");
                    Owner.Database.UpdatePlayerCountInRoom(RoomID, (byte)LocalRoom.Room.ListOnlinePlayer.Count);
                    Owner.ListPlayerToRemove.Add(Sender);

                    OnJoinRoomLocal(Sender, RoomID, Owner.DicLocalRoom[RoomID]);
                }
                else
                {
                    //Maybe in transfer, don't allow the client to join
                    if (LocalRoom == null)
                    {
                        Sender.Send(new JoinRoomFailedScriptServer(RoomID, RoomToJoin));
                    }
                    else
                    {
                        Sender.Send(new JoinRoomFailedScriptServer(RoomID, LocalRoom.Room));
                    }
                }
            }
            else
            {
                Sender.Send(new JoinRoomFailedScriptServer(RoomID, RoomToJoin));
            }
        }
Example #5
0
 protected abstract void OnJoinRoomLocal(IOnlineConnection Sender, string RoomID, GameClientGroup ActiveGroup);
 public AskTripleThunderGameDataScriptServer(GameClientGroup ActiveGroup)
     : base(ScriptName)
 {
     this.ActiveGroup = ActiveGroup;
 }
Example #7
0
        protected override void OnJoinRoomLocal(IOnlineConnection Sender, string RoomID, GameClientGroup ActiveGroup)
        {
            RoomInformations JoinedRoom            = (RoomInformations)ActiveGroup.Room;
            List <Player>    ListJoiningPlayerInfo = JoinedRoom.GetOnlinePlayer(Sender);

            foreach (IOnlineConnection ActivePlayer in ActiveGroup.Room.ListOnlinePlayer)
            {
                if (ActivePlayer == Sender)
                {
                    continue;
                }

                ActivePlayer.Send(new PlayerJoinedScriptServer(ListJoiningPlayerInfo));
            }

            Dictionary <string, OnlineScript> DicNewScript = OnlineHelper.GetRoomScriptsServer(JoinedRoom, Owner);

            if (JoinedRoom.RoomType == RoomInformations.RoomTypeMission)
            {
                MissionRoomInformations MissionRoom = (MissionRoomInformations)JoinedRoom;

                DicNewScript.Add(AskStartGameMissionScriptServer.ScriptName, new AskStartGameMissionScriptServer(MissionRoom, (TripleThunderClientGroup)ActiveGroup, Owner));
                DicNewScript.Add(AskChangeRoomExtrasMissionScriptServer.ScriptName, new AskChangeRoomExtrasMissionScriptServer(MissionRoom));
            }
            else if (JoinedRoom.RoomType == RoomInformations.RoomTypeBattle)
            {
                BattleRoomInformations BattleRoom = (BattleRoomInformations)JoinedRoom;

                DicNewScript.Add(AskStartGameMissionScriptServer.ScriptName, new AskStartGameBattleScriptServer(BattleRoom, (TripleThunderClientGroup)ActiveGroup, Owner));
                DicNewScript.Add(AskChangeRoomExtrasBattleScriptServer.ScriptName, new AskChangeRoomExtrasBattleScriptServer(BattleRoom));
            }
            Sender.AddOrReplaceScripts(DicNewScript);

            if (ActiveGroup.CurrentGame != null)
            {
                FightingZone CurrentGame = (FightingZone)ActiveGroup.CurrentGame;

                foreach (Player ActivePlayer in ListJoiningPlayerInfo)
                {
                    CurrentGame.AddLocalCharacter(ActivePlayer);
                    ActivePlayer.OnlineClient = Sender;

                    int LayerIndex;
                    CurrentGame.AddPlayerFromSpawn(ActivePlayer, CurrentGame.NextRobotID + (uint.MaxValue - 100), true, out LayerIndex);

                    //Add Game Specific scripts
                    DicNewScript = OnlineHelper.GetTripleThunderScriptsServer((TripleThunderClientGroup)ActiveGroup, ActivePlayer);
                    Sender.AddOrReplaceScripts(DicNewScript);

                    foreach (IOnlineConnection OtherPlayer in ActiveGroup.Room.ListOnlinePlayer)
                    {
                        if (OtherPlayer == Sender)
                        {
                            continue;
                        }

                        OtherPlayer.Send(new CreatePlayerScriptServer(ActivePlayer, LayerIndex, false));
                    }
                }
            }

            Sender.Send(new JoinRoomLocalScriptServer(RoomID, JoinedRoom.CurrentDifficulty, ListJoiningPlayerInfo, ActiveGroup));
        }
Example #8
0
 public TransferRoomScriptServer(GameServer Owner, GameClientGroup ClientGroupTemplate, string RoomID)
     : this(Owner, ClientGroupTemplate)
 {
     this.RoomID = RoomID;
 }
Example #9
0
 public TransferRoomScriptServer(GameServer Owner, GameClientGroup ClientGroupTemplate)
     : base(ScriptName)
 {
     this.Owner = Owner;
     this.ClientGroupTemplate = ClientGroupTemplate;
 }
 public ReceiveGameDataScriptServer(GameClientGroup ActiveGroup, IOnlineConnection Owner)
     : base(ScriptName)
 {
     this.ActiveGroup = ActiveGroup;
     this.Owner       = Owner;
 }
        protected override void OnJoinRoomLocal(IOnlineConnection Sender, string RoomID, GameClientGroup ActiveGroup)
        {
            PVPRoomInformations    JoinedRoom            = (PVPRoomInformations)ActiveGroup.Room;
            List <BattleMapPlayer> ListJoiningPlayerInfo = JoinedRoom.GetOnlinePlayer(Sender);

            foreach (IOnlineConnection ActivePlayer in ActiveGroup.Room.ListOnlinePlayer)
            {
                if (ActivePlayer == Sender)
                {
                    continue;
                }

                ActivePlayer.Send(new PlayerJoinedScriptServer(ListJoiningPlayerInfo));
            }

            Dictionary <string, OnlineScript> DicNewScript = OnlineHelper.GetRoomScriptsServer(JoinedRoom, Owner);

            DicNewScript.Add(AskStartGameBattleScriptServer.ScriptName, new AskStartGameBattleScriptServer(JoinedRoom, (Online.BattleMapClientGroup)ActiveGroup, Owner));
            DicNewScript.Add(AskChangeRoomExtrasMissionScriptServer.ScriptName, new AskChangeRoomExtrasMissionScriptServer(JoinedRoom));

            Sender.AddOrReplaceScripts(DicNewScript);

            if (ActiveGroup.CurrentGame != null)
            {
            }

            Sender.Send(new JoinRoomLocalScriptServer(RoomID, JoinedRoom.CurrentDifficulty, ListJoiningPlayerInfo, ActiveGroup));
        }
Example #12
0
 public CreateRoomTripleThunderScriptServer(GameServer Owner, GameClientGroup ClientGroupTemplate)
     : base(Owner, ClientGroupTemplate)
 {
     this.Owner = Owner;
     this.ClientGroupTemplate = ClientGroupTemplate;
 }
        public static Dictionary <string, OnlineScript> GetTripleThunderScriptsServer(GameClientGroup ActiveGroup, Player ActivePlayer)
        {
            Dictionary <string, OnlineScript> DicNewScript = new Dictionary <string, OnlineScript>();

            DicNewScript.Add(ShootBulletScriptServer.ScriptName, new ShootBulletScriptServer((TripleThunderClientGroup)ActiveGroup, ActivePlayer));
            DicNewScript.Add(AskTripleThunderGameDataScriptServer.ScriptName, new AskTripleThunderGameDataScriptServer((TripleThunderClientGroup)ActiveGroup));
            DicNewScript.Add(CreateSFXScriptServer.ScriptName, new CreateSFXScriptServer((TripleThunderClientGroup)ActiveGroup));
            DicNewScript.Add(CreateVFXScriptServer.ScriptName, new CreateVFXScriptServer((TripleThunderClientGroup)ActiveGroup));

            return(DicNewScript);
        }