Esempio n. 1
0
 /// <summary>
 /// 删除一个场景
 /// </summary>
 public static void RemoveFreshPlayerListCopyMap(int nID, CopyMap mapInfo)
 {
     lock (m_FreshPlayerListCopyMaps)
     {
         m_FreshPlayerListCopyMaps.Remove(nID);
     }
 }
Esempio n. 2
0
        /// <summary>
        // 刷城门
        /// </summary>
        public static void CreateGateMonster(CopyMap copyMapInfo)
        {
            int monsterID = Data.FreshPlayerSceneInfo.GateID;

            string[] sfields = Data.FreshPlayerSceneInfo.GatePos.Split(',');

            int nPosX = Global.SafeConvertToInt32(sfields[0]);
            int nPosY = Global.SafeConvertToInt32(sfields[1]);

            GameMap gameMap = null;

            if (!GameManager.MapMgr.DictMaps.TryGetValue(copyMapInfo.MapCode, out gameMap))
            {
                return;
            }

            int gridX = gameMap.CorrectWidthPointToGridPoint(nPosX) / gameMap.MapGridWidth;
            int gridY = gameMap.CorrectHeightPointToGridPoint(nPosY) / gameMap.MapGridHeight;

            GameManager.MonsterZoneMgr.AddDynamicMonsters(copyMapInfo.MapCode, monsterID, copyMapInfo.CopyMapID, 1, gridX, gridY, 0);

            copyMapInfo.FreshPlayerCreateGateFlag = 1;

            return;
        }
Esempio n. 3
0
 private void UpdateKuaFuMapClientCount(KarenBattleScene scene)
 {
     if (null != scene)
     {
         CopyMap copyMap = scene.CopyMap;
         if (null != copyMap)
         {
             KarenBattleSceneInfo sceneItem          = this.SceneDataDict.Values.FirstOrDefault <KarenBattleSceneInfo>();
             List <int>           mapClientCountList = new List <int>(new int[sceneItem.MaxLegions]);
             List <GameClient>    objsList           = copyMap.GetClientsList();
             if (objsList != null && objsList.Count > 0)
             {
                 for (int i = 0; i < objsList.Count; i++)
                 {
                     GameClient c = objsList[i];
                     if (c != null)
                     {
                         int side = c.ClientData.BattleWhichSide;
                         if (side > 0 && side < mapClientCountList.Count)
                         {
                             List <int> list;
                             int        index;
                             (list = mapClientCountList)[index = side - 1] = list[index] + 1;
                         }
                     }
                 }
             }
             JunTuanClient.getInstance().UpdateKuaFuMapClientCount(scene.GameId, mapClientCountList);
         }
     }
 }
Esempio n. 4
0
        public static Dictionary <int, CopyMap> m_FreshPlayerListCopyMaps = new Dictionary <int, CopyMap>(); // key: 副本流水ID 即DB生成  Value: CopyMap信息

        /// <summary>
        /// 添加一个场景
        /// </summary>
        public static void AddFreshPlayerListCopyMap(int nID, CopyMap mapInfo)
        {
            lock (m_FreshPlayerListCopyMaps)
            {
                m_FreshPlayerListCopyMaps.Add(nID, mapInfo);
            }
        }
 public static void RemoveFreshPlayerListCopyMap(int nID, CopyMap mapInfo)
 {
     lock (FreshPlayerCopySceneManager.m_FreshPlayerListCopyMaps)
     {
         FreshPlayerCopySceneManager.m_FreshPlayerListCopyMaps.Remove(nID);
     }
 }
        public static void HeartBeatFreshPlayerCopyMap()
        {
            long nowTicks = TimeUtil.NOW();

            if (nowTicks - FreshPlayerCopySceneManager.LastHeartBeatTicks >= 1000L)
            {
                FreshPlayerCopySceneManager.LastHeartBeatTicks = nowTicks;
                List <CopyMap> CopyMapList = new List <CopyMap>();
                lock (FreshPlayerCopySceneManager.m_FreshPlayerListCopyMaps)
                {
                    CopyMap copyMap = null;
                    foreach (CopyMap item in FreshPlayerCopySceneManager.m_FreshPlayerListCopyMaps.Values)
                    {
                        copyMap = item;
                        if (item.FreshPlayerCreateGateFlag == 0)
                        {
                            FreshPlayerCopySceneManager.CreateGateMonster(item);
                        }
                        List <GameClient> clientsList = item.GetClientsList();
                        if (clientsList != null && clientsList.Count <= 0)
                        {
                            CopyMapList.Add(item);
                        }
                    }
                    if (null != copyMap)
                    {
                        GameManager.MonsterZoneMgr.ReloadCopyMapMonsters(copyMap.MapCode, -1);
                    }
                }
                for (int i = 0; i < CopyMapList.Count; i++)
                {
                    GameManager.CopyMapMgr.ProcessRemoveCopyMap(CopyMapList[i]);
                }
            }
        }
 public static void AddFreshPlayerListCopyMap(int nID, CopyMap mapInfo)
 {
     lock (FreshPlayerCopySceneManager.m_FreshPlayerListCopyMaps)
     {
         FreshPlayerCopySceneManager.m_FreshPlayerListCopyMaps.Add(nID, mapInfo);
     }
 }
        public static void RemoveExperienceListCopyMap(int nID)
        {
            bool bRemve = false;

            lock (ExperienceCopySceneManager.m_ExperienceListCopyMaps)
            {
                CopyMap tmp = null;
                if (ExperienceCopySceneManager.m_ExperienceListCopyMaps.TryGetValue(nID, out tmp))
                {
                    ExperienceCopySceneManager.m_ExperienceListCopyMaps.Remove(nID);
                    bRemve = true;
                }
            }
            lock (ExperienceCopySceneManager.m_ExperienceListCopyMapsInfo)
            {
                if (bRemve)
                {
                    ExperienceCopyScene ExperienceSceneInfo = null;
                    if (ExperienceCopySceneManager.m_ExperienceListCopyMapsInfo.TryGetValue(nID, out ExperienceSceneInfo))
                    {
                        ExperienceCopySceneManager.m_ExperienceListCopyMapsInfo.Remove(nID);
                    }
                }
            }
        }
