Пример #1
0
        private static BossAIItem ParseBossAICachingItem(SystemXmlItem systemXmlItem)
        {
            BossAIItem bossAIItem = new BossAIItem
            {
                ID          = systemXmlItem.GetIntValue("ID", -1),
                AIID        = systemXmlItem.GetIntValue("AIID", -1),
                TriggerNum  = systemXmlItem.GetIntValue("TriggerNum", -1),
                TriggerCD   = systemXmlItem.GetIntValue("TriggerCD", -1),
                TriggerType = systemXmlItem.GetIntValue("TriggerType", -1),
                Desc        = systemXmlItem.GetStringValue("Description")
            };

            bossAIItem.Condition = BossAICachingMgr.ParseCondition(bossAIItem.ID, bossAIItem.TriggerType, systemXmlItem.GetStringValue("Condition"));
            BossAIItem result;

            if (null == bossAIItem.Condition)
            {
                result = null;
            }
            else
            {
                result = bossAIItem;
            }
            return(result);
        }
Пример #2
0
        /// <summary>
        /// 限制类物品检测是否可以使用
        /// </summary>
        /// <param name="client">GameClient</param>
        /// <param name="goodsID">物品ID</param>
        /// <param name="failedMsg">[out]不可使用的信息提示</param>
        /// <returns>可以使用返回True,同时failedMsg为NULL。否则返回False,failedMsg指示不可使用原因</returns>
        public bool CheckCanUse_ByToType(GameClient client, int goodsID, out string failedMsg)
        {
            failedMsg = "";

            SystemXmlItem systemGoodsItem = null;

            if (!GameManager.SystemGoods.SystemXmlItemDict.TryGetValue(goodsID, out systemGoodsItem))
            {
                return(false);
            }

            string condIdx = systemGoodsItem.GetStringValue("ToType");
            string condArg = systemGoodsItem.GetStringValue("ToTypeProperty");

            // 未配置限制条件,认为可以使用
            if (string.IsNullOrEmpty(condIdx) || condIdx == "-1")
            {
                return(true);
            }

            condIdx = condIdx.ToLower();

            ICondJudger judger = null;

            if (!canUseDict.TryGetValue(condIdx, out judger))
            {
                // 没有找到限制处理程序,默认可以使用
                return(true);
            }

            return(judger.Judge(client, condArg, out failedMsg));
        }
Пример #3
0
        /// <summary>
        /// 获取BOSS奖励
        /// </summary>
        /// <param name="client"></param>
        public static void GetBossReward(GameClient client, int nFubenID, List <GoodsData> goodNormal, List <int> GoodsIDList)
        {
            SystemXmlItem systemFuBenItem = null;

            if (!GameManager.systemFuBenMgr.SystemXmlItemDict.TryGetValue(nFubenID, out systemFuBenItem))
            {
                return;
            }

            // 增加BOSS掉落物品奖励
            int nBossGoodsPackID = -1;

            nBossGoodsPackID = systemFuBenItem.GetIntValue("BossGoodsList");

            if (nBossGoodsPackID > 0)
            {
                int maxFallCountByID = GameManager.GoodsPackMgr.GetFallGoodsMaxCount(nBossGoodsPackID);
                if (maxFallCountByID <= 0)
                {
                    maxFallCountByID = GoodsPackManager.MaxFallCount;
                }

                // 根据物品掉落ID获取要掉落的物品
                List <GoodsData> goodsDataList = GameManager.GoodsPackMgr.GetGoodsDataList(client, nBossGoodsPackID, maxFallCountByID, 0);
                if (null != goodsDataList && goodsDataList.Count > 0)
                {
                    for (int j = 0; j < goodsDataList.Count; ++j)
                    {
                        goodNormal.Add(goodsDataList[j]);
                        GoodsIDList.Add(goodsDataList[j].GoodsID);
                    }
                }
            }
        }
Пример #4
0
        /// <summary>
        /// 根据职业加载技能项,并进行缓存
        /// </summary>
        /// <param name="occupation"></param>
        public static void LoadWingPropsItemsByOccupation(int occupation)
        {
            string   fileName = "";
            XElement xml      = null;

            try
            {
                fileName = string.Format("Config/Wing/Wing_{0}.xml", occupation);
                xml      = XElement.Load(Global.GameResPath(fileName));
                if (null == xml)
                {
                    throw new Exception(string.Format("加载系统xml配置文件:{0}, 失败。没有找到相关XML配置文件!", fileName));
                }
            }
            catch (Exception)
            {
                throw new Exception(string.Format("加载系统xml配置文件:{0}, 失败。没有找到相关XML配置文件!", fileName));
            }

            IEnumerable <XElement> WingPropsXmlItems = xml.Elements("Level");

            foreach (var WingPropsItem in WingPropsXmlItems)
            {
                SystemXmlItem systemXmlItem = new SystemXmlItem()
                {
                    XMLNode = WingPropsItem,
                };

                string key = string.Format("{0}_{1}", occupation,
                                           (int)Global.GetSafeAttributeLong(WingPropsItem, "ID"));

                WingPropsItemsDict[key] = systemXmlItem;
            }
        }
