public static void ExperienceCopyMapCreateMonster(GameClient client, ExperienceCopyScene ExperienceMapInfo, ExperienceCopyMapDataInfo exMap, int nWave)
        {
            ExperienceMapInfo.m_ExperienceCopyMapCreateMonsterFlag = 1;
            ExperienceMapInfo.m_ExperienceCopyMapCreateMonsterWave++;
            GameMap gameMap = null;

            if (!GameManager.MapMgr.DictMaps.TryGetValue(ExperienceMapInfo.m_MapCodeID, out gameMap))
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("经验副本 地图配置 ID = {0}", ExperienceMapInfo.m_MapCodeID), null, true);
            }
            else
            {
                int        gridX    = gameMap.CorrectWidthPointToGridPoint(exMap.posX) / gameMap.MapGridWidth;
                int        gridY    = gameMap.CorrectHeightPointToGridPoint(exMap.posZ) / gameMap.MapGridHeight;
                int        gridNum  = gameMap.CorrectWidthPointToGridPoint(exMap.Radius);
                int        nTotal   = 0;
                List <int> nListID  = exMap.MonsterIDList[nWave];
                List <int> nListNum = exMap.MonsterNumList[nWave];
                for (int i = 0; i < nListID.Count; i++)
                {
                    int nID  = nListID[i];
                    int nNum = nListNum[i];
                    GameManager.MonsterZoneMgr.AddDynamicMonsters(ExperienceMapInfo.m_MapCodeID, nID, ExperienceMapInfo.m_CopyMapID, nNum, gridX, gridY, gridNum, 0, SceneUIClasses.Normal, null, null);
                    nTotal += nNum;
                    ExperienceMapInfo.m_ExperienceCopyMapCreateMonsterNum += nNum;
                    ExperienceMapInfo.m_ExperienceCopyMapRemainMonsterNum += nNum;
                }
                ExperienceMapInfo.m_ExperienceCopyMapNeedKillMonsterNum = ExperienceMapInfo.m_ExperienceCopyMapCreateMonsterNum * exMap.CreateNextWaveMonsterCondition[nWave] / 100;
                if (client != null)
                {
                    ExperienceCopySceneManager.SendMsgToClientForExperienceCopyMapInfo(client, ExperienceMapInfo.m_ExperienceCopyMapCreateMonsterWave);
                }
            }
        }
Exemplo n.º 2
0
        public static List <int[]> FindPath(Point startPoint, Point endPoint, int mapCode)
        {
            GameMap      gameMap = GameManager.MapMgr.DictMaps[mapCode];
            List <int[]> result;

            if (null == gameMap)
            {
                result = null;
            }
            else
            {
                PathFinderFast pathFinderFast;
                if (GlobalNew._pathStack.Count <= 0)
                {
                    pathFinderFast = new PathFinderFast(gameMap.MyNodeGrid.GetFixedObstruction())
                    {
                        Formula           = HeuristicFormula.Manhattan,
                        Diagonals         = true,
                        HeuristicEstimate = 2,
                        ReopenCloseNodes  = true,
                        SearchLimit       = int.MaxValue,
                        Punish            = null,
                        MaxNum            = Global.GMax(gameMap.MapGridWidth, gameMap.MapGridHeight)
                    };
                }
                else
                {
                    pathFinderFast = GlobalNew._pathStack.Pop();
                }
                startPoint.X = (double)(gameMap.CorrectWidthPointToGridPoint((int)startPoint.X) / gameMap.MapGridWidth);
                startPoint.Y = (double)(gameMap.CorrectHeightPointToGridPoint((int)startPoint.Y) / gameMap.MapGridHeight);
                endPoint.X   = (double)(gameMap.CorrectWidthPointToGridPoint((int)endPoint.X) / gameMap.MapGridWidth);
                endPoint.Y   = (double)(gameMap.CorrectHeightPointToGridPoint((int)endPoint.Y) / gameMap.MapGridHeight);
                pathFinderFast.EnablePunish = false;
                List <PathFinderNode> nodeList = pathFinderFast.FindPath(startPoint, endPoint);
                if (nodeList == null || nodeList.Count <= 0)
                {
                    result = null;
                }
                else
                {
                    List <int[]> path = new List <int[]>();
                    for (int i = 0; i < nodeList.Count; i++)
                    {
                        path.Add(new int[]
                        {
                            nodeList[i].X,
                            nodeList[i].Y
                        });
                    }
                    result = path;
                }
            }
            return(result);
        }