Esempio n. 9
0
        public static void AddGlodCopySceneList(int nID, CopyMap mapInfo)
        {
            bool bInsert = false;

            lock (GlodCopySceneManager.m_GlodCopySceneLists)
            {
                CopyMap tmp = null;
                if (!GlodCopySceneManager.m_GlodCopySceneLists.TryGetValue(nID, out tmp))
                {
                    GlodCopySceneManager.m_GlodCopySceneLists.Add(nID, mapInfo);
                    bInsert = true;
                }
                else if (tmp == null)
                {
                    GlodCopySceneManager.m_GlodCopySceneLists[nID] = mapInfo;
                    bInsert = true;
                }
                lock (GlodCopySceneManager.m_GlodCopySceneInfo)
                {
                    if (bInsert)
                    {
                        GoldCopyScene GoldCopySceneInfo = null;
                        if (!GlodCopySceneManager.m_GlodCopySceneInfo.TryGetValue(nID, out GoldCopySceneInfo))
                        {
                            GoldCopySceneInfo = new GoldCopyScene();
                            GoldCopySceneInfo.InitInfo(mapInfo.MapCode, mapInfo.CopyMapID, nID);
                            GoldCopySceneInfo.m_StartTimer = TimeUtil.NOW();
                            GlodCopySceneManager.m_GlodCopySceneInfo.Add(nID, GoldCopySceneInfo);
                        }
                    }
                }
            }
        }
Esempio n. 10
0
        public static bool EnterGoldCopySceneWhenLogin(GameClient client, bool bContinue = true)
        {
            bool result;

            if (client != null)
            {
                CopyMap       tmp = null;
                GoldCopyScene GoldCopySceneInfo = null;
                lock (GlodCopySceneManager.m_GlodCopySceneLists)
                {
                    if (!GlodCopySceneManager.m_GlodCopySceneLists.TryGetValue(client.ClientData.FuBenSeqID, out tmp) || tmp == null)
                    {
                        return(false);
                    }
                }
                lock (GlodCopySceneManager.m_GlodCopySceneInfo)
                {
                    if (!GlodCopySceneManager.m_GlodCopySceneInfo.TryGetValue(client.ClientData.FuBenSeqID, out GoldCopySceneInfo) || GoldCopySceneInfo == null)
                    {
                        return(false);
                    }
                }
                long ticks = TimeUtil.NOW();
                GoldCopySceneInfo.m_LoginEnterTimer = ticks;
                GoldCopySceneInfo.m_LoginEnterFlag  = 1;
                result = true;
            }
            else
            {
                result = false;
            }
            return(result);
        }