Пример #5
0
 private void LoadHuangJinBossInfo()
 {
     try
     {
         XElement xmlFile = Global.GetGameResXml(string.Format("Config/HuangJin.xml", new object[0]));
         if (null != xmlFile)
         {
             IEnumerable <XElement> WorldBossXEle = xmlFile.Elements("Boss");
             foreach (XElement xmlItem in WorldBossXEle)
             {
                 if (null != xmlItem)
                 {
                     SystemXmlItem systemXmlItem = new SystemXmlItem
                     {
                         XMLNode = xmlItem
                     };
                     TimerBossData tmpInfo = new TimerBossData();
                     tmpInfo.nRoleID = systemXmlItem.GetIntValue("ID", -1);
                     int[] arrLevel = systemXmlItem.GetIntArrayValue("Level", ',');
                     if (arrLevel == null || arrLevel.Length != 2)
                     {
                         throw new Exception(string.Format("启动时加载xml文件: {0} 失败 Level格式错误", string.Format("Config/HuangJin.xml", new object[0])));
                     }
                     tmpInfo.nReqLevel           = arrLevel[1];
                     tmpInfo.nReqChangeLiveCount = arrLevel[0];
                     this.m_HuangJinBossDict.Add(tmpInfo.nRoleID, tmpInfo);
                 }
             }
         }
     }
     catch (Exception)
     {
         throw new Exception(string.Format("启动时加载xml文件: {0} 失败", string.Format("Config/HuangJin.xml", new object[0])));
     }
 }
Пример #6
0
        public static int GetSkillLevel(GameClient client, int skillID)
        {
            int level = 0;

            if (client.ClientData.MyTalentData.IsOpen)
            {
                TalentPropData talentData = client.ClientData.MyTalentPropData;
                if (talentData.SkillOneValue.ContainsKey(skillID))
                {
                    level += talentData.SkillOneValue[skillID];
                }
                else
                {
                    SystemXmlItem systemMagic = null;
                    if (!GameManager.SystemMagicsMgr.SystemXmlItemDict.TryGetValue(skillID, out systemMagic))
                    {
                        return(level);
                    }
                    int nParentMagicID = systemMagic.GetIntValue("ParentMagicID", -1);
                    if (nParentMagicID > 0)
                    {
                        SkillData ParentSkillData = Global.GetSkillDataByID(client, nParentMagicID);
                        if (null != ParentSkillData)
                        {
                            if (talentData.SkillOneValue.ContainsKey(ParentSkillData.SkillID))
                            {
                                level += talentData.SkillOneValue[ParentSkillData.SkillID];
                            }
                        }
                    }
                }
                level += talentData.SkillAllValue;
            }
            return(level);
        }
Пример #7
0
        /// <summary>
        /// 从缓存中读取进阶配置项
        /// </summary>
        /// <param name="occupation"></param>
        /// <param name="jingMaiID"></param>
        /// <param name="jingMaiLevel"></param>
        /// <returns></returns>
        public static SystemXmlItem GetWingUPCacheItem(int nLevel)
        {
            SystemXmlItem systemWingPropsCacheItem = null;

            if (!GameManager.SystemWingsUp.SystemXmlItemDict.TryGetValue(nLevel, out systemWingPropsCacheItem))
            {
                return(null);
            }

            return(systemWingPropsCacheItem);
        }
Пример #8
0
        public static bool IsInCopyTimesLimit(GameClient client, SystemXmlItem fubenItem)
        {
            bool result;

            if (client == null || fubenItem == null)
            {
                result = false;
            }
            else
            {
                int copyId = fubenItem.GetIntValue("ID", -1);
                if (WanMotaCopySceneManager.IsWanMoTaMapCode(copyId))
                {
                    result = true;
                }
                else
                {
                    int maxEnterNum  = fubenItem.GetIntValue("EnterNumber", -1);
                    int maxFinishNum = fubenItem.GetIntValue("FinishNumber", -1);
                    int hadFinishNum;
                    int hadEnterNum = Global.GetFuBenEnterNum(Global.GetFuBenData(client, copyId), out hadFinishNum);
                    if (maxEnterNum <= 0 && maxFinishNum <= 0)
                    {
                        result = true;
                    }
                    else
                    {
                        int[] nAddNum;
                        if (Global.IsInExperienceCopyScene(copyId))
                        {
                            nAddNum = GameManager.systemParamsList.GetParamValueIntArrayByName("VIPJinYanFuBenNum", ',');
                        }
                        else if (copyId == 5100)
                        {
                            nAddNum = GameManager.systemParamsList.GetParamValueIntArrayByName("VIPJinBiFuBenNum", ',');
                        }
                        else
                        {
                            nAddNum = null;
                        }
                        int extAddNum = 0;
                        int nVipLev   = client.ClientData.VipLevel;
                        if (nVipLev > 0 && nVipLev <= VIPEumValue.VIPENUMVALUE_MAXLEVEL && nAddNum != null && nAddNum.Length > nVipLev)
                        {
                            extAddNum = nAddNum[nVipLev];
                        }
                        result = ((maxEnterNum <= 0 || hadEnterNum < maxEnterNum + extAddNum) && (maxFinishNum <= 0 || hadFinishNum < maxFinishNum + extAddNum));
                    }
                }
            }
            return(result);
        }
