Exemple #1
0
        public void ParseEquipProps(SystemXmlItem systemGoods, out EquipPropItem equipPropItem)
        {
            equipPropItem = null;
            string props = systemGoods.GetStringValue("EquipProps");

            string[] fields = props.Split(new char[]
            {
                ','
            });
            if (fields.Length != 177)
            {
                LogManager.WriteLog(LogTypes.Fatal, string.Format("解析物品属性失败: EquipID={0},EquipProps属性期望个数{1},实际个数{2}", systemGoods.GetIntValue("ID", -1), 177, fields.Length), null, true);
            }
            double[] arryDoubles = null;
            try
            {
                arryDoubles = Global.StringArray2DoubleArray(fields);
            }
            catch (Exception)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("转换物品属性数组: EquipID={0}", systemGoods.GetIntValue("ID", -1)), null, true);
                return;
            }
            equipPropItem = new EquipPropItem();
            int i = 0;

            while (i < 177 && i < arryDoubles.Length)
            {
                equipPropItem.ExtProps[i] = arryDoubles[i];
                i++;
            }
        }
        public static double GetExtProp(BufferItemTypes bufferItemType, ExtPropIndexes extPropIndexe, int goodsIndex)
        {
            int[]  goodsIds = AdvanceBufferPropsMgr.GetCachingIDsByID((int)bufferItemType);
            double result;

            if (null == goodsIds)
            {
                result = 0.0;
            }
            else if (goodsIndex < 0 || goodsIndex >= goodsIds.Length)
            {
                result = 0.0;
            }
            else
            {
                int           goodsID = goodsIds[goodsIndex];
                EquipPropItem item    = GameManager.EquipPropsMgr.FindEquipPropItem(goodsID);
                if (null == item)
                {
                    result = 0.0;
                }
                else
                {
                    result = item.ExtProps[(int)extPropIndexe];
                }
            }
            return(result);
        }
Exemple #3
0
        public EquipPropItem FindEquipPropItem(int equipID)
        {
            EquipPropItem equipPropItem = null;

            lock (this._EquipPropsDict)
            {
                if (this._EquipPropsDict.TryGetValue(equipID, out equipPropItem))
                {
                    return(equipPropItem);
                }
            }
            SystemXmlItem systemGoods = null;
            EquipPropItem result;

            if (!GameManager.SystemGoods.SystemXmlItemDict.TryGetValue(equipID, out systemGoods))
            {
                result = null;
            }
            else
            {
                this.ParseEquipProps(systemGoods, out equipPropItem);
                if (null != equipPropItem)
                {
                    lock (this._EquipPropsDict)
                    {
                        this._EquipPropsDict[equipID] = equipPropItem;
                    }
                }
                result = equipPropItem;
            }
            return(result);
        }
Exemple #4
0
        /// <summary>
        /// 解析装备属性
        /// </summary>
        /// <param name="systemGoods"></param>
        /// <param name="equipPropItem"></param>
        public void ParseEquipProps(string props, out EquipPropItem equipPropItem)
        {
            equipPropItem = null;
            string[] fields = props.Split(',');
            if (fields.Length != (int)ExtPropIndexes.Max_Configed) //属性个数不符合
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("解析物品属性失败"));
                return;
            }

            double[] arryDoubles = null;

            try
            {
                arryDoubles = Global.StringArray2DoubleArray(fields);
            }
            catch (Exception)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("转换物品属性数组"));
                return;
            }

            equipPropItem = new EquipPropItem();
            //for (int i = 0; i < 5; i++)
            //{
            //    equipPropItem.BaseProps[i] = arryDoubles[i];
            //}

            for (int i = 0; i < (int)ExtPropIndexes.Max_Configed; i++)
            {
                equipPropItem.ExtProps[i] = arryDoubles[i];
            }
        }
        private EquipPropItem GetGroupProp(string strEffect)
        {
            EquipPropItem result;

            if (string.IsNullOrEmpty(strEffect))
            {
                result = null;
            }
            else
            {
                EquipPropItem item      = new EquipPropItem();
                string[]      arrEffect = strEffect.Split(new char[]
                {
                    '|'
                });
                foreach (string effect in arrEffect)
                {
                    string[] arr = effect.Split(new char[]
                    {
                        ','
                    });
                    int    id    = (int)Enum.Parse(typeof(ExtPropIndexes), arr[0]);
                    double value = double.Parse(arr[1]);
                    item.ExtProps[id] += value;
                }
                result = item;
            }
            return(result);
        }
Exemple #6
0
        /// <summary>
        /// 通过物品ID获取属性
        /// </summary>
        /// <param name="equipID"></param>
        /// <returns></returns>
        public EquipPropItem FindEquipPropItem(int equipID)
        {
            EquipPropItem equipPropItem = null;

            lock (_EquipPropsDict)
            {
                if (_EquipPropsDict.TryGetValue(equipID, out equipPropItem))
                {
                    return(equipPropItem);
                }
            }

            //先查找缓存
            SystemXmlItem systemGoods = null;

            if (!GameManager.SystemGoods.SystemXmlItemDict.TryGetValue(equipID, out systemGoods))
            {
                return(null);
            }

            ParseEquipProps(systemGoods, out equipPropItem);
            if (null != equipPropItem)
            {
                lock (_EquipPropsDict)
                {
                    _EquipPropsDict[equipID] = equipPropItem;
                }
            }

            return(equipPropItem);
        }
Exemple #7
0
        /// <summary>
        /// 解析装备属性
        /// </summary>
        /// <param name="systemGoods"></param>
        /// <param name="equipPropItem"></param>
        private void ParseEquipProps(SystemXmlItem systemGoods, out EquipPropItem equipPropItem)
        {
            equipPropItem = null;
            string props = systemGoods.GetStringValue("EquipProps");

            string[] fields = props.Split(',');
            if (fields.Length != (int)ExtPropIndexes.Max_Configed) //属性个数不符合
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("解析物品属性失败: EquipID={0}", systemGoods.GetIntValue("ID")));
                return;
            }

            double[] arryDoubles = null;

            try
            {
                arryDoubles = Global.StringArray2DoubleArray(fields);
            }
            catch (Exception)
            {
                LogManager.WriteLog(LogTypes.Error, string.Format("转换物品属性数组: EquipID={0}", systemGoods.GetIntValue("ID")));
                return;
            }

            equipPropItem = new EquipPropItem();
            //for (int i = 0; i < 5; i++)
            //{
            //    equipPropItem.BaseProps[i] = arryDoubles[i];
            //}

            for (int i = 0; i < (int)ExtPropIndexes.Max_Configed; i++)
            {
                equipPropItem.ExtProps[i] = arryDoubles[i];
            }
        }
Exemple #8
0
 public void ParseEquipProps(string props, out EquipPropItem equipPropItem)
 {
     equipPropItem = null;
     string[] fields = props.Split(new char[]
     {
         ','
     });
     if (fields.Length != 177)
     {
         LogManager.WriteLog(LogTypes.Error, string.Format("解析物品属性失败", new object[0]), null, true);
     }
     else
     {
         double[] arryDoubles = null;
         try
         {
             arryDoubles = Global.StringArray2DoubleArray(fields);
         }
         catch (Exception)
         {
             LogManager.WriteLog(LogTypes.Error, string.Format("转换物品属性数组", new object[0]), null, true);
             return;
         }
         equipPropItem = new EquipPropItem();
         for (int i = 0; i < 177; i++)
         {
             equipPropItem.ExtProps[i] = arryDoubles[i];
         }
     }
 }
