예제 #1
0
 public static void UpdateRoleAttr(GameClient client, int weaponType, bool needBrocast = false)
 {
     try
     {
         List <WeaponMaster.WeaponMasterItem> weaponMasterList;
         if (WeaponMaster.WeaponMasterXml.TryGetValue(weaponType, out weaponMasterList))
         {
             int        begin           = 11;
             int        end             = 21;
             List <int> equipHandleList = new List <int>();
             foreach (GoodsData _g in client.ClientData.GoodsDataList)
             {
                 if (_g.Using == 1)
                 {
                     int           cateGoriy   = -1;
                     SystemXmlItem systemGoods = null;
                     if (GameManager.SystemGoods.SystemXmlItemDict.TryGetValue(_g.GoodsID, out systemGoods))
                     {
                         cateGoriy = systemGoods.GetIntValue("Categoriy", -1);
                     }
                     if (cateGoriy >= begin && cateGoriy <= end)
                     {
                         equipHandleList.Add(cateGoriy);
                     }
                 }
             }
             if (equipHandleList.Count >= 1 && equipHandleList.Count <= 2)
             {
                 WeaponMaster.WeaponMasterItem weaponItem = null;
                 foreach (WeaponMaster.WeaponMasterItem _w in weaponMasterList)
                 {
                     if (WeaponMaster.WeaponIsMatch(_w.WeaponType1, _w.WeaponType2, equipHandleList) || WeaponMaster.WeaponIsMatch(_w.WeaponType2, _w.WeaponType1, equipHandleList))
                     {
                         weaponItem = _w;
                         break;
                     }
                 }
                 double[] ExtProps = (weaponItem == null) ? new double[177] : weaponItem.ExtProps;
                 client.ClientData.PropsCacheManager.SetExtProps(new object[]
                 {
                     PropsSystemTypes.WeaponMaster,
                     ExtProps
                 });
                 if (needBrocast)
                 {
                     GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);
                     GameManager.ClientMgr.NotifyOthersLifeChanged(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, true, false, 7);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Error, string.Format("WeaponMaster :: 更新角色武器大师属性加成:{0}, 失败。", new object[0]), ex, true);
     }
 }
예제 #2
0
 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]);
                     }
                 }
             }
         }
     }
 }