Example #1
0
        /// <summary>
        ///  是否在副本的等级限制中
        /// </summary>
        public static bool IsInCopyLevelLimit(GameClient client, SystemXmlItem fubenItem)
        {
            if (client == null || fubenItem == null)
            {
                return(false);
            }

            int minLevel = fubenItem.GetIntValue("MinLevel");
            int maxLevel = fubenItem.GetIntValue("MaxLevel");

            maxLevel = maxLevel <= 0 ? 1000 : maxLevel;  //表示无限制

            int nMinZhuanSheng = fubenItem.GetIntValue("MinZhuanSheng");
            int nMaxZhuanSheng = fubenItem.GetIntValue("MaxZhuanSheng");

            nMaxZhuanSheng = nMaxZhuanSheng <= 0 ? 1000 : nMaxZhuanSheng;  // 无限制

            minLevel = Global.GetUnionLevel(nMinZhuanSheng, minLevel);
            maxLevel = Global.GetUnionLevel(nMaxZhuanSheng, maxLevel, true);

            // 首先判断级别是否满足
            int unionLevel = Global.GetUnionLevel(client.ClientData.ChangeLifeCount, client.ClientData.Level);

            if (unionLevel < minLevel || unionLevel > maxLevel)
            {
                return(false);
            }

            return(true);
        }
Example #2
0
        public void InitlDefult()
        {
            XElement szxXml = null;

            try
            {
                string fullPathFileName = Global.GameResPath(DefultPathName);
                szxXml = XElement.Load(fullPathFileName);
                if (null == szxXml)
                {
                    throw new Exception(string.Format("加载技能xml配置文件:{0}, 失败。没有找到相关XML配置文件!", DefultPathName));
                }
                SystemXmlItem          systemXmlItem = new SystemXmlItem();
                IEnumerable <XElement> nodes         = szxXml.Elements(DefultRootName).Elements();
                foreach (var node in nodes)
                {
                    systemXmlItem.XMLNode = node;

                    GlobalDefultObject globalDefultObject = new GlobalDefultObject()
                    {
                        ID         = systemXmlItem.GetIntValue("ID"),
                        Occupation = systemXmlItem.GetIntValue("Occ"),
                        SkillID    = systemXmlItem.GetIntValue("SkillID"),
                    };
                    _SystemGlobalDefultList.Add(globalDefultObject.ID, globalDefultObject);
                }
            }
            catch (Exception)
            {
                throw new Exception(string.Format("加载技能xxml配置文件:{0}, 失败。没有找到相关XML配置文件!", DefultPathName));
            }
        }
Example #3
0
        public bool IsCanAward2MagicSword(GameClient client, int nGoodsID)
        {
            int  nOcc = Global.CalcOriginalOccupationID(client);
            bool result;

            if (!this.IsMagicSword(nOcc))
            {
                result = false;
            }
            else
            {
                SystemXmlItem systemGoods = null;
                if (!GameManager.SystemGoods.SystemXmlItemDict.TryGetValue(nGoodsID, out systemGoods))
                {
                    result = false;
                }
                else if (Global.GetMainOccupationByGoodsID(nGoodsID) == -1)
                {
                    result = true;
                }
                else
                {
                    EMagicSwordTowardType eEMSType = this.GetMagicSwordTowardType(client);
                    int nStrength     = systemGoods.GetIntValue("Strength", -1);
                    int nIntelligence = systemGoods.GetIntValue("Intelligence", -1);
                    EMagicSwordTowardType eEMSGoodType = EMagicSwordTowardType.EMST_Intelligence;
                    if (nStrength >= nIntelligence)
                    {
                        eEMSGoodType = EMagicSwordTowardType.EMST_Strength;
                    }
                    result = (eEMSType == eEMSGoodType);
                }
            }
            return(result);
        }
Example #4
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);
        }
