Ejemplo n.º 1
0
        internal void SendAddRoom(Game.Server.Rooms.BaseRoom room)
        {
            GSPacketIn pkg = new GSPacketIn((int)eFightPackageType.GAME_ROOM_CREATE);

            pkg.WriteInt(room.RoomId);
            pkg.WriteInt((int)room.GameType);
            pkg.WriteInt(room.Game.PlayerCount);

            List <GamePlayer> players = room.GetPlayersSafe();

            foreach (GamePlayer p in players)
            {
                pkg.WriteInt(p.PlayerCharacter.ID);//改为唯一ID
                pkg.WriteInt(p.PlayerCharacter.Attack);
                pkg.WriteInt(p.PlayerCharacter.Defence);
                pkg.WriteInt(p.PlayerCharacter.Agility);
                pkg.WriteInt(p.PlayerCharacter.Luck);
                pkg.WriteDouble(p.GetBaseAttack());
                pkg.WriteDouble(p.GetBaseDefence());
                pkg.WriteDouble(p.GetBaseAgility());
                pkg.WriteDouble(p.GetBaseBlood());
                pkg.WriteInt(p.CurrentWeapon.TemplateID);
            }
            SendTCP(pkg, room);
        }
Ejemplo n.º 2
0
        public void SendUpdateRoom(BaseRoom room)
        {
            GamePlayer[] players = GetPlayersSafe();
            GSPacketIn   pkg     = null;

            foreach (GamePlayer p in players)
            {
                if (pkg == null)
                {
                    //---------------
                    BaseRoom[]      list     = RoomMgr.Rooms;
                    List <BaseRoom> tempList = new List <BaseRoom>();

                    for (int i = 0; i < list.Length; i++)
                    {
                        if (!list[i].IsEmpty)
                        {
                            tempList.Add(list[i]);
                        }
                    }
                    pkg = p.Out.SendUpdateRoomList(tempList);
                }
                else
                {
                    p.Out.SendTCP(pkg);
                }
            }
        }
Ejemplo n.º 3
0
        public static bool CanChangeStyle(BaseRoom game, GSPacketIn pkg)
        {
            FightRateInfo[] infos = GetAllFightRateInfo();
            try
            {
                foreach (FightRateInfo info in infos)
                {
                    if (info.BeginDay.Year <= DateTime.Now.Year && DateTime.Now.Year <= info.EndDay.Year)
                    {
                        if (info.BeginDay.DayOfYear <= DateTime.Now.DayOfYear && DateTime.Now.DayOfYear <= info.EndDay.DayOfYear)
                        {
                            if (info.BeginTime.TimeOfDay <= DateTime.Now.TimeOfDay && DateTime.Now.TimeOfDay <= info.EndTime.TimeOfDay)
                            {
                                if (Bussiness.ThreadSafeRandom.NextStatic(1000000) < info.Rate)
                                {
                                    //game.Data.FightName = info.Name;
                                    //GamePlayer[] selfs = game.GetAllPlayers();

                                    //pkg.WriteBoolean(true);
                                    //pkg.WriteInt(selfs.Length);
                                    //foreach (GamePlayer p in selfs)
                                    //{
                                    //    string style = string.Empty;
                                    //    string color = string.Empty;
                                    //    string skin = string.Empty;
                                    //    p.CurrentInventory.GetStyle(11, p.PlayerCharacter.Sex ? info.BoyTemplateID : info.GirlTemplateID, ref style, ref color, ref skin);

                                    //    //p.UpdateStyle(style,color,skin, p.EquipShow(3, 1, p.PlayerCharacter.Hide), true);
                                    //    pkg.WriteInt(p.PlayerCharacter.ID);
                                    //    pkg.WriteString(style);
                                    //    pkg.WriteInt(p.EquipShow(3, 1, p.PlayerCharacter.Hide));
                                    //    pkg.WriteBoolean(p.PlayerCharacter.Sex);
                                    //    pkg.WriteString(skin);
                                    //    pkg.WriteString(color);

                                    //    p.Out.SendMessage(Game.Server.Packets.eMessageType.ChatNormal, info.SelfCue);
                                    //}

                                    //GamePlayer[] enemys = game.MatchGame.GetAllPlayers();
                                    //foreach (GamePlayer p in enemys)
                                    //{
                                    //    p.Out.SendMessage(Game.Server.Packets.eMessageType.ChatNormal, info.EnemyCue);
                                    //}

                                    return true;
                                }
                            }
                        }
                    }

                }
            }
            catch
            { }

            pkg.WriteBoolean(false);

            return false;
        }