Esempio n. 11
0
 public void ExecuteEnterMap(int mapCode)
 {
     if (this._ClientData.MapCode >= 0 && this._ClientData.CopyMapID >= 0)
     {
         MapTypes mapType = Global.GetMapType(mapCode);
         if (mapType >= MapTypes.NormalCopy && mapType <= MapTypes.MarriageCopy)
         {
             CopyMap copyMap = GameManager.CopyMapMgr.FindCopyMap(this._ClientData.CopyMapID);
             if (null != copyMap)
             {
                 lock (copyMap.EventQueue)
                 {
                     foreach (MapAIEvent e in copyMap.EventQueue)
                     {
                         int guangMuID = e.GuangMuID;
                         int show      = e.Show;
                         this.sendCmd(667, string.Format("{0}:{1}", guangMuID, show), false);
                     }
                 }
                 if (!copyMap.ExecEnterMapLuaFile)
                 {
                     copyMap.ExecEnterMapLuaFile = true;
                     GameMap gameMap = GameManager.MapMgr.DictMaps[this._ClientData.MapCode];
                     if (!string.IsNullOrEmpty(gameMap.EnterMapLuaFile))
                     {
                         Global.ExcuteLuaFunction(this, gameMap.EnterMapLuaFile, "comeOn", null, null);
                     }
                 }
             }
         }
     }
 }
        public static bool RemoveCopyScene(CopyMap copyMap, SceneUIClasses sceneType)
        {
            bool success = true;

            lock (GlobalServiceManager.Scene2ManagerDict)
            {
                List <IManager> list;
                if (GlobalServiceManager.Scene2ManagerDict.TryGetValue((int)sceneType, out list))
                {
                    foreach (IManager i in list)
                    {
                        ICopySceneManager m2 = i as ICopySceneManager;
                        if (null != m2)
                        {
                            try
                            {
                                success = (success && m2.RemoveCopyScene(copyMap, sceneType));
                            }
                            catch (Exception ex)
                            {
                                LogManager.WriteException(ex.ToString());
                            }
                        }
                    }
                }
            }
            return(success);
        }
        public static void AddExperienceListCopyMap(int nID, CopyMap mapInfo)
        {
            bool bInsert = false;

            lock (ExperienceCopySceneManager.m_ExperienceListCopyMaps)
            {
                CopyMap tmp = null;
                if (!ExperienceCopySceneManager.m_ExperienceListCopyMaps.TryGetValue(nID, out tmp))
                {
                    ExperienceCopySceneManager.m_ExperienceListCopyMaps.Add(nID, mapInfo);
                    bInsert = true;
                }
                else if (tmp == null)
                {
                    ExperienceCopySceneManager.m_ExperienceListCopyMaps[nID] = mapInfo;
                    bInsert = true;
                }
            }
            lock (ExperienceCopySceneManager.m_ExperienceListCopyMapsInfo)
            {
                if (bInsert)
                {
                    ExperienceCopyScene ExperienceSceneInfo = null;
                    if (!ExperienceCopySceneManager.m_ExperienceListCopyMapsInfo.TryGetValue(nID, out ExperienceSceneInfo))
                    {
                        ExperienceSceneInfo = new ExperienceCopyScene();
                        ExperienceSceneInfo.InitInfo(mapInfo.MapCode, mapInfo.CopyMapID, nID);
                        ExperienceSceneInfo.m_StartTimer = TimeUtil.NOW();
                        ExperienceCopySceneManager.m_ExperienceListCopyMapsInfo.Add(nID, ExperienceSceneInfo);
                    }
                }
            }
        }
Esempio n. 14
0
        /// <summary>
        // 刷B怪
        /// </summary>
        public static void CreateMonsterBFreshPlayerScene(CopyMap copyMapInfo)
        {
            int monsterID = Data.FreshPlayerSceneInfo.NeedKillMonster2ID;

            string[] sfields = Data.FreshPlayerSceneInfo.NeedCreateMonster2Pos.Split(',');

            int nPosX = Global.SafeConvertToInt32(sfields[0]);
            int nPosY = Global.SafeConvertToInt32(sfields[1]);

            GameMap gameMap = null;

            if (!GameManager.MapMgr.DictMaps.TryGetValue(copyMapInfo.MapCode, out gameMap))
            {
                return;
            }

            int gridX = gameMap.CorrectWidthPointToGridPoint(nPosX) / gameMap.MapGridWidth;
            int gridY = gameMap.CorrectHeightPointToGridPoint(nPosY) / gameMap.MapGridHeight;

            int gridNum = gameMap.CorrectPointToGrid(Data.FreshPlayerSceneInfo.NeedCreateMonster2Radius);

            for (int i = 0; i < Data.FreshPlayerSceneInfo.NeedCreateMonster2Num; ++i)
            {
                GameManager.MonsterZoneMgr.AddDynamicMonsters(copyMapInfo.MapCode, monsterID, copyMapInfo.CopyMapID, 1, gridX, gridY, gridNum, Data.FreshPlayerSceneInfo.NeedCreateMonster2PursuitRadius);
            }

            return;
        }
        public static void AddEMoLaiXiCopySceneList(int nID, CopyMap mapInfo)
        {
            bool bInsert = false;

            lock (EMoLaiXiCopySceneManager.m_EMoLaiXiCopySceneLists)
            {
                CopyMap tmp = null;
                if (!EMoLaiXiCopySceneManager.m_EMoLaiXiCopySceneLists.TryGetValue(nID, out tmp))
                {
                    EMoLaiXiCopySceneManager.m_EMoLaiXiCopySceneLists.Add(nID, mapInfo);
                    bInsert = true;
                }
                else if (tmp == null)
                {
                    EMoLaiXiCopySceneManager.m_EMoLaiXiCopySceneLists[nID] = mapInfo;
                    bInsert = true;
                }
                lock (EMoLaiXiCopySceneManager.m_EMoLaiXiCopySceneInfo)
                {
                    if (bInsert)
                    {
                        EMoLaiXiCopySence eMoLaiXiCopySenceInfo = null;
                        if (!EMoLaiXiCopySceneManager.m_EMoLaiXiCopySceneInfo.TryGetValue(nID, out eMoLaiXiCopySenceInfo))
                        {
                            eMoLaiXiCopySenceInfo = new EMoLaiXiCopySence();
                            eMoLaiXiCopySenceInfo.InitInfo(mapInfo.MapCode, mapInfo.CopyMapID, nID);
                            eMoLaiXiCopySenceInfo.m_StartTimer = TimeUtil.NOW();
                            EMoLaiXiCopySceneManager.m_EMoLaiXiCopySceneInfo.Add(nID, eMoLaiXiCopySenceInfo);
                        }
                    }
                }
            }
        }
