public static void InitAllForgeLevelInfo()
 {
     lock (AllThingsCalcItem.QiangHuaFuJiaItemList)
     {
         SystemXmlItems xmlitems = new SystemXmlItems();
         xmlitems.LoadFromXMlFile("Config/QiangHuaFuJia.xml", "", "ID", 0);
         AllThingsCalcItem.QiangHuaFuJiaItemList.Clear();
         foreach (KeyValuePair <int, SystemXmlItem> kv in xmlitems.SystemXmlItemDict)
         {
             SystemXmlItem     item = kv.Value;
             QiangHuaFuJiaItem qiangHuaFuJiaItem = new QiangHuaFuJiaItem();
             qiangHuaFuJiaItem.Id    = item.GetIntValue("ID", -1);
             qiangHuaFuJiaItem.Level = item.GetIntValue("QiangHuaLevel", -1);
             qiangHuaFuJiaItem.Num   = item.GetIntValue("Num", -1);
             qiangHuaFuJiaItem.AddAttackInjurePercent = item.GetDoubleValue("AddAttackInjurePercent");
             qiangHuaFuJiaItem.MaxLifePercent         = item.GetDoubleValue("MaxLifePercent");
             AllThingsCalcItem.QiangHuaFuJiaItemList.Add(qiangHuaFuJiaItem);
         }
         AllThingsCalcItem.QiangHuaFuJiaItemList.Sort((QiangHuaFuJiaItem x, QiangHuaFuJiaItem y) => x.Id - y.Id);
         for (int i = 0; i < AllThingsCalcItem.QiangHuaFuJiaItemList.Count; i++)
         {
             AllThingsCalcItem.QiangHuaFuJiaItemList[i].Id = i + 1;
         }
     }
 }