Exemple #9
0
        /// <summary>
        /// 设置基础属性的值(数组)
        /// </summary>
        /// <param name="args"></param>
        public void SetBaseProps(params object[] args)
        {
            PropsCacheItem parent = PropsCacheRoot;
            PropsCacheItem child  = null;

            double[] props       = null;
            object   propsObject = null;

            if (args.Length > 1)
            {
                propsObject = args[args.Length - 1];
                EquipPropItem equipPropItem = args[args.Length - 1] as EquipPropItem;
                if (null != equipPropItem)
                {
                    props = equipPropItem.BaseProps;
                }
                else
                {
                    props = args[args.Length - 1] as double[];
                }
            }

            if (null == props)
            {
                return;
            }

            lock (PropsCacheRoot)
            {
                foreach (var obj in args)
                {
                    if (obj == propsObject)
                    {
                        if (child != null)
                        {
                            Contract.Assert(child.SubPropsItemDict.Count == 0, "only leaf node can set props!");
                            for (int i = 0; i < (int)UnitPropIndexes.Max && i < props.Length; i++)
                            {
                                child.SetBaseProp(i, props[i]);
                            }
                        }
                        break;
                    }
                    else
                    {
                        if (!parent.SubPropsItemDict.TryGetValue((int)obj, out child))
                        {
                            child = new PropsCacheItem(parent, Convert.ToInt32(obj));
                            parent.SubPropsItemDict.Add((int)obj, child);
                        }

                        parent = child;
                    }
                }
            }
        }
        /// <summary>
        /// 获取扩展属性接口
        /// </summary>
        /// <param name="bufferItemType"></param>
        /// <param name="extPropIndexe"></param>
        /// <returns></returns>
        public static double GetExtPropByGoodsID(BufferItemTypes bufferItemType, ExtPropIndexes extPropIndexe, int goodsID)
        {
            EquipPropItem item = GameManager.EquipPropsMgr.FindEquipPropItem(goodsID);

            if (null == item)
            {
                return(0.0);
            }

            return(item.ExtProps[(int)extPropIndexe]);
        }
Exemple #11
0
 public void UpdateRingAttr(GameClient client, bool bNeedUpdateSpouse = false, bool bIsLogin = false)
 {
     if (MarryLogic.IsVersionSystemOpenOfMarriage())
     {
         if (-1 != client.ClientData.MyMarriageData.nRingID)
         {
             if (-1 != client.ClientData.MyMarriageData.byMarrytype && -1 != client.ClientData.MyMarriageData.nSpouseID)
             {
                 GameClient   Spouseclient = GameManager.ClientMgr.FindClient(client.ClientData.MyMarriageData.nSpouseID);
                 MarriageData SpouseMarriageData;
                 if (null != Spouseclient)
                 {
                     SpouseMarriageData = Spouseclient.ClientData.MyMarriageData;
                 }
                 else
                 {
                     string tcpstring = string.Format("{0}", client.ClientData.MyMarriageData.nSpouseID);
                     SpouseMarriageData = Global.sendToDB <MarriageData, string>(10186, tcpstring, client.ServerId);
                 }
                 if (SpouseMarriageData != null && -1 != SpouseMarriageData.nRingID)
                 {
                     EquipPropItem myringitem        = GameManager.EquipPropsMgr.FindEquipPropItem(client.ClientData.MyMarriageData.nRingID);
                     EquipPropItem tmpmyringitem     = new EquipPropItem();
                     EquipPropItem spouseringitem    = GameManager.EquipPropsMgr.FindEquipPropItem(SpouseMarriageData.nRingID);
                     EquipPropItem tmpspouseringitem = new EquipPropItem();
                     for (int i = 0; i < tmpmyringitem.ExtProps.Length; i++)
                     {
                         tmpmyringitem.ExtProps[i]     = this.RingAttrJiSuan(client.ClientData.MyMarriageData.byGoodwilllevel, client.ClientData.MyMarriageData.byGoodwillstar, myringitem.ExtProps[i]);
                         tmpspouseringitem.ExtProps[i] = this.RingAttrJiSuan(SpouseMarriageData.byGoodwilllevel, SpouseMarriageData.byGoodwillstar, spouseringitem.ExtProps[i]);
                         tmpmyringitem.ExtProps[i]    += tmpspouseringitem.ExtProps[i] * this.dOtherRingmodulus;
                     }
                     client.ClientData.PropsCacheManager.SetExtProps(new object[]
                     {
                         PropsSystemTypes.MarriageRing,
                         tmpmyringitem.ExtProps
                     });
                     if (!bIsLogin)
                     {
                         GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);
                         GameManager.ClientMgr.NotifyOthersLifeChanged(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, true, false, 7);
                     }
                     if (bNeedUpdateSpouse)
                     {
                         if (null != Spouseclient)
                         {
                             this.UpdateRingAttr(Spouseclient, false, false);
                         }
                     }
                 }
             }
         }
     }
 }
Exemple #12
0
 public void ResetRingAttr(GameClient client)
 {
     if (-1 != client.ClientData.MyMarriageData.nRingID)
     {
         EquipPropItem tmpnullprop = new EquipPropItem();
         client.ClientData.PropsCacheManager.SetExtProps(new object[]
         {
             PropsSystemTypes.MarriageRing,
             tmpnullprop.ExtProps
         });
         GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);
         GameManager.ClientMgr.NotifyOthersLifeChanged(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, true, false, 7);
     }
 }
Exemple #13
0
        /// <summary>
        /// 重置婚戒属性 用于离婚后重置属性
        /// </summary>
        public void ResetRingAttr(GameClient client)
        {
            //必须先重置属性再清ringid
            if (-1 == client.ClientData.MyMarriageData.nRingID)
            {
                return;
            }

            EquipPropItem tmpnullprop = new EquipPropItem();

            //更新属性
            client.ClientData.PropsCacheManager.SetExtProps(PropsSystemTypes.MarriageRing, /*client.ClientData.MyMarriageData.nRingID,*/ tmpnullprop.ExtProps);

            // 通知客户端属性变化
            GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);
            // 总生命值和魔法值变化通知(同一个地图才需要通知)
            GameManager.ClientMgr.NotifyOthersLifeChanged(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);
        }