Esempio n. 16
0
 public static void RemoveCopyScenes(CopyMap cmInfo, int nSqeID, int nCopyID)
 {
     lock (ZhuanShengShiLian.ZhuanShengRunTimeData.Mutex)
     {
         ZSSLScene zsslScene;
         ZhuanShengShiLian.SceneDict.TryRemove(nSqeID, out zsslScene);
     }
 }
Esempio n. 17
0
        /// <summary>
        // 玩家登陆后进入金币副本
        /// </summary>
        public static bool EnterLuoLanFaZhenCopySenceWhenLogin(GameClient client, bool bContinue = true)
        {
            if (client != null)
            {
                CopyMap tmp = null;
                LuoLanFaZhenCopySence LuoLanFaZhenCopySenceInfo = null;

                lock (m_LuoLanFaZhenCopySceneLists)
                {
                    if (!m_LuoLanFaZhenCopySceneLists.TryGetValue(client.ClientData.FuBenSeqID, out tmp) || tmp == null)
                    {
                        return(false);
                    }
                }

                lock (m_LuoLanFaZhenCopySceneInfo)
                {
                    if (!m_LuoLanFaZhenCopySceneInfo.TryGetValue(client.ClientData.FuBenSeqID, out LuoLanFaZhenCopySenceInfo) || LuoLanFaZhenCopySenceInfo == null)
                    {
                        return(false);
                    }
                }

                if (LuoLanFaZhenCopySenceInfo.m_bFinished)
                {
                    return(false);
                }

                long ticks = TimeUtil.NOW();    // 当前tick
                LuoLanFaZhenCopySenceInfo.m_LoginEnterTimer = ticks;
                LuoLanFaZhenCopySenceInfo.m_LoginEnterFlag  = 1;

                /*if (bContinue == false)
                 * {
                 *  return true;
                 * }
                 *
                 * int fuBenID = FuBenManager.FindFuBenIDByMapCode(client.ClientData.MapCode);
                 * if (fuBenID > 0)
                 * {
                 *  List<GameClient> clientsList = tmp.GetClientsList();
                 *
                 *  if (clientsList.Count() != 0 && clientsList[0] != null)
                 *  {
                 *      string strcmd = string.Format("{0}:{1}", LuoLanFaZhenCopySenceInfo.m_CreateMonsterWave, Data.LuoLanFaZhenCopySencedata.LuoLanFaZhenCopySenceMonsterData.Count());//1.当前的波数 2.总波数
                 *      //TCPOutPacket tcpOutPacket = null;
                 *      //tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(Global._TCPManager.TcpOutPacketPool, strcmd, (int)TCPGameServerCmds.CMD_SPR_LuoLanFaZhenCopySenceMONSTERWAVE);
                 *      //Global._TCPManager.MySocketListener.SendData(clientsList[0].ClientSocket, tcpOutPacket);
                 *      GameManager.ClientMgr.SendToClient(clientsList[0], strcmd, (int)TCPGameServerCmds.CMD_SPR_LuoLanFaZhenCopySenceMONSTERWAVE);
                 *  }
                 * }*/

                return(true);
            }

            return(false);
        }
