Ejemplo n.º 1
0
        public static void GetWanmotaSweepReward(GameClient client, int nFubenID)
        {
            FuBenMapItem fuBenMapItem = FuBenManager.FindMapCodeByFuBenID(nFubenID, nFubenID);

            if (null != fuBenMapItem)
            {
                List <GoodsData> goodNormal = new List <GoodsData>();
                List <int>       goodsID    = new List <int>();
                WanMotaCopySceneManager.GetFubenItemReward(client, fuBenMapItem, false, goodNormal, goodsID);
                if (null == client.ClientData.LayerRewardData)
                {
                    client.ClientData.LayerRewardData = new LayerRewardData();
                }
                if (WanMotaCopySceneManager.IsWanMoTaMapCode(nFubenID))
                {
                    List <SingleLayerRewardData> listRewardData = null;
                    SingleLayerRewardData        layerReward    = WanMotaCopySceneManager.AddSingleSweepReward(client, goodNormal, nFubenID - WanMotaCopySceneManager.nWanMoTaFirstFuBenOrder + 1, fuBenMapItem.Experience, fuBenMapItem.Money1, fuBenMapItem.nXingHunAward, out listRewardData);
                    SweepWanMotaManager.UpdataSweepInfo(client, listRewardData);
                    lock (client.ClientData.LayerRewardData)
                    {
                        client.ClientData.LayerRewardData.WanMoTaLayerRewardList.Add(layerReward);
                    }
                }
            }
        }
Ejemplo n.º 2
0
 public static void GetFubenItemReward(GameClient client, FuBenMapItem fuBenMapItem, bool bFirstPass, List <GoodsData> goodNormal, List <int> GoodsIDList)
 {
     if (bFirstPass)
     {
         if (null != fuBenMapItem.FirstGoodsDataList)
         {
             for (int i = 0; i < fuBenMapItem.FirstGoodsDataList.Count; i++)
             {
                 goodNormal.Add(fuBenMapItem.FirstGoodsDataList[i]);
                 GoodsIDList.Add(fuBenMapItem.FirstGoodsDataList[i].GoodsID);
             }
         }
     }
     else
     {
         if (null != fuBenMapItem.GoodsDataList)
         {
             for (int i = 0; i < fuBenMapItem.GoodsDataList.Count; i++)
             {
                 goodNormal.Add(new GoodsData(fuBenMapItem.GoodsDataList[i]));
                 GoodsIDList.Add(fuBenMapItem.GoodsDataList[i].GoodsID);
             }
         }
         WanMotaCopySceneManager.GetBossReward(client, fuBenMapItem.FuBenID, goodNormal, GoodsIDList);
     }
 }
        /// <summary>
        /// 获取物品通关的物品奖励
        /// </summary>
        /// <param name="client"></param>
        public static void GetFubenItemReward(GameClient client, FuBenMapItem fuBenMapItem, bool bFirstPass, List <GoodsData> goodNormal, List <int> GoodsIDList)
        {
            // 首次通关物品奖励
            if (bFirstPass)
            {
                if (null != fuBenMapItem.FirstGoodsDataList)
                {
                    for (int j = 0; j < fuBenMapItem.FirstGoodsDataList.Count; ++j)
                    {
                        goodNormal.Add(fuBenMapItem.FirstGoodsDataList[j]);
                        GoodsIDList.Add(fuBenMapItem.FirstGoodsDataList[j].GoodsID);
                    }
                }
            }
            // 扫荡时的Boss奖励
            else
            {
                // 普通通关物品奖励
                if (null != fuBenMapItem.GoodsDataList)
                {
                    for (int j = 0; j < fuBenMapItem.GoodsDataList.Count; ++j)
                    {
                        goodNormal.Add(new GoodsData(fuBenMapItem.GoodsDataList[j]));
                        GoodsIDList.Add(fuBenMapItem.GoodsDataList[j].GoodsID);
                    }
                }

                GetBossReward(client, fuBenMapItem.FuBenID, goodNormal, GoodsIDList);
            }
        }