Exemple #2
0
        /// <summary>
        /// 初始化套装强化加成信息
        /// </summary>
        public static void InitAllForgeLevelInfo()
        {
            lock (QiangHuaFuJiaItemList)
            {
                SystemXmlItems xmlitems = new SystemXmlItems();
                xmlitems.LoadFromXMlFile("Config/QiangHuaFuJia.xml", "", "ID");
                SystemXmlItem item = null;
                QiangHuaFuJiaItemList.Clear();
                foreach (var kv in xmlitems.SystemXmlItemDict)
                {
                    item = kv.Value;

                    QiangHuaFuJiaItem qiangHuaFuJiaItem = new QiangHuaFuJiaItem();
                    qiangHuaFuJiaItem.Id    = item.GetIntValue("ID");
                    qiangHuaFuJiaItem.Level = item.GetIntValue("QiangHuaLevel");
                    qiangHuaFuJiaItem.Num   = item.GetIntValue("Num");
                    qiangHuaFuJiaItem.AddAttackInjurePercent = item.GetDoubleValue("AddAttackInjurePercent");
                    qiangHuaFuJiaItem.MaxLifePercent         = item.GetDoubleValue("MaxLifePercent");
                    QiangHuaFuJiaItemList.Add(qiangHuaFuJiaItem);
                }

                QiangHuaFuJiaItemList.Sort((x, y) => { return(x.Id - y.Id); });
                for (int i = 0; i < QiangHuaFuJiaItemList.Count; i++)
                {
                    QiangHuaFuJiaItemList[i].Id = i + 1;
                }
            }
        }
        /// <summary>
        /// 解析五行奇阵的奖励项
        /// </summary>
        /// <param name="systemXmlItem"></param>
        public static void ParseWuXingAwardItem(SystemXmlItem systemXmlItem)
        {
            List <GoodsData> goodsDataList = null;
            string           goodsIDs      = systemXmlItem.GetStringValue("GoodsIDs");

            if (!string.IsNullOrEmpty(goodsIDs))
            {
                string[] fields = goodsIDs.Split('|');
                if (fields.Length > 0)
                {
                    goodsDataList = ParseGoodsDataList(fields);
                }
                else
                {
                    LogManager.WriteLog(LogTypes.Error, string.Format("解析WuXingAwards.xml配置项中的物品奖励失败, MapCode={0}", systemXmlItem.GetIntValue("MapCode")));
                }
            }
            else
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("解析WuXingAwards.xml配置项中的物品奖励失败, MapCode={0}", systemXmlItem.GetIntValue("MapCode")));
            }

            TheWuXingMapAwardItem = new WuXingMapAwardItem()
            {
                MapCode       = systemXmlItem.GetIntValue("MapCode"),
                Money1        = systemXmlItem.GetIntValue("Moneyaward"),
                ExpXiShu      = systemXmlItem.GetDoubleValue("ExpXiShu"),
                GoodsDataList = goodsDataList,
                MinBlessPoint = systemXmlItem.GetIntValue("MinBlessPoint"),
                MaxBlessPoint = systemXmlItem.GetIntValue("MaxBlessPoint"),
            };
        }
 public void UpdateTaoZhuangAttr(GameClient client, TaoZhuangData taoZhuangEquip, ref List <PassiveSkillData> passiveSkillList, ref double[] _ExtProps)
 {
     if (null != taoZhuangEquip)
     {
         TaoZhuang taoZhuang;
         if (this.JueXingRunTimeData.TaoZhuangDict.TryGetValue(taoZhuangEquip.ID, out taoZhuang))
         {
             int canActiveCount = taoZhuangEquip.ActiviteList.FindAll(delegate(int _x)
             {
                 JueXingShiItem stone;
                 return(this.JueXingRunTimeData.JueXingShiDict.TryGetValue(_x, out stone) && this.CanAddAttribute(client, stone.Position));
             }).Count;
             if (canActiveCount >= taoZhuang.TaoZhuangProps3Num && taoZhuang.TaoZhuangProps3Num > 0)
             {
                 for (int i = 0; i < 177; i++)
                 {
                     _ExtProps[i] += taoZhuang.TaoZhuangProps3[i];
                     _ExtProps[i] += taoZhuang.TaoZhuangProps2[i];
                     _ExtProps[i] += taoZhuang.TaoZhuangProps1[i];
                 }
             }
             else if (canActiveCount >= taoZhuang.TaoZhuangProps2Num && taoZhuang.TaoZhuangProps2Num > 0)
             {
                 for (int i = 0; i < 177; i++)
                 {
                     _ExtProps[i] += taoZhuang.TaoZhuangProps2[i];
                     _ExtProps[i] += taoZhuang.TaoZhuangProps1[i];
                 }
             }
             else if (canActiveCount >= taoZhuang.TaoZhuangProps1Num && taoZhuang.TaoZhuangProps1Num > 0)
             {
                 for (int i = 0; i < 177; i++)
                 {
                     _ExtProps[i] += taoZhuang.TaoZhuangProps1[i];
                 }
             }
             if (taoZhuang.Type == 1)
             {
                 client.ClientData.PropsCacheManager.SetExtProps(new object[]
                 {
                     PropsSystemTypes.WeaponMaster,
                     new double[177]
                 });
                 if (canActiveCount >= taoZhuang.WeaponMasterNum)
                 {
                     WeaponMaster.UpdateRoleAttr(client, taoZhuang.WeaponMasterType, false);
                 }
             }
             foreach (List <int> skillItem in taoZhuang.PassiveSkill)
             {
                 if (skillItem.Count > 1 && canActiveCount >= skillItem[0])
                 {
                     for (int i = 1; i < skillItem.Count; i++)
                     {
                         SystemXmlItem systemMagic = null;
                         if (GameManager.SystemMagicsMgr.SystemXmlItemDict.TryGetValue(skillItem[i], out systemMagic))
                         {
                             passiveSkillList.Add(new PassiveSkillData
                             {
                                 skillId     = skillItem[i],
                                 triggerRate = (int)(systemMagic.GetDoubleValue("TriggerOdds") * 100.0),
                                 triggerType = systemMagic.GetIntValue("TriggerType", -1),
                                 coolDown    = systemMagic.GetIntValue("CDTime", -1),
                                 triggerCD   = systemMagic.GetIntValue("TriggerCD", -1)
                             });
                         }
                     }
                 }
             }
             foreach (List <int> item in taoZhuang.PassiveEffect)
             {
                 if (item.Count > 1 && canActiveCount >= item[0])
                 {
                     for (int i = 1; i < item.Count; i++)
                     {
                         client.PassiveEffectList.Add(item[i]);
                     }
                 }
             }
         }
     }
 }