Esempio n. 18
0
        public void CreateMonster(ElementWarScene scene, int upWave)
        {
            CopyMap copyMap = scene.CopyMapInfo;
            GameMap gameMap = null;

            if (!GameManager.MapMgr.DictMaps.TryGetValue(scene.MapID, out gameMap))
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("元素试炼报错 地图配置 ID = {0}", scene.MapID), null, true);
            }
            else
            {
                long nowTicket = TimeUtil.NOW();
                long nowSecond = nowTicket / 1000L;
                lock (scene)
                {
                    if (scene.MonsterWave >= scene.MonsterWaveTotal)
                    {
                        scene.SceneStatus = GameSceneStatuses.STATUS_END;
                    }
                    else
                    {
                        scene.IsMonsterFlag = 1;
                        int wave = scene.MonsterWave + upWave;
                        if (wave > scene.MonsterWaveTotal)
                        {
                            wave = scene.MonsterWaveTotal;
                        }
                        ElementWarMonsterConfigInfo waveConfig = this._runtimeData.GetOrderConfig(wave);
                        if (waveConfig == null)
                        {
                            LogManager.WriteLog(LogTypes.Error, string.Format("元素试炼报错 刷怪波次 = {0}", wave), null, true);
                        }
                        else
                        {
                            scene.MonsterCountCreate = waveConfig.MonsterCount;
                            scene.MonsterWave        = wave;
                            scene.CreateMonsterTime  = nowSecond;
                            for (int i = 0; i < waveConfig.MonsterCount; i++)
                            {
                                int monsterID = waveConfig.MonsterIDs[i % waveConfig.MonsterIDs.Count];
                                int gridX     = gameMap.CorrectWidthPointToGridPoint(waveConfig.X + Global.GetRandomNumber(-waveConfig.Radius, waveConfig.Radius)) / gameMap.MapGridWidth;
                                int gridY     = gameMap.CorrectHeightPointToGridPoint(waveConfig.Y + Global.GetRandomNumber(-waveConfig.Radius, waveConfig.Radius)) / gameMap.MapGridHeight;
                                int gridNum   = 0;
                                GameManager.MonsterZoneMgr.AddDynamicMonsters(scene.MapID, monsterID, scene.CopyMapInfo.CopyMapID, 1, gridX, gridY, gridNum, 0, SceneUIClasses.Normal, null, null);
                            }
                            scene.ScoreData.Wave         = waveConfig.OrderID;
                            scene.ScoreData.EndTime      = nowTicket + (long)(waveConfig.Up1 * 1000);
                            scene.ScoreData.MonsterCount = (long)waveConfig.MonsterCount;
                            GameManager.ClientMgr.BroadSpecialCopyMapMessage <ElementWarScoreData>(1014, scene.ScoreData, scene.CopyMapInfo);
                        }
                    }
                }
            }
        }
Esempio n. 19
0
        /// <summary>
        /// 添加一个场景
        /// </summary>
        public bool AddHuanYingSiYuanCopyScenes(GameClient client, CopyMap copyMap)
        {
            if (copyMap.MapCode == RuntimeData.MapCode)
            {
                int fuBenSeqId = copyMap.FuBenSeqID;
                int mapCode    = copyMap.MapCode;
                lock (Mutex)
                {
                    HuanYingSiYuanScene huanYingSiYuanScene = null;
                    if (!HuanYingSiYuanSceneDict.TryGetValue(fuBenSeqId, out huanYingSiYuanScene))
                    {
                        huanYingSiYuanScene         = new HuanYingSiYuanScene();
                        huanYingSiYuanScene.CopyMap = copyMap;
                        huanYingSiYuanScene.CleanAllInfo();
                        huanYingSiYuanScene.GameId         = (int)Global.GetClientKuaFuServerLoginData(client).GameId;
                        huanYingSiYuanScene.m_nMapCode     = mapCode;
                        huanYingSiYuanScene.CopyMapId      = copyMap.CopyMapID;
                        huanYingSiYuanScene.FuBenSeqId     = fuBenSeqId;
                        huanYingSiYuanScene.m_nPlarerCount = 1;

                        HuanYingSiYuanSceneDict[fuBenSeqId] = huanYingSiYuanScene;
                    }
                    else
                    {
                        huanYingSiYuanScene.m_nPlarerCount++;
                    }

                    if (client.ClientData.BattleWhichSide == 1)
                    {
                        huanYingSiYuanScene.ScoreInfoData.Count1++;
                    }
                    else
                    {
                        huanYingSiYuanScene.ScoreInfoData.Count2++;
                    }

                    copyMap.IsKuaFuCopy = true;
                    copyMap.SetRemoveTicks(TimeUtil.NOW() + RuntimeData.TotalSecs * TimeUtil.SECOND);
                    GameManager.ClientMgr.BroadSpecialCopyMapMessage((int)TCPGameServerCmds.CMD_SPR_HYSY_SCORE_INFO, huanYingSiYuanScene.ScoreInfoData, huanYingSiYuanScene.CopyMap);
                }

                client.SceneContextData2 = new HuanYingSiYuanLianShaContextData();

                //更新状态
                HuanYingSiYuanClient.getInstance().GameFuBenRoleChangeState(client.ClientData.RoleID, (int)KuaFuRoleStates.StartGame);
                GlobalNew.UpdateKuaFuRoleDayLogData(client.ServerId, client.ClientData.RoleID, TimeUtil.NowDateTime(), client.ClientData.ZoneID, 0, 1, 0, 0, (int)GameTypes.HuanYingSiYuan);

                return(true);
            }

            return(false);
        }