Ejemplo n.º 4
0
 public UpdateRoomPosAction(BaseRoom room, int pos,bool isOpened, int place, int placeView)
 {
     m_room = room;
     m_pos = pos;
     m_isOpened = isOpened;
     m_place = place;
     m_placeView = placeView;
 }
Ejemplo n.º 5
0
 public UpdateRoomPosAction(BaseRoom room, int pos, bool isOpened, int place, int placeView)
 {
     this.m_room      = room;
     this.m_pos       = pos;
     this.m_isOpened  = isOpened;
     this.m_place     = place;
     this.m_placeView = placeView;
 }
Ejemplo n.º 6
0
 public void SendRoomSetupChange(BaseRoom room)
 {
     if (this.m_host != null)
     {
         GSPacketIn pkg = this.m_host.Out.SendRoomChange(room);
         this.SendToAll(pkg);
     }
 }
Ejemplo n.º 7
0
 public static BattleServer AddRoom(BaseRoom room)
 {
     BattleServer server = FindActiveServer();
     if (server != null && server.AddRoom(room))
     {
         return server;
     }
     return null;
 }
Ejemplo n.º 8
0
        public void Execute()
        {
            BaseRoom room = m_player.CurrentRoom;

            if (room != null)
            {
                room.SwitchTeamUnsafe(m_player);
            }
        }
Ejemplo n.º 9
0
        public void Execute()
        {
            BaseRoom currentRoom = this.m_player.CurrentRoom;

            if (currentRoom != null)
            {
                currentRoom.SwitchTeamUnsafe(this.m_player);
            }
        }
Ejemplo n.º 10
0
 public RoomSetupChangeAction(BaseRoom room, GSPacketIn packet, eRoomType roomType, byte timeMode, eHardLevel hardLevel, int levelLimits, int mapId)
 {
     m_room        = room;
     m_roomType    = roomType;
     m_timeMode    = timeMode;
     m_hardLevel   = hardLevel;
     m_levelLimits = levelLimits;
     m_mapId       = mapId;
     m_packet      = packet;
 }
Ejemplo n.º 11
0
 public RoomSetupChangeAction(BaseRoom room, GSPacketIn packet, eRoomType roomType, byte timeMode, eHardLevel hardLevel, int levelLimits, int mapId)
 {
     m_room = room;
     m_roomType = roomType;
     m_timeMode = timeMode;
     m_hardLevel = hardLevel;
     m_levelLimits = levelLimits;
     m_mapId = mapId;
     m_packet = packet;
 }
Ejemplo n.º 12
0
 public RoomSetupChangeAction(BaseRoom room, GSPacketIn packet, eRoomType roomType, byte timeMode, eHardLevel hardLevel, int levelLimits, int mapId, bool isArea)
 {
     this.m_room        = room;
     this.m_roomType    = roomType;
     this.m_timeMode    = timeMode;
     this.m_hardLevel   = hardLevel;
     this.m_levelLimits = levelLimits;
     this.m_mapId       = mapId;
     this.m_packet      = packet;
     this.m_isArea      = isArea;
 }
