예제 #1
0
        public void FortDead(Monster fortMonster)
        {
            CreateMonsterTagInfo tagInfo = fortMonster.Tag as CreateMonsterTagInfo;

            if (tagInfo != null)
            {
                int fubebSeqID = tagInfo.FuBenSeqId;
                if (fubebSeqID >= 0 && fortMonster.CopyMapID >= 0 && this.IsCopyWolf(fortMonster.CurrentMapCode))
                {
                    CopyWolfSceneInfo scene = null;
                    if (this._runtimeData.SceneDict.TryGetValue(fubebSeqID, out scene) && scene != null)
                    {
                        if (scene.SceneStatus < GameSceneStatuses.STATUS_END)
                        {
                            lock (scene)
                            {
                                scene.SceneStatus           = GameSceneStatuses.STATUS_END;
                                scene.ScoreData.FortLifeNow = 0;
                                GameManager.ClientMgr.BroadSpecialCopyMapMessage <CopyWolfScoreData>(1025, scene.ScoreData, scene.CopyMapInfo);
                            }
                        }
                    }
                }
            }
        }
예제 #2
0
 public void MonsterDead(GameClient client, Monster monster)
 {
     if (client.ClientData.FuBenSeqID >= 0 && client.ClientData.CopyMapID >= 0 && this.IsCopyWolf(client.ClientData.FuBenID))
     {
         CopyWolfSceneInfo scene = null;
         if (this._runtimeData.SceneDict.TryGetValue(client.ClientData.FuBenSeqID, out scene) && scene != null)
         {
             if (scene.AddKilledMonster(monster))
             {
                 if (scene.SceneStatus < GameSceneStatuses.STATUS_END)
                 {
                     lock (scene)
                     {
                         int score = scene.AddMonsterScore(client.ClientData.RoleID, monster.MonsterInfo.WolfScore);
                         scene.ScoreData.RoleMonsterScore = scene.RoleMonsterScore;
                         GameManager.ClientMgr.BroadSpecialCopyMapMessage <CopyWolfScoreData>(1025, scene.ScoreData, scene.CopyMapInfo);
                         if (scene.IsMonsterFlag == 1 && scene.KilledMonsterHashSet.Count == scene.MonsterCountCreate)
                         {
                             scene.MonsterWaveOld = scene.MonsterWave;
                             if (scene.MonsterWave >= scene.MonsterWaveTotal)
                             {
                                 scene.SceneStatus = GameSceneStatuses.STATUS_END;
                             }
                             else
                             {
                                 scene.IsMonsterFlag = 0;
                             }
                         }
                     }
                 }
             }
         }
     }
 }
예제 #3
0
        public void FortDead(Monster fortMonster)
        {
            CreateMonsterTagInfo tagInfo = fortMonster.Tag as CreateMonsterTagInfo;

            if (tagInfo == null)
            {
                return;
            }

            int fubebSeqID = tagInfo.FuBenSeqId;

            if (fubebSeqID < 0 || fortMonster.CopyMapID < 0 || !IsCopyWolf(fortMonster.CurrentMapCode))
            {
                return;
            }

            CopyWolfSceneInfo scene = null;

            if (!_runtimeData.SceneDict.TryGetValue(fubebSeqID, out scene) || scene == null)
            {
                return;
            }
            if (scene.SceneStatus >= GameSceneStatuses.STATUS_END)
            {
                return;
            }

            lock (scene)
            {
                scene.SceneStatus           = GameSceneStatuses.STATUS_END;
                scene.ScoreData.FortLifeNow = 0;
                GameManager.ClientMgr.BroadSpecialCopyMapMessage((int)TCPGameServerCmds.CMD_SPR_COPY_WOLF_SCORE_INFO, scene.ScoreData, scene.CopyMapInfo);
            }//lock
        }
예제 #4
0
        /// <summary>
        /// 玩家离开
        /// </summary>
        public void LeaveFuBen(GameClient client)
        {
            //ElementWarClient.getInstance().GameFuBenRoleChangeState(client.ClientData.RoleID, (int)KuaFuRoleStates.None);

            CopyWolfSceneInfo scene = null;

            lock (_runtimeData.SceneDict)
            {
                if (!_runtimeData.SceneDict.TryGetValue(client.ClientData.FuBenSeqID, out scene))
                {
                    return;
                }
            }

            lock (scene)
            {
                scene.PlayerCount--;
                if (scene.SceneStatus != GameSceneStatuses.STATUS_END &&
                    scene.SceneStatus != GameSceneStatuses.STATUS_AWARD &&
                    scene.SceneStatus != GameSceneStatuses.STATUS_CLEAR)
                {
                    KuaFuManager.getInstance().SetCannotJoinKuaFu_UseAutoEndTicks(client);
                }
            }
        }