Example #5
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);
        }
        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))
            {
                int nBossGoodsPackID = systemFuBenItem.GetIntValue("BossGoodsList", -1);
                if (nBossGoodsPackID > 0)
                {
                    int maxFallCountByID = GameManager.GoodsPackMgr.GetFallGoodsMaxCount(nBossGoodsPackID);
                    if (maxFallCountByID <= 0)
                    {
                        maxFallCountByID = GoodsPackManager.MaxFallCount;
                    }
                    List <GoodsData> goodsDataList = GameManager.GoodsPackMgr.GetGoodsDataList(client, nBossGoodsPackID, maxFallCountByID, 0, 1.0);
                    if (goodsDataList != null && goodsDataList.Count > 0)
                    {
                        for (int i = 0; i < goodsDataList.Count; i++)
                        {
                            goodNormal.Add(goodsDataList[i]);
                            GoodsIDList.Add(goodsDataList[i].GoodsID);
                        }
                    }
                }
            }
        }
Example #7
0
        public bool IsMagicSwordWeapon(int nGoodsID)
        {
            SystemXmlItem systemGoods = null;
            bool          result;

            if (!GameManager.SystemGoods.SystemXmlItemDict.TryGetValue(nGoodsID, out systemGoods))
            {
                result = false;
            }
            else
            {
                ItemCategories eCategoriy = (ItemCategories)systemGoods.GetIntValue("Categoriy", -1);
                bool           bRes       = false;
                switch (eCategoriy)
                {
                case ItemCategories.WuQi_Jian:
                case ItemCategories.WuQi_Fu:
                case ItemCategories.WuQi_Chui:
                case ItemCategories.WuQi_Mao:
                case ItemCategories.WuQi_Zhang:
                case ItemCategories.WuQi_Dun:
                case ItemCategories.WuQi_Dao:
                    bRes = true;
                    break;
                }
                result = bRes;
            }
            return(result);
        }
Example #8
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);
        }
Example #9
0
        public static TaskData GetTaoTask(GameClient client)
        {
            TaskData result;

            if (null == client.ClientData.TaskDataList)
            {
                result = null;
            }
            else
            {
                lock (client.ClientData.TaskDataList)
                {
                    for (int i = 0; i < client.ClientData.TaskDataList.Count; i++)
                    {
                        TaskData      taskData   = client.ClientData.TaskDataList[i];
                        SystemXmlItem systemTask = null;
                        if (GameManager.SystemTasksMgr.SystemXmlItemDict.TryGetValue(taskData.DoingTaskID, out systemTask))
                        {
                            int taskClass = systemTask.GetIntValue("TaskClass", -1);
                            if (taskClass == 9)
                            {
                                return(taskData);
                            }
                        }
                    }
                }
                result = null;
            }
            return(result);
        }
        /// <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);
                    }
                }
            }
        }
Example #11
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])));
     }
 }
Example #12
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);
        }
Example #13
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);
        }
Example #14
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);
        }
Example #15
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);
        }
Example #16
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);
        }
Example #17
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"));
        }
Example #18
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);
        }
Example #19
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")));
            }
        }
Example #20
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);
        }
Example #21
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);
        }
 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)
     });
 }
Example #23
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);
            }
        }
Example #24
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);
        }