Ejemplo n.º 13
0
 public static void ClearRooms(long tick)
 {
     BaseRoom[] rooms = RoomMgr.m_rooms;
     for (int i = 0; i < rooms.Length; i++)
     {
         BaseRoom baseRoom = rooms[i];
         if (baseRoom.IsUsing && baseRoom.PlayerCount == 0)
         {
             baseRoom.Stop();
         }
     }
 }
Ejemplo n.º 14
0
 public RoomSetupChangeAction(BaseRoom room, eRoomType roomType, byte timeMode, eHardLevel hardLevel, int levelLimits, int mapId, string password, string roomname, bool isCrosszone, bool isOpenBoss)
 {
     m_room = room;
     m_roomType = roomType;
     m_timeMode = timeMode;
     m_hardLevel = hardLevel;
     m_levelLimits = levelLimits;
     m_mapId = mapId;
     m_password = password;
     m_roomName = roomname;
     m_isCrosszone = isCrosszone;
     m_isOpenBoss = isOpenBoss;
 }
Ejemplo n.º 15
0
 public RoomSetupChangeAction(BaseRoom room, eRoomType roomType, byte timeMode, eHardLevel hardLevel, int levelLimits, int mapId, string password, string roomname, bool isCrosszone, bool isOpenBoss)
 {
     this.m_room        = room;
     this.m_roomType    = roomType;
     this.m_timeMode    = timeMode;
     this.m_hardLevel   = hardLevel;
     this.m_levelLimits = levelLimits;
     this.m_mapId       = mapId;
     this.m_password    = password;
     this.m_roomName    = roomname;
     this.m_isCrosszone = isCrosszone;
     this.m_isOpenBoss  = isOpenBoss;
 }
Ejemplo n.º 16
0
        public static bool Setup(int maxRoom)
        {
            maxRoom       = maxRoom < 1 ? 1 : maxRoom;
            m_thread      = new Thread(new ThreadStart(RoomThread));
            m_actionQueue = new Queue <IAction>();
            m_rooms       = new BaseRoom[maxRoom];
            for (int i = 0; i < maxRoom; i++)
            {
                m_rooms[i] = new BaseRoom(i + 1);
            }
            m_waitingRoom = new BaseWaitingRoom();

            return(true);
        }
Ejemplo n.º 17
0
        public static bool Setup(int maxRoom)
        {
            maxRoom = maxRoom < 1 ? 1 : maxRoom;
            m_thread = new Thread(new ThreadStart(RoomThread));
            m_actionQueue = new Queue<IAction>();
            m_rooms = new BaseRoom[maxRoom];
            for (int i = 0; i < maxRoom; i++)
            {
                m_rooms[i] = new BaseRoom(i + 1);
            }
            m_waitingRoom = new BaseWaitingRoom();

            return true;
        }
Ejemplo n.º 18
0
        public void Execute()
        {
            if (this.m_player.CurrentRoom != null)
            {
                this.m_player.CurrentRoom.RemovePlayerUnsafe(this.m_player);
            }
            if (this.m_player.IsActive)
            {
                BaseRoom[] rooms = RoomMgr.Rooms;
                BaseRoom   room  = null;
                for (int i = 0; i < rooms.Length; i++)
                {
                    if (!rooms[i].IsUsing)
                    {
                        room = rooms[i];
                        break;
                    }
                }
                if (room != null)
                {
                    RoomMgr.WaitingRoom.RemovePlayer(this.m_player);
                    room.Start();
                    if (this.m_roomType == eRoomType.Exploration)
                    {
                        room.HardLevel   = eHardLevel.Normal;
                        room.LevelLimits = (int)room.GetLevelLimit(this.m_player);
                    }
                    room.UpdateRoom(this.m_name, this.m_password, this.m_roomType, this.m_timeType, 0);

                    if (this.m_roomType == eRoomType.Match)
                    {
                        if (BattleMgr.IsOpenAreaFight)
                        {
                            room.IsArea = true;
                        }
                    }
                    GSPacketIn pkg = this.m_player.Out.SendRoomCreate(room);
                    room.AddPlayerUnsafe(this.m_player);
                    RoomMgr.WaitingRoom.SendUpdateRoom(room);
                }
                else
                {
                    Console.WriteLine(LanguageMgr.GetTranslation("CreateRoomAction.MaxRoom", new object[0]));
                    this.m_player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("CreateRoomAction.MaxRoom", new object[0]));
                }
            }
        }