Пример #9
0
        private bool SetFinishNum(GameClient client, TodayInfo todayInfo, SystemXmlItem fuBenInfo)
        {
            int num = todayInfo.NumMax - todayInfo.NumEnd;

            switch ((ETodayType)todayInfo.Type)
            {
            case ETodayType.Exp:
            case ETodayType.Gold:
                Global.UpdateFuBenData(client, todayInfo.FuBenID, num, num);
                break;

            case ETodayType.KaLiMa:
            case ETodayType.EM:
            case ETodayType.Lo:
                Global.UpdateFuBenData(client, todayInfo.FuBenID, num, num);
                break;

            case ETodayType.Tao:
            {
                DailyTaskData taoData = null;
                Global.GetDailyTaskData(client, (int)TaskClasses.TaofaTask, out taoData, true);

                taoData.RecNum = todayInfo.NumMax;
                Global.UpdateDBDailyTaskData(client, taoData, true);
            }
            break;
            }

            FuBenData fuBenData = Global.GetFuBenData(client, todayInfo.FuBenID);

            if (fuBenData != null && (fuBenData.EnterNum != 0 || fuBenData.FinishNum != 0))
            {
                //记录通关副本数量
                int           dayID    = TimeUtil.NowDateTime().DayOfYear;
                RoleDailyData roleData = client.ClientData.MyRoleDailyData;
                if (null == roleData || dayID != roleData.FuBenDayID)
                {
                    roleData            = new RoleDailyData();
                    roleData.FuBenDayID = dayID;
                    client.ClientData.MyRoleDailyData = roleData;
                }

                int count = todayInfo.NumMax - todayInfo.NumEnd;
                roleData.TodayFuBenNum += count;

                int level = fuBenInfo.GetIntValue("FuBenLevel");
                DailyActiveManager.ProcessCompleteCopyMapForDailyActive(client, level, count); //活跃
                ChengJiuManager.ProcessCompleteCopyMapForChengJiu(client, level, count);       //成就
            }

            return(true);
        }
Пример #10
0
        /// <summary>
        /// 从缓存中读取配置项
        /// </summary>
        /// <param name="occupation"></param>
        /// <param name="jingMaiID"></param>
        /// <param name="jingMaiLevel"></param>
        /// <returns></returns>
        public static SystemXmlItem GetWingPropsCacheItem(int occupation, int level)
        {
            string key = string.Format("{0}_{1}", occupation, level);

            SystemXmlItem systemWingPropsCacheItem = null;

            if (!WingPropsItemsDict.TryGetValue(key, out systemWingPropsCacheItem))
            {
                return(null);
            }

            return(systemWingPropsCacheItem);
        }
Пример #11
0
        public static SystemXmlItem GetWingUPCacheItem(int nLevel)
        {
            SystemXmlItem systemWingPropsCacheItem = null;
            SystemXmlItem result;

            if (!GameManager.SystemWingsUp.SystemXmlItemDict.TryGetValue(nLevel, out systemWingPropsCacheItem))
            {
                result = null;
            }
            else
            {
                result = systemWingPropsCacheItem;
            }
            return(result);
        }
Пример #12
0
        /// <summary>
        /// 是否记录攻击时间间隔
        /// </summary>
        /// <param name="client"></param>
        /// <param name="magicCode"></param>
        /// <returns></returns>
        private static bool CanRecordAttackTicks(GameClient client, int magicCode)
        {
            //首先判断技能是群攻还是单攻
            SystemXmlItem systemMagic = null;

            if (!GameManager.SystemMagicsMgr.SystemXmlItemDict.TryGetValue(magicCode, out systemMagic))
            {
                return(true);
            }

            //地狱火不记录攻击时刻
            //return (SkillTypes.FiveBallMagic != systemMagic.GetIntValue("SkillType"));
            //不是普攻就记录,普攻则不记录
            return(1 != systemMagic.GetIntValue("SkillType"));
        }