예제 #5
0
        public void MonsterDead(Monster monster)
        {
            CreateMonsterTagInfo tagInfo = monster.Tag as CreateMonsterTagInfo;

            if (tagInfo == null)
            {
                return;
            }

            int fubebSeqID = tagInfo.FuBenSeqId;

            if (fubebSeqID < 0 || monster.CopyMapID < 0 || !IsCopyWolf(monster.CurrentMapCode))
            {
                return;
            }

            CopyWolfSceneInfo scene = null;

            if (!_runtimeData.SceneDict.TryGetValue(fubebSeqID, out scene) || scene == null)
            {
                return;
            }
            if (scene.SceneStatus >= GameSceneStatuses.STATUS_END)
            {
                return;
            }

            //如果是重复记录击杀同一只怪,则直接返回
            if (!scene.AddKilledMonster(monster))
            {
                return;
            }

            if (scene.SceneStatus >= GameSceneStatuses.STATUS_END)
            {
                return;
            }

            lock (scene)
            {
                if (scene.IsMonsterFlag == 1 && scene.KilledMonsterHashSet.Count == scene.MonsterCountCreate)
                {
                    scene.MonsterWaveOld = scene.MonsterWave;
                    if (scene.MonsterWave >= scene.MonsterWaveTotal)
                    {
                        scene.SceneStatus = GameSceneStatuses.STATUS_END;
                    }
                    else
                    {
                        scene.IsMonsterFlag = 0;
                    }
                }
            }//lock
        }
예제 #6
0
 public void processEvent(EventObjectEx eventObject)
 {
     if (eventObject.EventType == 30)
     {
         OnCreateMonsterEventObject e = eventObject as OnCreateMonsterEventObject;
         if (null != e)
         {
             CreateMonsterTagInfo tagInfo = e.Monster.Tag as CreateMonsterTagInfo;
             if (null != tagInfo)
             {
                 e.Monster.AllwaySearchEnemy = true;
                 if (tagInfo.IsFort)
                 {
                     e.Monster.Camp = this._runtimeData.CampID;
                 }
                 e.Result  = true;
                 e.Handled = true;
             }
         }
     }
     if (eventObject.EventType == 33)
     {
         PreMonsterInjureEventObject obj = eventObject as PreMonsterInjureEventObject;
         if (obj != null && obj.SceneType == 34)
         {
             Monster attacker    = obj.Attacker as Monster;
             Monster fortMonster = obj.Monster;
             if (attacker != null && fortMonster != null)
             {
                 CreateMonsterTagInfo tagInfo = fortMonster.Tag as CreateMonsterTagInfo;
                 if (tagInfo != null && tagInfo.IsFort)
                 {
                     int fubebSeqID = tagInfo.FuBenSeqId;
                     if (fubebSeqID > 0)
                     {
                         CopyWolfSceneInfo scene = null;
                         if (this._runtimeData.SceneDict.TryGetValue(fubebSeqID, out scene) && scene != null)
                         {
                             int injure   = this._runtimeData.GetMonsterHurt(attacker.MonsterInfo.ExtensionID);
                             int fortLife = (int)Math.Max(0.0, fortMonster.VLife - (double)injure);
                             scene.ScoreData.FortLifeNow = fortLife;
                             scene.ScoreData.FortLifeMax = (int)fortMonster.MonsterInfo.VLifeMax;
                             GameManager.ClientMgr.BroadSpecialCopyMapMessage <CopyWolfScoreData>(1025, scene.ScoreData, scene.CopyMapInfo);
                             obj.Injure          = injure;
                             eventObject.Handled = true;
                             eventObject.Result  = true;
                         }
                     }
                 }
             }
         }
     }
 }
예제 #7
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);
            }
        }