Example #25
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);
                }

                int originGoodsID  = Convert.ToInt32(itemParams[0]);
                int originGoodsNum = Convert.ToInt32(itemParams[1]);
                if (originGoodsID <= 0 || originGoodsNum <= 0)
                {
                    strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0);
                    client.sendCmd(nID, strCmd);
                    return(true);
                }

                GoodsReplaceResult replaceRet = GoodsReplaceManager.Instance().GetReplaceResult(client, originGoodsID);
                if (replaceRet == null || replaceRet.TotalGoodsCnt() < originGoodsNum)
                {
                    // 物品数量不够
                    strCmd = string.Format("{0}:{1}:{2}:{3}", -4, nRoleID, 0, 0);
                    client.sendCmd(nID, strCmd);
                    return(true);
                }

                List <GoodsReplaceResult.ReplaceItem> realCostList = new List <GoodsReplaceResult.ReplaceItem>();
                // 1:替换后的绑定材料
                // 2:替换后的非绑定材料
                // 3:原始绑定材料
                // 4:原始非绑定材料
                realCostList.AddRange(replaceRet.BindList);
                realCostList.AddRange(replaceRet.UnBindList);
                realCostList.Add(replaceRet.OriginBindGoods);
                realCostList.Add(replaceRet.OriginUnBindGoods);

                int hasUseCnt    = 0;
                int stillNeedCnt = originGoodsNum;
                foreach (var item in realCostList)
                {
                    if (item.GoodsCnt <= 0)
                    {
                        continue;
                    }

                    int realCostCnt = Math.Min(stillNeedCnt, item.GoodsCnt);
                    if (realCostCnt <= 0)
                    {
                        break;
                    }

                    bool bUsedBinding     = false;
                    bool bUsedTimeLimited = false;
                    bool bFailed          = false;
                    if (item.IsBind)
                    {
                        if (!GameManager.ClientMgr.NotifyUseBindGoods(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool,
                                                                      client, item.GoodsID, realCostCnt, false, out bUsedBinding, out bUsedTimeLimited))
                        {
                            bFailed = true;
                        }
                    }
                    else
                    {
                        if (!GameManager.ClientMgr.NotifyUseNotBindGoods(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool,
                                                                         client, item.GoodsID, realCostCnt, false, out bUsedBinding, out bUsedTimeLimited))
                        {
                            bFailed = true;
                        }
                    }

                    stillNeedCnt -= realCostCnt;

                    if (bFailed)
                    {
                        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;
            }

            // 七日活动
            // 翅膀升级和升阶次数,成功失败都算
            GlobalEventSource.getInstance().fireEvent(SevenDayGoalEvPool.Alloc(client, ESevenDayGoalFuncType.WingSuitStarTimes));

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

            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);
                    }

                    bool oldWingLingYuOpened = GlobalNew.IsGongNengOpened(client, GongNengIDs.WingLingYu);

                    // 更新翅膀的新等级,星数
                    client.ClientData.MyWingData.WingID     = nNextWingID;
                    client.ClientData.MyWingData.ForgeLevel = 0;
                    client.ClientData.MyWingData.StarExp    = 0;

                    // 七日活动
                    GlobalEventSource.getInstance().fireEvent(SevenDayGoalEvPool.Alloc(client, ESevenDayGoalFuncType.WingLevel));

                    bool newWingLingYuOpened = GlobalNew.IsGongNengOpened(client, GongNengIDs.WingLingYu);
                    if (!oldWingLingYuOpened && newWingLingYuOpened)
                    {
                        //翎羽功能开启了,初始化
                        LingYuManager.InitAsOpened(client);
                    }

                    // 按新等级增加属性
                    if (1 == client.ClientData.MyWingData.Using)
                    {
                        MUWingsManager.UpdateWingDataProps(client, true);
                        //升阶时候,翅膀的基础属性的改变会影响注魂加成
                        ZhuLingZhuHunManager.UpdateZhuLingZhuHunProps(client);

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

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

                    //[bing] 刷新客户端活动叹号
                    if (client._IconStateMgr.CheckJieRiFanLi(client, ActivityTypes.JieriWing))
                    {
                        client._IconStateMgr.AddFlushIconState((ushort)ActivityTipTypes.JieRiActivity, client._IconStateMgr.IsAnyJieRiTipActived());
                        client._IconStateMgr.SendIconStateToClient(client);
                    }
                }
            }

            return(true);
        }
Example #26
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);
        }
Example #27
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);
 }