Пример #13
0
 private static ExtensionPropItem ParseCachingItem(SystemXmlItem systemXmlItem)
 {
     return(new ExtensionPropItem
     {
         ID = systemXmlItem.GetIntValue("ID", -1),
         PrevTuoZhanShuXing = ExtensionPropsMgr.ParseDict(systemXmlItem.GetStringValue("PrevTuoZhanShuXing")),
         TargetType = systemXmlItem.GetIntValue("TargetTyp", -1),
         ActionType = systemXmlItem.GetIntValue("ActionType", -1),
         Probability = (int)(systemXmlItem.GetDoubleValue("Probability") * 100.0),
         NeedSkill = ExtensionPropsMgr.ParseDict(systemXmlItem.GetStringValue("NeedSkill")),
         Icon = systemXmlItem.GetIntValue("Icon", -1),
         TargetDecoration = systemXmlItem.GetIntValue("TargetDecoration", -1),
         DelayDecoration = systemXmlItem.GetIntValue("DelayDecoration", -1)
     });
 }
Пример #14
0
        public static void LoadCachingItems(SystemXmlItems systemExtensionProps)
        {
            Dictionary <int, ExtensionPropItem> cachingDict = new Dictionary <int, ExtensionPropItem>();

            foreach (int key in systemExtensionProps.SystemXmlItemDict.Keys)
            {
                SystemXmlItem     systemXmlItem     = systemExtensionProps.SystemXmlItemDict[key];
                ExtensionPropItem extensionPropItem = ExtensionPropsMgr.ParseCachingItem(systemXmlItem);
                if (null != extensionPropItem)
                {
                    cachingDict[extensionPropItem.ID] = extensionPropItem;
                }
            }
            ExtensionPropsMgr._ExtensionPropsCachingDict = cachingDict;
        }
Пример #15
0
        /// summary
        /// 装入世界BOSS信息
        /// summary
        private void LoadWorldBossInfo()
        {
            // 世界BOSS信息表
            try
            {
                XElement xmlFile = null;
                xmlFile = Global.GetGameResXml(string.Format("Config/Activity/BossInfo.xml"));
                if (null == xmlFile)
                {
                    return;
                }

                IEnumerable <XElement> WorldBossXEle = xmlFile.Elements("Boss");
                foreach (var xmlItem in WorldBossXEle)
                {
                    if (null != xmlItem)
                    {
                        SystemXmlItem systemXmlItem = new SystemXmlItem()
                        {
                            XMLNode = xmlItem,
                        };

                        TimerBossData tmpInfo = new TimerBossData();

                        tmpInfo.nRoleID = systemXmlItem.GetIntValue("ID");
                        int [] arrLevel = systemXmlItem.GetIntArrayValue("Level");
                        if (null == arrLevel || arrLevel.Length != 2)
                        {
                            // 填写错误则抛异常
                            systemXmlItem = null;
                            throw new Exception(string.Format("启动时加载xml文件: {0} 失败 Level格式错误", string.Format("Config/Activity/BossInfo.xml")));
                        }
                        else
                        {
                            tmpInfo.nReqLevel           = arrLevel[1];
                            tmpInfo.nReqChangeLiveCount = arrLevel[0];
                        }

                        systemXmlItem = null;
                        m_WorldBossDict.Add(tmpInfo.nRoleID, tmpInfo);
                    }
                }
            }
            catch (Exception)
            {
                throw new Exception(string.Format("启动时加载xml文件: {0} 失败", string.Format("Config/Activity/BossInfo.xml")));
            }
        }
Пример #16
0
        public static bool HasFinishedPreTask(GameClient client, SystemXmlItem fubenItem)
        {
            bool result;

            if (client == null || fubenItem == null)
            {
                result = false;
            }
            else
            {
                int copyTab  = fubenItem.GetIntValue("TabID", -1);
                int needTask = GlobalNew.GetFuBenTabNeedTask(copyTab);
                result = (needTask <= client.ClientData.MainTaskID);
            }
            return(result);
        }
Пример #17
0
        public static SystemXmlItem GetWingStarCacheItem(int occupation, int level, int starNum)
        {
            string        key = string.Format("{0}_{1}_{2}", occupation, level, starNum);
            SystemXmlItem systemWingStarCacheItem = null;
            SystemXmlItem result;

            if (!WingStarCacheManager.WingStarItemsDict.TryGetValue(key, out systemWingStarCacheItem))
            {
                result = null;
            }
            else
            {
                result = systemWingStarCacheItem;
            }
            return(result);
        }
Пример #18
0
        /// <summary>
        /// 从xml项中解析缓存项
        /// </summary>
        /// <param name="systemXmlItem"></param>
        private static ExtensionPropItem ParseCachingItem(SystemXmlItem systemXmlItem)
        {
            ExtensionPropItem extensionPropItem = new ExtensionPropItem()
            {
                ID = systemXmlItem.GetIntValue("ID"),
                PrevTuoZhanShuXing = ParseDict(systemXmlItem.GetStringValue("PrevTuoZhanShuXing")),
                TargetType         = systemXmlItem.GetIntValue("TargetTyp"),
                ActionType         = systemXmlItem.GetIntValue("ActionType"),
                Probability        = (int)(systemXmlItem.GetDoubleValue("Probability") * 100),
                NeedSkill          = ParseDict(systemXmlItem.GetStringValue("NeedSkill")),
                Icon             = systemXmlItem.GetIntValue("Icon"),
                TargetDecoration = systemXmlItem.GetIntValue("TargetDecoration"),
                DelayDecoration  = systemXmlItem.GetIntValue("DelayDecoration"),
            };

            return(extensionPropItem);
        }
