예제 #1
0
        public static BaseGame StartPVEGame(int roomId, List<IGamePlayer> players, int copyId, eRoomType roomType, eGameType gameType, int timeType, eHardLevel hardLevel, int levelLimits)
        {
            try
            {
                PveInfo info = null;

                if (copyId == 0)
                {
                    info = PveInfoMgr.GetPveInfoByType(roomType, levelLimits);
                }
                else
                {
                    info = PveInfoMgr.GetPveInfoById(copyId);
                }
                if (info != null)
                {
                    PVEGame game = new PVEGame(m_gameId++, roomId, info, players, null, roomType, gameType, timeType, hardLevel);
                    game.GameOverLog += new BaseGame.GameOverLogEventHandle(LogMgr.LogFightAdd);
                    lock (m_games)
                    {
                        m_games.Add(game);
                    }

                    game.Prepare();
                    return game;
                }
                else
                {
                    return null;
                }
            }
            catch (Exception e)
            {
                log.Error("Create game error:", e);
                return null;
            }
        }
예제 #2
0
 public void SendPlayerInfoInGame(PVEGame game, IGamePlayer gp, Player p)
 {
     GSPacketIn pkg = new GSPacketIn((byte)ePackageType.GAME_CMD);
     pkg.WriteByte((byte)eTankCmdType.PLAY_INFO_IN_GAME);
     pkg.WriteInt(gp.PlayerCharacter.ID);
     //zoneid
     pkg.WriteInt(4);
     pkg.WriteInt(p.Team);
     pkg.WriteInt(p.Id);
     pkg.WriteInt(p.MaxBlood);
     pkg.WriteBoolean(p.Ready);
     game.SendToAll(pkg);
 }
예제 #3
0
        private void SendCreateGameToSingle(PVEGame game, IGamePlayer gamePlayer)
        {
            GSPacketIn pkg = new GSPacketIn((byte)ePackageType.GAME_CMD);
            pkg.WriteByte((byte)eTankCmdType.GAME_ROOM_INFO);
            pkg.WriteInt(game.Map.Info.ID);
            pkg.WriteInt((byte)game.RoomType);
            pkg.WriteInt((byte)game.GameType);
            pkg.WriteInt(game.TimeType);
            List<Player> players = game.GetAllFightPlayers();
            pkg.WriteInt(players.Count);
            foreach (Player p in players)
            {
                IGamePlayer gp = p.PlayerDetail;
                pkg.WriteInt(gp.PlayerCharacter.ID);
                //zoneid
                //pkg.WriteInt(4);
                pkg.WriteString(gp.PlayerCharacter.NickName);
                //isvip
                pkg.WriteBoolean(true);
                pkg.WriteInt(5);
                pkg.WriteBoolean(gp.PlayerCharacter.Sex);
                pkg.WriteInt(gp.PlayerCharacter.Hide);
                pkg.WriteString(gp.PlayerCharacter.Style);
                pkg.WriteString(gp.PlayerCharacter.Colors);
                pkg.WriteString(gp.PlayerCharacter.Skin);
                pkg.WriteInt(gp.PlayerCharacter.Grade);
                pkg.WriteInt(gp.PlayerCharacter.Repute);
                if (gp.MainWeapon == null)
                {
                    pkg.WriteInt(0);
                }
                else
                {
                    pkg.WriteInt(gp.MainWeapon.TemplateID);
                    pkg.WriteInt(0);
                    pkg.WriteString("");
                    pkg.WriteDateTime(DateTime.MinValue);
                }
                pkg.WriteInt(0);
                pkg.WriteInt(gp.PlayerCharacter.ConsortiaID);
                pkg.WriteString(gp.PlayerCharacter.ConsortiaName);
                pkg.WriteInt(gp.PlayerCharacter.ConsortiaLevel);
                pkg.WriteInt(gp.PlayerCharacter.ConsortiaRepute);

                pkg.WriteInt(p.Team);
                pkg.WriteInt(p.Id);
                pkg.WriteInt(p.MaxBlood);
                pkg.WriteBoolean(p.Ready);
            }

            MissionInfo missionInfo = game.Misssions[game.SessionId - 1];
            pkg.WriteString(missionInfo.Name);
            pkg.WriteString(missionInfo.Name);
            pkg.WriteString(missionInfo.Success);
            pkg.WriteString(missionInfo.Failure);
            pkg.WriteString(missionInfo.Description);
            pkg.WriteInt(game.TotalMissionCount);
            pkg.WriteInt(game.SessionId - 1);
            gamePlayer.SendTCP(pkg);
        }