Exemplo n.º 3
0
        /// <summary>
        // 刷怪接口
        /// </summary>
        static public void ExperienceCopyMapCreateMonster(GameClient client, ExperienceCopyScene ExperienceMapInfo, ExperienceCopyMapDataInfo exMap, int nWave)
        {
            ExperienceMapInfo.m_ExperienceCopyMapCreateMonsterFlag = 1;

            ++ExperienceMapInfo.m_ExperienceCopyMapCreateMonsterWave;

            GameMap gameMap = null;

            if (!GameManager.MapMgr.DictMaps.TryGetValue(ExperienceMapInfo.m_MapCodeID, out gameMap))
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("经验副本 地图配置 ID = {0}", ExperienceMapInfo.m_MapCodeID));
                return;
            }

            int gridX = gameMap.CorrectWidthPointToGridPoint(exMap.posX) / gameMap.MapGridWidth;
            int gridY = gameMap.CorrectHeightPointToGridPoint(exMap.posZ) / gameMap.MapGridHeight;

            int gridNum = gameMap.CorrectWidthPointToGridPoint(exMap.Radius);

            int nID    = 0;
            int nNum   = 0;
            int nTotal = 0;

            //for (int i = 0; i < exMap.MonsterIDList.Count; ++i)
            {
                List <int> nListID  = exMap.MonsterIDList[nWave];
                List <int> nListNum = exMap.MonsterNumList[nWave];

                for (int j = 0; j < nListID.Count; ++j)
                {
                    nID  = nListID[j];
                    nNum = nListNum[j];

                    GameManager.MonsterZoneMgr.AddDynamicMonsters(ExperienceMapInfo.m_MapCodeID, nID, ExperienceMapInfo.m_CopyMapID, nNum, gridX, gridY, gridNum);

                    nTotal += nNum;

                    ExperienceMapInfo.m_ExperienceCopyMapCreateMonsterNum += nNum;

                    ExperienceMapInfo.m_ExperienceCopyMapRemainMonsterNum += nNum;
                }
            }

            // 计数要杀死怪的数量
            ExperienceMapInfo.m_ExperienceCopyMapNeedKillMonsterNum = ExperienceMapInfo.m_ExperienceCopyMapCreateMonsterNum * exMap.CreateNextWaveMonsterCondition[nWave] / 100;

            //System.Console.WriteLine("liaowei是帅哥  经验副本 {0} 里 刷怪了 数量是 {1} !!!", exMap.MapCodeID, ExperienceMapInfo.m_ExperienceCopyMapCreateMonsterNum);

            if (client != null)
            {
                SendMsgToClientForExperienceCopyMapInfo(client, ExperienceMapInfo.m_ExperienceCopyMapCreateMonsterWave);
            }
        }
Exemplo n.º 4
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;
        }
Exemplo n.º 5
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;
        }