Ejemplo n.º 4
0
 public static void SendMsgToClientForWanMoTaCopyMapAward(GameClient client, CopyMap copyMap, bool anyAlive)
 {
     if (copyMap != null)
     {
         int fuBenSeqID = FuBenManager.FindFuBenSeqIDByRoleID(client.ClientData.RoleID);
         FuBenTongGuanData fubenTongGuanData = null;
         bool bFirstPassWanMoTa = false;
         if (fuBenSeqID > 0)
         {
             FuBenInfoItem fuBenInfoItem = FuBenManager.FindFuBenInfoBySeqID(fuBenSeqID);
             if (null != fuBenInfoItem)
             {
                 fuBenInfoItem.EndTicks = TimeUtil.NOW();
                 int addFuBenNum = 1;
                 if (fuBenInfoItem.nDayOfYear != TimeUtil.NowDateTime().DayOfYear)
                 {
                     addFuBenNum = 0;
                 }
                 int fuBenID = FuBenManager.FindFuBenIDByMapCode(client.ClientData.MapCode);
                 if (fuBenID > 0)
                 {
                     if (WanMotaCopySceneManager.IsWanMoTaMapCode(client.ClientData.MapCode))
                     {
                         if (!Global.FuBenPassed(client, fuBenID))
                         {
                             bFirstPassWanMoTa = true;
                         }
                     }
                     int usedSecs = (int)((fuBenInfoItem.EndTicks - fuBenInfoItem.StartTicks) / 1000L);
                     Global.UpdateFuBenDataForQuickPassTimer(client, fuBenID, usedSecs, addFuBenNum);
                     FuBenMapItem fuBenMapItem = FuBenManager.FindMapCodeByFuBenID(fuBenID, client.ClientData.MapCode);
                     fubenTongGuanData = WanMotaCopySceneManager.GiveCopyMapGiftNoScore(client, fuBenMapItem, true);
                     GameManager.DBCmdMgr.AddDBCmd(10053, string.Format("{0}:{1}:{2}:{3}", new object[]
                     {
                         client.ClientData.RoleID,
                         Global.FormatRoleName(client, client.ClientData.RoleName),
                         fuBenID,
                         usedSecs
                     }), null, client.ServerId);
                 }
             }
         }
         GameManager.ClientMgr.NotifyAllFuBenBeginInfo(copyMap, client.ClientData.RoleID, !anyAlive);
         if (fubenTongGuanData != null && bFirstPassWanMoTa)
         {
             TCPOutPacket tcpOutPacket = DataHelper.ObjectToTCPOutPacket <FuBenTongGuanData>(fubenTongGuanData, Global._TCPManager.TcpOutPacketPool, 521);
             if (!Global._TCPManager.MySocketListener.SendData(client.ClientSocket, tcpOutPacket, true))
             {
             }
         }
     }
 }