예제 #4
0
        public static BaseGame StartPVEGame(List<IGamePlayer> player, int mapIndex, eRoomType roomType, eTeamType teamType, eGameType gameType, int timeType)
        {
            try
            {
                int index = MapMgr.GetMapIndex(mapIndex, (byte)roomType, m_serverId);
                index = 1072;
                Map map = MapMgr.CloneMap(index);

                if (map != null)
                {
                    PVEGame game = new PVEGame(m_gameId ++,player, map, roomType, teamType, gameType, timeType);

                    lock (m_games)
                    {
                        m_games.Add(game);
                    }

                    game.Prepare();
                    return game;
                }
                else
                {
                    return null;
                }
            }
            catch (Exception e)
            {
                log.Error("Create game error:", e);
                return null;
            }
        }
예제 #5
0
 private void SendCreateGameToSingle(PVEGame game, IGamePlayer gamePlayer)
 {
     GSPacketIn pkg = new GSPacketIn((byte)ePackageType.GAME_CMD);
     pkg.WriteByte((byte)eTankCmdType.GAME_ROOM_INFO);
     pkg.WriteInt(game.Map.Info.ID);
     pkg.WriteInt((byte)game.RoomType);
     pkg.WriteInt((byte)game.GameType);
     pkg.WriteInt(game.TimeType);
     List<Player> players = game.GetAllFightPlayers();
     pkg.WriteInt(players.Count);
     foreach (Player p in players)
     {
         IGamePlayer gp = p.PlayerDetail;
         pkg.WriteInt(gp.PlayerCharacter.ID);
         pkg.WriteString(gp.PlayerCharacter.NickName);
         pkg.WriteBoolean(false);//_loc_10 = _loc_2.readBoolean();
         pkg.WriteByte(gp.PlayerCharacter.typeVIP);
         pkg.WriteInt(gp.PlayerCharacter.VIPLevel);
         pkg.WriteBoolean(gp.PlayerCharacter.Sex);
         pkg.WriteInt(gp.PlayerCharacter.Hide);
         pkg.WriteString(gp.PlayerCharacter.Style);
         pkg.WriteString(gp.PlayerCharacter.Colors);
         pkg.WriteString(gp.PlayerCharacter.Skin);
         pkg.WriteInt(gp.PlayerCharacter.Grade);
         pkg.WriteInt(gp.PlayerCharacter.Repute);
         if (gp.MainWeapon == null)
         {
             pkg.WriteInt(0);
         }
         else
         {
             pkg.WriteInt(gp.MainWeapon.TemplateID);
             pkg.WriteInt(gp.MainWeapon.RefineryLevel);
             pkg.WriteString(gp.MainWeapon.Name);
             pkg.WriteDateTime(DateTime.MinValue);
         }
         if (gp.SecondWeapon == null)
         {
             pkg.WriteInt(0);
         }
         else
         {
             pkg.WriteInt(gp.SecondWeapon.TemplateID);
         }
         pkg.WriteInt(gp.PlayerCharacter.ConsortiaID);
         pkg.WriteString(gp.PlayerCharacter.ConsortiaName);
         pkg.WriteInt(0);//_loc_8.badgeID = _loc_2.readInt();
         pkg.WriteInt(0);//_loc_14 = _loc_2.readInt();
         pkg.WriteInt(0);//_loc_15 = _loc_2.readInt();
         pkg.WriteBoolean(false);//_loc_8.DailyLeagueFirst = _loc_2.readBoolean();
         pkg.WriteInt(0);//_loc_8.DailyLeagueLastScore = _loc_2.readInt();
         pkg.WriteInt(p.Team);
         pkg.WriteInt(p.Id);
         pkg.WriteInt(p.MaxBlood);
         pkg.WriteBoolean(p.Ready);
     }
     int index = game.SessionId - 1;
     MissionInfo missionInfo = game.Misssions[index];
     pkg.WriteString(missionInfo.Name);
     pkg.WriteString(missionInfo.Name);
     pkg.WriteString(missionInfo.Success);
     pkg.WriteString(missionInfo.Failure);
     pkg.WriteString(missionInfo.Description);
     pkg.WriteInt(game.TotalMissionCount);
     pkg.WriteInt(index);
     gamePlayer.SendTCP(pkg);
 }