Пример #19
0
        /// <summary>
        /// 是否完成了副本的前置任务
        /// </summary>
        public static bool HasFinishedPreTask(GameClient client, SystemXmlItem fubenItem)
        {
            if (client == null || fubenItem == null)
            {
                return(false);
            }

            int copyTab  = fubenItem.GetIntValue("TabID");
            int needTask = GlobalNew.GetFuBenTabNeedTask(copyTab);

            if (needTask > client.ClientData.MainTaskID)
            {
                return(false);
            }

            return(true);
        }
Пример #20
0
        /// <summary>
        /// 加载缓存项
        /// </summary>
        public static void LoadCachingItems(SystemXmlItems systemExtensionProps)
        {
            Dictionary <int, ExtensionPropItem> cachingDict = new Dictionary <int, ExtensionPropItem>();

            foreach (var key in systemExtensionProps.SystemXmlItemDict.Keys)
            {
                SystemXmlItem     systemXmlItem     = systemExtensionProps.SystemXmlItemDict[(int)key];
                ExtensionPropItem extensionPropItem = ParseCachingItem(systemXmlItem);
                if (null == extensionPropItem) //解析出错
                {
                    continue;
                }

                cachingDict[extensionPropItem.ID] = extensionPropItem;
            }

            _ExtensionPropsCachingDict = cachingDict;
        }
Пример #21
0
        /// <summary>
        /// 是否完成了前置副本
        /// </summary>
        public static bool HasPassedPreCopy(GameClient client, SystemXmlItem fubenItem)
        {
            if (client == null || fubenItem == null)
            {
                return(false);
            }

            int nUpCopyID     = fubenItem.GetIntValue("UpCopyID");
            int nFinishNumber = fubenItem.GetIntValue("FinishNumber");

            if (nUpCopyID > 0 && nFinishNumber > 0)
            {
                if (!Global.FuBenPassed(client, nUpCopyID))
                {
                    return(false);
                }
            }

            return(true);
        }
Пример #22
0
        /// <summary>
        /// 从xml项中解析Boss AI缓存项
        /// </summary>
        /// <param name="systemXmlItem"></param>
        private static BossAIItem ParseBossAICachingItem(SystemXmlItem systemXmlItem)
        {
            BossAIItem bossAIItem = new BossAIItem()
            {
                ID          = systemXmlItem.GetIntValue("ID"),
                AIID        = systemXmlItem.GetIntValue("AIID"),
                TriggerNum  = systemXmlItem.GetIntValue("TriggerNum"),
                TriggerCD   = systemXmlItem.GetIntValue("TriggerCD"),
                TriggerType = systemXmlItem.GetIntValue("TriggerType"),
                Desc        = systemXmlItem.GetStringValue("Description"),
            };

            bossAIItem.Condition = ParseCondition(bossAIItem.ID, bossAIItem.TriggerType, systemXmlItem.GetStringValue("Condition"));
            if (null == bossAIItem.Condition)
            {
                return(null);
            }

            return(bossAIItem);
        }
Пример #23
0
        public static void UpdateRolePetSkill(GameClient client)
        {
            List <PassiveSkillData> resultList = new List <PassiveSkillData>();

            List <GoodsData> petList = client.ClientData.DamonGoodsDataList;
            GoodsData        warPet  = client.ClientData.DamonGoodsDataList.Find(_g => _g.Using > 0);

            if (warPet != null)
            {
                List <PetSkillInfo> allSkillList = new List <PetSkillInfo>();
                List <PetSkillInfo> petSkillList = GetPetSkillInfo(warPet);
                var temp = from info in petSkillList
                           where info.PitIsOpen && info.SkillID > 0
                           select info;

                if (temp.Any())
                {
                    foreach (var t in temp)
                    {
                        SystemXmlItem systemMagic = null;
                        if (!GameManager.SystemMagicsMgr.SystemXmlItemDict.TryGetValue(t.SkillID, out systemMagic))
                        {
                            continue;
                        }

                        PassiveSkillData data = new PassiveSkillData();
                        data.skillId     = t.SkillID;
                        data.skillLevel  = t.Level;
                        data.triggerRate = (int)(systemMagic.GetDoubleValue("TriggerOdds") * 100);
                        data.triggerType = systemMagic.GetIntValue("TriggerType");
                        data.coolDown    = systemMagic.GetIntValue("CDTime");
                        data.triggerCD   = systemMagic.GetIntValue("TriggerCD");

                        resultList.Add(data);
                    }
                }
            }

            client.passiveSkillModule.UpdateSkillList(resultList);
            JingLingQiYuanManager.getInstance().RefreshProps(client);
        }