Exemplo n.º 6
0
        /// <summary>
        /// 补充刷新水晶棺材
        /// </summary>
        /// <param name="client"></param>
        public static void AddShuiJingGuanCaiMonsters(GameClient client)
        {
            CopyMap copyMapInfo = null;

            lock (m_FreshPlayerListCopyMaps)
            {
                if (!m_FreshPlayerListCopyMaps.TryGetValue(client.ClientData.FuBenSeqID, out copyMapInfo) || copyMapInfo == null)
                {
                    return;
                }
            }

            if (copyMapInfo.HaveBirthShuiJingGuan)
            {
                return;
            }

            if (copyMapInfo.FreshPlayerKillMonsterBCount >= Data.FreshPlayerSceneInfo.NeedKillMonster2Num)
            {
                bool canAddMonster = true;
                if (canAddMonster) //是否能刷水晶棺的怪物
                {
                    copyMapInfo.HaveBirthShuiJingGuan = true;

                    // 把水晶棺刷出来
                    int      monsterID = Data.FreshPlayerSceneInfo.CrystalID;
                    string[] sfields   = Data.FreshPlayerSceneInfo.CrystalPos.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);
                }
            }
        }
Exemplo n.º 7
0
        public void CreateFort(CopyWolfSceneInfo scene)
        {
            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
            {
                lock (scene)
                {
                    if (scene.IsFortFlag <= 0)
                    {
                        scene.IsFortFlag = 1;
                        int gridX = gameMap.CorrectWidthPointToGridPoint((int)this._runtimeData.FortSite.X) / gameMap.MapGridWidth;
                        int gridY = gameMap.CorrectHeightPointToGridPoint((int)this._runtimeData.FortSite.Y) / gameMap.MapGridHeight;
                        CreateMonsterTagInfo tagInfo = new CreateMonsterTagInfo();
                        tagInfo.FuBenSeqId  = scene.FuBenSeqId;
                        tagInfo.IsFort      = true;
                        tagInfo.ManagerType = 34;
                        GameManager.MonsterZoneMgr.AddDynamicMonsters(scene.MapID, this._runtimeData.FortMonsterID, scene.CopyMapInfo.CopyMapID, 1, gridX, gridY, 0, 0, SceneUIClasses.CopyWolf, tagInfo, null);
                        XElement xml = GameManager.MonsterZoneMgr.AllMonstersXml;
                        if (xml != null)
                        {
                            XElement monsterXml = Global.GetSafeXElement(xml, "Monster", "ID", this._runtimeData.FortMonsterID.ToString());
                            if (monsterXml != null)
                            {
                                int life = (int)Global.GetSafeAttributeLong(monsterXml, "MaxLife");
                                scene.ScoreData.FortLifeNow = life;
                                scene.ScoreData.FortLifeMax = life;
                                GameManager.ClientMgr.BroadSpecialCopyMapMessage <CopyWolfScoreData>(1025, scene.ScoreData, scene.CopyMapInfo);
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// 刷怪
        /// </summary>
        public void CreateMonster(CopyWolfSceneInfo scene, int upWave = 1)
        {
            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;
            }

            //------------------------------------临时测试
            //if (scene.MonsterWave > 0)
            //{
            //    //置刷怪标记
            //    scene.IsMonsterFlag = 1;
            //    return;
            //}

            long nowTicket = TimeUtil.NOW();
            long nowSecond = nowTicket / 1000;

            lock (scene)
            {
                if (scene.MonsterWave >= scene.MonsterWaveTotal)
                {
                    scene.MonsterWaveOld = scene.MonsterWave;
                    scene.MonsterWave    = 0;
                    scene.SceneStatus    = GameSceneStatuses.STATUS_END;
                    return;
                }

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

                int wave = scene.MonsterWave + upWave;
                if (wave > scene.MonsterWaveTotal)
                {
                    wave = scene.MonsterWaveTotal;
                }

                waveConfig = _runtimeData.GetWaveConfig(wave);
                if (waveConfig == null)
                {
                    LogManager.WriteLog(LogTypes.Error, string.Format("【狼魂要塞】报错 刷怪波次 = {0}", wave));
                    return;
                }

                scene.MonsterWave       = wave; // 递增刷怪波数
                scene.CreateMonsterTime = nowSecond;

                int totalCount   = 0;
                int monsterID    = 0;
                int monsterCount = 0;
                int gridX        = 0;
                int gridY        = 0;
                int gridNum      = 0;

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

                foreach (CopyWolfSiteInfo siteInfo in waveConfig.MonsterSiteDic)
                {
                    gridX = gameMap.CorrectWidthPointToGridPoint(siteInfo.X + Global.GetRandomNumber(-siteInfo.Radius, siteInfo.Radius)) / gameMap.MapGridWidth;
                    gridY = gameMap.CorrectHeightPointToGridPoint(siteInfo.Y + Global.GetRandomNumber(-siteInfo.Radius, siteInfo.Radius)) / gameMap.MapGridHeight;

                    foreach (var monster in waveConfig.MonsterList)
                    {
                        monsterID    = monster[0];
                        monsterCount = monster[1];
                        totalCount  += monsterCount;
                        GameManager.MonsterZoneMgr.AddDynamicMonsters(scene.MapID, monsterID, scene.CopyMapInfo.CopyMapID, monsterCount, gridX, gridY, gridNum, 0, SceneUIClasses.CopyWolf, tagInfo);
                        //break;
                    }
                    //break;
                }

                scene.MonsterCountCreate += totalCount;
                scene.ScoreData.Wave      = waveConfig.WaveID;
                scene.ScoreData.EndTime   = nowTicket + waveConfig.NextTime * 1000;
                //scene.ScoreData.MonsterCount += scene.MonsterCountCreate;

                GameManager.ClientMgr.BroadSpecialCopyMapMessage((int)TCPGameServerCmds.CMD_SPR_COPY_WOLF_SCORE_INFO, scene.ScoreData, scene.CopyMapInfo);
            }
        }
Exemplo n.º 9
0
        public void CreateMonster(CopyWolfSceneInfo scene, int upWave = 1)
        {
            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), null, true);
            }
            else
            {
                long nowTicket = TimeUtil.NOW();
                long nowSecond = nowTicket / 1000L;
                lock (scene)
                {
                    if (scene.MonsterWave >= scene.MonsterWaveTotal)
                    {
                        scene.MonsterWaveOld = scene.MonsterWave;
                        scene.MonsterWave    = 0;
                        scene.SceneStatus    = GameSceneStatuses.STATUS_END;
                    }
                    else
                    {
                        scene.IsMonsterFlag = 1;
                        int wave = scene.MonsterWave + upWave;
                        if (wave > scene.MonsterWaveTotal)
                        {
                            wave = scene.MonsterWaveTotal;
                        }
                        waveConfig = this._runtimeData.GetWaveConfig(wave);
                        if (waveConfig == null)
                        {
                            LogManager.WriteLog(LogTypes.Error, string.Format("【狼魂要塞】报错 刷怪波次 = {0}", wave), null, true);
                        }
                        else
                        {
                            scene.MonsterWave       = wave;
                            scene.CreateMonsterTime = nowSecond;
                            int totalCount = 0;
                            int gridNum    = 0;
                            CreateMonsterTagInfo tagInfo = new CreateMonsterTagInfo();
                            tagInfo.FuBenSeqId  = scene.FuBenSeqId;
                            tagInfo.IsFort      = false;
                            tagInfo.ManagerType = 34;
                            foreach (CopyWolfSiteInfo siteInfo in waveConfig.MonsterSiteDic)
                            {
                                int gridX = gameMap.CorrectWidthPointToGridPoint(siteInfo.X + Global.GetRandomNumber(-siteInfo.Radius, siteInfo.Radius)) / gameMap.MapGridWidth;
                                int gridY = gameMap.CorrectHeightPointToGridPoint(siteInfo.Y + Global.GetRandomNumber(-siteInfo.Radius, siteInfo.Radius)) / gameMap.MapGridHeight;
                                foreach (int[] monster in waveConfig.MonsterList)
                                {
                                    int monsterID    = monster[0];
                                    int monsterCount = monster[1];
                                    totalCount += monsterCount;
                                    GameManager.MonsterZoneMgr.AddDynamicMonsters(scene.MapID, monsterID, scene.CopyMapInfo.CopyMapID, monsterCount, gridX, gridY, gridNum, 0, SceneUIClasses.CopyWolf, tagInfo, null);
                                }
                            }
                            scene.MonsterCountCreate += totalCount;
                            scene.ScoreData.Wave      = waveConfig.WaveID;
                            scene.ScoreData.EndTime   = nowTicket + (long)(waveConfig.NextTime * 1000);
                            GameManager.ClientMgr.BroadSpecialCopyMapMessage <CopyWolfScoreData>(1025, scene.ScoreData, scene.CopyMapInfo);
                        }
                    }
                }
            }
        }
        public static void KillMonsterInFreshPlayerScene(GameClient client, Monster monster)
        {
            CopyMap copyMapInfo;

            lock (FreshPlayerCopySceneManager.m_FreshPlayerListCopyMaps)
            {
                if (!FreshPlayerCopySceneManager.m_FreshPlayerListCopyMaps.TryGetValue(client.ClientData.FuBenSeqID, out copyMapInfo) || copyMapInfo == null)
                {
                    return;
                }
            }
            if (monster.MonsterInfo.VLevel >= Data.FreshPlayerSceneInfo.NeedKillMonster1Level)
            {
                copyMapInfo.FreshPlayerKillMonsterACount++;
                if (copyMapInfo.FreshPlayerKillMonsterACount >= Data.FreshPlayerSceneInfo.NeedKillMonster1Num)
                {
                    string strcmd = string.Format("{0}", client.ClientData.RoleID);
                    GameManager.ClientMgr.SendToClient(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, strcmd, 525);
                }
            }
            if (monster.MonsterInfo.ExtensionID == Data.FreshPlayerSceneInfo.NeedKillMonster2ID)
            {
                copyMapInfo.FreshPlayerKillMonsterBCount++;
                if (copyMapInfo.FreshPlayerKillMonsterBCount >= Data.FreshPlayerSceneInfo.NeedKillMonster2Num)
                {
                    bool     canAddMonster = false;
                    TaskData taskData      = Global.GetTaskData(client, 105);
                    if (null != taskData)
                    {
                        canAddMonster = true;
                    }
                    if (canAddMonster)
                    {
                        copyMapInfo.HaveBirthShuiJingGuan = true;
                        int      monsterID = Data.FreshPlayerSceneInfo.CrystalID;
                        string[] sfields   = Data.FreshPlayerSceneInfo.CrystalPos.Split(new char[]
                        {
                            ','
                        });
                        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, 0, SceneUIClasses.Normal, null, null);
                    }
                }
            }
            if (monster.MonsterInfo.ExtensionID == Data.FreshPlayerSceneInfo.GateID)
            {
                FreshPlayerCopySceneManager.CreateMonsterBFreshPlayerScene(copyMapInfo);
            }
            if (monster.MonsterInfo.ExtensionID == Data.FreshPlayerSceneInfo.CrystalID)
            {
                int      monsterID = Data.FreshPlayerSceneInfo.DiaoXiangID;
                string[] sfields   = Data.FreshPlayerSceneInfo.DiaoXiangPos.Split(new char[]
                {
                    ','
                });
                int     nPosX   = Global.SafeConvertToInt32(sfields[0]);
                int     nPosY   = Global.SafeConvertToInt32(sfields[1]);
                GameMap gameMap = null;
                if (GameManager.MapMgr.DictMaps.TryGetValue(copyMapInfo.MapCode, out gameMap))
                {
                    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, 0, SceneUIClasses.Normal, null, null);
                }
            }
        }