Ejemplo n.º 19
0
        public void SendUpdateRoom(BaseRoom room)
        {
            GamePlayer[] players = GetPlayersSafe();
            GSPacketIn pkg = null;

            foreach (GamePlayer p in players)
            {
                if (pkg == null)
                {
                    pkg = p.Out.SendUpdateRoomList(room);
                }
                else
                {
                    p.Out.SendTCP(pkg);
                }
            }
        }
Ejemplo n.º 20
0
        public void SendUpdateRoom(BaseRoom room)
        {
            GamePlayer[] players = GetPlayersSafe();
            GSPacketIn   pkg     = null;

            foreach (GamePlayer p in players)
            {
                if (pkg == null)
                {
                    pkg = p.Out.SendUpdateRoomList(room);
                }
                else
                {
                    p.Out.SendTCP(pkg);
                }
            }
        }
Ejemplo n.º 21
0
        public void Execute()
        {
            if (m_player.CurrentRoom != null)
            {
                m_player.CurrentRoom.RemovePlayerUnsafe(m_player);
            }
            if (m_player.IsActive == false)
            {
                return;
            }
            BaseRoom[] rooms = RoomMgr.Rooms;

            BaseRoom room = null;

            for (int i = 0; i < rooms.Length; i++)
            {
                if (rooms[i].IsUsing == false)
                {
                    room = rooms[i];
                    break;
                }
            }

            if (room != null)
            {
                RoomMgr.WaitingRoom.RemovePlayer(m_player);


                room.Start();
                //探险默认使用普通难度等级
                if (m_roomType == eRoomType.Exploration)
                {
                    room.HardLevel   = eHardLevel.Normal;
                    room.LevelLimits = (int)room.GetLevelLimit(m_player);
                }

                room.UpdateRoom(m_name, m_password, m_roomType, m_timeType, 0);


                GSPacketIn pkg = m_player.Out.SendRoomCreate(room);
                room.AddPlayerUnsafe(m_player);
                RoomMgr.WaitingRoom.SendUpdateRoom(room);
            }
        }
Ejemplo n.º 22
0
        public void Execute()
        {
            if (m_player.CurrentRoom != null)
            {
                m_player.CurrentRoom.RemovePlayer(m_player);
            }

            BaseRoom[] rooms = RoomMgr.Rooms;
            BaseRoom   rm    = null;

            if (m_roomId == -1)
            {
                return;
            }
            else
            {
                rm = rooms[m_roomId - 1];
            }

            if (rm.NeedPassword == false || rm.Password == m_pwd)
            {
                RoomMgr.WaitingRoom.RemovePlayer(m_player);

                m_player.Out.SendRoomLoginResult(true);
                m_player.Out.SendRoomCreate(rm);

                if (rm.Game != null && rm.Game is PVEGame)
                {
                    PVEGame pve = rm.Game as PVEGame;
                    Player  fp  = new Player(m_player, pve.PhysicalId++, pve, 1);
                    pve.AddPlayer(m_player, fp);
                }

                rm.AddPlayer(m_player);

                RoomMgr.WaitingRoom.SendUpdateRoom(rm);
            }
            else
            {
                m_player.Out.SendMessage(eMessageType.ERROR, "房间密码错误");
                m_player.Out.SendRoomLoginResult(false);
            }
        }
Ejemplo n.º 23
0
        public bool AddRoom(Game.Server.Rooms.BaseRoom room)
        {
            bool result = false;

            lock (m_rooms)
            {
                if (!m_rooms.ContainsKey(room.RoomId))
                {
                    m_rooms.Add(room.RoomId, room);
                    result = true;
                }
            }

            if (result)
            {
                m_server.SendAddRoom(room);
            }
            return(result);
        }