Esempio n. 20
0
        /// <summary>
        /// 刷要塞
        /// </summary>
        public void CreateFort(CopyWolfSceneInfo scene)
        {
            CopyMap          copyMap    = scene.CopyMapInfo;
            CopyWolfWaveInfo waveConfig = null;

            GameMap gameMap = null;

            if (!GameManager.MapMgr.DictMaps.TryGetValue(scene.MapID, out gameMap))
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("【狼魂要塞】报错 地图配置 ID = {0}", scene.MapID));
                return;
            }

            lock (scene)
            {
                if (scene.IsFortFlag > 0)
                {
                    return;
                }

                //置刷怪标记
                scene.IsFortFlag = 1;

                int gridX = gameMap.CorrectWidthPointToGridPoint((int)_runtimeData.FortSite.X) / gameMap.MapGridWidth;
                int gridY = gameMap.CorrectHeightPointToGridPoint((int)_runtimeData.FortSite.Y) / gameMap.MapGridHeight;

                CreateMonsterTagInfo tagInfo = new CreateMonsterTagInfo();
                tagInfo.FuBenSeqId  = scene.FuBenSeqId;
                tagInfo.IsFort      = true;
                tagInfo.ManagerType = (int)SceneUIClasses.CopyWolf;

                GameManager.MonsterZoneMgr.AddDynamicMonsters(scene.MapID, _runtimeData.FortMonsterID, scene.CopyMapInfo.CopyMapID, 1, gridX, gridY, 0, 0, SceneUIClasses.CopyWolf, tagInfo);

                XElement xml = GameManager.MonsterZoneMgr.AllMonstersXml;
                if (xml == null)
                {
                    return;
                }

                XElement monsterXml = Global.GetSafeXElement(xml, "Monster", "ID", _runtimeData.FortMonsterID.ToString());
                if (monsterXml == null)
                {
                    return;
                }

                int life = (int)Global.GetSafeAttributeLong(monsterXml, "MaxLife");
                scene.ScoreData.FortLifeNow = life;
                scene.ScoreData.FortLifeMax = life;
                GameManager.ClientMgr.BroadSpecialCopyMapMessage((int)TCPGameServerCmds.CMD_SPR_COPY_WOLF_SCORE_INFO, scene.ScoreData, scene.CopyMapInfo);
            }
        }
Esempio n. 21
0
        /// <summary>
        /// 添加一个场景
        /// </summary>
        public bool AddTianTiCopyScenes(GameClient client, CopyMap copyMap, SceneUIClasses sceneType)
        {
            if (sceneType == SceneUIClasses.TianTi)
            {
                int fuBenSeqId = copyMap.FuBenSeqID;
                int mapCode    = copyMap.MapCode;
                lock (RuntimeData.Mutex)
                {
                    TianTiScene tianTiScene = null;
                    if (!TianTiSceneDict.TryGetValue(fuBenSeqId, out tianTiScene))
                    {
                        tianTiScene         = new TianTiScene();
                        tianTiScene.CopyMap = copyMap;
                        tianTiScene.CleanAllInfo();
                        tianTiScene.GameId         = (int)Global.GetClientKuaFuServerLoginData(client).GameId;
                        tianTiScene.m_nMapCode     = mapCode;
                        tianTiScene.CopyMapId      = copyMap.CopyMapID;
                        tianTiScene.FuBenSeqId     = fuBenSeqId;
                        tianTiScene.m_nPlarerCount = 1;

                        TianTiSceneDict[fuBenSeqId] = tianTiScene;
                    }
                    else
                    {
                        tianTiScene.m_nPlarerCount++;
                    }

                    copyMap.IsKuaFuCopy = true;
                    SaveClientBattleSide(tianTiScene, client);
                    copyMap.SetRemoveTicks(TimeUtil.NOW() + RuntimeData.TotalSecs * TimeUtil.SECOND);

                    if (tianTiScene.SuccessSide == -1)
                    {
                        client.sendCmd((int)TCPGameServerCmds.CMD_SPR_TIANTI_AWARD, new TianTiAwardsData()
                        {
                            Success = -1
                        });
                    }
                }

                //更新状态
                TianTiClient.getInstance().GameFuBenRoleChangeState(client.ClientData.RoleID, (int)KuaFuRoleStates.StartGame);
                GlobalNew.UpdateKuaFuRoleDayLogData(client.ServerId, client.ClientData.RoleID, TimeUtil.NowDateTime(), client.ClientData.ZoneID, 0, 1, 0, 0, (int)GameTypes.TianTi);

                return(true);
            }

            return(false);
        }