Exemplo n.º 11
0
        /// <summary>
        // 杀死了怪
        /// </summary>
        public static void KillMonsterInFreshPlayerScene(GameClient client, Monster monster)
        {
            CopyMap copyMapInfo;

            lock (m_FreshPlayerListCopyMaps)
            {
                if (!m_FreshPlayerListCopyMaps.TryGetValue(client.ClientData.FuBenSeqID, out copyMapInfo) || copyMapInfo == null)
                {
                    return;
                }
            }

            if (monster.MonsterInfo.VLevel >= Data.FreshPlayerSceneInfo.NeedKillMonster1Level)
            {
                ++copyMapInfo.FreshPlayerKillMonsterACount;

                if (copyMapInfo.FreshPlayerKillMonsterACount >= Data.FreshPlayerSceneInfo.NeedKillMonster1Num)
                {
                    // 杀死A怪的数量已经达到限额 通知客户端 面前的阻挡消失 玩家可以离开桥 攻击城门了
                    string strcmd = string.Format("{0}", client.ClientData.RoleID);
                    GameManager.ClientMgr.SendToClient(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, strcmd,
                                                       (int)TCPGameServerCmds.CMD_SPR_FRESHPLAYERSCENEKILLMONSTERAHASDONE);
                }
            }

            if (monster.MonsterInfo.ExtensionID == Data.FreshPlayerSceneInfo.NeedKillMonster2ID)
            {
                ++copyMapInfo.FreshPlayerKillMonsterBCount;

                if (copyMapInfo.FreshPlayerKillMonsterBCount >= Data.FreshPlayerSceneInfo.NeedKillMonster2Num)
                {
                    bool     canAddMonster = false;
                    TaskData taskData      = Global.GetTaskData(client, 105);        //先写死吧,临时i解决掉
                    if (null != taskData)
                    {
                        canAddMonster = true;
                    }

                    if (canAddMonster) //是否能刷水晶棺的怪物
                    {
                        copyMapInfo.HaveBirthShuiJingGuan = true;

                        // 把水晶棺刷出来
                        int      monsterID = Data.FreshPlayerSceneInfo.CrystalID;
                        string[] sfields   = Data.FreshPlayerSceneInfo.CrystalPos.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);
                    }
                }
            }

            // 如果杀死的是城门 刷巫师
            if (monster.MonsterInfo.ExtensionID == Data.FreshPlayerSceneInfo.GateID)
            {
                CreateMonsterBFreshPlayerScene(copyMapInfo);
            }

            // 刷雕像
            if (monster.MonsterInfo.ExtensionID == Data.FreshPlayerSceneInfo.CrystalID)
            {
                int      monsterID = Data.FreshPlayerSceneInfo.DiaoXiangID;
                string[] sfields   = Data.FreshPlayerSceneInfo.DiaoXiangPos.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);
            }

            return;
        }