Ejemplo n.º 24
0
        public void Execute()
        {
            if (this.m_player.CurrentRoom != null)
            {
                this.m_player.CurrentRoom.RemovePlayerUnsafe(this.m_player);
            }
            if (!this.m_player.IsActive)
            {
                return;
            }
            BaseRoom[] rooms    = RoomMgr.Rooms;
            BaseRoom   baseRoom = null;

            for (int i = 0; i < rooms.Length; i++)
            {
                if (!rooms[i].IsUsing)
                {
                    baseRoom = rooms[i];
                    break;
                }
            }
            if (baseRoom != null)
            {
                RoomMgr.WaitingRoom.RemovePlayer(this.m_player);
                baseRoom.Start();
                if (this.m_roomType == eRoomType.Dungeon)
                {
                    baseRoom.HardLevel   = eHardLevel.Normal;
                    baseRoom.LevelLimits = (int)baseRoom.GetLevelLimit(this.m_player);
                }
                baseRoom.UpdateRoom(this.m_name, this.m_password, this.m_roomType, this.m_timeType, 0);
                this.m_player.Out.SendRoomCreate(baseRoom);
                baseRoom.AddPlayerUnsafe(this.m_player);
                RoomMgr.WaitingRoom.SendUpdateRoom(baseRoom);
            }
        }
Ejemplo n.º 25
0
        public static List <BaseRoom> GetAllUsingRoom()
        {
            List <BaseRoom> list = new List <BaseRoom>();

            BaseRoom[] rooms;
            Monitor.Enter(rooms = RoomMgr.m_rooms);
            try
            {
                BaseRoom[] rooms2 = RoomMgr.m_rooms;
                for (int i = 0; i < rooms2.Length; i++)
                {
                    BaseRoom room = rooms2[i];
                    if (room.IsUsing)
                    {
                        list.Add(room);
                    }
                }
            }
            finally
            {
                Monitor.Exit(rooms);
            }
            return(list);
        }
Ejemplo n.º 26
0
 public static void CancelPickup(BattleServer server, BaseRoom room)
 {
     AddAction(new CancelPickupAction(server, room));
 }
Ejemplo n.º 27
0
 public GSPacketIn SendRoomChange(Game.Server.Rooms.BaseRoom room)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 28
0
 public GSPacketIn SendRoomPairUpCancel(Game.Server.Rooms.BaseRoom room)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 29
0
 public static void UpdateRoomGameType(BaseRoom room, eRoomType roomType, byte timeMode, eHardLevel hardLevel, int levelLimits, int mapId, string password, string roomname, bool isCrosszone, bool isOpenBoss)
 {
     AddAction(new RoomSetupChangeAction(room, roomType, timeMode, hardLevel, levelLimits, mapId, password, roomname, isCrosszone, isOpenBoss));
 }
Ejemplo n.º 30
0
 public GSPacketIn SendRoomPairUpCancel(BaseRoom room)
 {
     GSPacketIn pkg = new GSPacketIn((byte)ePackageType.GAME_PAIRUP_CANCEL);
     SendTCP(pkg);
     return pkg;
 }
Ejemplo n.º 31
0
 public GSPacketIn SendRoomChange(BaseRoom room)
 {
     GSPacketIn pkg = new GSPacketIn((byte)ePackageType.GAME_ROOM_SETUP_CHANGE);
     pkg.WriteInt(room.MapId);
     pkg.WriteByte((byte)room.RoomType);
     pkg.WriteByte((byte)room.TimeMode);
     pkg.WriteByte((byte)room.HardLevel);
     pkg.WriteInt(room.LevelLimits);
     pkg.WriteBoolean(false);
     SendTCP(pkg);
     return pkg;
 }