예제 #8
0
        /// <summary>
        // 杀怪接口
        /// </summary>
        public void MonsterDead(GameClient client, Monster monster)
        {
            //if(client == null && monster.SceneType == (int)SceneUIClasses.CopyWolf)
            //    scene.AddKilledMonster(monster))

            if (client.ClientData.FuBenSeqID < 0 || client.ClientData.CopyMapID < 0 || !IsCopyWolf(client.ClientData.FuBenID))
            {
                return;
            }

            CopyWolfSceneInfo scene = null;

            if (!_runtimeData.SceneDict.TryGetValue(client.ClientData.FuBenSeqID, out scene) || scene == null)
            {
                return;
            }

            //如果是重复记录击杀同一只怪,则直接返回
            if (!scene.AddKilledMonster(monster))
            {
                return;
            }

            if (scene.SceneStatus >= GameSceneStatuses.STATUS_END)
            {
                return;
            }

            lock (scene)
            {
                //scene.MonsterCountKill++;
                //====Monsters===
                //int score = scene.AddMonsterScore(client.ClientData.RoleID, monster.MonsterInfo.WolfScore);
                //scene.ScoreData.RoleMonsterScore = scene.RoleMonsterScore;

                ////scene.ScoreData.MonsterCount -= 1;
                ////scene.ScoreData.MonsterCount = scene.ScoreData.MonsterCount < 0 ? 0 : scene.ScoreData.MonsterCount;
                //GameManager.ClientMgr.BroadSpecialCopyMapMessage((int)TCPGameServerCmds.CMD_SPR_COPY_WOLF_SCORE_INFO, scene.ScoreData, scene.CopyMapInfo);

                //if (scene.IsMonsterFlag == 1 && scene.KilledMonsterHashSet.Count == scene.MonsterCountCreate)
                //{
                //    scene.MonsterWaveOld = scene.MonsterWave;
                //    if (scene.MonsterWave >= scene.MonsterWaveTotal)
                //        scene.SceneStatus = GameSceneStatuses.STATUS_END;
                //    else
                //        scene.IsMonsterFlag = 0;
                //}
            }//lock
        }
예제 #9
0
        /// <summary>
        /// 添加一个场景
        /// </summary>
        public bool AddCopyScene(GameClient client, CopyMap copyMap)
        {
            if (copyMap.MapCode == _runtimeData.MapID)
            {
                int fuBenSeqId = copyMap.FuBenSeqID;
                int mapCode    = copyMap.MapCode;
                lock (_mutex)
                {
                    CopyWolfSceneInfo newScene = null;
                    if (!_runtimeData.SceneDict.TryGetValue(fuBenSeqId, out newScene))
                    {
                        newScene             = new CopyWolfSceneInfo();
                        newScene.CopyMapInfo = copyMap;
                        newScene.CleanAllInfo();
                        newScene.GameId      = Global.GetClientKuaFuServerLoginData(client).GameId;
                        newScene.MapID       = mapCode;
                        newScene.CopyID      = copyMap.CopyMapID;
                        newScene.FuBenSeqId  = fuBenSeqId;
                        newScene.PlayerCount = 1;

                        _runtimeData.SceneDict[fuBenSeqId] = newScene;
                    }
                    else
                    {
                        newScene.PlayerCount++;
                    }

                    client.ClientData.BattleWhichSide = _runtimeData.CampID;
                    copyMap.IsKuaFuCopy = true;
                    copyMap.SetRemoveTicks(TimeUtil.NOW() + _runtimeData.TotalSecs * TimeUtil.SECOND);
                    GameManager.ClientMgr.BroadSpecialCopyMapMessage((int)TCPGameServerCmds.CMD_SPR_COPY_WOLF_SCORE_INFO, newScene.ScoreData, newScene.CopyMapInfo);
                }

                //更新状态
                // ElementWarClient.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)_gameType);

                return(true);
            }

            return(false);
        }
예제 #10
0
        public void LeaveFuBen(GameClient client)
        {
            CopyWolfSceneInfo scene = null;

            lock (this._runtimeData.SceneDict)
            {
                if (!this._runtimeData.SceneDict.TryGetValue(client.ClientData.FuBenSeqID, out scene))
                {
                    return;
                }
            }
            lock (scene)
            {
                scene.PlayerCount--;
                if (scene.SceneStatus != GameSceneStatuses.STATUS_END && scene.SceneStatus != GameSceneStatuses.STATUS_AWARD && scene.SceneStatus != GameSceneStatuses.STATUS_CLEAR)
                {
                    KuaFuManager.getInstance().SetCannotJoinKuaFu_UseAutoEndTicks(client);
                }
            }
        }