Exemple #14
0
 public void processEvent(EventObject eventObject)
 {
     if (eventObject.getEventType() == 18)
     {
         Monster    monster = (eventObject as MonsterBlooadChangedEventObject).getMonster();
         GameClient client  = (eventObject as MonsterBlooadChangedEventObject).getGameClient();
         if (monster != null && null != client)
         {
             if (client.ClientData.CopyMapID > 0 && client.ClientData.FuBenSeqID > 0 && MapTypes.MarriageCopy == Global.GetMapType(client.ClientData.MapCode) && MapTypes.MarriageCopy == Global.GetMapType(monster.CurrentMapCode))
             {
                 SystemXmlItem XMLItem = null;
                 if (this.ManAndWifeBossXmlItems.SystemXmlItemDict.TryGetValue(monster.MonsterInfo.ExtensionID, out XMLItem) && null != XMLItem)
                 {
                     if (XMLItem.GetIntValue("Need", -1) != (int)client.ClientData.MyMarriageData.byMarrytype)
                     {
                         BufferData bufferData = Global.GetMonsterBufferDataByID(monster, XMLItem.GetIntValue("GoodsID", -1));
                         if (bufferData == null || Global.IsBufferDataOver(bufferData, 0L))
                         {
                             double[] newActionParams = new double[]
                             {
                                 15.0,
                                 1.0
                             };
                             EquipPropItem item = GameManager.EquipPropsMgr.FindEquipPropItem(2000808);
                             if (null != item)
                             {
                                 newActionParams[1] = item.ExtProps[24];
                             }
                             Global.UpdateMonsterBufferData(monster, BufferItemTypes.MU_MARRIAGE_SUBDAMAGEPERCENTTIMER, newActionParams);
                             string text = string.Format(GLang.GetLang(484, new object[0]), client.ClientData.RoleName, monster.MonsterInfo.VSName);
                             GameManager.ClientMgr.BroadSpecialHintText(monster.CurrentMapCode, monster.CurrentCopyMapID, text);
                         }
                     }
                 }
             }
         }
     }
     else if (eventObject.getEventType() == 12)
     {
         GameClient client = (eventObject as PlayerLogoutEventObject).getPlayer();
         this.ClientExitRoom(client);
     }
 }
Exemple #15
0
        private EquipPropItem GetGroupProp(string strEffect)
        {
            if (string.IsNullOrEmpty(strEffect))
            {
                return(null);
            }

            EquipPropItem item = new EquipPropItem();

            string[] arrEffect = strEffect.Split('|');
            foreach (string effect in arrEffect)
            {
                string[] arr   = effect.Split(',');
                int      id    = (int)Enum.Parse(typeof(ExtPropIndexes), arr[0]);
                double   value = double.Parse(arr[1]);
                item.ExtProps[id] += value;
            }

            return(item);
        }
        /// <summary>
        /// 更新玩家的军旗Buff
        /// </summary>
        /// <param name="c"></param>
        /// <param name="item"></param>
        /// <param name="bufferID"></param>
        private void UpdateQiZhiBuff4GameClient(GameClient client, EquipPropItem item, int bufferID, bool add)
        {
            try
            {
                if (add && null != item)
                {
                    client.ClientData.PropsCacheManager.SetExtProps(PropsSystemTypes.BufferByGoodsProps, bufferID, item.ExtProps);
                    Global.UpdateBufferData(client, (BufferItemTypes)bufferID, RuntimeData.QiZhiBuffEnableParamsDict[bufferID], 1, true);
                }
                else
                {
                    client.ClientData.PropsCacheManager.SetExtProps(PropsSystemTypes.BufferByGoodsProps, bufferID, PropsCacheManager.ConstExtProps);//BufferItemTypes.MU_LangHunLingYu_QIZHI1
                    Global.UpdateBufferData(client, (BufferItemTypes)bufferID, RuntimeData.QiZhiBuffDisableParamsDict[bufferID], 1, true);
                }

                GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);
            }
            catch (System.Exception ex)
            {
                LogManager.WriteException(ex.ToString());
            }
        }
        /// <summary>
        /// 获取扩展属性接口
        /// </summary>
        /// <param name="bufferItemType"></param>
        /// <param name="extPropIndexe"></param>
        /// <returns></returns>
        public static double GetExtProp(BufferItemTypes bufferItemType, ExtPropIndexes extPropIndexe, int goodsIndex)
        {
            /// 根据BufferID获取缓存的物品ID列表
            int[] goodsIds = GetCachingIDsByID((int)bufferItemType);
            if (null == goodsIds)
            {
                return(0.0);
            }

            if (goodsIndex < 0 || goodsIndex >= goodsIds.Length)
            {
                return(0.0);
            }

            int           goodsID = goodsIds[goodsIndex];
            EquipPropItem item    = GameManager.EquipPropsMgr.FindEquipPropItem(goodsID);

            if (null == item)
            {
                return(0.0);
            }

            return(item.ExtProps[(int)extPropIndexe]);
        }
        public static void AddTempBufferProp(GameClient client, BufferItemTypes bufferID, int type)
        {
            EquipPropItem item = null;

            do
            {
                //判断此地图是否允许使用Buffer
                if (!Global.CanMapUseBuffer(client.ClientData.MapCode, (int)bufferID))
                {
                    break;
                }

                BufferData bufferData = Global.GetBufferDataByID(client, (int)bufferID);
                if (null == bufferData)
                {
                    break;
                }

                if (Global.IsBufferDataOver(bufferData))
                {
                    break;
                }

                int bufferGoodsId = 0;
                if (type == 0)
                {
                    // VIP处理 [4/10/2014 LiaoWei]
                    int goodsIndex = 0;
                    if (bufferID == BufferItemTypes.ZuanHuang)
                    {
                        goodsIndex = client.ClientData.VipLevel;
                    }
                    else
                    {
                        goodsIndex = (int)bufferData.BufferVal;
                    }

                    int[] goodsIds = GetCachingIDsByID((int)bufferID);
                    if (null == goodsIds)
                    {
                        break;
                    }

                    if (goodsIndex < 0 || goodsIndex >= goodsIds.Length)
                    {
                        break;
                    }

                    bufferGoodsId = goodsIds[goodsIndex];
                }
                else if (type == 1)
                {
                    bufferGoodsId = (int)bufferData.BufferVal;
                }

                if (bufferGoodsId > 0)
                {
                    item = GameManager.EquipPropsMgr.FindEquipPropItem(bufferGoodsId);
                }
            } while (false);

            if (null != item)
            {
                client.ClientData.PropsCacheManager.SetExtProps(PropsSystemTypes.BufferByGoodsProps, bufferID, item.ExtProps);
            }
            else
            {
                client.ClientData.PropsCacheManager.SetExtProps(PropsSystemTypes.BufferByGoodsProps, bufferID, PropsCacheManager.ConstExtProps);
            }
        }