Пример #24
0
        public bool HandleKuaFuInitGame(GameClient client)
        {
            if (client == null)
            {
                return(false);
            }

            lock (Mutex)
            {
                CopyTeamData td = null;
                if (!this.TeamDict.TryGetValue(client.ClientSocket.ClientKuaFuServerLoginData.GameId, out td))
                {
                    return(false);
                }

                SystemXmlItem systemFuBenItem = null;
                if (!GameManager.systemFuBenMgr.SystemXmlItemDict.TryGetValue(td.FuBenId, out systemFuBenItem))
                {
                    return(false);
                }
                int mapCode = systemFuBenItem.GetIntValue("MapCode");
                int destX, destY;
                if (!GetBirthPoint(mapCode, out destX, out destY))
                {
                    LogManager.WriteLog(LogTypes.Error, string.Format("rolename={0} 跨服登录副本copyid={1}, 找不到出生点", client.ClientData.RoleName, td.FuBenId));
                    return(false);
                }

                client.ClientData.MapCode    = mapCode;
                client.ClientData.PosX       = (int)destX;
                client.ClientData.PosY       = (int)destY;
                client.ClientData.FuBenSeqID = client.ClientSocket.ClientKuaFuServerLoginData.FuBenSeqId;

                // 记录跨服玩家参加的队伍ID,玩家下线的时候用
                RoleId2JoinedTeam[client.ClientData.RoleID] = td.TeamID;

                return(true);
            }
        }
Пример #25
0
        public static void LoadBossAICachingItems(SystemXmlItems systemBossAI)
        {
            Dictionary <string, List <BossAIItem> > bossAICachingDict = new Dictionary <string, List <BossAIItem> >();

            foreach (int key in systemBossAI.SystemXmlItemDict.Keys)
            {
                SystemXmlItem systemXmlItem = systemBossAI.SystemXmlItemDict[key];
                BossAIItem    bossAIItem    = BossAICachingMgr.ParseBossAICachingItem(systemXmlItem);
                if (null != bossAIItem)
                {
                    string            strKey         = string.Format("{0}_{1}", bossAIItem.AIID, bossAIItem.TriggerType);
                    List <BossAIItem> bossAIItemList = null;
                    if (!bossAICachingDict.TryGetValue(strKey, out bossAIItemList))
                    {
                        bossAIItemList            = new List <BossAIItem>();
                        bossAICachingDict[strKey] = bossAIItemList;
                    }
                    bossAIItemList.Add(bossAIItem);
                }
            }
            BossAICachingMgr._BossAICachingDict = bossAICachingDict;
        }
Пример #26
0
        public static bool IsInCopyLevelLimit(GameClient client, SystemXmlItem fubenItem)
        {
            bool result;

            if (client == null || fubenItem == null)
            {
                result = false;
            }
            else
            {
                int minLevel = fubenItem.GetIntValue("MinLevel", -1);
                int maxLevel = fubenItem.GetIntValue("MaxLevel", -1);
                maxLevel = ((maxLevel <= 0) ? 1000 : maxLevel);
                int nMinZhuanSheng = fubenItem.GetIntValue("MinZhuanSheng", -1);
                int nMaxZhuanSheng = fubenItem.GetIntValue("MaxZhuanSheng", -1);
                nMaxZhuanSheng = ((nMaxZhuanSheng <= 0) ? 1000 : nMaxZhuanSheng);
                minLevel       = Global.GetUnionLevel(nMinZhuanSheng, minLevel, false);
                maxLevel       = Global.GetUnionLevel(nMaxZhuanSheng, maxLevel, true);
                int unionLevel = Global.GetUnionLevel(client.ClientData.ChangeLifeCount, client.ClientData.Level, false);
                result = (unionLevel >= minLevel && unionLevel <= maxLevel);
            }
            return(result);
        }