Ejemplo n.º 32
0
 public void SendUpdateRoom(BaseRoom room)
 {
 }
Ejemplo n.º 33
0
        public GSPacketIn SendGameRoomInfo(GamePlayer player, BaseRoom game)
        {
            GSPacketIn pkg = new GSPacketIn((byte)ePackageType.GAME_ROOM_CREATE, player.PlayerCharacter.ID);

            //pkg.WriteInt(game.ID);
            //pkg.WriteByte((byte)game.RoomType);
            //pkg.WriteByte(game.ScanTime);
            //pkg.WriteByte((byte)game.Count);
            //pkg.WriteByte((byte)(game.OpenState.Length - game.CloseTotal()));
            //pkg.WriteBoolean(game.Pwd != "" ? true : false);
            //pkg.WriteInt(game.MapIndex);
            //pkg.WriteBoolean(game.GameState == eGameState.FREE ? false : true);
            //pkg.WriteByte((byte)game.GameMode);
            //pkg.WriteString(game.Name);
            //pkg.WriteByte((byte)game.GameClass);
            //SendTCP(pkg);
            return pkg;
        }
Ejemplo n.º 34
0
 public StartGameAction(BaseRoom room)
 {
     m_room = room;
 }
Ejemplo n.º 35
0
 public CancelPickupAction(BattleServer server,BaseRoom room)
 {
     m_room = room;
     m_server = server;
 }
Ejemplo n.º 36
0
 public void SendChangeGameType(BaseRoom room)
 {
     GSPacketIn pkg = new GSPacketIn((byte)eFightPackageType.CHANGE_GAME_TYPE)
     {
         Parameter1 = room.RoomId
     };
     pkg.WriteInt((int)room.GameType);
     SendTCP(pkg);
 }
Ejemplo n.º 37
0
        public void Execute()
        {
            if (m_player.IsActive == false)
            {
                return;
            }

            if (m_player.CurrentRoom != null)
            {
                m_player.CurrentRoom.RemovePlayerUnsafe(m_player);
            }

            BaseRoom[] rooms = RoomMgr.Rooms;
            BaseRoom   rm    = null;

            if (m_roomId == -1)
            {
                rm = FindRandomRoom(rooms);
                if (rm == null)
                {
                    m_player.Out.SendMessage(eMessageType.ERROR, "暂时没有合适的房间,请稍后重试!");
                    m_player.Out.SendRoomLoginResult(false);
                    return;
                }
            }
            else
            {
                rm = rooms[m_roomId - 1];
            }
            if (!rm.IsUsing)
            {
                m_player.Out.SendMessage(eMessageType.Normal, "房间不存在!");
                return;
            }

            if (rm.PlayerCount == rm.PlacesCount)
            {
                m_player.Out.SendMessage(eMessageType.ERROR, "房间人数已满!");
            }
            else
            {
                if (rm.NeedPassword == false || rm.Password == m_pwd)
                {
                    if (rm.Game == null || rm.Game.CanAddPlayer())
                    {
                        if (rm.RoomType == eRoomType.Exploration && rm.LevelLimits > (int)rm.GetLevelLimit(m_player))
                        {
                            m_player.Out.SendMessage(eMessageType.ERROR, "您的等级和该房间要求等级不符!");
                            return;
                        }

                        RoomMgr.WaitingRoom.RemovePlayer(m_player);
                        m_player.Out.SendRoomLoginResult(true);
                        m_player.Out.SendRoomCreate(rm);

                        if (rm.AddPlayerUnsafe(m_player))
                        {
                            if (rm.Game != null)
                            {
                                rm.Game.AddPlayer(m_player);
                            }
                        }

                        RoomMgr.WaitingRoom.SendUpdateRoom(rm);
                        m_player.Out.SendRoomChange(rm);
                    }
                }
                else
                {
                    m_player.Out.SendMessage(eMessageType.ERROR, "房间密码错误");
                    m_player.Out.SendRoomLoginResult(false);
                }
            }
        }