예제 #6
0
 private void SendCreateGameToSingle(PVEGame game, IGamePlayer gamePlayer)
 {
     GSPacketIn pkg = new GSPacketIn((byte)ePackageType.GAME_CMD);
     pkg.WriteByte((byte)eTankCmdType.GAME_ROOM_INFO);
     pkg.WriteInt(game.Map.Info.ID);
     pkg.WriteInt((byte)game.RoomType);
     pkg.WriteInt((byte)game.GameType);
     pkg.WriteInt(game.TimeType);
     List<Player> players = game.GetAllFightPlayers();
     pkg.WriteInt(players.Count);
     foreach (Player p in players)
     {
         IGamePlayer gp = p.PlayerDetail;
         pkg.WriteInt(gp.PlayerCharacter.ID);
         pkg.WriteString(gp.PlayerCharacter.NickName);
         pkg.WriteBoolean(false);//_loc_10 = _loc_2.readBoolean();
         pkg.WriteByte(gp.PlayerCharacter.typeVIP);
         pkg.WriteInt(gp.PlayerCharacter.VIPLevel);
         pkg.WriteBoolean(gp.PlayerCharacter.Sex);
         pkg.WriteInt(gp.PlayerCharacter.Hide);
         pkg.WriteString(gp.PlayerCharacter.Style);
         pkg.WriteString(gp.PlayerCharacter.Colors);
         pkg.WriteString(gp.PlayerCharacter.Skin);
         pkg.WriteInt(gp.PlayerCharacter.Grade);
         pkg.WriteInt(gp.PlayerCharacter.Repute);
         if (gp.MainWeapon == null)
         {
             pkg.WriteInt(0);
         }
         else
         {
             pkg.WriteInt(gp.MainWeapon.TemplateID);
             pkg.WriteInt(gp.MainWeapon.RefineryLevel);
             pkg.WriteString(gp.MainWeapon.Name);
             pkg.WriteDateTime(DateTime.MinValue);
         }
         if (gp.SecondWeapon == null)
         {
             pkg.WriteInt(0);
         }
         else
         {
             pkg.WriteInt(gp.SecondWeapon.TemplateID);
         }
         pkg.WriteInt(gp.PlayerCharacter.ConsortiaID);
         pkg.WriteString(gp.PlayerCharacter.ConsortiaName);
         pkg.WriteInt(0);//_loc_8.badgeID = _loc_2.readInt();
         pkg.WriteInt(0);//_loc_14 = _loc_2.readInt();
         pkg.WriteInt(0);//_loc_15 = _loc_2.readInt();
         pkg.WriteBoolean(false);//_loc_8.DailyLeagueFirst = _loc_2.readBoolean();
         pkg.WriteInt(0);//_loc_8.DailyLeagueLastScore = _loc_2.readInt();
         pkg.WriteInt(p.Team);
         pkg.WriteInt(p.Id);
         pkg.WriteInt(p.MaxBlood);
         pkg.WriteBoolean(p.Ready);
     }
     int index = game.SessionId - 1;
     /*
     if ((index == 0) || (index > Missions.Count))
     {
         StringBuilder sb = new StringBuilder();
         foreach (MissionInfo mi in Missions.Values)
         {
             sb.Append(mi.Id).Append(",");
         }
         log.Error(string.Format("PVEGame.SendCreateGameToSingle KeyNotFoundException, game.SessionId : {0}, index : {1}, Missions.Ids : {2}, Missions.Count : {3}", new object[] { game.SessionId, index, sb.ToString(), this.Missions.Count }));
         if (index == 0)
         {
             index = 1;
         }
         if (index == Missions.Count)
         {
             index = Missions.Count;
         }
     }
     */
     MissionInfo missionInfo = game.Misssions[index];
     pkg.WriteString(missionInfo.Name);
     pkg.WriteString(missionInfo.Name);
     pkg.WriteString(missionInfo.Success);
     pkg.WriteString(missionInfo.Failure);
     pkg.WriteString(missionInfo.Description);
     pkg.WriteInt(game.TotalMissionCount);
     pkg.WriteInt(index);
     gamePlayer.SendTCP(pkg);
 }