Esempio n. 22
0
        /// <summary>
        /// 删除一个场景
        /// </summary>
        public bool RemoveCopyScene(CopyMap copyMap, SceneUIClasses sceneType)
        {
            if (sceneType == SceneUIClasses.LangHunLingYu)
            {
                lock (RuntimeData.Mutex)
                {
                    LangHunLingYuScene LangHunLingYuScene;
                    RuntimeData.SceneDict.TryRemove(copyMap.FuBenSeqID, out LangHunLingYuScene);
                }

                return(true);
            }

            return(false);
        }
Esempio n. 23
0
        /// <summary>
        /// 删除一个场景
        /// </summary>
        public bool RemoveCopyScene(CopyMap copyMap)
        {
            if (copyMap.MapCode == _runtimeData.MapID)
            {
                lock (_mutex)
                {
                    CopyWolfSceneInfo scene;
                    _runtimeData.SceneDict.TryRemove(copyMap.FuBenSeqID, out scene);
                }

                return(true);
            }

            return(false);
        }
Esempio n. 24
0
        /// <summary>
        /// 删除一个场景
        /// </summary>
        public bool RemoveCopyScene(CopyMap copyMap, SceneUIClasses sceneType)
        {
            if (sceneType == SceneUIClasses.KingOfBattle)
            {
                lock (RuntimeData.Mutex)
                {
                    KingOfBattleScene KingOfBattleScene;
                    SceneDict.TryRemove(copyMap.FuBenSeqID, out KingOfBattleScene);
                }

                return(true);
            }

            return(false);
        }
Esempio n. 25
0
        /// <summary>
        /// 删除一个场景
        /// </summary>
        public bool RemoveCopyScene(CopyMap copyMap)
        {
            if (copyMap.MapCode == _runtimeData.MapID)
            {
                lock (_mutex)
                {
                    ElementWarScene scene;
                    _sceneDict.TryRemove(copyMap.FuBenSeqID, out scene);
                }

                return(true);
            }

            return(false);
        }
Esempio n. 26
0
        /// <summary>
        /// 删除一个场景
        /// </summary>
        public bool RemoveCopyScene(CopyMap copyMap, SceneUIClasses sceneType)
        {
            if (sceneType == SceneUIClasses.YongZheZhanChang)
            {
                lock (RuntimeData.Mutex)
                {
                    YongZheZhanChangScene YongZheZhanChangScene;
                    SceneDict.TryRemove(copyMap.FuBenSeqID, out YongZheZhanChangScene);
                }

                return(true);
            }

            return(false);
        }
Esempio n. 27
0
        /// <summary>
        // 心跳处理
        /// </summary>
        public static void HeartBeatFreshPlayerCopyMap()
        {
            long nowTicks = DateTime.Now.Ticks / 10000;

            if (nowTicks - LastHeartBeatTicks < (1000))
            {
                return;
            }

            LastHeartBeatTicks = nowTicks;

            // 没有玩家了 清空场景
            List <CopyMap> CopyMapList = new List <CopyMap>();

            // lock住!!
            lock (m_FreshPlayerListCopyMaps)
            {
                CopyMap copyMap = null;
                foreach (var item in m_FreshPlayerListCopyMaps.Values)
                {
                    copyMap = item;

                    // 刷出城门怪
                    if (item.FreshPlayerCreateGateFlag == 0)
                    {
                        CreateGateMonster(item);
                    }

                    List <GameClient> clientsList = item.GetClientsList();
                    if (null != clientsList && clientsList.Count <= 0)
                    {
                        CopyMapList.Add(item);
                    }
                }

                if (null != copyMap)
                {
                    // 加载自动复活的怪物
                    GameManager.MonsterZoneMgr.ReloadCopyMapMonsters(copyMap.MapCode, -1);
                }
            }


            for (int i = 0; i < CopyMapList.Count; ++i)
            {
                GameManager.CopyMapMgr.ProcessRemoveCopyMap(CopyMapList[i]);
            }
        }