Ejemplo n.º 5
0
 private bool InitConfig()
 {
     try
     {
         XElement xml = XElement.Load(Global.GameResPath("Config/MoRiShenPan.xml"));
         IEnumerable <XElement> xmlItems = xml.Elements();
         foreach (XElement item in xmlItems)
         {
             MoRiMonster monster = new MoRiMonster();
             monster.Id              = (int)Global.GetSafeAttributeLong(item, "ID");
             monster.Name            = Global.GetSafeAttributeStr(item, "Name");
             monster.MonsterId       = (int)Global.GetSafeAttributeLong(item, "MonstersID");
             monster.BirthX          = (int)Global.GetSafeAttributeLong(item, "X");
             monster.BirthY          = (int)Global.GetSafeAttributeLong(item, "Y");
             monster.KillLimitSecond = (int)Global.GetSafeAttributeLong(item, "Time");
             string addBossProps = Global.GetSafeAttributeStr(item, "Props");
             if (!string.IsNullOrEmpty(addBossProps) && addBossProps != "-1")
             {
                 foreach (string prop in addBossProps.Split(new char[]
                 {
                     '|'
                 }))
                 {
                     string[] prop_kv = prop.Split(new char[]
                     {
                         ','
                     });
                     if (prop_kv != null && prop_kv.Length == 2)
                     {
                         monster.ExtPropDict.Add((int)Enum.Parse(typeof(ExtPropIndexes), prop_kv[0]), (float)Convert.ToDouble(prop_kv[1]));
                     }
                 }
             }
             this.BossConfigList.Add(monster);
         }
         this.BossConfigList.Sort(delegate(MoRiMonster left, MoRiMonster right)
         {
             int result;
             if (left.Id < right.Id)
             {
                 result = -1;
             }
             else if (left.Id > right.Id)
             {
                 result = 1;
             }
             else
             {
                 result = 0;
             }
             return(result);
         });
         SystemXmlItem systemFuBenItem = null;
         if (!GameManager.systemFuBenMgr.SystemXmlItemDict.TryGetValue(70000, out systemFuBenItem))
         {
             LogManager.WriteLog(LogTypes.Fatal, string.Format("缺少末日审判副本配置 CopyID={0}", 70000), null, true);
             return(false);
         }
         this.MapCode = systemFuBenItem.GetIntValue("MapCode", -1);
         FuBenMapItem fubenItem = FuBenManager.FindMapCodeByFuBenID(70000, this.MapCode);
         if (fubenItem == null)
         {
             LogManager.WriteLog(LogTypes.Fatal, string.Format("末日审判地图 {0} 配置错误", this.MapCode), null, true);
             return(false);
         }
         this.CopyMaxAliveMinutes = fubenItem.MaxTime;
         GameMap gameMap = null;
         if (!GameManager.MapMgr.DictMaps.TryGetValue(this.MapCode, out gameMap))
         {
             LogManager.WriteLog(LogTypes.Fatal, string.Format("缺少末日审判地图 {0}", this.MapCode), null, true);
             return(false);
         }
         this.copyMapGirdWidth  = gameMap.MapGridWidth;
         this.copyMapGirdHeight = gameMap.MapGridHeight;
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Fatal, string.Format("加载xml配置文件:{0}, 失败。", "Config/MoRiShenPan.xml"), ex, true);
         return(false);
     }
     return(true);
 }