Пример #27
0
        public static void UpdateRolePetSkill(GameClient client)
        {
            List <PassiveSkillData> resultList = new List <PassiveSkillData>();
            List <GoodsData>        petList    = client.ClientData.DamonGoodsDataList;
            GoodsData warPet = client.ClientData.DamonGoodsDataList.Find((GoodsData _g) => _g.Using > 0);

            if (warPet != null)
            {
                List <PetSkillInfo>        allSkillList = new List <PetSkillInfo>();
                List <PetSkillInfo>        petSkillList = PetSkillManager.GetPetSkillInfo(warPet);
                IEnumerable <PetSkillInfo> temp         = from info in petSkillList
                                                          where info.PitIsOpen && info.SkillID > 0
                                                          select info;
                if (temp.Any <PetSkillInfo>())
                {
                    foreach (PetSkillInfo t in temp)
                    {
                        SystemXmlItem systemMagic = null;
                        if (GameManager.SystemMagicsMgr.SystemXmlItemDict.TryGetValue(t.SkillID, out systemMagic))
                        {
                            resultList.Add(new PassiveSkillData
                            {
                                skillId     = t.SkillID,
                                skillLevel  = t.Level,
                                triggerRate = (int)(systemMagic.GetDoubleValue("TriggerOdds") * 100.0),
                                triggerType = systemMagic.GetIntValue("TriggerType", -1),
                                coolDown    = systemMagic.GetIntValue("CDTime", -1),
                                triggerCD   = systemMagic.GetIntValue("TriggerCD", -1)
                            });
                        }
                    }
                }
            }
            client.passiveSkillModule.UpdateSkillList(resultList);
            JingLingQiYuanManager.getInstance().RefreshProps(client, true);
        }
Пример #28
0
        public static bool UpdateWingDataProps(GameClient client, bool toAdd = true)
        {
            bool result;

            if (null == client.ClientData.MyWingData)
            {
                result = false;
            }
            else if (client.ClientData.MyWingData.WingID <= 0)
            {
                result = false;
            }
            else
            {
                SystemXmlItem baseXmlNode = WingPropsCacheManager.GetWingPropsCacheItem(Global.CalcOriginalOccupationID(client), client.ClientData.MyWingData.WingID);
                if (null == baseXmlNode)
                {
                    result = false;
                }
                else
                {
                    MUWingsManager.ChangeWingDataProps(client, baseXmlNode, toAdd);
                    baseXmlNode = WingStarCacheManager.GetWingStarCacheItem(Global.CalcOriginalOccupationID(client), client.ClientData.MyWingData.WingID, client.ClientData.MyWingData.ForgeLevel);
                    if (null == baseXmlNode)
                    {
                        result = false;
                    }
                    else
                    {
                        MUWingsManager.ChangeWingDataProps(client, baseXmlNode, toAdd);
                        result = true;
                    }
                }
            }
            return(result);
        }