Example #28
0
 private bool ProcessMoRiJudgeJoin(GameClient client, int nID, byte[] bytes, string[] cmdParams)
 {
     try
     {
         SceneUIClasses sceneType = Global.GetMapSceneType(client.ClientData.MapCode);
         if (sceneType != SceneUIClasses.Normal)
         {
             client.sendCmd(nID, -21, false);
             return(true);
         }
         if (!this.IsGongNengOpened(client, true))
         {
             client.sendCmd(nID, -2001, false);
             return(true);
         }
         if (client.ClientData.SignUpGameType != 0)
         {
             client.sendCmd(nID, -2002, false);
             return(true);
         }
         if (KuaFuManager.getInstance().IsInCannotJoinKuaFuCopyTime(client))
         {
             client.sendCmd(nID, -2004, false);
             return(true);
         }
         SystemXmlItem systemFuBenItem = null;
         if (!GameManager.systemFuBenMgr.SystemXmlItemDict.TryGetValue(70000, out systemFuBenItem))
         {
             client.sendCmd(nID, -3, false);
             return(true);
         }
         int minLevel       = systemFuBenItem.GetIntValue("MinLevel", -1);
         int maxLevel       = systemFuBenItem.GetIntValue("MaxLevel", -1);
         int nMinZhuanSheng = systemFuBenItem.GetIntValue("MinZhuanSheng", -1);
         int nMaxZhuanSheng = systemFuBenItem.GetIntValue("MaxZhuanSheng", -1);
         if (client.ClientData.ChangeLifeCount < nMinZhuanSheng || (client.ClientData.ChangeLifeCount == nMinZhuanSheng && client.ClientData.Level < minLevel))
         {
             client.sendCmd(nID, "-19".ToString(), false);
             return(true);
         }
         if (client.ClientData.ChangeLifeCount > nMaxZhuanSheng || (client.ClientData.ChangeLifeCount == nMaxZhuanSheng && client.ClientData.Level > maxLevel))
         {
             client.sendCmd(nID, "-19".ToString(), false);
             return(true);
         }
         FuBenData fuBenData = Global.GetFuBenData(client, 70000);
         if (fuBenData != null && fuBenData.FinishNum >= systemFuBenItem.GetIntValue("FinishNumber", -1))
         {
             client.sendCmd(nID, "-16".ToString(), false);
             return(true);
         }
         int result = 0;
         if (result == 1)
         {
             client.ClientData.SignUpGameType = 3;
             GlobalNew.UpdateKuaFuRoleDayLogData(client.ServerId, client.ClientData.RoleID, TimeUtil.NowDateTime(), client.ClientData.ZoneID, 1, 0, 0, 0, 3);
         }
         client.sendCmd(nID, result.ToString(), false);
         return(true);
     }
     catch (Exception ex)
     {
         DataHelper.WriteFormatExceptionLog(ex, Global.GetDebugHelperInfo(client.ClientSocket), false, false);
     }
     return(false);
 }
        /// <summary>
        /// 翅膀升星处理
        /// </summary>
        public bool processCmd(Logic.GameClient client, string[] cmdParams)
        {
            int nID         = (int)TCPGameServerCmds.CMD_SPR_WINGUPSTAR;
            int nRoleID     = Global.SafeConvertToInt32(cmdParams[0]);
            int nUpStarMode = 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);
            }

            // 获取升星信息表
            SystemXmlItem upStarXmlItem = WingStarCacheManager.GetWingStarCacheItem(Global.CalcOriginalOccupationID(client), client.ClientData.MyWingData.WingID, client.ClientData.MyWingData.ForgeLevel + 1);

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

            string strWingShengXing = GameManager.systemParamsList.GetParamValueByName("WingShengXing");

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

            // 解析升级暴率
            string[] wingShengXing = strWingShengXing.Split(',');
            if (3 != wingShengXing.Length)
            {
                strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0);
                client.sendCmd(nID, strCmd);
                return(true);
            }

            // 暴率
            int nPowRate = 0;
            // 增加的星经验
            int nAddExp = 0;

            if (0 == nUpStarMode)
            {
                nPowRate = (int)(Convert.ToDouble(wingShengXing[0]) * 100.0);
                nAddExp  = Convert.ToInt32(upStarXmlItem.GetIntValue("GoodsExp"));
            }
            else
            {
                nPowRate = (int)(Convert.ToDouble(wingShengXing[1]) * 100.0);
                nAddExp  = Convert.ToInt32(upStarXmlItem.GetIntValue("ZuanShiExp"));
            }

            // 暴升,乘以经验倍数
            int nRandNum = Global.GetRandomNumber(0, 100);

            if (nRandNum < nPowRate)
            {
                nAddExp *= Convert.ToInt32(wingShengXing[2]);
            }

            int nUpStarReqExp  = upStarXmlItem.GetIntValue("StarExp");
            int nNextStarLevel = client.ClientData.MyWingData.ForgeLevel;
            int nNextStarExp   = 0;

            if (client.ClientData.MyWingData.StarExp + nAddExp >= nUpStarReqExp)
            {
                if (nNextStarLevel < MUWingsManager.MaxWingEnchanceLevel)
                {
                    // 改变星级,剩余的经验改到下级
                    nNextStarLevel += 1;
                    nNextStarExp    = client.ClientData.MyWingData.StarExp + nAddExp - nUpStarReqExp;

                    // 连续升星
                    while (true)
                    {
                        if (nNextStarLevel >= MUWingsManager.MaxWingEnchanceLevel)
                        {
                            break;
                        }

                        SystemXmlItem nextStarXmlItem = WingStarCacheManager.GetWingStarCacheItem(Global.CalcOriginalOccupationID(client), client.ClientData.MyWingData.WingID, nNextStarLevel + 1);
                        if (null == upStarXmlItem)
                        {
                            break;
                        }

                        int nNextUpStarReqExp = nextStarXmlItem.GetIntValue("StarExp");
                        if (nNextStarExp >= nNextUpStarReqExp)
                        {
                            nNextStarLevel += 1;
                            nNextStarExp    = nNextStarExp - nNextUpStarReqExp;
                        }
                        else
                        {
                            break;
                        }
                    }
                }
                else
                {
                    // 已经达到最高星
                    nNextStarExp = nUpStarReqExp;
                }
            }
            else
            {
                nNextStarExp = client.ClientData.MyWingData.StarExp + nAddExp;
            }

            if (0 == nUpStarMode)
            {
                //获取强化需要的道具的物品ID
                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 iRet = MUWingsManager.WingUpStarDBCommand(client, client.ClientData.MyWingData.DbID, 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, nNextStarLevel, nNextStarExp);
                client.sendCmd(nID, strCmd);

                client.ClientData.MyWingData.StarExp = nNextStarExp;
                if (client.ClientData.MyWingData.ForgeLevel != nNextStarLevel)
                {
                    // 先移除原来的属性
                    if (1 == client.ClientData.MyWingData.Using)
                    {
                        MUWingsManager.UpdateWingDataProps(client, false);
                    }

                    client.ClientData.MyWingData.ForgeLevel = nNextStarLevel;

                    // 按新等级增加属性
                    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);
        }