Exemplo n.º 12
0
        public void HeartBeatAngelTempleScene()
        {
            long ticks = TimeUtil.NOW();
            AngelTempleStatus newStatus;

            if (this.ChangeToNextStatus(out newStatus))
            {
                switch (newStatus)
                {
                case AngelTempleStatus.FIGHT_STATUS_NULL:
                {
                    List <object> objsList = GameManager.ClientMgr.GetMapClients(this.m_AngelTempleData.MapCode);
                    if (objsList != null)
                    {
                        for (int i = 0; i < objsList.Count; i++)
                        {
                            GameClient c = objsList[i] as GameClient;
                            if (c != null)
                            {
                                if (c.ClientData.MapCode == this.m_AngelTempleData.MapCode)
                                {
                                    int toMapCode = GameManager.MainMapCode;
                                    int toPosX    = -1;
                                    int toPosY    = -1;
                                    if (MapTypes.Normal == Global.GetMapType(c.ClientData.LastMapCode))
                                    {
                                        if (GameManager.BattleMgr.BattleMapCode != c.ClientData.LastMapCode || GameManager.ArenaBattleMgr.BattleMapCode != c.ClientData.LastMapCode)
                                        {
                                            toMapCode = c.ClientData.LastMapCode;
                                            toPosX    = c.ClientData.LastPosX;
                                            toPosY    = c.ClientData.LastPosY;
                                        }
                                    }
                                    GameMap gameMap = null;
                                    if (GameManager.MapMgr.DictMaps.TryGetValue(toMapCode, out gameMap))
                                    {
                                        c.ClientData.bIsInAngelTempleMap = false;
                                        GameManager.ClientMgr.NotifyChangeMap(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, c, toMapCode, toPosX, toPosY, -1, 0);
                                    }
                                }
                            }
                        }
                    }
                    this.CleanUpAngelTempleScene();
                    if (ticks >= this.m_AngelTempleScene.m_lEndTime + (long)(this.m_AngelTempleData.LeaveTime * 20000))
                    {
                        this.m_AngelTempleScene.m_eStatus = AngelTempleStatus.FIGHT_STATUS_NULL;
                    }
                    break;
                }

                case AngelTempleStatus.FIGHT_STATUS_PREPARE:
                    Global.AddFlushIconStateForAll(1007, true);
                    break;

                case AngelTempleStatus.FIGHT_STATUS_BEGIN:
                {
                    lock (this.m_AngelTempleScene)
                    {
                        this.bBossKilled = false;
                        this.m_AngelTempleScene.m_bEndFlag = 0;
                    }
                    this.SendTimeInfoToAll(ticks);
                    int     monsterID = this.m_AngelTempleData.BossID;
                    GameMap gameMap   = null;
                    if (!GameManager.MapMgr.DictMaps.TryGetValue(this.m_AngelTempleData.MapCode, out gameMap))
                    {
                        LogManager.WriteLog(LogTypes.Error, string.Format("天使神殿报错 地图配置 ID = {0}", this.m_AngelTempleData.MapCode), null, true);
                        return;
                    }
                    int gridX = gameMap.CorrectWidthPointToGridPoint(this.m_AngelTempleData.BossPosX) / gameMap.MapGridWidth;
                    int gridY = gameMap.CorrectHeightPointToGridPoint(this.m_AngelTempleData.BossPosY) / gameMap.MapGridHeight;
                    this.AngelTempleMonsterUpgradePercent = Global.SafeConvertToDouble(GameManager.GameConfigMgr.GetGameConifgItem("AngelTempleMonsterUpgradeNumber"));
                    GameManager.MonsterZoneMgr.AddDynamicMonsters(this.m_AngelTempleData.MapCode, monsterID, -1, 1, gridX, gridY, 1, 0, SceneUIClasses.Normal, null, null);
                    break;
                }

                case AngelTempleStatus.FIGHT_STATUS_END:
                    Global.AddFlushIconStateForAll(1007, false);
                    this.SendTimeInfoToAll(ticks);
                    if (!this.bBossKilled && this.m_AngelTempleBoss != null)
                    {
                        MonsterData md     = this.m_AngelTempleBoss.GetMonsterData();
                        double      damage = 0.0;
                        if (md.MaxLifeV != md.LifeV)
                        {
                            damage = Global.Clamp(md.MaxLifeV - md.LifeV, md.MaxLifeV / 10.0, md.MaxLifeV);
                            this.AngelTempleMonsterUpgradePercent *= damage * 0.8 / md.MaxLifeV;
                            Global.UpdateDBGameConfigg("AngelTempleMonsterUpgradeNumber", this.AngelTempleMonsterUpgradePercent.ToString("0.00"));
                        }
                        GameManager.MonsterMgr.AddDelayDeadMonster(this.m_AngelTempleBoss);
                        GameManager.ClientMgr.NotifyAngelTempleMsgBossDisappear(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, this.m_AngelTempleData.MapCode);
                        LogManager.WriteLog(LogTypes.SQL, string.Format("天使神殿Boss未死亡,血量减少百分比{0:P} ,Boss生命值比例成长为{1}", damage / md.MaxLifeV, this.AngelTempleMonsterUpgradePercent), null, true);
                        this.m_AngelTempleBoss = null;
                    }
                    this.GiveAwardAngelTempleScene(this.bBossKilled);
                    break;
                }
            }
            if (newStatus == AngelTempleStatus.FIGHT_STATUS_BEGIN)
            {
            }
        }