Ejemplo n.º 38
0
 public ExitRoomAction(BaseRoom room, GamePlayer player)
 {
     this.m_room   = room;
     this.m_player = player;
 }
Ejemplo n.º 39
0
 public StartProxyGameAction(BaseRoom room,ProxyGame game)
 {
     m_room = room;
     m_game = game;
 }
Ejemplo n.º 40
0
 public CancelPickupAction(BattleServer server, BaseRoom room)
 {
     this.m_room   = room;
     this.m_server = server;
 }
Ejemplo n.º 41
0
 public GSPacketIn SendRoomCreate(BaseRoom room)
 {
     GSPacketIn pkg = new GSPacketIn((byte)ePackageType.GAME_ROOM_CREATE);
     pkg.WriteInt(room.RoomId);
     pkg.WriteByte((byte)room.RoomType);
     pkg.WriteByte((byte)room.HardLevel);
     pkg.WriteByte((byte)room.TimeMode);
     pkg.WriteByte((byte)room.PlayerCount);
     pkg.WriteByte((byte)room.PlacesCount);
     pkg.WriteBoolean(string.IsNullOrEmpty(room.Password) ? false : true);
     pkg.WriteInt(room.MapId);
     pkg.WriteBoolean(room.IsPlaying);
     pkg.WriteString(room.Name);
     pkg.WriteByte((byte)room.GameType);
     pkg.WriteInt(room.LevelLimits);
     pkg.WriteBoolean(false);
     SendTCP(pkg);
     return pkg;
 }
Ejemplo n.º 42
0
 public void SendRoomSetupChange(BaseRoom room)
 {
     if (m_host != null)
     {
         GSPacketIn pkg = m_host.Out.SendRoomChange(room);
         SendToAll(pkg);
     }
 }
Ejemplo n.º 43
0
        public GSPacketIn SendRoomType(GamePlayer player, BaseRoom game)
        {
            GSPacketIn pkg = new GSPacketIn((byte)ePackageType.GAME_PAIRUP_ROOM_SETUP);
            pkg.WriteByte((byte)game.GameStyle);
            pkg.WriteInt((int)game.GameType);

            SendTCP(pkg);
            return pkg;
        }
Ejemplo n.º 44
0
 public static void KickPlayer(BaseRoom baseRoom, byte index)
 {
     AddAction(new KickPlayerAction(baseRoom, index));
 }
Ejemplo n.º 45
0
 public GSPacketIn SendRoomClear(GamePlayer player, BaseRoom game)
 {
     GSPacketIn pkg = new GSPacketIn((byte)ePackageType.GAME_ROOM_CLEAR, player.PlayerCharacter.ID);
     pkg.WriteInt(game.RoomId);
     SendTCP(pkg);
     return pkg;
 }
Ejemplo n.º 46
0
 public static void StartProxyGame(BaseRoom room, ProxyGame game)
 {
     AddAction(new StartProxyGameAction(room, game));
 }
Ejemplo n.º 47
0
 public static void ExitRoom(BaseRoom room, GamePlayer player)
 {
     AddAction(new ExitRoomAction(room, player));
 }
Ejemplo n.º 48
0
 public KickPlayerAction(BaseRoom room, int place)
 {
     m_room = room;
     m_place = place;
 }
Ejemplo n.º 49
0
 public static void StartGameMission(BaseRoom room)
 {
     AddAction(new StartGameMissionAction(room));
 }
Ejemplo n.º 50
0
        public bool RemoveRoom(BaseRoom room)
        {
            bool result = false;

            lock (m_rooms)
            {
                result = m_rooms.ContainsKey(room.RoomId);
            }

            if (result)
            {
                m_server.SendRemoveRoom(room);
            }

            return result;
        }
Ejemplo n.º 51
0
 public static void StopProxyGame(BaseRoom room)
 {
     AddAction(new StopProxyGameAction(room));
 }
