Esempio n. 1
0
        /// <summary>
        /// 刷怪
        /// </summary>
        public void CreateMonster(HuanYingSiYuanScene scene, HuanYingSiYuanShengBeiContextData contextData = null)
        {
            int gridX = contextData.PosX / RuntimeData.MapGridWidth;
            int gridY = contextData.PosY / RuntimeData.MapGridHeight;

            GameManager.MonsterZoneMgr.AddDynamicMonsters(RuntimeData.MapCode, contextData.MonsterId, contextData.CopyMapID, 1, gridX, gridY, 0, 0, SceneUIClasses.HuanYingSiYuan, contextData);
        }
Esempio n. 2
0
        /// <summary>
        /// 玩家离开血色堡垒
        /// </summary>
        public void LeaveFuBen(GameClient client)
        {
            lock (Mutex)
            {
                TryLostShengBei(client);

                HuanYingSiYuanScene huanYingSiYuanScene = null;
                if (HuanYingSiYuanSceneDict.TryGetValue(client.ClientData.FuBenSeqID, out huanYingSiYuanScene))
                {
                    huanYingSiYuanScene.m_nPlarerCount--;

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

                    GameManager.ClientMgr.BroadSpecialCopyMapMessage((int)TCPGameServerCmds.CMD_SPR_HYSY_SCORE_INFO, huanYingSiYuanScene.ScoreInfoData, huanYingSiYuanScene.CopyMap);
                }
            }

            HuanYingSiYuanClient.getInstance().GameFuBenRoleChangeState(client.ClientData.RoleID, (int)KuaFuRoleStates.None);
        }
Esempio n. 3
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. 4
0
 private void TryLostShengBei(GameClient client)
 {
     lock (Mutex)
     {
         HuanYingSiYuanScene huanYingSiYuanScene = null;
         if (HuanYingSiYuanSceneDict.TryGetValue(client.ClientData.FuBenSeqID, out huanYingSiYuanScene))
         {
             HuanYingSiYuanShengBeiContextData contextData = LostShengBei(client);
             if (null != contextData)
             {
                 contextData.OwnerRoleId = 0;
                 huanYingSiYuanScene.ShengBeiContextDict.Remove(contextData.UniqueId);
                 CreateMonster(huanYingSiYuanScene, contextData);
             }
         }
     }
 }
Esempio n. 5
0
        private void GetShengBei(HuanYingSiYuanScene huanYingSiYuanScene, GameClient client, HuanYingSiYuanShengBeiContextData contextData)
        {
            if (null != contextData)
            {
                lock (Mutex)
                {
                    client.SceneContextData = contextData;
                    huanYingSiYuanScene.ShengBeiContextDict[contextData.UniqueId] = contextData;

                    //设置拥有者的buffer
                    client.ClientData.PropsCacheManager.SetExtProps(PropsSystemTypes.HysyShengBei, contextData.BufferProps);
                    double[] actionParams = new double[2] {
                        contextData.BufferGoodsId, RuntimeData.HoldShengBeiSecs
                    };
                    Global.UpdateBufferData(client, BufferItemTypes.HysyShengBei, actionParams);
                }
            }
        }
Esempio n. 6
0
        private void CheckShengBeiBufferTime(HuanYingSiYuanScene huanYingSiYuanScene, long nowTicks)
        {
            List <HuanYingSiYuanShengBeiContextData> shengBeiList = new List <HuanYingSiYuanShengBeiContextData>();

            lock (Mutex)
            {
                if (huanYingSiYuanScene.m_eStatus == GameSceneStatuses.STATUS_BEGIN)
                {
                    if (huanYingSiYuanScene.ShengBeiContextDict.Count > 0)
                    {
                        foreach (var contextData in huanYingSiYuanScene.ShengBeiContextDict.Values)
                        {
                            //处理超时情况
                            if (contextData.EndTicks < nowTicks)
                            {
                                shengBeiList.Add(contextData);
                                if (contextData.OwnerRoleId != 0)
                                {
                                    GameClient client = GameManager.ClientMgr.FindClient(contextData.OwnerRoleId);
                                    if (null != client)
                                    {
                                        LostShengBei(client);
                                    }
                                }

                                contextData.OwnerRoleId = 0;
                                CreateMonster(huanYingSiYuanScene, contextData);
                            }
                        }
                    }

                    if (shengBeiList.Count > 0)
                    {
                        foreach (var contextData in shengBeiList)
                        {
                            huanYingSiYuanScene.ShengBeiContextDict.Remove(contextData.UniqueId);
                        }
                    }
                }
            }
        }
Esempio n. 7
0
        public void OnCaiJiFinish(GameClient client, Monster monster)
        {
            HuanYingSiYuanShengBeiContextData contextData = monster.Tag as HuanYingSiYuanShengBeiContextData;
            HuanYingSiYuanScene huanYingSiYuanScene       = null;
            CopyMap             copyMap = null;

            if (null != contextData)
            {
                long endTicks = TimeUtil.NOW() + RuntimeData.HoldShengBeiSecs * TimeUtil.SECOND;
                lock (Mutex)
                {
                    contextData.OwnerRoleId = client.ClientData.RoleID;
                    contextData.EndTicks    = endTicks;
                    if (HuanYingSiYuanSceneDict.TryGetValue(contextData.FuBenSeqId, out huanYingSiYuanScene))
                    {
                        if (huanYingSiYuanScene.m_eStatus == GameSceneStatuses.STATUS_BEGIN)
                        {
                            GetShengBei(huanYingSiYuanScene, client, contextData);
                        }
                    }
                }
            }
        }
