Exemplo n.º 1
0
        private void RefreshShenJiFuWenProps(GameClient client)
        {
            Dictionary <int, ShenJiFuWenConfigData> tempShenJiConfig = null;

            lock (this.ConfigMutex)
            {
                tempShenJiConfig = this.ShenJiConfig;
            }
            double[] _ExtProps = new double[177];
            foreach (ShenJiFuWenData item in client.ClientData.ShenJiDataDict.Values)
            {
                ShenJiFuWenConfigData sConfigData = null;
                if (tempShenJiConfig.TryGetValue(item.ShenJiID, out sConfigData))
                {
                    ShenJiFuWenEffectData effect = sConfigData.GetEffect(item.Level);
                    for (int i = 0; i < _ExtProps.Length; i++)
                    {
                        _ExtProps[i] += effect.ExtProps[i];
                    }
                }
            }
            client.ClientData.PropsCacheManager.SetExtProps(new object[]
            {
                PropsSystemTypes.ShenJiFuWen,
                _ExtProps
            });
            client.delayExecModule.SetDelayExecProc(new DelayExecProcIds[]
            {
                DelayExecProcIds.RecalcProps,
                DelayExecProcIds.NotifyRefreshProps
            });
        }
Exemplo n.º 2
0
 public bool LoadShenJiFuWenConfigFile()
 {
     try
     {
         GeneralCachingXmlMgr.RemoveCachingXml(Global.GameResPath("Config/ShenJiFuWen.xml"));
         XElement xml = GeneralCachingXmlMgr.GetXElement(Global.GameResPath("Config/ShenJiFuWen.xml"));
         if (null == xml)
         {
             return(false);
         }
         Dictionary <int, ShenJiFuWenConfigData> tempShenJiConfig = new Dictionary <int, ShenJiFuWenConfigData>();
         IEnumerable <XElement> xmlItems = xml.Elements();
         foreach (XElement xmlItem in xmlItems)
         {
             ShenJiFuWenConfigData data = new ShenJiFuWenConfigData();
             data.ShenJiID     = (int)Global.GetSafeAttributeLong(xmlItem, "ID");
             data.PreShenJiID  = (int)Global.GetSafeAttributeLong(xmlItem, "Prev");
             data.PreShenJiLev = (int)Global.GetSafeAttributeLong(xmlItem, "PrevLevel");
             data.MaxLevel     = (int)Global.GetSafeAttributeLong(xmlItem, "MaxLevel");
             data.UpNeed       = (int)Global.GetSafeAttributeLong(xmlItem, "UpNeed");
             for (int levelloop = 1; levelloop <= 5; levelloop++)
             {
                 ShenJiFuWenEffectData effectItem = this.ParseShenJiFuWenEffectData(xmlItem, levelloop.ToString());
                 if (null == effectItem)
                 {
                     break;
                 }
                 data.ShenJiEffectList.Add(effectItem);
             }
             tempShenJiConfig[data.ShenJiID] = data;
         }
         lock (this.ConfigMutex)
         {
             this.ShenJiConfig = tempShenJiConfig;
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Fatal, string.Format("{0}解析出现异常, {1}", "Config/ShenJiFuWen.xml", ex.Message), null, true);
         return(false);
     }
     return(true);
 }
Exemplo n.º 3
0
        private int GetCostShenJiPointNum(GameClient client)
        {
            Dictionary <int, ShenJiFuWenConfigData> tempShenJiConfig = null;

            lock (this.ConfigMutex)
            {
                tempShenJiConfig = this.ShenJiConfig;
            }
            int TotalCostNum = 0;

            foreach (ShenJiFuWenData item in client.ClientData.ShenJiDataDict.Values)
            {
                ShenJiFuWenConfigData sConfigData = null;
                if (tempShenJiConfig.TryGetValue(item.ShenJiID, out sConfigData))
                {
                    TotalCostNum += sConfigData.UpNeed * item.Level;
                }
            }
            return(TotalCostNum);
        }
Exemplo n.º 4
0
 public bool ProcessShenJiAddEffectCmd(GameClient client, int nID, byte[] bytes, string[] cmdParams)
 {
     try
     {
         int result   = 0;
         int roleID   = Convert.ToInt32(cmdParams[0]);
         int shenjiID = Convert.ToInt32(cmdParams[1]);
         Dictionary <int, ShenJiFuWenConfigData> tempShenJiConfig = null;
         lock (this.ConfigMutex)
         {
             tempShenJiConfig = this.ShenJiConfig;
         }
         ShenJiFuWenConfigData sConfigData = null;
         if (!tempShenJiConfig.TryGetValue(shenjiID, out sConfigData))
         {
             result = 1;
             client.sendCmd(nID, string.Format("{0}:{1}:{2}:{3}", new object[]
             {
                 result,
                 roleID,
                 shenjiID,
                 0
             }), false);
             return(true);
         }
         ShenJiFuWenData actData = this.GetShenJiFuWenData(client, shenjiID);
         if (actData != null && actData.Level >= sConfigData.MaxLevel)
         {
             result = 2;
             client.sendCmd(nID, string.Format("{0}:{1}:{2}:{3}", new object[]
             {
                 result,
                 roleID,
                 shenjiID,
                 0
             }), false);
             return(true);
         }
         if (sConfigData.UpNeed > GameManager.ClientMgr.GetShenJiPointValue(client))
         {
             result = 2;
             client.sendCmd(nID, string.Format("{0}:{1}:{2}:{3}", new object[]
             {
                 result,
                 roleID,
                 shenjiID,
                 0
             }), false);
             return(true);
         }
         ShenJiFuWenConfigData preConfigData = null;
         if (tempShenJiConfig.TryGetValue(sConfigData.PreShenJiID, out preConfigData))
         {
             ShenJiFuWenData preData = this.GetShenJiFuWenData(client, sConfigData.PreShenJiID);
             if (preData == null || sConfigData.PreShenJiLev > preData.Level)
             {
                 result = 2;
                 client.sendCmd(nID, string.Format("{0}:{1}:{2}:{3}", new object[]
                 {
                     result,
                     roleID,
                     shenjiID,
                     0
                 }), false);
                 return(true);
             }
         }
         if (null == actData)
         {
             actData = new ShenJiFuWenData
             {
                 ShenJiID = shenjiID
             };
             client.ClientData.ShenJiDataDict[shenjiID] = actData;
         }
         GameManager.ClientMgr.ModifyShenJiPointValue(client, -sConfigData.UpNeed, "精灵神迹升级|激活", true, true);
         actData.Level++;
         this.UpdateShenJiFuWenDataDB(client, shenjiID, actData.Level);
         this.RefreshShenJiFuWenProps(client);
         client.sendCmd(nID, string.Format("{0}:{1}:{2}:{3}", new object[]
         {
             result,
             roleID,
             shenjiID,
             actData.Level
         }), false);
         return(true);
     }
     catch (Exception ex)
     {
         DataHelper.WriteFormatExceptionLog(ex, Global.GetDebugHelperInfo(client.ClientSocket), false, false);
     }
     return(false);
 }