Example #30
0
        private bool SetFinishNum(GameClient client, TodayInfo todayInfo, SystemXmlItem fuBenInfo)
        {
            int num = todayInfo.NumMax - todayInfo.NumEnd;

            switch (todayInfo.Type)
            {
            case 1:
            case 2:
                Global.UpdateFuBenData(client, todayInfo.FuBenID, num, num);
                break;

            case 3:
            case 4:
            case 5:
                Global.UpdateFuBenData(client, todayInfo.FuBenID, num, num);
                break;

            case 6:
            {
                DailyTaskData taoData = null;
                Global.GetDailyTaskData(client, 9, out taoData, true);
                taoData.RecNum = todayInfo.NumMax;
                Global.UpdateDBDailyTaskData(client, taoData, true);
                break;
            }

            case 7:
            {
                int nType = 2;
                Global.UpdateDayActivityEnterCountToDB(client, client.ClientData.RoleID, TimeUtil.NowDateTime().DayOfYear, nType, todayInfo.NumMax);
                break;
            }

            case 8:
            {
                int nType = 1;
                Global.UpdateDayActivityEnterCountToDB(client, client.ClientData.RoleID, TimeUtil.NowDateTime().DayOfYear, nType, todayInfo.NumMax);
                break;
            }

            case 9:
            {
                int nType = 6;
                Global.UpdateDayActivityEnterCountToDB(client, client.ClientData.RoleID, TimeUtil.NowDateTime().DayOfYear, nType, todayInfo.NumMax);
                break;
            }

            case 10:
            case 11:
            case 12:
                Global.UpdateFuBenData(client, todayInfo.FuBenID, num, num);
                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 (roleData == null || dayID != roleData.FuBenDayID)
                {
                    roleData.FuBenDayID    = dayID;
                    roleData.TodayFuBenNum = 0;
                }
                int count = todayInfo.NumMax - todayInfo.NumEnd;
                roleData.TodayFuBenNum += count;
                int level = fuBenInfo.GetIntValue("FuBenLevel", -1);
                DailyActiveManager.ProcessCompleteCopyMapForDailyActive(client, level, count);
                ChengJiuManager.ProcessCompleteCopyMapForChengJiu(client, level, count);
            }
            return(true);
        }