예제 #11
0
        public bool AddCopyScene(GameClient client, CopyMap copyMap)
        {
            bool result;

            if (copyMap.MapCode == this._runtimeData.MapID)
            {
                int fuBenSeqId = copyMap.FuBenSeqID;
                int mapCode    = copyMap.MapCode;
                lock (CopyWolfManager._mutex)
                {
                    CopyWolfSceneInfo newScene = null;
                    if (!this._runtimeData.SceneDict.TryGetValue(fuBenSeqId, out newScene))
                    {
                        newScene             = new CopyWolfSceneInfo();
                        newScene.CopyMapInfo = copyMap;
                        newScene.CleanAllInfo();
                        newScene.GameId      = Global.GetClientKuaFuServerLoginData(client).GameId;
                        newScene.MapID       = mapCode;
                        newScene.CopyID      = copyMap.CopyMapID;
                        newScene.FuBenSeqId  = fuBenSeqId;
                        newScene.PlayerCount = 1;
                        this._runtimeData.SceneDict[fuBenSeqId] = newScene;
                    }
                    else
                    {
                        newScene.PlayerCount++;
                    }
                    client.ClientData.BattleWhichSide = this._runtimeData.CampID;
                    copyMap.IsKuaFuCopy = true;
                    copyMap.SetRemoveTicks(TimeUtil.NOW() + (long)(this._runtimeData.TotalSecs * 1000));
                    GameManager.ClientMgr.BroadSpecialCopyMapMessage <CopyWolfScoreData>(1025, newScene.ScoreData, newScene.CopyMapInfo);
                }
                GlobalNew.UpdateKuaFuRoleDayLogData(client.ServerId, client.ClientData.RoleID, TimeUtil.NowDateTime(), client.ClientData.ZoneID, 0, 1, 0, 0, 11);
                result = true;
            }
            else
            {
                result = false;
            }
            return(result);
        }