Exemple #19
0
        /// <summary>
        /// 更新婚戒属性
        /// bNeedUpdateSpouse 更新配偶戒指属性
        /// </summary>
        public void UpdateRingAttr(GameClient client, bool bNeedUpdateSpouse = false, bool bIsLogin = false)
        {
            //功能未开启不增加婚戒属性
            if (!MarryLogic.IsVersionSystemOpenOfMarriage())
            {
                return;
            }

            //看看是否有婚戒
            if (-1 == client.ClientData.MyMarriageData.nRingID)
            {
                return;
            }

            //看看是不是结婚了 没结婚不会增加婚戒属性
            if (-1 == client.ClientData.MyMarriageData.byMarrytype ||
                -1 == client.ClientData.MyMarriageData.nSpouseID)
            {
                return;
            }

            //[bing] 如果发现配偶在线直接取数据
            MarriageData SpouseMarriageData = null;
            GameClient   Spouseclient       = GameManager.ClientMgr.FindClient(client.ClientData.MyMarriageData.nSpouseID);

            if (null != Spouseclient)
            {
                SpouseMarriageData = Spouseclient.ClientData.MyMarriageData;
            }
            else
            {
                //取一下情侣的数据 需要情侣婚戒数据
                string tcpstring = string.Format("{0}", client.ClientData.MyMarriageData.nSpouseID);
                SpouseMarriageData = Global.sendToDB <MarriageData, String>((int)TCPGameServerCmds.CMD_DB_GET_MARRY_DATA, tcpstring, client.ServerId);
            }

            //没有数据? 或者出错?
            if (null == SpouseMarriageData ||
                -1 == SpouseMarriageData.nRingID)
            {
                return;
            }

            //结婚后,夫妻双方享受自己婚戒的BUFF最终属性,和对方婚戒的30%的最终属性

            //先找到自己婚戒的最终属性
            EquipPropItem myringitem    = GameManager.EquipPropsMgr.FindEquipPropItem(client.ClientData.MyMarriageData.nRingID);
            EquipPropItem tmpmyringitem = new EquipPropItem();

            //找到自己伴侣婚戒的最终属性
            EquipPropItem spouseringitem    = GameManager.EquipPropsMgr.FindEquipPropItem(SpouseMarriageData.nRingID);
            EquipPropItem tmpspouseringitem = new EquipPropItem();

            //计算婚戒最终属性
            for (int i = 0; i < tmpmyringitem.ExtProps.Length; ++i)
            {
                tmpmyringitem.ExtProps[i]     = RingAttrJiSuan(client.ClientData.MyMarriageData.byGoodwilllevel, client.ClientData.MyMarriageData.byGoodwillstar, myringitem.ExtProps[i]);
                tmpspouseringitem.ExtProps[i] = RingAttrJiSuan(SpouseMarriageData.byGoodwilllevel, SpouseMarriageData.byGoodwillstar, spouseringitem.ExtProps[i]);
                tmpmyringitem.ExtProps[i]    += tmpspouseringitem.ExtProps[i] * dOtherRingmodulus;
            }

            //更新属性 [bing] 因为现在只有一个婚戒 所以不要记ID了 mark
            client.ClientData.PropsCacheManager.SetExtProps(PropsSystemTypes.MarriageRing, /*client.ClientData.MyMarriageData.nRingID,*/ tmpmyringitem.ExtProps);

            if (false == bIsLogin)
            {
                // 通知客户端属性变化
                GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);
                // 总生命值和魔法值变化通知(同一个地图才需要通知)
                GameManager.ClientMgr.NotifyOthersLifeChanged(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);
            }

            //如果情侣在线可能需要更新情侣的婚戒属性
            //取出情侣
            if (true == bNeedUpdateSpouse)
            {
                if (null != Spouseclient)
                {
                    UpdateRingAttr(Spouseclient, false);
                }
            }
        }