Exemple #5
0
        /// <summary>
        /// 坐骑进阶
        /// </summary>
        /// <param name="client"></param>
        /// <param name="horseDbID"></param>
        public static int ProcessHorseUpgrade(GameClient client, int horseDbID, bool allowAutoBuy)
        {
            //获取坐骑数据
            HorseData horseData = Global.GetHorseDataByDbID(client, horseDbID);

            if (null == horseData)
            {
                return(-1);
            }

            SystemXmlItem horseUpXmlNode = Global.GetHorseUpXmlNode(horseData.HorseID + 1);

            if (null == horseUpXmlNode)
            {
                return(-35);
            }

            //int needRoleLevel = horseUpXmlNode.GetIntValue("LevelLimit");
            //if (client.ClientData.Level < needRoleLevel)
            //{
            //    return -38;
            //}

            //获取强化需要的道具的物品ID
            int horseUpgradeGoodsID  = 0;
            int horseUpgradeGoodsNum = 0;

            //解析进阶需要的物品ID和数量
            Global.ParseHorseJinJieFu(horseData.HorseID, out horseUpgradeGoodsID, out horseUpgradeGoodsNum, horseUpXmlNode);
            if (horseUpgradeGoodsID <= 0)
            {
                return(-20);
            }

            if (horseData.HorseID >= Global.MaxHorseID)
            {
                return(-30);
            }

            //本次强化需要的银两
            int needYinLiang = Global.GMax(horseUpXmlNode.GetIntValue("UseYinLiang"), 0);

            needYinLiang = Global.RecalcNeedYinLiang(needYinLiang); //判断银两是否折半
            if (client.ClientData.YinLiang < needYinLiang)
            {
                return(-60);
            }

            int needBuyGoodsNum = 0; //需要购买的
            int needSubGoodsNum = 0; //需要扣除的

            //本次强化需要的辅助物品的个数
            int needGoodsNum = Global.GMax(horseUpgradeGoodsNum, 0);

            needSubGoodsNum = needGoodsNum;

            if (Global.GetTotalGoodsCountByID(client, horseUpgradeGoodsID) < needGoodsNum)
            {
                if (allowAutoBuy)
                {
                    needSubGoodsNum = Global.GetTotalGoodsCountByID(client, horseUpgradeGoodsID);
                    needBuyGoodsNum = needGoodsNum - needSubGoodsNum;
                }
                else
                {
                    return(-70);
                }
            }

            bool usedBinding     = false;
            bool usedTimeLimited = false;

            //自动扣除物品
            if (needSubGoodsNum > 0)
            {
                //扣除物品
                if (!GameManager.ClientMgr.NotifyUseGoods(Global._TCPManager.MySocketListener,
                                                          Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, horseUpgradeGoodsID, needSubGoodsNum, false, out usedBinding, out usedTimeLimited))
                {
                    return(-70);
                }
            }

            //自动扣除money
            if (needBuyGoodsNum > 0)
            {
                //自动扣除元宝购买
                int ret = Global.SubUserMoneyForGoods(client, horseUpgradeGoodsID, needBuyGoodsNum, "坐骑进阶");

                if (ret <= 0)
                {
                    return(ret);
                }
            }

            //扣除银两
            if (!GameManager.ClientMgr.SubUserYinLiang(Global._TCPManager.MySocketListener,
                                                       Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, needYinLiang, "坐骑进阶"))
            {
                return(-60);
            }

            int    horseOne   = 110000 - horseUpXmlNode.GetIntValue("HorseOne");
            int    horseTwo   = 110000 - horseUpXmlNode.GetIntValue("HorseTwo");
            double horseThree = horseUpXmlNode.GetDoubleValue("HorseThree");
            //int horseBlessPoint = horseUpXmlNode.GetIntValue("BlessPoint");

            //获取坐骑的失败积分
            int jinJieFailedNum = Global.GetHorseFailedNum(horseData);

            //判断如果还没到真概率,则直接返回失败
            if (jinJieFailedNum < horseTwo)
            {
                //if (!usedTimeLimited) //不是限时的道具
                {
                    //记录失败次数
                    //horseData.JinJieFailedNum += 1;
                    Global.AddHorseFailedNum(horseData, 1);
                }
                //else
                //{
                //    Global.AddHorseTempJiFen(horseData, 1);
                //}

                //记录失败次数
                Global.UpdateHorseIDDBCommand(Global._TCPManager.TcpOutPacketPool, client, horseData.DbID, horseData.HorseID, horseData.JinJieFailedNum, Global.GetHorseStrTempTime(horseData), horseData.JinJieTempNum, horseData.JinJieFailedDayID);

                //写入角色进阶坐骑的行为日志
                Global.AddRoleHorseUpgradeEvent(client, horseData.DbID, horseData.HorseID, horseData.JinJieFailedNum, Global.GetHorseStrTempTime(horseData), horseData.JinJieTempNum, horseData.JinJieFailedDayID, "失败");

                //改变坐骑的临时ID
                //Global.ChangeTempHorseID(client, horseData.HorseID + 1);

                return(-1000);
            }

            //判断如果还没到必定成功的幸运值,则判断随机数
            if (jinJieFailedNum < (horseOne - 1))
            {
                int successRate = (int)(horseThree * 10000);
                int randNum     = Global.GetRandomNumber(1, 10001);

                if (client.ClientData.TempHorseUpLevelRate != 1) //临时测试加成功率
                {
                    successRate *= client.ClientData.TempHorseUpLevelRate;
                    successRate  = Global.GMin(10000, successRate);
                }

                if (randNum > successRate)
                {
                    //if (!usedTimeLimited) //不是限时的道具
                    {
                        //记录失败次数
                        //horseData.JinJieFailedNum += 1;
                        Global.AddHorseFailedNum(horseData, 1);
                    }
                    //else
                    //{
                    //    Global.AddHorseTempJiFen(horseData, 1);
                    //}

                    //记录失败次数
                    Global.UpdateHorseIDDBCommand(Global._TCPManager.TcpOutPacketPool, client, horseData.DbID, horseData.HorseID, horseData.JinJieFailedNum, Global.GetHorseStrTempTime(horseData), horseData.JinJieTempNum, horseData.JinJieFailedDayID);

                    //写入角色进阶坐骑的行为日志
                    Global.AddRoleHorseUpgradeEvent(client, horseData.DbID, horseData.HorseID, horseData.JinJieFailedNum, Global.GetHorseStrTempTime(horseData), horseData.JinJieTempNum, horseData.JinJieFailedDayID, "失败");

                    //改变坐骑的临时ID
                    //Global.ChangeTempHorseID(client, horseData.HorseID + 1);

                    return(-1000);
                }
            }

            //处理坐骑进阶
            return(ProcessHorseUpgradeNow(client, horseDbID, horseData));
        }