Пример #29
0
        public bool processCmd(Logic.GameClient client, string[] cmdParams)
        {
            int nID         = (int)TCPGameServerCmds.CMD_SPR_WINGUPGRADE;
            int nRoleID     = Global.SafeConvertToInt32(cmdParams[0]);
            int nUpWingMode = Global.SafeConvertToInt32(cmdParams[1]); //0: 道具进阶, 1: 钻石进阶

            string strCmd = "";

            if (null == client.ClientData.MyWingData)
            {
                strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0);
                client.sendCmd(nID, strCmd);
                return(true);
            }

            // 已到最高级
            if (client.ClientData.MyWingData.WingID >= MUWingsManager.MaxWingID)
            {
                strCmd = string.Format("{0}:{1}:{2}:{3}", -8, nRoleID, 0, 0);
                client.sendCmd(nID, strCmd);
                return(true);
            }

            // 获取进阶信息表
            SystemXmlItem upStarXmlItem = MUWingsManager.GetWingUPCacheItem(client.ClientData.MyWingData.WingID + 1);

            if (null == upStarXmlItem)
            {
                strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0);
                client.sendCmd(nID, strCmd);
                return(true);
            }

            if (0 == nUpWingMode)
            {
                // 获取进阶需要的道具的物品信息
                string strReqItemID = upStarXmlItem.GetStringValue("NeedGoods");

                // 解析物品ID与数量
                string[] itemParams = strReqItemID.Split(',');
                if (null == itemParams || itemParams.Length != 2)
                {
                    strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0);
                    client.sendCmd(nID, strCmd);
                    return(true);
                }

                // 获取进阶需要的道具的物品ID
                int nEnchanceNeedGoodsID = Convert.ToInt32(itemParams[0]);
                // 获取进阶需要的道具的物品数量
                int nEnchanceNeedGoodsNum = Convert.ToInt32(itemParams[1]);

                if (nEnchanceNeedGoodsID <= 0 || nEnchanceNeedGoodsNum <= 0)
                {
                    strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0);
                    client.sendCmd(nID, strCmd);
                    return(true);
                }

                // 判断数量是否够
                if (Global.GetTotalGoodsCountByID(client, nEnchanceNeedGoodsID) < nEnchanceNeedGoodsNum)
                {
                    // 物品数量不够
                    strCmd = string.Format("{0}:{1}:{2}:{3}", -4, nRoleID, 0, 0);
                    client.sendCmd(nID, strCmd);
                    return(true);
                }

                // 自动扣除物品
                if (nEnchanceNeedGoodsNum > 0)
                {
                    bool bUsedBinding     = false;
                    bool bUsedTimeLimited = false;

                    //扣除物品
                    if (!GameManager.ClientMgr.NotifyUseGoods(Global._TCPManager.MySocketListener,
                                                              Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, nEnchanceNeedGoodsID, nEnchanceNeedGoodsNum, false, out bUsedBinding, out bUsedTimeLimited))
                    {
                        strCmd = string.Format("{0}:{1}:{2}:{3}", -5, nRoleID, 0, 0);
                        client.sendCmd(nID, strCmd);
                        return(true);
                    }
                }
            }
            else
            {
                // 获取进阶需要的钻石数量
                int nReqZuanShi = upStarXmlItem.GetIntValue("NeedZuanShi");
                if (nReqZuanShi <= 0)
                {
                    strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0);
                    client.sendCmd(nID, strCmd);
                    return(true);
                }
                // 判断用户点卷额是否不足【钻石】
                if (client.ClientData.UserMoney < nReqZuanShi)
                {
                    //用户点卷额不足【钻石】
                    strCmd = string.Format("{0}:{1}:{2}:{3}", -6, nRoleID, 0, 0);
                    client.sendCmd(nID, strCmd);
                    return(true);
                }

                //先DBServer请求扣费
                //扣除用户点卷
                if (!GameManager.ClientMgr.SubUserMoney(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, nReqZuanShi, "翅膀进阶"))
                {
                    //扣除用户点卷失败
                    strCmd = string.Format("{0}:{1}:{2}:{3}", -7, nRoleID, 0, 0);
                    client.sendCmd(nID, strCmd);
                    return(true);
                }
            }

            int nLuckOne     = upStarXmlItem.GetIntValue("LuckyOne");
            int nLuckyTwo    = upStarXmlItem.GetIntValue("LuckyTwo");
            int nLuckTwoRate = (int)(upStarXmlItem.GetDoubleValue("LuckyTwoRate") * 100.0);

            int nNextWingID          = client.ClientData.MyWingData.WingID;
            int nNextJinJieFailedNum = client.ClientData.MyWingData.JinJieFailedNum;
            int nNextStarLevel       = client.ClientData.MyWingData.ForgeLevel;
            int nNextStarExp         = client.ClientData.MyWingData.StarExp;


            // LuckyOne+提升获得幸运点 < LuckyTwo;必定不会提升成功
            if (nLuckOne + client.ClientData.MyWingData.JinJieFailedNum < nLuckyTwo)
            {
                // 幸运点加1
                nNextJinJieFailedNum++;
            }
            // LuckyOne+提升获得幸运点>= LuckyTwo,则根据配置得到LuckyTwoRate概率判定是否能够完成进阶操作
            else if (nLuckOne + client.ClientData.MyWingData.JinJieFailedNum < 110000)
            {
                //
                int nRandNum = Global.GetRandomNumber(0, 100);
                if (nRandNum < nLuckTwoRate)
                {
                    // 进阶成功
                    nNextWingID++;

                    // 幸运点清0
                    nNextJinJieFailedNum = 0;

                    // 星级清0
                    nNextStarLevel = 0;

                    // 星级经验清0
                    nNextStarExp = 0;
                }
                else
                {
                    // 幸运点加1
                    nNextJinJieFailedNum++;
                }
            }
            // LuckyOne+提升获得幸运点>=110000时,进阶必定成功
            else
            {
                // 进阶成功
                nNextWingID++;

                // 幸运点清0
                nNextJinJieFailedNum = 0;

                // 星级清0
                nNextStarLevel = 0;

                // 星级经验清0
                nNextStarExp = 0;
            }

            // 将改变保存到数据库
            int iRet = MUWingsManager.WingUpDBCommand(client, client.ClientData.MyWingData.DbID, nNextWingID, nNextJinJieFailedNum, nNextStarLevel, nNextStarExp);

            if (iRet < 0)
            {
                strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0);
                client.sendCmd(nID, strCmd);
                return(true);
            }
            else
            {
                strCmd = string.Format("{0}:{1}:{2}:{3}", 0, nRoleID, nNextWingID, nNextJinJieFailedNum);
                client.sendCmd(nID, strCmd);

                client.ClientData.MyWingData.JinJieFailedNum = nNextJinJieFailedNum;
                if (client.ClientData.MyWingData.WingID != nNextWingID)
                {
                    // 先移除原来的属性
                    if (1 == client.ClientData.MyWingData.Using)
                    {
                        MUWingsManager.UpdateWingDataProps(client, false);
                    }

                    client.ClientData.MyWingData.WingID     = nNextWingID;
                    client.ClientData.MyWingData.ForgeLevel = 0;
                    client.ClientData.MyWingData.StarExp    = 0;


                    // 按新等级增加属性
                    if (1 == client.ClientData.MyWingData.Using)
                    {
                        MUWingsManager.UpdateWingDataProps(client, true);

                        // 通知客户端属性变化
                        GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);

                        // 总生命值和魔法值变化通知(同一个地图才需要通知)
                        GameManager.ClientMgr.NotifyOthersLifeChanged(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);
                    }
                }
            }

            return(true);
        }
Пример #30
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);
 }