Exemple #20
0
        /// <summary>
        /// 设置扩展属性的值(数组)
        /// </summary>
        /// <param name="args">系统类型(int),子系统类型(int),...,属性值数组(double[])</param>
        public void SetExtProps(params object[] args)
        {
            PropsCacheItem parent = PropsCacheRoot;

            PropsCacheItem child = null;

            double[] props       = null;
            object   propsObject = null;

            try
            {
                if (args.Length > 1)
                {
                    propsObject = args[args.Length - 1];
                    EquipPropItem equipPropItem = propsObject as EquipPropItem;
                    if (null != equipPropItem)
                    {
                        props = equipPropItem.ExtProps;
                    }
                    else
                    {
                        props = args[args.Length - 1] as double[];
                    }
                }

                lock (PropsCacheRoot)
                {
                    foreach (var obj in args)
                    {
                        if (obj == propsObject)
                        {
                            if (child != null)
                            {
                                Contract.Assert(child.SubPropsItemDict.Count == 0, "only leaf node can set props!");
                                if (null != props)
                                {
                                    for (int i = 0; i < (int)ExtPropIndexes.Max && i < props.Length; i++)
                                    {
                                        child.SetExtProp(i, props[i]);
                                    }
                                }
                                else
                                {
                                    for (int i = 0; i < (int)ExtPropIndexes.Max; i++)
                                    {
                                        child.SetExtProp(i, 0);
                                    }
                                }
                            }

                            break;
                        }
                        else
                        {
                            if (!parent.SubPropsItemDict.TryGetValue((int)obj, out child))
                            {
                                child = new PropsCacheItem(parent, Convert.ToInt32(obj));
                                parent.SubPropsItemDict.Add((int)obj, child);
                            }

                            parent = child;
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                LogManager.WriteException(ex.ToString());
            }
        }
Exemple #21
0
        /// <summary>
        /// 解析通用的扩展属性加成配置,目前需要扩展属性
        /// </summary>
        /// <param name="str"></param>
        /// <param name="verifyColumn"></param>
        /// <param name="splitChar1"></param>
        /// <param name="splitChar2"></param>
        public static EquipPropItem ParseEquipPropItem(string str, bool verifyColumn = true, char splitChar1 = '|', char splitChar2 = ',', char splitChar3 = '-')
        {
            EquipPropItem equipPropItem = new EquipPropItem();

            if (!string.IsNullOrEmpty(str))
            {
                string[] propertyConfigArray = str.Split(splitChar1);
                foreach (var propertyConfigItem in propertyConfigArray)
                {
                    string[] nameValueArray = propertyConfigItem.Split(splitChar2);
                    if (nameValueArray.Length == 2)
                    {
                        ExtPropIndexes propIndex = ConfigParser.GetPropIndexByPropName(nameValueArray[0]);
                        if (propIndex < ExtPropIndexes.Max)
                        {
                            double propValue;
                            if (double.TryParse(nameValueArray[1], out propValue))
                            {
                                equipPropItem.ExtProps[(int)propIndex] = propValue;
                            }
                        }
                        else
                        {
                            //其他特殊配置类型
                            int propIndex0 = -1;
                            int propIndex1 = -1;
                            switch (nameValueArray[0])
                            {
                            case "Attack":
                            {
                                propIndex0 = (int)ExtPropIndexes.MinAttack;
                                propIndex1 = (int)ExtPropIndexes.MaxAttack;
                            }
                            break;

                            case "Mattack":
                            {
                                propIndex0 = (int)ExtPropIndexes.MinMAttack;
                                propIndex1 = (int)ExtPropIndexes.MaxMAttack;
                            }
                            break;

                            case "Defense":
                            {
                                propIndex0 = (int)ExtPropIndexes.MinDefense;
                                propIndex1 = (int)ExtPropIndexes.MaxDefense;
                            }
                            break;

                            case "Mdefense":
                            {
                                propIndex0 = (int)ExtPropIndexes.MinMDefense;
                                propIndex1 = (int)ExtPropIndexes.MaxMDefense;
                            }
                            break;
                            }

                            string[] valueArray = nameValueArray[1].Split(splitChar3);
                            double   propValue;
                            if (propIndex0 >= 0 && double.TryParse(valueArray[0], out propValue))
                            {
                                equipPropItem.ExtProps[propIndex0] = propValue;
                            }

                            if (propIndex1 >= 0 && double.TryParse(valueArray[1], out propValue))
                            {
                                equipPropItem.ExtProps[propIndex1] = propValue;
                            }
                        }
                    }
                }
            }

            return(equipPropItem);
        }
        /// <summary>
        /// 初始化配置
        /// </summary>
        public bool InitConfig()
        {
            bool     success          = true;
            XElement xml              = null;
            string   fileName         = "";
            string   fullPathFileName = "";
            IEnumerable <XElement> nodes;

            lock (RuntimeData.Mutex)
            {
                try
                {
                    //圣杯配置
                    RuntimeData.ShengBeiDataDict.Clear();

                    fileName         = "Config/HolyGrail.xml";
                    fullPathFileName = Global.GameResPath(fileName); //Global.IsolateResPath(fileName);
                    xml   = XElement.Load(fullPathFileName);
                    nodes = xml.Elements();
                    foreach (var node in nodes)
                    {
                        ShengBeiData item = new ShengBeiData();
                        item.ID        = (int)Global.GetSafeAttributeLong(node, "ID");
                        item.MonsterID = (int)Global.GetSafeAttributeLong(node, "MonsterID");
                        item.Time      = (int)Global.GetSafeAttributeLong(node, "Time");
                        item.GoodsID   = (int)Global.GetSafeAttributeLong(node, "GoodsID");
                        item.Score     = (int)Global.GetSafeAttributeLong(node, "Score");
                        item.PosX      = (int)Global.GetSafeAttributeLong(node, "PosX");
                        item.PosY      = (int)Global.GetSafeAttributeLong(node, "PosY");

                        EquipPropItem propItem = GameManager.EquipPropsMgr.FindEquipPropItem(item.GoodsID);
                        if (null != propItem)
                        {
                            item.BufferProps = propItem.ExtProps;
                        }
                        else
                        {
                            success = false;
                            LogManager.WriteLog(LogTypes.Fatal, "幻影寺院的圣杯Buffer的GoodsID在物品表中找不到");
                        }

                        RuntimeData.ShengBeiDataDict[item.ID] = item;
                    }

                    //出生点配置
                    RuntimeData.MapBirthPointDict.Clear();

                    fileName         = "Config/TempleMirageRebirth.xml";
                    fullPathFileName = Global.GameResPath(fileName); //Global.IsolateResPath(fileName);
                    xml   = XElement.Load(fullPathFileName);
                    nodes = xml.Elements();
                    foreach (var node in nodes)
                    {
                        HuanYingSiYuanBirthPoint item = new HuanYingSiYuanBirthPoint();
                        item.ID          = (int)Global.GetSafeAttributeLong(node, "ID");
                        item.PosX        = (int)Global.GetSafeAttributeLong(node, "PosX");
                        item.PosY        = (int)Global.GetSafeAttributeLong(node, "PosY");
                        item.BirthRadius = (int)Global.GetSafeAttributeLong(node, "BirthRadius");

                        RuntimeData.MapBirthPointDict[item.ID] = item;
                    }

                    //连杀配置
                    RuntimeData.ContinuityKillAwardDict.Clear();

                    fileName         = "Config/ContinuityKillAward.xml";
                    fullPathFileName = Global.GameResPath(fileName); //Global.IsolateResPath(fileName);
                    xml   = XElement.Load(fullPathFileName);
                    nodes = xml.Elements();
                    foreach (var node in nodes)
                    {
                        ContinuityKillAward item = new ContinuityKillAward();
                        item.ID    = (int)Global.GetSafeAttributeLong(node, "ID");
                        item.Num   = (int)Global.GetSafeAttributeLong(node, "Num");
                        item.Score = (int)Global.GetSafeAttributeLong(node, "Score");

                        RuntimeData.ContinuityKillAwardDict[item.Num] = item;
                    }

                    //活动配置
                    RuntimeData.MapCode = 0;

                    fileName         = "Config/TempleMirage.xml";
                    fullPathFileName = Global.GameResPath(fileName); //Global.IsolateResPath(fileName);
                    xml   = XElement.Load(fullPathFileName);
                    nodes = xml.Elements();
                    foreach (var node in nodes)
                    {
                        RuntimeData.MapCode       = (int)Global.GetSafeAttributeLong(node, "MapCode");
                        RuntimeData.MinZhuanSheng = (int)Global.GetSafeAttributeLong(node, "MinZhuanSheng");
                        RuntimeData.MinLevel      = (int)Global.GetSafeAttributeLong(node, "MinLevel");
                        RuntimeData.MinRequestNum = (int)Global.GetSafeAttributeLong(node, "MinRequestNum");
                        RuntimeData.MaxEnterNum   = (int)Global.GetSafeAttributeLong(node, "MaxEnterNum");

                        RuntimeData.WaitingEnterSecs = (int)Global.GetSafeAttributeLong(node, "WaitingEnterSecs");
                        RuntimeData.PrepareSecs      = (int)Global.GetSafeAttributeLong(node, "PrepareSecs");
                        RuntimeData.FightingSecs     = (int)Global.GetSafeAttributeLong(node, "FightingSecs");
                        RuntimeData.ClearRolesSecs   = (int)Global.GetSafeAttributeLong(node, "ClearRolesSecs");

                        if (!ConfigParser.ParserTimeRangeList(RuntimeData.TimePoints, Global.GetSafeAttributeStr(node, "TimePoints")))
                        {
                            success = false;
                            LogManager.WriteLog(LogTypes.Fatal, "读取幻影寺院时间配置(TimePoints)出错");
                        }

                        GameMap gameMap = null;
                        if (!GameManager.MapMgr.DictMaps.TryGetValue(RuntimeData.MapCode, out gameMap))
                        {
                            LogManager.WriteLog(LogTypes.Fatal, string.Format("缺少幻影寺院地图 {0}", RuntimeData.MapCode));
                        }

                        RuntimeData.MapGridWidth  = gameMap.MapGridWidth;
                        RuntimeData.MapGridHeight = gameMap.MapGridHeight;

                        break;
                    }

                    //奖励配置
                    RuntimeData.TempleMirageEXPAward = GameManager.systemParamsList.GetParamValueIntByName("TempleMirageEXPAward");
                    RuntimeData.TempleMirageWin      = (int)GameManager.systemParamsList.GetParamValueIntByName("TempleMirageWin");
                    RuntimeData.TempleMiragePK       = (int)GameManager.systemParamsList.GetParamValueIntByName("TempleMiragePK");
                    RuntimeData.TempleMirageMinJiFen = (int)GameManager.systemParamsList.GetParamValueIntByName("TempleMirageMinJiFen");

                    if (!ConfigParser.ParseStrInt2(GameManager.systemParamsList.GetParamValueByName("TempleMirageWinNum"), ref RuntimeData.TempleMirageWinExtraNum, ref RuntimeData.TempleMirageWinExtraRate))
                    {
                        success = false;
                        LogManager.WriteLog(LogTypes.Fatal, "读取幻影寺院多倍奖励配置(TempleMirageWin)出错");
                    }

                    if (!ConfigParser.ParseStrInt2(GameManager.systemParamsList.GetParamValueByName("TempleMirageAward"), ref RuntimeData.TempleMirageAwardChengJiu, ref RuntimeData.TempleMirageAwardShengWang))
                    {
                        success = false;
                        LogManager.WriteLog(LogTypes.Fatal, "读取幻影寺院多倍奖励配置(TempleMirageWin)出错");
                    }

                    List <List <int> > levelRanges = ConfigParser.ParserIntArrayList(GameManager.systemParamsList.GetParamValueByName("TempleMirageLevel"));
                    if (levelRanges.Count == 0)
                    {
                        success = false;
                        LogManager.WriteLog(LogTypes.Fatal, "读取幻影寺院等级分组配置(TempleMirageLevel)出错");
                    }
                    else
                    {
                        for (int i = 0; i < levelRanges.Count; i++)
                        {
                            List <int> range = levelRanges[i];
                            RuntimeData.Range2GroupIndexDict.Add(new RangeKey(Global.GetUnionLevel(range[0], range[1]), Global.GetUnionLevel(range[2], range[3])), i + 1);
                        }
                    }
                }
                catch (System.Exception ex)
                {
                    success = false;
                    LogManager.WriteLog(LogTypes.Fatal, string.Format("加载xml配置文件:{0}, 失败。", fileName), ex);
                }
            }

            return(success);
        }
        public void UpdateQiZhiBangHui(LangHunLingYuScene scene, int npcExtentionID, int bhid, string bhName, int zoneId)
        {
            int oldBHID  = 0;
            int bufferID = 0;

            lock (RuntimeData.Mutex)
            {
                for (int i = 0; i < scene.QiZhiBuffOwnerDataList.Count; i++)
                {
                    if (scene.QiZhiBuffOwnerDataList[i].NPCID == npcExtentionID)
                    {
                        oldBHID = scene.QiZhiBuffOwnerDataList[i].OwnerBHID;
                        scene.QiZhiBuffOwnerDataList[i].OwnerBHID     = bhid;
                        scene.QiZhiBuffOwnerDataList[i].OwnerBHName   = bhName;
                        scene.QiZhiBuffOwnerDataList[i].OwnerBHZoneId = zoneId;
                        break;
                    }
                }

                QiZhiConfig qiZhiConfig;
                if (RuntimeData.NPCID2QiZhiConfigDict.TryGetValue(npcExtentionID, out qiZhiConfig))
                {
                    bufferID = qiZhiConfig.BufferID;
                }
            }

            if (bhid == oldBHID)
            {
                return;
            }

            if (npcExtentionID == RuntimeData.SuperQiZhiNpcId)
            {
                scene.SuperQiZhiOwnerBhid = bhid;
            }

            try
            {
                EquipPropItem item = GameManager.EquipPropsMgr.FindEquipPropItem(bufferID);
                if (null != item)
                {
                    foreach (var copyMap in scene.CopyMapDict.Values)
                    {
                        List <GameClient> clientList = copyMap.GetClientsList();
                        for (int i = 0; i < clientList.Count; i++)
                        {
                            GameClient c = clientList[i] as GameClient;
                            if (c == null)
                            {
                                continue;
                            }

                            bool add = false;
                            if (c.ClientData.Faction == oldBHID)
                            {
                                add = false;
                            }
                            else if (c.ClientData.Faction == bhid)
                            {
                                add = true;
                            }

                            UpdateQiZhiBuff4GameClient(c, item, bufferID, add);
                        }
                    }
                }

                NotifyQiZhiBuffOwnerDataList(scene);
            }
            catch (System.Exception ex)
            {
                LogManager.WriteException("旗帜状态变化,设置旗帜Buff时发生异常:" + ex.ToString());
            }
        }
 public void RefreshProps(GameClient client, bool notifyPorpsChangeInfo = true)
 {
     if (!GameFuncControlManager.IsGameFuncDisabled(GameFuncType.System1Dot5))
     {
         int sumPetLevel       = 0;
         int findPetLevel      = 0;
         int sumPetTianFuNum   = 0;
         int findPetTianFuNum  = 0;
         int sumPetSkillLevel  = 0;
         int findPetSkillLevel = 0;
         List <PetSkillInfo>             petSkillList           = new List <PetSkillInfo>();
         EquipPropItem                   petLevelAwardItem      = null;
         EquipPropItem                   petTianFuAwardItem     = null;
         EquipPropItem                   petSkillAwardItem      = null;
         EquipPropItem                   petSkillLevelAwardItem = null;
         Dictionary <int, GoodsData>     havingPetDict          = new Dictionary <int, GoodsData>();
         Dictionary <int, EquipPropItem> groupPropItemDict      = new Dictionary <int, EquipPropItem>();
         List <GoodsData>                demonGoodsList         = DamonMgr.GetDemonGoodsDataList(client);
         foreach (GoodsData goodsData in demonGoodsList)
         {
             GoodsData existGoodsData;
             if (!havingPetDict.TryGetValue(goodsData.GoodsID, out existGoodsData))
             {
                 existGoodsData         = new GoodsData();
                 existGoodsData.GoodsID = goodsData.GoodsID;
                 existGoodsData.GCount  = 0;
                 havingPetDict[existGoodsData.GoodsID] = existGoodsData;
             }
             existGoodsData.GCount++;
             sumPetLevel     += goodsData.Forge_level + 1;
             sumPetTianFuNum += Global.GetEquipExcellencePropNum(goodsData);
             petSkillList.AddRange(PetSkillManager.GetPetSkillInfo(goodsData));
         }
         foreach (PetSkillInfo item in petSkillList)
         {
             sumPetSkillLevel += (item.PitIsOpen ? item.Level : 0);
         }
         lock (this.RuntimeData.Mutex)
         {
             foreach (PetLevelAwardItem item2 in this.RuntimeData.PetLevelAwardList)
             {
                 if (sumPetLevel >= item2.Level && item2.Level > findPetLevel)
                 {
                     findPetLevel      = item2.Level;
                     petLevelAwardItem = item2.PropItem;
                 }
             }
             foreach (PetTianFuAwardItem item3 in this.RuntimeData.PetTianFuAwardList)
             {
                 if (sumPetTianFuNum >= item3.TianFuNum && item3.TianFuNum > findPetTianFuNum)
                 {
                     findPetTianFuNum   = item3.TianFuNum;
                     petTianFuAwardItem = item3.PropItem;
                 }
             }
             foreach (PetGroupPropertyItem item4 in this.RuntimeData.PetGroupPropertyList)
             {
                 groupPropItemDict[item4.Id] = null;
                 bool avalid = true;
                 foreach (List <int> list in item4.PetGoodsList)
                 {
                     GoodsData existGoodsData;
                     if (!havingPetDict.TryGetValue(list[0], out existGoodsData) || existGoodsData.GCount < list[1])
                     {
                         avalid = false;
                         break;
                     }
                 }
                 if (avalid)
                 {
                     groupPropItemDict[item4.Id] = item4.PropItem;
                 }
             }
             foreach (PetSkillGroupInfo item5 in this.RuntimeData.PetSkillAwardList)
             {
                 int sum = 0;
                 using (List <int> .Enumerator enumerator8 = item5.SkillList.GetEnumerator())
                 {
                     while (enumerator8.MoveNext())
                     {
                         int p = enumerator8.Current;
                         IEnumerable <PetSkillInfo> temp = from info in petSkillList
                                                           where info.PitIsOpen && info.SkillID > 0 && info.SkillID == p
                                                           select info;
                         if (temp.Any <PetSkillInfo>())
                         {
                             sum += temp.Count <PetSkillInfo>();
                         }
                     }
                 }
                 if (sum < item5.SkillNum)
                 {
                     break;
                 }
                 petSkillAwardItem = item5.GroupProp;
             }
             foreach (PetSkillLevelAwardItem item6 in this.RuntimeData.PetSkillLevelAwardList)
             {
                 if (sumPetSkillLevel >= item6.Level && item6.Level > findPetSkillLevel)
                 {
                     findPetSkillLevel      = item6.Level;
                     petSkillLevelAwardItem = item6.PropItem;
                 }
             }
         }
         client.ClientData.PropsCacheManager.SetExtProps(new object[]
         {
             PropsSystemTypes.JingLingQiYuan,
             0,
             petLevelAwardItem
         });
         client.ClientData.PropsCacheManager.SetExtProps(new object[]
         {
             PropsSystemTypes.JingLingQiYuan,
             1,
             petTianFuAwardItem
         });
         foreach (KeyValuePair <int, EquipPropItem> groupPropItem in groupPropItemDict)
         {
             client.ClientData.PropsCacheManager.SetExtProps(new object[]
             {
                 PropsSystemTypes.JingLingQiYuan,
                 2,
                 groupPropItem.Key,
                 groupPropItem.Value
             });
         }
         client.ClientData.PropsCacheManager.SetExtProps(new object[]
         {
             PropsSystemTypes.JingLingQiYuan,
             3,
             petSkillAwardItem
         });
         client.ClientData.PropsCacheManager.SetExtProps(new object[]
         {
             PropsSystemTypes.JingLingQiYuan,
             4,
             petSkillLevelAwardItem
         });
         if (notifyPorpsChangeInfo)
         {
             GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);
             GameManager.ClientMgr.NotifyOthersLifeChanged(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, true, false, 7);
         }
     }
 }
Exemple #25
0
        public static EquipPropItem ParseEquipPropItem(string str, bool verifyColumn = true, char splitChar1 = '|', char splitChar2 = ',', char splitChar3 = '-')
        {
            EquipPropItem equipPropItem = new EquipPropItem();

            if (!string.IsNullOrEmpty(str))
            {
                string[] propertyConfigArray = str.Split(new char[]
                {
                    splitChar1
                });
                foreach (string propertyConfigItem in propertyConfigArray)
                {
                    string[] nameValueArray = propertyConfigItem.Split(new char[]
                    {
                        splitChar2
                    });
                    if (nameValueArray.Length == 2)
                    {
                        ExtPropIndexes propIndex = ConfigParser.GetPropIndexByPropName(nameValueArray[0]);
                        if (propIndex < ExtPropIndexes.Max)
                        {
                            double propValue;
                            if (double.TryParse(nameValueArray[1], out propValue))
                            {
                                equipPropItem.ExtProps[(int)propIndex] = propValue;
                            }
                        }
                        else
                        {
                            int    propIndex2 = -1;
                            int    propIndex3 = -1;
                            string text       = nameValueArray[0];
                            if (text != null)
                            {
                                if (!(text == "Attack"))
                                {
                                    if (!(text == "Mattack"))
                                    {
                                        if (!(text == "Defense"))
                                        {
                                            if (text == "Mdefense")
                                            {
                                                propIndex2 = 5;
                                                propIndex3 = 6;
                                            }
                                        }
                                        else
                                        {
                                            propIndex2 = 3;
                                            propIndex3 = 4;
                                        }
                                    }
                                    else
                                    {
                                        propIndex2 = 9;
                                        propIndex3 = 10;
                                    }
                                }
                                else
                                {
                                    propIndex2 = 7;
                                    propIndex3 = 8;
                                }
                            }
                            string[] valueArray = nameValueArray[1].Split(new char[]
                            {
                                splitChar3
                            });
                            double propValue;
                            if (propIndex2 >= 0 && double.TryParse(valueArray[0], out propValue))
                            {
                                equipPropItem.ExtProps[propIndex2] = propValue;
                            }
                            if (propIndex3 >= 0 && double.TryParse(valueArray[1], out propValue))
                            {
                                equipPropItem.ExtProps[propIndex3] = propValue;
                            }
                        }
                    }
                }
            }
            return(equipPropItem);
        }
Exemple #26
0
 private void UpdateBuff4GameClient(GameClient client, int bufferGoodsID, object tagInfo, bool add)
 {
     try
     {
         KarenBattleQiZhiConfig_East CrystalItem = tagInfo as KarenBattleQiZhiConfig_East;
         if (null != CrystalItem)
         {
             int             BuffTime     = 0;
             BufferItemTypes buffItemType = BufferItemTypes.None;
             if (null != CrystalItem)
             {
                 BuffTime     = CrystalItem.HoldTme;
                 buffItemType = BufferItemTypes.KarenEastCrystal;
             }
             KarenBattleScene scene;
             if (this.SceneDict.TryGetValue(client.ClientData.FuBenSeqID, out scene))
             {
                 EquipPropItem item = GameManager.EquipPropsMgr.FindEquipPropItem(bufferGoodsID);
                 if (null != item)
                 {
                     if (add)
                     {
                         double[] actionParams = new double[]
                         {
                             (double)BuffTime,
                             (double)bufferGoodsID
                         };
                         Global.UpdateBufferData(client, buffItemType, actionParams, 1, true);
                         client.ClientData.PropsCacheManager.SetExtProps(new object[]
                         {
                             PropsSystemTypes.BufferByGoodsProps,
                             bufferGoodsID,
                             item.ExtProps
                         });
                         string Key = this.BuildSceneBuffKey(client, bufferGoodsID);
                         scene.SceneBuffDict[Key] = new KarenBattleSceneBuff
                         {
                             RoleID   = client.ClientData.RoleID,
                             BuffID   = bufferGoodsID,
                             EndTicks = TimeUtil.NOW() + (long)(BuffTime * 1000),
                             tagInfo  = tagInfo
                         };
                         if (buffItemType == BufferItemTypes.KarenEastCrystal)
                         {
                             client.SceneContextData = tagInfo;
                         }
                     }
                     else
                     {
                         double[] array        = new double[2];
                         double[] actionParams = array;
                         Global.UpdateBufferData(client, buffItemType, actionParams, 1, true);
                         client.ClientData.PropsCacheManager.SetExtProps(new object[]
                         {
                             PropsSystemTypes.BufferByGoodsProps,
                             bufferGoodsID,
                             PropsCacheManager.ConstExtProps
                         });
                         Global.RemoveBufferData(client, (int)buffItemType);
                         string Key = this.BuildSceneBuffKey(client, bufferGoodsID);
                         scene.SceneBuffDict.Remove(Key);
                         if (buffItemType == BufferItemTypes.KarenEastCrystal)
                         {
                             client.SceneContextData = null;
                         }
                     }
                     GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteException(ex.ToString());
     }
 }
Exemple #27
0
        /// <summary>
        /// 重新计算和设置角色从精灵奇缘系统活动的属性
        /// </summary>
        /// <param name="client"></param>
        /// <param name="notifyPorpsChangeInfo"></param>
        public void RefreshProps(GameClient client, bool notifyPorpsChangeInfo = true)
        {
            // 如果1.5的功能没开放
            if (GameFuncControlManager.IsGameFuncDisabled(GameFuncType.System1Dot5))
            {
                return;
            }

            int sumPetLevel                  = 0;
            int findPetLevel                 = 0;
            int sumPetTianFuNum              = 0;
            int findPetTianFuNum             = 0;
            List <PetSkillInfo> petSkillList = new List <PetSkillInfo>();

            EquipPropItem petLevelAwardItem  = null;
            EquipPropItem petTianFuAwardItem = null;
            EquipPropItem petSkillAwardItem  = null;

            Dictionary <int, GoodsData>     havingPetDict     = new Dictionary <int, GoodsData>();
            Dictionary <int, EquipPropItem> groupPropItemDict = new Dictionary <int, EquipPropItem>();

            List <GoodsData> demonGoodsList = DamonMgr.GetDemonGoodsDataList(client);

            foreach (var goodsData in demonGoodsList)
            {
                GoodsData existGoodsData;
                if (!havingPetDict.TryGetValue(goodsData.GoodsID, out existGoodsData))
                {
                    existGoodsData         = new GoodsData();
                    existGoodsData.GoodsID = goodsData.GoodsID;
                    existGoodsData.GCount  = 0;
                    havingPetDict[existGoodsData.GoodsID] = existGoodsData;
                }

                existGoodsData.GCount++;
                sumPetLevel     += goodsData.Forge_level + 1; //潜规则,客户端显示的是这个值+1
                sumPetTianFuNum += Global.GetEquipExcellencePropNum(goodsData);

                petSkillList.AddRange(PetSkillManager.GetPetSkillInfo(goodsData));
            }

            lock (RuntimeData.Mutex)
            {
                //等级奇缘
                foreach (var item in RuntimeData.PetLevelAwardList)
                {
                    if (sumPetLevel >= item.Level && item.Level > findPetLevel)
                    {
                        findPetLevel      = item.Level;
                        petLevelAwardItem = item.PropItem;
                    }
                }

                //天赋奇缘
                foreach (var item in RuntimeData.PetTianFuAwardList)
                {
                    if (sumPetTianFuNum >= item.TianFuNum && item.TianFuNum > findPetTianFuNum)
                    {
                        findPetTianFuNum   = item.TianFuNum;
                        petTianFuAwardItem = item.PropItem;
                    }
                }

                //精灵组合
                foreach (var item in RuntimeData.PetGroupPropertyList)
                {
                    groupPropItemDict[item.Id] = null;
                    bool avalid = true;
                    foreach (var list in item.PetGoodsList)
                    {
                        GoodsData existGoodsData;
                        if (!havingPetDict.TryGetValue(list[0], out existGoodsData) || existGoodsData.GCount < list[1])
                        {
                            avalid = false;
                            break;
                        }
                    }

                    if (avalid)
                    {
                        groupPropItemDict[item.Id] = item.PropItem;
                    }
                }

                //精灵技能
                foreach (var item in RuntimeData.PetSkillAwardList)
                {
                    int sum = 0;
                    foreach (var p in item.SkillList)
                    {
                        var temp = from info in petSkillList
                                   where info.PitIsOpen && info.SkillID > 0 && info.SkillID == p
                                   select info;

                        if (temp.Any())
                        {
                            sum += temp.Count();
                        }
                    }

                    if (sum < item.SkillNum)
                    {
                        break;
                    }

                    petSkillAwardItem = item.GroupProp;
                }
            }

            client.ClientData.PropsCacheManager.SetExtProps(PropsSystemTypes.JingLingQiYuan, SubPropsTypes.Level, petLevelAwardItem);
            client.ClientData.PropsCacheManager.SetExtProps(PropsSystemTypes.JingLingQiYuan, SubPropsTypes.TianFuNum, petTianFuAwardItem);

            foreach (var groupPropItem in groupPropItemDict)
            {
                client.ClientData.PropsCacheManager.SetExtProps(PropsSystemTypes.JingLingQiYuan, SubPropsTypes.PetGroup, groupPropItem.Key, groupPropItem.Value);
            }

            client.ClientData.PropsCacheManager.SetExtProps(PropsSystemTypes.JingLingQiYuan, SubPropsTypes.PetSkill, petSkillAwardItem);

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

                // 总生命值和魔法值变化通知(同一个地图才需要通知)
                GameManager.ClientMgr.NotifyOthersLifeChanged(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client);
            }
        }
        public static void AddTempBufferProp(GameClient client, BufferItemTypes bufferID, int type)
        {
            EquipPropItem item = null;

            if (Global.CanMapUseBuffer(client.ClientData.MapCode, (int)bufferID))
            {
                BufferData bufferData = Global.GetBufferDataByID(client, (int)bufferID);
                if (null != bufferData)
                {
                    if (!Global.IsBufferDataOver(bufferData, 0L))
                    {
                        int bufferGoodsId = 0;
                        if (type == 0)
                        {
                            int goodsIndex;
                            if (bufferID == BufferItemTypes.ZuanHuang)
                            {
                                goodsIndex = client.ClientData.VipLevel;
                            }
                            else
                            {
                                goodsIndex = (int)bufferData.BufferVal;
                            }
                            int[] goodsIds = AdvanceBufferPropsMgr.GetCachingIDsByID((int)bufferID);
                            if (null == goodsIds)
                            {
                                goto IL_F8;
                            }
                            if (goodsIndex < 0 || goodsIndex >= goodsIds.Length)
                            {
                                goto IL_F8;
                            }
                            bufferGoodsId = goodsIds[goodsIndex];
                        }
                        else if (type == 1)
                        {
                            bufferGoodsId = (int)bufferData.BufferVal;
                        }
                        if (bufferGoodsId > 0)
                        {
                            item = GameManager.EquipPropsMgr.FindEquipPropItem(bufferGoodsId);
                        }
                    }
                }
            }
IL_F8:
            if (null != item)
            {
                client.ClientData.PropsCacheManager.SetExtProps(new object[]
                {
                    PropsSystemTypes.BufferByGoodsProps,
                    bufferID,
                    item.ExtProps
                });
            }
            else
            {
                client.ClientData.PropsCacheManager.SetExtProps(new object[]
                {
                    PropsSystemTypes.BufferByGoodsProps,
                    bufferID,
                    PropsCacheManager.ConstExtProps
                });
            }
        }