예제 #12
0
        public void MonsterDead(Monster monster)
        {
            CreateMonsterTagInfo tagInfo = monster.Tag as CreateMonsterTagInfo;

            if (tagInfo != null)
            {
                int fubebSeqID = tagInfo.FuBenSeqId;
                if (fubebSeqID >= 0 && monster.CopyMapID >= 0 && this.IsCopyWolf(monster.CurrentMapCode))
                {
                    CopyWolfSceneInfo scene = null;
                    if (this._runtimeData.SceneDict.TryGetValue(fubebSeqID, out scene) && scene != null)
                    {
                        if (scene.SceneStatus < GameSceneStatuses.STATUS_END)
                        {
                            if (scene.AddKilledMonster(monster))
                            {
                                if (scene.SceneStatus < GameSceneStatuses.STATUS_END)
                                {
                                    lock (scene)
                                    {
                                        if (scene.IsMonsterFlag == 1 && scene.KilledMonsterHashSet.Count == scene.MonsterCountCreate)
                                        {
                                            scene.MonsterWaveOld = scene.MonsterWave;
                                            if (scene.MonsterWave >= scene.MonsterWaveTotal)
                                            {
                                                scene.SceneStatus = GameSceneStatuses.STATUS_END;
                                            }
                                            else
                                            {
                                                scene.IsMonsterFlag = 0;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
예제 #13
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);
                            }
                        }
                    }
                }
            }
        }
예제 #14
0
        public void processEvent(EventObjectEx eventObject)
        {
            if (eventObject.EventType == (int)EventTypes.OnCreateMonster)
            {
                OnCreateMonsterEventObject e = eventObject as OnCreateMonsterEventObject;
                if (null != e)
                {
                    CreateMonsterTagInfo tagInfo = e.Monster.Tag as CreateMonsterTagInfo;
                    if (null != tagInfo)
                    {
                        e.Monster.AllwaySearchEnemy = true;
                        if (tagInfo.IsFort)
                        {
                            e.Monster.Camp = _runtimeData.CampID;
                        }

                        e.Result  = true;
                        e.Handled = true;
                    }
                }
            }

            if (eventObject.EventType == (int)EventTypes.PreMonsterInjure)
            {
                PreMonsterInjureEventObject obj = eventObject as PreMonsterInjureEventObject;
                if (obj != null && obj.SceneType == (int)SceneUIClasses.CopyWolf)
                {
                    Monster attacker    = obj.Attacker as Monster;
                    Monster fortMonster = obj.Monster;

                    if (attacker == null || fortMonster == null)
                    {
                        return;
                    }

                    CreateMonsterTagInfo tagInfo = fortMonster.Tag as CreateMonsterTagInfo;
                    if (tagInfo != null)
                    {
                        int fubebSeqID = tagInfo.FuBenSeqId;
                        //int.TryParse(fortMonster.Tag.ToString(), out fubebSeqID);
                        if (fubebSeqID <= 0)
                        {
                            return;
                        }

                        CopyWolfSceneInfo scene = null;
                        if (!_runtimeData.SceneDict.TryGetValue(fubebSeqID, out scene) || scene == null)
                        {
                            return;
                        }
                        //====Monsters===
                        //int injure = _runtimeData.GetMonsterHurt(attacker.MonsterInfo.ExtensionID);
                        ////injure = 1;
                        //int fortLife = (int)Math.Max(0, fortMonster.VLife - injure);
                        //scene.ScoreData.FortLifeNow = fortLife;
                        //scene.ScoreData.FortLifeMax = (int)fortMonster.MonsterInfo.VLifeMax;
                        //GameManager.ClientMgr.BroadSpecialCopyMapMessage((int)TCPGameServerCmds.CMD_SPR_COPY_WOLF_SCORE_INFO, scene.ScoreData, scene.CopyMapInfo);

                        // obj.Injure = injure;
                        eventObject.Handled = true;
                        eventObject.Result  = true;
                    }
                }
            }
        }
예제 #15
0
        /// <summary>
        /// 给奖励
        /// </summary>
        public void GiveAwards(CopyWolfSceneInfo scene, int leftSecond)
        {
            try
            {
                FuBenMapItem fuBenMapItem = FuBenManager.FindMapCodeByFuBenID(scene.CopyMapInfo.FubenMapID, scene.MapID);
                if (fuBenMapItem == null)
                {
                    return;
                }

                int zhanLi = 0;
                List <GameClient> objsList = scene.CopyMapInfo.GetClientsList();
                if (objsList != null && objsList.Count > 0)
                {
                    for (int n = 0; n < objsList.Count; ++n)
                    {
                        GameClient client = objsList[n];
                        if (client != null && client == GameManager.ClientMgr.FindClient(client.ClientData.RoleID)) //确认角色仍然在线
                        {
                            int wave = scene.MonsterWaveOld;
                            if (wave > scene.MonsterWaveTotal)
                            {
                                wave = scene.MonsterWaveTotal;
                            }

                            int scoreMonster = scene.GetMonsterScore(client.ClientData.RoleID);
                            int life         = scene.ScoreData.FortLifeNow;
                            int scoreAll     = GetScore(scoreMonster, leftSecond, life);

                            // 公式
                            long nExp      = AwardExp(fuBenMapItem.Experience, scoreAll);
                            int  money     = AwardGoldBind(fuBenMapItem.Money1, scoreAll);
                            int  wolfMoney = AwardWolfMoney(fuBenMapItem.WolfMoney, scoreAll);

                            if (nExp > 0)
                            {
                                GameManager.ClientMgr.ProcessRoleExperience(client, nExp, false);
                            }

                            if (money > 0)
                            {
                                GameManager.ClientMgr.AddMoney1(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, money, string.Format("副本{0}通关奖励", scene.CopyID), false);
                            }

                            if (wolfMoney > 0)
                            {
                                GameManager.ClientMgr.ModifyLangHunFenMoValue(client, wolfMoney, "狼魂要塞", true);
                            }

                            CopyWolfAwardsData awardsData = new CopyWolfAwardsData()
                            {
                                Wave      = scene.MonsterWaveOld,
                                Exp       = nExp,
                                Money     = money,
                                WolfMoney = wolfMoney,
                                RoleScore = scene.GetMonsterScore(client.ClientData.RoleID)
                            };

                            //AddElementWarCount(client);
                            GlobalNew.UpdateKuaFuRoleDayLogData(client.ServerId, client.ClientData.RoleID, TimeUtil.NowDateTime(), client.ClientData.ZoneID, 0, 0, 1, 0, (int)_gameType);

                            client.sendCmd((int)TCPGameServerCmds.CMD_SPR_COPY_WOLF_AWARD, awardsData);

                            zhanLi += client.ClientData.CombatForce;
                            Global.UpdateFuBenDataForQuickPassTimer(client, scene.CopyMapInfo.FubenMapID, 0, 1);
                        }
                    }
                }

                int roleCount = 0;
                if (objsList != null && objsList.Count > 0)
                {
                    roleCount = objsList.Count;
                    zhanLi    = zhanLi / roleCount;
                }

                // ElementWarClient.getInstance().UpdateCopyPassEvent(scene.FuBenSeqId, roleCount, scene.MonsterWaveOld, zhanLi);
            }
            catch (System.Exception ex)
            {
                DataHelper.WriteExceptionLogEx(ex, "【狼魂要塞】清场调度异常");
            }
        }
예제 #16
0
 public void GiveAwards(CopyWolfSceneInfo scene, int leftSecond)
 {
     try
     {
         FuBenMapItem fuBenMapItem = FuBenManager.FindMapCodeByFuBenID(scene.CopyMapInfo.FubenMapID, scene.MapID);
         if (fuBenMapItem != null)
         {
             int zhanLi = 0;
             List <GameClient> objsList = scene.CopyMapInfo.GetClientsList();
             if (objsList != null && objsList.Count > 0)
             {
                 for (int i = 0; i < objsList.Count; i++)
                 {
                     GameClient client = objsList[i];
                     if (client != null && client == GameManager.ClientMgr.FindClient(client.ClientData.RoleID))
                     {
                         int wave = scene.MonsterWaveOld;
                         if (wave > scene.MonsterWaveTotal)
                         {
                             wave = scene.MonsterWaveTotal;
                         }
                         int  scoreMonster = scene.GetMonsterScore(client.ClientData.RoleID);
                         int  life         = scene.ScoreData.FortLifeNow;
                         int  scoreAll     = this.GetScore(scoreMonster, leftSecond, life);
                         long nExp         = (long)this.AwardExp(fuBenMapItem.Experience, scoreAll);
                         int  money        = this.AwardGoldBind(fuBenMapItem.Money1, scoreAll);
                         int  wolfMoney    = this.AwardWolfMoney(fuBenMapItem.WolfMoney, scoreAll);
                         if (nExp > 0L)
                         {
                             GameManager.ClientMgr.ProcessRoleExperience(client, nExp, false, true, false, "none");
                         }
                         if (money > 0)
                         {
                             GameManager.ClientMgr.AddMoney1(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, money, string.Format("副本{0}通关奖励", scene.CopyID), false);
                         }
                         if (wolfMoney > 0)
                         {
                             GameManager.ClientMgr.ModifyLangHunFenMoValue(client, wolfMoney, "狼魂要塞", true, true);
                         }
                         CopyWolfAwardsData awardsData = new CopyWolfAwardsData
                         {
                             Wave      = scene.MonsterWaveOld,
                             Exp       = nExp,
                             Money     = money,
                             WolfMoney = wolfMoney,
                             RoleScore = scene.GetMonsterScore(client.ClientData.RoleID)
                         };
                         GlobalNew.UpdateKuaFuRoleDayLogData(client.ServerId, client.ClientData.RoleID, TimeUtil.NowDateTime(), client.ClientData.ZoneID, 0, 0, 1, 0, 11);
                         client.sendCmd <CopyWolfAwardsData>(1026, awardsData, false);
                         zhanLi += client.ClientData.CombatForce;
                         Global.UpdateFuBenDataForQuickPassTimer(client, scene.CopyMapInfo.FubenMapID, 0, 1);
                     }
                 }
             }
             if (objsList != null && objsList.Count > 0)
             {
                 int roleCount = objsList.Count;
                 zhanLi /= roleCount;
             }
         }
     }
     catch (Exception ex)
     {
         DataHelper.WriteExceptionLogEx(ex, "【狼魂要塞】清场调度异常");
     }
 }
예제 #17
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);
                        }
                    }
                }
            }
        }
예제 #18
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);
            }
        }