Esempio n. 28
0
        /// <summary>
        /// 执行进入地图的lua脚本
        /// </summary>
        /// <param name="mapCode"></param>
        public void ExecuteEnterMap(int mapCode)
        {
            //角色死亡,并且登出的时候,会被配置成 -1
            if (_ClientData.MapCode < 0 || _ClientData.CopyMapID < 0)
            {
                return;
            }

            MapTypes mapType = Global.GetMapType(mapCode);

            if (mapType >= MapTypes.NormalCopy && mapType <= MapTypes.JingJiChang)
            {
                /// 获取副本地图对象
                CopyMap copyMap = GameManager.CopyMapMgr.FindCopyMap(_ClientData.CopyMapID);
                if (null == copyMap)
                {
                    return;
                }

                //重发AI相关的指令队列
                lock (copyMap.EventQueue)
                {
                    foreach (var e in copyMap.EventQueue)
                    {
                        int guangMuID = e.GuangMuID;
                        int show      = e.Show;
                        sendCmd((int)TCPGameServerCmds.CMD_SPR_MAPAIEVENT, string.Format("{0}:{1}", guangMuID, show));
                    }
                }

                if (copyMap.ExecEnterMapLuaFile)
                {
                    return;
                }

                copyMap.ExecEnterMapLuaFile = true;

                GameMap gameMap = GameManager.MapMgr.DictMaps[_ClientData.MapCode];
                if (!string.IsNullOrEmpty(gameMap.EnterMapLuaFile))
                {
                    //执行对话脚本
                    Global.ExcuteLuaFunction(this, gameMap.EnterMapLuaFile, "comeOn", null, null);
                }
            }
        }
        public static void ExperienceCopyMapKillMonster(GameClient client, Monster monster)
        {
            ExperienceCopyMapDataInfo TmpExInfo = null;

            if (Data.ExperienceCopyMapDataInfoList.TryGetValue(client.ClientData.MapCode, out TmpExInfo))
            {
                ExperienceCopyScene tmpExSceneInfo = null;
                lock (ExperienceCopySceneManager.m_ExperienceListCopyMapsInfo)
                {
                    if (!ExperienceCopySceneManager.m_ExperienceListCopyMapsInfo.TryGetValue(client.ClientData.FuBenSeqID, out tmpExSceneInfo))
                    {
                        return;
                    }
                }
                if (tmpExSceneInfo != null)
                {
                    CopyMap TmpCopyMapInfo = null;
                    if (ExperienceCopySceneManager.m_ExperienceListCopyMaps.TryGetValue(client.ClientData.FuBenSeqID, out TmpCopyMapInfo))
                    {
                        if (TmpCopyMapInfo != null)
                        {
                            tmpExSceneInfo.m_ExperienceCopyMapKillMonsterNum++;
                            tmpExSceneInfo.m_ExperienceCopyMapKillMonsterTotalNum++;
                            tmpExSceneInfo.m_ExperienceCopyMapRemainMonsterNum--;
                            if (tmpExSceneInfo.m_ExperienceCopyMapCreateMonsterFlag == 1 && tmpExSceneInfo.m_ExperienceCopyMapKillMonsterNum == tmpExSceneInfo.m_ExperienceCopyMapNeedKillMonsterNum)
                            {
                                tmpExSceneInfo.m_ExperienceCopyMapCreateMonsterFlag = 0;
                                tmpExSceneInfo.m_ExperienceCopyMapKillMonsterNum    = 0;
                                tmpExSceneInfo.m_ExperienceCopyMapCreateMonsterNum  = 0;
                            }
                            if (tmpExSceneInfo.m_ExperienceCopyMapCreateMonsterWave == TmpExInfo.MonsterIDList.Count && tmpExSceneInfo.m_ExperienceCopyMapKillMonsterTotalNum == TmpExInfo.MonsterSum)
                            {
                                ExperienceCopySceneManager.SendMsgToClientForExperienceCopyMapAward(client);
                            }
                            int nWave = tmpExSceneInfo.m_ExperienceCopyMapCreateMonsterWave;
                            if (tmpExSceneInfo.m_ExperienceCopyMapKillMonsterTotalNum == TmpExInfo.MonsterSum || tmpExSceneInfo.m_ExperienceCopyMapRemainMonsterNum == 0)
                            {
                                nWave++;
                            }
                            ExperienceCopySceneManager.SendMsgToClientForExperienceCopyMapInfo(client, nWave);
                        }
                    }
                }
            }
        }
Esempio n. 30
0
        /// <summary>
        /// 删除一个场景
        /// </summary>
        public bool RemoveHuanYingSiYuanListCopyScenes(CopyMap copyMap)
        {
            if (copyMap.MapCode == RuntimeData.MapCode)
            {
                lock (Mutex)
                {
                    HuanYingSiYuanScene huanYingSiYuanScene;
                    if (HuanYingSiYuanSceneDict.TryRemove(copyMap.FuBenSeqID, out huanYingSiYuanScene))
                    {
                        GameId2FuBenSeq.Remove(huanYingSiYuanScene.GameId);
                    }
                }

                return(true);
            }

            return(false);
        }