Esempio n. 8
0
        /// <summary>
        /// 给奖励
        /// </summary>
        public void GiveAwards(HuanYingSiYuanScene huanYingSiYuanScene)
        {
            try
            {
                List <GameClient> objsList = huanYingSiYuanScene.CopyMap.GetClientsList();
                if (objsList != null && objsList.Count > 0)
                {
                    int nowDayId = Global.GetOffsetDayNow();
                    for (int n = 0; n < objsList.Count; ++n)
                    {
                        GameClient client = objsList[n];
                        if (client != null && client == GameManager.ClientMgr.FindClient(client.ClientData.RoleID)) //确认角色仍然在线
                        {
                            bool   success    = false;
                            double nMultiple  = 0.5;
                            int    awardsRate = 1;
                            int    count      = 0;

                            HuanYingSiYuanLianShaContextData clientLianShaContextData = client.SceneContextData2 as HuanYingSiYuanLianShaContextData;
                            if (null != clientLianShaContextData && clientLianShaContextData.TotalScore >= RuntimeData.TempleMirageMinJiFen)
                            {
                                if (client.ClientData.BattleWhichSide == huanYingSiYuanScene.SuccessSide)
                                {
                                    success   = true;
                                    nMultiple = 1;

                                    //每日前3次享受10倍奖励
                                    int dayid = Global.GetRoleParamsInt32FromDB(client, RoleParamName.HysySuccessDayId);
                                    if (dayid == nowDayId)
                                    {
                                        count = Global.GetRoleParamsInt32FromDB(client, RoleParamName.HysySuccessCount);
                                        if (count < RuntimeData.TempleMirageWinExtraNum)
                                        {
                                            awardsRate = RuntimeData.TempleMirageWinExtraRate;
                                        }
                                    }
                                    else
                                    {
                                        awardsRate = RuntimeData.TempleMirageWinExtraRate;
                                    }
                                }
                            }
                            else
                            {
                                //达不到最低分数,无奖励,不计次
                                nMultiple  = 0;
                                awardsRate = 0;
                            }

                            // 公式
                            long nExp           = (long)(RuntimeData.TempleMirageEXPAward * nMultiple * client.ClientData.ChangeLifeCount);
                            int  chengJiuaward  = (int)(RuntimeData.TempleMirageAwardChengJiu * nMultiple);
                            int  shengWangaward = (int)(RuntimeData.TempleMirageAwardShengWang * nMultiple);

                            if (nExp > 0)
                            {
                                GameManager.ClientMgr.ProcessRoleExperience(client, nExp * awardsRate, false);
                                //GameManager.ClientMgr.NotifyAddExpMsg(client, nExp); //客户端自己提示,有显示"X10"的需求
                            }

                            if (chengJiuaward > 0)
                            {
                                ChengJiuManager.AddChengJiuPoints(client, "幻影寺院获得成就", chengJiuaward * awardsRate, true, true);
                            }

                            if (shengWangaward > 0)
                            {
                                GameManager.ClientMgr.ModifyShengWangValue(client, shengWangaward * awardsRate, "幻影寺院获得声望");
                            }

                            HuanYingSiYuanAwardsData awardsData = new HuanYingSiYuanAwardsData()
                            {
                                SuccessSide   = huanYingSiYuanScene.SuccessSide,
                                Exp           = nExp,
                                ShengWang     = shengWangaward,
                                ChengJiuAward = chengJiuaward,
                                AwardsRate    = awardsRate,
                            };

                            if (success)
                            {
                                if (nMultiple > 0)
                                {
                                    Global.SaveRoleParamsInt32ValueToDB(client, RoleParamName.HysySuccessDayId, nowDayId, true);
                                    Global.SaveRoleParamsInt32ValueToDB(client, RoleParamName.HysySuccessCount, count + 1, true);

                                    GlobalNew.UpdateKuaFuRoleDayLogData(client.ServerId, client.ClientData.RoleID, TimeUtil.NowDateTime(), client.ClientData.ZoneID, 0, 0, 1, 0, (int)GameTypes.HuanYingSiYuan);
                                    if (huanYingSiYuanScene.ScoreInfoData.Score1 >= 1000 || huanYingSiYuanScene.ScoreInfoData.Score2 >= 1000)
                                    {
                                        //FaildCount记录为获得够1000分而获胜的人次
                                        GlobalNew.UpdateKuaFuRoleDayLogData(client.ServerId, client.ClientData.RoleID, TimeUtil.NowDateTime(), client.ClientData.ZoneID, 0, 0, 0, 1, (int)GameTypes.HuanYingSiYuan);
                                    }
                                }
                            }
                            else
                            {
                                //FaildCount记录为失败人次
                                //GlobalNew.UpdateKuaFuRoleDayLogData(client.ServerId, client.ClientData.RoleID, TimeUtil.NowDateTime(), client.ClientData.ZoneID, 0, 0, 0, 1);
                            }

                            client.sendCmd((int)TCPGameServerCmds.CMD_SPR_HYSY_AWARD, awardsData);
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                DataHelper.WriteExceptionLogEx(ex, "幻影寺院清场调度异常");
            }
        }
Esempio n. 9
0
 public void CompleteHuanYingSiYuanScene(HuanYingSiYuanScene huanYingSiYuanScene, int successSide)
 {
     huanYingSiYuanScene.m_eStatus   = GameSceneStatuses.STATUS_END;
     huanYingSiYuanScene.SuccessSide = successSide;
 }