Ejemplo n.º 52
0
 public StartGameAction(BaseRoom room)
 {
     m_room = room;
 }
Ejemplo n.º 53
0
 public static void UpdateRoomPos(BaseRoom room, int pos, bool isOpened, int place, int placeView)
 {
     AddAction(new UpdateRoomPosAction(room, pos, isOpened, place, placeView));
 }
Ejemplo n.º 54
0
        public void Execute()
        {
            if (m_player.IsActive == false)
            {
                return;
            }

            if (m_player.CurrentRoom != null)
            {
                m_player.CurrentRoom.RemovePlayerUnsafe(m_player);
            }

            BaseRoom[] rooms = RoomMgr.Rooms;
            BaseRoom   rm    = null;

            if (m_roomId == -1)
            {
                rm = FindRandomRoom(rooms);
                if (rm == null)
                {
                    m_player.Out.SendMessage(eMessageType.ERROR, "Không có phòng game nào!");
                    m_player.Out.SendRoomLoginResult(false);
                    return;
                }
            }
            else
            {
                rm = rooms[m_roomId - 1];
            }
            if (!rm.IsUsing)
            {
                m_player.Out.SendMessage(eMessageType.Normal, "Phòng đang sử dụng!");
                return;
            }

            if (rm.PlayerCount == rm.PlacesCount)
            {
                m_player.Out.SendMessage(eMessageType.ERROR, "Phòng đã đấy!");
            }
            else
            {
                if (rm.NeedPassword == false || rm.Password == m_pwd)
                {
                    if (rm.Game == null || rm.Game.CanAddPlayer())
                    {
                        if (rm.LevelLimits > (int)rm.GetLevelLimit(m_player))
                        {
                            m_player.Out.SendMessage(eMessageType.ERROR, "Level chưa đủ!");
                            return;
                        }

                        RoomMgr.WaitingRoom.RemovePlayer(m_player);
                        m_player.Out.SendRoomLoginResult(true);
                        m_player.Out.SendRoomCreate(rm);

                        if (rm.AddPlayerUnsafe(m_player))
                        {
                            if (rm.Game != null)
                            {
                                rm.Game.AddPlayer(m_player);
                            }
                        }

                        RoomMgr.WaitingRoom.SendUpdateRoom(rm);
                        m_player.Out.SendRoomChange(rm);
                    }
                }
                else
                {
                    m_player.Out.SendMessage(eMessageType.ERROR, "Password không đúng!");
                    m_player.Out.SendRoomLoginResult(false);
                }
            }
        }
Ejemplo n.º 55
0
        internal void SendRemoveRoom(Game.Server.Rooms.BaseRoom room)
        {
            GSPacketIn pkg = new GSPacketIn((int)eFightPackageType.GAME_PAIRUP_CANCEL);

            SendTCP(pkg, room);
        }
Ejemplo n.º 56
0
 public GSPacketIn SendRoomType(Game.Server.GameObjects.GamePlayer player, Game.Server.Rooms.BaseRoom game)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 57
0
 public KickPlayerAction(BaseRoom room, int place)
 {
     this.m_room  = room;
     this.m_place = place;
 }
Ejemplo n.º 58
0
 public UpdateRoomPosAction(BaseRoom room, int pos,bool isOpened)
 {
     m_room = room;
     m_pos = pos;
     m_isOpened = isOpened;
 }
Ejemplo n.º 59
0
 public void SendRemoveRoom(BaseRoom room)
 {
     GSPacketIn pkg = new GSPacketIn((int)eFightPackageType.ROOM_REMOVE);
     pkg.Parameter1 = room.RoomId;
     SendTCP(pkg);
 }
Ejemplo n.º 60
0
 public UpdatePlayerStateAction(GamePlayer player, BaseRoom room, byte state)
 {
     m_player = player;
     m_state  = state;
     m_room   = room;
 }