Exemplo n.º 13
0
        /// <summary>
        // 刷怪接口
        /// </summary>
        static public void DaimonSquareSceneCreateMonster(DaimonSquareScene bcTmp, DaimonSquareDataInfo bcDataTmp)
        {
            if (bcTmp.m_nMonsterWave >= bcTmp.m_nMonsterTotalWave)
            {
                return;
            }

            // 置刷怪标记
            bcTmp.m_nCreateMonsterFlag = 1;

            string sMonsterNum       = null;
            string sMonsterID        = null;
            string sNeedSkillMonster = null;

            sMonsterNum       = bcDataTmp.MonsterNum[bcTmp.m_nMonsterWave];
            sMonsterID        = bcDataTmp.MonsterID[bcTmp.m_nMonsterWave];
            sNeedSkillMonster = bcDataTmp.CreateNextWaveMonsterCondition[bcTmp.m_nMonsterWave];

            if (sMonsterID == null || sMonsterNum == null || sNeedSkillMonster == null)
            {
                return;
            }

            string[] sNum  = null;
            string[] sID   = null;
            string[] sRate = null;

            sNum  = sMonsterNum.Split(',');
            sID   = sMonsterID.Split(',');
            sRate = sNeedSkillMonster.Split(',');

            if (sNum.Length != sID.Length)
            {
                return;
            }

            GameMap gameMap = null;

            if (!GameManager.MapMgr.DictMaps.TryGetValue(bcDataTmp.MapCode, out gameMap))
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("恶魔广场报错 地图配置 ID = {0}", bcDataTmp.MapCode));
                return;
            }

            int gridX = gameMap.CorrectWidthPointToGridPoint(bcDataTmp.posX) / gameMap.MapGridWidth;
            int gridY = gameMap.CorrectHeightPointToGridPoint(bcDataTmp.posZ) / gameMap.MapGridHeight;

            int gridNum = gameMap.CorrectWidthPointToGridPoint(bcDataTmp.Radius);

            for (int i = 0; i < sNum.Length; ++i)
            {
                int nNum = Global.SafeConvertToInt32(sNum[i]);
                int nID  = Global.SafeConvertToInt32(sID[i]);
                //System.Console.WriteLine("liaowei是帅哥  恶魔广场 i = {0}",i);
                for (int j = 0; j < nNum; ++j)
                {
                    GameManager.MonsterZoneMgr.AddDynamicMonsters(bcTmp.m_nMapCode, nID, -1, 1, gridX, gridY, gridNum);

                    //System.Console.WriteLine("liaowei是帅哥  恶魔广场 j = {0}", j);

                    ++bcTmp.m_nCreateMonsterCount;
                }
            }

            // 计数要杀死怪的数量
            bcTmp.m_nNeedKillMonsterNum = bcTmp.m_nCreateMonsterCount * Global.SafeConvertToInt32(sRate[0]) / 100;

            // 递增刷怪波数
            ++bcTmp.m_nMonsterWave;

            //System.Console.WriteLine("liaowei是帅哥  恶魔广场第{0}波 {1}只!!!", bcTmp.m_nMonsterWave, bcTmp.m_nCreateMonsterCount);

            // 恶魔广场怪物波和人物得分信息
            GameManager.ClientMgr.NotifyDaimonSquareMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, bcDataTmp.MapCode, (int)TCPGameServerCmds.CMD_SPR_QUERYDAIMONSQUAREMONSTERWAVEANDPOINTRINFO,
                                                        0, 0, bcDataTmp.MonsterID.Length - bcTmp.m_nMonsterWave, -100, 0);  // 只更新波数

            //System.Console.WriteLine("liaowei是帅哥  恶魔广场{0}里 刷第{1}波怪了 一共{3}只!!!", bcTmp.m_nMapCode, bcTmp.m_nMonsterWave, bcTmp.m_nCreateMonsterCount);

            return;
        }