Ejemplo n.º 6
0
        public static FuBenTongGuanData GiveCopyMapGiftNoScore(GameClient client, FuBenMapItem fuBenMapItem, bool bFirstPass)
        {
            FuBenTongGuanData result;

            if (null == fuBenMapItem)
            {
                result = null;
            }
            else
            {
                List <GoodsData> goodNormal = new List <GoodsData>();
                List <int>       goodsID    = new List <int>();
                WanMotaCopySceneManager.GetFubenItemReward(client, fuBenMapItem, bFirstPass, goodNormal, goodsID);
                if (bFirstPass)
                {
                    WanMotaCopySceneManager.GetFubenItemReward(client, fuBenMapItem, false, goodNormal, goodsID);
                }
                FuBenTongGuanData fuBenTongGuanData = new FuBenTongGuanData();
                fuBenTongGuanData.FuBenID      = fuBenMapItem.FuBenID;
                fuBenTongGuanData.TotalScore   = 0;
                fuBenTongGuanData.KillNum      = 0;
                fuBenTongGuanData.KillScore    = 0;
                fuBenTongGuanData.MaxKillScore = 0;
                fuBenTongGuanData.UsedSecs     = 0;
                fuBenTongGuanData.TimeScore    = 0;
                fuBenTongGuanData.MaxTimeScore = 0;
                fuBenTongGuanData.DieCount     = 0;
                fuBenTongGuanData.DieScore     = 0;
                fuBenTongGuanData.MaxDieScore  = 0;
                fuBenTongGuanData.GoodsIDList  = goodsID;
                string strTitle;
                if (bFirstPass)
                {
                    strTitle = string.Format(GLang.GetLang(570, new object[0]), client.ClientData.WanMoTaNextLayerOrder + 1);
                }
                else
                {
                    strTitle = string.Format(GLang.GetLang(571, new object[0]), client.ClientData.WanMoTaNextLayerOrder + 1);
                }
                if (bFirstPass)
                {
                    fuBenTongGuanData.AwardExp     = fuBenMapItem.nFirstExp + fuBenMapItem.Experience;
                    fuBenTongGuanData.AwardJinBi   = fuBenMapItem.nFirstGold + fuBenMapItem.Money1;
                    fuBenTongGuanData.AwardXingHun = fuBenMapItem.nFirstXingHunAward + fuBenMapItem.nXingHunAward;
                }
                else
                {
                    fuBenTongGuanData.AwardExp     = fuBenMapItem.Experience;
                    fuBenTongGuanData.AwardJinBi   = fuBenMapItem.Money1;
                    fuBenTongGuanData.AwardXingHun = fuBenMapItem.nXingHunAward;
                }
                WanMotaCopySceneManager.AddRewardToClient(client, goodNormal, fuBenTongGuanData.AwardExp, fuBenTongGuanData.AwardJinBi, fuBenTongGuanData.AwardXingHun, strTitle);
                int nWanMoTaNextLayerOrder = GameManager.ClientMgr.GetWanMoTaPassLayerValue(client) + 1;
                GameManager.ClientMgr.SaveWanMoTaPassLayerValue(client, nWanMoTaNextLayerOrder, false);
                client.ClientData.WanMoTaNextLayerOrder = nWanMoTaNextLayerOrder;
                SingletonTemplate <WanMoTaTopLayerManager> .Instance().OnClientPass(client, nWanMoTaNextLayerOrder);

                GameManager.ClientMgr.NotifySelfParamsValueChange(client, RoleCommonUseIntParamsIndexs.WanMoTaCurrLayerOrder, 0);
                WanMoTaDBCommandManager.LayerChangeDBCommand(client, nWanMoTaNextLayerOrder);
                ProcessTask.ProcessRoleTaskVal(client, TaskTypes.WanMoTa, -1);
                result = fuBenTongGuanData;
            }
            return(result);
        }
        /// <summary>
        // 万魔塔副本层奖励
        /// </summary>
        public static void SendMsgToClientForWanMoTaCopyMapAward(GameClient client, CopyMap copyMap, bool anyAlive)
        {
            CopyMap tmpCopyMap = copyMap;

            if (tmpCopyMap == null)
            {
                return;
            }

            int fuBenSeqID = FuBenManager.FindFuBenSeqIDByRoleID(client.ClientData.RoleID);

            FuBenTongGuanData fubenTongGuanData = null;

            bool bFirstPassWanMoTa = false;

            if (fuBenSeqID > 0) //如果副本不存在
            {
                FuBenInfoItem fuBenInfoItem = FuBenManager.FindFuBenInfoBySeqID(fuBenSeqID);
                if (null != fuBenInfoItem)
                {
                    fuBenInfoItem.EndTicks = DateTime.Now.Ticks / 10000;
                    int addFuBenNum = 1;
                    if (fuBenInfoItem.nDayOfYear != TimeUtil.NowDateTime().DayOfYear)
                    {
                        addFuBenNum = 0;
                    }

                    int fuBenID = FuBenManager.FindFuBenIDByMapCode(client.ClientData.MapCode);
                    if (fuBenID > 0)
                    {
                        if (WanMotaCopySceneManager.IsWanMoTaMapCode(client.ClientData.MapCode))
                        {
                            // 第一次通过万魔塔某层
                            if (!Global.FuBenPassed(client, fuBenID))
                            {
                                bFirstPassWanMoTa = true;
                            }
                        }

                        int usedSecs = (int)((fuBenInfoItem.EndTicks - fuBenInfoItem.StartTicks) / 1000);

                        // 更新玩家通关时间信息
                        Global.UpdateFuBenDataForQuickPassTimer(client, fuBenID, usedSecs, addFuBenNum);

                        // LogManager.WriteLog(LogTypes.Info, string.Format("万魔塔首次通关标记:{0}", bFirstPassWanMoTa));

                        // 给玩家物品
                        FuBenMapItem fuBenMapItem = FuBenManager.FindMapCodeByFuBenID(fuBenID, client.ClientData.MapCode);
                        fubenTongGuanData = GiveCopyMapGiftNoScore(client, fuBenMapItem, true);

                        GameManager.DBCmdMgr.AddDBCmd((int)TCPGameServerCmds.CMD_DB_ADDFUBENHISTDATA, string.Format("{0}:{1}:{2}:{3}", client.ClientData.RoleID,
                                                                                                                    Global.FormatRoleName(client, client.ClientData.RoleName), fuBenID, usedSecs), null);

                        // 万魔塔通关不计活跃 ChenXiaojun
                        //int nLev = -1;
                        //SystemXmlItem systemFuBenItem = null;
                        //if (!GameManager.systemFuBenMgr.SystemXmlItemDict.TryGetValue(fuBenID, out systemFuBenItem))
                        //{
                        //    nLev = systemFuBenItem.GetIntValue("FuBenLevel");
                        //}
                        //GameManager.ClientMgr.UpdateRoleDailyData_FuBenNum(client, 1, nLev);

                        //副本通关
                        //Global.BroadcastFuBenOk(client, usedSecs, fuBenID);
                    }
                }
            }

            GameManager.ClientMgr.NotifyAllFuBenBeginInfo(client, !anyAlive);
            if (fubenTongGuanData != null && bFirstPassWanMoTa)
            {
                //发送奖励到客户端
                TCPOutPacket tcpOutPacket = DataHelper.ObjectToTCPOutPacket <FuBenTongGuanData>(fubenTongGuanData, Global._TCPManager.TcpOutPacketPool, (int)TCPGameServerCmds.CMD_SPR_FUBENPASSNOTIFY);

                if (!Global._TCPManager.MySocketListener.SendData(client.ClientSocket, tcpOutPacket))
                {
                    ;
                }
            }
        }
        /// <summary>
        /// 给玩家副本的奖励 -- 无视评分
        /// </summary>
        /// <param name="client"></param>
        public static FuBenTongGuanData GiveCopyMapGiftNoScore(GameClient client, FuBenMapItem fuBenMapItem, bool bFirstPass)
        {
            if (null == fuBenMapItem)
            {
                return(null);
            }

            List <GoodsData> goodNormal = new List <GoodsData>();
            List <int>       goodsID    = new List <int>();

            // 获取副本的物品奖励
            GetFubenItemReward(client, fuBenMapItem, bFirstPass, goodNormal, goodsID);
            if (bFirstPass)
            {
                GetFubenItemReward(client, fuBenMapItem, false, goodNormal, goodsID);
            }

            FuBenTongGuanData fuBenTongGuanData = new FuBenTongGuanData();

            fuBenTongGuanData.FuBenID      = fuBenMapItem.FuBenID;
            fuBenTongGuanData.TotalScore   = 0;
            fuBenTongGuanData.KillNum      = 0;
            fuBenTongGuanData.KillScore    = 0;
            fuBenTongGuanData.MaxKillScore = 0;             //击杀数=最大击杀数
            fuBenTongGuanData.UsedSecs     = 0;
            fuBenTongGuanData.TimeScore    = 0;
            fuBenTongGuanData.MaxTimeScore = 0;
            fuBenTongGuanData.DieCount     = 0;
            fuBenTongGuanData.DieScore     = 0;
            fuBenTongGuanData.MaxDieScore  = 0;
            fuBenTongGuanData.GoodsIDList  = goodsID;

            string strTitle = "";

            if (bFirstPass)
            {
                strTitle = string.Format("万魔塔首次通关【{0}层】奖励", client.ClientData.WanMoTaNextLayerOrder);
            }
            else
            {
                strTitle = string.Format("万魔塔通关【{0}层】奖励", client.ClientData.WanMoTaNextLayerOrder);
            }

            // 金币、经验奖励
            if (bFirstPass)
            {
                // 首次通关
                fuBenTongGuanData.AwardExp     = fuBenMapItem.nFirstExp + fuBenMapItem.Experience;
                fuBenTongGuanData.AwardJinBi   = fuBenMapItem.nFirstGold + fuBenMapItem.Money1;
                fuBenTongGuanData.AwardXingHun = fuBenMapItem.nFirstXingHunAward;
            }
            else
            {
                fuBenTongGuanData.AwardExp     = fuBenMapItem.Experience;
                fuBenTongGuanData.AwardJinBi   = fuBenMapItem.Money1;
                fuBenTongGuanData.AwardXingHun = fuBenMapItem.nXingHunAward;
            }

            // 给奖励用专门的函数
            AddRewardToClient(client, goodNormal, fuBenTongGuanData.AwardExp, fuBenTongGuanData.AwardJinBi, fuBenTongGuanData.AwardXingHun, strTitle);

            // 保存万魔塔通关层数(角色参数)
            int nWanMoTaNextLayerOrder = GameManager.ClientMgr.GetWanMoTaPassLayerValue(client) + 1;

            GameManager.ClientMgr.SaveWanMoTaPassLayerValue(client, nWanMoTaNextLayerOrder);
            client.ClientData.WanMoTaNextLayerOrder = nWanMoTaNextLayerOrder;

            // 当用户首次通关30层开始,每通关10层万魔塔副本,显示游戏公告
            if (nWanMoTaNextLayerOrder >= 30 && nWanMoTaNextLayerOrder % 10 == 0)
            {
                // 玩家【用户名字】勇往直前,勇不可挡,通过了万魔塔第XX层!
                string broadCastMsg = StringUtil.substitute(Global.GetLang("玩家【{0}】勇往直前,勇不可挡,通过了万魔塔第{1}层!"),
                                                            Global.FormatRoleName(client, client.ClientData.RoleName), nWanMoTaNextLayerOrder);

                //播放用户行为消息
                Global.BroadcastRoleActionMsg(client, RoleActionsMsgTypes.HintMsg, broadCastMsg, true, GameInfoTypeIndexes.Hot, ShowGameInfoTypes.OnlySysHint);
            }

            // 当用户通关超过30层,成功成为万魔塔第一名的角色时,显示游戏公告
            if (nWanMoTaNextLayerOrder >= 30)
            {
                if ((nWanMoTaNextLayerOrder - 1) > GetWanMoTaDetailCmdProcessor.getInstance().WanMoTaTopLayer)
                {
                    string broadCastMsg = StringUtil.substitute(Global.GetLang("玩家【{0}】已势如破竹,雄霸万魔榜首!"),
                                                                Global.FormatRoleName(client, client.ClientData.RoleName));

                    //播放用户行为消息
                    Global.BroadcastRoleActionMsg(client, RoleActionsMsgTypes.HintMsg, broadCastMsg, true, GameInfoTypeIndexes.Hot, ShowGameInfoTypes.OnlySysHint);
                }
            }

            // 通知客户端万魔塔通关层数改变
            GameManager.ClientMgr.NotifySelfParamsValueChange(client, RoleCommonUseIntParamsIndexs.WanMoTaCurrLayerOrder, 0);

            // 保存万魔塔通关层数到万魔塔数据库表
            WanMoTaDBCommandManager.LayerChangeDBCommand(client, nWanMoTaNextLayerOrder);
            return(fuBenTongGuanData);
        }