Exemple #6
0
        public static int ProcessHorseUpgrade(GameClient client, int horseDbID, bool allowAutoBuy)
        {
            HorseData horseData = Global.GetHorseDataByDbID(client, horseDbID);
            int       result;

            if (null == horseData)
            {
                result = -1;
            }
            else
            {
                SystemXmlItem horseUpXmlNode = Global.GetHorseUpXmlNode(horseData.HorseID + 1);
                if (null == horseUpXmlNode)
                {
                    result = -35;
                }
                else
                {
                    int horseUpgradeGoodsID  = 0;
                    int horseUpgradeGoodsNum = 0;
                    Global.ParseHorseJinJieFu(horseData.HorseID, out horseUpgradeGoodsID, out horseUpgradeGoodsNum, horseUpXmlNode);
                    if (horseUpgradeGoodsID <= 0)
                    {
                        result = -20;
                    }
                    else if (horseData.HorseID >= Global.MaxHorseID)
                    {
                        result = -30;
                    }
                    else
                    {
                        int needYinLiang = Global.GMax(horseUpXmlNode.GetIntValue("UseYinLiang", -1), 0);
                        needYinLiang = Global.RecalcNeedYinLiang(needYinLiang);
                        if (client.ClientData.YinLiang < needYinLiang)
                        {
                            result = -60;
                        }
                        else
                        {
                            int needBuyGoodsNum = 0;
                            int needGoodsNum    = Global.GMax(horseUpgradeGoodsNum, 0);
                            int needSubGoodsNum = needGoodsNum;
                            if (Global.GetTotalGoodsCountByID(client, horseUpgradeGoodsID) < needGoodsNum)
                            {
                                if (!allowAutoBuy)
                                {
                                    return(-70);
                                }
                                needSubGoodsNum = Global.GetTotalGoodsCountByID(client, horseUpgradeGoodsID);
                                needBuyGoodsNum = needGoodsNum - needSubGoodsNum;
                            }
                            bool usedBinding     = false;
                            bool usedTimeLimited = false;
                            if (needSubGoodsNum > 0)
                            {
                                if (!GameManager.ClientMgr.NotifyUseGoods(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, horseUpgradeGoodsID, needSubGoodsNum, false, out usedBinding, out usedTimeLimited, false))
                                {
                                    return(-70);
                                }
                            }
                            if (needBuyGoodsNum > 0)
                            {
                                int ret = Global.SubUserMoneyForGoods(client, horseUpgradeGoodsID, needBuyGoodsNum, "坐骑进阶");
                                if (ret <= 0)
                                {
                                    return(ret);
                                }
                            }
                            if (!GameManager.ClientMgr.SubUserYinLiang(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, needYinLiang, "坐骑进阶", false))
                            {
                                result = -60;
                            }
                            else
                            {
                                int    horseOne        = 110000 - horseUpXmlNode.GetIntValue("HorseOne", -1);
                                int    horseTwo        = 110000 - horseUpXmlNode.GetIntValue("HorseTwo", -1);
                                double horseThree      = horseUpXmlNode.GetDoubleValue("HorseThree");
                                int    jinJieFailedNum = Global.GetHorseFailedNum(horseData);
                                if (jinJieFailedNum < horseTwo)
                                {
                                    Global.AddHorseFailedNum(horseData, 1);
                                    Global.UpdateHorseIDDBCommand(Global._TCPManager.TcpOutPacketPool, client, horseData.DbID, horseData.HorseID, horseData.JinJieFailedNum, Global.GetHorseStrTempTime(horseData), horseData.JinJieTempNum, horseData.JinJieFailedDayID);
                                    Global.AddRoleHorseUpgradeEvent(client, horseData.DbID, horseData.HorseID, horseData.JinJieFailedNum, Global.GetHorseStrTempTime(horseData), horseData.JinJieTempNum, horseData.JinJieFailedDayID, "失败");
                                    result = -1000;
                                }
                                else
                                {
                                    if (jinJieFailedNum < horseOne - 1)
                                    {
                                        int successRate = (int)(horseThree * 10000.0);
                                        int randNum     = Global.GetRandomNumber(1, 10001);
                                        if (client.ClientData.TempHorseUpLevelRate != 1)
                                        {
                                            successRate *= client.ClientData.TempHorseUpLevelRate;
                                            successRate  = Global.GMin(10000, successRate);
                                        }
                                        if (randNum > successRate)
                                        {
                                            Global.AddHorseFailedNum(horseData, 1);
                                            Global.UpdateHorseIDDBCommand(Global._TCPManager.TcpOutPacketPool, client, horseData.DbID, horseData.HorseID, horseData.JinJieFailedNum, Global.GetHorseStrTempTime(horseData), horseData.JinJieTempNum, horseData.JinJieFailedDayID);
                                            Global.AddRoleHorseUpgradeEvent(client, horseData.DbID, horseData.HorseID, horseData.JinJieFailedNum, Global.GetHorseStrTempTime(horseData), horseData.JinJieTempNum, horseData.JinJieFailedDayID, "失败");
                                            return(-1000);
                                        }
                                    }
                                    result = ProcessHorse.ProcessHorseUpgradeNow(client, horseDbID, horseData);
                                }
                            }
                        }
                    }
                }
            }
            return(result);
        }